Guest User

playerInput

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