Engine
Class PlayerPawn

source: c:\runehov\Engine\Classes\PlayerPawn.uc
Core.Object
   |
   +--Engine.Actor
      |
      +--Engine.Pawn
         |
         +--Engine.PlayerPawn
Direct Known Subclasses:Camera, Spectator, RunePlayer

class PlayerPawn
extends Engine.Pawn

//============================================================================= // PlayerPawn. // player controlled pawns // Note that Pawns which implement functions for the PlayerTick messages // must handle player control in these functions //=============================================================================
Variables
 float AtrophyTimer
           RUNE: Timer for strength atrophy
 BorrowedMouseX, BorrowedMouseY
           weapon class priorities (9 is highest)
 byte CdTrack
 float ClientSideAlphaScale
           RUNE: client side var for camera alpha
 CurrentTimeStamp,LastUpdateTime,ServerTimeStamp,TimeMargin, ClientUpdateTime
           weapon class priorities (9 is highest)
 float DefaultFOV
 string DelayedCommand
           just spawned into a level (not from a loadgame)
 int DemoViewPitch
           weapon class priorities (9 is highest)
 int DemoViewYaw
           weapon class priorities (9 is highest)
 float DesiredFOV
 vector DesiredPolyColorAdjust
           RUNE: Desired adjust (smoothly fades to this color)
 string FailedView
           weapon class priorities (9 is highest)
 FlashScale, FlashFog
 SavedMove FreeMoves
           weapon class priorities (9 is highest)
 GameReplicationInfo GameReplicationInfo
           weapon class priorities (9 is highest)
 class HUDType
 float HudTranslucency
 ConstantGlowScale, InstantFlash
 ConstantGlowFog, InstantFog
 float LastPlaySound
           weapon class priorities (9 is highest)
 float LevelFadeAlpha
           just spawned into a level (not from a loadgame)
 float MaxTimeMargin
           weapon class priorities (9 is highest)
 int Misc1
 int Misc2
 float MouseSensitivity
           just spawned into a level (not from a loadgame)
 float MouseSmoothThreshold
           weapon class priorities (9 is highest)
 float MouseZeroTime
           weapon class priorities (9 is highest)
 float MyAutoAim
           max vertical shake magnitude
 string NoPauseMessage
           weapon class priorities (9 is highest)
 float OldScale
           RUNE: storage of alphascale while client alpha rendering
 ERenderStyle OldStyle
           RUNE: storage of style while client alpha rendering
 string OwnCamera
           weapon class priorities (9 is highest)
 SavedMove PendingMove
           weapon class priorities (9 is highest)
 Player Player
 vector PolyColorAdjust
           RUNE: Color adjust on the screen polygons
 color ProgressColor[8]
           weapon class priorities (9 is highest)
 string ProgressMessage[8]
           weapon class priorities (9 is highest)
 float ProgressTimeOut
           weapon class priorities (9 is highest)
 string QuickSaveString
           weapon class priorities (9 is highest)
 int RendMap
 SavedMove SavedMoves
           weapon class priorities (9 is highest)
 ScoreBoard Scoring
 class ScoringType
 int ShowFlags
 music Song
 byte SongSection
 class SpecialMenu
           just spawned into a level (not from a loadgame)
 Weapon StowSpot[3]
           RUNE: Stow Spots
 float TargetEyeHeight
           weapon class priorities (9 is highest)
 rotator TargetViewRotation
           weapon class priorities (9 is highest)
 vector TargetWeaponViewOffset
           weapon class priorities (9 is highest)
 EMusicTransition Transition
 Actor ViewTarget
 string ViewingFrom
           weapon class priorities (9 is highest)
 name WeaponPriority[20]
           weapon class priorities (9 is highest)
 float ZoomLevel
           just spawned into a level (not from a loadgame)
 bool bAdmin
           RUNE: Stow Spots
 bool bAlwaysMouseLook
           Snap to level eyeheight when not mouselooking
 bool bAnimTransition
           used for dodge move
 bool bBadConnectionAlert
           used for dodge move
 bool bBloodLust
           RUNE: True if the character is bloodlusting
 bool bCenterView
           used for dodge move
 bool bCheatsEnabled
           used in net games
 bool bClientSideAlpha
           RUNE: client side var for camera alpha
 bool bDelayedCommand
           used for dodge move
 bool bEdgeBack
           used for dodge move
 bool bEdgeForward
           used for dodge move
 bool bEdgeLeft
           used for dodge move
 bool bEdgeRight
           used for dodge move
 bool bFixedCamera
           this class allowed in single player
 bool bFrozen
           used for dodge move
 bool bInvertMouse
           used for dodge move
 bool bIsCrouching
           used for dodge move
 bool bIsTurning
           used for dodge move
 bool bIsTyping
           this class allowed in single player
 bool bJumpStatus
           used in net games
 bool bJustAltFired
           this class allowed in single player
 bool bJustFired
           this class allowed in single player
 bool bJustSpawned
           just spawned into a level (not from a loadgame)
 bool bKeyboardLook
           no snapping when true
 bool bLookUpStairs
           look up/down stairs (player)
 bool bMaxMouseSmoothing
           used for dodge move
 bool bMessageBeep
           used for dodge move
 bool bMouseZeroed
           used for dodge move
 bool bNeverAutoSwitch
           if true, don't automatically switch to picked up weapon
 bool bNoFlash
           used for dodge move
 bool bNoVoices
           used for dodge move
 bool bPressedJump
           used for dodge move
 bool bReadyToPlay
           used for dodge move
 bool bReducedVis
           used for dodge move
 bool bRising
           used for dodge move
 bool bShowMenu
           used for dodge move
 bool bShowScores
           used for dodge move
 bool bSinglePlayer
           this class allowed in single player
 bool bSnapToLevel
           Snap to level eyeheight when not mouselooking
 bool bSpecialMenu
           used for dodge move
 bool bUpdatePosition
           used for dodge move
 bool bWasBack
           used for dodge move
 bool bWasForward
           used for dodge move
 bool bWasLeft
           used for dodge move
 bool bWasRight
           used for dodge move
 bool bWokeUp
           used for dodge move
 bool bZooming
           used for dodge move
 float bobtime
 input float
           weapon class priorities (9 is highest)
 float maxshake
           max vertical shake magnitude
 DebugHUD myDebugHUD
 HUD myHUD
 string ngWorldSecret
           weapon class priorities (9 is highest)
 int shakemag
           max magnitude in degrees of shaking
 float shaketimer
           player uses this for shaking view
 float shakevert
           max vertical shake magnitude
 float verttimer
           max vertical shake magnitude

States
GameEnded, Dying, Uninterrupted, Pain, PlayerSpectating, PlayerWaiting, CheatFlying, PlayerFlying, PlayerSwimming, FeigningDeath, EdgeHanging, PlayerWalking, InvalidState

Function Summary
 void ActivateInventoryItem(class InvItem)
     
// Activate specific inventory item
 void ActivateItem()
     
// The player wants to active selected item
 void AddBots(int N)
 rotator AdjustAim(float projSpeed, vector projStart, int aimerror, bool bLeadTarget, bool bWarnTarget)
     
/* AdjustAim()
Calls this version for player aiming help.
Aimerror not used in this version.
Only adjusts aiming at pawns
*/
 void Admin(string CommandLine)
     
// Execute an administrative console command on the server.
 void AdminLogin(string Password)
     
// Login as the administrator.
 void AdminLogout()
     
// Logout as the administrator.
 void AltFire(optional float)
     
// The player wants to alternate-fire.
 void AlwaysMouseLook(Bool B)
 void Amphibious()
 eAttitude AttitudeTo(Pawn Other)
 void BehindView(Bool B)
 void BoostStrength(int amount)
 void Bug(string Msg)
     
//=============================================================================
//
// Bug
//
// RUNE:  A convenient bug report tool that outputs a message long with the
// current player location
//=============================================================================
 void CalcBehindView(out vector, out rotator, float Dist)
     
// Player view.
// Compute the rendering viewpoint for the player.
//
 void CallForHelp()
 void CauseEvent(name N)
 void ChangeAlwaysMouseLook(Bool B)
 void ChangeAutoAim(float F)
 void ChangeCrosshair()
     
// Crosshair
 void ChangeDodgeClickTime(float F)
 void ChangeHud()
 void ChangeName(string S)
 void ChangeSnapView(bool B)
 void ChangeStairLook(bool B)
 void ChangeTeam(int N)
 void ChangedWeapon()
     
// Just changed to pendingWeapon
 void CheatPlease()
 void CheckBob(float DeltaTime, float Speed2D, vector Y)
 void ClearProgressMessages()
     
//*************************************************************************************
// Special purpose/cheat execs
 void ClientAdjustGlow(float scale, vector fog)
 void ClientAdjustPosition(float TimeStamp, name newState, EPhysics newPhysics, float NewLocX, float NewLocY, float NewLocZ, float NewVelX, float NewVelY, float NewVelZ, Actor NewBase)
     
// ClientAdjustPosition - pass newloc and newvel in components so they don't get rounded
 void ClientChangeTeam(int N)
 void ClientFlash(float scale, vector fog)
 void ClientInstantFlash(float scale, vector fog)
 
simulated
ClientPlaySound(sound ASound, optional bool, optional bool)
     
//Play a sound client side (so only client will hear it
 
simulated
ClientReliablePlaySound(sound ASound, optional bool, optional bool)
 void ClientReplicateSkins(Texture Skin1, optional texture, optional texture, optional texture)
 void ClientSetMusic(music NewSong, byte NewSection, byte NewCdTrack, EMusicTransition NewTransition)
 void ClientShake(vector shake)
 void ClientUpdatePosition()
 void ClientVoiceMessage(PlayerReplicationInfo Sender, PlayerReplicationInfo Recipient, name messagetype, byte messageID)
 void ClientWeaponEvent(name EventType)
 int CompressAccel(int C)
 string ConsoleCommand(string Command)
     
// Execute a console command in the context of this player, then forward to Actor.ConsoleCommand.
 void CopyToClipboard(string Text)
 void DebugCommand(string text)
 void DebugContinue()
 void Defend(optional float)
     
// The player wants to defend
exec 
 void Died(Pawn Killer, name damageType, vector HitLocation)
     
//log(class$" Falling");
	PlayInAir(0.1);
}
*/
 void DoJump(optional float)
     
//Player Jumped
 void EndZoom()
 void FOV(float F)
 void Falling()
     
/* 
 void FeignDeath()
 void Fire(optional float)
     
// The player wants to fire.
 void Fly()
 void FunctionKey(byte Num)
     
// Handle function keypress for F1-F10.
 string GetDefaultURL(string Option)
 LevelInfo GetEntryLevel()
 SavedMove GetFreeMove()
 string GetPlayerNetworkAddress()
 void Ghost()
 void God()
 void Grab()
 void HandleWalking()
 void InitPlayerReplicationInfo()
 void InvertMouse(bool B)
 void Invisible(bool B)
 void Jump(optional float)
 void JumpOffPawn()
 void Kick(string S)
 void KickBan(string S)
 string KillMessage(name damageType, Pawn Other)
 void KillPawns()
 void KilledBy(Pawn EventInstigator)
     
//=============================================================================
// Player Control
 void Loc()
     
//=============================================================================
//
// Loc
//
// RUNE:  debugging tool.  Prints a message to the screen with the player location
//=============================================================================
 void LocalTravel(string URL)
 void MoveAutonomous(float DeltaTime, bool NewbRun, bool NewbDuck, bool NewbPressedJump, eDodgeDir DodgeMove, vector newAccel, rotator DeltaRot)
 void Mutate(string MutateString)
 void Name(string S)
 void NeverSwitchOnPickup(bool B)
 void NextWeapon()
     
/* NextWeapon()
- switch to next inventory group weapon
*/
 string PasteFromClipboard()
 void Pause()
     
// Try to pause the game.
 void Ping()
 void PlayAltFiring()
 
simulated
PlayBeepSound()
 void PlayChatting()
 void PlayDodge(eDodgeDir DodgeMove)
     
//=============================================================================
// Animation playing - should be implemented in subclass, 
//
 void PlayFeignDeath()
 void PlayFiring()
 void PlayHit(float Damage, vector HitLocation, name damageType, float MomentumZ)
 void PlayRising()
 void PlaySwimming()
 void PlayTurning(optional float)
 void PlayerList()
 void PlayersOnly()
 void PowerUp()
 void PrevItem()
     
// The player wants to select previous item
 void PrevWeapon()
     
/* PrevWeapon()
- switch to previous inventory group weapon
*/
 void ProcessMove(float DeltaTime, vector newAccel, eDodgeDir DodgeMove, rotator DeltaRot)
 void Profile()
 void QuickLoad()
 void QuickSave()
 void RememberSpot()
 void ReplaceText(out string, string Replace, string With)
 void ReplicateMove(float DeltaTime, vector NewAccel, eDodgeDir DodgeMove, rotator DeltaRot)
     
//
// Replicate this client's desired movement to the server.
//
 void ResetKeyboard()
     
//
// native client-side functions.
//
 void RestartLevel()
 void RuleList()
 void SShot()
 void Say(string Msg)
     
// Send a message to all players.
 void ServerAddBots(int N)
 void ServerChangeSkin(int SkinIndex)
 void ServerFeignDeath()
 void ServerMove(float TimeStamp, vector InAccel, vector ClientLoc, bool NewbRun, bool NewbDuck, bool NewbJumpStatus, bool bFired, bool bAltFired, bool bForceFire, bool bForceAltFire, eDodgeDir DodgeMove, byte ClientRoll, int View, optional byte, optional int)
     
//
// Send movement to the server.
// Passes acceleration in components so it doesn't get rounded.
//
 void ServerNeverSwitchOnPickup(bool B)
 void ServerReStartGame()
 void ServerReStartPlayer()
 void ServerSetSloMo(float T)
 void ServerSetWeaponPriority(byte i, name WeaponName)
 void ServerTaunt(name Sequence)
 void ServerUpdateWeapons()
 void SetAutoAim(float F)
 void SetBob(float F)
 void SetClientAlpha(float alpha)
 void SetDesiredFOV(float F)
 void SetDodgeClickTime(float F)
 void SetFOVAngle(float newFOV)
 void SetFriction(float F)
 void SetJumpZ(float F)
 void SetMaxMouseSmoothing(bool B)
 void SetMouseSmoothThreshold(float F)
 void SetName(string S)
 bool SetPause(BOOL bPause)
     
// Try to set the pause state; returns success indicator.
 void SetProgressColor(color C, int Index)
 void SetProgressMessage(string S, int Index)
 void SetProgressTime(float T)
 void SetSensitivity(float F)
 void SetSpeed(float F)
 void SetViewFlash(bool B)
 void SetWeaponStay(bool B)
 void ShakeView(float shaketime, float RollMag, float vertmag)
 void ShowInventory()
 void ShowLoadMenu()
 void ShowMenu()
 void ShowPath()
 void ShowScores()
 void ShowSpecialMenu(string ClassName)
     
//*************************************************************************************
// Normal gameplay execs
// Type the name of the exec function at the console to execute it
 void ShowTags(optional string)
     
// ShowTags [f] []
 void ShutUp()
 void SloMo(float T)
 void SnapView(bool B)
 void Speech(int Type, int Index, int Callsign)
     
// Send a voice message of a certain type to a certain player.
 void StairLook(bool B)
 void StartWalk()
 void StartZoom()
 void StopZoom()
 void StrengthDecay(float Time)
 void Suicide()
 void Summon(string ClassName)
 void SwimAnimUpdate(bool bNotForward)
 void SwitchCoopLevel(string URL)
 void SwitchLevel(string URL)
 void SwitchWeapon(byte F)
     
// The player wants to switch to weapon group numer I.
 void Taunt()
 void Team(int N)
 void TeamSay(string Msg)
 void Tele(vector newLoc)
     
//=============================================================================
//
// Tele
//
// RUNE:  debugging tool.  Teleports the player to a given location
//=============================================================================
 void Throw()
 void ToggleRuneHUD()
     
// HUD
 void ToggleZoom()
 void TweenToSwimming(float tween)
 void Typing(bool bTyping)
 void UpdateBob(float F)
 void UpdateRotation(float DeltaTime, float maxPitch)
 void UpdateSensitivity(float F)
 void UpdateURL(string NewOption, string NewValue, bool bSaveDefault)
 void UpdateWeaponPriorities()
 void Use()
 void ViewFlash(float DeltaTime)
 void ViewPlayer(string S)
 void ViewPlayerNum(optional int)
 void ViewSelf()
 void ViewShake(float DeltaTime)
     
// NOTE:  This function is overridden in RunePlayer
 void Walk()
 void Watch(string ClassName)
 void damageAttitudeTo(Pawn Other)


State GameEnded Function Summary
 void SetNGSecret(string newSecret)
 string GetNGSecret()
     
// ngStats Accessors
 void Done()
 void BeginState()
 void Timer()
 void FindGoodView()
 void ServerMove(float TimeStamp, vector InAccel, vector ClientLoc, bool NewbRun, bool NewbDuck, bool NewbJumpStatus, bool bFired, bool bAltFired, bool bForceFire, bool bForceAltFire, eDodgeDir DodgeMove, byte ClientRoll, int View, optional byte, optional int)
 void PlayerMove(float DeltaTime)
 void AltFire(optional float)
 void Fire(optional float)
 void ViewPlayer(string S)
 void Taunt()


State Dying Function Summary
 void EndState()
 void BeginState()
 void Timer()
 bool JointDamaged(int Damage, Pawn Instigator, vector HitLoc, vector Momentum, Name DamageType, int joint)
 void FindGoodView()
 void PlayerMove(float DeltaTime)
 void PlayerCalcView(out actor, out vector, out rotator)
     
