daily pastebin goal
49%
SHARE
TWEET

DeusExPlayer.uc (Altered)

JivHiriel Dec 12th, 2016 15 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //=============================================================================
  2. // DeusExPlayer.
  3. //=============================================================================
  4. class DeusExPlayer extends PlayerPawnExt
  5.     native;
  6.  
  7. #exec OBJ LOAD FILE=Effects
  8.  
  9. // Name and skin assigned to PC by player on the Character Generation screen
  10. var travel String   TruePlayerName;
  11. var travel int      PlayerSkin;
  12.  
  13. // Combat Difficulty, set only at new game time
  14. var travel Float CombatDifficulty;
  15.  
  16. // Augmentation system vars
  17. var travel AugmentationManager AugmentationSystem;
  18.  
  19. // Skill system vars
  20. var travel SkillManager SkillSystem;
  21.  
  22. var() travel int SkillPointsTotal;
  23. var() travel int SkillPointsAvail;
  24.  
  25. // Credits (money) the player has
  26. var travel int Credits;
  27.  
  28. // Energy the player has
  29. var travel float Energy;
  30. var travel float EnergyMax;
  31. var travel float EnergyDrain;               // amount of energy left to drain
  32. var travel float EnergyDrainTotal;      // total amount of energy to drain
  33. var float MaxRegenPoint;     // in multiplayer, the highest that auto regen will take you
  34. var float RegenRate;         // the number of points healed per second in mp
  35.  
  36. // Keyring, used to store any keys the player picks up
  37. var travel NanoKeyRing KeyRing;     // Inventory Item
  38. var travel NanoKeyInfo KeyList;     // List of Keys
  39.  
  40. // frob vars
  41. var() float MaxFrobDistance;
  42. var Actor FrobTarget;
  43. var float FrobTime;
  44.  
  45. // HUD Refresh Timer
  46. var float LastRefreshTime;
  47.  
  48. // Conversation System Vars
  49. var ConPlay conPlay;                        // Conversation
  50. var DataLinkPlay dataLinkPlay;              // Used for DataLinks
  51. var travel ConHistory conHistory;           // Conversation History
  52.  
  53. // Inventory System Vars
  54. var travel byte             invSlots[30];       // 5x6 grid of inventory slots
  55. var int                     maxInvRows;         // Maximum number of inventory rows
  56. var int                     maxInvCols;         // Maximum number of inventory columns
  57. var travel Inventory        inHand;             // The current object in hand
  58. var travel Inventory        inHandPending;      // The pending item waiting to be put in hand
  59. var travel Inventory        ClientinHandPending; // Client temporary inhand pending, for mousewheel use.
  60. var travel Inventory        LastinHand;         // Last object inhand, so we can detect inhand changes on the client.
  61. var travel bool             bInHandTransition;  // The inHand is being swapped out
  62. // DEUS_EX AMSD  Whether to ignore inv slots in multiplayer
  63. var bool bBeltIsMPInventory;
  64.  
  65. // Goal Tracking
  66. var travel DeusExGoal FirstGoal;
  67. var travel DeusExGoal LastGoal;
  68.  
  69. // Note Tracking
  70. var travel DeusExNote FirstNote;
  71. var travel DeusExNote LastNote;
  72.  
  73. // Data Vault Images
  74. var travel DataVaultImage FirstImage;
  75.  
  76. // Log Messages
  77. var DeusExLog FirstLog;
  78. var DeusExLog LastLog;
  79.  
  80. // used by ViewModel
  81. var Actor ViewModelActor[8];
  82.  
  83. // DEUS_EX AMSD For multiplayer option propagation UGH!
  84. // In most cases options will sync on their own.  But for
  85. // initial loadout based on options, we need to send them to the
  86. // server.  Easiest thing to do is have a function at startup
  87. // that sends that info.
  88. var bool bFirstOptionsSynced;
  89. var bool bSecondOptionsSynced;
  90.  
  91. // used while crouching
  92. var travel bool bForceDuck;
  93. var travel bool bCrouchOn;              // used by toggle crouch
  94. var travel bool bWasCrouchOn;           // used by toggle crouch
  95. var travel byte lastbDuck;              // used by toggle crouch
  96.  
  97. // leaning vars
  98. var bool bCanLean;
  99. var float curLeanDist;
  100. var float prevLeanDist;
  101.  
  102. // toggle walk
  103. var bool bToggleWalk;
  104.  
  105. // communicate run silent value in multiplayer
  106. var float   RunSilentValue;
  107.  
  108. // cheats
  109. var bool  bWarrenEMPField;
  110. var float WarrenTimer;
  111. var int   WarrenSlot;
  112.  
  113. // used by lots of stuff
  114. var name FloorMaterial;
  115. var name WallMaterial;
  116. var Vector WallNormal;
  117.  
  118. // drug effects on the player
  119. var travel float drugEffectTimer;
  120.  
  121. // shake variables
  122. var float JoltMagnitude;  // magnitude of bounce imposed by heavy footstepsj
  123.  
  124. // poison dart effects on the player
  125. var float poisonTimer;      // time remaining before next poison TakeDamage
  126. var int   poisonCounter;    // number of poison TakeDamages remaining
  127. var int   poisonDamage;     // damage taken from poison effect
  128.  
  129. // bleeding variables
  130. var     float       BleedRate;      // how profusely the player is bleeding; 0-1
  131. var     float       DropCounter;    // internal; used in tick()
  132. var()   float       ClotPeriod;     // seconds it takes bleedRate to go from 1 to 0
  133.  
  134. var float FlashTimer; // How long it should take the current flash to fade.
  135.  
  136. // length of time player can stay underwater
  137. // modified by SkillSwimming, AugAqualung, and Rebreather
  138. var float swimDuration;
  139. var travel float swimTimer;
  140. var float swimBubbleTimer;
  141.  
  142. // conversation info
  143. var Actor ConversationActor;
  144. var Actor lastThirdPersonConvoActor;
  145. var float lastThirdPersonConvoTime;
  146. var Actor lastFirstPersonConvoActor;
  147. var float lastFirstPersonConvoTime;
  148.  
  149. var Bool bStartingNewGame;                          // Set to True when we're starting a new game.
  150. var Bool bSavingSkillsAugs;
  151.  
  152. // Put spy drone here instead of HUD
  153. var bool bSpyDroneActive;
  154. var int spyDroneLevel;
  155. var float spyDroneLevelValue;
  156. var SpyDrone aDrone;
  157.  
  158. // Buying skills for multiplayer
  159. var bool        bBuySkills;
  160.  
  161. // If player wants to see a profile of the killer in multiplayer
  162. var bool        bKillerProfile;
  163.  
  164. // Multiplayer notification messages
  165. const           MPFLAG_FirstSpot                = 0x01;
  166. const           MPSERVERFLAG_FirstPoison    = 0x01;
  167. const           MPSERVERFLAG_FirstBurn      = 0x02;
  168. const           MPSERVERFLAG_TurretInv      = 0x04;
  169. const           MPSERVERFLAG_CameraInv      = 0x08;
  170. const           MPSERVERFLAG_LostLegs       = 0x10;
  171. const           MPSERVERFLAG_DropItem       = 0x20;
  172. const           MPSERVERFLAG_NoCloakWeapon = 0x40;
  173.  
  174. const           mpMsgDelay = 4.0;
  175.  
  176. var int     mpMsgFlags;
  177. var int     mpMsgServerFlags;
  178.  
  179. const   MPMSG_TeamUnatco        =0;
  180. const   MPMSG_TeamNsf           =1;
  181. const   MPMSG_TeamHit           =2;
  182. const   MPMSG_TeamSpot          =3;
  183. const   MPMSG_FirstPoison       =4;
  184. const   MPMSG_FirstBurn     =5;
  185. const   MPMSG_TurretInv     =6;
  186. const   MPMSG_CameraInv     =7;
  187. const   MPMSG_CloseKills        =8;
  188. const   MPMSG_TimeNearEnd       =9;
  189. const   MPMSG_LostLegs          =10;
  190. const   MPMSG_DropItem          =11;
  191. const MPMSG_KilledTeammate =12;
  192. const MPMSG_TeamLAM         =13;
  193. const MPMSG_TeamComputer    =14;
  194. const MPMSG_NoCloakWeapon   =15;
  195. const MPMSG_TeamHackTurret  =16;
  196.  
  197. var int         mpMsgCode;
  198. var float       mpMsgTime;
  199. var int         mpMsgOptionalParam;
  200. var String      mpMsgOptionalString;
  201.  
  202. // Variables used when starting new game to show the intro first.
  203. var String      strStartMap;
  204. var travel Bool bStartNewGameAfterIntro;
  205. var travel Bool bIgnoreNextShowMenu;
  206.  
  207. // map that we're about to travel to after we finish interpolating
  208. var String NextMap;
  209.  
  210. // Configuration Variables
  211. var globalconfig bool bObjectNames;                 // Object names on/off
  212. var globalconfig bool bNPCHighlighting;             // NPC highlighting when new convos
  213. var globalconfig bool bSubtitles;                   // True if Conversation Subtitles are on
  214. var globalconfig bool bAlwaysRun;                   // True to default to running
  215. var globalconfig bool bToggleCrouch;                // True to let key toggle crouch
  216. var globalconfig float logTimeout;                  // Log Timeout Value
  217. var globalconfig byte  maxLogLines;                 // Maximum number of log lines visible
  218. var globalconfig bool bHelpMessages;                // Multiplayer help messages
  219.  
  220. // Overlay Options (TODO: Move to DeusExHUD.uc when serializable)
  221. var globalconfig byte translucencyLevel;            // 0 - 10?
  222. var globalconfig bool bObjectBeltVisible;
  223. var globalconfig bool bHitDisplayVisible;
  224. var globalconfig bool bAmmoDisplayVisible;
  225. var globalconfig bool bAugDisplayVisible;
  226. var globalconfig bool bDisplayAmmoByClip;
  227. var globalconfig bool bCompassVisible;
  228. var globalconfig bool bCrosshairVisible;
  229. var globalconfig bool bAutoReload;
  230. var globalconfig bool bDisplayAllGoals;
  231. var globalconfig bool bHUDShowAllAugs;              // TRUE = Always show Augs on HUD
  232. var globalconfig int  UIBackground;                 // 0 = Render 3D, 1 = Snapshot, 2 = Black
  233. var globalconfig bool bDisplayCompletedGoals;
  234. var globalconfig bool bShowAmmoDescriptions;
  235. var globalconfig bool bConfirmSaveDeletes;
  236. var globalconfig bool bConfirmNoteDeletes;
  237. var globalconfig bool bAskedToTrain;
  238.  
  239. // Multiplayer Playerspecific options
  240. var() globalconfig Name AugPrefs[9]; //List of aug preferences.
  241.  
  242. // Used to manage NPC Barks
  243. var travel BarkManager barkManager;
  244.  
  245. // Color Theme Manager, used to manage all the pretty
  246. // colors the player gets to play with for the Menus
  247. // and HUD windows.
  248.  
  249. var travel ColorThemeManager ThemeManager;
  250. var globalconfig String MenuThemeName;
  251. var globalconfig String HUDThemeName;
  252.  
  253. // Translucency settings for various UI Elements
  254. var globalconfig Bool bHUDBordersVisible;
  255. var globalconfig Bool bHUDBordersTranslucent;
  256. var globalconfig Bool bHUDBackgroundTranslucent;
  257. var globalconfig Bool bMenusTranslucent;
  258.  
  259. var localized String InventoryFull;
  260. var localized String TooMuchAmmo;
  261. var localized String TooHeavyToLift;
  262. var localized String CannotLift;
  263. var localized String NoRoomToLift;
  264. var localized String CanCarryOnlyOne;
  265. var localized String CannotDropHere;
  266. var localized String HandsFull;
  267. var localized String NoteAdded;
  268. var localized String GoalAdded;
  269. var localized String PrimaryGoalCompleted;
  270. var localized String SecondaryGoalCompleted;
  271. var localized String EnergyDepleted;
  272. var localized String AddedNanoKey;
  273. var localized String HealedPointsLabel;
  274. var localized String HealedPointLabel;
  275. var localized String SkillPointsAward;
  276. var localized String QuickSaveGameTitle;
  277. var localized String WeaponUnCloak;
  278. var localized String TakenOverString;
  279. var localized String    HeadString;
  280. var localized String    TorsoString;
  281. var localized String LegsString;
  282. var localized String WithTheString;
  283. var localized String WithString;
  284. var localized String PoisonString;
  285. var localized String BurnString;
  286. var localized String NoneString;
  287.  
  288. var ShieldEffect DamageShield; //visual damage effect for multiplayer feedback
  289. var float ShieldTimer; //for turning shield to fade.
  290. enum EShieldStatus
  291. {
  292.     SS_Off,
  293.     SS_Fade,
  294.     SS_Strong
  295. };
  296.  
  297. var EShieldStatus ShieldStatus;
  298.  
  299. var Pawn                    myBurner;
  300. var Pawn                    myPoisoner;
  301. var Actor               myProjKiller;
  302. var Actor               myTurretKiller;
  303. var Actor               myKiller;
  304. var KillerProfile       killProfile;
  305. var InvulnSphere        invulnSph;
  306.  
  307. // Conversation Invocation Methods
  308. enum EInvokeMethod
  309. {
  310.     IM_Bump,
  311.     IM_Frob,
  312.     IM_Sight,
  313.     IM_Radius,
  314.     IM_Named,
  315.     IM_Other
  316. };
  317.  
  318. enum EMusicMode
  319. {
  320.     MUS_Ambient,
  321.     MUS_Combat,
  322.     MUS_Conversation,
  323.     MUS_Outro,
  324.     MUS_Dying
  325. };
  326.  
  327. var EMusicMode musicMode;
  328. var byte savedSection;      // last section playing before interrupt
  329. var float musicCheckTimer;
  330. var float musicChangeTimer;
  331.  
  332. // Used to keep track of # of saves
  333. var travel int saveCount;
  334. var travel Float saveTime;
  335.  
  336. // for getting at the debug system
  337. var DebugInfo GlobalDebugObj;
  338.  
  339. // Set to TRUE if the player can see the quotes.  :)
  340. var globalconfig bool bQuotesEnabled;
  341.  
  342. // DEUS_EX AMSD For propagating gametype
  343. var GameInfo DXGame;
  344. var float    ServerTimeDiff;
  345. var float    ServerTimeLastRefresh;
  346.  
  347. // DEUS_EX AMSD For trying higher damage games
  348. var float MPDamageMult;
  349.  
  350. // Nintendo immunity
  351. var float   NintendoImmunityTime;
  352. var float   NintendoImmunityTimeLeft;
  353. var bool        bNintendoImmunity;
  354. const           NintendoDelay = 6.0;
  355.  
  356. // For closing comptuers if the server quits
  357. var Computers ActiveComputer;
  358.  
  359. var globalconfig bool bHDTP_JC;
  360. var globalconfig bool bHDTP_Walton, bHDTP_Anna, bHDTP_UNATCO, bHDTP_MJ12, bHDTP_NSF, bHDTP_RiotCop, bHDTP_Gunther, bHDTP_Paul, bHDTP_Nico;
  361. var globalconfig int bHDTP_ALL; //-1 = none, 0 = use other settings, 1 = all.
  362. var string HDTPMeshName;
  363. var string HDTPMeshTex[8];
  364.  
  365. //GMDX: CyberP & dasraiser
  366. //SAVEOUT
  367. var config int QuickSaveIndex; //out of some number
  368. var config int QuickSaveTotal;//this number
  369. var config bool bTogAutoSave;   //CyberP: enable/disable autosave
  370. var config int iQuickSaveLast;//index to last saved file
  371. var travel int QuickSaveLast;
  372. var travel int QuickSaveCurrent;
  373. var string     QuickSaveName;
  374. //hardcore mode
  375. var travel bool bHardCoreMode; //if set disable save game options.
  376. var bool bPendingHardCoreSave; //set this to active quicksave
  377. //misc
  378. var globalconfig bool bSkipNewGameIntro; //CyberP: for GMDX option menu
  379. var config bool bColorCodedAmmo;
  380. var config bool bExtraHardcore;
  381. var config bool bDecap;
  382. var config bool bNoTranslucency;
  383. var config bool bDblClickHolster;
  384. var config bool bHalveAmmo;
  385. var config bool bHardcoreUnlocked; //CyberP: unlock options once completed the game
  386. var config bool bAutoHolster;      //CyberP:auto-down weapon if right click deco
  387. var config bool bRealUI;
  388. var config bool bNoConsole;
  389. var config bool bHardcoreAI1;
  390. var config bool bHardcoreAI2;
  391. var config bool bHardcoreAI3;
  392. var config bool bAlternateToolbelt;
  393. var config bool bAnimBar1;
  394. var config bool bAnimBar2;
  395. var config bool bExtraObjectDetails;
  396. var config bool bA51Camera;
  397. var config bool bCameraSensors;
  398. var config bool bHardcoreFilterOption;
  399. var config bool bRealisticCarc;
  400. var config bool bLaserRifle;
  401. var config bool bRemoveVanillaDeath;
  402. var config bool bHitmarkerOn;
  403. var config bool bMantleOption;
  404. var config bool bUSP;
  405. var bool bThisMission; //CyberP: getting hacky in here.
  406. var travel int fullUp; //CyberP: eat/drink limit.
  407. var string fatty; //CyberP: eat/drink limit.
  408. var string noUsing;  //CyberP: left click interaction
  409. var bool bLeftClicked; //CyberP: left click interaction
  410. var bool bDrainAlert; //CyberP: alert if energy low
  411. var float bloodTime; //CyberP:
  412. var float hitmarkerTime;
  413. var float camInterpol;
  414. var travel bool bWasCrosshair;
  415. var bool bFromCrosshair;
  416. var transient bool bThrowDecoration;
  417. var int SlotMem; //CyberP: for belt/weapon switching, so the code remembers what weapon we had before holstering
  418. var int clickCountCyber; //CyberP: for double clicking to unequip
  419. var bool bStunted; //CyberP: for slowing player under various conditions
  420. var bool bRegenStamina; //CyberP: regen when in water but head above water
  421. var bool bCrouchRegen;  //CyberP: regen when crouched and has skill
  422. var bool bDoubleClickCheck; //CyberP: to return from double clicking.
  423. var travel Inventory assignedWeapon;
  424. var Inventory primaryWeapon;
  425. var float augEffectTime;
  426. var vector vecta;
  427. var rotator rota;
  428. //var bool bBoosty;  //CyberP: low-tech speed boost
  429. //Alias=LeanLeft,LeanRight
  430. //Aliases[18]=(Command="Button bLeanRightHook",Alias=LeanRH)
  431. //Aliases[19]=(Command="Button bLeanLeftHook",Alias=LeanLH)
  432. var transient bool bLeanKeysDefined;
  433. var travel int PerkNamesArray[34]; //CyberP: perk names
  434. var travel string BoughtPerks[34];
  435. var config color customColorsMenu[14]; //CyberP: custom color theme
  436. var config color customColorsHUD[14];
  437. var bool bTiptoes; //based on left+right lean
  438. var bool bCanTiptoes; //based on legs/crouch/can raise body
  439. var bool bIsTiptoes;
  440. var bool bPreTiptoes;
  441. var bool bLeftToe,bRightToe;
  442. var bool bRadarTran; //CyberP: radar trans effect
  443. var bool bCloakEnabled; //player is cloaked was class'DeusExWeapon'.default.this=T/F wow :)
  444. var transient bool bIsCloaked; //weapon is cloaked
  445. var int LightLevelDisplay; //CyberP: augIFF light value
  446. var travel Actor RocketTarget; //GEPDummyTarget (basic actor)
  447. var travel int advBelt;
  448. var travel float RocketTargetMaxDistance;
  449. var bool bGEPzoomActive;
  450. var bool bGEPprojectileInflight;//is projectile flighing
  451. var int GEPSkillLevel;
  452. var float GEPSkillLevelValue;
  453. var DeusExProjectile aGEPProjectile;//Fired projectile inflight
  454. var transient float GEPsteeringX,GEPsteeringY; //used for mouse input control
  455. var WeaponGEPGun GEPmounted;
  456.  
  457.  
  458. //Recoil shockwave
  459.  
  460. var() vector RecoilSimLimit; //plus/minus
  461. var() float RecoilDrain;
  462. var vector RecoilShake;
  463.  
  464. var vector RecoilDesired;//lerp to this
  465. var float RecoilTime; //amount of lerp shake before desired set to 0
  466.  
  467. var rotator SAVErotation;
  468. var vector SAVElocation;
  469. var bool bStaticFreeze;
  470.  
  471. //////////END GMDX
  472.  
  473. // native Functions
  474. native(1099) final function string GetDeusExVersion();
  475. native(2100) final function ConBindEvents();
  476. native(3001) final function name SetBoolFlagFromString(String flagNameString, bool bValue);
  477. native(3002) final function ConHistory CreateHistoryObject();
  478. native(3003) final function ConHistoryEvent CreateHistoryEvent();
  479. native(3010) final function DeusExLog CreateLogObject();
  480. native(3011) final function SaveGame(int saveIndex, optional String saveDesc);
  481. native(3012) final function DeleteSaveGameFiles(optional String saveDirectory);
  482. native(3013) final function GameDirectory CreateGameDirectoryObject();
  483. native(3014) final function DataVaultImageNote CreateDataVaultImageNoteObject();
  484. native(3015) final function DumpLocation CreateDumpLocationObject();
  485. native(3016) final function UnloadTexture(Texture texture);
  486. //native 3017 taken by particleiterator.
  487.  
  488. //
  489. // network replication
  490. //
  491. replication
  492. {
  493.     // server to client
  494.     reliable if ((Role == ROLE_Authority) && (bNetOwner))
  495.         AugmentationSystem, SkillSystem, SkillPointsTotal, SkillPointsAvail, inHand, inHandPending, KeyRing, Energy,
  496.           bSpyDroneActive, DXGame, bBuySkills, drugEffectTimer, killProfile;
  497.  
  498.     reliable if (Role == ROLE_Authority)
  499.        ShieldStatus, RunSilentValue, aDrone, NintendoImmunityTimeLeft;
  500.  
  501.     // client to server
  502.     reliable if (Role < ROLE_Authority)
  503.         BarkManager, FrobTarget, AugPrefs, bCanLean, curLeanDist, prevLeanDist,
  504.         bInHandTransition, bForceDuck, FloorMaterial, WallMaterial, WallNormal, swimTimer, swimDuration;
  505.  
  506.     // Functions the client can call
  507.     reliable if (Role < ROLE_Authority)
  508.         DoFrob, ParseLeftClick, ParseRightClick, ReloadWeapon, PlaceItemInSlot, RemoveItemFromSlot, ClearInventorySlots,
  509.       SetInvSlots, FindInventorySlot, ActivateBelt, DropItem, SetInHand, AugAdd, ExtinguishFire, CatchFire,
  510.       AllEnergy, ClearPosition, ClearBelt, AddObjectToBelt, RemoveObjectFromBelt, TeamSay,
  511.       KeypadRunUntriggers, KeypadRunEvents, KeypadToggleLocks, ReceiveFirstOptionSync, ReceiveSecondOptionSync,CreateDrone, MoveDrone,
  512.       CloseComputerScreen, SetComputerHackTime, UpdateCameraRotation, ToggleCameraState,
  513.       SetTurretTrackMode, SetTurretState, NewMultiplayerMatch, PopHealth, ServerUpdateLean, BuySkills, PutInHand,
  514.       MakeCameraAlly, PunishDetection, ServerSetAutoReload, FailRootWindowCheck, FailConsoleCheck, ClientPossessed;
  515.  
  516.     // Unreliable functions the client can call
  517.     unreliable if (Role < ROLE_Authority)
  518.       MaintainEnergy, UpdateTranslucency;
  519.  
  520.     // Functions the server calls in client
  521.     reliable if ((Role == ROLE_Authority) && (bNetOwner))
  522.       UpdateAugmentationDisplayStatus, AddAugmentationDisplay, RemoveAugmentationDisplay, ClearAugmentationDisplay, ShowHud,
  523.         ActivateKeyPadWindow, SetDamagePercent, SetServerTimeDiff, ClientTurnOffScores;
  524.  
  525.     reliable if (Role == ROLE_Authority)
  526.       InvokeComputerScreen, ClientDeath, AddChargedDisplay, RemoveChargedDisplay, MultiplayerDeathMsg, MultiplayerNotifyMsg,
  527.       BuySkillSound, ShowMultiplayerWin, ForceDroneOff ,AddDamageDisplay, ClientSpawnHits, CloseThisComputer, ClientPlayAnimation, ClientSpawnProjectile, LocalLog,
  528.       VerifyRootWindow, VerifyConsole, ForceDisconnect;
  529.  
  530. }
  531.  
  532. exec function cheat()
  533. {
  534.     if (bHardCoreMode) bCheatsEnabled = false;
  535.     else bCheatsEnabled = !bCheatsEnabled;
  536.  
  537. }
  538.  
  539. function UpdateHDTPsettings()
  540. {
  541.     local mesh tempmesh;
  542.     local texture temptex;
  543.     local int i;
  544.  
  545.     if(GetHDTPSettings(self)) //lol recursive
  546.     {
  547.         if(HDTPMeshname != "")
  548.         {
  549.             tempmesh = lodmesh(dynamicloadobject(HDTPMeshname,class'mesh',true));
  550.             if(tempmesh != none)
  551.             {
  552.                 mesh = tempmesh;
  553.                 for(i=0;i<=7;i++)
  554.                 {
  555.                     if(HDTPMeshtex[i] != "")
  556.                     {
  557.                         temptex = texture(dynamicloadobject(HDTPMeshtex[i],class'texture',true));
  558.                         if(temptex != none)
  559.                             multiskins[i] = temptex;
  560.                     }
  561.                 }
  562.             }
  563.         }
  564.     }
  565.     else
  566.     {
  567.         mesh = default.mesh;
  568.         for(i=0; i<=7;i++)
  569.         {
  570.             multiskins[i]=default.multiskins[i];
  571.         }
  572.     }
  573. }
  574.  
  575. function bool GetHDTPSettings(actor Other)
  576. {
  577.     if(bHDTP_ALL > 0)
  578.         return true;
  579.     else if(bHDTP_All < 0)
  580.         return false;
  581.     else
  582.     {
  583.         if((Other.IsA('JCDentonMaleCarcass') || Other.IsA('JCDouble') || Other.IsA('JCDentonMale')) && bHDTP_JC)     //changed self to JCdentonmale for hopefully better mod compatibility
  584.             return true;
  585.         //if((Other.IsA('MJ12Troop') || Other.IsA('MJ12TroopCarcass')) && bHDTP_MJ12)
  586.         //  return true;
  587.         else if((Other.IsA('UNATCOTroop') || Other.IsA('UNATCOTroopCarcass')) && bHDTP_UNATCO)
  588.             return true;
  589.         else if((Other.IsA('WaltonSimons') || Other.IsA('WaltonSimonsCarcass')) && bHDTP_WALTON)
  590.             return true;
  591.         else if((Other.IsA('AnnaNavarre') || Other.IsA('AnnaNavarreCarcass')) && bHDTP_Anna)
  592.             return true;
  593.         else if((Other.IsA('GuntherHermann') || Other.IsA('GuntherHermannCarcass')) && bHDTP_Gunther)
  594.             return true;
  595.         else if((Other.IsA('RiotCop') || Other.IsA('RiotCopCarcass')) && bHDTP_RiotCop)
  596.             return true;
  597.         else if((Other.IsA('Terrorist') || Other.IsA('TerroristCarcass')) && bHDTP_NSF)
  598.             return true;
  599.         else if((Other.IsA('PaulDenton') || Other.IsA('PaulDentonCarcass')) && bHDTP_Paul)
  600.             return true;
  601.         else if((Other.IsA('NicoletteDuClare') || Other.IsA('NicoletteDuClareCarcass')) && bHDTP_Nico)
  602.             return true;
  603.         else
  604.             return false;
  605.     }
  606.     return false;
  607. }
  608.  
  609. function setupDifficultyMod() //CyberP: Lazy scale based on difficulty. To find all things modified by difficulty level in
  610. {                             //CyberP: GMDX, search CombatDifficulty & bHardCoreMode.
  611. local ScriptedPawn P;         //CyberP: WARNING: is called every login. TODO: call only once per map.
  612. local ThrownProjectile TP;
  613. local AutoTurret       T;
  614. local SecurityCamera   SC;
  615. local DeusExWeapon     WP;
  616. local DeusExAmmo       AM;
  617. local DeusExMover      MV;
  618. local Keypad           KP;
  619.  
  620. log("bHardCoreMode =" @bHardCoreMode);
  621. log("CombatDifficulty =" @CombatDifficulty);
  622.  
  623.      if (bHDTP_All != -1)
  624.       bHDTP_All=-1;
  625.  
  626.      bStunted = False; //CyberP: failsafe
  627.  
  628.      ForEach AllActors(class'ScriptedPawn', P)
  629.      {
  630.       if (P.bHardcoreOnly == True && bHardCoreMode == False && bHardcoreFilterOption == False)  //CyberP: remove this pawn if we are not hardcore
  631.           P.Destroy();
  632.       if (P.IsA('HumanMilitary') || P.IsA('HumanThug'))
  633.       {
  634.          if (!bHardCoreMode && CombatDifficulty > 1)
  635.          {
  636.          if (P.HearingThreshold < 0.135000)
  637.          P.HearingThreshold = 0.135000;
  638.          if (P.SurprisePeriod < 1.250000)
  639.          P.SurprisePeriod = 1.250000;
  640.          if (P.VisibilityThreshold < 0.005500)
  641.          P.VisibilityThreshold = 0.005500;
  642.          if (P.EnemyTimeout > 10.000000)
  643.          P.EnemyTimeout = 10.000000;
  644.          }
  645.          else if (CombatDifficulty <= 1)
  646.          {
  647.          if (P.VisibilityThreshold < 0.010000)
  648.          P.VisibilityThreshold = 0.010000;
  649.          if (P.HearingThreshold < 0.150000)
  650.          P.HearingThreshold = 0.150000;
  651.          if (P.EnemyTimeout > 8.000000)
  652.          P.EnemyTimeout = 8.000000;
  653.          if (P.SurprisePeriod < 2.000000)
  654.          P.SurprisePeriod = 2.0;
  655.          }
  656.          else if (bHardCoreMode)
  657.          {
  658.          if (P.BaseAccuracy != 0.000000 && P.BaseAccuracy > 0.050000) //CyberP: all Human Military are more accurate on hardcore mode.
  659.          P.BaseAccuracy=0.050000;
  660.          if (P.bDefendHome && P.HomeExtent < 64)
  661.          P.EnemyTimeOut = 22.000000;  //CyberP: camp for longer
  662.          if (P.SurprisePeriod > 0.75)
  663.          P.SurprisePeriod = 0.75;
  664.          }
  665.       }
  666.       else if (P.IsA('Robot'))
  667.       {
  668.          if (bHardCoreMode)
  669.            P.EnemyTimeout = 16.000000;
  670.          else
  671.            P.EnemyTimeout = 10.000000;
  672.       }
  673.       if ((P.IsA('MJ12Troop') || P.IsA('MJ12Elite')) && (P.bHasCloak || P.UnfamiliarName == "MJ12 Elite" ))
  674.       {
  675.         if (bHardCoreMode)
  676.         {
  677.         P.default.Health=350;
  678.         P.default.HealthHead=350;
  679.         P.default.HealthTorso=350;
  680.         P.default.HealthLegLeft=350;
  681.         P.default.HealthLegRight=350;
  682.         P.default.HealthArmLeft=350;
  683.         P.default.HealthArmRight=350;
  684.         P.Health=350;
  685.         P.HealthHead=350;
  686.         P.HealthTorso=350;
  687.         P.HealthLegLeft=350;
  688.         P.HealthLegRight=350;
  689.         P.HealthArmLeft=350;
  690.         P.HealthArmRight=350;
  691.         P.CloakThreshold=140;
  692.         P.GroundSpeed=260.000000;
  693.         }
  694.         else
  695.         {
  696.         P.default.Health=200;
  697.         P.default.HealthHead=200;
  698.         P.default.HealthTorso=200;
  699.         P.default.HealthLegLeft=200;
  700.         P.default.HealthLegRight=200;
  701.         P.default.HealthArmLeft=200;
  702.         P.default.HealthArmRight=200;
  703.         P.Health=200;
  704.         P.HealthHead=200;
  705.         P.HealthTorso=200;
  706.         P.HealthLegLeft=200;
  707.         P.HealthLegRight=200;
  708.         P.HealthArmLeft=200;
  709.         P.HealthArmRight=200;
  710.         P.CloakThreshold=100;
  711.         P.GroundSpeed=240.000000;
  712.         P.SurprisePeriod=1.000000;
  713.         }
  714.       }
  715.       else if (P.IsA('MJ12Commando'))
  716.       {
  717.          if (bHardCoreMode)
  718.         {
  719.         P.default.Health=450;
  720.         P.default.HealthHead=450;
  721.         P.default.HealthTorso=450;
  722.         P.default.HealthLegLeft=450;
  723.         P.default.HealthLegRight=450;
  724.         P.default.HealthArmLeft=450;
  725.         P.default.HealthArmRight=450;
  726.         P.Health=450;
  727.         P.HealthHead=450;
  728.         P.HealthTorso=450;
  729.         P.HealthLegLeft=450;
  730.         P.HealthLegRight=450;
  731.         P.HealthArmLeft=450;
  732.         P.HealthArmRight=450;
  733.         P.VisibilityThreshold=0.001000;
  734.         }
  735.         else
  736.         {
  737.         P.default.Health=300;
  738.         P.default.HealthHead=300;
  739.         P.default.HealthTorso=300;
  740.         P.default.HealthLegLeft=300;
  741.         P.default.HealthLegRight=300;
  742.         P.default.HealthArmLeft=300;
  743.         P.default.HealthArmRight=300;
  744.         P.Health=300;
  745.         P.HealthHead=300;
  746.         P.HealthTorso=300;
  747.         P.HealthLegLeft=300;
  748.         P.HealthLegRight=300;
  749.         P.HealthArmLeft=300;
  750.         P.HealthArmRight=300;
  751.         P.VisibilityThreshold=0.004000;
  752.         }
  753.       }
  754.       else if (P.IsA('MIB'))
  755.       {
  756.          if (!bHardCoreMode && P.GroundSpeed>P.default.GroundSpeed)
  757.         {
  758.          P.GroundSpeed=360.000000;
  759.           P.default.Health=450;
  760.          P.default.HealthHead=450;
  761.          P.default.HealthTorso=450;
  762.          P.default.HealthLegLeft=450;
  763.          P.default.HealthLegRight=450;
  764.          P.default.HealthArmLeft=450;
  765.          P.default.HealthArmRight=450;
  766.          P.Health=450;
  767.          P.HealthHead=450;
  768.           P.HealthTorso=450;
  769.          P.HealthLegLeft=450;
  770.          P.HealthLegRight=450;
  771.          P.HealthArmLeft=450;
  772.          P.HealthArmRight=450;
  773.         }
  774.       }
  775.       else if (P.IsA('WaltonSimons'))
  776.       {
  777.          if (!bHardCoreMode)
  778.          {
  779.           P.GroundSpeed=360.000000;
  780.           P.default.Health=700;
  781.          P.default.HealthHead=700;
  782.          P.default.HealthTorso=700;
  783.          P.default.HealthLegLeft=700;
  784.          P.default.HealthLegRight=700;
  785.          P.default.HealthArmLeft=700;
  786.          P.default.HealthArmRight=700;
  787.          P.Health=700;
  788.          P.HealthHead=700;
  789.           P.HealthTorso=700;
  790.          P.HealthLegLeft=700;
  791.          P.HealthLegRight=700;
  792.          P.HealthArmLeft=700;
  793.          P.HealthArmRight=700;
  794.          }
  795.       }
  796.       else if (P.IsA('Gray'))
  797.       {
  798.         if (bHardCoreMode == False)
  799.         {
  800.         P.default.Health=250;
  801.         P.default.HealthHead=250;
  802.         P.default.HealthTorso=250;
  803.         P.default.HealthLegLeft=250;
  804.         P.default.HealthLegRight=250;
  805.         P.default.HealthArmLeft=250;
  806.        P.default.HealthArmRight=250;
  807.         P.Health=250;
  808.          P.HealthHead=250;
  809.          P.HealthTorso=250;
  810.           P.HealthLegLeft=200;
  811.           P.HealthLegRight=250;
  812.           P.HealthArmLeft=250;
  813.           P.HealthArmRight=250;
  814.           }
  815.       }
  816.     }
  817.  
  818.     if (bHardCoreMode == False)
  819.     {
  820.     ForEach AllActors(class'ThrownProjectile', TP)
  821.     {
  822.             if (TP.bNoHardcoreFilter == True) //CyberP: destroy this bomb if we are not hardcore
  823.             {
  824.                 TP.Destroy();
  825.             }
  826.             else
  827.                 TP.proxRadius=156.000000;  //Also lower radius if not hardcore
  828.     }
  829.     }
  830.     else
  831.     {
  832.     ForEach AllActors(class'DeusExAmmo', AM)
  833.     {
  834.        if (AM.Owner == None)
  835.        {
  836.             if (AM.IsA('AmmoDartTaser'))
  837.              AM.AmmoAmount = 1;
  838.             else if (AM.IsA('Ammo20mmEMP'))
  839.              AM.AmmoAmount = 1;
  840.             else if (AM.IsA('Ammo20mm'))
  841.              AM.AmmoAmount = 2;
  842.        }
  843.     }
  844.     /*ForEach AllActors(class'DeusExMover', MV)
  845.     {
  846.             if (MV.lockStrength < 0.8 && MV.bPickable)
  847.              MV.lockStrength += 0.1;
  848.             if (MV.bBreakable && MV.DamageThreshold < 90)
  849.              MV.DamageThreshold += 10;
  850.     }
  851.     ForEach AllActors(class'Keypad', KP)
  852.     {
  853.             if (KP.bHackable && KP.hackStrength < 0.8)
  854.              KP.hackStrength += 0.1;
  855.     } */
  856.     }
  857.  
  858.     if (bLaserRifle == False)
  859.     {
  860.     ForEach AllActors(class'DeusExWeapon', WP)
  861.     {
  862.             if (WP.ItemName == "Laser Rifle") //CyberP: destroy it
  863.                 WP.Destroy();
  864.     }
  865.     }
  866.  
  867.     if (bUSP == False)
  868.     {
  869.     ForEach AllActors(class'DeusExWeapon', WP)
  870.     {
  871.              if (WP.ItemName == "USP.10")
  872.                 WP.Destroy();
  873.     }
  874.     }
  875.  
  876.     ForEach AllActors(class'AutoTurret', T)
  877.     {
  878.             if (CombatDifficulty <= 1.5)
  879.             {
  880.                 T.maxRange=2000;
  881.                 T.default.maxRange=2000;
  882.             }
  883.             else
  884.             {
  885.                 T.maxRange=4000;
  886.                 T.default.maxRange=4000;
  887.             }
  888.     }
  889.  
  890.     ForEach AllActors(class'SecurityCamera', SC)
  891.     {
  892.             if (CombatDifficulty < 3.0)
  893.             {
  894.                 SC.hackStrength=0.100000;
  895.                 SC.cameraRange = 1024;
  896.                 SC.default.cameraRange = 1024;
  897.                 if (SC.swingPeriod < 9.0)
  898.                   SC.swingPeriod+=3.0;
  899.             }
  900.             if (bHardcoreMode)
  901.                 SC.hackStrength=0.250000;
  902.             else
  903.                 SC.hackStrength=0.150000;
  904.             if (bA51Camera)
  905.             {
  906.                 SC.hackStrength=0.500000;
  907.                 SC.HitPoints=150;
  908.                 SC.minDamageThreshold=80;
  909.             }
  910.     }
  911. }
  912.  
  913. // ----------------------------------------------------------------------
  914. // PostBeginPlay()
  915. //
  916. // set up the augmentation and skill systems
  917. // ----------------------------------------------------------------------
  918.  
  919. function PostBeginPlay()
  920. {
  921.     local DeusExLevelInfo info;
  922.     local int levelInfoCount;
  923.     local float mult;
  924.  
  925.     Super.PostBeginPlay();
  926.  
  927.     class'DeusExPlayer'.default.DefaultFOV=DefaultFOV;
  928.     class'DeusExPlayer'.default.DesiredFOV=DesiredFOV;
  929.  
  930.     // Check to make sure there's only *ONE* DeusExLevelInfo and
  931.     // go fucking *BOOM* if we find more than one.
  932.  
  933.     levelInfoCount = 0;
  934.     foreach AllActors(class'DeusExLevelInfo', info)
  935.         levelInfoCount++;
  936.  
  937.     Assert(levelInfoCount <= 1);
  938.  
  939.     // give us a shadow
  940.     if (Level.Netmode == NM_Standalone)
  941.       CreateShadow();
  942.  
  943.     InitializeSubSystems();
  944.     DXGame = Level.Game;
  945.     ShieldStatus = SS_Off;
  946.     ServerTimeLastRefresh = 0;
  947.     if (bHDTP_All != -1)
  948.       bHDTP_All=-1;    //CyberP: no HDTP characters for a number of reasons.
  949.     // Safeguard so no cheats in multiplayer
  950.     if ( Level.NetMode != NM_Standalone )
  951.         bCheatsEnabled = False;
  952.     HDTP();
  953.  
  954. // SAVEOUT
  955.  
  956.     //QuickSaveCurrent=int(ConsoleCommand("get DeusEx.JCDentonMale QuickSaveIndex"));
  957.     //QuickSaveLast=int(ConsoleCommand("get DeusEx.JCDentonMale iQuickSaveLast"));
  958.  
  959.     QuickSaveCurrent=QuickSaveIndex;
  960.     QuickSaveLast=iQuickSaveLast;
  961.  
  962.     log("MYCHK::"@QuickSaveCurrent@"::"@QuickSaveLast);
  963.  
  964.     bWasCrosshair=bCrosshairVisible;
  965.  
  966.     RefreshLeanKeys();
  967.  
  968. }
  969.  
  970. function ServerSetAutoReload( bool bAuto )
  971. {
  972.     bAutoReload = bAuto;
  973. }
  974.  
  975. // ----------------------------------------------------------------------
  976.  
  977. function SetServerTimeDiff( float sTime )
  978. {
  979.     ServerTimeDiff = (sTime - Level.Timeseconds);
  980. }
  981.  
  982. // ----------------------------------------------------------------------
  983. // PostNetBeginPlay()
  984. //
  985. // Take care of the theme manager
  986. // ----------------------------------------------------------------------
  987.  
  988. simulated function PostNetBeginPlay()
  989. {
  990.     Super.PostNetBeginPlay();
  991.  
  992.     if (Role == ROLE_SimulatedProxy)
  993.     {
  994.       DrawShield();
  995.       CreatePlayerTracker();
  996.         if ( NintendoImmunityTimeLeft > 0.0 )
  997.             DrawInvulnShield();
  998.       return;
  999.     }
  1000.  
  1001.     //DEUS_EX AMSD In multiplayer, we need to do this for our local theme manager, since
  1002.     //PostBeginPlay isn't called to set these up, and the Thememanager can be local, it
  1003.     //doesn't have to sync with the server.
  1004.     if (ThemeManager == NONE)
  1005.     {
  1006.         CreateColorThemeManager();
  1007.         ThemeManager.SetOwner(self);
  1008.         ThemeManager.SetCurrentHUDColorTheme(ThemeManager.GetFirstTheme(1));
  1009.         ThemeManager.SetCurrentMenuColorTheme(ThemeManager.GetFirstTheme(0));
  1010.         ThemeManager.SetMenuThemeByName(MenuThemeName);
  1011.         ThemeManager.SetHUDThemeByName(HUDThemeName);
  1012.         if (DeusExRootWindow(rootWindow) != None)
  1013.            DeusExRootWindow(rootWindow).ChangeStyle();
  1014.     }
  1015.     ReceiveFirstOptionSync(AugPrefs[0], AugPrefs[1], AugPrefs[2], AugPrefs[3], AugPrefs[4]);
  1016.     ReceiveSecondOptionSync(AugPrefs[5], AugPrefs[6], AugPrefs[7], AugPrefs[8]);
  1017.     ShieldStatus = SS_Off;
  1018.     bCheatsEnabled = False;
  1019.  
  1020.      ServerSetAutoReload( bAutoReload );
  1021. }
  1022.  
  1023. // ----------------------------------------------------------------------
  1024. // InitializeSubSystems()
  1025. // ----------------------------------------------------------------------
  1026.  
  1027. function InitializeSubSystems()
  1028. {
  1029.     // Spawn the BarkManager
  1030.     if (BarkManager == None)
  1031.         BarkManager = Spawn(class'BarkManager', Self);
  1032.  
  1033.     // Spawn the Color Manager
  1034.     CreateColorThemeManager();
  1035.     ThemeManager.SetOwner(self);
  1036.  
  1037.     // install the augmentation system if not found
  1038.     if (AugmentationSystem == None)
  1039.     {
  1040.         AugmentationSystem = Spawn(class'AugmentationManager', Self);
  1041.         AugmentationSystem.CreateAugmentations(Self);
  1042.         AugmentationSystem.AddDefaultAugmentations();
  1043.         AugmentationSystem.SetOwner(Self);
  1044.     }
  1045.     else
  1046.     {
  1047.         AugmentationSystem.SetPlayer(Self);
  1048.         AugmentationSystem.SetOwner(Self);
  1049.     }
  1050.  
  1051.     // install the skill system if not found
  1052.     if (SkillSystem == None)
  1053.     {
  1054.         SkillSystem = Spawn(class'SkillManager', Self);
  1055.         SkillSystem.CreateSkills(Self);
  1056.     }
  1057.     else
  1058.     {
  1059.         SkillSystem.SetPlayer(Self);
  1060.     }
  1061.  
  1062.     if ((Level.Netmode == NM_Standalone) || (!bBeltIsMPInventory))
  1063.     {
  1064.       // Give the player a keyring
  1065.       CreateKeyRing();
  1066.     }
  1067. }
  1068.  
  1069. // ----------------------------------------------------------------------
  1070. // PostPostBeginPlay()
  1071. // ----------------------------------------------------------------------
  1072.  
  1073. function PostPostBeginPlay()
  1074. {
  1075.  
  1076.  
  1077.     Super.PostPostBeginPlay();
  1078.  
  1079.     // Bind any conversation events to this DeusExPlayer
  1080.     ConBindEvents();
  1081.  
  1082.     // Restore colors that the user selected (as opposed to those
  1083.     // stored in the savegame)
  1084.     ThemeManager.SetMenuThemeByName(MenuThemeName);
  1085.     ThemeManager.SetHUDThemeByName(HUDThemeName);
  1086.  
  1087.  
  1088.  
  1089.  
  1090.  
  1091.     if ((Level.NetMode != NM_Standalone) && ( killProfile == None ))
  1092.         killProfile = Spawn(class'KillerProfile', Self);
  1093. }
  1094.  
  1095. // ----------------------------------------------------------------------
  1096. // PreTravel() - Called when a ClientTravel is about to happen
  1097. // ----------------------------------------------------------------------
  1098.  
  1099. function PreTravel()
  1100. {
  1101.     // Set a flag designating that we're traveling,
  1102.     // so MissionScript can check and not call FirstFrame() for this map.
  1103.  
  1104. //   log("MYCHK:PreTravel:"@self);
  1105.  
  1106.     flagBase.SetBool('PlayerTraveling', True, True, 0);
  1107.  
  1108.     SaveSkillPoints();
  1109.  
  1110.     if (dataLinkPlay != None)
  1111.         dataLinkPlay.AbortAndSaveHistory();
  1112.  
  1113.     // If the player is burning (Fire! Fire!), extinguish him
  1114.     // before the map transition.  This is done to fix stuff
  1115.     // that's fucked up.
  1116.     ExtinguishFire();
  1117. }
  1118.  
  1119. // ----------------------------------------------------------------------
  1120. // TravelPostAccept()
  1121. // ----------------------------------------------------------------------
  1122.  
  1123. event TravelPostAccept()
  1124. {
  1125.     local DeusExLevelInfo info;
  1126.     local MissionScript scr;
  1127.     local bool bScriptRunning;
  1128.     local InterpolationPoint I;
  1129.     local SavePoint SP;
  1130.     local rotator rofs;
  1131.  
  1132.     //local WeaponGEPGun gepTest;
  1133.     local vector ofst;
  1134.  
  1135.     Super.TravelPostAccept();
  1136.  
  1137.  
  1138.     // reset the keyboard
  1139.     ResetKeyboard();
  1140.  
  1141.     RefreshLeanKeys();
  1142.  
  1143.     info = GetLevelInfo();
  1144.  
  1145. //   log("MYCHK:PostTravel: ,"@info.Name);
  1146.  
  1147.     if (info != None)
  1148.     {
  1149.         // hack for the DX.dx logo/splash level
  1150.         if (info.MissionNumber == -2)
  1151.         {
  1152.             foreach AllActors(class 'InterpolationPoint', I, 'IntroCam')
  1153.             {
  1154.                 if (I.Position == 1)
  1155.                 {
  1156.                     SetCollision(False, False, False);
  1157.                     bCollideWorld = False;
  1158.                     Target = I;
  1159.                     SetPhysics(PHYS_Interpolating);
  1160.                     PhysRate = 1.0;
  1161.                     PhysAlpha = 0.0;
  1162.                     bInterpolating = True;
  1163.                     bStasis = False;
  1164.                     ShowHud(False);
  1165.                     PutInHand(None);
  1166.                     GotoState('Interpolating');
  1167.                     break;
  1168.                 }
  1169.             }
  1170.             return;
  1171.         }
  1172.  
  1173.         if (info.MapName == "14_OceanLab_silo" || info.MapName == "06_HongKong_Canal" || info.missionNumber == 15)
  1174.         bThisMission=true;
  1175.         else
  1176.         bThisMission=false;
  1177.  
  1178.         // hack for the DXOnly.dx splash level
  1179.         if (info.MissionNumber == -1)
  1180.         {
  1181.             ShowHud(False);
  1182.             GotoState('Paralyzed');
  1183.             return;
  1184.         }
  1185.     }
  1186.  
  1187.     // Restore colors
  1188.     if (ThemeManager != None)
  1189.     {
  1190.         ThemeManager.SetMenuThemeByName(MenuThemeName);
  1191.         ThemeManager.SetHUDThemeByName(HUDThemeName);
  1192.     }
  1193.  
  1194.     // Make sure any charged pickups that were active
  1195.     // before travelling are still active.
  1196.     RefreshChargedPickups();
  1197.  
  1198.     // Make sure the Skills and Augmentation systems
  1199.     // are properly initialized and reset.
  1200.  
  1201.     RestoreSkillPoints();
  1202.  
  1203.     if (SkillSystem != None)
  1204.     {
  1205.         SkillSystem.SetPlayer(Self);
  1206.     }
  1207.  
  1208.     if (AugmentationSystem != None)
  1209.     {
  1210.         // set the player correctly
  1211.         AugmentationSystem.SetPlayer(Self);
  1212.         AugmentationSystem.RefreshAugDisplay();
  1213.     }
  1214.  
  1215.     // Nuke any existing conversation
  1216.     if (conPlay != None)
  1217.         conPlay.TerminateConversation();
  1218.  
  1219.     HDTP();
  1220.     // Make sure any objects that care abou the PlayerSkin
  1221.     // are notified
  1222.     UpdatePlayerSkin();
  1223.  
  1224.     // If the player was carrying a decoration,
  1225.     // call TravelPostAccept() so it can initialize itself
  1226.     if (CarriedDecoration != None)
  1227.         CarriedDecoration.TravelPostAccept();
  1228.  
  1229.     // If the player was carrying a decoration, make sure
  1230.     // it's placed back in his hand (since the location
  1231.     // info won't properly travel)
  1232.     PutCarriedDecorationInHand();
  1233.  
  1234.     // Reset FOV
  1235.     SetFOVAngle(Default.DesiredFOV);
  1236.  
  1237.     // If the player had a scope view up, make sure it's
  1238.     // properly restore
  1239.     RestoreScopeView();
  1240.  
  1241.     // make sure the mission script has been spawned correctly
  1242.     if (info != None)
  1243.     {
  1244.         bScriptRunning = False;
  1245.         foreach AllActors(class'MissionScript', scr)
  1246.             bScriptRunning = True;
  1247.  
  1248.         if (!bScriptRunning)
  1249.             info.SpawnScript();
  1250.     }
  1251.  
  1252.     // make sure the player's eye height is correct
  1253.     BaseEyeHeight = CollisionHeight - (GetDefaultCollisionHeight() - Default.BaseEyeHeight);
  1254.  
  1255.     //GMDX
  1256.  
  1257.     foreach AllActors(class'SavePoint',SP)
  1258.     {
  1259.       if ((!bHardCoreMode)||(SP.bUsedSavePoint))
  1260.          SP.Destroy();
  1261.     }
  1262.     //ConsoleCommand("set ini:Engine.Engine.ViewportManager Brightness 1");
  1263.  
  1264.     if (bHardCoreMode)
  1265.     {
  1266.       bCheatsEnabled=false;
  1267.       bAutoReload=false;
  1268.     }
  1269.  
  1270.     setupDifficultyMod(); //CyberP: set difficulty modifiers
  1271. //set gep tracking
  1272.     if (RocketTarget==none)
  1273.        RocketTarget=spawn(class'DeusEx.GEPDummyTarget');
  1274.  
  1275.     SetRocketWireControl();
  1276.  
  1277.     //end GMDX
  1278. }
  1279. //GMDX: set up mounted gep spawn, as no matter what i try it still draws it on spawn :/
  1280. function SpawnGEPmounted(bool mountIt)
  1281. {
  1282.     if (mountIt)
  1283.     {
  1284.         if ((Weapon!=none)&&(Weapon.IsA('WeaponGEPGun')))
  1285.         {
  1286.             GEPmounted=WeaponGEPGun(Weapon);
  1287.             GEPmounted.SetMount(self);
  1288.         } else
  1289.             log("ERROR: GEP gun in zoom but GEP not in hand");
  1290.     } else
  1291.     {
  1292.         GEPmounted.SetMount(none);
  1293.       // GEPmounted=none;
  1294.     }
  1295.     /*if (GEPmounted!=none) return true;
  1296.  
  1297.     GEPmounted=spawn(class'WeaponGEPmounted',self,,Location,Rotation);
  1298.     if (GEPmounted!=none)
  1299.     {
  1300.       GEPmounted.bHidden=true;//use this to invoke renderoverlays
  1301.       GEPmounted.bHideWeapon=true;
  1302.       GEPmounted.SetPhysics(PHYS_None);
  1303.       GEPmounted.SetMount(self);
  1304.       return true;
  1305.     } else log("ERROR: could not spawn GEPmounted");//else
  1306.       //bNoGEPmounted=true;
  1307.     return false;*/
  1308. }
  1309.  
  1310. //GMDX remove console from Hardcore mode >:]
  1311. exec function Say(string Msg )
  1312. {
  1313.     if (bHardCoreMode || bNoConsole) return; else
  1314.       super.Say(Msg);
  1315. }
  1316.  
  1317. exec function Type()
  1318. {
  1319.     if (bHardCoreMode) return; else
  1320.       super.Type();
  1321. }
  1322.  
  1323. function Typing( bool bTyping )
  1324. {
  1325.     if (bHardCoreMode)
  1326.       Player.Console.GotoState('');
  1327.     else super.Typing(bTyping);
  1328. }
  1329.  
  1330. /////
  1331.  
  1332. exec function HDTP(optional string s)
  1333. {
  1334.     local scriptedpawn P;
  1335.     local deusexcarcass C;
  1336.  
  1337.     if(s != "")
  1338.     {
  1339.         s = Caps(s);
  1340.         if(s == "NICO")
  1341.             bHDTP_Nico = !bHDTP_Nico;
  1342.         else if(s == "WALTON")
  1343.             bHDTP_Walton = !bHDTP_Walton;
  1344.         else if(s == "ANNA")
  1345.             bHDTP_Anna = !bHDTP_Anna;
  1346.         else if(s == "MJ12")
  1347.             bHDTP_MJ12 = false;// was !bHDTP_MJ12;
  1348.         else if(s == "UNATCO")
  1349.             bHDTP_UNATCO = !bHDTP_UNATCO;
  1350.         else if(s == "NSF")
  1351.             bHDTP_NSF = !bHDTP_NSF;
  1352.         else if(s == "COP")
  1353.             bHDTP_RiotCop = !bHDTP_RiotCop;
  1354.         else if(s == "GUNTHER")
  1355.             bHDTP_Gunther = !bHDTP_Gunther;
  1356.         else if(s == "PAUL")
  1357.             bHDTP_Paul = !bHDTP_Paul;
  1358.         else if(s == "JC")
  1359.             bHDTP_JC = !bHDTP_JC;
  1360.         else if(s == "ALL")
  1361.         {
  1362.             bHDTP_All++;
  1363.             if(bHDTP_All > 1)
  1364.                 bHDTP_All = -1;
  1365.         }
  1366.     }
  1367.  
  1368.     foreach Allactors(Class'Scriptedpawn',P)
  1369.         P.UpdateHDTPSettings();
  1370.     foreach Allactors(Class'DeusexCarcass',C)
  1371.         C.UpdateHDTPsettings();
  1372.  
  1373.     UpdateHDTPsettings();
  1374. }
  1375.  
  1376.  
  1377. // ----------------------------------------------------------------------
  1378. // Update Time Played
  1379. // ----------------------------------------------------------------------
  1380.  
  1381. final function UpdateTimePlayed(float deltaTime)
  1382. {
  1383.     saveTime += deltaTime;
  1384. }
  1385.  
  1386. // ----------------------------------------------------------------------
  1387. // RestoreScopeView()
  1388. // ----------------------------------------------------------------------
  1389.  
  1390. function RestoreScopeView()
  1391. {
  1392.     if (inHand != None)
  1393.     {
  1394.         if (inHand.IsA('Binoculars') && (inHand.bActive))
  1395.             Binoculars(inHand).RefreshScopeDisplay(Self, True);
  1396.         else if ((DeusExWeapon(inHand) != None) && (DeusExWeapon(inHand).bZoomed))
  1397.             DeusExWeapon(inHand).RefreshScopeDisplay(Self, True, True);
  1398.     }
  1399. }
  1400.  
  1401. // ----------------------------------------------------------------------
  1402. // RefreshChargedPickups()
  1403. // ----------------------------------------------------------------------
  1404.  
  1405. function RefreshChargedPickups()
  1406. {
  1407.     local ChargedPickup anItem;
  1408.  
  1409.     // Loop through all the ChargedPicksups and look for charged pickups
  1410.     // that are active.  If we find one, add to the user-interface.
  1411.  
  1412.     foreach AllActors(class'ChargedPickup', anItem)
  1413.     {
  1414.         if ((anItem.Owner == Self) && (anItem.IsActive()))
  1415.         {
  1416.             // Make sure tech goggles display is refreshed
  1417.             if (anItem.IsA('TechGoggles'))
  1418.                 TechGoggles(anItem).UpdateHUDDisplay(Self);
  1419.  
  1420.             AddChargedDisplay(anItem);
  1421.         }
  1422.     }
  1423. }
  1424.  
  1425. // ----------------------------------------------------------------------
  1426. // UpdatePlayerSkin()
  1427. // ----------------------------------------------------------------------
  1428.  
  1429. function UpdatePlayerSkin()
  1430. {
  1431.     local PaulDenton paul;
  1432.     local PaulDentonCarcass paulCarcass;
  1433.     local JCDentonMaleCarcass jcCarcass;
  1434.     local JCDouble jc;
  1435.  
  1436.     // Paul Denton
  1437.     foreach AllActors(class'PaulDenton', paul)
  1438.         break;
  1439.  
  1440.     if (paul != None)
  1441.         paul.SetSkin(Self);
  1442.  
  1443.     // Paul Denton Carcass
  1444.     foreach AllActors(class'PaulDentonCarcass', paulCarcass)
  1445.         break;
  1446.  
  1447.     if (paulCarcass != None)
  1448.         paulCarcass.SetSkin(Self);
  1449.  
  1450.     // JC Denton Carcass
  1451.     foreach AllActors(class'JCDentonMaleCarcass', jcCarcass)
  1452.         break;
  1453.  
  1454.     if (jcCarcass != None)
  1455.         jcCarcass.SetSkin(Self);
  1456.  
  1457.     // JC's stunt double
  1458.     foreach AllActors(class'JCDouble', jc)
  1459.         break;
  1460.  
  1461.     if (jc != None)
  1462.         jc.SetSkin(Self);
  1463. }
  1464.  
  1465.  
  1466. // ----------------------------------------------------------------------
  1467. // GetLevelInfo()
  1468. // ----------------------------------------------------------------------
  1469.  
  1470. function DeusExLevelInfo GetLevelInfo()
  1471. {
  1472.     local DeusExLevelInfo info;
  1473.  
  1474.  
  1475.     foreach AllActors(class'DeusExLevelInfo', info)
  1476.         break;
  1477.  
  1478. //   log("MYCHK:LevelInfo: ,"@info.Name);
  1479.  
  1480.     return info;
  1481. }
  1482.  
  1483. //
  1484. // If player chose to dual map the F keys
  1485. //
  1486. exec function DualmapF3() { if ( AugmentationSystem != None) AugmentationSystem.ActivateAugByKey(0); }
  1487. exec function DualmapF4() { if ( AugmentationSystem != None) AugmentationSystem.ActivateAugByKey(1); }
  1488. exec function DualmapF5() { if ( AugmentationSystem != None) AugmentationSystem.ActivateAugByKey(2); }
  1489. exec function DualmapF6() { if ( AugmentationSystem != None) AugmentationSystem.ActivateAugByKey(3); }
  1490. exec function DualmapF7() { if ( AugmentationSystem != None) AugmentationSystem.ActivateAugByKey(4); }
  1491. exec function DualmapF8() { if ( AugmentationSystem != None) AugmentationSystem.ActivateAugByKey(5); }
  1492. exec function DualmapF9() { if ( AugmentationSystem != None) AugmentationSystem.ActivateAugByKey(6); }
  1493. exec function DualmapF10() { if ( AugmentationSystem != None) AugmentationSystem.ActivateAugByKey(7); }
  1494. exec function DualmapF11() { if ( AugmentationSystem != None) AugmentationSystem.ActivateAugByKey(8); }
  1495. exec function DualmapF12() { if ( AugmentationSystem != None) AugmentationSystem.ActivateAugByKey(9); }
  1496.  
  1497. //
  1498. // Team Say
  1499. //
  1500. exec function TeamSay( string Msg )
  1501. {
  1502.     local Pawn P;
  1503.     local String str;
  1504.  
  1505.     if (bHardCoreMode) return;
  1506.  
  1507.     if ( TeamDMGame(DXGame) == None )
  1508.     {
  1509.         Say(Msg);
  1510.         return;
  1511.     }
  1512.  
  1513.     str = PlayerReplicationInfo.PlayerName $ ": " $ Msg;
  1514.  
  1515.     if ( Role == ROLE_Authority )
  1516.         log( "TeamSay>" $ str );
  1517.  
  1518.     for( P=Level.PawnList; P!=None; P=P.nextPawn )
  1519.     {
  1520.         if( P.bIsPlayer && (P.PlayerReplicationInfo.Team == PlayerReplicationInfo.Team) )
  1521.         {
  1522.             if ( P.IsA('DeusExPlayer') )
  1523.                 DeusExPlayer(P).ClientMessage( str, 'TeamSay', true );
  1524.         }
  1525.     }
  1526. }
  1527.  
  1528. // ----------------------------------------------------------------------
  1529. // RestartLevel()
  1530. // ----------------------------------------------------------------------
  1531.  
  1532. exec function RestartLevel()
  1533. {
  1534.     ResetPlayer();
  1535.     Super.RestartLevel();
  1536. }
  1537.  
  1538. // ----------------------------------------------------------------------
  1539. // LoadGame()
  1540. // ----------------------------------------------------------------------
  1541.  
  1542. exec function LoadGame(int saveIndex)
  1543. {
  1544.  
  1545. //   log("MYCHK:LoadGame: ,"@saveIndex);
  1546.     // Reset the FOV
  1547.     if (class'DeusExPlayer'.default.bCloakEnabled == True)
  1548.        class'DeusExPlayer'.default.bCloakEnabled = False; //CyberP: disable the cloak effect
  1549.     else if (class'DeusExPlayer'.default.bRadarTran == True)
  1550.        class'DeusExPlayer'.default.bRadarTran = False;    //CyberP: disable the radar effect
  1551.     bCrosshairVisible=True;                            //CyberP: fuck it
  1552.     DesiredFOV = Default.DesiredFOV;
  1553.     DeusExRootWindow(rootWindow).ClearWindowStack();
  1554.     ClientTravel("?loadgame=" $ saveIndex, TRAVEL_Absolute, False);
  1555. }
  1556.  
  1557.  
  1558. // ----------------------------------------------------------------------
  1559. // QuickSave()
  1560. // ----------------------------------------------------------------------
  1561.  
  1562. exec function QuickSave()
  1563. {
  1564.     local DeusExLevelInfo info;
  1565.  
  1566.     info = GetLevelInfo();
  1567.  
  1568.     // Don't allow saving if:
  1569.     //
  1570.     // 1) The player is dead
  1571.     // 2) We're on the logo map
  1572.     // 4) We're interpolating (playing outtro)
  1573.     // 3) A datalink is playing
  1574.     // 4) We're in a multiplayer game
  1575.  
  1576.     if (((info != None) && (info.MissionNumber < 0)) ||
  1577.        ((IsInState('Dying')) || (IsInState('Paralyzed')) || (IsInState('Interpolating'))) ||
  1578.        (dataLinkPlay != None) || (Level.Netmode != NM_Standalone))
  1579.     {
  1580.        return;
  1581.     }
  1582.  
  1583.     if (bHardCoreMode && !bPendingHardCoreSave) return;
  1584.     bPendingHardCoreSave=false;
  1585. //SAVEOUT
  1586.     ConsoleCommand("set DeusEx.JCDentonMale QuickSaveIndex "$QuickSaveCurrent);
  1587. //   QuickSaveIndex=QuickSaveCurrent;
  1588.  
  1589.     if (QuickSaveCurrent>=QuickSaveTotal)
  1590.       QuickSaveCurrent=0;
  1591.     QuickSaveCurrent++;
  1592.  
  1593.     QuickSaveLast=-(10+QuickSaveCurrent);
  1594.     QuickSaveName=sprintf("AutoSave%d",QuickSaveCurrent);
  1595.     log("MYCHK:DX_QuickSave: ,"@QuickSaveName@" ,Last:"@QuickSaveLast@" ,Current:"@QuickSaveCurrent);
  1596.     SaveGame(QuickSaveLast, QuickSaveName);
  1597.     ConsoleCommand("set DeusEx.JCDentonMale iQuickSaveLast "$QuickSaveLast);
  1598. //  default.iQuickSaveLast=QuickSaveLast;
  1599.  
  1600. //original  SaveGame(-1, QuickSaveGameTitle);
  1601. }
  1602.  
  1603. // ----------------------------------------------------------------------
  1604. // QuickLoad()
  1605. // ----------------------------------------------------------------------
  1606.  
  1607. exec function QuickLoad()
  1608. {
  1609.     //Don't allow in multiplayer.
  1610.     if (Level.Netmode != NM_Standalone)
  1611.       return;
  1612.  
  1613.     if (DeusExRootWindow(rootWindow) != None)
  1614.         DeusExRootWindow(rootWindow).ConfirmQuickLoad();
  1615. }
  1616.  
  1617. // ----------------------------------------------------------------------
  1618. // QuickLoadConfirmed()
  1619. // ----------------------------------------------------------------------
  1620.  
  1621. function QuickLoadConfirmed()
  1622. {
  1623.     if (Level.Netmode != NM_Standalone)
  1624.       return;
  1625.  
  1626.     log("MYCHK:DX_QuickLoadConfirmed: "@QuickSaveLast);
  1627. //SAVEOUT
  1628. LoadGame(QuickSaveLast); //changed so now selects last saved game, even if from menu
  1629. //original  LoadGame(-1);
  1630. }
  1631.  
  1632. // ----------------------------------------------------------------------
  1633. // BuySkillSound()
  1634. // ----------------------------------------------------------------------
  1635.  
  1636. function BuySkillSound( int code )
  1637. {
  1638.     local Sound snd;
  1639.  
  1640.     switch( code )
  1641.     {
  1642.         case 0:
  1643.             snd = Sound'Menu_OK';
  1644.             break;
  1645.         case 1:
  1646.             snd = Sound'Menu_Cancel';
  1647.             break;
  1648.         case 2:
  1649.             snd = Sound'Menu_Focus';
  1650.             break;
  1651.         case 3:
  1652.             snd = Sound'Menu_BuySkills';
  1653.             break;
  1654.     }
  1655.     PlaySound( snd, SLOT_Interface, 0.75 );
  1656. }
  1657.  
  1658. //GMDX meh my bloody saveconfig over(um)ride , changed all player.saveconfigs files to point here so i can handle DTS
  1659. function SaveConfigOverride()
  1660. {
  1661.     if (Weapon!=none&&DeusExWeapon(Weapon).bLasing) //CyberP: &&Weapon.IsA('WeaponNanoSword')
  1662.       bCrosshairVisible=bWasCrossHair;
  1663.  
  1664.     SaveConfig();
  1665.  
  1666.     if (Weapon!=none&&DeusExWeapon(Weapon).bLasing) //CyberP: &&Weapon.IsA('WeaponNanoSword')
  1667.       bCrosshairVisible=false;
  1668. }
  1669.  
  1670. // ----------------------------------------------------------------------
  1671. // StartNewGame()
  1672. //
  1673. // Starts a new game given the map passed in
  1674. // ----------------------------------------------------------------------
  1675.  
  1676. exec function StartNewGame(String startMap)
  1677. {
  1678.     local Inventory item, nextItem;
  1679.  
  1680.     if (DeusExRootWindow(rootWindow) != None)
  1681.         DeusExRootWindow(rootWindow).ClearWindowStack();
  1682.  
  1683.     if(KeyRing != None)
  1684.         KeyRing.RemoveAllKeys();
  1685.  
  1686.     for(item = Inventory; item != None; item = nextItem)
  1687.     {
  1688.         nextItem = item.Inventory;
  1689.         item.Destroy();
  1690.     }
  1691.     // Set a flag designating that we're traveling,
  1692.     // so MissionScript can check and not call FirstFrame() for this map.
  1693.     flagBase.SetBool('PlayerTraveling', True, True, 0);
  1694.  
  1695.     SaveSkillPoints();
  1696.     ResetPlayer();
  1697.     DeleteSaveGameFiles();
  1698.  
  1699.     bStartingNewGame = True;
  1700.  
  1701.     // Send the player to the specified map!
  1702.     if (startMap == "")
  1703.         Level.Game.SendPlayer(Self, "01_NYC_UNATCOIsland");     // TODO: Must be stored somewhere!
  1704.     else
  1705.         Level.Game.SendPlayer(Self, startMap);
  1706. }
  1707.  
  1708. // ----------------------------------------------------------------------
  1709. // StartTrainingMission()
  1710. // ----------------------------------------------------------------------
  1711.  
  1712. function StartTrainingMission()
  1713. {
  1714.     if (DeusExRootWindow(rootWindow) != None)
  1715.         DeusExRootWindow(rootWindow).ClearWindowStack();
  1716.  
  1717.     // Make sure the player isn't asked to do this more than
  1718.     // once if prompted on the main menu.
  1719.     if (!bAskedToTrain)
  1720.     {
  1721.         bAskedToTrain = True;
  1722.         SaveConfig();
  1723.     }
  1724.  
  1725.     SkillSystem.ResetSkills();
  1726.     ResetPlayer(True);
  1727.     DeleteSaveGameFiles();
  1728.     bStartingNewGame = True;
  1729.     Level.Game.SendPlayer(Self, "00_Training");
  1730. }
  1731.  
  1732. // ----------------------------------------------------------------------
  1733. // ShowIntro()
  1734. // ----------------------------------------------------------------------
  1735.  
  1736. function ShowIntro(optional bool bStartNewGame)
  1737. {
  1738.     //GMDX: fix inventory bug when player dies and starts new game
  1739.     if (IsInState('Dying')) GotoState('PlayerWalking');
  1740.  
  1741.     if (DeusExRootWindow(rootWindow) != None)
  1742.         {
  1743.         DeusExRootWindow(rootWindow).ClearWindowStack();
  1744.         DeusExRootWindow(rootWindow).hud.belt.ClearBelt();
  1745.         }
  1746.     bStartNewGameAfterIntro = bStartNewGame;
  1747.  
  1748.     // Make sure all augmentations are OFF before going into the intro
  1749.     AugmentationSystem.DeactivateAll();
  1750.  
  1751.     if (bSkipNewGameIntro)
  1752.       PostIntro();
  1753.       else// Reset the player
  1754.          Level.Game.SendPlayer(Self, "00_Intro");
  1755. }
  1756.  
  1757. // ----------------------------------------------------------------------
  1758. // ShowCredits()
  1759. // ----------------------------------------------------------------------
  1760.  
  1761. function ShowCredits(optional bool bLoadIntro)
  1762. {
  1763.     local DeusExRootWindow root;
  1764.     local CreditsWindow winCredits;
  1765.  
  1766.     root = DeusExRootWindow(rootWindow);
  1767.  
  1768.     if (root != None)
  1769.     {
  1770.         // Show the credits screen and force the game not to pause
  1771.         // if we're showing the credits after the endgame
  1772.         winCredits = CreditsWindow(root.InvokeMenuScreen(Class'CreditsWindow', bLoadIntro));
  1773.         winCredits.SetLoadIntro(bLoadIntro);
  1774.     }
  1775. }
  1776.  
  1777. // ----------------------------------------------------------------------
  1778. // StartListenGame()
  1779. // ----------------------------------------------------------------------
  1780.  
  1781. function StartListenGame(string options)
  1782. {
  1783.     local DeusExRootWindow root;
  1784.  
  1785.     root = DeusExRootWindow(rootWindow);
  1786.  
  1787.     if (root != None)
  1788.       root.ClearWindowStack();
  1789.  
  1790.     ConsoleCommand("start "$options$"?listen");
  1791. }
  1792.  
  1793. // ----------------------------------------------------------------------
  1794. // StartMultiplayerGame()
  1795. // ----------------------------------------------------------------------
  1796.  
  1797. function StartMultiplayerGame(string command)
  1798. {
  1799.     local DeusExRootWindow root;
  1800.  
  1801.     root = DeusExRootWindow(rootWindow);
  1802.  
  1803.     if (root != None)
  1804.       root.ClearWindowStack();
  1805.  
  1806.     ConsoleCommand(command);
  1807. }
  1808.  
  1809. // ----------------------------------------------------------------------
  1810. // NewMultiplayerMatch()
  1811. // ----------------------------------------------------------------------
  1812.  
  1813. function NewMultiplayerMatch()
  1814. {
  1815.     DeusExMPGame( DXGame ).RestartPlayer( Self );
  1816.     PlayerReplicationInfo.Score = 0;
  1817.     PlayerReplicationInfo.Deaths = 0;
  1818.     PlayerReplicationInfo.Streak = 0;
  1819. }
  1820.  
  1821. // ----------------------------------------------------------------------
  1822. // ShowMultiplayerWin()
  1823. // ----------------------------------------------------------------------
  1824.  
  1825. function ShowMultiplayerWin( String winnerName, int winningTeam, String Killer, String Killee, String Method )
  1826. {
  1827.     local HUDMultiplayer mpScr;
  1828.     local DeusExRootWindow root;
  1829.  
  1830.     if (( Player != None ) && ( Player.Console != None ))
  1831.         Player.Console.ClearMessages();
  1832.  
  1833.     root = DeusExRootWindow(rootWindow);
  1834.  
  1835.     if ( root != None )
  1836.     {
  1837.         mpScr = HUDMultiplayer(root.InvokeUIScreen(Class'HUDMultiplayer', True));
  1838.         root.MaskBackground(True);
  1839.  
  1840.         if ( mpScr != None )
  1841.         {
  1842.          mpScr.winnerName = winnerName;
  1843.             mpScr.winningTeam = winningTeam;
  1844.             mpScr.winKiller = Killer;
  1845.             mpScr.winKillee = Killee;
  1846.             mpScr.winMethod = Method;
  1847.         }
  1848.     }
  1849.  
  1850.     //Do cleanup
  1851.     if (PlayerIsClient())
  1852.     {
  1853.       if (AugmentationSystem != None)
  1854.          AugmentationSystem.DeactivateAll();
  1855.     }
  1856. }
  1857.  
  1858.  
  1859. // ----------------------------------------------------------------------
  1860. // ResetPlayer()
  1861. //
  1862. // Called when a new game is started.
  1863. //
  1864. // 1) Erase all flags except those beginning with "SKTemp_"
  1865. // 2) Dumps inventory
  1866. // 3) Restore any other defaults
  1867. // ----------------------------------------------------------------------
  1868.  
  1869. function ResetPlayer(optional bool bTraining)
  1870. {
  1871.     local inventory anItem;
  1872.     local inventory nextItem;
  1873.  
  1874.     ResetPlayerToDefaults();
  1875.  
  1876.     // Reset Augmentations
  1877.     if (AugmentationSystem != None)
  1878.     {
  1879.         AugmentationSystem.ResetAugmentations();
  1880.         AugmentationSystem.Destroy();
  1881.         AugmentationSystem = None;
  1882.     }
  1883.  
  1884.     // Give the player a pistol and a prod
  1885.     if (!bTraining)
  1886.     {
  1887.         anItem = Spawn(class'WeaponPistol');
  1888.         anItem.Frob(Self, None);
  1889.         anItem.bInObjectBelt = True;
  1890.         anItem = Spawn(class'WeaponProd');
  1891.         anItem.Frob(Self, None);
  1892.         anItem.bInObjectBelt = True;
  1893.         anItem = Spawn(class'MedKit');
  1894.         anItem.Frob(Self, None);
  1895.         anItem.bInObjectBelt = True;
  1896.         swimTimer = 100;  //CyberP: start with full stamina.
  1897.     }
  1898. }
  1899.  
  1900. // ----------------------------------------------------------------------
  1901. // ResetPlayerToDefaults()
  1902. //
  1903. // Resets all travel variables to their defaults
  1904. // ----------------------------------------------------------------------
  1905.  
  1906. function ResetPlayerToDefaults()
  1907. {
  1908.     local inventory anItem;
  1909.     local inventory nextItem;
  1910.     local int i;
  1911.     // reset the image linked list
  1912.     FirstImage = None;
  1913.  
  1914.     if (DeusExRootWindow(rootWindow) != None)
  1915.         DeusExRootWindow(rootWindow).ResetFlags();
  1916.  
  1917.     // Remove all the keys from the keyring before
  1918.     // it gets destroyed
  1919.     if (KeyRing != None)
  1920.     {
  1921.         KeyRing.RemoveAllKeys();
  1922.       if ((Role == ROLE_Authority) && (Level.NetMode != NM_Standalone))
  1923.       {
  1924.          KeyRing.ClientRemoveAllKeys();
  1925.       }
  1926.         KeyRing = None;
  1927.     }
  1928.  
  1929.     while(Inventory != None)
  1930.     {
  1931.         anItem = Inventory;
  1932.         DeleteInventory(anItem);
  1933.       anItem.Destroy();
  1934.     }
  1935. /*
  1936.     anItem = Inventory;
  1937.     while(anItem!= None)
  1938.     {
  1939.       log("DELETE "@anItem);
  1940.        nextItem=anItem.Inventory;
  1941.         DeleteInventory(anItem);
  1942.       anItem.Destroy();
  1943.       anItem=nextItem;
  1944.     }
  1945. */
  1946.     // Clear object belt
  1947.     if (DeusExRootWindow(rootWindow) != None)
  1948.         DeusExRootWindow(rootWindow).hud.belt.ClearBelt();
  1949.  
  1950.     // clear the notes and the goals
  1951.     DeleteAllNotes();
  1952.     DeleteAllGoals();
  1953.  
  1954.     // Nuke the history
  1955.     ResetConversationHistory();
  1956.  
  1957.     // Other defaults
  1958.     Credits = Default.Credits;
  1959.     Energy  = Default.Energy;
  1960.     SkillPointsTotal = Default.SkillPointsTotal;
  1961.     SkillPointsAvail = Default.SkillPointsAvail;
  1962.  
  1963.     SetInHandPending(None);
  1964.     SetInHand(None);
  1965.  
  1966.     bInHandTransition = False;
  1967.  
  1968.     RestoreAllHealth();
  1969.     ClearLog();
  1970.  
  1971.     // Reset save count/time
  1972.     saveCount = 0;
  1973.     saveTime  = 0.0;
  1974.  
  1975.     // Reinitialize all subsystems we've just nuked
  1976.     InitializeSubSystems();
  1977.  
  1978.     for(i=0;i<ArrayCount(PerkNamesArray);i++)   //CyberP: reset perks
  1979.            PerkNamesArray[i] = 0;
  1980.         for(i=0;i<ArrayCount(BoughtPerks);i++)   //CyberP: reset perks
  1981.            BoughtPerks[i] = "";
  1982.  
  1983.     // Give starting inventory.
  1984.     if (Level.Netmode != NM_Standalone)
  1985.     {
  1986.         NintendoImmunityEffect( True );
  1987.       GiveInitialInventory();
  1988.     }
  1989. }
  1990.  
  1991. // ----------------------------------------------------------------------
  1992. // CreateKeyRing()
  1993. // ----------------------------------------------------------------------
  1994.  
  1995. function CreateKeyRing()
  1996. {
  1997.     if (KeyRing == None)
  1998.     {
  1999.         KeyRing = Spawn(class'NanoKeyRing', Self);
  2000.         KeyRing.InitialState='Idle2';
  2001.         KeyRing.GiveTo(Self);
  2002.         KeyRing.SetBase(Self);
  2003.     }
  2004. }
  2005.  
  2006. singular function RecoilShaker(vector shakeAmount)
  2007. {
  2008. local float shakeTime, shakeRoll, shakeVert;
  2009.  
  2010.     RecoilDesired.X=RecoilShake.X+((1.0*shakeAmount.X*2.2)-shakeAmount.X);//2.0)-shakeAmount.X);
  2011.     RecoilDesired.Y=RecoilShake.Y+((1.0*shakeAmount.Y*2.2)-shakeAmount.Y);     //CyberP: 2
  2012.     RecoilDesired.Z=RecoilShake.Z+((1.0*shakeAmount.Z*2.2)-shakeAmount.Z);
  2013.  
  2014.     if (Weapon != none && DeusExWeapon(Weapon).bHandToHand && DeusExWeapon(Weapon).bFiring)
  2015.     {
  2016.        RecoilTime=default.RecoilTime/3; //CyberP: attack effect for melee weapons
  2017.        FovAngle += 1;
  2018.     }
  2019.     else if (Weapon != none && DeusExWeapon(Weapon).bFiring)
  2020.     {
  2021.        if (DeusExWeapon(Weapon).bAutomatic && DeusExWeapon(inHand).bFiring)
  2022.        {
  2023.        RecoilTime=default.RecoilTime/2.5;
  2024.        FovAngle -= 1.5;
  2025.        }
  2026.        else
  2027.        {
  2028.        RecoilTime=default.RecoilTime*0.65;   //CyberP: faster shake for guns
  2029.        //if (DeusExWeapon(Weapon).bExtraShaker && !IsLeaning() && PerkNamesArray[12] != 1)
  2030.        //Velocity -= Vector(ViewRotation) * 150; //CyberP: big guns make us step back a bit
  2031.        }
  2032.     }
  2033.     else
  2034.     {
  2035.        RecoilTime=default.RecoilTime;   //CyberP: else for flinching and other effects
  2036.     }
  2037.  
  2038.     //SetFOVAngle(FOVAngle);
  2039.     if (RecoilShake.X>RecoilSimLimit.X) RecoilShake.X=RecoilSimLimit.X;
  2040.     if (RecoilShake.Y>RecoilSimLimit.Y) RecoilShake.Y=RecoilSimLimit.Y;
  2041.     if (RecoilShake.Z>RecoilSimLimit.Z) RecoilShake.Z=RecoilSimLimit.Z;
  2042.  
  2043.     if (RecoilShake.X<-RecoilSimLimit.X) RecoilShake.X=-RecoilSimLimit.X;
  2044.     if (RecoilShake.Y<-RecoilSimLimit.Y) RecoilShake.Y=-RecoilSimLimit.Y;
  2045.     if (RecoilShake.Z<-RecoilSimLimit.Z) RecoilShake.Z=-RecoilSimLimit.Z;
  2046. }
  2047.  
  2048. function RecoilEffectTick(float deltaTime)
  2049. {
  2050.     local float invTime;
  2051.     local float shakeTime, ShakeRoll, ShakeVert;
  2052.     if ((RecoilTime>0)||(VSize(RecoilShake)>0.0))
  2053.     {
  2054.        if (inHand !=none && inHand.IsA('DeusExWeapon') && DeusExWeapon(inHand).bFiring)
  2055.        {invTime=3/default.RecoilTime;
  2056.        if ((!DeusExWeapon(inHand).bSuperheated) && (DeusExWeapon(inHand).bExtraShaker)) //CyberP: hmm, tick...
  2057.        {shakeTime=0.01; shakeRoll=80+80; shakeVert-=2+2; ShakeView(shakeTime, shakeRoll, shakeVert);}
  2058.        }
  2059.        else
  2060.        invTime=1.0/0.140000;
  2061.  
  2062.         RecoilShake.X=Lerp(deltaTime*invTime,RecoilShake.X,RecoilDesired.X);
  2063.         RecoilShake.Y=Lerp(deltaTime*invTime,RecoilShake.Y,RecoilDesired.Y);
  2064.         RecoilShake.Z=Lerp(deltaTime*invTime,RecoilShake.Z,RecoilDesired.Z);
  2065.         RecoilTime-=deltaTime;
  2066.  
  2067.         if (RecoilTime<=0.0)
  2068.         {
  2069.             RecoilTime=0;
  2070.             if ((DeusExWeapon(inHand) != None) && (DeusExWeapon(inHand).bZoomed))
  2071.             FovAngle = DeusExWeapon(inHand).ScopeFOV;
  2072.             else
  2073.             FovAngle = Default.DesiredFOV;
  2074.             RecoilDesired=vect(0,0,0);
  2075.             if (VSize(RecoilShake)<0.1)
  2076.               RecoilShake=vect(0,0,0);
  2077.         }
  2078.     } /*else
  2079.     if
  2080.     {
  2081.         RecoilShake.X*=(RecoilDrain*deltaTime*(FRand()*0.1+0.9));
  2082.         RecoilShake.Y*=(RecoilDrain*deltaTime*(FRand()*0.1+0.9));
  2083.         RecoilShake.Z*=(RecoilDrain*deltaTime*(FRand()*0.1+0.9));
  2084.         RecoilShake.X +=(FRand()*0.06-0.03); //push to var?
  2085.         RecoilShake.Y +=(FRand()*0.06-0.03); //push to var?
  2086.         RecoilShake.Z +=(FRand()*0.06-0.03); //push to var?
  2087.  
  2088.     }*/
  2089. }
  2090.  
  2091. // ----------------------------------------------------------------------
  2092. // DrugEffects()
  2093. // ----------------------------------------------------------------------
  2094.  
  2095. simulated function DrugEffects(float deltaTime)
  2096. {
  2097.     local float mult, fov, augLevel;
  2098.     local Rotator rot;
  2099.     local DeusExRootWindow root;
  2100.     local Crosshair        cross;
  2101.  
  2102.     root = DeusExRootWindow(rootWindow);
  2103.  
  2104.     if (hitmarkerTime > 0)
  2105.     {
  2106.     if ((root != None) && (root.hud != None))
  2107.         {
  2108.             cross = root.hud.cross;
  2109.             if (bCrosshairVisible==False)
  2110.                bCrosshairVisible=True;
  2111.             cross.SetBackground(Texture'GMDXSFX.Icons.Hitmarker');
  2112.              //root.hud.SetBackground(Texture'GMDXSFX.Icons.Hitmarker');
  2113.  
  2114.             hitmarkerTime -= deltaTime;
  2115.  
  2116.             if (hitmarkerTime < 0.05 || IsInState('Dying'))
  2117.             {
  2118.             hitmarkerTime = 0;
  2119.             if (Weapon != None && Weapon.IsA('DeusExWeapon') && DeusExWeapon(Weapon).bLasing && bCrosshairVisible==True)
  2120.                 bCrosshairVisible=False;
  2121.             cross.SetBackground(Texture'CrossSquare');
  2122.             }
  2123.         }
  2124.     }
  2125.     if (drugEffectTimer > 0.0)
  2126.     {
  2127.         if ((root != None) && (root.hud != None))
  2128.         {
  2129.             if (root.hud.background == None)
  2130.             {
  2131.                 root.hud.SetBackground(Texture'DrunkFX');
  2132.                 root.hud.SetBackgroundSmoothing(True);
  2133.                 root.hud.SetBackgroundStretching(True);
  2134.                 root.hud.SetBackgroundStyle(DSTY_Modulated);//(DSTY_Modulated);
  2135.             }
  2136.         }
  2137.  
  2138.         mult = FClamp(drugEffectTimer / 10.0, 0.0, 3.0);
  2139.         rot.Pitch = 1024.0 * Cos(Level.TimeSeconds * mult) * deltaTime * mult;
  2140.         rot.Yaw = 1024.0 * Sin(Level.TimeSeconds * mult) * deltaTime * mult;
  2141.         rot.Roll = 0;
  2142.  
  2143.         rot.Pitch = FClamp(rot.Pitch, -4096, 4096);
  2144.         rot.Yaw = FClamp(rot.Yaw, -4096, 4096);
  2145.  
  2146.         ViewRotation += rot;
  2147.         if ((ViewRotation.Pitch > 16384) && (ViewRotation.Pitch < 32768))
  2148.                 ViewRotation.Pitch = 16384; //CyberP: stop view rot
  2149.         /*if ( Level.NetMode == NM_Standalone )
  2150.         {
  2151.             fov = Default.DesiredFOV - drugEffectTimer + Rand(2);
  2152.             fov = FClamp(fov, 60, Default.DesiredFOV);
  2153.             DesiredFOV = fov;
  2154.         }
  2155.         else */
  2156.             //DesiredFOV = Default.DesiredFOV;
  2157.  
  2158.         //Aug Environment will help with drug effects
  2159.         augLevel = AugmentationSystem.GetAugLevelValue(class'AugEnviro');
  2160.         if(augLevel > 0.0)
  2161.             drugEffectTimer -= deltaTime / augLevel;
  2162.         else
  2163.             drugEffectTimer -= deltaTime;
  2164.         if (drugEffectTimer < 0)
  2165.             drugEffectTimer = 0;
  2166.     }
  2167.     else if (bloodTime > 0)
  2168.     {
  2169.     if ((root != None) && (root.hud != None))
  2170.         {
  2171.             if (root.hud.background == None)
  2172.             {
  2173.                 if (FRand() < 0.25) root.hud.SetBackground(Texture'HDTPFlatFXtex2');
  2174.                 else if (FRand() < 0.5) root.hud.SetBackground(Texture'HDTPFlatFXtex3');
  2175.                 else if (FRand() < 0.75) root.hud.SetBackground(Texture'HDTPFlatFXtex5');
  2176.                 else root.hud.SetBackground(Texture'HDTPFlatFXtex6');
  2177.                 root.hud.SetBackgroundSmoothing(True);
  2178.                 root.hud.SetBackgroundStretching(True);
  2179.                 root.hud.SetBackgroundStyle(DSTY_Modulated);//(DSTY_Modulated);
  2180.             }
  2181.             bloodTime -= deltaTime;
  2182.             if (bloodTime > 0 && bloodTime < 0.2)
  2183.             root.hud.SetBackground(Texture'FadeTop');
  2184.             else if (bloodTime < 0)
  2185.             bloodTime = 0;
  2186.         }
  2187.     }
  2188.     else if (augEffectTime > 0) //Hmm, may be a problem: if we activate augBallistic to wipe drug effect
  2189.     {
  2190.      if ((root != None) && (root.hud != None))
  2191.         {
  2192.             if (root.hud.background == None)
  2193.             {
  2194.                 root.hud.SetBackground(Texture'Xplsn_EMPG');
  2195.                 root.hud.SetBackgroundSmoothing(True);
  2196.                 root.hud.SetBackgroundStretching(True);
  2197.                 root.hud.SetBackgroundStyle(DSTY_Modulated);//(DSTY_Modulated);
  2198.             }
  2199.             augEffectTime -= deltaTime;
  2200.             if (augEffectTime < 0)
  2201.             augEffectTime = 0;
  2202.         }
  2203.     }
  2204.     else
  2205.     {
  2206.         if ((root != None) && (root.hud != None))
  2207.         {
  2208.             if (root.hud.background != None)
  2209.             {
  2210.                 root.hud.SetBackground(None);
  2211.                 root.hud.SetBackgroundStyle(DSTY_Normal);
  2212.                 if (inHand.IsA('DeusExWeapon') && DeusExWeapon(inHand).bZoomed)
  2213.                 {
  2214.                 }
  2215.                 else
  2216.                 DesiredFOV = Default.DesiredFOV;
  2217.             }
  2218.         }
  2219.     }
  2220.  
  2221.     function ZymeEffects(float deltaTime)
  2222.     {
  2223.         //Zyme effect
  2224.         // This function just manages the time and resets it when applicable.  The fact
  2225.         // that the value is negative is what other functions look for.
  2226.         if(drugEffectTimer < 0.0)
  2227.         {
  2228.             drugEffectTimer += deltaTime;
  2229.  
  2230.             if(drugEffectTimer >= 0.0)
  2231.             {
  2232.                 if(Level.NetMode == NM_Standalone)
  2233.                 {
  2234.                     flagBase.DeleteFlag('Travel_GameSpeed', FLAG_Float); //Just in case it hasn't been set yet
  2235.                     Level.Game.SetGameSpeed(Level.Game.GameSpeed * 2.000);
  2236.                 }
  2237.                 else
  2238.                     log("DeusExPlayer: Somehow the zyme effect was activated in a non-singleplayer map.  WTF?");
  2239.                 drugEffectTimer = 180.0;
  2240.                 ClientMessage("Zyme effect wears off");
  2241.             }
  2242.         }
  2243.     }
  2244. }
  2245.  
  2246. // ----------------------------------------------------------------------
  2247. // PlayMusic()
  2248. // ----------------------------------------------------------------------
  2249.  
  2250. function PlayMusic(String musicToPlay, optional int sectionToPlay)
  2251. {
  2252.     local Music LoadedMusic;
  2253.     local EMusicMode newMusicMode;
  2254.  
  2255.     if (musicToPlay != "")
  2256.     {
  2257.         LoadedMusic = Music(DynamicLoadObject(musicToPlay $ "." $ musicToPlay, class'Music'));
  2258.  
  2259.         if (LoadedMusic != None)
  2260.         {
  2261.             switch(sectionToPlay)
  2262.             {
  2263.                 case 0:  newMusicMode = MUS_Ambient; break;
  2264.                 case 1:  newMusicMode = MUS_Combat; break;
  2265.                 case 2:  newMusicMode = MUS_Conversation; break;
  2266.                 case 3:  newMusicMode = MUS_Outro; break;
  2267.                 case 4:  newMusicMode = MUS_Dying; break;
  2268.                 default: newMusicMode = MUS_Ambient; break;
  2269.             }
  2270.  
  2271.             ClientSetMusic(LoadedMusic, newMusicMode, 255, MTRAN_FastFade);
  2272.         }
  2273.     }
  2274. }
  2275.  
  2276. // ----------------------------------------------------------------------
  2277. // PlayMusicWindow()
  2278. //
  2279. // Displays the Load Map dialog
  2280. // ----------------------------------------------------------------------
  2281.  
  2282. exec function PlayMusicWindow()
  2283. {
  2284.     if (!bCheatsEnabled)
  2285.         return;
  2286.  
  2287.     InvokeUIScreen(Class'PlayMusicWindow');
  2288. }
  2289.  
  2290. // ----------------------------------------------------------------------
  2291. // UpdateDynamicMusic()
  2292. //
  2293. // Pattern definitions:
  2294. //   0 - Ambient 1
  2295. //   1 - Dying
  2296. //   2 - Ambient 2 (optional)
  2297. //   3 - Combat
  2298. //   4 - Conversation
  2299. //   5 - Outro
  2300. // ----------------------------------------------------------------------
  2301.  
  2302. function UpdateDynamicMusic(float deltaTime)
  2303. {
  2304.     local bool bCombat;
  2305.     local ScriptedPawn npc;
  2306.     local Pawn CurPawn;
  2307.     local DeusExLevelInfo info;
  2308.  
  2309.     if (Level.Song == None)
  2310.         return;
  2311.  
  2312.     info = GetLevelInfo();
  2313.     if (info != none)
  2314.     if (info.MapName == "02_NYC_Bar" || info.MapName == "04_NYC_Bar" || info.MapName == "08_NYC_Bar" || info.MapName == "06_HongKong_WanChai_Underworld"
  2315.     || info.MapName == "10_Paris_Club")
  2316.         return;  //CyberP: no dynamic music in clubs and bars.
  2317.  
  2318.     // DEUS_EX AMSD In singleplayer, do the old thing.
  2319.     // In multiplayer, we can come out of dying.
  2320.     if (!PlayerIsClient())
  2321.     {
  2322.       if ((musicMode == MUS_Dying) || (musicMode == MUS_Outro))
  2323.          return;
  2324.     }
  2325.     else
  2326.     {
  2327.       if (musicMode == MUS_Outro)
  2328.          return;
  2329.     }
  2330.  
  2331.  
  2332.     musicCheckTimer += deltaTime;
  2333.     musicChangeTimer += deltaTime;
  2334.  
  2335.     if (IsInState('Interpolating'))
  2336.     {
  2337.         // don't mess with the music on any of the intro maps
  2338.         info = GetLevelInfo();
  2339.         if ((info != None) && (info.MissionNumber < 0))
  2340.         {
  2341.             musicMode = MUS_Outro;
  2342.             return;
  2343.         }
  2344.  
  2345.         if (musicMode != MUS_Outro)
  2346.         {
  2347.             ClientSetMusic(Level.Song, 5, 255, MTRAN_FastFade);
  2348.             musicMode = MUS_Outro;
  2349.         }
  2350.     }
  2351.     else if (IsInState('Conversation'))
  2352.     {
  2353.         if (musicMode != MUS_Conversation)
  2354.         {
  2355.             // save our place in the ambient track
  2356.             if (musicMode == MUS_Ambient)
  2357.                 savedSection = SongSection;
  2358.             else
  2359.                 savedSection = 255;
  2360.  
  2361.             ClientSetMusic(Level.Song, 4, 255, MTRAN_Fade);
  2362.             musicMode = MUS_Conversation;
  2363.         }
  2364.     }
  2365.     else if (IsInState('Dying'))
  2366.     {
  2367.         if (musicMode != MUS_Dying)
  2368.         {
  2369.             ClientSetMusic(Level.Song, 1, 255, MTRAN_Fade);
  2370.             musicMode = MUS_Dying;
  2371.         }
  2372.     }
  2373.     else
  2374.     {
  2375.         // only check for combat music every second //CyberP: 2 secs
  2376.         if (musicCheckTimer >= 2.0)
  2377.         {
  2378.             musicCheckTimer = 0.0;
  2379.             bCombat = False;
  2380.  
  2381.             // check a 100 foot radius around me for combat
  2382.          // XXXDEUS_EX AMSD Slow Pawn Iterator
  2383.          //foreach RadiusActors(class'ScriptedPawn', npc, 1600)
  2384.          for (CurPawn = Level.PawnList; CurPawn != None; CurPawn = CurPawn.NextPawn)
  2385.          {
  2386.             npc = ScriptedPawn(CurPawn);
  2387.             if ((npc != None) && (VSize(npc.Location - Location) < (1600 + npc.CollisionRadius)))
  2388.             {
  2389.                if ((npc.GetStateName() == 'Attacking') && (npc.Enemy == Self))
  2390.                {
  2391.                   bCombat = True;
  2392.                   break;
  2393.                }
  2394.             }
  2395.          }
  2396.             if (bCombat)
  2397.             {
  2398.                 musicChangeTimer = 0.0;
  2399.  
  2400.                 if (musicMode != MUS_Combat)
  2401.                 {
  2402.                     // save our place in the ambient track
  2403.                     if (musicMode == MUS_Ambient)
  2404.                         savedSection = SongSection;
  2405.                     else
  2406.                         savedSection = 255;
  2407.  
  2408.                     ClientSetMusic(Level.Song, 3, 255, MTRAN_FastFade);
  2409.                     musicMode = MUS_Combat;
  2410.                 }
  2411.             }
  2412.             else if (musicMode != MUS_Ambient)
  2413.             {
  2414.                 // wait until we've been out of combat for 5 seconds before switching music
  2415.                 if (musicChangeTimer >= 5.0)
  2416.                 {
  2417.                     // use the default ambient section for this map
  2418.                     if (savedSection == 255)
  2419.                         savedSection = Level.SongSection;
  2420.  
  2421.                     // fade slower for combat transitions
  2422.                     if (musicMode == MUS_Combat)
  2423.                         ClientSetMusic(Level.Song, savedSection, 255, MTRAN_SlowFade);
  2424.                     else
  2425.                         ClientSetMusic(Level.Song, savedSection, 255, MTRAN_Fade);
  2426.  
  2427.                     savedSection = 255;
  2428.                     musicMode = MUS_Ambient;
  2429.                     musicChangeTimer = 0.0;
  2430.                 }
  2431.             }
  2432.         }
  2433.     }
  2434. }
  2435.  
  2436. // ----------------------------------------------------------------------
  2437. // MaintainEnergy()
  2438. // ----------------------------------------------------------------------
  2439.  
  2440. function MaintainEnergy(float deltaTime)
  2441. {
  2442.     local Float energyUse;
  2443.     local Float energyRegen;
  2444.  
  2445.     // make sure we can't continue to go negative if we take damage
  2446.     // after we're already out of energy
  2447.     if (Energy <= 0)
  2448.     {
  2449.         Energy = 0;
  2450.         EnergyDrain = 0;
  2451.         EnergyDrainTotal = 0;
  2452.     }
  2453.  
  2454.     energyUse = 0;
  2455.  
  2456.     // Don't waste time doing this if the player is dead or paralyzed
  2457.     if ((!IsInState('Dying')) && (!IsInState('Paralyzed')))
  2458.     {
  2459.       if (Energy > 0)
  2460.       {
  2461.          // Decrement energy used for augmentations
  2462.          energyUse = AugmentationSystem.CalcEnergyUse(deltaTime);
  2463.  
  2464.          Energy -= EnergyUse;
  2465.          if (Energy < 6)
  2466.          {
  2467.             if (EnergyUse != 0 && bDrainAlert==False)
  2468.             {
  2469.             PlaySound(sound'GMDXSFX.Generic.biolow',SLOT_None);
  2470.             bDrainAlert=True; //CyberP: alert when energy is low
  2471.             }
  2472.          }
  2473.  
  2474.          if (Energy > 10)
  2475.             bDrainAlert=False;
  2476.  
  2477.          // Calculate the energy drain due to EMP attacks
  2478.          if (EnergyDrain > 0)
  2479.          {
  2480.             energyUse = EnergyDrainTotal * deltaTime;
  2481.             Energy -= EnergyUse;
  2482.             EnergyDrain -= EnergyUse;
  2483.  
  2484.             if (EnergyDrain <= 0)
  2485.             {
  2486.                EnergyDrain = 0;
  2487.                EnergyDrainTotal = 0;
  2488.             }
  2489.          }
  2490.       }
  2491.  
  2492.       //Do check if energy is 0.
  2493.       // If the player's energy drops to zero, deactivate
  2494.       // all augmentations
  2495.       if (Energy <= 0)
  2496.       {
  2497.          //If we were using energy, then tell the client we're out.
  2498.          //Otherwise just make sure things are off.  If energy was
  2499.          //already 0, then energy use will still be 0, so we won't
  2500.          //spam.  DEUS_EX AMSD
  2501.          if (energyUse > 0)
  2502.             ClientMessage(EnergyDepleted);
  2503.          Energy = 0;
  2504.          EnergyDrain = 0;
  2505.          EnergyDrainTotal = 0;
  2506.          AugmentationSystem.DeactivateAll();
  2507.       }
  2508.  
  2509.       // If all augs are off, then start regenerating in multiplayer,
  2510.       // up to 25%.
  2511.       if ((energyUse == 0) && (Energy <= MaxRegenPoint) && (Level.NetMode != NM_Standalone))
  2512.       {
  2513.          energyRegen = RegenRate * deltaTime;
  2514.          Energy += energyRegen;
  2515.       }
  2516.     }
  2517. }
  2518. // ----------------------------------------------------------------------
  2519. // RefreshSystems()
  2520. // DEUS_EX AMSD For keeping multiplayer working in better shape
  2521. // ----------------------------------------------------------------------
  2522.  
  2523. simulated function RefreshSystems(float DeltaTime)
  2524. {
  2525.     local DeusExRootWindow root;
  2526.  
  2527.     if (Level.NetMode == NM_Standalone)
  2528.       return;
  2529.  
  2530.     if (Role == ROLE_Authority)
  2531.       return;
  2532.  
  2533.     if (LastRefreshTime < 0)
  2534.       LastRefreshTime = 0;
  2535.  
  2536.     LastRefreshTime = LastRefreshTime + DeltaTime;
  2537.  
  2538.     if (LastRefreshTime < 0.25)
  2539.       return;
  2540.  
  2541.     if (AugmentationSystem != None)
  2542.       AugmentationSystem.RefreshAugDisplay();
  2543.  
  2544.     root = DeusExRootWindow(rootWindow);
  2545.     if (root != None)
  2546.       root.RefreshDisplay(LastRefreshTime);
  2547.  
  2548.     RepairInventory();
  2549.  
  2550.     LastRefreshTime = 0;
  2551.  
  2552. }
  2553.  
  2554. function RepairInventory()
  2555. {
  2556.     local byte              LocalInvSlots[30];      // 5x6 grid of inventory slots
  2557.     local int i;
  2558.     local int slotsCol;
  2559.     local int slotsRow;
  2560.     local Inventory curInv;
  2561.  
  2562.     if ((Level.NetMode != NM_Standalone) && (bBeltIsMPInventory))
  2563.       return;
  2564.  
  2565.     //clean out our temp inventory.
  2566.     for (i = 0; i < 30; i++)
  2567.       LocalInvSlots[i] = 0;
  2568.  
  2569.     // go through our inventory and fill localinvslots
  2570.     if (Inventory != None)
  2571.     {
  2572.       for (curInv = Inventory; curInv != None; curInv = curInv.Inventory)
  2573.       {
  2574.          // Make sure this item is located in a valid position
  2575.          if (( curInv.invPosX != -1 ) && ( curInv.invPosY != -1 ))
  2576.          {
  2577.             // fill inventory slots
  2578.             for( slotsRow=0; slotsRow < curInv.invSlotsY; slotsRow++ )
  2579.                for ( slotsCol=0; slotsCol < curInv.invSlotsX; slotsCol++ )
  2580.                   LocalInvSlots[((slotsRow + curInv.invPosY) * maxInvCols) + (slotscol + curInv.invPosX)] = 1;
  2581.          }
  2582.       }
  2583.     }
  2584.  
  2585.     // verify that the 2 inventory grids match
  2586.     for (i = 0; i < 30; i++)
  2587.       if (LocalInvSlots[i] < invSlots[i]) //don't stuff slots, that can get handled elsewhere, just clear ones that need it
  2588.       {
  2589.          log("ERROR!!! Slot "$i$" should be "$LocalInvSlots[i]$", but isn't!!!!, repairing");
  2590.          invSlots[i] = LocalInvSlots[i];
  2591.       }
  2592.  
  2593. }
  2594.  
  2595. // ----------------------------------------------------------------------
  2596. // Bleed()
  2597. //
  2598. // Let the blood flow
  2599. // ----------------------------------------------------------------------
  2600.  
  2601. function Bleed(float deltaTime)
  2602. {
  2603.     local float  dropPeriod;
  2604.     local float  adjustedRate;
  2605.     local vector bloodVector;
  2606.  
  2607.     if ((DeusExMPGame(Level.Game) != None) && (!DeusExMPGame(Level.Game).bSpawnEffects))
  2608.     {
  2609.       bleedrate = 0;
  2610.       dropCounter = 0;
  2611.       return;
  2612.     }
  2613.  
  2614.     // Copied from ScriptedPawn::Tick()
  2615.     bleedRate = FClamp(bleedRate, 0.0, 1.0);
  2616.     if (bleedRate > 0)
  2617.     {
  2618.         adjustedRate = (1.0-bleedRate)*1.0+0.1;  // max 10 drops per second
  2619.         dropPeriod = adjustedRate / FClamp(VSize(Velocity)/512.0, 0.05, 1.0);
  2620.         dropCounter += deltaTime;
  2621.         while (dropCounter >= dropPeriod)
  2622.         {
  2623.             bloodVector = vect(0,0,1)*CollisionHeight*0.5;  // so folks don't bleed from the crotch
  2624.             spawn(Class'BloodDrop',,,bloodVector+Location);
  2625.             dropCounter -= dropPeriod;
  2626.         }
  2627.         bleedRate -= deltaTime/clotPeriod;
  2628.     }
  2629.     if (bleedRate <= 0)
  2630.     {
  2631.         dropCounter = 0;
  2632.         bleedRate   = 0;
  2633.     }
  2634. }
  2635.  
  2636. // ----------------------------------------------------------------------
  2637. // UpdatePoison()
  2638. //
  2639. // Get all woozy 'n' stuff
  2640. // ----------------------------------------------------------------------
  2641.  
  2642. function UpdatePoison(float deltaTime)
  2643. {
  2644.     if (Health <= 0)  // no more pain -- you're already dead!
  2645.         return;
  2646.  
  2647.     if (InConversation())  // kinda hacky...
  2648.         return;
  2649.  
  2650.     if (poisonCounter > 0)
  2651.     {
  2652.         poisonTimer += deltaTime;
  2653.         if (poisonTimer >= 3.0)  // pain every two seconds //CyberP: three seconds
  2654.         {
  2655.             poisonTimer = 0;
  2656.             poisonCounter--;
  2657.             TakeDamage(poisonDamage * 0.5, myPoisoner, Location, vect(0,0,0), 'PoisonEffect'); //CyberP: since we have thrice as effective tranq darts, reduce poison damage to player by half. 15 dam per interval on hardcore
  2658.         }
  2659.         if ((poisonCounter <= 0) || (Health <= 0))
  2660.             StopPoison();
  2661.     }
  2662. }
  2663.  
  2664. // ----------------------------------------------------------------------
  2665. // StartPoison()
  2666. //
  2667. // Gakk!  We've been poisoned!
  2668. // ----------------------------------------------------------------------
  2669.  
  2670. function StartPoison( Pawn poisoner, int Damage )
  2671. {
  2672.     myPoisoner = poisoner;
  2673.  
  2674.     if (myPoisoner.weapon.IsA('WeaponGreaselSpit') && FRand() < 0.3)
  2675.     PlaySound(sound'MaleCough',SLOT_Pain);    //CyberP: cough to greasel spit
  2676.  
  2677.     if (Health <= 0)  // no more pain -- you're already dead!
  2678.         return;
  2679.  
  2680.     if (InConversation())  // kinda hacky...
  2681.         return;
  2682.  
  2683.     // CyberP: less poison if
  2684.     if (PerkNamesArray[20]==1)
  2685.     poisonCounter = 3;
  2686.     else
  2687.     poisonCounter = 4;   // take damage no more than four times (over 8 seconds)
  2688.  
  2689.     poisonTimer   = 0;    // reset pain timer
  2690.     if (poisonDamage < Damage)  // set damage amount
  2691.         poisonDamage = Damage;
  2692.  
  2693.         // CyberP: Don't do drug effects if
  2694.  
  2695.         if (PerkNamesArray[20]==1 && poisonCounter > 0)
  2696.         drugEffectTimer = 0;
  2697.         else
  2698.         drugEffectTimer += 3;  // make the player vomit for the next four seconds
  2699.  
  2700.     // In multiplayer, don't let the effect last longer than 30 seconds
  2701.     if ( Level.NetMode != NM_Standalone )
  2702.     {
  2703.         if ( drugEffectTimer > 30 )
  2704.             drugEffectTimer = 30;
  2705.     }
  2706. }
  2707.  
  2708. // ----------------------------------------------------------------------
  2709. // StopPoison()
  2710. //
  2711. // Stop the pain
  2712. // ----------------------------------------------------------------------
  2713.  
  2714. function StopPoison()
  2715. {
  2716.     myPoisoner = None;
  2717.     poisonCounter = 0;
  2718.     poisonTimer   = 0;
  2719.     poisonDamage  = 0;
  2720. }
  2721.  
  2722. // ----------------------------------------------------------------------
  2723. // SpawnEMPSparks()
  2724. //
  2725. // Spawn sparks for items affected by Warren's EMP Field
  2726. // ----------------------------------------------------------------------
  2727.  
  2728. function SpawnEMPSparks(Actor empActor, Rotator rot)
  2729. {
  2730.     local ParticleGenerator sparkGen;
  2731.  
  2732.     if ((empActor == None) || empActor.bDeleteMe)
  2733.         return;
  2734.  
  2735.     sparkGen = Spawn(class'ParticleGenerator', empActor,, empActor.Location, rot);
  2736.     if (sparkGen != None)
  2737.     {
  2738.         sparkGen.SetBase(empActor);
  2739.         sparkGen.LifeSpan = 3;
  2740.         sparkGen.particleTexture = Texture'Effects.Fire.SparkFX1';
  2741.         sparkGen.particleDrawScale = 0.1;
  2742.         sparkGen.bRandomEject = True;
  2743.         sparkGen.ejectSpeed = 100.0;
  2744.         sparkGen.bGravity = True;
  2745.         sparkGen.bParticlesUnlit = True;
  2746.         sparkGen.frequency = 1.0;
  2747.         sparkGen.riseRate = 10;
  2748.         sparkGen.spawnSound = Sound'Spark2';
  2749.     }
  2750. }
  2751.  
  2752. // ----------------------------------------------------------------------
  2753. // UpdateWarrenEMPField()
  2754. //
  2755. // Update Warren's EMP field
  2756. // ----------------------------------------------------------------------
  2757.  
  2758. function UpdateWarrenEMPField(float deltaTime)
  2759. {
  2760.     local float          empRadius;
  2761.     local Robot          curRobot;
  2762.     local AlarmUnit      curAlarm;
  2763.     local AutoTurret     curTurret;
  2764.     local LaserTrigger   curLaser;
  2765.     local BeamTrigger    curBeam;
  2766.     local SecurityCamera curCamera;
  2767.     local int            option;
  2768.  
  2769.     if (bWarrenEMPField)
  2770.     {
  2771.         WarrenTimer -= deltaTime;
  2772.         if (WarrenTimer <= 0)
  2773.         {
  2774.             WarrenTimer = 0.15;
  2775.  
  2776.             empRadius = 600;
  2777.             if (WarrenSlot == 0)
  2778.             {
  2779.                 foreach RadiusActors(Class'Robot', curRobot, empRadius)
  2780.                 {
  2781.                     if ((curRobot.LastRendered() < 2.0) && (curRobot.CrazedTimer <= 0) &&
  2782.                         (curRobot.EMPHitPoints > 0))
  2783.                     {
  2784.                         if (curRobot.GetPawnAllianceType(self) == ALLIANCE_Hostile)
  2785.                             option = Rand(2);
  2786.                         else
  2787.                             option = 0;
  2788.                         if (option == 0)
  2789.                             curRobot.TakeDamage(curRobot.EMPHitPoints*2, self, curRobot.Location, vect(0,0,0), 'EMP');
  2790.                         else
  2791.                             curRobot.TakeDamage(100, self, curRobot.Location, vect(0,0,0), 'NanoVirus');
  2792.                         SpawnEMPSparks(curRobot, Rotator(Location-curRobot.Location));
  2793.                     }
  2794.                 }
  2795.             }
  2796.             else if (WarrenSlot == 1)
  2797.             {
  2798.                 foreach RadiusActors(Class'AlarmUnit', curAlarm, empRadius)
  2799.                 {
  2800.                     if ((curAlarm.LastRendered() < 2.0) && !curAlarm.bConfused)
  2801.                     {
  2802.                         curAlarm.TakeDamage(100, self, curAlarm.Location, vect(0,0,0), 'EMP');
  2803.                         SpawnEMPSparks(curAlarm, curAlarm.Rotation);
  2804.                     }
  2805.                 }
  2806.             }
  2807.             else if (WarrenSlot == 2)
  2808.             {
  2809.                 foreach RadiusActors(Class'AutoTurret', curTurret, empRadius)
  2810.                 {
  2811.                     if ((curTurret.LastRendered() < 2.0) && !curTurret.bConfused)
  2812.                     {
  2813.                         curTurret.TakeDamage(100, self, curTurret.Location, vect(0,0,0), 'EMP');
  2814.                         SpawnEMPSparks(curTurret, Rotator(Location-curTurret.Location));
  2815.                     }
  2816.                 }
  2817.             }
  2818.             else if (WarrenSlot == 3)
  2819.             {
  2820.                 foreach RadiusActors(Class'LaserTrigger', curLaser, empRadius)
  2821.                 {
  2822.                     if ((curLaser.LastRendered() < 2.0) && !curLaser.bConfused)
  2823.                     {
  2824.                         curLaser.TakeDamage(100, self, curLaser.Location, vect(0,0,0), 'EMP');
  2825.                         SpawnEMPSparks(curLaser, curLaser.Rotation);
  2826.                     }
  2827.                 }
  2828.             }
  2829.             else if (WarrenSlot == 4)
  2830.             {
  2831.                 foreach RadiusActors(Class'BeamTrigger', curBeam, empRadius)
  2832.                 {
  2833.                     if ((curBeam.LastRendered() < 2.0) && !curBeam.bConfused)
  2834.                     {
  2835.                         curBeam.TakeDamage(100, self, curBeam.Location, vect(0,0,0), 'EMP');
  2836.                         SpawnEMPSparks(curBeam, curBeam.Rotation);
  2837.                     }
  2838.                 }
  2839.             }
  2840.             else if (WarrenSlot == 5)
  2841.             {
  2842.                 foreach RadiusActors(Class'SecurityCamera', curCamera, empRadius)
  2843.                 {
  2844.                     if ((curCamera.LastRendered() < 2.0) && !curCamera.bConfused)
  2845.                     {
  2846.                         curCamera.TakeDamage(100, self, curCamera.Location, vect(0,0,0), 'EMP');
  2847.                         SpawnEMPSparks(curCamera, Rotator(Location-curCamera.Location));
  2848.                     }
  2849.                 }
  2850.             }
  2851.  
  2852.             WarrenSlot++;
  2853.             if (WarrenSlot >= 6)
  2854.                 WarrenSlot = 0;
  2855.         }
  2856.     }
  2857. }
  2858.  
  2859.  
  2860. // ----------------------------------------------------------------------
  2861. // UpdateTranslucency()
  2862. // DEUS_EX AMSD Try to make the player harder to see if he is in darkness.
  2863. // ----------------------------------------------------------------------
  2864.  
  2865. function UpdateTranslucency(float DeltaTime)
  2866. {
  2867.     local float DarkVis;
  2868.     local float CamoVis;
  2869.     local AdaptiveArmor armor;
  2870.     local bool bMakeTranslucent;
  2871.     local DeusExMPGame Game;
  2872.  
  2873.     // Don't do it in multiplayer.
  2874.     if (Level.NetMode == NM_Standalone)
  2875.       return;
  2876.  
  2877.     Game = DeusExMPGame(Level.Game);
  2878.     if (Game == None)
  2879.     {
  2880.       return;
  2881.     }
  2882.  
  2883.     bMakeTranslucent = false;
  2884.  
  2885.     //DarkVis = AIVisibility(TRUE);
  2886.     DarkVis = 1.0;
  2887.  
  2888.     CamoVis = 1.0;
  2889.  
  2890.     //Check cloaking.
  2891.     if (AugmentationSystem.GetAugLevelValue(class'AugCloak') != -1.0)
  2892.     {
  2893.       bMakeTranslucent = TRUE;
  2894.       CamoVis = Game.CloakEffect;
  2895.     }
  2896.  
  2897.     // If you have a weapon out, scale up the camo and turn off the cloak.
  2898.     // Adaptive armor leaves you completely invisible, but drains quickly.
  2899.     if ((inHand != None) && (inHand.IsA('DeusExWeapon')) && (CamoVis < 1.0))
  2900.     {
  2901.       CamoVis = 1.0;
  2902.       bMakeTranslucent=FALSE;
  2903.       ClientMessage(WeaponUnCloak);
  2904.       AugmentationSystem.FindAugmentation(class'AugCloak').Deactivate();
  2905.     }
  2906.  
  2907.     // go through the actor list looking for owned AdaptiveArmor
  2908.     // since they aren't in the inventory anymore after they are used
  2909.     if (UsingChargedPickup(class'AdaptiveArmor'))
  2910.       {
  2911.          CamoVis = CamoVis * Game.CloakEffect;
  2912.          bMakeTranslucent = TRUE;
  2913.       }
  2914.  
  2915.     ScaleGlow = Default.ScaleGlow * CamoVis * DarkVis;
  2916.  
  2917.     //Translucent is < 0.1, untranslucent if > 0.2, not same edge to prevent sharp breaks.
  2918.     if (bMakeTranslucent)
  2919.     {
  2920.       Style = STY_Translucent;
  2921.       if (Self.IsA('JCDentonMale'))
  2922.       {
  2923.          MultiSkins[6] = Texture'BlackMaskTex';
  2924.          MultiSkins[7] = Texture'BlackMaskTex';
  2925.       }
  2926.     }
  2927.     else if (Game.bDarkHiding)
  2928.     {
  2929.       if (CamoVis * DarkVis < Game.StartHiding)
  2930.          Style = STY_Translucent;
  2931.       if (CamoVis * DarkVis > Game.EndHiding)
  2932.          Style = Default.Style;
  2933.     }
  2934.     else if (!bMakeTranslucent)
  2935.     {
  2936.       if (Self.IsA('JCDentonMale'))
  2937.       {
  2938.          MultiSkins[6] = Default.MultiSkins[6];
  2939.          MultiSkins[7] = Default.MultiSkins[7];
  2940.       }
  2941.       Style = Default.Style;
  2942.     }
  2943. }
  2944.  
  2945. // ----------------------------------------------------------------------
  2946. // RestoreSkillPoints()
  2947. //
  2948. // Restore skill point variables
  2949. // ----------------------------------------------------------------------
  2950.  
  2951. function RestoreSkillPoints()
  2952. {
  2953.     local name flagName;
  2954.  
  2955.     bSavingSkillsAugs = False;
  2956.  
  2957.     // Get the skill points available
  2958.     flagName = rootWindow.StringToName("SKTemp_SkillPointsAvail");
  2959.     if (flagBase.CheckFlag(flagName, FLAG_Int))
  2960.     {
  2961.         SkillPointsAvail = flagBase.GetInt(flagName);
  2962.         flagBase.DeleteFlag(flagName, FLAG_Int);
  2963.     }
  2964.  
  2965.     // Get the skill points total
  2966.     flagName = rootWindow.StringToName("SKTemp_SkillPointsTotal");
  2967.     if (flagBase.CheckFlag(flagName, FLAG_Int))
  2968.     {
  2969.         SkillPointsTotal = flagBase.GetInt(flagName);
  2970.         flagBase.DeleteFlag(flagName, FLAG_Int);
  2971.     }
  2972. }
  2973.  
  2974. // ----------------------------------------------------------------------
  2975. // SaveSkillPoints()
  2976. //
  2977. // Saves out skill points, used when starting a new game
  2978. // ----------------------------------------------------------------------
  2979.  
  2980. function SaveSkillPoints()
  2981. {
  2982.     local name flagName;
  2983.  
  2984.     // Save/Restore must be done as atomic unit
  2985.     if (bSavingSkillsAugs)
  2986.         return;
  2987.  
  2988.     bSavingSkillsAugs = True;
  2989.  
  2990.     // Save the skill points available
  2991.     flagName = rootWindow.StringToName("SKTemp_SkillPointsAvail");
  2992.     flagBase.SetInt(flagName, SkillPointsAvail);
  2993.  
  2994.     // Save the skill points available
  2995.     flagName = rootWindow.StringToName("SKTemp_SkillPointsTotal");
  2996.     flagBase.SetInt(flagName, SkillPointsTotal);
  2997. }
  2998.  
  2999. // ----------------------------------------------------------------------
  3000. // AugAdd()
  3001. //
  3002. // Augmentation system functions
  3003. // exec functions for command line for demo
  3004. // ----------------------------------------------------------------------
  3005.  
  3006. exec function AugAdd(class<Augmentation> aWantedAug)
  3007. {
  3008.     local Augmentation anAug;
  3009.  
  3010.     if (!bCheatsEnabled)
  3011.         return;
  3012.  
  3013.     if (AugmentationSystem != None)
  3014.     {
  3015.         anAug = AugmentationSystem.GivePlayerAugmentation(aWantedAug);
  3016.  
  3017.         if (anAug == None)
  3018.             ClientMessage(GetItemName(String(aWantedAug)) $ " is not a valid augmentation!");
  3019.     }
  3020. }
  3021.  
  3022. // ----------------------------------------------------------------------
  3023. // ActivateAugmentation()
  3024. // ----------------------------------------------------------------------
  3025.  
  3026. exec function ActivateAugmentation(int num)
  3027. {
  3028.     local Augmentation anAug;
  3029.     local int count, wantedSlot, slotIndex;
  3030.     local bool bFound;
  3031.  
  3032.     if (RestrictInput())
  3033.         return;
  3034.  
  3035.     if (Energy == 0)
  3036.     {
  3037.         ClientMessage(EnergyDepleted);
  3038.         PlaySound(AugmentationSystem.FirstAug.DeactivateSound, SLOT_None);
  3039.         return;
  3040.     }
  3041.  
  3042.     if (AugmentationSystem != None)
  3043.         AugmentationSystem.ActivateAugByKey(num);
  3044. }
  3045.  
  3046. // ----------------------------------------------------------------------
  3047. // ActivateAllAugs()
  3048. // ----------------------------------------------------------------------
  3049.  
  3050. exec function ActivateAllAugs()
  3051. {
  3052.     if (AugmentationSystem != None)
  3053.         AugmentationSystem.ActivateAll();
  3054. }
  3055.  
  3056. // ----------------------------------------------------------------------
  3057. // DeactivateAllAugs()
  3058. // ----------------------------------------------------------------------
  3059.  
  3060. exec function DeactivateAllAugs()
  3061. {
  3062.     if (AugmentationSystem != None)
  3063.         AugmentationSystem.DeactivateAll();
  3064. }
  3065.  
  3066. // ----------------------------------------------------------------------
  3067. // SwitchAmmo()
  3068. // ----------------------------------------------------------------------
  3069.  
  3070. exec function SwitchAmmo()
  3071. {
  3072.     if (inHand.IsA('DeusExWeapon'))
  3073.         DeusExWeapon(inHand).CycleAmmo();
  3074. }
  3075.  
  3076. // ----------------------------------------------------------------------
  3077. // RemoveInventoryType()
  3078. // ----------------------------------------------------------------------
  3079.  
  3080. function RemoveInventoryType(Class<Inventory> removeType)
  3081. {
  3082.     local Inventory item;
  3083.  
  3084.     item = FindInventoryType(removeType);
  3085.  
  3086.     if (item != None)
  3087.         DeleteInventory(item);
  3088. }
  3089.  
  3090. // ----------------------------------------------------------------------
  3091. // AddAugmentationDisplay()
  3092. // ----------------------------------------------------------------------
  3093.  
  3094. function AddAugmentationDisplay(Augmentation aug)
  3095. {
  3096.     //DEUS_EX AMSD Added none check here.
  3097.     if ((rootWindow != None) && (aug != None))
  3098.         DeusExRootWindow(rootWindow).hud.activeItems.AddIcon(aug.SmallIcon, aug);
  3099. }
  3100.  
  3101. // ----------------------------------------------------------------------
  3102. // RemoveAugmentationDisplay()
  3103. // ----------------------------------------------------------------------
  3104.  
  3105. function RemoveAugmentationDisplay(Augmentation aug)
  3106. {
  3107.     DeusExRootWindow(rootWindow).hud.activeItems.RemoveIcon(aug);
  3108. }
  3109.  
  3110. // ----------------------------------------------------------------------
  3111. // ClearAugmentationDisplay()
  3112. // ----------------------------------------------------------------------
  3113.  
  3114. function ClearAugmentationDisplay()
  3115. {
  3116.     DeusExRootWindow(rootWindow).hud.activeItems.ClearAugmentationDisplay();
  3117. }
  3118.  
  3119. // ----------------------------------------------------------------------
  3120. // UpdateAugmentationDisplayStatus()
  3121. // ----------------------------------------------------------------------
  3122.  
  3123. function UpdateAugmentationDisplayStatus(Augmentation aug)
  3124. {
  3125.     DeusExRootWindow(rootWindow).hud.activeItems.UpdateAugIconStatus(aug);
  3126. }
  3127.  
  3128. // ----------------------------------------------------------------------
  3129. // AddChargedDisplay()
  3130. // ----------------------------------------------------------------------
  3131.  
  3132. function AddChargedDisplay(ChargedPickup item)
  3133. {
  3134.     if ( (PlayerIsClient()) || (Level.NetMode == NM_Standalone) )
  3135.       DeusExRootWindow(rootWindow).hud.activeItems.AddIcon(item.ChargedIcon, item);
  3136. }
  3137.  
  3138. // ----------------------------------------------------------------------
  3139. // RemoveChargedDisplay()
  3140. // ----------------------------------------------------------------------
  3141.  
  3142. function RemoveChargedDisplay(ChargedPickup item)
  3143. {
  3144.     if ( (PlayerIsClient()) || (Level.NetMode == NM_Standalone) )
  3145.       DeusExRootWindow(rootWindow).hud.activeItems.RemoveIcon(item);
  3146. }
  3147.  
  3148. // ----------------------------------------------------------------------
  3149. // ActivateKeypadWindow()
  3150. // DEUS_EX AMSD Has to be here because player doesn't own keypad, so
  3151. // func rep doesn't work right.
  3152. // ----------------------------------------------------------------------
  3153. function ActivateKeypadWindow(Keypad KPad, bool bHacked)
  3154. {
  3155.     KPad.ActivateKeypadWindow(Self, bHacked);
  3156. }
  3157.  
  3158. function KeypadRunUntriggers(Keypad KPad)
  3159. {
  3160.     KPad.RunUntriggers(Self);
  3161. }
  3162.  
  3163. function KeypadRunEvents(Keypad KPad, bool bSuccess)
  3164. {
  3165.     KPad.RunEvents(Self, bSuccess);
  3166. }
  3167.  
  3168. function KeypadToggleLocks(Keypad KPad)
  3169. {
  3170.     KPad.ToggleLocks(Self);
  3171. }
  3172.  
  3173. // ----------------------------------------------------------------------
  3174. // Multiplayer computer functions
  3175. // ----------------------------------------------------------------------
  3176.  
  3177. //server->client (computer to frobber)
  3178. function InvokeComputerScreen(Computers computerToActivate, float CompHackTime, float ServerLevelTime)
  3179. {
  3180.     local NetworkTerminal termwindow;
  3181.     local DeusExRootWindow root;
  3182.  
  3183.     computerToActivate.LastHackTime = CompHackTime + (Level.TimeSeconds - ServerLevelTime);
  3184.  
  3185.     ActiveComputer = ComputerToActivate;
  3186.  
  3187.     //only allow for clients or standalone
  3188.     if ((Level.NetMode != NM_Standalone) && (!PlayerIsClient()))
  3189.     {
  3190.       ActiveComputer = None;
  3191.       CloseComputerScreen(computerToActivate);
  3192.       return;
  3193.     }
  3194.  
  3195.     root = DeusExRootWindow(rootWindow);
  3196.     if (root != None)
  3197.     {
  3198.       termwindow = NetworkTerminal(root.InvokeUIScreen(computerToActivate.terminalType, True));
  3199.       if (termwindow != None)
  3200.       {
  3201.             computerToActivate.termwindow = termwindow;
  3202.          termWindow.SetCompOwner(computerToActivate);
  3203.          // If multiplayer, start hacking if there are no users
  3204.          if ((Level.NetMode != NM_Standalone) && (!termWindow.bHacked) && (computerToActivate.NumUsers() == 0) &&
  3205.              (termWindow.winHack != None) && (termWindow.winHack.btnHack != None))
  3206.          {
  3207.             termWindow.winHack.StartHack();
  3208.             termWindow.winHack.btnHack.SetSensitivity(False);
  3209.             termWindow.FirstScreen=None;
  3210.          }
  3211.          termWindow.ShowFirstScreen();
  3212.       }
  3213.     }
  3214.     if ((termWindow == None)  || (root == None))
  3215.     {
  3216.       CloseComputerScreen(computerToActivate);
  3217.       ActiveComputer = None;
  3218.     }
  3219. }
  3220.  
  3221.  
  3222. // CloseThisComputer is for the client (used at the end of a mp match)
  3223.  
  3224. function CloseThisComputer( Computers comp )
  3225. {
  3226.     if ((comp != None) && ( comp.termwindow != None ))
  3227.         comp.termwindow.CloseScreen("EXIT");
  3228. }
  3229.  
  3230. //client->server (window to player)
  3231. function CloseComputerScreen(Computers computerToClose)
  3232. {
  3233.     computerToClose.CloseOut();
  3234. }
  3235.  
  3236. //client->server (window to player)
  3237. function SetComputerHackTime(Computers computerToSet, float HackTime, float ClientLevelTime)
  3238. {
  3239.     computerToSet.lastHackTime = HackTime + (Level.TimeSeconds - ClientLevelTime);
  3240. }
  3241.  
  3242. //client->server (window to player)
  3243. function UpdateCameraRotation(SecurityCamera camera, Rotator rot)
  3244. {
  3245.     camera.DesiredRotation = rot;
  3246. }
  3247.  
  3248. //client->server (window to player)
  3249. function ToggleCameraState(SecurityCamera cam, ElectronicDevices compOwner)
  3250. {
  3251.     if (cam.bActive)
  3252.     {
  3253.       cam.UnTrigger(compOwner, self);
  3254.       cam.team = -1;
  3255.     }
  3256.     else
  3257.     {
  3258.       MakeCameraAlly(cam);
  3259.       cam.Trigger(compOwner, self);
  3260.     }
  3261.  
  3262.     // Make sure the camera isn't in bStasis=True
  3263.     // so it responds to our every whim.
  3264.     cam.bStasis = False;
  3265. }
  3266.  
  3267. //client->server (window to player)
  3268. function SetTurretState(AutoTurret turret, bool bActive, bool bDisabled)
  3269. {
  3270.     turret.bActive   = bActive;
  3271.     turret.bDisabled = bDisabled;
  3272.     turret.bComputerReset = False;
  3273. }
  3274.  
  3275. //client->server (window to player)
  3276. function SetTurretTrackMode(ComputerSecurity computer, AutoTurret turret, bool bTrackPlayers, bool bTrackPawns)
  3277. {
  3278.     local String str;
  3279.  
  3280.     turret.bTrackPlayersOnly = bTrackPlayers;
  3281.     turret.bTrackPawnsOnly   = bTrackPawns;
  3282.     turret.bComputerReset = False;
  3283.  
  3284.     //in multiplayer, behave differently
  3285.     //set the safe target to ourself.
  3286.     if (Level.NetMode != NM_Standalone)
  3287.     {
  3288.       //we abuse the names of the booleans here.
  3289.         turret.SetSafeTarget( Self );
  3290.  
  3291.         if (Role == ROLE_Authority)
  3292.         {
  3293.             if ( TeamDMGame(DXGame) != None )
  3294.             {
  3295.                 computer.team = PlayerReplicationInfo.team;
  3296.                 turret.team = PlayerReplicationInfo.Team;
  3297.                 if ( !turret.bDisabled )
  3298.                 {
  3299.                     str = TakenOverString $ turret.titleString $ ".";
  3300.                     TeamSay( str );
  3301.                 }
  3302.             }
  3303.             else
  3304.             {
  3305.                 computer.team = PlayerReplicationInfo.PlayerID;
  3306.                 turret.team = PlayerReplicationInfo.PlayerID;
  3307.             }
  3308.         }
  3309.     }
  3310. }
  3311.  
  3312. //client->server (window to player)
  3313. function MakeCameraAlly(SecurityCamera camera)
  3314. {
  3315.     Camera.SafeTarget = Self;
  3316.     if (Level.Game.IsA('TeamDMGame'))
  3317.       Camera.Team = PlayerReplicationInfo.Team;
  3318.     else
  3319.       Camera.Team = PlayerReplicationInfo.PlayerID;
  3320. }
  3321.  
  3322. //client->server (window to player)
  3323. function PunishDetection(int DamageAmount)
  3324. {
  3325.     if (DamageAmount > 0)
  3326.       TakeDamage(DamageAmount, None, vect(0,0,0), vect(0,0,0), 'EMP');
  3327. }
  3328.  
  3329. // ----------------------------------------------------------------------
  3330. // AddDamageDisplay()
  3331. //
  3332. // Turn on the correct damage type icon on the HUD
  3333. // Note that these icons naturally fade out after a few seconds,
  3334. // so there is no need to turn them off
  3335. // ----------------------------------------------------------------------
  3336.  
  3337. function AddDamageDisplay(name damageType, vector hitOffset)
  3338. {
  3339.     DeusExRootWindow(rootWindow).hud.damageDisplay.AddIcon(damageType, hitOffset);
  3340. }
  3341.  
  3342. // ----------------------------------------------------------------------
  3343. // SetDamagePercent()
  3344. //
  3345. // Set the percentage amount of damage that's being absorbed
  3346. // ----------------------------------------------------------------------
  3347.  
  3348. function SetDamagePercent(float percent)
  3349. {
  3350.     DeusExRootWindow(rootWindow).hud.damageDisplay.SetPercent(percent);
  3351. }
  3352.  
  3353. // ----------------------------------------------------------------------
  3354. // default sound functions
  3355. // ----------------------------------------------------------------------
  3356.  
  3357. // ----------------------------------------------------------------------
  3358. // PlayBodyThud()
  3359. //
  3360. // this is called by MESH NOTIFY
  3361. // ----------------------------------------------------------------------
  3362.  
  3363. function PlayBodyThud()
  3364. {
  3365.     PlaySound(sound'BodyThud', SLOT_Interact);
  3366. }
  3367.  
  3368. // ----------------------------------------------------------------------
  3369. // GetWallMaterial()
  3370. //
  3371. // gets the name of the texture group that we are facing
  3372. // ----------------------------------------------------------------------
  3373.  
  3374. function name GetWallMaterial(out vector wallNormal)
  3375. {
  3376.     local vector EndTrace, HitLocation, HitNormal;
  3377.     local actor target;
  3378.     local int texFlags, grabDist;
  3379.     local name texName, texGroup;
  3380.  
  3381.     // if we are falling, then increase our grabbing distance
  3382.     if (Physics == PHYS_Falling)
  3383.         grabDist = 3.0;
  3384.     else
  3385.         grabDist = 1.5;
  3386.  
  3387.     // trace out in front of us
  3388.     EndTrace = Location + (Vector(Rotation) * CollisionRadius * grabDist);
  3389.  
  3390.     foreach TraceTexture(class'Actor', target, texName, texGroup, texFlags, HitLocation, HitNormal, EndTrace)
  3391.     {
  3392.         if ((target == Level) || target.IsA('Mover'))
  3393.             break;
  3394.     }
  3395.  
  3396.     wallNormal = HitNormal;
  3397.  
  3398.     return texGroup;
  3399. }
  3400.  
  3401. // ----------------------------------------------------------------------
  3402. // GetFloorMaterial()
  3403. //
  3404. // gets the name of the texture group that we are standing on
  3405. // ----------------------------------------------------------------------
  3406.  
  3407. function name GetFloorMaterial()
  3408. {
  3409.     local vector EndTrace, HitLocation, HitNormal;
  3410.     local actor target;
  3411.     local int texFlags;
  3412.     local name texName, texGroup;
  3413.  
  3414.     // trace down to our feet
  3415.     EndTrace = Location - CollisionHeight * 2 * vect(0,0,1);
  3416.  
  3417.     foreach TraceTexture(class'Actor', target, texName, texGroup, texFlags, HitLocation, HitNormal, EndTrace)
  3418.     {
  3419.         if ((target == Level) || target.IsA('Mover'))
  3420.             break;
  3421.     }
  3422.  
  3423.     if (target != None && target.IsA('DeusExMover')) //CyberP: special case for movers.
  3424.     {
  3425.      if (target.IsA('BreakableGlass'))
  3426.         texGroup = 'Glass';
  3427.      else if (DeusExMover(target).FragmentClass == Class'DeusEx.WoodFragment')
  3428.         texGroup = 'Wood';
  3429.      else if (DeusExMover(target).FragmentClass == Class'DeusEx.MetalFragment')
  3430.         texGroup = 'Metal';
  3431.      else
  3432.         texGroup = 'Stucco';
  3433.     }
  3434.  
  3435.     return texGroup;
  3436. }
  3437.  
  3438. // ----------------------------------------------------------------------
  3439. // PlayFootStep()
  3440. //
  3441. // plays footstep sounds based on the texture group
  3442. // yes, I know this looks nasty -- I'll have to figure out a cleaner
  3443. // way to do this
  3444. // ----------------------------------------------------------------------
  3445.  
  3446. simulated function PlayFootStep()
  3447. {
  3448.     local Sound stepSound;
  3449.     local float rnd;
  3450.     local float speedFactor, massFactor;
  3451.     local float volume, pitch, range;
  3452.     local float radius, mult;
  3453.     local float volumeMultiplier,volumeMod;
  3454.     local DeusExPlayer pp;
  3455.     local bool bOtherPlayer;
  3456.     local float shakeTime, shakeRoll, shakeVert;
  3457.  
  3458.     // Only do this on ourself, since this takes into account aug stealth and such
  3459.     if ( Level.NetMode != NM_StandAlone )
  3460.         pp = DeusExPlayer( GetPlayerPawn() );
  3461.  
  3462.     if ( pp != Self )
  3463.         bOtherPlayer = True;
  3464.     else
  3465.         bOtherPlayer = False;
  3466.  
  3467.     rnd = FRand();
  3468.  
  3469.     volumeMultiplier = 1.0;
  3470.     if (IsInState('PlayerSwimming') || (Physics == PHYS_Swimming))
  3471.     {
  3472.         volumeMultiplier = 0.5;
  3473.         if (rnd < 0.5)
  3474.             stepSound = Sound'Swimming';
  3475.         else
  3476.             stepSound = Sound'Treading';
  3477.     }
  3478.     else if (FootRegion.Zone.bWaterZone)
  3479.     {
  3480.         volumeMultiplier = 1.0;
  3481.         if (rnd < 0.33)
  3482.             stepSound = Sound'WaterStep1';
  3483.         else if (rnd < 0.66)
  3484.             stepSound = Sound'WaterStep2';
  3485.         else
  3486.             stepSound = Sound'WaterStep3';
  3487.     }
  3488.     else
  3489.     {
  3490.         switch(FloorMaterial)
  3491.         {
  3492.             case 'Textile':
  3493.             case 'Paper':
  3494.                 volumeMultiplier = 0.6;
  3495.                 if (rnd < 0.25)
  3496.                     stepSound = Sound'CarpetStep1';
  3497.                 else if (rnd < 0.5)
  3498.                     stepSound = Sound'CarpetStep2';
  3499.                 else if (rnd < 0.75)
  3500.                     stepSound = Sound'CarpetStep3';
  3501.                 else
  3502.                     stepSound = Sound'CarpetStep4';
  3503.                 break;
  3504.  
  3505.                 case 'Earth':
  3506.                 volumeMultiplier = 0.8;
  3507.                 if (rnd < 0.25)
  3508.                     stepSound = Sound'DIRT1';
  3509.                 else if (rnd < 0.5)
  3510.                     stepSound = Sound'DIRT2';
  3511.                 else if (rnd < 0.75)
  3512.                     stepSound = Sound'DIRT3';
  3513.                 else
  3514.                     stepSound = Sound'DIRT4';
  3515.                 break;
  3516.  
  3517.             case 'Foliage':
  3518.                 volumeMultiplier = 0.7;
  3519.                 if (rnd < 0.25)
  3520.                     stepSound = Sound'GrassStep1';
  3521.                 else if (rnd < 0.5)
  3522.                     stepSound = Sound'GrassStep2';
  3523.                 else if (rnd < 0.75)
  3524.                     stepSound = Sound'GrassStep3';
  3525.                 else
  3526.                     stepSound = Sound'GrassStep4';
  3527.                 break;
  3528.  
  3529.             case 'Metal':
  3530.                 volumeMultiplier = 0.9;
  3531.             if (bThisMission)
  3532.             {
  3533.             if (rnd < 0.25)
  3534.                     stepSound = Sound'GRATE1';
  3535.                 else if (rnd < 0.5)
  3536.                     stepSound = Sound'GRATE2';
  3537.                 else if (rnd < 0.75)
  3538.                     stepSound = Sound'GRATE3';
  3539.                 else
  3540.                     stepSound = Sound'GRATE4';
  3541.             }
  3542.             else
  3543.             {
  3544.                 if (rnd < 0.25)
  3545.                     stepSound = Sound'MetalStep1';
  3546.                 else if (rnd < 0.5)
  3547.                     stepSound = Sound'MetalStep2';
  3548.                 else if (rnd < 0.75)
  3549.                     stepSound = Sound'MetalStep3';
  3550.                 else
  3551.                     stepSound = Sound'MetalStep4';
  3552.             }
  3553.                 break;
  3554.  
  3555.             case 'Ladder':
  3556.                 volumeMultiplier = 1.0;
  3557.                 if (rnd < 0.25)
  3558.                     stepSound = Sound'GRATE1';
  3559.                 else if (rnd < 0.5)
  3560.                     stepSound = Sound'GRATE2';
  3561.                 else if (rnd < 0.75)
  3562.                     stepSound = Sound'GRATE3';
  3563.                 else
  3564.                     stepSound = Sound'GRATE4';
  3565.                  break;
  3566.  
  3567.             case 'Glass':
  3568.             volumeMultiplier = 0.7;
  3569.                 if (rnd < 0.25)
  3570.                     stepSound = Sound'GLASS1';
  3571.                 else if (rnd < 0.5)
  3572.                     stepSound = Sound'GLASS2';
  3573.                 else if (rnd < 0.75)
  3574.                     stepSound = Sound'GLASS3';
  3575.                 else
  3576.                     stepSound = Sound'GLASS4';
  3577.                 break;
  3578.  
  3579.             case 'Ceramic':
  3580.             case 'Tiles':
  3581.                 volumeMultiplier = 0.75;
  3582.                 if (rnd < 0.25)
  3583.                     stepSound = Sound'TileStep1';
  3584.                 else if (rnd < 0.5)
  3585.                     stepSound = Sound'TileStep2';
  3586.                 else if (rnd < 0.75)
  3587.                     stepSound = Sound'TileStep3';
  3588.                 else
  3589.                     stepSound = Sound'TileStep4';
  3590.                 break;
  3591.  
  3592.             case 'Wood':
  3593.                 volumeMultiplier = 0.8;
  3594.                 if (rnd < 0.25)
  3595.                     stepSound = Sound'WoodStep1';
  3596.                 else if (rnd < 0.5)
  3597.                     stepSound = Sound'WoodStep2';
  3598.                 else if (rnd < 0.75)
  3599.                     stepSound = Sound'WoodStep3';
  3600.                 else
  3601.                     stepSound = Sound'WoodStep4';
  3602.                 break;
  3603.  
  3604.             case 'Stucco':
  3605.             volumeMultiplier = 0.7;
  3606.                 if (rnd < 0.25)
  3607.                     stepSound = Sound'CARDB1';
  3608.                 else if (rnd < 0.5)
  3609.                     stepSound = Sound'CARDB2';
  3610.                 else if (rnd < 0.75)
  3611.                     stepSound = Sound'CARDB3';
  3612.                 else
  3613.                     stepSound = Sound'CARDB4';
  3614.                 break;
  3615.  
  3616.             case 'Brick':
  3617.             case 'Concrete':
  3618.             volumeMultiplier = 0.95;
  3619.                 if (rnd < 0.25)
  3620.                     stepSound = Sound'STEP1';
  3621.                 else if (rnd < 0.5)
  3622.                     stepSound = Sound'STEP2';
  3623.                 else if (rnd < 0.75)
  3624.                     stepSound = Sound'STEP3';
  3625.                 else
  3626.                     stepSound = Sound'STEP4';
  3627.                 break;
  3628.  
  3629.             case 'Stone':
  3630.             default:
  3631.                 volumeMultiplier = 0.8;
  3632.                 if (rnd < 0.25)
  3633.                     stepSound = Sound'StoneStep1';
  3634.                 else if (rnd < 0.5)
  3635.                     stepSound = Sound'StoneStep2';
  3636.                 else if (rnd < 0.75)
  3637.                     stepSound = Sound'StoneStep3';
  3638.                 else
  3639.                     stepSound = Sound'StoneStep4';
  3640.                 break;
  3641.         }
  3642.     }
  3643.  
  3644.     // compute sound volume, range and pitch, based on mass and speed
  3645.     if (IsInState('PlayerSwimming') || (Physics == PHYS_Swimming))
  3646.         speedFactor = WaterSpeed/180.0;
  3647.     else
  3648.         speedFactor = VSize(Velocity)/200.0; //CyberP: was 180
  3649.  
  3650.     massFactor  = Mass/150.0;
  3651.     radius      = 375.0;
  3652.     volume      = (speedFactor+0.2) * massFactor; //CyberP: SpeedF bonus Was +0.2
  3653.     range       = radius * volume;
  3654.     pitch       = (volume+0.5);
  3655.     volume      = FClamp(volume, 0, 1.0) * 0.5;     // Hack to compensate for increased footstep volume.
  3656.     range       = FClamp(range, 0.01, radius*4);
  3657.     pitch       = FClamp(pitch, 1.0, 1.5);
  3658.  
  3659.     // AugStealth decreases our footstep volume
  3660.     volume *= RunSilentValue;
  3661.  
  3662.      //CyberP: new sounds for landing from height.
  3663.     if (Velocity.Z < -350)
  3664.     {
  3665.     if (FloorMaterial=='Wood' && Velocity.Z > -500)
  3666.     stepSound=sound'WoodLand';
  3667.     else if (FloorMaterial=='Concrete' || FloorMaterial=='Stone' || FloorMaterial=='Tile')
  3668.     stepSound=sound'pcconcfall1';
  3669.     else if (FloorMaterial=='Wood')
  3670.     stepSound=sound'DSOOF2';
  3671.     else if (FloorMaterial=='Textile' || FloorMaterial=='Paper')
  3672.     stepSound=sound'CarpetLand';
  3673.     else if (FloorMaterial=='Earth' || FloorMaterial=='Foliage')
  3674.     stepSound=sound'pl_jumpland1';
  3675.     volume*=1.5;
  3676.     }
  3677.  
  3678.     if (Velocity.Z < -500)
  3679.     {
  3680.     if (((bThisMission) && (FloorMaterial=='Metal'))|| FloorMaterial=='Ladder')
  3681.     PlaySound(sound'bouncemetal',SLOT_None,volume*1.25,,,0.6);
  3682.     else if (FloorMaterial=='Metal')
  3683.     PlaySound(sound'MetalDoorClose',SLOT_None,volume*1.25,,,1.5);
  3684.     }
  3685.  
  3686.     //GMDX: modded for skill system stealth
  3687.     volumeMod=0.9;
  3688.     if (SkillSystem!=None && SkillSystem.GetSkillLevel(class'SkillStealth')>=1)
  3689.     {
  3690.         if (abs(Velocity.z)>20) volumeMod*=0.1; //no point really having landed caclucate when footstep overrides it, so a nasty hack is afoot.
  3691.         //if (SkillSystem.GetSkillLevel(class'SkillStealth')>1) volume *= 0.6;
  3692.     }
  3693.     //if (bJustLanded) log("PlayFootStep bJustLanded vol="@volume@": mod="@volumeMod@": Z="@Velocity.Z);
  3694.  
  3695.     if (bIsWalking)
  3696.     volume *= 0.3;  //CyberP: can walk up behind enemies.
  3697.     PlaySound(stepSound, SLOT_Interact, volume, , range, pitch);
  3698.     AISendEvent('LoudNoise', EAITYPE_Audio, volume*volumeMultiplier*volumeMod, range*volumeMultiplier);
  3699.  
  3700. }
  3701.  
  3702. // ----------------------------------------------------------------------
  3703. // IsHighlighted()
  3704. //
  3705. // checks to see if we should highlight this actor
  3706. // ----------------------------------------------------------------------
  3707.  
  3708. function bool IsHighlighted(actor A)
  3709. {
  3710.     if (bBehindView)
  3711.         return False;
  3712.  
  3713.     if (A != None)
  3714.     {
  3715.         if (A.bDeleteMe || A.bHidden)
  3716.             return False;
  3717.  
  3718.         if (A.IsA('Pawn'))
  3719.         {
  3720.             if (!bNPCHighlighting)
  3721.                 return False;
  3722.         }
  3723.  
  3724.         if (A.IsA('DeusExMover') && !DeusExMover(A).bHighlight)
  3725.             return False;
  3726.         else if (A.IsA('Mover') && !A.IsA('DeusExMover'))
  3727.             return False;
  3728.         else if (A.IsA('DeusExDecoration') && !DeusExDecoration(A).bHighlight)
  3729.             return False;
  3730.         else if (A.IsA('DeusExCarcass') && !DeusExCarcass(A).bHighlight)
  3731.             return False;
  3732.         else if (A.IsA('ThrownProjectile') && !ThrownProjectile(A).bHighlight)
  3733.             return False;
  3734.         else if (A.IsA('DeusExProjectile') && !DeusExProjectile(A).bStuck)
  3735.             return False;
  3736.         else if (A.IsA('ScriptedPawn') && !ScriptedPawn(A).bHighlight)
  3737.             return False;
  3738.     }
  3739.  
  3740.     return True;
  3741. }
  3742.  
  3743. // ----------------------------------------------------------------------
  3744. // IsFrobbable()
  3745. //
  3746. // is this actor frobbable?
  3747. // ----------------------------------------------------------------------
  3748.  
  3749. function bool IsFrobbable(actor A)
  3750. {
  3751.     if ((!A.bHidden)) //GMDX: so you it doesnt hightlight spoof &&(!A.IsA('WeaponGEPmounted'))
  3752.         if (A.IsA('Mover') || A.IsA('DeusExDecoration') || A.IsA('Inventory') ||
  3753.             A.IsA('ScriptedPawn') || A.IsA('DeusExCarcass') || A.IsA('DeusExProjectile'))
  3754.             return True;
  3755.  
  3756.     return False;
  3757. }
  3758.  
  3759. // ----------------------------------------------------------------------
  3760. // HighlightCenterObject()
  3761. //
  3762. // checks to see if an object can be frobbed, if so, then highlight it
  3763. // ----------------------------------------------------------------------
  3764.  
  3765. function HighlightCenterObject()
  3766. {
  3767.     local Actor target, smallestTarget;
  3768.     local Vector HitLoc, HitNormal, StartTrace, EndTrace;
  3769.     local DeusExRootWindow root;
  3770.     local float minSize;
  3771.     local bool bFirstTarget;
  3772.     local int skillz;
  3773.     local float shakeTime, shakeRoll, shakeVert;
  3774.     local float rnd;
  3775.  
  3776.     if (IsInState('Dying'))
  3777.         return;
  3778.  
  3779.     root = DeusExRootWindow(rootWindow);
  3780.  
  3781.     // only do the trace every tenth of a second
  3782.     if (FrobTime >= 0.1)
  3783.     {
  3784.       /*if (WallMaterial == 'Ladder' || FloorMaterial == 'Ladder') //CyberP: hack for ladder climbing sfx. Meh, inconsistent
  3785.       {
  3786.            if (Velocity.Z != 0 && FRand() < 0.25)
  3787.            {
  3788.            rnd = FRand();
  3789.            if (rnd < 0.25) PlaySound(Sound'GMDXSFX.Player.pl_ladder1',SLOT_None);
  3790.            else if (rnd < 0.5) PlaySound(Sound'GMDXSFX.Player.pl_ladder2',SLOT_None);
  3791.            else if (rnd < 0.75) PlaySound(Sound'GMDXSFX.Player.pl_ladder3',SLOT_None);
  3792.            else PlaySound(Sound'GMDXSFX.Player.pl_ladder4',SLOT_None);
  3793.            }
  3794.       } */
  3795.       if (inHand != None && inHand.IsA('Multitool'))
  3796.             {
  3797.                 if (self.IsA('DeusExPlayer') && PerkNamesArray[16]==1)
  3798.                 MaxFrobDistance = 768;
  3799.             }
  3800.         else
  3801.             {
  3802.                 MaxFrobDistance = 112;
  3803.             }
  3804.         // figure out how far ahead we should trace
  3805.         StartTrace = Location;
  3806.         EndTrace = Location + (Vector(ViewRotation) * MaxFrobDistance);
  3807.  
  3808.         // adjust for the eye height
  3809.         StartTrace.Z += BaseEyeHeight;
  3810.         EndTrace.Z += BaseEyeHeight;
  3811.  
  3812.         smallestTarget = None;
  3813.         minSize = 99999;
  3814.         bFirstTarget = True;
  3815.  
  3816.         if (bIsCrouching)
  3817.         {
  3818.         if (PerkNamesArray[29]==1)
  3819.         bCrouchRegen=True;
  3820.         if (Velocity.X != 0 || Velocity.Y != 0)
  3821.         {
  3822.         shakeTime = 0.1;
  3823.         shakeRoll = 24+24;
  3824.         shakeVert = 3;
  3825.         ShakeView(shakeTime, shakeRoll, shakeVert);
  3826.         }
  3827.         }
  3828.         else
  3829.         {
  3830.         bCrouchRegen=false;
  3831.         }
  3832.      if (inHand != none && inHand.IsA('Multitool'))
  3833.      {
  3834.         foreach TraceActors(class'Actor', target, HitLoc, HitNormal, EndTrace, StartTrace)
  3835.         {
  3836.         if (IsFrobbable(target) && (target != CarriedDecoration))
  3837.              {
  3838.                 if (target.IsA('HackableDevices'))
  3839.                 {
  3840.                 }
  3841.                 else
  3842.                 {
  3843.                 MaxFrobDistance=112;
  3844.                 StartTrace = Location;
  3845.                 EndTrace = Location + (Vector(ViewRotation) * MaxFrobDistance);
  3846.                 StartTrace.Z += BaseEyeHeight;
  3847.                 EndTrace.Z += BaseEyeHeight;
  3848.                 }
  3849.              }
  3850.         }
  3851.      }
  3852.         // find the object that we are looking at
  3853.         // make sure we don't select the object that we're carrying
  3854.         // use the last traced object as the target...this will handle
  3855.         // smaller items under larger items for example
  3856.         // ScriptedPawns always have precedence, though
  3857.         foreach TraceActors(class'Actor', target, HitLoc, HitNormal, EndTrace, StartTrace)
  3858.         {
  3859.             if (IsFrobbable(target) && (target != CarriedDecoration))
  3860.             {
  3861.                 if (target.IsA('ScriptedPawn'))
  3862.                 {
  3863.                     smallestTarget = target;
  3864.                     break;
  3865.                 }
  3866.                 else if (target.IsA('Mover') && bFirstTarget)
  3867.                 {
  3868.                     smallestTarget = target;
  3869.                     break;
  3870.                 }
  3871.                 else if (target.CollisionRadius < minSize)
  3872.                 {
  3873.                     minSize = target.CollisionRadius;
  3874.                     smallestTarget = target;
  3875.                     bFirstTarget = False;
  3876.                 }
  3877.             }
  3878.         }
  3879.         FrobTarget = smallestTarget;
  3880.  
  3881.         // reset our frob timer
  3882.         FrobTime = 0;
  3883.     }
  3884. }
  3885.  
  3886. // ----------------------------------------------------------------------
  3887. // Landed()
  3888. //
  3889. // copied from Engine.PlayerPawn new landing code for Deus Ex
  3890. // zero damage if falling from 15 feet or less
  3891. // scaled damage from 15 to 60 feet
  3892. // death over 60 feet
  3893. // ----------------------------------------------------------------------
  3894.  
  3895. function Landed(vector HitNormal)
  3896. {
  3897.     local vector legLocation;
  3898.     local int augLevel;
  3899.     local float augReduce, dmg, skillStealthMod;
  3900.     local float shakeTime, shakeRoll, shakeVert;
  3901.     //Note - physics changes type to PHYS_Walking by default for landed pawns
  3902.     PlayLanded(Velocity.Z);
  3903. //    PlaySound(Land, SLOT_Interact, 1); //this is aweful sound, leaving it to footstep
  3904.  
  3905.     if (Velocity.Z < -1.4 * JumpZ)
  3906.     {
  3907.         //MakeNoise(-0.5 * Velocity.Z/(FMax(JumpZ, 150.0)));
  3908.         if ((Velocity.Z < -800) && (ReducedDamageType != 'All'))
  3909.             if ( Role == ROLE_Authority )
  3910.             {
  3911.                 // check our jump augmentation and reduce falling damage if we have it
  3912.                 // jump augmentation doesn't exist anymore - use Speed instaed
  3913.                 // reduce an absolute amount of damage instead of a relative amount
  3914.                 augReduce = 0;
  3915.                 if (AugmentationSystem != None)
  3916.                 {
  3917.                     if (AugmentationSystem.GetAugLevelValue(class'AugStealth') != -1.0) //CyberP: silent running also reduces falling dam too
  3918.                     augLevel = AugmentationSystem.GetClassLevel(class'AugStealth');
  3919.                     else
  3920.                     augLevel = AugmentationSystem.GetClassLevel(class'AugSpeed');
  3921.                     if (augLevel >= 0)
  3922.                         augReduce = 15 * (augLevel+1);
  3923.                 }
  3924.  
  3925.                 //Calculate the zyme effect
  3926.                 if(drugEffectTimer < 0) //(FindInventoryType(Class'DeusEx.ZymeCharged') != None)
  3927.                     augReduce += 10;
  3928.  
  3929.                 dmg = Max((-0.16 * (Velocity.Z + 700)) - augReduce, 0);
  3930.                 legLocation = Location + vect(-1,0,-1);         // damage left leg
  3931.                 TakeDamage(dmg, None, legLocation, vect(0,0,0), 'fell');
  3932.  
  3933.                 legLocation = Location + vect(1,0,-1);          // damage right leg
  3934.                 TakeDamage(dmg, None, legLocation, vect(0,0,0), 'fell');
  3935.  
  3936.                 dmg = Max((-0.06 * (Velocity.Z + 700)) - augReduce, 0);
  3937.                 legLocation = Location + vect(0,0,1);           // damage torso
  3938.                 TakeDamage(dmg, None, legLocation, vect(0,0,0), 'fell');
  3939.                 if (dmg > 20)
  3940.                 PlaySound(sound'pl_fallpain3',SLOT_None,2.0);
  3941.             }
  3942.     }
  3943.     if (Velocity.Z < -460)//(Abs(Velocity.Z) >= 1.5 * JumpZ)//GMDX add compression to jump/fall (cosmetic) //CyberP: edited
  3944.     {
  3945.     camInterpol = 0.4;
  3946.     if (inHand != none && (inHand.IsA('NanoKeyRing') || inHand.IsA('DeusExPickup')))
  3947.     {
  3948.     }
  3949.     else
  3950.     {
  3951.         RecoilTime=default.RecoilTime;
  3952.         RecoilShake.Z-=lerp(min(Abs(Velocity.Z),4.0*310)/(4.0*310),0,14.0); //CyberP: 7
  3953.         RecoilShake.Y-=lerp(min(Abs(Velocity.Z),4.0*310)/(4.0*310),0,6.0);
  3954.         RecoilShaker(vect(3,4,14));
  3955.         shakeTime= 0.15; shakeRoll = 0; shakeVert = -8; shakeView(shakeTime,shakeRoll,shakeVert);
  3956.     }
  3957.     }
  3958.  
  3959.     //if ( (Level.Game != None) && (Level.Game.Difficulty > 0) && (Abs(Velocity.Z) > 0.75 * 400) )
  3960.     //{//GMDX: skill system stealth mod
  3961.     //if (SkillSystem!=None && SkillSystem.GetSkillLevel(class'SkillStealth')==0 &&
  3962.     //AugmentationSystem != None && AugmentationSystem.GetAugLevelValue('AugStealth') == -1.0)
  3963.       //   AISendEvent('LoudNoise', EAITYPE_Audio,, 512);
  3964.       //skillStealthMod=0.075;
  3965.         //else skillStealthMod=0.8;//0.15;
  3966.  
  3967.     //skillStealthMod*= Level.Game.Difficulty * (0.01+fMin(abs(Velocity.Z/100.0),3));
  3968.  
  3969.     //MakeNoise(skillStealthMod );
  3970.     //log("LANDED VOL: "@skillStealthMod@"  "@fMin(abs(Velocity.Z),640));
  3971.     //if (SkillSystem!=None && SkillSystem.GetSkillLevel(class'SkillStealth')==0) //CyberP: fuck it, we'll just have it not send at all
  3972.     //AISendEvent('LoudNoise', EAITYPE_Audio, skillStealthMod, fMin(Abs(Velocity.Z*1.5),536));
  3973.     //}
  3974.     bJustLanded = true;
  3975.  
  3976.     {
  3977.         //Calculate the zyme effect
  3978.         if(drugEffectTimer < 0) //(FindInventoryType(Class'DeusEx.ZymeCharged') != None)
  3979.             augReduce += 10;
  3980.  
  3981.         dmg = Max((-0.16 * (Velocity.Z + 700)) - augReduce, 0);
  3982.         legLocation = Location + vect(-1,0,-1);         // damage left leg
  3983.         TakeDamage(dmg, None, legLocation, vect(0,0,0), 'fell');
  3984.  
  3985.         legLocation = Location + vect(1,0,-1);          // damage right leg
  3986.         TakeDamage(dmg, None, legLocation, vect(0,0,0), 'fell');
  3987.  
  3988.         dmg = Max((-0.06 * (Velocity.Z + 700)) - augReduce, 0);
  3989.         legLocation = Location + vect(0,0,1);           // damage torso
  3990.         TakeDamage(dmg, None, legLocation, vect(0,0,0), 'fell');
  3991.     }
  3992. }
  3993.  
  3994. // ----------------------------------------------------------------------
  3995. // SupportActor()
  3996. //
  3997. // Copied directly from ScriptedPawn.uc
  3998. // Called when something lands on us
  3999. // ----------------------------------------------------------------------
  4000.  
  4001. function SupportActor(Actor standingActor)
  4002. {
  4003.     local vector newVelocity;
  4004.     local float  angle;
  4005.     local float  zVelocity;
  4006.     local float  baseMass;
  4007.     local float  standingMass;
  4008.     local vector damagePoint;
  4009.     local float  damage;
  4010.  
  4011.     zVelocity    = standingActor.Velocity.Z;
  4012.     standingMass = FMax(1, standingActor.Mass);
  4013.     baseMass     = FMax(1, Mass);
  4014.     damagePoint  = Location + vect(0,0,1)*(CollisionHeight-1);
  4015.     damage       = (1 - (standingMass/baseMass) * (zVelocity/100));
  4016.  
  4017.     // Have we been stomped?
  4018.     if ((zVelocity*standingMass < -7500) && (damage > 0))
  4019.         TakeDamage(damage, standingActor.Instigator, damagePoint, 0.2*standingActor.Velocity, 'stomped');
  4020.  
  4021.     // Bounce the actor off the player
  4022.     angle = FRand()*Pi*2;
  4023.     newVelocity.X = cos(angle);
  4024.     newVelocity.Y = sin(angle);
  4025.     newVelocity.Z = 0;
  4026.     newVelocity *= FRand()*25 + 25;
  4027.     newVelocity += standingActor.Velocity;
  4028.     newVelocity.Z = 90;
  4029.     standingActor.Velocity = newVelocity;
  4030.     standingActor.SetPhysics(PHYS_Falling);
  4031. }
  4032.  
  4033. // ----------------------------------------------------------------------
  4034. // SpawnCarcass()
  4035. //
  4036. // copied from Engine.PlayerPawn
  4037. // modified to let carcasses have inventories
  4038. // ----------------------------------------------------------------------
  4039.  
  4040. function Carcass SpawnCarcass()
  4041. {
  4042.     local DeusExCarcass carc;
  4043.     local Inventory item;
  4044.     local Vector loc;
  4045.  
  4046.     // don't spawn a carcass if we've been gibbed
  4047.     if (Health < -40) //CyberP: gib
  4048.       return None;
  4049.  
  4050.     carc = DeusExCarcass(Spawn(CarcassType));
  4051.     if (carc != None)
  4052.     {
  4053.         carc.Initfor(self);
  4054.  
  4055.         // move it down to the ground
  4056.         loc = Location;
  4057.         loc.z -= CollisionHeight;
  4058.         loc.z += carc.CollisionHeight;
  4059.         carc.SetLocation(loc);
  4060.  
  4061.         if (Player != None)
  4062.             carc.bPlayerCarcass = true;
  4063.         MoveTarget = carc; //for Player 3rd person views
  4064.  
  4065.         // give the carcass the player's inventory
  4066.         for (item=Inventory; item!=None; item=Inventory)
  4067.         {
  4068.             DeleteInventory(item);
  4069.         //  carc.AddInventory(item);   //CyberP: commented out to prevent suicide inventory exploit.
  4070.         }
  4071.     }
  4072.  
  4073.     return carc;
  4074. }
  4075.  
  4076. // ----------------------------------------------------------------------
  4077. // Reloading()
  4078. //
  4079. // Called when one of the player's weapons is reloading
  4080. // ----------------------------------------------------------------------
  4081.  
  4082. function Reloading(DeusExWeapon weapon, float reloadTime)
  4083. {
  4084.     if (!IsLeaning() && !bIsCrouching && (Physics != PHYS_Swimming) && !IsInState('Dying'))
  4085.         PlayAnim('Reload', 1.0 / reloadTime, 0.1);
  4086. }
  4087. function DoneReloading(DeusExWeapon weapon);
  4088.  
  4089. // ----------------------------------------------------------------------
  4090. // HealPlayer()
  4091. // ----------------------------------------------------------------------
  4092.  
  4093. function int HealPlayer(int baseHealPoints, optional Bool bUseMedicineSkill)
  4094. {
  4095.     local float mult;
  4096.     local int adjustedHealAmount, aha2, tempaha;
  4097.     local int origHealAmount;
  4098.     local float dividedHealAmount;
  4099.  
  4100.     if (bUseMedicineSkill)
  4101.         adjustedHealAmount = CalculateSkillHealAmount(baseHealPoints);
  4102.     else
  4103.         adjustedHealAmount = baseHealPoints;
  4104.  
  4105.     origHealAmount = adjustedHealAmount;
  4106.  
  4107.     if (adjustedHealAmount > 0)
  4108.     {
  4109.         if (bUseMedicineSkill)
  4110.             {
  4111.             PlaySound(sound'MedicalHiss', SLOT_None,,, 256);
  4112.             ClientFlash(4,vect(0,0,200));     //CyberP: flash when using medkits.
  4113.             }
  4114.         // Heal by 3 regions via multiplayer game
  4115.         if (( Level.NetMode == NM_DedicatedServer ) || ( Level.NetMode == NM_ListenServer ))
  4116.         {
  4117.          // DEUS_EX AMSD If legs broken, heal them a little bit first
  4118.          if (HealthLegLeft == 0)
  4119.          {
  4120.             aha2 = adjustedHealAmount;
  4121.             if (aha2 >= 5)
  4122.                aha2 = 5;
  4123.             tempaha = aha2;
  4124.             adjustedHealAmount = adjustedHealAmount - aha2;
  4125.             HealPart(HealthLegLeft, aha2);
  4126.             HealPart(HealthLegRight,tempaha);
  4127.                 mpMsgServerFlags = mpMsgServerFlags & (~MPSERVERFLAG_LostLegs);
  4128.          }
  4129.             HealPart(HealthHead, adjustedHealAmount);
  4130.  
  4131.             if ( adjustedHealAmount > 0 )
  4132.             {
  4133.                 aha2 = adjustedHealAmount;
  4134.                 HealPart(HealthTorso, aha2);
  4135.                 aha2 = adjustedHealAmount;
  4136.                 HealPart(HealthArmRight,aha2);
  4137.                 HealPart(HealthArmLeft, adjustedHealAmount);
  4138.             }
  4139.             if ( adjustedHealAmount > 0 )
  4140.             {
  4141.                 aha2 = adjustedHealAmount;
  4142.                 HealPart(HealthLegRight, aha2);
  4143.                 HealPart(HealthLegLeft, adjustedHealAmount);
  4144.             }
  4145.         }
  4146.         else
  4147.         {
  4148.             HealPartMedicalSkill(HealthHead, adjustedHealAmount);   //GMDX upgraded out
  4149.             HealPartMedicalSkill(HealthTorso, adjustedHealAmount);  //GMDX upgraded out
  4150.             HealPart(HealthLegRight, adjustedHealAmount);
  4151.             HealPart(HealthLegLeft, adjustedHealAmount);
  4152.             HealPart(HealthArmRight, adjustedHealAmount);
  4153.             HealPart(HealthArmLeft, adjustedHealAmount);
  4154.         }
  4155.  
  4156.         GenerateTotalHealth();
  4157.  
  4158.         adjustedHealAmount = origHealAmount - adjustedHealAmount;
  4159.  
  4160.         if (origHealAmount == baseHealPoints)
  4161.         {
  4162.             if (adjustedHealAmount == 1)
  4163.                 ClientMessage(Sprintf(HealedPointLabel, adjustedHealAmount));
  4164.             else
  4165.                 ClientMessage(Sprintf(HealedPointsLabel, adjustedHealAmount));
  4166.         }
  4167.         else
  4168.         {
  4169.             ClientMessage(Sprintf(HealedPointsLabel, adjustedHealAmount));
  4170.         }
  4171.     }
  4172.  
  4173.     return adjustedHealAmount;
  4174. }
  4175.  
  4176. // ----------------------------------------------------------------------
  4177. // ChargePlayer()
  4178. // ----------------------------------------------------------------------
  4179.  
  4180. function int ChargePlayer(int baseChargePoints)
  4181. {
  4182.     local int chargedPoints;
  4183.  
  4184.     chargedPoints = Min(EnergyMax - Int(Energy), baseChargePoints);
  4185.  
  4186.     Energy += chargedPoints;
  4187.  
  4188.     return chargedPoints;
  4189. }
  4190.  
  4191. // ----------------------------------------------------------------------
  4192. // CalculateSkillHealAmount()
  4193. // ----------------------------------------------------------------------
  4194.  
  4195. function int CalculateSkillHealAmount(int baseHealPoints)
  4196. {
  4197.     local float mult;
  4198.     local int adjustedHealAmount;
  4199.  
  4200.     // check skill use
  4201.     if (SkillSystem != None)
  4202.     {
  4203.         mult = SkillSystem.GetSkillLevelValue(class'SkillMedicine');
  4204.  
  4205.         // apply the skill
  4206.         adjustedHealAmount = baseHealPoints * mult;
  4207.     }
  4208.  
  4209.     return adjustedHealAmount;
  4210. }
  4211.  
  4212. // ----------------------------------------------------------------------
  4213. // HealPart()
  4214. // ----------------------------------------------------------------------
  4215.  
  4216. function HealPart(out int points, out int amt)
  4217. {
  4218.     local int spill;
  4219.  
  4220.     points += amt;
  4221.     spill = points - 100;
  4222.     if (spill > 0)
  4223.         points = 100;
  4224.     else
  4225.         spill = 0;
  4226.  
  4227.     amt = spill;
  4228. }
  4229.  
  4230. // ----------------------------------------------------------------------
  4231. // by dasraiser for GMDX
  4232. // HealPart()Extended
  4233. // Medical Upgrade for Head Torso Base on Medical Skill Upgrade
  4234. // ----------------------------------------------------------------------
  4235. function HealPartMedicalSkill(out int points, out int amt)
  4236. {
  4237.     local int spill;
  4238.     local Skill sk;
  4239.  
  4240.     if (SkillSystem!=None)
  4241.     {
  4242.       sk = SkillSystem.GetSkillFromClass(Class'DeusEx.SkillMedicine');
  4243.       if (sk==None) HealPart(points,amt); //deal with default if no medical skill!!
  4244.       else
  4245.       {
  4246.          points += amt;
  4247.          spill = points - (100+sk.CurrentLevel*10);
  4248.          if (spill > 0)
  4249.             points = (100+sk.CurrentLevel*10);
  4250.          else
  4251.             spill = 0;
  4252.          amt = spill;
  4253.        }
  4254.     }
  4255.     else HealPart(points,amt); //deal with default if no skill system!!
  4256. }
  4257.  
  4258. // ----------------------------------------------------------------------
  4259. // HandleWalking()
  4260. //
  4261. // subclassed from PlayerPawn so we can control run/walk defaults
  4262. // ----------------------------------------------------------------------
  4263.  
  4264. function HandleWalking()
  4265. {
  4266.     Super.HandleWalking();
  4267.  
  4268.     if (bAlwaysRun && !(bExtraHardcore && bHardCoreMode))  //&& !bHardCoreMode
  4269.         bIsWalking = (bRun != 0) || (bDuck != 0);
  4270.     else
  4271.         bIsWalking = (bRun == 0) || (bDuck != 0);
  4272.  
  4273.     // handle the toggle walk key
  4274.     if (bToggleWalk && !bExtraHardcore)   //&& !bHardCoreMode
  4275.         bIsWalking = !bIsWalking;
  4276.  
  4277.     if (bToggleCrouch)
  4278.     {
  4279.         if (!bCrouchOn && !bWasCrouchOn && (bDuck != 0))
  4280.         {
  4281.             bCrouchOn = True;
  4282.             if ((InHand != None && InHand.IsA('DeusExPickup')) || CarriedDecoration != None)
  4283.             {
  4284.             }
  4285.             else
  4286.             {
  4287.             RecoilTime*=3.0;
  4288.             RecoilShake.Z-=lerp(min(Abs(4),4.0*4)/(4.0*4),3,5);
  4289.             RecoilShaker(vect(0,0,-1.5));
  4290.             }
  4291.         }
  4292.         else if (bCrouchOn && !bWasCrouchOn && (bDuck == 0))
  4293.         {
  4294.             bWasCrouchOn = True;
  4295.         }
  4296.         else if (bCrouchOn && bWasCrouchOn && (bDuck == 0) && (lastbDuck != 0))
  4297.         {
  4298.             bCrouchOn = False;
  4299.             bWasCrouchOn = False;
  4300.         }
  4301.  
  4302.         if (bCrouchOn)
  4303.         {
  4304.             bIsCrouching = True;
  4305.             bDuck = 1;
  4306.         }
  4307.  
  4308.         lastbDuck = bDuck;
  4309.     }
  4310. }
  4311.  
  4312. // ----------------------------------------------------------------------
  4313. // DoJump()
  4314. //
  4315. // copied from Engine.PlayerPawn
  4316. // Modified to let you jump if you are carrying something rather light
  4317. // You can also jump if you are crouching, just at a much lower height
  4318. // ----------------------------------------------------------------------
  4319.  
  4320. function DoJump( optional float F )
  4321. {
  4322.     local DeusExWeapon w;
  4323.     local float scaleFactor, augLevel;
  4324.     local int MusLevel;
  4325.  
  4326.     MusLevel = AugmentationSystem.GetClassLevel(class'AugMuscle');
  4327.  
  4328.     if (MusLevel==-1) MusLevel=30;
  4329.       else MusLevel=(MusLevel+3)*50;
  4330.  
  4331.     if ((CarriedDecoration != None) && (CarriedDecoration.Mass > MusLevel))
  4332.         return;
  4333.     else if (bForceDuck || IsLeaning())
  4334.         return;
  4335.  
  4336.  
  4337.         //CyberP: effect when jumping
  4338. if (!bIsCrouching && Physics == PHYS_Walking)
  4339. {
  4340.    RecoilTime=default.RecoilTime + 0.9;
  4341.  
  4342.    if (Weapon != none && inHand != none)
  4343.      {
  4344.      if (Weapon.IsA('WeaponPlasmaRifle') || Weapon.IsA('WeaponGEPGun') || Weapon.IsA('WeaponFlamethrower') || inHand.IsA('DeusExPickup'))
  4345.      {
  4346.         RecoilShake.Z-=lerp(min(Abs(4),4.0*4)/(4.0*4),2,4.0);
  4347.         RecoilShaker(vect(0,0,1));
  4348.      }
  4349.      else
  4350.      {
  4351.         RecoilShake.Z-=lerp(min(Abs(30),4.0*30)/(4.0*30),12,14.0);
  4352.         RecoilShaker(vect(0,0,4));
  4353.      }
  4354.      }
  4355. }
  4356.  
  4357.     if (Physics == PHYS_Walking)
  4358.     {
  4359.         camInterpol = 0.4;
  4360.         if ((Role == ROLE_Authority )&&(FRand()<0.33))
  4361.             PlaySound(JumpSound, SLOT_None, 1.5, true, 1200, 1.0 - 0.2*FRand() );
  4362.         if ( (Level.Game != None) && (Level.Game.Difficulty > 0) )
  4363.             MakeNoise(0.1 * Level.Game.Difficulty);
  4364.         PlayInAir();
  4365.  
  4366.         if (bStunted)
  4367.         Velocity.Z = JumpZ*0.75;
  4368.         else
  4369.         Velocity.Z = JumpZ;
  4370.  
  4371.         swimTimer -= 0.8;
  4372.         if (swimTimer < 0)
  4373.         swimTimer = 0;
  4374.  
  4375.     //Zyme effect
  4376.     if(drugEffectTimer < 0) //(FindInventoryType(Class'DeusEx.ZymeCharged') != None)
  4377.         Velocity.Z += Default.JumpZ * 0.2;
  4378.  
  4379.         if ( Level.NetMode != NM_Standalone )
  4380.         {
  4381.          if (AugmentationSystem == None)
  4382.             augLevel = -1.0;
  4383.          else
  4384.             augLevel = AugmentationSystem.GetAugLevelValue(class'AugSpeed');
  4385.             w = DeusExWeapon(InHand);
  4386.             if ((augLevel != -1.0) && ( w != None ) && ( w.Mass > 30.0))
  4387.             {
  4388.                 scaleFactor = 1.0 - FClamp( ((w.Mass - 30.0)/55.0), 0.0, 0.5 );
  4389.                 Velocity.Z *= scaleFactor;
  4390.             }
  4391.         }
  4392.  
  4393.         // reduce the jump velocity if you are crouching
  4394. //      if (bIsCrouching)
  4395. //          Velocity.Z *= 0.9;
  4396.  
  4397.         if ( Base != Level )
  4398.             Velocity.Z += Base.Velocity.Z;
  4399.         SetPhysics(PHYS_Falling);
  4400.         if ( bCountJumps && (Role == ROLE_Authority) )
  4401.             Inventory.OwnerJumped();
  4402.     }
  4403. }
  4404.  
  4405. function bool IsLeaning()
  4406. {
  4407.     return (curLeanDist != 0);
  4408. }
  4409.  
  4410. // ----------------------------------------------------------------------
  4411. // SetBasedPawnSize()
  4412. // ----------------------------------------------------------------------
  4413.  
  4414. function bool SetBasedPawnSize(float newRadius, float newHeight)
  4415. {
  4416.     local float  oldRadius, oldHeight;
  4417.     local bool   bSuccess;
  4418.     local vector centerDelta, lookDir, upDir;
  4419.     local float  deltaEyeHeight;
  4420.     local Decoration savedDeco;
  4421.  
  4422.     if (newRadius < 0)
  4423.         newRadius = 0;
  4424.     if (newHeight < 0)
  4425.         newHeight = 0;
  4426.  
  4427.     oldRadius = CollisionRadius;
  4428.     oldHeight = CollisionHeight;
  4429.  
  4430.     if ( Level.NetMode == NM_Standalone )
  4431.     {
  4432.         if ((oldRadius == newRadius) && (oldHeight == newHeight))
  4433.             return true;
  4434.     }
  4435.  
  4436.     centerDelta    = vect(0, 0, 1)*(newHeight-oldHeight);
  4437.     deltaEyeHeight = GetDefaultCollisionHeight() - Default.BaseEyeHeight;
  4438.  
  4439.     if ( Level.NetMode != NM_Standalone )
  4440.     {
  4441.         if ((oldRadius == newRadius) && (oldHeight == newHeight) && (BaseEyeHeight == newHeight - deltaEyeHeight))
  4442.             return true;
  4443.     }
  4444.  
  4445.     if (CarriedDecoration != None)
  4446.         savedDeco = CarriedDecoration;
  4447.  
  4448.     bSuccess = false;
  4449.     if ((newHeight <= CollisionHeight) && (newRadius <= CollisionRadius))  // shrink
  4450.     {
  4451.         SetCollisionSize(newRadius, newHeight);
  4452.         if (Move(centerDelta))
  4453.             bSuccess = true;
  4454.         else
  4455.             SetCollisionSize(oldRadius, oldHeight);
  4456.     }
  4457.     else
  4458.     {
  4459.         if (Move(centerDelta))
  4460.         {
  4461.             SetCollisionSize(newRadius, newHeight);
  4462.             bSuccess = true;
  4463.         }
  4464.     }
  4465.  
  4466.     if (bSuccess)
  4467.     {
  4468.         // make sure we don't lose our carried decoration
  4469.         if (savedDeco != None)
  4470.         {
  4471.             savedDeco.SetPhysics(PHYS_None);
  4472.             savedDeco.SetBase(Self);
  4473.             savedDeco.SetCollision(False, False, False);
  4474.  
  4475.             // reset the decoration's location
  4476.             lookDir = Vector(Rotation);
  4477.             lookDir.Z = 0;
  4478.             upDir = vect(0,0,0);
  4479.             upDir.Z = CollisionHeight / 2;      // put it up near eye level
  4480.             savedDeco.SetLocation(Location + upDir + (0.5 * CollisionRadius + CarriedDecoration.CollisionRadius) * lookDir);
  4481.         }
  4482.  
  4483. //      PrePivotOffset  = vect(0, 0, 1)*(GetDefaultCollisionHeight()-newHeight);
  4484.         PrePivot        -= centerDelta;
  4485. //      DesiredPrePivot -= centerDelta;
  4486.         BaseEyeHeight   = newHeight - deltaEyeHeight;
  4487.  
  4488.         // Complaints that eye height doesn't seem like your crouching in multiplayer
  4489.         if (( Level.NetMode != NM_Standalone ) && (bIsCrouching || bForceDuck) )
  4490.             EyeHeight       -= (centerDelta.Z * 2.5);
  4491.         else
  4492.             EyeHeight       -= centerDelta.Z;
  4493.     }
  4494.     return (bSuccess);
  4495. }
  4496.  
  4497. // ----------------------------------------------------------------------
  4498. // ResetBasedPawnSize()
  4499. // ----------------------------------------------------------------------
  4500.  
  4501. function bool ResetBasedPawnSize()
  4502. {
  4503.     return SetBasedPawnSize(Default.CollisionRadius, GetDefaultCollisionHeight());
  4504. }
  4505.  
  4506. // ----------------------------------------------------------------------
  4507. // GetDefaultCollisionHeight()
  4508. // ----------------------------------------------------------------------
  4509.  
  4510. function float GetDefaultCollisionHeight()
  4511. {
  4512.     return (Default.CollisionHeight-4.5);
  4513. }
  4514.  
  4515. // ----------------------------------------------------------------------
  4516. // GetCurrentGroundSpeed()
  4517. // ----------------------------------------------------------------------
  4518.  
  4519. function float GetCurrentGroundSpeed()
  4520. {
  4521.     local float augValue, speed;
  4522.  
  4523.     // Remove this later and find who's causing this to Access None MB
  4524.     if ( AugmentationSystem == None )
  4525.         return 0;
  4526.  
  4527.     augValue = AugmentationSystem.GetAugLevelValue(class'AugSpeed');
  4528.  
  4529.     if (augValue == -1.0)
  4530.         augValue = 1.0;
  4531.  
  4532.     if (( Level.NetMode != NM_Standalone ) && Self.IsA('Human') )
  4533.         speed = Human(Self).mpGroundSpeed * augValue;
  4534.     else
  4535.         speed = Default.GroundSpeed * augValue;
  4536.  
  4537.     if(drugEffectTimer < 0) //(FindInventoryType(Class'DeusEx.ZymeCharged') != None)
  4538.         speed += Default.GroundSpeed * 0.2;
  4539.  
  4540.     return speed;
  4541. }
  4542.  
  4543. // ----------------------------------------------------------------------
  4544. // CreateDrone
  4545. // ----------------------------------------------------------------------
  4546. function CreateDrone()
  4547. {
  4548.     local Vector loc;
  4549.  
  4550.     loc = (2.0 + class'SpyDrone'.Default.CollisionRadius + CollisionRadius) * Vector(ViewRotation);
  4551.     loc.Z = BaseEyeHeight;
  4552.     loc += Location;
  4553.     aDrone = Spawn(class'SpyDrone', Self,, loc, ViewRotation);
  4554.     if (aDrone != None)
  4555.     {
  4556.         aDrone.Speed = 3 * spyDroneLevelValue;
  4557.         aDrone.MaxSpeed = 3 * spyDroneLevelValue;
  4558.         aDrone.Damage = 5 * spyDroneLevelValue;
  4559.         aDrone.blastRadius = 8 * spyDroneLevelValue;
  4560.         // window construction now happens in Tick()
  4561.     }
  4562. }
  4563.  
  4564. // ----------------------------------------------------------------------
  4565. // MoveDrone
  4566. // ----------------------------------------------------------------------
  4567.  
  4568. simulated function MoveDrone( float DeltaTime, Vector loc )
  4569. {
  4570.     // if the wanted velocity is zero, apply drag so we slow down gradually
  4571.     if (VSize(loc) == 0)
  4572.     {
  4573.       aDrone.Velocity *= 0.9;
  4574.     }
  4575.     else
  4576.     {
  4577.       aDrone.Velocity += deltaTime * aDrone.MaxSpeed * loc;
  4578.     }
  4579.  
  4580.     // add slight bobbing
  4581.     // DEUS_EX AMSD Only do the bobbing in singleplayer, we want stationary drones stationary.
  4582.     if (Level.Netmode == NM_Standalone)
  4583.       aDrone.Velocity += deltaTime * Sin(Level.TimeSeconds * 2.0) * vect(0,0,1);
  4584. }
  4585.  
  4586. function ServerUpdateLean( Vector desiredLoc )
  4587. {
  4588.     local Vector gndCheck, traceSize, HitNormal, HitLocation;
  4589.     local Actor HitActor, HitActorGnd;
  4590.  
  4591.     // First check to see if anything is in the way
  4592.     traceSize.X = CollisionRadius;
  4593.     traceSize.Y = CollisionRadius;
  4594.     traceSize.Z = CollisionHeight;
  4595.     HitActor = Trace( HitLocation, HitNormal, desiredLoc, Location, True, traceSize );
  4596.  
  4597.     // Make we don't lean off the edge of something
  4598.     if ( HitActor == None ) // Don't bother if we're going to fail to set anyway
  4599.     {
  4600.         gndCheck = desiredLoc - vect(0,0,1) * CollisionHeight;
  4601.         HitActorGnd = Trace( HitLocation, HitNormal, gndCheck, desiredLoc, True, traceSize );
  4602.     }
  4603.  
  4604.     if ( (HitActor == None) && (HitActorGnd != None) )
  4605.         SetLocation( desiredLoc );
  4606.  
  4607. //  SetRotation( rot );
  4608. }
  4609.  
  4610.  
  4611. // ----------------------------------------------------------------------
  4612. // GMDX:dasraiser insert lean to Tiptoes
  4613. // RefreshKey copied from HUDMultiSkill.uc for Tiptoes Lean
  4614. // ----------------------------------------------------------------------
  4615.  
  4616. function RefreshLeanKeys()
  4617. {
  4618.     local String KeyName, Alias,KeyLeanLeft,AliasLeanLeft,KeyLeanRight,AliasLeanRight;
  4619. //  local int EI_KL,EI_KR;
  4620.     local int i;
  4621.     local int Nfound;
  4622.  
  4623. //GMDX as EInputKey enum not same as Actor!
  4624. //^^var int LeanLeftKey, LeanRightKey;
  4625.  
  4626.  
  4627.     bLeanKeysDefined=false;
  4628.  
  4629.     for ( i=0; i<255; i++ )
  4630.     {
  4631.         KeyName = ConsoleCommand ( "KEYNAME "$i );
  4632.         if ( KeyName != "" )
  4633.         {
  4634.             Alias = ConsoleCommand( "KEYBINDING "$KeyName );
  4635.             if ( InStr(Alias,"LeanRight" )!=-1)
  4636.             {
  4637.                //EI_KR=i;
  4638.                KeyLeanRight=KeyName;
  4639.                AliasLeanRight=Alias;
  4640.                Nfound++;
  4641.             } else
  4642.             if ( InStr(Alias,"LeanLeft" )!=-1)
  4643.             {
  4644.                //EI_KL=i;
  4645.             KeyLeanLeft=KeyName;
  4646.                AliasLeanLeft=Alias;
  4647.                Nfound++;
  4648.             }
  4649.             if (Nfound==2) break;
  4650.         }
  4651.     }
  4652.     if (Nfound==2)
  4653.     {
  4654.       bLeanKeysDefined=true;
  4655. //    log("Set InputExt "$KeyLeanRight$" "$AliasLeanRight$" | bLeanRightHook 1 | OnRelease bLeanRightHook 0");
  4656. //    log("Set InputExt "$KeyLeanLeft$" "$AliasLeanLeft$" | bLeanLeftHook 1 | OnRelease bLeanLeftHook 0");
  4657.       ConsoleCommand("SET InputExt "$KeyLeanRight$" LeanRight | SetTiptoesRight 1 | OnRelease SetTiptoesRight 0");
  4658.       ConsoleCommand("SET InputExt "$KeyLeanLeft$" LeanLeft | SetTiptoesLeft 1 | OnRelease SetTiptoesLeft 0");
  4659.     } else log("Lean Keys UNDEFINED, disabling tiptoes");
  4660.  
  4661. }
  4662.  
  4663. exec function SetTiptoesLeft(bool B)
  4664. {
  4665.     if (bLeanKeysDefined)
  4666.       bLeftToe=B; else bLeftToe=false;
  4667.  
  4668.     if (bLeftToe&&bRightToe) bPreTiptoes=true;
  4669.       else bPreTiptoes=false;
  4670.  
  4671.       //log("Exec LeftTip"@bLeftToe@bPreTiptoes@bLeanKeysDefined);
  4672. }
  4673.  
  4674. exec function SetTiptoesRight(bool B)
  4675. {
  4676.     if (bLeanKeysDefined)
  4677.       bRightToe=B; else bLeftToe=false;
  4678.  
  4679.     if (bLeftToe&&bRightToe) bPreTiptoes=true;
  4680.       else bPreTiptoes=false;
  4681.  
  4682.     //log("Exec RightTip"@bRightToe@bPreTiptoes);
  4683. }
  4684.  
  4685. // ----------------------------------------------------------------------
  4686. // state PlayerWalking
  4687. // ----------------------------------------------------------------------
  4688.  
  4689. state PlayerWalking
  4690. {
  4691.     // lets us affect the player's movement
  4692.     function ProcessMove ( float DeltaTime, vector newAccel, eDodgeDir DodgeMove, rotator DeltaRot)
  4693.     {
  4694.         local int newSpeed, defSpeed;
  4695.         local name mat;
  4696.         local vector HitLocation, HitNormal, checkpoint, downcheck;
  4697.         local Actor HitActor, HitActorDown;
  4698.         local bool bCantStandUp;
  4699.         local Vector loc, traceSize;
  4700.         local float alpha, maxLeanDist;
  4701.         local float legTotal, weapSkill;
  4702.         local int augValue;
  4703.         local int ResetSize;
  4704.         local float mult, mult2, mult3;
  4705.  
  4706.         if (bStaticFreeze)
  4707.         {
  4708.             SetRotation(SAVErotation);
  4709.             return;
  4710.         }
  4711.  
  4712.         // if the spy drone augmentation is active
  4713.         if (bSpyDroneActive)
  4714.         {
  4715.             if ( aDrone != None )
  4716.             {
  4717.                 // put away whatever is in our hand
  4718.                 if (inHand != None)
  4719.                     PutInHand(None);
  4720.  
  4721.                 // make the drone's rotation match the player's view
  4722.                 aDrone.SetRotation(ViewRotation);
  4723.  
  4724.                 // move the drone
  4725.                 loc = Normal((aUp * vect(0,0,1) + aForward * vect(1,0,0) + aStrafe * vect(0,1,0)) >> ViewRotation);
  4726.  
  4727.                 // opportunity for client to translate movement to server
  4728.                 MoveDrone( DeltaTime, loc );
  4729.  
  4730.                 // freeze the player
  4731.                 Velocity = vect(0,0,0);
  4732.             }
  4733.             return;
  4734.         }
  4735.  
  4736.     defSpeed = GetCurrentGroundSpeed();
  4737.     ResetSize=0;
  4738.  
  4739. //      log("TIPTOES "@bLeanLeftHook@bLeanRightHook@IsLeaning()@bIsCrouching@bForceDuck);
  4740.       //GMDX:tiptoes
  4741.       if (!bPreTiptoes) bIsTiptoes=false;
  4742.  
  4743.       bTiptoes=bPreTiptoes&&(!IsLeaning()||bIsTiptoes);
  4744.  
  4745.       // crouching makes you two feet tall
  4746.         if (bIsCrouching || bForceDuck)
  4747.         {
  4748.             if ( Level.NetMode != NM_Standalone )
  4749.                 SetBasedPawnSize(Default.CollisionRadius, 30.0);
  4750.             else
  4751.                SetBasedPawnSize(Default.CollisionRadius, 16);
  4752.  
  4753.                 // check to see if we could stand up if we wanted to
  4754.                 checkpoint = Location;
  4755.                 // check normal standing height
  4756.                 checkpoint.Z = checkpoint.Z - CollisionHeight + 2 * GetDefaultCollisionHeight();
  4757.                 traceSize.X = CollisionRadius;
  4758.                 traceSize.Y = CollisionRadius;
  4759.                 traceSize.Z = 1;
  4760.                 HitActor = Trace(HitLocation, HitNormal, checkpoint, Location, True, traceSize);
  4761.                 if (HitActor == None)
  4762.                     bCantStandUp = False;
  4763.                 else
  4764.                     bCantStandUp = True;
  4765.       } else
  4766.          ResetSize++;
  4767.  
  4768.         if (bTiptoes)
  4769.         { //check we can go on tiptoes
  4770.             checkpoint = Location;
  4771.          if (bForceDuck||bIsCrouching)
  4772.             checkpoint.Z = checkpoint.Z + 14 +18;
  4773.             else
  4774.                checkpoint.Z = checkpoint.Z + 5.3 + GetDefaultCollisionHeight();
  4775.  
  4776.             traceSize.X = CollisionRadius;
  4777.             traceSize.Y = CollisionRadius;
  4778.             traceSize.Z = 1;
  4779.             HitActor = Trace(HitLocation, HitNormal, checkpoint, Location, True, traceSize);
  4780.             if (HitActor == None)
  4781.                 bCanTiptoes = True;
  4782.             else
  4783.                 bCanTiptoes = False;
  4784.  
  4785.             //log("bCanTiptoes "@bCanTiptoes);
  4786.         } else
  4787.          ResetSize++;
  4788.  
  4789.     if (ResetSize==2)
  4790.       {
  4791.          // DEUS_EX AMSD Changed this to grab defspeed, because GetCurrentGroundSpeed takes 31k cycles to run.
  4792.             GroundSpeed = defSpeed;
  4793.             // make sure the collision height is fudged for the floor problem - CNN
  4794.             if (!IsLeaning())
  4795.             {
  4796.                 ResetBasedPawnSize();
  4797.                 //log("Size Reset");
  4798.             }
  4799.         }
  4800.  
  4801.         if (bCantStandUp)
  4802.             bForceDuck = True;
  4803.         else
  4804.             bForceDuck = False;
  4805.  
  4806.         // if the player's legs are damaged, then reduce our speed accordingly
  4807.         newSpeed = defSpeed;
  4808.  
  4809.         if ( Level.NetMode == NM_Standalone )
  4810.         {
  4811.             if (HealthLegLeft < 1)
  4812.                 newSpeed -= (defSpeed/2) * 0.25;
  4813.             else if (HealthLegLeft < 34)
  4814.                 newSpeed -= (defSpeed/2) * 0.15;
  4815.             else if (HealthLegLeft < 67)
  4816.                 newSpeed -= (defSpeed/2) * 0.10;
  4817.  
  4818.             if (HealthLegRight < 1)
  4819.                 newSpeed -= (defSpeed/2) * 0.25;
  4820.             else if (HealthLegRight < 34)
  4821.                 newSpeed -= (defSpeed/2) * 0.15;
  4822.             else if (HealthLegRight < 67)
  4823.                 newSpeed -= (defSpeed/2) * 0.10;
  4824.  
  4825.             if (HealthTorso < 67)
  4826.                 newSpeed -= (defSpeed/2) * 0.05;
  4827.         }
  4828.  
  4829.         // let the player pull themselves along with their hands even if both of
  4830.         // their legs are blown off
  4831.         if ((HealthLegLeft < 1) && (HealthLegRight < 1))
  4832.         {
  4833.             newSpeed = defSpeed * 0.8;
  4834.             bIsWalking = True;
  4835.             bForceDuck = True;
  4836.             bCanTiptoes=false;
  4837.         }
  4838.         // make crouch speed faster than normal
  4839.         else if (bIsCrouching || bForceDuck)
  4840.         {
  4841.             mult3=1;             //CyberP: faster crouch speed. Comment out all except bIsWalking = True to remove
  4842.             if (SkillSystem!=None && SkillSystem.GetSkillLevel(class'SkillStealth')>=1)
  4843.             mult3= 1 + (SkillSystem.GetSkillLevel(class'SkillStealth')* 0.15);
  4844.             newSpeed = defSpeed * mult3;
  4845.             bIsWalking = True;
  4846.         }
  4847.  
  4848.         // CNN - Took this out because it sucks ASS!
  4849.         // if the legs are seriously damaged, increase the head bob
  4850.         // (unless the player has turned it off)
  4851.     //  if (Bob > 0.0)
  4852.     //  {
  4853.     //      legTotal = (HealthLegLeft + HealthLegRight) / 2.0;
  4854.     //      if (legTotal < 20)
  4855.     //          Bob = Default.Bob * FClamp(0.05*(70 - legTotal), 1.0, 3.0);
  4856.     //      else
  4857.     //          Bob = Default.Bob;
  4858.     //  }
  4859.  
  4860.       if ( AugmentationSystem != None )
  4861.          augValue = AugmentationSystem.GetClassLevel(class'AugMuscle');
  4862.  
  4863.        if (augValue==3) augValue = 0; else augValue=1;
  4864.  
  4865.        //CyberP: slow the player under certain conditions
  4866.        if (bStunted && Physics == PHYS_Walking)
  4867.        {
  4868.        bIsWalking = True;
  4869.        newSpeed = defSpeed;
  4870.        }
  4871.  
  4872.         // slow the player down if he's carrying something heavy
  4873.         // Like a DEAD BODY!  AHHHHHH!!!
  4874.         if (CarriedDecoration != None)
  4875.         {
  4876.             newSpeed -= CarriedDecoration.Mass * 2*augValue;
  4877.         }
  4878.         // don't slow the player down if he's skilled at the corresponding weapon skill
  4879.         else if ((DeusExWeapon(Weapon) != None) && (Weapon.Mass > 30) && (AugmentationSystem != None))
  4880.         {
  4881.           if (DeusExWeapon(Weapon).GetWeaponSkill() > -0.25 && AugmentationSystem.GetAugLevelValue(class'AugMuscle') == -1)
  4882.             {
  4883.             bIsWalking = True;
  4884.             newSpeed = defSpeed;
  4885.             }
  4886.         }
  4887.         else if ((inHand != None) && inHand.IsA('POVCorpse'))
  4888.         {
  4889.             newSpeed -= inHand.Mass * 3*augValue;
  4890.         }
  4891.  
  4892.         /*// Multiplayer movement adjusters   //CyberP: no multiplayer
  4893.         if ( Level.NetMode != NM_Standalone )
  4894.         {
  4895.             if ( Weapon != None )
  4896.             {
  4897.                 weapSkill = DeusExWeapon(Weapon).GetWeaponSkill();
  4898.                 // Slow down heavy weapons in multiplayer
  4899.                 if ((DeusExWeapon(Weapon) != None) && (Weapon.Mass > 30) )
  4900.                 {
  4901.                     newSpeed = defSpeed;
  4902.                     newSpeed -= ((( Weapon.Mass - 30.0 ) / (class'WeaponGEPGun'.Default.Mass - 30.0 )) * (0.70 + weapSkill) * defSpeed );
  4903.                 }
  4904.                 // Slow turn rate of GEP gun in multiplayer to discourage using it as the most effective close quarters weapon
  4905.                 if ((WeaponGEPGun(Weapon) != None) && (!WeaponGEPGun(Weapon).bZoomed))
  4906.                     TurnRateAdjuster = FClamp( 0.20 + -(weapSkill*0.5), 0.25, 1.0 );
  4907.                 else
  4908.                     TurnRateAdjuster = 1.0;
  4909.             }
  4910.             else
  4911.                 TurnRateAdjuster = 1.0;
  4912.         } */
  4913.  
  4914.         // if we are moving really slow, force us to walking
  4915.         if ((newSpeed <= defSpeed / 3) && !bForceDuck)
  4916.         {
  4917.             bIsWalking = True;
  4918.             newSpeed = defSpeed;
  4919.         }
  4920.  
  4921.         // if we are moving backwards, we should move slower
  4922.       // DEUS_EX AMSD Turns out this wasn't working right in multiplayer, I have a fix
  4923.       // for it, but it would change all our balance.
  4924.         //if ((aForward < 0) && (Level.NetMode == NM_Standalone))
  4925.         //  newSpeed *= 0.65;  //CyberP:
  4926.  
  4927.  
  4928.       if (bTiptoes&&bCanTiptoes) //!bIsTiptoes fuuk why so much spamming size
  4929.       {
  4930.          bIsTiptoes=true;
  4931.          if (bIsCrouching || bForceDuck)
  4932.             SetBasedPawnSize(Default.CollisionRadius, 16+18);
  4933.             else
  4934.                SetBasedPawnSize(Default.CollisionRadius, GetDefaultCollisionHeight()+5.3);
  4935.          newSpeed*=0.6;
  4936.       }
  4937.  
  4938.       mult = SkillSystem.GetSkillLevelValue(class'SkillSwimming');
  4939.       swimDuration = UnderWaterTime * mult;
  4940.  
  4941.       if (bIsWalking && !bIsCrouching && !bForceDuck)  //CyberP: faster walking
  4942.       {
  4943.       mult3=1;             //CyberP: faster walk speed. Comment out all except newSpeed *= 1.7 to remove
  4944.             if (SkillSystem!=None && SkillSystem.GetSkillLevel(class'SkillStealth')>=1)
  4945.             mult3= 1 + (SkillSystem.GetSkillLevel(class'SkillStealth')* 0.15);
  4946.             //newSpeed = defSpeed * mult3;
  4947.       newSpeed *= 1.7; //1.5
  4948.       newSpeed *= mult3;
  4949.       }
  4950.  
  4951.       if (Physics == PHYS_Walking && !bCrouchOn)   //CyberP: stamina system
  4952.       {
  4953.       if (bIsWalking == false && !bIsCrouching && (Velocity.X != 0 || Velocity.Y != 0 ))
  4954.       {
  4955.         if (bHardCoreMode)
  4956.         swimTimer -= deltaTime;
  4957.         else
  4958.         swimTimer -= deltaTime*0.3;
  4959.  
  4960.         if (swimTimer < 0)
  4961.         {swimTimer = 0;
  4962.         bIsWalking = true;
  4963.         }
  4964.  
  4965.         if (swimTimer < 0.0001 && FRand() < 0.7)
  4966.         PlaySound(sound'MaleBreathe', SLOT_None);
  4967.       }
  4968.       }
  4969.  
  4970.       if (Physics == PHYS_Walking)  //CyberP: stamina system
  4971.       {
  4972.       if (bIsWalking == true || (Velocity.X == 0 && Velocity.Y == 0))
  4973.       {
  4974.         if (bIsCrouching)
  4975.         {
  4976.           if (bCrouchRegen)
  4977.           {
  4978.           mult2 = AugmentationSystem.GetAugLevelValue(class'AugAqualung');
  4979.         if (mult2 == -1.0 && PerkNamesArray[27] == 1)
  4980.         swimTimer += deltaTime*3.3;
  4981.         else if (mult2 == -1.0)
  4982.         swimTimer += deltaTime*2.2;
  4983.         else if (mult2 == 30)
  4984.         swimTimer += deltaTime*5;
  4985.         else if (mult2 == 60)
  4986.         swimTimer += deltaTime*10;
  4987.         else if (mult2 == 120)
  4988.         swimTimer += deltaTime*20;
  4989.         else if (mult2 == 240)
  4990.         swimTimer += deltaTime*40;
  4991.  
  4992.         if (swimTimer < 1)
  4993.         {bStunted = true; SetTimer(3,false);}
  4994.         if (swimTimer < 0)
  4995.         swimTimer = 0;
  4996.         if (swimTimer > swimDuration)
  4997.         swimTimer = swimDuration;
  4998.           }
  4999.         }
  5000.         else
  5001.         {
  5002.         mult2 = AugmentationSystem.GetAugLevelValue(class'AugAqualung');
  5003.         if (mult2 == -1.0 && PerkNamesArray[27] == 1)
  5004.         swimTimer += deltaTime*3.3;
  5005.         else if (mult2 == -1.0)
  5006.         swimTimer += deltaTime*2.2;
  5007.         else if (mult2 == 30)
  5008.         swimTimer += deltaTime*5;
  5009.         else if (mult2 == 60)
  5010.         swimTimer += deltaTime*10;
  5011.         else if (mult2 == 120)
  5012.         swimTimer += deltaTime*20;
  5013.         else if (mult2 == 240)
  5014.         swimTimer += deltaTime*40;
  5015.  
  5016.         if (swimTimer < 1)
  5017.         {bStunted = true; SetTimer(3,false);}
  5018.         if (swimTimer < 0)
  5019.         swimTimer = 0;
  5020.         if (swimTimer > swimDuration)
  5021.         swimTimer = swimDuration;
  5022.         }
  5023.       }
  5024.       }
  5025.       //if (bBoosty)
  5026.       // {
  5027.       // newSpeed *= 30;
  5028.       // }
  5029.  
  5030.     //Zyme effect
  5031.     {
  5032.     if(drugEffectTimer < 0) //(FindInventoryType(Class'DeusEx.ZymeCharged') != None)
  5033.         newSpeed *= 1.2;
  5034.     }
  5035.  
  5036.       GroundSpeed = FMax(newSpeed, 100);
  5037.  
  5038.         // if we are moving or crouching, we can't lean
  5039.         // uncomment below line to disallow leaning during crouch
  5040.  
  5041.             if ((VSize(Velocity) < 10) && (aForward == 0) && !(bPreTiptoes||bIsTiptoes||CarriedDecoration != None))     // && !bIsCrouching && !bForceDuck)
  5042.                 bCanLean = True;
  5043.             else
  5044.                 bCanLean = False;
  5045.  
  5046.             // check leaning buttons (axis aExtra0 is used for leaning)
  5047.             maxLeanDist = 40;
  5048.  
  5049.             if (IsLeaning()&&!bIsTiptoes)
  5050.             {
  5051.                 if ( PlayerIsClient() || (Level.NetMode == NM_Standalone) )
  5052.                     ViewRotation.Roll = curLeanDist * 20;
  5053.  
  5054.                 if (!bIsCrouching && !bForceDuck)
  5055.                 {
  5056.                     SetBasedPawnSize(CollisionRadius, GetDefaultCollisionHeight() - Abs(curLeanDist) / 3.0);
  5057.                     //log("Size REset");
  5058.                 }
  5059.             }
  5060.             if (bCanLean && (aExtra0 != 0))
  5061.             {
  5062.                 // lean
  5063.                 DropDecoration();       // drop the decoration that we are carrying
  5064.                 if (AnimSequence != 'CrouchWalk')
  5065.                     PlayCrawling();
  5066.                 if (SkillSystem.GetSkillLevel(class'SkillStealth') >=3)
  5067.                     alpha = maxLeanDist * aExtra0 * 2.0 * (DeltaTime*2);
  5068.                 else
  5069.                     alpha = maxLeanDist * aExtra0 * 2.0 * DeltaTime;
  5070.  
  5071.                 loc = vect(0,0,0);
  5072.                 loc.Y = alpha;
  5073.                 if (Abs(curLeanDist + alpha) < maxLeanDist)
  5074.                 {
  5075.                     // check to make sure the destination not blocked
  5076.                     checkpoint = (loc >> Rotation) + Location;
  5077.                     traceSize.X = CollisionRadius;
  5078.                     traceSize.Y = CollisionRadius;
  5079.                     traceSize.Z = CollisionHeight;
  5080.                     HitActor = Trace(HitLocation, HitNormal, checkpoint, Location, True, traceSize);
  5081.  
  5082.                     // check down as well to make sure there's a floor there
  5083.                     downcheck = checkpoint - vect(0,0,1) * CollisionHeight;
  5084.                     HitActorDown = Trace(HitLocation, HitNormal, downcheck, checkpoint, True, traceSize);
  5085.                     if ((HitActor == None) && (HitActorDown != None))
  5086.                     {
  5087.                         if ( PlayerIsClient() || (Level.NetMode == NM_Standalone))
  5088.                         {
  5089.                             SetLocation(checkpoint);
  5090.                             ServerUpdateLean( checkpoint );
  5091.                             curLeanDist += alpha;
  5092.                         }
  5093.                     }
  5094.                 }
  5095.                 else
  5096.                 {
  5097.                     if ( PlayerIsClient() || (Level.NetMode == NM_Standalone) )
  5098.                         curLeanDist = aExtra0 * maxLeanDist;
  5099.                 }
  5100.             }
  5101.             else if (IsLeaning())   //if (!bCanLean && IsLeaning()) // uncomment this to not hold down lean
  5102.             {
  5103.                 // un-lean
  5104.                 if (AnimSequence == 'CrouchWalk')
  5105.                     PlayRising();
  5106.  
  5107.                 if ( PlayerIsClient() || (Level.NetMode == NM_Standalone))
  5108.                 {
  5109.                     prevLeanDist = curLeanDist;
  5110.                     alpha = FClamp(7.0 * DeltaTime, 0.001, 0.9);
  5111.                     curLeanDist *= 1.0 - alpha;
  5112.                     if (Abs(curLeanDist) < 1.0)
  5113.                         curLeanDist = 0;
  5114.                 }
  5115.  
  5116.                 loc = vect(0,0,0);
  5117.                 loc.Y = -(prevLeanDist - curLeanDist);
  5118.  
  5119.                 // check to make sure the destination not blocked
  5120.                 checkpoint = (loc >> Rotation) + Location;
  5121.                 traceSize.X = CollisionRadius;
  5122.                 traceSize.Y = CollisionRadius;
  5123.                 traceSize.Z = CollisionHeight;
  5124.                 HitActor = Trace(HitLocation, HitNormal, checkpoint, Location, True, traceSize);
  5125.  
  5126.                 // check down as well to make sure there's a floor there
  5127.                 downcheck = checkpoint - vect(0,0,1) * CollisionHeight;
  5128.                 HitActorDown = Trace(HitLocation, HitNormal, downcheck, checkpoint, True, traceSize);
  5129.                 if ((HitActor == None) && (HitActorDown != None))
  5130.                 {
  5131.                     if ( PlayerIsClient() || (Level.NetMode == NM_Standalone))
  5132.                     {
  5133.                         SetLocation( checkpoint );
  5134.                         ServerUpdateLean( checkpoint );
  5135.                     }
  5136.                 }
  5137.             }
  5138.  
  5139.         Super.ProcessMove(DeltaTime, newAccel, DodgeMove, DeltaRot);
  5140.     }
  5141.  
  5142.     function ZoneChange(ZoneInfo NewZone)
  5143.     {
  5144.     local vector loc;
  5145.     local int i;
  5146.         // if we jump into water, empty our hands
  5147.         if (NewZone.bWaterZone)
  5148.             {
  5149.             DropDecoration();
  5150.             //loc = Location + VRand() * 4;
  5151.             //loc.Z += CollisionHeight * 0.9;
  5152.  
  5153.             if (Velocity.Z < -440)  //CyberP: effects for jumping in water from height.
  5154.             {
  5155.             PlaySound(sound'SplashLarge', SLOT_Pain);
  5156.             ClientFlash(12,vect(160,200,255));
  5157.             for (i=0;i<38;i++)
  5158.             {
  5159.                 loc = Location + VRand() * 35;
  5160.                 loc.Z = Location.Z + FRand();
  5161.                 loc += Vector(ViewRotation) * CollisionRadius * 1.02;
  5162.                 loc.Z -= CollisionHeight + FRand();
  5163.                 Spawn(class'AirBubble', Self,, loc);
  5164.             }
  5165.            if (inHand != none && (inHand.IsA('NanoKeyRing') || inHand.IsA('DeusExPickup')))
  5166.             {
  5167.             }
  5168.             else
  5169.             {
  5170.               RecoilTime=default.RecoilTime;
  5171.               RecoilShake.Z-=lerp(min(Abs(Velocity.Z),4.0*JumpZ)/(4.0*JumpZ),0,14.0); //CyberP: 7
  5172.               RecoilShake.Y-=lerp(min(Abs(Velocity.Z),4.0*JumpZ)/(4.0*JumpZ),0,6.0);
  5173.               RecoilShaker(vect(6,8,18));
  5174.               }
  5175.             }
  5176.             Super.ZoneChange(NewZone);
  5177.          }
  5178.     }
  5179.  
  5180.     event PlayerTick(float deltaTime)
  5181.     {
  5182.         //DEUS_EX AMSD Additional updates
  5183.         //Because of replication delay, aug icons end up being a step behind generally.  So refresh them
  5184.         //every freaking tick.
  5185.         RefreshSystems(deltaTime);
  5186.  
  5187.         DrugEffects(deltaTime);
  5188.         RecoilEffectTick(deltaTime);
  5189.         Bleed(deltaTime);
  5190.         HighlightCenterObject();
  5191.         ZymeEffects(deltaTime);
  5192.  
  5193.         // CyberP: scare NPCs if holding TNT
  5194.         if (CarriedDecoration != None)
  5195.         {
  5196.             if (CarriedDecoration.IsA('CrateExplosiveSmall'))
  5197.             {
  5198.                  AISendEvent('WeaponFire', EAITYPE_Visual);
  5199.             }
  5200.         }
  5201.  
  5202.         UpdateDynamicMusic(deltaTime);
  5203.         UpdateWarrenEMPField(deltaTime);
  5204.       // DEUS_EX AMSD Move these funcions to a multiplayer tick
  5205.       // so that only that call gets propagated to the server.
  5206.       MultiplayerTick(deltaTime);
  5207.       // DEUS_EX AMSD For multiplayer...
  5208.         FrobTime += deltaTime;
  5209.  
  5210.         if (camInterpol > 0)
  5211.         {
  5212.           if (camInterpol > 0.2)
  5213.              ViewRotation.Pitch -= deltaTime * 2000;
  5214.           else
  5215.              ViewRotation.Pitch += deltaTime * 2000;
  5216.           if ((ViewRotation.Pitch > 16384) && (ViewRotation.Pitch < 32768))
  5217.                 ViewRotation.Pitch = 16384;
  5218.         camInterpol -= deltaTime;
  5219.         }
  5220.         // save some texture info
  5221.         FloorMaterial = GetFloorMaterial();
  5222.         WallMaterial = GetWallMaterial(WallNormal);
  5223.  
  5224.         // Check if player has walked outside a first-person convo.
  5225.         CheckActiveConversationRadius();
  5226.  
  5227.         // Check if all the people involved in a conversation are
  5228.         // still within a reasonable radius.
  5229.         CheckActorDistances();
  5230.  
  5231.         // handle poison
  5232.       //DEUS_EX AMSD Now handled in multiplayertick
  5233.         //UpdatePoison(deltaTime);
  5234.  
  5235.         // Update Time Played
  5236.         UpdateTimePlayed(deltaTime);
  5237.  
  5238.         Super.PlayerTick(deltaTime);
  5239.     }
  5240. }
  5241.  
  5242. // ----------------------------------------------------------------------
  5243. // state PlayerFlying
  5244. // ----------------------------------------------------------------------
  5245.  
  5246. state PlayerFlying
  5247. {
  5248.     function ZoneChange(ZoneInfo NewZone)
  5249.     {
  5250.         // if we jump into water, empty our hands
  5251.         if (NewZone.bWaterZone)
  5252.             DropDecoration();
  5253.  
  5254.         Super.ZoneChange(NewZone);
  5255.     }
  5256.  
  5257.     event PlayerTick(float deltaTime)
  5258.     {
  5259.  
  5260.         //DEUS_EX AMSD Additional updates
  5261.         //Because of replication delay, aug icons end up being a step behind generally.  So refresh them
  5262.         //every freaking tick.
  5263.         RefreshSystems(deltaTime);
  5264.  
  5265.         DrugEffects(deltaTime);
  5266.         RecoilEffectTick(deltaTime);
  5267.         HighlightCenterObject();
  5268.         UpdateDynamicMusic(deltaTime);
  5269.         ZymeEffects(deltaTime);
  5270.       // DEUS_EX AMSD For multiplayer...
  5271.       MultiplayerTick(deltaTime);
  5272.         FrobTime += deltaTime;
  5273.  
  5274.         // Check if player has walked outside a first-person convo.
  5275.         CheckActiveConversationRadius();
  5276.  
  5277.         // Check if all the people involved in a conversation are
  5278.         // still within a reasonable radius.
  5279.         CheckActorDistances();
  5280.  
  5281.         // Update Time Played
  5282.         UpdateTimePlayed(deltaTime);
  5283.  
  5284.         Super.PlayerTick(deltaTime);
  5285.     }
  5286. }
  5287.  
  5288. // ----------------------------------------------------------------------
  5289. // event HeadZoneChange
  5290. // ----------------------------------------------------------------------
  5291.  
  5292. event HeadZoneChange(ZoneInfo newHeadZone)
  5293. {
  5294.     local float mult, augLevel;
  5295.  
  5296.     // hack to get the zone's ambientsound working until Tim fixes it
  5297.     if (newHeadZone.AmbientSound != None)
  5298.         newHeadZone.SoundRadius = 255;
  5299.     if (HeadRegion.Zone.AmbientSound != None)
  5300.         HeadRegion.Zone.SoundRadius = 0;
  5301.  
  5302.     if (newHeadZone.bWaterZone && !HeadRegion.Zone.bWaterZone)
  5303.     {
  5304.         // make sure we're not crouching when we start swimming
  5305.         bIsCrouching = False;
  5306.         bCrouchOn = False;
  5307.         bWasCrouchOn = False;
  5308.         bDuck = 0;
  5309.         lastbDuck = 0;
  5310.         Velocity = vect(0,0,0);
  5311.         Acceleration = vect(0,0,0);
  5312.         mult = SkillSystem.GetSkillLevelValue(class'SkillSwimming');
  5313.         swimDuration = UnderWaterTime * mult;
  5314.         bRegenStamina = false;
  5315.         AmbientSound = Sound'swimmingloop';
  5316.         SoundPitch = 46;
  5317.         SwimTimer = swimDuration;
  5318.         //swimTimer = swimDuration;
  5319.         if (( Level.NetMode != NM_Standalone ) && Self.IsA('Human') )
  5320.         {
  5321.             if ( AugmentationSystem != None )
  5322.                 augLevel = AugmentationSystem.GetAugLevelValue(class'AugAqualung');
  5323.             if ( augLevel == -1.0 )
  5324.                 WaterSpeed = Human(Self).Default.mpWaterSpeed * mult;
  5325.             else
  5326.                 WaterSpeed = Human(Self).Default.mpWaterSpeed * 2.0 * mult;
  5327.         }
  5328.         else
  5329.             WaterSpeed = Default.WaterSpeed * mult;
  5330.     }
  5331.     else
  5332.     {
  5333.     bRegenStamina = true;
  5334.     SwimTimer += 0.5;
  5335.     AmbientSound = none;
  5336.     SoundPitch = 64;
  5337.     }
  5338.     Super.HeadZoneChange(newHeadZone);
  5339. }
  5340.  
  5341. // ----------------------------------------------------------------------
  5342. // state PlayerSwimming
  5343. // ----------------------------------------------------------------------
  5344.  
  5345. state PlayerSwimming
  5346. {
  5347.     function GrabDecoration()
  5348.     {
  5349.         // we can't grab decorations underwater
  5350.     }
  5351.  
  5352.     function ZoneChange(ZoneInfo NewZone)
  5353.     {
  5354.         // if we jump into water, empty our hands
  5355.         if (NewZone.bWaterZone)
  5356.         {
  5357.             DropDecoration();
  5358.             if (bOnFire)
  5359.                 ExtinguishFire();
  5360.         }
  5361.  
  5362.         Super.ZoneChange(NewZone);
  5363.     }
  5364.  
  5365.     event PlayerTick(float deltaTime)
  5366.     {
  5367.         local vector loc;
  5368.         local float mult2;
  5369.         //DEUS_EX AMSD Additional updates
  5370.         //Because of replication delay, aug icons end up being a step behind generally.  So refresh them
  5371.         //every freaking tick.
  5372.         RefreshSystems(deltaTime);
  5373.         RecoilEffectTick(deltaTime);
  5374.  
  5375.         DrugEffects(deltaTime);
  5376.         HighlightCenterObject();
  5377.         UpdateDynamicMusic(deltaTime);
  5378.         ZymeEffects(deltaTime);
  5379.       // DEUS_EX AMSD For multiplayer...
  5380.       MultiplayerTick(deltaTime);
  5381.         FrobTime += deltaTime;
  5382.  
  5383.         if (bOnFire)
  5384.             ExtinguishFire();
  5385.  
  5386.         if (bRegenStamina)
  5387.         {
  5388.         mult2 = AugmentationSystem.GetAugLevelValue(class'AugAqualung');
  5389.         if (mult2 == -1.0 && PerkNamesArray[27] == 1)
  5390.         swimTimer += deltaTime*3.3;
  5391.         else if (mult2 == -1.0)
  5392.         swimTimer += deltaTime*2.2;
  5393.         else if (mult2 == 30)
  5394.         swimTimer += deltaTime*5;
  5395.         else if (mult2 == 60)
  5396.         swimTimer += deltaTime*10;
  5397.         else if (mult2 == 120)
  5398.         swimTimer += deltaTime*20;
  5399.         else if (mult2 == 240)
  5400.         swimTimer += deltaTime*40;
  5401.  
  5402.         if (swimTimer > SwimDuration)
  5403.         swimTimer = SwimDuration;
  5404.         if (swimTimer < 0)
  5405.         swimTimer = 0;
  5406.         }
  5407.         // save some texture info
  5408.         FloorMaterial = GetFloorMaterial();
  5409.         WallMaterial = GetWallMaterial(WallNormal);
  5410.  
  5411.         // don't let the player run if swimming
  5412.         bIsWalking = True;
  5413.  
  5414.         // update our swimming info
  5415.         swimTimer -= deltaTime;
  5416.         swimTimer = FMax(0, swimTimer);
  5417.  
  5418.         if ( Role == ROLE_Authority )
  5419.         {
  5420.             if (swimTimer > 0)
  5421.                 PainTime = swimTimer;
  5422.         }
  5423.  
  5424.         // Check if player has walked outside a first-person convo.
  5425.         CheckActiveConversationRadius();
  5426.  
  5427.         // Check if all the people involved in a conversation are
  5428.         // still within a reasonable radius.
  5429.         CheckActorDistances();
  5430.  
  5431.         // Randomly spawn an air bubble every 0.2 seconds
  5432.         // Place them in front of the player's eyes
  5433.         swimBubbleTimer += deltaTime;
  5434.         if (swimBubbleTimer >= 0.2)
  5435.         {
  5436.             swimBubbleTimer = 0;
  5437.             if (FRand() < 0.2)
  5438.             {
  5439.                 loc = Location + VRand() * 4;
  5440.                 loc += Vector(ViewRotation) * CollisionRadius * 2;
  5441.                 loc.Z += CollisionHeight * 0.9;
  5442.                 Spawn(class'AirBubble', Self,, loc);
  5443.             }
  5444.         }
  5445.  
  5446.         // handle poison
  5447.       //DEUS_EX AMSD Now handled in multiplayertick
  5448.         //UpdatePoison(deltaTime);
  5449.  
  5450.         // Update Time Played
  5451.         UpdateTimePlayed(deltaTime);
  5452.  
  5453.         Super.PlayerTick(deltaTime);
  5454.     }
  5455.  
  5456.     function BeginState()
  5457.     {
  5458.         local float mult, augLevel;
  5459.  
  5460.         // set us to be two feet high
  5461.         SetBasedPawnSize(Default.CollisionRadius, 16);
  5462.  
  5463.         // get our skill info
  5464.         mult = SkillSystem.GetSkillLevelValue(class'SkillSwimming');
  5465.         swimDuration = UnderWaterTime * mult;
  5466.         //swimTimer = swimDuration;
  5467.         swimBubbleTimer = 0;
  5468.         WaterSpeed = Default.WaterSpeed * mult;
  5469.  
  5470.         Super.BeginState();
  5471.     }
  5472. }
  5473.  
  5474.  
  5475. // ----------------------------------------------------------------------
  5476. // state Dying
  5477. //
  5478. // make sure the death animation finishes
  5479. // ----------------------------------------------------------------------
  5480.  
  5481. state Dying
  5482. {
  5483.     ignores all;
  5484.  
  5485.     event PlayerTick(float deltaTime)
  5486.     {
  5487.     local float time;
  5488.  
  5489.       if (PlayerIsClient())
  5490.          ClientDeath();
  5491.         UpdateDynamicMusic(deltaTime);
  5492.         time = Level.TimeSeconds - FrobTime;
  5493.         HeadRegion.Zone.ViewFog.X = time*0.01;
  5494.         if (bRemoveVanillaDeath && time > 64.0 && HeadRegion.Zone.ViewFog.X != 0)
  5495.         {
  5496.         if ((MenuUIWindow(DeusExRootWindow(rootWindow).GetTopWindow()) == None) &&
  5497.         (ToolWindow(DeusExRootWindow(rootWindow).GetTopWindow()) == None))
  5498.             ConsoleCommand("OPEN DXONLY");
  5499.   }
  5500.         Super.PlayerTick(deltaTime);
  5501.     }
  5502.  
  5503.     exec function Fire(optional float F)
  5504.     {
  5505.         if ( Level.NetMode != NM_Standalone )
  5506.         Super.Fire();
  5507.     }
  5508.  
  5509.     exec function ShowMainMenu()
  5510.     {
  5511.         // reduce the white glow when the menu is up
  5512.         if (InstantFog != vect(0,0,0))
  5513.         {
  5514.             InstantFog   = vect(0.1,0.1,0.1);
  5515.             InstantFlash = 0.01;
  5516.  
  5517.             // force an update
  5518.             ViewFlash(1.0);
  5519.         }
  5520.         HeadRegion.Zone.ViewFog.X = 0;
  5521.         Global.ShowMainMenu();
  5522.     }
  5523.  
  5524.     function BeginState()
  5525.     {
  5526.     local DeusExRootWindow root;
  5527.     local BloodPool pool;
  5528.     local Vector HitLocation, HitNormal, EndTrace;
  5529.     local Actor hit;
  5530.  
  5531.     root = DeusExRootWindow(rootWindow);
  5532.  
  5533.     ClientFlash(900000,vect(255,0,0));
  5534.     if (bCrouchOn || bWasCrouchOn || bIsCrouching || bForceDuck)
  5535.        MeleeRange=51.000000; //CyberP: change this unused var to avoid adding yet more global vars
  5536.  
  5537.     if (root != None)
  5538.       root.ClearWindowStack();
  5539.  
  5540.         FrobTime = Level.TimeSeconds;
  5541.         if (!bRemoveVanillaDeath || Health < -40)
  5542.            ShowHud(False);
  5543.         else if (bRemoveVanillaDeath)
  5544.         {
  5545.            KillShadow();
  5546.            EndTrace = Location - vect(0,0,320);
  5547.            if (!HeadRegion.Zone.bWaterZone)
  5548.            {
  5549.             hit = Trace(HitLocation, HitNormal, EndTrace, Location, False);
  5550.             pool = spawn(class'BloodPool',,, HitLocation, Rotator(HitNormal));
  5551.             if (pool != none)
  5552.             {
  5553.                 pool.maxDrawScale = CollisionRadius / 520.0;
  5554.                 pool.ReattachDecal();
  5555.             }
  5556.            }
  5557.         }
  5558.       ClientDeath();
  5559.     }
  5560.  
  5561.    function TakeDamage(int Damage, Pawn instigatedBy, Vector hitlocation, Vector momentum, name damageType)
  5562.     {
  5563.     }
  5564.  
  5565.     function Landed(vector HitNormal)
  5566.     {
  5567.        if (Velocity.Z < -800)
  5568.        {
  5569.        PlaySound(sound'pl_fallpain3',SLOT_None,1.5);
  5570.        HeadRegion.Zone.ViewFog.X = 255;
  5571.        }
  5572.     }
  5573.  
  5574.     function PlayerCalcView(out actor ViewActor, out vector CameraLocation, out rotator CameraRotation)
  5575.     {
  5576.         local vector ViewVect, HitLocation, HitNormal, whiteVec;
  5577.         local float ViewDist;
  5578.         local actor HitActor;
  5579.         local float time;
  5580.  
  5581.         ViewActor = Self;
  5582.         if (bHidden && (!bRemoveVanillaDeath || Health < -40))
  5583.         {
  5584.             // spiral up and around carcass and fade to white in five seconds
  5585.             time = Level.TimeSeconds - FrobTime;
  5586.  
  5587.             if ( ((myKiller != None) && (killProfile != None) && (!killProfile.bKilledSelf)) ||
  5588.                   ((killProfile != None) && killProfile.bValid && (!killProfile.bKilledSelf)))
  5589.             {
  5590.                 if ( killProfile.bValid && killProfile.bTurretKilled )
  5591.                     ViewVect = killProfile.killerLoc - Location;
  5592.                 else if ( killProfile.bValid && killProfile.bProximityKilled )
  5593.                     ViewVect = killProfile.killerLoc - Location;
  5594.                 else if (( !killProfile.bKilledSelf ) && ( myKiller != None ))
  5595.                     ViewVect = myKiller.Location - Location;
  5596.                 CameraLocation = Location;
  5597.                 CameraRotation = Rotator(ViewVect);
  5598.             }
  5599.             else if (time < 8.0)
  5600.             {
  5601.                 whiteVec.X = time / 16.0;
  5602.                 whiteVec.Y = time / 16.0;
  5603.                 whiteVec.Z = time / 16.0;
  5604.                 CameraRotation.Pitch = -16384;
  5605.                 CameraRotation.Yaw = (time * 2000.0); // 8192.0) % 65536; CyberP: slow down the spinning
  5606.                 ViewDist = 32 + time * 32;
  5607.                 InstantFog = whiteVec;
  5608.                 InstantFlash = 0.5;
  5609.                 ViewFlash(1.0);
  5610.                 // make sure we don't go through the ceiling
  5611.                 ViewVect = vect(0,0,1);
  5612.                 HitActor = Trace(HitLocation, HitNormal, Location + ViewDist * ViewVect, Location);
  5613.                 if ( HitActor != None )
  5614.                     CameraLocation = HitLocation;
  5615.                 else
  5616.                     CameraLocation = Location + ViewDist * ViewVect;
  5617.             }
  5618.             else
  5619.             {
  5620.                 if  ( Level.NetMode != NM_Standalone )
  5621.                 {
  5622.                     // Don't fade to black in multiplayer
  5623.                 }
  5624.                 else
  5625.                 {
  5626.                     // then, fade out to black in four seconds and bring up
  5627.                     // the main menu automatically
  5628.                     whiteVec.X = FMax(0.5 - (time-8.0) / 8.0, -1.0);
  5629.                     whiteVec.Y = FMax(0.5 - (time-8.0) / 8.0, -1.0);
  5630.                     whiteVec.Z = FMax(0.5 - (time-8.0) / 8.0, -1.0);
  5631.                     CameraRotation.Pitch = -16384;
  5632.                     CameraRotation.Yaw = (time * 2000.0); //% 65536;  cyberP: same changes as above.
  5633.                      ViewDist = 32 + 8.0 * 32;
  5634.                     InstantFog = whiteVec;
  5635.                     InstantFlash = whiteVec.X;
  5636.                     ViewFlash(1.0);
  5637.  
  5638.                     // start the splash screen after a bit
  5639.                     // only if we don't have a menu open
  5640.                     // DEUS_EX AMSD Don't do this in multiplayer!!!!
  5641.                     if (Level.NetMode == NM_Standalone)
  5642.                     {
  5643.                         if (whiteVec == vect(-1.0,-1.0,-1.0))
  5644.                             if ((MenuUIWindow(DeusExRootWindow(rootWindow).GetTopWindow()) == None) &&
  5645.                                 (ToolWindow(DeusExRootWindow(rootWindow).GetTopWindow()) == None))
  5646.                                 ConsoleCommand("OPEN DXONLY");
  5647.                     }
  5648.                 }
  5649.                 // make sure we don't go through the ceiling
  5650.                 ViewVect = vect(0,0,1);
  5651.                 HitActor = Trace(HitLocation, HitNormal, Location + ViewDist * ViewVect, Location);
  5652.                 if ( HitActor != None )
  5653.                     CameraLocation = HitLocation;
  5654.                 else
  5655.                     CameraLocation = Location + ViewDist * ViewVect;
  5656.             }
  5657.         }
  5658.         else if (bRemoveVanillaDeath)
  5659.         {
  5660.             time = Level.TimeSeconds - FrobTime;
  5661.  
  5662.                CameraLocation = Location;
  5663.                CameraRotation = ViewRotation;
  5664.                ViewFlash(1.0);
  5665.                bHidden = True;
  5666.  
  5667.             if (time < 0.35 && !HeadRegion.Zone.bWaterZone && ((AnimSequence == 'DeathFront' && Physics != PHYS_Falling) || bJustLanded))
  5668.             {
  5669.             //CameraRotation.Pitch = (time * -17000);
  5670.             //CameraRotation.Yaw = (time * 1000.0);
  5671.             //CameraLocation += Vector(ViewRotation) * (time * 60);
  5672.             //CameraLocation.Z -= (time * 5);
  5673.             CameraRotation.Pitch = (time * 7000);
  5674.             CameraRotation.Roll = (time * 34000.0);
  5675.             if (MeleeRange != 51.000000)
  5676.                CameraLocation.Z -= (time * 127);
  5677.             else
  5678.                CameraLocation.Z -= (time * 48);
  5679.             rota = CameraRotation;
  5680.             vecta = CameraLocation;
  5681.             }
  5682.             else if (time < 1.1 && !HeadRegion.Zone.bWaterZone && (AnimSequence == 'DeathBack' || (AnimSequence == 'DeathFront' && Physics == PHYS_Falling)))
  5683.             {
  5684.             if (time < 0.5)
  5685.             CameraRotation.Pitch = (time * 16000);
  5686.             else if (time < 0.6)
  5687.             CameraRotation.Pitch = (time * 16500);
  5688.             else if  (time < 0.7)
  5689.             CameraRotation.Pitch = (time * 17000);
  5690.             else if (time < 0.8)
  5691.             CameraRotation.Pitch = (time * 17500);
  5692.             else
  5693.             CameraRotation.Pitch = (time * 18000);
  5694.  
  5695.             CameraRotation.Yaw += (time * 6000.0);
  5696.             if (MeleeRange != 51.000000)
  5697.                CameraLocation.Z -= (time * 30);
  5698.             else
  5699.                CameraLocation.Z -= (time * 13);
  5700.             rota = CameraRotation;
  5701.             vecta = CameraLocation;
  5702.             }
  5703.             else if (time < 8.0 && HeadRegion.Zone.bWaterZone)
  5704.             {
  5705.                CameraRotation.Pitch -= (time * 2000);
  5706.                CameraRotation.Yaw -= (time * 1000);
  5707.                rota = CameraRotation;
  5708.                vecta = CameraLocation;
  5709.             }
  5710.             else
  5711.             {
  5712.             CameraRotation = rota;
  5713.             CameraLocation = vecta;
  5714.             }
  5715.         }
  5716.         else
  5717.         {
  5718.             // use FrobTime as the cool DeathCam timer
  5719.             FrobTime = Level.TimeSeconds;
  5720.  
  5721.             // make sure we don't go through the wall
  5722.             ViewDist = 190;
  5723.             ViewVect = vect(1,0,0) >> Rotation;
  5724.             HitActor = Trace( HitLocation, HitNormal,
  5725.                     Location - ViewDist * vector(CameraRotation), Location, false, vect(12,12,2));
  5726.             if ( HitActor != None )
  5727.                 CameraLocation = HitLocation;
  5728.             else
  5729.                 CameraLocation = Location - ViewDist * ViewVect;
  5730.         }
  5731.  
  5732.         // don't fog view if we are "paused"
  5733.         if (DeusExRootWindow(rootWindow).bUIPaused)
  5734.         {
  5735.             InstantFog   = vect(0,0,0);
  5736.             InstantFlash = 0;
  5737.             ViewFlash(1.0);
  5738.         }
  5739.     }
  5740.  
  5741. Begin:
  5742.     // Dead players comes back to life with scope view, so this is here to prevent that
  5743.     if ( DeusExWeapon(inHand) != None )
  5744.     {
  5745.         DeusExWeapon(inHand).bZoomed = False;
  5746.         DeusExWeapon(inHand).RefreshScopeDisplay(Self, True, False);
  5747.     }
  5748.  
  5749.     if ( DeusExRootWindow(rootWindow).hud.augDisplay != None )
  5750.     {
  5751.         DeusExRootWindow(rootWindow).hud.augDisplay.bVisionActive = False;
  5752.         DeusExRootWindow(rootWindow).hud.augDisplay.activeCount = 0;
  5753.     }
  5754.  
  5755.     // Don't come back to life drugged or posioned
  5756.     poisonCounter       = 0;
  5757.     poisonTimer         = 0;
  5758.     drugEffectTimer = 0;
  5759.  
  5760.     if (AugmentationSystem != None)
  5761.         AugmentationSystem.DeactivateAll(); //CyberP: deactivate augs
  5762.     // Don't come back to life crouched
  5763.     bCrouchOn           = False;
  5764.     bWasCrouchOn        = False;
  5765.     bIsCrouching        = False;
  5766.     bForceDuck          = False;
  5767.     lastbDuck           = 0;
  5768.     bDuck               = 0;
  5769.  
  5770.     ClientFlash(900000,vect(160,0,0));
  5771.     IncreaseClientFlashLength(4);
  5772.     FrobTime = Level.TimeSeconds;
  5773.     bBehindView = True;  //CyberP: was true
  5774.     Velocity = vect(0,0,0);
  5775.     Acceleration = vect(0,0,0);
  5776.     DesiredFOV = Default.DesiredFOV;
  5777.     FinishAnim();
  5778.     KillShadow();
  5779.  
  5780.    FlashTimer = 0;
  5781.  
  5782.     // hide us and spawn the carcass
  5783.     bHidden = True;
  5784.     if (!bRemoveVanillaDeath)
  5785.        SpawnCarcass();
  5786.    //DEUS_EX AMSD Players should not leave physical versions of themselves around :)
  5787.    if (Level.NetMode != NM_Standalone)
  5788.       HidePlayer();
  5789. }
  5790.  
  5791. // ----------------------------------------------------------------------
  5792. // state Interpolating
  5793. // ----------------------------------------------------------------------
  5794.  
  5795. state Interpolating
  5796. {
  5797.     ignores all;
  5798.  
  5799.     function TakeDamage(int Damage, Pawn instigatedBy, Vector hitlocation, Vector momentum, name damageType)
  5800.     {
  5801.     }
  5802.  
  5803.     // check to see if we are done interpolating, if so, then travel to the next map
  5804.     event InterpolateEnd(Actor Other)
  5805.     {
  5806.         if (InterpolationPoint(Other).bEndOfPath)
  5807.             if (NextMap != "")
  5808.             {
  5809.                 // DEUS_EX_DEMO
  5810.                 //
  5811.                 // If this is the demo, show the demo splash screen, which
  5812.                 // will exit the game after the player presses a key/mouseclick
  5813. //              if (NextMap == "02_NYC_BatteryPark")
  5814. //                  ShowDemoSplash();
  5815. //              else
  5816.                     Level.Game.SendPlayer(Self, NextMap);
  5817.             }
  5818.     }
  5819.  
  5820.     exec function Fire(optional float F)
  5821.     {
  5822.         local DeusExLevelInfo info;
  5823.  
  5824.         // only bring up the menu if we're not in a mission outro
  5825.         info = GetLevelInfo();
  5826.         if ((info != None) && (info.MissionNumber < 0))
  5827.             ShowMainMenu();
  5828.     }
  5829.  
  5830.     event PlayerTick(float deltaTime)
  5831.     {
  5832.         UpdateInHand();
  5833.         UpdateDynamicMusic(deltaTime);
  5834.         ShowHud(False);
  5835.     }
  5836.  
  5837. Begin:
  5838.     if (bOnFire)
  5839.         ExtinguishFire();
  5840.  
  5841.     bDetectable = False;
  5842.  
  5843.     // put away your weapon
  5844.     if (Weapon != None)
  5845.     {
  5846.         Weapon.bHideWeapon = True;
  5847.         Weapon = None;
  5848.         PutInHand(None);
  5849.     }
  5850.  
  5851.     // can't carry decorations across levels
  5852.     if (CarriedDecoration != None)
  5853.     {
  5854.         CarriedDecoration.Destroy();
  5855.         CarriedDecoration = None;
  5856.     }
  5857.  
  5858.     PlayAnim('Still');
  5859. }
  5860.  
  5861. state StaticFreeze
  5862. {
  5863.     ignores all;
  5864.  
  5865.     event PlayerTick(float deltaTime)
  5866.     {
  5867.         UpdateInHand();
  5868.  
  5869. //      ViewFlash(deltaTime);
  5870.         if (aGEPProjectile==none)
  5871.         {
  5872.             bStaticFreeze=false;
  5873.            GotoState('PlayerWalking');
  5874.         }
  5875.     }
  5876. Begin:
  5877. }
  5878. // ----------------------------------------------------------------------
  5879. // state Paralyzed
  5880. // ----------------------------------------------------------------------
  5881.  
  5882. state Paralyzed
  5883. {
  5884.     ignores all;
  5885.  
  5886.     function TakeDamage(int Damage, Pawn instigatedBy, Vector hitlocation, Vector momentum, name damageType)
  5887.     {
  5888.     }
  5889.  
  5890.     exec function Fire(optional float F)
  5891.     {
  5892.         ShowMainMenu();
  5893.     }
  5894.  
  5895.     event PlayerTick(float deltaTime)
  5896.     {
  5897.         UpdateInHand();
  5898.         ShowHud(False);
  5899.         ViewFlash(deltaTime);
  5900.     }
  5901.  
  5902. Begin:
  5903.     if (bOnFire)
  5904.         ExtinguishFire();
  5905.  
  5906.     bDetectable = False;
  5907.  
  5908.     // put away your weapon
  5909.     if (Weapon != None)
  5910.     {
  5911.         Weapon.bHideWeapon = True;
  5912.         Weapon = None;
  5913.         PutInHand(None);
  5914.     }
  5915.  
  5916.     // can't carry decorations across levels
  5917.     if (CarriedDecoration != None)
  5918.     {
  5919.         CarriedDecoration.Destroy();
  5920.         CarriedDecoration = None;
  5921.     }
  5922.  
  5923.     SetPhysics(PHYS_None);
  5924.     PlayAnim('Still');
  5925.     Stop;
  5926.  
  5927. Letterbox:
  5928.     if (bOnFire)
  5929.         ExtinguishFire();
  5930.  
  5931.     bDetectable = False;
  5932.  
  5933.     // put away your weapon
  5934.     if (Weapon != None)
  5935.     {
  5936.         Weapon.bHideWeapon = True;
  5937.         Weapon = None;
  5938.         PutInHand(None);
  5939.     }
  5940.  
  5941.     // can't carry decorations across levels
  5942.     if (CarriedDecoration != None)
  5943.     {
  5944.         CarriedDecoration.Destroy();
  5945.         CarriedDecoration = None;
  5946.     }
  5947.  
  5948.     SetPhysics(PHYS_None);
  5949.     PlayAnim('Still');
  5950.     if (rootWindow != None)
  5951.         rootWindow.NewChild(class'CinematicWindow');
  5952. }
  5953.  
  5954. // ----------------------------------------------------------------------
  5955. // RenderOverlays()
  5956. // render our in-hand object
  5957. // ----------------------------------------------------------------------
  5958. simulated event RenderOverlays( canvas Canvas )
  5959. {
  5960. //  if ((aGEPProjectile!=none)&&(aGEPProjectile.IsA('Rocket'))&&(Rocket(aGEPProjectile).bFlipFlopCanvas)) return;
  5961.  
  5962.     if ((GEPmounted!=none)&&(GEPmounted.bFlipFlopCanvas)) return;
  5963.  
  5964.     Super.RenderOverlays(Canvas);
  5965.  
  5966.     if (!IsInState('Interpolating') && !IsInState('Paralyzed'))
  5967.         if ((inHand != None) && (!inHand.IsA('Weapon')))
  5968.             inHand.RenderOverlays(Canvas);
  5969.  
  5970.  
  5971.  
  5972.     if ((aGEPProjectile!=none)&&(aGEPProjectile.IsA('Rocket'))&&(bGEPprojectileInflight))
  5973.     {
  5974.         if (!bStaticFreeze)
  5975.         {
  5976.             SAVErotation=Rotation;
  5977.             SAVElocation=Location;
  5978.             bStaticFreeze=true;
  5979.         }
  5980. //      Rocket(aGEPProjectile).RenderPortal(Canvas);
  5981.     } else
  5982.         bStaticFreeze=false;
  5983. }
  5984.  
  5985. // ----------------------------------------------------------------------
  5986. // RestrictInput()
  5987. //
  5988. // Are we in a state which doesn't allow certain exec functions?
  5989. // ----------------------------------------------------------------------
  5990.  
  5991. function bool RestrictInput()
  5992. {
  5993.     if (IsInState('Interpolating') || IsInState('Dying') || IsInState('Paralyzed') || (FlagBase.GetBool('PlayerTraveling') ))
  5994.         return True;
  5995.  
  5996.     return False;
  5997. }
  5998.  
  5999.  
  6000. // ----------------------------------------------------------------------
  6001. // DroneExplode
  6002. // ----------------------------------------------------------------------
  6003. function DroneExplode()
  6004. {
  6005.     local AugDrone anAug;
  6006.  
  6007.     if (aDrone != None)
  6008.     {
  6009.         aDrone.Explode(aDrone.Location, vect(0,0,1));
  6010.       //DEUS_EX AMSD Don't blow up OTHER player drones...
  6011.       anAug = AugDrone(AugmentationSystem.FindAugmentation(class'AugDrone'));
  6012.         //foreach AllActors(class'AugDrone', anAug)
  6013.       if (anAug != None)
  6014.          anAug.Deactivate();
  6015.     }
  6016. }
  6017.  
  6018. // ----------------------------------------------------------------------
  6019. // BuySkills()
  6020. // ----------------------------------------------------------------------
  6021.  
  6022. exec function BuySkills()
  6023. {
  6024.     if ( Level.NetMode != NM_Standalone )
  6025.     {
  6026.         // First turn off scores if we're heading into skill menu
  6027.         if ( !bBuySkills )
  6028.             ClientTurnOffScores();
  6029.  
  6030.         bBuySkills = !bBuySkills;
  6031.         BuySkillSound( 2 );
  6032.     }
  6033. }
  6034.  
  6035. // ----------------------------------------------------------------------
  6036. // KillerProfile()
  6037. // ----------------------------------------------------------------------
  6038.  
  6039. exec function KillerProfile()
  6040. {
  6041.     bKillerProfile = !bKillerProfile;
  6042. }
  6043.  
  6044. // ----------------------------------------------------------------------
  6045. // ClientTurnOffScores()
  6046. // ----------------------------------------------------------------------
  6047. function ClientTurnOffScores()
  6048. {
  6049.     if ( bShowScores )
  6050.         bShowScores = False;
  6051. }
  6052.  
  6053. // ----------------------------------------------------------------------
  6054. /// ShowScores()  //CyberP: this function is now used in singleplayer for secondary weapon use
  6055. // ----------------------------------------------------------------------
  6056.  
  6057. exec function ShowScores()
  6058. {
  6059.     if ( bBuySkills && !bShowScores )
  6060.         BuySkills();
  6061.     if (Level.NetMode == NM_Standalone)
  6062.     {
  6063.         if (RestrictInput())
  6064.         return;
  6065.         if (Weapon != None && inHand != none && assignedWeapon != None && assignedWeapon != inHand)
  6066.         {
  6067.          if (inHand.IsA('DeusExWeapon'))
  6068.          primaryWeapon = DeusExWeapon(inHand);
  6069.          inHandPending = assignedWeapon;
  6070.          if (inHandPending.IsA('DeusExWeapon'))
  6071.             DeusExWeapon(inHandPending).bBeginQuickMelee=true;
  6072.         }
  6073.         else if (inHand != none && assignedWeapon != None && assignedWeapon == inHand)
  6074.         {
  6075.           if (inHand.IsA('DeusExWeapon') && DeusExWeapon(inHand).bBeginQuickMelee)
  6076.           {
  6077.                   if (DeusExWeapon(inHand).AccurateRange > 200 && DeusExWeapon(inHand).AmmoLeftInClip() == 0 ) //CyberP/|Totalitarian|: hack fix bug
  6078.                      return;
  6079.                   else
  6080.                      DeusExWeapon(inHand).quickMeleeCombo = 0.4;
  6081.           }
  6082.         }
  6083.         else if (inHand == none && inHandPending == None && CarriedDecoration == None)
  6084.         {
  6085.            if (assignedWeapon != None)
  6086.                inHandPending = assignedWeapon;
  6087.         }
  6088.     }
  6089.     bShowScores = !bShowScores;
  6090. }
  6091.  
  6092. // ----------------------------------------------------------------------
  6093. // ParseLeftClick()
  6094. // ----------------------------------------------------------------------
  6095.  
  6096. exec function ParseLeftClick()
  6097. {
  6098.     local int AugMuscleOn;
  6099.     local DeusExPickup pickup;
  6100.     local int MedSkillLevel;
  6101.     local string bioboost;
  6102.     local DeusExRootWindow root;
  6103.     local bool bThrownDecor;
  6104.     //local Decoration Decor;  //CyberP: see commented out block further down.
  6105.  
  6106.     //
  6107.     // ParseLeftClick deals with things in your HAND
  6108.     //
  6109.     // Precedence:
  6110.     // - Detonate spy drone
  6111.     // - Fire (handled automatically by user.ini bindings)
  6112.     // - Use inHand
  6113.     //
  6114.  
  6115. //log("ParseLeftClick");
  6116.     if (RestrictInput())
  6117.         return;
  6118. //log("ParseLeftClick1");
  6119.     // if the spy drone augmentation is active, blow it up
  6120.     if (bSpyDroneActive)
  6121.     {
  6122.         DroneExplode();
  6123.         return;
  6124.     }
  6125.  
  6126.     if (inHand != None)
  6127.        if (inHand.IsA('DeusExWeapon'))  //CyberP: cancel reloading - shotguns only
  6128.          if (DeusExWeapon(inHand).IsInState('Reload'))
  6129.              DeusExWeapon(inHand).bCancelLoading = True;
  6130. //log("ParseLeftClick2");
  6131.     if ((inHand != None) && !bInHandTransition &&(!inHand.IsA('POVcorpse')))
  6132.     {
  6133. //  log("ParseLeftClick3");
  6134.         if (inHand.bActivatable)
  6135.             inHand.Activate();
  6136.         else if (FrobTarget != None)
  6137.         {
  6138. //       log("ParseLeftClick4");
  6139.             // special case for using keys or lockpicks on doors
  6140.             if (FrobTarget.IsA('DeusExMover'))
  6141.                 if (inHand.IsA('NanoKeyRing') || inHand.IsA('Lockpick'))
  6142.                     DoFrob(Self, inHand);
  6143.  
  6144.             // special case for using multitools on hackable things
  6145.             if (FrobTarget.IsA('HackableDevices'))
  6146.             {
  6147.                 if (inHand.IsA('Multitool'))
  6148.                 {
  6149.                     if (( Level.Netmode != NM_Standalone ) && (TeamDMGame(DXGame) != None) && FrobTarget.IsA('AutoTurretGun') && (AutoTurretGun(FrobTarget).team==PlayerReplicationInfo.team) )
  6150.                     {
  6151.                         MultiplayerNotifyMsg( MPMSG_TeamHackTurret );
  6152.                         return;
  6153.                     }
  6154.                     else
  6155.                         DoFrob(Self, inHand);
  6156.                 }
  6157.             }
  6158.         }
  6159.     }
  6160.     else
  6161.     {
  6162.       if (AugmentationSystem != None)
  6163.       AugMuscleOn = AugmentationSystem.GetAugLevelValue(class'AugMuscle');
  6164.         if (AugMuscleOn> -1.0)
  6165.         {
  6166.          if ((inHand != None) && !bInHandTransition &&(InHand.IsA('POVcorpse')))
  6167.          {
  6168.             bThrownDecor=true;
  6169.             if (bRealisticCarc || bHardCoreMode)
  6170.             bThrowDecoration=False;
  6171.             else
  6172.             bThrowDecoration=True;
  6173.             DropItem();
  6174.          } else
  6175.          {
  6176.             if (CarriedDecoration != None)
  6177.                  bThrownDecor=true;
  6178.             bThrowDecoration=true;
  6179.             DropDecoration();
  6180.          // play a throw anim
  6181.             PlayAnim('Attack',,0.1);
  6182.            }
  6183.        }
  6184.     }
  6185.     /*if (inHand == None && FrobTarget != none && FrobTarget.IsA('DeusExDecoration') && Decoration(FrobTarget).bPushable == False)
  6186.     {
  6187.     Decoration(FrobTarget).bPushable = True;
  6188.     GrabDecoration();
  6189.     } */ //CyberP: this allowed us to pick up objects like datacubes, lamps. vending machines and such, but it is not worth the effort.
  6190.     if (inHand == None && FrobTarget != none && FrobTarget.IsA('DeusExPickup'))
  6191.     {
  6192.       if (FrobTarget.IsA('Sodacan'))
  6193.       {
  6194.       if (fullUp >= 15)
  6195.       {ClientMessage(fatty); return;}
  6196.        HealPlayer(2, False);
  6197.        PlaySound(sound'MaleBurp');
  6198.        fullUp++;
  6199.        DeusExPickup(FrobTarget).Destroy();
  6200.       }
  6201.       else if (FrobTarget.IsA('SoyFood'))
  6202.       {
  6203.       if (fullUp >= 15)
  6204.       {ClientMessage(fatty); return;}
  6205.        HealPlayer(5, False);
  6206.        PlaySound(sound'EatingChips',SLOT_None,3.0);
  6207.        fullUp++;
  6208.        DeusExPickup(FrobTarget).Destroy();
  6209.       }
  6210.       else if (FrobTarget.IsA('Candybar'))
  6211.       {
  6212.       if (fullUp >= 15)
  6213.       {ClientMessage(fatty); return;}
  6214.        HealPlayer(3, False);
  6215.        PlaySound(sound'CandyEat',SLOT_None,2);
  6216.        bioboost="Recharged 3 Bioelectrical Energy Units";
  6217.        ClientMessage(bioboost);
  6218.        Energy += 3;
  6219.        if (Energy > EnergyMax)
  6220.                 Energy = EnergyMax;
  6221.        fullUp++;
  6222.        DeusExPickup(FrobTarget).Destroy();
  6223.       }
  6224.       else if (FrobTarget.IsA('Flare'))
  6225.       {
  6226.        Flare(FrobTarget).LightFlare();
  6227.       }
  6228.       else if (FrobTarget.IsA('FireExtinguisher'))
  6229.       {
  6230.        if (FireExtinguisher(FrobTarget).bAltActivate==False)
  6231.        {
  6232.        FireExtinguisher(FrobTarget).bAltActivate=True;
  6233.        FireExtinguisher(FrobTarget).Activate();
  6234.        }
  6235.       }
  6236.       else if (FrobTarget.IsA('WineBottle'))
  6237.       {
  6238.       if (fullUp >= 15)
  6239.       {ClientMessage(fatty); return;}
  6240.        HealPlayer(2, False);
  6241.        drugEffectTimer += 5.0;
  6242.        PlaySound(sound'drinkwine',SLOT_None);
  6243.        fullUp++;
  6244.        DeusExPickup(FrobTarget).Destroy();
  6245.       }
  6246.       else if (FrobTarget.IsA('Liquor40oz'))
  6247.       {
  6248.       if (fullUp >= 15)
  6249.       {ClientMessage(fatty); return;}
  6250.        HealPlayer(2, False);
  6251.        drugEffectTimer += 7.0;
  6252.        PlaySound(sound'drinkwine',SLOT_None);
  6253.        fullUp++;
  6254.        DeusExPickup(FrobTarget).Destroy();
  6255.       }
  6256.       else if (FrobTarget.IsA('LiquorBottle'))
  6257.       {
  6258.       if (fullUp >= 15)
  6259.       {ClientMessage(fatty); return;}
  6260.        HealPlayer(2, False);
  6261.        drugEffectTimer += 4.0;
  6262.        PlaySound(sound'drinkwine',SLOT_None);
  6263.        fullUp++;
  6264.        DeusExPickup(FrobTarget).Destroy();
  6265.       }
  6266.       else if (FrobTarget.IsA('VialCrack'))
  6267.       {
  6268.       if (fullUp >= 10)
  6269.       {ClientMessage(fatty); return;}
  6270.        HealPlayer(-10, False);
  6271.        drugEffectTimer += 60.0;
  6272.        fullUp++;
  6273.        DeusExPickup(FrobTarget).Destroy();
  6274.       }
  6275.       else if (FrobTarget.IsA('Medkit'))
  6276.       {
  6277.        if (SkillSystem != none)
  6278.         MedSkillLevel = SkillSystem.GetSkillLevel(class'SkillMedicine');
  6279.        if (MedSkillLevel < 1.0)
  6280.        MedSkillLevel = 0;
  6281.        HealPlayer((MedSkillLevel+1)*30, False);
  6282.        PlaySound(sound'MedicalHiss', SLOT_None,,, 256);
  6283.        ClientFlash(4,vect(0,0,200));
  6284.        DeusExPickup(FrobTarget).Destroy();
  6285.       }
  6286.       else if (FrobTarget.IsA('BioelectricCell'))
  6287.       {
  6288.        PlaySound(sound'BioElectricHiss', SLOT_None,,, 256);
  6289.        if (PerkNamesArray[8]==1)
  6290.             BioelectricCell(FrobTarget).rechargeAmount=25;
  6291.        ClientMessage(Sprintf(BioelectricCell(FrobTarget).msgRecharged, BioelectricCell(FrobTarget).rechargeAmount));
  6292.        Energy += BioelectricCell(FrobTarget).rechargeAmount; //25;
  6293.             if (Energy > EnergyMax)
  6294.                 Energy = EnergyMax;
  6295.        DeusExPickup(FrobTarget).Destroy();
  6296.       }
  6297.       else if (FrobTarget.IsA('Cigarettes'))
  6298.       {
  6299.        Cigarettes(FrobTarget).bDontUse = True;
  6300.        Cigarettes(FrobTarget).GoToState('Activated');
  6301.       }
  6302.       else if (FrobTarget.IsA('SkilledTool') || FrobTarget.IsA('ChargedPickup') || FrobTarget.IsA('WeaponMod') ||
  6303.       FrobTarget.IsA('AugmentationUpgradeCannister') || FrobTarget.IsA('AugmentationCannister') || FrobTarget.IsA('Binoculars'))
  6304.       {
  6305.       bLeftClicked = True;
  6306.       ParseRightClick();
  6307.       }
  6308.       else
  6309.       ClientMessage(noUsing);
  6310.     }
  6311.     else if (inHand == None && FrobTarget != none && FrobTarget.IsA('DeusExWeapon'))
  6312.     {
  6313.     bLeftClicked = True;
  6314.     ParseRightClick();
  6315.     }
  6316.     else if (inHand == None && FrobTarget != none && FrobTarget.IsA('DeusExAmmo'))
  6317.     {
  6318.     ClientMessage(noUsing);
  6319.     }
  6320. //  log("ParseLeftClick5");
  6321. }
  6322.  
  6323. // ----------------------------------------------------------------------
  6324. // ParseRightClick()
  6325. // ----------------------------------------------------------------------
  6326.  
  6327. exec function ParseRightClick()
  6328. {
  6329.     //
  6330.     // ParseRightClick deals with things in the WORLD
  6331.     //
  6332.     // Precedence:
  6333.     // - Pickup highlighted Inventory
  6334.     // - Frob highlighted object
  6335.     // - Grab highlighted Decoration
  6336.     // - Put away (or drop if it's a deco) inHand
  6337.     //
  6338.  
  6339.     local AutoTurret turret;
  6340.     local int ViewIndex;
  6341.     local bool bPlayerOwnsIt;
  6342.     local Inventory oldFirstItem;
  6343.     local Inventory oldInHand;
  6344.     local Decoration oldCarriedDecoration;
  6345.     local Vector loc;
  6346.     local DeusExWeapon ExWep;
  6347.     local DeusExRootWindow root;
  6348.  
  6349.     if