Advertisement
Guest User

Untitled

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