lufusol

playerInput.ws for Friendly Focus for Witcher 3 4.01

Feb 12th, 2023
411
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.     private var altSignCasting : bool;
  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.             // --modFriendlyFocus
  1659.             if ( theGame.GetInGameConfigWrapper().GetVarValue('FriendlyFocus', 'ffEnableHoldFocus') )
  1660.             {
  1661.             if( IsPressed( action ) )
  1662.             {
  1663.                
  1664.                 if( thePlayer.GoToCombatIfNeeded() )
  1665.                 {
  1666.                     OnCommGuard( action );
  1667.                     return false;
  1668.                 }
  1669.                 theGame.GetFocusModeController().Activate();
  1670.                
  1671.             }
  1672.             else if( IsReleased( action ) )
  1673.             {
  1674.                 theGame.GetFocusModeController().Deactivate();
  1675.             }
  1676.         }
  1677.         else
  1678.         {
  1679.                 if( IsPressed( action ) )
  1680.                 {
  1681.                     if( thePlayer.GoToCombatIfNeeded() )
  1682.                     {
  1683.                         OnCommGuard( action );
  1684.                         return false;
  1685.                     }
  1686.                     if( theGame.GetFocusModeController().IsActive() )
  1687.                     {
  1688.                         theGame.GetFocusModeController().Deactivate();
  1689.                     }
  1690.                     else
  1691.                     {
  1692.                         theGame.GetFocusModeController().Activate();
  1693.                     }
  1694.                 }
  1695.             }
  1696.             // modFriendlyFocus--
  1697.         }
  1698.         else
  1699.         {
  1700.             thePlayer.DisplayActionDisallowedHudMessage(EIAB_ExplorationFocus);
  1701.             theGame.GetFocusModeController().Deactivate(); 
  1702.         }
  1703.     }
  1704.    
  1705.    
  1706.    
  1707.    
  1708.    
  1709.     private function ShouldSwitchAttackType():bool
  1710.     {
  1711.         var outKeys : array<EInputKey>;
  1712.        
  1713.         if ( theInput.LastUsedPCInput() )
  1714.         {      
  1715.             theInput.GetPCKeysForAction('PCAlternate',outKeys);
  1716.             if ( outKeys.Size() > 0 )
  1717.             {
  1718.                 if ( theInput.IsActionPressed('PCAlternate') )
  1719.                 {
  1720.                     return true;
  1721.                 }
  1722.             }
  1723.         }
  1724.         return false;
  1725.     }
  1726.    
  1727.     event OnCbtAttackWithAlternateLight( action : SInputAction )
  1728.     {
  1729.         CbtAttackPC( action, false);
  1730.     }
  1731.    
  1732.     event OnCbtAttackWithAlternateHeavy( action : SInputAction )
  1733.     {
  1734.         CbtAttackPC( action, true);
  1735.     }
  1736.    
  1737.     function CbtAttackPC( action : SInputAction, isHeavy : bool )
  1738.     {
  1739.         var switchAttackType : bool;
  1740.        
  1741.         switchAttackType = ShouldSwitchAttackType();
  1742.        
  1743.         if ( !theInput.LastUsedPCInput() )
  1744.         {
  1745.             return;
  1746.         }
  1747.        
  1748.         if ( thePlayer.IsCiri() )
  1749.         {
  1750.             if ( switchAttackType != isHeavy)
  1751.             {
  1752.                 OnCbtCiriAttackHeavy(action);
  1753.             }
  1754.             else
  1755.             {
  1756.                 OnCbtAttackLight(action);
  1757.             }
  1758.         }
  1759.         else
  1760.         {
  1761.             if ( switchAttackType != isHeavy)
  1762.             {
  1763.                 OnCbtAttackHeavy(action);
  1764.             }
  1765.             else
  1766.             {
  1767.                 OnCbtAttackLight(action);
  1768.             }
  1769.         }
  1770.     }
  1771.    
  1772.     event OnCbtAttackLight( action : SInputAction )
  1773.     {
  1774.         var allowed, checkedFists           : bool;
  1775.        
  1776.         if( IsPressed(action) )
  1777.         {
  1778.            
  1779.             if(altSignCasting && !theInput.LastUsedPCInput() && theInput.IsActionPressed('CastSign') && !GetWitcherPlayer().IsCurrentSignChanneled())
  1780.             {
  1781.                 AltCastSign(ST_Axii);
  1782.                 return false;
  1783.             }
  1784.            
  1785.            
  1786.            
  1787.             if( IsActionAllowed(EIAB_LightAttacks)  )
  1788.             {
  1789.                 if (thePlayer.GetBIsInputAllowed())
  1790.                 {
  1791.                     allowed = false;                   
  1792.                    
  1793.                     if( thePlayer.GetCurrentMeleeWeaponType() == PW_Fists || thePlayer.GetCurrentMeleeWeaponType() == PW_None )
  1794.                     {
  1795.                         checkedFists = true;
  1796.                         if(IsActionAllowed(EIAB_Fists))
  1797.                             allowed = true;
  1798.                     }
  1799.                     else if(IsActionAllowed(EIAB_SwordAttack))
  1800.                     {
  1801.                         checkedFists = false;
  1802.                         allowed = true;
  1803.                     }
  1804.                    
  1805.                     if(allowed)
  1806.                     {
  1807.                         thePlayer.SetupCombatAction( EBAT_LightAttack, BS_Pressed );
  1808.                     }
  1809.                     else
  1810.                     {
  1811.                         if(checkedFists)
  1812.                             thePlayer.DisplayActionDisallowedHudMessage(EIAB_Fists);
  1813.                         else
  1814.                             thePlayer.DisplayActionDisallowedHudMessage(EIAB_SwordAttack);
  1815.                     }
  1816.                 }
  1817.             }
  1818.             else  if ( !IsActionBlockedBy(EIAB_LightAttacks,'interaction') )
  1819.             {
  1820.                 thePlayer.DisplayActionDisallowedHudMessage(EIAB_LightAttacks);
  1821.             }
  1822.         }
  1823.     }
  1824.    
  1825.     event OnCbtAttackHeavy( action : SInputAction )
  1826.     {
  1827.         var allowed, checkedSword : bool;
  1828.         var outKeys : array<EInputKey>;
  1829.        
  1830.         if ( thePlayer.GetBIsInputAllowed() )
  1831.         {
  1832.            
  1833.             if(altSignCasting && !theInput.LastUsedPCInput() && theInput.IsActionPressed('CastSign') && !GetWitcherPlayer().IsCurrentSignChanneled())
  1834.             {
  1835.                 if(IsPressed( action ))
  1836.                 {
  1837.                     AltCastSign(ST_Yrden);
  1838.                     return false;
  1839.                 }
  1840.                 else if (IsReleased( action ))
  1841.                 {
  1842.                     return false;
  1843.                 }
  1844.             }
  1845.            
  1846.        
  1847.             if( IsActionAllowed(EIAB_HeavyAttacks) )
  1848.             {
  1849.                 allowed = false;
  1850.                
  1851.                 if( thePlayer.GetCurrentMeleeWeaponType() == PW_Fists || thePlayer.GetCurrentMeleeWeaponType() == PW_None )
  1852.                 {
  1853.                     checkedSword = false;
  1854.                     if(IsActionAllowed(EIAB_Fists))
  1855.                         allowed = true;
  1856.                 }
  1857.                 else if(IsActionAllowed(EIAB_SwordAttack))
  1858.                 {
  1859.                     checkedSword = true;
  1860.                     allowed = true;
  1861.                 }
  1862.                
  1863.                 if(allowed)
  1864.                 {
  1865.                     if ( ( thePlayer.GetCurrentMeleeWeaponType() == PW_Fists || thePlayer.GetCurrentMeleeWeaponType() == PW_None ) && IsPressed(action)  )
  1866.                     {
  1867.                         thePlayer.SetupCombatAction( EBAT_HeavyAttack, BS_Released );              
  1868.                     }
  1869.                     else
  1870.                     {
  1871.                         if( IsReleased(action) && theInput.GetLastActivationTime( action.aName ) < 0.2 )
  1872.                         {
  1873.                             thePlayer.SetupCombatAction( EBAT_HeavyAttack, BS_Released );
  1874.                         }
  1875.                     }
  1876.                 }
  1877.                 else
  1878.                 {
  1879.                     if(checkedSword)
  1880.                         thePlayer.DisplayActionDisallowedHudMessage(EIAB_SwordAttack);
  1881.                     else                   
  1882.                         thePlayer.DisplayActionDisallowedHudMessage(EIAB_Fists);
  1883.                 }
  1884.             }
  1885.             else if ( !IsActionBlockedBy(EIAB_HeavyAttacks,'interaction') )
  1886.             {
  1887.                 thePlayer.DisplayActionDisallowedHudMessage(EIAB_HeavyAttacks);
  1888.             }
  1889.         }
  1890.     }
  1891.  
  1892.     private function CheckFinisherInput() : bool
  1893.     {
  1894.         var enemyInCone         : CActor;
  1895.         var npc                 : CNewNPC;
  1896.         var interactionTarget   : CInteractionComponent;
  1897.        
  1898.         var isDeadlySwordHeld   : bool;
  1899.    
  1900.         interactionTarget = theGame.GetInteractionsManager().GetActiveInteraction();
  1901.         if ( interactionTarget && interactionTarget.GetName() == "Finish" )
  1902.         {
  1903.             npc = (CNewNPC)( interactionTarget.GetEntity() );
  1904.            
  1905.             isDeadlySwordHeld = thePlayer.IsDeadlySwordHeld();
  1906.             if( ( theInput.GetActionValue( 'AttackHeavy' ) == 1.f || theInput.GetActionValue( 'AttackLight' ) == 1.f  )
  1907.                 && isDeadlySwordHeld )
  1908.             {
  1909.                 theGame.RemoveTimeScale( theGame.GetTimescaleSource(ETS_FinisherInput) );
  1910.                 npc.SignalGameplayEvent('Finisher');
  1911.                
  1912.             }
  1913.             else if ( !isDeadlySwordHeld )
  1914.             {
  1915.                 if ( thePlayer.IsWeaponHeld( 'fist' ))
  1916.                     thePlayer.SetBehaviorVariable( 'combatTauntType', 1.f );
  1917.                 else
  1918.                     thePlayer.SetBehaviorVariable( 'combatTauntType', 0.f );
  1919.                    
  1920.                 thePlayer.RaiseEvent( 'CombatTaunt' );
  1921.             }
  1922.            
  1923.             return true;
  1924.            
  1925.         }
  1926.         return false;
  1927.     }
  1928.    
  1929.     private function IsPlayerAbleToPerformSpecialAttack() : bool
  1930.     {
  1931.         if( ( thePlayer.GetCurrentStateName() == 'Exploration' ) && !( thePlayer.IsWeaponHeld( 'silversword' ) || thePlayer.IsWeaponHeld( 'steelsword' ) ) )
  1932.         {
  1933.             return false;
  1934.         }
  1935.         return true;
  1936.     }
  1937.    
  1938.     event OnCbtSpecialAttackWithAlternateLight( action : SInputAction )
  1939.     {
  1940.         CbSpecialAttackPC( action, false);
  1941.     }
  1942.    
  1943.     event OnCbtSpecialAttackWithAlternateHeavy( action : SInputAction )
  1944.     {
  1945.         CbSpecialAttackPC( action, true);
  1946.     }
  1947.    
  1948.     function CbSpecialAttackPC( action : SInputAction, isHeavy : bool )
  1949.     {
  1950.         var switchAttackType : bool;
  1951.        
  1952.         switchAttackType = ShouldSwitchAttackType();
  1953.        
  1954.         if ( !theInput.LastUsedPCInput() )
  1955.         {
  1956.             return;
  1957.         }
  1958.        
  1959.         if ( IsPressed(action) )
  1960.         {
  1961.             if ( thePlayer.IsCiri() )
  1962.             {
  1963.                
  1964.                 OnCbtCiriSpecialAttackHeavy(action);
  1965.             }
  1966.             else
  1967.             {
  1968.                 if (switchAttackType != isHeavy)
  1969.                 {
  1970.                     OnCbtSpecialAttackHeavy(action);
  1971.                 }
  1972.                 else
  1973.                 {
  1974.                     OnCbtSpecialAttackLight(action);
  1975.                 }
  1976.             }
  1977.         }
  1978.         else if ( IsReleased( action ) )
  1979.         {
  1980.             if ( thePlayer.IsCiri() )
  1981.             {
  1982.                 OnCbtCiriSpecialAttackHeavy(action);
  1983.             }
  1984.             else
  1985.             {
  1986.                
  1987.                 OnCbtSpecialAttackHeavy(action);
  1988.                 OnCbtSpecialAttackLight(action);
  1989.             }
  1990.         }
  1991.     }
  1992.    
  1993.     event OnCbtSpecialAttackLight( action : SInputAction )
  1994.     {
  1995.        
  1996.         if(!theInput.LastUsedPCInput() && IsPressed( action ) && theInput.GetActionValue( 'CastSign' ) > 0)
  1997.         {
  1998.             return false;
  1999.         }
  2000.        
  2001.    
  2002.         if ( IsReleased( action )  )
  2003.         {
  2004.             thePlayer.CancelHoldAttacks();
  2005.             return true;
  2006.         }
  2007.        
  2008.         if ( !IsPlayerAbleToPerformSpecialAttack() )
  2009.             return false;
  2010.        
  2011.         if( !IsActionAllowed(EIAB_LightAttacks) )
  2012.         {
  2013.             thePlayer.DisplayActionDisallowedHudMessage(EIAB_LightAttacks);
  2014.             return false;
  2015.         }
  2016.         if(!IsActionAllowed(EIAB_SpecialAttackLight) )
  2017.         {
  2018.             thePlayer.DisplayActionDisallowedHudMessage(EIAB_SpecialAttackLight);
  2019.             return false;
  2020.         }
  2021.        
  2022.         if( IsPressed(action) && thePlayer.CanUseSkill(S_Sword_s01) )  
  2023.         {          
  2024.             thePlayer.PrepareToAttack();
  2025.             thePlayer.SetPlayedSpecialAttackMissingResourceSound(false);
  2026.             thePlayer.AddTimer( 'IsSpecialLightAttackInputHeld', 0.00001, true );
  2027.         }
  2028.     }  
  2029.  
  2030.     event OnCbtSpecialAttackHeavy( action : SInputAction )
  2031.     {
  2032.        
  2033.         if(!theInput.LastUsedPCInput() && IsPressed( action ) && theInput.GetActionValue( 'CastSign' ) > 0)
  2034.         {
  2035.             return false;
  2036.         }
  2037.        
  2038.    
  2039.         if ( IsReleased( action )  )
  2040.         {
  2041.             thePlayer.CancelHoldAttacks();
  2042.             return true;
  2043.         }
  2044.        
  2045.         if ( !IsPlayerAbleToPerformSpecialAttack() || GetWitcherPlayer().IsInCombatAction_SpecialAttackHeavy() )
  2046.             return false;
  2047.        
  2048.         if( !IsActionAllowed(EIAB_HeavyAttacks))
  2049.         {
  2050.             thePlayer.DisplayActionDisallowedHudMessage(EIAB_HeavyAttacks);
  2051.             return false;
  2052.         }      
  2053.         if(!IsActionAllowed(EIAB_SpecialAttackHeavy))
  2054.         {
  2055.             thePlayer.DisplayActionDisallowedHudMessage(EIAB_SpecialAttackHeavy);
  2056.             return false;
  2057.         }
  2058.        
  2059.         if( IsPressed(action) && thePlayer.CanUseSkill(S_Sword_s02) )  
  2060.         {  
  2061.             thePlayer.PrepareToAttack();
  2062.             thePlayer.SetPlayedSpecialAttackMissingResourceSound(false);
  2063.             thePlayer.AddTimer( 'IsSpecialHeavyAttackInputHeld', 0.00001, true );
  2064.         }
  2065.         else if ( IsPressed(action) )
  2066.         {
  2067.             if ( theInput.IsActionPressed('AttackHeavy') )
  2068.                 theInput.ForceDeactivateAction('AttackHeavy');
  2069.             else if ( theInput.IsActionPressed('AttackWithAlternateHeavy') )
  2070.                 theInput.ForceDeactivateAction('AttackWithAlternateHeavy');
  2071.         }
  2072.     }
  2073.    
  2074.    
  2075.     event OnCbtCiriSpecialAttack( action : SInputAction )
  2076.     {
  2077.         if( !GetCiriPlayer().HasSword() )
  2078.             return false;
  2079.    
  2080.         if( thePlayer.GetBIsInputAllowed() && thePlayer.GetBIsCombatActionAllowed() && IsPressed(action) ) 
  2081.         {
  2082.             if ( thePlayer.HasAbility('CiriBlink') && ((W3ReplacerCiri)thePlayer).HasStaminaForSpecialAction(true) )
  2083.                 thePlayer.PrepareToAttack();
  2084.             thePlayer.PushCombatActionOnBuffer( EBAT_Ciri_SpecialAttack, BS_Pressed );
  2085.             thePlayer.ProcessCombatActionBuffer(); 
  2086.         }
  2087.         else if ( IsReleased( action ) && thePlayer.GetCombatAction() == EBAT_Ciri_SpecialAttack && thePlayer.GetBehaviorVariable( 'isPerformingSpecialAttack' ) != 0 )
  2088.         {
  2089.             thePlayer.PushCombatActionOnBuffer( EBAT_Ciri_SpecialAttack, BS_Released );
  2090.             thePlayer.ProcessCombatActionBuffer();     
  2091.         }
  2092.     }
  2093.    
  2094.    
  2095.     event OnCbtCiriAttackHeavy( action : SInputAction )
  2096.     {
  2097.         var specialAttackAction : SInputAction;
  2098.        
  2099.         if( !GetCiriPlayer().HasSword() )
  2100.             return false;
  2101.        
  2102.         specialAttackAction = theInput.GetAction('CiriSpecialAttackHeavy');
  2103.        
  2104.         if( thePlayer.GetBIsInputAllowed() && IsReleased(action) && thePlayer.GetBehaviorVariable( 'isPerformingSpecialAttack' ) == 0  )   
  2105.         {  
  2106.             if( IsActionAllowed(EIAB_HeavyAttacks) && IsActionAllowed(EIAB_SwordAttack) )
  2107.             {
  2108.                 if ( thePlayer.GetCurrentMeleeWeaponType() == PW_Steel )
  2109.                 {
  2110.                     thePlayer.PrepareToAttack();
  2111.                     thePlayer.SetupCombatAction( EBAT_HeavyAttack, BS_Released );
  2112.                     if ( thePlayer.GetBIsCombatActionAllowed() )
  2113.                         thePlayer.ProcessCombatActionBuffer();
  2114.                 }
  2115.             }
  2116.             else if ( !IsActionBlockedBy(EIAB_HeavyAttacks,'interaction') )
  2117.             {
  2118.                 thePlayer.DisplayActionDisallowedHudMessage(EIAB_LightAttacks);            
  2119.             }
  2120.         }
  2121.     }
  2122.    
  2123.    
  2124.     event OnCbtCiriSpecialAttackHeavy( action : SInputAction )
  2125.     {  
  2126.         if( !GetCiriPlayer().HasSword() )
  2127.             return false;
  2128.        
  2129.         if( thePlayer.GetBIsInputAllowed() && thePlayer.GetBIsCombatActionAllowed() && IsPressed(action) ) 
  2130.         {
  2131.             theInput.ForceDeactivateAction('AttackWithAlternateHeavy');
  2132.             thePlayer.PushCombatActionOnBuffer( EBAT_Ciri_SpecialAttack_Heavy, BS_Pressed );
  2133.             thePlayer.ProcessCombatActionBuffer();
  2134.         }
  2135.         else if ( IsReleased( action ) && thePlayer.GetCombatAction() == EBAT_Ciri_SpecialAttack_Heavy && thePlayer.GetBehaviorVariable( 'isPerformingSpecialAttack' ) != 0  )
  2136.         {
  2137.             theInput.ForceDeactivateAction('CiriAttackHeavy');
  2138.             theInput.ForceDeactivateAction('AttackWithAlternateHeavy');
  2139.             thePlayer.PushCombatActionOnBuffer( EBAT_Ciri_SpecialAttack_Heavy, BS_Released );
  2140.             thePlayer.ProcessCombatActionBuffer();     
  2141.         }
  2142.     }
  2143.    
  2144.     event OnCbtCiriDodge( action : SInputAction )
  2145.     {  
  2146.         if( IsActionAllowed(EIAB_Dodge) && IsPressed(action) && thePlayer.IsAlive() )  
  2147.         {
  2148.             if ( thePlayer.IsInCombatAction() && thePlayer.GetCombatAction() == EBAT_Ciri_SpecialAttack && thePlayer.GetBehaviorVariable( 'isCompletingSpecialAttack' ) <= 0 )
  2149.             {
  2150.                 thePlayer.PushCombatActionOnBuffer( EBAT_Ciri_Dodge, BS_Pressed );
  2151.                 thePlayer.ProcessCombatActionBuffer();         
  2152.             }
  2153.             else if ( thePlayer.GetBIsInputAllowed() )
  2154.             {
  2155.                 thePlayer.PushCombatActionOnBuffer( EBAT_Ciri_Dodge, BS_Pressed );
  2156.                 if ( thePlayer.GetBIsCombatActionAllowed() )
  2157.                     thePlayer.ProcessCombatActionBuffer();
  2158.             }
  2159.             else
  2160.             {
  2161.                 if ( thePlayer.IsInCombatAction() && thePlayer.GetBehaviorVariable( 'combatActionType' ) == (int)CAT_Attack )
  2162.                 {
  2163.                     if ( thePlayer.CanPlayHitAnim() && thePlayer.IsThreatened() )
  2164.                     {
  2165.                         thePlayer.CriticalEffectAnimationInterrupted("CiriDodge");
  2166.                         thePlayer.PushCombatActionOnBuffer( EBAT_Ciri_Dodge, BS_Pressed );
  2167.                         thePlayer.ProcessCombatActionBuffer();                         
  2168.                     }
  2169.                     else
  2170.                         thePlayer.PushCombatActionOnBuffer( EBAT_Ciri_Dodge, BS_Pressed );
  2171.                 }
  2172.             }
  2173.         }
  2174.         else if ( !IsActionAllowed(EIAB_Dodge) )
  2175.         {
  2176.             thePlayer.DisplayActionDisallowedHudMessage(EIAB_Dodge);
  2177.         }
  2178.     }
  2179.    
  2180.     event OnCbtCiriDash( action : SInputAction )
  2181.     {
  2182.         if ( theInput.LastUsedGamepad() && IsPressed( action ) )
  2183.         {
  2184.             thePlayer.StartDodgeTimer();
  2185.         }
  2186.         else if( IsActionAllowed(EIAB_Dodge) && thePlayer.IsAlive() )  
  2187.         {
  2188.             if ( theInput.LastUsedGamepad() )
  2189.             {
  2190.                 if ( !(thePlayer.IsDodgeTimerRunning() && !thePlayer.IsInsideInteraction() && IsReleased(action)) )
  2191.                     return false;
  2192.             }
  2193.            
  2194.             if ( thePlayer.IsInCombatAction() && thePlayer.GetCombatAction() == EBAT_Ciri_SpecialAttack && thePlayer.GetBehaviorVariable( 'isCompletingSpecialAttack' ) <= 0 )
  2195.             {
  2196.                 thePlayer.PushCombatActionOnBuffer( EBAT_Roll, BS_Released );
  2197.                 thePlayer.ProcessCombatActionBuffer();         
  2198.             }
  2199.             else if ( thePlayer.GetBIsInputAllowed() )
  2200.             {
  2201.                 thePlayer.PushCombatActionOnBuffer( EBAT_Roll, BS_Released );
  2202.                 if ( thePlayer.GetBIsCombatActionAllowed() )
  2203.                     thePlayer.ProcessCombatActionBuffer();
  2204.             }
  2205.             else
  2206.             {
  2207.                 if ( thePlayer.IsInCombatAction() && thePlayer.GetBehaviorVariable( 'combatActionType' ) == (int)CAT_Attack )
  2208.                 {
  2209.                     if ( thePlayer.CanPlayHitAnim() && thePlayer.IsThreatened() )
  2210.                     {
  2211.                         thePlayer.CriticalEffectAnimationInterrupted("CiriDodge");
  2212.                         thePlayer.PushCombatActionOnBuffer( EBAT_Roll, BS_Released );
  2213.                         thePlayer.ProcessCombatActionBuffer();                         
  2214.                     }
  2215.                     else
  2216.                         thePlayer.PushCombatActionOnBuffer( EBAT_Roll, BS_Released );
  2217.                 }
  2218.             }
  2219.         }
  2220.         else if ( !IsActionAllowed(EIAB_Dodge) )
  2221.         {
  2222.             thePlayer.DisplayActionDisallowedHudMessage(EIAB_Dodge);
  2223.         }
  2224.     }
  2225.    
  2226.     event OnCbtDodge( action : SInputAction )
  2227.     {      
  2228.         if ( IsPressed(action) )
  2229.         {
  2230.            
  2231.             if(altSignCasting && !theInput.LastUsedPCInput() && theInput.IsActionPressed('CastSign'))
  2232.             {
  2233.                
  2234.                
  2235.             }          
  2236.             else
  2237.            
  2238.             {
  2239.                 thePlayer.EvadePressed(EBAT_Dodge);
  2240.             }
  2241.         }
  2242.     }
  2243.    
  2244.     event OnCbtRoll( action : SInputAction )
  2245.     {      
  2246.         if ( theInput.LastUsedPCInput() )
  2247.         {
  2248.             if ( IsPressed( action ) )
  2249.             {
  2250.                 thePlayer.EvadePressed(EBAT_Roll);
  2251.             }
  2252.         }
  2253.         else
  2254.         {
  2255.             if ( IsPressed( action ) )
  2256.             {
  2257.                
  2258.                 if(altSignCasting && theInput.IsActionPressed('CastSign'))
  2259.                 {
  2260.                     return false;                  
  2261.                 }
  2262.                
  2263.                 else
  2264.                 {
  2265.                     thePlayer.StartDodgeTimer();
  2266.                 }
  2267.             }
  2268.             else if ( IsReleased( action ) )
  2269.             {
  2270.                 if ( thePlayer.IsDodgeTimerRunning() )
  2271.                 {
  2272.                     thePlayer.StopDodgeTimer();
  2273.                     if ( !thePlayer.IsInsideInteraction() )
  2274.                         thePlayer.EvadePressed(EBAT_Roll);
  2275.                 }
  2276.                
  2277.             }
  2278.         }
  2279.     }
  2280.    
  2281.    
  2282.     public function GetIsAltSignCasting() : bool
  2283.     {
  2284.         return altSignCasting;
  2285.     }
  2286.  
  2287.     public function GetIsAltSignCastingPressed() : bool
  2288.     {
  2289.         return altSignCasting  &&  theInput.IsActionPressed('CastSign');
  2290.     }
  2291.    
  2292.     public function SetIsAltSignCasting(enable : bool)
  2293.     {
  2294.         altSignCasting = enable;
  2295.     }
  2296.    
  2297.     private function AltCastSign(signType : ESignType)
  2298.     {
  2299.         var signSkill : ESkill;
  2300.        
  2301.         if( !thePlayer.GetBIsInputAllowed() )
  2302.         {  
  2303.             return;
  2304.         }
  2305.    
  2306.         if( !IsActionAllowed(EIAB_Signs) || GetWitcherPlayer().IsSignBlocked(signType) )
  2307.         {              
  2308.             thePlayer.DisplayActionDisallowedHudMessage(EIAB_Signs);
  2309.             return;
  2310.         }
  2311.         if ( thePlayer.IsHoldingItemInLHand() && thePlayer.IsUsableItemLBlocked() )
  2312.         {
  2313.             thePlayer.DisplayActionDisallowedHudMessage(EIAB_Undefined, false, false, true);
  2314.             return;
  2315.         }
  2316.  
  2317.         signSkill = SignEnumToSkillEnum(signType);
  2318.         if( signSkill != S_SUndefined )
  2319.         {
  2320.             if(!thePlayer.CanUseSkill(signSkill))
  2321.             {
  2322.                 thePlayer.DisplayActionDisallowedHudMessage(EIAB_Signs, false, false, true);
  2323.                 return;
  2324.             }
  2325.        
  2326.             if( thePlayer.HasStaminaToUseSkill( signSkill, false ) )
  2327.             {
  2328.                 GetWitcherPlayer().SetEquippedSign(signType);              
  2329.                 thePlayer.SetupCombatAction( EBAT_CastSign, BS_Pressed );
  2330.             }
  2331.             else
  2332.             {
  2333.                 thePlayer.SoundEvent("gui_no_stamina");
  2334.             }
  2335.         }
  2336.     }
  2337.    
  2338.    
  2339.     var lastMovementDoubleTapName : name;
  2340.    
  2341.     event OnMovementDoubleTap( action : SInputAction )
  2342.     {
  2343.         if ( IsPressed( action ) )
  2344.         {
  2345.             if ( !thePlayer.IsDodgeTimerRunning() || action.aName != lastMovementDoubleTapName )
  2346.             {
  2347.                 thePlayer.StartDodgeTimer();
  2348.                 lastMovementDoubleTapName = action.aName;
  2349.             }
  2350.             else
  2351.             {
  2352.                 thePlayer.StopDodgeTimer();
  2353.                
  2354.                 thePlayer.EvadePressed(EBAT_Dodge);
  2355.             }
  2356.            
  2357.         }
  2358.     }
  2359.    
  2360.     event OnCastSign( action : SInputAction )
  2361.     {
  2362.         var signSkill : ESkill;
  2363.  
  2364.         if( altSignCasting )
  2365.             thePlayer.ApplyCastSettings();
  2366.        
  2367.        
  2368.         if(altSignCasting && !theInput.LastUsedPCInput())
  2369.         {
  2370.             if(IsPressed( action ) && (theInput.GetActionValue( 'LockAndGuard' ) > 0) && !GetWitcherPlayer().IsCurrentSignChanneled())
  2371.             {
  2372.                 AltCastSign(ST_Igni);
  2373.             }
  2374.             else if(IsPressed( action ))
  2375.             {
  2376.                 thePlayer.BlockAction(EIAB_Interactions, 'NGE_CastSign_Block');
  2377.                 thePlayer.BlockAction(EIAB_InteractionAction, 'NGE_CastSign_Block');
  2378.                 thePlayer.BlockAction(EIAB_InteractionContainers, 'NGE_CastSign_Block');
  2379.             }
  2380.             else if(IsReleased( action ))
  2381.             {
  2382.                 thePlayer.UnblockAction(EIAB_Interactions, 'NGE_CastSign_Block');
  2383.                 thePlayer.UnblockAction(EIAB_InteractionAction, 'NGE_CastSign_Block');
  2384.                 thePlayer.UnblockAction(EIAB_InteractionContainers, 'NGE_CastSign_Block');
  2385.             }
  2386.            
  2387.             return false;
  2388.         }
  2389.        
  2390.        
  2391.         if( !thePlayer.GetBIsInputAllowed() )
  2392.         {  
  2393.             return false;
  2394.         }
  2395.        
  2396.         if( IsPressed(action) )
  2397.         {
  2398.             if( !IsActionAllowed(EIAB_Signs) )
  2399.             {              
  2400.                 thePlayer.DisplayActionDisallowedHudMessage(EIAB_Signs);
  2401.                 return false;
  2402.             }
  2403.  if ( thePlayer.IsHoldingItemInLHand() && thePlayer.IsUsableItemLBlocked() )
  2404.             {
  2405.                 thePlayer.DisplayActionDisallowedHudMessage(EIAB_Undefined, false, false, true);
  2406.                 return false;
  2407.             }
  2408.            
  2409.             signSkill = SignEnumToSkillEnum( thePlayer.GetEquippedSign() );
  2410.             if( signSkill != S_SUndefined )
  2411.             {
  2412.                 if(!thePlayer.CanUseSkill(signSkill))
  2413.                 {
  2414.                     thePlayer.DisplayActionDisallowedHudMessage(EIAB_Signs, false, false, true);
  2415.                     return false;
  2416.                 }
  2417.            
  2418.                 if( thePlayer.HasStaminaToUseSkill( signSkill, false ) )
  2419.                 {
  2420.                     if( GetInvalidUniqueId() != thePlayer.inv.GetItemFromSlot( 'l_weapon' ) && !thePlayer.IsUsableItemLBlocked())
  2421.                     {
  2422.  
  2423.                        
  2424.                        
  2425.                     }
  2426.                     thePlayer.SetupCombatAction( EBAT_CastSign, BS_Pressed );
  2427.                 }
  2428.                 else
  2429.                 {
  2430.                     thePlayer.SoundEvent("gui_no_stamina");
  2431.                 }
  2432.             }          
  2433.         }
  2434.     }
  2435.    
  2436.    
  2437.    
  2438.    
  2439.     event OnThrowBomb(action : SInputAction)
  2440.     {
  2441.         var selectedItemId : SItemUniqueId;
  2442.    
  2443.         selectedItemId = thePlayer.GetSelectedItemId();
  2444.         if(!thePlayer.inv.IsItemBomb(selectedItemId))
  2445.             return false;
  2446.        
  2447.         if( thePlayer.inv.SingletonItemGetAmmo(selectedItemId) == 0 )
  2448.         {
  2449.            
  2450.             if(IsPressed(action))
  2451.             {          
  2452.                 thePlayer.SoundEvent( "gui_ingame_low_stamina_warning" );
  2453.             }
  2454.            
  2455.             return false;
  2456.         }
  2457.        
  2458.         if ( IsReleased(action) )
  2459.         {
  2460.             if ( thePlayer.IsThrowHold() )
  2461.             {
  2462.                 if ( thePlayer.playerAiming.GetAimedTarget() )
  2463.                 {
  2464.                     if ( thePlayer.AllowAttack( thePlayer.playerAiming.GetAimedTarget(), EBAT_ItemUse ) )
  2465.                     {
  2466.                         thePlayer.PushCombatActionOnBuffer( EBAT_ItemUse, BS_Released );
  2467.                         thePlayer.ProcessCombatActionBuffer();
  2468.                     }
  2469.                     else
  2470.                         thePlayer.BombThrowAbort();
  2471.                 }
  2472.                 else
  2473.                 {
  2474.                     thePlayer.PushCombatActionOnBuffer( EBAT_ItemUse, BS_Released );
  2475.                     thePlayer.ProcessCombatActionBuffer();             
  2476.                 }
  2477.                
  2478.                 thePlayer.SetThrowHold( false );
  2479.    
  2480.                 return true;
  2481.        
  2482.             }
  2483.             else
  2484.             {
  2485.                 if(!IsActionAllowed(EIAB_ThrowBomb))
  2486.                 {
  2487.                     thePlayer.DisplayActionDisallowedHudMessage(EIAB_ThrowBomb);
  2488.                     return false;
  2489.                 }
  2490.                
  2491.                 if ( thePlayer.IsHoldingItemInLHand() && !thePlayer.IsUsableItemLBlocked() )
  2492.                 {
  2493.                     thePlayer.SetPlayerActionToRestore ( PATR_ThrowBomb );
  2494.                     thePlayer.OnUseSelectedItem( true );
  2495.                     return true;
  2496.                 }
  2497.                 if(thePlayer.CanSetupCombatAction_Throw() && theInput.GetLastActivationTime( action.aName ) < 0.3f )   
  2498.                 {
  2499.                    
  2500.                     thePlayer.SetupCombatAction( EBAT_ItemUse, BS_Pressed );
  2501.                     return true;
  2502.                 }      
  2503.            
  2504.                 thePlayer.SetupCombatAction( EBAT_ItemUse, BS_Released );
  2505.                 return true;
  2506.             }
  2507.         }
  2508.        
  2509.         return false;
  2510.     }
  2511.    
  2512.     event OnThrowBombHold(action : SInputAction)
  2513.     {
  2514.         var locks : array<SInputActionLock>;
  2515.         var ind : int;
  2516.  
  2517.         var selectedItemId : SItemUniqueId;
  2518.    
  2519.         selectedItemId = thePlayer.GetSelectedItemId();
  2520.         if(!thePlayer.inv.IsItemBomb(selectedItemId))
  2521.             return false;
  2522.        
  2523.         if( thePlayer.inv.SingletonItemGetAmmo(selectedItemId) == 0 )
  2524.         {
  2525.            
  2526.             if(IsPressed(action))
  2527.             {          
  2528.                 thePlayer.SoundEvent( "gui_ingame_low_stamina_warning" );
  2529.             }
  2530.            
  2531.             return false;
  2532.         }
  2533.            
  2534.         if( IsPressed(action) )
  2535.         {
  2536.             if(!IsActionAllowed(EIAB_ThrowBomb))
  2537.             {
  2538.                 thePlayer.DisplayActionDisallowedHudMessage(EIAB_ThrowBomb);
  2539.                 return false;
  2540.             }
  2541.             else if(GetWitcherPlayer().GetBombDelay(GetWitcherPlayer().GetItemSlot(selectedItemId)) > 0 )
  2542.             {
  2543.                
  2544.                 return false;
  2545.             }
  2546.             if ( thePlayer.IsHoldingItemInLHand() && !thePlayer.IsUsableItemLBlocked() )
  2547.             {
  2548.                 thePlayer.SetPlayerActionToRestore ( PATR_ThrowBomb );
  2549.                 thePlayer.OnUseSelectedItem( true );
  2550.                 return true;
  2551.             }
  2552.             if(thePlayer.CanSetupCombatAction_Throw() && theInput.GetLastActivationTime( action.aName ) < 0.3f )   
  2553.             {
  2554.                 if( thePlayer.GetBIsCombatActionAllowed() )
  2555.                 {
  2556.                     thePlayer.PushCombatActionOnBuffer( EBAT_ItemUse, BS_Pressed );
  2557.                     thePlayer.ProcessCombatActionBuffer();
  2558.                 }
  2559.             }      
  2560.        
  2561.            
  2562.            
  2563.             locks = GetActionLocks(EIAB_ThrowBomb);
  2564.             ind = FindActionLockIndex(EIAB_ThrowBomb, 'BombThrow');
  2565.             if(ind >= 0)
  2566.                 locks.Erase(ind);
  2567.            
  2568.             if(locks.Size() != 0)
  2569.                 return false;
  2570.            
  2571.             thePlayer.SetThrowHold( true );
  2572.             return true;
  2573.         }
  2574.  
  2575.         return false;
  2576.     }
  2577.    
  2578.     event OnThrowBombAbort(action : SInputAction)
  2579.     {      
  2580.         if( IsPressed(action) )
  2581.         {      
  2582.             thePlayer.BombThrowAbort();
  2583.         }
  2584.     }
  2585.    
  2586.    
  2587.    
  2588.    
  2589.    
  2590.     event OnCbtThrowItem( action : SInputAction )
  2591.     {          
  2592.         var isUsableItem, isCrossbow, isBomb, ret : bool;
  2593.         var itemId : SItemUniqueId;    
  2594.        
  2595.        
  2596.         if(thePlayer.IsInAir() || thePlayer.GetWeaponHolster().IsOnTheMiddleOfHolstering())
  2597.             return false;
  2598.            
  2599.         if( thePlayer.IsSwimming() && !thePlayer.OnCheckDiving() && thePlayer.GetCurrentStateName() != 'AimThrow' )
  2600.             return false;
  2601.                
  2602.         itemId = thePlayer.GetSelectedItemId();
  2603.        
  2604.         if(!thePlayer.inv.IsIdValid(itemId))
  2605.             return false;
  2606.        
  2607.         isCrossbow = thePlayer.inv.IsItemCrossbow(itemId);
  2608.         if(!isCrossbow)
  2609.         {
  2610.             isBomb = thePlayer.inv.IsItemBomb(itemId);
  2611.             if(!isBomb)
  2612.             {
  2613.                 isUsableItem = true;
  2614.             }
  2615.         }
  2616.        
  2617.        
  2618.        
  2619.        
  2620.         if( isCrossbow )
  2621.         {
  2622.             if ( IsActionAllowed(EIAB_Crossbow) )
  2623.             {
  2624.                 if( IsPressed(action))
  2625.                 {
  2626.                     if ( thePlayer.IsHoldingItemInLHand() && !thePlayer.IsUsableItemLBlocked() )
  2627.                     {
  2628.  
  2629.                        
  2630.                         thePlayer.SetPlayerActionToRestore ( PATR_Crossbow );
  2631.                         thePlayer.OnUseSelectedItem( true );
  2632.                         ret = true;                    
  2633.                     }
  2634.                     else if ( thePlayer.GetBIsInputAllowed() && !thePlayer.IsCurrentlyUsingItemL() )
  2635.                     {
  2636.                         thePlayer.SetIsAimingCrossbow( true );
  2637.                         thePlayer.SetupCombatAction( EBAT_ItemUse, BS_Pressed );
  2638.                        
  2639.                        
  2640.                         ret = true;
  2641.                     }
  2642.                 }
  2643.                 else
  2644.                 {
  2645.  
  2646.                     if ( thePlayer.GetIsAimingCrossbow() && !thePlayer.IsCurrentlyUsingItemL() )
  2647.                     {
  2648.                         thePlayer.SetupCombatAction( EBAT_ItemUse, BS_Released );
  2649.                        
  2650.                        
  2651.                         thePlayer.SetIsAimingCrossbow( false );
  2652.                         ret = true;
  2653.                     }
  2654.                 }
  2655.             }
  2656.             else
  2657.             {
  2658.                 if ( !thePlayer.IsInShallowWater() )
  2659.                     thePlayer.DisplayActionDisallowedHudMessage(EIAB_Crossbow);            
  2660.             }
  2661.            
  2662.             if ( IsPressed(action) )
  2663.                 thePlayer.AddTimer( 'IsItemUseInputHeld', 0.00001, true );
  2664.             else
  2665.                 thePlayer.RemoveTimer('IsItemUseInputHeld');
  2666.                
  2667.             return ret;
  2668.         }
  2669.         else if(isBomb)
  2670.         {
  2671.             return OnThrowBomb(action);
  2672.         }
  2673.         else if(isUsableItem && !thePlayer.IsSwimming() )
  2674.         {
  2675.             if( IsActionAllowed(EIAB_UsableItem) )
  2676.             {
  2677.                 if(IsPressed(action) && thePlayer.HasStaminaToUseAction(ESAT_UsableItem))
  2678.                 {
  2679.                     thePlayer.SetPlayerActionToRestore ( PATR_Default );
  2680.                     thePlayer.OnUseSelectedItem();
  2681.                     return true;
  2682.                 }
  2683.  
  2684.             }
  2685.             else
  2686.             {
  2687.                 thePlayer.DisplayActionDisallowedHudMessage(EIAB_UsableItem);
  2688.             }
  2689.         }
  2690.        
  2691.         return false;
  2692.     }
  2693.    
  2694.     event OnCbtThrowItemHold( action : SInputAction )
  2695.     {
  2696.         var isBomb, isCrossbow, isUsableItem : bool;
  2697.         var itemId : SItemUniqueId;
  2698.        
  2699.        
  2700.         if(thePlayer.IsInAir() || thePlayer.GetWeaponHolster().IsOnTheMiddleOfHolstering() )
  2701.             return false;
  2702.            
  2703.         if( thePlayer.IsSwimming() && !thePlayer.OnCheckDiving() && thePlayer.GetCurrentStateName() != 'AimThrow' )
  2704.             return false;          
  2705.                
  2706.         itemId = thePlayer.GetSelectedItemId();
  2707.        
  2708.         if(!thePlayer.inv.IsIdValid(itemId))
  2709.             return false;
  2710.        
  2711.         isCrossbow = thePlayer.inv.IsItemCrossbow(itemId);
  2712.         if(!isCrossbow)
  2713.         {
  2714.             isBomb = thePlayer.inv.IsItemBomb(itemId);
  2715.             if(isBomb)
  2716.             {
  2717.                 return OnThrowBombHold(action);
  2718.             }
  2719.             else
  2720.             {
  2721.                 isUsableItem = true;
  2722.             }
  2723.         }
  2724.        
  2725.        
  2726.         if(IsPressed(action))
  2727.         {
  2728.             if( isCrossbow && !IsActionAllowed(EIAB_Crossbow) )
  2729.             {
  2730.                 thePlayer.DisplayActionDisallowedHudMessage(EIAB_Crossbow);
  2731.                 return false;
  2732.             }
  2733.            
  2734.             if( isUsableItem)
  2735.             {
  2736.                 if(!IsActionAllowed(EIAB_UsableItem))
  2737.                 {
  2738.                     thePlayer.DisplayActionDisallowedHudMessage(EIAB_UsableItem);
  2739.                     return false;
  2740.                 }
  2741.                 else if(thePlayer.IsSwimming())
  2742.                 {
  2743.                     thePlayer.DisplayActionDisallowedHudMessage(EIAB_Undefined, false, false, true);
  2744.                     return false;
  2745.                 }
  2746.             }
  2747.         }
  2748.    
  2749.         if( IsPressed(action) )
  2750.         {
  2751.             thePlayer.SetThrowHold( true );
  2752.             return true;
  2753.         }
  2754.         else if( IsReleased(action) && thePlayer.IsThrowHold())
  2755.         {
  2756.            
  2757.            
  2758.             thePlayer.SetupCombatAction( EBAT_ItemUse, BS_Released );
  2759.             thePlayer.SetThrowHold( false );
  2760.             return true;
  2761.         }
  2762.        
  2763.         return false;
  2764.     }
  2765.    
  2766.     event OnCbtThrowCastAbort( action : SInputAction )
  2767.     {
  2768.         var player : W3PlayerWitcher;
  2769.         var throwStage : EThrowStage;
  2770.        
  2771.         if(thePlayer.inv.IsItemBomb(thePlayer.GetSelectedItemId()))
  2772.         {
  2773.             return OnThrowBombAbort(action);                           
  2774.         }
  2775.        
  2776.         if( IsPressed(action) )
  2777.         {
  2778.             player = GetWitcherPlayer();
  2779.             if(player)
  2780.             {
  2781.                 if( player.IsCastingSign() )
  2782.                 {
  2783.                     player.CastSignAbort();
  2784.                 }
  2785.                 else
  2786.                 {
  2787.                     if ( thePlayer.inv.IsItemCrossbow( thePlayer.inv.GetItemFromSlot( 'l_weapon' ) ) )
  2788.                     {
  2789.                         thePlayer.OnRangedForceHolster();
  2790.                     }
  2791.                     else
  2792.                     {
  2793.                         throwStage = (int)thePlayer.GetBehaviorVariable( 'throwStage', (int)TS_Stop);
  2794.                        
  2795.                         if(throwStage == TS_Start || throwStage == TS_Loop)
  2796.                             player.ThrowingAbort();
  2797.                     }
  2798.                 }
  2799.             }
  2800.         }
  2801.     }
  2802.    
  2803.     event OnCbtSelectLockTarget( inputVector : Vector )
  2804.     {
  2805.         var newLockTarget   : CActor;
  2806.         var inputHeading    : float;
  2807.         var target          : CActor;
  2808.        
  2809.         inputVector.Y = inputVector.Y  * -1.f;
  2810.         inputHeading =  VecHeading( inputVector );
  2811.        
  2812.         newLockTarget = thePlayer.GetScreenSpaceLockTarget( thePlayer.GetDisplayTarget(), 180.f, 1.f, inputHeading );
  2813.  
  2814.         if ( newLockTarget )
  2815.             thePlayer.ProcessLockTarget( newLockTarget );
  2816.        
  2817.         target = thePlayer.GetTarget();
  2818.         if ( target )
  2819.         {
  2820.             thePlayer.SetSlideTarget( target );
  2821.            
  2822.         }
  2823.     }
  2824.  
  2825.     event OnCbtLockAndGuard( action : SInputAction )
  2826.     {
  2827.         if(thePlayer.IsCiri() && !GetCiriPlayer().HasSword())
  2828.             return false;
  2829.        
  2830.        
  2831.         if( IsReleased(action) )
  2832.         {
  2833.            
  2834.             if(altSignCasting && !theInput.LastUsedPCInput() && theInput.IsActionPressed('CastSign') && GetWitcherPlayer().IsCurrentSignChanneled())
  2835.             {              
  2836.                 thePlayer.AbortSign();
  2837.             }
  2838.            
  2839.        
  2840.             thePlayer.SetGuarded(false);
  2841.             thePlayer.OnGuardedReleased(); 
  2842.         }
  2843.        
  2844.         if( (thePlayer.IsWeaponHeld('fists') || thePlayer.GetCurrentStateName() == 'CombatFists') && !IsActionAllowed(EIAB_Fists))
  2845.         {
  2846.             thePlayer.DisplayActionDisallowedHudMessage(EIAB_Fists);
  2847.             return false;
  2848.         }
  2849.        
  2850.         if( IsPressed(action) )
  2851.         {
  2852.            
  2853.             if(altSignCasting && !theInput.LastUsedPCInput() && theInput.IsActionPressed('CastSign') && !GetWitcherPlayer().IsCurrentSignChanneled())
  2854.             {
  2855.                 AltCastSign(ST_Igni);
  2856.                 return false;
  2857.             }
  2858.            
  2859.        
  2860.        
  2861.             if( !IsActionAllowed(EIAB_Parry) )
  2862.             {
  2863.                 if ( IsActionBlockedBy(EIAB_Parry,'UsableItem') )
  2864.                 {
  2865.                     thePlayer.DisplayActionDisallowedHudMessage(EIAB_Parry);
  2866.                 }
  2867.                 return true;
  2868.             }
  2869.                
  2870.             if ( thePlayer.GetCurrentStateName() == 'Exploration' )
  2871.                 thePlayer.GoToCombatIfNeeded();
  2872.                
  2873.             if ( thePlayer.bLAxisReleased )
  2874.                 thePlayer.ResetRawPlayerHeading();
  2875.            
  2876.             if ( thePlayer.rangedWeapon && thePlayer.rangedWeapon.GetCurrentStateName() != 'State_WeaponWait' )
  2877.                 thePlayer.OnRangedForceHolster( true, true );
  2878.            
  2879.             thePlayer.AddCounterTimeStamp(theGame.GetEngineTime());
  2880.             thePlayer.SetGuarded(true);            
  2881.             thePlayer.OnPerformGuard();
  2882.         }  
  2883.     }      
  2884.    
  2885.     event OnCbtCameraLockOrSpawnHorse( action : SInputAction )
  2886.     {
  2887.         if ( OnCbtCameraLock(action) )
  2888.             return true;
  2889.            
  2890.         if ( OnCommSpawnHorse(action) )
  2891.             return true;
  2892.            
  2893.         return false;
  2894.     }
  2895.    
  2896.     event OnCbtCameraLock( action : SInputAction )
  2897.     {  
  2898.         if( IsPressed(action) )
  2899.         {
  2900.             if ( thePlayer.IsThreatened() || thePlayer.IsActorLockedToTarget() )
  2901.             {
  2902.                 if( !IsActionAllowed(EIAB_CameraLock))
  2903.                 {
  2904.                     return false;
  2905.                 }
  2906.                 else if ( !thePlayer.IsHardLockEnabled() && thePlayer.GetDisplayTarget() && (CActor)( thePlayer.GetDisplayTarget() ) && IsActionAllowed(EIAB_HardLock))
  2907.                 {  
  2908.                     if ( thePlayer.bLAxisReleased )
  2909.                         thePlayer.ResetRawPlayerHeading();
  2910.                    
  2911.                     thePlayer.HardLockToTarget( true );
  2912.                 }
  2913.                 else
  2914.                 {
  2915.                     thePlayer.HardLockToTarget( false );
  2916.                 }  
  2917.                 return true;
  2918.             }
  2919.         }
  2920.         return false;
  2921.     }
  2922.    
  2923.     event OnChangeCameraPreset( action : SInputAction )
  2924.     {
  2925.         if( IsPressed(action) )
  2926.         {
  2927.             ((CCustomCamera)theCamera.GetTopmostCameraObject()).NextPreset();
  2928.         }
  2929.     }
  2930.    
  2931.     event OnChangeCameraPresetByMouseWheel( action : SInputAction )
  2932.     {
  2933.         var tolerance : float;
  2934.         tolerance = 10.0f;
  2935.        
  2936.         if( ( action.value * totalCameraPresetChange ) < 0.0f )
  2937.         {
  2938.             totalCameraPresetChange = 0.0f;
  2939.         }
  2940.        
  2941.         totalCameraPresetChange += action.value;
  2942.         if( totalCameraPresetChange < -tolerance )
  2943.         {
  2944.             ((CCustomCamera)theCamera.GetTopmostCameraObject()).PrevPreset();
  2945.             totalCameraPresetChange = 0.0f;
  2946.         }
  2947.         else if( totalCameraPresetChange > tolerance )
  2948.         {
  2949.             ((CCustomCamera)theCamera.GetTopmostCameraObject()).NextPreset();
  2950.             totalCameraPresetChange = 0.0f;
  2951.         }
  2952.     }
  2953.    
  2954.     event OnMeditationAbort(action : SInputAction)
  2955.     {
  2956.         var med : W3PlayerWitcherStateMeditation;
  2957.        
  2958.         if (!theGame.GetGuiManager().IsAnyMenu())
  2959.         {
  2960.             med = (W3PlayerWitcherStateMeditation)GetWitcherPlayer().GetCurrentState();
  2961.             if(med)
  2962.             {
  2963.                
  2964.                
  2965.                 med.StopRequested(false);
  2966.             }
  2967.         }
  2968.     }
  2969.    
  2970.     public final function ClearLocksForNGP()
  2971.     {
  2972.         var i : int;
  2973.        
  2974.         for(i=actionLocks.Size()-1; i>=0; i-=1)
  2975.         {          
  2976.             OnActionLockChanged(i, false);
  2977.             actionLocks[i].Clear();
  2978.         }      
  2979.     }
  2980.    
  2981.    
  2982.    
  2983.    
  2984.    
  2985.     public function Dbg_UnlockAllActions()
  2986.     {
  2987.         var i : int;
  2988.        
  2989.         if( theGame.IsFinalBuild() )
  2990.         {
  2991.             return;
  2992.         }
  2993.            
  2994.         for(i=actionLocks.Size()-1; i>=0; i-=1)
  2995.         {          
  2996.             OnActionLockChanged(i, false);
  2997.         }
  2998.         actionLocks.Clear();
  2999.     }
  3000.    
  3001.     event OnDbgSpeedUp( action : SInputAction )
  3002.     {
  3003.         if( theGame.IsFinalBuild() )
  3004.         {
  3005.             return false;
  3006.         }
  3007.        
  3008.         if(IsPressed(action))
  3009.         {
  3010.             theGame.SetTimeScale(4, theGame.GetTimescaleSource(ETS_DebugInput), theGame.GetTimescalePriority(ETS_DebugInput));
  3011.         }
  3012.         else if(IsReleased(action))
  3013.         {
  3014.             theGame.RemoveTimeScale( theGame.GetTimescaleSource(ETS_DebugInput) );
  3015.         }
  3016.     }
  3017.    
  3018.     event OnDbgHit( action : SInputAction )
  3019.     {
  3020.         if( theGame.IsFinalBuild() )
  3021.         {
  3022.             return false;
  3023.         }
  3024.        
  3025.         if(IsReleased(action))
  3026.         {
  3027.             thePlayer.SetBehaviorVariable( 'HitReactionDirection',(int)EHRD_Back);
  3028.             thePlayer.SetBehaviorVariable( 'isAttackReflected', 0 );
  3029.             thePlayer.SetBehaviorVariable( 'HitReactionType', (int)EHRT_Heavy);
  3030.             thePlayer.SetBehaviorVariable( 'HitReactionWeapon', 0);
  3031.             thePlayer.SetBehaviorVariable( 'HitSwingDirection',(int)ASD_LeftRight);
  3032.             thePlayer.SetBehaviorVariable( 'HitSwingType',(int)AST_Horizontal);
  3033.            
  3034.             thePlayer.RaiseForceEvent( 'Hit' );
  3035.             thePlayer.OnRangedForceHolster( true );
  3036.             GetWitcherPlayer().SetCustomRotation( 'Hit', thePlayer.GetHeading()+180, 1080.f, 0.1f, false );
  3037.             thePlayer.CriticalEffectAnimationInterrupted("OnDbgHit");
  3038.         }
  3039.     }
  3040.    
  3041.     event OnDbgKillTarget( action : SInputAction )
  3042.     {
  3043.         var target : CActor;
  3044.        
  3045.         if( theGame.IsFinalBuild() )
  3046.         {
  3047.             return false;
  3048.         }
  3049.        
  3050.         target = thePlayer.GetTarget();
  3051.        
  3052.         if( target && IsReleased(action) )
  3053.         {
  3054.             target.Kill( 'Debug' );
  3055.         }
  3056.     }
  3057.    
  3058.     event OnDbgKillAll( action : SInputAction )
  3059.     {
  3060.         if( theGame.IsFinalBuild() )
  3061.         {
  3062.             return false;
  3063.         }
  3064.        
  3065.         if(IsReleased(action))
  3066.             thePlayer.DebugKillAll();
  3067.     }
  3068.    
  3069.    
  3070.     event OnDbgKillAllTargetingPlayer( action : SInputAction )
  3071.     {
  3072.         var i : int;
  3073.         var all : array<CActor>;
  3074.    
  3075.         if( theGame.IsFinalBuild() )
  3076.         {
  3077.             return false;
  3078.         }
  3079.        
  3080.         if(IsPressed(action))
  3081.         {
  3082.             all = GetActorsInRange(thePlayer, 10000, 10000, '', true);
  3083.             for(i=0; i<all.Size(); i+=1)
  3084.             {
  3085.                 if(all[i] != thePlayer && all[i].GetTarget() == thePlayer)
  3086.                     all[i].Kill( 'Debug' );
  3087.             }
  3088.         }
  3089.     }
  3090.    
  3091.     event OnDbgTeleportToPin( action : SInputAction )
  3092.     {
  3093.         if( theGame.IsFinalBuild() )
  3094.         {
  3095.             return false;
  3096.         }
  3097.        
  3098.         if(IsReleased(action))
  3099.             thePlayer.DebugTeleportToPin();
  3100.     }
  3101.    
  3102.    
  3103.    
  3104.     event OnBoatDismount( action : SInputAction )
  3105.     {
  3106.         var boatComp : CBoatComponent;
  3107.         var stopAction : SInputAction;
  3108.  
  3109.         stopAction = theInput.GetAction('GI_Decelerate');
  3110.        
  3111.         if( IsReleased(action) && ( theInput.LastUsedPCInput() || ( stopAction.value < 0.7 && stopAction.lastFrameValue < 0.7 ) ) )
  3112.         {
  3113.             if( thePlayer.IsActionAllowed( EIAB_DismountVehicle ) )
  3114.             {  
  3115.                 boatComp = (CBoatComponent)thePlayer.GetUsedVehicle().GetComponentByClassName( 'CBoatComponent' );
  3116.                 boatComp.IssueCommandToDismount( DT_normal );
  3117.             }
  3118.             else
  3119.             {
  3120.                 thePlayer.DisplayActionDisallowedHudMessage(EIAB_DismountVehicle);
  3121.             }
  3122.         }
  3123.     }
  3124.    
  3125.    
  3126.    
  3127.    
  3128.    
  3129.     event OnCiriDrawWeapon( action : SInputAction )
  3130.     {
  3131.         var duringCastSign : bool;
  3132.    
  3133.        
  3134.         if ( IsReleased(action) || ( IsPressed(action) && (thePlayer.GetCurrentMeleeWeaponType() == PW_None || thePlayer.GetCurrentMeleeWeaponType() == PW_Fists) ) )
  3135.         {
  3136.             if ( thePlayer.GetBIsInputAllowed() && thePlayer.GetBIsCombatActionAllowed()  )
  3137.             {
  3138.                 if (thePlayer.GetCurrentMeleeWeaponType() == PW_Steel && !thePlayer.IsThreatened() )
  3139.                     thePlayer.OnEquipMeleeWeapon( PW_None, false );
  3140.                 else
  3141.                     thePlayer.OnEquipMeleeWeapon( PW_Steel, false );
  3142.             }
  3143.         }
  3144.         else if(IsReleased(action) || ( IsPressed(action) && (thePlayer.GetCurrentMeleeWeaponType() == PW_Steel || thePlayer.GetCurrentMeleeWeaponType() == PW_Silver) ) )
  3145.         {
  3146.             CiriSheatheWeapon();
  3147.         }
  3148.     }
  3149.    
  3150.     event OnCiriHolsterWeapon( action : SInputAction )
  3151.     {
  3152.         var currWeaponType : EPlayerWeapon;
  3153.        
  3154.         if(IsPressed( action ))
  3155.         {
  3156.             currWeaponType = thePlayer.GetCurrentMeleeWeaponType();
  3157.            
  3158.             if(currWeaponType == PW_Steel || currWeaponType == PW_Silver)
  3159.             {
  3160.                 CiriSheatheWeapon();               
  3161.             }          
  3162.         }
  3163.     }
  3164.    
  3165.     private final function CiriSheatheWeapon()
  3166.     {
  3167.         if ( thePlayer.GetBIsInputAllowed() && thePlayer.GetBIsCombatActionAllowed() && !thePlayer.IsThreatened() )
  3168.         {
  3169.             thePlayer.OnEquipMeleeWeapon( PW_None, false );
  3170.         }
  3171.     }
  3172.    
  3173.    
  3174.    
  3175.    
  3176.     event OnCommHoldFastMenu( action : SInputAction )
  3177.     {
  3178.         if(IsPressed(action))
  3179.         {
  3180.             holdFastMenuInvoked = true;    
  3181.             PushInventoryScreen();
  3182.         }
  3183.     }
  3184.    
  3185.     event OnFastMenu( action : SInputAction )
  3186.     {      
  3187.         if( IsReleased(action) )
  3188.         {
  3189.             if(holdFastMenuInvoked)
  3190.             {
  3191.                 holdFastMenuInvoked = false;
  3192.                 return false;
  3193.             }
  3194.            
  3195.             if ( theGame.IsBlackscreenOrFading() )
  3196.             {
  3197.                 return false;
  3198.             }
  3199.            
  3200.             if (theGame.GetGuiManager().IsAnyMenu())
  3201.             {
  3202.                 return false;
  3203.             }
  3204.            
  3205.             if( IsActionAllowed( EIAB_OpenFastMenu ) )
  3206.             {
  3207.                 theGame.SetMenuToOpen( '' );
  3208.                 theGame.RequestMenu('CommonMenu' );
  3209.             }
  3210.             else
  3211.             {
  3212.                 thePlayer.DisplayActionDisallowedHudMessage(EIAB_OpenFastMenu);
  3213.             }
  3214.         }
  3215.     }
  3216.  
  3217.     event OnIngameMenu( action : SInputAction )
  3218.     {
  3219.         var openedPanel : name;
  3220.         openedPanel = theGame.GetMenuToOpen();
  3221.        
  3222.         if( IsReleased(action)
  3223.             && openedPanel != 'GlossaryTutorialsMenu'
  3224.             && !theGame.GetGuiManager().IsAnyMenu()
  3225.             && !theGame.IsBlackscreenOrFading()
  3226.             && FactsQuerySum("nge_pause_menu_disabled") <= 0 )
  3227.         {
  3228.             theGame.SetMenuToOpen( '' );
  3229.             theGame.RequestMenu('CommonIngameMenu' );
  3230.         }
  3231.     }
  3232.    
  3233.     event OnToggleHud( action : SInputAction )
  3234.     {
  3235.         var hud : CR4ScriptedHud;
  3236.         if ( IsReleased(action) )
  3237.         {
  3238.             hud = (CR4ScriptedHud)theGame.GetHud();
  3239.             if ( hud )
  3240.             {
  3241.                 hud.ToggleHudByUser();
  3242.             }
  3243.         }
  3244.     }
  3245.    
  3246.     public final function Debug_ClearAllActionLocks(optional action : EInputActionBlock, optional all : bool)
  3247.     {
  3248.         var i : int;
  3249.        
  3250.         if(all)
  3251.         {
  3252.             Dbg_UnlockAllActions();        
  3253.         }
  3254.         else
  3255.         {
  3256.             OnActionLockChanged(action, false);
  3257.             actionLocks[action].Clear();
  3258.         }
  3259.     }
  3260. }
  3261.  
Add Comment
Please, Sign In to add comment