/*
	
 void ServerMove(float TimeStamp, vector Accel, vector ClientLoc, bool NewbRun, bool NewbDuck, bool NewbJumpStatus, bool bFired, bool bAltFired, bool bForceFire, bool bForceAltFire, eDodgeDir DodgeMove, byte ClientRoll, int View, optional byte, optional int)
 void Taunt()
 void PlayChatting()
 void Use()
 void AltFire(optional float)
 void Fire(optional float)
 void ServerReStartPlayer()


State Uninterrupted Function Summary
 void AnimEnd()
 void PlayerMove(float DeltaTime)
 bool CanGotoPainState()


State Pain Function Summary
 void PlayerMove(float DeltaTime)
 bool CanGotoPainState()


State PlayerSpectating Function Summary
 void BeginState()
 void EndState()
 void PlayerMove(float DeltaTime)
 void ProcessMove(float DeltaTime, vector NewAccel, eDodgeDir DodgeMove, rotator DeltaRot)
 void Fire(optional float)
 void ChangeTeam(int N)
 void AltFire(optional float)
 void SendVoiceMessage(PlayerReplicationInfo Sender, PlayerReplicationInfo Recipient, Name messagetype, byte messageID, Name broadcasttype)
 void Suicide()


State PlayerWaiting Function Summary
 void BeginState()
 void EndState()
 void PlayerMove(float DeltaTime)
 void PlayWaiting(optional float)
 void ProcessMove(float DeltaTime, vector NewAccel, eDodgeDir DodgeMove, rotator DeltaRot)
 void AltFire(optional float)
 void Fire(optional float)
 void ChangeTeam(int N)
 void Suicide()
 void Jump(optional float)


State CheatFlying Function Summary
 void BeginState()
 void PlayerMove(float DeltaTime)
 void ProcessMove(float DeltaTime, vector NewAccel, eDodgeDir DodgeMove, rotator DeltaRot)
 void AnimEnd()


State PlayerFlying Function Summary
 void BeginState()
 void PlayerMove(float DeltaTime)
 void AnimEnd()


State PlayerSwimming Function Summary
 void BeginState()
 void Timer()
 void PlayerMove(float DeltaTime)
 void ProcessMove(float DeltaTime, vector NewAccel, eDodgeDir DodgeMove, rotator DeltaRot)
 void ZoneChange(ZoneInfo NewZone)
 void AnimEnd()
 void Landed(vector HitNormal, Actor HitActor)


State FeigningDeath Function Summary
 void BeginState()
 void EndState()
 void ChangedWeapon()
 void PlayDying(Name DamageType, vector HitLocation)
 void PlayTakeHit(float tweentime, int damage, vector HitLoc, Name damageType, vector Momentum, int BodyPart)
 void PlayerMove(float DeltaTime)
 void ServerMove(float TimeStamp, vector Accel, vector ClientLoc, bool NewbRun, bool NewbDuck, bool NewbJumpStatus, bool bFired, bool bAltFired, bool bForceFire, bool bForceAltFire, eDodgeDir DodgeMove, byte ClientRoll, int View, optional byte, optional int)
 void ProcessMove(float DeltaTime, vector NewAccel, eDodgeDir DodgeMove, rotator DeltaRot)
 void Rise()
 void AnimEnd()
 void Taunt()
 void PlayChatting()
 void AltFire(optional float)
 void Fire(optional float)
 void ZoneChange(ZoneInfo NewZone)


State EdgeHanging Function Summary
 void BeginState()
 void EndState()
 void ChangedWeapon()
 void PlayDying(Name DamageType, vector HitLocation)
 void PlayTakeHit(float tweentime, int damage, vector HitLoc, Name damageType, vector Momentum, int BodyPart)
 void PlayerMove(float DeltaTime)
 void ServerMove(float TimeStamp, vector Accel, vector ClientLoc, bool NewbRun, bool NewbDuck, bool NewbJumpStatus, bool bFired, bool bAltFired, bool bForceFire, bool bForceAltFire, eDodgeDir DodgeMove, byte ClientRoll, int View, optional byte, optional int)
 void ProcessMove(float DeltaTime, vector NewAccel, eDodgeDir DodgeMove, rotator DeltaRot)
 void Landed(vector HitNormal, Actor HitActor)
 void AnimEnd()
 void Taunt()
 void PlayChatting()
 bool CanGotoPainState()
 void ZoneChange(ZoneInfo NewZone)


State PlayerWalking Function Summary
 void EndState()
 void BeginState()
 void PlayerMove(float DeltaTime)
 void ProcessMove(float DeltaTime, vector NewAccel, eDodgeDir DodgeMove, rotator DeltaRot)
 void Dodge(eDodgeDir DodgeMove)
 void Landed(vector HitNormal, Actor HitActor)
 void AnimEnd()
 void ZoneChange(ZoneInfo NewZone)
 void FeignDeath()


State InvalidState Function Summary
 void PlayerMove(float DeltaTime)



Source Code


00001	//=============================================================================
00002	// PlayerPawn.
00003	// player controlled pawns
00004	// Note that Pawns which implement functions for the PlayerTick messages
00005	// must handle player control in these functions
00006	//=============================================================================
00007	class PlayerPawn expands Pawn
00008		config(user)
00009		native;
00010	//	nativereplication;
00011	
00012	// Player info.
00013	var const player Player;
00014	var	globalconfig string Password;	// for restarting coop savegames
00015	
00016	var	travel	  float DodgeClickTimer; // max double click interval for dodge move
00017	var(Movement) globalconfig float	DodgeClickTime;
00018	var(Movement) globalconfig float Bob;
00019	var			  float				LandBob, AppliedBob;
00020	var float bobtime;
00021	
00022	// Camera info.
00023	var int ShowFlags;
00024	var int RendMap;
00025	var int Misc1;
00026	var int Misc2;
00027	
00028	var actor ViewTarget;
00029	var vector FlashScale, FlashFog;
00030	var HUD	myHUD;
00031	var DebugHUD myDebugHUD;
00032	var ScoreBoard Scoring;
00033	var class<hud> HUDType;
00034	var class<scoreboard> ScoringType;
00035	
00036	var float DesiredFlashScale, ConstantGlowScale, InstantFlash;
00037	var vector DesiredFlashFog, ConstantGlowFog, InstantFog;
00038	var globalconfig float DesiredFOV;
00039	var globalconfig float DefaultFOV;
00040	var globalconfig float HudTranslucency;
00041	
00042	// Music info.
00043	var music Song;
00044	var byte  SongSection;
00045	var byte  CdTrack;
00046	var EMusicTransition Transition;
00047	
00048	var float shaketimer; // player uses this for shaking view
00049	var int shakemag;	// max magnitude in degrees of shaking
00050	var float shakevert; // max vertical shake magnitude
00051	var float maxshake;
00052	var float verttimer;
00053	var travel globalconfig float MyAutoAim;
00054	var(Sounds) sound JumpSound;
00055	
00056	var float AtrophyTimer;				 // RUNE:  Timer for strength atrophy
00057	var bool bBloodLust;				 // RUNE:  True if the character is bloodlusting
00058	
00059	var vector PolyColorAdjust;			 // RUNE:  Color adjust on the screen polygons
00060	var vector DesiredPolyColorAdjust;	 // RUNE:  Desired adjust (smoothly fades to this color)
00061	var bool bClientSideAlpha;			 // RUNE:  client side var for camera alpha
00062	var float ClientSideAlphaScale;		 // RUNE:  client side var for camera alpha
00063	var ERenderStyle OldStyle;			 // RUNE:  storage of style while client alpha rendering
00064	var float OldScale;					 // RUNE:  storage of alphascale while client alpha rendering
00065	
00066	var travel Weapon StowSpot[3]; // RUNE:  Stow Spots
00067	
00068	// Player control flags
00069	var bool		bAdmin;
00070	var() globalconfig bool 		bLookUpStairs;	// look up/down stairs (player)
00071	var() globalconfig bool		bSnapToLevel;	// Snap to level eyeheight when not mouselooking
00072	var() globalconfig bool		bAlwaysMouseLook;
00073	var globalconfig bool 		bKeyboardLook;	// no snapping when true
00074	var bool		bWasForward;	// used for dodge move 
00075	var bool		bWasBack;
00076	var bool		bWasLeft;
00077	var bool		bWasRight;
00078	var bool		bEdgeForward;
00079	var bool		bEdgeBack;
00080	var bool		bEdgeLeft;
00081	var bool 		bEdgeRight;
00082	var bool		bIsCrouching;
00083	var	bool		bShakeDir;			
00084	var bool		bAnimTransition;
00085	var bool		bIsTurning;
00086	var bool		bFrozen;
00087	var bool        bBadConnectionAlert;
00088	var globalconfig bool	bInvertMouse;
00089	var bool		bShowScores;
00090	var bool		bShowMenu;
00091	var bool		bSpecialMenu;
00092	var bool		bWokeUp;
00093	var bool		bPressedJump;
00094	var bool		bUpdatePosition;
00095	var bool		bDelayedCommand;
00096	var bool		bRising;
00097	var bool		bReducedVis;
00098	var bool		bCenterView;
00099	var() globalconfig bool bMaxMouseSmoothing;
00100	var bool		bMouseZeroed;
00101	var bool		bReadyToPlay;
00102	var globalconfig bool bNoFlash;
00103	var globalconfig bool bNoVoices;
00104	var globalconfig bool bMessageBeep;
00105	var bool		bZooming;
00106	var() bool		bSinglePlayer;		// this class allowed in single player
00107	var bool		bJustFired;
00108	var bool		bJustAltFired;
00109	var bool		bIsTyping;
00110	var bool		bFixedCamera;
00111	var globalconfig bool	bNeverAutoSwitch;	// if true, don't automatically switch to picked up weapon
00112	var bool		bJumpStatus;	// used in net games
00113	var	bool		bUpdating;
00114	var bool		bCheatsEnabled;
00115	var bool		bJustSpawned;		// just spawned into a level (not from a loadgame)
00116	
00117	var float		ZoomLevel;
00118	var float		LevelFadeAlpha;
00119	
00120	var class<menu> SpecialMenu;
00121	var string DelayedCommand;
00122	var globalconfig float	MouseSensitivity;
00123	
00124	var globalconfig name	WeaponPriority[20]; //weapon class priorities (9 is highest)
00125	
00126	var float SmoothMouseX, SmoothMouseY, BorrowedMouseX, BorrowedMouseY;
00127	var() globalconfig float MouseSmoothThreshold;
00128	var float MouseZeroTime;
00129	
00130	// Input axes.
00131	var input float 
00132		aBaseX, aBaseY, aBaseZ,
00133		aMouseX, aMouseY,
00134		aForward, aTurn, aStrafe, aUp, 
00135		aLookUp, aExtra4, aExtra3, aExtra2,
00136		aExtra1, aExtra0;
00137	
00138	// Move Buffering.
00139	var SavedMove SavedMoves;
00140	var SavedMove FreeMoves;
00141	var SavedMove PendingMove;
00142	var float CurrentTimeStamp,LastUpdateTime,ServerTimeStamp,TimeMargin, ClientUpdateTime;
00143	var globalconfig float MaxTimeMargin;
00144	
00145	// Progess Indicator.
00146	var string ProgressMessage[8];
00147	var color ProgressColor[8];
00148	var float ProgressTimeOut;
00149	
00150	// Localized strings
00151	var localized string QuickSaveString;
00152	var localized string NoPauseMessage;
00153	var localized string ViewingFrom;
00154	var localized string OwnCamera;
00155	var localized string FailedView;
00156	
00157	// ReplicationInfo
00158	var GameReplicationInfo GameReplicationInfo;
00159	
00160	// ngWorldStats Logging
00161	var() globalconfig string ngWorldSecret;
00162	
00163	// Remote Pawn ViewTargets
00164	var rotator TargetViewRotation; 
00165	var float TargetEyeHeight;
00166	var vector TargetWeaponViewOffset;
00167	
00168	// Demo recording view rotation
00169	var int DemoViewPitch;
00170	var int DemoViewYaw;
00171	
00172	var float LastPlaySound;
00173	
00174	replication
00175	{
00176		// Things the server should send to the client.
00177		reliable if( bNetOwner && Role==ROLE_Authority )
00178			ViewTarget, ScoringType, HUDType, GameReplicationInfo, bFixedCamera, bCheatsEnabled,
00179			DesiredPolyColorAdjust, bBloodlust;
00180		unreliable if ( bNetOwner && Role==ROLE_Authority )
00181			TargetViewRotation, TargetEyeHeight, TargetWeaponViewOffset;
00182		reliable if( bDemoRecording && Role==ROLE_Authority )
00183			DemoViewPitch, DemoViewYaw;
00184		unreliable if ( ROLE==ROLE_Authority )
00185			bIsTyping;
00186	
00187		// Things the client should send to the server
00188		reliable if ( Role<ROLE_Authority )
00189			Password, bReadyToPlay;
00190	
00191		// Functions client can call.
00192		unreliable if( Role<ROLE_Authority )
00193			CallForHelp;
00194		reliable if( Role<ROLE_Authority )
00195			ShowPath, RememberSpot, Speech, Say, TeamSay, RestartLevel, SwitchWeapon, Pause, SetPause, 
00196			PrevItem, ActivateItem, ShowInventory, Grab, ServerFeignDeath, ServerSetWeaponPriority,
00197			ChangeName, ChangeTeam, God, Suicide, ViewClass, ViewPlayerNum, ViewSelf, ViewPlayer, ServerSetSloMo, ServerAddBots,
00198			PlayersOnly, ServerRestartPlayer, NeverSwitchOnPickup, BehindView, ServerNeverSwitchOnPickup, 
00199			PrevWeapon, NextWeapon, GetWeapon, ServerReStartGame, ServerUpdateWeapons, ServerTaunt, ServerChangeSkin,
00200			SwitchLevel, SwitchCoopLevel, Kick, KickBan, KillAll, Summon, Admin, AdminLogin, AdminLogout, Typing, Mutate,
00201			Use, Throw, PowerUp, CheatPlease;
00202		unreliable if( Role<ROLE_Authority )
00203			ServerMove, Fly, Walk, Ghost;
00204	
00205		// Functions server can call.
00206		reliable if( Role==ROLE_Authority && !bDemoRecording )
00207			ClientTravel;
00208		reliable if( Role==ROLE_Authority )
00209			ClientReliablePlaySound, ClientReplicateSkins, ClientAdjustGlow, ClientChangeTeam, ClientSetMusic, StartZoom, ToggleZoom, StopZoom, EndZoom, SetDesiredFOV, ClearProgressMessages, SetProgressColor, SetProgressMessage, SetProgressTime, ClientWeaponEvent;
00210		unreliable if( Role==ROLE_Authority )
00211			SetFOVAngle, ClientShake, ClientFlash, ClientInstantFlash;
00212		unreliable if( Role==ROLE_Authority && !bDemoRecording )
00213			ClientPlaySound;
00214		unreliable if( RemoteRole==ROLE_AutonomousProxy )//***
00215			ClientAdjustPosition;
00216	}
00217	
00218	//
00219	// native client-side functions.
00220	//
00221	native event ClientTravel( string URL, ETravelType TravelType, bool bItems );
00222	native(544) final function ResetKeyboard();
00223	native(546) final function UpdateURL(string NewOption, string NewValue, bool bSaveDefault);
00224	native final function string GetDefaultURL(string Option);
00225	native final function LevelInfo GetEntryLevel();
00226	native final function string GetPlayerNetworkAddress();
00227	
00228	// Execute a console command in the context of this player, then forward to Actor.ConsoleCommand.
00229	native function string ConsoleCommand( string Command );
00230	native function CopyToClipboard( string Text );
00231	native function string PasteFromClipboard();
00232	
00233	function InitPlayerReplicationInfo()
00234	{
00235		Super.InitPlayerReplicationInfo();
00236	
00237		PlayerReplicationInfo.bAdmin = bAdmin;
00238	}
00239	
00240	event PreClientTravel()
00241	{
00242	}
00243	
00244	exec function Ping()
00245	{
00246		ClientMessage("Current ping is"@PlayerReplicationInfo.Ping);
00247	}
00248	
00249	function ClientWeaponEvent(name EventType)
00250	{
00251		if ( Weapon != None )
00252			Weapon.ClientWeaponEvent(EventType);
00253	}
00254	
00255	simulated event RenderOverlays( canvas Canvas )
00256	{
00257		if ( Weapon != None )
00258			Weapon.RenderOverlays(Canvas);
00259	
00260		if ( myHUD != None )
00261			myHUD.RenderOverlays(Canvas);
00262	}
00263	
00264	function SetClientAlpha(float alpha)
00265	{
00266		ClientSideAlphaScale = FClamp(alpha, 0.0, 1.0);
00267		bClientSideAlpha = (ClientSideAlphaScale < 1.0);
00268	}
00269	
00270	function ClientReplicateSkins(texture Skin1, optional texture Skin2, optional texture Skin3, optional texture Skin4)
00271	{
00272		// do nothing (just loading other player skins onto client)
00273		log("Getting "$Skin1$", "$Skin2$", "$Skin3$", "$Skin4);
00274		return;
00275	}
00276	
00277	function CheckBob(float DeltaTime, float Speed2D, vector Y)
00278	{
00279		local float OldBobTime;
00280	
00281		OldBobTime = BobTime;
00282		if ( Speed2D < 10 )
00283			BobTime += 0.2 * DeltaTime;
00284		else
00285			BobTime += DeltaTime * (0.3 + 0.7 * Speed2D/GroundSpeed);
00286		WalkBob = Y * 0.65 * Bob * Speed2D * sin(6 * BobTime);
00287		AppliedBob = AppliedBob * (1 - FMin(1, 16 * deltatime));
00288		if ( LandBob > 0.01 )
00289		{
00290			AppliedBob += FMin(1, 16 * deltatime) * LandBob;
00291			LandBob *= (1 - 8*Deltatime);
00292		}
00293		if ( Speed2D < 10 )
00294			WalkBob.Z = AppliedBob + Bob * 30 * sin(12 * BobTime);
00295		else
00296			WalkBob.Z = AppliedBob + Bob * Speed2D * sin(12 * BobTime);
00297	}
00298	
00299	exec function ViewPlayerNum(optional int num)
00300	{
00301		local Pawn P;
00302	
00303		if ( !PlayerReplicationInfo.bIsSpectator && !Level.Game.bTeamGame )
00304			return;
00305	
00306		if ( num >= 0 )
00307		{
00308			P = Pawn(ViewTarget);
00309			if ( (P != None) && P.bIsPlayer && (P.PlayerReplicationInfo.TeamID == num) )
00310			{
00311				ViewTarget = None;
00312				bBehindView = false;
00313				return;
00314			}
00315			for ( P=Level.PawnList; P!=None; P=P.NextPawn )
00316				if ( P.bIsPlayer && (P.PlayerReplicationInfo.Team == PlayerReplicationInfo.Team)
00317					&& !P.PlayerReplicationInfo.bIsSpectator
00318					&& (P.PlayerReplicationInfo.TeamID == num) )
00319				{
00320					if ( P != self )
00321					{
00322						ViewTarget = P;
00323						bBehindView = true;
00324					}
00325					return;
00326				}
00327			return;
00328		}
00329		if ( Role == ROLE_Authority )
00330		{
00331			ViewClass(class'Pawn', true);
00332			While ( (ViewTarget != None) 
00333					&& (!Pawn(ViewTarget).bIsPlayer || Pawn(ViewTarget).PlayerReplicationInfo.bIsSpectator) )
00334			{
00335				ViewClass(class'Pawn', true);
00336			}
00337	
00338			if ( ViewTarget != None )
00339				ClientMessage(ViewingFrom@Pawn(ViewTarget).PlayerReplicationInfo.PlayerName, 'Event', true);
00340			else
00341				ClientMessage(ViewingFrom@OwnCamera, 'Event', true);
00342		}
00343	}
00344	
00345	exec function Profile()
00346	{
00347		//TEMP for performance measurement
00348	
00349		slog("Average AI Time"@Level.AvgAITime);
00350		slog(" < 5% "$Level.AIProfile[0]);
00351		slog(" < 10% "$Level.AIProfile[1]);
00352		slog(" < 15% "$Level.AIProfile[2]);
00353		slog(" < 20% "$Level.AIProfile[3]);
00354		slog(" < 25% "$Level.AIProfile[4]);
00355		slog(" < 30% "$Level.AIProfile[5]);
00356		slog(" < 35% "$Level.AIProfile[6]);
00357		slog(" > 35% "$Level.AIProfile[7]);
00358	}
00359	
00360	// Execute an administrative console command on the server.
00361	exec function Admin( string CommandLine )
00362	{
00363		local string Result;
00364		if( bAdmin )
00365			Result = ConsoleCommand( CommandLine );
00366		if( Result!="" )
00367			ClientMessage( Result );
00368	}
00369	
00370	// Login as the administrator.
00371	exec function AdminLogin( string Password )
00372	{
00373		Level.Game.AdminLogin( Self, Password );
00374	}
00375	
00376	// Logout as the administrator.
00377	exec function AdminLogout()
00378	{
00379		Level.Game.AdminLogout( Self );
00380	}
00381	
00382	exec function SShot()
00383	{
00384		local float b;
00385		b = float(ConsoleCommand("get ini:Engine.Engine.ViewportManager Brightness"));
00386		ConsoleCommand("set ini:Engine.Engine.ViewportManager Brightness 1");
00387		ConsoleCommand("flush");
00388		ConsoleCommand("shot");
00389		ConsoleCommand("set ini:Engine.Engine.ViewportManager Brightness "$string(B));
00390		ConsoleCommand("flush");
00391	}
00392	
00393	
00394	exec function DebugContinue()
00395	{
00396		local Pawn P;
00397	
00398		if (AnimRate == 0)
00399			AnimRate = 1.0;
00400	
00401		// Players only off
00402		if (Level.bPlayersOnly)
00403			Level.bPlayersOnly = false;
00404	
00405		// Turn off Debug info
00406		if (myDebugHud != None)
00407		{
00408			myDebugHUD.SetMode(DEBUG_NONE);
00409			myDebugHUD.SetWatch(None);
00410			myDebugHUD.SaveConfig();
00411		}
00412	}
00413	
00414	exec function PlayerList()
00415	{
00416		local PlayerReplicationInfo PRI;
00417	
00418		log("Player List:");
00419		ForEach AllActors(class'PlayerReplicationInfo', PRI)
00420			log(PRI.PlayerName@"( ping"@PRI.Ping$")"@"Team="$PRI.Team);
00421	}
00422	
00423	exec function RuleList()
00424	{
00425		log("Rule List:");
00426		if (Level.Game != None)
00427			log(Level.Game.GetRules());
00428	}
00429	
00430	//=============================================================================
00431	//
00432	// Bug
00433	//
00434	// RUNE:  A convenient bug report tool that outputs a message long with the
00435	// current player location
00436	//=============================================================================
00437		
00438	exec function Bug(string Msg)
00439	{
00440		local int x, y, z;
00441	
00442		// Truncate location
00443		x = Location.X;
00444		y = Location.Y;
00445		z = Location.Z;
00446		slog("BUG REPORT: " $Msg$ " Loc: ("$x$", "$y$", "$z$")");
00447	}
00448	
00449	//=============================================================================
00450	//
00451	// Loc
00452	//
00453	// RUNE:  debugging tool.  Prints a message to the screen with the player location
00454	//=============================================================================
00455		
00456	exec function Loc()
00457	{
00458		local int x, y, z;
00459		local string LevelName;
00460	
00461		// Truncate location
00462		x = Location.X;
00463		y = Location.Y;
00464		z = Location.Z;
00465	
00466		LevelName = Left(Level, InStr(Level, "."));
00467	
00468		// This doesn't use slog, because there's no reason for this to be logged
00469		ClientMessage("Current location is ("$x$", "$y$", "$z$") on Level: "$Level.Title);
00470	}
00471	
00472	//=============================================================================
00473	//
00474	// Tele
00475	//
00476	// RUNE:  debugging tool.  Teleports the player to a given location
00477	//=============================================================================
00478	
00479	exec function Tele(vector newLoc)
00480	{
00481		if(bAdmin || (Level.Netmode == NM_Standalone))
00482			SetLocation(newLoc);
00483	}
00484	
00485	exec function ShutUp()
00486	{
00487		StopAllSound();
00488	}
00489	
00490	//
00491	// Native ClientSide Functions
00492	//
00493	event ReceiveLocalizedMessage( class<LocalMessage> Message, optional int Switch, optional PlayerReplicationInfo RelatedPRI_1, optional PlayerReplicationInfo RelatedPRI_2, optional Object OptionalObject )
00494	{
00495		Message.Static.ClientReceive( Self, Switch, RelatedPRI_1, RelatedPRI_2, OptionalObject );
00496	}
00497	
00498	event ClientMessage( coerce string S, optional Name Type, optional bool bBeep )
00499	{
00500		local Class<LocalMessage> MessageClass;
00501	
00502		if (Player == None)
00503			return;
00504	
00505		if (Type == '')
00506			Type = 'Event';
00507	
00508		if ( myHUD != None )
00509		{
00510			MessageClass = myHUD.DetermineClass(Type);
00511			MessageClass.Static.ClientReceiveMessage(Self, S, PlayerReplicationInfo);
00512		}
00513		else
00514		{
00515			if (Player.Console != None)
00516				Player.Console.Message( PlayerReplicationInfo, S, Type );
00517			if (bBeep && bMessageBeep)
00518				PlayBeepSound();
00519		}
00520	}
00521	
00522	event TeamMessage( PlayerReplicationInfo PRI, coerce string S, name Type, optional bool bBeep  )
00523	{
00524		local Class<LocalMessage> MessageClass;
00525	
00526		if (Type == '')
00527			Type = 'Event';
00528		if ( myHUD != None )
00529		{
00530			MessageClass = myHUD.DetermineClass(Type);
00531			MessageClass.Static.ClientReceiveMessage(Self, S, PRI);
00532		}
00533		else
00534		{
00535			if (Player.Console != None)
00536				Player.Console.Message( PRI, S, Type );
00537			if (bBeep && bMessageBeep)
00538				PlayBeepSound();
00539		}
00540	}
00541	
00542	function ClientVoiceMessage(PlayerReplicationInfo Sender, PlayerReplicationInfo Recipient, name messagetype, byte messageID)
00543	{
00544		local VoicePack V;
00545	
00546		if ( (Sender == None) || (Sender.voicetype == None) || (Player.Console == None) )
00547			return;
00548			
00549		V = Spawn(Sender.voicetype, self);
00550		if ( V != None )
00551			V.ClientInitialize(Sender, Recipient, messagetype, messageID);
00552	}
00553	
00554	simulated function PlayBeepSound();
00555	
00556	//
00557	// Send movement to the server.
00558	// Passes acceleration in components so it doesn't get rounded.
00559	//
00560	function ServerMove
00561	(
00562		float TimeStamp, 
00563		vector InAccel, 
00564		vector ClientLoc,
00565		bool NewbRun,
00566		bool NewbDuck,
00567		bool NewbJumpStatus, 
00568		bool bFired,
00569		bool bAltFired,
00570		bool bForceFire,
00571		bool bForceAltFire,
00572		eDodgeDir DodgeMove, 
00573		byte ClientRoll, 
00574		int View,
00575		optional byte OldTimeDelta,
00576		optional int OldAccel
00577	)
00578	{
00579		local float DeltaTime, clientErr, OldTimeStamp;
00580		local rotator DeltaRot, Rot;
00581		local vector Accel, LocDiff;
00582		local int maxPitch, ViewPitch, ViewYaw;
00583		local actor OldBase;
00584	
00585		local bool NewbPressedJump, OldbRun, OldbDuck;
00586		local eDodgeDir OldDodgeMove;
00587	
00588		// If this move is outdated, discard it.
00589		if ( CurrentTimeStamp >= TimeStamp )
00590			return;
00591	
00592		// Update bReadyToPlay for clients
00593		if ( PlayerReplicationInfo != None )
00594			PlayerReplicationInfo.bReadyToPlay = bReadyToPlay;
00595	
00596		// if OldTimeDelta corresponds to a lost packet, process it first
00597		if (  OldTimeDelta != 0 )
00598		{
00599			OldTimeStamp = TimeStamp - float(OldTimeDelta)/500 - 0.001;
00600			if ( CurrentTimeStamp < OldTimeStamp - 0.001 )
00601			{
00602				// split out components of lost move (approx)
00603				Accel.X = OldAccel >>> 23;
00604				if ( Accel.X > 127 )
00605					Accel.X = -1 * (Accel.X - 128);
00606				Accel.Y = (OldAccel >>> 15) & 255;
00607				if ( Accel.Y > 127 )
00608					Accel.Y = -1 * (Accel.Y - 128);
00609				Accel.Z = (OldAccel >>> 7) & 255;
00610				if ( Accel.Z > 127 )
00611					Accel.Z = -1 * (Accel.Z - 128);
00612				Accel *= 20;
00613				
00614				OldbRun = ( (OldAccel & 64) != 0 );
00615				OldbDuck = ( (OldAccel & 32) != 0 );
00616				NewbPressedJump = ( (OldAccel & 16) != 0 );
00617				if ( NewbPressedJump )
00618					bJumpStatus = NewbJumpStatus;
00619	
00620				switch (OldAccel & 7)
00621				{
00622					case 0:
00623						OldDodgeMove = DODGE_None;
00624						break;
00625					case 1:
00626						OldDodgeMove = DODGE_Left;
00627						break;
00628					case 2:
00629						OldDodgeMove = DODGE_Right;
00630						break;
00631					case 3:
00632						OldDodgeMove = DODGE_Forward;
00633						break;
00634					case 4:
00635						OldDodgeMove = DODGE_Back;
00636						break;
00637				}
00638				//log("Recovered move from "$OldTimeStamp$" acceleration "$Accel$" from "$OldAccel);
00639				MoveAutonomous(OldTimeStamp - CurrentTimeStamp, OldbRun, OldbDuck, NewbPressedJump, OldDodgeMove, Accel, rot(0,0,0));
00640				CurrentTimeStamp = OldTimeStamp;
00641			}
00642		}		
00643	
00644		// View components
00645		ViewPitch = View/32768;
00646		ViewYaw = 2 * (View - 32768 * ViewPitch);
00647		ViewPitch *= 2;
00648		// Make acceleration.
00649		Accel = InAccel/10;
00650	
00651		NewbPressedJump = (bJumpStatus != NewbJumpStatus);
00652		bJumpStatus = NewbJumpStatus;
00653	
00654		// handle firing and alt-firing
00655		if(bFired)
00656		{
00657			if(bForceFire && (Weapon != None) )
00658			{
00659	//RUNE			Weapon.ForceFire();
00660				Fire(0);
00661			}
00662			else if(bFire == 0)
00663			{
00664				Fire(0);
00665			}
00666			bFire = 1;
00667		}
00668		else
00669			bFire = 0;
00670	
00671	
00672		if(bAltFired)
00673		{
00674			if(bForceAltFire && (Shield != None))
00675				AltFire(0);
00676	//RUNE			Weapon.ForceAltFire();
00677			else if(bAltFire == 0)
00678				AltFire(0);
00679			bAltFire = 1;
00680		}
00681		else
00682			bAltFire = 0;
00683	
00684		// Save move parameters.
00685		DeltaTime = TimeStamp - CurrentTimeStamp;
00686		if ( ServerTimeStamp > 0 )
00687		{
00688			// allow 1% error
00689			TimeMargin += DeltaTime - 1.01 * (Level.TimeSeconds - ServerTimeStamp);
00690			if ( TimeMargin > MaxTimeMargin )
00691			{
00692				// player is too far ahead
00693				TimeMargin -= DeltaTime;
00694				if ( TimeMargin < 0.5 )
00695					MaxTimeMargin = Default.MaxTimeMargin;
00696				else
00697					MaxTimeMargin = 0.5;
00698				DeltaTime = 0;
00699			}
00700		}
00701	
00702		CurrentTimeStamp = TimeStamp;
00703		ServerTimeStamp = Level.TimeSeconds;
00704		Rot.Roll = 256 * ClientRoll;
00705		Rot.Yaw = ViewYaw;
00706		if ( (Physics == PHYS_Swimming) || (Physics == PHYS_Flying) )
00707			maxPitch = 2;
00708		else
00709			maxPitch = 1;
00710		If ( (ViewPitch > maxPitch * RotationRate.Pitch) && (ViewPitch < 65536 - maxPitch * RotationRate.Pitch) )
00711		{
00712			If (ViewPitch < 32768) 
00713				Rot.Pitch = maxPitch * RotationRate.Pitch;
00714			else
00715				Rot.Pitch = 65536 - maxPitch * RotationRate.Pitch;
00716		}
00717		else
00718			Rot.Pitch = ViewPitch;
00719		DeltaRot = (Rotation - Rot);
00720		ViewRotation.Pitch = ViewPitch;
00721		ViewRotation.Yaw = ViewYaw;
00722		ViewRotation.Roll = 0;
00723		SetRotation(Rot);
00724	
00725		OldBase = Base;
00726	
00727		// Perform actual movement.
00728		if ( (Level.Pauser == "") && (DeltaTime > 0) )
00729			MoveAutonomous(DeltaTime, NewbRun, NewbDuck, NewbPressedJump, DodgeMove, Accel, DeltaRot);
00730	
00731		// Accumulate movement error.
00732		if ( Level.TimeSeconds - LastUpdateTime > 500.0/Player.CurrentNetSpeed )
00733			ClientErr = 10000;
00734		else if ( Level.TimeSeconds - LastUpdateTime > 180.0/Player.CurrentNetSpeed )
00735		{
00736			LocDiff = Location - ClientLoc;
00737			ClientErr = LocDiff Dot LocDiff;
00738		}
00739	
00740		// If client has accumulated a noticeable positional error, correct him.
00741		if ( ClientErr > 3 )
00742		{
00743			if ( Mover(Base) != None )
00744				ClientLoc = Location - Base.Location;
00745			else
00746				ClientLoc = Location;
00747			//log("Client Error at "$TimeStamp$" is "$ClientErr$" with acceleration "$Accel$" LocDiff "$LocDiff$" Physics "$Physics);
00748			LastUpdateTime = Level.TimeSeconds;
00749			ClientAdjustPosition
00750			(
00751				TimeStamp, 
00752				GetStateName(), 
00753				Physics, 
00754				ClientLoc.X, 
00755				ClientLoc.Y, 
00756				ClientLoc.Z, 
00757				Velocity.X, 
00758				Velocity.Y, 
00759				Velocity.Z,
00760				Base
00761			);
00762		}
00763		//log("Server "$Role$" moved "$self$" stamp "$TimeStamp$" location "$Location$" Acceleration "$Acceleration$" Velocity "$Velocity);
00764	}	
00765	
00766	function ProcessMove ( float DeltaTime, vector newAccel, eDodgeDir DodgeMove, rotator DeltaRot)
00767	{
00768		Acceleration = newAccel;
00769	}
00770	
00771	final function MoveAutonomous
00772	(	
00773		float DeltaTime, 	
00774		bool NewbRun,
00775		bool NewbDuck,
00776		bool NewbPressedJump, 
00777		eDodgeDir DodgeMove, 
00778		vector newAccel, 
00779		rotator DeltaRot
00780	)
00781	{
00782		if ( NewbRun )
00783			bRun = 1;
00784		else
00785			bRun = 0;
00786	
00787		if ( NewbDuck )
00788			bDuck = 1;
00789		else
00790			bDuck = 0;
00791		bPressedJump = NewbPressedJump;
00792	
00793		HandleWalking();
00794		ProcessMove(DeltaTime, newAccel, DodgeMove, DeltaRot);	
00795		AutonomousPhysics(DeltaTime);
00796		//log("Role "$Role$" moveauto time "$100 * DeltaTime$" ("$Level.TimeDilation$")");
00797	}
00798	
00799	// ClientAdjustPosition - pass newloc and newvel in components so they don't get rounded
00800	
00801	function ClientAdjustPosition
00802	(
00803		float TimeStamp, 
00804		name newState, 
00805		EPhysics newPhysics,
00806		float NewLocX, 
00807		float NewLocY, 
00808		float NewLocZ, 
00809		float NewVelX, 
00810		float NewVelY, 
00811		float NewVelZ,
00812		Actor NewBase
00813	)
00814	{
00815		local vector OldLoc, NewLocation;
00816	
00817		if ( CurrentTimeStamp > TimeStamp )
00818			return;
00819		CurrentTimeStamp = TimeStamp;
00820	
00821		NewLocation.X = NewLocX;
00822		NewLocation.Y = NewLocY;
00823		NewLocation.Z = NewLocZ;
00824		Velocity.X = NewVelX;
00825		Velocity.Y = NewVelY;
00826		Velocity.Z = NewVelZ;
00827	
00828		SetBase(NewBase);
00829		if ( Mover(NewBase) != None )
00830			NewLocation += NewBase.Location;
00831	
00832		//log("Client "$Role$" adjust "$self$" stamp "$TimeStamp$" location "$Location);
00833		OldLoc = Location;
00834		bCanTeleport = false;
00835		SetLocation(NewLocation);
00836		bCanTeleport = true;
00837	
00838		SetPhysics(newPhysics);
00839		if ( !IsInState(newState) )
00840		{
00841	//log("CAP: GotoState("$newState$")");
00842			GotoState(newState);
00843		}
00844	
00845		bUpdatePosition = true;
00846	}
00847	
00848	function ClientUpdatePosition()
00849	{
00850		local SavedMove CurrentMove;
00851		local int realbRun, realbDuck;
00852		local bool bRealJump;
00853	
00854		local float AdjPCol, SavedRadius, TotalTime;
00855		local pawn SavedPawn, P;
00856		local vector Dist;
00857	
00858		bUpdatePosition = false;
00859		realbRun= bRun;
00860		realbDuck = bDuck;
00861		bRealJump = bPressedJump;
00862		CurrentMove = SavedMoves;
00863		bUpdating = true;
00864		while ( CurrentMove != None )
00865		{
00866			if ( CurrentMove.TimeStamp <= CurrentTimeStamp )
00867			{
00868				SavedMoves = CurrentMove.NextMove;
00869				CurrentMove.NextMove = FreeMoves;
00870				FreeMoves = CurrentMove;
00871				FreeMoves.Clear();
00872				CurrentMove = SavedMoves;
00873			}
00874			else
00875			{
00876				// adjust radius of nearby players with uncertain location
00877				if ( TotalTime > 0 )
00878					ForEach AllActors(class'Pawn', P)
00879						if ( (P != self) && (P.Velocity != vect(0,0,0)) && P.bBlockPlayers )
00880						{
00881							Dist = P.Location - Location;
00882							AdjPCol = 0.0004 * PlayerReplicationInfo.Ping * ((P.Velocity - Velocity) Dot Normal(Dist));
00883							if ( VSize(Dist) < AdjPCol + P.CollisionRadius + CollisionRadius + CurrentMove.Delta * GroundSpeed * (Normal(Velocity) Dot Normal(Dist)) )
00884							{
00885								SavedPawn = P;
00886								SavedRadius = P.CollisionRadius;
00887								Dist.Z = 0;
00888								P.SetCollisionSize(FClamp(AdjPCol + P.CollisionRadius, 0.5 * P.CollisionRadius, VSize(Dist) - CollisionRadius - P.CollisionRadius), P.CollisionHeight);
00889								break;
00890							}
00891						} 
00892				TotalTime += CurrentMove.Delta;
00893				MoveAutonomous(CurrentMove.Delta, CurrentMove.bRun, CurrentMove.bDuck, CurrentMove.bPressedJump, 
00894					CurrentMove.DodgeMove, CurrentMove.Acceleration, rot(0,0,0));
00895				CurrentMove = CurrentMove.NextMove;
00896				if ( SavedPawn != None )
00897				{
00898					SavedPawn.SetCollisionSize(SavedRadius, P.CollisionHeight);
00899					SavedPawn = None;
00900				}
00901			}
00902		}
00903		bUpdating = false;
00904		bDuck = realbDuck;
00905		bRun = realbRun;
00906		bPressedJump = bRealJump;
00907		//log("Client adjusted "$self$" stamp "$CurrentTimeStamp$" location "$Location$" dodge "$DodgeDir);
00908	}
00909	
00910	final function SavedMove GetFreeMove()
00911	{
00912		local SavedMove s;
00913	
00914		if ( FreeMoves == None )
00915			return Spawn(class'SavedMove');
00916		else
00917		{
00918			s = FreeMoves;
00919			FreeMoves = FreeMoves.NextMove;
00920			s.NextMove = None;
00921			return s;
00922		}	
00923	}
00924	
00925	function int CompressAccel(int C)
00926	{
00927		if ( C >= 0 )
00928			C = Min(C, 127);
00929		else
00930			C = Min(abs(C), 127) + 128;
00931		return C;
00932	}
00933	
00934	//
00935	// Replicate this client's desired movement to the server.
00936	//
00937	function ReplicateMove
00938	(
00939		float DeltaTime, 
00940		vector NewAccel, 
00941		eDodgeDir DodgeMove, 
00942		rotator DeltaRot
00943	)
00944	{
00945		local SavedMove NewMove, OldMove, LastMove;
00946		local byte ClientRoll;
00947		local int i;
00948		local float OldTimeDelta, TotalTime, NetMoveDelta;
00949		local int OldAccel;
00950		local vector BuildAccel, AccelNorm;
00951	
00952		local float AdjPCol, SavedRadius;
00953		local pawn SavedPawn, P;
00954		local vector Dist;
00955	
00956		// if am network client and am carrying flag - 
00957		//	make its position look good client side
00958		if ( (PlayerReplicationInfo != None) 
00959			&& (PlayerReplicationInfo.HasFlag != None) )
00960			PlayerReplicationInfo.HasFlag.FollowHolder(self);
00961	
00962		// Get a SavedMove actor to store the movement in.
00963		if ( PendingMove != None )
00964		{
00965			//add this move to the pending move
00966			PendingMove.TimeStamp = Level.TimeSeconds; 
00967			if ( VSize(NewAccel) > 3072 )
00968				NewAccel = 3072 * Normal(NewAccel);
00969			TotalTime = PendingMove.Delta + DeltaTime;
00970			PendingMove.Acceleration = (DeltaTime * NewAccel + PendingMove.Delta * PendingMove.Acceleration)/TotalTime;
00971	
00972			// Set this move's data.
00973			if ( PendingMove.DodgeMove == DODGE_None )
00974				PendingMove.DodgeMove = DodgeMove;
00975			PendingMove.bRun = (bRun > 0);
00976			PendingMove.bDuck = (bDuck > 0);
00977			PendingMove.bPressedJump = bPressedJump || PendingMove.bPressedJump;
00978			PendingMove.bFire = PendingMove.bFire || bJustFired || (bFire != 0);
00979			PendingMove.bForceFire = PendingMove.bForceFire || bJustFired;
00980			PendingMove.bAltFire = PendingMove.bAltFire || bJustAltFired || (bAltFire != 0);
00981			PendingMove.bForceAltFire = PendingMove.bForceAltFire || bJustFired;
00982			PendingMove.Delta = TotalTime;
00983		}
00984		if ( SavedMoves != None )
00985		{
00986			NewMove = SavedMoves;
00987			AccelNorm = Normal(NewAccel);
00988			while ( NewMove.NextMove != None )
00989			{
00990				// find most recent interesting move to send redundantly
00991				if ( NewMove.bPressedJump || ((NewMove.DodgeMove != Dodge_NONE) && (NewMove.DodgeMove < 5))
00992					|| ((NewMove.Acceleration != NewAccel) && ((normal(NewMove.Acceleration) Dot AccelNorm) < 0.95)) )
00993					OldMove = NewMove;
00994				NewMove = NewMove.NextMove;
00995			}
00996			if ( NewMove.bPressedJump || ((NewMove.DodgeMove != Dodge_NONE) && (NewMove.DodgeMove < 5))
00997				|| ((NewMove.Acceleration != NewAccel) && ((normal(NewMove.Acceleration) Dot AccelNorm) < 0.95)) )
00998				OldMove = NewMove;
00999		}
01000	
01001		LastMove = NewMove;
01002		NewMove = GetFreeMove();
01003		NewMove.Delta = DeltaTime;
01004		if ( VSize(NewAccel) > 3072 )
01005			NewAccel = 3072 * Normal(NewAccel);
01006		NewMove.Acceleration = NewAccel;
01007	
01008		// Set this move's data.
01009		NewMove.DodgeMove = DodgeMove;
01010		NewMove.TimeStamp = Level.TimeSeconds;
01011		NewMove.bRun = (bRun > 0);
01012		NewMove.bDuck = (bDuck > 0);
01013		NewMove.bPressedJump = bPressedJump;
01014		NewMove.bFire = (bJustFired || (bFire != 0));
01015		NewMove.bForceFire = bJustFired;
01016		NewMove.bAltFire = (bJustAltFired || (bAltFire != 0));
01017		NewMove.bForceAltFire = bJustAltFired;
01018	
01019		bJustFired = false;
01020		bJustAltFired = false;
01021		
01022		// adjust radius of nearby players with uncertain location
01023		ForEach AllActors(class'Pawn', P)
01024			if ( (P != self) && (P.Velocity != vect(0,0,0)) && P.bBlockPlayers )
01025			{
01026				Dist = P.Location - Location;
01027				AdjPCol = 0.0004 * PlayerReplicationInfo.Ping * ((P.Velocity - Velocity) Dot Normal(Dist));
01028				if ( VSize(Dist) < AdjPCol + P.CollisionRadius + CollisionRadius + NewMove.Delta * GroundSpeed * (Normal(Velocity) Dot Normal(Dist)) )
01029				{
01030					SavedPawn = P;
01031					SavedRadius = P.CollisionRadius;
01032					Dist.Z = 0;
01033					P.SetCollisionSize(FClamp(AdjPCol + P.CollisionRadius, 0.5 * P.CollisionRadius, VSize(Dist) - CollisionRadius - P.CollisionRadius), P.CollisionHeight);
01034					break;
01035				}
01036			} 
01037		// Simulate the movement locally.
01038		ProcessMove(NewMove.Delta, NewMove.Acceleration, NewMove.DodgeMove, DeltaRot);
01039		AutonomousPhysics(NewMove.Delta);
01040		if ( SavedPawn != None )
01041			SavedPawn.SetCollisionSize(SavedRadius, P.CollisionHeight);
01042	
01043		//log("Role "$Role$" repmove at "$Level.TimeSeconds$" Move time "$100 * DeltaTime$" ("$Level.TimeDilation$")");
01044	
01045		// Decide whether to hold off on move
01046		// send if dodge, jump, or fire unless really too soon, or if newmove.delta big enough
01047		// on client side, save extra buffered time in LastUpdateTime
01048		if ( PendingMove == None )
01049			PendingMove = NewMove;
01050		else
01051		{
01052			NewMove.NextMove = FreeMoves;
01053			FreeMoves = NewMove;
01054			FreeMoves.Clear();
01055			NewMove = PendingMove;
01056		}
01057		NetMoveDelta = FMax(64.0/Player.CurrentNetSpeed, 0.011);
01058		
01059		if ( !PendingMove.bForceFire && !PendingMove.bForceAltFire && !PendingMove.bPressedJump
01060			&& (PendingMove.Delta < NetMoveDelta - ClientUpdateTime) )
01061		{
01062			// save as pending move
01063			return;
01064		}
01065		else if ( (ClientUpdateTime < 0) && (PendingMove.Delta < NetMoveDelta - ClientUpdateTime) )
01066			return;
01067		else
01068		{
01069			ClientUpdateTime = PendingMove.Delta - NetMoveDelta;
01070			if ( SavedMoves == None )
01071				SavedMoves = PendingMove;
01072			else
01073				LastMove.NextMove = PendingMove;
01074			PendingMove = None;
01075		}
01076	
01077		// check if need to redundantly send previous move
01078		if ( OldMove != None )
01079		{
01080			// log("Redundant send timestamp "$OldMove.TimeStamp$" accel "$OldMove.Acceleration$" at "$Level.Timeseconds$" New accel "$NewAccel);
01081			// old move important to replicate redundantly
01082			OldTimeDelta = FMin(255, (Level.TimeSeconds - OldMove.TimeStamp) * 500);
01083			BuildAccel = 0.05 * OldMove.Acceleration + vect(0.5, 0.5, 0.5);
01084			OldAccel = (CompressAccel(BuildAccel.X) << 23) 
01085						+ (CompressAccel(BuildAccel.Y) << 15) 
01086						+ (CompressAccel(BuildAccel.Z) << 7);
01087			if ( OldMove.bRun )
01088				OldAccel += 64;
01089			if ( OldMove.bDuck )
01090				OldAccel += 32;
01091			if ( OldMove.bPressedJump )
01092				OldAccel += 16;
01093			OldAccel += OldMove.DodgeMove;
01094		}
01095		//else
01096		//	log("No redundant timestamp at "$Level.TimeSeconds$" with accel "$NewAccel);
01097	
01098		// Send to the server
01099		ClientRoll = (Rotation.Roll >> 8) & 255;
01100		if ( NewMove.bPressedJump )
01101			bJumpStatus = !bJumpStatus;
01102		ServerMove
01103		(
01104			NewMove.TimeStamp, 
01105			NewMove.Acceleration * 10, 
01106			Location, 
01107			NewMove.bRun,
01108			NewMove.bDuck,
01109			bJumpStatus, 
01110			NewMove.bFire,
01111			NewMove.bAltFire,
01112			NewMove.bForceFire,
01113			NewMove.bForceAltFire,
01114			NewMove.DodgeMove, 
01115			ClientRoll,
01116			(32767 & (ViewRotation.Pitch/2)) * 32768 + (32767 & (ViewRotation.Yaw/2)),
01117			OldTimeDelta,
01118			OldAccel 
01119		);
01120		//log("Replicated "$self$" stamp "$NewMove.TimeStamp$" location "$Location$" dodge "$NewMove.DodgeMove$" to "$DodgeDir);
01121	}
01122	
01123	function HandleWalking()
01124	{
01125	//	bIsWalking = ((bRun != 0) || (bDuck != 0)) && !Region.Zone.IsA('WarpZoneInfo'); 
01126		bIsWalking = ((bRun != 0) || bIsCrouching) && !Region.Zone.IsA('WarpZoneInfo');  // RUNE
01127	}
01128	
01129	//----------------------------------------------
01130	
01131	simulated event Destroyed()
01132	{
01133		Super.Destroyed();
01134		if ( myHud != None )
01135			myHud.Destroy();
01136		if ( Scoring != None )
01137			Scoring.Destroy();
01138	
01139		While ( FreeMoves != None )
01140		{
01141			FreeMoves.Destroy();
01142			FreeMoves = FreeMoves.NextMove;
01143		}
01144	
01145		While ( SavedMoves != None )
01146		{
01147			SavedMoves.Destroy();
01148			SavedMoves = SavedMoves.NextMove;
01149		}
01150	}
01151	
01152	function ServerReStartGame()
01153	{
01154		Level.Game.RestartGame();
01155	}
01156	
01157	function PlayHit(float Damage, vector HitLocation, name damageType, float MomentumZ)
01158	{
01159		Level.Game.SpecialDamageString = "";
01160	}
01161	
01162	function SetFOVAngle(float newFOV)
01163	{
01164		FOVAngle = newFOV;
01165	}
01166		 
01167	function ClientFlash( float scale, vector fog )
01168	{
01169		DesiredFlashScale = scale;
01170		DesiredFlashFog = 0.001 * fog;
01171	}
01172	
01173	function ClientInstantFlash( float scale, vector fog )
01174	{
01175		InstantFlash = scale;
01176		InstantFog = 0.001 * fog;
01177	}
01178	
01179	//Play a sound client side (so only client will hear it
01180	simulated function ClientPlaySound(sound ASound, optional bool bInterrupt, optional bool bVolumeControl )
01181	{	
01182		local actor SoundPlayer;
01183	
01184		LastPlaySound = Level.TimeSeconds;	// so voice messages won't overlap
01185		if ( ViewTarget != None )
01186			SoundPlayer = ViewTarget;
01187		else
01188			SoundPlayer = self;
01189	
01190		SoundPlayer.PlaySound(ASound, SLOT_None, 16.0, bInterrupt);
01191		SoundPlayer.PlaySound(ASound, SLOT_Interface, 16.0, bInterrupt);
01192		SoundPlayer.PlaySound(ASound, SLOT_Misc, 16.0, bInterrupt);
01193		SoundPlayer.PlaySound(ASound, SLOT_Talk, 16.0, bInterrupt);
01194	}
01195	
01196	simulated function ClientReliablePlaySound(sound ASound, optional bool bInterrupt, optional bool bVolumeControl )
01197	{
01198		ClientPlaySound(ASound, bInterrupt, bVolumeControl);
01199	}
01200	   
01201	function ClientAdjustGlow( float scale, vector fog )
01202	{
01203		ConstantGlowScale += scale;
01204		ConstantGlowFog += 0.001 * fog;
01205	}
01206	
01207	function ClientShake(vector shake)
01208	{
01209		if ( (shakemag < shake.X) || (shaketimer <= 0.01 * shake.Y) )
01210		{
01211			shakemag = shake.X;
01212			shaketimer = 0.01 * shake.Y;	
01213			maxshake = 0.01 * shake.Z;
01214			verttimer = 0;
01215			ShakeVert = -1.1 * maxshake;
01216		}
01217	}
01218	
01219	function ShakeView( float shaketime, float RollMag, float vertmag)
01220	{
01221		local vector shake;
01222	
01223		shake.X = RollMag;
01224		shake.Y = 100 * shaketime;
01225		shake.Z = 100 * vertmag;
01226		ClientShake(shake);
01227	}
01228	
01229	function ClientSetMusic( music NewSong, byte NewSection, byte NewCdTrack, EMusicTransition NewTransition )
01230	{
01231		Song        = NewSong;
01232		SongSection = NewSection;
01233		CdTrack     = NewCdTrack;
01234		Transition  = NewTransition;
01235	}
01236	
01237	function ServerFeignDeath()
01238	{
01239	/* RUNE:  Obsolete Unreal Weapon Code
01240		PendingWeapon = Weapon;
01241		if ( Weapon != None )
01242			Weapon.PutDown();
01243	*/
01244		GotoState('FeigningDeath');
01245	
01246	}
01247	
01248	
01249	function ServerReStartPlayer()
01250	{
01251	}
01252	
01253	function ServerChangeSkin( int SkinIndex )
01254	{
01255		if ( Level.Game.bCanChangeSkin )
01256		{
01257			CurrentSkin = SkinIndex;
01258			Self.static.SetSkinActor(Self, SkinIndex);
01259		}
01260	}
01261	
01262	//*************************************************************************************
01263	// Normal gameplay execs
01264	// Type the name of the exec function at the console to execute it
01265	
01266	exec function ShowSpecialMenu( string ClassName )
01267	{
01268		local class<menu> aMenuClass;
01269	
01270		aMenuClass = class<menu>( DynamicLoadObject( ClassName, class'Class' ) );
01271		if( aMenuClass!=None )
01272		{
01273			bSpecialMenu = true;
01274			SpecialMenu = aMenuClass;
01275			ShowMenu();
01276		}
01277	}
01278		
01279	exec function Jump( optional float F )
01280	{
01281		if ( !bShowMenu && (Level.Pauser == PlayerReplicationInfo.PlayerName) )
01282			SetPause(False);
01283		else
01284			bPressedJump = true;
01285	}
01286	
01287	
01288	// ShowTags [f] [<classname>]
01289	exec function ShowTags(optional string cmdline)
01290	{
01291		local actor a;
01292		local string tagsMsg, tempMsg1, tempMsg2;
01293		local bool tagsFilter;
01294		local class<Actor> tagsClass;
01295	
01296		if(!bAdmin && (Level.Netmode != NM_Standalone))
01297			return;
01298		tagsClass = class'Actor';
01299		tagsFilter = False;
01300		if(cmdline != "")
01301		{
01302			if(cmdline ~= "F" || Left(cmdline, 2) ~= "F ")
01303			{
01304				tagsFilter = True;
01305				cmdline = Right(cmdline, Len(cmdline)-1);
01306				while(Len(cmdline) > 0 && Asc(cmdline) < 33)
01307					cmdline = Right(cmdline, Len(cmdline)-1);
01308			}
01309			if(Len(cmdline) > 0)
01310			{
01311				tagsClass = None;
01312				foreach AllActors(class'Actor', a)
01313				{
01314					if(string(a.Class.Name) ~= cmdline)
01315					{
01316						tagsClass = a.Class;
01317						break;
01318					}
01319				}
01320				if(tagsClass == None)
01321				{
01322					slog("Class '" $ cmdline $ "' not found");
01323					return;
01324				}
01325			}
01326		}
01327		foreach AllActors(tagsClass, a)
01328		{
01329			if(a.Tag == '' || a.Tag == 'None' || string(a.Tag) ~= string(a.Class.Name))
01330				continue;
01331			if(tagsFilter)
01332				if(a.IsA('InterpolationPoint') || a.IsA('PathNode') || a.IsA('PatrolPoint'))
01333					continue;
01334			tempMsg1 = string(a.Tag) $ "(" $ string(a.Class.Name) $ ") ";
01335			tempMsg2 = tagsMsg $ tempMsg1;
01336			if (Len(tempMsg2) > 80)
01337			{
01338				slog(tagsMsg);
01339				tagsMsg = tempMsg1;
01340			}
01341			else
01342				tagsMsg = tempMsg2;
01343		}
01344		if(Len(tagsMsg) > 0)
01345			slog(tagsMsg);
01346	}
01347	
01348	exec function CauseEvent( name N )
01349	{
01350		local actor A;
01351		local int triggerCount;
01352	
01353		if( !bCheatsEnabled )
01354			return;
01355	
01356		if( (bAdmin || (Level.Netmode == NM_Standalone)) && (N != '') )
01357		{
01358			triggerCount = 0;
01359			foreach AllActors( class 'Actor', A, N )
01360			{
01361				A.Trigger( Self, Self );
01362				triggerCount++;
01363			}
01364			slog(triggerCount $ " actor(s) triggered");
01365		}
01366	}
01367	
01368	exec function Taunt()
01369	{
01370	}
01371	
01372	function ServerTaunt(name Sequence )
01373	{
01374		PlayUninterruptedAnim(Sequence);
01375	}
01376	
01377	exec function FeignDeath()
01378	{
01379	}
01380	
01381	exec function CallForHelp()
01382	{
01383		local Pawn P;
01384	
01385		if ( !Level.Game.bTeamGame || (Enemy == None) || (Enemy.Health <= 0) )
01386			return;
01387	
01388		for ( P=Level.PawnList; P!=None; P=P.NextPawn )
01389			if ( P.bIsPlayer && (P.PlayerReplicationInfo.Team == PlayerReplicationInfo.Team) )
01390				P.HandleHelpMessageFrom(self);
01391	}
01392	
01393	function damageAttitudeTo(pawn Other)
01394	{
01395		if ( Other != Self )
01396			Enemy = Other;
01397	}
01398	
01399	exec function Grab()
01400	{
01401		// was used for decoration grab/drop
01402	}
01403	
01404	// Send a voice message of a certain type to a certain player.
01405	exec function Speech( int Type, int Index, int Callsign )
01406	{
01407		local VoicePack V;
01408	
01409		V = Spawn( PlayerReplicationInfo.VoiceType, Self );
01410		if (V != None)
01411			V.PlayerSpeech( Type, Index, Callsign );
01412	}
01413	
01414	function PlayChatting();
01415	
01416	function Typing( bool bTyping )
01417	{
01418		bIsTyping = bTyping;
01419		if (bTyping)
01420		{
01421			if (Level.Game != None)
01422			{
01423				if (Level.Game.WorldLog != None)
01424					Level.Game.WorldLog.LogTypingEvent(True, Self);
01425				if (Level.Game.LocalLog != None)
01426					Level.Game.LocalLog.LogTypingEvent(True, Self);
01427			}
01428			PlayChatting();
01429		} 
01430		else 
01431		{
01432			if (Level.Game != None)
01433			{
01434				if (Level.Game.WorldLog != None)
01435					Level.Game.WorldLog.LogTypingEvent(False, Self);
01436				if (Level.Game.LocalLog != None)
01437					Level.Game.LocalLog.LogTypingEvent(False, Self);
01438			}
01439		}
01440	}
01441	
01442	// Send a message to all players.
01443	exec function Say( string Msg )
01444	{
01445		local Pawn P;
01446	
01447		if ( Level.Game.AllowsBroadcast(self, Len(Msg)) )
01448			for( P=Level.PawnList; P!=None; P=P.nextPawn )
01449				if( P.bIsPlayer || P.IsA('MessagingSpectator') )
01450					P.TeamMessage( PlayerReplicationInfo, Msg, 'Say', true );
01451		return;
01452	}
01453	
01454	exec function TeamSay( string Msg )
01455	{
01456		local Pawn P;
01457	
01458		if ( !Level.Game.bTeamGame )
01459		{
01460			Say(Msg);
01461			return;
01462		}
01463	
01464		if ( Msg ~= "Help" )
01465		{
01466			CallForHelp();
01467			return;
01468		}
01469				
01470		if ( Level.Game.AllowsBroadcast(self, Len(Msg)) )
01471			for( P=Level.PawnList; P!=None; P=P.nextPawn )
01472				if( P.bIsPlayer && (P.PlayerReplicationInfo.Team == PlayerReplicationInfo.Team) )
01473				{
01474					if ( P.IsA('PlayerPawn') )
01475						P.TeamMessage( PlayerReplicationInfo, Msg, 'TeamSay', true );
01476				}
01477	}
01478	
01479	exec function RestartLevel()
01480	{
01481		if( bAdmin || Level.Netmode==NM_Standalone )
01482			ClientTravel( "?restart", TRAVEL_Relative, false );
01483	}
01484	
01485	exec function LocalTravel( string URL )
01486	{
01487		if( bAdmin || Level.Netmode==NM_Standalone )
01488			ClientTravel( URL, TRAVEL_Relative, true );
01489	}
01490	
01491	function ToggleZoom()
01492	{
01493		if ( DefaultFOV != DesiredFOV )
01494			EndZoom();
01495		else
01496			StartZoom();
01497	}
01498		
01499	function StartZoom()
01500	{
01501		ZoomLevel = 0.0;
01502		bZooming = true;
01503	}
01504	
01505	function StopZoom()
01506	{
01507		bZooming = false;
01508	}
01509	
01510	function EndZoom()
01511	{
01512		bZooming = false;
01513		DesiredFOV = DefaultFOV;
01514	}
01515	
01516	exec function FOV(float F)
01517	{
01518		SetDesiredFOV(F);
01519	}
01520		
01521	exec function SetDesiredFOV(float F)
01522	{
01523		if( (F >= 80.0) || Level.bAllowFOV || bAdmin || (Level.Netmode==NM_Standalone) )
01524		{
01525			DefaultFOV = FClamp(F, 1, 170);
01526			DesiredFOV = DefaultFOV;
01527			SaveConfig();
01528		}
01529	}
01530	
01531	/* PrevWeapon()
01532	- switch to previous inventory group weapon
01533	*/
01534	exec function PrevWeapon()
01535	{
01536	/* RUNE:  Obsolete Unreal Weapon Code
01537	
01538		local int prevGroup;
01539		local Inventory inv;
01540		local Weapon realWeapon, w, Prev;
01541		local bool bFoundWeapon;
01542	
01543		if( bShowMenu || Level.Pauser!="" )
01544			return;
01545		if ( Weapon == None )
01546		{
01547			SwitchToBestWeapon();
01548			return;
01549		}
01550		prevGroup = 0;
01551		realWeapon = Weapon;
01552		if ( PendingWeapon != None )
01553			Weapon = PendingWeapon;
01554		PendingWeapon = None;
01555		
01556		for (inv=Inventory; inv!=None; inv=inv.Inventory)
01557		{
01558			w = Weapon(inv);
01559			if ( w != None )
01560			{
01561				if ( w.InventoryGroup == Weapon.InventoryGroup )
01562				{
01563					if ( w == Weapon )
01564					{
01565						bFoundWeapon = true;
01566						if ( Prev != None )
01567						{
01568							PendingWeapon = Prev;
01569							break;
01570						}
01571					}
01572					else if ( !bFoundWeapon )
01573						Prev = W;
01574				}
01575				else if ( (w.InventoryGroup < Weapon.InventoryGroup) 					 
01576						&& (w.InventoryGroup >= prevGroup) )
01577				{
01578					prevGroup = w.InventoryGroup;
01579					PendingWeapon = w;
01580				}
01581			}
01582		}
01583		bFoundWeapon = false;
01584		prevGroup = Weapon.InventoryGroup;
01585		if ( PendingWeapon == None )
01586			for (inv=Inventory; inv!=None; inv=inv.Inventory)
01587			{
01588				w = Weapon(inv);
01589				if ( w != None )
01590				{
01591					if ( w.InventoryGroup == Weapon.InventoryGroup )
01592					{
01593						if ( w == Weapon )
01594							bFoundWeapon = true;
01595						else if ( bFoundWeapon && (PendingWeapon == None) )
01596							PendingWeapon = W;
01597					}
01598					else if ( (w.InventoryGroup > PrevGroup) ) 
01599					{
01600						prevGroup = w.InventoryGroup;
01601						PendingWeapon = w;
01602					}
01603				}
01604			}
01605	
01606		Weapon = realWeapon;
01607		if ( PendingWeapon == None )
01608			return;
01609	
01610		if ( Weapon != PendingWeapon )
01611			Weapon.PutDown();
01612	*/
01613	}
01614	
01615	/* NextWeapon()
01616	- switch to next inventory group weapon
01617	*/
01618	exec function NextWeapon()
01619	{
01620	/* RUNE:  Obsolete Unreal Weapon Code
01621	
01622		local int nextGroup;
01623		local Inventory inv;
01624		local Weapon realWeapon, w, Prev;
01625		local bool bFoundWeapon;
01626	
01627		if( bShowMenu || Level.Pauser!="" )
01628			return;
01629		if ( Weapon == None )
01630		{
01631			SwitchToBestWeapon();
01632			return;
01633		}
01634		nextGroup = 100;
01635		realWeapon = Weapon;
01636		if ( PendingWeapon != None )
01637			Weapon = PendingWeapon;
01638		PendingWeapon = None;
01639	
01640		for (inv=Inventory; inv!=None; inv=inv.Inventory)
01641		{
01642			w = Weapon(inv);
01643			if ( w != None )
01644			{
01645				if ( w.InventoryGroup == Weapon.InventoryGroup )
01646				{
01647					if ( w == Weapon )
01648						bFoundWeapon = true;
01649					else if ( bFoundWeapon )
01650					{
01651						PendingWeapon = W;
01652						break;
01653					}
01654				}
01655				else if ( w.InventoryGroup > Weapon.InventoryGroup
01656						&& (w.InventoryGroup < nextGroup) )
01657				{
01658					nextGroup = w.InventoryGroup;
01659					PendingWeapon = w;
01660				}
01661			}
01662		}
01663	
01664		bFoundWeapon = false;
01665		nextGroup = Weapon.InventoryGroup;
01666		if ( PendingWeapon == None )
01667			for (inv=Inventory; inv!=None; inv=inv.Inventory)
01668			{
01669				w = Weapon(Inv);
01670				if ( w != None )
01671				{
01672					if ( w.InventoryGroup == Weapon.InventoryGroup )
01673					{
01674						if ( w == Weapon )
01675						{
01676							bFoundWeapon = true;
01677							if ( Prev != None )
01678								PendingWeapon = Prev;
01679						}
01680						else if ( !bFoundWeapon && (PendingWeapon == None) )
01681							Prev = W;
01682					}
01683					else if ( w.InventoryGroup < nextGroup ) 
01684					{
01685						nextGroup = w.InventoryGroup;
01686						PendingWeapon = w;
01687					}
01688				}
01689			}
01690	
01691		Weapon = realWeapon;
01692		if ( PendingWeapon == None )
01693			return;
01694	
01695		if ( Weapon != PendingWeapon )
01696			Weapon.PutDown();
01697	*/
01698	}
01699	
01700	exec function Mutate(string MutateString)
01701	{
01702		if( Level.NetMode == NM_Client )
01703			return;
01704		Level.Game.BaseMutator.Mutate(MutateString, Self);
01705	}
01706	
01707	exec function QuickSave()
01708	{
01709		if ( (Health > 0) 
01710			&& (Level.NetMode == NM_Standalone)
01711			&& !Level.Game.bDeathMatch 
01712			&& GetStateName() != 'Scripting'
01713			&& GetStateName() != 'Uninterrupted')
01714		{ // Disallow save if in multiplay, dead, or in a cinematic
01715			ClientMessage(QuickSaveString);
01716			ConsoleCommand("SaveGame 9");
01717		}
01718	}
01719	
01720	exec function QuickLoad()
01721	{
01722		if ( (Level.NetMode == NM_Standalone)
01723			&& !Level.Game.bDeathMatch )
01724			ClientTravel( "?load=9", TRAVEL_Absolute, false);
01725	}
01726	
01727	exec function Kick( string S ) 
01728	{
01729		local Pawn aPawn;
01730		if( !bAdmin )
01731			return;
01732		for( aPawn=Level.PawnList; aPawn!=None; aPawn=aPawn.NextPawn )
01733			if
01734			(	aPawn.bIsPlayer
01735				&&	aPawn.PlayerReplicationInfo.PlayerName~=S 
01736				&&	(PlayerPawn(aPawn)==None || NetConnection(PlayerPawn(aPawn).Player)!=None ) )
01737			{
01738				aPawn.Destroy();
01739				return;
01740			}
01741	}
01742	
01743	exec function KickBan( string S ) 
01744	{
01745		local Pawn aPawn;
01746		local string IP;
01747		local int j;
01748		if( !bAdmin )
01749			return;
01750		for( aPawn=Level.PawnList; aPawn!=None; aPawn=aPawn.NextPawn )
01751			if
01752			(	aPawn.bIsPlayer
01753				&&	aPawn.PlayerReplicationInfo.PlayerName~=S 
01754				&&	(PlayerPawn(aPawn)==None || NetConnection(PlayerPawn(aPawn).Player)!=None ) )
01755			{
01756				IP = PlayerPawn(aPawn).GetPlayerNetworkAddress();
01757				if(Level.Game.CheckIPPolicy(IP))
01758				{
01759					IP = Left(IP, InStr(IP, ":"));
01760					Log("Adding IP Ban for: "$IP);
01761					for(j=0;j<50;j++)
01762						if(Level.Game.IPPolicies[j] == "")
01763							break;
01764					if(j < 50)
01765						Level.Game.IPPolicies[j] = "DENY,"$IP;
01766					Level.Game.SaveConfig();
01767				}
01768				aPawn.Destroy();
01769				return;
01770			}
01771	}
01772	
01773	// Try to set the pause state; returns success indicator.
01774	function bool SetPause( BOOL bPause )
01775	{
01776		if (Level.Game == None)
01777			return false;
01778		return Level.Game.SetPause(bPause, self);
01779	}
01780	
01781	exec function SetMouseSmoothThreshold( float F )
01782	{
01783		MouseSmoothThreshold = FClamp(F, 0, 0.1);
01784		SaveConfig();
01785	}
01786	
01787	exec function SetMaxMouseSmoothing( bool B )
01788	{
01789		bMaxMouseSmoothing = B;
01790		SaveConfig();
01791	}
01792	
01793	// Try to pause the game.
01794	exec function Pause()
01795	{
01796		if ( bShowMenu )
01797			return;
01798		if( !SetPause(Level.Pauser=="") )
01799			ClientMessage(NoPauseMessage);
01800	}
01801	
01802	// Activate specific inventory item
01803	exec function ActivateInventoryItem( class InvItem )
01804	{
01805		local Inventory Inv;
01806	
01807		Inv = FindInventoryType(InvItem);
01808		if ( Inv != None )
01809			Inv.Activate();
01810	}
01811	
01812	// HUD
01813	exec function ToggleRuneHUD()
01814	{
01815		if (myHud != None)
01816			myHUD.ChangeHud(1);
01817		myHUD.SaveConfig();
01818	}
01819	
01820	exec function ChangeHud()
01821	{
01822		if( !bCheatsEnabled )
01823			return;
01824	
01825		if ( myDebugHud != None )
01826			myDebugHUD.ChangeHud(1);
01827		myDebugHUD.SaveConfig();
01828	}
01829	
01830	// Crosshair
01831	exec function ChangeCrosshair()
01832	{
01833		if( !bCheatsEnabled )
01834			return;
01835	
01836		if ( myDebugHud != None ) 
01837			myDebugHUD.ChangeCrosshair(1);
01838		myDebugHUD.SaveConfig();
01839	}
01840	
01841	
01842	event PreRender( canvas Canvas )
01843	{
01844		if (bDebug==1)
01845		{
01846			if (myDebugHUD	 != None)
01847				myDebugHUD.PreRender(Canvas);
01848			else if ( Viewport(Player) != None )
01849				myDebugHUD = spawn(class'Engine.DebugHUD', self);
01850		}
01851	
01852		if ( myHud != None )
01853			myHUD.PreRender(Canvas);
01854		else if ( (Viewport(Player) != None) && (HUDType != None) )
01855			myHUD = spawn(HUDType, self);
01856	
01857		if (bClientSideAlpha)
01858		{
01859			OldStyle = Style;
01860			OldScale = AlphaScale;
01861			Style = STY_AlphaBlend;
01862			AlphaScale = ClientSideAlphaScale;
01863		}
01864	}
01865	
01866	event PostRender( canvas Canvas )
01867	{
01868		if (bClientSideAlpha)
01869		{
01870			Style = OldStyle;
01871			AlphaScale = OldScale;
01872		}
01873	
01874		if (bDebug==1)
01875		{
01876			if ( myDebugHud != None )
01877				myDebugHud.PostRender(Canvas);
01878			else if ( Viewport(Player) != None )
01879				myDebugHud = spawn(class'Engine.DebugHUD', self);
01880		}
01881	
01882		if ( myHud != None )
01883			myHUD.PostRender(Canvas);
01884		else if ( (Viewport(Player) != None) && (HUDType != None) )
01885			myHUD = spawn(HUDType, self);
01886	
01887		// Call start event here so HUD exists (for cinematics)
01888		if(StartEvent != '')
01889		{
01890			FireEvent(StartEvent);
01891			StartEvent = '';
01892		}
01893	}
01894	
01895	//=============================================================================
01896	// Inventory-related input notifications.
01897	
01898	// Handle function keypress for F1-F10.
01899	exec function FunctionKey( byte Num )
01900	{
01901	}
01902	
01903	exec function Throw()
01904	{
01905	}
01906	
01907	exec function Use()
01908	{
01909	}
01910	
01911	exec function PowerUp()
01912	{
01913	}
01914	
01915	// The player wants to switch to weapon group numer I.
01916	exec function SwitchWeapon (byte F )
01917	{
01918	/* RUNE:  Obsolete Unreal Weapon Code
01919		local weapon newWeapon;
01920	
01921		if ( bShowMenu || Level.Pauser!="" )
01922		{
01923			if ( myHud != None )
01924				myHud.InputNumber(F);
01925			return;
01926		}
01927		if ( Inventory == None )
01928			return;
01929		if ( (Weapon != None) && (Weapon.Inventory != None) )
01930			newWeapon = Weapon.Inventory.WeaponChange(F);
01931		else
01932			newWeapon = None;	
01933		if ( newWeapon == None )
01934			newWeapon = Inventory.WeaponChange(F);
01935		if ( newWeapon == None )
01936			return;
01937	
01938		if ( Weapon == None )
01939		{
01940			PendingWeapon = newWeapon;
01941			ChangedWeapon();
01942		}
01943		else if ( (Weapon != newWeapon) && Weapon.PutDown() )
01944			PendingWeapon = newWeapon;
01945	*/
01946	}
01947	
01948	exec function GetWeapon(class<Weapon> NewWeaponClass )
01949	{
01950	/* RUNE:  Obsolete Unreal Weapon Code
01951	
01952		local Inventory Inv;
01953	
01954		if ( (Inventory == None) || (NewWeaponClass == None)
01955			|| ((Weapon != None) && (Weapon.Class == NewWeaponClass)) )
01956			return;
01957	
01958		for ( Inv=Inventory; Inv!=None; Inv=Inv.Inventory )
01959			if ( Inv.Class == NewWeaponClass )
01960			{
01961				PendingWeapon = Weapon(Inv);
01962				Weapon.PutDown();
01963				return;
01964			}
01965	*/
01966	}
01967		
01968	// The player wants to select previous item
01969	exec function PrevItem()
01970	{
01971		local Inventory Inv, LastItem;
01972	
01973		if ( bShowMenu || Level.Pauser!="" )
01974			return;
01975		if (SelectedItem==None) {
01976			SelectedItem = Inventory.SelectNext();
01977			Return;
01978		}
01979		if (SelectedItem.Inventory!=None) 
01980			for( Inv=SelectedItem.Inventory; Inv!=None; Inv=Inv.Inventory ) {
01981				if (Inv==None) Break;
01982				if (Inv.bActivatable) LastItem=Inv;
01983			}
01984		for( Inv=Inventory; Inv!=SelectedItem; Inv=Inv.Inventory ) {
01985			if (Inv==None) Break;
01986			if (Inv.bActivatable) LastItem=Inv;
01987		}
01988		if (LastItem!=None) {
01989			SelectedItem = LastItem;
01990			ClientMessage(SelectedItem.ItemName$SelectedItem.M_Selected);
01991		}
01992	}
01993	
01994	// The player wants to active selected item
01995	exec function ActivateItem()
01996	{
01997		if( bShowMenu || Level.Pauser!="" )
01998			return;
01999		if (SelectedItem!=None) 
02000			SelectedItem.Activate();
02001	}
02002	
02003	// The player wants to fire.
02004	exec function Fire( optional float F )
02005	{
02006		bJustFired = true;
02007		if( bShowMenu || (Level.Pauser!="") || (Role < ROLE_Authority) )
02008			return;
02009	
02010		if(Weapon != None)
02011			PlayFiring();
02012	
02013	/* RUNE:  Obsolete Unreal Weapon Code
02014	
02015		bJustFired = true;
02016		if( bShowMenu || (Level.Pauser!="") || (Role < ROLE_Authority) )
02017		{
02018			if( (Role < ROLE_Authority) && (Weapon!=None) )
02019				bJustFired = Weapon.ClientFire(F);
02020			if ( !bShowMenu && (Level.Pauser == PlayerReplicationInfo.PlayerName)  )
02021				SetPause(False);
02022			return;
02023		}
02024		if( Weapon!=None )
02025		{
02026			Weapon.bPointing = true;
02027			PlayFiring();
02028			Weapon.Fire(F);
02029		}
02030	*/
02031	}
02032	
02033	function PlayFiring()
02034	{
02035	}
02036	
02037	// The player wants to alternate-fire.
02038	exec function AltFire( optional float F )
02039	{
02040		bJustAltFired = true;
02041		if( bShowMenu || (Level.Pauser!="") || (Role < ROLE_Authority) )
02042			return;
02043	
02044		if(Shield != None)
02045			PlayAltFiring();
02046	
02047	/* RUNE:  Obsolete Unreal Weapon Code
02048	
02049		bJustAltFired = true;
02050		if( bShowMenu || (Level.Pauser!="") || (Role < ROLE_Authority) )
02051		{
02052			if( (Role < ROLE_Authority) && (Weapon!=None) )
02053				bJustAltFired = Weapon.ClientAltFire(F);
02054			if ( !bShowMenu && (Level.Pauser == PlayerReplicationInfo.PlayerName) )
02055				SetPause(False);
02056			return;
02057		}
02058		if( Weapon!=None )
02059		{
02060			Weapon.bPointing = true;
02061			PlayFiring();
02062			Weapon.AltFire(F);
02063		}
02064	*/
02065	}
02066	
02067	function PlayAltFiring()
02068	{
02069	}
02070	
02071	/*
02072	// The player wants to defend
02073	exec function Defend( optional float F )
02074	{
02075		if( bShowMenu || (Level.Pauser!="") || (Role < ROLE_Authority) )
02076			return;
02077	}
02078	*/
02079	
02080	
02081	//Player Jumped
02082	function DoJump( optional float F )
02083	{
02084		if ( !bIsCrouching && (Physics == PHYS_Walking) )
02085		{
02086			if ( !bUpdating )
02087				PlayOwnedSound(JumpSound, SLOT_Talk, 1.5, true, 1200, 1.0 );
02088			if ( (Level.Game != None) && (Level.Game.Difficulty > 0) )
02089				MakeNoise(0.1 * Level.Game.Difficulty);
02090			PlayInAir(0.1);
02091			if ( bCountJumps && (Role == ROLE_Authority) && (Inventory != None) )
02092				Inventory.OwnerJumped();
02093			Velocity.Z = JumpZ;
02094			if ( (Base != Level) && (Base != None) )
02095				Velocity.Z += Base.Velocity.Z; 
02096			SetPhysics(PHYS_Falling);
02097		}
02098	}
02099	
02100	exec function Suicide()
02101	{
02102		KilledBy( None );
02103	}
02104	
02105	exec function AlwaysMouseLook( Bool B )
02106	{
02107		ChangeAlwaysMouseLook(B);
02108		SaveConfig();
02109	}
02110	
02111	function ChangeAlwaysMouseLook(Bool B)
02112	{
02113		bAlwaysMouseLook = B;
02114		if ( bAlwaysMouseLook )
02115			bLookUpStairs = false;
02116	}
02117		
02118	exec function SnapView( bool B )
02119	{
02120		ChangeSnapView(B);
02121		SaveConfig();
02122	}
02123	
02124	function ChangeSnapView( bool B )
02125	{
02126		bSnapToLevel = B;
02127	}
02128		
02129	exec function StairLook( bool B )
02130	{
02131		ChangeStairLook(B);
02132		SaveConfig();
02133	}
02134	
02135	function ChangeStairLook( bool B )
02136	{
02137		bLookUpStairs = B;
02138		if ( bLookUpStairs )
02139			bAlwaysMouseLook = false;
02140	}
02141	
02142	exec function SetDodgeClickTime( float F )
02143	{
02144		ChangeDodgeClickTime(F);
02145		SaveConfig();
02146	}
02147	
02148	function ChangeDodgeClickTime( float F )
02149	{
02150		DodgeClickTime = FMin(0.3, F);
02151	}
02152	final function ReplaceText(out string Text, string Replace, string With)
02153	{
02154		local int i;
02155		local string Input;
02156			
02157		Input = Text;
02158		Text = "";
02159		i = InStr(Input, Replace);
02160		while(i != -1)
02161		{	
02162			Text = Text $ Left(Input, i) $ With;
02163			Input = Mid(Input, i + Len(Replace));	
02164			i = InStr(Input, Replace);
02165		}
02166		Text = Text $ Input;
02167	}
02168	
02169	exec function SetName( coerce string S )
02170	{
02171		if ( Len(S) > 28 )
02172			S = left(S,28);
02173		ReplaceText(S, " ", "_");
02174		ChangeName(S);
02175		UpdateURL("Name", S, true);
02176		SaveConfig();
02177	}
02178	
02179	exec function Name( coerce string S )
02180	{
02181		SetName(S);
02182	}
02183	
02184	function ChangeName( coerce string S )
02185	{
02186		Level.Game.ChangeName( self, S, false );
02187	}
02188	
02189	exec function Team( int N )
02190	{
02191		ChangeTeam(N);
02192	}
02193	
02194	function ChangeTeam( int N )
02195	{
02196		local int OldTeam;
02197		OldTeam = PlayerReplicationInfo.Team;
02198		Level.Game.ChangeTeam(self, N);
02199		if ( Level.Game.bTeamGame && (PlayerReplicationInfo.Team != OldTeam) )
02200			Died( None, '', Location );
02201	}
02202	
02203	function ClientChangeTeam( int N )
02204	{
02205		local Pawn P;
02206	
02207		if ( PlayerReplicationInfo != None )
02208			PlayerReplicationInfo.Team = N;
02209	
02210		// if listen server, this may be called for non-local players that are logging in
02211		// if so, don't update URL
02212		if ( (Level.NetMode == NM_ListenServer) && (Player == None) )
02213		{
02214			// check if any other players exist
02215			for ( P=Level.PawnList; P!=None; P=P.NextPawn )
02216				if ( P.IsA('PlayerPawn') && (ViewPort(PlayerPawn(P).Player) != None) )
02217					return;
02218		}
02219			
02220		UpdateURL("Team",string(N), true);	
02221	}
02222	exec function SetAutoAim( float F )
02223	{
02224		ChangeAutoAim(F);
02225		SaveConfig();
02226	}
02227	
02228	function ChangeAutoAim( float F )
02229	{
02230		MyAutoAim = FMax(Level.Game.AutoAim, F);
02231	}
02232	
02233	exec function PlayersOnly()
02234	{
02235		if ( Level.Netmode != NM_Standalone )
02236			return;
02237	
02238		Level.bPlayersOnly = !Level.bPlayersOnly;
02239	}
02240	
02241	exec function ViewPlayer( string S )
02242	{
02243		local pawn P;
02244	
02245		for ( P=Level.pawnList; P!=None; P= P.NextPawn )
02246			if ( P.bIsPlayer && (P.PlayerReplicationInfo.PlayerName ~= S) )
02247				break;
02248	
02249		if ( (P != None) && Level.Game.CanSpectate(self, P) )
02250		{
02251			ClientMessage(ViewingFrom@P.PlayerReplicationInfo.PlayerName, 'Event', true);
02252			if ( P == self)
02253				ViewTarget = None;
02254			else
02255				ViewTarget = P;
02256		}
02257		else
02258			ClientMessage(FailedView);
02259	
02260		bBehindView = ( ViewTarget != None );
02261		if ( bBehindView )
02262			ViewTarget.BecomeViewTarget();
02263	}
02264	
02265	exec function CheatView( class<actor> aClass )
02266	{
02267		local actor other, first;
02268		local bool bFound;
02269	
02270		if( !bCheatsEnabled )
02271			return;
02272	
02273		if( !bAdmin && Level.NetMode!=NM_Standalone )
02274			return;
02275	
02276		first = None;
02277		ForEach AllActors( aClass, other )
02278		{
02279			if ( (first == None) && (other != self) )
02280			{
02281				first = other;
02282				bFound = true;
02283			}
02284			if ( other == ViewTarget ) 
02285				first = None;
02286		}  
02287	
02288		if ( first != None )
02289		{
02290			if ( first.IsA('Pawn') && Pawn(first).bIsPlayer && (Pawn(first).PlayerReplicationInfo.PlayerName != "") )
02291				ClientMessage(ViewingFrom@Pawn(first).PlayerReplicationInfo.PlayerName, 'Event', true);
02292			else
02293				ClientMessage(ViewingFrom@first, 'Event', true);
02294			ViewTarget = first;
02295		}
02296		else
02297		{
02298			if ( bFound )
02299				ClientMessage(ViewingFrom@OwnCamera, 'Event', true);
02300			else
02301				ClientMessage(FailedView, 'Event', true);
02302			ViewTarget = None;
02303		}
02304	
02305		bBehindView = ( ViewTarget != None );
02306		if ( bBehindView )
02307			ViewTarget.BecomeViewTarget();
02308	}
02309	
02310	exec function ViewSelf()
02311	{
02312		bBehindView = false;
02313		Viewtarget = None;
02314		ClientMessage(ViewingFrom@OwnCamera, 'Event', true);
02315	}
02316	
02317	exec function ViewClass( class<actor> aClass, optional bool bQuiet )
02318	{
02319		local actor other, first;
02320		local bool bFound;
02321	
02322		if ( (Level.Game != None) && !Level.Game.bCanViewOthers )
02323			return;
02324	
02325		first = None;
02326		ForEach AllActors( aClass, other )
02327		{
02328			if ( (first == None) && (other != self)
02329				 && ( (bAdmin && Level.Game==None) || Level.Game.CanSpectate(self, other) ) )
02330			{
02331				first = other;
02332				bFound = true;
02333			}
02334			if ( other == ViewTarget ) 
02335				first = None;
02336		}  
02337	
02338		if ( first != None )
02339		{
02340			if ( !bQuiet )
02341			{
02342				if ( first.IsA('Pawn') && Pawn(first).bIsPlayer && (Pawn(first).PlayerReplicationInfo.PlayerName != "") )
02343					ClientMessage(ViewingFrom@Pawn(first).PlayerReplicationInfo.PlayerName, 'Event', true);
02344				else
02345					ClientMessage(ViewingFrom@first, 'Event', true);
02346			}
02347			ViewTarget = first;
02348		}
02349		else
02350		{
02351			if ( !bQuiet )
02352			{
02353				if ( bFound )
02354					ClientMessage(ViewingFrom@OwnCamera, 'Event', true);
02355				else
02356					ClientMessage(FailedView, 'Event', true);
02357			}
02358			ViewTarget = None;
02359		}
02360	
02361		bBehindView = ( ViewTarget != None );
02362		if ( bBehindView )
02363			ViewTarget.BecomeViewTarget();
02364	}
02365	
02366	exec function NeverSwitchOnPickup( bool B )
02367	{
02368		bNeverAutoSwitch = B;
02369		bNeverSwitchOnPickup = B;
02370		ServerNeverSwitchOnPickup(B);
02371		SaveConfig();
02372	}
02373	
02374	function ServerNeverSwitchOnPickup(bool B)
02375	{
02376		bNeverSwitchOnPickup = B;
02377	}
02378		
02379	exec function InvertMouse( bool B )
02380	{
02381		bInvertMouse = B;
02382		SaveConfig();
02383	}
02384	
02385	exec function SwitchLevel( string URL )
02386	{
02387		if( bAdmin || Level.NetMode==NM_Standalone || Level.netMode==NM_ListenServer )
02388			Level.ServerTravel( URL, false );
02389	}
02390	
02391	exec function SwitchCoopLevel( string URL )
02392	{
02393		if( bAdmin || Level.NetMode==NM_Standalone || Level.netMode==NM_ListenServer )
02394			Level.ServerTravel( URL, true );
02395	}
02396	
02397	exec function ShowScores()
02398	{
02399		bShowScores = !bShowScores;
02400	}
02401	 
02402	exec function ShowMenu()
02403	{
02404		WalkBob = vect(0,0,0);
02405		bShowMenu = true; // menu is responsible for turning this off
02406		Player.Console.GotoState('Menuing');
02407			
02408		if( Level.Netmode == NM_Standalone )
02409			SetPause(true);
02410	}
02411	
02412	exec function ShowLoadMenu()
02413	{
02414		ShowMenu();
02415	}
02416	
02417	exec function AddBots(int N)
02418	{
02419		ServerAddBots(N);
02420	}
02421	
02422	function ServerAddBots(int N)
02423	{
02424		local int i;
02425	
02426		if ( !bAdmin && (Level.Netmode != NM_Standalone) )
02427			return;
02428	
02429		if ( !Level.Game.bDeathMatch )
02430			return;
02431	
02432		for ( i=0; i<N; i++ )
02433			Level.Game.ForceAddBot();
02434	}
02435	
02436		
02437	//*************************************************************************************
02438	// Special purpose/cheat execs
02439	
02440	exec function ClearProgressMessages()
02441	{
02442		local int i;
02443	
02444		for (i=0; i<8; i++)
02445		{
02446			ProgressMessage[i] = "";
02447			ProgressColor[i].R = 255;
02448			ProgressColor[i].G = 255;
02449			ProgressColor[i].B = 255;
02450		}
02451	}
02452	
02453	exec function SetProgressMessage( string S, int Index )
02454	{
02455		if (Index < 8)
02456			ProgressMessage[Index] = S;
02457	}
02458	
02459	exec function SetProgressColor( color C, int Index )
02460	{
02461		if (Index < 8)
02462			ProgressColor[Index] = C;
02463	}
02464	
02465	exec function SetProgressTime( float T )
02466	{
02467		ProgressTimeOut = T + Level.TimeSeconds;
02468	}
02469	
02470	exec event ShowUpgradeMenu();
02471	
02472	exec function Amphibious()
02473	{
02474		if( !bCheatsEnabled )
02475			return;
02476		if ( !bAdmin && (Level.Netmode != NM_Standalone) )
02477			return;
02478		if (HeadRegion.Zone.bWaterZone)
02479			PainTime=0;
02480		UnderwaterTime = +999999.0;
02481	}
02482		
02483	exec function Fly()
02484	{
02485		if( !bCheatsEnabled )
02486			return;
02487		if ( !bAdmin && (Level.Netmode != NM_Standalone) )
02488			return;
02489			
02490		UnderWaterTime = Default.UnderWaterTime;	
02491		ClientMessage("You feel much lighter");
02492		SetCollision(true, true , true);
02493		bCollideWorld = true;
02494		GotoState('CheatFlying');
02495	}
02496	
02497	exec function SetWeaponStay( bool B)
02498	{
02499		local Weapon W;
02500	
02501		if ( !bAdmin && (Level.Netmode != NM_Standalone) )
02502			return;
02503	
02504		Level.Game.bCoopWeaponMode = B;
02505		ForEach AllActors(class'Weapon', W)
02506		{
02507			W.bWeaponStay = false;
02508			W.SetWeaponStay();
02509		}
02510	}
02511	
02512	exec function Walk()
02513	{	
02514		if ( !bAdmin && (Level.Netmode != NM_Standalone) )
02515			return;
02516		StartWalk();
02517	}
02518	
02519	function StartWalk()
02520	{
02521		UnderWaterTime = Default.UnderWaterTime;	
02522		SetCollision(true, true , true);
02523		SetPhysics(PHYS_Walking);
02524		bCollideWorld = true;
02525		if ( Region.Zone.bWaterZone && (PlayerRestartState == 'PlayerWalking') )
02526		{
02527			if (HeadRegion.Zone.bWaterZone)
02528				PainTime = UnderWaterTime;
02529			setPhysics(PHYS_Swimming);
02530			GotoState('PlayerSwimming');
02531		}
02532		else
02533			GotoState(PlayerReStartState);
02534		ClientReStart();
02535	}
02536	
02537	exec function Ghost()
02538	{
02539		if( !bCheatsEnabled )
02540			return;
02541		if ( !bAdmin && (Level.Netmode != NM_Standalone) )
02542			return;
02543		
02544		UnderWaterTime = -1.0;	
02545		ClientMessage("You feel ethereal");
02546		SetCollision(false, false, false);
02547		bCollideWorld = false;
02548		GotoState('CheatFlying');
02549	}
02550	
02551	exec function ShowInventory()
02552	{
02553		local Inventory Inv;
02554		
02555		if( Weapon!=None )
02556			log( "   Weapon: " $ Weapon.Class );
02557		for( Inv=Inventory; Inv!=None; Inv=Inv.Inventory ) 
02558			log( "Inv: "$Inv $ " state "$Inv.GetStateName());
02559		if ( SelectedItem != None )
02560			log( "Selected Item"@SelectedItem@"Charge"@SelectedItem.Charge );
02561	}
02562	
02563	
02564	exec function Invisible(bool B)
02565	{
02566		if( !bCheatsEnabled )
02567			return;
02568		if ( !bAdmin && (Level.Netmode != NM_Standalone) )
02569			return;
02570	
02571		if (B)
02572		{
02573			bHidden = true;
02574			Visibility = 0;
02575		}
02576		else
02577		{
02578			bHidden = false;
02579			Visibility = Default.Visibility;
02580		}	
02581	}
02582	
02583	exec function CheatPlease()
02584	{
02585		if(bAdmin || (Level.Netmode == NM_Standalone))
02586		{
02587			bCheatsEnabled = !bCheatsEnabled;
02588			if(bCheatsEnabled)
02589				ClientMessage("Cheats Enabled");
02590			else
02591				ClientMessage("Cheats Disabled");
02592		}
02593	}
02594		
02595	exec function God()
02596	{
02597		if( !bCheatsEnabled )
02598			return;
02599		if ( !bAdmin && (Level.Netmode != NM_Standalone) )
02600			return;
02601	
02602		if ( ReducedDamageType == 'All' )
02603		{
02604			ReducedDamageType = '';
02605			ClientMessage("God mode off");
02606			return;
02607		}
02608	
02609		ReducedDamageType = 'All'; 
02610		ClientMessage("God Mode on");
02611	}
02612	
02613	exec function BehindView( Bool B )
02614	{
02615		bBehindView = B;
02616	}
02617	
02618	exec function SetBob(float F)
02619	{
02620		UpdateBob(F);
02621		SaveConfig();
02622	}
02623	
02624	function UpdateBob(float F)
02625	{
02626		Bob = FClamp(F,0,0.032);
02627	}
02628	
02629	exec function SetSensitivity(float F)
02630	{
02631		UpdateSensitivity(F);
02632		SaveConfig();
02633	}
02634	
02635	function UpdateSensitivity(float F)
02636	{
02637		MouseSensitivity = FMax(0,F);
02638	}
02639	
02640	exec function SloMo( float T )
02641	{
02642			ServerSetSloMo(T);
02643	}
02644	
02645	function ServerSetSloMo(float T)
02646	{
02647		if ( bAdmin || (Level.Netmode == NM_Standalone) )
02648		{
02649			Level.Game.SetGameSpeed(T);
02650			Level.Game.SaveConfig(); 
02651			Level.Game.GameReplicationInfo.SaveConfig();
02652		}
02653	}
02654	
02655	exec function SetJumpZ( float F )
02656	{
02657		if( !bCheatsEnabled )
02658			return;
02659		if ( !bAdmin && (Level.Netmode != NM_Standalone) )
02660			return;
02661		JumpZ = F;
02662	}
02663	
02664	
02665	exec function SetFriction( float F )
02666	{
02667		local ZoneInfo Z;
02668		if ( !bAdmin && (Level.Netmode != NM_Standalone) )
02669			return;
02670		ForEach AllActors(class'ZoneInfo', Z)
02671			Z.ZoneGroundFriction = F;
02672	}
02673	
02674	exec function SetSpeed( float F )
02675	{
02676		if( !bCheatsEnabled )
02677			return;
02678		if ( !bAdmin && (Level.Netmode != NM_Standalone) )
02679			return;
02680		GroundSpeed = Default.GroundSpeed * f;
02681		WaterSpeed = Default.WaterSpeed * f;
02682	}
02683	
02684	exec function KillAll(class<actor> aClass)
02685	{
02686		local Actor A;
02687	
02688		if( !bCheatsEnabled )
02689			return;
02690		if ( !bAdmin && (Level.Netmode != NM_Standalone) )
02691			return;
02692		ForEach AllActors(class 'Actor', A)
02693			if ( ClassIsChildOf(A.class, aClass) )
02694				A.Destroy();
02695	}
02696	
02697	exec function KillPawns()
02698	{
02699		local Pawn P;
02700		
02701		if( !bCheatsEnabled )
02702			return;
02703		if ( !bAdmin && (Level.Netmode != NM_Standalone) )
02704			return;
02705		ForEach AllActors(class 'Pawn', P)
02706			if (PlayerPawn(P) == None)
02707				P.Destroy();
02708	}
02709	
02710	exec function Summon( string ClassName )
02711	{
02712		local class<actor> NewClass;
02713	
02714		if( !bCheatsEnabled )
02715			return;
02716		if( !bAdmin && (Level.Netmode != NM_Standalone) )
02717			return;
02718		log( "Fabricate " $ ClassName );
02719		NewClass = class<actor>( DynamicLoadObject( ClassName, class'Class' ) );
02720		if( NewClass!=None )
02721			Spawn( NewClass,,,Location + 72 * Vector(Rotation) + vect(0,0,1) * 15 );
02722	}
02723	
02724	exec function DebugCommand( string text )
02725	{
02726	//	if ( !bAdmin && (Level.Netmode != NM_Standalone) )
02727	//		return;
02728	
02729		if ( myDebugHud != None )
02730			myDebugHud.Command(text);
02731	}
02732	
02733	exec function Watch( string ClassName )
02734	{
02735	//	if ( !bAdmin && (Level.Netmode != NM_Standalone) )
02736	//		return;
02737	
02738		if ( myDebugHud != None )
02739			myDebugHud.Command("WATCH"@ClassName);
02740	}
02741	
02742	
02743	exec function ActorState( class<actor> aClass, name statename )
02744	{	// Order the closest scriptpawn to enter a state
02745		local actor A, Nearest;
02746		local float nearestdist, dist;
02747	
02748		//fixme: the exec function parser cuts the first char from 2nd parameter
02749		
02750		nearestdist = 999999999;
02751		nearest = None;
02752		foreach AllActors(aClass, A)
02753		{
02754			dist = VSize(A.Location - Location);
02755			if (dist < nearestdist)
02756			{
02757				nearestdist = dist;
02758				nearest = A;
02759			}
02760		}
02761	
02762		if (nearest != None)
02763		{
02764			slog(nearest.name@"->"@statename);
02765			nearest.GotoState(statename, '');
02766		}
02767	}
02768	
02769	exec function ShowPath()
02770	{
02771		//find next path to remembered spot
02772		local Actor node;
02773		slog("show path to: "$Destination);
02774		if (pointReachable(Destination))
02775		{
02776			slog("destination is reachable");
02777			Spawn(class 'WayBeaconDest', self, '', Destination);
02778		}
02779		else
02780		{
02781		slog("destination not reachable, trying FindPathTo");
02782			node = FindPathTo(Destination);
02783			if (node != None)
02784			{
02785				slog("found path");
02786				Spawn(class 'WayBeacon', self, '', node.location);
02787			}
02788			else
02789				slog("didn't find path");
02790		}
02791	}
02792	
02793	exec function RememberSpot()
02794	{	//remember spot
02795		Destination = Location;
02796	}
02797	
02798	//=============================================================================
02799	// Input related functions.
02800	
02801	// Postprocess the player's input.
02802	
02803	event PlayerInput( float DeltaTime )
02804	{
02805		local float SmoothTime, FOVScale, MouseScale, AbsSmoothX, AbsSmoothY, MouseTime;
02806	
02807		if ( bShowMenu && (myHud != None) ) 
02808		{
02809			if ( myHud.MainMenu != None )
02810				myHud.MainMenu.MenuTick( DeltaTime );
02811			// clear inputs
02812			bEdgeForward = false;
02813			bEdgeBack = false;
02814			bEdgeLeft = false;
02815			bEdgeRight = false;
02816			bWasForward = false;
02817			bWasBack = false;
02818			bWasLeft = false;
02819			bWasRight = false;
02820			aStrafe = 0;
02821			aTurn = 0;
02822			aForward = 0;
02823			aLookUp = 0;
02824	
02825			return;
02826		}
02827		else if ( bDelayedCommand )
02828		{
02829			bDelayedCommand = false;
02830			ConsoleCommand(DelayedCommand);
02831		}
02832					
02833		// Check for Dodge move
02834		// flag transitions
02835		bEdgeForward = (bWasForward ^^ (aBaseY > 0));
02836		bEdgeBack = (bWasBack ^^ (aBaseY < 0));
02837		bEdgeLeft = (bWasLeft ^^ (aStrafe > 0));
02838		bEdgeRight = (bWasRight ^^ (aStrafe < 0));
02839		bWasForward = (aBaseY > 0);
02840		bWasBack = (aBaseY < 0);
02841		bWasLeft = (aStrafe > 0);
02842		bWasRight = (aStrafe < 0);
02843		
02844		// Smooth and amplify mouse movement
02845		SmoothTime = FMin(0.2, 3 * DeltaTime * Level.TimeDilation);
02846		FOVScale = DesiredFOV * 0.01111; 
02847		MouseScale = MouseSensitivity * FOVScale;
02848		aMouseX *= MouseScale;
02849		aMouseY *= MouseScale;
02850	
02851	//************************************************************************
02852	
02853		//log("X "$aMouseX$" Smooth "$SmoothMouseX$" Borrowed "$BorrowedMouseX$" zero time "$(Level.TimeSeconds - MouseZeroTime)$" vs "$MouseSmoothThreshold);
02854		AbsSmoothX = SmoothMouseX;
02855		AbsSmoothY = SmoothMouseY;
02856		MouseTime = (Level.TimeSeconds - MouseZeroTime)/Level.TimeDilation;
02857		if ( bMaxMouseSmoothing && (aMouseX == 0) && (MouseTime < MouseSmoothThreshold) )
02858		{
02859			SmoothMouseX = 0.5 * (MouseSmoothThreshold - MouseTime) * AbsSmoothX/MouseSmoothThreshold;
02860			BorrowedMouseX += SmoothMouseX;
02861		}
02862		else
02863		{
02864			if ( (SmoothMouseX == 0) || (aMouseX == 0) 
02865					|| ((SmoothMouseX > 0) != (aMouseX > 0)) )
02866			{
02867				SmoothMouseX = aMouseX;
02868				BorrowedMouseX = 0;
02869			}
02870			else
02871			{
02872				SmoothMouseX = 0.5 * (SmoothMouseX + aMouseX - BorrowedMouseX);
02873				if ( (SmoothMouseX > 0) != (aMouseX > 0) )
02874				{
02875					if ( AMouseX > 0 )
02876						SmoothMouseX = 1;
02877					else
02878						SmoothMouseX = -1;
02879				} 
02880				BorrowedMouseX = SmoothMouseX - aMouseX;
02881			}
02882			AbsSmoothX = SmoothMouseX;
02883		}
02884		if ( bMaxMouseSmoothing && (aMouseY == 0) && (MouseTime < MouseSmoothThreshold) )
02885		{
02886			SmoothMouseY = 0.5 * (MouseSmoothThreshold - MouseTime) * AbsSmoothY/MouseSmoothThreshold;
02887			BorrowedMouseY += SmoothMouseY;
02888		}
02889		else
02890		{
02891			if ( (SmoothMouseY == 0) || (aMouseY == 0) 
02892					|| ((SmoothMouseY > 0) != (aMouseY > 0)) )
02893			{
02894				SmoothMouseY = aMouseY;
02895				BorrowedMouseY = 0;
02896			}
02897			else
02898			{
02899				SmoothMouseY = 0.5 * (SmoothMouseY + aMouseY - BorrowedMouseY);
02900				if ( (SmoothMouseY > 0) != (aMouseY > 0) )
02901				{
02902					if ( AMouseY > 0 )
02903						SmoothMouseY = 1;
02904					else
02905						SmoothMouseY = -1;
02906				} 
02907				BorrowedMouseY = SmoothMouseY - aMouseY;
02908			}
02909			AbsSmoothY = SmoothMouseY;
02910		}
02911		if ( (aMouseX != 0) || (aMouseY != 0) )
02912			MouseZeroTime = Level.TimeSeconds;
02913	
02914		// adjust keyboard and joystick movements
02915		aLookUp *= FOVScale;
02916		aTurn   *= FOVScale;
02917	
02918		// Remap raw x-axis movement.
02919		if( bStrafe!=0 )
02920		{
02921			// Strafe.
02922			aStrafe += aBaseX + SmoothMouseX;
02923			aBaseX   = 0;
02924		}
02925		else
02926		{
02927			// Forward.
02928			aTurn  += aBaseX * FOVScale + SmoothMouseX;
02929			aBaseX  = 0;
02930		}
02931	
02932		// Remap mouse y-axis movement.
02933		if( (bStrafe == 0) && (bAlwaysMouseLook || (bLook!=0)) )
02934		{
02935			// Look up/down.
02936			if ( bInvertMouse )
02937				aLookUp -= SmoothMouseY;
02938			else
02939				aLookUp += SmoothMouseY;
02940		}
02941		else
02942		{
02943			// Move forward/backward.
02944			aForward += SmoothMouseY;
02945		}
02946		SmoothMouseX = AbsSmoothX;
02947		SmoothMouseY = AbsSmoothY;
02948	
02949		if ( bSnapLevel != 0 )
02950		{
02951			bCenterView = true;
02952			bKeyboardLook = false;
02953		}
02954		else if (aLookUp != 0)
02955		{
02956			bCenterView = false;
02957			bKeyboardLook = true;
02958		}
02959		else if ( bSnapToLevel && !bAlwaysMouseLook )
02960		{
02961			bCenterView = true;
02962			bKeyboardLook = false;
02963		}
02964	
02965		// Remap other y-axis movement.
02966		if ( bFreeLook != 0 )
02967		{
02968			bKeyboardLook = true;
02969			aLookUp += 0.5 * aBaseY * FOVScale;
02970		}
02971		else
02972			aForward += aBaseY;
02973	
02974		aBaseY = 0;
02975	
02976		// Handle walking.
02977		HandleWalking();
02978	}
02979	
02980	//=============================================================================
02981	// functions.
02982	
02983	event UpdateEyeHeight(float DeltaTime)
02984	{
02985		local float smooth, bound;
02986		
02987	
02988		// smooth up/down stairs
02989		If( (Physics==PHYS_Walking) && !bJustLanded )
02990		{
02991			smooth = FMin(1.0, 10.0 * DeltaTime/Level.TimeDilation);
02992			EyeHeight = (EyeHeight - Location.Z + OldLocation.Z) * (1 - smooth) + ( ShakeVert + BaseEyeHeight) * smooth;
02993			bound = -0.5 * CollisionHeight;
02994			if (EyeHeight < bound)
02995				EyeHeight = bound;
02996			else
02997			{
02998				bound = CollisionHeight + FClamp((OldLocation.Z - Location.Z), 0.0, MaxStepHeight); 
02999				if ( EyeHeight > bound )
03000					EyeHeight = bound;
03001			}
03002		}
03003		else
03004		{
03005			smooth = FClamp(10.0 * DeltaTime/Level.TimeDilation, 0.35,1.0);
03006			bJustLanded = false;
03007			EyeHeight = EyeHeight * ( 1 - smooth) + (BaseEyeHeight + ShakeVert) * smooth;
03008		}
03009	
03010		// teleporters affect your FOV, so adjust it back down
03011		if ( FOVAngle != DesiredFOV )
03012		{
03013			if ( FOVAngle > DesiredFOV )
03014				FOVAngle = FOVAngle - FMax(7, 0.9 * DeltaTime * (FOVAngle - DesiredFOV)); 
03015			else 
03016				FOVAngle = FOVAngle - FMin(-7, 0.9 * DeltaTime * (FOVAngle - DesiredFOV)); 
03017			if ( Abs(FOVAngle - DesiredFOV) <= 10 )
03018				FOVAngle = DesiredFOV;
03019		}
03020	
03021		// adjust FOV for weapon zooming
03022		if ( bZooming )
03023		{	
03024			ZoomLevel += DeltaTime * 1.0;
03025			if (ZoomLevel > 0.9)
03026				ZoomLevel = 0.9;
03027			DesiredFOV = FClamp(90.0 - (ZoomLevel * 88.0), 1, 170);
03028		} 
03029	}
03030	
03031	event PlayerTimeOut()
03032	{
03033		if (Health > 0)
03034			Died(None, 'suicided', Location);
03035	}
03036	
03037	// Just changed to pendingWeapon
03038	function ChangedWeapon()
03039	{
03040		Super.ChangedWeapon();
03041	//	if ( PendingWeapon != None )
03042	//		PendingWeapon.SetHand(Handedness);
03043	}
03044	
03045	function JumpOffPawn()
03046	{
03047		Velocity += 60 * VRand();
03048		Velocity.Z = 120;
03049		SetPhysics(PHYS_Falling);
03050	}
03051	
03052	event TravelPostAccept()
03053	{
03054		if ( Health <= 0 )
03055			Health = Default.Health;
03056	}
03057	
03058	// This pawn was possessed by a player.
03059	event Possess()
03060	{
03061		if ( Level.Netmode == NM_Client )
03062		{
03063			// replicate client weapon preferences to server
03064			ServerNeverSwitchOnPickup(bNeverAutoSwitch);
03065	//		ServerSetHandedness(Handedness);
03066			UpdateWeaponPriorities();
03067		}
03068		ServerUpdateWeapons();
03069		bIsPlayer = true;
03070		DodgeClickTime = FMin(0.3, DodgeClickTime);
03071		EyeHeight = BaseEyeHeight;
03072		NetPriority = 3;
03073		StartWalk();
03074	}
03075	
03076	function UpdateWeaponPriorities()
03077	{
03078		local byte i;
03079	
03080		// send new priorities to server
03081		if ( Level.Netmode == NM_Client )
03082			for ( i=0; i<ArrayCount(WeaponPriority); i++ )
03083				ServerSetWeaponPriority(i, WeaponPriority[i]);
03084	}
03085	
03086	function ServerSetWeaponPriority(byte i, name WeaponName )
03087	{
03088		local inventory inv;
03089	
03090		WeaponPriority[i] = WeaponName;
03091	/*
03092		for ( inv=Inventory; inv!=None; inv=inv.inventory )
03093			if ( inv.class.name == WeaponName )
03094				Weapon(inv).SetSwitchPriority(self);
03095	*/
03096	}
03097	
03098	// This pawn was unpossessed by a player.
03099	event UnPossess()
03100	{
03101		log(Self$" being unpossessed");
03102		if ( myHUD != None )
03103			myHUD.Destroy();
03104		bIsPlayer = false;
03105		EyeHeight = 0.8 * CollisionHeight;
03106	}
03107	
03108	event PlayerTick( float Time )
03109	{
03110	}
03111	
03112	function BoostStrength(int amount);
03113	function StrengthDecay(float Time);
03114	
03115	//
03116	// Called immediately before gameplay begins.
03117	//
03118	event PreBeginPlay()
03119	{
03120		bIsPlayer = true;
03121		Super.PreBeginPlay();
03122	}
03123	
03124	event PostBeginPlay()
03125	{
03126		Super.PostBeginPlay();
03127		if (Level.LevelEnterText != "" )
03128			ClientMessage(Level.LevelEnterText);
03129		if ( Level.NetMode != NM_Client )
03130		{
03131			HUDType = Level.Game.HUDType;
03132			ScoringType = Level.Game.ScoreboardType;
03133			MyAutoAim = FMax(MyAutoAim, Level.Game.AutoAim);
03134		}
03135		bIsPlayer = true;
03136		DodgeClickTime = FMin(0.3, DodgeClickTime);
03137		DesiredFOV = DefaultFOV;
03138		EyeHeight = BaseEyeHeight;
03139	}
03140	
03141	function ServerUpdateWeapons()
03142	{
03143	/* RUNE:  Obsolete Unreal Weapon Code
03144	
03145		local inventory Inv;
03146	
03147		For ( Inv=Inventory; Inv!=None; Inv=Inv.Inventory )
03148			if ( Inv.IsA('Weapon') )
03149				Weapon(Inv).SetSwitchPriority(self); 
03150	
03151	*/
03152	}
03153	
03154	//=============================================================================
03155	// Animation playing - should be implemented in subclass, 
03156	//
03157	
03158	function PlayDodge(eDodgeDir DodgeMove)
03159	{
03160		PlayDuck();
03161	}
03162	
03163	function PlayTurning(optional float tween);
03164	
03165	function PlaySwimming()
03166	{
03167		PlayMoving();
03168	}
03169	
03170	function TweenToSwimming(float tween);
03171	function PlayFeignDeath();
03172	function PlayRising();
03173	
03174	
03175	/* AdjustAim()
03176	Calls this version for player aiming help.
03177	Aimerror not used in this version.
03178	Only adjusts aiming at pawns
03179	*/
03180	
03181	function rotator AdjustAim(float projSpeed, vector projStart, int aimerror, bool bLeadTarget, bool bWarnTarget)
03182	{
03183		local vector FireDir, AimSpot, HitNormal, HitLocation;
03184		local actor BestTarget;
03185		local float bestAim, bestDist;
03186		local actor HitActor;
03187		
03188		FireDir = vector(ViewRotation);
03189		HitActor = Trace(HitLocation, HitNormal, projStart + 4000 * FireDir, projStart, true);
03190		if ( (HitActor != None) && HitActor.bProjTarget )
03191		{
03192			if ( bWarnTarget && HitActor.IsA('Pawn') )
03193				Pawn(HitActor).WarnTarget(self, projSpeed, FireDir);
03194			return ViewRotation;
03195		}
03196	
03197		bestAim = FMin(0.93, MyAutoAim);
03198		BestTarget = PickTarget(bestAim, bestDist, FireDir, projStart);
03199	
03200		if ( bWarnTarget && (Pawn(BestTarget) != None) )
03201			Pawn(BestTarget).WarnTarget(self, projSpeed, FireDir);	
03202	
03203		if ( (Level.NetMode != NM_Standalone) || (Level.Game.Difficulty > 2) 
03204			|| bAlwaysMouseLook || ((BestTarget != None) && (bestAim < MyAutoAim)) || (MyAutoAim >= 1) )
03205			return ViewRotation;
03206		
03207		if ( BestTarget == None )
03208		{
03209			bestAim = MyAutoAim;
03210			BestTarget = PickAnyTarget(bestAim, bestDist, FireDir, projStart);
03211			if ( BestTarget == None )
03212				return ViewRotation;
03213		}
03214	
03215		AimSpot = projStart + FireDir * bestDist;
03216		AimSpot.Z = BestTarget.Location.Z + 0.3 * BestTarget.CollisionHeight;
03217	
03218		return rotator(AimSpot - projStart);
03219	}
03220	
03221	/* 
03222	function Falling()
03223	{
03224		//SetPhysics(PHYS_Falling); //Note - physics changes type to PHYS_Falling by default
03225		//log(class$" Falling");
03226		PlayInAir(0.1);
03227	}
03228	*/
03229	
03230	function Died(pawn Killer, name damageType, vector HitLocation)
03231	{
03232		StopZoom();
03233	
03234		// RUNE:  Fire an event that is zone-specific when the player dies
03235		if(Region.Zone.ZonePlayerDiedEvent != '')
03236			FireEvent(Region.Zone.ZonePlayerDiedEvent);
03237	
03238		Super.Died(Killer, damageType, HitLocation);	
03239	}
03240	
03241	function eAttitude AttitudeTo(Pawn Other)
03242	{
03243		if (Other.bIsPlayer)
03244			return AttitudeToPlayer;
03245		else 
03246			return Other.AttitudeToPlayer;
03247	}
03248	
03249	
03250	function string KillMessage( name damageType, pawn Other )
03251	{
03252		return ( Level.Game.PlayerKillMessage(damageType, Other.PlayerReplicationInfo)$PlayerReplicationInfo.PlayerName );
03253	}
03254		
03255	//=============================================================================
03256	// Player Control
03257	
03258	function KilledBy( pawn EventInstigator )
03259	{
03260		Health = 0;
03261		Died( EventInstigator, 'suicided', Location );
03262	}
03263	
03264	// Player view.
03265	// Compute the rendering viewpoint for the player.
03266	//
03267	
03268	function CalcBehindView(out vector CameraLocation, out rotator CameraRotation, float Dist)
03269	{
03270		local vector View,HitLocation,HitNormal;
03271		local float ViewDist;
03272	
03273		CameraRotation = ViewRotation;
03274		View = vect(1,0,0) >> CameraRotation;
03275		if( Trace( HitLocation, HitNormal, CameraLocation - (Dist + 30) * vector(CameraRotation), CameraLocation ) != None )
03276			ViewDist = FMin( (CameraLocation - HitLocation) Dot View, Dist );
03277		else
03278			ViewDist = Dist;
03279		CameraLocation -= (ViewDist - 30) * View; 
03280	}
03281	
03282	event PlayerCalcView(out actor ViewActor, out vector CameraLocation, out rotator CameraRotation )
03283	{
03284		local Pawn PTarget;
03285	
03286		if ( ViewTarget != None )
03287		{
03288			ViewActor = ViewTarget;
03289			CameraLocation = ViewTarget.Location;
03290			CameraRotation = ViewTarget.Rotation;
03291			PTarget = Pawn(ViewTarget);
03292			if ( PTarget != None )
03293			{
03294				if ( Level.NetMode == NM_Client )
03295				{
03296					if ( PTarget.bIsPlayer )
03297						PTarget.ViewRotation = TargetViewRotation;
03298					PTarget.EyeHeight = TargetEyeHeight;
03299	/* RUNE:  Obsolete Unreal Weapon Code
03300					if ( PTarget.Weapon != None )
03301						PTarget.Weapon.PlayerViewOffset = TargetWeaponViewOffset;
03302	*/
03303				}
03304				if ( PTarget.bIsPlayer )
03305					CameraRotation = PTarget.ViewRotation;
03306				if ( !bBehindView )
03307					CameraLocation.Z += PTarget.EyeHeight;
03308			}
03309			if ( bBehindView )
03310				CalcBehindView(CameraLocation, CameraRotation, 180);
03311			return;
03312		}
03313	
03314		ViewActor = Self;
03315		CameraLocation = Location;
03316	
03317		if( bBehindView ) //up and behind
03318			CalcBehindView(CameraLocation, CameraRotation, 150);
03319		else
03320		{
03321			// First-person view.
03322			CameraRotation = ViewRotation;
03323			CameraLocation.Z += EyeHeight;
03324			CameraLocation += WalkBob;
03325		}
03326	}
03327	
03328	exec function SetViewFlash(bool B)
03329	{
03330		bNoFlash = !B;
03331	}
03332	
03333	function ViewFlash(float DeltaTime)
03334	{
03335		local vector goalFog;
03336		local float goalscale, delta;
03337	
03338		if ( bNoFlash )
03339		{
03340			InstantFlash = 0;
03341			InstantFog = vect(0,0,0);
03342			FlashFog = vect(0,0,0);
03343			FlashScale = vect(1,1,1);
03344			return;
03345		}
03346	
03347	
03348		delta = FMin(0.1, DeltaTime);
03349		goalScale = 1 + DesiredFlashScale + ConstantGlowScale + HeadRegion.Zone.ViewFlash.X; 
03350		goalFog = DesiredFlashFog + ConstantGlowFog + HeadRegion.Zone.ViewFog;
03351		DesiredFlashScale -= DesiredFlashScale * 2 * delta;  
03352		DesiredFlashFog -= DesiredFlashFog * 2 * delta;
03353		FlashScale.X += (goalScale - FlashScale.X + InstantFlash) * 10 * delta;
03354		FlashFog += (goalFog - FlashFog + InstantFog) * 10 * delta;
03355		InstantFlash = 0;
03356		InstantFog = vect(0,0,0);
03357	
03358		if ( FlashScale.X > 0.981 )
03359			FlashScale.X = 1;
03360		FlashScale = FlashScale.X * vect(1,1,1);
03361	
03362		if ( FlashFog.X < 0.019 )
03363			FlashFog.X = 0;
03364		if ( FlashFog.Y < 0.019 )
03365			FlashFog.Y = 0;
03366		if ( FlashFog.Z < 0.019 )
03367			FlashFog.Z = 0;
03368	}
03369	
03370	// NOTE:  This function is overridden in RunePlayer
03371	function ViewShake(float DeltaTime)
03372	{
03373		local float delta;
03374	
03375		if (shaketimer > 0.0) //shake view
03376		{
03377			shaketimer -= DeltaTime;
03378			if ( verttimer == 0 )
03379			{
03380				verttimer = 0.1;
03381				ShakeVert = -1.1 * maxshake;
03382			}
03383			else
03384			{
03385				verttimer -= DeltaTime;
03386				if ( verttimer < 0 )
03387				{
03388					verttimer = 0.2 * FRand();
03389					shakeVert = (2 * FRand() - 1) * maxshake;  
03390				}
03391			}
03392			ViewRotation.Roll = ViewRotation.Roll & 65535;
03393			if (bShakeDir)
03394			{
03395				ViewRotation.Roll += Int( 10 * shakemag * FMin(0.1, DeltaTime));
03396				bShakeDir = (ViewRotation.Roll > 32768) || (ViewRotation.Roll < (0.5 + FRand()) * shakemag);
03397				if ( (ViewRotation.Roll < 32768) && (ViewRotation.Roll > 1.3 * shakemag) )
03398				{
03399					ViewRotation.Roll = 1.3 * shakemag;
03400					bShakeDir = false;
03401				}
03402				else if (FRand() < 3 * DeltaTime)
03403					bShakeDir = !bShakeDir;
03404			}
03405			else
03406			{
03407				ViewRotation.Roll -= Int( 10 * shakemag * FMin(0.1, DeltaTime));
03408				bShakeDir = (ViewRotation.Roll > 32768) && (ViewRotation.Roll < 65535 - (0.5 + FRand()) * shakemag);
03409				if ( (ViewRotation.Roll > 32768) && (ViewRotation.Roll < 65535 - 1.3 * shakemag) )
03410				{
03411					ViewRotation.Roll = 65535 - 1.3 * shakemag;
03412					bShakeDir = true;
03413				}
03414				else if (FRand() < 3 * DeltaTime)
03415					bShakeDir = !bShakeDir;
03416			}
03417		}
03418		else
03419		{
03420			ShakeVert = 0;
03421			ViewRotation.Roll = ViewRotation.Roll & 65535;
03422			if (ViewRotation.Roll < 32768)
03423			{
03424				if ( ViewRotation.Roll > 0 )
03425					ViewRotation.Roll = Max(0, ViewRotation.Roll - (Max(ViewRotation.Roll,500) * 10 * FMin(0.1,DeltaTime)));
03426			}
03427			else
03428			{
03429				ViewRotation.Roll += ((65536 - Max(500,ViewRotation.Roll)) * 10 * FMin(0.1,DeltaTime));
03430				if ( ViewRotation.Roll > 65534 )
03431					ViewRotation.Roll = 0;
03432			}
03433		} 
03434	}
03435	
03436	function UpdateRotation(float DeltaTime, float maxPitch)
03437	{
03438		local rotator newRotation;
03439		
03440		DesiredRotation = ViewRotation; //save old rotation
03441		ViewRotation.Pitch += 32.0 * DeltaTime * aLookUp;
03442		ViewRotation.Pitch = ViewRotation.Pitch & 65535;
03443		If ((ViewRotation.Pitch > 18000) && (ViewRotation.Pitch < 49152))
03444		{
03445			If (aLookUp > 0) 
03446				ViewRotation.Pitch = 18000;
03447			else
03448				ViewRotation.Pitch = 49152;
03449		}
03450		ViewRotation.Yaw += 32.0 * DeltaTime * aTurn;
03451	//	ViewShake(deltaTime); // RUNE:  ViewShake is handled in the Camera code
03452		ViewFlash(deltaTime);
03453			
03454		newRotation = Rotation;
03455		newRotation.Yaw = ViewRotation.Yaw;
03456		newRotation.Pitch = ViewRotation.Pitch;
03457		If ( (newRotation.Pitch > maxPitch * RotationRate.Pitch) && (newRotation.Pitch < 65536 - maxPitch * RotationRate.Pitch) )
03458		{
03459			If (ViewRotation.Pitch < 32768) 
03460				newRotation.Pitch = maxPitch * RotationRate.Pitch;
03461			else
03462				newRotation.Pitch = 65536 - maxPitch * RotationRate.Pitch;
03463		}
03464		setRotation(newRotation);
03465	}
03466	
03467	function SwimAnimUpdate(bool bNotForward)
03468	{
03469		if ( !bAnimTransition && (GetAnimGroup(AnimSequence) != 'Gesture') )
03470		{
03471			if ( bNotForward )
03472		 	{
03473			 	 if ( GetAnimGroup(AnimSequence) != 'Waiting' )
03474					TweenToWaiting(0.1);
03475			}
03476			else if ( GetAnimGroup(AnimSequence) == 'Waiting' )
03477				TweenToSwimming(0.1);
03478		}
03479	}
03480	
03481	auto state InvalidState
03482	{
03483		event PlayerTick( float DeltaTime )
03484		{
03485			log(self$" invalid state");
03486			if ( bUpdatePosition )
03487				ClientUpdatePosition();
03488	
03489			PlayerMove(DeltaTime);
03490		}
03491	
03492		function PlayerMove( float DeltaTime )
03493		{
03494			if ( Role < ROLE_Authority ) // then save this move and replicate it
03495				ReplicateMove(DeltaTime, vect(0,0,0), Dodge_None, rot(0,0,0));
03496		}
03497	}
03498	
03499	// Player movement.
03500	// Player Standing, walking, running, falling.
03501	state PlayerWalking
03502	{
03503	ignores SeePlayer, HearNoise, Bump;
03504	
03505		exec function FeignDeath()
03506		{
03507			if ( Physics == PHYS_Walking )
03508			{
03509				ServerFeignDeath();
03510				Acceleration = vect(0,0,0);
03511				GotoState('FeigningDeath');
03512			}
03513		}
03514	
03515		function ZoneChange( ZoneInfo NewZone )
03516		{
03517			if (NewZone.bWaterZone)
03518			{
03519				setPhysics(PHYS_Swimming);
03520				GotoState('PlayerSwimming');
03521			}
03522		}
03523	
03524		function AnimEnd()
03525		{
03526			local name MyAnimGroup;
03527	
03528			bAnimTransition = false;
03529			if (Physics == PHYS_Walking)
03530			{
03531				if (bIsCrouching)
03532				{
03533					if ( !bIsTurning && ((Velocity.X * Velocity.X + Velocity.Y * Velocity.Y) < 1000) )
03534						PlayDuck();	
03535					else
03536						PlayCrawling();
03537				}
03538				else
03539				{
03540					MyAnimGroup = GetAnimGroup(AnimSequence);
03541					if ((Velocity.X * Velocity.X + Velocity.Y * Velocity.Y) < 1000)
03542					{
03543						if ( MyAnimGroup == 'Waiting' )
03544							PlayWaiting();
03545						else
03546						{
03547							bAnimTransition = true;
03548							TweenToWaiting(0.2);
03549						}
03550					}	
03551					else
03552					{
03553						if ( (MyAnimGroup == 'Waiting') || (MyAnimGroup == 'Landing') || (MyAnimGroup == 'Gesture') || (MyAnimGroup == 'TakeHit')  )
03554						{
03555							TweenToMoving(0.1);
03556							bAnimTransition = true;
03557						}
03558						else 
03559							PlayMoving();
03560					}
03561				}
03562			}
03563		}
03564	
03565		function Landed(vector HitNormal, actor HitActor)
03566		{
03567			Super.Landed(HitNormal, HitActor);
03568	
03569			if (Velocity.Z < -1.4 * JumpZ)
03570				ShakeView(0.175 - 0.00007 * Velocity.Z, -0.85 * Velocity.Z, -0.002 * Velocity.Z);
03571	
03572			if (DodgeDir == DODGE_Active)
03573			{
03574				DodgeDir = DODGE_Done;
03575				DodgeClickTimer = 0.0;
03576				Velocity *= 0.1;
03577			}
03578			else
03579				DodgeDir = DODGE_None;
03580		}
03581	
03582		function Dodge(eDodgeDir DodgeMove)
03583		{
03584			local vector X,Y,Z;
03585	
03586			if ( bIsCrouching || (Physics != PHYS_Walking) )
03587				return;
03588	
03589			GetAxes(Rotation,X,Y,Z);
03590			if (DodgeMove == DODGE_Forward)
03591				Velocity = 1.3*GroundSpeed*X + (Velocity Dot Y)*Y;
03592			else if (DodgeMove == DODGE_Back)
03593				Velocity = -1.3*GroundSpeed*X + (Velocity Dot Y)*Y; 
03594			else if (DodgeMove == DODGE_Left)
03595				Velocity = 1.3*GroundSpeed*Y + (Velocity Dot X)*X; 
03596			else if (DodgeMove == DODGE_Right)
03597				Velocity = -1.3*GroundSpeed*Y + (Velocity Dot X)*X; 
03598	
03599			Velocity.Z = 180;
03600			PlayOwnedSound(JumpSound, SLOT_Talk, 1.0, true, 800, 1.0 );
03601			PlayDodge(DodgeMove);
03602			DodgeDir = DODGE_Active;
03603			SetPhysics(PHYS_Falling);
03604		}
03605		
03606		function ProcessMove(float DeltaTime, vector NewAccel, eDodgeDir DodgeMove, rotator DeltaRot)	
03607		{
03608			local vector OldAccel;
03609	
03610			OldAccel = Acceleration;
03611			Acceleration = NewAccel;
03612			bIsTurning = ( Abs(DeltaRot.Yaw/DeltaTime) > 5000 );
03613			if ( (DodgeMove == DODGE_Active) && (Physics == PHYS_Falling) )
03614				DodgeDir = DODGE_Active;	
03615			else if ( (DodgeMove != DODGE_None) && (DodgeMove < DODGE_Active) )
03616				Dodge(DodgeMove);
03617	
03618			if ( bPressedJump )
03619				DoJump();
03620			if ( (Physics == PHYS_Walking) && (GetAnimGroup(AnimSequence) != 'Dodge') )
03621			{
03622				if (!bIsCrouching)
03623				{
03624					if (bDuck != 0)
03625					{
03626						bIsCrouching = true;
03627						PlayDuck();
03628					}
03629				}
03630				else if (bDuck == 0)
03631				{
03632					OldAccel = vect(0,0,0);
03633					bIsCrouching = false;
03634					TweenToMoving(0.1);
03635	//				TweenToRunning(0.1);
03636				}
03637	
03638				if ( !bIsCrouching )
03639				{
03640					if ( (!bAnimTransition || (AnimFrame > 0)) && (GetAnimGroup(AnimSequence) != 'Landing') )
03641					{
03642						if ( Acceleration != vect(0,0,0) )
03643						{
03644							if ( (GetAnimGroup(AnimSequence) == 'Waiting') || (GetAnimGroup(AnimSequence) == 'Gesture') || (GetAnimGroup(AnimSequence) == 'TakeHit') )
03645							{
03646								bAnimTransition = true;
03647								TweenToMoving(0.1);
03648							}
03649						}
03650				 		else if ( (Velocity.X * Velocity.X + Velocity.Y * Velocity.Y < 1000) 
03651							&& (GetAnimGroup(AnimSequence) != 'Gesture') ) 
03652				 		{
03653				 			if ( GetAnimGroup(AnimSequence) == 'Waiting' )
03654				 			{
03655								if ( bIsTurning && (AnimFrame >= 0) ) 
03656								{
03657									bAnimTransition = true;
03658									PlayTurning();
03659								}
03660							}
03661				 			else if ( !bIsTurning ) 
03662							{
03663								bAnimTransition = true;
03664								TweenToWaiting(0.2);
03665							}
03666						}
03667					}
03668				}
03669				else
03670				{
03671					if ( (OldAccel == vect(0,0,0)) && (Acceleration != vect(0,0,0)) )
03672						PlayCrawling();
03673				 	else if ( !bIsTurning && (Acceleration == vect(0,0,0)) && (AnimFrame > 0.1) )
03674						PlayDuck();
03675				}
03676			}
03677		}
03678				
03679		event PlayerTick( float DeltaTime )
03680		{
03681			if ( bUpdatePosition )
03682				ClientUpdatePosition();
03683	
03684			PlayerMove(DeltaTime);
03685		}
03686	
03687		function PlayerMove( float DeltaTime )
03688		{
03689			local vector X,Y,Z, NewAccel;
03690			local EDodgeDir OldDodge;
03691			local eDodgeDir DodgeMove;
03692			local rotator OldRotation;
03693			local float Speed2D;
03694			local bool	bSaveJump;
03695			local name AnimGroupName;
03696	
03697			GetAxes(Rotation,X,Y,Z);
03698	
03699			aForward *= 0.4;
03700			aStrafe  *= 0.4;
03701			aLookup  *= 0.24;
03702			aTurn    *= 0.24;
03703	
03704			// Update acceleration.
03705			NewAccel = aForward*X + aStrafe*Y; 
03706			NewAccel.Z = 0;
03707			// Check for Dodge move
03708			if ( DodgeDir == DODGE_Active )
03709				DodgeMove = DODGE_Active;
03710			else
03711				DodgeMove = DODGE_None;
03712			if (DodgeClickTime > 0.0)
03713			{
03714				if ( DodgeDir < DODGE_Active )
03715				{
03716					OldDodge = DodgeDir;
03717					DodgeDir = DODGE_None;
03718					if (bEdgeForward && bWasForward)
03719						DodgeDir = DODGE_Forward;
03720					if (bEdgeBack && bWasBack)
03721						DodgeDir = DODGE_Back;
03722					if (bEdgeLeft && bWasLeft)
03723						DodgeDir = DODGE_Left;
03724					if (bEdgeRight && bWasRight)
03725						DodgeDir = DODGE_Right;
03726					if ( DodgeDir == DODGE_None)
03727						DodgeDir = OldDodge;
03728					else if ( DodgeDir != OldDodge )
03729						DodgeClickTimer = DodgeClickTime + 0.5 * DeltaTime;
03730					else 
03731						DodgeMove = DodgeDir;
03732				}
03733		
03734				if (DodgeDir == DODGE_Done)
03735				{
03736					DodgeClickTimer -= DeltaTime;
03737					if (DodgeClickTimer < -0.35) 
03738					{
03739						DodgeDir = DODGE_None;
03740						DodgeClickTimer = DodgeClickTime;
03741					}
03742				}		
03743				else if ((DodgeDir != DODGE_None) && (DodgeDir != DODGE_Active))
03744				{
03745					DodgeClickTimer -= DeltaTime;			
03746					if (DodgeClickTimer < 0)
03747					{
03748						DodgeDir = DODGE_None;
03749						DodgeClickTimer = DodgeClickTime;
03750					}
03751				}
03752			}
03753		
03754			AnimGroupName = GetAnimGroup(AnimSequence);		
03755			if ( (Physics == PHYS_Walking) && (AnimGroupName != 'Dodge') )
03756			{
03757				//if walking, look up/down stairs - unless player is rotating view
03758				if ( !bKeyboardLook && (bLook == 0) )
03759				{
03760					if ( bLookUpStairs )
03761						ViewRotation.Pitch = FindStairRotation(deltaTime);
03762					else if ( bCenterView )
03763					{
03764						ViewRotation.Pitch = ViewRotation.Pitch & 65535;
03765						if (ViewRotation.Pitch > 32768)
03766							ViewRotation.Pitch -= 65536;
03767						ViewRotation.Pitch = ViewRotation.Pitch * (1 - 12 * FMin(0.0833, deltaTime));
03768						if ( Abs(ViewRotation.Pitch) < 1000 )
03769							ViewRotation.Pitch = 0;	
03770					}
03771				}
03772	
03773				Speed2D = Sqrt(Velocity.X * Velocity.X + Velocity.Y * Velocity.Y);
03774				//add bobbing when walking
03775				if ( !bShowMenu )
03776					CheckBob(DeltaTime, Speed2D, Y);
03777			}	
03778			else if ( !bShowMenu )
03779			{ 
03780				BobTime = 0;
03781				WalkBob = WalkBob * (1 - FMin(1, 8 * deltatime));
03782			}
03783	
03784			// Update rotation.
03785			OldRotation = Rotation;
03786			UpdateRotation(DeltaTime, 1);
03787	
03788			if ( bPressedJump && (AnimGroupName == 'Dodge') )
03789			{
03790				bSaveJump = true;
03791				bPressedJump = false;
03792			}
03793			else
03794				bSaveJump = false;
03795	
03796			if ( Role < ROLE_Authority ) // then save this move and replicate it
03797				ReplicateMove(DeltaTime, NewAccel, DodgeMove, OldRotation - Rotation);
03798			else
03799				ProcessMove(DeltaTime, NewAccel, DodgeMove, OldRotation - Rotation);
03800			bPressedJump = bSaveJump;
03801		}
03802	
03803		function BeginState()
03804		{
03805			if ( Mesh == None )
03806				SetMesh();
03807			WalkBob = vect(0,0,0);
03808			DodgeDir = DODGE_None;
03809			bIsCrouching = false;
03810			bIsTurning = false;
03811			bPressedJump = false;
03812			if (Physics != PHYS_Falling) SetPhysics(PHYS_Walking);
03813			if ( !IsAnimating() )
03814				PlayWaiting();
03815		}
03816		
03817		function EndState()
03818		{
03819			WalkBob = vect(0,0,0);
03820			bIsCrouching = false;
03821		}
03822	}
03823	
03824	//-----------------------------------------------------------------------------
03825	//
03826	// STATE EdgeHanging
03827	//
03828	//-----------------------------------------------------------------------------
03829	
03830	state EdgeHanging
03831	{
03832	ignores SeePlayer, HearNoise, Bump, Fire, AltFire, GrabEdge, Jump, SwitchWeapon;
03833	
03834		function ZoneChange( ZoneInfo NewZone )
03835		{
03836			if (NewZone.bWaterZone)
03837			{
03838				setPhysics(PHYS_Swimming);
03839				GotoState('PlayerSwimming');
03840			}
03841		}
03842	
03843		function bool CanGotoPainState()
03844		{ // Do not allow the actor to enter the painstate when edge hanging
03845			return(false);
03846		}
03847	
03848		function PlayChatting()
03849		{
03850		}
03851	
03852		exec function Taunt()
03853		{
03854		}
03855	
03856		function AnimEnd()
03857		{
03858		}
03859		
03860		function Landed(vector HitNormal, actor HitActor)
03861		{
03862		}
03863		
03864		function ProcessMove(float DeltaTime, vector NewAccel, eDodgeDir DodgeMove, rotator DeltaRot)	
03865		{
03866			if(bPressedJump)
03867			{
03868				SetPhysics(PHYS_Falling);
03869				GotoState('PlayerWalking');
03870			}
03871			Acceleration = vect(0,0,0);
03872		}
03873	
03874		event PlayerTick( float DeltaTime )
03875		{
03876			if ( bUpdatePosition )
03877				ClientUpdatePosition();
03878			
03879			PlayerMove(DeltaTime);
03880		}
03881	
03882		function ServerMove
03883		(
03884			float TimeStamp, 
03885			vector Accel, 
03886			vector ClientLoc,
03887			bool NewbRun,
03888			bool NewbDuck,
03889			bool NewbJumpStatus, 
03890			bool bFired,
03891			bool bAltFired,
03892			bool bForceFire,
03893			bool bForceAltFire,
03894			eDodgeDir DodgeMove, 
03895			byte ClientRoll, 
03896			int View,
03897			optional byte OldTimeDelta,
03898			optional int OldAccel
03899		)
03900		{
03901			Global.ServerMove(TimeStamp, Accel, ClientLoc, NewbRun, NewbDuck, NewbJumpStatus,
03902								bFired, bAltFired, bForceFire, bForceAltFire, DodgeMove, ClientRoll, (32767 & (Rotation.Pitch/2)) * 32768 + (32767 & (Rotation.Yaw/2)));
03903		}
03904	
03905		function PlayerMove( float DeltaTime)
03906		{
03907			local rotator currentRot;
03908			local vector NewAccel;
03909	
03910			aLookup  *= 0.24;
03911			aTurn    *= 0.24;
03912	
03913			// Update acceleration.
03914			if ( !IsAnimating() && (aForward != 0) || (aStrafe != 0) )
03915				NewAccel = vect(0,0,1);
03916			else
03917				NewAccel = vect(0,0,0);
03918	
03919			// Update view rotation.
03920			currentRot = Rotation;
03921			UpdateRotation(DeltaTime, 1);
03922			SetRotation(currentRot);
03923	
03924			if ( Role < ROLE_Authority ) // then save this move and replicate it
03925				ReplicateMove(DeltaTime, NewAccel, DODGE_None, Rot(0,0,0));
03926			else
03927				ProcessMove(DeltaTime, NewAccel, DODGE_None, Rot(0,0,0));
03928			bPressedJump = false;
03929		}
03930	
03931		function PlayTakeHit(float tweentime, int damage, vector HitLoc, name damageType, vector Momentum, int BodyPart)
03932		{
03933		}
03934		
03935		function PlayDying(name DamageType, vector HitLocation)
03936		{
03937			BaseEyeHeight = Default.BaseEyeHeight;
03938			Super.PlayDying(DamageType, HitLocation);
03939		}
03940		
03941		function ChangedWeapon()
03942		{
03943			Inventory.ChangedWeapon();
03944			Weapon = None;
03945		}
03946	
03947		function EndState()
03948		{
03949		}
03950	
03951		function BeginState()
03952		{
03953			bIsCrouching = false;
03954			bPressedJump = false;
03955			
03956		}
03957	
03958	begin:
03959		PlayPullUp();
03960		
03961		Sleep(0.2);
03962		AirSpeed = 175;
03963		
03964		SetPhysics(PHYS_Flying);
03965		MoveTo(GrabLocationUp);
03966		MoveTo(GrabLocationIn);
03967		SetPhysics(PHYS_None);
03968		FinishAnim();
03969	
03970		PlayWaiting();
03971		AirSpeed = Default.AirSpeed;
03972	//	CameraRotSpeed = Default.CameraRotSpeed;
03973		
03974		GotoState('PlayerWalking');
03975	}
03976	
03977	state FeigningDeath
03978	{
03979	ignores SeePlayer, HearNoise, Bump;
03980	
03981		function ZoneChange( ZoneInfo NewZone )
03982		{
03983			if (NewZone.bWaterZone)
03984			{
03985				setPhysics(PHYS_Swimming);
03986				GotoState('PlayerSwimming');
03987			}
03988		}
03989	
03990		exec function Fire( optional float F )
03991		{
03992			bJustFired = true;
03993		}
03994	
03995		exec function AltFire( optional float F )
03996		{
03997			bJustFired = true;
03998		}
03999	
04000		function PlayChatting()
04001		{
04002		}
04003	
04004		exec function Taunt()
04005		{
04006		}
04007	
04008		function AnimEnd()
04009		{
04010			if ( (Role == ROLE_Authority) && (Health > 0) )
04011			{
04012				GotoState('PlayerWalking');
04013	//			PendingWeapon.SetDefaultDisplayProperties();
04014				ChangedWeapon();
04015			}
04016		}
04017		
04018		function Rise()
04019		{
04020			if ( !bRising )
04021			{
04022				Enable('AnimEnd');
04023				BaseEyeHeight = Default.BaseEyeHeight;
04024				bRising = true;
04025				PlayRising();
04026			}
04027		}
04028	
04029		function ProcessMove(float DeltaTime, vector NewAccel, eDodgeDir DodgeMove, rotator DeltaRot)	
04030		{
04031			if ( bJustFired || bPressedJump || (NewAccel.Z > 0) )
04032				Rise();
04033			Acceleration = vect(0,0,0);
04034		}
04035	
04036		event PlayerTick( float DeltaTime )
04037		{
04038			Weapon = None; // in case client confused because of weapon switch just before feign death
04039			if ( bUpdatePosition )
04040				ClientUpdatePosition();
04041			
04042			PlayerMove(DeltaTime);
04043		}
04044	
04045		function ServerMove
04046		(
04047			float TimeStamp, 
04048			vector Accel, 
04049			vector ClientLoc,
04050			bool NewbRun,
04051			bool NewbDuck,
04052			bool NewbJumpStatus, 
04053			bool bFired,
04054			bool bAltFired,
04055			bool bForceFire,
04056			bool bForceAltFire,
04057			eDodgeDir DodgeMove, 
04058			byte ClientRoll, 
04059			int View,
04060			optional byte OldTimeDelta,
04061			optional int OldAccel
04062		)
04063		{
04064			Global.ServerMove(TimeStamp, Accel, ClientLoc, NewbRun, NewbDuck, NewbJumpStatus,
04065								bFired, bAltFired, bForceFire, bForceAltFire, DodgeMove, ClientRoll, (32767 & (Rotation.Pitch/2)) * 32768 + (32767 & (Rotation.Yaw/2)));
04066		}
04067	
04068		function PlayerMove( float DeltaTime)
04069		{
04070			local rotator currentRot;
04071			local vector NewAccel;
04072	
04073			aLookup  *= 0.24;
04074			aTurn    *= 0.24;
04075	
04076			// Update acceleration.
04077			if ( !IsAnimating() && (aForward != 0) || (aStrafe != 0) )
04078				NewAccel = vect(0,0,1);
04079			else
04080				NewAccel = vect(0,0,0);
04081	
04082			// Update view rotation.
04083			currentRot = Rotation;
04084			UpdateRotation(DeltaTime, 1);
04085			SetRotation(currentRot);
04086	
04087			if ( Role < ROLE_Authority ) // then save this move and replicate it
04088				ReplicateMove(DeltaTime, NewAccel, DODGE_None, Rot(0,0,0));
04089			else
04090				ProcessMove(DeltaTime, NewAccel, DODGE_None, Rot(0,0,0));
04091			bPressedJump = false;
04092		}
04093	
04094		function PlayTakeHit(float tweentime, int damage, vector HitLoc, name damageType, vector Momentum, int BodyPart)
04095		{
04096			if ( IsAnimating() )
04097			{
04098				Enable('AnimEnd');
04099				Global.PlayTakeHit(tweentime, damage, HitLoc, damageType, Momentum, BodyPart);
04100			}
04101		}
04102		
04103		function PlayDying(name DamageType, vector HitLocation)
04104		{
04105			BaseEyeHeight = Default.BaseEyeHeight;
04106			if ( bRising || IsAnimating() )
04107				Global.PlayDying(DamageType, HitLocation);
04108		}
04109		
04110		function ChangedWeapon()
04111		{
04112			Weapon = None;
04113			Inventory.ChangedWeapon();
04114		}
04115	
04116		function EndState()
04117		{
04118			bJustFired = false;
04119			PlayerReplicationInfo.bFeigningDeath = false;
04120		}
04121	
04122		function BeginState()
04123		{
04124			local rotator NewRot;
04125			NewRot = Rotation;
04126			NewRot.Pitch = 0;
04127			SetRotation(NewRot);
04128			BaseEyeHeight = -0.5 * CollisionHeight;
04129			bIsCrouching = false;
04130			bPressedJump = false;
04131			bJustFired = false;
04132			bRising = false;
04133			Disable('AnimEnd');
04134			PlayFeignDeath();
04135			PlayerReplicationInfo.bFeigningDeath = true;
04136		}
04137	}
04138	
04139	// Player movement.
04140	// Player Swimming
04141	state PlayerSwimming
04142	{
04143	ignores SeePlayer, HearNoise, Bump;
04144	
04145		event UpdateEyeHeight(float DeltaTime)
04146		{
04147			local float smooth, bound;
04148			
04149			// smooth up/down stairs
04150			if( !bJustLanded )
04151			{
04152				smooth = FMin(1.0, 10.0 * DeltaTime/Level.TimeDilation);
04153				EyeHeight = (EyeHeight - Location.Z + OldLocation.Z) * (1 - smooth) + ( ShakeVert + BaseEyeHeight) * smooth;
04154				bound = -0.5 * CollisionHeight;
04155				if (EyeHeight < bound)
04156					EyeHeight = bound;
04157				else
04158				{
04159					bound = CollisionHeight + FClamp((OldLocation.Z - Location.Z), 0.0, MaxStepHeight); 
04160					 if ( EyeHeight > bound )
04161						EyeHeight = bound;
04162	
04163				}
04164			}
04165			else
04166			{
04167				smooth = FClamp(10.0 * DeltaTime/Level.TimeDilation, 0.35, 1.0);
04168				bJustLanded = false;
04169				EyeHeight = EyeHeight * ( 1 - smooth) + (BaseEyeHeight + ShakeVert) * smooth;
04170			}
04171	
04172			// teleporters affect your FOV, so adjust it back down
04173			if ( FOVAngle != DesiredFOV )
04174			{
04175				if ( FOVAngle > DesiredFOV )
04176					FOVAngle = FOVAngle - FMax(7, 0.9 * DeltaTime * (FOVAngle - DesiredFOV)); 
04177				else 
04178					FOVAngle = FOVAngle - FMin(-7, 0.9 * DeltaTime * (FOVAngle - DesiredFOV)); 
04179				if ( Abs(FOVAngle - DesiredFOV) <= 10 )
04180					FOVAngle = DesiredFOV;
04181			}
04182	
04183			// adjust FOV for weapon zooming
04184			if ( bZooming )
04185			{	
04186				ZoomLevel += DeltaTime * 1.0;
04187				if (ZoomLevel > 0.9)
04188					ZoomLevel = 0.9;
04189				DesiredFOV = FClamp(90.0 - (ZoomLevel * 88.0), 1, 170);
04190			} 
04191		}
04192	
04193		function Landed(vector HitNormal, actor HitActor)
04194		{
04195			if ( !bUpdating )
04196			{
04197				//log(class$" Landed while swimming");
04198				PlayLanded(Velocity.Z);
04199				//TakeFallingDamage();
04200				bJustLanded = true;
04201			}
04202			if ( Region.Zone.bWaterZone )
04203				SetPhysics(PHYS_Swimming);
04204			else
04205			{
04206				GotoState('PlayerWalking');
04207				AnimEnd();
04208			}
04209		}
04210	
04211		function AnimEnd()
04212		{
04213			local vector X,Y,Z;
04214			GetAxes(Rotation, X,Y,Z);
04215			if ( (Acceleration Dot X) <= 0 )
04216			{
04217				if ( GetAnimGroup(AnimSequence) == 'TakeHit' )
04218				{
04219					bAnimTransition = true;
04220					TweenToWaiting(0.2);
04221				} 
04222				else
04223					PlayWaiting();
04224			}	
04225			else
04226			{
04227				if ( GetAnimGroup(AnimSequence) == 'TakeHit' )
04228				{
04229					bAnimTransition = true;
04230					TweenToSwimming(0.2);
04231				} 
04232				else
04233					PlaySwimming();
04234			}
04235		}
04236		
04237		function ZoneChange( ZoneInfo NewZone )
04238		{
04239			local actor HitActor;
04240			local vector HitLocation, HitNormal, checkpoint;
04241	
04242			if (!NewZone.bWaterZone)
04243			{
04244				SetPhysics(PHYS_Falling);
04245				if (bUpAndOut && CheckWaterJump(HitNormal)) //check for waterjump
04246				{
04247					velocity.Z = 330 + 2 * CollisionRadius; //set here so physics uses this for remainder of tick
04248					PlayDuck();
04249					GotoState('PlayerWalking');
04250				}				
04251				else if (!FootRegion.Zone.bWaterZone || (Velocity.Z > 160) )
04252				{
04253					GotoState('PlayerWalking');
04254					AnimEnd();
04255				}
04256				else //check if in deep water
04257				{
04258					checkpoint = Location;
04259					checkpoint.Z -= (CollisionHeight + 6.0);
04260					HitActor = Trace(HitLocation, HitNormal, checkpoint, Location, false);
04261					if (HitActor != None)
04262					{
04263						GotoState('PlayerWalking');
04264						AnimEnd();
04265					}
04266					else
04267					{
04268						Enable('Timer');
04269						SetTimer(0.7,false);
04270					}
04271				}
04272				//log("Out of water");
04273			}
04274			else
04275			{
04276				Disable('Timer');
04277				SetPhysics(PHYS_Swimming);
04278			}
04279		}
04280	
04281		function ProcessMove(float DeltaTime, vector NewAccel, eDodgeDir DodgeMove, rotator DeltaRot)	
04282		{
04283			local vector X,Y,Z, Temp;
04284		
04285			GetAxes(ViewRotation,X,Y,Z);
04286			Acceleration = NewAccel;
04287	
04288			SwimAnimUpdate( (X Dot Acceleration) <= 0 );
04289	
04290			bUpAndOut = ((X Dot Acceleration) > 0) && ((Acceleration.Z > 0) || (ViewRotation.Pitch > 2048));
04291			if ( bUpAndOut && !Region.Zone.bWaterZone && CheckWaterJump(Temp) ) //check for waterjump
04292			{
04293				velocity.Z = 330 + 2 * CollisionRadius; //set here so physics uses this for remainder of tick
04294				PlayDuck();
04295				GotoState('PlayerWalking');
04296			}				
04297		}
04298	
04299		event PlayerTick( float DeltaTime )
04300		{
04301			if ( bUpdatePosition )
04302				ClientUpdatePosition();
04303			
04304			PlayerMove(DeltaTime);
04305		}
04306	
04307		function PlayerMove(float DeltaTime)
04308		{
04309			local rotator oldRotation;
04310			local vector X,Y,Z, NewAccel;
04311			local float Speed2D;
04312		
04313			GetAxes(ViewRotation,X,Y,Z);
04314	
04315			aForward *= 0.2;
04316			aStrafe  *= 0.1;
04317			aLookup  *= 0.24;
04318			aTurn    *= 0.24;
04319			aUp		 *= 0.1;  
04320			
04321			NewAccel = aForward*X + aStrafe*Y + aUp*vect(0,0,1); 
04322		
04323			//add bobbing when swimming
04324			if ( !bShowMenu )
04325			{
04326				Speed2D = Sqrt(Velocity.X * Velocity.X + Velocity.Y * Velocity.Y);
04327				WalkBob = Y * Bob *  0.5 * Speed2D * sin(4.0 * Level.TimeSeconds);
04328				WalkBob.Z = Bob * 1.5 * Speed2D * sin(8.0 * Level.TimeSeconds);
04329			}
04330	
04331			// Update rotation.
04332			oldRotation = Rotation;
04333			UpdateRotation(DeltaTime, 2);
04334	
04335			if ( Role < ROLE_Authority ) // then save this move and replicate it
04336				ReplicateMove(DeltaTime, NewAccel, DODGE_None, OldRotation - Rotation);
04337			else
04338				ProcessMove(DeltaTime, NewAccel, DODGE_None, OldRotation - Rotation);
04339			bPressedJump = false;
04340		}
04341	
04342		function Timer()
04343		{
04344			if ( !Region.Zone.bWaterZone && (Role == ROLE_Authority) )
04345			{
04346				//log("timer out of water");
04347				GotoState('PlayerWalking');
04348				AnimEnd();
04349			}
04350		
04351			Disable('Timer');
04352		}
04353		
04354		function BeginState()
04355		{
04356			Disable('Timer');
04357			if ( !IsAnimating() )
04358				TweenToWaiting(0.3);
04359			//log("player swimming");
04360		}
04361	}
04362	
04363	state PlayerFlying
04364	{
04365	ignores SeePlayer, HearNoise, Bump;
04366			
04367		function AnimEnd()
04368		{
04369			PlaySwimming();
04370		}
04371		
04372		event PlayerTick( float DeltaTime )
04373		{
04374			if ( bUpdatePosition )
04375				ClientUpdatePosition();
04376		
04377			PlayerMove(DeltaTime);
04378		}
04379	
04380		function PlayerMove(float DeltaTime)
04381		{
04382			local rotator newRotation;
04383			local vector X,Y,Z;
04384	
04385			GetAxes(Rotation,X,Y,Z);
04386	
04387			aForward *= 0.2;
04388			aStrafe  *= 0.2;
04389			aLookup  *= 0.24;
04390			aTurn    *= 0.24;
04391	
04392			Acceleration = aForward*X + aStrafe*Y;  
04393			// Update rotation.
04394			UpdateRotation(DeltaTime, 2);
04395	
04396			if ( Role < ROLE_Authority ) // then save this move and replicate it
04397				ReplicateMove(DeltaTime, Acceleration, DODGE_None, rot(0,0,0));
04398			else
04399				ProcessMove(DeltaTime, Acceleration, DODGE_None, rot(0,0,0));
04400		}
04401		
04402		function BeginState()
04403		{
04404			SetPhysics(PHYS_Flying);
04405			if  ( !IsAnimating() ) PlayMoving();
04406			//log("player flying");
04407		}
04408	}
04409	
04410	state CheatFlying
04411	{
04412	ignores SeePlayer, HearNoise, Bump, JointDamaged;
04413			
04414		function AnimEnd()
04415		{
04416			PlaySwimming();
04417		}
04418		
04419		function ProcessMove(float DeltaTime, vector NewAccel, eDodgeDir DodgeMove, rotator DeltaRot)	
04420		{
04421			Acceleration = Normal(NewAccel);
04422			Velocity = Normal(NewAccel) * 300;
04423			AutonomousPhysics(DeltaTime);
04424		}
04425	
04426		event PlayerTick( float DeltaTime )
04427		{
04428			if ( bUpdatePosition )
04429				ClientUpdatePosition();
04430	
04431			PlayerMove(DeltaTime);
04432		}
04433	
04434		function PlayerMove(float DeltaTime)
04435		{
04436			local rotator newRotation;
04437			local vector X,Y,Z;
04438	
04439			GetAxes(ViewRotation,X,Y,Z);
04440	
04441			aForward *= 0.1;
04442			aStrafe  *= 0.1;
04443			aLookup  *= 0.24;
04444			aTurn    *= 0.24;
04445			aUp		 *= 0.1;
04446		
04447			Acceleration = aForward*X + aStrafe*Y + aUp*vect(0,0,1);  
04448	
04449			UpdateRotation(DeltaTime, 1);
04450	
04451			if ( Role < ROLE_Authority ) // then save this move and replicate it
04452				ReplicateMove(DeltaTime, Acceleration, DODGE_None, rot(0,0,0));
04453			else
04454				ProcessMove(DeltaTime, Acceleration, DODGE_None, rot(0,0,0));
04455		}
04456	
04457		function BeginState()
04458		{
04459			EyeHeight = BaseEyeHeight;
04460			SetPhysics(PHYS_Flying);
04461			if  ( !IsAnimating() ) PlaySwimming();
04462		}
04463	}
04464	
04465	state PlayerWaiting
04466	{
04467	ignores SeePlayer, HearNoise, Bump, TakeDamage, Died, ZoneChange, FootZoneChange;
04468	
04469		exec function Jump( optional float F )
04470		{
04471		}
04472	
04473		exec function Suicide()
04474		{
04475		}
04476	
04477		function ChangeTeam( int N )
04478		{
04479			Level.Game.ChangeTeam(self, N);
04480		}
04481	
04482		exec function Fire(optional float F)
04483		{
04484			bReadyToPlay = true;
04485		}
04486		
04487		exec function AltFire(optional float F)
04488		{
04489			bReadyToPlay = true;
04490		}
04491			
04492		function ProcessMove(float DeltaTime, vector NewAccel, eDodgeDir DodgeMove, rotator DeltaRot)	
04493		{
04494			Acceleration = NewAccel;
04495			MoveSmooth(Acceleration * DeltaTime);
04496		}
04497	
04498		function PlayWaiting(optional float tween){}
04499	
04500		event PlayerTick( float DeltaTime )
04501		{
04502			if ( bUpdatePosition )
04503				ClientUpdatePosition();
04504	
04505			PlayerMove(DeltaTime);
04506		}
04507	
04508		function PlayerMove(float DeltaTime)
04509		{
04510			local rotator newRotation;
04511			local vector X,Y,Z;
04512	
04513			GetAxes(ViewRotation,X,Y,Z);
04514	
04515			aForward *= 0.1;
04516			aStrafe  *= 0.1;
04517			aLookup  *= 0.24;
04518			aTurn    *= 0.24;
04519			aUp		 *= 0.1;
04520		
04521			Acceleration = aForward*X + aStrafe*Y + aUp*vect(0,0,1);  
04522	
04523			UpdateRotation(DeltaTime, 1);
04524	
04525			if ( Role < ROLE_Authority ) // then save this move and replicate it
04526				ReplicateMove(DeltaTime, Acceleration, DODGE_None, rot(0,0,0));
04527			else
04528				ProcessMove(DeltaTime, Acceleration, DODGE_None, rot(0,0,0));
04529		}
04530	
04531		function EndState()
04532		{
04533			SetMesh();
04534			PlayerReplicationInfo.bIsSpectator = false;
04535			PlayerReplicationInfo.bWaitingPlayer = false;
04536			SetCollision(true,true,true);
04537		}
04538	
04539		function BeginState()
04540		{
04541			Mesh = None;
04542			if ( PlayerReplicationInfo != None )
04543			{
04544				PlayerReplicationInfo.bIsSpectator = true;
04545				PlayerReplicationInfo.bWaitingPlayer = true;
04546			}
04547			SetCollision(false,false,false);
04548			EyeHeight = BaseEyeHeight;
04549			SetPhysics(PHYS_None);
04550		}
04551	}
04552	
04553	state PlayerSpectating
04554	{
04555	ignores SeePlayer, HearNoise, Bump, TakeDamage, Died, ZoneChange, FootZoneChange;
04556	
04557		exec function Suicide()
04558		{
04559		}
04560	
04561		function SendVoiceMessage(PlayerReplicationInfo Sender, PlayerReplicationInfo Recipient, name messagetype, byte messageID, name broadcasttype)
04562		{
04563		}
04564	
04565		exec function AltFire( optional float F )
04566		{
04567			bBehindView = false;
04568			Viewtarget = None;
04569			ClientMessage(ViewingFrom@OwnCamera, 'Event', true);
04570		}
04571	
04572		function ChangeTeam( int N )
04573		{
04574			Level.Game.ChangeTeam(self, N);
04575		}
04576	
04577		exec function Fire( optional float F )
04578		{
04579			if ( Role == ROLE_Authority )
04580			{
04581				ViewPlayerNum(-1);
04582				bBehindView = true;
04583			}
04584		} 
04585	
04586		function ProcessMove(float DeltaTime, vector NewAccel, eDodgeDir DodgeMove, rotator DeltaRot)	
04587		{
04588			Acceleration = NewAccel;
04589			MoveSmooth(Acceleration * DeltaTime);
04590		}
04591	
04592		event PlayerTick( float DeltaTime )
04593		{
04594			if ( bUpdatePosition )
04595				ClientUpdatePosition();
04596	
04597			PlayerMove(DeltaTime);
04598		}
04599	
04600		function PlayerMove(float DeltaTime)
04601		{
04602			local rotator newRotation;
04603			local vector X,Y,Z;
04604	
04605			GetAxes(ViewRotation,X,Y,Z);
04606	
04607			aForward *= 0.1;
04608			aStrafe  *= 0.1;
04609			aLookup  *= 0.24;
04610			aTurn    *= 0.24;
04611			aUp		 *= 0.1;
04612		
04613			Acceleration = aForward*X + aStrafe*Y + aUp*vect(0,0,1);  
04614	
04615			UpdateRotation(DeltaTime, 1);
04616	
04617			if ( Role < ROLE_Authority ) // then save this move and replicate it
04618				ReplicateMove(DeltaTime, Acceleration, DODGE_None, rot(0,0,0));
04619			else
04620				ProcessMove(DeltaTime, Acceleration, DODGE_None, rot(0,0,0));
04621		}
04622	
04623		function EndState()
04624		{
04625			PlayerReplicationInfo.bIsSpectator = false;
04626			PlayerReplicationInfo.bWaitingPlayer = false;
04627			SetMesh();
04628			SetCollision(true,true,true);
04629		}
04630	
04631		function BeginState()
04632		{
04633			PlayerReplicationInfo.bIsSpectator = true;
04634			PlayerReplicationInfo.bWaitingPlayer = true;
04635			bShowScores = true;
04636			Mesh = None;
04637			SetCollision(false,false,false);
04638			EyeHeight = Default.BaseEyeHeight;
04639			SetPhysics(PHYS_None);
04640		}
04641	}
04642	
04643	//------------------------------------------------------------
04644	//
04645	// Pain
04646	//
04647	// For now, the pain state does nothing on the player
04648	//------------------------------------------------------------
04649	
04650	state Pain
04651	{
04652		function bool CanGotoPainState()
04653		{ // Do not allow the actor to enter the painstate when already in pain
04654			return(false);
04655		}
04656	
04657		event PlayerTick( float DeltaTime )
04658		{
04659			if ( bUpdatePosition )
04660				ClientUpdatePosition();
04661			
04662			PlayerMove(DeltaTime);
04663		}
04664	
04665		function PlayerMove( float DeltaTime )
04666		{
04667			if ( Role < ROLE_Authority ) // then save this move and replicate it
04668				ReplicateMove(DeltaTime, vect(0,0,0), Dodge_None, rot(0,0,0));
04669		}
04670	
04671	Begin:
04672		GotoState(NextStateAfterPain);
04673	}
04674	
04675	//------------------------------------------------------------
04676	//
04677	// Uninterrupted
04678	//
04679	//------------------------------------------------------------
04680	
04681	state Uninterrupted
04682	{
04683	ignores SeePlayer, EnemyNotVisible, HearNoise, Trigger, Bump, HitWall, HeadZoneChange, FootZoneChange, ZoneChange, Falling, WarnTarget, LongFall, Landed;
04684	
04685		function bool CanGotoPainState()
04686		{ // Do not allow the actor to enter the painstate when in uninterrupted mode
04687			return(false);
04688		}
04689	
04690		event PlayerTick( float DeltaTime )
04691		{
04692			if ( bUpdatePosition )
04693				ClientUpdatePosition();
04694			
04695			PlayerMove(DeltaTime);
04696		}
04697	
04698		function PlayerMove( float DeltaTime )
04699		{
04700			if ( Role < ROLE_Authority ) // then save this move and replicate it
04701				ReplicateMove(DeltaTime, vect(0,0,0), Dodge_None, rot(0,0,0));
04702		}
04703	
04704		function AnimEnd()
04705		{
04706		}
04707	
04708	begin:
04709		if(UninterruptedAnim != '')
04710		{
04711			PlayAnim(UninterruptedAnim, 1.0, 0.1);
04712			if(AnimProxy != None)
04713				AnimProxy.PlayAnim(UninterruptedAnim, 1.0, 0.1);
04714			
04715			FinishAnim();
04716			
04717			// Clear out any blending information (if it exists)
04718			BlendAnimSequence = 'None';
04719			if(AnimProxy != None)
04720			{
04721				AnimProxy.BlendAnimSequence = 'None';			
04722				AnimProxy.GotoState('Idle');
04723			}
04724	
04725			GotoState(NextState);
04726		}
04727	}
04728	
04729	//------------------------------------------------------------
04730	//
04731	// Dying
04732	//
04733	//------------------------------------------------------------
04734	state Dying
04735	{
04736	ignores SeePlayer, EnemyNotVisible, HearNoise, KilledBy, Trigger, Bump, HitWall, HeadZoneChange, FootZoneChange, ZoneChange, Falling, WarnTarget, Died, LongFall, PainTimer, Landed, SwitchWeapon;
04737	
04738		function ServerReStartPlayer()
04739		{
04740			//slog("calling restartplayer in dying with netmode "$Level.NetMode);
04741			if ( Level.NetMode == NM_Client )
04742				return;
04743			if (Level.Game.bGameEnded)
04744				return;
04745			if( Level.Game.RestartPlayer(self) )
04746			{
04747				ServerTimeStamp = 0;
04748				TimeMargin = 0;
04749				Enemy = None;
04750				Level.Game.StartPlayer(self);
04751				ClientReStart();
04752			}
04753			else
04754				log("Restartplayer failed");
04755		}
04756	
04757		exec function Fire( optional float F )
04758		{
04759			if ( !bFrozen )
04760				ServerReStartPlayer();
04761			return;
04762	
04763	
04764			if ( (Level.NetMode == NM_Standalone) && !Level.Game.bDeathMatch )
04765			{
04766				if ( bFrozen )
04767					return;
04768				ShowLoadMenu();
04769			}
04770			else if ( !bFrozen || (FRand() < 0.2) )
04771				ServerReStartPlayer();
04772		}
04773		
04774		exec function AltFire( optional float F )
04775		{
04776			Fire(F);
04777		}
04778		exec function Use()
04779		{
04780			Fire(0);
04781		}
04782	
04783		function PlayChatting()
04784		{
04785		}
04786	
04787		exec function Taunt()
04788		{
04789		}
04790	
04791		function ServerMove
04792		(
04793			float TimeStamp, 
04794			vector Accel, 
04795			vector ClientLoc,
04796			bool NewbRun,
04797			bool NewbDuck,
04798			bool NewbJumpStatus,
04799			bool bFired,
04800			bool bAltFired,
04801			bool bForceFire,
04802			bool bForceAltFire,
04803			eDodgeDir DodgeMove, 
04804			byte ClientRoll, 
04805			int View,
04806			optional byte OldTimeDelta,
04807			optional int OldAccel
04808		)
04809		{
04810			Global.ServerMove(
04811						TimeStamp,
04812						Accel, 
04813						ClientLoc,
04814						false,
04815						false,
04816						false, 
04817						false,
04818						false,
04819						false,
04820						false,
04821						DodgeMove, 
04822						ClientRoll, 
04823						View);
04824		}
04825	
04826	/*
04827		function PlayerCalcView(out actor ViewActor, out vector CameraLocation, out rotator CameraRotation )
04828		{
04829			local vector View,HitLocation,HitNormal, FirstHit, spot;
04830			local float DesiredDist, ViewDist, WallOutDist;
04831			local actor HitActor;
04832			local Pawn PTarget;
04833	
04834			if ( ViewTarget != None )
04835			{
04836				ViewActor = ViewTarget;
04837				CameraLocation = ViewTarget.Location;
04838				CameraRotation = ViewTarget.Rotation;
04839				PTarget = Pawn(ViewTarget);
04840				if ( PTarget != None )
04841				{
04842					if ( Level.NetMode == NM_Client )
04843					{
04844						if ( PTarget.bIsPlayer )
04845							PTarget.ViewRotation = TargetViewRotation;
04846						PTarget.EyeHeight = TargetEyeHeight;
04847					}
04848					if ( PTarget.bIsPlayer )
04849						CameraRotation = PTarget.ViewRotation;
04850					CameraLocation.Z += PTarget.EyeHeight;
04851				}
04852	
04853				if ( Carcass(ViewTarget) != None )
04854				{
04855					if ( bBehindView || (ViewTarget.Physics == PHYS_None) )
04856						CameraRotation = ViewRotation;
04857					else 
04858						ViewRotation = CameraRotation;
04859					if ( bBehindView )
04860						CalcBehindView(CameraLocation, CameraRotation, 190);
04861				}
04862				else if ( bBehindView )
04863					CalcBehindView(CameraLocation, CameraRotation, 180);
04864	
04865				return;
04866			}
04867	
04868			// View rotation.
04869			CameraRotation = ViewRotation;
04870			DesiredFOV = DefaultFOV;		
04871			ViewActor = self;
04872			if( bBehindView ) //up and behind (for death scene)
04873				CalcBehindView(CameraLocation, CameraRotation, 180);
04874			else
04875			{
04876				// First-person view.
04877				CameraLocation = Location;
04878				CameraLocation.Z += Default.BaseEyeHeight;
04879			}
04880		}
04881	*/
04882	
04883		event PlayerTick( float DeltaTime )
04884		{
04885			if ( bUpdatePosition )
04886				ClientUpdatePosition();
04887			
04888			PlayerMove(DeltaTime);
04889		}
04890	
04891		function PlayerMove(float DeltaTime)
04892		{
04893			local vector X,Y,Z;
04894	
04895			if ( !bFrozen )
04896			{
04897				if ( bPressedJump )
04898				{
04899					Fire(0);
04900					bPressedJump = false;
04901				}
04902				GetAxes(ViewRotation,X,Y,Z);
04903				// Update view rotation.
04904				aLookup  *= 0.24;
04905				aTurn    *= 0.24;
04906				ViewRotation.Yaw += 32.0 * DeltaTime * aTurn;
04907				ViewRotation.Pitch += 32.0 * DeltaTime * aLookUp;
04908				ViewRotation.Pitch = ViewRotation.Pitch & 65535;
04909				If ((ViewRotation.Pitch > 18000) && (ViewRotation.Pitch < 49152))
04910				{
04911					If (aLookUp > 0) 
04912						ViewRotation.Pitch = 18000;
04913					else
04914						ViewRotation.Pitch = 49152;
04915				}
04916				if ( Role < ROLE_Authority ) // then save this move and replicate it
04917					ReplicateMove(DeltaTime, vect(0,0,0), DODGE_None, rot(0,0,0));
04918			}
04919			else
04920			{
04921				GetAxes(ViewRotation,X,Y,Z);
04922				// Update view rotation.
04923				aLookup  *= 0.24;
04924				aTurn    *= 0.24;
04925				ViewRotation.Yaw += 32.0 * DeltaTime * aTurn;
04926				ViewRotation.Pitch += 32.0 * DeltaTime * aLookUp;
04927				ViewRotation.Pitch = ViewRotation.Pitch & 65535;
04928				If ((ViewRotation.Pitch > 18000) && (ViewRotation.Pitch < 49152))
04929				{
04930					If (aLookUp > 0) 
04931						ViewRotation.Pitch = 18000;
04932					else
04933						ViewRotation.Pitch = 49152;
04934				}
04935				if ( Role < ROLE_Authority ) // then save this move and replicate it
04936					ReplicateMove(DeltaTime, vect(0,0,0), DODGE_None, rot(0,0,0));
04937			}
04938	//		ViewShake(DeltaTime); // RUNE:  ViewShake is handled in the Camera code
04939			ViewFlash(DeltaTime);
04940		}
04941	
04942		function FindGoodView()
04943		{
04944			local vector cameraLoc;
04945			local rotator cameraRot;
04946			local int tries, besttry;
04947			local float bestdist, newdist;
04948			local int startYaw;
04949			local actor ViewActor;
04950			
04951			//fixme - try to pick view with killer visible
04952			//fixme - also try varying starting pitch
04953			////log("Find good death scene view");
04954			ViewRotation.Pitch = 56000;
04955			tries = 0;
04956			besttry = 0;
04957			bestdist = 0.0;
04958			startYaw = ViewRotation.Yaw;
04959			
04960			for (tries=0; tries<16; tries++)
04961			{
04962				cameraLoc = Location;
04963				PlayerCalcView(ViewActor, cameraLoc, cameraRot);
04964				newdist = VSize(cameraLoc - Location);
04965				if (newdist > bestdist)
04966				{
04967					bestdist = newdist;	
04968					besttry = tries;
04969				}
04970				ViewRotation.Yaw += 4096;
04971			}
04972				
04973			ViewRotation.Yaw = startYaw + besttry * 4096;
04974		}
04975		
04976		function bool JointDamaged(int Damage, Pawn Instigator, vector HitLoc, vector Momentum, name DamageType, int joint)
04977		{
04978			if (!bHidden)
04979				return Super.JointDamaged(Damage, Instigator, HitLoc, Momentum, DamageType, joint);
04980			return true;
04981		}
04982	
04983		
04984		function Timer()
04985		{
04986			bFrozen = false;
04987			bShowScores = true;
04988			bPressedJump = false;
04989			Super.Timer();
04990		}
04991	
04992		function BeginState()
04993		{
04994			BaseEyeheight = Default.BaseEyeHeight;
04995			EyeHeight = BaseEyeHeight;
04996			bBehindView = true;
04997			bFrozen = true;
04998			bPressedJump = false;
04999			bJustFired = false;
05000			bJustAltFired = false;
05001			LookTarget=None;
05002			LookSpot=vect(0,0,0);
05003	//		FindGoodView();
05004			if ( (Role == ROLE_Authority) && !bHidden )
05005			{
05006				ReplaceWithCarcass();
05007			}
05008			SetTimer(1.0, false);
05009	
05010			// clean out saved moves
05011			while ( SavedMoves != None )
05012			{
05013				SavedMoves.Destroy();
05014				SavedMoves = SavedMoves.NextMove;
05015			}
05016			if ( PendingMove != None )
05017			{
05018				PendingMove.Destroy();
05019				PendingMove = None;
05020			}
05021		}
05022		
05023		function EndState()
05024		{
05025			// clean out saved moves
05026			while ( SavedMoves != None )
05027			{
05028				SavedMoves.Destroy();
05029				SavedMoves = SavedMoves.NextMove;
05030			}
05031			if ( PendingMove != None )
05032			{
05033				PendingMove.Destroy();
05034				PendingMove = None;
05035			}
05036			Velocity = vect(0,0,0);
05037			Acceleration = vect(0,0,0);
05038			bShowScores = false;
05039			bJustFired = false;
05040			bJustAltFired = false;
05041			bPressedJump = false;
05042			if ( Carcass(ViewTarget) != None )
05043				ViewTarget = None;
05044			//Log(self$" exiting dying with remote role "$RemoteRole$" and role "$Role);
05045		}
05046	}
05047	
05048	state GameEnded
05049	{
05050	ignores SeePlayer, HearNoise, KilledBy, Bump, HitWall, HeadZoneChange, FootZoneChange, ZoneChange, Falling, JointDamaged, PainTimer, Died, Suicide;
05051	
05052		exec function Taunt()
05053		{
05054			if ( Health > 0 )
05055				Global.Taunt();
05056		}
05057	
05058		exec function ViewClass( class<actor> aClass, optional bool bQuiet )
05059		{
05060		}
05061		exec function ViewPlayer( string S )
05062		{
05063		}
05064		exec function Fire( optional float F )
05065		{
05066			if ( Role < ROLE_Authority)
05067				return;
05068			if ( !bFrozen )
05069				ServerReStartGame();
05070			else if ( TimerRate <= 0 )
05071				SetTimer(1.5, false);
05072		}
05073		
05074		exec function AltFire( optional float F )
05075		{
05076			Fire(F);
05077		}
05078	
05079		event PlayerTick( float DeltaTime )
05080		{
05081			if ( bUpdatePosition )
05082				ClientUpdatePosition();
05083	
05084			PlayerMove(DeltaTime);
05085		}
05086	
05087		function PlayerMove(float DeltaTime)
05088		{
05089			local vector X,Y,Z;
05090			
05091			GetAxes(ViewRotation,X,Y,Z);
05092			// Update view rotation.
05093	
05094			if ( !bFixedCamera )
05095			{
05096				aLookup  *= 0.24;
05097				aTurn    *= 0.24;
05098				ViewRotation.Yaw += 32.0 * DeltaTime * aTurn;
05099				ViewRotation.Pitch += 32.0 * DeltaTime * aLookUp;
05100				ViewRotation.Pitch = ViewRotation.Pitch & 65535;
05101				If ((ViewRotation.Pitch > 18000) && (ViewRotation.Pitch < 49152))
05102				{
05103					If (aLookUp > 0) 
05104						ViewRotation.Pitch = 18000;
05105					else
05106						ViewRotation.Pitch = 49152;
05107				}
05108			}
05109			else if ( ViewTarget != None )
05110				ViewRotation = ViewTarget.Rotation;
05111	
05112	//		ViewShake(DeltaTime); // RUNE:  ViewShake is handled in the Camera code
05113			ViewFlash(DeltaTime);
05114	
05115			if ( Role < ROLE_Authority ) // then save this move and replicate it
05116				ReplicateMove(DeltaTime, vect(0,0,0), DODGE_None, rot(0,0,0));
05117			else
05118				ProcessMove(DeltaTime, vect(0,0,0), DODGE_None, rot(0,0,0));
05119			bPressedJump = false;
05120		}
05121	
05122		function ServerMove
05123		(
05124			float TimeStamp, 
05125			vector InAccel, 
05126			vector ClientLoc,
05127			bool NewbRun,
05128			bool NewbDuck,
05129			bool NewbJumpStatus, 
05130			bool bFired,
05131			bool bAltFired,
05132			bool bForceFire,
05133			bool bForceAltFire,
05134			eDodgeDir DodgeMove, 
05135			byte ClientRoll, 
05136			int View,
05137			optional byte OldTimeDelta,
05138			optional int OldAccel
05139		)
05140		{
05141			Global.ServerMove(TimeStamp, InAccel, ClientLoc, NewbRun, NewbDuck, NewbJumpStatus,
05142								bFired, bAltFired, bForceFire, bForceAltFire, DodgeMove, ClientRoll, (32767 & (ViewRotation.Pitch/2)) * 32768 + (32767 & (ViewRotation.Yaw/2)) );
05143	
05144		}
05145	
05146		function FindGoodView()
05147		{
05148			local vector cameraLoc;
05149			local rotator cameraRot;
05150			local int tries, besttry;
05151			local float bestdist, newdist;
05152			local int startYaw;
05153			local actor ViewActor;
05154			
05155			ViewRotation.Pitch = 56000;
05156			tries = 0;
05157			besttry = 0;
05158			bestdist = 0.0;
05159			startYaw = ViewRotation.Yaw;
05160			
05161			for (tries=0; tries<16; tries++)
05162			{
05163				if ( ViewTarget != None )
05164					cameraLoc = ViewTarget.Location;
05165				else
05166					cameraLoc = Location;
05167				PlayerCalcView(ViewActor, cameraLoc, cameraRot);
05168				newdist = VSize(cameraLoc - Location);
05169				if (newdist > bestdist)
05170				{
05171					bestdist = newdist;	
05172					besttry = tries;
05173				}
05174				ViewRotation.Yaw += 4096;
05175			}
05176				
05177			ViewRotation.Yaw = startYaw + besttry * 4096;
05178		}
05179		
05180		function Timer()
05181		{
05182			bFrozen = false;
05183		}
05184		
05185		function BeginState()
05186		{
05187			EndZoom();
05188			AnimRate = 0.0;
05189			SimAnim.Y = 0;
05190			if (AnimProxy!=None)
05191			{
05192				AnimProxy.AnimRate = 0;
05193				AnimProxy.SimAnim.Y = 0;
05194			}
05195			bFire = 0;
05196			bAltFire = 0;
05197			SetCollision(false,false,false);
05198			bShowScores = true;
05199			bFrozen = true;
05200			if ( !bFixedCamera )
05201			{
05202				FindGoodView();
05203				bBehindView = true;
05204			}
05205			SetTimer(1.5, false);
05206			SetPhysics(PHYS_None);
05207		}
05208	
05209		function Done()
05210		{
05211			// Handle LOD issues
05212			LODCurve = LOD_CURVE_AGGRESSIVE;
05213			LODPercentMax = 0.4; // Reduce the max polycount allowed on dead bodies
05214	
05215			bCollideWorld = false;
05216		}
05217	
05218	Death:
05219		SetPhysics(PHYS_Falling);
05220	
05221		WaitForLanding();
05222		FinishAnim();
05223		SetPhysics(PHYS_None);
05224	
05225		Done();
05226		Goto('PostDeath');
05227	}
05228	
05229	// ngStats Accessors
05230	function string GetNGSecret()
05231	{
05232		return ngWorldSecret;
05233	}
05234	
05235	function SetNGSecret(string newSecret)
05236	{
05237		ngWorldSecret = newSecret;
05238	}
05239	
05240	simulated function Debug(Canvas canvas, int mode)
05241	{
05242		Super.Debug(canvas, mode);
05243	
05244		Canvas.DrawText("PlayerPawn:");
05245		Canvas.CurY -= 8;
05246		Canvas.DrawText("  bReadyToPlay: " $ bReadyToPlay);
05247		Canvas.CurY -= 8;
05248		Canvas.DrawText("  bShowScores:  " $ bShowScores);
05249		Canvas.CurY -= 8;
05250		Canvas.DrawText("  Strength:     " $ Strength$"/"$MaxStrength);
05251		Canvas.CurY -= 8;
05252		Canvas.DrawText("  bBloodlust    " $ bBloodlust);
05253		Canvas.CurY -= 8;
05254		Canvas.DrawText("  AtrophyTimer  " $ AtrophyTimer);
05255		Canvas.CurY -= 8;
05256		Canvas.DrawText("  bClientSideAlpha: " $ bClientSideAlpha);
05257		Canvas.CurY -= 8;
05258		Canvas.DrawText("  ClientSideAlphaScale: " $ ClientSideAlphaScale);
05259		Canvas.CurY -= 8;
05260		Canvas.DrawText("  HudType: " $ HudType);
05261		Canvas.CurY -= 8;
05262		Canvas.DrawText("  myHud: " $ myHud);
05263		Canvas.CurY -= 8;
05264	}
05265	
05266	defaultproperties
05267	{
05268	     Bob=0.016000
05269	     FlashScale=(X=1.000000,Y=1.000000,Z=1.000000)
05270	     DesiredFOV=75.000000
05271	     DefaultFOV=75.000000
05272	     HudTranslucency=0.750000
05273	     CdTrack=255
05274	     MyAutoAim=1.000000
05275	     PolyColorAdjust=(X=255.000000,Y=255.000000,Z=255.000000)
05276	     DesiredPolyColorAdjust=(X=255.000000,Y=255.000000,Z=255.000000)
05277	     bAlwaysMouseLook=True
05278	     bKeyboardLook=True
05279	     bMessageBeep=True
05280	     MouseSensitivity=3.000000
05281	     MouseSmoothThreshold=0.160000
05282	     MaxTimeMargin=3.000000
05283	     QuickSaveString="Quick Saving"
05284	     NoPauseMessage="Game is not pauseable"
05285	     ViewingFrom="Now viewing from "
05286	     OwnCamera="own camera"
05287	     FailedView="Failed to change view."
05288	     bIsPlayer=True
05289	     bCanJump=True
05290	     bViewTarget=True
05291	     DesiredSpeed=0.300000
05292	     SightRadius=4100.000000
05293	     LookDegPerSec=0.000000
05294	     bStasis=False
05295	     bTravel=True
05296	     RotationRate=(Pitch=0,Yaw=0,Roll=0)
05297	     NetPriority=3.000000
05298	}

End Source Code