Guest User

Untitled

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