XIII
Class XIIIPlayerController

source: C:\XIII\XIII\Classes\XIIIPlayerController.uc
Core.Object
   |
   +--Engine.Actor
      |
      +--Engine.Controller
         |
         +--Engine.PlayerController
            |
            +--XIII.XIIIPlayerController
Direct Known Subclasses:XIIIMPPlayerController

class XIIIPlayerController
extends Engine.PlayerController

//----------------------------------------------------------- // //-----------------------------------------------------------
Variables
 Actor CamView
           Used for viewing through a cam.
 int CamViewMode
           time cumul
 HookPoint ClimbHookPoint
           HP to use when climbing up at top of the rope
 eDrawType DT_mem
           Used for viewing through a cam.
 vector DoorClimbMove
           Movement if climbing door to check the end of climb.
 vector DoorLockedNormal
           used for climbing doors
 vector DoorLockedPos
           used for climbing doors
 Actor DoorToClimb
           Door that is climbed
 ForceFeedbackController FFController
           For ForceFeedBack controls
 color FilterColor
           La couleur courante.
 float FilterColorSpeed
           La vitesse de convergence.
 color FilterColorWanted
           La couleur vers laquelle le moteur doit converger.
 Hook HookUsed
           the hook used when in Hooked State
 XIIIPlayerInteraction MyInteraction
           used for climbing doors
 string MyInteractionClass
           because color.a is int & we need float
 vector OldDoorClimbPos
           used for climbing doors
 XIIIItems OldItem
           to memorize Item when climbing doors
 byte OldWeap
           to memorize weapon when switching weapons/items modes
 OnoFalling OnoF
           used for climbing doors
 float SniperPitch
           Used for the breath movement in sniping zoom.
 float SniperYaw
           Used for the breath movement in sniping zoom.
 string StatsMem
           the string that will be used to memorize stats on clients
 HookNavPoint TargetHookClimb
           HNP to climb to
 VideoPlayer VP
           Used to play videos
 float VignetteAlpha
           because color.a is int & we need float
 float VignetteAlphaDecFactor
           Used for flash SFXs (FlashBang
 float VignetteFlashDecFactor
           Used for flash SFXs (FlashBang)
 float VignetteSFXduration
           Used for flash SFXs (FlashBang
 XIIIPorte aDoor
           Door to be lockpicked
 bool bAltZoomingSystem
           Used to block weapon switch while climbing doors.
 bool bCheckTurnSpeed
           check turning speed
 bool bCheckTurnSpeed
           check turning speed
 bool bFixedCrosshair
           Player is hooked (to use it in walk/swim
 bool bFloatingCrosshair
           Player is hooked (to use it in walk/swim
 bool bHooked
           Player is hooked (to use it in walk/swim
 bool bMenuIsActive
           If true, no other display allowed
 bool bOkForMoving
           Used to wait for first rendered frame (first postrender called) to activate player movement (else will be able to move while init).
 bool bPickingUp
           Bool to validate the GameInfo HandlePickupQuery
 bool bPressedDuck
           Used to block weapon switch while climbing doors.
 bool bRenderPortal
           if true, then rotation will be assisted by a 'lock' when strafing around target (Halo-like)
 bool bRotationAssist
           if true, then rotation will be assisted by a 'lock' when strafing around target (Halo-like)
 bool bTurnWanted
           For 90/180 turns
 bool bWaitForWeaponMode
           true if waiting for a changedweapon order
 bool bWeaponBlock
           Used to block weapon switch while climbing doors.
 bool bWeaponMode
           true if weapons are active, false if items are active
 float fCamViewPercent
           time cumul
 float fCrosshairSize
           0 = off, 1 = On on target, 2 = always on.
 float fSniperPrecision
           Used for the breath movement in sniping zoom.
 float fTurnDeltaTime
           time cumul
 float fTurnDeltaTime
           time cumul
 int fTurnInc
           store turning values (90/180/270/360/720
 float fTurnSpeed[5]
           store turning values (90/180/270/360/720
 float fTurnSpeed[5]
           store turning values (90/180/270/360/720
 float fTyrolSpeed
           For Tyrol Behaviour
 sound hCLimbDoorSound
           used for climbing doors
 sound hCamViewBeginUseSound
           used for climbing doors
 sound hCamViewInUseSound
           used for climbing doors
 sound hEndClimbDoorSound
           used for climbing doors
 sound hEndClimbLadderSound
           used for climbing doors
 sound hTyrolEndSound
           because color.a is int & we need float
 sound hTyrolStartSound
           because color.a is int & we need float
 int iCrosshairMode
           0 = off, 1 = On on target, 2 = always on.
 int iGameEndedRandEffect
           used for climbing doors
 MultiViewport multiViewport
           time cumul
 rotator rGameEndedCamRot
           used for climbing doors
 vector vGameEndedCamLoc
           used for climbing doors
 vector vSniperOffset
           Used for the breath movement in sniping zoom.
 vector vSniperOffsetSpeed
           Used for the breath movement in sniping zoom.
 vTyrolEnd, vTyrolDir
           For Tyrol Behaviour
 vector vWeaponFeedBack
           to simulate weapon feed back while firing
 vector vWeaponFeedBackReturn
           to return to normal pos after firing
 XboxLiveManager xboxlive
           time cumul

States
Kicked, NoMove, NoRotation, WaitForFirstDisplay, NoControl, PlayingVideo, GameEndedSuccess, GameEndedFalling, GameEndedDrown, GameEndedDeath, GameEnded, ClimbToHookNavPoint, OldItem, OldItem, PlayerGunning, ClimbDoor, MayClimbDoor, CameraView, BossView, Tyroling, Hooked, PlayerSwimming, PlayerWalking, PlayerClimbing

Function Summary
 void AAM(int i)
     
//_____________________________________________________________________________
 void ActivateItem()
     
//_____________________________________________________________________________
// The player wants to active selected item
 rotator AdjustAim(Ammunition FiredAmmunition, vector projStart, int AimCalcMode)
     
// ELR computes AimSpot and return rotator(AimSpot - projStart)
//Simulated function rotator AdjustAim(float projSpeed, vector projStart, int aimerror, bool bLeadTarget, bool bWarnTarget, bool bTossed, bool bTrySplash)
// AimCalcMode is used as 0 = weapon firing, 1 = interface aim anticipation
 void AdjustView(float DeltaTime)
     
//_____________________________________________________________________________
// ELR made zooming speed higher
 bool AllowHooking()
     
//_____________________________________________________________________________
 void AltFire(optional float)
     
//_____________________________________________________________________________
 void AutoPickup(bool b)
     
//_____________________________________________________________________________
 void BehindView(Bool B)
     
//____________________________________________________________________________
// ELR Override this
 bool CanUseLockPick()
     
//_____________________________________________________________________________
// ELR - Do we still pick the lock ? return true if no.
 void CancelPickLock()
     
//_____________________________________________________________________________
// ELR - Do we still pick the lock ? return true if no.
 void ChangeSkin(string NewSkinCode)
     
//_____________________________________________________________________________
 bool CheckPickLock()
     
//_____________________________________________________________________________
// ELR - Do we still pick the lock ? return true if no.
 
simulated
ClientAddDamageWarn(int RelativeHitLoc)
     
//____________________________________________________________________
 void ClientGameEnded()
     
//_____________________________________________________________________________
 void ClientRestart()
     
//_____________________________________________________________________________
 void ClientSetBehindView(bool B)
 void ClientTargetHighLight(int Alpha, float TargetHighLight, float Duration)
     
//_____________________________________________________________________________
 void CrosshairMode(int i)
     
//_____________________________________________________________________________
exec 
 void CrosshairSize(Float f)
     
//_____________________________________________________________________________
 void DBInput(bool b)
     
//_____________________________________________________________________________
exec 
 void DBTurn()
     
//_____________________________________________________________________________
exec 
 void DetailLevel(int i)
     
//_____________________________________________________________________________
 void DisplayDebug(Canvas C, out float, out float)
     
//_____________________________________________________________________________
 void DoHideHUD(bool B)
     
//_____________________________________________________________________________
 void Duck(optional float)
     
//_____________________________________________________________________________
 void EnterStartState()
     
//_____________________________________________________________________________
 void Fire(optional float)
     
//_____________________________________________________________________________
// The player wants to fire.
 void FixCrosshairMode(int i)
     
//_____________________________________________________________________________
exec 
 void FloatCrosshairMode(int i)
     
//_____________________________________________________________________________
exec 
 void FlowerPower(int i)
     
//_____________________________________________________________________________
 void ForceReload()
     
//_____________________________________________________________________________
// can't reload if have grabbed corpse/pawn
 void GoClimbHookNavPoint(HookPoint HP, HookNavPoint HNP)
     
//_____________________________________________________________________________
// at top of a rope, climb up to the hooknavpoint
 void GoHooking(Hook H)
     
//_____________________________________________________________________________
// ELR - Here we send the controller into hooked state
 void GoTyroling(XIIITyrolNavPoint StartPoint, XIIITyrolNavPoint EndPoint, float TyrolSpeed)
     
//_____________________________________________________________________________
// Set up the tyroling params, called by TyrolTrigger
 void GoreLevel(int i)
     
//_____________________________________________________________________________
 void Grab()
     
//_____________________________________________________________________________
 void HideWeapon()
     
//_____________________________________________________________________________
// ELR hide/unhide Weapon (Used by the DecoWeapon to hide weapon then put it back when used)
 void ImBoss()
     
//_____________________________________________________________________________
exec 
 void Jump(optional float)
     
//_____________________________________________________________________________
// Normal gameplay execs
// Type the name of the exec function at the console to execute it
 void KillTarget(int i)
     
//_____________________________________________________________________________
 void LogInteraction()
     
//_____________________________________________________________________________
exec 
 void LogInteractives()
     
//_____________________________________________________________________________
exec 
 
simulated
MatchStarting()
     
//_____________________________________________________________________________
// called when gameplay actually starts
 bool NearWall(float walldist)
     
//_____________________________________________________________________________
// ELR
 void NextWeapon()
     
//_____________________________________________________________________________
 void PawnDied()
     
//_____________________________________________________________________________
// ::DBUG::
 void PrevWeapon()
     
//_____________________________________________________________________________
 void QuickHeal()
     
//_____________________________________________________________________________
 void ReLoad()
     
//_____________________________________________________________________________
// ELR Use the ForceReload function of base weapons functions
 
simulated
RenderScreenOverlays(Canvas C)
     
//_____________________________________________________________________________
 void RestartLevel()
     
//_____________________________________________________________________________
 void RestoreView()
     
//_____________________________________________________________________________
 Actor ReturnTrace(out vector, out vector, vector End, vector Start, bool bActor, optional vector, optional out, optional int)
     
//_____________________________________________________________________________
// ::TODO:: put in native (may not optimize the trace but everytinh else & called each frame so...)
 void RumbleFX(int FXNum)
     
//_____________________________________________________________________________
// Setup the ForceFeedbackController
 void SearchPawn(XIIIPawn P)
     
//_____________________________________________________________________________
 void SelectWeapon(byte F)
     
//_____________________________________________________________________________
// The player wants to switch to weapon group number F.
 void ServerUpdateSkin(string NewSkinCode)
     
//_____________________________________________________________________________
 void SetCamView(Actor C, optional float)
     
//_____________________________________________________________________________
 void SetCamViewPortal(Actor C, optional float)
 void SetRumbleFX(bool B)
     
//_____________________________________________________________________________
// Setup the ForceFeedbackController
 void SetZoomSystem(bool B)
     
//_____________________________________________________________________________
exec 
 void ShowInfo()
 void ShowMenu()
     
//_____________________________________________________________________________
 void SpawnDefaultHUD()
     
//_____________________________________________________________________________
// SpawnDefaultHUD()
// Spawn a HUD (make sure that PlayerController always has valid HUD, even if
//  ClientSetHUD() hasn't been called
 void StatUpdate()
     
//_____________________________________________________________________________
 void SwitchWeapon(byte F)
     
//_____________________________________________________________________________
// we want the player to switch to weapon group number F.
 
simulated
SwitchWeaponMode()
     
//_____________________________________________________________________________
// ELR hide/unhide Weapon
 void Teleport(name N)
     
//_____________________________________________________________________________
exec 
 void TeleportNext()
     
/*
exec 
 void TestNI()
     
//_____________________________________________________________________________
exec 
 bool TryClimbDoor(Actor pDoorLocked, vector pDoorLockedPos, vector pDoorLockedNormal)
     
//_____________________________________________________________________________
 Powerups TryInteractWithDoor(Actor A)
     
//_____________________________________________________________________________
// return the inventory object to be used to interact with A
// should be used w/ Grab Controller function to automatically get the item out.
 Powerups TryInteractWithTrigger(Actor A)
     
//_____________________________________________________________________________
// return the inventory object to be used to interact with A
// should be used w/ Grab Controller function to automatically get the item out.
 bool TryPickLock()
     
//_____________________________________________________________________________
// ELR - Here we define if the controller allow the use of a lockpick
 bool TryTyroling()
     
//_____________________________________________________________________________
// ELR - check if we can send the controller into Tyrol state
 void TurnAround()
     
//_____________________________________________________________________________
// ELR Added to make b180Left and b180Right working.
// (Actually used as b90Left and b90Right :)
 void UnFire(optional float)
     
//_____________________________________________________________________________
// The player Release fire.
 void UpdateRotation(float DeltaTime, float maxPitch)
     
//_____________________________________________________________________________
 void WeaponZoom()
     
//_____________________________________________________________________________
 void cNextItem()
     
//_____________________________________________________________________________
// ELR Just to cancel it in some states
 void cPrevItem()
     
//_____________________________________________________________________________
// ELR Just to cancel it in some states


State Kicked Function Summary
 void PlayerMove(float DeltaTime)
 void UpdateRotation(float DeltaTime, float maxPitch)


State NoMove Function Summary
 void PlayerMove(float DeltaTime)


State NoRotation Function Summary
 void UpdateRotation(float DeltaTime, float maxPitch)
     
// Anticrash if target actor was a breakable mover
//      Log("NoControl End State");
    }

    


State WaitForFirstDisplay Function Summary
 void PlayerMove(float DeltaTime)
 void UpdateRotation(float DeltaTime, float maxPitch)


State NoControl Function Summary
 void PlayerMove(float DeltaTime)
     
//      Log("NoControl End State");
    }


    event PlayerCalcView(out actor ViewActor, out vector CameraLocation, out rotator CameraRotation )
    {
      Log("NoControl PlayerCalcView");
    	ViewActor = ViewTarget;
      CameraLocation = Location;
      CameraRotation = Rotation;
    }
*/
 void UpdateRotation(float DeltaTime, float maxPitch)


State PlayingVideo Function Summary
 void Fire(optional float)


State GameEndedSuccess Function Summary


State GameEndedFalling Function Summary
 void EndState()
     
// dont replay the GameEnded BeginState()
 void BeginState()


State GameEndedDrown Function Summary
 void BeginState()


State GameEndedDeath Function Summary
 void BeginState()


State GameEnded Function Summary
 void BeginState()
 void Timer()
 void FindGoodView()
 void ServerMove(float TimeStamp, vector InAccel, vector ClientLoc, bool NewbRun, bool NewbDuck, bool NewbJumpStatus, eDoubleClickDir DoubleClickMove, byte ClientRoll, int View, optional byte, optional int)
 void PlayerMove(float DeltaTime)
     
    {
      Fire(F);
    }
*/
 void AltFire(optional float)
     
    {
      if ( Role < ROLE_Authority)
        return;
      if ( !bFrozen )
        ServerReStartGame();
      else if ( TimerRate <= 0 )
        SetTimer(1.5, false);
    }

    exec 
 void Fire(optional float)
     
/*
    exec 
 void AltFire(optional float)
 void Fire(optional float)
     
// ELR E3 CHEAT
 void ServerReStartGame()
 bool IsInLethalVolume(out optional)
 void ThrowWeapon()
 void PawnDied()


State ClimbToHookNavPoint Function Summary
 void ProcessMove(float DeltaTime, vector NewAccel, eDoubleClickDir DoubleClickMove, rotator DeltaRot)
 void EndState()
 void BeginState()


State OldItem Function Summary
 void Fire(float value)
 void AltFire(float value)
 void Grab()
 void PlayerMove(float DeltaTime)
 void Leave()


State OldItem Function Summary


State PlayerGunning Function Summary
 void EndState()
 void BeginState()


State ClimbDoor Function Summary
 void ProcessMove(float DeltaTime, vector NewAccel, eDoubleClickDir DoubleClickMove, rotator DeltaRot)
 void EndState()


State MayClimbDoor Function Summary
 void Timer()
 void BeginState()


State CameraView Function Summary
 void EndState()
 void BeginState()


State BossView Function Summary
 void EndState()
 void BeginState()


State Tyroling Function Summary
 void ProcessMove(float DeltaTime, vector NewAccel, eDoubleClickDir DoubleClickMove, rotator DeltaRot)
     
//__________________
 void PlayerMove(float DeltaTime)
     
//__________________
 void EndState()
 void BeginState()


State Hooked Function Summary
 void ProcessMove(float DeltaTime, vector NewAccel, eDoubleClickDir DoubleClickMove, rotator DeltaRot)
     
// ELR 2nd ProcessMove, trying to get rid of vel/acc and setting the player's pos
    
 void PlayerMove(float DeltaTime)
     
//_________________
    
 void EndState()
     
    {
      Pawn.bCanCrouch=False;
      Pawn.bCanClimbLadders=False;
      bPressedDuck=false;
    }
    
 void BeginState()
     
extends PlayerWalking
{
    


State PlayerSwimming Function Summary
 void EndState()
 void BeginState()
 bool NotifyPhysicsVolumeChange(PhysicsVolume NewVolume)
 void PlayerMove(float DeltaTime)
 void ProcessMove(float DeltaTime, vector NewAccel, eDoubleClickDir DoubleClickMove, rotator DeltaRot)


State PlayerWalking Function Summary
 void PlayerMove(float DeltaTime)
 void ProcessMove(float DeltaTime, vector NewAccel, eDoubleClickDir DoubleClickMove, rotator DeltaRot)


State PlayerClimbing Function Summary
 void ProcessMove(float DeltaTime, vector NewAccel, eDoubleClickDir DoubleClickMove, rotator DeltaRot)
 void EndState()
 void BeginState()



Source Code


00001	//-----------------------------------------------------------
00002	//
00003	//-----------------------------------------------------------
00004	class XIIIPlayerController extends PlayerController;
00005	
00006	var bool bTurnWanted;           // For 90/180 turns
00007	var bool bWeaponMode;           // true if weapons are active, false if items are active
00008	var bool bWaitForWeaponMode;    // true if waiting for a changedweapon order
00009	var bool bPickingUp;            // Bool to validate the GameInfo HandlePickupQuery
00010	var bool bWeaponBlock;          // Used to block weapon switch while climbing doors.
00011	var bool bPressedDuck;
00012	var config bool bAltZoomingSystem;
00013	var bool bHooked;               // Player is hooked (to use it in walk/swim
00014	var config bool bFixedCrosshair;
00015	var config bool bFloatingCrosshair;
00016	
00017	var bool bMenuIsActive;         // If true, no other display allowed
00018	var config bool bRotationAssist;// if true, then rotation will be assisted by a 'lock' when strafing around target (Halo-like)
00019	// SE XBox Specific, for Cameras portal rendering
00020	var bool bRenderPortal;
00021	var bool bOkForMoving;          // Used to wait for first rendered frame (first postrender called) to activate player movement (else will be able to move while init).
00022	
00023	/*
00024	var config bool bCheckTurnSpeed;// check turning speed
00025	var float fTurnSpeed[5];        // store turning values (90/180/270/360/720°)
00026	var int fTurnInc;
00027	var float fTurnDeltaTime;       // time cumul
00028	*/
00029	
00030	var float fCamViewPercent;
00031	var int CamViewMode;
00032	var MultiViewport multiViewport;
00033	// SE Xbox End
00034	var XboxLiveManager xboxlive;
00035	var string StatsMem;            // the string that will be used to memorize stats on clients
00036	
00037	var byte OldWeap;               // to memorize weapon when switching weapons/items modes
00038	var XIIIItems OldItem;          // to memorize Item when climbing doors
00039	var XIIIPorte aDoor;            // Door to be lockpicked
00040	
00041	var float SniperYaw;            // Used for the breath movement in sniping zoom.
00042	var float SniperPitch;          // Used for the breath movement in sniping zoom.
00043	var float fSniperPrecision;     // Used for the breath movement in sniping zoom.
00044	var vector vSniperOffset;       // Used for the breath movement in sniping zoom.
00045	var vector vSniperOffsetSpeed;  // Used for the breath movement in sniping zoom.
00046	
00047	var Hook HookUsed;              // the hook used when in Hooked State
00048	var HookPoint ClimbHookPoint;   // HP to use when climbing up at top of the rope
00049	var HookNavPoint TargetHookClimb; // HNP to climb to
00050	
00051	var vector vTyrolStart, vTyrolEnd, vTyrolDir;     // For Tyrol Behaviour
00052	var float fTyrolSpeed;                            // For Tyrol Behaviour
00053	
00054	var eDrawType DT_mem;           // Used for viewing through a cam.
00055	var actor CamView;              // Used for viewing through a cam.
00056	
00057	var actor DoorToClimb;          // Door that is climbed
00058	var vector DoorLockedNormal;    // used for climbing doors
00059	var vector DoorLockedPos;       // used for climbing doors
00060	var vector DoorClimbMove;       // Movement if climbing door to check the end of climb.
00061	var vector OldDoorClimbPos;     // used for climbing doors
00062	
00063	var XIIIPlayerInteraction MyInteraction;
00064	var sound hCLimbDoorSound;
00065	var sound hEndClimbDoorSound;
00066	
00067	// EndGame Vars
00068	var vector vGameEndedCamLoc;
00069	var rotator rGameEndedCamRot;
00070	var int iGameEndedRandEffect;
00071	var OnoFalling OnoF;
00072	
00073	var sound hCamViewBeginUseSound;
00074	var sound hCamViewInUseSound;
00075	//var sound hCamViewEndUseSound;
00076	
00077	var sound hEndClimbLadderSound;
00078	//var sound hEnteringWaterSound;
00079	//var sound hExitingWaterSound;
00080	
00081	var vector vWeaponFeedBack;       // to simulate weapon feed back while firing
00082	var vector vWeaponFeedBackReturn; // to return to normal pos after firing
00083	
00084	var ForceFeedbackController FFController;   // For ForceFeedBack controls
00085	var VideoPlayer VP;               // Used to play videos
00086	
00087	var float VignetteFlashDecFactor; // Used for flash SFXs (FlashBang)
00088	var float VignetteAlphaDecFactor; // Used for flash SFXs (FlashBang
00089	var float VignetteSFXduration;    // Used for flash SFXs (FlashBang
00090	var float VignetteAlpha;          // because color.a is int & we need float
00091	
00092	var string MyInteractionClass;
00093	
00094	var sound hTyrolStartSound;
00095	var sound hTyrolEndSound;
00096	
00097	var globalconfig int iCrosshairMode;    // 0 = off, 1 = On on target, 2 = always on.
00098	var globalconfig float fCrosshairSize;
00099	
00100	//_____________________________________________________________________________
00101	// ELR Replicate things
00102	replication
00103	{
00104	    // Variables the server should send to the client.
00105	    reliable if ( Role==ROLE_Authority )
00106	      bWeaponMode, bWaitForWeaponMode, ClientTargetHighLight;
00107	
00108	    // Functions the server should send to the client.
00109	  	unreliable if( Role==ROLE_Authority )
00110	      ClientViewFeedBackSetup, ClientAddDamageWarn;
00111	
00112	  	reliable if( Role<ROLE_Authority )
00113	  	  ServerUpdateSkin;
00114	}
00115	
00116	//_____________________________________________________________________________
00117	// The player wants to switch to weapon group number F.
00118	exec function SelectWeapon( byte F )
00119	{
00120	    local weapon newWeapon;
00121	
00122	    if ( Pawn.region.Zone.FlashEffectDesc.IsActivated )
00123	      return;
00124	    if ( (Pawn.PendingWeapon != none) && (DecoWeapon(Pawn.PendingWeapon) != none) )
00125	      return;
00126	    if ( (Level.Pauser!=None) || (Pawn == None) || (Pawn.Inventory == None) )
00127	      return;
00128	
00129	    if ( (Pawn.Weapon != None) && (Pawn.Weapon.Inventory != None) )
00130	      newWeapon = Pawn.Weapon.Inventory.WeaponSelect(F);
00131	    else
00132	      newWeapon = None;
00133	    if ( newWeapon == None )
00134	      newWeapon = Pawn.Inventory.WeaponSelect(F);
00135	
00136	    if ( newWeapon == None )
00137	      return;
00138	
00139	//    Log("SelectWeapon"@NewWeapon);
00140	    if ( Pawn.Weapon == None )
00141	    {
00142	//      Log("  No Weapon");
00143	      if ( bWeaponMode )
00144	      {
00145	        if ( Pawn.Weapon != newWeapon )
00146	        {
00147	          Pawn.PendingWeapon = newWeapon;
00148	          Pawn.ChangedWeapon();
00149	        }
00150	      }
00151	      else if ( !bWaitForWeaponMode )
00152	      {
00153	        XIIIBaseHud(MyHud).fDrawWeaponsTimer = Level.TimeSeconds+2.0;
00154	        bWaitForWeaponMode = true;
00155	        Pawn.Weapon = NewWeapon;
00156	        SwitchWeaponMode();
00157	      }
00158	    }
00159	    else
00160	    {
00161	      if ( bWeaponMode )
00162	      {
00163	        if ( Pawn.Weapon != newWeapon )
00164	        {
00165	          Pawn.PendingWeapon = newWeapon;
00166	          if ( !Pawn.Weapon.PutDown() )
00167	            Pawn.PendingWeapon = None;
00168	        }
00169	      }
00170	      else
00171	      {
00172	        XIIIBaseHud(MyHud).fDrawWeaponsTimer = Level.TimeSeconds+2.0;
00173	        bWaitForWeaponMode = true;
00174	        Pawn.Weapon = NewWeapon;
00175	        SwitchWeaponMode();
00176	      }
00177	    }
00178	}
00179	
00180	//_____________________________________________________________________________
00181	simulated event IAmKicked()
00182	{
00183	    GotoState('Kicked', 'Begin');
00184	    Pawn.bTearOff = true;
00185	    bTearOff = true;
00186	    Pawn.Died( None, class'DTSuicided', Pawn.Location );
00187	    PlayerReplicationInfo.destroy();
00188	    PlayerReplicationInfo = none;
00189	}
00190	
00191	
00192	//_____________________________________________________________________________
00193	exec function ChangeSkin(string NewSkinCode)
00194	{
00195	    local int i;
00196	
00197	    // DO nothing in solo.
00198	    if ( Level.bLonePlayer )
00199	      return;
00200	
00201	//    Log("SKIN Exec ChangeSkin");
00202	
00203	    // don't replicate things for nothing if non valid code.
00204	    i = class'MeshSkinList'.Static.StaticFindSkinIndex(NewSkinCode);
00205	    if ( i > class'MeshSkinList'.default.MeshSkinListInfo.Length )
00206	      return;
00207	
00208	    ServerUpdateSkin(Caps(left(NewSkinCode,4)));
00209	//    Pawn.PlayerReplicationInfo.SkinCodeName = NewSkinCode;
00210	//    XIIIMPPlayerPawn(Pawn).ChangeSkin();
00211	}
00212	
00213	//_____________________________________________________________________________
00214	function ServerUpdateSkin(string NewSkinCode)
00215	{
00216	//    Log("SKIN ServerUpdateSkin");
00217	    PlayerReplicationInfo.SkinCodeName = NewSkinCode; // will be replicated to all clients
00218	    Pawn.ChangeSkin();  // local change on server
00219	}
00220	
00221	//____________________________________________________________________
00222	simulated function ClientAddDamageWarn(int RelativeHitLoc)
00223	{
00224	    XIIIBaseHud(MyHud).AddDamageWarn(RelativeHitLoc);
00225	}
00226	
00227	//_____________________________________________________________________________
00228	function EnterStartState()
00229	{
00230		local name NewState;
00231	
00232		if ( Level.bLonePlayer && !bOkForMoving )
00233		{
00234		  GotoState('WaitForFirstDisplay');
00235		  return;
00236		}
00237	  else
00238	    Super.EnterStartState();
00239	}
00240	
00241	/*
00242	//_____________________________________________________________________________
00243	exec function ImBoss()
00244	{
00245	    XIIIBaseHud(MyHud).AddBossBar(XIIIPawn(Pawn));
00246	}
00247	*/
00248	/*
00249	//_____________________________________________________________________________
00250	exec function LogInteractives()
00251	{
00252	    local Actor A;
00253	    local int i;
00254	
00255	    Log("BEGIN Interactive List");
00256	    i = 0;
00257	    foreach AllActors(class'Actor', A)
00258	    {
00259	      if ( A.bInteractive )
00260	      {
00261	        i++;
00262	        Log(" -"@i@A);
00263	      }
00264	    }
00265	    Log("END Interactive List");
00266	}
00267	*/
00268	//_____________________________________________________________________________
00269	exec function GoreLevel(int i)
00270	{
00271	    Level.Game.GoreLevel = i%2;
00272	    Level.Game.SaveConfig();
00273	}
00274	
00275	//_____________________________________________________________________________
00276	exec function FlowerPower(int i)
00277	{
00278	    if ( i != 0 )
00279	      Level.Game.GoreLevel = 0;
00280	    Level.Game.bAlternateMode = (i%2 == 1);
00281	    Level.Game.SaveConfig();
00282	}
00283	
00284	//_____________________________________________________________________________
00285	exec function DetailLevel(int i)
00286	{
00287	    Level.Game.DetailLevel = i%3;
00288	    Level.Game.SaveConfig();
00289	}
00290	
00291	//_____________________________________________________________________________
00292	exec function KillTarget(int i)
00293	{
00294	    if ( MyInteraction.FiringTargetActor != none )
00295	      MyInteraction.FiringTargetActor.TakeDamage(10000,Pawn,vect(0,0,1),vect(0,0,1),class'DTSuicided');
00296	}
00297	
00298	/*
00299	//_____________________________________________________________________________
00300	exec function SetZoomSystem(bool B)
00301	{
00302	    bAltZoomingSystem = B;
00303	    SaveConfig();
00304	}
00305	*/
00306	
00307	//_____________________________________________________________________________
00308	exec function AAM(int i)
00309	{
00310	    iAutoAimMode = i%2;
00311	    SaveConfig();
00312	}
00313	
00314	/*
00315	//_____________________________________________________________________________
00316	exec function DBTurn()
00317	{
00318	    bCheckTurnSpeed = !bCheckTurnSpeed;
00319	    SaveConfig();
00320	}
00321	
00322	//_____________________________________________________________________________
00323	exec function DBInput(bool b)
00324	{
00325	    PlayerInput.bCheckInputRanges = b;
00326	    PlayerInput.SaveConfig();
00327	}
00328	*/
00329	
00330	/*
00331	//_____________________________________________________________________________
00332	exec function CrosshairMode(int i)
00333	{
00334	    iCrossHairMode = i%3;
00335	    SaveConfig();
00336	}
00337	*/
00338	
00339	//_____________________________________________________________________________
00340	exec function AutoPickup(bool b)
00341	{
00342	    bAutoPickup = b;
00343	    SaveConfig();
00344	}
00345	
00346	/*
00347	//_____________________________________________________________________________
00348	exec function FixCrosshairMode(int i)
00349	{
00350	    bFixedCrosshair = (i%2 == 1);
00351	    SaveConfig();
00352	}
00353	
00354	//_____________________________________________________________________________
00355	exec function FloatCrosshairMode(int i)
00356	{
00357	    bFixedCrosshair = false;
00358	    bFloatingCrosshair = (i%2 == 1);
00359	    SaveConfig();
00360	}
00361	*/
00362	
00363	//_____________________________________________________________________________
00364	exec function CrosshairSize(Float f)
00365	{
00366	    fCrossHairSize = fClamp(f, 0.1, 3.0);
00367	    SaveConfig();
00368	}
00369	
00370	/*
00371	//_____________________________________________________________________________
00372	exec function LogInteraction()
00373	{
00374	    log("LogInteraction");
00375	    MyInteraction.SwitchLog();
00376	}
00377	*/
00378	
00379	//_____________________________________________________________________________
00380	exec function DoHideHUD( bool B )
00381	{
00382	    log("DoHideHUD call with B="$B);
00383	    MYHud.bHideHud = B;
00384	}
00385	
00386	/*
00387	//_____________________________________________________________________________
00388	exec function Teleport(name N)
00389	{
00390	    local XIIITeleportCheat XTC;
00391	
00392	//    Log("Trying to Teleport to "$N);
00393	
00394	    foreach AllActors(class'XIIITeleportCheat', XTC, N)
00395	    {
00396	      if (XTC != none)
00397	      {
00398	//        Log("Teleporting player to Spot "$XTC);
00399	        XTC.TeleportPlayer(XIIIPlayerPawn(Pawn));
00400	        break;
00401	      }
00402	    }
00403	}
00404	*/
00405	
00406	/*
00407	exec function TeleportNext()
00408	{
00409	    local XIIITeleportCheat XTC, XTCfirst;
00410	
00411	//    Log("Trying to Teleport to next teleporter");
00412	
00413	    foreach AllActors(class'XIIITeleportCheat', XTC)
00414	    {
00415	      if (XTCfirst == none)
00416	        XTCfirst = XTC;
00417	      if ( (XTC != none) && XTC.bLastUsed )
00418	      {
00419	        if ( XTC.NextXIIITeleportCheat != none )
00420	        {
00421	//          Log("Teleporting player to Spot "$XTC.NextXIIITeleportCheat);
00422	          XTC.NextXIIITeleportCheat.TeleportPlayer(XIIIPlayerPawn(Pawn));
00423	          XTC.NextXIIITeleportCheat.bLastUsed = true;
00424	          XTC.bLastUsed = false;
00425	          return;
00426	        }
00427	        else
00428	        {
00429	//          Log("Teleporting player to Spot "$XTCfirst);
00430	          XTCfirst.TeleportPlayer(XIIIPlayerPawn(Pawn));
00431	          XTCFirst.bLastUsed = true;
00432	          return;
00433	        }
00434	      }
00435	    }
00436	    // if we are here it's because none have bCurrent
00437	    if (XTCFirst != none)
00438	    {
00439	//      Log("Teleporting player to Spot "$XTCfirst);
00440	      XTCfirst.TeleportPlayer(XIIIPlayerPawn(Pawn));
00441	      XTCFirst.bLastUsed = true;
00442	      return;
00443	    }
00444	}
00445	*/
00446	
00447	//____________________________________________________________________________
00448	// ELR Override this
00449	exec function BehindView( Bool B )
00450	{
00451	    if (!(Left(Level.GetLocalURL(), 7) ~= "mapmenu"))
00452	      Super.BehindView(B);
00453	    if ( B )
00454	    {
00455	        Pawn.weapon.bHidden = true;
00456	        Pawn.weapon.RefreshDisplaying();
00457	    }
00458	    else
00459	    {
00460	        Pawn.weapon.bHidden = false;
00461	        Pawn.weapon.RefreshDisplaying();
00462	    }
00463	}
00464	
00465	function ClientSetBehindView(bool B)
00466	{
00467	    bBehindView = B;
00468	    if ( !B && Pawn.Shadow != none )
00469	      Pawn.Shadow.DetachProjector(true);
00470	}
00471	
00472	//____________________________________________________________________________
00473	event PlayerCalcView(out actor ViewActor, out vector CameraLocation, out rotator CameraRotation )
00474	{
00475	    local int i;
00476	
00477	    super.PlayerCalcView(ViewActor, CameraLocation, CameraRotation);
00478	    // following lines needed to have weapon in 3D overlays using bDelayDisplay instead of RenderOverlays
00479	    if ( ((Pawn == none) || Pawn.bIsDead) && (Attached.Length > 0) )
00480	    { // may have died, if something attached (must be 1rst person/inventory weapons) then detach else crash in SetLoc if something happen to inventory
00481	      for ( i=0; i<Attached.Length; i++)
00482	      {
00483	//        Log("DETACH"@Attached[i]@"from"@self);
00484	        Attached[i].SetBase(none);
00485	      }
00486	    }
00487	    SetLocation(CameraLocation);
00488	    SetRotation(CameraRotation);
00489	}
00490	
00491	//____________________________________________________________________________
00492	simulated event SetInitialState()
00493	{
00494	    if (Left(Level.GetLocalURL(), 7) ~= "mapmenu")
00495	    {
00496	      MyHud.bHideHUD = true;
00497	//      ConsoleCommand("ShowMenu");
00498	      GotoState('NoControl');
00499	      return;
00500	    }
00501	    Super.SetInitialState();
00502	
00503	}
00504	
00505	//____________________________________________________________________________
00506	// MLK: Superset to launch the briefing before the game starts
00507	// ELR First place it is safe to use Player Var so to spawn interactions.
00508	event InitInputSystem()
00509	{
00510	    local MapInfo Map;
00511	    local int i;
00512	    local XIIIPlayerInteraction XPI;
00513	
00514	    Super.InitInputSystem();
00515	
00516	    Player.Console = Player.InteractionMaster.Console;
00517	    if (Player.Console == none)
00518	    {
00519	        log("PAS de Console !?!");
00520	        return;
00521	    }
00522	    if (Player.Console.ViewportOwner == none)
00523	      Player.Console.ViewportOwner = Player;
00524	
00525	    for (i=0; i<Player.LocalInteractions.Length; i++)
00526	    {
00527	      if ( XIIIPlayerInteraction(Player.LocalInteractions[i]) != none )
00528	        MyInteraction = XIIIPlayerInteraction(Player.LocalInteractions[i]);
00529	    }
00530	// if an interaction already exists (coming from previous map) then reuse it, don't create another
00531	
00532	    if ( MyInteraction != none )
00533	    {
00534	        Player.InteractionMaster.RemoveInteraction(MyInteraction);
00535	        MyInteraction = none;
00536	    }
00537	
00538	    if ( MyInteraction == none )
00539	    {
00540	      XPI = XIIIPlayerInteraction(Player.InteractionMaster.AddInteraction(MyInteractionClass, Player));
00541	      if ( XPI != none )
00542	      {
00543	        XPI.Level = Level;
00544	        XPI.MyPC = Self;
00545	        MyInteraction = XPI;
00546	      }
00547	    }
00548	    else
00549	    {
00550	      MyInteraction.Level = Level;
00551	      MyInteraction.MyPC = Self;
00552	    }
00553	
00554	    SetRumbleFX(bUseRumble);
00555	
00556	    // Autolaunch Menu if in the 'menustart'.
00557	    if (Left(Level.GetLocalURL(), 7) ~= "mapmenu")
00558	    {
00559	      MyHud.bHideHUD = true;
00560	      ConsoleCommand("ShowMenu");
00561	      XIIIGameInfo(Level.Game).MapInfo.EndCartoonEffect = true;
00562	      GotoState('NoControl');
00563	    }
00564	
00565	    if ( !Level.bLonePlayer && (Level.GetPlateforme() == 2) )
00566	    {
00567	      if (xboxlive == none) // Southend!!!!!!!!!1 safe for other platforms..
00568	        xboxlive=New Class'XboxLiveManager';
00569	
00570	      if (xboxlive.IsLoggedIn(xboxlive.GetCurrentUser()))
00571	        ConsoleCommand("ShowMenu"); // SOUTHEND!!!!!!!!!  Need this for XBOX!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!1
00572	      return;
00573	    }
00574	
00575	// SOLO ONLY INIT
00576	    foreach AllActors(class'XIII.Mapinfo',map)
00577	      break;
00578	    if ( Map != none && Map.bBriefing )
00579	    {
00580	      XIIIGameInfo(Level.Game).MapInfo = Map;
00581	      ConsoleCommand("ShowBriefing");
00582	    }
00583	}
00584	
00585	//_____________________________________________________________________________
00586	// ::DBUG::
00587	simulated event Destroyed()
00588	{
00589	    Log("PLAYER"@self@"destroyed !!");
00590	    Super.Destroyed();
00591	}
00592	
00593	//_____________________________________________________________________________
00594	// ::DBUG::
00595	function PawnDied()
00596	{
00597	  Log("PLAYER"@self@"PawnDied call bIsPlayer="$bIsPlayer);
00598	  Super.PawnDied();
00599	  // Unflash player if under flashbang sfx
00600	  ClientFilter(
00601	    class'Canvas'.Static.MakeColor(128,128,128,255),
00602	    class'Canvas'.Static.MakeColor(128,128,128,255),
00603	    1.0
00604	  );
00605	  ClientHighLight( class'Canvas'.Static.MakeColor(0,0,0,0), 0.0);
00606	  ClientTargetHighLight(0,0,0.001);
00607	  UseVignetteFilter = 0;
00608	  UseVignetteHighlight = 0;
00609	}
00610	
00611	//_____________________________________________________________________________
00612	// Setup the ForceFeedbackController
00613	function SetRumbleFX(bool B)
00614	{
00615	    if ( B )
00616	    {
00617	      if ( FFController != none )
00618	      {
00619	        FFController.EnableForceFeedback(true);
00620	      }
00621	      else
00622	      {
00623	        FFController = new class'ForceFeedbackController';
00624	        FFController.EnableForceFeedback(true);
00625	      }
00626	    }
00627	    else
00628	    {
00629	      if ( FFController != none )
00630	      {
00631	        FFController.EnableForceFeedback(false);
00632	      }
00633	    }
00634	}
00635	
00636	//_____________________________________________________________________________
00637	// Setup the ForceFeedbackController
00638	function RumbleFX(int FXNum)
00639	{
00640	    if ( (FFController != none) && FFController.IsForceFeedbackEnable() )
00641	    {
00642	      switch(FXNum)
00643	      {
00644	        Case 1: // Beretta
00645	          FFController.StartEffect(0, 0.45, 0.45, 0.00, 1.00, 0.20, 0.70, 0.35 ); Break;
00646	        Case 2: // Hunting Gun, Left
00647	          FFController.StartEffect(0, 0.00, 0.75, 0.00, 1.00, 0.25, 0.50, 0.35 ); Break;
00648	        Case 3: // Hunting Gun, Right
00649	          FFController.StartEffect(0, 0.75, 0.00, 0.00, 1.00, 0.25, 0.50, 0.35 ); Break;
00650	        Case 4: // ShotGun
00651	          FFController.StartEffect(0, 0.60, 0.00, 0.00, 1.00, 0.35, 0.50, 0.40 ); Break;
00652	        Case 5: // Magnum
00653	          FFController.StartEffect(0, 0.60, 0.60, 0.00, 1.00, 0.20, 0.70, 0.35 ); Break;
00654	        Case 6: // M16 FX 1
00655	          FFController.StartEffect(0, 0.15, 0.45, 0.00, 1.00, 0.10, 0.70, 0.15 ); Break;
00656	        Case 7: // M16 inv. FX 1
00657	          FFController.StartEffect(0, 0.45, 0.15, 0.00, 1.00, 0.10, 0.70, 0.15 ); Break;
00658	        Case 8: // Kalash FX 1
00659	          FFController.StartEffect(0, 0.25, 0.45, 0.00, 1.00, 0.10, 0.70, 0.15 ); Break;
00660	        Case 9: // Kalash inv. FX 1
00661	          FFController.StartEffect(0, 0.45, 0.25, 0.00, 1.00, 0.10, 0.70, 0.15 ); Break;
00662	        Case 10: // Minigun FX 1
00663	          FFController.StartEffect(0, 0.10, 0.35, 0.00, 0.70, 0.10, 0.70, 0.15 ); Break;
00664	        Case 11: // Minigun inv. FX 1
00665	          FFController.StartEffect(0, 0.35, 0.10, 0.00, 0.70, 0.10, 0.70, 0.15 ); Break;
00666	        Case 12: // Sniper Rifle
00667	          FFController.StartEffect(0, 0.90, 0.90, 0.00, 1.00, 0.15, 0.70, 0.25 ); Break;
00668	        Case 13: // Bazooka
00669	          FFController.StartEffect(0, 0.90, 0.90, 0.00, 0.70, 0.25, 1.00, 1.00 ); Break;
00670	        Case 14: // CrossBow, CrossBow X3
00671	          FFController.StartEffect(0, 0.50, 0.50, 0.00, 0.10, 0.10, 1.00, 0.25 ); Break;
00672	        Case 15: // M60 FX 1
00673	          FFController.StartEffect(0, 0.80, 0.40, 0.00, 1.00, 0.10, 0.70, 0.15 ); Break;
00674	        Case 16: // M60 inv. FX 1
00675	          FFController.StartEffect(0, 0.40, 0.80, 0.00, 1.00, 0.10, 0.70, 0.15 ); Break;
00676	        Case 17: // Harpoon
00677	          FFController.StartEffect(0, 0.30, 0.30, 0.00, 0.10, 0.10, 1.00, 0.20 ); Break;
00678	/*
00679	        Case 5:
00680	          FFController.StartEffect(0, fRumb1, fRumb2, t1, Amplit1, t2, Amplit2, t3 );
00681	          Break;
00682	*/
00683	      }
00684	    }
00685	}
00686	
00687	//_____________________________________________________________________________
00688	// SpawnDefaultHUD()
00689	// Spawn a HUD (make sure that PlayerController always has valid HUD, even if
00690	//  ClientSetHUD() hasn't been called
00691	function SpawnDefaultHUD()
00692	{
00693	     myHUD = spawn(class'XIIIBaseHUD',self);
00694	}
00695	
00696	//_____________________________________________________________________________
00697	function DisplayDebug(Canvas C, out float YL, out float YPos)
00698	{
00699	    Super.DisplayDebug(C, YL, YPos);
00700	
00701	    C.DrawText("rotation "$rotation);
00702	    YPos += YL;
00703	    C.SetPos(4,YPos);
00704	
00705	    C.DrawText("Weapon Mode "$bWeaponMode);
00706	    YPos += YL;
00707	    C.SetPos(4,YPos);
00708	
00709	    if ( Pawn != none )
00710	    {
00711	/*
00712	      if ( Pawn.PendingWeapon != none )
00713	      {
00714	        C.DrawText("PendingWeapon="$Pawn.PendingWeapon@"STATE"@Pawn.PendingWeapon.GetStateName());
00715	        YPos += YL;
00716	        C.SetPos(4,YPos);
00717	      }
00718	      if ( Pawn.PendingWeapon != none )
00719	      {
00720	        C.DrawText("Weapon="$Pawn.Weapon@"STATE"@Pawn.Weapon.GetStateName());
00721	        YPos += YL;
00722	        C.SetPos(4,YPos);
00723	      }
00724	      if ( Pawn.PendingItem != none )
00725	      {
00726	        C.DrawText("PendingItem="$Pawn.PendingItem@"STATE"@Pawn.PendingItem.GetStateName());
00727	        YPos += YL;
00728	        C.SetPos(4,YPos);
00729	      }
00730	      if ( Pawn.SelectedItem != none )
00731	      {
00732	        C.DrawText("Item="$Pawn.SelectedItem@"STATE"@Pawn.SelectedItem.GetStateName());
00733	        YPos += YL;
00734	        C.SetPos(4,YPos);
00735	      }
00736	
00737	*/
00738	      if ( XIIIPawn(Pawn).LHand != none )
00739	      {
00740	        C.DrawText("LeftHand="$XIIIPawn(Pawn).LHand);
00741	        YPos += YL;
00742	        C.SetPos(4,YPos);
00743	      }
00744	    }
00745	
00746	    C.DrawText("Rotation="$Rotation@"AdjustedAimForFiring"@rotator(AdjustedAimForFiring)@"OldAdjustAim"@rotator(OldAdjustAim));
00747	    YPos += YL;
00748	    C.SetPos(4,YPos);
00749	
00750	/*    C.DrawText("bAlwaysLevel="$bAlwaysLevel@"bCenterView="$bCenterView@"bLook="$bLook@"bLookUpStairs="$bLookUpStairs@"bSnapToLevel="$bSnapToLevel);
00751	    YPos += YL;
00752	    C.SetPos(4,YPos); */
00753	}
00754	
00755	//_____________________________________________________________________________
00756	exec function RestartLevel()
00757	{
00758	//    if( Level.Netmode==NM_Standalone )
00759	    if ( Level.bLonePlayer )
00760	      ClientTravel( "?restart", TRAVEL_Relative, false );
00761	}
00762	
00763	//_____________________________________________________________________________
00764	function ClientRestart()
00765	{
00766	  Log("ClientRestart"@self@"Pawn="$Pawn);
00767		if ( Pawn == None )
00768		{
00769			GotoState('WaitingForPawn');
00770			return;
00771		}
00772		if ( PlayerInput != none )
00773		{
00774		  PlayerInput.iDuckMem = 0;
00775		  PlayerInput.bDuckCheck = false;
00776		  Pawn.ShouldCrouch(false);
00777		}
00778		bDuck = 0;
00779		Pawn.ClientRestart();
00780		SetViewTarget(Pawn);
00781		bBehindView = Pawn.PointOfView();
00782		EnterStartState();
00783	}
00784	
00785	//_____________________________________________________________________________
00786	simulated function RenderScreenOverlays( canvas C )
00787	{
00788	    if ( fCamViewPercent > 0.0 )
00789	    {
00790	      CamView.Instigator = pawn;
00791	      CamView.RenderOverlays(C);
00792	    }
00793	}
00794	
00795	//_____________________________________________________________________________
00796	// ELR
00797	simulated event RenderOverlays( canvas C )
00798	{
00799	    if ( !Level.bCineFrame )
00800	      MyInteraction.MyPCPostRender(C);
00801	    else
00802	      MyInteraction.TargetActor = none;
00803	    // ::TODO:: Optimize using NoControl state test or overriding RenderOverlays in NoControl State ?
00804	/*
00805	    if ( (Pawn != none) && Pawn.region.Zone.FlashEffectDesc.IsActivated )
00806	    { // do not simply return but hide weapons/items
00807	      if ( Pawn.Weapon != none )
00808	      { // should be in the flashback end effect
00809	      }
00810	      return;
00811	    }
00812	*/
00813	
00814	/*
00815	    if ( (Level.Game != none) && Level.Game.bGameEnded )
00816	    {
00817	//      Log("RenderOverlays w/ bGameEnded !!!");
00818	      return;
00819	    }
00820	*/
00821	
00822	    if ( (Level.Game != none) && (Level.Game.DetailLevel < 2) )
00823	    { // On anything else than XBOX, use full screen render.
00824	      if ( IsInState('CameraView') )
00825	      {
00826	        CamView.Instigator = pawn;
00827	        CamView.RenderOverlays(C);
00828	        return;
00829	      }
00830	    }
00831	    else
00832	    { // on XBox, use portal
00833	      switch (CamViewMode)
00834	      {
00835	        case 0:
00836	          fCamViewPercent -= 0.05;
00837	          if (fCamViewPercent < 0.0)
00838	          {
00839	            fCamViewPercent = 0.0;
00840	            CamView = none;
00841	          }
00842	        break;
00843	        case 1:
00844	          fCamViewPercent += 0.05;
00845	          if (fCamViewPercent > 1.0)
00846	            fCamViewPercent = 1.0;
00847	        break;
00848	      }
00849	
00850	      if (multiViewport != none)
00851	      {
00852	        multiViewport.RenderOverlays(C);
00853	        if (multiViewport.bEnded)
00854	        {
00855	          multiViewport.Destroy();
00856	          multiViewport = none;
00857	          Level.SetOnlyPostRender(false);
00858	        }
00859	      }
00860	
00861	      if ( fCamViewPercent > 0.0 )
00862	      {
00863	        CamView.Instigator = pawn;
00864	        CamView.RenderOverlays(C);
00865	//        return; // don't return as we render in a viewport.
00866	      }
00867	    }
00868	
00869	    if ( bWeaponMode && (Pawn != none) && (Pawn.Weapon != none) )
00870	    {
00871	//      if ( !Pawn.Weapon.IsAnimating() )
00872	//        Pawn.Weapon.AnimEnd(0); // Anti bug, if selected MUST Have an animation
00873	      if ( Pawn.Weapon.Instigator != Pawn ) // don't bNetDirty by instigator changed each frame
00874	        Pawn.Weapon.Instigator = Pawn;
00875	      Pawn.Weapon.RenderOverlays(C);
00876	    }
00877	    if ( !bWeaponMode && (Pawn != none) )
00878	    {
00879	//      if ( !Pawn.SelectedItem.IsAnimating() )
00880	//        Pawn.SelectedItem.AnimEnd(0); // Anti bug, if selected MUST Have an animation
00881	      if ( Pawn.SelectedItem != none )
00882	        Pawn.SelectedItem.RenderOverlays(C);
00883	      else
00884	      { // bug ?
00885	        NextWeapon();
00886	        Pawn.ChangedWeapon();
00887	      }
00888	    }
00889	
00890	    if ( (Pawn != none) && (XIIIPawn(Pawn).LHand != None) && (XIIIPawn(Pawn).LHand.bActive) )
00891	    {
00892	      XIIIPawn(Pawn).LHand.RenderOverlays(C);
00893	    }
00894	}
00895	
00896	//_____________________________________________________________________________
00897	function ClientTargetHighLight( int Alpha, float TargetHighLight, float Duration)
00898	{ // compute Dec values per millsec
00899	    VignetteFlashDecFactor = (TargetHighLight - VignetteHighLight) / Duration;
00900	    VignetteAlphaDecFactor = (Alpha - VignetteColor.A) / Duration;
00901	    VignetteSFXduration = Duration;
00902	    VignetteAlpha = VignetteColor.A;
00903	}
00904	
00905	//_____________________________________________________________________________
00906	// ELR made zooming speed higher
00907	function AdjustView(float DeltaTime )
00908	{
00909	    // teleporters affect your FOV, so adjust it back down
00910	    if ( FOVAngle != DesiredFOV )
00911	    {
00912	      if ( FOVAngle > DesiredFOV )
00913	        FOVAngle = FOVAngle - FMax(7, 0.9 * DeltaTime * (FOVAngle - DesiredFOV));
00914	      else
00915	        FOVAngle = FOVAngle - FMin(-7, 0.9 * DeltaTime * (FOVAngle - DesiredFOV));
00916	      if ( Abs(FOVAngle - DesiredFOV) <= 10 )
00917	        FOVAngle = DesiredFOV;
00918	    }
00919	
00920	    // adjust FOV for weapon zooming
00921	    if ( bZooming )
00922	    {
00923	      ZoomLevel += DeltaTime * 1.5;
00924	      if (ZoomLevel > 0.95)
00925	        ZoomLevel = 0.95;
00926	      DesiredFOV = FClamp(90.0 - (ZoomLevel * 88.0), 1, 170);
00927	    }
00928	
00929	    // Handle here because we do have DeltaTime
00930	    if ( ((UseVignetteFilter != 0) || (UseVignetteHighlight != 0)) && ( VignetteSFXduration > 0) )
00931	    {
00932	      VignetteHighLight += (DeltaTime * VignetteFlashDecFactor);
00933	      VignetteAlpha += (Deltatime * VignetteAlphaDecFactor);
00934	      VignetteColor.A = VignetteAlpha;
00935	      VignetteSFXduration -= DeltaTime;
00936	//      Log("VignetteSFXduration="$VignetteSFXduration@"VignetteHighLight="$VignetteHighLight@"VignetteColor="$VignetteColor.R$"."$VignetteColor.G$"."$VignetteColor.B$"."$VignetteAlpha);
00937	      if ( VignetteSFXduration <= 0 )
00938	      {
00939	        UseVignetteFilter = 0;
00940	        UseVignetteHighlight = 0;
00941	      }
00942	    }
00943	}
00944	
00945	//_____________________________________________________________________________
00946	/* AdjustAim()
00947	  Calls this version for player aiming help.
00948	  Aimerror not used in this version.
00949	  Only adjusts aiming at pawns
00950	*/
00951	// ELR computes AimSpot and return rotator(AimSpot - projStart)
00952	//Simulated function rotator AdjustAim(float projSpeed, vector projStart, int aimerror, bool bLeadTarget, bool bWarnTarget, bool bTossed, bool bTrySplash)
00953	// AimCalcMode is used as 0 = weapon firing, 1 = interface aim anticipation
00954	Simulated function rotator AdjustAim(Ammunition FiredAmmunition, vector projStart, int AimCalcMode)
00955	{
00956	    if ( Pawn != None && !Pawn.IsLocallyControlled() )
00957	      AdjustAimForDisplay(FiredAmmunition, ProjStart);
00958	
00959	    if ( !FiredAmmunition.bInstantHit )
00960	      return rotator(AdjustedAimForFiring);
00961	    else
00962	      return rotator(OldAdjustAim);
00963	}
00964	
00965	//_____________________________________________________________________________
00966	exec function ShowMenu()
00967	{
00968	    log("SHOWMENU: "$self);
00969	    if ( !Level.bLonePlayer || !Level.Game.bGameEnded || (XIIIGameInfo(Level.Game).XIIIEndGameType!=4) )
00970	      ConsoleCommand("ShowTheMenu "$self);
00971	    if ( VP != none )
00972	      VP.Stop();
00973	}
00974	
00975	exec function ShowInfo()
00976	{
00977	    log("SHOWINFO: "$self);
00978	    if (!bMenuIsActive)
00979	      MyHud.ShowScores();
00980	}
00981	
00982	//_____________________________________________________________________________
00983	exec function Duck( optional float F )
00984	{
00985	  bPressedDuck = true;
00986	}
00987	
00988	//_____________________________________________________________________________
00989	exec function QuickHeal()
00990	{
00991	    Local inventory Inv;
00992	
00993	    DebugLog("Quick Heal Call");
00994	    if ( (Pawn != none) && (Pawn.region.zone != none) && Pawn.region.Zone.FlashEffectDesc.IsActivated )
00995	      return;
00996	
00997	    if ( bWeaponBlock )
00998	      return;
00999	
01000	    if ( !bWeaponMode )
01001	    {
01002	      if ( Med(Pawn.SelectedItem) != none )
01003	      {
01004	        ActivateItem();
01005	        return;
01006	      }
01007	      if ( Med(Pawn.PendingItem) != none )
01008	      { // don't use a possible pending item to avoid pb switching
01009	        return;
01010	      }
01011	    }
01012	
01013	    if ( XIIIPawn(Pawn).HealthPercent() <= 25 )
01014	    { //seek FullMedKit
01015	      Inv = Pawn.FindInventoryType(class'FullMedKit');
01016	      if ( Inv == none )
01017	        Inv = Pawn.FindInventoryType(class'MedKit');
01018	    }
01019	    else if ( XIIIPawn(Pawn).IsWounded() )
01020	    { //seek MedKit
01021	      Inv = Pawn.FindInventoryType(class'MedKit');
01022	      if ( Inv == none )
01023	        Inv = Pawn.FindInventoryType(class'FullMedKit');
01024	    }
01025	    if ( Inv != none )
01026	    {
01027	      DebugLog("Quick Heal Should HEAL using "$Inv);
01028	      Med(Inv).UseMeQuick(self);
01029	      if ( Med(Inv).Charge <=0 )
01030	      {
01031	        if ( Pawn.SelectedItem == Inv )
01032	          Pawn.SelectedItem = none;
01033	        if ( Pawn.PendingItem == Inv )
01034	          Pawn.PendingItem = none;
01035	        if ( OldItem == Inv )
01036	          OldItem = none;
01037	        Med(Inv).UsedUpNoChange();
01038	      }
01039	    }
01040	
01041	}
01042	
01043	//_____________________________________________________________________________
01044	// ELR Use the ForceReload function of base weapons functions
01045	exec function ReLoad()
01046	{
01047	    if ( (Pawn != none) && (Pawn.region.zone != none) && Pawn.region.Zone.FlashEffectDesc.IsActivated )
01048	      return;
01049	
01050	    ForceReload();
01051	}
01052	
01053	//_____________________________________________________________________________
01054	// can't reload if have grabbed corpse/pawn
01055	exec function ForceReload()
01056	{
01057	//    Log("ForceReLoad, Pawn="$Pawn@"Pawn.Weapon="$Pawn.Weapon);
01058	    if ( Level.bLonePlayer )
01059	    {
01060	      if ( (Pawn != None) && (Pawn.Weapon != None) && (XIIIPawn(Pawn).LHand.pOnShoulder == none) )
01061	        Pawn.Weapon.ForceReload();
01062	    }
01063	    else
01064	      if ( (Pawn != None) && (Pawn.Weapon != None) )
01065	        Pawn.Weapon.ForceReload();
01066	}
01067	
01068	//_____________________________________________________________________________
01069	// The player wants to fire.
01070	exec function Fire( optional float F )
01071	{
01072	    if ( Pawn.region.Zone.FlashEffectDesc.IsActivated )
01073	      return;
01074	
01075	    XIIIBaseHud(MyHud).fDrawWeaponsTimer = Level.TimeSeconds-10; // get rid of weapon/item drawing list
01076	
01077	    if ( XIIIPlayerPawn(Pawn).SSSk != none )
01078	      XIIIPlayerPawn(Pawn).SSSk.ResetTimer();
01079	
01080	    if ( IsInState('CameraView') )
01081	    {
01082	      RestoreView();
01083	      return;
01084	    }
01085	    if ( bWeaponMode )
01086	    {
01087	      if ( Pawn.Weapon != None )
01088	        Pawn.Weapon.Fire(F);
01089	    }
01090	    else
01091	    {
01092	      if ( !bWeaponMode && (Hook(Pawn.SelectedItem) != none) )
01093	      {
01094	        if ( !Hook(Pawn.SelectedItem).bGoUp && (!Hook(Pawn.SelectedItem).bGoDown || Hook(Pawn.SelectedItem).ActivatedByFire) )
01095	        {
01096	          Hook(Pawn.SelectedItem).ActivatedByFire = true;
01097	          ActivateItem();
01098	        }
01099	      }
01100	      else
01101	      {
01102	//        log("Activating item via fire call");
01103	        ActivateItem();
01104	      }
01105	      if (Level.NetMode == NM_Client)
01106	      {
01107	//        Log("Activate Item (on client) "@Pawn.SelectedItem);
01108	        if ( Level.Pauser!=None )
01109	          return;
01110	        if ( (Pawn != None) && (Pawn.SelectedItem!=None) )
01111	          Pawn.SelectedItem.Activate();
01112	      }
01113	    }
01114	}
01115	
01116	//_____________________________________________________________________________
01117	// The player Release fire.
01118	exec function UnFire( optional float F )
01119	{
01120	//    Log("Calling Unfire");
01121	    if ( bWeaponMode )
01122	    {
01123	      if ( (Pawn != none) && (XIIIWeapon(Pawn.Weapon) != None) )
01124	        XIIIWeapon(Pawn.Weapon).UnFire(F);
01125	    }
01126	}
01127	
01128	//_____________________________________________________________________________
01129	exec function AltFire( optional float F )
01130	{
01131	    if ( Pawn.region.Zone.FlashEffectDesc.IsActivated )
01132	      return;
01133	
01134	    if ( IsInState('CameraView') )
01135	    {
01136	      RestoreView();
01137	      return;
01138	    }
01139	    if ( !bWeaponMode && (Hook(Pawn.SelectedItem) != none) && bHooked && !Hook(Pawn.SelectedItem).bGoDown && !Hook(Pawn.SelectedItem).bGoUp)
01140	    {
01141	      Hook(Pawn.SelectedItem).ActivatedByAltFire = true;
01142	      ActivateItem();
01143	    }
01144	/*
01145	    else if ( XIIIPawn(Pawn).LHand.pOnShoulder != none )
01146	    {
01147	      XIIIPawn(Pawn).LHand.UnGrabPawn();
01148	    }
01149	    else if ( MyInteraction.bCanGrabCorpse || MyInteraction.bCanTakePrisonner )
01150	    {
01151	      XIIIPawn(Pawn).LHand.GrabPawn(XIIIPawn(MyInteraction.TargetActor));
01152	      XIIIPawn(Pawn).CheckMaluses();
01153	    }
01154	*/
01155	//    else if ( !bWeaponMode && (Micro(Pawn.SelectedItem) != none) ) // Creates dependency
01156	    else if ( !bWeaponMode && Pawn.SelectedItem.IsA('Micro') ) // don't create dependency
01157	      Fire();
01158	    else if ( bWeaponMode )
01159	      WeaponZoom();
01160	}
01161	
01162	//_____________________________________________________________________________
01163	// ELR hide/unhide Weapon
01164	simulated function SwitchWeaponMode()
01165	{
01166	    local inventory I;
01167	
01168	    DebugLog(">>> SwitchWeaponMode call, bWeaponMode="$bWeaponMode@"bWaitForWeaponMode="$bWaitForWeaponMode);
01169	
01170	    if ( !bWeaponMode )
01171	    {
01172	      DebugLog("  > Calling PutDown for"@XIIIItems(Pawn.SelectedItem));
01173	      XIIIItems(Pawn.SelectedItem).PutDown();
01174	      if ( XIIIPawn(Pawn).bHaveOnlyOneHandFree && (XIIIWeapon(Pawn.Weapon).WHand == WHA_2HShot) )
01175	        Pawn.PendingWeapon = Pawn.Inventory.NextWeapon(None, Pawn.Weapon);
01176	      else
01177	        Pawn.PendingWeapon = Pawn.Weapon;
01178	    }
01179	    else
01180	    {
01181	      if ( !bHooked ) // Reset to MedKits priority
01182	        XIIIPawn(Pawn).SelectedItem = Pawn.Inventory.NextItem(none, none);
01183	      else
01184	        XIIIPawn(Pawn).SelectedItem = HookUsed;
01185	      if ( XIIIPawn(Pawn).bHaveOnlyOneHandFree && (XIIIItems(Pawn.SelectedItem).IHand == IH_2H) )
01186	        XIIIPawn(Pawn).SelectedItem = Pawn.Inventory.NextItem(none, XIIIPawn(Pawn).SelectedItem);
01187	      if ( XIIIPawn(Pawn).SelectedItem != none )
01188	      {
01189	//        XIIIPawn(Pawn).PendingItem = Pawn.SelectedItem;
01190	        DebugLog("  > Calling PutDown for"@Pawn.Weapon);
01191	        Pawn.Weapon.PutDown();
01192	      }
01193	      else
01194	      { // Cancel Change
01195	        bWaitForWeaponMode = true;
01196	      }
01197	/*
01198	      I = Pawn.Inventory.SelectNext();
01199	//      log("  > SelectNext Result="$I);
01200	      if (I != none )
01201	      {
01202	        XIIIPawn(Pawn).PendingItem = Pawn.SelectedItem;
01203	//        log("  > Calling Putdown for"@Pawn.Weapon);
01204	        Pawn.Weapon.PutDown();
01205	      }
01206	      else
01207	      {
01208	        bWaitForWeaponMode = true;
01209	      }
01210	*/
01211	    }
01212	//    ServerSwitchWeaponMode(bWeaponMode, bWaitForWeaponMode);
01213	}
01214	
01215	//_____________________________________________________________________________
01216	// ELR hide/unhide Weapon (Used by the DecoWeapon to hide weapon then put it back when used)
01217	exec function HideWeapon()
01218	{
01219	    if ( XIIIWeapon(pawn.Weapon) != none )
01220	    {
01221	      if ( bWeaponMode )
01222	        SwitchWeapon( OldWeap );
01223	      else
01224	      {
01225	        OldWeap = pawn.weapon.InventoryGroup;
01226	        switchweapon( 0 );
01227	      }
01228	    }
01229	}
01230	
01231	//_____________________________________________________________________________
01232	exec function PrevWeapon()
01233	{
01234	    if ( Pawn.region.Zone.FlashEffectDesc.IsActivated )
01235	      return;
01236	
01237	    if ( (Pawn.PendingWeapon != none) && (DecoWeapon(Pawn.PendingWeapon) != none) )
01238	      return;
01239	
01240	//    if ( (XIIIItems(Pawn.SelectedItem) != none) && XIIIItems(Pawn.SelectedItem).bChangeItem && !Pawn.SelectedItem.IsAnimating() )
01241	//    { // Bug chance for freezed inventory switching
01242	//      Pawn.SelectedItem.AnimEnd(0);
01243	//    }
01244	//    if ( (Pawn.Weapon != none) && Pawn.Weapon.bChangeWeapon && !Pawn.Weapon.IsAnimating() )
01245	//    { // Bug chance for freezed inventory switching
01246	//      Pawn.Weapon.AnimEnd(0);
01247	//    }
01248	
01249	    Pawn.PendingItem = none;
01250	
01251	    XIIIBaseHud(MyHud).bDrawWeapons = true;
01252	    XIIIBaseHud(MyHud).bDrawItems = false;
01253	    XIIIBaseHud(MyHud).fDrawWeaponsTimer = Level.TimeSeconds + 1.0;
01254	    XIIIBaseHud(MyHud).fDrawItemsTimer = Level.TimeSeconds - 1.0;
01255	
01256	//    if ( bWeaponMode || bWaitForWeaponMode )
01257	    if ( bWaitForWeaponMode )
01258	    {
01259	      if ( Level.Pauser != None )
01260	        return;
01261	      if ( Pawn.Weapon == None )
01262	      {
01263	        SwitchToBestWeapon();
01264	        return;
01265	      }
01266	      if ( Pawn.PendingWeapon != None )
01267	        Pawn.PendingWeapon = Pawn.Inventory.PrevWeapon(None, Pawn.PendingWeapon);
01268	      else
01269	        Pawn.PendingWeapon = Pawn.Inventory.PrevWeapon(None, Pawn.Weapon);
01270	
01271	      if ( Pawn.PendingWeapon != None )
01272	      {
01273	        Pawn.Weapon.PutDown();
01274	      }
01275	    }
01276	    else
01277	    {
01278	      XIIIBaseHud(MyHud).fDrawWeaponsTimer = Level.TimeSeconds+2.0;
01279	      bWaitForWeaponMode = true;
01280	      SwitchWeaponMode();
01281	    }
01282	}
01283	
01284	//_____________________________________________________________________________
01285	exec function NextWeapon()
01286	{
01287	    if ( Pawn.region.Zone.FlashEffectDesc.IsActivated )
01288	      return;
01289	
01290	    if ( (Pawn.PendingWeapon != none) && (DecoWeapon(Pawn.PendingWeapon) != none) )
01291	      return;
01292	
01293	//    if ( (XIIIItems(Pawn.SelectedItem) != none) && XIIIItems(Pawn.SelectedItem).bChangeItem && !Pawn.SelectedItem.IsAnimating() )
01294	//    { // Bug chance for freezed inventory switching
01295	//      Pawn.SelectedItem.AnimEnd(0);
01296	//    }
01297	//    if ( (Pawn.Weapon != none) && Pawn.Weapon.bChangeWeapon && !Pawn.Weapon.IsAnimating() )
01298	//    { // Bug chance for freezed inventory switching
01299	//      Pawn.Weapon.AnimEnd(0);
01300	//    }
01301	    Pawn.PendingItem = none;
01302	
01303	    XIIIBaseHud(MyHud).bDrawWeapons = true;
01304	    XIIIBaseHud(MyHud).bDrawItems = false;
01305	    XIIIBaseHud(MyHud).fDrawWeaponsTimer = Level.TimeSeconds + 1.0;
01306	    XIIIBaseHud(MyHud).fDrawItemsTimer = Level.TimeSeconds - 1.0;
01307	
01308	//    if ( bWeaponMode || bWaitForWeaponMode )
01309	    if ( bWaitForWeaponMode )
01310	    {
01311	//      Log("> NextWeapon call in "$self);
01312	      if( Level.Pauser!=None )
01313	        return;
01314	      if ( Pawn.Weapon == None )
01315	      {
01316	        SwitchToBestWeapon();
01317	        return;
01318	      }
01319	      if ( Pawn.PendingWeapon != None )
01320	        Pawn.PendingWeapon = Pawn.Inventory.NextWeapon(None, Pawn.PendingWeapon);
01321	      else
01322	        Pawn.PendingWeapon = Pawn.Inventory.NextWeapon(None, Pawn.Weapon);
01323	
01324	      if ( Pawn.PendingWeapon != None )
01325	      {
01326	        Pawn.Weapon.PutDown();
01327	      }
01328	    }
01329	    else
01330	    {
01331	      XIIIBaseHud(MyHud).fDrawWeaponsTimer = Level.TimeSeconds+2.0;
01332	      bWaitForWeaponMode = true;
01333	      SwitchWeaponMode();
01334	    }
01335	}
01336	
01337	
01338	//_____________________________________________________________________________
01339	// we want the player to switch to weapon group number F.
01340	exec function SwitchWeapon( byte F )
01341	{
01342		local weapon newWeapon;
01343	
01344		if ( (Pawn == none) || Pawn.bIsDead )
01345		  return;
01346	
01347		if ( (Level.Pauser!=None) || (Pawn == None) || (Pawn.Inventory == None) )
01348			return;
01349		if ( (Pawn.Weapon != None) && (Pawn.Weapon.Inventory != None) )
01350			newWeapon = Pawn.Weapon.Inventory.WeaponChange(F);
01351		else
01352			newWeapon = None;
01353		if ( newWeapon == None )
01354			newWeapon = Pawn.Inventory.WeaponChange(F);
01355	
01356		if ( newWeapon == None )
01357		{ // ELR Don't just return, switchweapon(0) instead
01358	    SwitchWeapon(0);
01359	  	return;
01360	  }
01361	
01362		if ( Pawn.Weapon == None )
01363		{
01364			Pawn.PendingWeapon = newWeapon;
01365			Pawn.ChangedWeapon();
01366		}
01367		else if ( Pawn.Weapon != newWeapon )
01368		{
01369			Pawn.PendingWeapon = newWeapon;
01370			if ( !Pawn.Weapon.PutDown() )
01371				Pawn.PendingWeapon = None;
01372		}
01373	}
01374	
01375	/*
01376	//_____________________________________________________________________________
01377	exec function TestNI()
01378	{
01379	    local int i;
01380	    local inventory Inv;
01381	
01382	    Inv = Pawn.Inventory;
01383	    Log("BEGIN Testing NextItem From PawnInventory"@Inv);
01384	    for (i=0; i<5; i++)
01385	    {
01386	      if ( inv != none )
01387	      {
01388	        if ( PowerUps(Inv) != none )
01389	          Inv = Inv.NextItem(none, PowerUps(Inv));
01390	        else
01391	          Inv = Inv.NextItem(none, none);
01392	        if ( Inv != none )
01393	          Log("  Next Inv="$Inv);
01394	        else
01395	          Log("  Next Inv=NONE");
01396	      }
01397	    }
01398	    Log("END Testing NextItem");
01399	    Inv = Pawn.Inventory;
01400	    Log("BEGIN Testing NextItem From PawnSelectedItem"@Pawn.SelectedItem);
01401	    for (i=0; i<5; i++)
01402	    {
01403	      if ( inv != none )
01404	      {
01405	        if ( Pawn.SelectedItem != none )
01406	          Inv = Inv.NextItem(none, Pawn.SelectedItem);
01407	        else
01408	          Inv = Inv.NextItem(none, none);
01409	        if ( Inv != none )
01410	          Log("  Next Inv="$Inv);
01411	        else
01412	          Log("  Next Inv=NONE");
01413	      }
01414	    }
01415	    Log("END Testing NextItem");
01416	}
01417	*/
01418	
01419	//_____________________________________________________________________________
01420	// ELR Just to cancel it in some states
01421	exec function cPrevItem()
01422	{
01423	    Local inventory tInv;
01424	
01425	    if ( Pawn.region.Zone.FlashEffectDesc.IsActivated )
01426	      return;
01427	
01428	    DebugLog("PREVITEM bWeaponMode="$bWeaponMode@"PendingWeapon="$Pawn.PendingWeapon);
01429	
01430	    if ( DecoWeapon(Pawn.PendingWeapon) != none )
01431	      return;
01432	
01433	//    if ( (XIIIItems(Pawn.SelectedItem) != none) && XIIIItems(Pawn.SelectedItem).bChangeItem && !Pawn.SelectedItem.IsAnimating() )
01434	//    { // Bug chance for freezed inventory switching
01435	//      Pawn.SelectedItem.AnimEnd(0);
01436	//    }
01437	//    if ( (Pawn.Weapon != none) && Pawn.Weapon.bChangeWeapon && !Pawn.Weapon.IsAnimating() )
01438	//    { // Bug chance for freezed inventory switching
01439	//      Pawn.Weapon.AnimEnd(0);
01440	//    }
01441	
01442	    Pawn.PendingWeapon = none;
01443	
01444	    XIIIBaseHud(MyHud).bDrawWeapons=false;
01445	    XIIIBaseHud(MyHud).bDrawItems = true;
01446	    XIIIBaseHud(MyHud).fDrawItemsTimer = 1.0+Level.TimeSeconds;
01447	    XIIIBaseHud(MyHud).fDrawWeaponsTimer = Level.TimeSeconds-1.0;
01448	
01449	//    if ( !bWeaponMode || !bWaitForWeaponMode )
01450	    if ( !bWaitForWeaponMode )
01451	    { // Selecting next item
01452	      DebugLog("  > cPrevItem call in "$self$", switching items w/ SelectedItem="$Pawn.SelectedItem);
01453	      if( Level.Pauser != None )
01454	        return;
01455	      if ( XIIIPawn(Pawn).PendingItem == none )
01456	        XIIIPawn(Pawn).PendingItem = Pawn.Inventory.PrevItem(none, Pawn.SelectedItem);
01457	      else
01458	        XIIIPawn(Pawn).PendingItem = Pawn.Inventory.PrevItem(none, XIIIPawn(Pawn).PendingItem);
01459	      if ( (XIIIPawn(Pawn).PendingItem != None) && (XIIIPawn(Pawn).PendingItem != Pawn.SelectedItem) )
01460	      {
01461	        if(  XIIIItems(Pawn.SelectedItem) != none )
01462	        {
01463	          XIIIItems(Pawn.SelectedItem).PutDown();
01464	          DebugLog("  > cPrevItem puting down"@XIIIItems(Pawn.SelectedItem));
01465	        }
01466	        else
01467	        {
01468	          Pawn.SelectedItem = XIIIPawn(Pawn).PendingItem;
01469	          XIIIItems(XIIIPawn(Pawn).PendingItem).BringUp();
01470	          DebugLog("  > cPrevItem BringUp"@XIIIPawn(Pawn).PendingItem@"because selected = none");
01471	        }
01472	        return;
01473	      }
01474	      if ( (XIIIPawn(Pawn).PendingItem == None) && (Pawn.SelectedItem == none) )
01475	      {
01476	        Warn("!@! PrevItem w/ Pending item & Item none");
01477	        NextWeapon();
01478	        Pawn.ChangedWeapon();
01479	      }
01480	    }
01481	    else
01482	    {
01483	      DebugLog(">>> cPrevItem call in "$self$", going to item mode");
01484	      XIIIBaseHud(MyHud).fDrawItemsTimer = 2.0+Level.TimeSeconds;
01485	      bWaitForWeaponMode = false;
01486	      SwitchWeaponMode();
01487	    }
01488	}
01489	
01490	//_____________________________________________________________________________
01491	// ELR Just to cancel it in some states
01492	exec function cNextItem()
01493	{
01494	    Local inventory tInv;
01495	
01496	    if ( Pawn.region.Zone.FlashEffectDesc.IsActivated )
01497	      return;
01498	
01499	    DebugLog("NEXTITEM bWeaponMode="$bWeaponMode@"PendingWeapon="$Pawn.PendingWeapon);
01500	
01501	    if ( DecoWeapon(Pawn.PendingWeapon) != none )
01502	      return;
01503	
01504	//    if ( (XIIIItems(Pawn.SelectedItem) != none) && XIIIItems(Pawn.SelectedItem).bChangeItem && !Pawn.SelectedItem.IsAnimating() )
01505	//    { // Bug chance for freezed inventory switching
01506	//      Pawn.SelectedItem.AnimEnd(0);
01507	//    }
01508	//    if ( (Pawn.Weapon != none) && Pawn.Weapon.bChangeWeapon && !Pawn.Weapon.IsAnimating() )
01509	//    { // Bug chance for freezed inventory switching
01510	//      Pawn.Weapon.AnimEnd(0);
01511	//    }
01512	
01513	    Pawn.PendingWeapon = none;
01514	
01515	    XIIIBaseHud(MyHud).bDrawWeapons = false;
01516	    XIIIBaseHud(MyHud).bDrawItems = true;
01517	    XIIIBaseHud(MyHud).fDrawItemsTimer = 1.0+Level.TimeSeconds;
01518	    XIIIBaseHud(MyHud).fDrawWeaponsTimer = Level.TimeSeconds-1.0;
01519	
01520	//    if ( !bWeaponMode || !bWaitForWeaponMode )
01521	    if ( !bWaitForWeaponMode )
01522	    { // Selecting next item
01523	      DebugLog("  > cNextItem call in "$self$", switching items w/ SelectedItem="$Pawn.SelectedItem);
01524	      if( Level.Pauser != None )
01525	        return;
01526	      if ( XIIIPawn(Pawn).PendingItem == none )
01527	        XIIIPawn(Pawn).PendingItem = Pawn.Inventory.NextItem(none, Pawn.SelectedItem);
01528	      else
01529	        XIIIPawn(Pawn).PendingItem = Pawn.Inventory.NextItem(none, XIIIPawn(Pawn).PendingItem);
01530	      if ( (XIIIPawn(Pawn).PendingItem != None) && (XIIIPawn(Pawn).PendingItem != Pawn.SelectedItem) )
01531	      {
01532	        if ( XIIIItems(Pawn.SelectedItem) != none )
01533	        {
01534	          XIIIItems(Pawn.SelectedItem).PutDown();
01535	          DebugLog("  > cNextItem puting down"@XIIIItems(Pawn.SelectedItem));
01536	        }
01537	        else
01538	        {
01539	          Pawn.SelectedItem = XIIIPawn(Pawn).PendingItem;
01540	          XIIIItems(XIIIPawn(Pawn).PendingItem).BringUp();
01541	          DebugLog("  > cNextItem BringUp"@XIIIPawn(Pawn).PendingItem@"because selected = none");
01542	        }
01543	        return;
01544	      }
01545	      if ( (XIIIPawn(Pawn).PendingItem == None) && (Pawn.SelectedItem == none) )
01546	      {
01547	        Warn("!@! PrevItem w/ Pending item & Item none");
01548	        NextWeapon();
01549	        Pawn.ChangedWeapon();
01550	      }
01551	    }
01552	    else
01553	    {
01554	      DebugLog(">>> cNextItem call in "$self$", going to item mode");
01555	      XIIIBaseHud(MyHud).fDrawItemsTimer = 2.0+Level.TimeSeconds;
01556	      bWaitForWeaponMode = false;
01557	      SwitchWeaponMode();
01558	    }
01559	}
01560	
01561	//_____________________________________________________________________________
01562	exec function WeaponZoom()
01563	{
01564	//    Log(self@" WeaponZoom");
01565	    if ( (Pawn != None) && (Pawn.Weapon != None) )
01566	    {
01567	      if ( XIIIWeapon(Pawn.Weapon).bHaveAltFire )
01568	      {
01569	//        Log(self@" calling Altfire");
01570	        Pawn.Weapon.AltFire(0);
01571	      }
01572	      else
01573	      {
01574	//        Log(self@" calling zoom");
01575	        Pawn.Weapon.Zoom();
01576	      }
01577	    }
01578	}
01579	
01580	//_____________________________________________________________________________
01581	exec function Grab()
01582	{
01583	    local PowerUps PwrU;
01584	
01585	    DebugLog("GRAB");
01586	    // If in cameraview, restore view instead of interaction
01587	    if ( IsInState('CameraView') )
01588	    {
01589	      RestoreView();
01590	      return;
01591	    }
01592	
01593	    // Hook interactions
01594	    if ( bHooked )
01595	    {
01596	      if ( !bWeaponMode  )
01597	      {
01598	        if ( (Hook(Pawn.SelectedItem) != none) )
01599	        {
01600	          Hook(Pawn.SelectedItem).Release();
01601	          return;
01602	        }
01603	      }
01604	      else if ( bWaitForWeaponMode )
01605	      {
01606	        cNextItem();
01607	        return;
01608	      }
01609	    }
01610	    if ( MyInteraction.bCanHook )
01611	    {
01612	      ActivateItem();
01613	      return;
01614	    }
01615	
01616	    if ( MyInteraction.bCanBreak )
01617	    {
01618	      MyInteraction.TargetActor.TakeDamage(50, Pawn, MyInteraction.TargetActor.Location, vect(0,0,0), class'DTFisted');
01619	      MyInteraction.TargetActor = none;
01620	      return;
01621	    }
01622	
01623	    // Priority to interaction w/ door
01624	    if ( MyInteraction.bCanDoor && !MyInteraction.bCanTrigger )
01625	    {
01626	      if ( MyInteraction.bCanUnLockDoor )
01627	      {
01628	        PwrU = TryInteractWithDoor(MyInteraction.TargetActor);
01629	        if ( ( bWeaponMode ) && (PwrU != none) )
01630	        {
01631	          cNextItem();
01632	          XIIIPawn(Pawn).PendingItem = PwrU;
01633	          if ( (XIIIPawn(Pawn).PendingItem != None) && (XIIIPawn(Pawn).PendingItem != Pawn.SelectedItem) )
01634	            XIIIItems(Pawn.SelectedItem).PutDown();
01635	          return;
01636	        }
01637	        else if ( (!bWeaponMode) && (PwrU != none) )
01638	        {
01639	          if (PwrU == Pawn.SelectedItem)
01640	            Pawn.SelectedItem.Activate();
01641	          else
01642	          {
01643	            cNextItem();
01644	            XIIIPawn(Pawn).PendingItem = PwrU;
01645	            if ( (XIIIPawn(Pawn).PendingItem != None) && (XIIIPawn(Pawn).PendingItem != Pawn.SelectedItem) )
01646	              XIIIItems(Pawn.SelectedItem).PutDown();
01647	          }
01648	          return;
01649	        }
01650	        else if ( XIIIMover(MyInteraction.TargetActor) != none )
01651	        {
01652	          if ( XIIIBaseHud(MyHud).HudDlg == none ) // only send this message if not in a dialog already
01653	            MyHud.LocalizedMessage( class'XIIIDialogMessage', 1, none, none, none, XIIIMover(MyInteraction.TargetActor).LockedMessage );
01654	          return;
01655	        }
01656	      }
01657	      else
01658	      {
01659	        if ( XIIIMover(MyInteraction.TargetActor) != none )
01660	        {
01661	          XIIIMover(MyInteraction.TargetActor).PlayerTrigger(self, Pawn);
01662	          XIIIPawn(Pawn).PlayOpenDoor();
01663	          return;
01664	        }
01665	        else if ( MagneticPassTrigger(MyInteraction.TargetActor) != none )
01666	        {
01667	          MagneticPassTrigger(MyInteraction.TargetActor).PlayerTrigger(self, Pawn);
01668	          XIIIPawn(Pawn).PlayOpenDoor();
01669	          return;
01670	        }
01671	      }
01672	    }
01673	
01674	    // next priority to search a corpse
01675	    if ( MyInteraction.bCanSearchCorpse )
01676	    {
01677	      SearchPawn(XIIIPawn(MyInteraction.TargetActor));
01678	      return;
01679	    }
01680	
01681	    if ( MyInteraction.bCanPickup )
01682	    {
01683	      DebugLog("GRAB PICKUP");
01684	      if ( MyInteraction.TargetActor.IsA('XIIIDecoPickup')
01685	//        && ((DecoWeapon(Pawn.Weapon) != none) || (DecoWeapon(Pawn.PendingWeapon) != none)) )
01686	        && ((DecoWeapon(Pawn.PendingWeapon) != none) || (DecoWeapon(Pawn.Weapon) != none)) )
01687	        return;
01688	      bPickingUp = true;
01689	      MyInteraction.TargetActor.Touch(Pawn);
01690	      bPickingUp = false;
01691	      MyInteraction.TargetActor = none;
01692	      return;
01693	    }
01694	
01695	    // then trigger actor
01696	    if ( MyInteraction.bCanTrigger )
01697	    {
01698	      PwrU = TryInteractWithTrigger(MyInteraction.TargetActor);
01699	//      Log("GRAB TRIGGER, Interaction item should be PwrU="$PwrU);
01700	      if ( ( bWeaponMode ) && (PwrU != none) )
01701	      {
01702	        cNextItem();
01703	        XIIIPawn(Pawn).PendingItem = PwrU;
01704	        if ( (XIIIPawn(Pawn).PendingItem != None) && (XIIIPawn(Pawn).PendingItem != Pawn.SelectedItem) )
01705	          XIIIItems(Pawn.SelectedItem).PutDown();
01706	      }
01707	      else if ( (!bWeaponMode) && (PwrU != none) )
01708	      {
01709	        if (PwrU == Pawn.SelectedItem)
01710	          Pawn.SelectedItem.Activate();
01711	        else
01712	        {
01713	          cNextItem();
01714	          XIIIPawn(Pawn).PendingItem = PwrU;
01715	          if ( (XIIIPawn(Pawn).PendingItem != None) && (XIIIPawn(Pawn).PendingItem != Pawn.SelectedItem) )
01716	            XIIIItems(Pawn.SelectedItem).PutDown();
01717	        }
01718	      }
01719	      else
01720	        XIIITriggers(MyInteraction.TargetActor).PlayerTrigger(self, Pawn);
01721	      return;
01722	    }
01723	
01724	    if ( MyInteraction.bCantDoor )
01725	    {
01726	      XIIIMover(MyInteraction.TargetActor).PlayerTrigger(self, Pawn);
01727	      return;
01728	    }
01729	
01730	    // next priority to grab/ungrab pawn
01731	    if ( XIIIPawn(Pawn).LHand != none )
01732	    {
01733	      if ( XIIIPawn(Pawn).LHand.pOnShoulder != none )
01734	      {
01735	        XIIIPawn(Pawn).LHand.UnGrabPawn();
01736	        return;
01737	      }
01738	      else if (
01739	          (MyInteraction.bCanGrabCorpse && XIIIPawn(Pawn).CanGrabCorpse(XIIIPawn(MyInteraction.TargetActor)) )
01740	       || (MyInteraction.bCanTakePrisonner && XIIIPawn(Pawn).CanTakePrisonner(XIIIPawn(MyInteraction.TargetActor))) )
01741	      {
01742	        if ( bWeaponMode && Pawn.Weapon.bHaveSlave )
01743	          Pawn.Weapon.MySlave.PutDown();
01744	        XIIIPawn(Pawn).LHand.GrabPawn(XIIIPawn(MyInteraction.TargetActor));
01745	        XIIIPawn(Pawn).CheckMaluses();
01746	        return;
01747	      }
01748	    }
01749	
01750	    if ( bWeaponMode && (Pawn.Weapon.Default.ReloadCount > Pawn.Weapon.ReloadCount) )
01751	    {
01752	      ReLoad();
01753	      return;
01754	    }
01755	
01756	    if ( !bWeaponMode && Pawn.SelectedItem.IsA('Med') )
01757	    {
01758	      Pawn.SelectedItem.Activate();
01759	      return;
01760	    }
01761	}
01762	
01763	//_____________________________________________________________________________
01764	// The player wants to active selected item
01765	exec function ActivateItem()
01766	{
01767	    DebugLog("Activate Item"@Pawn.SelectedItem);
01768	    if ( Level.Pauser!=None )
01769	      return;
01770	    if ( (Pawn != None) && (Pawn.SelectedItem!=None) )
01771	      Pawn.SelectedItem.Activate();
01772	}
01773	
01774	//_____________________________________________________________________________
01775	// ELR - Do we still pick the lock ? return true if no.
01776	function bool CanUseLockPick()
01777	{
01778	    if ( XIIIPorte(MyInteraction.TargetActor) == none )
01779	      return false;
01780	    return ( XIIIPorte(MyInteraction.TargetActor).IsInState('Locked') );
01781	}
01782	
01783	//_____________________________________________________________________________
01784	// ELR - Do we still pick the lock ? return true if no.
01785	function bool CheckPickLock()
01786	{
01787	    local actor HitActor;
01788	
01789	    HitActor = MyInteraction.TargetActor;
01790	    if ( (HitActor == none) || (aDoor != HitActor) )
01791	    {
01792	      if ( aDoor != none )
01793	        aDoor.UnTrigger( Pawn.SelectedItem, pawn );
01794	      aDoor = none;
01795	      return true;
01796	    }
01797	    if ( aDoor.IsInState('PlayerTriggerToggle') )
01798	    { // Unlocked
01799	      aDoor = none;
01800	      MyHud.LocalizedMessage(class'XIIISoloMessage', 2);
01801	    }
01802	    return false;
01803	}
01804	
01805	//_____________________________________________________________________________
01806	// ELR - Do we still pick the lock ? return true if no.
01807	function CancelPickLock()
01808	{
01809	    if ( aDoor != none )
01810	      aDoor.UnTrigger( Pawn.SelectedItem, pawn );
01811	    aDoor = none;
01812	}
01813	
01814	//_____________________________________________________________________________
01815	// ELR - Here we define if the controller allow the use of a lockpick
01816	function bool TryPickLock()
01817	{
01818	    aDoor = XIIIPorte(MyInteraction.TargetActor);
01819	//    DebugLog("TryPickLock "$aDoor);
01820	    if ( (aDoor != none) && aDoor.IsInState('Locked') )
01821	    {
01822	      aDoor.Trigger( Pawn.SelectedItem, Pawn );
01823	//      MyHud.LocalizedMessage(class'XIIISoloMessage', 1);
01824	      return true;
01825	    }
01826	    else
01827	      aDoor = none;
01828	    return false;
01829	}
01830	
01831	//_____________________________________________________________________________
01832	// return the inventory object to be used to interact with A
01833	// should be used w/ Grab Controller function to automatically get the item out.
01834	function PowerUps TryInteractWithDoor(actor A)
01835	{
01836	  Local XIIIPorte XP;
01837	  local PowerUps I;
01838	
01839	  XP = XIIIPorte(A);
01840	  if ( (XP != none) && XP.IsInState('Locked') )
01841	  {
01842	    I = XIIIPawn(Pawn).FindPowerUpItemName(XP.UnLockItemName);
01843	    if ( I == none )
01844	      I = XIIIPawn(Pawn).FindPowerUpItemName(XP.UnLockItemCode);
01845	//    Log(">> "$I$" should be used to interact with "$A);
01846	    return I;
01847	  }
01848	
01849	  return none;
01850	}
01851	
01852	//_____________________________________________________________________________
01853	// return the inventory object to be used to interact with A
01854	// should be used w/ Grab Controller function to automatically get the item out.
01855	function PowerUps TryInteractWithTrigger(actor A)
01856	{
01857	  Local XIIITriggers XT;
01858	  local PowerUps I;
01859	
01860	  XT = XIIITriggers(A);
01861	  if ( XT != none )
01862	  {
01863	//    Log("TryInteractWithTrigger XT="$XT$" TAG="$XT.Tag);
01864	    I = XIIIPawn(Pawn).FindPowerUpItemNameForTrigger(XT.Tag);
01865	//    Log(">> "$I$" should be used to interact with "$A);
01866	    return I;
01867	  }
01868	
01869	  return none;
01870	}
01871	
01872	//_____________________________________________________________________________
01873	// ::TODO:: put in native (may not optimize the trace but everytinh else & called each frame so...)
01874	function actor ReturnTrace(out vector HitLoc, out vector HitNorm, vector End, vector Start, bool bActor, optional vector Extent, optional out Material HitMat, optional int TraceType)
01875	{
01876	    local actor PickMe, PotentialDoor;
01877	    local vector HitLoc2, HitNorm2;
01878	
01879	    foreach TraceActors(class'actor', Pickme, HitLoc, HitNorm, End, Start, vect(0,0,0), TraceType)
01880	    {
01881	      if ( Pickme == Level ) // stop the iterator at first Level hit
01882	        return none;
01883	      if ( (Pickme != none) && Pickme.bInteractive && (PickMe != Pawn) )
01884	      {
01885	        if ( XIIIPorte(Pickme) != none )
01886	        {
01887	          PotentialDoor = Trace(HitLoc2, HitNorm2, HitLoc - HitNorm, Start, false, vect(0,0,0), HitMat, TraceType);
01888	          if ( PotentialDoor != none )
01889	          {
01890	            HitLoc = hitLoc2;
01891	            HitNorm = hitNorm2;
01892	            Pickme = PotentialDoor;
01893	            return PickMe;
01894	          }
01895	          else if ( FastTrace(HitLoc, Start) )
01896	            return PickMe;
01897	        }
01898	        else
01899	        {
01900	          if ( FastTrace(HitLoc, Start) )
01901	          {
01902	            if ( Pickup(PickMe) != none )
01903	              return PickMe;
01904	            else
01905	              return PickMe;
01906	          }
01907	        }
01908	      }
01909	    }
01910	    return none;
01911	}
01912	
01913	//_____________________________________________________________________________
01914	function bool AllowHooking()
01915	{
01916	    return ( !bWeaponMode && (Hook(Pawn.SelectedItem)!=none) );
01917	}
01918	
01919	//_____________________________________________________________________________
01920	// ELR - check if we can send the controller into Tyrol state
01921	function bool TryTyroling()
01922	{
01923	    return true;
01924	}
01925	
01926	//_____________________________________________________________________________
01927	// Set up the tyroling params, called by TyrolTrigger
01928	function GoTyroling(XIIITyrolNavPoint StartPoint, XIIITyrolNavPoint EndPoint, float TyrolSpeed)
01929	{
01930	//    Log("SetUpTyrol w/ StartPoint="$StartPoint$" EndPoint="$EndPoint$" TyrolSpeed="$TyrolSpeed);
01931	    fTyrolSpeed = TyrolSpeed;
01932	    vTyrolStart = StartPoint.Location - vect(0,0,1)*Pawn.CollisionHeight;
01933	    vTyrolEnd = EndPoint.Location - vect(0,0,1)*Pawn.CollisionHeight;
01934	    vTyrolDir = normal(vTyrolEnd - vTyrolStart);
01935	    Pawn.SetPhysics(PHYS_None);
01936	    Pawn.SetLocation(vTyrolStart);
01937	    Pawn.SetRotation(rotator(vTyrolDir));
01938	    Pawn.Velocity = vTyrolDir * 5.0;
01939	    Pawn.Acceleration = vect(0,0,0);
01940	    SetLocation(vTyrolStart);
01941	    SetRotation(rotator(vTyrolDir));
01942	    gotoState('Tyroling');
01943	}
01944	
01945	//_____________________________________________________________________________
01946	function SearchPawn(XIIIPawn P)
01947	{
01948	    local inventory I, OwnI;
01949	    local class<ammo> A;
01950	    local bool bDBSearch;
01951	    local ammunition IAmmo, IAltAmmo;
01952	
01953	    bDBSearch = false;
01954	
01955	    if ( !P.bIsDead )
01956	      return;
01957	    if ( bDBSearch ) Log(" investigating "$P$" corpse");
01958	
01959	    XIIIPawn(Pawn).PlaySearchCorpse();
01960	
01961	//    XIIICheatManager(CheatManager).LogInventory();
01962	    if (P.Inventory == none)
01963	    {
01964	      ReceiveLocalizedMessage( class'XIIISoloMessage', 4, None, None);
01965	      return;
01966	    }
01967	
01968	    if ( P.Shadow != none )
01969	    {
01970	      P.Shadow.bShadowIsStatic = false;
01971	      P.SetTimer2(0.2, false);
01972	    }
01973	
01974	    if ( bDBSearch ) Log(">>> SearchPawn");
01975	    I = P.Inventory;
01976	    while ( I != none )
01977	    {
01978	      if ( bDBSearch )
01979	      {
01980	        if ( Weapon(I) != none )
01981	          Log(" >> Processing Weapon "$I$" ReloadCount="$Weapon(I).ReloadCount@"AmmoType="$Weapon(i).AmmoType@"AltAmmoType="$Weapon(i).AltAmmoType);
01982	        else
01983	          Log(" >> Processing "$I);
01984	      }
01985	      I.Transfer(Pawn); // all transfer handling is in subclasses.
01986	      I = P.Inventory;
01987	    }
01988	}
01989	
01990	//_____________________________________________________________________________
01991	// ELR Added to make b180Left and b180Right working.
01992	// (Actually used as b90Left and b90Right :)
01993	function TurnAround()
01994	{
01995	    if ( !bSetTurnRot )
01996	    {
01997	      TurnRot180 = Rotation;
01998	      // For 90° turn
01999	      TurnRot180.Yaw += 16384 * (b90Right - b90Left);
02000	      // For 180° turn
02001	      TurnRot180.Yaw += 32768 * b180turn;
02002	      bSetTurnRot = true;
02003	    }
02004	    DesiredRotation = TurnRot180;
02005	    bTurnWanted = ( DesiredRotation.Yaw != Rotation.Yaw );
02006	}
02007	
02008	//_____________________________________________________________________________
02009	// Simulated weapon feedback
02010	// Not called by H2HAmmo
02011	function ClientViewFeedBackSetup(class<XIIIWeapon> WeapClass, optional bool bAmplify)
02012	{
02013	    if ( bAmplify ) // used for dual weapons amplified feedback
02014	      vWeaponFeedBack += vect(1.5,0,0)*WeapClass.default.ViewFeedBack.x*(fRand()-0.5) + vect(0,1.5,0)*WeapClass.default.ViewFeedBack.y*(abs(fRand()*0.7)+0.3);
02015	    else
02016	      vWeaponFeedBack = vect(0.5,0,0)*WeapClass.default.ViewFeedBack.x*(fRand()-0.5) + vect(0,0.5,0)*WeapClass.default.ViewFeedBack.y*(abs(fRand()*0.7)+0.3);
02017	    if ( (Level.GetPlateforme() == 1) || (Level.GetPlateforme() == 3) ) // PS2 + GC, reduce feedback
02018	      vWeaponFeedBack *= 0.4;
02019	}
02020	
02021	//_____________________________________________________________________________
02022	// Simulated weapon feedback
02023	// Not called by H2HAmmo
02024	function ClientViewAltFeedBackSetup(class<XIIIWeapon> WeapClass, optional bool bAmplify)
02025	{
02026	    if ( bAmplify ) // used for dual weapons amplified feedback
02027	      vWeaponFeedBack = vect(1.5,0,0)*WeapClass.default.AltViewFeedBack.x*(fRand()-0.5) + vect(0,1.5,0)*WeapClass.default.AltViewFeedBack.y*(abs(fRand()*0.7)+0.3);
02028	    else
02029	      vWeaponFeedBack = vect(0.5,0,0)*WeapClass.default.AltViewFeedBack.x*(fRand()-0.5) + vect(0,0.5,0)*WeapClass.default.AltViewFeedBack.y*(abs(fRand()*0.7)+0.3);
02030	    if ( (Level.GetPlateforme() == 1) || (Level.GetPlateforme() == 3) ) // PS2 + GC, reduce feedback
02031	      vWeaponFeedBack *= 0.4;
02032	}
02033	
02034	//_____________________________________________________________________________
02035	function UpdateRotation(float DeltaTime, float maxPitch)
02036	{
02037	    local rotator newRotation, ViewRotation;
02038	    local int WeaponFeedBackPitch;
02039	    local vector LocalAim;
02040	    local int i;
02041	    local float fSpeedLimit, fDistFact;
02042	
02043	    if ( bInterpolating || ((Pawn != None) && Pawn.bInterpolating) )
02044	    { // only treat shakes when interpolating
02045	      ViewShake(deltaTime);
02046	      return;
02047	    }
02048	
02049	    ViewRotation = Rotation;
02050	    DesiredRotation = ViewRotation; //save old rotation
02051	
02052	    if ( (b90Left != 0) || (b90Right != 0) || (b180Turn != 0) )
02053	      TurnAround();
02054	    else
02055	      bSetTurnRot = false;
02056	
02057	    if ( bTurnToNearest != 0 )
02058	      TurnTowardNearestEnemy();
02059	    else if ( Pawn != none )
02060	    {
02061	      TurnTarget = None;
02062	      if ( bTurnWanted )
02063	      {
02064	        ViewRotation.Yaw = (ViewRotation.Yaw * (1/Deltatime)/10 + DesiredRotation.Yaw)/((1/Deltatime)/10+1);
02065	      }
02066	      bTurnWanted = false;
02067	
02068	      if ( !bFixedCrosshair )
02069	      {
02070	        // ELR Try reducing turn speed when locking someone.
02071	        if ( bLocked )
02072	        {
02073	//          aTurn *= 0.5;
02074	//          aLookUp *= 0.5;
02075	          fSpeedLimit = fClamp(Abs(LocalAim.Y) / 0.7, 0.5, 1.0);
02076	          PlayerInput.ViewTurnAcc = fClamp(PlayerInput.ViewTurnAcc, -fSpeedLimit, fSpeedLimit);
02077	          PlayerInput.ViewUpAcc = fClamp(PlayerInput.ViewUpAcc, -0.5, 0.5); // don't limit as much as pawns have more height than width.
02078	          PlayerInput.ViewTurnBoost = 0.0;
02079	          if ( bRotationAssist && (aTurn == 0) && ((aStrafe != 0) || (aForward != 0)) && (Level.Game != none) && (Level.Game.Difficulty <= 1) )
02080	  //        if ( bRotationAssist && ((aStrafe != 0) || (aForward != 0)) && (Level.Game != none) && (Level.Game.Difficulty <= 1) )
02081	  //        if ( bRotationAssist )// && (aTurn == 0) ) // test, to help guys w/ no arms playing XIII
02082	          { // Assist rotation toward besttarget
02083	            LocalAim = OldAdjustAim << Rotation; // Adjustaim vector in local coords
02084	            aTurn += LocalAim.y * 1800;
02085	          }
02086	        }
02087	      }
02088	      else
02089	      {
02090	        //============== CYD+b
02091	        // mode bFixedCrosshair : true
02092	
02093	        if ( bLocked )
02094	        {
02095	          // AdjustAim vector in local coords
02096	          LocalAim = OldAdjustAim << Rotation;
02097	          fDistFact = fClamp(vSize(BestTarget.Location - Pawn.Location)/3000.f, 0.1, 1.0);
02098	
02099	//          Log("turning toward target="$(aTurn*LocalAim.Y >= 0));
02100	          // TURN SPEED
02101	          fSpeedLimit = fClamp(Abs(LocalAim.Y) / 0.7 / fDistFact, 0.40, 1.0);
02102	          // Try to avoid 'bumper' effect
02103	          PlayerInput.ViewTurnAcc = fClamp(PlayerInput.ViewTurnAcc, -fSpeedLimit, fSpeedLimit);
02104	          PlayerInput.ViewUpAcc = fClamp(PlayerInput.ViewUpAcc, -0.5, 0.5); // don't limit as much as pawns have more height than width.
02105	          PlayerInput.ViewTurnBoost = 0.0;
02106	
02107	          // HELP ON TARGETING
02108	          if ( bRotationAssist
02109	            && (aTurn == 0) && (aLookUp == 0)
02110	            && ((aStrafe != 0) || (aForward != 0))
02111	            && ( (Level.Game == none) // either on Clients
02112	               || !Level.bLonePlayer  // or not in solo
02113	               || (Level.Game.Difficulty <= 1)) )  // or in solo w/ low difficulty
02114	          {
02115	            if (aStrafe != 0)
02116	            {
02117	              aTurn += localAim.y * 200.0;
02118	              if( !Pawn.bIsCrouched )
02119	              {
02120	                aTurn -= aStrafe * 0.048f * (1.0-fDistFact)*(1.0-fDistFact);
02121	              }
02122	            }
02123	            if (aForward != 0) // Help more if player moving forward/backward
02124	              aTurn += 315.f * LocalAim.y;
02125	
02126	            // limit feedback & try to avoid speed up when exiting 'cushion'
02127	            vWeaponFeedBack.y       *= 0.90f;
02128	            vWeaponFeedBackReturn.y *= 0.90f;
02129	          }
02130	        }
02131	        //============== CYD+e
02132	      }
02133	
02134	      // if turning around, SpeedUp taptaps fade
02135	      if ( (aTurn != 0) || (aLookUp != 0) )
02136	        for (i=0; i<5; i++ )
02137	          if ( MyHud.fDrawSixSenseTimer[i] > 0 )
02138	            MyHud.fDrawSixSenseTimer[i] -= XIIIBaseHud(MyHud).dT*6.0;
02139	
02140	      if ( bCenterView )
02141	      {
02142	//        Log("Cancelling aLook because centerview command");
02143	        aLookUp = 0;
02144	      }
02145	      // ELR WeaponFeedBack
02146	      if ( Pawn.IsLocallyControlled() && ((abs(vWeaponFeedBack.y) > 0.1) || (abs(vWeaponFeedBack.x) > 0.1))
02147	        )
02148	      { // Move view because of weapon feedback
02149	        vWeaponFeedBack.x *= 1.0 - fMin(1.0, 0.25 * 64.0 * DeltaTime); // not really proportional to framerate but
02150	        vWeaponFeedBack.y *= 1.0 - fMin(1.0, 0.25 * 64.0 * DeltaTime); // sfx is more attenuated if low framerate so it's ok
02151	
02152	        WeaponFeedBackPitch = (100.0 * vWeaponFeedBack.y) * 64 * DeltaTime + ViewRotation.Pitch;
02153	        WeaponFeedBackPitch = WeaponFeedBackPitch & 65535;
02154	        // Memorize offset
02155	        If ((WeaponFeedBackPitch < 15500) || (WeaponFeedBackPitch > 50000))
02156	        { // only memorize this displacement if it will occur (not limited by view)
02157	          vWeaponFeedBackReturn.y += 100.0 * vWeaponFeedBack.y * 64 * DeltaTime;
02158	        }
02159	        // these one are memorized
02160	        vWeaponFeedBackReturn.x += 100.0 * vWeaponFeedBack.x * 64 * DeltaTime;
02161	        vWeaponFeedBackReturn.y += aLookUp;
02162	        // Update view
02163	        aTurn += 100.0 * vWeaponFeedBack.x * 64 * DeltaTime;
02164	        aLookUp += 100.0 * vWeaponFeedBack.y * 64 * DeltaTime;
02165	        // reduce effect
02166	      }
02167	      else
02168	      { // Return smoothly to pos.
02169	//        XIIIPawn(Pawn).bJumpFeedBack=false;
02170	        aTurn -= vWeaponFeedBackReturn.x * 0.20 * 64 * DeltaTime;
02171	        aLookUp -= vWeaponFeedBackReturn.y * 0.20 * 64 * DeltaTime;
02172	        vWeaponFeedBackReturn *= (1.0 - 0.20 * 64 * DeltaTime);
02173	        vWeaponFeedBack *= (1.0 - 0.20 * 64 * DeltaTime);
02174	      }
02175	      // End Weapon FeedBack
02176	
02177	/*
02178	var config bool bCheckTurnSpeed;// check turning speed
02179	var float fTurnSpeed[5];        // store turning values (90/180/270/360/720°)
02180	var float fTurnDeltaTime;       // time cumul
02181	*/
02182	/*
02183	      // Check turning speed
02184	      if ( bCheckTurnSpeed )
02185	      {
02186	        if ( aTurn != 0 )
02187	        {
02188	          fTurnInc += abs(43.0 * DeltaTime * aTurn);
02189	
02190	          fTurnDeltaTime += DeltaTime;
02191	          if ( fTurnSpeed[0] == 0.0 )
02192	          { // first check
02193	            if ( fTurnInc > 65536/4.0 )
02194	            {
02195	              fTurnSpeed[0] = fTurnDeltaTime;
02196	              fTurnSpeed[1] = 0.0;
02197	              MyHud.Message(none, "90 turn "$fTurnSpeed[0], 'CHEAT');
02198	            }
02199	          }
02200	          else if ( fTurnSpeed[1] == 0.0 )
02201	          { // first check
02202	            if ( fTurnInc > 65536/2.0 )
02203	            {
02204	              fTurnSpeed[1] = fTurnDeltaTime;
02205	              fTurnSpeed[2] = 0.0;
02206	              MyHud.Message(none, "180 turn "$fTurnSpeed[1], 'CHEAT');
02207	            }
02208	          }
02209	          else if ( fTurnSpeed[2] == 0.0 )
02210	          { // first check
02211	            if ( fTurnInc > 65536*3.0/4.0 )
02212	            {
02213	              fTurnSpeed[2] = fTurnDeltaTime;
02214	              fTurnSpeed[3] = 0.0;
02215	              MyHud.Message(none, "270 turn "$fTurnSpeed[2], 'CHEAT');
02216	            }
02217	          }
02218	          else if ( fTurnSpeed[3] == 0.0 )
02219	          { // first check
02220	            if ( fTurnInc > 65536 )
02221	            {
02222	              fTurnSpeed[3] = fTurnDeltaTime;
02223	              fTurnSpeed[4] = 0.0;
02224	              MyHud.Message(none, "360 turn "$fTurnSpeed[3], 'CHEAT');
02225	            }
02226	          }
02227	          else if ( fTurnSpeed[4] == 0.0 )
02228	          { // first check
02229	            if ( fTurnInc > 65536*2 )
02230	            {
02231	              fTurnSpeed[4] = fTurnDeltaTime;
02232	              MyHud.Message(none, "720 turn "$fTurnSpeed[4], 'CHEAT');
02233	            }
02234	          }
02235	
02236	
02237	        }
02238	        else
02239	        {
02240	          fTurnDeltaTime = 0.0;
02241	          fTurnSpeed[0] = 0.0;
02242	          fTurnInc = 0;
02243	        }
02244	      }
02245	*/
02246	      if ( DesiredFOV != DefaultFov )
02247	      {
02248	        ViewRotation.Yaw += 21.5 * DeltaTime * aTurn;
02249	        ViewRotation.Pitch += 21.5 * DeltaTime * aLookUp;
02250	      }
02251	      else
02252	      {
02253	        ViewRotation.Yaw += 43.0 * DeltaTime * aTurn;
02254	        ViewRotation.Pitch += 43.0 * DeltaTime * aLookUp;
02255	      }
02256	
02257	      // ELR Handle the SniperSkill Here
02258	      if ( (DesiredFOV != defaultFov) && (Pawn!=none) && Level.bLonePlayer && !XIIIPlayerPawn(Pawn).bIsSniper )
02259	      {
02260	        if ( Pawn.Acceleration == vect(0,0,0) )
02261	        {
02262	          if ( Pawn.bIsCrouched )
02263	            fSniperPrecision = fmax(0.0, fSniperPrecision - DeltaTime/3.0);
02264	          else
02265	            fSniperPrecision = fmax(0.0, fSniperPrecision - DeltaTime/6.0);
02266	        }
02267	        else
02268	          fSniperPrecision = fMin(1.0, fSniperPrecision + DeltaTime/1.8);
02269	        ViewRotation.Pitch -= SniperPitch;
02270	        Viewrotation.Yaw -= SniperYaw;
02271	        // End reinit Viewrotation
02272	        // Processing of SniperPitch & SniperYaw
02273	        vSniperOffset.z = 0.0;
02274	        vSniperOffsetSpeed.z = 0.0;
02275	        vSniperOffset += vSniperOffsetSpeed * (DeltaTime/1000.0);
02276	        vSniperOffsetSpeed -= (vSniperOffset) / (DeltaTime*Deltatime*200.0);
02277	        vSniperOffsetSpeed += normal(vSniperOffset cross vect(0,0,1)) * 8.0;
02278	        if ( vSize(vSniperOffsetSpeed) > 4000.0 )
02279	          vSniperOffsetSpeed = normal(vSniperOffsetSpeed)*4000.0;
02280	        SniperPitch = fSniperPrecision * 212.0 * sin(vsniperOffset.X) * ((DefaultFov - DesiredFOV) / DefaultFov);
02281	        SniperYaw = fSniperPrecision * 212.0 * sin(vsniperOffset.Y) * ((DefaultFov - DesiredFOV) / DefaultFov);
02282	        // End Processing
02283	        // Set Viewrotation
02284	        Viewrotation.Pitch += SniperPitch;
02285	        Viewrotation.Yaw += SniperYaw;
02286	      }
02287	      else if ( pawn != none )
02288	      { // ::TODO:: this is executed each frame whne not sniping, should be optimized
02289	        if ( XIIIPlayerPawn(Pawn).bIsSniper )
02290	          fSniperPrecision = 0.0;
02291	        else
02292	        {
02293	          fSniperPrecision = 1.0;
02294	          vSniperOffset = vRand()*1.56;
02295	          vSniperOffsetSpeed = vRand();
02296	          SniperPitch = 0.0;
02297	          SniperYaw = 0.0;
02298	        }
02299	      }
02300	      // END Sniper Handle
02301	    }
02302	
02303	    ViewRotation.Pitch = ViewRotation.Pitch & 65535;
02304	    if ((ViewRotation.Pitch > 15500) && (ViewRotation.Pitch < (50000+15500)/2))
02305	      ViewRotation.Pitch = 15500;
02306	    else if ((ViewRotation.Pitch > (50000+15500)/2) && (ViewRotation.Pitch < 50000))
02307	      ViewRotation.Pitch = 50000;
02308	/*
02309	    if ((ViewRotation.Pitch > 15500) && (ViewRotation.Pitch < 50000))
02310	    {
02311	      if (aLookUp > 0)
02312	        ViewRotation.Pitch = 15500;
02313	      else if (aLookUp < 0)
02314	        ViewRotation.Pitch = 50000;
02315	    }
02316	*/
02317	
02318	    SetRotation(ViewRotation);
02319	    ViewShake(deltaTime);
02320	    ViewFlash(deltaTime);
02321	
02322	    NewRotation = ViewRotation;
02323	    NewRotation.Roll = Rotation.Roll;
02324	
02325	    If ( (newRotation.Pitch > maxPitch * RotationRate.Pitch) && (newRotation.Pitch < 65536 - maxPitch * RotationRate.Pitch) )
02326	    {
02327	      If (ViewRotation.Pitch < 32768)
02328	        newRotation.Pitch = maxPitch * RotationRate.Pitch;
02329	      else
02330	        newRotation.Pitch = 65536 - maxPitch * RotationRate.Pitch;
02331	    }
02332	    if ( !bRotateToDesired && (Pawn != None) && (!bFreeCamera || !bBehindView) )
02333	      Pawn.FaceRotation(newRotation, deltatime);
02334	
02335	//    Pawn.ControllerPitch = newRotation.Pitch;
02336	
02337	//    log("Update Pitch");
02338	}
02339	
02340	//_____________________________________________________________________________
02341	function SetCamView( actor C, optional float F )
02342	{
02343	    if ( F==0 )
02344	      F = 90;
02345	    GotoState('CameraView');
02346	    CamView = C;
02347	    DT_mem = C.DrawType;
02348	    C.SetDrawType(DT_none);
02349	//    SetViewTarget(C);
02350	    DesiredFOV = F;
02351	    FOVAngle = F;
02352	    DefaultFov = F;
02353	}
02354	
02355	function SetCamViewPortal( actor C, optional float F )
02356	{
02357	  if (CamView != C)
02358	  {
02359	    if ( F == 0 )
02360	      F = 90;
02361	    CamView = C;
02362	    CamView.Trigger(self, Pawn);
02363	  }
02364	}
02365	
02366	//_____________________________________________________________________________
02367	function RestoreView()
02368	{
02369	//    SetViewTarget(Pawn);
02370	    GotoState('PlayerWalking');
02371	    CamView.SetDrawType(DT_mem);
02372	    DefaultFOV = default.DefaultFOV;
02373	    DesiredFOV = DefaultFOV;
02374	    FOVAngle = DefaultFOV;
02375	}
02376	
02377	//_____________________________________________________________________________
02378	// ELR - Here we send the controller into hooked state
02379	function GoHooking(Hook H)
02380	{
02381	    HookUsed = H;
02382	    bHooked = true;
02383	//    GotoState('Hooked');
02384	}
02385	
02386	//_____________________________________________________________________________
02387	// at top of a rope, climb up to the hooknavpoint
02388	function GoClimbHookNavPoint(HookPoint HP, HookNavPoint HNP)
02389	{
02390	    ClimbHookPoint = HP;
02391	    TargetHookClimb = HNP;
02392	    bHooked = false;
02393	    GotoState('ClimbToHookNavPoint');
02394	}
02395	
02396	/*
02397	//_____________________________________________________________________________
02398	// ELR
02399	function bool NearWall(float walldist)
02400	{
02401	    local actor HitActor;
02402	    local vector HitLocation, HitNormal, ViewSpot, ViewDist, LookDir;
02403	
02404	    LookDir = vector(Rotation);
02405	    ViewSpot = Pawn.Location + Pawn.BaseEyeHeight * vect(0,0,1);
02406	    ViewDist = LookDir * walldist;
02407	    HitActor = Trace(HitLocation, HitNormal, ViewSpot + ViewDist, ViewSpot, false);
02408	    if ( HitActor == None )
02409	      return false;
02410	    return true;
02411	}
02412	*/
02413	
02414	//_____________________________________________________________________________
02415	function bool TryClimbDoor(actor pDoorLocked, vector pDoorLockedPos, vector pDoorLockedNormal)
02416	{
02417	    local vector X, Y, Z, Start, End, HitLoc, HitNorm;
02418	    local actor A;
02419	
02420	    if ( (XIIIPawn(Pawn).LHand.pOnShoulder != none) || Pawn.bIsCrouched || (XIIIPorte(pDoorLocked)==none) )
02421	      return false;
02422	
02423	    if ( bWeaponMode && (Pawn.Weapon.WHand == WHA_Deco) )
02424	      return false;
02425	
02426	    if ( !XIIIPorte(pDoorLocked).bClimbAble )
02427	      return false;
02428	//    if ( !XIIIPorte(pDoorLocked).bOpened && !XIIIPorte(pDoorLocked).bClosed) )
02429	    if ( !XIIIPorte(pDoorLocked).bOpened )
02430	      return false; // don't climb if the door is moving or not climbable.
02431	
02432	    GetAxes(Rotation,X,Y,Z);
02433	//    if ( X.z > -0.25 ) // ELR Just check we are not looking really down
02434	//    {
02435	      Start = pDoorLockedPos + pDoorLockedNormal;
02436	      End = Start + vect(0,0,1) * Pawn.CollisionHeight;
02437	      if ( FastTrace(End,Start) )
02438	      {
02439	        A=Trace(HitLoc, HitNorm, End, Start, false);
02440	        return true;
02441	      }
02442	//    }
02443	    return false;
02444	}
02445	
02446	//_____________________________________________________________________________
02447	// Normal gameplay execs
02448	// Type the name of the exec function at the console to execute it
02449	exec function Jump( optional float F )
02450	{
02451	    if ( LadderVolume(Pawn.PhysicsVolume) != none )
02452	    { // Jumping in a ladder volume mean we do want to climb
02453	      Pawn.PhysicsVolume.PawnEnteredVolume(Pawn);
02454	      if (Pawn.Physics == PHYS_Ladder)
02455	        return;
02456	    }
02457	
02458	    if ( MyInteraction.bCanClimbDoor )
02459	    {
02460	      DoorToClimb = MyInteraction.TargetActor;
02461	      DoorLockedNormal = MyInteraction.TargHitNorm;
02462	      DoorLockedPos = MyInteraction.TargHitLoc;
02463	
02464	      GotoState('MayClimbDoor');
02465	    }
02466	
02467	    bPressedJump = true;
02468	}
02469	
02470	//_____________________________________________________________________________
02471	event HearNoise( float Loudness, Actor NoiseMaker)
02472	{
02473	//    Log("__"@self@"Heard"@NoiseMaker);
02474	//    if ( XIIIPlayerPawn(Pawn).bSixSenseOn )
02475	    if ( vSize(NoiseMaker.location - Pawn.Location) < 2500/1.27 )
02476	      XIIIPlayerPawn(Pawn).Heard(Loudness, NoiseMaker);
02477	}
02478	
02479	//_____________________________________________________________________________
02480	// called when gameplay actually starts
02481	simulated function MatchStarting()
02482	{
02483	    Log("MP-] MatchStarting for"@self);
02484	    UseVignetteFilter = 0;
02485	    UseVignetteHighlight = 0;
02486	    bWeaponBlock = false;
02487	    if ( Level.Game != none )
02488	      Level.Game.RestartPlayer(Self);
02489	    if ( PlayerInput != none )
02490	    {
02491	      PlayerInput.bDuckCheck = false;
02492	      PlayerInput.iDuckMem = 0;
02493	    }
02494	}
02495	
02496	//_____________________________________________________________________________
02497	event TeamMessage( PlayerReplicationInfo PRI, coerce string S, name Type )
02498	{
02499	    local string ConsoleString;
02500	
02501	//    log("Teammessage with PRI "$PRI$" hud "$myHud$" Player "$Player$" console "$Player.console$" string "$S@"Type "$Type);
02502	    ConsoleString = S;
02503	    if ( (Type == 'Say') || (Type == 'TeamSay') )
02504	      ConsoleString = PRI.PlayerName$": "$ConsoleString;
02505	
02506	//    Player.Console.Message( ConsoleString, 6.0 );
02507	    myHUD.Message( PRI, S, Type );
02508	}
02509	
02510	//_____________________________________________________________________________
02511	function StatUpdate();
02512	
02513	//_____________________________________________________________________________
02514	function ClientGameEnded()
02515	{
02516	//    if ( (Role < ROLE_Authority) || (Level.NetMode == NM_StandAlone) )
02517	    if (Role < ROLE_Authority)
02518	      GotoState('GameEnded');
02519	}
02520	
02521	//_____________________________________________________________________________
02522	state PlayerClimbing
02523	{
02524	    event bool NotifyHitWall(vector HitNormal, actor Wall)
02525	    { // ELR don't send HitWall to pawn while in ladder.
02526	      return true;
02527	    }
02528	    function BeginState()
02529	    {
02530	      if ( Pawn != None )
02531	      {
02532	        Pawn.ShouldCrouch(false);
02533	        bPressedJump = false;
02534	        bDuck = 0;
02535	        bPressedDuck = false;
02536	        Pawn.ChangeAnimation();
02537	      }
02538	    }
02539	    function EndState()
02540	    {
02541	      if ( Pawn != None )
02542	      {
02543	        Pawn.ShouldCrouch(false);
02544	        bPressedJump = false;
02545	        bDuck = 0;
02546	        bPressedDuck = false;
02547	        Pawn.ChangeAnimation();
02548	        Pawn.PlaySound(hEndClimbLadderSound);
02549	      }
02550	    }
02551	    function ProcessMove(float DeltaTime, vector NewAccel, eDoubleClickDir DoubleClickMove, rotator DeltaRot)
02552	    {
02553	      local vector OldAccel;
02554	
02555	      OldAccel = Pawn.Acceleration;
02556	      if ( bAltDuck != 0 )
02557	        NewAccel.Z = -2048.0;
02558	      if ( bAltJump != 0 )
02559	        NewAccel.Z = 2048.0;
02560	
02561	      Pawn.Acceleration = NewAccel;
02562	//      Log("Accel="$Pawn.Acceleration@"bIsCrouched="$Pawn.bIsCrouched$"bIsWalking="$Pawn.bIsWalking);
02563	/*
02564	      if ( bPressedJump )
02565	      {
02566	        Pawn.DoJump(bUpdating);
02567	        if ( Pawn.Physics == PHYS_Falling )
02568	          GotoState('PlayerWalking');
02569	      }
02570	*/
02571	    }
02572	}
02573	
02574	//_____________________________________________________________________________
02575	state PlayerWalking
02576	{
02577	    function ProcessMove(float DeltaTime, vector NewAccel, eDoubleClickDir DoubleClickMove, rotator DeltaRot)
02578	    {
02579	      local vector OldAccel, HookDir, HookMove, CenterDir;
02580	      local bool OldCrouch;
02581	
02582	      if ( Pawn == none )
02583	        return;
02584	      // ELR Limit speed there ::FIXME:: but not for on-line because on serveur FOV don't change.
02585	      if ( (Level.NetMode == NM_StandAlone) && (DefaultFOV != DesiredFOV) )
02586	      {
02587	        NewAccel *= 0.01;
02588	        XIIIPawn(Pawn).SetGroundspeed(Pawn.WalkingPct / 2.0);
02589	      }
02590	      else
02591	      {
02592	        if ( bWeaponMode )
02593	        {
02594	          if ( (XIIIWeapon(Pawn.Weapon) != none) && XIIIWeapon(Pawn.Weapon).bHeavyWeapon )
02595	            XIIIPawn(Pawn).SetGroundspeed(0.666);
02596	          else if ( (XIIIPawn(Pawn).LHand != none) && XIIIPawn(Pawn).LHand.bActive )
02597	            XIIIPawn(Pawn).SetGroundspeed(0.333);
02598	          else
02599	            XIIIPawn(Pawn).SetGroundspeed(1.0);
02600	        }
02601	        else
02602	        {
02603	          if ( (XIIIPawn(Pawn).LHand != none) && XIIIPawn(Pawn).LHand.bActive )
02604	            XIIIPawn(Pawn).SetGroundspeed(0.333);
02605	          else
02606	            XIIIPawn(Pawn).SetGroundspeed(1.0);
02607	        }
02608	      }
02609	
02610	      if ( bHooked )
02611	      {
02612	        if ( (Pawn.Physics==PHYS_Walking) && (Pawn.Location.z > HookUsed.HookPoint.z) )
02613	          HookUsed.HookLength = vSize(HookUsed.HookPoint - Pawn.Location) + 1.0;
02614	        if ( (vSize(HookUsed.HookPoint - Pawn.Location) > HookUsed.HookLength) && (Pawn.Location.z < HookUsed.HookPoint.z) )
02615	        {
02616	          Pawn.SetPhysics(PHYS_Falling);
02617	          HookDir = normal(HookUsed.HookPoint - Pawn.Location);
02618	          HookMove = HookDir * (vSize(HookUsed.HookPoint - Pawn.Location) - HookUsed.HookLength);
02619	          Pawn.Move( HookMove );
02620	          // Look for the speed to set the player (remove speed along rope axis).
02621	          Pawn.Velocity -= HookDir * (HookDir dot Pawn.velocity);
02622	        }
02623	      }
02624	
02625	      OldAccel = Pawn.Acceleration;
02626	      Pawn.Acceleration = NewAccel;
02627	
02628	//      Log("bDuck="$bDuck@"bWantsToCrouch="$Pawn.bWantsToCrouch);
02629	      if ( bPressedJump )
02630	      {
02631	        if ( bHooked && !HookUsed.bGoUp && !HookUsed.bGoDown && (Hook(Pawn.SelectedItem) != none) )
02632	        {
02633	//          Log("Hook ActivatedByJump");
02634	          Hook(Pawn.SelectedItem).ActivatedByJump = true;
02635	          ActivateItem();
02636	          return;
02637	        }
02638	        Pawn.DoJump(bUpdating);
02639	      }
02640	      if ( Pawn.Physics != PHYS_Falling )
02641	      {
02642	        OldCrouch = Pawn.bWantsToCrouch;
02643	        if (bDuck == 0)
02644	          Pawn.ShouldCrouch(false);
02645	        else if ( Pawn.bCanCrouch )
02646	          Pawn.ShouldCrouch(true);
02647	      }
02648	      else
02649	      {
02650	        // should reset Crouch
02651	        if ( PlayerInput != none )
02652	        {
02653	          PlayerInput.bDuckCheck = false;
02654	          PlayerInput.iDuckMem = 0;
02655	        }
02656	        Pawn.bWantsToCrouch = false;
02657	        Pawn.ShouldCrouch(false);
02658	        bDuck = 0;
02659	        if ( !bHooked )
02660	          bAltDuck = 0;
02661	        if ( bHooked && bPressedDuck && !HookUsed.bGoUp && !HookUsed.bGoDown && (Hook(Pawn.SelectedItem) != none) )
02662	        {
02663	  //        Log("Hook ActivatedByDuck");
02664	          HookUsed.ActivatedByDuck = true;
02665	          ActivateItem();
02666	          bPressedDuck = false;
02667	          return;
02668	        }
02669	      }
02670	      if ( (Hook(Pawn.SelectedItem) != none) && (Pawn.SelectedItem.IsInState('Idle') || Pawn.SelectedItem.IsInState('DownItemRopeCut')) )
02671	        bhooked = false;
02672	    }
02673	
02674	    function PlayerMove( float DeltaTime )
02675	    {
02676	      local vector X,Y,Z, NewAccel;
02677	      local eDoubleClickDir DoubleClickMove;
02678	      local rotator OldRotation, ViewRotation;
02679	      local float Speed2D;
02680	      local bool bSaveJump;
02681	
02682	      if ( Pawn != none ) // May happen in on-line game
02683	        GetAxes(Pawn.Rotation,X,Y,Z);
02684	      else
02685	        GetAxes(Rotation,X,Y,Z);
02686	
02687	      // ELR Add to avoid CenterView if mid-air
02688	      if ( bHooked && (Pawn.Physics != PHYS_Walking) )
02689	        bCenterView = False;
02690	
02691	      // Update acceleration.
02692	      NewAccel = aForward*X + aStrafe*Y;
02693	      NewAccel.Z = 0;
02694	      if ( VSize(NewAccel) < 1.0 )
02695	        NewAccel = vect(0,0,0);
02696	//      DoubleClickMove = PlayerInput.CheckForDoubleClickMove(DeltaTime);
02697	
02698	      if ( bHooked && (Pawn.Base == none) )
02699	        NewAccel *= 0.03*1.5;
02700	
02701	      GroundPitch = 0;
02702	      // ELR don't do snapview if zoomed
02703	//      if ( (DefaultFov != DesiredFov) || (XIIIWeapon(Pawn.Weapon).bZoomed) )
02704	//      {
02705	//        Log("             ...reseting view because fov not ok or weapon zoom");
02706	
02707	/* ELR // take this back ;)
02708	        bSnaptoLevel = false;
02709	        bCenterView = false;
02710	*/
02711	
02712	//      }
02713	/*
02714	      if ( bCenterView )
02715	        log("Centering view");
02716	*/
02717	      if ( (Pawn != none) && Pawn.Pressingfire() )
02718	      {
02719	        bSnaptoLevel = false;
02720	        bCenterView = false;
02721	      }
02722	
02723	      ViewRotation = Rotation;
02724	      if ( (Pawn != none) && (Pawn.Physics == PHYS_Walking) )
02725	      {
02726	//        Log("PlayerWalking...");
02727	        // tell pawn about any direction changes to give it a chance to play appropriate animation
02728	        //if walking, look up/down stairs - unless player is rotating view
02729	//        GroundPitch = FindStairRotation(deltaTime);
02730	//        if ( GroundPitch != 0 )
02731	//          Log("GroundPitch="$GroundPitch@"bLookUpStairs="$bLookUpStairs@"bSnapToLevel="$bSnapToLevel);
02732	        if ( (bLook == 0)
02733	          && (((Pawn.Acceleration != Vect(0,0,0)) && bAlwaysLevel && bSnapToLevel) || !bKeyboardLook) )
02734	        {
02735	//          Log("             ...aligning view");
02736	          if ( bLookUpStairs && bSnapToLevel )
02737	          {
02738	//            Log("             ...aligning view Setting GroundPitch ViewRotation.Pitch="$ViewRotation.Pitch@"GroundPitch="$GroundPitch);
02739	            ViewRotation.Pitch -= (GroundPitch / (DeltaTime*1000));
02740	          }
02741	          else if ( bCenterView && (DefaultFOV == DesiredFOV) )
02742	          {
02743	//            Log("             ...aligning view Centering view");
02744	            ViewRotation.Pitch = ViewRotation.Pitch & 65535;
02745	            if (ViewRotation.Pitch > 32768)
02746	              ViewRotation.Pitch -= 65536;
02747	            ViewRotation.Pitch = ViewRotation.Pitch * (1 - 12 * FMin(0.0833, deltaTime));
02748	            if ( Abs(ViewRotation.Pitch) < 1000 )
02749	              ViewRotation.Pitch = 0;
02750	          }
02751	        }
02752	
02753	        Speed2D = Sqrt(Pawn.Velocity.X * Pawn.Velocity.X + Pawn.Velocity.Y * Pawn.Velocity.Y);
02754	        //add bobbing when walking
02755	        CheckBob(DeltaTime, Speed2D, Y);
02756	      }
02757	      else
02758	      {
02759	        if ( !bKeyboardLook && (bLook == 0) && bCenterView )
02760	        {
02761	          ViewRotation.Pitch = ViewRotation.Pitch & 65535;
02762	          if (ViewRotation.Pitch > 32768)
02763	               ViewRotation.Pitch -= 65536;
02764	          ViewRotation.Pitch = ViewRotation.Pitch * (1 - 12 * FMin(0.0833, deltaTime));
02765	          if ( Abs(ViewRotation.Pitch) < 1000 )
02766	               ViewRotation.Pitch = 0;
02767	        }
02768	        BobTime = 0;
02769	        WalkBob = WalkBob * (1 - FMin(1, 8 * deltatime));
02770	      }
02771	
02772	      // Update rotation.
02773	      SetRotation(ViewRotation);
02774	      OldRotation = Rotation;
02775	      // ELR Rotation Speed Down when holding corpse/Pawn
02776	      if ( (Pawn != none) && (XIIIPawn(Pawn).LHand!=none) && (XIIIPawn(Pawn).LHand.pOnShoulder != none) )
02777	        UpdateRotation(DeltaTime*0.75, 0);
02778	      else
02779	        UpdateRotation(DeltaTime, 0);
02780	
02781	      if ( bPressedJump && Pawn.CannotJumpNow() )
02782	      {
02783	        bSaveJump = true;
02784	        bPressedJump = false;
02785	      }
02786	      else
02787	        bSaveJump = false;
02788	
02789	      if ( Role < ROLE_Authority ) // then save this move and replicate it
02790	        ReplicateMove(DeltaTime, NewAccel, DoubleClickMove, OldRotation - Rotation);
02791	      else
02792	        ProcessMove(DeltaTime, NewAccel, DoubleClickMove, OldRotation - Rotation);
02793	      if ( (Pawn != none) && (Pawn.ControllerPitch != Rotation.Pitch / 256) )
02794	        Pawn.ControllerPitch = Rotation.Pitch / 256; // needed for ListenServer -> Client
02795	      bPressedJump = bSaveJump;
02796	    }
02797	}
02798	
02799	//_____________________________________________________________________________
02800	// ELR
02801	state PlayerSwimming
02802	{
02803	    function ProcessMove(float DeltaTime, vector NewAccel, eDoubleClickDir DoubleClickMove, rotator DeltaRot)
02804	    {
02805	      local vector X,Y,Z, OldAccel, HookDir, HookMove, CenterDir;
02806	
02807	      GetAxes(Rotation,X,Y,Z);
02808	
02809	      if ( bHooked )
02810	      { // while swimming only update hooklength
02811	        if ( (vSize(HookUsed.HookPoint - Pawn.Location) > HookUsed.HookLength) && (Pawn.Location.z < HookUsed.HookPoint.z) )
02812	        {
02813	          HookDir = normal(HookUsed.HookPoint - Pawn.Location);
02814	          HookMove = HookDir * (vSize(HookUsed.HookPoint - Pawn.Location) - HookUsed.HookLength);
02815	          Pawn.Move( HookMove );
02816	          // Look for the speed to set the player (remove speed along rope axis).
02817	          Pawn.Velocity -= HookDir * (HookDir dot Pawn.velocity);
02818	        }
02819	      }
02820	
02821	      OldAccel = Pawn.Acceleration;
02822	      Pawn.Acceleration = NewAccel;
02823	
02824	      Pawn.bUpAndOut = ((X Dot Pawn.Acceleration) > 0) && ((Pawn.Acceleration.Z > 0) || (Rotation.Pitch > 2048));
02825	      if ( !Pawn.PhysicsVolume.bWaterVolume ) //check for waterjump
02826	        NotifyPhysicsVolumeChange(Pawn.PhysicsVolume);
02827	      if ( (Hook(Pawn.SelectedItem) != none) && (Pawn.SelectedItem.IsInState('Idle') || Pawn.SelectedItem.IsInState('DownItemRopeCut')) )
02828	        bhooked = false;
02829	    }
02830	
02831	    function PlayerMove(float DeltaTime)
02832	    {
02833	      local rotator oldRotation;
02834	      local vector X,Y,Z, NewAccel;
02835	      local float Speed2D;
02836	
02837	      GetAxes(Rotation,X,Y,Z);
02838	
02839	      NewAccel = aForward*X + aStrafe*Y + aUp*vect(0,0,1);
02840	      if ( VSize(NewAccel) < 1.0 )
02841	        NewAccel = vect(0,0,0);
02842	
02843	      //add bobbing when swimming
02844	      Speed2D = Sqrt(Pawn.Velocity.X * Pawn.Velocity.X + Pawn.Velocity.Y * Pawn.Velocity.Y);
02845	      WalkBob = Y * Bob *  0.5 * Speed2D * sin(4.0 * Level.TimeSeconds);
02846	      WalkBob.Z = Bob * 1.5 * Speed2D * sin(8.0 * Level.TimeSeconds);
02847	
02848	      // Update rotation.
02849	      oldRotation = Rotation;
02850	      UpdateRotation(DeltaTime, 2);
02851	
02852	      if ( Role < ROLE_Authority ) // then save this move and replicate it
02853	        ReplicateMove(DeltaTime, NewAccel, DCLICK_None, OldRotation - Rotation);
02854	      else
02855	        ProcessMove(DeltaTime, NewAccel, DCLICK_None, OldRotation - Rotation);
02856	      bPressedJump = false;
02857	    }
02858	    function bool NotifyPhysicsVolumeChange( PhysicsVolume NewVolume )
02859	    {
02860	      local actor HitActor;
02861	      local vector HitLocation, HitNormal, checkpoint;
02862	
02863	      if ( !NewVolume.bWaterVolume )
02864	      {
02865	        Pawn.SetPhysics(PHYS_Falling);
02866	        if (Pawn.bUpAndOut && Pawn.CheckWaterJump(HitNormal)) //check for waterjump
02867	        {
02868	        // ONLY CHANGE HERE
02869	          Pawn.velocity.Z = 400 + Pawn.CollisionHeight; //set here so physics uses this for remainder of tick
02870	        // ONLY CHANGE HERE
02871	//          Pawn.velocity.Z = 330 + 2 * Pawn.CollisionRadius; //set here so physics uses this for remainder of tick
02872	          GotoState(Pawn.LandMovementState);
02873	        }
02874	        else if ( (Pawn.Velocity.Z > 160) || !Pawn.TouchingWaterVolume() )
02875	          GotoState(Pawn.LandMovementState);
02876	        else //check if in deep water
02877	        {
02878	          checkpoint = Pawn.Location;
02879	          checkpoint.Z -= (Pawn.CollisionHeight + 6.0);
02880	          HitActor = Trace(HitLocation, HitNormal, checkpoint, Pawn.Location, false);
02881	          if (HitActor != None)
02882	            GotoState(Pawn.LandMovementState);
02883	          else
02884	          {
02885	            Enable('Timer');
02886	            SetTimer(0.7,false);
02887	          }
02888	        }
02889	      }
02890	      else
02891	      {
02892	        Disable('Timer');
02893	        Pawn.SetPhysics(PHYS_Swimming);
02894	      }
02895	      return false;
02896	    }
02897	    function BeginState()
02898	    {
02899	      Disable('Timer');
02900	      Pawn.SetPhysics(PHYS_Swimming);
02901	//      Pawn.PlaySound(hEnteringWaterSound);
02902	    }
02903	    function EndState()
02904	    {
02905	//      Pawn.PlaySound(hExitingWaterSound);
02906	    }
02907	}
02908	
02909	/*
02910	//_____________________________________________________________________________
02911	// ELR
02912	State Hooked extends PlayerWalking
02913	{
02914	    function BeginState()
02915	    {
02916	      Pawn.bCanCrouch=False;
02917	      Pawn.bCanClimbLadders=False;
02918	      bPressedDuck=false;
02919	    }
02920	    function EndState()
02921	    {
02922	      Pawn.bCanCrouch=True;
02923	      Pawn.bCanClimbLadders=True;
02924	    }
02925	
02926	    //_________________
02927	    function PlayerMove( float DeltaTime )
02928	    {
02929	      local vector X,Y,Z, NewAccel;
02930	      local eDoubleClickDir DoubleClickMove;
02931	      local rotator OldRotation, ViewRotation;
02932	      local float Speed2D;
02933	      local bool bSaveJump;
02934	
02935	      GetAxes(Pawn.Rotation,X,Y,Z);
02936	      // ELR Add to avoid CenterView if mid-air
02937	      if ( Pawn.Physics != PHYS_Walking )
02938	        bCenterView = False;
02939	
02940	//      Log("aForward="$aForward@"aStrafe="$aStrafe);
02941	
02942	      // Update acceleration.
02943	      NewAccel = aForward*4*X + aStrafe*4*Y;
02944	      NewAccel.Z = 0;
02945	//      if ( NewAccel == vect(0,0,0) )
02946	//        NewAccel = -Pawn.Velocity*200;
02947	      if ( Pawn.Base == none )
02948	        NewAccel *= 0.0075;
02949	
02950	//      log("NewAccel="$NewAccel);
02951	//      DoubleClickMove = PlayerInput.CheckForDoubleClickMove(DeltaTime);
02952	
02953	      GroundPitch = 0;
02954	      ViewRotation = Rotation;
02955	      if (Pawn.Physics == PHYS_Walking)
02956	      {
02957	        //if walking, look up/down stairs - unless player is rotating view
02958	        GroundPitch = FindStairRotation(deltaTime);
02959	        if (DefaultFov != DesiredFov)
02960	        {
02961	          bSnaptoLevel = false;
02962	          bCenterView = false;
02963	        }
02964	
02965	        if ( (bLook == 0)
02966	          && (((Pawn.Acceleration != Vect(0,0,0)) && bAlwaysLevel && bSnapToLevel) || !bKeyboardLook) )
02967	        {
02968	          if ( bLookUpStairs || bSnapToLevel )
02969	          {
02970	            ViewRotation.Pitch = GroundPitch;
02971	          }
02972	          else if ( bCenterView && (DefaultFOV == DesiredFOV) )
02973	          {
02974	            ViewRotation.Pitch = ViewRotation.Pitch & 65535;
02975	            if (ViewRotation.Pitch > 32768)
02976	              ViewRotation.Pitch -= 65536;
02977	            ViewRotation.Pitch = ViewRotation.Pitch * (1 - 12 * FMin(0.0833, deltaTime));
02978	            if ( Abs(ViewRotation.Pitch) < 1000 )
02979	              ViewRotation.Pitch = 0;
02980	          }
02981	        }
02982	        Speed2D = Sqrt(Pawn.Velocity.X * Pawn.Velocity.X + Pawn.Velocity.Y * Pawn.Velocity.Y);
02983	        //add bobbing when walking
02984	        CheckBob(DeltaTime, Speed2D, Y);
02985	      }
02986	
02987	      // Update rotation.
02988	      SetRotation(ViewRotation);
02989	      OldRotation = Rotation;
02990	      UpdateRotation(DeltaTime, 1);
02991	
02992	      if ( bPressedJump && Pawn.CannotJumpNow() )
02993	      {
02994	        bSaveJump = true;
02995	        bPressedJump = false;
02996	      }
02997	      else
02998	        bSaveJump = false;
02999	
03000	      // ELR If jump pressed and colliding/facing a wall then impulse
03001	      if ( NearWall(Pawn.CollisionRadius + 15.0) )
03002	      {
03003	//        Pawn.Velocity.Z = 0.0;
03004	        if ( bPressedJump && (Pawn.Physics == PHYS_Falling) )
03005	        {
03006	          Pawn.Velocity -= X * 300.0;
03007	        }
03008	      }
03009	
03010	      if ( Role < ROLE_Authority ) // then save this move and replicate it
03011	        ReplicateMove(DeltaTime, NewAccel, DoubleClickMove, OldRotation - Rotation);
03012	      else
03013	        ProcessMove(DeltaTime, NewAccel, DoubleClickMove, OldRotation - Rotation);
03014	      bPressedJump = bSaveJump;
03015	    }
03016	
03017	    //_________________
03018	    // ELR 2nd ProcessMove, trying to get rid of vel/acc and setting the player's pos
03019	    function ProcessMove(float DeltaTime, vector NewAccel, eDoubleClickDir DoubleClickMove, rotator DeltaRot)
03020	    {
03021	      local vector OldAccel, HookDir, HookMove, CenterDir;
03022	      local bool OldCrouch;
03023	
03024	      OldAccel = Pawn.Acceleration;
03025	
03026	      // Not in Hook because need every frame treatment
03027	      if ( Pawn.Physics==PHYS_Walking )
03028	      {
03029	        if ( Pawn.Location.z > HookUsed.HookPoint.z )
03030	        {
03031	          HookUsed.HookLength = vSize(HookUsed.HookPoint - Pawn.Location) + 1.0;
03032	        }
03033	      }
03034	
03035	      if ( (vSize(HookUsed.HookPoint - Pawn.Location) > HookUsed.HookLength) && (Pawn.Location.z < HookUsed.HookPoint.z) )
03036	      {
03037	        Pawn.SetPhysics(PHYS_Falling);
03038	        HookDir = normal(HookUsed.HookPoint - Pawn.Location);
03039	        HookMove = HookDir * (vSize(HookUsed.HookPoint - Pawn.Location) - HookUsed.HookLength);
03040	        Pawn.Move( HookMove );
03041	        // Look for the speed to set the player (remove speed along rope axis).
03042	        Pawn.Velocity -= HookDir * (HookDir dot Pawn.velocity);
03043	      }
03044	
03045	      Pawn.Acceleration = NewAccel;
03046	
03047	      if ( bPressedJump )
03048	      {
03049	        if ( !HookUsed.bGoUp && !HookUsed.bGoDown )
03050	        {
03051	          Log("Hook ActivatedByJump");
03052	          Hook(Pawn.SelectedItem).ActivatedByJump = true;
03053	          ActivateItem();
03054	          return;
03055	        }
03056	        else
03057	          Pawn.DoJump(bUpdating);
03058	      }
03059	      if ( Pawn.Physics != PHYS_Falling )
03060	      {
03061	        OldCrouch = Pawn.bWantsToCrouch;
03062	        if (bDuck == 0)
03063	          Pawn.ShouldCrouch(false);
03064	        else if ( Pawn.bCanCrouch )
03065	          Pawn.ShouldCrouch(true);
03066	      }
03067	      else
03068	      {
03069	        if ( bPressedDuck && !HookUsed.bGoUp && !HookUsed.bGoDown )
03070	        {
03071	          Log("Hook ActivatedByDuck");
03072	          HookUsed.ActivatedByDuck = true;
03073	          ActivateItem();
03074	          bPressedDuck=false;
03075	          return;
03076	        }
03077	      }
03078	
03079	//      if ( !bWeaponMode && (Hook(Pawn.SelectedItem) != none) && Pawn.SelectedItem.isInState('Idle') )
03080	    // ELR we can release hook while having weapon in hand, so...
03081	      if ( (Hook(Pawn.SelectedItem) != none) && Pawn.SelectedItem.isInState('Idle') )
03082	      {
03083	        GotoState('PlayerWalking');
03084	      }
03085	    }
03086	}
03087	*/
03088	
03089	//_____________________________________________________________________________
03090	// ELR
03091	State Tyroling extends PlayerWalking
03092	{
03093	    function BeginState()
03094	    {
03095	      Pawn.PlaySound(hTyrolStartSound);
03096	    }
03097	    function EndState()
03098	    {
03099	      Pawn.PlaySound(hTyrolEndSound);
03100	      Pawn.SetPhysics(PHYS_Falling);
03101	    }
03102	
03103	    //__________________
03104	    function PlayerMove( float DeltaTime )
03105	    {
03106	      local vector X,Y,Z, NewAccel;
03107	      local eDoubleClickDir DoubleClickMove;
03108	      local rotator OldRotation, ViewRotation;
03109	      local float Speed2D;
03110	      local bool     bSaveJump;
03111	
03112	      if ( (vTyrolDir dot (Pawn.Location - vTyrolEnd) > 0.0) || (vTyrolDir dot Pawn.Velocity < 0.0) )
03113	      {
03114	        Gotostate('PlayerWalking');
03115	        return;
03116	      }
03117	      GetAxes(Pawn.Rotation,X,Y,Z);
03118	
03119	      // Update acceleration.
03120	//      NewAccel = aForward*X + aStrafe*Y;
03121	      if ( vSize(vTyrolEnd - Pawn.Location) > 512.0 )
03122	        // SpeedUp
03123	        NewAccel = vTyrolDir * 400.0;
03124	      else
03125	        //SlowDown
03126	        NewAccel = - vTyrolDir * 200.0;
03127	//      DoubleClickMove = PlayerInput.CheckForDoubleClickMove(DeltaTime);
03128	
03129	      GroundPitch = 0;
03130	      ViewRotation = Rotation;
03131	      if (Pawn.Physics == PHYS_Walking)
03132	      {
03133	        //if walking, look up/down stairs - unless player is rotating view
03134	//        GroundPitch = FindStairRotation(deltaTime);
03135	        if (DefaultFov != DesiredFov)
03136	        {
03137	          bSnaptoLevel = false;
03138	          bCenterView = false;
03139	        }
03140	        if ( (bLook == 0)
03141	          && (((Pawn.Acceleration != Vect(0,0,0)) && bAlwaysLevel && bSnapToLevel) || !bKeyboardLook) )
03142	        {
03143	          if ( bLookUpStairs || bSnapToLevel )
03144	          {
03145	            ViewRotation.Pitch = GroundPitch;
03146	          }
03147	          else if ( bCenterView && (DefaultFOV == DesiredFOV) )
03148	          {
03149	            ViewRotation.Pitch = ViewRotation.Pitch & 65535;
03150	            if (ViewRotation.Pitch > 32768)
03151	              ViewRotation.Pitch -= 65536;
03152	            ViewRotation.Pitch = ViewRotation.Pitch * (1 - 12 * FMin(0.0833, deltaTime));
03153	            if ( Abs(ViewRotation.Pitch) < 1000 )
03154	              ViewRotation.Pitch = 0;
03155	          }
03156	        }
03157	
03158	        Speed2D = Sqrt(Pawn.Velocity.X * Pawn.Velocity.X + Pawn.Velocity.Y * Pawn.Velocity.Y);
03159	        //add bobbing when walking
03160	        CheckBob(DeltaTime, Speed2D, Y);
03161	      }
03162	
03163	      // Update rotation.
03164	      SetRotation(ViewRotation);
03165	      OldRotation = Rotation;
03166	      UpdateRotation(DeltaTime, 1);
03167	
03168	      if ( bPressedJump && Pawn.CannotJumpNow() )
03169	      {
03170	        bSaveJump = true;
03171	        bPressedJump = false;
03172	      }
03173	      else
03174	        bSaveJump = false;
03175	
03176	      if ( Role < ROLE_Authority ) // then save this move and replicate it
03177	        ReplicateMove(DeltaTime, NewAccel, DoubleClickMove, OldRotation - Rotation);
03178	      else
03179	        ProcessMove(DeltaTime, NewAccel, DoubleClickMove, OldRotation - Rotation);
03180	      bPressedJump = bSaveJump;
03181	    }
03182	
03183	    //__________________
03184	    function ProcessMove(float DeltaTime, vector NewAccel, eDoubleClickDir DoubleClickMove, rotator DeltaRot)
03185	    {
03186	      local vector OldAccel;
03187	      local bool OldCrouch;
03188	
03189	      OldAccel = Pawn.Acceleration;
03190	      Pawn.Acceleration = NewAccel;
03191	      Pawn.SetPhysics(PHYS_None);
03192	      Pawn.Velocity += NewAccel * Deltatime;
03193	      if ( vSize(Pawn.Velocity) > fTyrolSpeed )
03194	        Pawn.Velocity = normal(Pawn.Velocity) * fTyrolSpeed;
03195	      Pawn.Move(Pawn.Velocity * Deltatime);
03196	
03197	      // ELR No more jump there
03198	
03199	      if ( Pawn.Physics != PHYS_Falling )
03200	      {
03201	        OldCrouch = Pawn.bWantsToCrouch;
03202	        if (bDuck == 0)
03203	          Pawn.ShouldCrouch(false);
03204	        else if ( Pawn.bCanCrouch )
03205	          Pawn.ShouldCrouch(true);
03206	      }
03207	    }
03208	}
03209	
03210	//_____________________________________________________________________________
03211	
03212	state BossView
03213	{
03214	    ignores ReLoad, NextWeapon, cNextItem, AltFire, Jump;
03215	
03216	    function BeginState() {}
03217	    function EndState() {}
03218	
03219	    event PlayerCalcView(out actor ViewActor, out vector CameraLocation, out rotator CameraRotation )
03220	    {
03221	//    	ViewActor = ViewTarget; // ELR don't set ViewActor else sound will come as heard from it
03222	        CameraLocation = CamView.Location;
03223	        CameraRotation = rotator( CamView.Location - CamView.Location);
03224	    }
03225	}
03226	
03227	//_____________________________________________________________________________
03228	state CameraView
03229	{
03230	    ignores AltFire, Jump;
03231	    ignores Reload, cNextItem, cPrevItem, PrevWeapon, NextWeapon;
03232	
03233	    function BeginState()
03234	    {
03235	      Pawn.Playsound(hCamViewBeginUseSound);
03236	      Pawn.Playsound(hCamViewInUseSound);
03237	      Pawn.Velocity = vect(0,0,0);
03238	      Pawn.Acceleration = vect(0,0,0);
03239	    }
03240	    function EndState()
03241	    {
03242	      Pawn.StopSound(hCamViewInUseSound);
03243	      Pawn.Playsound(hCamViewBeginUseSound);
03244	      DefaultFOV = default.DefaultFOV;
03245	      DesiredFOV = DefaultFOV;
03246	      FOVAngle = DefaultFOV;
03247	    }
03248	    event PlayerCalcView(out actor ViewActor, out vector CameraLocation, out rotator CameraRotation )
03249	    {
03250	//    	ViewActor = ViewTarget; // ELR don't set ViewActor else sound will come as heard from it
03251	      CameraLocation = CamView.Location;
03252	      CameraRotation = CamView.Rotation;
03253	    }
03254	}
03255	
03256	//_____________________________________________________________________________
03257	state MayClimbDoor extends PlayerWalking
03258	{
03259	    ignores NextWeapon, cNextItem, Grab;
03260	
03261	    function BeginState()
03262	    {
03263	      SetTimer(0.1, true);
03264	      if ( bWeaponMode )
03265	      {
03266	        OldWeap = pawn.weapon.InventoryGroup;
03267	        Pawn.Weapon.PutDown();
03268	      }
03269	      else
03270	      {
03271	        if ( OldItem != none )
03272	        {
03273	          cNextItem();
03274	          XIIIPawn(Pawn).PendingItem = OldItem;
03275	        }
03276	        else
03277	        {
03278	          NextWeapon();
03279	          Switchweapon( 0 );
03280	        }
03281	      }
03282	      bWeaponBlock = true;
03283	    }
03284	    function Timer()
03285	    {
03286	      if (Pawn.Velocity.Z < 0.0 )
03287	      {
03288	//        log(self$" should try to climb");
03289	        SetTimer(0.0, false);
03290	        OldDoorClimbPos = Pawn.Location;
03291	        DoorClimbMove = vect(0,0,1.0);
03292	        Pawn.PlaySound(hClimbDoorSound);
03293	        GotoState('ClimbDoor');
03294	      }
03295	    }
03296	    event bool NotifyLanded(vector HitNormal)
03297	    {
03298	      GotoState('PlayerWalking');
03299	      return true;
03300	    }
03301	}
03302	
03303	//_____________________________________________________________________________
03304	state ClimbDoor extends PlayerWalking
03305	{
03306	    ignores NextWeapon, cNextItem, Grab;
03307	
03308	    function EndState()
03309	    {
03310	//      Pawn.PlaySound(hEndClimbDoorSound); // ELR don't play this anytime, just in case we could have succeeded
03311	      bWeaponBlock = false;
03312	      if ( bWeaponMode )
03313	      {
03314	        Switchweapon( OldWeap );
03315	        Pawn.ChangedWeapon();
03316	      }
03317	      else
03318	      {
03319	        if ( OldItem != none )
03320	        {
03321	          cNextItem();
03322	          XIIIPawn(Pawn).PendingItem = OldItem;
03323	        }
03324	        else
03325	        {
03326	          NextWeapon();
03327	          Switchweapon( 0 );
03328	        }
03329	        Pawn.ChangedWeapon();
03330	      }
03331	    }
03332	
03333	    function ProcessMove(float DeltaTime, vector NewAccel, eDoubleClickDir DoubleClickMove, rotator DeltaRot)
03334	    {
03335	      local vector OldAccel;
03336	      local vector Start,End,HitLoc,HitNorm;
03337	      local actor A;
03338	
03339	      DoorClimbMove = Pawn.Location - OldDoorClimbPos;
03340	      if ( DoorClimbMove.z == 0.0 )
03341	      {
03342	//        log(self$" ending the climb because no more vertical speed.");
03343	        Pawn.Acceleration = vect(0,0,0);
03344	        Pawn.Velocity = - DoorLockedNormal * 200.0;
03345	        GotoState('PlayerWalking');
03346	        return;
03347	      }
03348	      DoorClimbMove.z = 0.0;
03349	      if ( vSize(DoorClimbMove) > 1.0 )
03350	      {
03351	//        log(self$" ending the climb because the move is not the one predicted");
03352	        Pawn.Acceleration = vect(0,0,0);
03353	        Pawn.Velocity = - DoorLockedNormal * 200.0;
03354	        Pawn.PlaySound(hEndClimbDoorSound); // ELR don't play this anytime, just in case we could have succeeded
03355	        GotoState('PlayerWalking');
03356	        return;
03357	      }
03358	
03359	      Start = Pawn.Location;
03360	      End = Start - DoorLockedNormal * Pawn.CollisionRadius * 1.5;
03361	      A = Trace(HitLoc, HitNorm, End, Start);
03362	      if ( (A != DoorToClimb) && (A != none) )
03363	      {
03364	//        log(self$" ending the climb because there is obstacle in front");
03365	//        log("DoorNormal="$DoorLockedNormal);
03366	        Pawn.Acceleration = vect(0,0,0);
03367	        Pawn.Velocity = - DoorLockedNormal * 200.0;
03368	        GotoState('PlayerWalking');
03369	        return;
03370	      }
03371	
03372	      OldDoorClimbPos = Pawn.Location;
03373	      OldAccel = Pawn.Acceleration;
03374	      Pawn.Acceleration = vect(0,0,0);
03375	      Pawn.Velocity = - DoorLockedNormal * 400.0 + vect(0,0,1) * 150.0;
03376	
03377	      if ( bPressedJump )
03378	        GotoState('PlayerWalking');
03379	    }
03380	}
03381	
03382	//_____________________________________________________________________________
03383	// Player is controlling orientation of a gun turret.
03384	state PlayerGunning
03385	{
03386	    ignores Reload, cNextItem, cPrevItem, PrevWeapon, NextWeapon;
03387	
03388	    function BeginState()
03389	    {
03390	      local MitraillTop GunnedTurret;
03391	      Local vector V,W;
03392	
03393	      GunnedTurret = MitraillTop(Pawn.ControlledActor);
03394	      V = GunnedTurret.location;
03395	      W = vector(GunnedTurret.owner.Rotation);
03396	      W.z = 0.0;
03397	      W = Normal(W);
03398	      V -= GunnedTurret.CollisionRadius * W;
03399	      V -= Pawn.CollisionRadius * W;
03400	      V.z = Pawn.Location.z;
03401	      Pawn.SetCollision(false,false,false);
03402	      Pawn.Velocity = vect(0,0,0);
03403	      Pawn.Acceleration = vect(0,0,0);
03404	      Pawn.SetLocation(V);
03405	      Pawn.SetCollision(true,true,true);
03406	      Pawn.bHidden = true;
03407	      Pawn.RefreshDisplaying();
03408	      Pawn.bStasis = true;
03409	      if ( bWeaponMode )
03410	      {
03411	        OldWeap = pawn.weapon.InventoryGroup;
03412	        Pawn.Weapon.PutDown();
03413	      }
03414	      else
03415	      {
03416	        OldItem = XIIIItems(Pawn.SelectedItem);
03417	        OldItem.PutDown();
03418	      }
03419	      bWeaponBlock = true;
03420	      SetViewTarget(Pawn.ControlledActor);
03421	      DesiredFOV = 70;
03422	      FOVAngle = 70;
03423	    }
03424	    function EndState()
03425	    {
03426	      Pawn.bHidden = false;
03427	      Pawn.RefreshDisplaying();
03428	      Pawn.bStasis = false;
03429	      SetViewTarget(Pawn);
03430	      DesiredFOV = DefaultFOV;
03431	      FOVAngle = DefaultFOV;
03432	      bWeaponBlock = false;
03433	      DebugLog("GUNNING EndState OldItem="$OldItem@"bWeaponMode="$bWeaponMode);
03434	      if ( bWeaponMode )
03435	      {
03436	        Switchweapon( OldWeap );
03437	        Pawn.ChangedWeapon();
03438	      }
03439	      else
03440	      {
03441	        if ( OldItem != none )
03442	        {
03443	          cNextItem();
03444	          XIIIPawn(Pawn).PendingItem = OldItem;
03445	        }
03446	        else
03447	        {
03448	          bWaitForWeaponMode = true;
03449	          bWeaponMode = true;
03450	          SwitchWeapon( 0 );
03451	        }
03452	        Pawn.ChangedWeapon();
03453	      }
03454	      DebugLog("GUNNING AFTER EndState OldItem="$OldItem@"bWeaponMode="$bWeaponMode);
03455	    }
03456	
03457	    event PlayerCalcView(out actor ViewActor, out vector CameraLocation, out rotator CameraRotation )
03458	    {
03459	      Local vector X,Y,Z;
03460	
03461	      GetAxes(ViewTarget.rotation, X,Y,Z);
03462	      ViewActor = ViewTarget;
03463	      CameraLocation = ViewActor.Location - X * 60 + Z * 20.0; // + ShakeOffset;
03464	      CameraRotation = ViewActor.Rotation;
03465	      CalcFirstPersonView( CameraLocation, CameraRotation );
03466	      CameraLocation -= Pawn.EyePosition();
03467	    }
03468	
03469	    function Leave()
03470	    {
03471	      local MitraillTop GunnedTurret;
03472	
03473	      GunnedTurret = MitraillTop(Pawn.ControlledActor);
03474	      GotoState('PlayerWalking');
03475	      Pawn.SetPhysics(PHYS_Falling);
03476	      GunnedTurret.LeaveControl();
03477	    }
03478	    function PlayerMove( float DeltaTime )
03479	    {
03480	      local MitraillTop GunnedTurret;
03481	
03482	      GunnedTurret = MitraillTop(Pawn.ControlledActor);
03483	      UpdateRotation(DeltaTime, 1);
03484	      GunnedTurret.TrySetRotation(Rotation);
03485	      SetRotation(GunnedTurret.Rotation);
03486	      if ( bPressedJump )
03487	        Leave();
03488	    }
03489	    exec function Grab() { Leave(); }
03490	    exec function AltFire(float value) { Leave(); }
03491	
03492	    exec function Fire(float value)
03493	    {
03494	      Mitrailltop(Pawn.ControlledActor).Fire();
03495	    }
03496	
03497	    simulated event RenderOverlays( canvas C )
03498	    {
03499	      Pawn.ControlledActor.RenderOverlays(C);
03500	    }
03501	}
03502	
03503	//_____________________________________________________________________________
03504	state ClimbToHookNavPoint extends PlayerWalking
03505	{
03506	    function BeginState()
03507	    {
03508	      Pawn.SetCollision(false,false,false);
03509	      SetPhysics(PHYS_None);
03510	    }
03511	    function EndState()
03512	    {
03513	      Pawn.SetCollision(true,true,true);
03514	      SetPhysics(PHYS_Walking);
03515	    }
03516	    function ProcessMove(float DeltaTime, vector NewAccel, eDoubleClickDir DoubleClickMove, rotator DeltaRot)
03517	    {
03518	//      Log("ClimbToHookNavPoint ProcessMove");
03519	      Pawn.Acceleration = vect(0,0,0);
03520	      if ( Pawn.Location.Z < (TargetHookClimb.Location.Z) )
03521	      {
03522	//        Log("                    ProcessMove going up");
03523	        Pawn.Velocity = vect(0,0,256);
03524	      }
03525	      else
03526	      {
03527	//        Log("                    ProcessMove going to nav point");
03528	        Pawn.Velocity = normal(TargetHookClimb.Location - Pawn.Location)*256;
03529	      }
03530	      if ( vSize(TargetHookClimb.Location - Pawn.Location) < 20.0 )
03531	      {
03532	//        Log("                    GOTO PlayerWalking because reached target");
03533	        GotoState('PlayerWalking');
03534	      }
03535	    }
03536	}
03537	
03538	//_____________________________________________________________________________
03539	state GameEnded
03540	{
03541	    ignores SeePlayer, HearNoise, KilledBy, NotifyBump, HitWall, NotifyHeadVolumeChange,
03542	      NotifyPhysicsVolumeChange, Falling, TakeDamage, Suicide, Reload, cNextItem, NextWeapon, PrevWeapon, cPrevItem, Grab;
03543	
03544	    simulated event RenderOverlays( canvas C ) {}
03545	    function PawnDied() {}
03546	    exec function ThrowWeapon() {}
03547	
03548	    function bool IsInLethalVolume(out optional volume Vol)
03549	    {
03550	      local Volume V;
03551	
03552	      ForEach Pawn.TouchingActors(class'Volume',V)
03553	        if ( V.IsA('Lethalvolume') )
03554	        {
03555	          Vol = V;
03556	          return true;
03557	        }
03558	      return false;
03559	    }
03560	
03561	    function ServerReStartGame()
03562	    {
03563	      Level.Game.RestartGame();
03564	    }
03565	
03566	// ELR E3 CHEAT
03567	    exec function Fire( optional float F )
03568	    {
03569	//      ConsoleCommand("RestartLevel");
03570	    }
03571	    exec function AltFire( optional float F )
03572	    {
03573	//      ConsoleCommand("RestartLevel");
03574	    }
03575	// ELR END E3 CHEATS
03576	/*
03577	    exec function Fire( optional float F )
03578	    {
03579	      if ( Role < ROLE_Authority)
03580	        return;
03581	      if ( !bFrozen )
03582	        ServerReStartGame();
03583	      else if ( TimerRate <= 0 )
03584	        SetTimer(1.5, false);
03585	    }
03586	
03587	    exec function AltFire( optional float F )
03588	    {
03589	      Fire(F);
03590	    }
03591	*/
03592	
03593	    function PlayerMove(float DeltaTime)
03594	    {
03595	      local vector X,Y,Z;
03596	      local Rotator ViewRotation;
03597	
03598	      GetAxes(Rotation,X,Y,Z);
03599	      // Update view rotation.
03600	
03601	      if ( !bFixedCamera )
03602	      {
03603	        ViewRotation = Rotation;
03604	        ViewRotation.Yaw += 32.0 * DeltaTime * aTurn;
03605	        ViewRotation.Pitch += 32.0 * DeltaTime * aLookUp;
03606	        ViewRotation.Pitch = ViewRotation.Pitch & 65535;
03607	        If ((ViewRotation.Pitch > 18000) && (ViewRotation.Pitch < 49152))
03608	        {
03609	          If (aLookUp > 0)
03610	            ViewRotation.Pitch = 18000;
03611	          else
03612	            ViewRotation.Pitch = 49152;
03613	        }
03614	        SetRotation(ViewRotation);
03615	      }
03616	      else if ( ViewTarget != None )
03617	        SetRotation(ViewTarget.Rotation);
03618	
03619	      ViewShake(DeltaTime);
03620	      ViewFlash(DeltaTime);
03621	
03622	      if ( Role < ROLE_Authority ) // then save this move and replicate it
03623	        ReplicateMove(DeltaTime, vect(0,0,0), DCLICK_None, rot(0,0,0));
03624	      else
03625	        ProcessMove(DeltaTime, vect(0,0,0), DCLICK_None, rot(0,0,0));
03626	      bPressedJump = false;
03627	    }
03628	
03629	    function ServerMove
03630	    (
03631	      float TimeStamp,
03632	      vector InAccel,
03633	      vector ClientLoc,
03634	      bool NewbRun,
03635	      bool NewbDuck,
03636	      bool NewbJumpStatus,
03637	      eDoubleClickDir DoubleClickMove,
03638	      byte ClientRoll,
03639	      int View,
03640	      optional byte OldTimeDelta,
03641	      optional int OldAccel
03642	    )
03643	    {
03644	      Global.ServerMove(TimeStamp, InAccel, ClientLoc, NewbRun, NewbDuck, NewbJumpStatus,
03645	        DoubleClickMove, ClientRoll, (32767 & (Rotation.Pitch/2)) * 32768 + (32767 & (Rotation.Yaw/2)) );
03646	
03647	    }
03648	
03649	    event PlayerCalcView(out actor ViewActor, out vector CameraLocation, out rotator CameraRotation )
03650	    {
03651	      ViewActor = ViewTarget;
03652	      CameraLocation = vGameEndedCamLoc;
03653	      CameraRotation = rGameEndedCamRot;
03654	    }
03655	
03656	    function FindGoodView()
03657	    {
03658	      local vector cameraLoc;
03659	      local rotator cameraRot, ViewRotation;
03660	      local int tries, besttry;
03661	      local float bestdist, newdist;
03662	      local int startYaw;
03663	      local actor ViewActor;
03664	
03665	      ViewRotation = Rotation;
03666	      ViewRotation.Pitch = 56000;
03667	      tries = 0;
03668	      besttry = 0;
03669	      bestdist = 0.0;
03670	      startYaw = ViewRotation.Yaw;
03671	
03672	      for (tries=0; tries<16; tries++)
03673	      {
03674	        cameraLoc = ViewTarget.Location;
03675	        PlayerCalcView(ViewActor, cameraLoc, cameraRot);
03676	        newdist = VSize(cameraLoc - ViewTarget.Location);
03677	        if (newdist > bestdist)
03678	        {
03679	          bestdist = newdist;
03680	          besttry = tries;
03681	        }
03682	        ViewRotation.Yaw += 4096;
03683	      }
03684	
03685	      ViewRotation.Yaw = startYaw + besttry * 4096;
03686	      SetRotation(ViewRotation);
03687	    }
03688	
03689	    function Timer()
03690	    {
03691	      bFrozen = false;
03692	    }
03693	
03694	    function BeginState()
03695	    {
03696	      local Pawn P;
03697	      Local Actor A;
03698	      Local Volume V;
03699	      local int XIIIEndGameType;
03700	
03701	      bFixedCamera = true;
03702	      DesiredFOV = DefaultFOV;
03703	      FOVAngle = DefaultFOV;
03704	
03705	      if ( Level.Game != none )
03706	        XIIIEndGameType = XIIIGameInfo(Level.Game).XIIIEndGameType;
03707	      else
03708	        XIIIEndGameType = 0;
03709	
03710	      Log("Game Ended for "$self$" w/ mode "$XIIIEndGameType);
03711	
03712	      // Hide all inventory that should be rendered
03713	      if ( Pawn != none )
03714	      {
03715	        Pawn.bCanClimbLadders = false; // no more ladder climb (in case player jumps in a laddervolume just before gameended
03716	        Pawn.bCanJump = false;
03717	        bWeaponBlock = true;
03718	/*
03719	        Pawn.PendingWeapon = none;
03720	        Pawn.PendingItem = none;
03721	        if ( pawn.weapon != none )
03722	        {
03723	          OldWeap = pawn.weapon.InventoryGroup;
03724	          Pawn.Weapon.PutDown();
03725	        }
03726	        if ( Pawn.SelectedItem != none )
03727	        {
03728	          OldItem = XIIIItems(Pawn.SelectedItem);
03729	          OldItem.PutDown();
03730	        }
03731	*/
03732	        if ( Pawn.Weapon != none )
03733	        {
03734	          Pawn.Weapon.bOwnerNoSee = true;
03735	          Pawn.Weapon.bHidden = true;
03736	          Pawn.Weapon.Refreshdisplaying();
03737	          if ( Pawn.Weapon.MySlave != none )
03738	          {
03739	            Pawn.Weapon.MySlave.bOwnerNoSee = true;
03740	            Pawn.Weapon.MySlave.bHidden = true;
03741	            Pawn.Weapon.MySlave.Refreshdisplaying();
03742	          }
03743	        }
03744	        if ( Pawn.SelectedItem != none )
03745	        {
03746	          Pawn.SelectedItem.bOwnerNoSee = true;
03747	          Pawn.SelectedItem.bHidden = true;
03748	          Pawn.SelectedItem.Refreshdisplaying();
03749	        }
03750	        if ( XIIIPawn(Pawn).LHand != none )
03751	        {
03752	          XIIIPawn(Pawn).LHand.bOwnerNoSee = true;
03753	          XIIIPawn(Pawn).LHand.bHidden = true;
03754	          XIIIPawn(Pawn).LHand.Refreshdisplaying();
03755	        }
03756	      }
03757	
03758	      Global.PlayerCalcView(A, vGameEndedCamLoc, rGameEndedCamRot);
03759	
03760	      if ( XIIIEndGameType == 1 ) // SoloDeath
03761	      {
03762	        if ( fRand() < 0.5 )
03763	          iGameEndedRandEffect = 1;
03764	        else
03765	          iGameEndedRandEffect = -1;
03766	        if ( XIIIPawn(pawn).HitDamageType != class'XIII.DTDrowned' )
03767	          GotoState('GameEndedDeath');
03768	        else
03769	          GotoState('GameEndedDrown');
03770	      }
03771	      else if ( XIIIEndGameType == 3 ) // Falling
03772	      {
03773	        if ( IsInLethalVolume(V) )
03774	        {
03775	//          Log("I'm in Lethalvolume V="$V);
03776	          OnoF = Spawn(class'OnoFalling', Pawn,,Pawn.Location);
03777	          vGameEndedCamLoc = Lethalvolume(V).PointOfViewWhenFalling.Location;
03778	        }
03779	//        Log("Volume V="$V$" PointOfViewWhenFalling="$Lethalvolume(V).PointOfViewWhenFalling);
03780	        iGameEndedRandEffect = 1;
03781	        bBehindView = true;
03782	        GotoState('GameEndedFalling');
03783	      }
03784	      else if ( XIIIEndGameType == 4 ) // Success
03785	      {
03786	        GotoState('GameEndedSuccess');
03787	      }
03788	
03789	      EndZoom();
03790	      bFire = 0;
03791	      bAltFire = 0;
03792	      if ( Pawn != None )
03793	      {
03794	        Pawn.SimAnim.AnimRate = 0;
03795	        Pawn.bPhysicsAnimUpdate = false;
03796	        Pawn.StopAnimating();
03797	        Pawn.SetCollision(false,false,false);
03798	      }
03799	      myHUD.bShowScores = true;
03800	      bFrozen = true;
03801	      if ( !bFixedCamera )
03802	      {
03803	        FindGoodView();
03804	        bBehindView = true;
03805	      }
03806	      SetTimer(1.5, false);
03807	      SetPhysics(PHYS_None);
03808	      ForEach DynamicActors(class'Pawn', P)
03809	      {
03810	        P.Velocity = vect(0,0,0);
03811	        P.SetPhysics(PHYS_None);
03812	      }
03813	    }
03814	begin:
03815	      if ( !Level.bLonePlayer || XIIIGameInfo(Level.Game).XIIIEndGameType==4)
03816			  stop;
03817		  Sleep(4);
03818	      ConsoleCommand("ShowTheMenu "$self);
03819	}
03820	
03821	//_____________________________________________________________________________
03822	state GameEndedDeath Extends GameEnded
03823	{
03824	    event PlayerTick(float dT)
03825	    {
03826	      DeltaT = dT;
03827	//      Log("DeltaT="$DeltaT);
03828	      Pawn.region.Zone.FlashEffectDesc.LayerBrightness = min(255, Pawn.region.Zone.FlashEffectDesc.LayerBrightness + DeltaT*200.0);
03829	      Pawn.region.Zone.FlashEffectDesc.Brightness = max(10, Pawn.region.Zone.FlashEffectDesc.Brightness - DeltaT*0.05);
03830	    }
03831	//      Global.PlayerCalcView(A, vGameEndedCamLoc, rGameEndedCamRot);
03832	    event PlayerCalcView(out actor ViewActor, out vector CameraLocation, out rotator CameraRotation )
03833	    {
03834	      Local vector TargetCamLoc;
03835	
03836	      TargetCamLoc = Pawn.Location - Pawn.CollisionHeight * 0.75 * vect(0,0,1);
03837	
03838	      if (rGameEndedCamRot.Pitch <= 15500)
03839	        rGameEndedCamRot.Pitch = max(0, rGameEndedCamRot.Pitch - (DeltaT * 300.0));
03840	//        rGameEndedCamRot.Pitch = max(0, rGameEndedCamRot.Pitch*0.97);
03841	      else if (rGameEndedCamRot.Pitch >= 50000)
03842	        rGameEndedCamRot.Pitch = min(65535, rGameEndedCamRot.Pitch + (DeltaT * 300.0));
03843	//        rGameEndedCamRot.Pitch = min(65535, rGameEndedCamRot.Pitch*1.007);
03844	
03845	      rGameEndedCamRot.Roll += 150.0 * (DeltaT*30.0) * iGameEndedRandEffect;
03846	      if ( iGameEndedRandEffect > 0 )
03847	        rGameEndedCamRot.Roll = min(rGameEndedCamRot.Roll, 12000);
03848	      else
03849	        rGameEndedCamRot.Roll = max(rGameEndedCamRot.Roll, -12000);
03850	      vGameEndedCamLoc = (vGameEndedCamLoc*45.0*(DeltaT*30.0) + TargetCamLoc)/(45.0*(DeltaT*30.0)+1);
03851	
03852	      ViewActor = ViewTarget;
03853	      CameraLocation = vGameEndedCamLoc;
03854	      CameraRotation = rGameEndedCamRot;
03855	    }
03856	
03857	    function BeginState()
03858	    {
03859	      Log("GameEndedDeath BeginState");
03860	      Pawn.region.Zone.FlashEffectDesc.IsActivated = true;
03861	      Pawn.region.Zone.FlashEffectDesc.NoGrey = true;
03862	      Pawn.region.Zone.FlashEffectDesc.Contrast = 255;
03863	      Pawn.region.Zone.FlashEffectDesc.LayerBrightness = 0;
03864	      Pawn.region.Zone.FlashEffectDesc.Brightness = 128;
03865	      Pawn.region.Zone.FlashEffectDesc.LayerColor = class'canvas'.static.makecolor(255,0,0,0);
03866	      DeltaT = 1.0/30.0;  // init to 30 fps
03867	      enable('Tick');
03868	      bStasis = false;
03869	//      SetTimer(1.5, false);
03870	//      Log("GameEndedDeath BeginState");
03871	    } // dont replay the GameEnded BeginState()
03872	/*
03873	    event Timer()
03874	    {
03875				ShakeView(5.0, 300, vect(0,0,10), 120000, vect(50,50,50), 3);
03876	    }
03877	*/
03878	}
03879	
03880	//_____________________________________________________________________________
03881	state GameEndedDrown Extends GameEnded
03882	{
03883	//      Global.PlayerCalcView(A, vGameEndedCamLoc, rGameEndedCamRot);
03884	    event PlayerCalcView(out actor ViewActor, out vector CameraLocation, out rotator CameraRotation )
03885	    {
03886	      Local vector TargetCamLoc;
03887	
03888	      TargetCamLoc = Pawn.Location; // - Pawn.CollisionHeight * 0.8 * vect(0,0,1);
03889	
03890	//      if ( (rGameEndedCamRot.Pitch > 15500) && (rGameEndedCamRot.Pitch < 50000))
03891	      if (rGameEndedCamRot.Pitch <= 15500)
03892	        rGameEndedCamRot.Pitch = min(15500, rGameEndedCamRot.Pitch + 300);
03893	      else if (rGameEndedCamRot.Pitch >= 50000)
03894	      {
03895	        rGameEndedCamRot.Pitch = rGameEndedCamRot.Pitch + 300;
03896	        rGameEndedCamRot.Pitch = rGameEndedCamRot.Pitch & 65535;
03897	      }
03898	
03899	/*
03900	      rGameEndedCamRot.Roll += 160*iGameEndedRandEffect;
03901	      if ( iGameEndedRandEffect > 0 )
03902	        rGameEndedCamRot.Roll = min(rGameEndedCamRot.Roll, 12000);
03903	      else
03904	        rGameEndedCamRot.Roll = max(rGameEndedCamRot.Roll, -12000);
03905	*/
03906	
03907	      vGameEndedCamLoc = (vGameEndedCamLoc*24.0 + TargetCamLoc)/25.0;
03908	
03909	      ViewActor = ViewTarget;
03910	      CameraLocation = vGameEndedCamLoc;
03911	      CameraRotation = rGameEndedCamRot;
03912	    }
03913	
03914	    function BeginState()
03915	    {
03916	//      Log("GameEndedDeath BeginState");
03917	    } // dont replay the GameEnded BeginState()
03918	}
03919	
03920	//_____________________________________________________________________________
03921	state GameEndedFalling Extends GameEnded
03922	{
03923	    event PlayerCalcView(out actor ViewActor, out vector CameraLocation, out rotator CameraRotation )
03924	    {
03925	      ViewActor = ViewTarget;
03926	      CameraLocation = vGameEndedCamLoc;
03927	      CameraRotation = Rotator(ViewActor.Location - vGameEndedCamLoc);
03928	    }
03929	
03930	    function BeginState()
03931	    {
03932	//      Log("GameEndedFalling BeginState");
03933	      FilterColorWanted=class'canvas'.static.makecolor(0,0,0,0);
03934	      FilterColorSpeed=0.5;
03935	/*
03936	var color FilterColor;                // La couleur courante.
03937	var color FilterColorWanted;          // La couleur vers laquelle le moteur doit converger.
03938	var float FilterColorSpeed;           // La vitesse de convergence.
03939	*/
03940	    } // dont replay the GameEnded BeginState()
03941	
03942	    function EndState()
03943	    {
03944	      FilterColorWanted=class'canvas'.static.makecolor(128,128,128,128);
03945	      FilterColorSpeed=10.0;
03946	    }
03947	
03948	    Event bool NotifyLanded(vector HitNorm)
03949	    {
03950	      OnoF.OnoEnd();
03951	      FilterColor=class'canvas'.static.makecolor(200,0,0,64);
03952	      FilterColorWanted=class'canvas'.static.makecolor(200,0,0,64);
03953	      Settimer(0.10, false);
03954	      return true;
03955	    }
03956	
03957	    event Timer()
03958	    {
03959	      FilterColorWanted=class'canvas'.static.makecolor(0,0,0,0);
03960	      FilterColorSpeed=5.0;
03961	    }
03962	}
03963	
03964	//_____________________________________________________________________________
03965	// the mission is a success, play video if available then travel
03966	state GameEndedSuccess extends GameEnded
03967	{
03968	    event BeginState()
03969	    {
03970	//      Log("GameEndedSucess BeginState");
03971	      SetTimer(3.0, false);
03972	    }
03973	    event Timer()
03974	    {
03975	//      Log("GameEndedSucess Timer");
03976	      if ( (XIIIGameInfo(Level.Game).MapInfo != none) && (XIIIGameInfo(Level.Game).MapInfo.EndMapVideo != "") )
03977	      { // Play video
03978	        if ( VP == none )
03979	          VP = new class'VideoPlayer';
03980	        if ( VP != none )
03981	          VP.Open(XIIIGameInfo(Level.Game).MapInfo.EndMapVideo);
03982	        GotoState('PlayingVideo');
03983	      }
03984	      else
03985	      { // travel
03986	        GotoState('GameEndedSuccess', 'DoTravel');
03987	      }
03988	    }
03989	Begin:
03990	  Stop;
03991	DoTravel:
03992	//  Log("GameEndedSucess DoTravel... Sleep 0.3");
03993	  sleep(1.0);
03994	//  Log("GameEndedSucess DoTravel... End sleep");
03995	  Level.ServerTravel(XIIIGameInfo(Level.Game).MapInfo.NextMapLevelWithUnr, true);
03996	}
03997	
03998	//_____________________________________________________________________________
03999	state PlayingVideo
04000	{
04001	    event BeginState()
04002	    {
04003	      KillAllSounds();
04004	      VP.Play();
04005	      StopAllSounds();
04006	    }
04007	    event PlayerTick(float dT)
04008	    {
04009	      if ( VP == none )
04010	        Level.ServerTravel(XIIIGameInfo(Level.Game).MapInfo.NextMapLevelWithUnr, true);
04011	      else
04012	      {
04013	        switch (VP.GetStatus())
04014	        {
04015	          Case 0: // End video or no play
04016	            Log("End video or no play");
04017	            Level.ServerTravel(XIIIGameInfo(Level.Game).MapInfo.NextMapLevelWithUnr, true);
04018	            break;
04019	          Case 2: // Error while playing
04020	            Log("Error playing video");
04021	            Level.ServerTravel(XIIIGameInfo(Level.Game).MapInfo.NextMapLevelWithUnr, true);
04022	            break;
04023	          Case 1: // continue playing
04024	        }
04025	      }
04026	    }
04027	    exec function Fire( optional float F );
04028	}
04029	
04030	//_____________________________________________________________________________
04031	State NoControl extends PlayerWalking
04032	{
04033	    ignores ReLoad, NextWeapon, PrevWeapon, cNextItem, cPrevItem, Fire, AltFire, Jump, Grab, QuickHeal;
04034	
04035	//    simulated event RenderOverlays( canvas C ) {}
04036	
04037	    event BeginState()
04038	    {
04039	      Pawn.bCanCrouch=false;
04040	//      Log("NoControl Begin State");
04041	      Super.BeginState();
04042	      velocity=vect(0,0,0);
04043	      if (!bMenuIsActive)
04044	      Level.bCineFrame = true;
04045	//      PlayerInput.bForceCrouch = true;
04046	    }
04047	
04048	    event EndState()
04049	    {
04050	      Pawn.bCanCrouch=true;
04051	      Level.bCineFrame = false;
04052	      MyInteraction.TargetActor = none; // Anticrash if target actor was a breakable mover
04053	//      Log("NoControl End State");
04054	//      PlayerInput.bForceCrouch = false;
04055	    }
04056	
04057	    function UpdateRotation(float DeltaTime, float maxPitch)
04058	    {
04059	      local Rotator r;
04060	      r=Rotation;
04061	      //		DesiredRotation=Rotation;
04062	      ViewShake(deltaTime);
04063	      SetRotation(r); // Force Rotation even if shaking camera
04064	      ViewFlash(deltaTime);
04065	    }
04066	/*
04067	    event Playertick(float dT)
04068	    {
04069	//      Log("NoControl End State");
04070	    }
04071	
04072	
04073	    event PlayerCalcView(out actor ViewActor, out vector CameraLocation, out rotator CameraRotation )
04074	    {
04075	      Log("NoControl PlayerCalcView");
04076	    	ViewActor = ViewTarget;
04077	      CameraLocation = Location;
04078	      CameraRotation = Rotation;
04079	    }
04080	*/
04081	
04082	    function PlayerMove( float DeltaTime )
04083	    {
04084	      local vector X,Y,Z, NewAccel;
04085	      local eDoubleClickDir DoubleClickMove;
04086	      local rotator OldRotation; //, ViewRotation;
04087	      //local float Speed2D;
04088	      //local bool bSaveJump;
04089	
04090	//      Log("NoControl PlayerMove");
04091	      GetAxes(Pawn.Rotation,X,Y,Z);
04092	
04093	      // Update acceleration.
04094	      NewAccel = vect(0,0,0);
04095	//      DoubleClickMove = PlayerInput.CheckForDoubleClickMove(DeltaTime);
04096	
04097	      GroundPitch = 0;
04098	      bSnaptoLevel = false;
04099	      bCenterView = false;
04100	      OldRotation = Rotation;
04101	      // MLK: Otherwise the player moves while in menu
04102	      if (!(Left(Level.GetLocalURL(), 7) ~= "mapmenu"))
04103	  		UpdateRotation(DeltaTime, 1);
04104	//      ViewShake(deltaTime);
04105	//      ViewFlash(deltaTime);
04106	
04107	      if ( Pawn.Physics != PHYS_Falling )
04108	      {
04109	        Pawn.bWantsToCrouch = PlayerInput.bForceCrouch;
04110	        Pawn.ShouldCrouch(PlayerInput.bForceCrouch);
04111	      }
04112	
04113	      if ( Role < ROLE_Authority ) // then save this move and replicate it
04114	        ReplicateMove(DeltaTime, NewAccel, DoubleClickMove, OldRotation - Rotation);
04115	      else
04116	        ProcessMove(DeltaTime, NewAccel, DoubleClickMove, OldRotation - Rotation);
04117	      bPressedJump = false;
04118	    }
04119	}
04120	
04121	//_____________________________________________________________________________
04122	// waiting for first display to give controls to the player (else can trigger unwanted/unseen events)
04123	// by moving while engine init (w/out screen refresh)
04124	state WaitForFirstDisplay
04125	{
04126	    simulated event RenderOverLays(Canvas C)
04127	    {
04128	      if ( !bOkForMoving )
04129	      {
04130	        bOkForMoving = true;
04131	        SetTimer(0.2, false);
04132	      }
04133	    }
04134	    simulated event Timer()
04135	    {
04136	      EnterStartState();
04137	    }
04138	    function UpdateRotation(float DeltaTime, float maxPitch);
04139	    function PlayerMove( float DeltaTime );
04140	}
04141	
04142	
04143	//_____________________________________________________________________________
04144	/*State NoRotation extends PlayerWalking
04145	{
04146	    ignores ReLoad, NextWeapon, PrevWeapon, cNextItem, cPrevItem, Fire, AltFire, Jump, Grab, QuickHeal;
04147	
04148	    simulated event RenderOverlays( canvas C ) {}
04149	
04150	    event BeginState()
04151	    {
04152	//      Log("NoControl Begin State");
04153	      Super.BeginState();
04154	      velocity=vect(0,0,0);
04155	    }
04156	
04157	    event EndState()
04158	    {
04159	      MyInteraction.TargetActor = none; // Anticrash if target actor was a breakable mover
04160	//      Log("NoControl End State");
04161	    }
04162	
04163	    function UpdateRotation(float DeltaTime, float maxPitch)
04164	    {
04165			LOCAL Rotator r;
04166			r=Rotation;
04167			ViewShake(deltaTime);
04168			SetRotation(r); // Force Rotation even if shaking camera
04169			ViewFlash(deltaTime);
04170	    }
04171	}*/
04172	//_____________________________________________________________________________
04173	State NoMove extends PlayerWalking
04174	{
04175	    ignores ReLoad, NextWeapon, PrevWeapon, cNextItem, cPrevItem, Fire, AltFire, Jump, Grab, QuickHeal;
04176	    event BeginState()
04177	    {
04178	      Super.BeginState();
04179	      velocity=vect(0,0,0);
04180	  	  rGameEndedCamRot=Rotation;
04181	      Pawn.bCanCrouch=false;
04182	    }
04183	    event EndState()
04184	    {
04185	      MyInteraction.TargetActor = none; // Anticrash if target actor was a breakable mover
04186	      Pawn.bCanCrouch=true;
04187	//      Log("NoMove End State");
04188	    }
04189	
04190	    function PlayerMove( float DeltaTime )
04191	    {
04192	      local vector NewAccel;
04193	      local eDoubleClickDir DoubleClickMove;
04194	      local rotator OldRotation,r;
04195	
04196	      NewAccel = vect(0,0,0);
04197	
04198	      GroundPitch = 0;
04199	      bSnaptoLevel = false;
04200	      bCenterView = false;
04201	      OldRotation = Rotation;
04202	  	  r=Rotation-rGameEndedCamRot;
04203	
04204	      DesiredRotation = r; //save old rotation
04205	      r.Yaw += 32.0 * DeltaTime * aTurn;
04206	      r.Pitch += 32.0 * DeltaTime * aLookUp;
04207	
04208	      r.Pitch = r.Pitch & 65535;
04209	      if ((r.Pitch > 15500) && (r.Pitch < 50000))
04210	      {
04211	        if (aLookUp > 0)
04212	          r.Pitch = 15500;
04213	        else
04214	          r.Pitch = 50000;
04215	      }
04216	
04217	      r.yaw=Clamp(((r.yaw+32768)&65535)-32768,-6144,6144);
04218	      r.Roll=0;
04219	      r.Pitch=Clamp(((r.Pitch+32768)&65535)-32768,-3072,3072);
04220	      SetRotation(r+rGameEndedCamRot);
04221	      ViewShake(deltaTime);
04222	      ViewFlash(deltaTime);
04223	
04224	      if ( Role < ROLE_Authority ) // then save this move and replicate it
04225	        ReplicateMove(DeltaTime, NewAccel, DoubleClickMove, OldRotation - Rotation);
04226	      else
04227	        ProcessMove(DeltaTime, NewAccel, DoubleClickMove, OldRotation - Rotation);
04228	      bPressedJump = false;
04229	    }
04230	}
04231	
04232	//_____________________________________________________________________________
04233	simulated State Kicked
04234	{
04235	    ignores ReLoad, NextWeapon, PrevWeapon, cNextItem, cPrevItem, Fire, AltFire, Jump, Grab, QuickHeal;
04236	    simulated event BeginState()
04237	    {
04238	      //Log("KICKED"@self@"BeginState");
04239	    }
04240	    simulated event EndState()
04241	    { // kicked are not allowed to go out of this state
04242	      //Log("KICKED"@self@"EndState");
04243	      SetTimer3(0.01, false);
04244	    }
04245	    function UpdateRotation(float DeltaTime, float maxPitch);
04246	    function PlayerMove( float DeltaTime );
04247	Begin:
04248	  Sleep(4);
04249	}
04250	
04251	//_____________________________________________________________________________
04252	// use to force player in Kicked State (else will go to dead after kicked
04253	simulated event timer3()
04254	{
04255	//    Log("KICKED"@self@"timer3");
04256	    GotoState('Kicked');
04257	}
04258	
04259	FUNCTION ClientSetHUD(class<HUD> newHUDType, class<Scoreboard> newScoringType)
04260	{
04261		SUPER.ClientSetHUD( newHUDType, newScoringType);
04262	
04263		if ( int(ConsoleCommand("Get GameInfo GoreLevel") ) != 0 )
04264	    {
04265	// PARENTAL LOCL ON
04266			ReplaceATextureByAnOther( Texture'XIIICine.effets.blodspotA', Texture'XIIICine.effets.blodspotAPL' );
04267			ReplaceATextureByAnOther( Texture'XIIICine.effets.bloodheadshotA', Texture'XIIICine.effets.bloodheadshotAPL' );
04268			ReplaceATextureByAnOther( Texture'XIIICine.effets.bloodprojM', Texture'XIIICine.effets.bloodprojMPL' );
04269			ReplaceATextureByAnOther( Texture'XIIICine.effets.goutteblood', Texture'XIIICine.effets.gouttebloodPL' );
04270			ReplaceATextureByAnOther( Texture'XIIICine.effets.jikleblood', Texture'XIIICine.effets.jiklebloodPL' );
04271			ReplaceATextureByAnOther( Texture'XIIICine.effets.projectionblodA', Texture'XIIICine.effets.projectionblodAPL' );
04272			ReplaceATextureByAnOther( Texture'XIIICine.effets.vignetteblood', Texture'XIIICine.effets.vignettebloodPL' );
04273		}
04274		else
04275		{
04276	// PARENTAL LOCL OFF
04277			ReplaceATextureByAnOther( Texture'XIIICine.effets.blodspotAPL', Texture'XIIICine.effets.blodspotA' );
04278			ReplaceATextureByAnOther( Texture'XIIICine.effets.bloodheadshotAPL', Texture'XIIICine.effets.bloodheadshotA' );
04279			ReplaceATextureByAnOther( Texture'XIIICine.effets.bloodprojMPL', Texture'XIIICine.effets.bloodprojM' );
04280			ReplaceATextureByAnOther( Texture'XIIICine.effets.gouttebloodPL', Texture'XIIICine.effets.goutteblood' );
04281			ReplaceATextureByAnOther( Texture'XIIICine.effets.jiklebloodPL', Texture'XIIICine.effets.jikleblood' );
04282			ReplaceATextureByAnOther( Texture'XIIICine.effets.projectionblodAPL', Texture'XIIICine.effets.projectionblodA' );
04283			ReplaceATextureByAnOther( Texture'XIIICine.effets.vignettebloodPL', Texture'XIIICine.effets.vignetteblood' );
04284		}
04285	
04286	
04287	}
04288	
04289	
04290	defaultproperties
04291	{
04292	     bWeaponMode=True
04293	     bWaitForWeaponMode=True
04294	     bAltZoomingSystem=True
04295	     bFixedCrosshair=True
04296	     hCLimbDoorSound=Sound'XIIIsound.SpecActions.LeonClimb1'
04297	     hEndClimbDoorSound=Sound'XIIIsound.SpecActions.LeonClimb2'
04298	     hCamViewBeginUseSound=Sound'XIIIsound.Items.CameraOn'
04299	     hCamViewInUseSound=Sound'XIIIsound.Items.CameraRumble'
04300	     hEndClimbLadderSound=Sound'XIIIsound.SpecActions__LadderClimb.LadderClimb__hEndClimbLadder'
04301	     MyInteractionClass="XIII.XIIIPlayerInteraction"
04302	     hTyrolStartSound=Sound'XIIIsound.Movers__TyrolCable.TyrolCable__hCableStart'
04303	     hTyrolEndSound=Sound'XIIIsound.Movers__TyrolCable.TyrolCable__hCableEnded'
04304	     iCrosshairMode=1
04305	     fCrosshairSize=2.000000
04306	     fLookSpeed=1.000000
04307	     bUseRumble=True
04308	     CheatClass=Class'XIII.XIIICheatManager'
04309	     PlayerReplicationInfoClass=Class'XIII.XIIIPlayerReplicationInfo'
04310	     bHasRollOff=False
04311	     bHasPosition=False
04312	}

End Source Code