JivHiriel

DeusExPlayer.uc (Altered)

Dec 12th, 2016
168
0
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 (RestrictInput())
  6350.         return;
  6351.  
  6352.     if (bSpyDroneActive)
  6353.     {
  6354.     if (aDrone != none)
  6355.         aDrone.AISendEvent('LoudNoise', EAITYPE_Audio, TransientSoundVolume, 768);
  6356.         if (FRand() < 0.25)
  6357.         PlaySound(sound'CatDie');
  6358.         else if (FRand() < 0.5)
  6359.         PlaySound(sound'DogLargeBark1');
  6360.         else if (FRand() < 0.75)
  6361.         PlaySound(sound'SeagullCry');
  6362.         else
  6363.         PlaySound(sound'RatSqueak1');
  6364.         return;
  6365.     }
  6366.     oldFirstItem = Inventory;
  6367.     oldInHand = inHand;
  6368.     oldCarriedDecoration = CarriedDecoration;
  6369.  
  6370.     if (FrobTarget != None)
  6371.         loc = FrobTarget.Location;
  6372.  
  6373.     if (FrobTarget != None)
  6374.     {
  6375.         // First check if this is a NanoKey, in which case we just
  6376.         // want to add it to the NanoKeyRing without disrupting
  6377.         // what the player is holding
  6378.         if ((FrobTarget.IsA('ScriptedPawn') || FrobTarget.IsA('DeusExMover')) && bAlternateToolbelt) //CyberP: no, first we do this for the invisible war toolbelt.
  6379.         {
  6380.             if ((ScriptedPawn(FrobTarget) != None && ScriptedPawn(FrobTarget).GetPawnAllianceType(self) == ALLIANCE_Hostile) || (DeusExMover(FrobTarget) != None && DeusExMover(FrobTarget).bFrobbable == False))
  6381.             {
  6382.              if (CarriedDecoration == None) //CyberP: DX:IW toolbelt
  6383.              {
  6384.               if (inHand != None && inHand.IsA('POVCorpse'))
  6385.               {
  6386.               }
  6387.               else
  6388.               {
  6389.                if (inHand == None)
  6390.                {
  6391.                root = DeusExRootWindow(rootWindow);
  6392.                 if (root != None && root.hud.belt.GetObjectFromBelt(advBelt) != inHand)
  6393.                 {
  6394.                    root.ActivateObjectInBelt(advBelt);
  6395.                    return;
  6396.                 }
  6397.                }
  6398.                else
  6399.                 PutInHand(None);
  6400.               }
  6401.              }
  6402.             }
  6403.             else
  6404.                 DoFrob(Self, None);
  6405.         }
  6406.         else if (FrobTarget.IsA('NanoKey'))
  6407.         {
  6408.             PickupNanoKey(NanoKey(FrobTarget));
  6409.             FrobTarget.Destroy();
  6410.             FrobTarget = None;
  6411.             return;
  6412.         }
  6413.         else if (FrobTarget.IsA('Inventory'))
  6414.         {
  6415.             // If this is an item that can be stacked, check to see if
  6416.             // we already have one, in which case we don't need to
  6417.             // allocate more space in the inventory grid.
  6418.             //
  6419.             // TODO: This logic may have to get more involved if/when
  6420.             // we start allowing other types of objects to get stacked.
  6421.             if (SkillSystem != none)
  6422.             {
  6423.             if ((FrobTarget.IsA('WeaponGEPGun') || FrobTarget.IsA('WeaponFlamethrower') || FrobTarget.IsA('WeaponPlasmaRifle')) && PerkNamesArray[24]==1)
  6424.             {
  6425.              DeusExWeapon(FrobTarget).invSlotsX=3;
  6426.              DeusExWeapon(FrobTarget).invSlotsY=1;
  6427.             }
  6428.             }
  6429.  
  6430.             if (PerkNamesArray[30]==1)
  6431.             {
  6432.                 if (FrobTarget.IsA('BioelectricCell'))
  6433.                 BioelectricCell(FrobTarget).MaxCopies=25;
  6434.                 else if (FrobTarget.IsA('Medkit'))
  6435.                 Medkit(FrobTarget).MaxCopies=20;
  6436.             }
  6437.  
  6438.             if (HandleItemPickup(FrobTarget, True) == False)
  6439.                 return;
  6440.  
  6441.             // if the frob succeeded, put it in the player's inventory
  6442.          //DEUS_EX AMSD ARGH! Because of the way respawning works, the item I pick up
  6443.          //is NOT the same as the frobtarget if I do a pickup.  So how do I tell that
  6444.          //I've successfully picked it up?  Well, if the first item in my inventory
  6445.          //changed, I picked up a new item.
  6446.             if ( ((Level.NetMode == NM_Standalone) && (Inventory(FrobTarget).Owner == Self)) ||
  6447.               ((Level.NetMode != NM_Standalone) && (oldFirstItem != Inventory)) )
  6448.             {
  6449.             if (Level.NetMode == NM_Standalone)
  6450.                FindInventorySlot(Inventory(FrobTarget));
  6451.             else
  6452.                FindInventorySlot(Inventory);
  6453.                 FrobTarget = None;
  6454.             }
  6455.         }
  6456.         else if (FrobTarget.IsA('Decoration') && Decoration(FrobTarget).bPushable)
  6457.         {
  6458.             if (swimTimer <= 1)
  6459.             {
  6460.             }
  6461.             else
  6462.             {
  6463.             GrabDecoration();
  6464.             }
  6465.         }
  6466.         else
  6467.         {
  6468.             if (( Level.NetMode != NM_Standalone ) && ( TeamDMGame(DXGame) != None ))
  6469.             {
  6470.                 if ( FrobTarget.IsA('LAM') || FrobTarget.IsA('GasGrenade') || FrobTarget.IsA('EMPGrenade'))
  6471.                 {
  6472.                     if ((ThrownProjectile(FrobTarget).team == PlayerReplicationInfo.team) && ( ThrownProjectile(FrobTarget).Owner != Self ))
  6473.                     {
  6474.                         if ( ThrownProjectile(FrobTarget).bDisabled )       // You can re-enable a grenade for a teammate
  6475.                         {
  6476.                             ThrownProjectile(FrobTarget).ReEnable();
  6477.                             return;
  6478.                         }
  6479.                         MultiplayerNotifyMsg( MPMSG_TeamLAM );
  6480.                         return;
  6481.                     }
  6482.                 }
  6483.                 if ( FrobTarget.IsA('ComputerSecurity') && (PlayerReplicationInfo.team == ComputerSecurity(FrobTarget).team) )
  6484.                 {
  6485.                     // Let controlling player re-hack his/her own computer
  6486.                     bPlayerOwnsIt = False;
  6487.                     foreach AllActors(class'AutoTurret',turret)
  6488.                     {
  6489.                         for (ViewIndex = 0; ViewIndex < ArrayCount(ComputerSecurity(FrobTarget).Views); ViewIndex++)
  6490.                         {
  6491.                             if (ComputerSecurity(FrobTarget).Views[ViewIndex].turretTag == turret.Tag)
  6492.                             {
  6493.                                 if (( turret.safeTarget == Self ) || ( turret.savedTarget == Self ))
  6494.                                 {
  6495.                                     bPlayerOwnsIt = True;
  6496.                                     break;
  6497.                                 }
  6498.                             }
  6499.                         }
  6500.                     }
  6501.                     if ( !bPlayerOwnsIt )
  6502.                     {
  6503.                         MultiplayerNotifyMsg( MPMSG_TeamComputer );
  6504.                         return;
  6505.                     }
  6506.                 }
  6507.             }
  6508.             // otherwise, just frob it
  6509.             DoFrob(Self, None);
  6510.         }
  6511.     }
  6512.     else
  6513.     {
  6514.         // if there's no FrobTarget, put away an inventory item or drop a decoration
  6515.         // or drop the corpse
  6516.         if (bAlternateToolbelt && CarriedDecoration == None) //CyberP: DX:IW toolbelt
  6517.         {
  6518.           if (inHand != None && inHand.IsA('POVCorpse'))
  6519.           {
  6520.           }
  6521.           else
  6522.           {
  6523.             root = DeusExRootWindow(rootWindow);
  6524.             if (root != None && root.hud.belt.GetObjectFromBelt(advBelt) != inHand)
  6525.             {
  6526.             root.ActivateObjectInBelt(advBelt);
  6527.             return;
  6528.             }
  6529.           }
  6530.         }
  6531.         if ((inHand != None) && inHand.IsA('POVCorpse'))
  6532.         {
  6533.             DropItem();
  6534.         }
  6535.         else if (CarriedDecoration != None)
  6536.         {
  6537.             PutInHand(None);
  6538.         }
  6539.         else if (clickCountCyber >= 1)
  6540.         {
  6541.             PutInHand(None);
  6542.         }
  6543.         else if (!bDblClickHolster)
  6544.         {
  6545.             PutInHand(None);
  6546.         }
  6547.         else
  6548.         {
  6549.             SetTimer(0.3,false);
  6550.             bDoubleClickCheck=True;
  6551.             clickCountCyber++;
  6552.         }
  6553.     }
  6554.  
  6555.     if ((oldInHand == None) && (inHand != None))
  6556.         PlayPickupAnim(loc);
  6557.     else if ((oldCarriedDecoration == None) && (CarriedDecoration != None))
  6558.         PlayPickupAnim(loc);
  6559. }
  6560.  
  6561. // ----------------------------------------------------------------------
  6562. // PlayPickupAnim()
  6563. // ----------------------------------------------------------------------
  6564.  
  6565. function PlayPickupAnim(Vector locPickup)
  6566. {
  6567.     if (Location.Z - locPickup.Z < 16)
  6568.         PlayAnim('PushButton',,0.1);
  6569.     else
  6570.         PlayAnim('Pickup',,0.1);
  6571. }
  6572.  
  6573. // ----------------------------------------------------------------------
  6574. // HandleItemPickup()
  6575. // ----------------------------------------------------------------------
  6576.  
  6577. function bool HandleItemPickup(Actor FrobTarget, optional bool bSearchOnly)
  6578. {
  6579.     local bool bCanPickup;
  6580.     local bool bSlotSearchNeeded;
  6581.     local Inventory foundItem;
  6582.  
  6583.     bSlotSearchNeeded = True;
  6584.     bCanPickup = True;
  6585.  
  6586.     // Special checks for objects that do not require phsyical inventory
  6587.     // in order to be picked up:
  6588.     //
  6589.     // - NanoKeys
  6590.     // - DataVaultImages
  6591.     // - Credits
  6592.  
  6593.     if ((FrobTarget.IsA('DataVaultImage')) || (FrobTarget.IsA('NanoKey')) || (FrobTarget.IsA('Credits')))
  6594.     {
  6595.         bSlotSearchNeeded = False;
  6596.     }
  6597.     else if (FrobTarget.IsA('DeusExPickup'))
  6598.     {
  6599.         // If an object of this type already exists in the player's inventory *AND*
  6600.         // the object is stackable, then we don't need to search.
  6601.  
  6602.         if ((FindInventoryType(FrobTarget.Class) != None) && (DeusExPickup(FrobTarget).bCanHaveMultipleCopies))
  6603.              bSlotSearchNeeded = False;
  6604.     }
  6605.     else
  6606.     {
  6607.         // If this isn't ammo or a weapon that we already have,
  6608.         // check if there's enough room in the player's inventory
  6609.         // to hold this item.
  6610.  
  6611.         foundItem = GetWeaponOrAmmo(Inventory(FrobTarget));
  6612.  
  6613.         if (foundItem != None)
  6614.         {
  6615.             bSlotSearchNeeded = False;
  6616.  
  6617.             // if this is an ammo, and we're full of it, abort the pickup
  6618.             if (foundItem.IsA('Ammo'))
  6619.             {
  6620.                 if (Ammo(foundItem).AmmoAmount >= Ammo(foundItem).MaxAmmo)
  6621.                 {
  6622.                     ClientMessage(TooMuchAmmo);
  6623.                     bCanPickup = False;
  6624.                 }
  6625.             }
  6626. //GMDX: hmm
  6627.             // If this is a grenade or LAM (what a pain in the ass) then also check
  6628.             // to make sure we don't have too many grenades already
  6629.             else if ((foundItem.IsA('WeaponEMPGrenade')) ||
  6630.                 (foundItem.IsA('WeaponGasGrenade')) ||
  6631.                 (foundItem.IsA('WeaponNanoVirusGrenade')) ||
  6632.                 (foundItem.IsA('WeaponLAM')))
  6633.             {
  6634.                 if (DeusExWeapon(foundItem).AmmoType.AmmoAmount >= DeusExWeapon(foundItem).AmmoType.MaxAmmo)
  6635.             {
  6636.                     ClientMessage(TooMuchAmmo);
  6637.                     bCanPickup = False;
  6638.                 }
  6639.             }
  6640.  
  6641.             // Otherwise, if this is a single-use weapon, prevent the player
  6642.             // from picking up  //CyberP: also check if ammo is full when picking up weapons
  6643.  
  6644.             else if (foundItem.IsA('Weapon'))
  6645.             {
  6646.                 // If these fields are set as checked, then this is a
  6647.                 // single use weapon, and if we already have one in our
  6648.                 // inventory another cannot be picked up (puke).
  6649.  
  6650.                 bCanPickup = ! ( (Weapon(foundItem).ReloadCount == 0) &&
  6651.                                  (Weapon(foundItem).PickupAmmoCount == 0) &&
  6652.                                  (Weapon(foundItem).AmmoName != None) );
  6653.  
  6654.                 /*if (Weapon(foundItem).IsA('WeaponHideAGun'))
  6655.                 {bCanPickup = True;  bSearchSlotNeeded = True;  }*/
  6656.  
  6657.                 if (!bCanPickup)
  6658.                     ClientMessage(Sprintf(CanCarryOnlyOne, foundItem.itemName));
  6659.                 DeusExWeapon(foundItem).SetMaxAmmo();
  6660.                 if (DeusExWeapon(foundItem).AmmoType.AmmoAmount >= DeusExWeapon(foundItem).MaxiAmmo)
  6661.                 {
  6662.                     ClientMessage(TooMuchAmmo);
  6663.                     bCanPickup = False;
  6664.                 }
  6665.  
  6666.             }
  6667.         }
  6668.     }
  6669.  
  6670.     if (bSlotSearchNeeded && bCanPickup)
  6671.     {
  6672. //    log("MYCHK::DXPlayer::HIP::ADD TO::"@FrobTarget);
  6673.         if (FindInventorySlot(Inventory(FrobTarget), bSearchOnly) == False)
  6674.         {
  6675. //       log("MYCHK::DXPlayer::HIP::ADD TO FAILED::"@foundItem);
  6676.             ClientMessage(Sprintf(InventoryFull, Inventory(FrobTarget).itemName));
  6677.             bCanPickup = False;
  6678.             ServerConditionalNotifyMsg( MPMSG_DropItem );
  6679.         }
  6680.     }
  6681.  
  6682.     if (bCanPickup)
  6683.     {
  6684.         //if (FrobTarget.IsA('WeaponLAW'))
  6685.         //  PlaySound(sound'WeaponPickup', SLOT_Interact, 0.5+FRand()*0.25, , 256, 0.95+FRand()*0.1);
  6686.         DoFrob(Self, inHand);
  6687.         if ( FrobTarget.IsA('DeusExWeapon') && bLeftClicked) //CyberP: for left click interaction
  6688.         {
  6689.         PutInHand(FoundItem);
  6690.         //bLeftClicked = False;
  6691.         }
  6692.         // This is bad. We need to reset the number so restocking works
  6693.         if ( Level.NetMode != NM_Standalone )
  6694.         {
  6695.             if ( FrobTarget.IsA('DeusExWeapon') && (DeusExWeapon(FrobTarget).PickupAmmoCount == 0) )
  6696.             {
  6697.                 DeusExWeapon(FrobTarget).PickupAmmoCount = DeusExWeapon(FrobTarget).Default.mpPickupAmmoCount * 3;
  6698.             }
  6699.         }
  6700.     }
  6701.  
  6702.     return bCanPickup;
  6703. }
  6704.  
  6705. // ----------------------------------------------------------------------
  6706. // CreateNanoKeyInfo()
  6707. // ----------------------------------------------------------------------
  6708.  
  6709. function NanoKeyInfo CreateNanoKeyInfo()
  6710. {
  6711.     local NanoKeyInfo newKey;
  6712.  
  6713.     newKey = new(Self) Class'NanoKeyInfo';
  6714.  
  6715.     return newKey;
  6716. }
  6717.  
  6718. // ----------------------------------------------------------------------
  6719. // PickupNanoKey()
  6720. //
  6721. // Picks up a NanoKey
  6722. //
  6723. // 1. Add KeyID to list of keys
  6724. // 2. Destroy NanoKey (since the user can't have it in his/her inventory)
  6725. // ----------------------------------------------------------------------
  6726.  
  6727. function PickupNanoKey(NanoKey newKey)
  6728. {
  6729.     KeyRing.GiveKey(newKey.KeyID, newKey.Description);
  6730.     //DEUS_EX AMSD In multiplayer, propagate the key to the client if the server
  6731.     if ((Role == ROLE_Authority) && (Level.NetMode != NM_Standalone))
  6732.     {
  6733.       KeyRing.GiveClientKey(newKey.KeyID, newKey.Description);
  6734.     }
  6735.     ClientMessage(Sprintf(AddedNanoKey, newKey.Description));
  6736. }
  6737.  
  6738. // ----------------------------------------------------------------------
  6739. // RemoveNanoKey()
  6740. // ----------------------------------------------------------------------
  6741.  
  6742. exec function RemoveNanoKey(Name KeyToRemove)
  6743. {
  6744.     if (!bCheatsEnabled)
  6745.         return;
  6746.  
  6747.     KeyRing.RemoveKey(KeyToRemove);
  6748.     if ((Role == ROLE_Authority) && (Level.NetMode != NM_Standalone))
  6749.     {
  6750.       KeyRing.RemoveClientKey(KeyToRemove);
  6751.     }
  6752. }
  6753.  
  6754. // ----------------------------------------------------------------------
  6755. // GiveNanoKey()
  6756. // ----------------------------------------------------------------------
  6757.  
  6758. exec function GiveNanoKey(Name newKeyID, String newDescription)
  6759. {
  6760.     if (!bCheatsEnabled)
  6761.         return;
  6762.  
  6763.     KeyRing.GiveKey(newKeyID, newDescription);
  6764.     //DEUS_EX AMSD In multiplayer, propagate the key to the client if the server
  6765.     if ((Role == ROLE_Authority) && (Level.NetMode != NM_Standalone))
  6766.     {
  6767.       KeyRing.GiveClientKey(newKeyID, newDescription);
  6768.     }
  6769.  
  6770. }
  6771.  
  6772. // ----------------------------------------------------------------------
  6773. // DoFrob()
  6774. //
  6775. // Frob the target
  6776. // ----------------------------------------------------------------------
  6777.  
  6778. function DoFrob(Actor Frobber, Inventory frobWith)
  6779. {
  6780.     local DeusExRootWindow root;
  6781.     local Ammo ammo;
  6782.     local Inventory item;
  6783.     local Actor A;
  6784.  
  6785.     // if the object destroyed itself, get out   //CyberP: copy-pasted this from below
  6786.     if (FrobTarget == None)
  6787.         return;
  6788.  
  6789.     // make sure nothing is based on us if we're an inventory
  6790.     if (FrobTarget.IsA('Inventory'))
  6791.         foreach FrobTarget.BasedActors(class'Actor', A)
  6792.             A.SetBase(None);
  6793.  
  6794. //   log("MYCHK::DXPlayer::DoFrob:Frobber:"@Frobber@": frobWith:"@frobWith@": FrobTarget:"@FrobTarget);
  6795.     FrobTarget.Frob(Frobber, frobWith);
  6796.  
  6797.     // if the object destroyed itself, get out
  6798.     if (FrobTarget == None)
  6799.         return;
  6800.  
  6801.     // if the inventory item aborted it's own pickup, get out
  6802.     if (FrobTarget.IsA('Inventory') && (FrobTarget.Owner != Self))
  6803.         return;
  6804.  
  6805.     // alert NPCs that I'm messing with stuff
  6806.     if (FrobTarget.bOwned)
  6807.         AISendEvent('Futz', EAITYPE_Visual);
  6808.  
  6809.     // play an animation
  6810.     PlayPickupAnim(FrobTarget.Location);
  6811.  
  6812.     // set the base so the inventory follows us around correctly
  6813.     if (FrobTarget.IsA('Inventory'))
  6814.         FrobTarget.SetBase(Frobber);
  6815. }
  6816.  
  6817. // ----------------------------------------------------------------------
  6818. // PutInHand()
  6819. //
  6820. // put the object in the player's hand and draw it in front of the player
  6821. // ----------------------------------------------------------------------
  6822.  
  6823. exec function PutInHand(optional Inventory inv)
  6824. {
  6825.     if (RestrictInput())
  6826.         return;
  6827.  
  6828.     if (bGEPprojectileInflight) return;
  6829.     // can't put anything in hand if you're using a spy drone
  6830.     if ((inHand == None) && bSpyDroneActive)
  6831.         return;
  6832.  
  6833.     // can't do anything if you're carrying a corpse
  6834.     if ((inHand != None) && inHand.IsA('POVCorpse'))
  6835.         return;
  6836.  
  6837.     if (inv != None)
  6838.     {
  6839.         // can't put ammo in hand
  6840.         if (inv.IsA('Ammo'))
  6841.             return;
  6842.  
  6843.         // Can't put an active charged item in hand  //cyberP: overruled for armor system
  6844.         //if ((inv.IsA('ChargedPickup')) && (ChargedPickup(inv).IsActive()))
  6845.         //  return;
  6846.     }
  6847.  
  6848.     if (CarriedDecoration != None)
  6849.         DropDecoration();
  6850.     bLeftClicked = False; //CyberP: fail safe
  6851.     SetInHandPending(inv);
  6852. }
  6853.  
  6854. // ----------------------------------------------------------------------
  6855. // UpdateBeltText()
  6856. // ----------------------------------------------------------------------
  6857.  
  6858. function UpdateBeltText(Inventory item)
  6859. {
  6860.     local DeusExRootWindow root;
  6861.  
  6862.     root = DeusExRootWindow(rootWindow);
  6863.  
  6864.     // Update object belt text
  6865.     if ((item.bInObjectBelt) && (root != None))
  6866.         root.hud.belt.UpdateObjectText(item.beltPos);
  6867. }
  6868.  
  6869. // ----------------------------------------------------------------------
  6870. // UpdateAmmoBeltText()
  6871. //
  6872. // Loops through all the weapons in the player's inventory and updates
  6873. // the ammo for any that matches the ammo type passed in.
  6874. // ----------------------------------------------------------------------
  6875.  
  6876. function UpdateAmmoBeltText(Ammo ammo)
  6877. {
  6878.     local Inventory inv;
  6879.  
  6880.     inv = Inventory;
  6881.     while(inv != None)
  6882.     {
  6883.         if ((inv.IsA('DeusExWeapon')) && (DeusExWeapon(inv).AmmoType == ammo))
  6884.             UpdateBeltText(inv);
  6885.  
  6886.         inv = inv.Inventory;
  6887.     }
  6888. }
  6889.  
  6890. // ----------------------------------------------------------------------
  6891. // SetInHand()
  6892. // ----------------------------------------------------------------------
  6893.  
  6894. function SetInHand(Inventory newInHand)
  6895. {
  6896.     local DeusExRootWindow root;
  6897.  
  6898.     inHand = newInHand;
  6899.  
  6900.     // Notify the hud
  6901.     root = DeusExRootWindow(rootWindow);
  6902.     if (root != None)
  6903.         root.hud.belt.UpdateInHand();
  6904. }
  6905.  
  6906. // ----------------------------------------------------------------------
  6907. // SetInHandPending()
  6908. // ----------------------------------------------------------------------
  6909.  
  6910. function SetInHandPending(Inventory newInHandPending)
  6911. {
  6912.     local DeusExRootWindow root;
  6913.  
  6914.     if ( newInHandPending == None )
  6915.         ClientInHandPending = None;
  6916.  
  6917.     inHandPending = newInHandPending;
  6918.  
  6919.     root = DeusExRootWindow(rootWindow);
  6920.     if (root != None)
  6921.         root.hud.belt.UpdateInHand();
  6922. }
  6923.  
  6924. // ----------------------------------------------------------------------
  6925. // UpdateInHand()
  6926. //
  6927. // Called every frame
  6928. // Checks the state of inHandPending and deals with animation and crap
  6929. // 1. Check for pending item
  6930. // 2. Play down anim (and deactivate) for inHand and wait for it to finish
  6931. // 3. Assign inHandPending to inHand (and SelectedItem)
  6932. // 4. Play up anim for inHand
  6933. // ----------------------------------------------------------------------
  6934.  
  6935. function UpdateInHand()
  6936. {
  6937.     local bool bSwitch;
  6938.     local rotator rot;
  6939.  
  6940.     //sync up clientinhandpending.
  6941.     if (inHandPending != inHand)
  6942.         ClientInHandPending = inHandPending;
  6943.  
  6944.     //DEUS_EX AMSD  Don't let clients do this.
  6945.     if (Role < ROLE_Authority)
  6946.       return;
  6947.  
  6948.     if (inHand != inHandPending)
  6949.     {
  6950.         bInHandTransition = True;
  6951.         bSwitch = False;
  6952.         if (inHand != None)
  6953.         {
  6954.             // turn it off if it is on
  6955.             if (inHand.bActive && !inHand.IsA('ChargedPickup')) //CyberP: armor system
  6956.                 inHand.Activate();
  6957.  
  6958.             if (inHand.IsA('SkilledTool'))
  6959.             {
  6960.                 if (inHand.IsInState('Idle'))
  6961.             {
  6962.                     SkilledTool(inHand).PutDown();
  6963.             }
  6964.                 else if (inHand.IsInState('Idle2'))
  6965.             {
  6966.                     bSwitch = True;
  6967.             }
  6968.             }
  6969.             else if (inHand.IsA('DeusExWeapon'))
  6970.             {
  6971.                 if (inHand.IsInState('Idle') || inHand.IsInState('Reload'))
  6972.                     DeusExWeapon(inHand).PutDown();
  6973.                 else if (inHand.IsInState('DownWeapon') && (Weapon == None))
  6974.                     bSwitch = True;
  6975.             }
  6976.             else
  6977.             {
  6978.                 bSwitch = True;
  6979.             }
  6980.         }
  6981.         else
  6982.         {
  6983.             bSwitch = True;
  6984.         }
  6985.  
  6986.         // OK to actually switch?
  6987.         if (bSwitch)
  6988.         {
  6989.             SetInHand(inHandPending);
  6990.             SelectedItem = inHandPending;
  6991.  
  6992.             if (inHand != None)
  6993.             {
  6994.                 if (inHand.IsA('SkilledTool'))
  6995.                     SkilledTool(inHand).BringUp();
  6996.                 else if (inHand.IsA('DeusExWeapon'))
  6997.                     SwitchWeapon(DeusExWeapon(inHand).InventoryGroup);
  6998.             }
  6999.         }
  7000.     }
  7001.     else
  7002.     {
  7003.         bInHandTransition = False;
  7004.  
  7005.         // Added this code because it's now possible to reselect an in-hand
  7006.         // item while we're putting it down, so we need to bring it back up...
  7007.  
  7008.         if (inHand != None)
  7009.         {
  7010.             // if we put the item away, bring it back up
  7011.             if (inHand.IsA('SkilledTool'))
  7012.             {
  7013.                 if (inHand.IsInState('Idle2'))
  7014.                     SkilledTool(inHand).BringUp();
  7015.             }
  7016.             else if (inHand.IsA('DeusExWeapon'))
  7017.             {
  7018.                 if (inHand.IsInState('DownWeapon') && (Weapon == None))
  7019.                     SwitchWeapon(DeusExWeapon(inHand).InventoryGroup);
  7020.             }
  7021.         }
  7022.  
  7023.     }
  7024.  
  7025.     UpdateCarcassEvent();
  7026. }
  7027.  
  7028. // ----------------------------------------------------------------------
  7029. // UpdateCarcassEvent()
  7030. //
  7031. // Small hack for sending carcass events
  7032. // ----------------------------------------------------------------------
  7033.  
  7034. function UpdateCarcassEvent()
  7035. {
  7036.     if ((inHand != None) && (inHand.IsA('POVCorpse')))
  7037.     {
  7038.         AIStartEvent('WeaponDrawn', EAITYPE_Visual);//AIStartEvent('Carcass', EAITYPE_Visual);
  7039.     }
  7040.     else
  7041.     {
  7042.         AIEndEvent('WeaponDrawn', EAITYPE_Visual);
  7043.         AIEndEvent('Carcass', EAITYPE_Visual);
  7044.     }
  7045. }
  7046.  
  7047. // ----------------------------------------------------------------------
  7048. // IsEmptyItemSlot()
  7049. //
  7050. // Returns True if the item will fit in this slot
  7051. // ----------------------------------------------------------------------
  7052.  
  7053. function Bool IsEmptyItemSlot( Inventory anItem, int col, int row )
  7054. {
  7055.        local int slotsCol;
  7056.        local int slotsRow;
  7057.        local Bool bEmpty;
  7058.        local Inventory inv;
  7059.        local DeusExRootWindow root;
  7060.        local PersonaScreenInventory winInv;
  7061.  
  7062.        if ( anItem == None )
  7063.                return False;
  7064.  
  7065.   //=== If cheats are off, then don't let us do the "overlap" trick
  7066.   root = DeusExRootWindow(rootWindow);
  7067.   winInv = PersonaScreenInventory(root.GetTopWindow());
  7068.   if(winInv == None || !winInv.bDragging)
  7069.   {
  7070.        inv = Inventory;
  7071.        while(inv != None)
  7072.        {
  7073.                SetInvSlots(inv, 1);
  7074.                inv = inv.Inventory;
  7075.        }
  7076.   }
  7077.  
  7078.        // First make sure the item can fit horizontally
  7079.        // and vertically
  7080.        if (( col + anItem.invSlotsX > maxInvCols ) ||
  7081.                ( row + anItem.invSlotsY > maxInvRows ))
  7082.                        return False;
  7083.  
  7084.   if ((Level.NetMode != NM_Standalone) && (bBeltIsMPInventory))
  7085.      return True;
  7086.  
  7087.        // Now check this and the needed surrounding slots
  7088.        // to see if all the slots are empty
  7089.  
  7090.        bEmpty = True;
  7091.        for( slotsRow=0; slotsRow < anItem.invSlotsY; slotsRow++ )
  7092.        {
  7093.                for ( slotsCol=0; slotsCol < anItem.invSlotsX; slotsCol++ )
  7094.                {
  7095.                        if ( invSlots[((slotsRow + row) * maxInvCols) + (slotsCol + col)] == 1 )
  7096.                        {
  7097.                                bEmpty = False;
  7098.                                break;
  7099.                        }
  7100.                }
  7101.  
  7102.                if ( !bEmpty )
  7103.                        break;
  7104.        }
  7105.  
  7106.        return bEmpty;
  7107. }
  7108.  
  7109. // ----------------------------------------------------------------------
  7110. // IsEmptyItemSlotXY()
  7111. //
  7112. // Returns True if the item will fit in this slot
  7113. // ----------------------------------------------------------------------
  7114.  
  7115. function Bool IsEmptyItemSlotXY( int invSlotsX, int invSlotsY, int col, int row )
  7116. {
  7117.     local int slotsCol;
  7118.     local int slotsRow;
  7119.     local Bool bEmpty;
  7120.  
  7121.     // First make sure the item can fit horizontally
  7122.     // and vertically
  7123.     if (( col + invSlotsX > maxInvCols ) ||
  7124.         ( row + invSlotsY > maxInvRows ))
  7125.             return False;
  7126.  
  7127.     if ((Level.NetMode != NM_Standalone) && (bBeltIsMPInventory))
  7128.       return True;
  7129.  
  7130.     // Now check this and the needed surrounding slots
  7131.     // to see if all the slots are empty
  7132.  
  7133.     bEmpty = True;
  7134.     for( slotsRow=0; slotsRow < invSlotsY; slotsRow++ )
  7135.     {
  7136.         for ( slotsCol=0; slotsCol < invSlotsX; slotsCol++ )
  7137.         {
  7138.             if ( invSlots[((slotsRow + row) * maxInvCols) + (slotsCol + col)] == 1 )
  7139.             {
  7140.                 bEmpty = False;
  7141.                 break;
  7142.             }
  7143.         }
  7144.  
  7145.         if ( !bEmpty )
  7146.             break;
  7147.     }
  7148.  
  7149.     return bEmpty;
  7150. }
  7151.  
  7152. // ----------------------------------------------------------------------
  7153. // SetInvSlots()
  7154. // ----------------------------------------------------------------------
  7155.  
  7156. function SetInvSlots( Inventory anItem, int newValue )
  7157. {
  7158.     local int slotsCol;
  7159.     local int slotsRow;
  7160.  
  7161.     if ( anItem == None )
  7162.         return;
  7163.  
  7164.     // Make sure this item is located in a valid position
  7165.     if (( anItem.invPosX != -1 ) && ( anItem.invPosY != -1 ))
  7166.     {
  7167.         // fill inventory slots
  7168.         for( slotsRow=0; slotsRow < anItem.invSlotsY; slotsRow++ )
  7169.             for ( slotsCol=0; slotsCol < anItem.invSlotsX; slotsCol++ )
  7170.                 invSlots[((slotsRow + anItem.invPosY) * maxInvCols) + (slotsCol + anItem.invPosX)] = newValue;
  7171.     }
  7172. }
  7173.  
  7174. // ----------------------------------------------------------------------
  7175. // PlaceItemInSlot()
  7176. // ----------------------------------------------------------------------
  7177.  
  7178. function PlaceItemInSlot( Inventory anItem, int col, int row )
  7179. {
  7180.     // Save in the original Inventory item also
  7181.     anItem.invPosX = col;
  7182.     anItem.invPosY = row;
  7183.  
  7184.     SetInvSlots(anItem, 1);
  7185. }
  7186.  
  7187. // ----------------------------------------------------------------------
  7188. // RemoveItemFromSlot()
  7189. //
  7190. // Removes an inventory item from the inventory grid
  7191. // ----------------------------------------------------------------------
  7192.  
  7193. function RemoveItemFromSlot(Inventory anItem)
  7194. {
  7195.     if (anItem != None)
  7196.     {
  7197.         SetInvSlots(anItem, 0);
  7198.         anItem.invPosX = -1;
  7199.         anItem.invPosY = -1;
  7200.     }
  7201. }
  7202.  
  7203. // ----------------------------------------------------------------------
  7204. // ClearInventorySlots()
  7205. //
  7206. // Not for the foolhardy
  7207. // ----------------------------------------------------------------------
  7208.  
  7209. function ClearInventorySlots()
  7210. {
  7211.     local int slotIndex;
  7212.  
  7213.     for(slotIndex=0; slotIndex<arrayCount(invSlots); slotIndex++)
  7214.         invSlots[slotIndex] = 0;
  7215. }
  7216.  
  7217. // ----------------------------------------------------------------------
  7218. // FindInventorySlot()
  7219. //
  7220. // Searches through the inventory slot grid and attempts to find a
  7221. // valid location for the item passed in.  Returns True if the item
  7222. // is placed, otherwise returns False.
  7223. // ----------------------------------------------------------------------
  7224.  
  7225. function Bool FindInventorySlot(Inventory anItem, optional Bool bSearchOnly)
  7226. {
  7227.     local bool bPositionFound;
  7228.     local int row;
  7229.     local int col;
  7230.     local int newSlotX;
  7231.     local int newSlotY;
  7232.     local int beltpos;
  7233.     local ammo foundAmmo;
  7234.  
  7235.     if (anItem == None)
  7236.         return False;
  7237.  
  7238.     // Special checks for objects that do not require phsyical inventory
  7239.     // in order to be picked up:
  7240.     //
  7241.     // - NanoKeys
  7242.     // - DataVaultImages
  7243.     // - Credits
  7244.     // - Ammo
  7245.  
  7246.     if ((anItem.IsA('DataVaultImage')) || (anItem.IsA('NanoKey')) || (anItem.IsA('Credits')) || (anItem.IsA('Ammo')))
  7247.         return True;
  7248.  
  7249.     bPositionFound = False;
  7250.     // DEUS_EX AMSD In multiplayer, due to propagation delays, the inventory refreshers in the
  7251.     // personascreeninventory can keep bouncing items back and forth.  So just return true and
  7252.     // place the item where it already was.
  7253.     if ((anItem.invPosX != -1) && (anItem.invPosY != -1) && (Level.NetMode != NM_Standalone) && (!bSearchOnly))
  7254.     {
  7255.       SetInvSlots(anItem,1);
  7256.       log("Trying to place item "$anItem$" when already placed at "$anItem.invPosX$", "$anItem.invPosY$".");
  7257.       return True;
  7258.     }
  7259.  
  7260.     // Loop through all slots, looking for a fit
  7261.     for (row=0; row<maxInvRows; row++)
  7262.     {
  7263.         if (row + anItem.invSlotsY > maxInvRows)
  7264.             break;
  7265.  
  7266.         // Make sure the item can fit vertically
  7267.         for(col=0; col<maxInvCols; col++)
  7268.         {
  7269.             if (IsEmptyItemSlot(anItem, col, row ))
  7270.             {
  7271.                 bPositionFound = True;
  7272.                 break;
  7273.             }
  7274.         }
  7275.  
  7276.         if (bPositionFound)
  7277.             break;
  7278.     }
  7279.  
  7280.     if ((Level.NetMode != NM_Standalone) && (bBeltIsMPInventory))
  7281.     {
  7282.       bPositionFound = False;
  7283.       beltpos = 0;
  7284.       if (DeusExRootWindow(rootWindow) != None)
  7285.       {
  7286.          for (beltpos = 0; beltpos < ArrayCount(DeusExRootWindow(rootWindow).hud.belt.objects); beltpos++)
  7287.          {
  7288.             if ( (DeusExRootWindow(rootWindow).hud.belt.objects[beltpos].item == None) && (anItem.TestMPBeltSpot(beltpos)) )
  7289.             {
  7290.                bPositionFound = True;
  7291.             }
  7292.          }
  7293.       }
  7294.       else
  7295.       {
  7296.          log("no belt to check");
  7297.       }
  7298.     }
  7299.  
  7300.     if ((bPositionFound) && (!bSearchOnly))
  7301.     {
  7302.         PlaceItemInSlot(anItem, col, row);
  7303.         if (bLeftClicked)
  7304.         {
  7305.         PutInHand(anItem); //CyberP: left click interaction
  7306.         bLeftClicked = False;
  7307.         }
  7308.     }
  7309.  
  7310.     return bPositionFound;
  7311. }
  7312.  
  7313. // ----------------------------------------------------------------------
  7314. // FindInventorySlotXY()
  7315. //
  7316. // Searches for an available slot given the number of horizontal and
  7317. // vertical slots this item takes up.
  7318. // ----------------------------------------------------------------------
  7319.  
  7320. function Bool FindInventorySlotXY(int invSlotsX, int invSlotsY, out int newSlotX, out int newSlotY)
  7321. {
  7322.     local bool bPositionFound;
  7323.     local int row;
  7324.     local int col;
  7325.  
  7326.     bPositionFound = False;
  7327.  
  7328.     // Loop through all slots, looking for a fit
  7329.     for (row=0; row<maxInvRows; row++)
  7330.     {
  7331.         if (row + invSlotsY > maxInvRows)
  7332.             break;
  7333.  
  7334.         // Make sure the item can fit vertically
  7335.         for(col=0; col<maxInvCols; col++)
  7336.         {
  7337.             if (IsEmptyItemSlotXY(invSlotsX, invSlotsY, col, row))
  7338.             {
  7339.                 newSlotX = col;
  7340.                 newSlotY = row;
  7341.  
  7342.                 bPositionFound = True;
  7343.                 break;
  7344.             }
  7345.         }
  7346.  
  7347.         if (bPositionFound)
  7348.             break;
  7349.     }
  7350.  
  7351.     return bPositionFound;
  7352. }
  7353.  
  7354. // ----------------------------------------------------------------------
  7355. // DumpInventoryGrid()
  7356. //
  7357. // Dumps the inventory grid to the log file.  Useful for debugging only.
  7358. // ----------------------------------------------------------------------
  7359.  
  7360. exec function DumpInventoryGrid()
  7361. {
  7362.     local int slotsCol;
  7363.     local int slotsRow;
  7364.     local String gridRow;
  7365.  
  7366.     log("DumpInventoryGrid()");
  7367.     log("=============================================================");
  7368.  
  7369.     log("        1 2 3 4 5");
  7370.     log("-----------------");
  7371.  
  7372.  
  7373.     for( slotsRow=0; slotsRow < maxInvRows; slotsRow++ )
  7374.     {
  7375.         gridRow = "Row #" $ slotsRow $ ": ";
  7376.  
  7377.         for ( slotsCol=0; slotsCol < maxInvCols; slotsCol++ )
  7378.         {
  7379.             if ( invSlots[(slotsRow * maxInvCols) + slotsCol] == 1)
  7380.                 gridRow = gridRow $ "X ";
  7381.             else
  7382.                 gridRow = gridRow $ "  ";
  7383.         }
  7384.  
  7385.         log(gridRow);
  7386.     }
  7387.     log("=============================================================");
  7388. }
  7389.  
  7390. // ----------------------------------------------------------------------
  7391. // Belt functions following are just callbacks to handle multiplayer
  7392. // belt updating.  First arg is true if it's the invbelt, false if it's
  7393. // the hudbelt.
  7394. // ----------------------------------------------------------------------
  7395.  
  7396. function ClearPosition(int pos)
  7397. {
  7398.     if (DeusExRootWindow(rootWindow) != None)
  7399.       DeusExRootWindow(rootWindow).hud.belt.ClearPosition(pos);
  7400. }
  7401.  
  7402. function ClearBelt()
  7403. {
  7404.     if (DeusExRootWindow(rootWindow) != None)
  7405.       DeusExRootWindow(rootWindow).hud.belt.ClearBelt();
  7406. }
  7407.  
  7408. function RemoveObjectFromBelt(Inventory item)
  7409. {
  7410.     if (DeusExRootWindow(rootWindow) != None)
  7411.       DeusExRootWindow(rootWindow).hud.belt.RemoveObjectFromBelt(item);
  7412. }
  7413.  
  7414. function AddObjectToBelt(Inventory item, int pos, bool bOverride)
  7415. {
  7416.     if (DeusExRootWindow(rootWindow) != None)
  7417.       DeusExRootWindow(rootWindow).hud.belt.AddObjectToBelt(item,pos,bOverride);
  7418. }
  7419.  
  7420.  
  7421. // ----------------------------------------------------------------------
  7422. // GetWeaponOrAmmo()
  7423. //
  7424. // Checks to see if the player already has this weapon or ammo
  7425. // in his inventory.  Returns the item if found, or None if not.
  7426. // ----------------------------------------------------------------------
  7427.  
  7428. function Inventory GetWeaponOrAmmo(Inventory queryItem)
  7429. {
  7430.     // First check to see if this item is actually a weapon or ammo
  7431.     if ((Weapon(queryItem) != None) || (Ammo(queryItem) != None))
  7432.         return FindInventoryType(queryItem.Class);
  7433.     else
  7434.         return None;
  7435. }
  7436.  
  7437. ///
  7438. /////////////////////////////////////////////////////////
  7439. //CheckBob() //CyberP: overrides code in playerPawn. Uncomment and modify headbob.
  7440. /////////////////////////////////////////////////////////
  7441. ///
  7442.  
  7443. /*function CheckBob(float DeltaTime, float Speed2D, vector Y)
  7444. {
  7445.     local float OldBobTime;
  7446.  
  7447.     if (!bModdedHeadBob)
  7448.     {
  7449.     Super.CheckBob(DeltaTime, Speed2D, Y);
  7450.     return;
  7451.     }
  7452.     OldBobTime = BobTime;
  7453.     if ( Speed2D < 10 )
  7454.         BobTime += 0.2 * DeltaTime;
  7455.     else
  7456.         BobTime += DeltaTime * (0.5 + 0.8 * Speed2D/GroundSpeed);   //0.5 + 0.8
  7457.     WalkBob = Y * 0.65 * Bob * Speed2D * sin(6 * BobTime);
  7458.     AppliedBob = AppliedBob * (1 - FMin(1, 2 * deltatime -70));
  7459.     if ( LandBob > 0.01 )
  7460.     {
  7461.         AppliedBob += FMin(1, 2 * deltatime) * LandBob;
  7462.         LandBob *= (1 - 8*Deltatime);
  7463.     }
  7464.     if ( Speed2D < 160 )
  7465.         WalkBob.Z = 0; // AppliedBob + Bob * 30 * sin(12 * BobTime);   // take out the "breathe" effect - DEUS_EX CNN
  7466.     else
  7467.         WalkBob.Z = AppliedBob/9 + Bob * (Speed2D/4) * cos(12 * BobTime);
  7468.  
  7469. } */
  7470.  
  7471.  
  7472. // ----------------------------------------------------------------------
  7473. // Summon()
  7474. //
  7475. // automatically prepend DeusEx. to the summoned class
  7476. // ----------------------------------------------------------------------
  7477.  
  7478. exec function Summon(string ClassName)
  7479. {
  7480.     if (!bCheatsEnabled)
  7481.         return;
  7482.  
  7483.     if(!bAdmin && (Level.Netmode != NM_Standalone))
  7484.         return;
  7485.     if(instr(ClassName, ".") == -1)
  7486.         ClassName = "DeusEx." $ ClassName;
  7487.     Super.Summon(ClassName);
  7488. }
  7489.  
  7490.  
  7491. // ----------------------------------------------------------------------
  7492. // SpawnMass()
  7493. //
  7494. // Spawns a bunch of actors around the player
  7495. // ----------------------------------------------------------------------
  7496.  
  7497. exec function SpawnMass(Name ClassName, optional int TotalCount)
  7498. {
  7499.     local actor        spawnee;
  7500.     local vector       spawnPos;
  7501.     local vector       center;
  7502.     local rotator      direction;
  7503.     local int          maxTries;
  7504.     local int          count;
  7505.     local int          numTries;
  7506.     local float        maxRange;
  7507.     local float        range;
  7508.     local float        angle;
  7509.     local class<Actor> spawn${1}< ${3} >
  7510.     local string        holdName;
  7511.  
  7512.     if (!bCheatsEnabled)
  7513.         return;
  7514.  
  7515.     if (!bAdmin && (Level.Netmode != NM_Standalone))
  7516.         return;
  7517.  
  7518.     if (instr(ClassName, ".") == -1)
  7519.         holdName = "DeusEx." $ ClassName;
  7520.     else
  7521.         holdName = "" $ ClassName;  // barf
  7522.  
  7523.     spawnClass = class<actor>(DynamicLoadObject(holdName, class'Class'));
  7524.     if (spawnClass == None)
  7525.     {
  7526.         ClientMessage("Illegal actor name "$GetItemName(String(ClassName)));
  7527.         return;
  7528.     }
  7529.  
  7530.     if (totalCount <= 0)
  7531.         totalCount = 10;
  7532.     if (totalCount > 250)
  7533.         totalCount = 250;
  7534.     maxTries = totalCount*2;
  7535.     count = 0;
  7536.     numTries = 0;
  7537.     maxRange = sqrt(totalCount/3.1416)*4*SpawnClass.Default.CollisionRadius;
  7538.  
  7539.     direction = ViewRotation;
  7540.     direction.pitch = 0;
  7541.     direction.roll  = 0;
  7542.     center = Location + Vector(direction)*(maxRange+SpawnClass.Default.CollisionRadius+CollisionRadius+20);
  7543.     while ((count < totalCount) && (numTries < maxTries))
  7544.     {
  7545.         angle = FRand()*3.14159265359*2;
  7546.         range = sqrt(FRand())*maxRange;
  7547.         spawnPos.X = sin(angle)*range;
  7548.         spawnPos.Y = cos(angle)*range;
  7549.         spawnPos.Z = 0;
  7550.         spawnee = spawn(SpawnClass,,,center+spawnPos, Rotation);
  7551.         if (spawnee != None)
  7552.             count++;
  7553.         numTries++;
  7554.     }
  7555.  
  7556.     ClientMessage(count$" actor(s) spawned");
  7557.  
  7558. }
  7559.  
  7560. // ----------------------------------------------------------------------
  7561. // ToggleWalk()
  7562. // ----------------------------------------------------------------------
  7563.  
  7564. exec function ToggleWalk()
  7565. {
  7566.     if (RestrictInput())
  7567.         return;
  7568.  
  7569.     bToggleWalk = !bToggleWalk;
  7570. }
  7571.  
  7572. // ----------------------------------------------------------------------
  7573. // ReloadWeapon()
  7574. //
  7575. // reloads the currently selected weapon
  7576. // ----------------------------------------------------------------------
  7577.  
  7578. exec function ReloadWeapon()
  7579. {
  7580.     local DeusExWeapon W;
  7581.  
  7582.     if (RestrictInput())
  7583.         return;
  7584. //GMDX: bumped to restricted
  7585. //  if (bGEPprojectileInflight) return;// cant reload during projectil flight
  7586.  
  7587.     W = DeusExWeapon(Weapon);  //CyberP: cannot reload when ammo in mag but none in reserves.
  7588.     if (W != None && (W.AmmoLeftInClip() != W.AmmoType.AmmoAmount || W.IsA('WeaponHideAGun') || W.GoverningSkill == class'DeusEx.SkillDemolition'))
  7589.         W.ReloadAmmo();
  7590. }
  7591.  
  7592. // ----------------------------------------------------------------------
  7593. // ToggleScope()
  7594. //
  7595. // turns the scope on or off for the current weapon
  7596. // ----------------------------------------------------------------------
  7597.  
  7598. exec function ToggleScope()
  7599. {
  7600.     local DeusExWeapon W;
  7601.  
  7602.     //log("ToggleScope "@IsInState('Interpolating')@" "@IsInState('Dying')@" "@IsInState('Paralyzed'));
  7603.     if (RestrictInput())
  7604.         return;
  7605.  
  7606.     W = DeusExWeapon(Weapon);
  7607.     if (W != None)
  7608.     {
  7609.       if (W.IsInState('Idle') || (W.bZoomed == False && W.AnimSequence == 'Shoot') || (W.bZoomed == True && RecoilTime==0)) //CyberP: far less restrictive
  7610.       {
  7611.         if (W.AnimSequence == 'Idle1' || W.AnimSequence == 'Idle2' || W.AnimSequence == 'Idle3')
  7612.         W.PlayAnim('Still');
  7613.         if (W.bZoomed==False&&W.IsA('WeaponRifle'))
  7614.         WeaponRifle(W).activateAn = True;
  7615.         else if (W.bZoomed==False&&W.IsA('WeaponPistol') && W.bHasScope)
  7616.         WeaponPistol(W).activateAn = True;
  7617.         else if (W.bZoomed==False&&W.IsA('WeaponMiniCrossbow') && W.bHasScope)
  7618.         WeaponMiniCrossbow(W).activateAn = True;
  7619.         else if (W.bZoomed==False&&W.IsA('WeaponStealthPistol') && W.bHasScope)
  7620.         WeaponStealthPistol(W).activateAn = True;
  7621.         else if (W.bZoomed==False&&W.IsA('WeaponAssaultGun') && W.bHasScope)
  7622.         WeaponAssaultGun(W).activateAn = True;
  7623.         else
  7624.         W.ScopeToggle();
  7625.         if (W.bZoomed&&W.IsA('WeaponGEPGun'))
  7626.         {
  7627.          bFromCrosshair=true;
  7628.         if (W.bLasing)
  7629.         W.LaserOff();
  7630.         }
  7631.       }
  7632.     }
  7633. }
  7634.  
  7635.  
  7636. //GMDX: tester for rocket tracking
  7637. //copied part from PutCarriedDecorationInHand()
  7638. //major cheat :P
  7639.  
  7640.  
  7641. //copied inpart from laseremitter
  7642. function bool CalcGEPLaserTrace(rotator newCamera,float newDistance,out vector HitLocOut)
  7643. {
  7644.     local vector StartTrace, EndTrace, HitLoc, HitNormal, Reflection;
  7645.     local actor target;
  7646.     local int i, texFlags;
  7647.     local name texName, texGroup;
  7648.     local bool HitObject;
  7649.  
  7650.     StartTrace = Location;
  7651.     StartTrace.Z += BaseEyeHeight;
  7652.     EndTrace = StartTrace + Vector(newCamera)*newDistance;
  7653.     HitObject = false;
  7654.  
  7655.     // trace the path of the reflected beam and draw points at each hit
  7656.  
  7657.     foreach TraceTexture(class'Actor', target, texName, texGroup, texFlags, HitLoc, HitNormal, EndTrace, StartTrace)
  7658.     {
  7659.         if ((target.DrawType == DT_None) || target.bHidden)
  7660.         {
  7661.             // do nothing - keep on tracing
  7662.         }
  7663.         else if ((target == Level) || target.IsA('Mover'))
  7664.         {
  7665.             HitObject=true;
  7666.             HitLocOut=HitLoc;
  7667.             break;
  7668.         }
  7669.         else
  7670.         {
  7671.             HitObject=true;
  7672.             HitLocOut=HitLoc;
  7673.             break;
  7674.         }
  7675.     }
  7676.     return HitObject;
  7677. }
  7678.  
  7679. function bool UpdateRocketTarget(rotator newCamera,float newDistance,optional bool bForcedUpdate)
  7680. {
  7681.     local vector lookDir, upDir,accVec;
  7682.     local Vector Start, X, Y, Z;
  7683.  
  7684.     if (RocketTarget==none) return false;
  7685.     if (bForcedUpdate||((InHand!=none)&&(InHand.IsA('WeaponGEPGun'))&&(WeaponGEPGun(InHand).bLasing)))//  ||(WeaponGEPGun(InHand).bZoomed))))
  7686.     {
  7687.         if (CalcGEPLaserTrace(newCamera,newDistance,lookDir))
  7688.             return RocketTarget.SetLocation(lookDir);
  7689.  
  7690.         upDir = Location;
  7691.         upDir.Z += BaseEyeHeight;
  7692.         lookDir = Vector(newCamera)*newDistance;
  7693.         return RocketTarget.SetLocation(upDir + lookDir);
  7694.     }
  7695.     return false;
  7696. }
  7697.  
  7698.  
  7699. function SetRocketWireControl()
  7700. {
  7701.     if (RocketTarget!=none)
  7702.     {
  7703.         RocketTarget.SetPhysics(PHYS_None);
  7704.         RocketTarget.SetBase(self);
  7705.  
  7706.         if (!UpdateRocketTarget(Rotation,RocketTargetMaxDistance,true))
  7707.             log("Error: Could not base initialize Rocket Target!");
  7708.     } else
  7709.        log("Error: Could not spawn Rocket Target!");
  7710. }
  7711.  
  7712. /*
  7713. function SetRocketPOVControl()
  7714. {
  7715.     if ((RocketTarget!=none)&&(InHand.IsA('WeaponGEPGun')))
  7716.     {
  7717.         RocketTarget.SetPhysics(PHYS_None);
  7718.  
  7719.         if (!bGEPprojectileInflight)
  7720.             RocketTarget.SetBase(InHand);
  7721. //          else
  7722. //              RocketTarget.SetBase(aGEPProjectile);
  7723.  
  7724.         if (UpdateRocketTarget(InHand.Rotation,0,true))
  7725.         {
  7726.             log("GEP Loc="@Location@" : Its="@RocketTarget.Location);
  7727.         } else
  7728.             log("Error: Could not base initialize Rocket Target to GEP!");
  7729.     } else
  7730.        log("Error: Could not spawn Rocket Target!");
  7731. }
  7732. */
  7733. /*
  7734. function SetRocketPOV(bool bSetToGEP)
  7735. {
  7736.     if (bSetToGEP)
  7737.     {
  7738.         SetRocketPOVControl();
  7739.     } else
  7740.     {
  7741.         SetRocketWireControl();
  7742.     }
  7743. }
  7744. */
  7745. function UpdateTrackingSteering(float deltaT)
  7746. {
  7747.     local float smx,smy;
  7748.     local float vlen;
  7749.  
  7750. //Handle mouse inputs
  7751.  
  7752.     smX=SmoothMouseX*0.01;
  7753.     smY=SmoothMouseY*0.01;
  7754.     if ((smX<0)&&(GEPSteeringX>smX))
  7755.         GEPsteeringX=smX;
  7756.         else
  7757.         if ((smX>0)&&(GEPSteeringX<smX))
  7758.             GEPsteeringX=smX;
  7759. //if (Abs(GEPsteeringX)<0.1) GEPsteeringX=0.0;
  7760.  
  7761.     if ((smY<0)&&(GEPSteeringY>smY))
  7762.         GEPsteeringY=smY;
  7763.         else
  7764.         if ((smY>0)&&(GEPSteeringY<smY))
  7765.             GEPsteeringY=smY;
  7766.  
  7767.     GEPsteeringX *=(0.7+(0.3-Fmax(0.3*deltaT*3.0,0.3)));
  7768.     GEPsteeringY *=(0.7+(0.3-Fmax(0.3*deltaT*3.0,0.3)));
  7769.  
  7770.     /*scaleGEP.X=GEPsteeringX;
  7771.     scaleGEP.Y=GEPsteeringY;
  7772.     vlen=Vsize(scaleGEP)*(0.8+(0.2-0.2*deltaT));
  7773.  
  7774.     GEPsteeringX = GEPsteeringX*3.0*deltaT; //drain to zero
  7775.     GEPsteeringY = GEPsteeringY*3.0*deltaT; //drain to zero
  7776.     */
  7777. //            if (Abs(GEPsteeringY)<0.1) GEPsteeringY=0.0;
  7778.  
  7779. }
  7780.  
  7781. //GMDX: end Rocket Target system
  7782.  
  7783.  
  7784. // check to see if the player can lift a certain decoration taking
  7785. // into account his muscle augs
  7786. function bool CanBeLifted(Decoration deco)
  7787. {
  7788.     local int augLevel, augMult;
  7789.     local float maxLift;
  7790. //gmdx modded so aug has effect
  7791.     maxLift = 50;
  7792.     if (AugmentationSystem != None)
  7793.     {
  7794.         augLevel = AugmentationSystem.GetClassLevel(class'AugMuscle');
  7795.         augMult = 1;
  7796.         if (augLevel >= 0)
  7797.             augMult = augLevel+3;
  7798.         maxLift *= augMult;
  7799.     }
  7800.  
  7801.     if (!deco.bPushable || (deco.Mass > maxLift) || (deco.StandingCount > 0))
  7802.     {
  7803.         if (deco.bPushable)
  7804.             ClientMessage(TooHeavyToLift);
  7805.         else
  7806.             ClientMessage(CannotLift);
  7807.  
  7808.         return False;
  7809.     }
  7810.  
  7811.     return True;
  7812. }
  7813.  
  7814. // ----------------------------------------------------------------------
  7815. // GrabDecoration()
  7816. //
  7817. // This overrides GrabDecoration() in Pawn.uc
  7818. // lets the strength augmentation affect how much the player can lift
  7819. // ----------------------------------------------------------------------
  7820.  
  7821. function GrabDecoration()
  7822. {
  7823.     // can't grab decorations while leaning
  7824.     if (IsLeaning())
  7825.         return;
  7826.  
  7827. //   log("GrabDecoration::"@FrobTarget@FrobTarget.Owner@FrobTarget.Base);
  7828.  
  7829.     if ((FrobTarget!=none)&&(FrobTarget.Base!=none)&&(FrobTarget.Base.IsA('GMDXProjectileWrap')))
  7830.     {
  7831.       FrobTarget.Base.Destroy();
  7832.       return;//GMDX stop catching of mythical deco that has no collide settings! will expand to allow catch maybe!
  7833.     }
  7834.     // can't grab decorations while holding something else
  7835.     if (inHand != None)
  7836.     {
  7837.         if (carriedDecoration != None || inHand.IsA('POVcorpse'))
  7838.         {ClientMessage(HandsFull); return;}
  7839.         else if (!bAutoHolster)
  7840.         {ClientMessage(HandsFull); return;}
  7841.         else if (bAutoHolster)
  7842.         {PutInHand(None);}
  7843.     }
  7844.  
  7845.     if (carriedDecoration == None)
  7846.         if ((FrobTarget != None) && FrobTarget.IsA('Decoration') && (Weapon == None || inHandPending == None)) //CyberP: added || inHandPending == None
  7847.             if (CanBeLifted(Decoration(FrobTarget)))
  7848.             {
  7849.                 CarriedDecoration = Decoration(FrobTarget);
  7850.                 PutCarriedDecorationInHand();
  7851.  
  7852.             }
  7853. }
  7854.  
  7855. // ----------------------------------------------------------------------
  7856. // PutCarriedDecorationInHand()
  7857. // ----------------------------------------------------------------------
  7858.  
  7859. function PutCarriedDecorationInHand()
  7860. {
  7861.     local vector lookDir, upDir;
  7862.     local float shakeTime, shakeVert, shakeRoll;
  7863.  
  7864.     if (CarriedDecoration != None)
  7865.     {
  7866.         lookDir = Vector(Rotation);
  7867.         lookDir.Z = 0;
  7868.         upDir = vect(0,0,0);
  7869.         if (CarriedDecoration.CollisionHeight < 8.000000)
  7870.              upDir.Z = CollisionHeight / 1.75;      //CyberP: a bit higher for small objects.
  7871.         else
  7872.              upDir.Z = CollisionHeight / 2.5;       // put it up near eye level  //CyberP: chest level. was 2
  7873.         CarriedDecoration.SetPhysics(PHYS_Falling);
  7874.  
  7875.         if ( CarriedDecoration.SetLocation(Location + upDir + (0.5 * CollisionRadius + CarriedDecoration.CollisionRadius) * lookDir) )
  7876.         {
  7877.             if (CarriedDecoration.Mass > 40)   //CyberP: pickup sounds
  7878.                 {
  7879.                     if (FRand() < 0.5)
  7880.                     PlaySound(Sound'objpickup3',SLOT_None);
  7881.                     else
  7882.                     PlaySound(Sound'genericlargeequip',SLOT_None);
  7883.                 }
  7884.                 else if (FRand() < 0.33)
  7885.                 PlaySound(Sound'genericlargeequip',SLOT_None);
  7886.                 else if (FRand() < 0.66)
  7887.                 PlaySound(Sound'genericsmallequip',SLOT_None);
  7888.                 else
  7889.                 PlaySound(Sound'genericsmallunequip',SLOT_None);
  7890.  
  7891.             CarriedDecoration.SetPhysics(PHYS_None);
  7892.             CarriedDecoration.SetBase(self);
  7893.             CarriedDecoration.SetCollision(False, False, False);
  7894.             CarriedDecoration.bCollideWorld = False;
  7895.  
  7896.             // make it translucent
  7897.             if (!bNoTranslucency || AugmentationSystem.GetAugLevelValue(class'AugCloak') != -1.0)
  7898.             {
  7899.             CarriedDecoration.Style = STY_Translucent;
  7900.             CarriedDecoration.ScaleGlow = 0.2; //GMDX was 1.0
  7901.             CarriedDecoration.bUnlit = True;
  7902.             }
  7903.  
  7904.             FrobTarget = None;
  7905.         }
  7906.         else
  7907.         {
  7908.             ClientMessage(NoRoomToLift);
  7909.             CarriedDecoration = None;
  7910.         }
  7911.     }
  7912. }
  7913.  
  7914. function ThrowDecoration(Decoration WrapDeco)
  7915. {
  7916.     local GMDXProjectileWrap PW;
  7917.     if (WrapDeco==none) return;
  7918.  
  7919.     //log("CARRIED DECO "@WrapDeco);
  7920.  
  7921. //   PW.default.Mesh=CarriedDecoration.Mesh;
  7922. //   PW.default.Mass=CarriedDecoration.Mass;
  7923. //            PW.default.CollisionHeight=CarriedDecoration.CollisionHeight;
  7924. //            PW.default.CollisionRadius=CarriedDecoration.CollisionRadius;
  7925. //   PW.default.ImpactSound=CarriedDecoration.PushSound;
  7926. //   PW.default.Buoyancy=CarriedDecoration.Buoyancy;
  7927.  
  7928.     PW=Spawn(class'GMDXProjectileWrap');
  7929.     if(PW!=none)
  7930.     {
  7931.       //log("CARRIED DECO, spawn prj");
  7932. //      if (WrapDeco.IsA('Carcass'))
  7933.          PW.InitWrapDecoration(WrapDeco,self);//,false);
  7934.          swimTimer -= 1;
  7935.          RecoilShaker(vect(3,0,1));
  7936.          if (swimTimer < 0)
  7937.         swimTimer = 0;
  7938. //         else
  7939. //           PW.InitWrapDecoration(WrapDeco,self);//,true);
  7940.     }
  7941. }
  7942. // ----------------------------------------------------------------------
  7943. // DropDecoration()
  7944. //
  7945. // This overrides DropDecoration() in Pawn.uc
  7946. // lets the player throw a decoration instead of just dropping it
  7947. // ----------------------------------------------------------------------
  7948.  
  7949. function DropDecoration()
  7950. {
  7951.     local Vector X, Y, Z, dropVect, origLoc, HitLocation, HitNormal, extent;
  7952.     local float velscale, size, mult;
  7953.     local bool bSuccess;
  7954.     local Actor hitActor;
  7955.  
  7956.     bSuccess = False;
  7957.  
  7958.     if (CarriedDecoration != None)
  7959.     {
  7960.         origLoc = CarriedDecoration.Location;
  7961.         GetAxes(Rotation, X, Y, Z);
  7962.  
  7963.         // if we are highlighting something, try to place the object on the target
  7964.         if ((FrobTarget != None) && !FrobTarget.IsA('Pawn') && !FrobTarget.IsA('DeusExWeapon') && !FrobTarget.IsA('Pickup') &&
  7965.            !FrobTarget.IsA('Decoration'))
  7966.         {
  7967.             CarriedDecoration.Velocity = vect(0,0,0);
  7968.  
  7969.             // try to drop the object about one foot above the target
  7970.             size = FrobTarget.CollisionRadius - CarriedDecoration.CollisionRadius * 2;
  7971.             dropVect.X = size/2 - FRand() * size;
  7972.             dropVect.Y = size/2 - FRand() * size;
  7973.             dropVect.Z = FrobTarget.CollisionHeight + CarriedDecoration.CollisionHeight + 16;
  7974.             dropVect += FrobTarget.Location;
  7975.         }
  7976.         else
  7977.         {
  7978.             // throw velocity is based on augmentation
  7979.             if (AugmentationSystem != None)
  7980.             {
  7981.                 mult = 1.3;//AugmentationSystem.GetAugLevelValue(class'AugMuscle'); //CyberP: we don't need this anymore
  7982.                 if (mult == -1.0)
  7983.                     mult = 1.0;
  7984.             }
  7985.  
  7986.             //if (IsLeaning())
  7987.             //  CarriedDecoration.Velocity = vect(0,0,0);
  7988.             //else
  7989.                 CarriedDecoration.Velocity = Vector(ViewRotation) * mult * 500 + vect(0,0,180) + 40 * VRand();
  7990.  
  7991.             // scale it based on the mass
  7992.             velscale = FClamp(CarriedDecoration.Mass / 20.0, 1.0, 40.0);
  7993.  
  7994.             CarriedDecoration.Velocity /= velscale;
  7995.             dropVect = Location + (CarriedDecoration.CollisionRadius + CollisionRadius + 2) * X; //was 4, now 2
  7996.             dropVect.Z += BaseEyeHeight;
  7997.             //if (FRand() < 0.3)
  7998.               // PlaySound(Sound'MaleLand',SLOT_None);
  7999.           if (CarriedDecoration.Mass <= 40 && CarriedDecoration.CollisionHeight < 23.000000 &&
  8000.              CarriedDecoration.CollisionRadius <= 22.500000)
  8001.             {
  8002.             CarriedDecoration.bFixedRotationDir = True;
  8003.             CarriedDecoration.RotationRate.Pitch = (32768 - Rand(65536)) * 1.5;
  8004.             if (FRand() < 0.2)
  8005.             CarriedDecoration.RotationRate.Yaw = (32768 - Rand(65536)) * 1.0;
  8006.             else if (FRand() < 0.7)
  8007.             {
  8008.             }
  8009.             else
  8010.             CarriedDecoration.RotationRate.Yaw -= (32768 - Rand(65536)) * 1.0;
  8011.             }
  8012.         }
  8013.  
  8014.         // is anything blocking the drop point? (like thin doors)
  8015.         if (FastTrace(dropVect))
  8016.         {
  8017.             CarriedDecoration.SetCollision(True, True, True);
  8018.             CarriedDecoration.bCollideWorld = True;
  8019.  
  8020.             // check to see if there's space there
  8021.             extent.X = CarriedDecoration.CollisionRadius;
  8022.             extent.Y = CarriedDecoration.CollisionRadius;
  8023.             extent.Z = 1;
  8024.             hitActor = Trace(HitLocation, HitNormal, dropVect, CarriedDecoration.Location, True, extent);
  8025.  
  8026.             if ((hitActor == None) && CarriedDecoration.SetLocation(dropVect))
  8027.                 bSuccess = True;
  8028.             else
  8029.             {
  8030.                 CarriedDecoration.SetCollision(False, False, False);
  8031.                 CarriedDecoration.bCollideWorld = False;
  8032.             }
  8033.         }
  8034.  
  8035.         // if we can drop it here, then drop it
  8036.         if (bSuccess)
  8037.         {
  8038.             CarriedDecoration.bWasCarried = True;
  8039.             CarriedDecoration.SetBase(None);
  8040.             CarriedDecoration.SetPhysics(PHYS_Falling);
  8041.             CarriedDecoration.Instigator = Self;
  8042.             AIEndEvent('WeaponDrawn', EAITYPE_Visual);
  8043.  
  8044.             // turn off translucency
  8045.             CarriedDecoration.Style = CarriedDecoration.Default.Style;
  8046.             CarriedDecoration.bUnlit = CarriedDecoration.Default.bUnlit;
  8047.             if (CarriedDecoration.IsA('DeusExDecoration'))
  8048.                 DeusExDecoration(CarriedDecoration).ResetScaleGlow();
  8049.  
  8050.          if (bThrowDecoration)
  8051.             ThrowDecoration(CarriedDecoration);
  8052.  
  8053.             CarriedDecoration = None;
  8054.         }
  8055.         else
  8056.         {
  8057.             // otherwise, don't drop it and display a message
  8058.             CarriedDecoration.SetLocation(origLoc);
  8059.             ClientMessage(CannotDropHere);
  8060.         }
  8061.     }
  8062.     bThrowDecoration=false;
  8063. }
  8064.  
  8065. // ----------------------------------------------------------------------
  8066. // DropItem()
  8067. //
  8068. // throws an item where you are currently looking
  8069. // or places it on your currently highlighted object
  8070. // if None is passed in, it drops what's inHand
  8071. // ----------------------------------------------------------------------
  8072.  
  8073. exec function bool DropItem(optional Inventory inv, optional bool bDrop)
  8074. {
  8075.     local Inventory item, previtem;
  8076.     local Inventory previousItemInHand;
  8077.     local Vector X, Y, Z, dropVect;
  8078.     local float size, mult;
  8079.     local DeusExCarcass carc;
  8080.     local class<DeusExCarcass> carc${1}< ${3} >
  8081.     local bool bDropped;
  8082.     local bool bRemovedFromSlots;
  8083.     local int  itemPosX, itemPosY, tex;
  8084.  
  8085.     bDropped = True;
  8086.  
  8087.     if (RestrictInput())
  8088.         return False;
  8089.  
  8090.     if (inv == None)
  8091.     {
  8092.         previousItemInHand = inHand;
  8093.         item = inHand;
  8094.     }
  8095.     else
  8096.     {
  8097.         item = inv;
  8098.     }
  8099.     if ((item!=none)&&(!item.IsA('POVcorpse'))) bThrowDecoration=false;
  8100.     if (item != None)
  8101.     {
  8102.         GetAxes(Rotation, X, Y, Z);
  8103.         dropVect = Location + (CollisionRadius + 2*item.CollisionRadius) * X;
  8104.         dropVect.Z += BaseEyeHeight;
  8105.  
  8106.         // check to see if we're blocked by terrain
  8107.         if (!FastTrace(dropVect))
  8108.         {
  8109.             ClientMessage(CannotDropHere);
  8110.             return False;
  8111.         }
  8112.  
  8113.         // don't drop it if it's in a strange state
  8114.         if (item.IsA('DeusExWeapon'))
  8115.         {
  8116.             if (!DeusExWeapon(item).IsInState('Idle') && !DeusExWeapon(item).IsInState('Idle2') &&
  8117.                 !DeusExWeapon(item).IsInState('DownWeapon') && !DeusExWeapon(item).IsInState('Reload'))
  8118.             {
  8119.                 return False;
  8120.             }
  8121.             else        // make sure the scope/laser are turned off
  8122.             {
  8123.                 DeusExWeapon(item).ScopeOff();
  8124.                 DeusExWeapon(item).LaserOff();
  8125.                 if (DeusExWeapon(item) == assignedWeapon)
  8126.                     assignedWeapon = None;
  8127.             }
  8128.         }
  8129.  
  8130.         // Don't allow active ChargedPickups to be dropped
  8131.         if ((item.IsA('ChargedPickup')) && (ChargedPickup(item).IsActive()))
  8132.         {
  8133.             return False;
  8134.         }
  8135.  
  8136.         // don't let us throw away the nanokeyring
  8137.         if (item.IsA('NanoKeyRing'))
  8138.         {
  8139.             return False;
  8140.         }
  8141.  
  8142.         // take it out of our hand
  8143.         if (item == inHand)
  8144.             PutInHand(None);
  8145.  
  8146.         // handle throwing pickups that stack
  8147.         if (item.IsA('DeusExPickup'))
  8148.         {
  8149.             // turn it off if it is on
  8150.             if (DeusExPickup(item).bActive)
  8151.                 DeusExPickup(item).Activate();
  8152.  
  8153.             tex = deusExPickUp(item).textureset; //our current tex
  8154.  
  8155.             DeusExPickup(item).NumCopies--;
  8156.  
  8157.             UpdateBeltText(item);
  8158.  
  8159.             if (DeusExPickup(item).NumCopies > 0)
  8160.             {
  8161.                 // put it back in our hand, but only if it was in our
  8162.                 // hand originally!!!
  8163.                 if (previousItemInHand == item)
  8164.                     PutInHand(previousItemInHand);
  8165.  
  8166.                 previtem = item;
  8167.  
  8168.                 item = Spawn(item.Class, Owner);
  8169.                 if(item != none)
  8170.                 {
  8171.                     if(deusExPickUp(item).bhasMultipleSkins)
  8172.                     {
  8173.                         deusExPickUp(item).textureSet = tex;
  8174.                         deusExPickUp(item).SetSkin();
  8175.                         deusExPickUp(previtem).UpdateCurrentSkin();
  8176.                     }
  8177.                 }
  8178.             }
  8179.             else
  8180.             {
  8181.                 if(deusExPickUp(item).bhasMultipleSkins)
  8182.                 {
  8183.                     deusExPickUp(item).textureSet = tex;
  8184.                     deusExPickUp(item).SetSkin();
  8185.                 }
  8186.  
  8187.                 // Keep track of this so we can undo it
  8188.                 // if necessary
  8189.                 bRemovedFromSlots = True;
  8190.                 itemPosX = item.invPosX;
  8191.                 itemPosY = item.invPosY;
  8192.  
  8193.                 // Remove it from the inventory slot grid
  8194.                 RemoveItemFromSlot(item);
  8195.  
  8196.                 // make sure we have one copy to throw!
  8197.                 DeusExPickup(item).NumCopies = 1;
  8198.             }
  8199.         }
  8200.         else
  8201.         {
  8202.             // Keep track of this so we can undo it
  8203.             // if necessary
  8204.             bRemovedFromSlots = True;
  8205.             itemPosX = item.invPosX;
  8206.             itemPosY = item.invPosY;
  8207.  
  8208.             // Remove it from the inventory slot grid
  8209.             RemoveItemFromSlot(item);
  8210.         }
  8211.  
  8212.         // if we are highlighting something, try to place the object on the target //CyberP: more lenience when dropping
  8213.         if ((FrobTarget != None) && !item.IsA('POVCorpse') && !FrobTarget.IsA('Pawn') && !FrobTarget.IsA('Pickup')
  8214.              && !FrobTarget.IsA('DeusExWeapon') && !FrobTarget.IsA('Decoration'))
  8215.         {
  8216.             item.Velocity = vect(0,0,0);
  8217.  
  8218.             // play the correct anim
  8219.             PlayPickupAnim(FrobTarget.Location);
  8220.  
  8221.             // try to drop the object about one foot above the target
  8222.             size = FrobTarget.CollisionRadius - item.CollisionRadius * 2;
  8223.             dropVect.X = size/2 - FRand() * size;
  8224.             dropVect.Y = size/2 - FRand() * size;
  8225.             dropVect.Z = FrobTarget.CollisionHeight + item.CollisionHeight + 16;
  8226.             if (FastTrace(dropVect))
  8227.             {
  8228.                 item.DropFrom(FrobTarget.Location + dropVect);
  8229.             }
  8230.             else
  8231.             {
  8232.                 ClientMessage(CannotDropHere);
  8233.                 bDropped = False;
  8234.             }
  8235.         }
  8236.         else
  8237.         {
  8238.             // throw velocity is based on augmentation
  8239.             if (AugmentationSystem != None)
  8240.             {
  8241.                 mult = AugmentationSystem.GetAugLevelValue(class'AugMuscle');
  8242.                 if (mult == -1.0)
  8243.                     mult = 0.7;
  8244.             }
  8245.  
  8246.             if (bDrop)
  8247.             {
  8248.                 item.Velocity = VRand() * 30;
  8249.  
  8250.                 // play the correct anim
  8251.                 PlayPickupAnim(item.Location);
  8252.             }
  8253.             else
  8254.             {
  8255.                 if (item.Mass > 20)
  8256.                    mult -= 0.15;
  8257.                 item.Velocity = Vector(ViewRotation) * (mult*1.5) * 600 + vect(0,0,150); //CyberP: z vect was 240
  8258.  
  8259.                 // play a throw anim
  8260.                 PlayAnim('Attack',,0.1);
  8261.             }
  8262.  
  8263.             GetAxes(ViewRotation, X, Y, Z);
  8264.             dropVect = Location + 0.8 * CollisionRadius * X;
  8265.             dropVect.Z += BaseEyeHeight;
  8266.  
  8267.             // if we are a corpse, spawn the actual carcass
  8268.             if (item.IsA('POVCorpse'))
  8269.             {
  8270.                 if (POVCorpse(item).carcClassString != "")
  8271.                 {
  8272.                     carcClass = class<DeusExCarcass>(DynamicLoadObject(POVCorpse(item).carcClassString, class'Class'));
  8273.                     if (carcClass != None)
  8274.                     {
  8275.                         carc = Spawn(carcClass);
  8276.                         if (carc != None)
  8277.                         {
  8278.                             carc.Mesh = carc.Mesh2;
  8279.                             carc.KillerAlliance = POVCorpse(item).KillerAlliance;
  8280.                             carc.KillerBindName = POVCorpse(item).KillerBindName;
  8281.                             carc.Alliance = POVCorpse(item).Alliance;
  8282.                             carc.bNotDead = POVCorpse(item).bNotDead;
  8283.                             carc.Tag = POVCorpse(item).CarcassTag;  //CyberP: tag
  8284.                             carc.bEmitCarcass = POVCorpse(item).bEmitCarcass;
  8285.                             carc.CumulativeDamage = POVCorpse(item).CumulativeDamage;
  8286.                             carc.MaxDamage = POVCorpse(item).MaxDamage;
  8287.                             carc.itemName = POVCorpse(item).CorpseItemName;
  8288.                             carc.CarcassName = POVCorpse(item).CarcassName;
  8289.                             carc.Velocity = item.Velocity * 0.5;
  8290.                             item.Velocity = vect(0,0,0);
  8291.                             carc.bHidden = False;
  8292.                             carc.bNotFirstFall = True;
  8293.                             carc.bEmitCarcass = true;  //CyberP: emitcarc
  8294.                             carc.SetPhysics(PHYS_Falling);
  8295.                             carc.SetScaleGlow();
  8296.                             Carc.UpdateHDTPSettings();
  8297.                             Carc.Inventory = PovCorpse(item).Inv; //GMDX
  8298.                             //if (FRand() < 0.3)
  8299.                             //PlaySound(Sound'DeusExSounds.Player.MaleLand', SLOT_None, 0.9, false, 800, 0.85);
  8300.  
  8301.                             if (carc.SetLocation(dropVect))
  8302.                             {
  8303.                                 // must circumvent PutInHand() since it won't allow
  8304.                                 // things in hand when you're carrying a corpse
  8305.                                 SetInHandPending(None);
  8306.                                 item.Destroy();
  8307.                                 item = None;
  8308.  
  8309.                                 if (bThrowDecoration)
  8310.                                 {
  8311.                                     bThrowDecoration=false;
  8312.                                     ThrowDecoration(carc);
  8313.                                     // play a throw anim
  8314.                               PlayAnim('Attack',,0.1);
  8315.                                 }
  8316.                             }
  8317.                             else
  8318.                                 carc.bHidden = True;
  8319.                         }
  8320.                     }
  8321.                 }
  8322.             }
  8323.             else
  8324.             {
  8325.                 if (FastTrace(dropVect))
  8326.                 {
  8327.                     item.DropFrom(dropVect);
  8328.                     item.bFixedRotationDir = True;
  8329.                     item.RotationRate.Pitch = (32768 - Rand(65536)) * 4.0 * (mult);
  8330.                     item.RotationRate.Yaw = (32768 - Rand(65536)) * 4.0 * (mult);
  8331.                 }
  8332.             }
  8333.         }
  8334.  
  8335.         // if we failed to drop it, put it back inHand
  8336.         if (item != None)
  8337.         {
  8338.             if (((inHand == None) || (inHandPending == None)) && (item.Physics != PHYS_Falling))
  8339.             {
  8340.                 PutInHand(item);
  8341.                 ClientMessage(CannotDropHere);
  8342.                 bDropped = False;
  8343.             }
  8344.             else
  8345.             {
  8346.                 item.Instigator = Self;
  8347.             }
  8348.         }
  8349.     }
  8350.     else if (CarriedDecoration != None)
  8351.     {
  8352.       bThrowDecoration=false;
  8353.       DropDecoration();
  8354.  
  8355.         // play a throw anim
  8356.         PlayAnim('Attack',,0.1);
  8357.     }
  8358.  
  8359.     // If the drop failed and we removed the item from the inventory
  8360.     // grid, then we need to stick it back where it came from so
  8361.     // the inventory doesn't get fucked up.
  8362.  
  8363.     if ((bRemovedFromSlots) && (item != None) && (!bDropped))
  8364.     {
  8365.         //DEUS_EX AMSD Use the function call for this, helps multiplayer
  8366.         PlaceItemInSlot(item, itemPosX, itemPosY);
  8367.     }
  8368.  
  8369.     return bDropped;
  8370. }
  8371.  
  8372. // ----------------------------------------------------------------------
  8373. // RemoveItemDuringConversation()
  8374. // ----------------------------------------------------------------------
  8375.  
  8376. function RemoveItemDuringConversation(Inventory item)
  8377. {
  8378.     if (item != None)
  8379.     {
  8380.         // take it out of our hand
  8381.         if (item == inHand)
  8382.             PutInHand(None);
  8383.  
  8384.         // Make sure it's removed from the inventory grid
  8385.         RemoveItemFromSlot(item);
  8386.  
  8387.         // Make sure the item is deactivated!
  8388.         if (item.IsA('DeusExWeapon'))
  8389.         {
  8390.             DeusExWeapon(item).ScopeOff();
  8391.             DeusExWeapon(item).LaserOff();
  8392.         }
  8393.         else if (item.IsA('DeusExPickup'))
  8394.         {
  8395.             // turn it off if it is on
  8396.             if (DeusExPickup(item).bActive)
  8397.                 DeusExPickup(item).Activate();
  8398.         }
  8399.  
  8400.         if (conPlay != None)
  8401.             conPlay.SetInHand(None);
  8402.     }
  8403. }
  8404.  
  8405. // ----------------------------------------------------------------------
  8406. // WinStats()
  8407. // ----------------------------------------------------------------------
  8408.  
  8409. exec function WinStats(bool bStatsOn)
  8410. {
  8411.     if (rootWindow != None)
  8412.         rootWindow.ShowStats(bStatsOn);
  8413. }
  8414.  
  8415.  
  8416. // ----------------------------------------------------------------------
  8417. // ToggleWinStats()
  8418. // ----------------------------------------------------------------------
  8419.  
  8420. exec function ToggleWinStats()
  8421. {
  8422.     if (!bCheatsEnabled)
  8423.         return;
  8424.  
  8425.     if (rootWindow != None)
  8426.         rootWindow.ShowStats(!rootWindow.bShowStats);
  8427. }
  8428.  
  8429.  
  8430. // ----------------------------------------------------------------------
  8431. // WinFrames()
  8432. // ----------------------------------------------------------------------
  8433.  
  8434. exec function WinFrames(bool bFramesOn)
  8435. {
  8436.     if (!bCheatsEnabled)
  8437.         return;
  8438.  
  8439.     if (rootWindow != None)
  8440.         rootWindow.ShowFrames(bFramesOn);
  8441. }
  8442.  
  8443.  
  8444. // ----------------------------------------------------------------------
  8445. // ToggleWinFrames()
  8446. // ----------------------------------------------------------------------
  8447.  
  8448. exec function ToggleWinFrames()
  8449. {
  8450.     if (!bCheatsEnabled)
  8451.         return;
  8452.  
  8453.     if (rootWindow != None)
  8454.         rootWindow.ShowFrames(!rootWindow.bShowFrames);
  8455. }
  8456.  
  8457.  
  8458. // ----------------------------------------------------------------------
  8459. // ShowClass()
  8460. // ----------------------------------------------------------------------
  8461.  
  8462. exec function ShowClass(Class<Actor> newClass)
  8463. {
  8464.     local DeusExRootWindow root;
  8465.  
  8466.     if (!bCheatsEnabled)
  8467.         return;
  8468.  
  8469.     root = DeusExRootWindow(rootWindow);
  8470.     if (root != None)
  8471.         if (root.actorDisplay != None)
  8472.             root.actorDisplay.SetViewClass(newClass);
  8473. }
  8474.  
  8475.  
  8476. // ----------------------------------------------------------------------
  8477. // ShowEyes()
  8478. // ----------------------------------------------------------------------
  8479.  
  8480. exec function ShowEyes(bool bShow)
  8481. {
  8482.     local DeusExRootWindow root;
  8483.  
  8484.     if (!bCheatsEnabled)
  8485.         return;
  8486.  
  8487.     root = DeusExRootWindow(rootWindow);
  8488.     if (root != None)
  8489.         if (root.actorDisplay != None)
  8490.             root.actorDisplay.ShowEyes(bShow);
  8491. }
  8492.  
  8493.  
  8494. // ----------------------------------------------------------------------
  8495. // ShowArea()
  8496. // ----------------------------------------------------------------------
  8497.  
  8498. exec function ShowArea(bool bShow)
  8499. {
  8500.     local DeusExRootWindow root;
  8501.  
  8502.     if (!bCheatsEnabled)
  8503.         return;
  8504.  
  8505.     root = DeusExRootWindow(rootWindow);
  8506.     if (root != None)
  8507.         if (root.actorDisplay != None)
  8508.             root.actorDisplay.ShowArea(bShow);
  8509. }
  8510.  
  8511.  
  8512. // ----------------------------------------------------------------------
  8513. // ShowCylinder()
  8514. // ----------------------------------------------------------------------
  8515.  
  8516. exec function ShowCylinder(bool bShow)
  8517. {
  8518.     local DeusExRootWindow root;
  8519.  
  8520.     if (!bCheatsEnabled)
  8521.         return;
  8522.  
  8523.     root = DeusExRootWindow(rootWindow);
  8524.     if (root != None)
  8525.         if (root.actorDisplay != None)
  8526.             root.actorDisplay.ShowCylinder(bShow);
  8527. }
  8528.  
  8529.  
  8530. // ----------------------------------------------------------------------
  8531. // ShowMesh()
  8532. // ----------------------------------------------------------------------
  8533.  
  8534. exec function ShowMesh(bool bShow)
  8535. {
  8536.     local DeusExRootWindow root;
  8537.  
  8538.     if (!bCheatsEnabled)
  8539.         return;
  8540.  
  8541.     root = DeusExRootWindow(rootWindow);
  8542.     if (root != None)
  8543.         if (root.actorDisplay != None)
  8544.             root.actorDisplay.ShowMesh(bShow);
  8545. }
  8546.  
  8547.  
  8548. // ----------------------------------------------------------------------
  8549. // ShowZone()
  8550. // ----------------------------------------------------------------------
  8551.  
  8552. exec function ShowZone(bool bShow)
  8553. {
  8554.     local DeusExRootWindow root;
  8555.  
  8556.     if (!bCheatsEnabled)
  8557.         return;
  8558.  
  8559.     root = DeusExRootWindow(rootWindow);
  8560.     if (root != None)
  8561.         if (root.actorDisplay != None)
  8562.             root.actorDisplay.ShowZone(bShow);
  8563. }
  8564.  
  8565.  
  8566. // ----------------------------------------------------------------------
  8567. // ShowLOS()
  8568. // ----------------------------------------------------------------------
  8569.  
  8570. exec function ShowLOS(bool bShow)
  8571. {
  8572.     local DeusExRootWindow root;
  8573.  
  8574.     if (!bCheatsEnabled)
  8575.         return;
  8576.  
  8577.     root = DeusExRootWindow(rootWindow);
  8578.     if (root != None)
  8579.         if (root.actorDisplay != None)
  8580.             root.actorDisplay.ShowLOS(bShow);
  8581. }
  8582.  
  8583.  
  8584. // ----------------------------------------------------------------------
  8585. // ShowVisibility()
  8586. // ----------------------------------------------------------------------
  8587.  
  8588. exec function ShowVisibility(bool bShow)
  8589. {
  8590.     local DeusExRootWindow root;
  8591.  
  8592.     if (!bCheatsEnabled)
  8593.         return;
  8594.  
  8595.     root = DeusExRootWindow(rootWindow);
  8596.     if (root != None)
  8597.         if (root.actorDisplay != None)
  8598.             root.actorDisplay.ShowVisibility(bShow);
  8599. }
  8600.  
  8601.  
  8602. // ----------------------------------------------------------------------
  8603. // ShowData()
  8604. // ----------------------------------------------------------------------
  8605.  
  8606. exec function ShowData(bool bShow)
  8607. {
  8608.     local DeusExRootWindow root;
  8609.  
  8610.     if (!bCheatsEnabled)
  8611.         return;
  8612.  
  8613.     root = DeusExRootWindow(rootWindow);
  8614.     if (root != None)
  8615.         if (root.actorDisplay != None)
  8616.             root.actorDisplay.ShowData(bShow);
  8617. }
  8618.  
  8619.  
  8620. // ----------------------------------------------------------------------
  8621. // ShowEnemyResponse()
  8622. // ----------------------------------------------------------------------
  8623.  
  8624. exec function ShowEnemyResponse(bool bShow)
  8625. {
  8626.     local DeusExRootWindow root;
  8627.  
  8628.     if (!bCheatsEnabled)
  8629.         return;
  8630.  
  8631.     root = DeusExRootWindow(rootWindow);
  8632.     if (root != None)
  8633.         if (root.actorDisplay != None)
  8634.             root.actorDisplay.ShowEnemyResponse(bShow);
  8635. }
  8636.  
  8637.  
  8638. // ----------------------------------------------------------------------
  8639. // ShowER()
  8640. // ----------------------------------------------------------------------
  8641.  
  8642. exec function ShowER(bool bShow)
  8643. {
  8644.     // Convenience form of ShowEnemyResponse()
  8645.     ShowEnemyResponse(bShow);
  8646. }
  8647.  
  8648.  
  8649. // ----------------------------------------------------------------------
  8650. // ShowState()
  8651. // ----------------------------------------------------------------------
  8652.  
  8653. exec function ShowState(bool bShow)
  8654. {
  8655.     local DeusExRootWindow root;
  8656.  
  8657.     if (!bCheatsEnabled)
  8658.         return;
  8659.  
  8660.     root = DeusExRootWindow(rootWindow);
  8661.     if (root != None)
  8662.         if (root.actorDisplay != None)
  8663.             root.actorDisplay.ShowState(bShow);
  8664. }
  8665.  
  8666.  
  8667. // ----------------------------------------------------------------------
  8668. // ShowEnemy()
  8669. // ----------------------------------------------------------------------
  8670.  
  8671. exec function ShowEnemy(bool bShow)
  8672. {
  8673.     local DeusExRootWindow root;
  8674.  
  8675.     if (!bCheatsEnabled)
  8676.         return;
  8677.  
  8678.     root = DeusExRootWindow(rootWindow);
  8679.     if (root != None)
  8680.         if (root.actorDisplay != None)
  8681.             root.actorDisplay.ShowEnemy(bShow);
  8682. }
  8683.  
  8684.  
  8685. // ----------------------------------------------------------------------
  8686. // ShowInstigator()
  8687. // ----------------------------------------------------------------------
  8688.  
  8689. exec function ShowInstigator(bool bShow)
  8690. {
  8691.     local DeusExRootWindow root;
  8692.  
  8693.     if (!bCheatsEnabled)
  8694.         return;
  8695.  
  8696.     root = DeusExRootWindow(rootWindow);
  8697.     if (root != None)
  8698.         if (root.actorDisplay != None)
  8699.             root.actorDisplay.ShowInstigator(bShow);
  8700. }
  8701.  
  8702.  
  8703. // ----------------------------------------------------------------------
  8704. // ShowBase()
  8705. // ----------------------------------------------------------------------
  8706.  
  8707. exec function ShowBase(bool bShow)
  8708. {
  8709.     local DeusExRootWindow root;
  8710.  
  8711.     if (!bCheatsEnabled)
  8712.         return;
  8713.  
  8714.     root = DeusExRootWindow(rootWindow);
  8715.     if (root != None)
  8716.         if (root.actorDisplay != None)
  8717.             root.actorDisplay.ShowBase(bShow);
  8718. }
  8719.  
  8720.  
  8721. // ----------------------------------------------------------------------
  8722. // ShowLight()
  8723. // ----------------------------------------------------------------------
  8724.  
  8725. exec function ShowLight(bool bShow)
  8726. {
  8727.     local DeusExRootWindow root;
  8728.  
  8729.     if (!bCheatsEnabled)
  8730.         return;
  8731.  
  8732.     root = DeusExRootWindow(rootWindow);
  8733.     if (root != None)
  8734.         if (root.actorDisplay != None)
  8735.             root.actorDisplay.ShowLight(bShow);
  8736. }
  8737.  
  8738.  
  8739. // ----------------------------------------------------------------------
  8740. // ShowDist()
  8741. // ----------------------------------------------------------------------
  8742.  
  8743. exec function ShowDist(bool bShow)
  8744. {
  8745.     local DeusExRootWindow root;
  8746.  
  8747.     if (!bCheatsEnabled)
  8748.         return;
  8749.  
  8750.     root = DeusExRootWindow(rootWindow);
  8751.     if (root != None)
  8752.         if (root.actorDisplay != None)
  8753.             root.actorDisplay.ShowDist(bShow);
  8754. }
  8755.  
  8756.  
  8757. // ----------------------------------------------------------------------
  8758. // ShowBindName()
  8759. // ----------------------------------------------------------------------
  8760.  
  8761. exec function ShowBindName(bool bShow)
  8762. {
  8763.     local DeusExRootWindow root;
  8764.  
  8765.     if (!bCheatsEnabled)
  8766.         return;
  8767.  
  8768.     root = DeusExRootWindow(rootWindow);
  8769.     if (root != None)
  8770.         if (root.actorDisplay != None)
  8771.             root.actorDisplay.ShowBindName(bShow);
  8772. }
  8773.  
  8774.  
  8775. // ----------------------------------------------------------------------
  8776. // ShowPos()
  8777. // ----------------------------------------------------------------------
  8778.  
  8779. exec function ShowPos(bool bShow)
  8780. {
  8781.     local DeusExRootWindow root;
  8782.  
  8783.     if (!bCheatsEnabled)
  8784.         return;
  8785.  
  8786.     root = DeusExRootWindow(rootWindow);
  8787.     if (root != None)
  8788.         if (root.actorDisplay != None)
  8789.             root.actorDisplay.ShowPos(bShow);
  8790. }
  8791.  
  8792.  
  8793. // ----------------------------------------------------------------------
  8794. // ShowHealth()
  8795. // ----------------------------------------------------------------------
  8796.  
  8797. exec function ShowHealth(bool bShow)
  8798. {
  8799.     local DeusExRootWindow root;
  8800.  
  8801.     if (!bCheatsEnabled)
  8802.         return;
  8803.  
  8804.     root = DeusExRootWindow(rootWindow);
  8805.     if (root != None)
  8806.         if (root.actorDisplay != None)
  8807.             root.actorDisplay.ShowHealth(bShow);
  8808. }
  8809.  
  8810.  
  8811. // ----------------------------------------------------------------------
  8812. // ShowPhysics()
  8813. // ----------------------------------------------------------------------
  8814.  
  8815. exec function ShowPhysics(bool bShow)
  8816. {
  8817.     local DeusExRootWindow root;
  8818.  
  8819.     if (!bCheatsEnabled)
  8820.         return;
  8821.  
  8822.     root = DeusExRootWindow(rootWindow);
  8823.     if (root != None)
  8824.         if (root.actorDisplay != None)
  8825.             root.actorDisplay.ShowPhysics(bShow);
  8826. }
  8827.  
  8828.  
  8829. // ----------------------------------------------------------------------
  8830. // ShowMass()
  8831. // ----------------------------------------------------------------------
  8832.  
  8833. exec function ShowMass(bool bShow)
  8834. {
  8835.     local DeusExRootWindow root;
  8836.  
  8837.     if (!bCheatsEnabled)
  8838.         return;
  8839.  
  8840.     root = DeusExRootWindow(rootWindow);
  8841.     if (root != None)
  8842.         if (root.actorDisplay != None)
  8843.             root.actorDisplay.ShowMass(bShow);
  8844. }
  8845.  
  8846.  
  8847. // ----------------------------------------------------------------------
  8848. // ShowVelocity()
  8849. // ----------------------------------------------------------------------
  8850.  
  8851. exec function ShowVelocity(bool bShow)
  8852. {
  8853.     local DeusExRootWindow root;
  8854.  
  8855.     if (!bCheatsEnabled)
  8856.         return;
  8857.  
  8858.     root = DeusExRootWindow(rootWindow);
  8859.     if (root != None)
  8860.         if (root.actorDisplay != None)
  8861.             root.actorDisplay.ShowVelocity(bShow);
  8862. }
  8863.  
  8864.  
  8865. // ----------------------------------------------------------------------
  8866. // ShowAcceleration()
  8867. // ----------------------------------------------------------------------
  8868.  
  8869. exec function ShowAcceleration(bool bShow)
  8870. {
  8871.     local DeusExRootWindow root;
  8872.  
  8873.     if (!bCheatsEnabled)
  8874.         return;
  8875.  
  8876.     root = DeusExRootWindow(rootWindow);
  8877.     if (root != None)
  8878.         if (root.actorDisplay != None)
  8879.             root.actorDisplay.ShowAcceleration(bShow);
  8880. }
  8881.  
  8882.  
  8883. // ----------------------------------------------------------------------
  8884. // ShowHud()
  8885. // ----------------------------------------------------------------------
  8886.  
  8887. exec function ShowHud(bool bShow)
  8888. {
  8889.     local DeusExRootWindow root;
  8890.     root = DeusExRootWindow(rootWindow);
  8891.     if (root != None)
  8892.         root.ShowHud(bShow);
  8893. }
  8894.  
  8895. // ----------------------------------------------------------------------
  8896. // ToggleObjectBelt()
  8897. // ----------------------------------------------------------------------
  8898.  
  8899. exec function ToggleObjectBelt()
  8900. {
  8901.     local DeusExRootWindow root;
  8902.  
  8903.     bObjectBeltVisible = !bObjectBeltVisible;
  8904.  
  8905.     root = DeusExRootWindow(rootWindow);
  8906.     if (root != None)
  8907.         root.UpdateHud();
  8908. }
  8909.  
  8910. // ----------------------------------------------------------------------
  8911. // ToggleHitDisplay()
  8912. // ----------------------------------------------------------------------
  8913.  
  8914. exec function ToggleHitDisplay()
  8915. {
  8916.     local DeusExRootWindow root;
  8917.  
  8918.     bHitDisplayVisible = !bHitDisplayVisible;
  8919.  
  8920.     root = DeusExRootWindow(rootWindow);
  8921.     if (root != None)
  8922.         root.UpdateHud();
  8923. }
  8924.  
  8925. // ----------------------------------------------------------------------
  8926. // ToggleAmmoDisplay()
  8927. // ----------------------------------------------------------------------
  8928.  
  8929. exec function ToggleAmmoDisplay()
  8930. {
  8931.     local DeusExRootWindow root;
  8932.  
  8933.     bAmmoDisplayVisible = !bAmmoDisplayVisible;
  8934.  
  8935.     root = DeusExRootWindow(rootWindow);
  8936.     if (root != None)
  8937.         root.UpdateHud();
  8938. }
  8939.  
  8940. // ----------------------------------------------------------------------
  8941. // ToggleAugDisplay()
  8942. // ----------------------------------------------------------------------
  8943.  
  8944. exec function ToggleAugDisplay()
  8945. {
  8946.     local DeusExRootWindow root;
  8947.  
  8948.     bAugDisplayVisible = !bAugDisplayVisible;
  8949.  
  8950.     root = DeusExRootWindow(rootWindow);
  8951.     if (root != None)
  8952.         root.UpdateHud();
  8953. }
  8954.  
  8955. // ----------------------------------------------------------------------
  8956. // ToggleCompass()
  8957. // ----------------------------------------------------------------------
  8958.  
  8959. exec function ToggleCompass()
  8960. {
  8961.     local DeusExRootWindow root;
  8962.  
  8963.     bCompassVisible = !bCompassVisible;
  8964.  
  8965.     root = DeusExRootWindow(rootWindow);
  8966.     if (root != None)
  8967.         root.UpdateHud();
  8968. }
  8969.  
  8970.  
  8971. // ----------------------------------------------------------------------
  8972. // ToggleLaser()
  8973. //
  8974. // turns the laser sight on or off for the current weapon
  8975. // ----------------------------------------------------------------------
  8976.  
  8977. exec function ToggleLaser()
  8978. {
  8979.     local DeusExWeapon W;
  8980.  
  8981.     if (RestrictInput()||bGEPzoomActive)
  8982.         return;
  8983.  
  8984.     W = DeusExWeapon(Weapon);
  8985.     if (W==none) return;
  8986.     if (!W.bHasLaser||W.IsA('WeaponNanoSword')||!W.IsInState('idle')) return;
  8987.  
  8988.     SetLaser(!W.bLasing,true);
  8989. }
  8990.  
  8991. function SetLaser(bool bNewOn,optional bool bCheckXhair)
  8992. {
  8993.     local DeusExWeapon W;
  8994.     W = DeusExWeapon(Weapon);
  8995.  
  8996.     if (W==none||(W!=none&&!W.bHasLaser)) return;
  8997.  
  8998.     bFromCrosshair=true;
  8999.     if (bNewOn)
  9000.     {
  9001.       W.LaserOn();
  9002.       if (bCheckXhair) SetCrosshair(false,false);
  9003.     } else
  9004.     {
  9005.       W.LaserOff();
  9006.       if (bCheckXhair) SetCrosshair(bWasCrosshair,false);
  9007.     }
  9008. }
  9009.  
  9010. function SetCrosshair(bool bNewOn,optional bool bCheckLasing)
  9011. {
  9012.     local DeusExRootWindow root;
  9013.     root = DeusExRootWindow(rootWindow);
  9014.  
  9015.     if (root == None) return;
  9016.  
  9017.     bCrosshairVisible=bNewOn;
  9018.     root.UpdateHud();
  9019.  
  9020.     if (bNewOn&&bCheckLasing) SetLaser(false,false);
  9021. }
  9022.  
  9023. // ----------------------------------------------------------------------
  9024. // ToggleCrosshair()
  9025. // ----------------------------------------------------------------------
  9026. exec function ToggleCrosshair()
  9027. {
  9028.     local DeusExWeapon W;
  9029.     if (RestrictInput())
  9030.         return;
  9031.     W = DeusExWeapon(Weapon);
  9032.  
  9033.     if (W!=none&&(W.IsA('WeaponNanoSword')||!W.IsInState('idle'))) return;
  9034.  
  9035.     bCrosshairVisible = !bCrosshairVisible;
  9036.     bWasCrosshair=bCrosshairVisible;
  9037.  
  9038.     SetCrosshair(bCrosshairVisible,true);
  9039. }
  9040.  
  9041. // ----------------------------------------------------------------------
  9042. // ShowInventoryWindow()
  9043. // ----------------------------------------------------------------------
  9044.  
  9045. exec function ShowInventoryWindow()
  9046. {
  9047.     if (RestrictInput())
  9048.         return;
  9049.  
  9050.     if ((Level.NetMode != NM_Standalone) && (bBeltIsMPInventory))
  9051.     {
  9052.       ClientMessage("Inventory screen disabled in multiplayer");
  9053.       return;
  9054.     }
  9055.  
  9056.     InvokeUIScreen(Class'PersonaScreenInventory');
  9057. }
  9058.  
  9059. // ----------------------------------------------------------------------
  9060. // ShowSkillsWindow()
  9061. // ----------------------------------------------------------------------
  9062.  
  9063. exec function ShowSkillsWindow()
  9064. {
  9065.     if (RestrictInput())
  9066.         return;
  9067.  
  9068.     if ((Level.NetMode != NM_Standalone) && (bBeltIsMPInventory))
  9069.     {
  9070.       ClientMessage("Skills screen disabled in multiplayer");
  9071.       return;
  9072.     }
  9073.  
  9074.     InvokeUIScreen(Class'PersonaScreenSkills');
  9075. }
  9076.  
  9077. // ----------------------------------------------------------------------
  9078. // ShowHealthWindow()
  9079. // ----------------------------------------------------------------------
  9080.  
  9081. exec function ShowHealthWindow()
  9082. {
  9083.     if (RestrictInput())
  9084.         return;
  9085.  
  9086.     if ((Level.NetMode != NM_Standalone) && (bBeltIsMPInventory))
  9087.     {
  9088.       ClientMessage("Health screen disabled in multiplayer");
  9089.       return;
  9090.     }
  9091.  
  9092.     InvokeUIScreen(Class'PersonaScreenHealth');
  9093. }
  9094.  
  9095. // ----------------------------------------------------------------------
  9096. // ShowImagesWindow()
  9097. // ----------------------------------------------------------------------
  9098.  
  9099. exec function ShowImagesWindow()
  9100. {
  9101.     if (RestrictInput())
  9102.         return;
  9103.  
  9104.     if ((Level.NetMode != NM_Standalone) && (bBeltIsMPInventory))
  9105.     {
  9106.       ClientMessage("Images screen disabled in multiplayer");
  9107.       return;
  9108.     }
  9109.  
  9110.     InvokeUIScreen(Class'PersonaScreenImages');
  9111. }
  9112.  
  9113. // ----------------------------------------------------------------------
  9114. // ShowConversationsWindow()
  9115. // ----------------------------------------------------------------------
  9116.  
  9117. exec function ShowConversationsWindow()
  9118. {
  9119.     if (RestrictInput())
  9120.         return;
  9121.  
  9122.     if ((Level.NetMode != NM_Standalone) && (bBeltIsMPInventory))
  9123.     {
  9124.       ClientMessage("Conversations screen disabled in multiplayer");
  9125.       return;
  9126.     }
  9127.  
  9128.     InvokeUIScreen(Class'PersonaScreenConversations');
  9129. }
  9130.  
  9131. // ----------------------------------------------------------------------
  9132. // ShowAugmentationsWindow()
  9133. // ----------------------------------------------------------------------
  9134.  
  9135. exec function ShowAugmentationsWindow()
  9136. {
  9137.     if (RestrictInput())
  9138.         return;
  9139.  
  9140.     if ((Level.NetMode != NM_Standalone) && (bBeltIsMPInventory))
  9141.     {
  9142.       ClientMessage("Augmentations screen disabled in multiplayer");
  9143.       return;
  9144.     }
  9145.  
  9146.     InvokeUIScreen(Class'PersonaScreenAugmentations');
  9147. }
  9148.  
  9149. // ----------------------------------------------------------------------
  9150. // ShowGoalsWindow()
  9151. // ----------------------------------------------------------------------
  9152.  
  9153. exec function ShowGoalsWindow()
  9154. {
  9155.     if (RestrictInput())
  9156.         return;
  9157.  
  9158.     if ((Level.NetMode != NM_Standalone) && (bBeltIsMPInventory))
  9159.     {
  9160.       ClientMessage("Goals screen disabled in multiplayer");
  9161.       return;
  9162.     }
  9163.  
  9164.     InvokeUIScreen(Class'PersonaScreenGoals');
  9165. }
  9166.  
  9167. // ----------------------------------------------------------------------
  9168. // ShowLogsWindow()
  9169. // ----------------------------------------------------------------------
  9170.  
  9171. exec function ShowLogsWindow()
  9172. {
  9173.     if (RestrictInput())
  9174.         return;
  9175.  
  9176.     if ((Level.NetMode != NM_Standalone) && (bBeltIsMPInventory))
  9177.     {
  9178.       ClientMessage("Logs screen disabled in multiplayer");
  9179.       return;
  9180.     }
  9181.  
  9182.     InvokeUIScreen(Class'PersonaScreenLogs');
  9183. }
  9184.  
  9185. // ----------------------------------------------------------------------
  9186. // ShowAugmentationAddWindow()
  9187. // ----------------------------------------------------------------------
  9188.  
  9189. exec function ShowAugmentationAddWindow()
  9190. {
  9191.     if (RestrictInput())
  9192.         return;
  9193.  
  9194.     InvokeUIScreen(Class'HUDMedBotAddAugsScreen');
  9195. }
  9196.  
  9197. // ----------------------------------------------------------------------
  9198. // ShowQuotesWindow()
  9199. // ----------------------------------------------------------------------
  9200.  
  9201. exec function ShowQuotesWindow()
  9202. {
  9203.     if (!bCheatsEnabled)
  9204.         return;
  9205.  
  9206.     InvokeUIScreen(Class'QuotesWindow');
  9207. }
  9208.  
  9209. // ----------------------------------------------------------------------
  9210. // ShowRGBDialog()
  9211. // ----------------------------------------------------------------------
  9212.  
  9213. exec function ShowRGBDialog()
  9214. {
  9215.     local DeusExRootWindow root;
  9216.  
  9217.     if (!bCheatsEnabled)
  9218.         return;
  9219.  
  9220.     root = DeusExRootWindow(rootWindow);
  9221.     if (root != None)
  9222.         root.PushWindow(Class'MenuScreenRGB');
  9223. }
  9224.  
  9225. // ----------------------------------------------------------------------
  9226. // ActivateBelt()
  9227. // ----------------------------------------------------------------------
  9228.  
  9229. exec function ActivateBelt(int objectNum)
  9230. {
  9231.     local DeusExRootWindow root;
  9232.  
  9233.     if (RestrictInput())
  9234.         return;
  9235.  
  9236.     if ((Level.NetMode != NM_Standalone) && bBuySkills)
  9237.     {
  9238.         root = DeusExRootWindow(rootWindow);
  9239.         if ( root != None )
  9240.         {
  9241.             if ( root.hud.hms.OverrideBelt( Self, objectNum ))
  9242.                 return;
  9243.         }
  9244.     }
  9245.  
  9246.     if (CarriedDecoration == None)
  9247.     {
  9248.         root = DeusExRootWindow(rootWindow);
  9249.         if (root != None)
  9250.             root.ActivateObjectInBelt(objectNum);
  9251.     }
  9252. }
  9253.  
  9254. // ----------------------------------------------------------------------
  9255. // NextBeltItem()
  9256. // ----------------------------------------------------------------------
  9257.  
  9258. exec function NextBeltItem()
  9259. {
  9260.     local DeusExRootWindow root;
  9261.     local int slot, startSlot;
  9262.  
  9263.     if (RestrictInput())
  9264.         return;
  9265.  
  9266.    if (inHand != None && inHand.IsA('DeusExWeapon'))
  9267.     {
  9268.      if (DeusExWeapon(inHand).bZoomed)
  9269.      {
  9270.       if (FovAngle < 60)
  9271.       {
  9272.        DeusExWeapon(inHand).ScopeFOV += 2;
  9273.        DeusExWeapon(inHand).RefreshScopeDisplay(Self,False,True);
  9274.       }
  9275.      return;
  9276.      }
  9277.     }
  9278.  
  9279.    if (!bAlternateToolbelt)
  9280.    {
  9281.     if (CarriedDecoration == None)
  9282.     {
  9283.         slot = 0;
  9284.         root = DeusExRootWindow(rootWindow);
  9285.         if (root != None)
  9286.         {
  9287.             if (inHand == None)
  9288.                 slot = SlotMem-1;
  9289.             else if (ClientInHandPending != None)
  9290.                 slot = ClientInHandPending.beltPos;
  9291.             else if (inHandPending != None)
  9292.                 slot = inHandPending.beltPos;
  9293.             else if (inHand != None)
  9294.                 slot = inHand.beltPos;
  9295.  
  9296.             startSlot = slot;
  9297.  
  9298.             do
  9299.             {
  9300.                 if (++slot >= 10)
  9301.                     slot = 0;
  9302.             }
  9303.             until (root.ActivateObjectInBelt(slot) || (startSlot == slot));
  9304.  
  9305.             clientInHandPending = root.hud.belt.GetObjectFromBelt(slot);
  9306.  
  9307.             switch( inHandPending.beltPos )
  9308.        {
  9309.         case 1:SlotMem = 1;break;
  9310.         case 2:SlotMem = 2;break;
  9311.         case 3:SlotMem = 3;break;
  9312.         case 4:SlotMem = 4;break;
  9313.         case 5:SlotMem = 5;break;
  9314.         case 6:SlotMem = 6;break;
  9315.         case 7:SlotMem = 7;break;
  9316.         case 8:SlotMem = 8;break;
  9317.         case 9:SlotMem = 9;break;
  9318.         default:SlotMem = 1;break;
  9319.         }
  9320.         }
  9321.     }
  9322.     }
  9323.     else
  9324.     {
  9325.     if (CarriedDecoration == None)
  9326.     {
  9327.         //slot = advBelt;
  9328.         root = DeusExRootWindow(rootWindow);
  9329.         if (root != None)
  9330.         {
  9331.                 if (++advBelt >= 10)
  9332.                     advBelt = 0;
  9333.             root.hud.belt.UpdateInHand2(advBelt);
  9334.             clientInHandPending = root.hud.belt.GetObjectFromBelt(advBelt);
  9335.         }
  9336.     }
  9337.     }
  9338. }
  9339.  
  9340. // ----------------------------------------------------------------------
  9341. // PrevBeltItem()
  9342. // ----------------------------------------------------------------------
  9343.  
  9344. exec function PrevBeltItem()
  9345. {
  9346.     local DeusExRootWindow root;
  9347.     local int slot, startSlot;
  9348.  
  9349.     if (RestrictInput())
  9350.         return;
  9351.  
  9352.     if (inHand != None && inHand.IsA('DeusExWeapon'))
  9353.     {
  9354.      if (DeusExWeapon(inHand).bZoomed)
  9355.      {
  9356.       if (FovAngle > 20)
  9357.       {
  9358.        DeusExWeapon(inHand).ScopeFOV -= 2;
  9359.        DeusExWeapon(inHand).RefreshScopeDisplay(Self,False,True);
  9360.       }
  9361.      return;
  9362.      }
  9363.     }
  9364.  
  9365.    if (!bAlternateToolbelt)
  9366.    {
  9367.     if (CarriedDecoration == None)
  9368.     {
  9369.         slot = 1;
  9370.         root = DeusExRootWindow(rootWindow);
  9371.         if (root != None)
  9372.         {
  9373.             if (inHand == none)
  9374.                 slot = SlotMem+1;
  9375.             else if (ClientInHandPending != None)
  9376.                 slot = ClientInHandPending.beltPos;
  9377.             else  if (inHandPending != None)
  9378.                 slot = inHandPending.beltPos;
  9379.             else if (inHand != None)
  9380.                 slot = inHand.beltPos;
  9381.  
  9382.             startSlot = slot;
  9383.             do
  9384.             {
  9385.                 if (--slot <= -1)
  9386.                     slot = 9;
  9387.             }
  9388.             until (root.ActivateObjectInBelt(slot) || (startSlot == slot));
  9389.  
  9390.             clientInHandPending = root.hud.belt.GetObjectFromBelt(slot);
  9391.             switch( inHandPending.beltPos )
  9392.        {
  9393.         case 1:SlotMem = 1;break;
  9394.         case 2:SlotMem = 2;break;
  9395.         case 3:SlotMem = 3;break;
  9396.         case 4:SlotMem = 4;break;
  9397.         case 5:SlotMem = 5;break;
  9398.         case 6:SlotMem = 6;break;
  9399.         case 7:SlotMem = 7;break;
  9400.         case 8:SlotMem = 8;break;
  9401.         case 9:SlotMem = 9;break;
  9402.         default:SlotMem = 0;break;
  9403.         }
  9404.         }
  9405.     }
  9406.     }
  9407.     else
  9408.     {
  9409.     if (CarriedDecoration == None)
  9410.     {
  9411.         //slot = advBelt;
  9412.         root = DeusExRootWindow(rootWindow);
  9413.         if (root != None)
  9414.         {
  9415.                 if (--advBelt <= -1)
  9416.                     advBelt = 9;
  9417.             root.hud.belt.UpdateInHand2(advBelt);
  9418.             clientInHandPending = root.hud.belt.GetObjectFromBelt(advBelt);
  9419.         }
  9420.     }
  9421.     }
  9422. }
  9423.  
  9424. // ----------------------------------------------------------------------
  9425. // ShowMainMenu()
  9426. // ----------------------------------------------------------------------
  9427.  
  9428. exec function ShowMainMenu()
  9429. {
  9430.     local DeusExRootWindow root;
  9431.     local DeusExLevelInfo info;
  9432.     local MissionEndgame Script;
  9433.  
  9434.     if (bIgnoreNextShowMenu)
  9435.     {
  9436.         bIgnoreNextShowMenu = False;
  9437.         return;
  9438.     }
  9439.  
  9440.     info = GetLevelInfo();
  9441.  
  9442.     // Special case baby!
  9443.     //
  9444.     // If the Intro map is loaded and we get here, that means the player
  9445.     // pressed Escape and we want to either A) start a new game
  9446.     // or B) return to the dx.dx screen.  Either way we're going to
  9447.     // abort the Intro by doing this.
  9448.     //
  9449.     // If this is one of the Endgames (which have a mission # of 99)
  9450.     // then we also want to call the Endgame's "FinishCinematic"
  9451.     // function
  9452.  
  9453.     // force the texture caches to flush
  9454.     ConsoleCommand("FLUSH");
  9455.  
  9456.     if ((info != None) && (info.MissionNumber == 98))
  9457.     {
  9458.         bIgnoreNextShowMenu = True;
  9459.         PostIntro();
  9460.     }
  9461.     else if ((info != None) && (info.MissionNumber == 99))
  9462.     {
  9463.         foreach AllActors(class'MissionEndgame', Script)
  9464.             break;
  9465.  
  9466.         if (Script != None)
  9467.             Script.FinishCinematic();
  9468.     }
  9469.     else
  9470.     {
  9471.         root = DeusExRootWindow(rootWindow);
  9472.         if (root != None)
  9473.         {
  9474. //GMDX: stop lockpick and multitool cheat
  9475.          if (!IsInState('Dying')&&InHand!=None&&InHand.IsA('SkilledTool')&&(InHand.IsA('Lockpick')||InHand.IsA('MultiTool')))
  9476.          {
  9477.             if (SkilledTool(InHand).IsInState('UseIt'))
  9478.                return; //just can InvokeMenu :P
  9479.          }
  9480.         root.InvokeMenu(Class'MenuMain');
  9481.         }
  9482.     }
  9483. }
  9484.  
  9485. // ----------------------------------------------------------------------
  9486. // PostIntro()
  9487. // ----------------------------------------------------------------------
  9488.  
  9489. function PostIntro()
  9490. {
  9491.     if (bStartNewGameAfterIntro)
  9492.     {
  9493.         bStartNewGameAfterIntro = False;
  9494.         StartNewGame(strStartMap);
  9495.     }
  9496.     else
  9497.     {
  9498.         Level.Game.SendPlayer(Self, "dxonly");
  9499.     }
  9500. }
  9501.  
  9502. // ----------------------------------------------------------------------
  9503. // EditFlags()
  9504. //
  9505. // Displays the Flag Edit dialog
  9506. // ----------------------------------------------------------------------
  9507.  
  9508. exec function EditFlags()
  9509. {
  9510.     if (!bCheatsEnabled)
  9511.         return;
  9512.  
  9513.     InvokeUIScreen(Class'FlagEditWindow');
  9514. }
  9515.  
  9516. // ----------------------------------------------------------------------
  9517. // InvokeConWindow()
  9518. //
  9519. // Displays the Invoke Conversation Window
  9520. // ----------------------------------------------------------------------
  9521.  
  9522. exec function InvokeConWindow()
  9523. {
  9524.     if (!bCheatsEnabled)
  9525.         return;
  9526.  
  9527.     InvokeUIScreen(Class'InvokeConWindow');
  9528. }
  9529.  
  9530. // ----------------------------------------------------------------------
  9531. // LoadMap()
  9532. //
  9533. // Displays the Load Map dialog
  9534. // ----------------------------------------------------------------------
  9535.  
  9536. exec function LoadMap()
  9537. {
  9538.     if (!bCheatsEnabled)
  9539.         return;
  9540.  
  9541.     InvokeUIScreen(Class'LoadMapWindow');
  9542. }
  9543.  
  9544. // ----------------------------------------------------------------------
  9545. // Overrides from PlayerPawn
  9546. // ----------------------------------------------------------------------
  9547.  
  9548. exec function Walk()
  9549. {
  9550.     if (RestrictInput())
  9551.         return;
  9552.  
  9553.     if (!bCheatsEnabled)
  9554.         return;
  9555.  
  9556.     Super.Walk();
  9557. }
  9558.  
  9559. exec function Fly()
  9560. {
  9561.     if (RestrictInput())
  9562.         return;
  9563.  
  9564.     if (!bCheatsEnabled)
  9565.         return;
  9566.  
  9567.     Super.Fly();
  9568. }
  9569.  
  9570. exec function Ghost()
  9571. {
  9572.     if (RestrictInput())
  9573.         return;
  9574.  
  9575.     if (!bCheatsEnabled)
  9576.         return;
  9577.  
  9578.     Super.Ghost();
  9579. }
  9580.  
  9581. exec function Fire(optional float F)
  9582. {
  9583.     if (RestrictInput())
  9584.     {
  9585.         if (bHidden)
  9586.             ShowMainMenu();
  9587.         return;
  9588.     }
  9589.  
  9590.     Super.Fire(F);
  9591. }
  9592.  
  9593. // ----------------------------------------------------------------------
  9594. // Tantalus()
  9595. //
  9596. // Instantly kills/destroys the object directly in front of the player
  9597. // (just like the Tantalus Field in Star Trek)
  9598. // ----------------------------------------------------------------------
  9599.  
  9600. exec function Tantalus()
  9601. {
  9602.     local Actor            hitActor;
  9603.     local Vector           hitLocation, hitNormal;
  9604.     local Vector           position, line;
  9605.     local ScriptedPawn     hitPawn;
  9606.     local DeusExMover      hitMover;
  9607.     local DeusExDecoration hitDecoration;
  9608.     local bool             bTakeDamage;
  9609.     local int              damage;
  9610.  
  9611.     if (!bCheatsEnabled)
  9612.         return;
  9613.  
  9614.     bTakeDamage = false;
  9615.     damage      = 1;
  9616.     position    = Location;
  9617.     position.Z += BaseEyeHeight;
  9618.     line        = Vector(ViewRotation) * 4000;
  9619.  
  9620.     hitActor = Trace(hitLocation, hitNormal, position+line, position, true);
  9621.     if (hitActor != None)
  9622.     {
  9623.         hitMover = DeusExMover(hitActor);
  9624.         hitPawn = ScriptedPawn(hitActor);
  9625.         hitDecoration = DeusExDecoration(hitActor);
  9626.         if (hitMover != None)
  9627.         {
  9628.             if (hitMover.bBreakable)
  9629.             {
  9630.                 hitMover.doorStrength = 0;
  9631.                 bTakeDamage = true;
  9632.             }
  9633.         }
  9634.         else if (hitPawn != None)
  9635.         {
  9636.             if (!hitPawn.bInvincible)
  9637.             {
  9638.                 hitPawn.HealthHead     = 0;
  9639.                 hitPawn.HealthTorso    = 0;
  9640.                 hitPawn.HealthLegLeft  = 0;
  9641.                 hitPawn.HealthLegRight = 0;
  9642.                 hitPawn.HealthArmLeft  = 0;
  9643.                 hitPawn.HealthArmRight = 0;
  9644.                 hitPawn.Health         = 0;
  9645.                 bTakeDamage = true;
  9646.             }
  9647.         }
  9648.         else if (hitDecoration != None)
  9649.         {
  9650.             if (!hitDecoration.bInvincible)
  9651.             {
  9652.                 hitDecoration.HitPoints = 0;
  9653.                 bTakeDamage = true;
  9654.             }
  9655.         }
  9656.         else if (hitActor != Level)
  9657.         {
  9658.             damage = 5000;
  9659.             bTakeDamage = true;
  9660.         }
  9661.     }
  9662.  
  9663.     if (bTakeDamage)
  9664.         hitActor.TakeDamage(damage, self, hitLocation, line, 'Tantalus');
  9665. }
  9666.  
  9667. // ----------------------------------------------------------------------
  9668. // OpenSesame()
  9669. //
  9670. // Opens any door immediately in front of you, locked or not
  9671. // ----------------------------------------------------------------------
  9672.  
  9673. exec function OpenSesame()
  9674. {
  9675.     local Actor       hitActor;
  9676.     local Vector      hitLocation, hitNormal;
  9677.     local Vector      position, line;
  9678.     local DeusExMover hitMover;
  9679.     local DeusExMover triggerMover;
  9680.     local HackableDevices device;
  9681.  
  9682.     if (!bCheatsEnabled)
  9683.         return;
  9684.  
  9685.     position    = Location;
  9686.     position.Z += BaseEyeHeight;
  9687.     line        = Vector(ViewRotation) * 4000;
  9688.  
  9689.     hitActor = Trace(hitLocation, hitNormal, position+line, position, true);
  9690.     hitMover = DeusExMover(hitActor);
  9691.     device   = HackableDevices(hitActor);
  9692.     if (hitMover != None)
  9693.     {
  9694.         if ((hitMover.Tag != '') && (hitMover.Tag != 'DeusExMover'))
  9695.         {
  9696.             foreach AllActors(class'DeusExMover', triggerMover, hitMover.Tag)
  9697.             {
  9698.                 triggerMover.bLocked = false;
  9699.                 triggerMover.Trigger(self, self);
  9700.             }
  9701.         }
  9702.         else
  9703.         {
  9704.             hitMover.bLocked = false;
  9705.             hitMover.Trigger(self, self);
  9706.         }
  9707.     }
  9708.     else if (device != None)
  9709.     {
  9710.         if (device.bHackable)
  9711.         {
  9712.             if (device.hackStrength > 0)
  9713.             {
  9714.                 device.hackStrength = 0;
  9715.                 device.HackAction(self, true);
  9716.             }
  9717.         }
  9718.     }
  9719. }
  9720.  
  9721. // ----------------------------------------------------------------------
  9722. // Legend()
  9723. //
  9724. // Displays the "Behind The Curtain" menu
  9725. // ----------------------------------------------------------------------
  9726.  
  9727. exec function Legend()
  9728. {
  9729.     if (!bCheatsEnabled)
  9730.         return;
  9731.  
  9732.     InvokeUIScreen(Class'BehindTheCurtain');
  9733. }
  9734.  
  9735. // ----------------------------------------------------------------------
  9736. // AddInventory()
  9737. // ----------------------------------------------------------------------
  9738.  
  9739. function bool AddInventory(inventory item)
  9740. {
  9741.     local bool retval;
  9742.     local DeusExRootWindow root;
  9743.  
  9744.     if (item == none) //CyberP: Patches up a really terrible bug. Origin: Unknown
  9745.     return(false);
  9746.  
  9747.     retval = super.AddInventory(item);
  9748.  
  9749.     // Force the object be added to the object belt
  9750.     // unless it's ammo
  9751.     //
  9752.     // Don't add Ammo and don't add Images!
  9753.  
  9754.     if ((item != None) && !item.IsA('Ammo') && (!item.IsA('DataVaultImage')) && (!item.IsA('Credits')))
  9755.     {
  9756.         root = DeusExRootWindow(rootWindow);
  9757.  
  9758.         if ( item.bInObjectBelt )
  9759.         {
  9760.             if (root != None)
  9761.             {
  9762.                 root.hud.belt.AddObjectToBelt(item, item.beltPos, True);
  9763.             }
  9764.         }
  9765.  
  9766.         if (retval)
  9767.         {
  9768.             if (root != None)
  9769.          {
  9770.                 root.AddInventory(item);
  9771.          }
  9772.         }
  9773.     }
  9774.  
  9775.     return (retval);
  9776. }
  9777.  
  9778. // ----------------------------------------------------------------------
  9779. // DeleteInventory()
  9780. // ----------------------------------------------------------------------
  9781.  
  9782. function bool DeleteInventory(inventory item)
  9783. {
  9784.     local bool retval;
  9785.     local DeusExRootWindow root;
  9786.     local PersonaScreenInventory winInv;
  9787.  
  9788.     // If the item was inHand, clear the inHand
  9789.     if (inHand == item)
  9790.     {
  9791.         SetInHand(None);
  9792.         SetInHandPending(None);
  9793.     }
  9794.  
  9795.     // Make sure the item is removed from the inventory grid
  9796.     RemoveItemFromSlot(item);
  9797.  
  9798.     root = DeusExRootWindow(rootWindow);
  9799.  
  9800.     if (root != None)
  9801.     {
  9802.         // If the inventory screen is active, we need to send notification
  9803.         // that the item is being removed
  9804.         winInv = PersonaScreenInventory(root.GetTopWindow());
  9805.         if (winInv != None)
  9806.             winInv.InventoryDeleted(item);
  9807.  
  9808.         // Remove the item from the object belt
  9809.         if (root != None)
  9810.             root.DeleteInventory(item);
  9811.       else //In multiplayer, we often don't have a root window when creating corpse, so hand delete
  9812.       {
  9813.          item.bInObjectBelt = false;
  9814.          item.beltPos = -1;
  9815.       }
  9816.     }
  9817.  
  9818.     return Super.DeleteInventory(item);
  9819. }
  9820.  
  9821. // ----------------------------------------------------------------------
  9822. // JoltView()
  9823. // ----------------------------------------------------------------------
  9824.  
  9825. event JoltView(float newJoltMagnitude)
  9826. {
  9827.     if (Abs(JoltMagnitude) < Abs(newJoltMagnitude))
  9828.         JoltMagnitude = newJoltMagnitude;
  9829. }
  9830.  
  9831. // ----------------------------------------------------------------------
  9832. // UpdateEyeHeight()
  9833. // ----------------------------------------------------------------------
  9834.  
  9835. event UpdateEyeHeight(float DeltaTime)
  9836. {
  9837.     Super.UpdateEyeHeight(DeltaTime);
  9838.  
  9839.     if (JoltMagnitude != 0)
  9840.     {
  9841.         if ((Physics == PHYS_Walking) && (Bob != 0))
  9842.             EyeHeight += (JoltMagnitude * 5);
  9843.         JoltMagnitude = 0;
  9844.     }
  9845. }
  9846.  
  9847. // ----------------------------------------------------------------------
  9848. // PlayerCalcView()
  9849. // ----------------------------------------------------------------------
  9850.  
  9851. event PlayerCalcView( out actor ViewActor, out vector CameraLocation, out rotator CameraRotation )
  9852. {
  9853.     local vector unX,unY,unZ;
  9854.     if (bStaticFreeze)
  9855.     {
  9856.         CameraLocation = SAVElocation;
  9857.         CameraLocation.Z += EyeHeight;
  9858.         CameraLocation += WalkBob;
  9859.         CameraRotation=SAVErotation;
  9860.         SetLocation(SAVElocation);
  9861.         SetRotation(SAVErotation);
  9862.         GotoState('StaticFreeze');
  9863.         return;
  9864.     }
  9865.     // check for spy drone and freeze player's view
  9866.     if (bSpyDroneActive)
  9867.     {
  9868.         if (aDrone != None)
  9869.         {
  9870.             // First-person view.
  9871.             CameraLocation = Location;
  9872.             CameraLocation.Z += EyeHeight;
  9873.             CameraLocation += WalkBob;
  9874.             return;
  9875.         }
  9876.     }
  9877.  
  9878.     // Check if we're in first-person view or third-person.  If we're in first-person then
  9879.     // we'll just render the normal camera view.  Otherwise we want to place the camera
  9880.     // as directed by the conPlay.cameraInfo object.
  9881.  
  9882.     if ( bBehindView && (!InConversation()) )
  9883.     {
  9884.         Super.PlayerCalcView(ViewActor, CameraLocation, CameraRotation);
  9885.         return;
  9886.     }
  9887.  
  9888.     if ( (!InConversation()) || ( conPlay.GetDisplayMode() == DM_FirstPerson ) )
  9889.     {
  9890.         // First-person view.
  9891.         ViewActor = Self;
  9892.         CameraRotation = ViewRotation;
  9893.         CameraLocation = Location;
  9894.         CameraLocation.Z += EyeHeight;
  9895.         CameraLocation += WalkBob;
  9896.  
  9897. //GMDX
  9898.         if (!bGEPzoomActive)
  9899.             UpdateRocketTarget(CameraRotation,RocketTargetMaxDistance);//wire guided (laser)
  9900.  
  9901.         GetAxes(Normalize(Rotation),unX,unY,unZ);
  9902.         unX*=RecoilShake.X;
  9903.         unY*=RecoilShake.Y;
  9904.         unZ*=RecoilShake.Z;
  9905.         CameraLocation += (unX+unY+unZ);
  9906.         return;
  9907.     }
  9908.  
  9909.     // Allow the ConCamera object to calculate the camera position and
  9910.     // rotation for us (in other words, take this sloppy routine and
  9911.     // hide it elsewhere).
  9912.  
  9913.     if (conPlay.cameraInfo.CalculateCameraPosition(ViewActor, CameraLocation, CameraRotation) == False)
  9914.         Super.PlayerCalcView(ViewActor, CameraLocation, CameraRotation);
  9915. }
  9916.  
  9917.  
  9918. // ----------------------------------------------------------------------
  9919. // PlayerInput()
  9920. // ----------------------------------------------------------------------
  9921.  
  9922. event PlayerInput( float DeltaTime )
  9923. {
  9924.     if (!InConversation())
  9925.         Super.PlayerInput(DeltaTime);
  9926. }
  9927.  
  9928. // ----------------------------------------------------------------------
  9929. // state Conversation
  9930. // ----------------------------------------------------------------------
  9931.  
  9932. state Conversation
  9933. {
  9934. ignores SeePlayer, HearNoise, Bump;
  9935.  
  9936.     event PlayerTick(float deltaTime)
  9937.     {
  9938.         local rotator tempRot;
  9939.         local float   yawDelta;
  9940.  
  9941.         UpdateInHand();
  9942.         UpdateDynamicMusic(deltaTime);
  9943.  
  9944.         DrugEffects(deltaTime);
  9945.         RecoilEffectTick(deltaTime);
  9946.         Bleed(deltaTime);
  9947.         MaintainEnergy(deltaTime);
  9948.  
  9949.         // must update viewflash manually incase a flash happens during a convo
  9950.         ViewFlash(deltaTime);
  9951.  
  9952.         // Check if player has walked outside a first-person convo.
  9953.         CheckActiveConversationRadius();
  9954.  
  9955.         // Check if all the people involved in a conversation are
  9956.         // still within a reasonable radius.
  9957.         CheckActorDistances();
  9958.  
  9959.         Super.PlayerTick(deltaTime);
  9960.         LipSynch(deltaTime);
  9961.  
  9962.         // Keep turning towards the person we're speaking to
  9963.         if (ConversationActor != None)
  9964.         {
  9965.             LookAtActor(ConversationActor, true, true, true, 0, 0.5);
  9966.  
  9967.             // Hacky way to force the player to turn...
  9968.             tempRot = rot(0,0,0);
  9969.             tempRot.Yaw = (DesiredRotation.Yaw - Rotation.Yaw) & 65535;
  9970.             if (tempRot.Yaw > 32767)
  9971.                 tempRot.Yaw -= 65536;
  9972.             yawDelta = RotationRate.Yaw * deltaTime;
  9973.             if (tempRot.Yaw > yawDelta)
  9974.                 tempRot.Yaw = yawDelta;
  9975.             else if (tempRot.Yaw < -yawDelta)
  9976.                 tempRot.Yaw = -yawDelta;
  9977.             SetRotation(Rotation + tempRot);
  9978.         }
  9979.  
  9980.         // Update Time Played
  9981.         UpdateTimePlayed(deltaTime);
  9982.     }
  9983.  
  9984.     function LoopHeadConvoAnim()
  9985.     {
  9986.     }
  9987.  
  9988.     function EndState()
  9989.     {
  9990.         conPlay = None;
  9991.  
  9992.         // Re-enable the PC's detectability
  9993.         MakePlayerIgnored(false);
  9994.  
  9995.         MoveTarget = None;
  9996.         bBehindView = false;
  9997.         StopBlendAnims();
  9998.         ConversationActor = None;
  9999.     }
  10000.  
  10001. Begin:
  10002.     // Make sure we're stopped
  10003.     Velocity.X = 0;
  10004.     Velocity.Y = 0;
  10005.     Velocity.Z = 0;
  10006.  
  10007.     Acceleration = Velocity;
  10008.  
  10009.     PlayRising();
  10010.  
  10011.     // Make sure the player isn't on fire!
  10012.     if (bOnFire)
  10013.         ExtinguishFire();
  10014.  
  10015.     // Make sure the PC can't be attacked while in conversation
  10016.     MakePlayerIgnored(true);
  10017.  
  10018.     LookAtActor(conPlay.startActor, true, false, true, 0, 0.5);
  10019.  
  10020.     SetRotation(DesiredRotation);
  10021.  
  10022.     PlayTurning();
  10023. //  TurnToward(conPlay.startActor);
  10024. //  TweenToWaiting(0.1);
  10025. //  FinishAnim();
  10026.  
  10027.     if (!conPlay.StartConversation(Self))
  10028.     {
  10029.         AbortConversation(True);
  10030.     }
  10031.     else
  10032.     {
  10033.         // Put away whatever the PC may be holding
  10034.         conPlay.SetInHand(InHand);
  10035.         PutInHand(None);
  10036.         UpdateInHand();
  10037.  
  10038.         if ( conPlay.GetDisplayMode() == DM_ThirdPerson )
  10039.             bBehindView = true;
  10040.     }
  10041. }
  10042.  
  10043. // ----------------------------------------------------------------------
  10044. // InConversation()
  10045. //
  10046. // Returns True if the player is currently engaged in conversation
  10047. // ----------------------------------------------------------------------
  10048.  
  10049. function bool InConversation()
  10050. {
  10051.     if ( conPlay == None )
  10052.     {
  10053.         return False;
  10054.     }
  10055.     else
  10056.     {
  10057.         if (conPlay.con != None)
  10058.             return ((conPlay.con.bFirstPerson == False) && (!conPlay.GetForcePlay()));
  10059.         else
  10060.             return False;
  10061.     }
  10062. }
  10063.  
  10064. // ----------------------------------------------------------------------
  10065. // CanStartConversation()
  10066. //
  10067. // Returns true if we can start a conversation.  Basically this means
  10068. // that
  10069. //
  10070. // 1) If in conversation, bCannotBeInterrutped set to False
  10071. // 2) If in conversation, if we're not in a third-person convo
  10072. // 3) The player isn't in 'bForceDuck' mode
  10073. // 4) The player isn't DEAD!
  10074. // 5) The player isn't swimming
  10075. // 6) The player isn't CheatFlying (ghost)
  10076. // 7) The player isn't in PHYS_Falling
  10077. // 8) The game is in 'bPlayersOnly' mode
  10078. // 9) UI screen of some sort isn't presently active.
  10079. // ----------------------------------------------------------------------
  10080.  
  10081. function bool CanStartConversation()
  10082. {
  10083.     if  (((conPlay != None) && (conPlay.CanInterrupt() == False)) ||
  10084.         ((conPlay != None) && (conPlay.con.bFirstPerson != True)) ||
  10085.          (( bForceDuck == True ) && ((HealthLegLeft > 0) || (HealthLegRight > 0))) ||
  10086.          ( IsInState('Dying') ) ||
  10087.          ( IsInState('PlayerSwimming') ) ||
  10088.          ( IsInState('CheatFlying') ) ||
  10089.          ( Physics == PHYS_Falling ) ||
  10090.          ( Level.bPlayersOnly ) ||
  10091.          (!DeusExRootWindow(rootWindow).CanStartConversation()))
  10092.         return False;
  10093.     else
  10094.         return True;
  10095. }
  10096.  
  10097. // ----------------------------------------------------------------------
  10098. // GetDisplayName()
  10099. //
  10100. // Returns a name that can be displayed in the conversation.
  10101. //
  10102. // The first time we speak to someone we'll use the Unfamiliar name.
  10103. // For subsequent conversations, use the Familiar name.  As a fallback,
  10104. // the BindName will be used if both of the other two fields
  10105. // are blank.
  10106. //
  10107. // If this is a DeusExDecoration and the Familiar/Unfamiliar names
  10108. // are blank, then use the decoration's ItemName instead.  This is
  10109. // for use in the FrobDisplayWindow.
  10110. // ----------------------------------------------------------------------
  10111.  
  10112. function String GetDisplayName(Actor actor, optional Bool bUseFamiliar)
  10113. {
  10114.     local String displayName;
  10115.  
  10116.     // Sanity check
  10117.     if ((actor == None) || (player == None) || (rootWindow == None))
  10118.         return "";
  10119.  
  10120.     // If we've spoken to this person already, use the
  10121.     // Familiar Name
  10122.     if ((actor.FamiliarName != "") && ((actor.LastConEndTime > 0) || (bUseFamiliar)))
  10123.         displayName = actor.FamiliarName;
  10124.  
  10125.     if ((displayName == "") && (actor.UnfamiliarName != ""))
  10126.         displayName = actor.UnfamiliarName;
  10127.  
  10128.     if (displayName == "")
  10129.     {
  10130.         if (actor.IsA('DeusExDecoration'))
  10131.             displayName = DeusExDecoration(actor).itemName;
  10132.         else
  10133.             displayName = actor.BindName;
  10134.     }
  10135.  
  10136.     return displayName;
  10137. }
  10138.  
  10139. // ----------------------------------------------------------------------
  10140. // EndConversation()
  10141. //
  10142. // Called by ConPlay when a conversation has finished.
  10143. // ----------------------------------------------------------------------
  10144.  
  10145. function EndConversation()
  10146. {
  10147.     local DeusExLevelInfo info;
  10148.  
  10149.     Super.EndConversation();
  10150.  
  10151.     // If we're in a bForcePlay (cinematic) conversation,
  10152.     // force the CinematicWindow to be displayd
  10153.     if ((conPlay != None) && (conPlay.GetForcePlay()))
  10154.     {
  10155.         if (DeusExRootWindow(rootWindow) != None)
  10156.             DeusExRootWindow(rootWindow).NewChild(class'CinematicWindow');
  10157.     }
  10158.  
  10159.     conPlay = None;
  10160.  
  10161.     // Check to see if we need to resume any DataLinks that may have
  10162.     // been aborted when we started this conversation
  10163.     ResumeDataLinks();
  10164.  
  10165.     StopBlendAnims();
  10166.  
  10167.     // We might already be dead at this point (someone drop a LAM before
  10168.     // entering the conversation?) so we want to make sure the player
  10169.     // doesn't suddenly jump into a non-DEATH state.
  10170.     //
  10171.     // Also make sure the player is actually in the Conversation state
  10172.     // before attempting to kick him out of it.
  10173.  
  10174.     if ((Health > 0) && ((IsInState('Conversation')) || (IsInState('FirstPersonConversation')) || (NextState == 'Interpolating')))
  10175.     {
  10176.         if (NextState == '')
  10177.             GotoState('PlayerWalking');
  10178.         else
  10179.             GotoState(NextState);
  10180.     }
  10181. }
  10182.  
  10183. // ----------------------------------------------------------------------
  10184. // ResumeDataLinks()
  10185. // ----------------------------------------------------------------------
  10186.  
  10187. function ResumeDataLinks()
  10188. {
  10189.     if ( dataLinkPlay != None )
  10190.         dataLinkPlay.ResumeDataLinks();
  10191. }
  10192.  
  10193. // ----------------------------------------------------------------------
  10194. // AbortConversation()
  10195. // ----------------------------------------------------------------------
  10196.  
  10197. function AbortConversation(optional bool bNoPlayedFlag)
  10198. {
  10199.     if (conPlay != None)
  10200.         conPlay.TerminateConversation(False, bNoPlayedFlag);
  10201. }
  10202.  
  10203. // ----------------------------------------------------------------------
  10204. // StartConversationByName()
  10205. //
  10206. // Starts a conversation by looking for the name passed in.
  10207. //
  10208. // Calls StartConversation() if a match is found.
  10209. // ----------------------------------------------------------------------
  10210.  
  10211. function bool StartConversationByName(
  10212.     Name conName,
  10213.     Actor conOwner,
  10214.     optional bool bAvoidState,
  10215.     optional bool bForcePlay
  10216.     )
  10217. {
  10218.     local ConListItem conListItem;
  10219.     local Conversation con;
  10220.     local Int  dist;
  10221.     local Bool bConversationStarted;
  10222.  
  10223.     bConversationStarted = False;
  10224.  
  10225.     if (conOwner == None)
  10226.         return False;
  10227.  
  10228.     conListItem = ConListItem(conOwner.conListItems);
  10229.  
  10230.     while( conListItem != None )
  10231.     {
  10232.         if ( conListItem.con.conName == conName )
  10233.         {
  10234.             con = conListItem.con;
  10235.             break;
  10236.         }
  10237.  
  10238.         conListItem = conListItem.next;
  10239.     }
  10240.  
  10241.     // Now check to see that we're in a respectable radius.
  10242.     if (con != None)
  10243.     {
  10244.         dist = VSize(Location - conOwner.Location);
  10245.  
  10246.         // 800 = default sound radius, from unscript.cpp
  10247.         //
  10248.         // If "bForcePlay" is set, then force the conversation
  10249.         // to play!
  10250.  
  10251.         if ((dist <= 800) || (bForcePlay))
  10252.             bConversationStarted = StartConversation(conOwner, IM_Named, con, bAvoidState, bForcePlay);
  10253.     }
  10254.  
  10255.     return bConversationStarted;
  10256. }
  10257.  
  10258. // ----------------------------------------------------------------------
  10259. // StartAIBarkConversation()
  10260. //
  10261. // Starts an AI Bark conversation, which really isn't a conversation
  10262. // as much as a simple bark.
  10263. // ----------------------------------------------------------------------
  10264.  
  10265. function bool StartAIBarkConversation(
  10266.     Actor conOwner,
  10267.     EBarkModes barkMode
  10268.     )
  10269. {
  10270.     if ((conOwner == None) || (conOwner.conListItems == None) || (barkManager == None) ||
  10271.         ((conPlay != None) && (conPlay.con.bFirstPerson != True)))
  10272.         return False;
  10273.     else
  10274.         return (barkManager.StartBark(DeusExRootWindow(rootWindow), ScriptedPawn(conOwner), barkMode));
  10275. }
  10276.  
  10277. // ----------------------------------------------------------------------
  10278. // StartConversation()
  10279. //
  10280. // Checks to see if a valid conversation exists for this moment in time
  10281. // between the ScriptedPawn and the PC.  If so, then it triggers the
  10282. // conversation system and returns TRUE when finished.
  10283. // ----------------------------------------------------------------------
  10284.  
  10285. function bool StartConversation(
  10286.     Actor invokeActor,
  10287.     EInvokeMethod invokeMethod,
  10288.     optional Conversation con,
  10289.     optional bool bAvoidState,
  10290.     optional bool bForcePlay
  10291.     )
  10292. {
  10293.     local DeusExRootWindow root;
  10294.  
  10295.     root = DeusExRootWindow(rootWindow);
  10296.  
  10297.     // First check to see the actor has any conversations or if for some
  10298.     // other reason we're unable to start a conversation (typically if
  10299.     // we're alread in a conversation or there's a UI screen visible)
  10300.  
  10301.     if ((!bForcePlay) && ((invokeActor.conListItems == None) || (!CanStartConversation())))
  10302.         return False;
  10303.  
  10304.     // Make sure the other actor can converse
  10305.     if ((!bForcePlay) && ((ScriptedPawn(invokeActor) != None) && (!ScriptedPawn(invokeActor).CanConverse())))
  10306.         return False;
  10307.  
  10308.     // If we have a conversation passed in, use it.  Otherwise check to see
  10309.     // if the passed in actor actually has a valid conversation that can be
  10310.     // started.
  10311.  
  10312.     if ( con == None )
  10313.         con = GetActiveConversation(invokeActor, invokeMethod);
  10314.  
  10315.     // If we have a conversation, put the actor into "Conversation Mode".
  10316.     // Otherwise just return false.
  10317.     //
  10318.     // TODO: Scan through the conversation and put *ALL* actors involved
  10319.     //       in the conversation into the "Conversation" state??
  10320.  
  10321.     if ( con != None )
  10322.     {
  10323.         // Check to see if this conversation is already playing.  If so,
  10324.         // then don't start it again.  This prevents a multi-bark conversation
  10325.         // from being abused.
  10326.         if ((conPlay != None) && (conPlay.con == con))
  10327.             return False;
  10328.  
  10329.         // Now check to see if there's a conversation playing that is owned
  10330.         // by the InvokeActor *and* the player has a speaking part *and*
  10331.         // it's a first-person convo, in which case we want to abort here.
  10332.         if (((conPlay != None) && (conPlay.invokeActor == invokeActor)) &&
  10333.             (conPlay.con.bFirstPerson) &&
  10334.             (conPlay.con.IsSpeakingActor(Self)))
  10335.             return False;
  10336.  
  10337.         // Check if the person we're trying to start the conversation
  10338.         // with is a Foe and this is a Third-Person conversation.
  10339.         // If so, ABORT!
  10340.         if ((!bForcePlay) && ((!con.bFirstPerson) && (ScriptedPawn(invokeActor) != None) && (ScriptedPawn(invokeActor).GetPawnAllianceType(Self) == ALLIANCE_Hostile)))
  10341.             return False;
  10342.  
  10343.         // If the player is involved in this conversation, make sure the
  10344.         // scriptedpawn even WANTS to converse with the player.
  10345.         //
  10346.         // I have put a hack in here, if "con.bCanBeInterrupted"
  10347.         // (which is no longer used as intended) is set, then don't
  10348.         // call the ScriptedPawn::CanConverseWithPlayer() function
  10349.  
  10350.         if ((!bForcePlay) && ((con.IsSpeakingActor(Self)) && (!con.bCanBeInterrupted) && (ScriptedPawn(invokeActor) != None) && (!ScriptedPawn(invokeActor).CanConverseWithPlayer(Self))))
  10351.             return False;
  10352.  
  10353.         // Hack alert!  If this is a Bark conversation (as denoted by the
  10354.         // conversation name, since we don't have a field in ConEdit),
  10355.         // then force this conversation to be first-person
  10356.         if (Left(con.conName, Len(con.conOwnerName) + 5) == (con.conOwnerName $ "_Bark"))  //CyberP: we can make all conversations first person this way
  10357.             con.bFirstPerson = True;
  10358.  
  10359.         // Make sure the player isn't ducking.  If the player can't rise
  10360.         // to start a third-person conversation (blocked by geometry) then
  10361.         // immediately abort the conversation, as this can create all
  10362.         // sorts of complications (such as the player standing through
  10363.         // geometry!!)
  10364.  
  10365.         if ((!con.bFirstPerson) && (ResetBasedPawnSize() == False))
  10366.             return False;
  10367.  
  10368.         // If ConPlay exists, end the current conversation playing
  10369.         if (conPlay != None)
  10370.         {
  10371.             // If we're already playing a third-person conversation, don't interrupt with
  10372.             // another *radius* induced conversation (frobbing is okay, though).
  10373.             if ((conPlay.con != None) && (conPlay.con.bFirstPerson) && (invokeMethod == IM_Radius))
  10374.                 return False;
  10375.  
  10376.             conPlay.InterruptConversation();
  10377.             conPlay.TerminateConversation();
  10378.         }
  10379.  
  10380.         // If this is a first-person conversation _and_ a DataLink is already
  10381.         // playing, then abort.  We don't want to give the user any more
  10382.         // distractions while a DL is playing, since they're pretty important.
  10383.         if ( dataLinkPlay != None )
  10384.         {
  10385.             if (con.bFirstPerson)
  10386.                 return False;
  10387.             else
  10388.                 dataLinkPlay.AbortAndSaveHistory();
  10389.         }
  10390.  
  10391.         // Found an active conversation, so start it
  10392.         conPlay = Spawn(class'ConPlay');
  10393.         conPlay.SetStartActor(invokeActor);
  10394.         conPlay.SetConversation(con);
  10395.         conPlay.SetForcePlay(bForcePlay);
  10396.         conPlay.SetInitialRadius(VSize(Location - invokeActor.Location));
  10397.  
  10398.         // If this conversation was invoked with IM_Named, then save away
  10399.         // the current radius so we don't abort until we get outside
  10400.         // of this radius + 100.
  10401.         if ((invokeMethod == IM_Named) || (invokeMethod == IM_Frob))
  10402.         {
  10403.             conPlay.SetOriginalRadius(con.radiusDistance);
  10404.             con.radiusDistance = VSize(invokeActor.Location - Location);
  10405.         }
  10406.  
  10407.         // If the invoking actor is a ScriptedPawn, then force this person
  10408.         // into the conversation state
  10409.         if ((!bForcePlay) && (ScriptedPawn(invokeActor) != None ))
  10410.             ScriptedPawn(invokeActor).EnterConversationState(con.bFirstPerson, bAvoidState);
  10411.  
  10412.         // Do the same if this is a DeusExDecoration
  10413.         if ((!bForcePlay) && (DeusExDecoration(invokeActor) != None ))
  10414.             DeusExDecoration(invokeActor).EnterConversationState(con.bFirstPerson, bAvoidState);
  10415.  
  10416.         // If this is a third-person convo, we're pretty much going to
  10417.         // pause the game.  If this is a first-person convo, then just
  10418.         // keep on going..
  10419.         //
  10420.         // If this is a third-person convo *AND* 'bForcePlay' == True,
  10421.         // then use first-person mode, as we're playing an intro/endgame
  10422.         // sequence and we can't have the player in the convo state (bad bad bad!)
  10423.  
  10424.         if ((!con.bFirstPerson) && (!bForcePlay))
  10425.         {
  10426.             GotoState('Conversation');
  10427.         }
  10428.         else
  10429.         {
  10430.             if (!conPlay.StartConversation(Self, invokeActor, bForcePlay))
  10431.             {
  10432.                 AbortConversation(True);
  10433.             }
  10434.         }
  10435.  
  10436.         return True;
  10437.     }
  10438.     else
  10439.     {
  10440.         return False;
  10441.     }
  10442. }
  10443.  
  10444. // ----------------------------------------------------------------------
  10445. // GetActiveConversation()
  10446. //
  10447. // This routine searches all the conversations in this chain until it
  10448. // finds one that is valid for this situation.  It returns the
  10449. // conversation or None if none are found.
  10450. // ----------------------------------------------------------------------
  10451.  
  10452. function Conversation GetActiveConversation( Actor invokeActor, EInvokeMethod invokeMethod )
  10453. {
  10454.     local ConListItem conListItem;
  10455.     local Conversation con;
  10456.     local Name flagName;
  10457.     local bool bAbortConversation;
  10458.  
  10459.     // If we don't have a valid invokeActor or the flagbase
  10460.     // hasn't yet been initialized, immediately abort.
  10461.     if ((invokeActor == None) || (flagBase == None))
  10462.         return None;
  10463.  
  10464.     bAbortConversation = True;
  10465.  
  10466.     // Force there to be a one second minimum between conversations
  10467.     // with the same NPC
  10468.     if ((invokeActor.LastConEndTime != 0) &&
  10469.         ((Level.TimeSeconds - invokeActor.LastConEndTime) < 1.0))
  10470.         return None;
  10471.  
  10472.     // In a loop, go through the conversations, checking each.
  10473.     conListItem = ConListItem(invokeActor.ConListItems);
  10474.  
  10475.     while ( conListItem != None )
  10476.     {
  10477.         con = conListItem.con;
  10478.  
  10479.         bAbortConversation = False;
  10480.  
  10481.         // Ignore Bark conversations, as these are started manually
  10482.         // by the AI system.  Do this by checking to see if the first
  10483.         // part of the conversation name is in the form,
  10484.         //
  10485.         // ConversationOwner_Bark
  10486.  
  10487.         if (Left(con.conName, Len(con.conOwnerName) + 5) == (con.conOwnerName $ "_Bark"))
  10488.             bAbortConversation = True;
  10489.  
  10490.         if (!bAbortConversation)
  10491.         {
  10492.             // Now check the invocation method to make sure
  10493.             // it matches what was passed in
  10494.  
  10495.             switch( invokeMethod )
  10496.             {
  10497.                 // Removed Bump conversation starting functionality, all convos
  10498.                 // must now be "Frobbed" to start (excepting Radius, of course).
  10499.                 case IM_Bump:
  10500.                 case IM_Frob:
  10501.                     bAbortConversation = !(con.bInvokeFrob || con.bInvokeBump);
  10502.                     break;
  10503.  
  10504.                 case IM_Sight:
  10505.                     bAbortConversation = !con.bInvokeSight;
  10506.                     break;
  10507.  
  10508.                 case IM_Radius:
  10509.                     if ( con.bInvokeRadius )
  10510.                     {
  10511.                         // Calculate the distance between the player and the owner
  10512.                         // and if the player is inside that radius, we've passed
  10513.                         // this check.
  10514.  
  10515.                         bAbortConversation = !CheckConversationInvokeRadius(invokeActor, con);
  10516.  
  10517.                         // First check to make sure that at least 10 seconds have passed
  10518.                         // before playing a radius-induced conversation after a letterbox
  10519.                         // conversation with the player
  10520.                         //
  10521.                         // Check:
  10522.                         //
  10523.                         // 1.  Player finished letterbox convo in last 10 seconds
  10524.                         // 2.  Conversation was with this NPC
  10525.                         // 3.  This new radius conversation is with same NPC.
  10526.  
  10527.                         if ((!bAbortConversation) &&
  10528.                             ((Level.TimeSeconds - lastThirdPersonConvoTime) < 10) &&
  10529.                             (lastThirdPersonConvoActor == invokeActor))
  10530.                             bAbortConversation = True;
  10531.  
  10532.                         // Now check if this conversation ended in the last ten seconds or so
  10533.                         // We want to prevent the user from getting trapped inside the same
  10534.                         // radius conversation
  10535.  
  10536.                         if ((!bAbortConversation) && (con.lastPlayedTime > 0))
  10537.                             bAbortConversation = ((Level.TimeSeconds - con.lastPlayedTime) < 10);
  10538.  
  10539.                         // Now check to see if the player just ended a radius, third-person
  10540.                         // conversation with this NPC in the last 5 seconds.  If so, punt,
  10541.                         // because we don't want these to chain together too quickly.
  10542.  
  10543.                         if ((!bAbortConversation) &&
  10544.                             ((Level.TimeSeconds - lastFirstPersonConvoTime) < 5) &&
  10545.                             (lastFirstPersonConvoActor == invokeActor))
  10546.                             bAbortConversation = True;
  10547.                     }
  10548.                     else
  10549.                     {
  10550.                         bAbortConversation = True;
  10551.                     }
  10552.                     break;
  10553.  
  10554.                 case IM_Other:
  10555.                 default:
  10556.                     break;
  10557.             }
  10558.         }
  10559.  
  10560.         // Now check to see if these two actors are too far apart on their Z
  10561.         // axis so we don't get conversations triggered when someone jumps on
  10562.         // someone else, or when actors are on two different levels.
  10563.  
  10564.         if (!bAbortConversation)
  10565.         {
  10566.             bAbortConversation = !CheckConversationHeightDifference(invokeActor, 20);
  10567.  
  10568.             // If the height check failed, look to see if the actor has a LOS view
  10569.             // to the player in which case we'll allow the conversation to continue
  10570.  
  10571.             if (bAbortConversation)
  10572.                 bAbortConversation = !CanActorSeePlayer(invokeActor);
  10573.         }
  10574.  
  10575.         // Check if this conversation is only to be played once
  10576.         if (( !bAbortConversation ) && ( con.bDisplayOnce ))
  10577.         {
  10578.             flagName = rootWindow.StringToName(con.conName $ "_Played");
  10579.             bAbortConversation = (flagBase.GetBool(flagName) == True);
  10580.         }
  10581.  
  10582.         if ( !bAbortConversation )
  10583.         {
  10584.             // Then check to make sure all the flags that need to be
  10585.             // set are.
  10586.  
  10587.             bAbortConversation = !CheckFlagRefs(con.flagRefList);
  10588.         }
  10589.  
  10590.         if ( !bAbortConversation )
  10591.             break;
  10592.  
  10593.         conListItem = conListItem.next;
  10594.     }
  10595.  
  10596.     if (bAbortConversation)
  10597.         return None;
  10598.     else
  10599.         return con;
  10600. }
  10601.  
  10602. // ----------------------------------------------------------------------
  10603. // CheckConversationInvokeRadius()
  10604. //
  10605. // Returns True if this conversation can be invoked given the
  10606. // invoking actor and the conversation passed in.
  10607. // ----------------------------------------------------------------------
  10608.  
  10609. function bool CheckConversationInvokeRadius(Actor invokeActor, Conversation con)
  10610. {
  10611.     local Int  invokeRadius;
  10612.     local Int  dist;
  10613.  
  10614.     dist = VSize(Location - invokeActor.Location);
  10615.  
  10616.     invokeRadius = Max(16, con.radiusDistance);
  10617.  
  10618.     return (dist <= invokeRadius);
  10619. }
  10620.  
  10621. // ----------------------------------------------------------------------
  10622. // CheckConversationHeightDifference()
  10623. //
  10624. // Checks to make sure the player and the invokeActor are fairly close
  10625. // to each other on the Z Plane.  Returns True if they are an
  10626. // acceptable distance, otherwise returns False.
  10627. // ----------------------------------------------------------------------
  10628.  
  10629. function bool CheckConversationHeightDifference(Actor invokeActor, int heightOffset)
  10630. {
  10631.     local Int dist;
  10632.  
  10633.     dist = Abs(Location.Z - invokeActor.Location.Z) - Abs(Default.CollisionHeight - CollisionHeight);
  10634.  
  10635.     if (dist > (Abs(CollisionHeight - invokeActor.CollisionHeight) + heightOffset))
  10636.         return False;
  10637.     else
  10638.         return True;
  10639. }
  10640.  
  10641. // ----------------------------------------------------------------------
  10642. // CanActorSeePlayer()
  10643. // ----------------------------------------------------------------------
  10644.  
  10645. function bool CanActorSeePlayer(Actor invokeActor)
  10646. {
  10647.     return FastTrace(invokeActor.Location);
  10648. }
  10649.  
  10650. // ----------------------------------------------------------------------
  10651. // CheckActiveConversationRadius()
  10652. //
  10653. // If there's a first-person conversation active, checks to make sure
  10654. // that the player has not walked far away from the conversation owner.
  10655. // If so, the conversation is aborted.
  10656. // ----------------------------------------------------------------------
  10657.  
  10658. function CheckActiveConversationRadius()
  10659. {
  10660.     local int checkRadius;
  10661.  
  10662.     // Ignore if conPlay.GetForcePlay() returns True
  10663.  
  10664.     if ((conPlay != None) && (!conPlay.GetForcePlay()) && (conPlay.ConversationStarted()) && (conPlay.displayMode == DM_FirstPerson) && (conPlay.StartActor != None))
  10665.     {
  10666.         // If this was invoked via a radius, then check to make sure the player doesn't
  10667.         // exceed that radius plus
  10668.  
  10669.         if (conPlay.con.bInvokeRadius)
  10670.             checkRadius = conPlay.con.radiusDistance + 100;
  10671.         else
  10672.             checkRadius = 300;
  10673.  
  10674.         // Add the collisioncylinder since some objects are wider than others
  10675.         checkRadius += conPlay.StartActor.CollisionRadius;
  10676.  
  10677.         if (VSize(conPlay.startActor.Location - Location) > checkRadius)
  10678.         {
  10679.             // Abort the conversation
  10680.             conPlay.TerminateConversation(True);
  10681.         }
  10682.     }
  10683. }
  10684.  
  10685. // ----------------------------------------------------------------------
  10686. // CheckActorDistances()
  10687. //
  10688. // Checks to see how far all the actors are away from each other
  10689. // to make sure the conversation should continue.
  10690. // ----------------------------------------------------------------------
  10691.  
  10692. function bool CheckActorDistances()
  10693. {
  10694.     if ((conPlay != None) && (!conPlay.GetForcePlay()) && (conPlay.ConversationStarted()) && (conPlay.displayMode == DM_ThirdPerson))
  10695.     {
  10696.         if (!conPlay.con.CheckActorDistances(Self))
  10697.             conPlay.TerminateConversation(True);
  10698.     }
  10699. }
  10700.  
  10701. // ----------------------------------------------------------------------
  10702. // CheckFlagRefs()
  10703. //
  10704. // Loops through the flagrefs passed in and sees if the current flag
  10705. // settings in the game match this set of flags.  Returns True if so,
  10706. // otherwise False.
  10707. // ----------------------------------------------------------------------
  10708.  
  10709. function bool CheckFlagRefs( ConFlagRef flagRef )
  10710. {
  10711.     local ConFlagRef currentRef;
  10712.  
  10713.     // Loop through our list of FlagRef's, checking the value of each.
  10714.     // If we hit a bad match, then we'll stop right away since there's
  10715.     // no point of continuing.
  10716.  
  10717.     currentRef = flagRef;
  10718.  
  10719.     while( currentRef != None )
  10720.     {
  10721.         if ( flagBase.GetBool(currentRef.flagName) != currentRef.value )
  10722.             return False;
  10723.  
  10724.         currentRef = currentRef.nextFlagRef;
  10725.     }
  10726.  
  10727.     // If we made it this far, then the flags check out.
  10728.     return True;
  10729. }
  10730.  
  10731. // ----------------------------------------------------------------------
  10732. // StartDataLinkTransmission()
  10733. //
  10734. // Locates and starts the DataLink passed in
  10735. // ----------------------------------------------------------------------
  10736.  
  10737. function Bool StartDataLinkTransmission(
  10738.     String datalinkName,
  10739.     Optional DataLinkTrigger datalinkTrigger)
  10740. {
  10741.     local Conversation activeDataLink;
  10742.     local bool bDataLinkPlaySpawned;
  10743.  
  10744.     // Don't allow DataLinks to start if we're in PlayersOnly mode
  10745.     if ( Level.bPlayersOnly )
  10746.         return False;
  10747.  
  10748.     activeDataLink = GetActiveDataLink(datalinkName);
  10749.  
  10750.     if ( activeDataLink != None )
  10751.     {
  10752.         // Search to see if there's an active DataLinkPlay object
  10753.         // before creating one
  10754.  
  10755.         if ( dataLinkPlay == None )
  10756.         {
  10757.             datalinkPlay = Spawn(class'DataLinkPlay');
  10758.             bDataLinkPlaySpawned = True;
  10759.         }
  10760.  
  10761.         // Call SetConversation(), which returns
  10762.         if (datalinkPlay.SetConversation(activeDataLink))
  10763.         {
  10764.             datalinkPlay.SetTrigger(datalinkTrigger);
  10765.  
  10766.             if (datalinkPlay.StartConversation(Self))
  10767.             {
  10768.                 return True;
  10769.             }
  10770.             else
  10771.             {
  10772.                 // Datalink must already be playing, or in queue
  10773.                 if (bDataLinkPlaySpawned)
  10774.                 {
  10775.                     datalinkPlay.Destroy();
  10776.                     datalinkPlay = None;
  10777.                 }
  10778.  
  10779.                 return False;
  10780.             }
  10781.         }
  10782.         else
  10783.         {
  10784.             // Datalink must already be playing, or in queue
  10785.             if (bDataLinkPlaySpawned)
  10786.             {
  10787.                 datalinkPlay.Destroy();
  10788.                 datalinkPlay = None;
  10789.             }
  10790.             return False;
  10791.         }
  10792.     }
  10793.     else
  10794.     {
  10795.         return False;
  10796.     }
  10797. }
  10798.  
  10799. // ----------------------------------------------------------------------
  10800. // GetActiveDataLink()
  10801. //
  10802. // Loops through the conversations belonging to the player and checks
  10803. // to see if the datalink conversation passed in can be found.  Also
  10804. // checks to the "PlayedOnce" flag to prevent datalink transmissions
  10805. // from playing more than one (unless intended).
  10806. // ----------------------------------------------------------------------
  10807.  
  10808. function Conversation GetActiveDataLink(String datalinkName)
  10809. {
  10810.     local Name flagName;
  10811.     local ConListItem conListItem;
  10812.     local Conversation con;
  10813.     local bool bAbortDataLink;
  10814.     local bool bDatalinkFound;
  10815.     local bool bDataLinkNameFound;
  10816.  
  10817.     // Abort immediately if the flagbase isn't yet initialized
  10818.     if ((flagBase == None) || (rootWindow == None))
  10819.         return None;
  10820.  
  10821.     conListItem = ConListItem(conListItems);
  10822.  
  10823.     // In a loop, go through the conversations, checking each.
  10824.     while ( conListItem != None )
  10825.     {
  10826.         con = conListItem.con;
  10827.  
  10828.         if ( Caps(datalinkName) == Caps(con.conName) )
  10829.         {
  10830.             // Now check if this DataLink is only to be played
  10831.             // once
  10832.  
  10833.             bDataLinkNameFound = True;
  10834.             bAbortDataLink = False;
  10835.  
  10836.             if ( con.bDisplayOnce )
  10837.             {
  10838.                 flagName = rootWindow.StringToName(con.conName $ "_Played");
  10839.                 bAbortDataLink = (flagBase.GetBool(flagName) == True);
  10840.             }
  10841.  
  10842.             // Check the flags for this DataLink
  10843.             if (( !bAbortDataLink ) && ( CheckFlagRefs( con.flagRefList ) == True ))
  10844.             {
  10845.                 bDatalinkFound = True;
  10846.                 break;
  10847.             }
  10848.         }
  10849.         conListItem = conListItem.next;
  10850.     }
  10851.  
  10852.     if (bDatalinkFound)
  10853.     {
  10854.         return con;
  10855.     }
  10856.     else
  10857.     {
  10858.         // Print a warning if this DL couldn't be found based on its name
  10859.         if (bDataLinkNameFound == False)
  10860.         {
  10861.             log("WARNING! INFOLINK NOT FOUND!! Name = " $ datalinkName);
  10862.             ClientMessage("WARNING! INFOLINK NOT FOUND!! Name = " $ datalinkName);
  10863.         }
  10864.         return None;
  10865.     }
  10866. }
  10867.  
  10868. // ----------------------------------------------------------------------
  10869. // AddNote()
  10870. //
  10871. // Adds a new note to the list of notes the player is carrying around.
  10872. // ----------------------------------------------------------------------
  10873.  
  10874. function DeusExNote AddNote( optional String strNote, optional Bool bUserNote, optional bool bShowInLog )
  10875. {
  10876.     local DeusExNote newNote;
  10877.  
  10878.     newNote = new(Self) Class'DeusExNote';
  10879.  
  10880.     newNote.text = strNote;
  10881.     newNote.SetUserNote( bUserNote );
  10882.  
  10883.     // Insert this new note at the top of the notes list
  10884.     if (FirstNote == None)
  10885.         LastNote  = newNote;
  10886.     else
  10887.         newNote.next = FirstNote;
  10888.  
  10889.     FirstNote = newNote;
  10890.  
  10891.     // Optionally show the note in the log
  10892.     if ( bShowInLog )
  10893.     {
  10894.         ClientMessage(NoteAdded);
  10895.         DeusExRootWindow(rootWindow).hud.msgLog.PlayLogSound(Sound'LogNoteAdded');
  10896.     }
  10897.  
  10898.     return newNote;
  10899. }
  10900.  
  10901. // ----------------------------------------------------------------------
  10902. // GetNote()
  10903. //
  10904. // Loops through the notes and searches for the TextTag passed in
  10905. // ----------------------------------------------------------------------
  10906.  
  10907. function DeusExNote GetNote(Name textTag)
  10908. {
  10909.     local DeusExNote note;
  10910.  
  10911.     note = FirstNote;
  10912.  
  10913.     while( note != None )
  10914.     {
  10915.         if (note.textTag == textTag)
  10916.             break;
  10917.  
  10918.         note = note.next;
  10919.     }
  10920.  
  10921.     return note;
  10922. }
  10923.  
  10924. // ----------------------------------------------------------------------
  10925. // DeleteNote()
  10926. //
  10927. // Deletes the specified note
  10928. // Returns True if the note successfully deleted
  10929. // ----------------------------------------------------------------------
  10930.  
  10931. function Bool DeleteNote( DeusExNote noteToDelete )
  10932. {
  10933.     local DeusExNote note;
  10934.     local DeusExNote previousNote;
  10935.     local Bool bNoteDeleted;
  10936.  
  10937.     bNoteDeleted = False;
  10938.     note = FirstNote;
  10939.     previousNote = None;
  10940.  
  10941.     while( note != None )
  10942.     {
  10943.         if ( note == noteToDelete )
  10944.         {
  10945.             if ( note == FirstNote )
  10946.                 FirstNote = note.next;
  10947.  
  10948.             if ( note == LastNote )
  10949.                 LastNote = previousNote;
  10950.  
  10951.             if ( previousNote != None )
  10952.                 previousNote.next = note.next;
  10953.  
  10954.             note = None;
  10955.  
  10956.             bNoteDeleted = True;
  10957.             break;
  10958.         }
  10959.         previousNote = note;
  10960.         note = note.next;
  10961.     }
  10962.  
  10963.     return bNoteDeleted;
  10964. }
  10965.  
  10966. // ----------------------------------------------------------------------
  10967. // DeleteAllNotes()
  10968. //
  10969. // Deletes *ALL* Notes
  10970. // ----------------------------------------------------------------------
  10971.  
  10972. function DeleteAllNotes()
  10973. {
  10974.     local DeusExNote note;
  10975.     local DeusExNote noteNext;
  10976.  
  10977.     note = FirstNote;
  10978.  
  10979.     while( note != None )
  10980.     {
  10981.         noteNext = note.next;
  10982.         DeleteNote(note);
  10983.         note = noteNext;
  10984.     }
  10985.  
  10986.     FirstNote = None;
  10987.     LastNote = None;
  10988. }
  10989.  
  10990. // ----------------------------------------------------------------------
  10991. // NoteAdd()
  10992. // ----------------------------------------------------------------------
  10993.  
  10994. exec function NoteAdd( String noteText, optional bool bUserNote )
  10995. {
  10996.     local DeusExNote newNote;
  10997.  
  10998.     newNote = AddNote( noteText );
  10999.     newNote.SetUserNote( bUserNote );
  11000. }
  11001.  
  11002. // ----------------------------------------------------------------------
  11003. // AddGoal()
  11004. //
  11005. // Adds a new goal to the list of goals the player is carrying around.
  11006. // ----------------------------------------------------------------------
  11007.  
  11008. function DeusExGoal AddGoal( Name goalName, bool bPrimaryGoal )
  11009. {
  11010.     local DeusExGoal newGoal;
  11011.  
  11012.     // First check to see if this goal already exists.  If so, we'll just
  11013.     // return it.  Otherwise create a new goal
  11014.  
  11015.     newGoal = FindGoal( goalName );
  11016.  
  11017.     if ( newGoal == None )
  11018.     {
  11019.         newGoal = new(Self) Class'DeusExGoal';
  11020.         newGoal.SetName( goalName );
  11021.  
  11022.         // Insert goal at the Top so goals are displayed in
  11023.         // Newest order first.
  11024.         if (FirstGoal == None)
  11025.             LastGoal  = newGoal;
  11026.         else
  11027.             newGoal.next = FirstGoal;
  11028.  
  11029.         FirstGoal    = newGoal;
  11030.  
  11031.         newGoal.SetPrimaryGoal( bPrimaryGoal );
  11032.  
  11033.         ClientMessage(GoalAdded);
  11034.         DeusExRootWindow(rootWindow).hud.msgLog.PlayLogSound(Sound'LogGoalAdded');
  11035.     }
  11036.  
  11037.     return newGoal;
  11038. }
  11039.  
  11040. // ----------------------------------------------------------------------
  11041. // FindGoal()
  11042. // ----------------------------------------------------------------------
  11043.  
  11044. function DeusExGoal FindGoal( Name goalName )
  11045. {
  11046.     local DeusExGoal goal;
  11047.  
  11048.     goal = FirstGoal;
  11049.  
  11050.     while( goal != None )
  11051.     {
  11052.         if ( goalName == goal.goalName )
  11053.             break;
  11054.  
  11055.         goal = goal.next;
  11056.     }
  11057.  
  11058.     return goal;
  11059. }
  11060.  
  11061. // ----------------------------------------------------------------------
  11062. // GoalAdd()
  11063. //
  11064. // Adds a new goal to the list of goals the player is carrying around.
  11065. // ----------------------------------------------------------------------
  11066.  
  11067. exec function GoalAdd( Name goalName, String goalText, optional bool bPrimaryGoal )
  11068. {
  11069.     local DeusExGoal newGoal;
  11070.  
  11071.     if (!bCheatsEnabled)
  11072.         return;
  11073.  
  11074.     newGoal = AddGoal( goalName, bPrimaryGoal );
  11075.     newGoal.SetText( goalText );
  11076. }
  11077.  
  11078. // ----------------------------------------------------------------------
  11079. // GoalSetPrimary()
  11080. //
  11081. // Sets a goal as a Primary Goal
  11082. // ----------------------------------------------------------------------
  11083.  
  11084. exec function GoalSetPrimary( Name goalName, bool bPrimaryGoal )
  11085. {
  11086.     local DeusExGoal goal;
  11087.  
  11088.     if (!bCheatsEnabled)
  11089.         return;
  11090.  
  11091.     goal = FindGoal( goalName );
  11092.  
  11093.     if ( goal != None )
  11094.         goal.SetPrimaryGoal( bPrimaryGoal );
  11095. }
  11096.  
  11097. // ----------------------------------------------------------------------
  11098. // GoalCompleted()
  11099. //
  11100. // Looks up the goal and marks it as completed.
  11101. // ----------------------------------------------------------------------
  11102.  
  11103. function GoalCompleted( Name goalName )
  11104. {
  11105.     local DeusExGoal goal;
  11106.  
  11107.     // Loop through all the goals until we hit the one we're
  11108.     // looking for.
  11109.     goal = FindGoal( goalName );
  11110.  
  11111.     if ( goal != None )
  11112.     {
  11113.         // Only mark a goal as completed once!
  11114.         if (!goal.IsCompleted())
  11115.         {
  11116.             goal.SetCompleted();
  11117.             DeusExRootWindow(rootWindow).hud.msgLog.PlayLogSound(Sound'LogGoalCompleted');
  11118.  
  11119.             // Let the player know
  11120.             if ( goal.bPrimaryGoal )
  11121.                 ClientMessage(PrimaryGoalCompleted);
  11122.             else
  11123.                 ClientMessage(SecondaryGoalCompleted);
  11124.         }
  11125.     }
  11126. }
  11127.  
  11128. // ----------------------------------------------------------------------
  11129. // DeleteGoal()
  11130. //
  11131. // Deletes the specified note
  11132. // Returns True if the note successfully deleted
  11133. // ----------------------------------------------------------------------
  11134.  
  11135. function Bool DeleteGoal( DeusExGoal goalToDelete )
  11136. {
  11137.     local DeusExGoal goal;
  11138.     local DeusExGoal previousGoal;
  11139.     local Bool bGoalDeleted;
  11140.  
  11141.     bGoalDeleted = False;
  11142.     goal = FirstGoal;
  11143.     previousGoal = None;
  11144.  
  11145.     while( goal != None )
  11146.     {
  11147.         if ( goal == goalToDelete )
  11148.         {
  11149.             if ( goal == FirstGoal )
  11150.                 FirstGoal = goal.next;
  11151.  
  11152.             if ( goal == LastGoal )
  11153.                 LastGoal = previousGoal;
  11154.  
  11155.             if ( previousGoal != None )
  11156.                 previousGoal.next = goal.next;
  11157.  
  11158.             goal = None;
  11159.  
  11160.             bGoalDeleted = True;
  11161.             break;
  11162.         }
  11163.         previousGoal = goal;
  11164.         goal = goal.next;
  11165.     }
  11166.  
  11167.     return bGoalDeleted;
  11168. }
  11169.  
  11170. // ----------------------------------------------------------------------
  11171. // DeleteAllGoals()
  11172. //
  11173. // Deletes *ALL* Goals
  11174. // ----------------------------------------------------------------------
  11175.  
  11176. function DeleteAllGoals()
  11177. {
  11178.     local DeusExGoal goal;
  11179.     local DeusExGoal goalNext;
  11180.  
  11181.     goal = FirstGoal;
  11182.  
  11183.     while( goal != None )
  11184.     {
  11185.         goalNext = goal.next;
  11186.         DeleteGoal(goal);
  11187.         goal = goalNext;
  11188.     }
  11189.  
  11190.     FirstGoal = None;
  11191.     LastGoal = None;
  11192. }
  11193.  
  11194. // ----------------------------------------------------------------------
  11195. // ResetGoals()
  11196. //
  11197. // Called when progressing to the next mission.  Deletes all
  11198. // completed Primary Goals as well as *ALL* Secondary Goals
  11199. // (regardless of status)
  11200. // ----------------------------------------------------------------------
  11201.  
  11202. function ResetGoals()
  11203. {
  11204.     local DeusExGoal goal;
  11205.     local DeusExGoal goalNext;
  11206.  
  11207.     goal = FirstGoal;
  11208.  
  11209.     while( goal != None )
  11210.     {
  11211.         goalNext = goal.next;
  11212.  
  11213.         // Delete:
  11214.         // 1) Completed Primary Goals
  11215.         // 2) ALL Secondary Goals
  11216.  
  11217.         if ((!goal.IsPrimaryGoal()) || (goal.IsPrimaryGoal() && goal.IsCompleted()))
  11218.             DeleteGoal(goal);
  11219.  
  11220.         goal = goalNext;
  11221.     }
  11222. }
  11223.  
  11224. // ----------------------------------------------------------------------
  11225. // AddImage()
  11226. //
  11227. // Inserts a new image in the user's list of images.  First checks to
  11228. // make sure the player doesn't already have the image.  If not,
  11229. // sticks the image at the top of the list.
  11230. // ----------------------------------------------------------------------
  11231.  
  11232. function bool AddImage(DataVaultImage newImage)
  11233. {
  11234.     local DataVaultImage image;
  11235.  
  11236.     if (newImage == None)
  11237.         return False;
  11238.  
  11239.     // First make sure the player doesn't already have this image!!
  11240.     image = FirstImage;
  11241.     while(image != None)
  11242.     {
  11243.         if (newImage.imageDescription == image.imageDescription)
  11244.             return False;
  11245.  
  11246.         image = image.NextImage;
  11247.     }
  11248.  
  11249.     // If the player doesn't yet have an image, make this his
  11250.     // first image.
  11251.     newImage.nextImage = FirstImage;
  11252.     newImage.prevImage = None;
  11253.  
  11254.     if (FirstImage != None)
  11255.         FirstImage.prevImage = newImage;
  11256.  
  11257.     FirstImage = newImage;
  11258.  
  11259.     return True;
  11260. }
  11261.  
  11262. // ----------------------------------------------------------------------
  11263. // AddLog()
  11264. //
  11265. // Adds a log message to our FirstLog linked list
  11266. // ----------------------------------------------------------------------
  11267.  
  11268. function DeusExLog AddLog(String logText)
  11269. {
  11270.     local DeusExLog newLog;
  11271.  
  11272.     newLog = CreateLogObject();
  11273.     newLog.SetLogText(logText);
  11274.  
  11275.     // Add this Note to the list of player Notes
  11276.     if ( FirstLog != None )
  11277.         LastLog.next = newLog;
  11278.     else
  11279.         FirstLog = newLog;
  11280.  
  11281.     LastLog = newLog;
  11282.  
  11283.     return newLog;
  11284. }
  11285.  
  11286. // ----------------------------------------------------------------------
  11287. // ClearLog()
  11288. //
  11289. // Removes log objects
  11290. // ----------------------------------------------------------------------
  11291.  
  11292. function ClearLog()
  11293. {
  11294.     local DeusExLog log;
  11295.     local DeusExLog nextLog;
  11296.  
  11297.     log = FirstLog;
  11298.  
  11299.     while( log != None )
  11300.     {
  11301.         nextLog = log.next;
  11302.         CriticalDelete(log);
  11303.         log = nextLog;
  11304.     }
  11305.  
  11306.     FirstLog = None;
  11307.     LastLog  = None;
  11308. }
  11309.  
  11310. // ----------------------------------------------------------------------
  11311. // SetLogTimeout()
  11312. // ----------------------------------------------------------------------
  11313.  
  11314. function SetLogTimeout(Float newLogTimeout)
  11315. {
  11316.     logTimeout = newLogTimeout;
  11317.  
  11318.     // Update the HUD Log Display
  11319.     if (DeusExRootWindow(rootWindow).hud != None)
  11320.         DeusExRootWindow(rootWindow).hud.msgLog.SetLogTimeout(newLogTimeout);
  11321. }
  11322.  
  11323. // ----------------------------------------------------------------------
  11324. // GetLogTimeout()
  11325. // ----------------------------------------------------------------------
  11326.  
  11327. function Float GetLogTimeout()
  11328. {
  11329.     if (Level.NetMode == NM_Standalone)
  11330.       return logTimeout;
  11331.     else
  11332.       return (FMax(5.0,logTimeout));
  11333. }
  11334.  
  11335. // ----------------------------------------------------------------------
  11336. // SetMaxLogLines()
  11337. // ----------------------------------------------------------------------
  11338.  
  11339. function SetMaxLogLines(Byte newLogLines)
  11340. {
  11341.     maxLogLines = newLogLines;
  11342.  
  11343.     // Update the HUD Log Display
  11344.     if (DeusExRootWindow(rootWindow).hud != None)
  11345.         DeusExRootWindow(rootWindow).hud.msgLog.SetMaxLogLines(newLogLines);
  11346. }
  11347.  
  11348. // ----------------------------------------------------------------------
  11349. // GetMaxLogLines()
  11350. // ----------------------------------------------------------------------
  11351.  
  11352. function Byte GetMaxLogLines()
  11353. {
  11354.     return maxLogLines;
  11355. }
  11356.  
  11357. // ----------------------------------------------------------------------
  11358. // PopHealth() - This is used from the health screen (Medkits applied to body parts were not in sync with server)
  11359. // ----------------------------------------------------------------------
  11360.  
  11361. function PopHealth( float health0, float health1, float health2, float health3, float health4, float health5 )
  11362. {
  11363.     HealthHead     = health0;
  11364.     HealthTorso    = health1;
  11365.     HealthArmRight = health2;
  11366.     HealthArmLeft  = health3;
  11367.     HealthLegRight = health4;
  11368.     HealthLegLeft  = health5;
  11369. }
  11370.  
  11371. // ----------------------------------------------------------------------
  11372. // GenerateTotalHealth()
  11373. //
  11374. // this will calculate a weighted average of all of the body parts
  11375. // and put that value in the generic Health
  11376. // NOTE: head and torso are both critical
  11377. // ----------------------------------------------------------------------
  11378.  
  11379. function GenerateTotalHealth()
  11380. {
  11381.     local float ave, avecrit;
  11382.  
  11383.     ave = (HealthLegLeft + HealthLegRight + HealthArmLeft + HealthArmRight) / 4.0;
  11384.  
  11385.     if ((HealthHead <= 0) || (HealthTorso <= 0))
  11386.         avecrit = 0;
  11387.     else
  11388.         avecrit = (HealthHead + HealthTorso) / 2.0;
  11389.  
  11390.     if (avecrit == 0)
  11391.         Health = 0;
  11392.     else
  11393.         Health = (ave + avecrit) / 2.0; //GMDX: TODO: check mini display for colouring etc, max value=115
  11394. }
  11395.  
  11396.  
  11397. // ----------------------------------------------------------------------
  11398. // MultiplayerDeathMsg()
  11399. // ----------------------------------------------------------------------
  11400. function MultiplayerDeathMsg( Pawn killer, bool killedSelf, bool valid, String killerName, String killerMethod )
  11401. {
  11402.     local MultiplayerMessageWin mmw;
  11403.     local DeusExRootWindow          root;
  11404.  
  11405.     myKiller = killer;
  11406.     if ( killProfile != None )
  11407.     {
  11408.         killProfile.bKilledSelf = killedSelf;
  11409.         killProfile.bValid = valid;
  11410.     }
  11411.     root = DeusExRootWindow(rootWindow);
  11412.     if ( root != None )
  11413.     {
  11414.         mmw = MultiplayerMessageWin(root.InvokeUIScreen(Class'MultiplayerMessageWin', True));
  11415.         if ( mmw != None )
  11416.         {
  11417.             mmw.bKilled = true;
  11418.             mmw.killerName = killerName;
  11419.             mmw.killerMethod = killerMethod;
  11420.             mmw.bKilledSelf = killedSelf;
  11421.             mmw.bValidMethod = valid;
  11422.         }
  11423.     }
  11424. }
  11425.  
  11426. function ShowProgress()
  11427. {
  11428.     local MultiplayerMessageWin mmw;
  11429.     local DeusExRootWindow          root;
  11430.  
  11431.     root = DeusExRootWindow(rootWindow);
  11432.     if (root != None)
  11433.     {
  11434.       if (root.GetTopWindow() != None)
  11435.          mmw = MultiplayerMessageWin(root.GetTopWindow());
  11436.  
  11437.       if ((mmw != None) && (mmw.bDisplayProgress == false))
  11438.       {
  11439.          mmw.Destroy();
  11440.          mmw = None;
  11441.       }
  11442.       if ( mmw == None )
  11443.       {
  11444.          mmw = MultiplayerMessageWin(root.InvokeUIScreen(Class'MultiplayerMessageWin', True));
  11445.          if ( mmw != None )
  11446.          {
  11447.             mmw.bKilled = false;
  11448.             mmw.bDisplayProgress = true;
  11449.             mmw.lockoutTime = Level.TimeSeconds + 0.2;
  11450.          }
  11451.       }
  11452.     }
  11453. }
  11454.  
  11455. // ----------------------------------------------------------------------
  11456. // ServerConditionalNoitfyMsg
  11457. // ----------------------------------------------------------------------
  11458.  
  11459. function ServerConditionalNotifyMsg( int code, optional int param, optional string str )
  11460. {
  11461.     switch( code )
  11462.     {
  11463.         case MPMSG_FirstPoison:
  11464.             if ( (mpMsgServerFlags & MPSERVERFLAG_FirstPoison) == MPSERVERFLAG_FirstPoison )
  11465.                 return;
  11466.             else
  11467.                 mpMsgServerFlags = mpMsgServerFlags | MPSERVERFLAG_FirstPoison;
  11468.             break;
  11469.         case MPMSG_FirstBurn:
  11470.             if ( (mpMsgServerFlags & MPSERVERFLAG_FirstBurn) == MPSERVERFLAG_FirstBurn )
  11471.                 return;
  11472.             else
  11473.                 mpMsgServerFlags = mpMsgServerFlags | MPSERVERFLAG_FirstBurn;
  11474.             break;
  11475.         case MPMSG_TurretInv:
  11476.             if ( ( mpMsgServerFlags & MPSERVERFLAG_TurretInv ) == MPSERVERFLAG_TurretInv )
  11477.                 return;
  11478.             else
  11479.                 mpMsgServerFlags = mpMsgServerFlags | MPSERVERFLAG_TurretInv;
  11480.             break;
  11481.         case MPMSG_CameraInv:
  11482.             if ( ( mpMsgServerFlags & MPSERVERFLAG_CameraInv ) == MPSERVERFLAG_CameraInv )
  11483.                 return;
  11484.             else
  11485.                 mpMsgServerFlags = mpMsgServerFlags | MPSERVERFLAG_CameraInv;
  11486.             break;
  11487.         case MPMSG_LostLegs:
  11488.             if ( ( mpMsgServerFlags & MPSERVERFLAG_LostLegs) == MPSERVERFLAG_LostLegs )
  11489.                 return;
  11490.             else
  11491.                 mpMsgServerFlags = mpMsgServerFlags | MPSERVERFLAG_LostLegs;
  11492.             break;
  11493.         case MPMSG_DropItem:
  11494.             if ( ( mpMsgServerFlags & MPSERVERFLAG_DropItem) == MPSERVERFLAG_DropItem )
  11495.                 return;
  11496.             else
  11497.                 mpMsgServerFlags = mpMsgServerFlags | MPSERVERFLAG_DropItem;
  11498.             break;
  11499.         case MPMSG_NoCloakWeapon:
  11500.             if ( ( mpMsgServerFlags & MPSERVERFLAG_NoCloakWeapon) == MPSERVERFLAG_NoCloakWeapon )
  11501.                 return;
  11502.             else
  11503.                 mpMsgServerFlags = mpMsgServerFlags | MPSERVERFLAG_NoCloakWeapon;
  11504.             break;
  11505.     }
  11506.     // If we made it here we need to notify
  11507.     MultiplayerNotifyMsg( code, param, str );
  11508. }
  11509.  
  11510. // ----------------------------------------------------------------------
  11511. // MultiplayerNotifyMsg()
  11512. // ----------------------------------------------------------------------
  11513. function MultiplayerNotifyMsg( int code, optional int param, optional string str )
  11514. {
  11515.     if ( !bHelpMessages )
  11516.     {
  11517.         switch( code )
  11518.         {
  11519.             case MPMSG_TeamUnatco:
  11520.             case MPMSG_TeamNsf:
  11521.             case MPMSG_TeamHit:
  11522.             case MPMSG_TeamSpot:
  11523.             case MPMSG_FirstPoison:
  11524.             case MPMSG_FirstBurn:
  11525.             case MPMSG_TurretInv:
  11526.             case MPMSG_CameraInv:
  11527.             case MPMSG_LostLegs:
  11528.             case MPMSG_DropItem:
  11529.             case MPMSG_KilledTeammate:
  11530.             case MPMSG_TeamLAM:
  11531.             case MPMSG_TeamComputer:
  11532.             case MPMSG_NoCloakWeapon:
  11533.             case MPMSG_TeamHackTurret:
  11534.                 return;     // Pass on these
  11535.             case MPMSG_CloseKills:
  11536.             case MPMSG_TimeNearEnd:
  11537.                 break;      // Go ahead with these
  11538.         }
  11539.     }
  11540.  
  11541.     switch( code )
  11542.     {
  11543.         case MPMSG_TeamSpot:
  11544.             if ( (mpMsgFlags & MPFLAG_FirstSpot) == MPFLAG_FirstSpot )
  11545.                 return;
  11546.             else
  11547.                 mpMsgFlags = mpMsgFlags | MPFLAG_FirstSpot;
  11548.             break;
  11549.         case MPMSG_CloseKills:
  11550.             if ((param == 0) || (str ~= ""))
  11551.             {
  11552.                 log("Warning: Passed bad params to multiplayer notify msg." );
  11553.                 return;
  11554.             }
  11555.             mpMsgOptionalParam = param;
  11556.             mpMsgOptionalString = str;
  11557.             break;
  11558.         case MPMSG_TimeNearEnd:
  11559.             if ((param == 0) || (str ~= ""))
  11560.             {
  11561.                 log("Warning: Passed bad params to multiplayer notify msg." );
  11562.                 return;
  11563.             }
  11564.             mpMsgOptionalParam = param;
  11565.             mpMsgOptionalString = str;
  11566.             break;
  11567.         case MPMSG_DropItem:
  11568.         case MPMSG_TeamUnatco:
  11569.         case MPMSG_TeamNsf:
  11570.             if (( DeusExRootWindow(rootWindow) != None ) && ( DeusExRootWindow(rootWindow).hud != None ) && (DeusExRootWindow(rootWindow).hud.augDisplay != None ))
  11571.                 DeusExRootWindow(rootWindow).hud.augDisplay.RefreshMultiplayerKeys();
  11572.             break;
  11573.     }
  11574.     mpMsgCode = code;
  11575.     mpMsgTime = Level.Timeseconds + mpMsgDelay;
  11576.     if (( code == MPMSG_TeamUnatco ) || ( code == MPMSG_TeamNsf ))
  11577.         mpMsgTime += 2.0;
  11578. }
  11579.  
  11580.  
  11581. //
  11582. // GetSkillInfoFromProjKiller
  11583. //
  11584. function GetSkillInfoFromProj( DeusExPlayer killer, Actor proj )
  11585. {
  11586.     local class<Skill> skill${1}< ${3} >
  11587.  
  11588.     if ( proj.IsA('GasGrenade') || proj.IsA('LAM') || proj.IsA('EMPGrenade') || proj.IsA('TearGas'))
  11589.         skillClass = class'SkillDemolition';
  11590.     else if ( proj.IsA('Rocket') || proj.IsA('RocketLAW') || proj.IsA('RocketWP') || proj.IsA('Fireball') || proj.IsA('PlasmaBolt') || proj.IsA('PlasmaGamma'))
  11591.         skillClass = class'SkillWeaponHeavy';
  11592.     else if ( proj.IsA('Dart') || proj.IsA('DartFlare') || proj.IsA('DartPoison') || proj.IsA('Shuriken'))
  11593.         skillClass = class'SkillWeaponLowTech';
  11594.     else if ( proj.IsA('HECannister20mm') || proj.IsA('SpiderConstructorLaunched2') || proj.IsA('RubberBullet'))
  11595.         skillClass = class'SkillWeaponRifle';
  11596.     else if ( proj.IsA('DeusExDecoration') )
  11597.     {
  11598.         killProfile.activeSkill = NoneString;
  11599.         killProfile.activeSkillLevel = 0;
  11600.         return;
  11601.     }
  11602.     if ( killer.SkillSystem != None )
  11603.     {
  11604.         killProfile.activeSkill = skillClass.Default.skillName;
  11605.         killProfile.activeSkillLevel = killer.SkillSystem.GetSkillLevel(skillClass);
  11606.     }
  11607. }
  11608.  
  11609. function GetWeaponName( DeusExWeapon w, out String name )
  11610. {
  11611.     if ( w != None )
  11612.     {
  11613.         if ( WeaponGEPGun(w) != None )
  11614.             name = WeaponGEPGun(w).shortName;
  11615.         else if ( WeaponLAM(w) != None )
  11616.             name = WeaponLAM(w).shortName;
  11617.         else
  11618.             name = w.itemName;
  11619.     }
  11620.     else
  11621.         name = NoneString;
  11622. }
  11623.  
  11624. //
  11625. // CreateKillerProfile
  11626. //
  11627. function CreateKillerProfile( Pawn killer, int damage, name damageType, String bodyPart )
  11628. {
  11629.     local DeusExPlayer pkiller;
  11630.     local DeusExProjectile proj;
  11631.     local DeusExDecoration decProj;
  11632.     local Augmentation anAug;
  11633.     local int augCnt;
  11634.     local DeusExWeapon w;
  11635.     local Skill askill;
  11636.     local String wShortString;
  11637.  
  11638.     if ( killProfile == None )
  11639.     {
  11640.         log("Warning:"$Self$" has a killProfile that is None!" );
  11641.         return;
  11642.     }
  11643.     else
  11644.         killProfile.Reset();
  11645.  
  11646.     pkiller = DeusExPlayer(killer);
  11647.  
  11648.     if ( pkiller != None )
  11649.     {
  11650.         killProfile.bValid = True;
  11651.         killProfile.name = pkiller.PlayerReplicationInfo.PlayerName;
  11652.         w = DeusExWeapon(pkiller.inHand);
  11653.         GetWeaponName( w, killProfile.activeWeapon );
  11654.  
  11655.         // What augs the killer was using
  11656.         if ( pkiller.AugmentationSystem != None )
  11657.         {
  11658.             killProfile.numActiveAugs = pkiller.AugmentationSystem.NumAugsActive();
  11659.             augCnt = 0;
  11660.             anAug = pkiller.AugmentationSystem.FirstAug;
  11661.             while ( anAug != None )
  11662.             {
  11663.                 if ( anAug.bHasIt && anAug.bIsActive && !anAug.bAlwaysActive && (augCnt < ArrayCount(killProfile.activeAugs)))
  11664.                 {
  11665.                     killProfile.activeAugs[augCnt] = anAug.augmentationName;
  11666.                     augCnt += 1;
  11667.                 }
  11668.                 anAug = anAug.next;
  11669.             }
  11670.         }
  11671.         else
  11672.             killProfile.numActiveAugs = 0;
  11673.  
  11674.         // My weapon and skill
  11675.         GetWeaponName( DeusExWeapon(inHand), killProfile.myActiveWeapon );
  11676.         if ( DeusExWeapon(inHand) != None )
  11677.         {
  11678.             if ( SkillSystem != None )
  11679.             {
  11680.                 askill = SkillSystem.GetSkillFromClass(DeusExWeapon(inHand).GoverningSkill);
  11681.                 killProfile.myActiveSkill = askill.skillName;
  11682.                 killProfile.myActiveSkillLevel = askill.CurrentLevel;
  11683.             }
  11684.         }
  11685.         else
  11686.         {
  11687.             killProfile.myActiveWeapon = NoneString;
  11688.             killProfile.myActiveSkill = NoneString;
  11689.             killProfile.myActiveSkillLevel = 0;
  11690.         }
  11691.         // Fill in my own active augs
  11692.         if ( AugmentationSystem != None )
  11693.         {
  11694.             killProfile.myNumActiveAugs = AugmentationSystem.NumAugsActive();
  11695.             augCnt = 0;
  11696.             anAug = AugmentationSystem.FirstAug;
  11697.             while ( anAug != None )
  11698.             {
  11699.                 if ( anAug.bHasIt && anAug.bIsActive && !anAug.bAlwaysActive && (augCnt < ArrayCount(killProfile.myActiveAugs)))
  11700.                 {
  11701.                     killProfile.myActiveAugs[augCnt] = anAug.augmentationName;
  11702.                     augCnt += 1;
  11703.                 }
  11704.                 anAug = anAug.next;
  11705.             }
  11706.         }
  11707.         killProfile.streak = (pkiller.PlayerReplicationInfo.Streak + 1);
  11708.         killProfile.healthLow = pkiller.HealthLegLeft;
  11709.         killProfile.healthMid =  pkiller.HealthTorso;
  11710.         killProfile.healthHigh = pkiller.HealthHead;
  11711.         killProfile.remainingBio = pkiller.Energy;
  11712.         killProfile.damage = damage;
  11713.         killProfile.bodyLoc = bodyPart;
  11714.         killProfile.killerLoc = pkiller.Location;
  11715.     }
  11716.     else
  11717.     {
  11718.         killProfile.bValid = False;
  11719.         return;
  11720.     }
  11721.  
  11722.     killProfile.methodStr = NoneString;
  11723.  
  11724.     switch( damageType )
  11725.     {
  11726.         case 'AutoShot':
  11727.             killProfile.methodStr = WithTheString $ AutoTurret(myTurretKiller).titleString  $ "!";
  11728.             killProfile.bTurretKilled = True;
  11729.             killProfile.killerLoc = AutoTurret(myTurretKiller).Location;
  11730.             if ( pkiller.SkillSystem != None )
  11731.             {
  11732.                 killProfile.activeSkill = class'SkillComputer'.Default.skillName;
  11733.                 killProfile.activeSkillLevel = pkiller.SkillSystem.GetSkillLevel(class'SkillComputer');
  11734.             }
  11735.             break;
  11736.         case 'PoisonEffect':
  11737.             killProfile.methodStr = PoisonString $ "!";
  11738.             killProfile.bPoisonKilled = True;
  11739.             killProfile.activeSkill = NoneString;
  11740.             killProfile.activeSkillLevel = 0;
  11741.             break;
  11742.         case 'Burned':
  11743.         case 'Flamed':
  11744.             if (( WeaponPlasmaRifle(w) != None ) || ( WeaponFlamethrower(w) != None ))
  11745.             {
  11746.                 // Use the weapon if it's still in hand
  11747.             }
  11748.             else
  11749.             {
  11750.                 killProfile.methodStr = BurnString $ "!";
  11751.                 killProfile.bBurnKilled = True;
  11752.                 killProfile.activeSkill = NoneString;
  11753.                 killProfile.activeSkillLevel = 0;
  11754.             }
  11755.             break;
  11756.     }
  11757.     if ( killProfile.methodStr ~= NoneString )
  11758.     {
  11759.         proj = DeusExProjectile(myProjKiller);
  11760.         decProj = DeusExDecoration(myProjKiller);
  11761.  
  11762.         if (( killer != None ) && (proj != None) && (!(proj.itemName ~= "")) )
  11763.         {
  11764.             if ( (LAM(myProjKiller) != None) && (LAM(myProjKiller).bProximityTriggered) )
  11765.             {
  11766.                 killProfile.bProximityKilled = True;
  11767.                 killProfile.killerLoc = LAM(myProjKiller).Location;
  11768.                 killProfile.myActiveSkill = class'SkillDemolition'.Default.skillName;
  11769.                 if ( SkillSystem != None )
  11770.                     killProfile.myActiveSkillLevel = SkillSystem.GetSkillLevel(class'SkillDemolition');
  11771.                 else
  11772.                     killProfile.myActiveSkillLevel = 0;
  11773.             }
  11774.             else
  11775.                 killProfile.bProjKilled = True;
  11776.             killProfile.methodStr = WithString $ proj.itemArticle $ " " $ proj.itemName $ "!";
  11777.             GetSkillInfoFromProj( pkiller, myProjKiller );
  11778.         }
  11779.         else if (( killer != None ) && ( decProj != None ) && (!(decProj.itemName ~= "" )) )
  11780.         {
  11781.             killProfile.methodStr = WithString $ decProj.itemArticle $ " " $ decProj.itemName $ "!";
  11782.             killProfile.bProjKilled = True;
  11783.             GetSkillInfoFromProj( pkiller, myProjKiller );
  11784.         }
  11785.         else if ((killer != None) && (w != None))
  11786.         {
  11787.             GetWeaponName( w, wShortString );
  11788.             killProfile.methodStr = WithString $ w.itemArticle $ " " $ wShortString $ "!";
  11789.             askill = pkiller.SkillSystem.GetSkillFromClass(w.GoverningSkill);
  11790.             killProfile.activeSkill = askill.skillName;
  11791.             killProfile.activeSkillLevel = askill.CurrentLevel;
  11792.         }
  11793.         else
  11794.             log("Warning: Failed to determine killer method killer:"$killer$" damage:"$damage$" damageType:"$damageType$" " );
  11795.     }
  11796.     // If we still failed dump this to log, and I'll see if there's a condition slipping through...
  11797.     if ( killProfile.methodStr ~= NoneString )
  11798.     {
  11799.         log("===>Warning: Failed to get killer method:"$Self$" damageType:"$damageType$" " );
  11800.         killProfile.bValid = False;
  11801.     }
  11802. }
  11803.  
  11804. // ----------------------------------------------------------------------
  11805. // TakeDamage()
  11806. // ----------------------------------------------------------------------
  11807.  
  11808. function TakeDamage(int Damage, Pawn instigatedBy, Vector hitlocation, Vector momentum, name damageType)
  11809. {
  11810.     local int actualDamage;
  11811.     local bool bAlreadyDead, bPlayAnim, bDamageGotReduced;
  11812.     local Vector offset, dst;
  11813.     local float headOffsetZ, headOffsetY, armOffset;
  11814.     local float origHealth, fdst;
  11815.     local DeusExLevelInfo info;
  11816.     local DeusExWeapon dxw;
  11817.     local String bodyString;
  11818.     local int MPHitLoc;
  11819.     local GMDXFlickerLight lightFlicker;
  11820.     local float augLVL;
  11821.     local DeusExRootWindow root;
  11822.     local GMDXImpactSpark AST;
  11823.  
  11824.     if ( bNintendoImmunity )
  11825.         return;
  11826.  
  11827.     bodyString = "";
  11828.     origHealth = Health;
  11829.  
  11830.     if (Level.NetMode != NM_Standalone)
  11831.       Damage *= MPDamageMult;
  11832.     else if (damageType=='Drowned')
  11833.     {
  11834.       if (PerkNamesArray[5]!=1)
  11835.       drugEffectTimer += 3.5; //freak player :)
  11836.       Damage=12; //GMDX mod drowning damage, taked that hard coded 5hpts
  11837.     }
  11838.  
  11839. //log("MYCHK DXP_TD:"@self@"take damage in state"@GetStateName()@" : "@Damage@" : "@damageType@" : "@instigatedBy);
  11840.  
  11841.     // use the hitlocation to determine where the pawn is hit
  11842.     // transform the worldspace hitlocation into objectspace
  11843.     // in objectspace, remember X is front to back
  11844.     // Y is side to side, and Z is top to bottom
  11845.     offset = (hitLocation - Location) << Rotation;
  11846.  
  11847.     // add a HUD icon for this damage type
  11848.     if ((damageType == 'Poison') || (damageType == 'PoisonEffect'))  // hack
  11849.         AddDamageDisplay('PoisonGas', offset);
  11850.     else
  11851.         AddDamageDisplay(damageType, offset);
  11852.  
  11853.     // nanovirus damage doesn't affect us
  11854.     if (damageType == 'NanoVirus')
  11855.         return;
  11856.  
  11857.     // handle poison
  11858.     if ((damageType == 'Poison') || ((Level.NetMode != NM_Standalone) && (damageType=='TearGas')) )
  11859.     {
  11860.         // Notify player if they're getting burned for the first time
  11861.         if ( Level.NetMode != NM_Standalone )
  11862.             ServerConditionalNotifyMsg( MPMSG_FirstPoison );
  11863.  
  11864.         StartPoison( instigatedBy, Damage );
  11865.     }
  11866.  
  11867.     // reduce our damage correctly
  11868.     if (ReducedDamageType == damageType)
  11869.         actualDamage = float(actualDamage) * (1.0 - ReducedDamagePct);
  11870.  
  11871.     // check for augs or inventory items
  11872.     bDamageGotReduced = DXReduceDamage(Damage, damageType, hitLocation, actualDamage, False);
  11873.  
  11874.     /// DEUS_EX AMSD Multiplayer shield
  11875.     if (Level.NetMode != NM_Standalone)
  11876.       if (bDamageGotReduced)
  11877.       {
  11878.          ShieldStatus = SS_Strong;
  11879.          ShieldTimer = 1.0;
  11880.       }
  11881.  
  11882.     if (ReducedDamageType == 'All') //God mode
  11883.         actualDamage = 0;
  11884.  
  11885.     //CyberP: add flinch effects
  11886.     if ((DamageType == 'Shot' || DamageType == 'AutoShot' || DamageType == 'Shocked'))
  11887.     {
  11888.        if (inHand != None && inHand.IsA('DeusExWeapon') && !DeusExWeapon(inHand).bFiring && FRand() < 0.18)
  11889.        {
  11890.        if (AugmentationSystem != None)
  11891.             augLVL = AugmentationSystem.GetAugLevelValue(class'AugBallistic');
  11892.          if (AugmentationSystem != None && augLVL >= 0.0)
  11893.          {
  11894.          }
  11895.          else
  11896.          {
  11897.         RecoilTime=default.RecoilTime;
  11898.         RecoilShake.Z-=lerp(min(Abs(ActualDamage),2.0*ActualDamage)/(1.0*ActualDamage),0,4.0); //CyberP: 7
  11899.         RecoilShake.Y-=lerp(min(Abs(ActualDamage),2.0*ActualDamage)/(1.0*ActualDamage),0,3.0);
  11900.         RecoilShaker(vect(1,2,-2));
  11901.          }
  11902.        }
  11903.        if (inHand != None && inHand.IsA('WeaponSword'))
  11904.         {
  11905.           if ((DamageType == 'Shot' || DamageType == 'AutoShot') && FRand() < 0.03)
  11906.            {
  11907.            PlaySound(sound'bouncemetal',SLOT_None);
  11908.            actualDamage = 0;
  11909.            return;
  11910.            }
  11911.         }
  11912.     }
  11913.     // Multiplayer only code
  11914.     if ( Level.NetMode != NM_Standalone )
  11915.     {
  11916.         if ( ( instigatedBy != None ) && (instigatedBy.IsA('DeusExPlayer')) )
  11917.         {
  11918.             // Special case the sniper rifle
  11919.             if ((DeusExPlayer(instigatedBy).Weapon != None) && ( DeusExPlayer(instigatedBy).Weapon.class == class'WeaponRifle' ))
  11920.             {
  11921.                 dxw = DeusExWeapon(DeusExPlayer(instigatedBy).Weapon);
  11922.                 if ( (dxw != None ) && ( !dxw.bZoomed ))
  11923.                     actualDamage *= WeaponRifle(dxw).mpNoScopeMult; // Reduce damage if we're not using the scope
  11924.             }
  11925.             if ( (TeamDMGame(DXGame) != None) && (TeamDMGame(DXGame).ArePlayersAllied(DeusExPlayer(instigatedBy),Self)) )
  11926.             {
  11927.                 // Don't notify if the player hurts themselves
  11928.                 if ( DeusExPlayer(instigatedBy) != Self )
  11929.                 {
  11930.                     actualDamage *= TeamDMGame(DXGame).fFriendlyFireMult;
  11931.                     if (( damageType != 'TearGas' ) && ( damageType != 'PoisonEffect' ))
  11932.                         DeusExPlayer(instigatedBy).MultiplayerNotifyMsg( MPMSG_TeamHit );
  11933.                 }
  11934.             }
  11935.  
  11936.         }
  11937.     }
  11938.  
  11939.     // EMP attacks drain BE energy
  11940.     if (damageType == 'EMP')
  11941.     {
  11942.         EnergyDrain += actualDamage;
  11943.         EnergyDrainTotal += actualDamage;
  11944.         PlayTakeHitSound(actualDamage, damageType, 1);
  11945.         if ((damageType == 'EMP') && (damage > 25))
  11946.         {
  11947.         PlaySound(sound'CloakDown', SLOT_None,,,,2.0);
  11948.         PlaySound(sound'tinnitus', SLOT_None);
  11949.         ClientFlash(800000,vect(255,255,255));
  11950.         IncreaseClientFlashLength(4);
  11951.         ShowHud(false);
  11952.         return;
  11953.         }
  11954.     }
  11955.  
  11956.     if (damageType == 'Exploded' || damageType == 'Shocked')
  11957.     {
  11958.        if (AugmentationSystem != None)
  11959.        {
  11960.          if (AugmentationSystem.GetAugLevelValue(class'AugShield') == -1.0 && PerkNamesArray[6] != 1)
  11961.          {
  11962.            bStunted = True;
  11963.            SetTimer(0.4,false);
  11964.          }
  11965.        }
  11966.     }
  11967.  
  11968.     bPlayAnim = True;
  11969.  
  11970.     // if we're burning, don't play a hit anim when taking burning damage
  11971.     if (damageType == 'Burned')
  11972.         bPlayAnim = False;
  11973.  
  11974.     if (Physics == PHYS_None)
  11975.         SetMovementPhysics();
  11976.     if (Physics == PHYS_Walking)
  11977.         momentum.Z = 0.4 * VSize(momentum);
  11978.     if ( instigatedBy == self )
  11979.         momentum *= 0.6;
  11980.     momentum = momentum/Mass;
  11981.     //  AddVelocity( momentum );    // doesn't do anything anyway
  11982.  
  11983.     // calculate our hit extents
  11984.     headOffsetZ = CollisionHeight * 0.78;
  11985.     headOffsetY = CollisionRadius * 0.35;
  11986.     armOffset = CollisionRadius * 0.35;
  11987.  
  11988.     // We decided to just have 3 hit locations in multiplayer MBCODE
  11989.     if (( Level.NetMode == NM_DedicatedServer ) || ( Level.NetMode == NM_ListenServer ))
  11990.     {
  11991.         MPHitLoc = GetMPHitLocation(HitLocation);
  11992.  
  11993.         if (MPHitLoc == 0)
  11994.             return;
  11995.         else if (MPHitLoc == 1 )
  11996.         {
  11997.             // MP Headshot is 2x damage
  11998.             // narrow the head region
  11999.             actualDamage *= 2;
  12000.             HealthHead -= actualDamage;
  12001.             bodyString = HeadString;
  12002.             if (bPlayAnim)
  12003.                 PlayAnim('HitHead', , 0.1);
  12004.         }
  12005.         else if ((MPHitLoc == 3) || (MPHitLoc == 4))    // Leg region
  12006.         {
  12007.             HealthLegRight -= actualDamage;
  12008.             HealthLegLeft -= actualDamage;
  12009.  
  12010.             if (MPHitLoc == 4)
  12011.             {
  12012.                 if (bPlayAnim)
  12013.                     PlayAnim('HitLegRight', , 0.1);
  12014.             }
  12015.             else if (MPHitLoc == 3)
  12016.             {
  12017.                 if (bPlayAnim)
  12018.                     PlayAnim('HitLegLeft', , 0.1);
  12019.             }
  12020.             // Since the legs are in sync only bleed up damage from one leg (otherwise it's double damage)
  12021.             if (HealthLegLeft < 0)
  12022.             {
  12023.                 HealthArmRight += HealthLegLeft;
  12024.                 HealthTorso += HealthLegLeft;
  12025.                 HealthArmLeft += HealthLegLeft;
  12026.                 bodyString = TorsoString;
  12027.                 HealthLegLeft = 0;
  12028.                 HealthLegRight = 0;
  12029.             }
  12030.         }
  12031.         else // arms and torso now one region
  12032.         {
  12033.             HealthArmLeft -= actualDamage;
  12034.             HealthTorso -= actualDamage;
  12035.             HealthArmRight -= actualDamage;
  12036.  
  12037.             bodyString = TorsoString;
  12038.  
  12039.             if (MPHitLoc == 6)
  12040.             {
  12041.                 if (bPlayAnim)
  12042.                     PlayAnim('HitArmRight', , 0.1);
  12043.             }
  12044.             else if (MPHitLoc == 5)
  12045.             {
  12046.                 if (bPlayAnim)
  12047.                     PlayAnim('HitArmLeft', , 0.1);
  12048.             }
  12049.             else
  12050.             {
  12051.                 if (bPlayAnim)
  12052.                     PlayAnim('HitTorso', , 0.1);
  12053.             }
  12054.         }
  12055.     }
  12056.     else // Normal damage code path for single player
  12057.     {
  12058.         if (offset.z > headOffsetZ)     // head
  12059.         {
  12060.             // narrow the head region
  12061.             if ((Abs(offset.x) < headOffsetY) || (Abs(offset.y) < headOffsetY))
  12062.             {
  12063.                 HealthHead -= actualDamage * 2;
  12064.                 if (bPlayAnim)
  12065.                     PlayAnim('HitHead', , 0.1);
  12066.                     // elec effect
  12067.     if (damageType == 'Shocked' && AST == None)
  12068.     {
  12069.     root = DeusExRootWindow(rootWindow);
  12070.         if ((root != None) && (root.hud != None))
  12071.         {
  12072.             if (root.hud.background == None)
  12073.             {
  12074.  
  12075.                 root.hud.SetBackground(Texture'Wepn_Prod_FX');
  12076.                 //root.hud.SetBackgroundSmoothing(True);
  12077.                 root.hud.SetBackgroundStretching(True);
  12078.                 root.hud.SetBackgroundStyle(DSTY_Translucent);
  12079.                 AST=Spawn(class'GMDXImpactSpark');
  12080.           if (AST != None)
  12081.           {
  12082.           AST.LifeSpan=4.000000;
  12083.           AST.DrawScale=0.000001;
  12084.           AST.Velocity=vect(0,0,0);
  12085.           AST.AmbientSound=Sound'Ambient.Ambient.Electricity3';
  12086.           AST.SoundVolume=224;
  12087.           AST.SoundRadius=64;
  12088.           AST.SoundPitch=80;
  12089.           }
  12090.             }
  12091.         }
  12092.     }
  12093.             }
  12094.         }
  12095.         else if (offset.z < 0.0)    // legs
  12096.         {
  12097.             if (offset.y > 0.0)
  12098.             {
  12099.                 HealthLegRight -= actualDamage;
  12100.                 if (bPlayAnim)
  12101.                     PlayAnim('HitLegRight', , 0.1);
  12102.             }
  12103.             else
  12104.             {
  12105.                 HealthLegLeft -= actualDamage;
  12106.                 if (bPlayAnim)
  12107.                     PlayAnim('HitLegLeft', , 0.1);
  12108.             }
  12109.  
  12110.             // if this part is already dead, damage the adjacent part
  12111.             if ((HealthLegRight < 0) && (HealthLegLeft > 0))
  12112.             {
  12113.                 HealthLegLeft += HealthLegRight;
  12114.                 HealthLegRight = 0;
  12115.             }
  12116.             else if ((HealthLegLeft < 0) && (HealthLegRight > 0))
  12117.             {
  12118.                 HealthLegRight += HealthLegLeft;
  12119.                 HealthLegLeft = 0;
  12120.             }
  12121.  
  12122.             if (HealthLegLeft < 0)
  12123.             {
  12124.                 HealthTorso += HealthLegLeft;
  12125.                 HealthLegLeft = 0;
  12126.             }
  12127.             if (HealthLegRight < 0)
  12128.             {
  12129.                 HealthTorso += HealthLegRight;
  12130.                 HealthLegRight = 0;
  12131.             }
  12132.         }
  12133.         else                        // arms and torso
  12134.         {
  12135.             if (offset.y > armOffset)
  12136.             {
  12137.                 HealthArmRight -= actualDamage;
  12138.                 if (bPlayAnim)
  12139.                     PlayAnim('HitArmRight', , 0.1);
  12140.             }
  12141.             else if (offset.y < -armOffset)
  12142.             {
  12143.                 HealthArmLeft -= actualDamage;
  12144.                 if (bPlayAnim)
  12145.                     PlayAnim('HitArmLeft', , 0.1);
  12146.             }
  12147.             else
  12148.             {
  12149.                 HealthTorso -= actualDamage * 2;
  12150.                 if (bPlayAnim)
  12151.                 {
  12152.                 PlayAnim('HitTorso', , 0.1);
  12153.                 }
  12154.             }
  12155.  
  12156.             // if this part is already dead, damage the adjacent part
  12157.             if (HealthArmLeft < 0)
  12158.             {
  12159.                 HealthTorso += HealthArmLeft;
  12160.                 HealthArmLeft = 0;
  12161.             }
  12162.             if (HealthArmRight < 0)
  12163.             {
  12164.                 HealthTorso += HealthArmRight;
  12165.                 HealthArmRight = 0;
  12166.             }
  12167.         }
  12168.     }
  12169.  
  12170.     // check for a back hit and play the correct anim
  12171.     if ((offset.x < 0.0) && bPlayAnim)
  12172.     {
  12173.         if (offset.z > headOffsetZ)     // head from the back
  12174.         {
  12175.             // narrow the head region
  12176.             if ((Abs(offset.x) < headOffsetY) || (Abs(offset.y) < headOffsetY))
  12177.                 PlayAnim('HitHeadBack', , 0.1);
  12178.         }
  12179.         else
  12180.             PlayAnim('HitTorsoBack', , 0.1);
  12181.     }
  12182.  
  12183.     // check for a water hit
  12184.     if (Region.Zone.bWaterZone)
  12185.     {
  12186.         if ((offset.x < 0.0) && bPlayAnim)
  12187.             PlayAnim('WaterHitTorsoBack',,0.1);
  12188.         else
  12189.             PlayAnim('WaterHitTorso',,0.1);
  12190.     }
  12191.  
  12192.     GenerateTotalHealth();
  12193.  
  12194.     if ((damageType != 'Stunned') && (damageType != 'TearGas') && (damageType != 'HalonGas') &&
  12195.         (damageType != 'PoisonGas') && (damageType != 'Radiation') && (damageType != 'EMP') &&
  12196.         (damageType != 'NanoVirus') && (damageType != 'Drowned') && (damageType != 'KnockedOut'))
  12197.         bleedRate += (origHealth-Health)/30.0;  // 30 points of damage = bleed profusely
  12198.  
  12199.     if (CarriedDecoration != None && FRand() < 0.3 && AugmentationSystem.GetAugLevelValue(class'AugMuscle') != 2)
  12200.         DropDecoration();
  12201.  
  12202.     // don't let the player die in the training mission
  12203.     info = GetLevelInfo();
  12204.     if ((info != None) && (info.MissionNumber == 0))
  12205.     {
  12206.         if (Health <= 0)
  12207.         {
  12208.             HealthTorso = FMax(HealthTorso, 10);
  12209.             HealthHead = FMax(HealthHead, 10);
  12210.             GenerateTotalHealth();
  12211.         }
  12212.     }
  12213.  
  12214.     if (Health > 0)
  12215.     {
  12216.         if ((Level.NetMode != NM_Standalone) && (HealthLegLeft==0) && (HealthLegRight==0))
  12217.             ServerConditionalNotifyMsg( MPMSG_LostLegs );
  12218.  
  12219.         if (instigatedBy != None)
  12220.             damageAttitudeTo(instigatedBy);
  12221.         PlayDXTakeDamageHit(actualDamage, hitLocation, damageType, momentum, bDamageGotReduced);
  12222.         AISendEvent('Distress', EAITYPE_Visual);
  12223.     }
  12224.     else
  12225.     {
  12226.         NextState = '';
  12227.         if (inHand != None && FRand() < 0.3)
  12228.            DropItem();
  12229.         PlayDeathHit(actualDamage, hitLocation, damageType, momentum);
  12230.         if ( Level.NetMode != NM_Standalone )
  12231.             CreateKillerProfile( instigatedBy, actualDamage, damageType, bodyString );
  12232.         if (DamageType == 'Exploded')   //CyberP: always gib to explosives
  12233.         {
  12234.             Health = -1000;
  12235.             Spawn(class'FleshFragmentSmoking');
  12236.             Spawn(class'FleshFragmentSmoking');
  12237.             Spawn(class'FleshFragmentSmoking');
  12238.             Spawn(class'FleshFragmentSmoking');
  12239.             Spawn(class'FleshFragmentSmoking');
  12240.         }
  12241.         else if (DamageType == 'Burned' && instigatedBy.Weapon != None && (instigatedBy.Weapon.IsA('WeaponHideAGun') || instigatedBy.Weapon.IsA('WeaponPlasmaRifle') || instigatedBy.Weapon.IsA('WeaponRobotPlasmaGun')))
  12242.         {
  12243.             Health = -1000;
  12244.             Spawn(class'FleshFragmentSmoking');
  12245.             Spawn(class'FleshFragmentBurned');
  12246.             Spawn(class'FleshFragmentBurned');
  12247.             Spawn(class'FleshFragmentBurned');
  12248.             Spawn(class'FleshFragmentBurned');
  12249.             Spawn(class'FleshFragmentBurned');
  12250.             Spawn(class'FleshFragmentBurned');
  12251.             Spawn(class'FleshFragmentBurned');
  12252.             Spawn(class'FleshFragmentBurned');
  12253.         }
  12254.         else if ( actualDamage > mass )
  12255.             Health = -1 * actualDamage;
  12256.         Enemy = instigatedBy;
  12257.         Died(instigatedBy, damageType, HitLocation);
  12258.         return;
  12259.     }
  12260.     MakeNoise(1.0);
  12261.  
  12262.     if ((DamageType == 'Flamed') && !bOnFire)
  12263.     {
  12264.         // Notify player if they're getting burned for the first time
  12265.         if ( Level.NetMode != NM_Standalone )
  12266.             ServerConditionalNotifyMsg( MPMSG_FirstBurn );
  12267.  
  12268.         CatchFire( instigatedBy );
  12269.     }
  12270.     myProjKiller = None;
  12271. }
  12272.  
  12273. // ----------------------------------------------------------------------
  12274. // GetMPHitLocation()
  12275. // Returns 1 for head, 2 for torso, 3 for left leg, 4 for right leg, 5 for
  12276. // left arm, 6 for right arm, 0 for nothing.
  12277. // ----------------------------------------------------------------------
  12278. simulated function int GetMPHitLocation(Vector HitLocation)
  12279. {
  12280.     local float HeadOffsetZ;
  12281.     local float HeadOffsetY;
  12282.     local float ArmOffset;
  12283.     local vector Offset;
  12284.  
  12285.     offset = (hitLocation - Location) << Rotation;
  12286.  
  12287.     // calculate our hit extents
  12288.     headOffsetZ = CollisionHeight * 0.78;
  12289.     headOffsetY = CollisionRadius * 0.35;
  12290.     armOffset = CollisionRadius * 0.35;
  12291.  
  12292.     if (offset.z > headOffsetZ )
  12293.     {
  12294.         // narrow the head region
  12295.         if ((Abs(offset.x) < headOffsetY) || (Abs(offset.y) < headOffsetY))
  12296.         {
  12297.             // Headshot, return 1;
  12298.             return 1;
  12299.         }
  12300.         else
  12301.         {
  12302.             return 0;
  12303.         }
  12304.     }
  12305.     else if (offset.z < 0.0)    // Leg region
  12306.     {
  12307.         if (offset.y > 0.0)
  12308.         {
  12309.             //right leg
  12310.             return 4;
  12311.         }
  12312.         else
  12313.         {
  12314.             //left leg
  12315.             return 3;
  12316.         }
  12317.     }
  12318.     else // arms and torso now one region
  12319.     {
  12320.         if (offset.y > armOffset)
  12321.         {
  12322.             return 6;
  12323.         }
  12324.         else if (offset.y < -armOffset)
  12325.         {
  12326.             return 5;
  12327.         }
  12328.         else
  12329.         {
  12330.             return 2;
  12331.         }
  12332.     }
  12333.     return 0;
  12334. }
  12335.  
  12336. // ----------------------------------------------------------------------
  12337. // DXReduceDamage()
  12338. //
  12339. // Calculates reduced damage from augmentations and from inventory items
  12340. // Also calculates a scalar damage reduction based on the mission number
  12341. // ----------------------------------------------------------------------
  12342. function bool DXReduceDamage(int Damage, name damageType, vector hitLocation, out int adjustedDamage, bool bCheckOnly)
  12343. {
  12344.     local float newDamage;
  12345.     local float augLevel, skillLevel;
  12346.     local float pct;
  12347.     local HazMatSuit suit;
  12348.     local BallisticArmor armor;
  12349.     local bool bReduced;
  12350.  
  12351.     bReduced = False;
  12352.     newDamage = Float(Damage);
  12353.  
  12354.     if ((damageType == 'TearGas') || (damageType == 'PoisonGas') || (damageType == 'Radiation') ||
  12355.         (damageType == 'HalonGas')  || (damageType == 'PoisonEffect') || (damageType == 'Poison') ||
  12356.                     (damageType == 'Burned') || (damageType == 'Shocked'))
  12357.     {
  12358.         if (AugmentationSystem != None)
  12359.             augLevel = AugmentationSystem.GetAugLevelValue(class'AugEnviro');
  12360.  
  12361.         if (augLevel >= 0.0)
  12362.             newDamage *= augLevel;
  12363.  
  12364.         // get rid of poison if we're maxed out
  12365.         if (newDamage ~= 0.0)
  12366.         {
  12367.             StopPoison();
  12368.             drugEffectTimer -= 4;   // stop the drunk effect
  12369.             if (drugEffectTimer < 0)
  12370.                 drugEffectTimer = 0;
  12371.         }
  12372.  
  12373.         // go through the actor list looking for owned HazMatSuits
  12374.         // since they aren't in the inventory anymore after they are used
  12375.  
  12376.  
  12377.       if (UsingChargedPickup(class'HazMatSuit'))
  12378.             {
  12379.                 skillLevel = SkillSystem.GetSkillLevelValue(class'SkillEnviro');
  12380.                 newDamage *= 0.4;//0.75 * skillLevel;
  12381.                 foreach AllActors(class'HazMatSuit', suit)
  12382.                    if ((suit.Owner == Self) && suit.bActive)
  12383.                        suit.Charge -= (Damage * 20 * skillLevel);
  12384.             }
  12385.     }
  12386.  
  12387.     if ((damageType == 'Shot') || (damageType == 'Sabot') || (damageType == 'AutoShot'))
  12388.     {
  12389.         // go through the actor list looking for owned BallisticArmor
  12390.         // since they aren't in the inventory anymore after they are used
  12391.       if (UsingChargedPickup(class'BallisticArmor'))
  12392.             {
  12393.                 skillLevel = SkillSystem.GetSkillLevelValue(class'SkillEnviro');
  12394.                 newDamage *= 0.65; //GMDX: removed too easy * skillLevel; //CyberP: foreach durable armor
  12395.                 foreach AllActors(class'BallisticArmor', armor)
  12396.                     if ((armor.Owner == Self) && armor.bActive)
  12397.                         armor.Charge -= (Damage * 18 * skillLevel);
  12398.             }
  12399.     }
  12400.  
  12401.     if (damageType == 'HalonGas')
  12402.     {
  12403.         if (bOnFire && !bCheckOnly)
  12404.             ExtinguishFire();
  12405.     }
  12406.  
  12407.     if ((damageType == 'Shot') || (damageType == 'AutoShot') || (damageType == 'KnockedOut'))
  12408.     {
  12409.         if (AugmentationSystem != None) //CyberP: now includes ballistic passive aug
  12410.         {
  12411.             augLevel = AugmentationSystem.GetAugLevelValue(class'AugBallistic');
  12412.  
  12413.         if (augLevel < 0.0 && Energy > 0)
  12414.             augLevel = AugmentationSystem.GetAugLevelValue(class'AugBallisticPassive');
  12415.         }
  12416.  
  12417.         if (augLevel >= 0.0)
  12418.             newDamage *= augLevel;
  12419.     }
  12420.  
  12421.     //if (damageType == 'EMP')
  12422.     //{
  12423.     //  if (AugmentationSystem != None)
  12424.     //      augLevel = AugmentationSystem.GetAugLevelValue(class'AugEMP');
  12425. //
  12426. //      if (augLevel >= 0.0)
  12427. //          newDamage *= augLevel;
  12428. //  }
  12429.  
  12430.     if ((damageType == 'Burned') || (damageType == 'Flamed') ||
  12431.         (damageType == 'Exploded') || (damageType == 'Shocked') || (damageType == 'EMP'))
  12432.     {
  12433.         if (AugmentationSystem != None)
  12434.             augLevel = AugmentationSystem.GetAugLevelValue(class'AugShield');
  12435.  
  12436.         if (augLevel >= 0.0)
  12437.             newDamage *= augLevel;
  12438.         if (augLevel == 0.3)
  12439.             Spawn(class'SphereEffectShield2');
  12440.     }
  12441.  
  12442.     if (newDamage < Damage)
  12443.     {
  12444.         if (!bCheckOnly)
  12445.         {
  12446.             pct = 1.0 - (newDamage / Float(Damage));
  12447.             SetDamagePercent(pct);
  12448.             ClientFlash(0.01, vect(80, 0, 0));
  12449.         }
  12450.         bReduced = True;
  12451.     }
  12452.     else
  12453.     {
  12454.         if (!bCheckOnly)
  12455.             SetDamagePercent(0.0);
  12456.     }
  12457.  
  12458.  
  12459.     //
  12460.     // Reduce or increase the damage based on the combat difficulty setting
  12461.     //
  12462.     if ((damageType == 'Shot') || (damageType == 'AutoShot') || (damageType == 'KnockedOut'))
  12463.     {
  12464.         newDamage *= CombatDifficulty;
  12465.  
  12466.         // always take at least one point of damage
  12467.         if ((newDamage <= 1) && (Damage > 0))
  12468.             newDamage = 1;
  12469.  
  12470.         if (AugmentationSystem.GetAugLevelValue(class'AugBallisticPassive') >= 0.0)
  12471.         {
  12472.            Energy -= newDamage * 0.125;
  12473.            if (Energy < 0)
  12474.               Energy = 0;
  12475.         }
  12476.     }
  12477.  
  12478.     if (!bHardCoreMode) //CyberP: now we also reduce all other damage types based on difficulty.
  12479.     {                   //CyberP: easy = reduced by half. Medium = 1/4. Hardcore & realistic = No reduction
  12480.     if ((damageType == 'Shocked') || (damageType == 'Burned') || (damageType == 'Exploded') || (damageType == 'Poison')
  12481.     || (damageType == 'Radiation') || (damageType == 'TearGas') || (damageType == 'PoisonEffect'))
  12482.     {
  12483.         if (CombatDifficulty < 1)
  12484.         newDamage *= 0.5;
  12485.         else if (CombatDifficulty < 3)
  12486.         newDamage *= 0.75;
  12487.     }
  12488.     }
  12489.  
  12490.     adjustedDamage = Int(newDamage);
  12491.  
  12492.     return bReduced;
  12493. }
  12494.  
  12495. // ----------------------------------------------------------------------
  12496. // Died()
  12497. //
  12498. // Checks to see if a conversation is playing when the PC dies.
  12499. // If so, nukes it.
  12500. // ----------------------------------------------------------------------
  12501.  
  12502. function Died(pawn Killer, name damageType, vector HitLocation)
  12503. {
  12504.     if (conPlay != None)
  12505.         conPlay.TerminateConversation();
  12506.  
  12507.     if (bOnFire)
  12508.         ExtinguishFire();
  12509.  
  12510.     if (AugmentationSystem != None)
  12511.         AugmentationSystem.DeactivateAll();
  12512.  
  12513.     if ((Level.NetMode == NM_DedicatedServer) || (Level.NetMode == NM_ListenServer))
  12514.       ClientDeath();
  12515.  
  12516.     Super.Died(Killer, damageType, HitLocation);
  12517. }
  12518.  
  12519. // ----------------------------------------------------------------------
  12520. // ClientDeath()
  12521. //
  12522. // Does client side cleanup on death.
  12523. // ----------------------------------------------------------------------
  12524.  
  12525. function ClientDeath()
  12526. {
  12527.     if (!PlayerIsClient())
  12528.       return;
  12529.  
  12530.     //FlashTimer = 0;
  12531.  
  12532.     // Reset skill notification
  12533.     DeusExRootWindow(rootWindow).hud.hms.bNotifySkills = False;
  12534.  
  12535.     DeusExRootWindow(rootWindow).hud.activeItems.winItemsContainer.RemoveAllIcons();
  12536.     DeusExRootWindow(rootWindow).hud.belt.ClearBelt();
  12537.  
  12538.     // This should get rid of the scope death problem in multiplayer
  12539.     if (( DeusExRootWindow(rootWindow).scopeView != None ) && DeusExRootWindow(rootWindow).scopeView.bViewVisible )
  12540.        DeusExRootWindow(rootWindow).scopeView.DeactivateView();
  12541.  
  12542.     if ( DeusExRootWindow(rootWindow).hud.augDisplay != None )
  12543.     {
  12544.         DeusExRootWindow(rootWindow).hud.augDisplay.bVisionActive = False;
  12545.         DeusExRootWindow(rootWindow).hud.augDisplay.activeCount = 0;
  12546.     }
  12547.  
  12548.     if ( bOnFire )
  12549.         ExtinguishFire();
  12550.  
  12551.     // Don't come back to life drugged or posioned
  12552.     poisonCounter       = 0;
  12553.     poisonTimer         = 0;
  12554.     drugEffectTimer = 0;
  12555.  
  12556.     // Don't come back to life crouched
  12557.     bCrouchOn           = False;
  12558.     bWasCrouchOn        = False;
  12559.     bIsCrouching        = False;
  12560.     bForceDuck          = False;
  12561.     lastbDuck           = 0;
  12562.     bDuck                   = 0;
  12563.  
  12564.     // No messages carry over
  12565.     mpMsgCode = 0;
  12566.     mpMsgTime = 0;
  12567.  
  12568.     bleedrate = 0;
  12569.     dropCounter = 0;
  12570.  
  12571. }
  12572.  
  12573. // ----------------------------------------------------------------------
  12574. // Timer()
  12575. //
  12576. // continually burn and do damage
  12577. // ----------------------------------------------------------------------
  12578.  
  12579. function Timer()
  12580. {
  12581.     local int damage;
  12582.  
  12583.     if (bDoubleClickCheck)
  12584.     {
  12585.       clickCountCyber = 0;
  12586.       bDoubleClickCheck=False;
  12587.       bStunted = False;
  12588.       if (!bOnFire)
  12589.           return;
  12590.     }
  12591.  
  12592.     bStunted = False;  //CyberP: called from takedamage.
  12593.  
  12594.     if (!InConversation() && bOnFire)
  12595.     {
  12596.         if ( Level.NetMode != NM_Standalone )
  12597.             damage = Class'WeaponFlamethrower'.Default.mpBurnDamage;
  12598.         else
  12599.             damage = Class'WeaponFlamethrower'.Default.BurnDamage;
  12600.         TakeDamage(damage, myBurner, Location, vect(0,0,0), 'Burned');
  12601.  
  12602.         if (HealthTorso <= 0)
  12603.         {
  12604.             TakeDamage(10, myBurner, Location, vect(0,0,0), 'Burned');
  12605.             ExtinguishFire();
  12606.         }
  12607.     }
  12608. }
  12609.  
  12610. // ----------------------------------------------------------------------
  12611. // CatchFire()
  12612. // ----------------------------------------------------------------------
  12613.  
  12614. function CatchFire( Pawn burner )
  12615. {
  12616.     local Fire f;
  12617.     local int i;
  12618.     local vector loc;
  12619.  
  12620.     myBurner = burner;
  12621.  
  12622.     burnTimer = 0;
  12623.  
  12624.     if (bOnFire || Region.Zone.bWaterZone)
  12625.         return;
  12626.  
  12627.     bOnFire = True;
  12628.     burnTimer = 0;
  12629.  
  12630.     for (i=0; i<8; i++)
  12631.     {
  12632.         loc.X = 0.5*CollisionRadius * (1.0-2.0*FRand());
  12633.         loc.Y = 0.5*CollisionRadius * (1.0-2.0*FRand());
  12634.         loc.Z = 0.6*CollisionHeight * (1.0-2.0*FRand());
  12635.         loc += Location;
  12636.  
  12637.       // DEUS_EX AMSD reduce the number of smoke particles in multiplayer
  12638.       // by creating smokeless fire (better for server propagation).
  12639.       if ((Level.NetMode == NM_Standalone) || (i <= 0))
  12640.          f = Spawn(class'Fire', Self,, loc);
  12641.       else
  12642.          f = Spawn(class'SmokelessFire', Self,, loc);
  12643.  
  12644.         if (f != None)
  12645.         {
  12646.             f.DrawScale = 0.5*FRand() + 1.0;
  12647.  
  12648.          //DEUS_EX AMSD Reduce the penalty in multiplayer
  12649.          if (Level.NetMode != NM_Standalone)
  12650.             f.DrawScale = f.DrawScale * 0.5;
  12651.  
  12652.             // turn off the sound and lights for all but the first one
  12653.             if (i > 0)
  12654.             {
  12655.                 f.AmbientSound = None;
  12656.                 f.LightType = LT_None;
  12657.             }
  12658.  
  12659.             // turn on/off extra fire and smoke
  12660.          // MP already only generates a little.
  12661.             if ((FRand() < 0.5) && (Level.NetMode == NM_Standalone))
  12662.                 f.smokeGen.Destroy();
  12663.             if ((FRand() < 0.5) && (Level.NetMode == NM_Standalone))
  12664.                 f.AddFire();
  12665.         }
  12666.     }
  12667.  
  12668.     // set the burn timer
  12669.     SetTimer(1.0, True);
  12670. }
  12671.  
  12672. // ----------------------------------------------------------------------
  12673. // ExtinguishFire()
  12674. // ----------------------------------------------------------------------
  12675.  
  12676. function ExtinguishFire()
  12677. {
  12678.     local Fire f;
  12679.  
  12680.     bOnFire = False;
  12681.     burnTimer = 0;
  12682.     SetTimer(0, False);
  12683.  
  12684.     foreach BasedActors(class'Fire', f)
  12685.         f.Destroy();
  12686. }
  12687.  
  12688. // ----------------------------------------------------------------------
  12689. // SpawnBlood()
  12690. // ----------------------------------------------------------------------
  12691.  
  12692. function SpawnBlood(Vector HitLocation, float Damage)
  12693. {
  12694.     local int i;
  12695.  
  12696.     if ((DeusExMPGame(Level.Game) != None) && (!DeusExMPGame(Level.Game).bSpawnEffects))
  12697.     {
  12698.       return;
  12699.     }
  12700.  
  12701.     //spawn(class'BloodSpurt',,,HitLocation);
  12702.     //spawn(class'BloodDrop',,,HitLocation);
  12703.     for (i=0; i<int(Damage); i+=10)
  12704.         spawn(class'BloodDrop',,,HitLocation);
  12705. }
  12706.  
  12707. // ----------------------------------------------------------------------
  12708. // PlayDXTakeDamageHit()
  12709. // DEUS_EX AMSD Created as a separate function to avoid extra calls to
  12710. // DXReduceDamage, which is slow in multiplayer
  12711. // ----------------------------------------------------------------------
  12712. function PlayDXTakeDamageHit(float Damage, vector HitLocation, name damageType, vector Momentum, bool DamageReduced)
  12713. {
  12714.     local float rnd;
  12715.  
  12716. //log("MYCHK PDXTDH:"@self@"take damage in state"@GetStateName()@" : "@Damage@" : "@damageType);
  12717.  
  12718.  
  12719.  
  12720.     PlayHit(Damage,HitLocation,damageType,Momentum);
  12721.  
  12722.     // if we actually took the full damage, flash the screen and play the sound
  12723.     // DEUS_EX AMSD DXReduceDamage is slow.  Pass in the result from earlier.
  12724.     if (!DamageReduced)
  12725.     {
  12726.         if ( (damage > 0) || (ReducedDamageType == 'All') )
  12727.         {
  12728.             // No client flash on plasma bolts in multiplayer
  12729.             if (( Level.NetMode != NM_Standalone ) && ( myProjKiller != None ) && (PlasmaBolt(myProjKiller)!=None) )
  12730.             {
  12731.             }
  12732.             else
  12733.             {//gmdx changed 0.002 on burned
  12734.                 rnd = FClamp(Damage, 20, 100);
  12735.                 if (damageType == 'Burned')
  12736.                     ClientFlash(0.0001, vect(75,37,37));   //vect(100,50,50)
  12737.                 else if (damageType == 'Flamed')
  12738.                     ClientFlash(rnd * 0.002, vect(200,100,100));
  12739.                 else if (damageType == 'Radiation')
  12740.                     ClientFlash(rnd * 0.002, vect(100,100,0));
  12741.                 else if (damageType == 'PoisonGas')
  12742.                     ClientFlash(rnd * 0.002, vect(50,150,0));
  12743.                 else if (damageType == 'TearGas')
  12744.                     ClientFlash(rnd * 0.002, vect(150,150,0));
  12745.                 else if (damageType == 'Drowned')
  12746.                     ClientFlash(rnd * 0.002, vect(0,100,200));
  12747.                 else if (damageType == 'EMP')
  12748.                     ClientFlash(rnd * 0.002, vect(0,200,200));
  12749.                 else
  12750.                     ClientFlash(rnd * 0.002, vect(50,0,0));
  12751.             }
  12752.             ShakeView(0.15 + 0.002 * Damage, Damage * 30, 0.3 * Damage);
  12753.         }
  12754.     }
  12755. }
  12756.  
  12757. // ----------------------------------------------------------------------
  12758. // PlayHit()
  12759. // ----------------------------------------------------------------------
  12760.  
  12761. function PlayHit(float Damage, vector HitLocation, name damageType, vector Momentum)
  12762. {
  12763.     if ((Damage > 0) && (damageType == 'Shot') || (damageType == 'Exploded') || (damageType == 'AutoShot'))
  12764.         SpawnBlood(HitLocation, Damage);
  12765.  
  12766.     if (Damage >=1) //CyberP: Don't scream (and subsequently send AIEvents) if the damage is really weak.
  12767.     PlayTakeHitSound(Damage, damageType, 1);
  12768. }
  12769.  
  12770. // ----------------------------------------------------------------------
  12771. // PlayDeathHit()
  12772. // ----------------------------------------------------------------------
  12773.  
  12774. function PlayDeathHit(float Damage, vector HitLocation, name damageType, vector Momentum)
  12775. {
  12776.     PlayDying(damageType, HitLocation);
  12777. }
  12778.  
  12779. // ----------------------------------------------------------------------
  12780. // SkillPointsAdd()
  12781. // ----------------------------------------------------------------------
  12782.  
  12783. function SkillPointsAdd(int numPoints)
  12784. {
  12785.     //Modified so it can take away points as well -- Y|yukichigai
  12786.     if (numPoints != 0) //Was > 0
  12787.     {
  12788.         SkillPointsAvail += numPoints;
  12789.         SkillPointsTotal += numPoints;
  12790.  
  12791.         if ((DeusExRootWindow(rootWindow) != None) &&
  12792.             (DeusExRootWindow(rootWindow).hud != None) &&
  12793.             (DeusExRootWindow(rootWindow).hud.msgLog != None))
  12794.         {
  12795.             //You were given skill points, hooray!
  12796.             if(numPoints > 0)
  12797.             {
  12798.                 ClientMessage(Sprintf(SkillPointsAward, numPoints));
  12799.                 DeusExRootWindow(rootWindow).hud.msgLog.PlayLogSound(Sound'LogSkillPoints');
  12800.             }
  12801.             //You lost skill points.  You must have screwed up.  Boo!
  12802.             else
  12803.             {
  12804.                 ClientMessage(Sprintf("%d skill points deducted!", -1*(numPoints)));
  12805.                 DeusExRootWindow(rootWindow).hud.msgLog.PlayLogSound(Sound'TurretSwitch');
  12806.             }
  12807.         }
  12808.  
  12809.         //== Prevent any potential crashes due to skillpoint awards
  12810.         if(SkillPointsAvail > 115900)
  12811.             SkillPointsAvail = 115900;
  12812.         if(SkillPointsTotal > 115900)
  12813.             SkillPointsTotal = 115900;
  12814.     }
  12815. }
  12816.  
  12817. // ----------------------------------------------------------------------
  12818. // perksManager() //CyberP:
  12819. // ----------------------------------------------------------------------
  12820.  
  12821. function perksManager(string Perky, int perkLevel)
  12822. {
  12823. local Medkit med;
  12824. local BioelectricCell cell;
  12825. local Robot robo;
  12826.  
  12827.    if (perkLevel == 1)
  12828.    {
  12829.     switch(Perky)
  12830.     {
  12831.           case "SONIC-TRANSDUCER SENSOR":
  12832.           PerkNamesArray[0]= 1;
  12833.           break;
  12834.  
  12835.           case "FOCUSED: PISTOLS":
  12836.           PerkNamesArray[1]= 1;
  12837.           break;
  12838.  
  12839.           case "FOCUSED: RIFLES":
  12840.           PerkNamesArray[2]= 1;
  12841.           break;
  12842.  
  12843.           case "PERFECT STANCE: HEAVY WEAPONS":
  12844.           PerkNamesArray[3]= 1;
  12845.           break;
  12846.  
  12847.           case "SHARP-EYED":
  12848.           PerkNamesArray[4]= 1;
  12849.           break;
  12850.  
  12851.           case "CLARITY":
  12852.           PerkNamesArray[5]= 1;
  12853.           break;
  12854.  
  12855.           case "STEADY-FOOTED":
  12856.           PerkNamesArray[6]= 1;
  12857.           break;
  12858.  
  12859.           case "MODDER":
  12860.           PerkNamesArray[7]= 1;
  12861.           break;
  12862.  
  12863.           case "BIOGENIC":
  12864.           PerkNamesArray[8]= 1;
  12865.           break;
  12866.  
  12867.           case "NIMBLE":
  12868.           PerkNamesArray[9]= 1;
  12869.           break;
  12870.  
  12871.           case "SABOTAGE":
  12872.           PerkNamesArray[10]= 1;
  12873.           break;
  12874.  
  12875.           default:
  12876.           break;
  12877.         }
  12878.      }
  12879.    else if (perkLevel == 2)
  12880.    {
  12881.     switch(Perky)
  12882.     {
  12883.           case "HUMAN COMBUSTION":
  12884.           PerkNamesArray[11]= 1;
  12885.           break;
  12886.  
  12887.           case "QUICKDRAW":
  12888.           PerkNamesArray[12]= 1;
  12889.           break;
  12890.  
  12891.           case "H.E ROCKET":
  12892.           PerkNamesArray[13]= 1;
  12893.           break;
  12894.  
  12895.           case "PIERCING":
  12896.           PerkNamesArray[14]= 1;
  12897.           break;
  12898.  
  12899.           case "SHORT FUSE":
  12900.           PerkNamesArray[15]= 1;
  12901.           break;
  12902.  
  12903.           case "WIRELESS STRENGTH":
  12904.           PerkNamesArray[16]= 1;
  12905.           break;
  12906.  
  12907.           case "ATHLETE'S APPETITE":
  12908.           PerkNamesArray[17]= 1;
  12909.           fullUp=-9999;
  12910.           break;
  12911.  
  12912.           case "NERVES OF STEEL":
  12913.           PerkNamesArray[18]= 1;
  12914.           break;
  12915.  
  12916.           case "TOXICOLOGIST":
  12917.           PerkNamesArray[19]= 1;
  12918.           break;
  12919.  
  12920.           case "HARDENED":
  12921.           PerkNamesArray[20]= 1;
  12922.           break;
  12923.  
  12924.           case "MISFEATURE EXPLOIT":
  12925.           PerkNamesArray[21]= 1;
  12926.           break;
  12927.  
  12928.           default:
  12929.           break;
  12930.         }
  12931.      }
  12932.     else if (perkLevel == 3)
  12933.    {
  12934.     switch(Perky)
  12935.     {
  12936.           case "PERFECT STANCE: PISTOLS":
  12937.           PerkNamesArray[22]= 1;
  12938.           break;
  12939.  
  12940.           case "PERFECT STANCE: RIFLES":
  12941.           PerkNamesArray[23]= 1;
  12942.           break;
  12943.  
  12944.           case "IN BULK":
  12945.           PerkNamesArray[24]= 1;
  12946.           break;
  12947.  
  12948.           case "INVENTIVE":
  12949.           PerkNamesArray[25]= 1;
  12950.           break;
  12951.  
  12952.           case "KNOCKOUT GAS":
  12953.           PerkNamesArray[26]= 1;
  12954.           break;
  12955.  
  12956.           case "ENDURANCE":
  12957.           PerkNamesArray[27]= 1;
  12958.           break;
  12959.  
  12960.           case "TECH SPECIALIST":
  12961.           PerkNamesArray[28]= 1;
  12962.           break;
  12963.  
  12964.           case "CREEPER":
  12965.           PerkNamesArray[29]= 1;
  12966.           break;
  12967.  
  12968.           case "COMBAT MEDIC'S BAG":
  12969.           PerkNamesArray[30]= 1;
  12970.           foreach AllActors(class'Medkit',med)
  12971.              med.MaxCopies = 20;
  12972.           foreach AllActors(class'BioelectricCell',cell)
  12973.              cell.MaxCopies = 25;
  12974.           break;
  12975.  
  12976.           case "CRACKED":
  12977.           PerkNamesArray[31]= 1;
  12978.           break;
  12979.  
  12980.           case "LOCKSPORT":
  12981.           PerkNamesArray[32]= 1;
  12982.           break;
  12983.  
  12984.           case "NEAT HACK":
  12985.           PerkNamesArray[33]= 1;
  12986.           break;
  12987.  
  12988.           default:
  12989.           break;
  12990.         }
  12991.      }
  12992. }
  12993.  
  12994. // ----------------------------------------------------------------------
  12995. // MakePlayerIgnored()
  12996. // ----------------------------------------------------------------------
  12997.  
  12998. function MakePlayerIgnored(bool bNewIgnore)
  12999. {
  13000.     bIgnore = bNewIgnore;
  13001.     // to restore original behavior, uncomment the next line
  13002.     //bDetectable = !bNewIgnore;
  13003. }
  13004.  
  13005. // ----------------------------------------------------------------------
  13006. // CalculatePlayerVisibility()
  13007. // ----------------------------------------------------------------------
  13008.  
  13009. function float CalculatePlayerVisibility(ScriptedPawn P)
  13010. {
  13011.     local float vis;
  13012.     local AdaptiveArmor armor;
  13013.     local DeusExWeapon wep;
  13014.  
  13015.     wep = DeusExWeapon(Weapon);
  13016.     vis = 1.0;
  13017.     if ((P != None) && (AugmentationSystem != None))
  13018.     {
  13019.         if (P.IsA('Robot'))
  13020.         {
  13021.             // if the aug is on, give the player full invisibility
  13022.             if (AugmentationSystem.GetAugLevelValue(class'AugRadarTrans') != -1.0)
  13023.                 vis = 0.0;
  13024.         }
  13025.         else
  13026.         {
  13027.             // if the aug is on, give the player full invisibility
  13028.             if (AugmentationSystem.GetAugLevelValue(class'AugCloak') != -1.0)
  13029.                 vis = 0.0;
  13030.         }
  13031.  
  13032.         // go through the actor list looking for owned AdaptiveArmor
  13033.         // since they aren't in the inventory anymore after they are used
  13034.  
  13035.       if (UsingChargedPickup(class'AdaptiveArmor'))
  13036.             {
  13037.                 vis = 0.0;
  13038.             }
  13039.       if (wep != None && wep.bLasing)
  13040.             {
  13041.                 vis = 1.0;    //CyberP: if laser on, can be seen even if cloaked/radartrans
  13042.             }
  13043.     }
  13044.  
  13045.     return vis;
  13046. }
  13047.  
  13048. // ----------------------------------------------------------------------
  13049. // ClientFlash()
  13050. //
  13051. // copied from Engine.PlayerPawn
  13052. // modified to add the new flash to the current flash
  13053. // ----------------------------------------------------------------------
  13054. // MBCODE: changed to simulated so that player can experience flash client side
  13055. // DEUS_EX AMSD: Added so we can change the flash time duration.
  13056. simulated function ClientFlash( float scale, vector fog)
  13057. {
  13058.     DesiredFlashScale += scale;
  13059.     DesiredFlashFog += 0.001 * fog;  //CyberP: 0.001
  13060. }
  13061.  
  13062. function IncreaseClientFlashLength(float NewFlashTime)
  13063. {
  13064.     FlashTimer = FMax(NewFlashTime,FlashTimer);
  13065. }
  13066.  
  13067. // ----------------------------------------------------------------------
  13068. // ViewFlash()
  13069. // modified so that flash doesn't always go away in exactly half a second.
  13070. // ---------------------------------------------------------------------
  13071. function ViewFlash(float DeltaTime)
  13072. {
  13073.     local float delta;
  13074.     local vector goalFog;
  13075.     local float goalscale, ReductionFactor;
  13076.  
  13077.     ReductionFactor = 2;
  13078.  
  13079.     if (FlashTimer > 0)
  13080.     {
  13081.       if (FlashTimer < Deltatime)
  13082.       {
  13083.          FlashTimer = 0;
  13084.       }
  13085.       else
  13086.       {
  13087.          ReductionFactor = 0;
  13088.          FlashTimer -= Deltatime;
  13089.       }
  13090.     }
  13091.  
  13092.     if ( bNoFlash )
  13093.     {
  13094.         InstantFlash = 0;
  13095.         InstantFog = vect(0,0,0);
  13096.     }
  13097.  
  13098.     delta = FMin(0.1, DeltaTime);
  13099.     goalScale = 1 + DesiredFlashScale + ConstantGlowScale + HeadRegion.Zone.ViewFlash.X;
  13100.     goalFog = DesiredFlashFog + ConstantGlowFog + HeadRegion.Zone.ViewFog;
  13101.     DesiredFlashScale -= DesiredFlashScale * ReductionFactor * delta;
  13102.     DesiredFlashFog -= DesiredFlashFog * ReductionFactor * delta;
  13103.     FlashScale.X += (goalScale - FlashScale.X + InstantFlash) * 10 * delta;
  13104.     FlashFog += (goalFog - FlashFog + InstantFog) * 10 * delta;
  13105.     InstantFlash = 0;
  13106.     InstantFog = vect(0,0,0);
  13107.  
  13108.     if ( FlashScale.X > 0.981 )
  13109.         FlashScale.X = 1;
  13110.     FlashScale = FlashScale.X * vect(1,1,1);
  13111.  
  13112.     if ( FlashFog.X < 0.019 )
  13113.         FlashFog.X = 0;
  13114.     if ( FlashFog.Y < 0.019 )
  13115.         FlashFog.Y = 0;
  13116.     if ( FlashFog.Z < 0.019 )
  13117.         FlashFog.Z = 0;
  13118. }
  13119. // ----------------------------------------------------------------------
  13120. // ViewModelAdd()
  13121. //
  13122. // lets an artist (or whoever) view a model and play animations on it
  13123. // from within the game
  13124. // ----------------------------------------------------------------------
  13125.  
  13126. exec function ViewModelAdd(int num, string ClassName)
  13127. {
  13128.     local class<actor> ViewModel${1}< ${3} >
  13129.     local rotator newrot;
  13130.     local vector loc;
  13131.  
  13132.     if (!bCheatsEnabled)
  13133.         return;
  13134.  
  13135.     if(instr(ClassName, ".") == -1)
  13136.         ClassName = "DeusEx." $ ClassName;
  13137.  
  13138.     if ((num >= 0) && (num <= 8))
  13139.     {
  13140.         if (num > 0)
  13141.             num--;
  13142.  
  13143.         if (ViewModelActor[num] == None)
  13144.         {
  13145.             ViewModelClass = class<actor>(DynamicLoadObject(ClassName, class'Class'));
  13146.             if (ViewModelClass != None)
  13147.             {
  13148.                 newrot = Rotation;
  13149.                 newrot.Roll = 0;
  13150.                 newrot.Pitch = 0;
  13151.                 loc = Location + (ViewModelClass.Default.CollisionRadius + CollisionRadius + 32) * Vector(newrot);
  13152.                 loc.Z += ViewModelClass.Default.CollisionHeight;
  13153.                 ViewModelActor[num] = Spawn(ViewModelClass,,, loc, newrot);
  13154.                 if (ViewModelActor[num] != None)
  13155.                     ViewModelActor[num].SetPhysics(PHYS_None);
  13156.                 if (ScriptedPawn(ViewModelActor[num]) != None)
  13157.                     ViewModelActor[num].GotoState('Paralyzed');
  13158.             }
  13159.         }
  13160.         else
  13161.             ClientMessage("There is already a ViewModel in that slot!");
  13162.     }
  13163. }
  13164.  
  13165. // ----------------------------------------------------------------------
  13166. // ViewModelDestroy()
  13167. //
  13168. // destroys the current ViewModel
  13169. // ----------------------------------------------------------------------
  13170.  
  13171. exec function ViewModelDestroy(int num)
  13172. {
  13173.     local int i;
  13174.  
  13175.     if (!bCheatsEnabled)
  13176.         return;
  13177.  
  13178.     if ((num >= 0) && (num <= 8))
  13179.     {
  13180.         if (num == 0)
  13181.         {
  13182.             for (i=0; i<8; i++)
  13183.                 if (ViewModelActor[i] != None)
  13184.                 {
  13185.                     ViewModelActor[i].Destroy();
  13186.                     ViewModelActor[i] = None;
  13187.                 }
  13188.         }
  13189.         else
  13190.         {
  13191.             i = num - 1;
  13192.             if (ViewModelActor[i] != None)
  13193.             {
  13194.                 ViewModelActor[i].Destroy();
  13195.                 ViewModelActor[i] = None;
  13196.             }
  13197.         }
  13198.     }
  13199. }
  13200.  
  13201. // ----------------------------------------------------------------------
  13202. // ViewModelPlay()
  13203. //
  13204. // plays an animation on the current ViewModel
  13205. // ----------------------------------------------------------------------
  13206.  
  13207. exec function ViewModelPlay(int num, name anim, optional float fps)
  13208. {
  13209.     local int i;
  13210.  
  13211.     if (!bCheatsEnabled)
  13212.         return;
  13213.  
  13214.     if ((num >= 0) && (num <= 8))
  13215.     {
  13216.         if (num == 0)
  13217.         {
  13218.             for (i=0; i<8; i++)
  13219.                 if (ViewModelActor[i] != None)
  13220.                 {
  13221.                     if (fps == 0)
  13222.                         fps = 1.0;
  13223.                     ViewModelActor[i].PlayAnim(anim, fps);
  13224.                 }
  13225.         }
  13226.         else
  13227.         {
  13228.             i = num - 1;
  13229.             if (ViewModelActor[i] != None)
  13230.             {
  13231.                 if (fps == 0)
  13232.                     fps = 1.0;
  13233.                 ViewModelActor[i].PlayAnim(anim, fps);
  13234.             }
  13235.         }
  13236.     }
  13237. }
  13238.  
  13239. // ----------------------------------------------------------------------
  13240. // ViewModelLoop()
  13241. //
  13242. // loops an animation on the current ViewModel
  13243. // ----------------------------------------------------------------------
  13244.  
  13245. exec function ViewModelLoop(int num, name anim, optional float fps)
  13246. {
  13247.     local int i;
  13248.  
  13249.     if (!bCheatsEnabled)
  13250.         return;
  13251.  
  13252.     if ((num >= 0) && (num <= 8))
  13253.     {
  13254.         if (num == 0)
  13255.         {
  13256.             for (i=0; i<8; i++)
  13257.                 if (ViewModelActor[i] != None)
  13258.                 {
  13259.                     if (fps == 0)
  13260.                         fps = 1.0;
  13261.                     ViewModelActor[i].LoopAnim(anim, fps);
  13262.                 }
  13263.         }
  13264.         else
  13265.         {
  13266.             i = num - 1;
  13267.             if (ViewModelActor[i] != None)
  13268.             {
  13269.                 if (fps == 0)
  13270.                     fps = 1.0;
  13271.                 ViewModelActor[i].LoopAnim(anim, fps);
  13272.             }
  13273.         }
  13274.     }
  13275. }
  13276.  
  13277. // ----------------------------------------------------------------------
  13278. // ViewModelBlendPlay()
  13279. //
  13280. // plays a blended animation on the current ViewModel
  13281. // ----------------------------------------------------------------------
  13282.  
  13283. exec function ViewModelBlendPlay(int num, name anim, optional float fps, optional int slot)
  13284. {
  13285.     local int i;
  13286.  
  13287.     if (!bCheatsEnabled)
  13288.         return;
  13289.  
  13290.     if ((num >= 0) && (num <= 8))
  13291.     {
  13292.         if (num == 0)
  13293.         {
  13294.             for (i=0; i<8; i++)
  13295.                 if (ViewModelActor[i] != None)
  13296.                 {
  13297.                     if (fps == 0)
  13298.                         fps = 1.0;
  13299.                     ViewModelActor[i].PlayBlendAnim(anim, fps, , slot);
  13300.                 }
  13301.         }
  13302.         else
  13303.         {
  13304.             i = num - 1;
  13305.             if (ViewModelActor[i] != None)
  13306.             {
  13307.                 if (fps == 0)
  13308.                     fps = 1.0;
  13309.                 ViewModelActor[i].PlayBlendAnim(anim, fps, , slot);
  13310.             }
  13311.         }
  13312.     }
  13313. }
  13314.  
  13315. // ----------------------------------------------------------------------
  13316. // ViewModelBlendStop()
  13317. //
  13318. // stops the blended animation on the current ViewModel
  13319. // ----------------------------------------------------------------------
  13320.  
  13321. exec function ViewModelBlendStop(int num)
  13322. {
  13323.     local int i;
  13324.  
  13325.     if (!bCheatsEnabled)
  13326.         return;
  13327.  
  13328.     if ((num >= 0) && (num <= 8))
  13329.     {
  13330.         if (num == 0)
  13331.         {
  13332.             for (i=0; i<8; i++)
  13333.                 if (ViewModelActor[i] != None)
  13334.                     ViewModelActor[i].StopBlendAnims();
  13335.         }
  13336.         else
  13337.         {
  13338.             i = num - 1;
  13339.             if (ViewModelActor[i] != None)
  13340.                 ViewModelActor[i].StopBlendAnims();
  13341.         }
  13342.     }
  13343. }
  13344.  
  13345. exec function ViewModelGiveWeapon(int num, string weaponClass)
  13346. {
  13347.     local class<Actor> New${1}< ${3} >
  13348.     local Actor obj;
  13349.     local int i;
  13350.     local ScriptedPawn pawn;
  13351.  
  13352.     if (!bCheatsEnabled)
  13353.         return;
  13354.  
  13355.     if (instr(weaponClass, ".") == -1)
  13356.         weaponClass = "DeusEx." $ weapon${1}< ${3} >
  13357.  
  13358.     if ((num >= 0) && (num <= 8))
  13359.     {
  13360.         NewClass = class<Actor>(DynamicLoadObject(weaponClass, class'Class'));
  13361.  
  13362.         if (NewClass != None)
  13363.         {
  13364.             obj = Spawn(NewClass,,, Location + (CollisionRadius+NewClass.Default.CollisionRadius+30) * Vector(Rotation) + vect(0,0,1) * 15);
  13365.             if ((obj != None) && obj.IsA('DeusExWeapon'))
  13366.             {
  13367.                 if (num == 0)
  13368.                 {
  13369.                     for (i=0; i<8; i++)
  13370.                     {
  13371.                         pawn = ScriptedPawn(ViewModelActor[i]);
  13372.                         if (pawn != None)
  13373.                         {
  13374.                             DeusExWeapon(obj).GiveTo(pawn);
  13375.                             obj.SetBase(pawn);
  13376.                             pawn.Weapon = DeusExWeapon(obj);
  13377.                             pawn.PendingWeapon = DeusExWeapon(obj);
  13378.                         }
  13379.                     }
  13380.                 }
  13381.                 else
  13382.                 {
  13383.                     i = num - 1;
  13384.                     pawn = ScriptedPawn(ViewModelActor[i]);
  13385.                     if (pawn != None)
  13386.                     {
  13387.                         DeusExWeapon(obj).GiveTo(pawn);
  13388.                         obj.SetBase(pawn);
  13389.                         pawn.Weapon = DeusExWeapon(obj);
  13390.                         pawn.PendingWeapon = DeusExWeapon(obj);
  13391.                     }
  13392.                 }
  13393.             }
  13394.             else
  13395.             {
  13396.                 if (obj != None)
  13397.                     obj.Destroy();
  13398.             }
  13399.         }
  13400.     }
  13401. }
  13402.  
  13403. // ----------------------------------------------------------------------
  13404. // aliases to ViewModel functions
  13405. // ----------------------------------------------------------------------
  13406.  
  13407. exec function VMA(int num, string ClassName)
  13408. {
  13409.     ViewModelAdd(num, ClassName);
  13410. }
  13411.  
  13412. exec function VMD(int num)
  13413. {
  13414.     ViewModelDestroy(num);
  13415. }
  13416.  
  13417. exec function VMP(int num, name anim, optional float fps)
  13418. {
  13419.     ViewModelPlay(num, anim, fps);
  13420. }
  13421.  
  13422. exec function VML(int num, name anim, optional float fps)
  13423. {
  13424.     ViewModelLoop(num, anim, fps);
  13425. }
  13426.  
  13427. exec function VMBP(int num, name anim, optional float fps, optional int slot)
  13428. {
  13429.     ViewModelBlendPlay(num, anim, fps, slot);
  13430. }
  13431.  
  13432. exec function VMBS(int num)
  13433. {
  13434.     ViewModelBlendStop(num);
  13435. }
  13436.  
  13437. exec function VMGW(int num, string weaponClass)
  13438. {
  13439.     ViewModelGiveWeapon(num, weaponClass);
  13440. }
  13441.  
  13442. // ----------------------------------------------------------------------
  13443. // Cheat functions
  13444. //
  13445. // ----------------------------------------------------------------------
  13446. // AllHealth()
  13447. // ----------------------------------------------------------------------
  13448.  
  13449. exec function AllHealth()
  13450. {
  13451.     if (!bCheatsEnabled)
  13452.         return;
  13453.  
  13454.     RestoreAllHealth();
  13455. }
  13456.  
  13457. // ----------------------------------------------------------------------
  13458. // RestoreAllHealth()
  13459. // mod by dasraiser for GMDX MedSkill additional health
  13460. // ----------------------------------------------------------------------
  13461.  
  13462. function RestoreAllHealth()
  13463. {
  13464.     local int spill;
  13465.     local Skill sk;
  13466.     local float MedSkillAdd;
  13467.     MedSkillAdd=0.0;
  13468.     if (SkillSystem!=None)
  13469.     {
  13470.       sk = SkillSystem.GetSkillFromClass(Class'DeusEx.SkillMedicine');
  13471.       if (sk!=None) MedSkillAdd=sk.CurrentLevel*10;
  13472.     }
  13473.     HealthHead = default.HealthHead+MedSkillAdd;
  13474.     HealthTorso = default.HealthTorso+MedSkillAdd;
  13475.     HealthLegLeft = default.HealthLegLeft;
  13476.     HealthLegRight = default.HealthLegRight;
  13477.     HealthArmLeft = default.HealthArmLeft;
  13478.     HealthArmRight = default.HealthArmRight;
  13479.     Health = default.Health;
  13480. }
  13481.  
  13482. // ----------------------------------------------------------------------
  13483. // DamagePart()
  13484. // ----------------------------------------------------------------------
  13485.  
  13486. exec function DamagePart(int partIndex, optional int amount)
  13487. {
  13488.     if (!bCheatsEnabled)
  13489.         return;
  13490.  
  13491.     if (amount == 0)
  13492.         amount = 1000;
  13493.  
  13494.     switch(partIndex)
  13495.     {
  13496.         case 0:     // head
  13497.             HealthHead -= Min(HealthHead, amount);
  13498.             break;
  13499.  
  13500.         case 1:     // torso
  13501.             HealthTorso -= Min(HealthTorso, amount);
  13502.             break;
  13503.  
  13504.         case 2:     // left arm
  13505.             HealthArmLeft -= Min(HealthArmLeft, amount);
  13506.             break;
  13507.  
  13508.         case 3:     // right arm
  13509.             HealthArmRight -= Min(HealthArmRight, amount);
  13510.             break;
  13511.  
  13512.         case 4:     // left leg
  13513.             HealthLegLeft -= Min(HealthLegLeft, amount);
  13514.             break;
  13515.  
  13516.         case 5:     // right leg
  13517.             HealthLegRight -= Min(HealthLegRight, amount);
  13518.             break;
  13519.     }
  13520. }
  13521.  
  13522. // ----------------------------------------------------------------------
  13523. // DamageAll()
  13524. // ----------------------------------------------------------------------
  13525.  
  13526. exec function DamageAll(optional int amount)
  13527. {
  13528.     if (!bCheatsEnabled)
  13529.         return;
  13530.  
  13531.     if (amount == 0)
  13532.         amount = 1000;
  13533.  
  13534.     HealthHead     -= Min(HealthHead, amount);
  13535.     HealthTorso    -= Min(HealthTorso, amount);
  13536.     HealthArmLeft  -= Min(HealthArmLeft, amount);
  13537.     HealthArmRight -= Min(HealthArmRight, amount);
  13538.     HealthLegLeft  -= Min(HealthLegLeft, amount);
  13539.     HealthLegRight -= Min(HealthLegRight, amount);
  13540. }
  13541.  
  13542. // ----------------------------------------------------------------------
  13543. // AllEnergy()
  13544. // ----------------------------------------------------------------------
  13545.  
  13546. exec function AllEnergy()
  13547. {
  13548.     if (!bCheatsEnabled)
  13549.         return;
  13550.  
  13551.     Energy = default.Energy;
  13552. }
  13553.  
  13554. // ----------------------------------------------------------------------
  13555. // AllCredits()
  13556. // ----------------------------------------------------------------------
  13557.  
  13558. exec function AllCredits()
  13559. {
  13560.     if (!bCheatsEnabled)
  13561.         return;
  13562.  
  13563.     Credits = 100000;
  13564. }
  13565.  
  13566. // ---------------------------------------------------------------------
  13567. // AllSkills()
  13568. // ----------------------------------------------------------------------
  13569.  
  13570. exec function AllSkills()
  13571. {
  13572.     if (!bCheatsEnabled)
  13573.         return;
  13574.  
  13575.     AllSkillPoints();
  13576.     SkillSystem.AddAllSkills();
  13577. }
  13578.  
  13579. // ----------------------------------------------------------------------
  13580. // AllSkillPoints()
  13581. // ----------------------------------------------------------------------
  13582.  
  13583. exec function AllSkillPoints()
  13584. {
  13585.     if (!bCheatsEnabled)
  13586.         return;
  13587.  
  13588.     SkillPointsTotal = 115900;
  13589.     SkillPointsAvail = 115900;
  13590. }
  13591.  
  13592. // ----------------------------------------------------------------------
  13593. // AllAugs()
  13594. // ----------------------------------------------------------------------
  13595.  
  13596. exec function AllAugs()
  13597. {
  13598.     local Augmentation anAug;
  13599.     local int i;
  13600.  
  13601.     if (!bCheatsEnabled)
  13602.         return;
  13603.  
  13604.     if (AugmentationSystem != None)
  13605.     {
  13606.         AugmentationSystem.AddAllAugs();
  13607.         AugmentationSystem.SetAllAugsToMaxLevel();
  13608.     }
  13609. }
  13610.  
  13611. // ----------------------------------------------------------------------
  13612. // AllWeapons()
  13613. // ----------------------------------------------------------------------
  13614.  
  13615. exec function AllWeapons()
  13616. {
  13617.     local Vector loc;
  13618.  
  13619.     if (!bCheatsEnabled)
  13620.         return;
  13621.  
  13622.     loc = Location + 2 * CollisionRadius * Vector(ViewRotation);
  13623.  
  13624.     Spawn(class'WeaponAssaultGun',,, loc);
  13625.     Spawn(class'WeaponAssaultShotgun',,, loc);
  13626.     Spawn(class'WeaponBaton',,, loc);
  13627.     Spawn(class'WeaponCombatKnife',,, loc);
  13628.     Spawn(class'WeaponCrowbar',,, loc);
  13629.     Spawn(class'WeaponEMPGrenade',,, loc);
  13630.     Spawn(class'WeaponFlamethrower',,, loc);
  13631.     Spawn(class'WeaponGasGrenade',,, loc);
  13632.     Spawn(class'WeaponGEPGun',,, loc);
  13633.     Spawn(class'WeaponHideAGun',,, loc);
  13634.     Spawn(class'WeaponLAM',,, loc);
  13635.     Spawn(class'WeaponLAW',,, loc);
  13636.     Spawn(class'WeaponMiniCrossbow',,, loc);
  13637.     Spawn(class'WeaponNanoSword',,, loc);
  13638.     Spawn(class'WeaponNanoVirusGrenade',,, loc);
  13639.     Spawn(class'WeaponPepperGun',,, loc);
  13640.     Spawn(class'WeaponPistol',,, loc);
  13641.     Spawn(class'WeaponPlasmaRifle',,, loc);
  13642.     Spawn(class'WeaponProd',,, loc);
  13643.     Spawn(class'WeaponRifle',,, loc);
  13644.     Spawn(class'WeaponSawedOffShotgun',,, loc);
  13645.     Spawn(class'WeaponShuriken',,, loc);
  13646.     Spawn(class'WeaponStealthPistol',,, loc);
  13647.     Spawn(class'WeaponSword',,, loc);
  13648. }
  13649.  
  13650. // ----------------------------------------------------------------------
  13651. // AllImages()
  13652. // ----------------------------------------------------------------------
  13653.  
  13654. exec function AllImages()
  13655. {
  13656.     local Vector loc;
  13657.     local Inventory item;
  13658.  
  13659.     if (!bCheatsEnabled)
  13660.         return;
  13661.  
  13662.     item = Spawn(class'Image01_GunFireSensor');
  13663.     item.Frob(Self, None);
  13664.     item = Spawn(class'Image01_LibertyIsland');
  13665.     item.Frob(Self, None);
  13666.     item = Spawn(class'Image01_TerroristCommander');
  13667.     item.Frob(Self, None);
  13668.     item = Spawn(class'Image02_Ambrosia_Flyer');
  13669.     item.Frob(Self, None);
  13670.     item = Spawn(class'Image02_NYC_Warehouse');
  13671.     item.Frob(Self, None);
  13672.     item = Spawn(class'Image02_BobPage_ManOfYear');
  13673.     item.Frob(Self, None);
  13674.     item = Spawn(class'Image03_747Diagram');
  13675.     item.Frob(Self, None);
  13676.     item = Spawn(class'Image03_NYC_Airfield');
  13677.     item.Frob(Self, None);
  13678.     item = Spawn(class'Image03_WaltonSimons');
  13679.     item.Frob(Self, None);
  13680.     item = Spawn(class'Image04_NSFHeadquarters');
  13681.     item.Frob(Self, None);
  13682.     item = Spawn(class'Image04_UNATCONotice');
  13683.     item.Frob(Self, None);
  13684.     item = Spawn(class'Image05_GreaselDisection');
  13685.     item.Frob(Self, None);
  13686.     item = Spawn(class'Image05_NYC_MJ12Lab');
  13687.     item.Frob(Self, None);
  13688.     item = Spawn(class'Image06_HK_Market');
  13689.     item.Frob(Self, None);
  13690.     item = Spawn(class'Image06_HK_MJ12Helipad');
  13691.     item.Frob(Self, None);
  13692.     item = Spawn(class'Image06_HK_MJ12Lab');
  13693.     item.Frob(Self, None);
  13694.     item = Spawn(class'Image06_HK_Versalife');
  13695.     item.Frob(Self, None);
  13696.     item = Spawn(class'Image06_HK_WanChai');
  13697.     item.Frob(Self, None);
  13698.     item = Spawn(class'Image08_JoeGreenMIBMJ12');
  13699.     item.Frob(Self, None);
  13700.     item = Spawn(class'Image09_NYC_Ship_Bottom');
  13701.     item.Frob(Self, None);
  13702.     item = Spawn(class'Image09_NYC_Ship_Top');
  13703.     item.Frob(Self, None);
  13704.     item = Spawn(class'Image10_Paris_Catacombs');
  13705.     item.Frob(Self, None);
  13706.     item = Spawn(class'Image10_Paris_CatacombsTunnels');
  13707.     item.Frob(Self, None);
  13708.     item = Spawn(class'Image10_Paris_Metro');
  13709.     item.Frob(Self, None);
  13710.     item = Spawn(class'Image11_Paris_Cathedral');
  13711.     item.Frob(Self, None);
  13712.     item = Spawn(class'Image11_Paris_CathedralEntrance');
  13713.     item.Frob(Self, None);
  13714.     item = Spawn(class'Image12_Vandenberg_Command');
  13715.     item.Frob(Self, None);
  13716.     item = Spawn(class'Image12_Vandenberg_Sub');
  13717.     item.Frob(Self, None);
  13718.     item = Spawn(class'Image12_Tiffany_HostagePic');
  13719.     item.Frob(Self, None);
  13720.     item = Spawn(class'Image14_OceanLab');
  13721.     item.Frob(Self, None);
  13722.     item = Spawn(class'Image14_Schematic');
  13723.     item.Frob(Self, None);
  13724.     item = Spawn(class'Image15_Area51Bunker');
  13725.     item.Frob(Self, None);
  13726.     item = Spawn(class'Image15_GrayDisection');
  13727.     item.Frob(Self, None);
  13728.     item = Spawn(class'Image15_BlueFusionDevice');
  13729.     item.Frob(Self, None);
  13730.     item = Spawn(class'Image15_Area51_Sector3');
  13731.     item.Frob(Self, None);
  13732.     item = Spawn(class'Image15_Area51_Sector4');
  13733.     item.Frob(Self, None);
  13734. }
  13735.  
  13736. // ----------------------------------------------------------------------
  13737. // Trig()
  13738. // ----------------------------------------------------------------------
  13739.  
  13740. exec function Trig(name ev)
  13741. {
  13742.     local Actor A;
  13743.  
  13744.     if (!bCheatsEnabled)
  13745.         return;
  13746.  
  13747.     if (ev != '')
  13748.         foreach AllActors(class'Actor', A, ev)
  13749.             A.Trigger(Self, Self);
  13750. }
  13751.  
  13752. // ----------------------------------------------------------------------
  13753. // UnTrig()
  13754. // ----------------------------------------------------------------------
  13755.  
  13756. exec function UnTrig(name ev)
  13757. {
  13758.     local Actor A;
  13759.  
  13760.     if (!bCheatsEnabled)
  13761.         return;
  13762.  
  13763.     if (ev != '')
  13764.         foreach AllActors(class'Actor', A, ev)
  13765.             A.UnTrigger(Self, Self);
  13766. }
  13767.  
  13768. // ----------------------------------------------------------------------
  13769. // SetState()
  13770. // ----------------------------------------------------------------------
  13771.  
  13772. exec function SetState(name state)
  13773. {
  13774.     local ScriptedPawn P;
  13775.     local Actor hitActor;
  13776.     local vector loc, line, HitLocation, hitNormal;
  13777.  
  13778.     if (!bCheatsEnabled)
  13779.         return;
  13780.  
  13781.     loc = Location;
  13782.     loc.Z += BaseEyeHeight;
  13783.     line = Vector(ViewRotation) * 2000;
  13784.  
  13785.     hitActor = Trace(hitLocation, hitNormal, loc+line, loc, true);
  13786.     P = ScriptedPawn(hitActor);
  13787.     if (P != None)
  13788.     {
  13789.         P.GotoState(state);
  13790.         ClientMessage("Setting "$P.BindName$" to the "$state$" state");
  13791.     }
  13792. }
  13793.  
  13794. // ----------------------------------------------------------------------
  13795. // DXDumpInfo()
  13796. //
  13797. // Dumps the following player information to the log file
  13798. // - inventory (with item counts)
  13799. // - health (as %)
  13800. // - energy (as %)
  13801. // - credits
  13802. // - skill points (avail and max)
  13803. // - skills
  13804. // - augmentations
  13805. // ----------------------------------------------------------------------
  13806.  
  13807. exec function DXDumpInfo()
  13808. {
  13809.     local DumpLocation dumploc;
  13810.     local DeusExLevelInfo info;
  13811.     local string userName, mapName, strCopies;
  13812.     local Inventory item, nextItem;
  13813.     local DeusExWeapon W;
  13814.     local Skill skill;
  13815.     local Augmentation aug;
  13816.     local bool bHasAugs;
  13817.  
  13818.     dumploc = CreateDumpLocationObject();
  13819.     if (dumploc != None)
  13820.     {
  13821.         userName = dumploc.GetCurrentUser();
  13822.         CriticalDelete(dumploc);
  13823.     }
  13824.  
  13825.     if (userName == "")
  13826.         userName = "NO USERNAME";
  13827.  
  13828.     mapName = "NO MAPNAME";
  13829.     foreach AllActors(class'DeusExLevelInfo', info)
  13830.         mapName = info.MapName;
  13831.  
  13832.     log("");
  13833.     log("**** DXDumpInfo - User: "$userName$" - Map: "$mapName$" ****");
  13834.     log("");
  13835.     log("  Inventory:");
  13836.  
  13837.     if (Inventory != None)
  13838.     {
  13839.         item = Inventory;
  13840.         do
  13841.         {
  13842.             nextItem = item.Inventory;
  13843.  
  13844.             if (item.bDisplayableInv || item.IsA('Ammo'))
  13845.             {
  13846.                 W = DeusExWeapon(item);
  13847.                 if ((W != None) && W.bHandToHand && (W.ProjectileClass != None))
  13848.                     strCopies = " ("$W.AmmoType.AmmoAmount$" rds)";
  13849.                 else if (item.IsA('Ammo') && (Ammo(item).PickupViewMesh != Mesh'TestBox'))
  13850.                     strCopies = " ("$Ammo(item).AmmoAmount$" rds)";
  13851.                 else if (item.IsA('Pickup') && (Pickup(item).NumCopies > 1))
  13852.                     strCopies = " ("$Pickup(item).NumCopies$")";
  13853.                 else
  13854.                     strCopies = "";
  13855.  
  13856.                 log("    "$item.GetItemName(String(item.Class))$strCopies);
  13857.             }
  13858.             item = nextItem;
  13859.         }
  13860.         until (item == None);
  13861.     }
  13862.     else
  13863.         log("    Empty");
  13864.  
  13865.     GenerateTotalHealth();
  13866.     log("");
  13867.     log("  Health:");
  13868.     log("    Overall   - "$Health$"%");
  13869.     log("    Head      - "$HealthHead$"%");
  13870.     log("    Torso     - "$HealthTorso$"%");
  13871.     log("    Left arm  - "$HealthArmLeft$"%");
  13872.     log("    Right arm - "$HealthArmRight$"%");
  13873.     log("    Left leg  - "$HealthLegLeft$"%");
  13874.     log("    Right leg - "$HealthLegRight$"%");
  13875.  
  13876.     log("");
  13877.     log("  BioElectric Energy:");
  13878.     log("    "$Int(Energy)$"%");
  13879.  
  13880.     log("");
  13881.     log("  Credits:");
  13882.     log("    "$Credits);
  13883.  
  13884.     log("");
  13885.     log("  Skill Points:");
  13886.     log("    Available    - "$SkillPointsAvail);
  13887.     log("    Total Earned - "$SkillPointsTotal);
  13888.  
  13889.     log("");
  13890.     log("  Skills:");
  13891.     if (SkillSystem != None)
  13892.     {
  13893.         skill = SkillSystem.FirstSkill;
  13894.         while (skill != None)
  13895.         {
  13896.             if (skill.SkillName != "")
  13897.                 log("    "$skill.SkillName$" - "$skill.skillLevelStrings[skill.CurrentLevel]);
  13898.  
  13899.             skill = skill.next;
  13900.         }
  13901.     }
  13902.  
  13903.     bHasAugs = False;
  13904.     log("");
  13905.     log("  Augmentations:");
  13906.     if (AugmentationSystem != None)
  13907.     {
  13908.         aug = AugmentationSystem.FirstAug;
  13909.         while (aug != None)
  13910.         {
  13911.             if (aug.bHasIt && (aug.AugmentationLocation != LOC_Default) && (aug.AugmentationName != ""))
  13912.             {
  13913.                 bHasAugs = True;
  13914.                 log("    "$aug.AugmentationName$" - Location: "$aug.AugLocsText[aug.AugmentationLocation]$" - Level: "$aug.CurrentLevel+1);
  13915.             }
  13916.  
  13917.             aug = aug.next;
  13918.         }
  13919.     }
  13920.  
  13921.     if (!bHasAugs)
  13922.         log("    None");
  13923.  
  13924.     log("");
  13925.     log("**** DXDumpInfo - END ****");
  13926.     log("");
  13927.  
  13928.     ClientMessage("Info dumped for user "$userName);
  13929. }
  13930.  
  13931.  
  13932. // ----------------------------------------------------------------------
  13933. // InvokeUIScreen()
  13934. //
  13935. // Calls DeusExRootWindow::InvokeUIScreen(), but first make sure
  13936. // a modifier (Alt, Shift, Ctrl) key isn't being held down.
  13937. // ----------------------------------------------------------------------
  13938.  
  13939. function InvokeUIScreen(Class<DeusExBaseWindow> windowClass)
  13940. {
  13941.     local DeusExRootWindow root;
  13942.     root = DeusExRootWindow(rootWindow);
  13943.     if (root != None)
  13944.     {
  13945.         if ( root.IsKeyDown( IK_Alt ) || root.IsKeyDown( IK_Shift ) || root.IsKeyDown( IK_Ctrl ))
  13946.             return;
  13947.  
  13948. //GMDX: stop lockpick and multitool cheat
  13949.       if (InHand!=None&&InHand.IsA('SkilledTool')&&(InHand.IsA('Lockpick')||InHand.IsA('MultiTool')))
  13950.       {
  13951.          if (SkilledTool(InHand).IsInState('UseIt'))
  13952.             return; //just cant InvokeUIScreen :P
  13953.       }
  13954.         if (bRealUI || bHardCoreMode)
  13955.         root.InvokeUIScreen(windowClass,true);
  13956.         else
  13957.         root.InvokeUIScreen(windowClass);
  13958.     }
  13959. }
  13960.  
  13961. // ----------------------------------------------------------------------
  13962. // ResetConversationHistory()
  13963. //
  13964. // Clears any conversation history, used primarily when starting a
  13965. // new game or travelling to new missions
  13966. // ----------------------------------------------------------------------
  13967.  
  13968. function ResetConversationHistory()
  13969. {
  13970.     if (conHistory != None)
  13971.     {
  13972.         CriticalDelete(conHistory);
  13973.         conHistory = None;
  13974.     }
  13975. }
  13976.  
  13977. // ======================================================================
  13978. // ======================================================================
  13979. // COLOR THEME MANAGER FUNCTIONS
  13980. // ======================================================================
  13981. // ======================================================================
  13982.  
  13983. // ----------------------------------------------------------------------
  13984. // CreateThemeManager()
  13985. // ----------------------------------------------------------------------
  13986.  
  13987. function CreateColorThemeManager()
  13988. {
  13989.     if (ThemeManager == None)
  13990.     {
  13991.         ThemeManager = Spawn(Class'ColorThemeManager', Self);
  13992.  
  13993.         // Add all default themes.
  13994.  
  13995.         // Menus
  13996.         ThemeManager.AddTheme(Class'ColorThemeMenu_Default');
  13997.         ThemeManager.AddTheme(Class'ColorThemeMenu_Custom1');
  13998.         ThemeManager.AddTheme(Class'ColorThemeMenu_BlueAndGold');
  13999.         ThemeManager.AddTheme(Class'ColorThemeMenu_CoolGreen');
  14000.         ThemeManager.AddTheme(Class'ColorThemeMenu_Cops');
  14001.         ThemeManager.AddTheme(Class'ColorThemeMenu_Cyan');
  14002.         ThemeManager.AddTheme(Class'ColorThemeMenu_DesertStorm');
  14003.         ThemeManager.AddTheme(Class'ColorThemeMenu_DriedBlood');
  14004.         ThemeManager.AddTheme(Class'ColorThemeMenu_Dusk');
  14005.         ThemeManager.AddTheme(Class'ColorThemeMenu_Earth');
  14006.         ThemeManager.AddTheme(Class'ColorThemeMenu_Green');
  14007.         ThemeManager.AddTheme(Class'ColorThemeMenu_Grey');
  14008.         ThemeManager.AddTheme(Class'ColorThemeMenu_IonStorm');
  14009.         ThemeManager.AddTheme(Class'ColorThemeMenu_Lava');
  14010.         ThemeManager.AddTheme(Class'ColorThemeMenu_NightVision');
  14011.         ThemeManager.AddTheme(Class'ColorThemeMenu_Ninja');
  14012.         ThemeManager.AddTheme(Class'ColorThemeMenu_Olive');
  14013.         ThemeManager.AddTheme(Class'ColorThemeMenu_PaleGreen');
  14014.         ThemeManager.AddTheme(Class'ColorThemeMenu_Pastel');
  14015.         ThemeManager.AddTheme(Class'ColorThemeMenu_Plasma');
  14016.         ThemeManager.AddTheme(Class'ColorThemeMenu_Primaries');
  14017.         ThemeManager.AddTheme(Class'ColorThemeMenu_Purple');
  14018.         ThemeManager.AddTheme(Class'ColorThemeMenu_Red');
  14019.         ThemeManager.AddTheme(Class'ColorThemeMenu_Seawater');
  14020.         ThemeManager.AddTheme(Class'ColorThemeMenu_SoylentGreen');
  14021.         ThemeManager.AddTheme(Class'ColorThemeMenu_Starlight');
  14022.         ThemeManager.AddTheme(Class'ColorThemeMenu_Steel');
  14023.         ThemeManager.AddTheme(Class'ColorThemeMenu_SteelGreen');
  14024.         ThemeManager.AddTheme(Class'ColorThemeMenu_Superhero');
  14025.         ThemeManager.AddTheme(Class'ColorThemeMenu_Terminator');
  14026.         ThemeManager.AddTheme(Class'ColorThemeMenu_Violet');
  14027.  
  14028.         // HUD
  14029.         ThemeManager.AddTheme(Class'ColorThemeHUD_Default');
  14030.         ThemeManager.AddTheme(Class'ColorThemeHUD_Custom2');
  14031.         ThemeManager.AddTheme(Class'ColorThemeHUD_Amber');
  14032.         ThemeManager.AddTheme(Class'ColorThemeHUD_Cops');
  14033.         ThemeManager.AddTheme(Class'ColorThemeHUD_Cyan');
  14034.         ThemeManager.AddTheme(Class'ColorThemeHUD_DarkBlue');
  14035.         ThemeManager.AddTheme(Class'ColorThemeHUD_DesertStorm');
  14036.         ThemeManager.AddTheme(Class'ColorThemeHUD_DriedBlood');
  14037.         ThemeManager.AddTheme(Class'ColorThemeHUD_Dusk');
  14038.         ThemeManager.AddTheme(Class'ColorThemeHUD_Grey');
  14039.         ThemeManager.AddTheme(Class'ColorThemeHUD_IonStorm');
  14040.         ThemeManager.AddTheme(Class'ColorThemeHUD_NightVision');
  14041.         ThemeManager.AddTheme(Class'ColorThemeHUD_Ninja');
  14042.         ThemeManager.AddTheme(Class'ColorThemeHUD_PaleGreen');
  14043.         ThemeManager.AddTheme(Class'ColorThemeHUD_Pastel');
  14044.         ThemeManager.AddTheme(Class'ColorThemeHUD_Plasma');
  14045.         ThemeManager.AddTheme(Class'ColorThemeHUD_Primaries');
  14046.         ThemeManager.AddTheme(Class'ColorThemeHUD_Purple');
  14047.         ThemeManager.AddTheme(Class'ColorThemeHUD_Red');
  14048.         ThemeManager.AddTheme(Class'ColorThemeHUD_SoylentGreen');
  14049.         ThemeManager.AddTheme(Class'ColorThemeHUD_Starlight');
  14050.         ThemeManager.AddTheme(Class'ColorThemeHUD_SteelGreen');
  14051.         ThemeManager.AddTheme(Class'ColorThemeHUD_Superhero');
  14052.         ThemeManager.AddTheme(Class'ColorThemeHUD_Terminator');
  14053.         ThemeManager.AddTheme(Class'ColorThemeHUD_Violet');
  14054.     }
  14055. }
  14056.  
  14057. // ----------------------------------------------------------------------
  14058. // NextHUDColorTheme()
  14059. //
  14060. // Cycles to the next available HUD color theme and squirts out
  14061. // a "StylesChanged" event.
  14062. // ----------------------------------------------------------------------
  14063.  
  14064. exec function NextHUDColorTheme()
  14065. {
  14066.     if (ThemeManager != None)
  14067.     {
  14068.         ThemeManager.NextHUDColorTheme();
  14069.         DeusExRootWindow(rootWindow).ChangeStyle();
  14070.     }
  14071. }
  14072.  
  14073. // ----------------------------------------------------------------------
  14074. // Cycles to the next available Menu color theme and squirts out
  14075. // a "StylesChanged" event.
  14076. // ----------------------------------------------------------------------
  14077.  
  14078. exec function NextMenuColorTheme()
  14079. {
  14080.     if (ThemeManager != None)
  14081.     {
  14082.         ThemeManager.NextMenuColorTheme();
  14083.         DeusExRootWindow(rootWindow).ChangeStyle();
  14084.     }
  14085. }
  14086.  
  14087. // ----------------------------------------------------------------------
  14088. // SetHUDBordersVisible()
  14089. // ----------------------------------------------------------------------
  14090.  
  14091. exec function SetHUDBordersVisible(bool bVisible)
  14092. {
  14093.     bHUDBordersVisible = bVisible;
  14094. }
  14095.  
  14096. // ----------------------------------------------------------------------
  14097. // GetHUDBordersVisible()
  14098. // ----------------------------------------------------------------------
  14099.  
  14100. function bool GetHUDBordersVisible()
  14101. {
  14102.     return bHUDBordersVisible;
  14103. }
  14104.  
  14105. // ----------------------------------------------------------------------
  14106. // SetHUDBorderTranslucency()
  14107. // ----------------------------------------------------------------------
  14108.  
  14109. exec function SetHUDBorderTranslucency(bool bNewTranslucency)
  14110. {
  14111.     bHUDBordersTranslucent = bNewTranslucency;
  14112. }
  14113.  
  14114. // ----------------------------------------------------------------------
  14115. // GetHUDBorderTranslucency()
  14116. // ----------------------------------------------------------------------
  14117.  
  14118. function bool GetHUDBorderTranslucency()
  14119. {
  14120.     return bHUDBordersTranslucent;
  14121. }
  14122.  
  14123. // ----------------------------------------------------------------------
  14124. // SetHUDBackgroundTranslucency()
  14125. // ----------------------------------------------------------------------
  14126.  
  14127. exec function SetHUDBackgroundTranslucency(bool bNewTranslucency)
  14128. {
  14129.     bHUDBackgroundTranslucent = bNewTranslucency;
  14130. }
  14131.  
  14132. // ----------------------------------------------------------------------
  14133. // GetHUDBackgroundTranslucency()
  14134. // ----------------------------------------------------------------------
  14135.  
  14136. function bool GetHUDBackgroundTranslucency()
  14137. {
  14138.     return bHUDBackgroundTranslucent;
  14139. }
  14140.  
  14141. // ----------------------------------------------------------------------
  14142. // SetMenuTranslucency()
  14143. // ----------------------------------------------------------------------
  14144.  
  14145. exec function SetMenuTranslucency(bool bNewTranslucency)
  14146. {
  14147.     bMenusTranslucent = bNewTranslucency;
  14148. }
  14149.  
  14150. // ----------------------------------------------------------------------
  14151. // GetMenuTranslucency()
  14152. // ----------------------------------------------------------------------
  14153.  
  14154. function bool GetMenuTranslucency()
  14155. {
  14156.     return bMenusTranslucent;
  14157. }
  14158.  
  14159. // ----------------------------------------------------------------------
  14160. // DebugInfo test functions
  14161. // ----------------------------------------------------------------------
  14162.  
  14163. exec function DebugCommand(string teststr)
  14164. {
  14165.     if (!bCheatsEnabled)
  14166.         return;
  14167.  
  14168.     if (GlobalDebugObj == None)
  14169.         GlobalDebugObj = new(Self) class'DebugInfo';
  14170.  
  14171.     if (GlobalDebugObj != None)
  14172.         GlobalDebugObj.Command(teststr);
  14173. }
  14174.  
  14175. exec function SetDebug(name cmd, name val)
  14176. {
  14177.     if (!bCheatsEnabled)
  14178.         return;
  14179.  
  14180.     if (GlobalDebugObj == None)
  14181.         GlobalDebugObj = new(Self) class'DebugInfo';
  14182.  
  14183.     Log("Want to setting Debug String " $ cmd $ " to " $ val);
  14184.  
  14185.     if (GlobalDebugObj != None)
  14186.         GlobalDebugObj.SetString(String(cmd),String(val));
  14187. }
  14188.  
  14189. exec function GetDebug(name cmd)
  14190. {
  14191.     local string temp;
  14192.  
  14193.     if (!bCheatsEnabled)
  14194.         return;
  14195.  
  14196.     if (GlobalDebugObj == None)
  14197.         GlobalDebugObj = new(Self) class'DebugInfo';
  14198.  
  14199.     if (GlobalDebugObj != None)
  14200.     {
  14201.         temp=GlobalDebugObj.GetString(String(cmd));
  14202.         Log("Debug String " $ cmd $ " has value " $ temp);
  14203.     }
  14204. }
  14205.  
  14206. exec function LogMsg(string msg)
  14207. {
  14208.     Log(msg);
  14209. }
  14210.  
  14211. simulated event Destroyed()
  14212. {
  14213.     if (GlobalDebugObj != None)
  14214.         CriticalDelete(GlobalDebugObj);
  14215.  
  14216.     ClearAugmentationDisplay();
  14217.  
  14218.     if (Role == ROLE_Authority)
  14219.       CloseThisComputer(ActiveComputer);
  14220.     ActiveComputer = None;
  14221.  
  14222.     Super.Destroyed();
  14223. }
  14224.  
  14225. // ----------------------------------------------------------------------
  14226. // Actor Location and Movement commands
  14227. // ----------------------------------------------------------------------
  14228.  
  14229. exec function MoveActor(int xPos, int yPos, int zPos)
  14230. {
  14231.     local Actor            hitActor;
  14232.     local Vector           hitLocation, hitNormal;
  14233.     local Vector           position, line, newPos;
  14234.  
  14235.     if (!bCheatsEnabled)
  14236.         return;
  14237.  
  14238.     position    = Location;
  14239.     position.Z += BaseEyeHeight;
  14240.     line        = Vector(ViewRotation) * 4000;
  14241.  
  14242.     hitActor = Trace(hitLocation, hitNormal, position+line, position, true);
  14243.     if (hitActor != None)
  14244.     {
  14245.         newPos.x=xPos;
  14246.         newPos.y=yPos;
  14247.         newPos.z=zPos;
  14248.         // hitPawn = ScriptedPawn(hitActor);
  14249.         Log( "Trying to move " $ hitActor.Name $ " from " $ hitActor.Location $ " to " $ newPos);
  14250.         hitActor.SetLocation(newPos);
  14251.         Log( "Ended up at " $ hitActor.Location );
  14252.     }
  14253. }
  14254.  
  14255. exec function WhereActor(optional int Me)
  14256. {
  14257.     local Actor            hitActor;
  14258.     local Vector           hitLocation, hitNormal;
  14259.     local Vector           position, line, newPos;
  14260.  
  14261.     if (!bCheatsEnabled)
  14262.         return;
  14263.  
  14264.     if (Me==1)
  14265.         hitActor=self;
  14266.     else
  14267.     {
  14268.         position    = Location;
  14269.         position.Z += BaseEyeHeight;
  14270.         line        = Vector(ViewRotation) * 4000;
  14271.         hitActor    = Trace(hitLocation, hitNormal, position+line, position, true);
  14272.     }
  14273.     if (hitActor != None)
  14274.     {
  14275.         Log( hitActor.Name $ " is at " $ hitActor.Location );
  14276.         BroadcastMessage( hitActor.Name $ " is at " $ hitActor.Location );
  14277.     }
  14278. }
  14279.  
  14280. // ----------------------------------------------------------------------
  14281. // Easter egg functions
  14282. // ----------------------------------------------------------------------
  14283.  
  14284. function Matrix()
  14285. {
  14286.     if (Sprite == None)
  14287.     {
  14288.         Sprite = Texture(DynamicLoadObject("Extras.Matrix_A00", class'Texture'));
  14289.         ConsoleCommand("RMODE 6");
  14290.     }
  14291.     else
  14292.     {
  14293.         Sprite = None;
  14294.         ConsoleCommand("RMODE 5");
  14295.     }
  14296. }
  14297.  
  14298. exec function IAmWarren()
  14299. {
  14300.     if (!bCheatsEnabled)
  14301.         return;
  14302.  
  14303.     if (!bWarrenEMPField)
  14304.     {
  14305.         bWarrenEMPField = true;
  14306.         WarrenTimer = 0;
  14307.         WarrenSlot  = 0;
  14308.         ClientMessage("Warren's EMP Field activated");  // worry about localization?
  14309.     }
  14310.     else
  14311.     {
  14312.         bWarrenEMPField = false;
  14313.         ClientMessage("Warren's EMP Field deactivated");  // worry about localization?
  14314.     }
  14315. }
  14316.  
  14317. // ----------------------------------------------------------------------
  14318. // UsingChargedPickup
  14319. // ----------------------------------------------------------------------
  14320.  
  14321. function bool UsingChargedPickup(class<ChargedPickup> itemclass)
  14322. {
  14323.     local inventory CurrentItem;
  14324.     local bool bFound;
  14325.  
  14326.     bFound = false;
  14327.  
  14328.     for (CurrentItem = Inventory; ((CurrentItem != None) && (!bFound)); CurrentItem = CurrentItem.inventory)
  14329.     {
  14330.       if ((CurrentItem.class == itemclass) && (CurrentItem.bActive))
  14331.          bFound = true;
  14332.     }
  14333.  
  14334.     return bFound;
  14335. }
  14336.  
  14337. // ----------------------------------------------------------------------
  14338. // MultiplayerSpecificFunctions
  14339. // ----------------------------------------------------------------------
  14340.  
  14341. // ----------------------------------------------------------------------
  14342. // ReceiveFirstOptionSync()
  14343. // DEUS_EX AMSD I have to enumerate every 2#%#@%Ing argument???
  14344. // ----------------------------------------------------------------------
  14345.  
  14346. function ReceiveFirstOptionSync ( Name PrefZero, Name PrefOne, Name PrefTwo, Name PrefThree, Name PrefFour)
  14347. {
  14348.     local int i;
  14349.     local Name AugPriority[5];
  14350.  
  14351.     if (bFirstOptionsSynced == true)
  14352.     {
  14353.       return;
  14354.     }
  14355.  
  14356.     AugPriority[0] = PrefZero;
  14357.     AugPriority[1] = PrefOne;
  14358.     AugPriority[2] = PrefTwo;
  14359.     AugPriority[3] = PrefThree;
  14360.     AugPriority[4] = PrefFour;
  14361.  
  14362.     for (i = 0; ((i < ArrayCount(AugPrefs)) && (i < ArrayCount(AugPriority))); i++)
  14363.     {
  14364.       AugPrefs[i] = AugPriority[i];
  14365.     }
  14366.     bFirstOptionsSynced = true;
  14367.  
  14368.     if (Role == ROLE_Authority)
  14369.     {
  14370.       if ((DeusExMPGame(Level.Game) != None) && (bSecondOptionsSynced))
  14371.       {
  14372.          DeusExMPGame(Level.Game).SetupAbilities(self);
  14373.       }
  14374.     }
  14375. }
  14376.  
  14377. // ----------------------------------------------------------------------
  14378. // ReceiveSecondOptionSync()
  14379. // DEUS_EX AMSD I have to enumerate every 2#%#@%Ing argument???
  14380. // ----------------------------------------------------------------------
  14381.  
  14382. function ReceiveSecondOptionSync ( Name PrefFive, Name PrefSix, Name PrefSeven, Name PrefEight)
  14383. {
  14384.     local int i;
  14385.     local Name AugPriority[9];
  14386.  
  14387.     if (bSecondOptionsSynced == true)
  14388.     {
  14389.       return;
  14390.     }
  14391.  
  14392.     AugPriority[5] = PrefFive;
  14393.     AugPriority[6] = PrefSix;
  14394.     AugPriority[7] = PrefSeven;
  14395.     AugPriority[8] = PrefEight;
  14396.  
  14397.     for (i = 5; ((i < ArrayCount(AugPrefs)) && (i < ArrayCount(AugPriority))); i++)
  14398.     {
  14399.       AugPrefs[i] = AugPriority[i];
  14400.     }
  14401.     bSecondOptionsSynced = true;
  14402.  
  14403.     if (Role == ROLE_Authority)
  14404.     {
  14405.       if ((DeusExMPGame(Level.Game) != None) && (bFirstOptionsSynced))
  14406.       {
  14407.          DeusExMPGame(Level.Game).SetupAbilities(self);
  14408.       }
  14409.     }
  14410. }
  14411.  
  14412. // ----------------------------------------------------------------------
  14413. // ClientPlayAnimation
  14414. // ----------------------------------------------------------------------
  14415.  
  14416. simulated function ClientPlayAnimation( Actor src, Name anim, float rate, bool bLoop )
  14417. {
  14418.     if ( src != None )
  14419.     {
  14420.             //      if ( bLoop )
  14421.             //          src.LoopAnim(anim, ,rate);
  14422.             //      else
  14423.             src.PlayAnim(anim, ,rate);
  14424.     }
  14425. }
  14426.  
  14427. // ----------------------------------------------------------------------
  14428. // ClientSpawnProjectile
  14429. // ----------------------------------------------------------------------
  14430.  
  14431. simulated function ClientSpawnProjectile( class<projectile> ProjClass, Actor owner, Vector Start, Rotator AdjustedAim )
  14432. {
  14433.     local DeusExProjectile proj;
  14434.  
  14435.     proj = DeusExProjectile(Spawn(ProjClass, Owner,, Start, AdjustedAim));
  14436.     if ( proj != None )
  14437.     {
  14438.         proj.RemoteRole = ROLE_None;
  14439.         proj.Damage = 0;
  14440.     }
  14441. }
  14442.  
  14443. // ----------------------------------------------------------------------
  14444. // ClientSpawnHits
  14445. // ----------------------------------------------------------------------
  14446.  
  14447. simulated function ClientSpawnHits( bool bPenetrating, bool bHandToHand, Vector HitLocation, Vector HitNormal, Actor Other, float Damage)
  14448. {
  14449.     local TraceHitSpawner hitspawner;
  14450.     log("DX");
  14451.  
  14452.     if (inHand.isA('WeaponNanoSword'))
  14453.     {
  14454.       class'TraceHitSpawner'.default.bForceBulletHole=true;
  14455.       log("NANO FOUND");
  14456.     }
  14457.     if (bPenetrating)
  14458.     {
  14459.       if (bHandToHand)
  14460.       {
  14461.          hitspawner = Spawn(class'TraceHitHandSpawner',Other,,HitLocation,Rotator(HitNormal));
  14462.       }
  14463.       else
  14464.       {
  14465.  
  14466.          hitspawner = Spawn(class'TraceHitSpawner',Other,,HitLocation,Rotator(HitNormal));
  14467.             hitspawner.HitDamage = Damage;
  14468.       }
  14469.     }
  14470.     else
  14471.     {
  14472.       if (bHandToHand)
  14473.       {
  14474.          hitspawner = Spawn(class'TraceHitHandNonPenSpawner',Other,,HitLocation,Rotator(HitNormal));
  14475.          if (IsInState('Dying'))
  14476.          hitspawner = none; //CyberP: death overrides melee attacks
  14477.       }
  14478.       else
  14479.       {
  14480.          hitspawner = Spawn(class'TraceHitNonPenSpawner',Other,,HitLocation,Rotator(HitNormal));
  14481.       }
  14482.     }
  14483.     if (hitSpawner != None)
  14484.     {
  14485.       hitspawner.HitDamage = Damage;
  14486.       if (inHand.isA('WeaponNanoSword'))
  14487.       {
  14488.          log("From DXplayer");
  14489.          hitSpawner.damageType='NanoSword';
  14490.       }
  14491.     }
  14492. }
  14493.  
  14494. // ----------------------------------------------------------------------
  14495. // NintendoImmunityEffect()
  14496. // ----------------------------------------------------------------------
  14497. function NintendoImmunityEffect( bool on )
  14498. {
  14499.     bNintendoImmunity = on;
  14500.  
  14501.     if (bNintendoImmunity)
  14502.     {
  14503.         NintendoImmunityTime = Level.Timeseconds + NintendoDelay;
  14504.         NintendoImmunityTimeLeft = NintendoDelay;
  14505.     }
  14506.     else
  14507.         NintendoImmunityTimeLeft = 0.0;
  14508. }
  14509.  
  14510. // ----------------------------------------------------------------------
  14511. // GetAugPriority()
  14512. // Returns -1 if the player has the aug.
  14513. // Returns 0-8 (0 being higher priority) for the aug priority.
  14514. // If the player doesn't list the aug as a priority, returns the first
  14515. // unoccupied slot num (9 if all are filled).
  14516. // ----------------------------------------------------------------------
  14517. function int GetAugPriority( Augmentation AugToCheck)
  14518. {
  14519.     local Name AugName;
  14520.     local int PriorityIndex;
  14521.  
  14522.     AugName = AugToCheck.Class.Name;
  14523.  
  14524.     if (AugToCheck.bHasIt)
  14525.       return -1;
  14526.  
  14527.     for (PriorityIndex = 0; PriorityIndex < ArrayCount(AugPrefs); PriorityIndex++)
  14528.     {
  14529.       if (AugPrefs[PriorityIndex] == AugName)
  14530.       {
  14531.          return PriorityIndex;
  14532.       }
  14533.       if (AugPrefs[PriorityIndex] == '')
  14534.       {
  14535.          return PriorityIndex;
  14536.       }
  14537.     }
  14538.  
  14539.     return PriorityIndex;
  14540. }
  14541.  
  14542. // ----------------------------------------------------------------------
  14543. // GrantAugs()
  14544. // Grants augs in order of priority.
  14545. // Sadly, we do this on the client because propagation of requested augs
  14546. // takes so long.
  14547. // ----------------------------------------------------------------------
  14548. function GrantAugs(int NumAugs)
  14549. {
  14550.     local Augmentation CurrentAug;
  14551.     local int PriorityIndex;
  14552.     local int AugsLeft;
  14553.  
  14554.     if (Role < ROLE_Authority)
  14555.       return;
  14556.     AugsLeft = NumAugs;
  14557.  
  14558.     for (PriorityIndex = 0; PriorityIndex < ArrayCount(AugPrefs); PriorityIndex++)
  14559.     {
  14560.       if (AugsLeft <= 0)
  14561.       {
  14562.          return;
  14563.       }
  14564.       if (AugPrefs[PriorityIndex] == '')
  14565.       {
  14566.          return;
  14567.       }
  14568.       for (CurrentAug = AugmentationSystem.FirstAug; CurrentAug != None; CurrentAug = CurrentAug.next)
  14569.       {
  14570.          if ((CurrentAug.Class.Name == AugPrefs[PriorityIndex]) && (CurrentAug.bHasIt == False))
  14571.          {
  14572.              AugmentationSystem.GivePlayerAugmentation(CurrentAug.Class);
  14573.                 // Max out aug
  14574.                 if (CurrentAug.bHasIt)
  14575.                     CurrentAug.CurrentLevel = CurrentAug.MaxLevel;
  14576.             AugsLeft = AugsLeft - 1;
  14577.          }
  14578.       }
  14579.     }
  14580. }
  14581.  
  14582. // ------------------------------------------------------------------------
  14583. // GiveInitialInventory()
  14584. // ------------------------------------------------------------------------
  14585.  
  14586. function GiveInitialInventory()
  14587. {
  14588.     local Inventory anItem;
  14589.  
  14590.     // Give the player a pistol.
  14591.  
  14592.     // spawn it.
  14593.     if ((!Level.Game.IsA('DeusExMPGame')) || (DeusExMPGame(Level.Game).bStartWithPistol))
  14594.     {
  14595.       anItem = Spawn(class'WeaponPistol');
  14596.       // "frob" it for pickup.  This will spawn a copy and give copy to player.
  14597.       anItem.Frob(Self,None);
  14598.       // Set it to be in belt (it will be the first inventory item)
  14599.       inventory.bInObjectBelt = True;
  14600.       // destroy original.
  14601.       anItem.Destroy();
  14602.  
  14603.       // Give some starting ammo.
  14604.       anItem = Spawn(class'Ammo10mm');
  14605.       DeusExAmmo(anItem).AmmoAmount=50;
  14606.       anItem.Frob(Self,None);
  14607.       anItem.Destroy();
  14608.     }
  14609.  
  14610.     // Give the player a medkit.
  14611.     anItem = Spawn(class'MedKit');
  14612.     anItem.Frob(Self,None);
  14613.     inventory.bInObjectBelt = True;
  14614.     anItem.Destroy();
  14615.  
  14616.     // Give them a lockpick and a multitool so they can make choices with skills
  14617.     // when they come across electronics and locks
  14618.     anItem = Spawn(class'Lockpick');
  14619.     anItem.Frob(Self,None);
  14620.     inventory.bInObjectBelt = True;
  14621.     anItem.Destroy();
  14622.  
  14623.     anItem = Spawn(class'Multitool');
  14624.     anItem.Frob(Self,None);
  14625.     inventory.bInObjectBelt = True;
  14626.     anItem.Destroy();
  14627. }
  14628.  
  14629. // ----------------------------------------------------------------------
  14630. // MultiplayerTick()
  14631. // Not the greatest name, handles single player ticks as well.  Basically
  14632. // anything tick style stuff that should be propagated to the server gets
  14633. // propagated as this one function call.
  14634. // ----------------------------------------------------------------------
  14635. function MultiplayerTick(float DeltaTime)
  14636. {
  14637.     local int burnTime;
  14638.     local float augLevel;
  14639.  
  14640.     Super.MultiplayerTick(DeltaTime);
  14641.  
  14642.     //If we've just put away items, reset this.
  14643.     if ((LastInHand != InHand) && (Level.Netmode == NM_Client) && (inHand == None))
  14644.     {
  14645.        ClientInHandPending = None;
  14646.     }
  14647.  
  14648.     LastInHand = InHand;
  14649.  
  14650.     if ((PlayerIsClient()) || (Level.NetMode == NM_ListenServer))
  14651.     {
  14652.       if ((ShieldStatus != SS_Off) && (DamageShield == None))
  14653.          DrawShield();
  14654.         if ( (NintendoImmunityTimeLeft > 0.0) && ( InvulnSph == None ))
  14655.             DrawInvulnShield();
  14656.       if (Style != STY_Translucent)
  14657.          CreateShadow();
  14658.       else
  14659.          KillShadow();
  14660.     }
  14661.  
  14662.     if (Role < ROLE_Authority)
  14663.       return;
  14664.  
  14665.     UpdateInHand();
  14666.  
  14667.     UpdatePoison(DeltaTime);
  14668.  
  14669.     if (lastRefreshTime < 0)
  14670.       lastRefreshTime = 0;
  14671.  
  14672.     lastRefreshTime = lastRefreshTime + DeltaTime;
  14673.  
  14674.     if (bOnFire)
  14675.     {
  14676.         if ( Level.NetMode != NM_Standalone )
  14677.             burnTime = Class'WeaponFlamethrower'.Default.mpBurnTime;
  14678.         else
  14679.             burnTime = Class'WeaponFlamethrower'.Default.BurnTime;
  14680.         burnTimer += deltaTime;
  14681.         if (burnTimer >= burnTime)
  14682.             ExtinguishFire();
  14683.     }
  14684.  
  14685.     if (lastRefreshTime < 0.25)
  14686.       return;
  14687.  
  14688.     if (ShieldTimer > 0)
  14689.       ShieldTimer = ShieldTimer - lastRefreshTime;
  14690.  
  14691.     if (ShieldStatus == SS_Fade)
  14692.       ShieldStatus = SS_Off;
  14693.  
  14694.     if (ShieldTimer <= 0)
  14695.     {
  14696.       if (ShieldStatus == SS_Strong)
  14697.          ShieldStatus = SS_Fade;
  14698.     }
  14699.  
  14700.     // If we have a drone active (post-death etc) and we're not using the aug, kill it off
  14701.     augLevel = AugmentationSystem.GetAugLevelValue(class'AugDrone');
  14702.     if (( aDrone != None ) && (augLevel == -1.0))
  14703.         aDrone.TakeDamage(100, None, aDrone.Location, vect(0,0,0), 'EMP');
  14704.  
  14705.     if ( Level.Timeseconds > ServerTimeLastRefresh )
  14706.     {
  14707.         SetServerTimeDiff( Level.Timeseconds );
  14708.         ServerTimeLastRefresh = Level.Timeseconds + 10.0;
  14709.     }
  14710.  
  14711.     MaintainEnergy(lastRefreshTime);
  14712.     UpdateTranslucency(lastRefreshTime);
  14713.     if ( bNintendoImmunity )
  14714.     {
  14715.         NintendoImmunityTimeLeft = NintendoImmunityTime - Level.Timeseconds;
  14716.         if ( Level.Timeseconds > NintendoImmunityTime )
  14717.             NintendoImmunityEffect( False );
  14718.     }
  14719.     RepairInventory();
  14720.     lastRefreshTime = 0;
  14721. }
  14722.  
  14723. // ----------------------------------------------------------------------
  14724.  
  14725. function ForceDroneOff()
  14726. {
  14727.     local AugDrone anAug;
  14728.  
  14729.     anAug = AugDrone(AugmentationSystem.FindAugmentation(class'AugDrone'));
  14730.     //foreach AllActors(class'AugDrone', anAug)
  14731.     if (anAug != None)
  14732.       anAug.Deactivate();
  14733. }
  14734.  
  14735. // ----------------------------------------------------------------------
  14736. // PlayerIsListenClient()
  14737. // Returns True if the current player is the "client" playing ON the
  14738. // listen server.
  14739. // ----------------------------------------------------------------------
  14740. function bool PlayerIsListenClient()
  14741. {
  14742.     return ((GetPlayerPawn() == Self) && (Level.NetMode == NM_ListenServer));
  14743. }
  14744.  
  14745. // ----------------------------------------------------------------------
  14746. // PlayerIsRemoteClient()
  14747. // Returns true if this player is the main player of this remote client
  14748. // -----------------------------------------------------------------------
  14749. function bool PlayerIsRemoteClient()
  14750. {
  14751.     return ((Level.NetMode == NM_Client) && (Role == ROLE_AutonomousProxy));
  14752. }
  14753.  
  14754. // ----------------------------------------------------------------------
  14755. // PlayerIsClient()
  14756. // Returns true if the current player is the "client" playing ON the
  14757. // listen server OR a remote client
  14758. // ----------------------------------------------------------------------
  14759. function bool PlayerIsClient()
  14760. {
  14761.     return (PlayerIsListenClient() || PlayerIsRemoteClient());
  14762. }
  14763.  
  14764. // ----------------------------------------------------------------------
  14765. // DrawShield()
  14766. // ----------------------------------------------------------------------
  14767. simulated function DrawShield()
  14768. {
  14769.     local ShieldEffect shield;
  14770.  
  14771.     if (DamageShield != None)
  14772.     {
  14773.       return;
  14774.     }
  14775.  
  14776.     shield = Spawn(class'ShieldEffect', Self,, Location, Rotation);
  14777.     if (shield != None)
  14778.     {
  14779.         shield.SetBase(Self);
  14780.       shield.RemoteRole = ROLE_None;
  14781.       shield.AttachedPlayer = Self;
  14782.     }
  14783.  
  14784.     DamageShield = shield;
  14785. }
  14786.  
  14787. // ----------------------------------------------------------------------
  14788. // DrawInvulnShield()
  14789. // ----------------------------------------------------------------------
  14790. simulated function DrawInvulnShield()
  14791. {
  14792.     if (( InvulnSph != None ) || (Level.NetMode == NM_Standalone))
  14793.         return;
  14794.  
  14795.     InvulnSph = Spawn(class'InvulnSphere', Self, , Location, Rotation );
  14796.     if ( InvulnSph != None )
  14797.     {
  14798.         InvulnSph.SetBase( Self );
  14799.         InvulnSph.RemoteRole = ROLE_None;
  14800.         InvulnSph.AttachedPlayer = Self;
  14801.         InvulnSph.LifeSpan = NintendoImmunityTimeLeft;
  14802.     }
  14803. }
  14804.  
  14805. // ----------------------------------------------------------------------
  14806. // CreatePlayerTracker()
  14807. // ----------------------------------------------------------------------
  14808. simulated function CreatePlayerTracker()
  14809. {
  14810.     local MPPlayerTrack PlayerTracker;
  14811.  
  14812.     PlayerTracker = Spawn(class'MPPlayerTrack');
  14813.     PlayerTracker.AttachedPlayer = Self;
  14814. }
  14815.  
  14816. // ----------------------------------------------------------------------
  14817. // DisconnectPlayer()
  14818. // ----------------------------------------------------------------------
  14819. exec function DisconnectPlayer()
  14820. {
  14821.     if (DeusExRootWindow(rootWindow) != None)
  14822.         DeusExRootWindow(rootWindow).ClearWindowStack();
  14823.  
  14824.     if (PlayerIsRemoteClient())
  14825.       ConsoleCommand("disconnect");
  14826.  
  14827.     if (PlayerIsListenClient())
  14828.       ConsoleCommand("start dx.dx");
  14829. }
  14830.  
  14831. exec function ShowPlayerPawnList()
  14832. {
  14833.     local pawn curpawn;
  14834.  
  14835.     for (curpawn = level.pawnlist; curpawn != none; curpawn = curpawn.nextpawn)
  14836.       log("======>Pawn is "$curpawn);
  14837. }
  14838.  
  14839. // ----------------------------------------------------------------------
  14840. // KillShadow
  14841. // ----------------------------------------------------------------------
  14842. simulated function KillShadow()
  14843. {
  14844.     if (Shadow != None)
  14845.       Shadow.Destroy();
  14846.     Shadow = None;
  14847. }
  14848.  
  14849. // ----------------------------------------------------------------------
  14850. // CreateShadow
  14851. // ----------------------------------------------------------------------
  14852. simulated function CreateShadow()
  14853. {
  14854.     if (Shadow == None)
  14855.     {
  14856.       Shadow = Spawn(class'Shadow', Self,, Location-vect(0,0,1)*CollisionHeight, rot(16384,0,0));
  14857.       if (Shadow != None)
  14858.       {
  14859.          Shadow.RemoteRole = ROLE_None;
  14860.       }
  14861.     }
  14862. }
  14863.  
  14864. // ----------------------------------------------------------------------
  14865. // LocalLog
  14866. // ----------------------------------------------------------------------
  14867. function LocalLog(String S)
  14868. {
  14869.     if (( Player != None ) && ( Player.Console != None ))
  14870.         Player.Console.AddString(S);
  14871. }
  14872.  
  14873. // ----------------------------------------------------------------------
  14874. // ShowDemoSplash()
  14875. // ----------------------------------------------------------------------
  14876. function ShowDemoSplash()
  14877. {
  14878.     local DeusExRootWindow root;
  14879.  
  14880.     root = DeusExRootWindow(rootWindow);
  14881.     if (root != None)
  14882.         root.PushWindow(Class'DemoSplashWindow');
  14883. }
  14884.  
  14885. // ----------------------------------------------------------------------
  14886. // VerifyConsole()
  14887. // Verifies that console is Engine.Console.  If you want something different,
  14888. // override this in a subclassed player class.
  14889. // ----------------------------------------------------------------------
  14890.  
  14891. function VerifyConsole(Class<Console> ConsoleClass)
  14892. {
  14893.     local bool bCheckPassed;
  14894.  
  14895.     bCheckPassed = True;
  14896.  
  14897.     if (Player.Console == None)
  14898.         bCheckPassed = False;
  14899.     else if (Player.Console.Class != ConsoleClass)
  14900.         bCheckPassed = False;
  14901.  
  14902.     if (bCheckPassed == False)
  14903.         FailConsoleCheck();
  14904. }
  14905.  
  14906. // ----------------------------------------------------------------------
  14907. // VerifyRootWindow()
  14908. // Verifies that the root window is the right kind of root window, since
  14909. // it can be changed in the ini
  14910. // ----------------------------------------------------------------------
  14911. function VerifyRootWindow(Class<DeusExRootWindow> WindowClass)
  14912. {
  14913.     local bool bCheckPassed;
  14914.  
  14915.     bCheckPassed = True;
  14916.  
  14917.     if (RootWindow == None)
  14918.         bCheckPassed = False;
  14919.     else if (RootWindow.Class != WindowClass)
  14920.         bCheckPassed = False;
  14921.  
  14922.     if (bCheckPassed == False)
  14923.         FailRootWindowCheck();
  14924. }
  14925.  
  14926. // ----------------------------------------------------------------------
  14927. // FailRootWindowCheck()
  14928. // ----------------------------------------------------------------------
  14929. function FailRootWindowCheck()
  14930. {
  14931.     if (Level.Game.IsA('DeusExGameInfo'))
  14932.         DeusExGameInfo(Level.Game).FailRootWindowCheck(Self);
  14933. }
  14934.  
  14935. // ----------------------------------------------------------------------
  14936. // FailConsoleCheck()
  14937. // ----------------------------------------------------------------------
  14938. function FailConsoleCheck()
  14939. {
  14940.     if (Level.Game.IsA('DeusExGameInfo'))
  14941.         DeusExGameInfo(Level.Game).FailConsoleCheck(Self);
  14942. }
  14943.  
  14944. // ----------------------------------------------------------------------
  14945. // Possess()
  14946. // ----------------------------------------------------------------------
  14947. event Possess()
  14948. {
  14949.     Super.Possess();
  14950.  
  14951.     if (Level.Netmode == NM_Client)
  14952.     {
  14953.         ClientPossessed();
  14954.     }
  14955. }
  14956.  
  14957. // ----------------------------------------------------------------------
  14958. // ClientPossessed()
  14959. // ----------------------------------------------------------------------
  14960. function ClientPossessed()
  14961. {
  14962.     if (Level.Game.IsA('DeusExGameInfo'))
  14963.         DeusExGameInfo(Level.Game).ClientPlayerPossessed(Self);
  14964. }
  14965.  
  14966. // ----------------------------------------------------------------------
  14967. // ForceDisconnect
  14968. // ----------------------------------------------------------------------
  14969. function ForceDisconnect(string Message)
  14970. {
  14971.     player.Console.AddString(Message);
  14972.     DisconnectPlayer();
  14973. }
  14974.  
  14975.  
  14976. /*
  14977. //----------------------------------------------------------------------------
  14978. // dasraiser keybind move offset and rotations
  14979. //
  14980. exec function MyFovPos()
  14981. {
  14982.     if ((inHand!=none)&&(inHand.IsA('DeusExWeapon')))
  14983.       DeusExWeapon(inHand).MyFovPos();
  14984. }
  14985. exec function MyFovNeg()
  14986. {
  14987.     if ((inHand!=none)&&(inHand.IsA('DeusExWeapon')))
  14988.       DeusExWeapon(inHand).MyFovNeg();
  14989. }
  14990.  
  14991. exec function MyOfsetYPos()
  14992. {
  14993.     if ((inHand!=none)&&(inHand.IsA('DeusExWeapon')))
  14994.       DeusExWeapon(inHand).MyOfsetYPos();
  14995. }
  14996. exec function MyOfsetXPos()
  14997. {
  14998.     if ((inHand!=none)&&(inHand.IsA('DeusExWeapon')))
  14999.       DeusExWeapon(inHand).MyOfsetXPos();
  15000. }
  15001. exec function MyOfsetZPos()
  15002. {
  15003.     if ((inHand!=none)&&(inHand.IsA('DeusExWeapon')))
  15004.       DeusExWeapon(inHand).MyOfsetZPos();
  15005. }
  15006. exec function MyOfsetYNeg()
  15007. {
  15008.     if ((inHand!=none)&&(inHand.IsA('DeusExWeapon')))
  15009.       DeusExWeapon(inHand).MyOfsetYNeg();
  15010. }
  15011. exec function MyOfsetXNeg()
  15012. {
  15013.     if ((inHand!=none)&&(inHand.IsA('DeusExWeapon')))
  15014.       DeusExWeapon(inHand).MyOfsetXNeg();
  15015.  
  15016. }
  15017. exec function MyOfsetZNeg()
  15018. {
  15019.     if ((inHand!=none)&&(inHand.IsA('DeusExWeapon')))
  15020.       DeusExWeapon(inHand).MyOfsetZNeg();
  15021. }
  15022. exec function MyOfsetRollPlus()
  15023. {
  15024.     if ((inHand!=none)&&(inHand.IsA('DeusExWeapon')))
  15025.       DeusExWeapon(inHand).MyOfsetRollPlus();
  15026. }
  15027. exec function MyOfsetPitchPlus()
  15028. {
  15029.     if ((inHand!=none)&&(inHand.IsA('DeusExWeapon')))
  15030.       DeusExWeapon(inHand).MyOfsetPitchPlus();
  15031. }
  15032. exec function MyOfsetYawPlus()
  15033. {
  15034.     if ((inHand!=none)&&(inHand.IsA('DeusExWeapon')))
  15035.       DeusExWeapon(inHand).MyOfsetYawPlus();
  15036. }
  15037.  
  15038. exec function MyOfsetRollMinus()
  15039. {
  15040.     if ((inHand!=none)&&(inHand.IsA('DeusExWeapon')))
  15041.       DeusExWeapon(inHand).MyOfsetRollMinus();
  15042. }
  15043. exec function MyOfsetPitchMinus()
  15044. {
  15045.     if ((inHand!=none)&&(inHand.IsA('DeusExWeapon')))
  15046.       DeusExWeapon(inHand).MyOfsetPitchMinus();
  15047. }
  15048. exec function MyOfsetYawMinus()
  15049. {
  15050.     if ((inHand!=none)&&(inHand.IsA('DeusExWeapon')))
  15051.       DeusExWeapon(inHand).MyOfsetYawMinus();
  15052. }
  15053. exec function MyLogInfos()
  15054. {
  15055.     log("test");
  15056.     if ((inHand!=none)&&(inHand.IsA('DeusExWeapon')))
  15057.       DeusExWeapon(inHand).MyLogInfos();
  15058. }
  15059.  
  15060.  
  15061. */
  15062. // ----------------------------------------------------------------------
  15063. // ----------------------------------------------------------------------
  15064.  
  15065. defaultproperties
  15066. {
  15067.      TruePlayerName="JC Denton"
  15068.      CombatDifficulty=1.000000
  15069.      SkillPointsTotal=5000
  15070.      SkillPointsAvail=5000
  15071.      Credits=500
  15072.      Energy=100.000000
  15073.      EnergyMax=100.000000
  15074.      MaxRegenPoint=25.000000
  15075.      RegenRate=1.500000
  15076.      MaxFrobDistance=112.000000
  15077.      maxInvRows=6
  15078.      maxInvCols=5
  15079.      bBeltIsMPInventory=True
  15080.      RunSilentValue=1.000000
  15081.      ClotPeriod=30.000000
  15082.      strStartMap="01_NYC_UNATCOIsland"
  15083.      bObjectNames=True
  15084.      bNPCHighlighting=True
  15085.      bSubtitles=True
  15086.      bAlwaysRun=True
  15087.      logTimeout=3.000000
  15088.      maxLogLines=4
  15089.      bHelpMessages=True
  15090.      bObjectBeltVisible=True
  15091.      bHitDisplayVisible=True
  15092.      bAmmoDisplayVisible=True
  15093.      bAugDisplayVisible=True
  15094.      bDisplayAmmoByClip=True
  15095.      bCompassVisible=True
  15096.      bCrosshairVisible=True
  15097.      bAutoReload=True
  15098.      bDisplayAllGoals=True
  15099.      bHUDShowAllAugs=True
  15100.      bShowAmmoDescriptions=True
  15101.      bConfirmSaveDeletes=True
  15102.      bConfirmNoteDeletes=True
  15103.      bAskedToTrain=True
  15104.      AugPrefs(0)=AugVision
  15105.      AugPrefs(1)=AugHealing
  15106.      AugPrefs(2)=AugSpeed
  15107.      AugPrefs(3)=AugDefense
  15108.      AugPrefs(4)=AugBallistic
  15109.      AugPrefs(5)=AugShield
  15110.      AugPrefs(6)=AugEMP
  15111.      AugPrefs(7)=AugStealth
  15112.      AugPrefs(8)=AugAqualung
  15113.      MenuThemeName="Default"
  15114.      HUDThemeName="Default"
  15115.      bHUDBordersVisible=True
  15116.      bHUDBordersTranslucent=True
  15117.      bHUDBackgroundTranslucent=True
  15118.      bMenusTranslucent=True
  15119.      InventoryFull="You don't have enough room in your inventory to pick up the %s"
  15120.      TooMuchAmmo="You already have enough of that type of ammo"
  15121.      TooHeavyToLift="It's too heavy to lift"
  15122.      CannotLift="You can't lift that"
  15123.      NoRoomToLift="There's no room to lift that"
  15124.      CanCarryOnlyOne="You can only carry one %s"
  15125.      CannotDropHere="Can't drop that here"
  15126.      HandsFull="Your hands are full"
  15127.      NoteAdded="Note Received - Check DataVault For Details"
  15128.      GoalAdded="Goal Received - Check DataVault For Details"
  15129.      PrimaryGoalCompleted="Primary Goal Completed"
  15130.      SecondaryGoalCompleted="Secondary Goal Completed"
  15131.      EnergyDepleted="Bio-electric energy reserves depleted"
  15132.      AddedNanoKey="%s added to Nano Key Ring"
  15133.      HealedPointsLabel="Healed %d points"
  15134.      HealedPointLabel="Healed %d point"
  15135.      SkillPointsAward="%d skill points awarded"
  15136.      QuickSaveGameTitle="Quick Save"
  15137.      WeaponUnCloak="Weapon drawn... Uncloaking"
  15138.      TakenOverString="I've taken over the "
  15139.      HeadString="Head"
  15140.      TorsoString="Torso"
  15141.      LegsString="Legs"
  15142.      WithTheString=" with the "
  15143.      WithString=" with "
  15144.      PoisonString=" with deadly poison"
  15145.      BurnString=" with excessive burning"
  15146.      NoneString="None"
  15147.      MPDamageMult=1.000000
  15148.      bHDTP_JC=True
  15149.      bHDTP_Walton=True
  15150.      bHDTP_Anna=True
  15151.      bHDTP_UNATCO=True
  15152.      bHDTP_MJ12=True
  15153.      bHDTP_NSF=True
  15154.      bHDTP_RiotCop=True
  15155.      bHDTP_Gunther=True
  15156.      bHDTP_Paul=True
  15157.      bHDTP_Nico=True
  15158.      QuickSaveTotal=5
  15159.      bTogAutoSave=True
  15160.      bColorCodedAmmo=True
  15161.      bDecap=True
  15162.      bAnimBar1=True
  15163.      bAnimBar2=True
  15164.      bRemoveVanillaDeath=True
  15165.      bHitmarkerOn=True
  15166.      bMantleOption=True
  15167.      fatty="You are full and cannot consume any more at this time"
  15168.      noUsing="You cannot use it at this time"
  15169.      customColorsMenu(0)=(B=255)
  15170.      customColorsMenu(1)=(G=49,B=255)
  15171.      customColorsMenu(2)=(R=210,G=194,B=255)
  15172.      customColorsMenu(3)=(R=77,G=77,B=78)
  15173.      customColorsMenu(4)=(R=207,G=207,B=207)
  15174.      customColorsMenu(5)=(R=255,G=255,B=192)
  15175.      customColorsMenu(6)=(R=86,G=38,B=24)
  15176.      customColorsMenu(7)=(R=206,G=206,B=202)
  15177.      customColorsMenu(8)=(R=204,G=198,B=201)
  15178.      customColorsMenu(9)=(R=255)
  15179.      customColorsMenu(10)=(G=255)
  15180.      customColorsMenu(11)=(R=255,G=64)
  15181.      customColorsMenu(12)=(G=255)
  15182.      customColorsMenu(13)=(R=128,G=128,B=128)
  15183.      customColorsHUD(0)=(R=32,G=32,B=32)
  15184.      customColorsHUD(1)=(R=217)
  15185.      customColorsHUD(2)=(R=128)
  15186.      customColorsHUD(3)=(R=167)
  15187.      customColorsHUD(4)=(R=167,G=164,B=164)
  15188.      customColorsHUD(5)=(R=255)
  15189.      customColorsHUD(6)=(R=112)
  15190.      customColorsHUD(7)=(R=204,G=202,B=204)
  15191.      customColorsHUD(8)=(R=169,G=171,B=171)
  15192.      customColorsHUD(9)=(R=201)
  15193.      customColorsHUD(10)=(R=255,G=255,B=255)
  15194.      customColorsHUD(11)=(B=86)
  15195.      customColorsHUD(12)=(R=255)
  15196.      customColorsHUD(13)=(R=128,G=128,B=128)
  15197.      LightLevelDisplay=-1
  15198.      advBelt=1
  15199.      RocketTargetMaxDistance=40000.000000
  15200.      RecoilSimLimit=(X=7.000000,Y=16.000000,Z=7.000000)
  15201.      RecoilDrain=0.950000
  15202.      RecoilTime=0.140000
  15203.      bCanStrafe=True
  15204.      MeleeRange=50.000000
  15205.      GroundSpeed=380.000000
  15206.      AccelRate=2048.000000
  15207.      FovAngle=75.000000
  15208.      Intelligence=BRAINS_HUMAN
  15209.      AngularResolution=0.500000
  15210.      Alliance=Player
  15211.      DrawType=DT_Mesh
  15212.      SoundVolume=64
  15213.      RotationRate=(Pitch=3072,Yaw=65000,Roll=2048)
  15214.      BindName="JCDenton"
  15215.      FamiliarName="JC Denton"
  15216.      UnfamiliarName="JC Denton"
  15217. }
Add Comment
Please, Sign In to add comment