ObviousDan

Untitled

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