Advertisement
Guest User

Untitled

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