lufusol

playerInput.ws for Realtime Gamepad Controls for Witcher 3 4.01

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