Rozez

playerinput.ws

Aug 30th, 2021
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 86.93 KB | None | 0 0
  1. /***********************************************************************/
  2. /** © 2015 CD PROJEKT S.A. All rights reserved.
  3. /** THE WITCHER® is a trademark of CD PROJEKT S. A.
  4. /** The Witcher game is based on the prose of Andrzej Sapkowski.
  5. /***********************************************************************/
  6.  
  7.  
  8.  
  9. class CPlayerInput
  10. {
  11. //---=== modFriendlyHUD ===---
  12. private const var KEY_HOLD_WINDOW : float; default KEY_HOLD_WINDOW = 0.4;
  13. private var controllerQuickInventoryHandled : bool;
  14. //---=== modFriendlyHUD ===---
  15. //private var TorchLight : CTorchLight;//TorchLight
  16.  
  17. private saved var actionLocks : array<array<SInputActionLock>>;
  18.  
  19.  
  20.  
  21. public var CiriTorchToggleButton : bool; //UphoeniX
  22.  
  23.  
  24.  
  25.  
  26. private var totalCameraPresetChange : float; default totalCameraPresetChange = 0.0f;
  27. private var potAction : SInputAction;
  28. private var potPress : bool;
  29. private var debugBlockSourceName : name; default debugBlockSourceName = 'PLAYER';
  30. private var holdFastMenuInvoked : bool; default holdFastMenuInvoked = false;
  31. private var potionUpperHeld, potionLowerHeld : bool;
  32. private var potionModeHold : bool;
  33.  
  34. default potionModeHold = true;
  35. editable var factValue : int;
  36. editable var factTimeValid : int;
  37. editable var factAddedOnUse : string;
  38.  
  39.  
  40.  
  41. public function Initialize(isFromLoad : bool, optional previousInput : CPlayerInput)
  42.  
  43. {
  44. var missingLocksCount, i : int;
  45. var dummy : array<SInputActionLock>;
  46.  
  47. if(previousInput)
  48. {
  49. actionLocks = previousInput.actionLocks;
  50. }
  51. else
  52. {
  53. if(!isFromLoad)
  54. {
  55. actionLocks.Grow(EnumGetMax('EInputActionBlock')+1);
  56. }
  57. else
  58. {
  59. missingLocksCount = EnumGetMax('EInputActionBlock') + 1 - actionLocks.Size();
  60. for ( i = 0; i < missingLocksCount; i += 1 )
  61. {
  62. actionLocks.PushBack( dummy );
  63. }
  64. }
  65. }
  66.  
  67. //---=== modFriendlyHUD ===---
  68. theInput.RegisterListener( this, 'On3DMarkersToggle', 'Toggle3DMarkers' );
  69. theInput.RegisterListener( this, 'OnHUDToggle', 'HUDToggle' );
  70. theInput.RegisterListener( this, 'OnPauseGameToggle', 'PauseGameToggle' );
  71. theInput.RegisterListener( this, 'OnSwitchCrossbow', 'SwitchCrossbow' );
  72. theInput.RegisterListener( this, 'OnPinModuleModfier', 'PinModuleModfier' );
  73. theInput.RegisterListener( this, 'OnToggleEssentials', 'ToggleEssentials' );
  74. theInput.RegisterListener( this, 'OnHoldToSeeHub', 'HoldToSeeEssentials' );
  75. theInput.RegisterListener( this, 'OnHoldToSeeChar', 'HoldToSeeCharStats' );
  76. theInput.RegisterListener( this, 'OnHoldToSeeMapPC', 'HoldToSeeMap' );
  77. theInput.RegisterListener( this, 'OnHoldToSeeJour', 'HoldToSeeQuests' );
  78. //---=== modFriendlyHUD ===---
  79.  
  80. theInput.RegisterListener( this, 'OnCommSprint', 'Sprint' );
  81. theInput.RegisterListener( this, 'OnCommSprintToggle', 'SprintToggle' );
  82. theInput.RegisterListener( this, 'OnCommWalkToggle', 'WalkToggle' );
  83. theInput.RegisterListener( this, 'OnCommGuard', 'Guard' );
  84.  
  85.  
  86. theInput.RegisterListener( this, 'OnCommSpawnHorse', 'SpawnHorse' );
  87.  
  88.  
  89.  
  90. theInput.RegisterListener( this, 'OnCommDrinkPotion1', 'DrinkPotion1' );
  91. theInput.RegisterListener( this, 'OnCommDrinkPotion2', 'DrinkPotion2' );
  92. theInput.RegisterListener( this, 'OnCommDrinkPotion3', 'DrinkPotion3' );
  93. theInput.RegisterListener( this, 'OnCommDrinkPotion4', 'DrinkPotion4' );
  94. theInput.RegisterListener( this, 'OnCommDrinkpotionUpperHeld', 'DrinkPotionUpperHold' );
  95. theInput.RegisterListener( this, 'OnCommDrinkpotionLowerHeld', 'DrinkPotionLowerHold' );
  96.  
  97.  
  98. theInput.RegisterListener( this, 'OnCommSteelSword', 'SteelSword' );
  99. theInput.RegisterListener( this, 'OnCommSilverSword', 'SilverSword' );
  100. theInput.RegisterListener( this, 'OnCommSheatheAny', 'SwordSheathe' );
  101. theInput.RegisterListener( this, 'OnCommSheatheSilver', 'SwordSheatheSilver' );
  102. theInput.RegisterListener( this, 'OnCommSheatheSteel', 'SwordSheatheSteel' );
  103.  
  104. theInput.RegisterListener( this, 'OnToggleSigns', 'ToggleSigns' );
  105. theInput.RegisterListener( this, 'OnSelectSign', 'SelectAard' );
  106. theInput.RegisterListener( this, 'OnSelectSign', 'SelectYrden' );
  107.  
  108.  
  109. theInput.RegisterListener( this, 'OnCiriTorchToggle', 'CiriTorchToggle' ); //UphoeniX
  110.  
  111.  
  112.  
  113. theInput.RegisterListener( this, 'OnSelectSign', 'SelectIgni' );
  114. theInput.RegisterListener( this, 'OnSelectSign', 'SelectQuen' );
  115. theInput.RegisterListener( this, 'OnSelectSign', 'SelectAxii' );
  116.  
  117.  
  118.  
  119. theInput.RegisterListener( this, 'OnCommDeckEditor', 'PanelGwintDeckEditor' );
  120. theInput.RegisterListener( this, 'OnCommMenuHub', 'HubMenu' );
  121. theInput.RegisterListener( this, 'OnCommPanelInv', 'PanelInv' );
  122. theInput.RegisterListener( this, 'OnCommHoldFastMenu', 'HoldFastMenu' );
  123. theInput.RegisterListener( this, 'OnCommPanelChar', 'PanelChar' );
  124. theInput.RegisterListener( this, 'OnCommPanelMed', 'PanelMed' );
  125. theInput.RegisterListener( this, 'OnCommPanelMap', 'PanelMap' );
  126. theInput.RegisterListener( this, 'OnCommPanelMapPC', 'PanelMapPC' );
  127. theInput.RegisterListener( this, 'OnCommPanelJour', 'PanelJour' );
  128. theInput.RegisterListener( this, 'OnCommPanelAlch', 'PanelAlch' );
  129. theInput.RegisterListener( this, 'OnCommPanelGlossary', 'PanelGlossary' );
  130. theInput.RegisterListener( this, 'OnCommPanelBestiary', 'PanelBestiary' );
  131. theInput.RegisterListener( this, 'OnCommPanelMeditation', 'PanelMeditation' );
  132. theInput.RegisterListener( this, 'OnCommPanelCrafting', 'PanelCrafting' );
  133. theInput.RegisterListener( this, 'OnShowControlsHelp', 'ControlsHelp' );
  134. theInput.RegisterListener( this, 'OnCommPanelUIResize', 'PanelUIResize' );
  135.  
  136. theInput.RegisterListener( this, 'OnCastSign', 'CastSign' );
  137. theInput.RegisterListener( this, 'OnExpFocus', 'Focus' );
  138. theInput.RegisterListener( this, 'OnExpMedallion', 'Medallion' );
  139.  
  140.  
  141. theInput.RegisterListener( this, 'OnBoatDismount', 'BoatDismount' );
  142.  
  143. theInput.RegisterListener( this, 'OnDiving', 'DiveDown' );
  144. theInput.RegisterListener( this, 'OnDiving', 'DiveUp' );
  145. theInput.RegisterListener( this, 'OnDivingDodge', 'DiveDodge' );
  146.  
  147.  
  148. theInput.RegisterListener( this, 'OnCbtSpecialAttackWithAlternateLight', 'SpecialAttackWithAlternateLight' );
  149. theInput.RegisterListener( this, 'OnCbtSpecialAttackWithAlternateHeavy', 'SpecialAttackWithAlternateHeavy' );
  150. theInput.RegisterListener( this, 'OnCbtAttackWithAlternateLight', 'AttackWithAlternateLight' );
  151. theInput.RegisterListener( this, 'OnCbtAttackWithAlternateHeavy', 'AttackWithAlternateHeavy' );
  152.  
  153. theInput.RegisterListener( this, 'OnCbtAttackLight', 'AttackLight' );
  154. theInput.RegisterListener( this, 'OnCbtAttackHeavy', 'AttackHeavy' );
  155. theInput.RegisterListener( this, 'OnCbtSpecialAttackLight', 'SpecialAttackLight' );
  156. theInput.RegisterListener( this, 'OnCbtSpecialAttackHeavy', 'SpecialAttackHeavy' );
  157. theInput.RegisterListener( this, 'OnCbtDodge', 'Dodge' );
  158. theInput.RegisterListener( this, 'OnCbtRoll', 'CbtRoll' );
  159. theInput.RegisterListener( this, 'OnMovementDoubleTap', 'MovementDoubleTapW' );
  160. theInput.RegisterListener( this, 'OnMovementDoubleTap', 'MovementDoubleTapS' );
  161. theInput.RegisterListener( this, 'OnMovementDoubleTap', 'MovementDoubleTapA' );
  162. theInput.RegisterListener( this, 'OnMovementDoubleTap', 'MovementDoubleTapD' );
  163. theInput.RegisterListener( this, 'OnCbtLockAndGuard', 'LockAndGuard' );
  164. theInput.RegisterListener( this, 'OnCbtCameraLockOrSpawnHorse', 'CameraLockOrSpawnHorse' );
  165. theInput.RegisterListener( this, 'OnCbtCameraLock', 'CameraLock' );
  166. theInput.RegisterListener( this, 'OnCbtComboDigitLeft', 'ComboDigitLeft' );
  167. theInput.RegisterListener( this, 'OnCbtComboDigitRight', 'ComboDigitRight' );
  168.  
  169.  
  170.  
  171. theInput.RegisterListener( this, 'OnCbtCiriSpecialAttack', 'CiriSpecialAttack' );
  172. theInput.RegisterListener( this, 'OnCbtCiriAttackHeavy', 'CiriAttackHeavy' );
  173. theInput.RegisterListener( this, 'OnCbtCiriSpecialAttackHeavy', 'CiriSpecialAttackHeavy' );
  174. theInput.RegisterListener( this, 'OnCbtCiriDodge', 'CiriDodge' );
  175. theInput.RegisterListener( this, 'OnCbtCiriDash', 'CiriDash' );
  176.  
  177.  
  178. theInput.RegisterListener( this, 'OnCbtThrowItem', 'ThrowItem' );
  179. theInput.RegisterListener( this, 'OnCbtThrowItemHold', 'ThrowItemHold' );
  180. theInput.RegisterListener( this, 'OnCbtThrowCastAbort', 'ThrowCastAbort' );
  181.  
  182.  
  183. theInput.RegisterListener( this, 'OnCiriDrawWeapon', 'CiriDrawWeapon' );
  184. theInput.RegisterListener( this, 'OnCiriDrawWeapon', 'CiriDrawWeaponAlternative' );
  185. theInput.RegisterListener( this, 'OnCiriHolsterWeapon', 'CiriHolsterWeapon' );
  186.  
  187.  
  188. if( !theGame.IsFinalBuild() )
  189. {
  190. theInput.RegisterListener( this, 'OnDbgSpeedUp', 'Debug_SpeedUp' );
  191. theInput.RegisterListener( this, 'OnDbgHit', 'Debug_Hit' );
  192. theInput.RegisterListener( this, 'OnDbgKillTarget', 'Debug_KillTarget' );
  193. theInput.RegisterListener( this, 'OnDbgKillAll', 'Debug_KillAllEnemies' );
  194. theInput.RegisterListener( this, 'OnDbgKillAllTargetingPlayer', 'Debug_KillAllTargetingPlayer' );
  195. theInput.RegisterListener( this, 'OnCommPanelFakeHud', 'PanelFakeHud' );
  196. theInput.RegisterListener( this, 'OnDbgTeleportToPin', 'Debug_TeleportToPin' );
  197. }
  198.  
  199.  
  200. theInput.RegisterListener( this, 'OnChangeCameraPreset', 'CameraPreset' );
  201. theInput.RegisterListener( this, 'OnChangeCameraPresetByMouseWheel', 'CameraPresetByMouseWheel' );
  202. theInput.RegisterListener( this, 'OnMeditationAbort', 'MeditationAbort');
  203.  
  204. theInput.RegisterListener( this, 'OnFastMenu', 'FastMenu' );
  205. theInput.RegisterListener( this, 'OnIngameMenu', 'IngameMenu' );
  206.  
  207. theInput.RegisterListener( this, 'OnToggleHud', 'ToggleHud' );
  208. }
  209.  
  210.  
  211. function Destroy()
  212. {
  213. }
  214.  
  215. //---=== modFriendlyHUD ===---
  216. event OnPinModuleModfier( action : SInputAction )
  217. {
  218. }
  219.  
  220. private var savedQuickSlot : EEquipmentSlots; default savedQuickSlot = EES_InvalidSlot;
  221.  
  222. event OnSwitchCrossbow( action : SInputAction )
  223. {
  224. var item1, item2, crossbow, selectedItem : SItemUniqueId;
  225. var witcher : W3PlayerWitcher;
  226.  
  227. if( thePlayer.IsCiri() )
  228. {
  229. return false;
  230. }
  231.  
  232. if( IsPressed( action ) )
  233. {
  234. witcher = GetWitcherPlayer();
  235. selectedItem = witcher.GetSelectedItemId();
  236. witcher.GetItemEquippedOnSlot( EES_Petard1, item1 );
  237. witcher.GetItemEquippedOnSlot( EES_Petard2, item2 );
  238. witcher.GetItemEquippedOnSlot( EES_RangedWeapon, crossbow );
  239. if ( !witcher.inv.IsItemCrossbow( selectedItem ) )
  240. {
  241. if ( selectedItem == item1 && selectedItem != GetInvalidUniqueId() )
  242. {
  243. savedQuickSlot = EES_Petard1;
  244. }
  245. else if ( selectedItem == item2 && selectedItem != GetInvalidUniqueId() )
  246. {
  247. savedQuickSlot = EES_Petard2;
  248. }
  249. else
  250. {
  251. savedQuickSlot = EES_InvalidSlot;
  252. }
  253. if ( crossbow != GetInvalidUniqueId() )
  254. {
  255. witcher.OnRadialMenuItemChoose( "Crossbow" );
  256. }
  257. }
  258. else
  259. {
  260. if ( savedQuickSlot == EES_Petard1 && item1 != GetInvalidUniqueId() )
  261. {
  262. witcher.OnRadialMenuItemChoose( "Slot1" );
  263. }
  264. else if ( savedQuickSlot == EES_Petard2 && item2 != GetInvalidUniqueId() )
  265. {
  266. witcher.OnRadialMenuItemChoose( "Slot2" );
  267. }
  268. else if ( item1 != GetInvalidUniqueId() )
  269. {
  270. witcher.OnRadialMenuItemChoose( "Slot1" );
  271. }
  272. else if ( item2 != GetInvalidUniqueId() )
  273. {
  274. witcher.OnRadialMenuItemChoose( "Slot2" );
  275. }
  276. savedQuickSlot = EES_InvalidSlot;
  277. }
  278. }
  279. }
  280.  
  281. event On3DMarkersToggle( action : SInputAction )
  282. {
  283. if( IsPressed( action ) )
  284. {
  285. GetFHUDConfig().Toggle3DMarkers();
  286. }
  287. }
  288.  
  289. event OnPauseGameToggle( action : SInputAction )
  290. {
  291. var hud : CR4ScriptedHud;
  292.  
  293. if( IsPressed( action ) )
  294. {
  295. if ( !theGame.IsPausedForReason( "user_pause" ) && !theGame.HasBlackscreenRequested() )
  296. {
  297. theGame.Pause( "user_pause" );
  298. theSound.SoundEvent("system_pause");
  299. }
  300. else if ( theGame.IsPausedForReason( "user_pause" ) && !theGame.HasBlackscreenRequested() )
  301. {
  302. theGame.Unpause( "user_pause" );
  303. theSound.SoundEvent("system_resume");
  304. }
  305. }
  306. }
  307. //---=== modFriendlyHUD ===---
  308.  
  309.  
  310. //---=== modFriendlyHUD ===---
  311. event OnPinModuleModfier( action : SInputAction )
  312. {
  313. }
  314.  
  315. private var savedQuickSlot : EEquipmentSlots; default savedQuickSlot = EES_InvalidSlot;
  316.  
  317. event OnSwitchCrossbow( action : SInputAction )
  318. {
  319. var item1, item2, crossbow, selectedItem : SItemUniqueId;
  320. var witcher : W3PlayerWitcher;
  321.  
  322. if( thePlayer.IsCiri() )
  323. {
  324. return false;
  325. }
  326.  
  327. if( IsPressed( action ) )
  328. {
  329. witcher = GetWitcherPlayer();
  330. selectedItem = witcher.GetSelectedItemId();
  331. witcher.GetItemEquippedOnSlot( EES_Petard1, item1 );
  332. witcher.GetItemEquippedOnSlot( EES_Petard2, item2 );
  333. witcher.GetItemEquippedOnSlot( EES_RangedWeapon, crossbow );
  334. if ( !witcher.inv.IsItemCrossbow( selectedItem ) )
  335. {
  336. if ( selectedItem == item1 && selectedItem != GetInvalidUniqueId() )
  337. {
  338. savedQuickSlot = EES_Petard1;
  339. }
  340. else if ( selectedItem == item2 && selectedItem != GetInvalidUniqueId() )
  341. {
  342. savedQuickSlot = EES_Petard2;
  343. }
  344. else
  345. {
  346. savedQuickSlot = EES_InvalidSlot;
  347. }
  348. if ( crossbow != GetInvalidUniqueId() )
  349. {
  350. witcher.OnRadialMenuItemChoose( "Crossbow" );
  351. }
  352. }
  353. else
  354. {
  355. if ( savedQuickSlot == EES_Petard1 && item1 != GetInvalidUniqueId() )
  356. {
  357. witcher.OnRadialMenuItemChoose( "Slot1" );
  358. }
  359. else if ( savedQuickSlot == EES_Petard2 && item2 != GetInvalidUniqueId() )
  360. {
  361. witcher.OnRadialMenuItemChoose( "Slot2" );
  362. }
  363. else if ( item1 != GetInvalidUniqueId() )
  364. {
  365. witcher.OnRadialMenuItemChoose( "Slot1" );
  366. }
  367. else if ( item2 != GetInvalidUniqueId() )
  368. {
  369. witcher.OnRadialMenuItemChoose( "Slot2" );
  370. }
  371. savedQuickSlot = EES_InvalidSlot;
  372. }
  373. }
  374. }
  375.  
  376. event On3DMarkersToggle( action : SInputAction )
  377. {
  378. if( IsPressed( action ) )
  379. {
  380. GetFHUDConfig().Toggle3DMarkers();
  381. }
  382. }
  383.  
  384. event OnPauseGameToggle( action : SInputAction )
  385. {
  386. var hud : CR4ScriptedHud;
  387.  
  388. if( IsPressed( action ) )
  389. {
  390. if ( !theGame.IsPausedForReason( "user_pause" ) && !theGame.HasBlackscreenRequested() )
  391. {
  392. theGame.Pause( "user_pause" );
  393. theSound.SoundEvent("system_pause");
  394. }
  395. else if ( theGame.IsPausedForReason( "user_pause" ) && !theGame.HasBlackscreenRequested() )
  396. {
  397. theGame.Unpause( "user_pause" );
  398. theSound.SoundEvent("system_resume");
  399. }
  400. }
  401. }
  402. //---=== modFriendlyHUD ===---
  403.  
  404.  
  405. public function FindActionLockIndex(action : EInputActionBlock, sourceName : name) : int
  406. {
  407. var i : int;
  408.  
  409. for(i=0; i<actionLocks[action].Size(); i+=1)
  410. if(actionLocks[action][i].sourceName == sourceName)
  411. return i;
  412.  
  413. return -1;
  414. }
  415.  
  416.  
  417. public function BlockAction(action : EInputActionBlock, sourceName : name, lock : bool, optional keepOnSpawn : bool, optional onSpawnedNullPointerHackFix : CPlayer, optional isFromQuest : bool, optional isFromPlace : bool)
  418. {
  419. var index : int;
  420. var isLocked, wasLocked : bool;
  421. var actionLock : SInputActionLock;
  422.  
  423. if (action == EIAB_HighlightObjective)
  424. {
  425. index = FindActionLockIndex(action, sourceName);
  426. }
  427.  
  428. index = FindActionLockIndex(action, sourceName);
  429.  
  430. wasLocked = (actionLocks[action].Size() > 0);
  431.  
  432. if(lock)
  433. {
  434. if(index != -1)
  435. return;
  436.  
  437. actionLock.sourceName = sourceName;
  438.  
  439. if( action == EIAB_CameraLock )
  440. {
  441. actionLock.removedOnSpawn = true;
  442. }
  443. else
  444. {
  445. actionLock.removedOnSpawn = !keepOnSpawn;
  446. }
  447. actionLock.isFromQuest = isFromQuest;
  448. actionLock.isFromPlace = isFromPlace;
  449.  
  450. actionLocks[action].PushBack(actionLock);
  451. }
  452. else
  453. {
  454. if(index == -1)
  455. return;
  456.  
  457. actionLocks[action].Erase(index);
  458. }
  459.  
  460. isLocked = (actionLocks[action].Size() > 0);
  461. if(isLocked != wasLocked)
  462. OnActionLockChanged(action, isLocked, sourceName, onSpawnedNullPointerHackFix);
  463. }
  464.  
  465.  
  466. public final function TutorialForceUnblockRadial() : array<SInputActionLock>
  467. {
  468. var ret : array<SInputActionLock>;
  469.  
  470. ret = actionLocks[EIAB_RadialMenu];
  471.  
  472. actionLocks[EIAB_RadialMenu].Clear();
  473.  
  474. thePlayer.SetBIsInputAllowed(true, '');
  475.  
  476. BlockAction( EIAB_Signs, 'ToxicGasTutorial', true, true, NULL, false);
  477.  
  478. return ret;
  479. }
  480.  
  481.  
  482. public final function TutorialForceRestoreRadialLocks(radialLocks : array<SInputActionLock>)
  483. {
  484. actionLocks[EIAB_RadialMenu] = radialLocks;
  485. thePlayer.UnblockAction(EIAB_Signs, 'ToxicGasTutorial' );
  486. }
  487.  
  488. private function OnActionLockChanged(action : EInputActionBlock, locked : bool, optional sourceName : name, optional onSpawnedNullPointerHackFix : CPlayer)
  489. {
  490. var player : CPlayer;
  491. var lockType : EPlayerInteractionLock;
  492. var hud : CR4ScriptedHud;
  493. var guiManager : CR4GuiManager;
  494. var rootMenu : CR4MenuBase;
  495.  
  496.  
  497. if( sourceName == debugBlockSourceName )
  498. {
  499.  
  500. sourceName = sourceName;
  501. }
  502.  
  503.  
  504. if(action == EIAB_FastTravel)
  505. {
  506. theGame.GetCommonMapManager().EnableFastTravelling(!locked);
  507. }
  508. else if(action == EIAB_Interactions)
  509. {
  510.  
  511. if(sourceName == 'InsideCombatAction')
  512. lockType = PIL_CombatAction;
  513. else
  514. lockType = PIL_Default;
  515.  
  516. if(!thePlayer)
  517. player = onSpawnedNullPointerHackFix;
  518. else
  519. player = thePlayer;
  520.  
  521. if(player)
  522. {
  523. if(locked)
  524. player.LockButtonInteractions(lockType);
  525. else
  526. player.UnlockButtonInteractions(lockType);
  527. }
  528.  
  529.  
  530. hud = (CR4ScriptedHud)theGame.GetHud();
  531. if ( hud )
  532. {
  533. hud.ForceInteractionUpdate();
  534. }
  535. }
  536. else if(action == EIAB_Movement && locked && thePlayer)
  537. {
  538.  
  539. if(thePlayer.IsUsingVehicle() && thePlayer.GetCurrentStateName() == 'HorseRiding')
  540. {
  541. ((CActor)thePlayer.GetUsedVehicle()).GetMovingAgentComponent().ResetMoveRequests();
  542. thePlayer.GetUsedVehicle().SetBehaviorVariable( '2idle', 1);
  543.  
  544. thePlayer.SetBehaviorVariable( 'speed', 0);
  545. thePlayer.SetBehaviorVariable( '2idle', 1);
  546. }
  547. else if(!thePlayer.IsInAir())
  548. {
  549. thePlayer.RaiseForceEvent( 'Idle' );
  550. }
  551. }
  552. else if (action == EIAB_DismountVehicle)
  553. {
  554. guiManager = theGame.GetGuiManager();
  555.  
  556. if (guiManager)
  557. {
  558. guiManager.UpdateDismountAvailable(locked);
  559. }
  560. }
  561. else if (action == EIAB_OpenPreparation || action == EIAB_OpenMap || action == EIAB_OpenInventory ||
  562. action == EIAB_OpenJournal || action == EIAB_OpenCharacterPanel || action == EIAB_OpenGlossary ||
  563. action == EIAB_OpenAlchemy || action == EIAB_MeditationWaiting || action == EIAB_OpenMeditation)
  564. {
  565. guiManager = theGame.GetGuiManager();
  566.  
  567. if (guiManager && guiManager.IsAnyMenu())
  568. {
  569. rootMenu = (CR4MenuBase)guiManager.GetRootMenu();
  570.  
  571. if (rootMenu)
  572. {
  573. rootMenu.ActionBlockStateChange(action, locked);
  574. }
  575. }
  576. }
  577. }
  578.  
  579. public function BlockAllActions(sourceName : name, lock : bool, optional exceptions : array<EInputActionBlock>, optional saveLock : bool, optional onSpawnedNullPointerHackFix : CPlayer, optional isFromQuest : bool, optional isFromPlace : bool)
  580. {
  581. var i, size : int;
  582.  
  583. size = EnumGetMax('EInputActionBlock')+1;
  584. for(i=0; i<size; i+=1)
  585. {
  586. if ( exceptions.Contains(i) || i == EIAB_CameraLock )
  587. continue;
  588.  
  589. BlockAction(i, sourceName, lock, saveLock, onSpawnedNullPointerHackFix, isFromQuest, isFromPlace);
  590. }
  591. }
  592.  
  593.  
  594. public final function BlockAllQuestActions(sourceName : name, lock : bool)
  595. {
  596. var action, j, size : int;
  597. var isLocked, wasLocked : bool;
  598. var exceptions : array< EInputActionBlock >;
  599.  
  600. if(lock)
  601. {
  602.  
  603. exceptions.PushBack( EIAB_FastTravelGlobal );
  604. BlockAllActions(sourceName, lock, exceptions, true, , true);
  605. }
  606. else
  607. {
  608.  
  609. size = EnumGetMax('EInputActionBlock')+1;
  610. for(action=0; action<size; action+=1)
  611. {
  612. wasLocked = (actionLocks[action].Size() > 0);
  613.  
  614. for(j=0; j<actionLocks[action].Size();)
  615. {
  616. if(actionLocks[action][j].isFromQuest)
  617. {
  618. actionLocks[action].EraseFast(j);
  619. }
  620. else
  621. {
  622. j += 1;
  623. }
  624. }
  625.  
  626. isLocked = (actionLocks[action].Size() > 0);
  627. if(wasLocked != isLocked)
  628. OnActionLockChanged(action, isLocked);
  629. }
  630. }
  631. }
  632.  
  633.  
  634. public function BlockAllUIQuestActions(sourceName : name, lock : bool)
  635. {
  636. var i, j, action, size : int;
  637. var uiActions : array<int>;
  638. var wasLocked, isLocked : bool;
  639.  
  640. if( lock )
  641. {
  642. BlockAction(EIAB_OpenInventory, sourceName, true, true, NULL, false);
  643. BlockAction(EIAB_MeditationWaiting, sourceName, true, true, NULL, false);
  644. BlockAction(EIAB_OpenMeditation, sourceName, true, true, NULL, false);
  645. BlockAction(EIAB_FastTravel, sourceName, true, true, NULL, false);
  646. BlockAction(EIAB_OpenMap, sourceName, true, true, NULL, false);
  647. BlockAction(EIAB_OpenCharacterPanel, sourceName, true, true, NULL, false);
  648. BlockAction(EIAB_OpenJournal, sourceName, true, true, NULL, false);
  649. BlockAction(EIAB_OpenAlchemy, sourceName, true, true, NULL, false);
  650. }
  651. else
  652. {
  653.  
  654. uiActions.Resize(8);
  655. uiActions[0] = EIAB_OpenInventory;
  656. uiActions[1] = EIAB_MeditationWaiting;
  657. uiActions[2] = EIAB_OpenMeditation;
  658. uiActions[3] = EIAB_FastTravel;
  659. uiActions[4] = EIAB_OpenMap;
  660. uiActions[5] = EIAB_OpenCharacterPanel;
  661. uiActions[6] = EIAB_OpenJournal;
  662. uiActions[7] = EIAB_OpenAlchemy;
  663.  
  664. size = uiActions.Size();
  665. for(i=0; i<size; i+=1)
  666. {
  667. action = uiActions[i];
  668.  
  669. wasLocked = (actionLocks[action].Size() > 0);
  670.  
  671. for(j=0; j<actionLocks[action].Size();)
  672. {
  673. if(actionLocks[action][j].isFromQuest)
  674. {
  675. actionLocks[action].EraseFast(j);
  676. }
  677. else
  678. {
  679. j += 1;
  680. }
  681. }
  682.  
  683. isLocked = (actionLocks[action].Size() > 0);
  684. if(wasLocked != isLocked)
  685. OnActionLockChanged(action, isLocked);
  686. }
  687. }
  688. }
  689.  
  690.  
  691. public function ForceUnlockAllInputActions(alsoQuestLocks : bool)
  692. {
  693. var i, j : int;
  694.  
  695. for(i=0; i<=EnumGetMax('EInputActionBlock'); i+=1)
  696. {
  697. if(alsoQuestLocks)
  698. {
  699. actionLocks[i].Clear();
  700. OnActionLockChanged(i, false);
  701. }
  702. else
  703. {
  704. for(j=actionLocks[i].Size()-1; j>=0; j-=1)
  705. {
  706. if(actionLocks[i][j].removedOnSpawn)
  707. actionLocks[i].Erase(j);
  708. }
  709.  
  710. if(actionLocks[i].Size() == 0)
  711. OnActionLockChanged(i, false);
  712. }
  713. }
  714. }
  715.  
  716. public function RemoveLocksOnSpawn()
  717. {
  718. var i, j : int;
  719.  
  720. for(i=0; i<actionLocks.Size(); i+=1)
  721. {
  722. for(j=actionLocks[i].Size()-1; j>=0; j-=1)
  723. {
  724. if(actionLocks[i][j].removedOnSpawn || i == EIAB_CameraLock)
  725. {
  726. actionLocks[i].Erase(j);
  727. }
  728. }
  729. }
  730. }
  731.  
  732. public function GetActionLocks(action : EInputActionBlock) : array< SInputActionLock >
  733. {
  734. return actionLocks[action];
  735. }
  736.  
  737. public function GetAllActionLocks() : array< array< SInputActionLock > >
  738. {
  739. return actionLocks;
  740. }
  741.  
  742. public function IsActionAllowed(action : EInputActionBlock) : bool
  743. {
  744. var actionAllowed : bool;
  745. actionAllowed = (actionLocks[action].Size() == 0);
  746. return actionAllowed;
  747. }
  748.  
  749. public function IsActionBlockedBy( action : EInputActionBlock, sourceName : name ) : bool
  750. {
  751. return FindActionLockIndex( action, sourceName ) != -1;
  752. }
  753.  
  754. public final function GetActionBlockedHudLockType(action : EInputActionBlock) : name
  755. {
  756. var i : int;
  757.  
  758. if(action == EIAB_Undefined)
  759. return '';
  760.  
  761. for(i=0; i<actionLocks[action].Size(); i+=1)
  762. {
  763. if(actionLocks[action][i].isFromPlace)
  764. return 'place';
  765. }
  766.  
  767. if(actionLocks[action].Size() > 0)
  768. return 'time';
  769.  
  770. return '';
  771. }
  772.  
  773.  
  774.  
  775.  
  776.  
  777.  
  778. event OnCommSprint( action : SInputAction )
  779. {
  780. if( IsPressed( action ) )
  781. {
  782.  
  783.  
  784.  
  785.  
  786.  
  787.  
  788.  
  789.  
  790.  
  791.  
  792.  
  793.  
  794.  
  795.  
  796.  
  797.  
  798.  
  799.  
  800. thePlayer.SetSprintActionPressed(true);
  801.  
  802. if ( thePlayer.rangedWeapon )
  803. thePlayer.rangedWeapon.OnSprintHolster();
  804. }
  805.  
  806.  
  807.  
  808. }
  809.  
  810. event OnCommSprintToggle( action : SInputAction )
  811. {
  812. if( IsPressed(action) )
  813. {
  814. if ( thePlayer.GetIsSprintToggled() )
  815. thePlayer.SetSprintToggle( false );
  816. else
  817. thePlayer.SetSprintToggle( true );
  818. }
  819. }
  820.  
  821. event OnCommWalkToggle( action : SInputAction )
  822. {
  823. if( IsPressed(action) && !thePlayer.GetIsSprinting() && !thePlayer.modifyPlayerSpeed )
  824. {
  825. if ( thePlayer.GetIsWalkToggled() )
  826. thePlayer.SetWalkToggle( false );
  827. else
  828. thePlayer.SetWalkToggle( true );
  829. }
  830. }
  831.  
  832.  
  833. event OnCommGuard( action : SInputAction )
  834. {
  835. if(thePlayer.IsCiri() && !GetCiriPlayer().HasSword())
  836. return false;
  837.  
  838. if ( !thePlayer.IsInsideInteraction() )
  839. {
  840. if ( IsActionAllowed(EIAB_Parry) )
  841. {
  842. if( IsReleased(action) && thePlayer.GetCurrentStateName() == 'CombatFists' )
  843. thePlayer.OnGuardedReleased();
  844.  
  845. if( IsPressed(action) )
  846. {
  847. thePlayer.AddCounterTimeStamp(theGame.GetEngineTime());
  848. thePlayer.SetGuarded(true);
  849. thePlayer.OnPerformGuard();
  850. }
  851. else if( IsReleased(action) )
  852. {
  853. thePlayer.SetGuarded(false);
  854. }
  855. }
  856. else
  857. {
  858. thePlayer.DisplayActionDisallowedHudMessage(EIAB_Parry);
  859. }
  860. }
  861. }
  862.  
  863.  
  864.  
  865.  
  866.  
  867. private var pressTimestamp : float;
  868. private const var DOUBLE_TAP_WINDOW : float;
  869. default DOUBLE_TAP_WINDOW = 0.4;
  870.  
  871. event OnCommSpawnHorse( action : SInputAction )
  872. {
  873. var doubleTap : bool;
  874.  
  875. if( IsPressed( action ) )
  876. {
  877. if( pressTimestamp + DOUBLE_TAP_WINDOW >= theGame.GetEngineTimeAsSeconds() )
  878. {
  879. doubleTap = true;
  880. }
  881. else
  882. {
  883. doubleTap = false;
  884. }
  885.  
  886. if( IsActionAllowed( EIAB_CallHorse ) && !thePlayer.IsInInterior() && !thePlayer.IsInAir() )
  887. {
  888.  
  889. if( doubleTap || theInput.LastUsedPCInput() )
  890. {
  891. if ( thePlayer.IsHoldingItemInLHand () )
  892. {
  893. thePlayer.OnUseSelectedItem(true);
  894. thePlayer.SetPlayerActionToRestore ( PATR_CallHorse );
  895. }
  896. else
  897. {
  898. theGame.OnSpawnPlayerHorse();
  899. }
  900. }
  901. }
  902. //---=== modFriendlyHUD ===---
  903. else if( doubleTap || theInput.LastUsedPCInput() )
  904. //---=== modFriendlyHUD ===---
  905. {
  906. if( thePlayer.IsInInterior() )
  907. thePlayer.DisplayActionDisallowedHudMessage( EIAB_Undefined, false, true );
  908. else
  909. thePlayer.DisplayActionDisallowedHudMessage( EIAB_CallHorse );
  910. }
  911.  
  912. pressTimestamp = theGame.GetEngineTimeAsSeconds();
  913.  
  914. return true;
  915. }
  916.  
  917. return false;
  918. }
  919.  
  920.  
  921. //---=== modFriendlyHUD ===---
  922. private var essentialsPressTimestamp : float;
  923. event OnToggleEssentials( action : SInputAction )
  924. {
  925. if( IsPressed( action ) && thePlayer.GetCurrentStateName() != 'ExplorationMeditation' )
  926. {
  927. thePlayer.RemoveTimer( 'PinEssentialGroupTimer' );
  928. thePlayer.AddTimer( 'PinEssentialGroupTimer', DOUBLE_TAP_WINDOW, false );
  929. if( essentialsPressTimestamp + DOUBLE_TAP_WINDOW >= theGame.GetEngineTimeAsSeconds() )
  930. {
  931. thePlayer.RemoveTimer( 'PinEssentialGroupTimer' );
  932. }
  933. essentialsPressTimestamp = theGame.GetEngineTimeAsSeconds();
  934. }
  935. }
  936.  
  937. event OnHoldToSeeHub( action : SInputAction )
  938. {
  939. if( theInput.IsActionPressed( 'PinModuleModfier' ) )
  940. {
  941. if( IsReleased( action ) )
  942. {
  943. ToggleEssentialModules( !IsHUDGroupEnabledForReason( GetFHUDConfig().essentialModules, "PinEssentialGroup" ), "PinEssentialGroup" );
  944. }
  945. }
  946. else
  947. {
  948. if ( IsPressed(action) )
  949. {
  950. thePlayer.AddTimer( 'EssentialsOnTimer' , KEY_HOLD_WINDOW, false );
  951. }
  952. if ( IsReleased(action) )
  953. {
  954. thePlayer.RemoveTimer( 'EssentialsOnTimer' );
  955. ToggleEssentialModules( false, "EssentialModulesHotkey" );
  956. }
  957. }
  958. }
  959.  
  960. private var pressHubTime : float;
  961. event OnCommMenuHub( action : SInputAction )
  962. {
  963. if( !theInput.IsActionPressed( 'PinModuleModfier' ) )
  964. {
  965. if( IsPressed(action) )
  966. {
  967. pressHubTime = theGame.GetEngineTimeAsSeconds();
  968. }
  969. if( IsReleased( action ) )
  970. {
  971. if ( theGame.GetEngineTimeAsSeconds() - pressHubTime < KEY_HOLD_WINDOW || !ActionsHaveConflict( 'HubMenu', 'HoldToSeeEssentials' ) )
  972. {
  973. PushMenuHub();
  974. }
  975. }
  976. }
  977. }
  978. //---=== modFriendlyHUD ===---
  979.  
  980. final function PushMenuHub()
  981. {
  982. if ( theGame.IsBlackscreenOrFading() )
  983. {
  984. return;
  985. }
  986. theGame.RequestMenu('CommonMenu');
  987. }
  988.  
  989. //---=== modFriendlyHUD ===---
  990. event OnHoldToSeeChar( action : SInputAction )
  991. {
  992. if( theInput.IsActionPressed( 'PinModuleModfier' ) )
  993. {
  994. if( IsReleased( action ) )
  995. {
  996. ToggleCharacterModules( !IsHUDGroupEnabledForReason( GetFHUDConfig().characterModules, "PinCharacterGroup" ), "PinCharacterGroup" );
  997. }
  998. }
  999. else
  1000. {
  1001. if ( IsPressed(action) )
  1002. {
  1003. thePlayer.AddTimer( 'CharOnTimer' , KEY_HOLD_WINDOW, false );
  1004. }
  1005. if ( IsReleased(action) )
  1006. {
  1007. thePlayer.RemoveTimer( 'CharOnTimer' );
  1008. ToggleCharacterModules( false, "CharModulesHotkey" );
  1009. }
  1010. }
  1011. }
  1012.  
  1013. private var pressCharTime : float;
  1014. event OnCommPanelChar( action : SInputAction )
  1015. {
  1016. if( !theInput.IsActionPressed( 'PinModuleModfier' ) )
  1017. {
  1018. if( IsPressed(action) )
  1019. {
  1020. pressCharTime = theGame.GetEngineTimeAsSeconds();
  1021. }
  1022. if( IsReleased( action ) )
  1023. {
  1024. if ( theGame.GetEngineTimeAsSeconds() - pressCharTime < KEY_HOLD_WINDOW || !ActionsHaveConflict( 'PanelChar', 'HoldToSeeCharStats' ) )
  1025. {
  1026. PushCharacterScreen();
  1027. }
  1028. }
  1029. }
  1030. }
  1031. //---=== modFriendlyHUD ===---
  1032.  
  1033. final function PushCharacterScreen()
  1034. {
  1035. if ( theGame.IsBlackscreenOrFading() )
  1036. {
  1037. return;
  1038. }
  1039.  
  1040. if( IsActionAllowed(EIAB_OpenCharacterPanel) )
  1041. {
  1042. theGame.RequestMenuWithBackground( 'CharacterMenu', 'CommonMenu' );
  1043. }
  1044. else
  1045. {
  1046. thePlayer.DisplayActionDisallowedHudMessage(EIAB_OpenCharacterPanel);
  1047. }
  1048. }
  1049.  
  1050.  
  1051. event OnCommPanelInv( action : SInputAction )
  1052. {
  1053. //---=== modFriendlyHUD ===---
  1054. if ( ( theInput.LastUsedPCInput() && IsReleased(action) ) || ( theInput.LastUsedGamepad() && IsPressed(action) ) )
  1055. {
  1056. if ( theInput.IsActionPressed( 'PanelInv' ) )
  1057. {
  1058. if ( theInput.IsActionPressed( 'PanelInv' ) )
  1059. {
  1060. controllerQuickInventoryHandled = true;
  1061. }
  1062. //---=== modFriendlyHUD ===---
  1063. PushInventoryScreen();
  1064. }
  1065. }
  1066.  
  1067. final function PushInventoryScreen()
  1068. {
  1069. if ( theGame.IsBlackscreenOrFading() )
  1070. {
  1071. return;
  1072. }
  1073. if( IsActionAllowed(EIAB_OpenInventory) )
  1074. {
  1075. theGame.RequestMenuWithBackground( 'InventoryMenu', 'CommonMenu' );
  1076. }
  1077. else
  1078. {
  1079. thePlayer.DisplayActionDisallowedHudMessage(EIAB_OpenInventory);
  1080. }
  1081. }
  1082.  
  1083.  
  1084. event OnCommDeckEditor( action : SInputAction )
  1085. {
  1086. if( IsReleased(action) )
  1087. {
  1088. if ( theGame.IsBlackscreenOrFading() )
  1089. {
  1090. return false;
  1091. }
  1092. if (theGame.GetGwintManager().GetHasDoneTutorial() || theGame.GetGwintManager().HasLootedCard())
  1093. {
  1094. if( IsActionAllowed(EIAB_OpenGwint) )
  1095. {
  1096. theGame.RequestMenu( 'DeckBuilder' );
  1097. }
  1098. else
  1099. {
  1100. thePlayer.DisplayActionDisallowedHudMessage(EIAB_OpenGwint);
  1101. }
  1102. }
  1103. }
  1104. }
  1105.  
  1106.  
  1107. event OnCommPanelMed( action : SInputAction )
  1108. {
  1109. if( IsReleased(action) )
  1110. {
  1111. if( IsActionAllowed(EIAB_MeditationWaiting) )
  1112. {
  1113. GetWitcherPlayer().Meditate();
  1114. }
  1115. else
  1116. {
  1117. thePlayer.DisplayActionDisallowedHudMessage(EIAB_MeditationWaiting);
  1118. }
  1119. }
  1120. }
  1121.  
  1122. //---=== modFriendlyHUD ===---
  1123. event OnHoldToSeeMapPC( action : SInputAction )
  1124. {
  1125. if( theInput.IsActionPressed( 'PinModuleModfier' ) )
  1126. {
  1127. if( IsReleased( action ) )
  1128. {
  1129. ToggleMinimapModules( !IsHUDGroupEnabledForReason( GetFHUDConfig().minimapModules, "PinMinimapGroup" ), "PinMinimapGroup" );
  1130. }
  1131. }
  1132. else
  1133. {
  1134. if ( IsPressed(action) )
  1135. {
  1136. thePlayer.AddTimer( 'MapOnTimer' , KEY_HOLD_WINDOW, false );
  1137. }
  1138. if( IsReleased(action) )
  1139. {
  1140. thePlayer.RemoveTimer( 'MapOnTimer' );
  1141. ToggleMinimapModules( false, "MinimapModulesHotkey" );
  1142. }
  1143. }
  1144. }
  1145.  
  1146. private var pressMapTime : float;
  1147. event OnCommPanelMapPC( action : SInputAction )
  1148. {
  1149. if( !theInput.IsActionPressed( 'PinModuleModfier' ) )
  1150. {
  1151. if( IsPressed(action) )
  1152. {
  1153. pressMapTime = theGame.GetEngineTimeAsSeconds();
  1154. }
  1155. if( IsReleased( action ) )
  1156. {
  1157. if ( theGame.GetEngineTimeAsSeconds() - pressMapTime < KEY_HOLD_WINDOW || !ActionsHaveConflict( 'PanelMapPC', 'HoldToSeeMap' ) )
  1158. {
  1159. PushMapScreen();
  1160. }
  1161. }
  1162. }
  1163. }
  1164. //---=== modFriendlyHUD ===---
  1165.  
  1166. event OnCommPanelMap( action : SInputAction )
  1167. {
  1168. if( IsPressed(action) )
  1169. {
  1170. PushMapScreen();
  1171. }
  1172. }
  1173. final function PushMapScreen()
  1174. {
  1175. if ( theGame.IsBlackscreenOrFading() )
  1176. {
  1177. return;
  1178. }
  1179. if( IsActionAllowed(EIAB_OpenMap) )
  1180. {
  1181. theGame.RequestMenuWithBackground( 'MapMenu', 'CommonMenu' );
  1182. }
  1183. else
  1184. {
  1185. thePlayer.DisplayActionDisallowedHudMessage(EIAB_OpenMap);
  1186. }
  1187. }
  1188.  
  1189. //---=== modFriendlyHUD ===---
  1190. event OnHoldToSeeJour( action : SInputAction )
  1191. {
  1192. if( theInput.IsActionPressed( 'PinModuleModfier' ) )
  1193. {
  1194. if( IsReleased( action ) )
  1195. {
  1196. ToggleQuestsModules( !IsHUDGroupEnabledForReason( GetFHUDConfig().questsModules, "PinQuestsGroup" ), "PinQuestsGroup" );
  1197. }
  1198. }
  1199. else
  1200. {
  1201. if ( IsPressed(action) )
  1202. {
  1203. thePlayer.AddTimer( 'QuestsOnTimer' , KEY_HOLD_WINDOW, false );
  1204. }
  1205. if( IsReleased(action) )
  1206. {
  1207. thePlayer.RemoveTimer( 'QuestsOnTimer' );
  1208. ToggleQuestsModules( false, "QuestsModulesHotkey" );
  1209. }
  1210. }
  1211. }
  1212.  
  1213. private var pressJournalTime : float;
  1214. event OnCommPanelJour( action : SInputAction )
  1215. {
  1216. if( !theInput.IsActionPressed( 'PinModuleModfier' ) )
  1217. {
  1218. if( IsPressed(action) )
  1219. {
  1220. pressJournalTime = theGame.GetEngineTimeAsSeconds();
  1221. }
  1222. if( IsReleased( action ) )
  1223. {
  1224. if ( theGame.GetEngineTimeAsSeconds() - pressJournalTime < KEY_HOLD_WINDOW || !ActionsHaveConflict( 'PanelJour', 'HoldToSeeQuests' ) )
  1225. {
  1226. PushJournalScreen();
  1227. }
  1228. }
  1229. }
  1230. }
  1231. //---=== modFriendlyHUD ===---
  1232.  
  1233. final function PushJournalScreen()
  1234. {
  1235. if ( theGame.IsBlackscreenOrFading() )
  1236. {
  1237. return;
  1238. }
  1239. if( IsActionAllowed(EIAB_OpenJournal) )
  1240. {
  1241.  
  1242. theGame.RequestMenuWithBackground( 'JournalQuestMenu', 'CommonMenu' );
  1243. }
  1244. else
  1245. {
  1246. thePlayer.DisplayActionDisallowedHudMessage(EIAB_OpenJournal);
  1247. }
  1248. }
  1249.  
  1250. event OnCommPanelMeditation( action : SInputAction )
  1251. {
  1252. if( IsReleased(action) )
  1253. {
  1254. PushMeditationScreen();
  1255. }
  1256. }
  1257.  
  1258. final function PushMeditationScreen()
  1259. {
  1260.  
  1261.  
  1262. if ( theGame.IsBlackscreenOrFading() )
  1263. {
  1264. return;
  1265. }
  1266. if( IsActionAllowed(EIAB_OpenMeditation) )
  1267. {
  1268.  
  1269.  
  1270.  
  1271.  
  1272.  
  1273.  
  1274.  
  1275.  
  1276. theGame.RequestMenuWithBackground( 'MeditationClockMenu', 'CommonMenu' );
  1277.  
  1278.  
  1279. }
  1280. else
  1281. {
  1282. thePlayer.DisplayActionDisallowedHudMessage(EIAB_OpenMeditation);
  1283. }
  1284. }
  1285.  
  1286. event OnCommPanelCrafting( action : SInputAction )
  1287. {
  1288. if( IsReleased(action) )
  1289. {
  1290. PushCraftingScreen();
  1291. }
  1292. }
  1293.  
  1294. final function PushCraftingScreen()
  1295. {
  1296. if ( theGame.IsBlackscreenOrFading() )
  1297. {
  1298. return;
  1299. }
  1300.  
  1301. theGame.RequestMenuWithBackground( 'CraftingMenu', 'CommonMenu' );
  1302. }
  1303.  
  1304.  
  1305. event OnCommPanelBestiary( action : SInputAction )
  1306. {
  1307. if( IsReleased(action) )
  1308. {
  1309. PushBestiaryScreen();
  1310. }
  1311. }
  1312.  
  1313. final function PushBestiaryScreen()
  1314. {
  1315. if ( theGame.IsBlackscreenOrFading() )
  1316. {
  1317. return;
  1318. }
  1319. if( IsActionAllowed(EIAB_OpenGlossary) )
  1320. {
  1321. theGame.RequestMenuWithBackground( 'GlossaryBestiaryMenu', 'CommonMenu' );
  1322. }
  1323. else
  1324. {
  1325. thePlayer.DisplayActionDisallowedHudMessage(EIAB_OpenGlossary);
  1326. }
  1327. }
  1328.  
  1329. event OnCommPanelAlch( action : SInputAction )
  1330. {
  1331. if( IsReleased(action) )
  1332. {
  1333. PushAlchemyScreen();
  1334. }
  1335. }
  1336. final function PushAlchemyScreen()
  1337. {
  1338. if ( theGame.IsBlackscreenOrFading() )
  1339. {
  1340. return;
  1341. }
  1342. if( IsActionAllowed(EIAB_OpenAlchemy) )
  1343. {
  1344. theGame.RequestMenuWithBackground( 'AlchemyMenu', 'CommonMenu' );
  1345. }
  1346. else
  1347. {
  1348. thePlayer.DisplayActionDisallowedHudMessage(EIAB_OpenAlchemy);
  1349. }
  1350. }
  1351.  
  1352. event OnCommPanelGlossary( action : SInputAction )
  1353. {
  1354. if( IsReleased(action) )
  1355. {
  1356. PushGlossaryScreen();
  1357. }
  1358. }
  1359. final function PushGlossaryScreen()
  1360. {
  1361. if ( theGame.IsBlackscreenOrFading() )
  1362. {
  1363. return;
  1364. }
  1365. if( IsActionAllowed(EIAB_OpenGlossary) )
  1366. {
  1367. theGame.RequestMenuWithBackground( 'GlossaryEncyclopediaMenu', 'CommonMenu' );
  1368. }
  1369. else
  1370. {
  1371. thePlayer.DisplayActionDisallowedHudMessage(EIAB_OpenGlossary);
  1372. }
  1373. }
  1374.  
  1375. event OnShowControlsHelp( action : SInputAction )
  1376. {
  1377. if( IsReleased(action) )
  1378. {
  1379. if ( theGame.IsBlackscreenOrFading() )
  1380. {
  1381. return false;
  1382. }
  1383.  
  1384.  
  1385. }
  1386. }
  1387.  
  1388. event OnCommPanelUIResize( action : SInputAction )
  1389. {
  1390. if( IsReleased(action) )
  1391. {
  1392. if ( theGame.IsBlackscreenOrFading() )
  1393. {
  1394. return false;
  1395. }
  1396. theGame.RequestMenu( 'RescaleMenu' );
  1397. }
  1398. }
  1399.  
  1400. event OnCommPanelFakeHud( action : SInputAction )
  1401. {
  1402. if( IsReleased(action) )
  1403. {
  1404. if ( theGame.IsBlackscreenOrFading() )
  1405. {
  1406. return false;
  1407. }
  1408.  
  1409. }
  1410. }
  1411.  
  1412.  
  1413.  
  1414.  
  1415. private var processedSwordHold : bool;
  1416.  
  1417. event OnCommSteelSword( action : SInputAction )
  1418. {
  1419. var duringCastSign : bool;
  1420.  
  1421. if(IsPressed(action))
  1422. processedSwordHold = false;
  1423.  
  1424. if ( theInput.LastUsedGamepad() && theInput.IsActionPressed('Alternate') )
  1425. {
  1426. return false;
  1427. }
  1428.  
  1429. if ( IsReleased(action) || ( IsPressed(action) && (thePlayer.GetCurrentMeleeWeaponType() == PW_None || thePlayer.GetCurrentMeleeWeaponType() == PW_Fists) ) )
  1430. {
  1431. if( !processedSwordHold )
  1432. {
  1433. if ( IsActionAllowed(EIAB_DrawWeapon) && thePlayer.GetBIsInputAllowed() && thePlayer.GetWeaponHolster().IsMeleeWeaponReady() )
  1434. {
  1435. thePlayer.PushCombatActionOnBuffer( EBAT_Draw_Steel, BS_Pressed );
  1436. if ( thePlayer.GetBIsCombatActionAllowed() )
  1437. thePlayer.ProcessCombatActionBuffer();
  1438. }
  1439. processedSwordHold = true;
  1440. }
  1441. }
  1442. }
  1443.  
  1444. event OnCommSilverSword( action : SInputAction )
  1445. {
  1446. var duringCastSign : bool;
  1447.  
  1448. if( IsPressed(action) )
  1449. processedSwordHold = false;
  1450.  
  1451. if ( theInput.LastUsedGamepad() && theInput.IsActionPressed('Alternate') )
  1452. {
  1453. return false;
  1454. }
  1455.  
  1456. if ( IsReleased(action) || ( IsPressed(action) && (thePlayer.GetCurrentMeleeWeaponType() == PW_None || thePlayer.GetCurrentMeleeWeaponType() == PW_Fists) ) )
  1457. {
  1458. if( !processedSwordHold )
  1459. {
  1460. if ( IsActionAllowed(EIAB_DrawWeapon) && thePlayer.GetBIsInputAllowed() && thePlayer.GetWeaponHolster().IsMeleeWeaponReady() )
  1461. {
  1462. thePlayer.PushCombatActionOnBuffer( EBAT_Draw_Silver, BS_Pressed );
  1463. if ( thePlayer.GetBIsCombatActionAllowed() || duringCastSign )
  1464. thePlayer.ProcessCombatActionBuffer();
  1465. }
  1466. processedSwordHold = true;
  1467. }
  1468.  
  1469. }
  1470. }
  1471.  
  1472. event OnCommSheatheAny( action : SInputAction )
  1473. {
  1474. var duringCastSign : bool;
  1475.  
  1476. if( IsPressed( action ) )
  1477. {
  1478. if ( thePlayer.GetBIsInputAllowed() && thePlayer.GetWeaponHolster().IsMeleeWeaponReady() )
  1479. {
  1480. thePlayer.PushCombatActionOnBuffer( EBAT_Sheathe_Sword, BS_Pressed );
  1481. if ( thePlayer.GetBIsCombatActionAllowed() || duringCastSign )
  1482. {
  1483. thePlayer.ProcessCombatActionBuffer();
  1484. }
  1485. }
  1486. processedSwordHold = true;
  1487. }
  1488. }
  1489.  
  1490. event OnCommSheatheSteel( action : SInputAction )
  1491. {
  1492. if( IsPressed( action ) && thePlayer.IsWeaponHeld( 'steelsword' ) && !processedSwordHold)
  1493. {
  1494. OnCommSheatheAny(action);
  1495. }
  1496. }
  1497.  
  1498. event OnCommSheatheSilver( action : SInputAction )
  1499. {
  1500. if( IsPressed( action ) && thePlayer.IsWeaponHeld( 'silversword' ) && !processedSwordHold)
  1501. {
  1502. OnCommSheatheAny(action);
  1503. }
  1504. }
  1505.  
  1506. event OnCommDrinkPot( action : SInputAction )
  1507. {
  1508. if(IsPressed(action))
  1509. {
  1510. if(!potPress)
  1511. {
  1512. potPress = true;
  1513. potAction = action;
  1514. thePlayer.AddTimer('PotDrinkTimer', 0.3);
  1515. }
  1516. else
  1517. {
  1518. PotDrinkTimer(true);
  1519. thePlayer.RemoveTimer('PotDrinkTimer');
  1520. }
  1521. }
  1522. }
  1523.  
  1524. public function PotDrinkTimer(isDoubleTapped : bool)
  1525. {
  1526. thePlayer.RemoveTimer('PotDrinkTimer');
  1527. potPress = false;
  1528.  
  1529. if(isDoubleTapped)
  1530. OnCommDrinkPotion2(potAction);
  1531. else
  1532. OnCommDrinkPotion1(potAction);
  1533. }
  1534.  
  1535.  
  1536.  
  1537.  
  1538. event OnCbtComboDigitLeft( action : SInputAction )
  1539. {
  1540. if ( theInput.IsActionPressed('Alternate') )
  1541. {
  1542. OnTogglePreviousSign(action);
  1543. }
  1544. }
  1545.  
  1546. event OnCbtComboDigitRight( action : SInputAction )
  1547. {
  1548. if ( theInput.IsActionPressed('Alternate') )
  1549. {
  1550. OnToggleNextSign(action);
  1551. }
  1552. }
  1553.  
  1554.  
  1555. event OnSelectSign(action : SInputAction)
  1556. {
  1557. if( IsPressed( action ) )
  1558. {
  1559. switch( action.aName )
  1560. {
  1561. case 'SelectAard' :
  1562. GetWitcherPlayer().SetEquippedSign(ST_Aard);
  1563. break;
  1564. case 'SelectYrden' :
  1565. GetWitcherPlayer().SetEquippedSign(ST_Yrden);
  1566. break;
  1567. case 'SelectIgni' :
  1568. GetWitcherPlayer().SetEquippedSign(ST_Igni);
  1569. break;
  1570. case 'SelectQuen' :
  1571. GetWitcherPlayer().SetEquippedSign(ST_Quen);
  1572. break;
  1573. case 'SelectAxii' :
  1574. GetWitcherPlayer().SetEquippedSign(ST_Axii);
  1575. break;
  1576. default :
  1577. break;
  1578. }
  1579. }
  1580. }
  1581.  
  1582. event OnToggleSigns( action : SInputAction )
  1583. {
  1584. var tolerance : float;
  1585. tolerance = 2.5f;
  1586.  
  1587. if( action.value < -tolerance )
  1588. {
  1589. GetWitcherPlayer().TogglePreviousSign();
  1590. }
  1591. else if( action.value > tolerance )
  1592. {
  1593. GetWitcherPlayer().ToggleNextSign();
  1594. }
  1595. }
  1596. event OnToggleNextSign( action : SInputAction )
  1597. {
  1598. if( IsPressed( action ) )
  1599. {
  1600. GetWitcherPlayer().ToggleNextSign();
  1601. }
  1602. }
  1603. event OnTogglePreviousSign( action : SInputAction )
  1604. {
  1605. if( IsPressed( action ) )
  1606. {
  1607. GetWitcherPlayer().TogglePreviousSign();
  1608. }
  1609. }
  1610.  
  1611. event OnToggleItem( action : SInputAction )
  1612. {
  1613. if( !IsActionAllowed( EIAB_QuickSlots ) )
  1614. {
  1615. thePlayer.DisplayActionDisallowedHudMessage(EIAB_QuickSlots);
  1616. return false;
  1617. }
  1618.  
  1619. if( IsReleased( action ) )
  1620. {
  1621. if( theInput.GetLastActivationTime( action.aName ) < 0.3 )
  1622. GetWitcherPlayer().ToggleNextItem();
  1623. }
  1624. }
  1625.  
  1626.  
  1627.  
  1628.  
  1629.  
  1630. event OnCommDrinkpotionUpperHeld( action : SInputAction )
  1631. {
  1632. //---=== modFriendlyHUD ===---
  1633. if( theInput.LastUsedGamepad() && GetFHUDConfig().enableItemsInRadialMenu && ((CR4HudModuleRadialMenu)theGame.GetHud().GetHudModule( "RadialMenuModule" )).IsRadialMenuOpened() )
  1634. {
  1635. return false;
  1636. }
  1637. //---=== modFriendlyHUD ===---
  1638.  
  1639. if(!potionModeHold)
  1640. return false;
  1641.  
  1642.  
  1643. if(thePlayer.IsCiri())
  1644. return false;
  1645.  
  1646. if(IsReleased(action))
  1647. return false;
  1648.  
  1649. potionUpperHeld = true;
  1650. GetWitcherPlayer().FlipSelectedPotion(true);
  1651. }
  1652.  
  1653. event OnCommDrinkpotionLowerHeld( action : SInputAction )
  1654. {
  1655. //---=== modFriendlyHUD ===---
  1656. if( theInput.LastUsedGamepad() && GetFHUDConfig().enableItemsInRadialMenu && ((CR4HudModuleRadialMenu)theGame.GetHud().GetHudModule( "RadialMenuModule" )).IsRadialMenuOpened() )
  1657. {
  1658. return false;
  1659. }
  1660. //---=== modFriendlyHUD ===---
  1661.  
  1662. if(!potionModeHold)
  1663. return false;
  1664.  
  1665.  
  1666. if(thePlayer.IsCiri())
  1667. return false;
  1668.  
  1669. if(IsReleased(action))
  1670. return false;
  1671.  
  1672. potionLowerHeld = true;
  1673. GetWitcherPlayer().FlipSelectedPotion(false);
  1674. }
  1675.  
  1676. public final function SetPotionSelectionMode(b : bool)
  1677. {
  1678. potionModeHold = b;
  1679. }
  1680.  
  1681. private final function DrinkPotion(action : SInputAction, upperSlot : bool) : bool
  1682. {
  1683. var witcher : W3PlayerWitcher;
  1684.  
  1685. if ( potionModeHold && IsReleased(action) )
  1686. {
  1687. if(!potionUpperHeld && !potionLowerHeld)
  1688. {
  1689. GetWitcherPlayer().OnPotionDrinkInput(upperSlot);
  1690. }
  1691.  
  1692. if(upperSlot)
  1693. potionUpperHeld = false;
  1694. else
  1695. potionLowerHeld = false;
  1696. }
  1697. else if(!potionModeHold && IsPressed(action))
  1698. {
  1699. witcher = GetWitcherPlayer();
  1700. if(!witcher.IsPotionDoubleTapRunning())
  1701. {
  1702. witcher.SetPotionDoubleTapRunning(true, upperSlot);
  1703. return true;
  1704. }
  1705. else
  1706. {
  1707. witcher.SetPotionDoubleTapRunning(false);
  1708. witcher.FlipSelectedPotion(upperSlot);
  1709. return true;
  1710. }
  1711. }
  1712.  
  1713. return false;
  1714. }
  1715.  
  1716.  
  1717. event OnCommDrinkPotion1( action : SInputAction )
  1718. {
  1719. //---=== modFriendlyHUD ===---
  1720. if( theInput.LastUsedGamepad() && GetFHUDConfig().enableItemsInRadialMenu && ((CR4HudModuleRadialMenu)theGame.GetHud().GetHudModule( "RadialMenuModule" )).IsRadialMenuOpened() )
  1721. {
  1722. return false;
  1723. }
  1724. //---=== modFriendlyHUD ===---
  1725.  
  1726. if(thePlayer.IsCiri())
  1727. return false;
  1728.  
  1729. if( !IsActionAllowed( EIAB_QuickSlots ) )
  1730. {
  1731. thePlayer.DisplayActionDisallowedHudMessage(EIAB_QuickSlots);
  1732. return false;
  1733. }
  1734.  
  1735. if ( theInput.LastUsedGamepad() )
  1736. {
  1737. return DrinkPotion(action, true);
  1738. }
  1739. else
  1740. if ( IsReleased(action) )
  1741. {
  1742. GetWitcherPlayer().OnPotionDrinkKeyboardsInput(EES_Potion1);
  1743. return true;
  1744. }
  1745.  
  1746. return false;
  1747. }
  1748.  
  1749.  
  1750. event OnCommDrinkPotion2( action : SInputAction )
  1751. {
  1752. var witcher : W3PlayerWitcher;
  1753.  
  1754. //---=== modFriendlyHUD ===---
  1755. if( theInput.LastUsedGamepad() && GetFHUDConfig().enableItemsInRadialMenu && ((CR4HudModuleRadialMenu)theGame.GetHud().GetHudModule( "RadialMenuModule" )).IsRadialMenuOpened() )
  1756. {
  1757. return false;
  1758. }
  1759. //---=== modFriendlyHUD ===---
  1760.  
  1761. if(thePlayer.IsCiri())
  1762. return false;
  1763.  
  1764. if( !IsActionAllowed( EIAB_QuickSlots ) )
  1765. {
  1766. thePlayer.DisplayActionDisallowedHudMessage(EIAB_QuickSlots);
  1767. return false;
  1768. }
  1769.  
  1770. if ( theInput.LastUsedGamepad() )
  1771. {
  1772. return DrinkPotion(action, false);
  1773. }
  1774. else
  1775. if ( IsReleased(action) )
  1776. {
  1777. GetWitcherPlayer().OnPotionDrinkKeyboardsInput(EES_Potion2);
  1778. return true;
  1779. }
  1780.  
  1781. return false;
  1782. }
  1783.  
  1784.  
  1785. event OnCommDrinkPotion3( action : SInputAction )
  1786. {
  1787. //---=== modFriendlyHUD ===---
  1788. if( theInput.LastUsedGamepad() && GetFHUDConfig().enableItemsInRadialMenu && ((CR4HudModuleRadialMenu)theGame.GetHud().GetHudModule( "RadialMenuModule" )).IsRadialMenuOpened() )
  1789. {
  1790. return false;
  1791. }
  1792. //---=== modFriendlyHUD ===---
  1793.  
  1794. if(thePlayer.IsCiri())
  1795. return false;
  1796.  
  1797. if( !IsActionAllowed( EIAB_QuickSlots ) )
  1798. {
  1799. thePlayer.DisplayActionDisallowedHudMessage(EIAB_QuickSlots);
  1800. return false;
  1801. }
  1802.  
  1803. if ( IsReleased(action) )
  1804. {
  1805. GetWitcherPlayer().OnPotionDrinkKeyboardsInput(EES_Potion3);
  1806. return true;
  1807. }
  1808.  
  1809. return false;
  1810. }
  1811.  
  1812.  
  1813. event OnCommDrinkPotion4( action : SInputAction )
  1814. {
  1815. var witcher : W3PlayerWitcher;
  1816.  
  1817. //---=== modFriendlyHUD ===---
  1818. if( theInput.LastUsedGamepad() && GetFHUDConfig().enableItemsInRadialMenu && ((CR4HudModuleRadialMenu)theGame.GetHud().GetHudModule( "RadialMenuModule" )).IsRadialMenuOpened() )
  1819. {
  1820. return false;
  1821. }
  1822. //---=== modFriendlyHUD ===---
  1823.  
  1824. if(thePlayer.IsCiri())
  1825. return false;
  1826.  
  1827. if( !IsActionAllowed( EIAB_QuickSlots ) )
  1828. {
  1829. thePlayer.DisplayActionDisallowedHudMessage(EIAB_QuickSlots);
  1830. return false;
  1831. }
  1832.  
  1833. if ( IsReleased(action) )
  1834. {
  1835. GetWitcherPlayer().OnPotionDrinkKeyboardsInput(EES_Potion4);
  1836. return true;
  1837. }
  1838.  
  1839. return false;
  1840. }
  1841.  
  1842.  
  1843.  
  1844.  
  1845.  
  1846. event OnDiving( action : SInputAction )
  1847. {
  1848. if ( IsPressed(action) && IsActionAllowed(EIAB_Dive) )
  1849. {
  1850. if ( action.aName == 'DiveDown' )
  1851. {
  1852. if ( thePlayer.OnAllowedDiveDown() )
  1853. {
  1854. if ( !thePlayer.OnCheckDiving() )
  1855. thePlayer.OnDive();
  1856.  
  1857. if ( thePlayer.bLAxisReleased )
  1858. thePlayer.SetBehaviorVariable( 'divePitch',-1.0);
  1859. else
  1860. thePlayer.SetBehaviorVariable( 'divePitch', -0.9);
  1861. thePlayer.OnDiveInput(-1.f);
  1862.  
  1863. if ( thePlayer.rangedWeapon.GetCurrentStateName() != 'State_WeaponWait' )
  1864. {
  1865. thePlayer.OnRangedForceHolster( true, false );
  1866. thePlayer.OnFullyBlendedIdle();
  1867. }
  1868. }
  1869. }
  1870. else if ( action.aName == 'DiveUp' )
  1871. {
  1872. if ( thePlayer.bLAxisReleased )
  1873. thePlayer.SetBehaviorVariable( 'divePitch',1.0);
  1874. else
  1875. thePlayer.SetBehaviorVariable( 'divePitch', 0.9);
  1876.  
  1877. if ( thePlayer.rangedWeapon.GetCurrentStateName() != 'State_WeaponWait' )
  1878. {
  1879. thePlayer.OnRangedForceHolster( true, false );
  1880. thePlayer.OnFullyBlendedIdle();
  1881. }
  1882.  
  1883. thePlayer.OnDiveInput(1.f);
  1884. }
  1885. }
  1886. else if ( IsReleased(action) )
  1887. {
  1888. thePlayer.SetBehaviorVariable( 'divePitch',0.0);
  1889. thePlayer.OnDiveInput(0.f);
  1890. }
  1891. else if ( IsPressed(action) && !IsActionAllowed(EIAB_Dive) )
  1892. {
  1893. thePlayer.DisplayActionDisallowedHudMessage(EIAB_Dive);
  1894. }
  1895. }
  1896.  
  1897. event OnDivingDodge( action : SInputAction )
  1898. {
  1899. var isDodgeAllowed : bool;
  1900.  
  1901. if( IsPressed(action) )
  1902. {
  1903. isDodgeAllowed = IsActionAllowed(EIAB_Dodge);
  1904. if( isDodgeAllowed && IsActionAllowed(EIAB_Dive) )
  1905. {
  1906. if ( thePlayer.OnCheckDiving() && thePlayer.GetBIsInputAllowed() )
  1907. {
  1908. thePlayer.PushCombatActionOnBuffer( EBAT_Dodge, BS_Pressed );
  1909. if ( thePlayer.GetBIsCombatActionAllowed() )
  1910. thePlayer.ProcessCombatActionBuffer();
  1911. }
  1912. }
  1913. else
  1914. {
  1915. if(!isDodgeAllowed)
  1916. thePlayer.DisplayActionDisallowedHudMessage(EIAB_Dodge);
  1917. else
  1918. thePlayer.DisplayActionDisallowedHudMessage(EIAB_Dive);
  1919. }
  1920. }
  1921. }
  1922.  
  1923.  
  1924.  
  1925.  
  1926.  
  1927. event OnExpFistFightLight( action : SInputAction )
  1928. {
  1929. var fistsAllowed : bool;
  1930.  
  1931. if( IsPressed(action) )
  1932. {
  1933. fistsAllowed = IsActionAllowed(EIAB_Fists);
  1934. if( fistsAllowed && IsActionAllowed(EIAB_LightAttacks) )
  1935. {
  1936.  
  1937. thePlayer.SetupCombatAction( EBAT_LightAttack, BS_Pressed );
  1938. }
  1939. else
  1940. {
  1941. if(!fistsAllowed)
  1942. thePlayer.DisplayActionDisallowedHudMessage(EIAB_Fists);
  1943. else
  1944. thePlayer.DisplayActionDisallowedHudMessage(EIAB_LightAttacks);
  1945. }
  1946. }
  1947. }
  1948.  
  1949. event OnExpFistFightHeavy( action : SInputAction )
  1950. {
  1951. var fistsAllowed : bool;
  1952.  
  1953. if( IsPressed(action) )
  1954. {
  1955. fistsAllowed = IsActionAllowed(EIAB_Fists);
  1956. if( fistsAllowed && IsActionAllowed(EIAB_HeavyAttacks) )
  1957. {
  1958.  
  1959. thePlayer.SetupCombatAction( EBAT_HeavyAttack, BS_Pressed );
  1960. }
  1961. else
  1962. {
  1963. if(!fistsAllowed)
  1964. thePlayer.DisplayActionDisallowedHudMessage(EIAB_Fists);
  1965. else
  1966. thePlayer.DisplayActionDisallowedHudMessage(EIAB_HeavyAttacks);
  1967. }
  1968. }
  1969. }
  1970.  
  1971.  
  1972.  
  1973. event OnExpFocus( action : SInputAction )
  1974. {
  1975. if(IsActionAllowed(EIAB_ExplorationFocus))
  1976. {
  1977. if( IsPressed( action ) )
  1978. {
  1979.  
  1980. if( thePlayer.GoToCombatIfNeeded() )
  1981. {
  1982. OnCommGuard( action );
  1983. return false;
  1984. }
  1985. theGame.GetFocusModeController().Activate();
  1986.  
  1987. }
  1988. else if( IsReleased( action ) )
  1989. {
  1990. theGame.GetFocusModeController().Deactivate();
  1991. }
  1992. }
  1993. else
  1994. {
  1995. thePlayer.DisplayActionDisallowedHudMessage(EIAB_ExplorationFocus);
  1996. theGame.GetFocusModeController().Deactivate();
  1997. }
  1998. }
  1999.  
  2000.  
  2001.  
  2002.  
  2003.  
  2004. private function ShouldSwitchAttackType():bool
  2005. {
  2006. var outKeys : array<EInputKey>;
  2007.  
  2008. if ( theInput.LastUsedPCInput() )
  2009. {
  2010. theInput.GetPCKeysForAction('PCAlternate',outKeys);
  2011. if ( outKeys.Size() > 0 )
  2012. {
  2013. if ( theInput.IsActionPressed('PCAlternate') )
  2014. {
  2015. return true;
  2016. }
  2017. }
  2018. }
  2019. return false;
  2020. }
  2021.  
  2022. event OnCbtAttackWithAlternateLight( action : SInputAction )
  2023. {
  2024. CbtAttackPC( action, false);
  2025. }
  2026.  
  2027. event OnCbtAttackWithAlternateHeavy( action : SInputAction )
  2028. {
  2029. CbtAttackPC( action, true);
  2030. }
  2031.  
  2032. function CbtAttackPC( action : SInputAction, isHeavy : bool )
  2033. {
  2034. var switchAttackType : bool;
  2035.  
  2036. switchAttackType = ShouldSwitchAttackType();
  2037.  
  2038. if ( !theInput.LastUsedPCInput() )
  2039. {
  2040. return;
  2041. }
  2042.  
  2043. if ( thePlayer.IsCiri() )
  2044. {
  2045. if ( switchAttackType != isHeavy)
  2046. {
  2047. OnCbtCiriAttackHeavy(action);
  2048. }
  2049. else
  2050. {
  2051. OnCbtAttackLight(action);
  2052. }
  2053. }
  2054. else
  2055. {
  2056. if ( switchAttackType != isHeavy)
  2057. {
  2058. OnCbtAttackHeavy(action);
  2059. }
  2060. else
  2061. {
  2062. OnCbtAttackLight(action);
  2063. }
  2064. }
  2065. }
  2066.  
  2067. event OnCbtAttackLight( action : SInputAction )
  2068. {
  2069. var allowed, checkedFists : bool;
  2070.  
  2071. if( IsPressed(action) )
  2072. {
  2073. if( IsActionAllowed(EIAB_LightAttacks) )
  2074. {
  2075. if (thePlayer.GetBIsInputAllowed())
  2076. {
  2077. allowed = false;
  2078.  
  2079. if( thePlayer.GetCurrentMeleeWeaponType() == PW_Fists || thePlayer.GetCurrentMeleeWeaponType() == PW_None )
  2080. {
  2081. checkedFists = true;
  2082. if(IsActionAllowed(EIAB_Fists))
  2083. allowed = true;
  2084. }
  2085. else if(IsActionAllowed(EIAB_SwordAttack))
  2086. {
  2087. checkedFists = false;
  2088. allowed = true;
  2089. }
  2090.  
  2091. if(allowed)
  2092. {
  2093. thePlayer.SetupCombatAction( EBAT_LightAttack, BS_Pressed );
  2094. }
  2095. else
  2096. {
  2097. if(checkedFists)
  2098. thePlayer.DisplayActionDisallowedHudMessage(EIAB_Fists);
  2099. else
  2100. thePlayer.DisplayActionDisallowedHudMessage(EIAB_SwordAttack);
  2101. }
  2102. }
  2103. }
  2104. else if ( !IsActionBlockedBy(EIAB_LightAttacks,'interaction') )
  2105. {
  2106. thePlayer.DisplayActionDisallowedHudMessage(EIAB_LightAttacks);
  2107. }
  2108. }
  2109. }
  2110.  
  2111. event OnCbtAttackHeavy( action : SInputAction )
  2112. {
  2113. var allowed, checkedSword : bool;
  2114. var outKeys : array<EInputKey>;
  2115.  
  2116. if ( thePlayer.GetBIsInputAllowed() )
  2117. {
  2118. if( IsActionAllowed(EIAB_HeavyAttacks) )
  2119. {
  2120. allowed = false;
  2121.  
  2122. if( thePlayer.GetCurrentMeleeWeaponType() == PW_Fists || thePlayer.GetCurrentMeleeWeaponType() == PW_None )
  2123. {
  2124. checkedSword = false;
  2125. if(IsActionAllowed(EIAB_Fists))
  2126. allowed = true;
  2127. }
  2128. else if(IsActionAllowed(EIAB_SwordAttack))
  2129. {
  2130. checkedSword = true;
  2131. allowed = true;
  2132. }
  2133.  
  2134. if(allowed)
  2135. {
  2136. if ( ( thePlayer.GetCurrentMeleeWeaponType() == PW_Fists || thePlayer.GetCurrentMeleeWeaponType() == PW_None ) && IsPressed(action) )
  2137. {
  2138. thePlayer.SetupCombatAction( EBAT_HeavyAttack, BS_Released );
  2139. }
  2140. else
  2141. {
  2142. if( IsReleased(action) && theInput.GetLastActivationTime( action.aName ) < 0.2 )
  2143. {
  2144. thePlayer.SetupCombatAction( EBAT_HeavyAttack, BS_Released );
  2145. }
  2146. }
  2147. }
  2148. else
  2149. {
  2150. if(checkedSword)
  2151. thePlayer.DisplayActionDisallowedHudMessage(EIAB_SwordAttack);
  2152. else
  2153. thePlayer.DisplayActionDisallowedHudMessage(EIAB_Fists);
  2154. }
  2155. }
  2156. else if ( !IsActionBlockedBy(EIAB_HeavyAttacks,'interaction') )
  2157. {
  2158. thePlayer.DisplayActionDisallowedHudMessage(EIAB_HeavyAttacks);
  2159. }
  2160. }
  2161. }
  2162.  
  2163. private function CheckFinisherInput() : bool
  2164. {
  2165. var enemyInCone : CActor;
  2166. var npc : CNewNPC;
  2167. var interactionTarget : CInteractionComponent;
  2168.  
  2169. var isDeadlySwordHeld : bool;
  2170.  
  2171. interactionTarget = theGame.GetInteractionsManager().GetActiveInteraction();
  2172. if ( interactionTarget && interactionTarget.GetName() == "Finish" )
  2173. {
  2174. npc = (CNewNPC)( interactionTarget.GetEntity() );
  2175.  
  2176. isDeadlySwordHeld = thePlayer.IsDeadlySwordHeld();
  2177. if( ( theInput.GetActionValue( 'AttackHeavy' ) == 1.f || theInput.GetActionValue( 'AttackLight' ) == 1.f )
  2178. && isDeadlySwordHeld )
  2179. {
  2180. theGame.RemoveTimeScale( theGame.GetTimescaleSource(ETS_FinisherInput) );
  2181. npc.SignalGameplayEvent('Finisher');
  2182.  
  2183. }
  2184. else if ( !isDeadlySwordHeld )
  2185. {
  2186. if ( thePlayer.IsWeaponHeld( 'fist' ))
  2187. thePlayer.SetBehaviorVariable( 'combatTauntType', 1.f );
  2188. else
  2189. thePlayer.SetBehaviorVariable( 'combatTauntType', 0.f );
  2190.  
  2191. thePlayer.RaiseEvent( 'CombatTaunt' );
  2192. }
  2193.  
  2194. return true;
  2195.  
  2196. }
  2197. return false;
  2198. }
  2199.  
  2200. private function IsPlayerAbleToPerformSpecialAttack() : bool
  2201. {
  2202. if( ( thePlayer.GetCurrentStateName() == 'Exploration' ) && !( thePlayer.IsWeaponHeld( 'silversword' ) || thePlayer.IsWeaponHeld( 'steelsword' ) ) )
  2203. {
  2204. return false;
  2205. }
  2206. return true;
  2207. }
  2208.  
  2209. event OnCbtSpecialAttackWithAlternateLight( action : SInputAction )
  2210. {
  2211. CbSpecialAttackPC( action, false);
  2212. }
  2213.  
  2214. event OnCbtSpecialAttackWithAlternateHeavy( action : SInputAction )
  2215. {
  2216. CbSpecialAttackPC( action, true);
  2217. }
  2218.  
  2219. function CbSpecialAttackPC( action : SInputAction, isHeavy : bool )
  2220. {
  2221. var switchAttackType : bool;
  2222.  
  2223. switchAttackType = ShouldSwitchAttackType();
  2224.  
  2225. if ( !theInput.LastUsedPCInput() )
  2226. {
  2227. return;
  2228. }
  2229.  
  2230. if ( IsPressed(action) )
  2231. {
  2232. if ( thePlayer.IsCiri() )
  2233. {
  2234.  
  2235. OnCbtCiriSpecialAttackHeavy(action);
  2236. }
  2237. else
  2238. {
  2239. if (switchAttackType != isHeavy)
  2240. {
  2241. OnCbtSpecialAttackHeavy(action);
  2242. }
  2243. else
  2244. {
  2245. OnCbtSpecialAttackLight(action);
  2246. }
  2247. }
  2248. }
  2249. else if ( IsReleased( action ) )
  2250. {
  2251. if ( thePlayer.IsCiri() )
  2252. {
  2253. OnCbtCiriSpecialAttackHeavy(action);
  2254. }
  2255. else
  2256. {
  2257.  
  2258. OnCbtSpecialAttackHeavy(action);
  2259. OnCbtSpecialAttackLight(action);
  2260. }
  2261. }
  2262. }
  2263.  
  2264. event OnCbtSpecialAttackLight( action : SInputAction )
  2265. {
  2266. if ( IsReleased( action ) )
  2267. {
  2268. thePlayer.CancelHoldAttacks();
  2269. return true;
  2270. }
  2271.  
  2272. if ( !IsPlayerAbleToPerformSpecialAttack() )
  2273. return false;
  2274.  
  2275. if( !IsActionAllowed(EIAB_LightAttacks) )
  2276. {
  2277. thePlayer.DisplayActionDisallowedHudMessage(EIAB_LightAttacks);
  2278. return false;
  2279. }
  2280. if(!IsActionAllowed(EIAB_SpecialAttackLight) )
  2281. {
  2282. thePlayer.DisplayActionDisallowedHudMessage(EIAB_SpecialAttackLight);
  2283. return false;
  2284. }
  2285.  
  2286. if( IsPressed(action) && thePlayer.CanUseSkill(S_Sword_s01) )
  2287. {
  2288. thePlayer.PrepareToAttack();
  2289. thePlayer.SetPlayedSpecialAttackMissingResourceSound(false);
  2290. thePlayer.AddTimer( 'IsSpecialLightAttackInputHeld', 0.00001, true );
  2291. }
  2292. }
  2293.  
  2294. event OnCbtSpecialAttackHeavy( action : SInputAction )
  2295. {
  2296. if ( IsReleased( action ) )
  2297. {
  2298. thePlayer.CancelHoldAttacks();
  2299. return true;
  2300. }
  2301.  
  2302. if ( !IsPlayerAbleToPerformSpecialAttack() )
  2303. return false;
  2304.  
  2305. if( !IsActionAllowed(EIAB_HeavyAttacks))
  2306. {
  2307. thePlayer.DisplayActionDisallowedHudMessage(EIAB_HeavyAttacks);
  2308. return false;
  2309. }
  2310. if(!IsActionAllowed(EIAB_SpecialAttackHeavy))
  2311. {
  2312. thePlayer.DisplayActionDisallowedHudMessage(EIAB_SpecialAttackHeavy);
  2313. return false;
  2314. }
  2315.  
  2316. if( IsPressed(action) && thePlayer.CanUseSkill(S_Sword_s02) )
  2317. {
  2318. thePlayer.PrepareToAttack();
  2319. thePlayer.SetPlayedSpecialAttackMissingResourceSound(false);
  2320. thePlayer.AddTimer( 'IsSpecialHeavyAttackInputHeld', 0.00001, true );
  2321. }
  2322. else if ( IsPressed(action) )
  2323. {
  2324. if ( theInput.IsActionPressed('AttackHeavy') )
  2325. theInput.ForceDeactivateAction('AttackHeavy');
  2326. else if ( theInput.IsActionPressed('AttackWithAlternateHeavy') )
  2327. theInput.ForceDeactivateAction('AttackWithAlternateHeavy');
  2328. }
  2329. }
  2330.  
  2331.  
  2332. event OnCbtCiriSpecialAttack( action : SInputAction )
  2333. {
  2334. if( !GetCiriPlayer().HasSword() )
  2335. return false;
  2336.  
  2337. if( thePlayer.GetBIsInputAllowed() && thePlayer.GetBIsCombatActionAllowed() && IsPressed(action) )
  2338. {
  2339. if ( thePlayer.HasAbility('CiriBlink') && ((W3ReplacerCiri)thePlayer).HasStaminaForSpecialAction(true) )
  2340. thePlayer.PrepareToAttack();
  2341. thePlayer.PushCombatActionOnBuffer( EBAT_Ciri_SpecialAttack, BS_Pressed );
  2342. thePlayer.ProcessCombatActionBuffer();
  2343. }
  2344. else if ( IsReleased( action ) && thePlayer.GetCombatAction() == EBAT_Ciri_SpecialAttack && thePlayer.GetBehaviorVariable( 'isPerformingSpecialAttack' ) != 0 )
  2345. {
  2346. thePlayer.PushCombatActionOnBuffer( EBAT_Ciri_SpecialAttack, BS_Released );
  2347. thePlayer.ProcessCombatActionBuffer();
  2348. }
  2349. }
  2350.  
  2351.  
  2352. event OnCbtCiriAttackHeavy( action : SInputAction )
  2353. {
  2354. var specialAttackAction : SInputAction;
  2355.  
  2356. if( !GetCiriPlayer().HasSword() )
  2357. return false;
  2358.  
  2359. specialAttackAction = theInput.GetAction('CiriSpecialAttackHeavy');
  2360.  
  2361. if( thePlayer.GetBIsInputAllowed() && IsReleased(action) && thePlayer.GetBehaviorVariable( 'isPerformingSpecialAttack' ) == 0 )
  2362. {
  2363. if( IsActionAllowed(EIAB_HeavyAttacks) && IsActionAllowed(EIAB_SwordAttack) )
  2364. {
  2365. if ( thePlayer.GetCurrentMeleeWeaponType() == PW_Steel )
  2366. {
  2367. thePlayer.PrepareToAttack();
  2368. thePlayer.SetupCombatAction( EBAT_HeavyAttack, BS_Released );
  2369. if ( thePlayer.GetBIsCombatActionAllowed() )
  2370. thePlayer.ProcessCombatActionBuffer();
  2371. }
  2372. }
  2373. else if ( !IsActionBlockedBy(EIAB_HeavyAttacks,'interaction') )
  2374. {
  2375. thePlayer.DisplayActionDisallowedHudMessage(EIAB_LightAttacks);
  2376. }
  2377. }
  2378. }
  2379.  
  2380.  
  2381. event OnCbtCiriSpecialAttackHeavy( action : SInputAction )
  2382. {
  2383. if( !GetCiriPlayer().HasSword() )
  2384. return false;
  2385.  
  2386. if( thePlayer.GetBIsInputAllowed() && thePlayer.GetBIsCombatActionAllowed() && IsPressed(action) )
  2387. {
  2388. theInput.ForceDeactivateAction('AttackWithAlternateHeavy');
  2389. thePlayer.PushCombatActionOnBuffer( EBAT_Ciri_SpecialAttack_Heavy, BS_Pressed );
  2390. thePlayer.ProcessCombatActionBuffer();
  2391. }
  2392. else if ( IsReleased( action ) && thePlayer.GetCombatAction() == EBAT_Ciri_SpecialAttack_Heavy && thePlayer.GetBehaviorVariable( 'isPerformingSpecialAttack' ) != 0 )
  2393. {
  2394. theInput.ForceDeactivateAction('CiriAttackHeavy');
  2395. theInput.ForceDeactivateAction('AttackWithAlternateHeavy');
  2396. thePlayer.PushCombatActionOnBuffer( EBAT_Ciri_SpecialAttack_Heavy, BS_Released );
  2397. thePlayer.ProcessCombatActionBuffer();
  2398. }
  2399. }
  2400.  
  2401. event OnCbtCiriDodge( action : SInputAction )
  2402. {
  2403. if( IsActionAllowed(EIAB_Dodge) && IsPressed(action) && thePlayer.IsAlive() )
  2404. {
  2405. if ( thePlayer.IsInCombatAction() && thePlayer.GetCombatAction() == EBAT_Ciri_SpecialAttack && thePlayer.GetBehaviorVariable( 'isCompletingSpecialAttack' ) <= 0 )
  2406. {
  2407. thePlayer.PushCombatActionOnBuffer( EBAT_Ciri_Dodge, BS_Pressed );
  2408. thePlayer.ProcessCombatActionBuffer();
  2409. }
  2410. else if ( thePlayer.GetBIsInputAllowed() )
  2411. {
  2412. thePlayer.PushCombatActionOnBuffer( EBAT_Ciri_Dodge, BS_Pressed );
  2413. if ( thePlayer.GetBIsCombatActionAllowed() )
  2414. thePlayer.ProcessCombatActionBuffer();
  2415. }
  2416. else
  2417. {
  2418. if ( thePlayer.IsInCombatAction() && thePlayer.GetBehaviorVariable( 'combatActionType' ) == (int)CAT_Attack )
  2419. {
  2420. if ( thePlayer.CanPlayHitAnim() && thePlayer.IsThreatened() )
  2421. {
  2422. thePlayer.CriticalEffectAnimationInterrupted("CiriDodge");
  2423. thePlayer.PushCombatActionOnBuffer( EBAT_Ciri_Dodge, BS_Pressed );
  2424. thePlayer.ProcessCombatActionBuffer();
  2425. }
  2426. else
  2427. thePlayer.PushCombatActionOnBuffer( EBAT_Ciri_Dodge, BS_Pressed );
  2428. }
  2429. }
  2430. }
  2431. else if ( !IsActionAllowed(EIAB_Dodge) )
  2432. {
  2433. thePlayer.DisplayActionDisallowedHudMessage(EIAB_Dodge);
  2434. }
  2435. }
  2436.  
  2437. event OnCbtCiriDash( action : SInputAction )
  2438. {
  2439. if ( theInput.LastUsedGamepad() && IsPressed( action ) )
  2440. {
  2441. thePlayer.StartDodgeTimer();
  2442. }
  2443. else if( IsActionAllowed(EIAB_Dodge) && thePlayer.IsAlive() )
  2444. {
  2445. if ( theInput.LastUsedGamepad() )
  2446. {
  2447. if ( !(thePlayer.IsDodgeTimerRunning() && !thePlayer.IsInsideInteraction() && IsReleased(action)) )
  2448. return false;
  2449. }
  2450.  
  2451. if ( thePlayer.IsInCombatAction() && thePlayer.GetCombatAction() == EBAT_Ciri_SpecialAttack && thePlayer.GetBehaviorVariable( 'isCompletingSpecialAttack' ) <= 0 )
  2452. {
  2453. thePlayer.PushCombatActionOnBuffer( EBAT_Roll, BS_Released );
  2454. thePlayer.ProcessCombatActionBuffer();
  2455. }
  2456. else if ( thePlayer.GetBIsInputAllowed() )
  2457. {
  2458. thePlayer.PushCombatActionOnBuffer( EBAT_Roll, BS_Released );
  2459. if ( thePlayer.GetBIsCombatActionAllowed() )
  2460. thePlayer.ProcessCombatActionBuffer();
  2461. }
  2462. else
  2463. {
  2464. if ( thePlayer.IsInCombatAction() && thePlayer.GetBehaviorVariable( 'combatActionType' ) == (int)CAT_Attack )
  2465. {
  2466. if ( thePlayer.CanPlayHitAnim() && thePlayer.IsThreatened() )
  2467. {
  2468. thePlayer.CriticalEffectAnimationInterrupted("CiriDodge");
  2469. thePlayer.PushCombatActionOnBuffer( EBAT_Roll, BS_Released );
  2470. thePlayer.ProcessCombatActionBuffer();
  2471. }
  2472. else
  2473. thePlayer.PushCombatActionOnBuffer( EBAT_Roll, BS_Released );
  2474. }
  2475. }
  2476. }
  2477. else if ( !IsActionAllowed(EIAB_Dodge) )
  2478. {
  2479. thePlayer.DisplayActionDisallowedHudMessage(EIAB_Dodge);
  2480. }
  2481. }
  2482.  
  2483. event OnCbtDodge( action : SInputAction )
  2484. {
  2485. if ( IsPressed(action) )
  2486. thePlayer.EvadePressed(EBAT_Dodge);
  2487. }
  2488.  
  2489. event OnCbtRoll( action : SInputAction )
  2490. {
  2491. if ( theInput.LastUsedPCInput() )
  2492. {
  2493. if ( IsPressed( action ) )
  2494. {
  2495. thePlayer.EvadePressed(EBAT_Roll);
  2496. }
  2497. }
  2498. else
  2499. {
  2500. if ( IsPressed( action ) )
  2501. {
  2502. thePlayer.StartDodgeTimer();
  2503. }
  2504. else if ( IsReleased( action ) )
  2505. {
  2506. if ( thePlayer.IsDodgeTimerRunning() )
  2507. {
  2508. thePlayer.StopDodgeTimer();
  2509. if ( !thePlayer.IsInsideInteraction() )
  2510. thePlayer.EvadePressed(EBAT_Roll);
  2511. }
  2512.  
  2513. }
  2514. }
  2515. }
  2516.  
  2517.  
  2518. var lastMovementDoubleTapName : name;
  2519.  
  2520. event OnMovementDoubleTap( action : SInputAction )
  2521. {
  2522. if ( IsPressed( action ) )
  2523. {
  2524. if ( !thePlayer.IsDodgeTimerRunning() || action.aName != lastMovementDoubleTapName )
  2525. {
  2526. thePlayer.StartDodgeTimer();
  2527. lastMovementDoubleTapName = action.aName;
  2528. }
  2529. else
  2530. {
  2531. thePlayer.StopDodgeTimer();
  2532.  
  2533. thePlayer.EvadePressed(EBAT_Dodge);
  2534. }
  2535.  
  2536. }
  2537. }
  2538.  
  2539. event OnCastSign( action : SInputAction )
  2540. {
  2541. var signSkill : ESkill;
  2542.  
  2543. if( !thePlayer.GetBIsInputAllowed() )
  2544. {
  2545. return false;
  2546. }
  2547.  
  2548. if( IsPressed(action) )
  2549. {
  2550. if( !IsActionAllowed(EIAB_Signs) )
  2551. {
  2552. thePlayer.DisplayActionDisallowedHudMessage(EIAB_Signs);
  2553. return false;
  2554. }
  2555. if ( thePlayer.IsHoldingItemInLHand() && thePlayer.IsUsableItemLBlocked() )
  2556. {
  2557. thePlayer.DisplayActionDisallowedHudMessage(EIAB_Undefined, false, false, true);
  2558. return false;
  2559. }
  2560. signSkill = SignEnumToSkillEnum( thePlayer.GetEquippedSign() );
  2561. if( signSkill != S_SUndefined )
  2562. {
  2563. if(!thePlayer.CanUseSkill(signSkill))
  2564. {
  2565. thePlayer.DisplayActionDisallowedHudMessage(EIAB_Signs, false, false, true);
  2566. return false;
  2567. }
  2568.  
  2569. if( thePlayer.HasStaminaToUseSkill( signSkill, false ) )
  2570. {
  2571. if( GetInvalidUniqueId() != thePlayer.inv.GetItemFromSlot( 'l_weapon' ) && !thePlayer.IsUsableItemLBlocked())
  2572. {
  2573.  
  2574.  
  2575.  
  2576. }
  2577.  
  2578. thePlayer.SetupCombatAction( EBAT_CastSign, BS_Pressed );
  2579. }
  2580. else
  2581. {
  2582. thePlayer.SoundEvent("gui_no_stamina");
  2583. }
  2584. }
  2585. }
  2586. }
  2587.  
  2588.  
  2589.  
  2590.  
  2591. event OnThrowBomb(action : SInputAction)
  2592. {
  2593. var selectedItemId : SItemUniqueId;
  2594.  
  2595. selectedItemId = thePlayer.GetSelectedItemId();
  2596. if(!thePlayer.inv.IsItemBomb(selectedItemId))
  2597. return false;
  2598.  
  2599. if( thePlayer.inv.SingletonItemGetAmmo(selectedItemId) == 0 )
  2600. {
  2601.  
  2602. if(IsPressed(action))
  2603. {
  2604. thePlayer.SoundEvent( "gui_ingame_low_stamina_warning" );
  2605. }
  2606.  
  2607. return false;
  2608. }
  2609.  
  2610. if ( IsReleased(action) )
  2611. {
  2612. if ( thePlayer.IsThrowHold() )
  2613. {
  2614. if ( thePlayer.playerAiming.GetAimedTarget() )
  2615. {
  2616. if ( thePlayer.AllowAttack( thePlayer.playerAiming.GetAimedTarget(), EBAT_ItemUse ) )
  2617. {
  2618. thePlayer.PushCombatActionOnBuffer( EBAT_ItemUse, BS_Released );
  2619. thePlayer.ProcessCombatActionBuffer();
  2620. }
  2621. else
  2622. thePlayer.BombThrowAbort();
  2623. }
  2624. else
  2625. {
  2626. thePlayer.PushCombatActionOnBuffer( EBAT_ItemUse, BS_Released );
  2627. thePlayer.ProcessCombatActionBuffer();
  2628. }
  2629.  
  2630. thePlayer.SetThrowHold( false );
  2631.  
  2632. return true;
  2633.  
  2634. }
  2635. else
  2636. {
  2637. if(!IsActionAllowed(EIAB_ThrowBomb))
  2638. {
  2639. thePlayer.DisplayActionDisallowedHudMessage(EIAB_ThrowBomb);
  2640. return false;
  2641. }
  2642.  
  2643. if ( thePlayer.IsHoldingItemInLHand() && !thePlayer.IsUsableItemLBlocked() )
  2644. {
  2645. thePlayer.SetPlayerActionToRestore ( PATR_ThrowBomb );
  2646. thePlayer.OnUseSelectedItem( true );
  2647. return true;
  2648. }
  2649. if(thePlayer.CanSetupCombatAction_Throw() && theInput.GetLastActivationTime( action.aName ) < 0.3f )
  2650. {
  2651.  
  2652. thePlayer.SetupCombatAction( EBAT_ItemUse, BS_Pressed );
  2653. return true;
  2654. }
  2655.  
  2656. thePlayer.SetupCombatAction( EBAT_ItemUse, BS_Released );
  2657. return true;
  2658. }
  2659. }
  2660.  
  2661. return false;
  2662. }
  2663.  
  2664. event OnThrowBombHold(action : SInputAction)
  2665. {
  2666. var locks : array<SInputActionLock>;
  2667. var ind : int;
  2668.  
  2669. var selectedItemId : SItemUniqueId;
  2670.  
  2671. selectedItemId = thePlayer.GetSelectedItemId();
  2672. if(!thePlayer.inv.IsItemBomb(selectedItemId))
  2673. return false;
  2674.  
  2675. if( thePlayer.inv.SingletonItemGetAmmo(selectedItemId) == 0 )
  2676. {
  2677.  
  2678. if(IsPressed(action))
  2679. {
  2680. thePlayer.SoundEvent( "gui_ingame_low_stamina_warning" );
  2681. }
  2682.  
  2683. return false;
  2684. }
  2685.  
  2686. if( IsPressed(action) )
  2687. {
  2688. if(!IsActionAllowed(EIAB_ThrowBomb))
  2689. {
  2690. thePlayer.DisplayActionDisallowedHudMessage(EIAB_ThrowBomb);
  2691. return false;
  2692. }
  2693. else if(GetWitcherPlayer().GetBombDelay(GetWitcherPlayer().GetItemSlot(selectedItemId)) > 0 )
  2694. {
  2695.  
  2696. return false;
  2697. }
  2698. if ( thePlayer.IsHoldingItemInLHand() && !thePlayer.IsUsableItemLBlocked() )
  2699. {
  2700. thePlayer.SetPlayerActionToRestore ( PATR_ThrowBomb );
  2701. thePlayer.OnUseSelectedItem( true );
  2702. return true;
  2703. }
  2704. if(thePlayer.CanSetupCombatAction_Throw() && theInput.GetLastActivationTime( action.aName ) < 0.3f )
  2705. {
  2706. if( thePlayer.GetBIsCombatActionAllowed() )
  2707. {
  2708. thePlayer.PushCombatActionOnBuffer( EBAT_ItemUse, BS_Pressed );
  2709. thePlayer.ProcessCombatActionBuffer();
  2710. }
  2711. }
  2712.  
  2713.  
  2714.  
  2715. locks = GetActionLocks(EIAB_ThrowBomb);
  2716. ind = FindActionLockIndex(EIAB_ThrowBomb, 'BombThrow');
  2717. if(ind >= 0)
  2718. locks.Erase(ind);
  2719.  
  2720. if(locks.Size() != 0)
  2721. return false;
  2722.  
  2723. thePlayer.SetThrowHold( true );
  2724. return true;
  2725. }
  2726.  
  2727. return false;
  2728. }
  2729.  
  2730. event OnThrowBombAbort(action : SInputAction)
  2731. {
  2732. if( IsPressed(action) )
  2733. {
  2734. thePlayer.BombThrowAbort();
  2735. }
  2736. }
  2737.  
  2738.  
  2739.  
  2740.  
  2741.  
  2742. event OnCbtThrowItem( action : SInputAction )
  2743. {
  2744. var isUsableItem, isCrossbow, isBomb, ret : bool;
  2745. var itemId : SItemUniqueId;
  2746.  
  2747.  
  2748. if(thePlayer.IsInAir() || thePlayer.GetWeaponHolster().IsOnTheMiddleOfHolstering())
  2749. return false;
  2750.  
  2751. if( thePlayer.IsSwimming() && !thePlayer.OnCheckDiving() && thePlayer.GetCurrentStateName() != 'AimThrow' )
  2752. return false;
  2753.  
  2754. itemId = thePlayer.GetSelectedItemId();
  2755.  
  2756. if(!thePlayer.inv.IsIdValid(itemId))
  2757. return false;
  2758.  
  2759. isCrossbow = thePlayer.inv.IsItemCrossbow(itemId);
  2760. if(!isCrossbow)
  2761. {
  2762. isBomb = thePlayer.inv.IsItemBomb(itemId);
  2763. if(!isBomb)
  2764. {
  2765. isUsableItem = true;
  2766. }
  2767. }
  2768.  
  2769.  
  2770.  
  2771.  
  2772. if( isCrossbow )
  2773. {
  2774. if ( IsActionAllowed(EIAB_Crossbow) )
  2775. {
  2776. if( IsPressed(action))
  2777. {
  2778. if ( thePlayer.IsHoldingItemInLHand() && !thePlayer.IsUsableItemLBlocked() )
  2779. {
  2780.  
  2781.  
  2782. thePlayer.SetPlayerActionToRestore ( PATR_Crossbow );
  2783. thePlayer.OnUseSelectedItem( true );
  2784. ret = true;
  2785. }
  2786. else if ( thePlayer.GetBIsInputAllowed() && !thePlayer.IsCurrentlyUsingItemL() )
  2787. {
  2788. thePlayer.SetIsAimingCrossbow( true );
  2789. thePlayer.SetupCombatAction( EBAT_ItemUse, BS_Pressed );
  2790.  
  2791.  
  2792. ret = true;
  2793. }
  2794. }
  2795. else
  2796. {
  2797.  
  2798. if ( thePlayer.GetIsAimingCrossbow() && !thePlayer.IsCurrentlyUsingItemL() )
  2799. {
  2800. thePlayer.SetupCombatAction( EBAT_ItemUse, BS_Released );
  2801.  
  2802.  
  2803. thePlayer.SetIsAimingCrossbow( false );
  2804. ret = true;
  2805. }
  2806. }
  2807. }
  2808. else
  2809. {
  2810. if ( !thePlayer.IsInShallowWater() )
  2811. thePlayer.DisplayActionDisallowedHudMessage(EIAB_Crossbow);
  2812. }
  2813.  
  2814. if ( IsPressed(action) )
  2815. thePlayer.AddTimer( 'IsItemUseInputHeld', 0.00001, true );
  2816. else
  2817. thePlayer.RemoveTimer('IsItemUseInputHeld');
  2818.  
  2819. return ret;
  2820. }
  2821. else if(isBomb)
  2822. {
  2823. return OnThrowBomb(action);
  2824. }
  2825. else if(isUsableItem && !thePlayer.IsSwimming() )
  2826. {
  2827. if( IsActionAllowed(EIAB_UsableItem) )
  2828. {
  2829. if(IsPressed(action) && thePlayer.HasStaminaToUseAction(ESAT_UsableItem))
  2830. {
  2831. thePlayer.SetPlayerActionToRestore ( PATR_Default );
  2832. thePlayer.OnUseSelectedItem();
  2833. return true;
  2834. }
  2835.  
  2836. }
  2837. else
  2838. {
  2839. thePlayer.DisplayActionDisallowedHudMessage(EIAB_UsableItem);
  2840. }
  2841. }
  2842.  
  2843. return false;
  2844. }
  2845.  
  2846. event OnCbtThrowItemHold( action : SInputAction )
  2847. {
  2848. var isBomb, isCrossbow, isUsableItem : bool;
  2849. var itemId : SItemUniqueId;
  2850.  
  2851.  
  2852. if(thePlayer.IsInAir() || thePlayer.GetWeaponHolster().IsOnTheMiddleOfHolstering() )
  2853. return false;
  2854.  
  2855. if( thePlayer.IsSwimming() && !thePlayer.OnCheckDiving() && thePlayer.GetCurrentStateName() != 'AimThrow' )
  2856. return false;
  2857.  
  2858. itemId = thePlayer.GetSelectedItemId();
  2859.  
  2860. if(!thePlayer.inv.IsIdValid(itemId))
  2861. return false;
  2862.  
  2863. isCrossbow = thePlayer.inv.IsItemCrossbow(itemId);
  2864. if(!isCrossbow)
  2865. {
  2866. isBomb = thePlayer.inv.IsItemBomb(itemId);
  2867. if(isBomb)
  2868. {
  2869. return OnThrowBombHold(action);
  2870. }
  2871. else
  2872. {
  2873. isUsableItem = true;
  2874. }
  2875. }
  2876.  
  2877.  
  2878. if(IsPressed(action))
  2879. {
  2880. if( isCrossbow && !IsActionAllowed(EIAB_Crossbow) )
  2881. {
  2882. thePlayer.DisplayActionDisallowedHudMessage(EIAB_Crossbow);
  2883. return false;
  2884. }
  2885.  
  2886. if( isUsableItem)
  2887. {
  2888. if(!IsActionAllowed(EIAB_UsableItem))
  2889. {
  2890. thePlayer.DisplayActionDisallowedHudMessage(EIAB_UsableItem);
  2891. return false;
  2892. }
  2893. else if(thePlayer.IsSwimming())
  2894. {
  2895. thePlayer.DisplayActionDisallowedHudMessage(EIAB_Undefined, false, false, true);
  2896. return false;
  2897. }
  2898. }
  2899. }
  2900.  
  2901. if( IsPressed(action) )
  2902. {
  2903. thePlayer.SetThrowHold( true );
  2904. return true;
  2905. }
  2906. else if( IsReleased(action) && thePlayer.IsThrowHold())
  2907. {
  2908.  
  2909.  
  2910. thePlayer.SetupCombatAction( EBAT_ItemUse, BS_Released );
  2911. thePlayer.SetThrowHold( false );
  2912. return true;
  2913. }
  2914.  
  2915. return false;
  2916. }
  2917.  
  2918. event OnCbtThrowCastAbort( action : SInputAction )
  2919. {
  2920. var player : W3PlayerWitcher;
  2921. var throwStage : EThrowStage;
  2922.  
  2923. if(thePlayer.inv.IsItemBomb(thePlayer.GetSelectedItemId()))
  2924. {
  2925. return OnThrowBombAbort(action);
  2926. }
  2927.  
  2928. if( IsPressed(action) )
  2929. {
  2930. player = GetWitcherPlayer();
  2931. if(player)
  2932. {
  2933. if( player.IsCastingSign() )
  2934. {
  2935. player.CastSignAbort();
  2936. }
  2937. else
  2938. {
  2939. if ( thePlayer.inv.IsItemCrossbow( thePlayer.inv.GetItemFromSlot( 'l_weapon' ) ) )
  2940. {
  2941. thePlayer.OnRangedForceHolster();
  2942. }
  2943. else
  2944. {
  2945. throwStage = (int)thePlayer.GetBehaviorVariable( 'throwStage', (int)TS_Stop);
  2946.  
  2947. if(throwStage == TS_Start || throwStage == TS_Loop)
  2948. player.ThrowingAbort();
  2949. }
  2950. }
  2951. }
  2952. }
  2953. }
  2954.  
  2955. event OnCbtSelectLockTarget( inputVector : Vector )
  2956. {
  2957. var newLockTarget : CActor;
  2958. var inputHeading : float;
  2959. var target : CActor;
  2960.  
  2961. inputVector.Y = inputVector.Y * -1.f;
  2962. inputHeading = VecHeading( inputVector );
  2963.  
  2964. newLockTarget = thePlayer.GetScreenSpaceLockTarget( thePlayer.GetDisplayTarget(), 180.f, 1.f, inputHeading );
  2965.  
  2966. if ( newLockTarget )
  2967. thePlayer.ProcessLockTarget( newLockTarget );
  2968.  
  2969. target = thePlayer.GetTarget();
  2970. if ( target )
  2971. {
  2972. thePlayer.SetSlideTarget( target );
  2973.  
  2974. }
  2975. }
  2976.  
  2977. event OnCbtLockAndGuard( action : SInputAction )
  2978. {
  2979. if(thePlayer.IsCiri() && !GetCiriPlayer().HasSword())
  2980. return false;
  2981.  
  2982.  
  2983. if( IsReleased(action) )
  2984. {
  2985. thePlayer.SetGuarded(false);
  2986. thePlayer.OnGuardedReleased();
  2987. }
  2988.  
  2989. if( (thePlayer.IsWeaponHeld('fists') || thePlayer.GetCurrentStateName() == 'CombatFists') && !IsActionAllowed(EIAB_Fists))
  2990. {
  2991. thePlayer.DisplayActionDisallowedHudMessage(EIAB_Fists);
  2992. return false;
  2993. }
  2994.  
  2995. if( IsPressed(action) )
  2996. {
  2997. //better torch
  2998. /*if( !IsActionAllowed(EIAB_Parry) )
  2999. {
  3000. if ( IsActionBlockedBy(EIAB_Parry,'UsableItem') )
  3001. {
  3002. thePlayer.DisplayActionDisallowedHudMessage(EIAB_Parry);
  3003. }
  3004. return true;
  3005. }*/
  3006.  
  3007. if ( thePlayer.GetCurrentStateName() == 'Exploration' )
  3008. thePlayer.GoToCombatIfNeeded();
  3009.  
  3010. if ( thePlayer.bLAxisReleased )
  3011. thePlayer.ResetRawPlayerHeading();
  3012.  
  3013. if ( thePlayer.rangedWeapon && thePlayer.rangedWeapon.GetCurrentStateName() != 'State_WeaponWait' )
  3014. thePlayer.OnRangedForceHolster( true, true );
  3015.  
  3016. thePlayer.AddCounterTimeStamp(theGame.GetEngineTime());
  3017. thePlayer.SetGuarded(true);
  3018. thePlayer.OnPerformGuard();
  3019. }
  3020. }
  3021.  
  3022. event OnCbtCameraLockOrSpawnHorse( action : SInputAction )
  3023. {
  3024. if ( OnCbtCameraLock(action) )
  3025. return true;
  3026.  
  3027. if ( OnCommSpawnHorse(action) )
  3028. return true;
  3029.  
  3030. return false;
  3031. }
  3032.  
  3033. event OnCbtCameraLock( action : SInputAction )
  3034. {
  3035. if( IsPressed(action) )
  3036. {
  3037. if ( thePlayer.IsThreatened() || thePlayer.IsActorLockedToTarget() )
  3038. {
  3039. if( !IsActionAllowed(EIAB_CameraLock))
  3040. {
  3041. return false;
  3042. }
  3043. else if ( !thePlayer.IsHardLockEnabled() && thePlayer.GetDisplayTarget() && (CActor)( thePlayer.GetDisplayTarget() ) && IsActionAllowed(EIAB_HardLock))
  3044. {
  3045. if ( thePlayer.bLAxisReleased )
  3046. thePlayer.ResetRawPlayerHeading();
  3047.  
  3048. thePlayer.HardLockToTarget( true );
  3049. }
  3050. else
  3051. {
  3052. thePlayer.HardLockToTarget( false );
  3053. }
  3054. return true;
  3055. }
  3056. }
  3057. return false;
  3058. }
  3059.  
  3060. event OnChangeCameraPreset( action : SInputAction )
  3061. {
  3062. if( IsPressed(action) )
  3063. {
  3064. ((CCustomCamera)theCamera.GetTopmostCameraObject()).NextPreset();
  3065. }
  3066. }
  3067.  
  3068. event OnChangeCameraPresetByMouseWheel( action : SInputAction )
  3069. {
  3070. var tolerance : float;
  3071. tolerance = 10.0f;
  3072.  
  3073. if( ( action.value * totalCameraPresetChange ) < 0.0f )
  3074. {
  3075. totalCameraPresetChange = 0.0f;
  3076. }
  3077.  
  3078. totalCameraPresetChange += action.value;
  3079. if( totalCameraPresetChange < -tolerance )
  3080. {
  3081. ((CCustomCamera)theCamera.GetTopmostCameraObject()).PrevPreset();
  3082. totalCameraPresetChange = 0.0f;
  3083. }
  3084. else if( totalCameraPresetChange > tolerance )
  3085. {
  3086. ((CCustomCamera)theCamera.GetTopmostCameraObject()).NextPreset();
  3087. totalCameraPresetChange = 0.0f;
  3088. }
  3089. }
  3090.  
  3091. event OnMeditationAbort(action : SInputAction)
  3092. {
  3093. var med : W3PlayerWitcherStateMeditation;
  3094.  
  3095.  
  3096.  
  3097.  
  3098.  
  3099.  
  3100.  
  3101.  
  3102.  
  3103.  
  3104.  
  3105.  
  3106.  
  3107.  
  3108.  
  3109. if (!theGame.GetGuiManager().IsAnyMenu())
  3110. {
  3111. med = (W3PlayerWitcherStateMeditation)GetWitcherPlayer().GetCurrentState();
  3112. if(med)
  3113. {
  3114.  
  3115.  
  3116. med.StopRequested(false);
  3117. }
  3118. }
  3119. }
  3120.  
  3121. public final function ClearLocksForNGP()
  3122. {
  3123. var i : int;
  3124.  
  3125. for(i=actionLocks.Size()-1; i>=0; i-=1)
  3126. {
  3127. OnActionLockChanged(i, false);
  3128. actionLocks[i].Clear();
  3129. }
  3130. }
  3131.  
  3132.  
  3133.  
  3134.  
  3135.  
  3136. public function Dbg_UnlockAllActions()
  3137. {
  3138. var i : int;
  3139.  
  3140. if( theGame.IsFinalBuild() )
  3141. {
  3142. return;
  3143. }
  3144.  
  3145. for(i=actionLocks.Size()-1; i>=0; i-=1)
  3146. {
  3147. OnActionLockChanged(i, false);
  3148. }
  3149. actionLocks.Clear();
  3150. }
  3151.  
  3152. event OnDbgSpeedUp( action : SInputAction )
  3153. {
  3154. if( theGame.IsFinalBuild() )
  3155. {
  3156. return false;
  3157. }
  3158.  
  3159. if(IsPressed(action))
  3160. {
  3161. theGame.SetTimeScale(4, theGame.GetTimescaleSource(ETS_DebugInput), theGame.GetTimescalePriority(ETS_DebugInput));
  3162. }
  3163. else if(IsReleased(action))
  3164. {
  3165. theGame.RemoveTimeScale( theGame.GetTimescaleSource(ETS_DebugInput) );
  3166. }
  3167. }
  3168.  
  3169. event OnDbgHit( action : SInputAction )
  3170. {
  3171. if( theGame.IsFinalBuild() )
  3172. {
  3173. return false;
  3174. }
  3175.  
  3176. if(IsReleased(action))
  3177. {
  3178. thePlayer.SetBehaviorVariable( 'HitReactionDirection',(int)EHRD_Back);
  3179. thePlayer.SetBehaviorVariable( 'isAttackReflected', 0 );
  3180. thePlayer.SetBehaviorVariable( 'HitReactionType', (int)EHRT_Heavy);
  3181. thePlayer.SetBehaviorVariable( 'HitReactionWeapon', 0);
  3182. thePlayer.SetBehaviorVariable( 'HitSwingDirection',(int)ASD_LeftRight);
  3183. thePlayer.SetBehaviorVariable( 'HitSwingType',(int)AST_Horizontal);
  3184.  
  3185. thePlayer.RaiseForceEvent( 'Hit' );
  3186. thePlayer.OnRangedForceHolster( true );
  3187. GetWitcherPlayer().SetCustomRotation( 'Hit', thePlayer.GetHeading()+180, 1080.f, 0.1f, false );
  3188. thePlayer.CriticalEffectAnimationInterrupted("OnDbgHit");
  3189. }
  3190. }
  3191.  
  3192. event OnDbgKillTarget( action : SInputAction )
  3193. {
  3194. var target : CActor;
  3195.  
  3196. if( theGame.IsFinalBuild() )
  3197. {
  3198. return false;
  3199. }
  3200.  
  3201. target = thePlayer.GetTarget();
  3202.  
  3203. if( target && IsReleased(action) )
  3204. {
  3205. target.Kill( 'Debug' );
  3206. }
  3207. }
  3208.  
  3209. event OnDbgKillAll( action : SInputAction )
  3210. {
  3211. if( theGame.IsFinalBuild() )
  3212. {
  3213. return false;
  3214. }
  3215.  
  3216. if(IsReleased(action))
  3217. thePlayer.DebugKillAll();
  3218. }
  3219.  
  3220.  
  3221. event OnDbgKillAllTargetingPlayer( action : SInputAction )
  3222. {
  3223. var i : int;
  3224. var all : array<CActor>;
  3225.  
  3226. if( theGame.IsFinalBuild() )
  3227. {
  3228. return false;
  3229. }
  3230.  
  3231. if(IsPressed(action))
  3232. {
  3233. all = GetActorsInRange(thePlayer, 10000, 10000, '', true);
  3234. for(i=0; i<all.Size(); i+=1)
  3235. {
  3236. if(all[i] != thePlayer && all[i].GetTarget() == thePlayer)
  3237. all[i].Kill( 'Debug' );
  3238. }
  3239. }
  3240. }
  3241.  
  3242. event OnDbgTeleportToPin( action : SInputAction )
  3243. {
  3244. if( theGame.IsFinalBuild() )
  3245. {
  3246. return false;
  3247. }
  3248.  
  3249. if(IsReleased(action))
  3250. thePlayer.DebugTeleportToPin();
  3251. }
  3252.  
  3253.  
  3254.  
  3255. event OnBoatDismount( action : SInputAction )
  3256. {
  3257. var boatComp : CBoatComponent;
  3258. var stopAction : SInputAction;
  3259.  
  3260. stopAction = theInput.GetAction('GI_Decelerate');
  3261.  
  3262. if( IsReleased(action) && ( theInput.LastUsedPCInput() || ( stopAction.value < 0.7 && stopAction.lastFrameValue < 0.7 ) ) )
  3263. {
  3264. if( thePlayer.IsActionAllowed( EIAB_DismountVehicle ) )
  3265. {
  3266. boatComp = (CBoatComponent)thePlayer.GetUsedVehicle().GetComponentByClassName( 'CBoatComponent' );
  3267. boatComp.IssueCommandToDismount( DT_normal );
  3268. }
  3269. else
  3270. {
  3271. thePlayer.DisplayActionDisallowedHudMessage(EIAB_DismountVehicle);
  3272. }
  3273. }
  3274. }
  3275.  
  3276.  
  3277.  
  3278.  
  3279.  
  3280. event OnCiriDrawWeapon( action : SInputAction )
  3281. {
  3282. var duringCastSign : bool;
  3283.  
  3284.  
  3285. if ( IsReleased(action) || ( IsPressed(action) && (thePlayer.GetCurrentMeleeWeaponType() == PW_None || thePlayer.GetCurrentMeleeWeaponType() == PW_Fists) ) )
  3286. {
  3287. if ( thePlayer.GetBIsInputAllowed() && thePlayer.GetBIsCombatActionAllowed() )
  3288. {
  3289. if (thePlayer.GetCurrentMeleeWeaponType() == PW_Steel && !thePlayer.IsThreatened() )
  3290. thePlayer.OnEquipMeleeWeapon( PW_None, false );
  3291. else
  3292. thePlayer.OnEquipMeleeWeapon( PW_Steel, false );
  3293. }
  3294. }
  3295. else if(IsReleased(action) || ( IsPressed(action) && (thePlayer.GetCurrentMeleeWeaponType() == PW_Steel || thePlayer.GetCurrentMeleeWeaponType() == PW_Silver) ) )
  3296. {
  3297. CiriSheatheWeapon();
  3298. }
  3299. }
  3300.  
  3301. event OnCiriHolsterWeapon( action : SInputAction )
  3302. {
  3303. var currWeaponType : EPlayerWeapon;
  3304.  
  3305. if(IsPressed( action ))
  3306. {
  3307. currWeaponType = thePlayer.GetCurrentMeleeWeaponType();
  3308.  
  3309. if(currWeaponType == PW_Steel || currWeaponType == PW_Silver)
  3310. {
  3311. CiriSheatheWeapon();
  3312. }
  3313. }
  3314. }
  3315.  
  3316. private final function CiriSheatheWeapon()
  3317. {
  3318. if ( thePlayer.GetBIsInputAllowed() && thePlayer.GetBIsCombatActionAllowed() && !thePlayer.IsThreatened() )
  3319. {
  3320. thePlayer.OnEquipMeleeWeapon( PW_None, false );
  3321. }
  3322. }
  3323.  
  3324.  
  3325.  
  3326.  
  3327. event OnCommHoldFastMenu( action : SInputAction )
  3328. {
  3329. if(IsPressed(action))
  3330. {
  3331. holdFastMenuInvoked = true;
  3332. PushInventoryScreen();
  3333. }
  3334. }
  3335.  
  3336. event OnFastMenu( action : SInputAction )
  3337. {
  3338. if( IsReleased(action) )
  3339. {
  3340. if(holdFastMenuInvoked)
  3341. {
  3342. holdFastMenuInvoked = false;
  3343. return false;
  3344. }
  3345.  
  3346. if ( theGame.IsBlackscreenOrFading() )
  3347. {
  3348. return false;
  3349. }
  3350.  
  3351. if (theGame.GetGuiManager().IsAnyMenu())
  3352. {
  3353. return false;
  3354. }
  3355.  
  3356. if( IsActionAllowed( EIAB_OpenFastMenu ) )
  3357. {
  3358. theGame.SetMenuToOpen( '' );
  3359. theGame.RequestMenu('CommonMenu' );
  3360. }
  3361. else
  3362. {
  3363. thePlayer.DisplayActionDisallowedHudMessage(EIAB_OpenFastMenu);
  3364. }
  3365. }
  3366. }
  3367.  
  3368. event OnIngameMenu( action : SInputAction )
  3369. {
  3370.  
  3371.  
  3372.  
  3373.  
  3374.  
  3375.  
  3376. var openedPanel : name;
  3377.  
  3378. //---=== modFriendlyHUD ===---
  3379. if ( controllerQuickInventoryHandled )
  3380. {
  3381. controllerQuickInventoryHandled = false;
  3382. return false;
  3383. }
  3384. //---=== modFriendlyHUD ===---
  3385.  
  3386. openedPanel = theGame.GetMenuToOpen();
  3387.  
  3388. if( IsReleased(action) && openedPanel != 'GlossaryTutorialsMenu' && !theGame.GetGuiManager().IsAnyMenu() )
  3389.  
  3390.  
  3391.  
  3392.  
  3393. {
  3394. if ( theGame.IsBlackscreenOrFading() )
  3395. {
  3396. return false;
  3397.  
  3398.  
  3399.  
  3400.  
  3401.  
  3402. }
  3403.  
  3404.  
  3405.  
  3406.  
  3407.  
  3408.  
  3409.  
  3410.  
  3411.  
  3412.  
  3413.  
  3414. theGame.SetMenuToOpen( '' );
  3415. theGame.RequestMenu('CommonIngameMenu' );
  3416. }
  3417. }
  3418.  
  3419.  
  3420. event OnToggleHud( action : SInputAction )
  3421. {
  3422. var hud : CR4ScriptedHud;
  3423. if ( IsReleased(action) )
  3424. {
  3425. hud = (CR4ScriptedHud)theGame.GetHud();
  3426. if ( hud )
  3427. {
  3428. hud.ToggleHudByUser();
  3429. }
  3430. }
  3431. }
  3432.  
  3433. public final function Debug_ClearAllActionLocks(optional action : EInputActionBlock, optional all : bool)
  3434. {
  3435. var i : int;
  3436.  
  3437. if(all)
  3438. {
  3439. Dbg_UnlockAllActions();
  3440. }
  3441. else
  3442. {
  3443. OnActionLockChanged(action, false);
  3444. actionLocks[action].Clear();
  3445. }
  3446. }
  3447.  
  3448.  
  3449.  
  3450.  
  3451.  
  3452.  
  3453.  
  3454.  
  3455.  
  3456.  
  3457.  
  3458.  
  3459.  
  3460.  
  3461.  
  3462.  
  3463.  
  3464.  
  3465.  
  3466.  
  3467.  
  3468.  
  3469.  
  3470.  
  3471.  
  3472.  
  3473.  
  3474.  
  3475.  
  3476.  
  3477.  
  3478.  
  3479.  
  3480.  
  3481.  
  3482.  
  3483.  
  3484.  
  3485.  
  3486.  
  3487.  
  3488.  
  3489.  
  3490.  
  3491.  
  3492.  
  3493.  
  3494.  
  3495.  
  3496.  
  3497.  
  3498.  
  3499.  
  3500.  
  3501.  
  3502.  
  3503.  
  3504.  
  3505.  
  3506.  
  3507.  
  3508.  
  3509.  
  3510.  
  3511.  
  3512.  
  3513.  
  3514.  
  3515.  
  3516.  
  3517.  
  3518.  
  3519.  
  3520.  
  3521.  
  3522.  
  3523.  
  3524.  
  3525.  
  3526.  
  3527.  
  3528.  
  3529.  
  3530.  
  3531.  
  3532.  
  3533.  
  3534.  
  3535.  
  3536.  
  3537.  
  3538.  
  3539.  
  3540.  
  3541.  
  3542.  
  3543.  
  3544.  
  3545.  
  3546.  
  3547.  
  3548.  
  3549.  
  3550.  
  3551.  
  3552.  
  3553.  
  3554.  
  3555.  
  3556.  
  3557.  
  3558.  
  3559.  
  3560. // Torch for Ciri
  3561. var TorchCiri : CTorchCiri;
  3562. event OnCiriTorchToggle ( action : SInputAction )
  3563. {
  3564. var CTLchoice : float;
  3565. var inGameConfigWrapper : CInGameConfigWrapper;
  3566.  
  3567.  
  3568. if( !TorchCiri )
  3569. {
  3570. TorchCiri = new CTorchCiri in this;
  3571.  
  3572. }
  3573.  
  3574. if ( IsPressed (action) && thePlayer.IsCiri() )
  3575. {
  3576. inGameConfigWrapper = (CInGameConfigWrapper)theGame.GetInGameConfigWrapper();
  3577. CTLchoice = StringToFloat(inGameConfigWrapper.GetVarValue('ModTorchLight', 'CTLchoice'));
  3578.  
  3579. CiriTorchToggleButton = ( !CiriTorchToggleButton );
  3580.  
  3581. if (CiriTorchToggleButton )
  3582. {
  3583. if ((thePlayer.GetCurrentMeleeWeaponType() == PW_Steel) && ( CTLchoice == 2))
  3584. {
  3585. thePlayer.OnEquipMeleeWeapon( PW_None, false );
  3586. thePlayer.AddTimer('CiriWisp', 2.1, false);
  3587. thePlayer.AddTimer('CiriWispFX', 2.5 , false);
  3588. theGame.GetGuiManager().ShowNotification(1.0);
  3589. }
  3590. else if ((thePlayer.GetCurrentMeleeWeaponType() == PW_None) && ( CTLchoice == 2))
  3591. {
  3592. thePlayer.AddTimer('CiriWisp', 0.1 , false);
  3593. thePlayer.AddTimer('CiriWispFX', 0.5 , false);
  3594. theGame.GetGuiManager().ShowNotification(0.0);
  3595. }
  3596. //if ((thePlayer.GetCurrentMeleeWeaponType() == PW_Steel) && ( CTLchoice > 2))
  3597. //{
  3598. //thePlayer.OnEquipMeleeWeapon( PW_None, false );
  3599.  
  3600. theGame.GetGuiManager().ShowNotification(2.0);
  3601. //}
  3602. TorchCiri.CiriTorchSelect ();
  3603. }
  3604.  
  3605. else
  3606. {
  3607. if ( CTLchoice == 2)
  3608. {
  3609. TorchCiri.WispTorchOff();
  3610. }
  3611.  
  3612. thePlayer.RemoveTimer('CiriWispFX');
  3613. thePlayer.RemoveTimer('CiriWisp');
  3614. TorchCiri.CiriTorchOff();
  3615. //thePlayer.RemoveTimer( 'DelayedSheathSword' );
  3616.  
  3617. }
  3618. }
  3619.  
  3620. }
  3621. // Torch for Ciri
  3622.  
  3623. }
  3624.  
Add Comment
Please, Sign In to add comment