Guest User

Untitled

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