lufusol

playerInput.ws for Turn On The Lights for Witcher 3 4.01

Feb 12th, 2023
213
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.         // modTurnOnTheLights ++
  633.         LogChannel( 'modTurnOnTheLights', "OnCommWalkToggle" );
  634.         if( !theInput.LastUsedGamepad() && IsReleased(action) )
  635.         {
  636.             LogChannel( 'modTurnOnTheLights', "OnCommWalkToggle: IsReleased" );
  637.             ((W3PlayerWitcher)thePlayer).turnOnTheLights.ProcessInput();
  638.         }
  639.         // modTurnOnTheLights --
  640.        
  641.         horse = thePlayer.GetHorseCurrentlyMounted();
  642.         if(horse)
  643.         {
  644.             horseWalkState = horse.GetHorseComponent().GetHorseWalkState();
  645.             if( IsPressed(action) )
  646.             {
  647.                 holdTimer = theGame.GetEngineTimeAsSeconds();
  648.             }
  649.             else if( IsReleased(action) )
  650.             {
  651.                 if(theGame.GetEngineTimeAsSeconds() - holdTimer > 0.2)
  652.                 {
  653.                     horse.GetHorseComponent().SetHorseWalkState(0);
  654.                 }
  655.                 else
  656.                 {  
  657.                     if(horseWalkState == 0)
  658.                         horse.GetHorseComponent().SetHorseWalkState(1);
  659.                     else if(horseWalkState == 1)
  660.                         horse.GetHorseComponent().SetHorseWalkState(2);
  661.                     else
  662.                         horse.GetHorseComponent().SetHorseWalkState(0);
  663.                 }
  664.             }          
  665.             return false;
  666.         }
  667.        
  668.    
  669.         if( IsPressed(action) && !thePlayer.GetIsSprinting() && !thePlayer.modifyPlayerSpeed )
  670.         {
  671.             if ( thePlayer.GetIsWalkToggled() )
  672.                 thePlayer.SetWalkToggle( false );
  673.             else
  674.                 thePlayer.SetWalkToggle( true );
  675.         }
  676.     }  
  677.    
  678.        
  679.     event OnCommGuard( action : SInputAction )
  680.     {
  681.         if(thePlayer.IsCiri() && !GetCiriPlayer().HasSword())
  682.             return false;
  683.            
  684.         if ( !thePlayer.IsInsideInteraction() )
  685.         {      
  686.             if (  IsActionAllowed(EIAB_Parry) )
  687.             {
  688.                 if( IsReleased(action) && thePlayer.GetCurrentStateName() == 'CombatFists' )
  689.                     thePlayer.OnGuardedReleased(); 
  690.                
  691.                 if( IsPressed(action) )
  692.                 {
  693.                     thePlayer.AddCounterTimeStamp(theGame.GetEngineTime());
  694.                     thePlayer.SetGuarded(true);
  695.                     thePlayer.OnPerformGuard();
  696.                 }
  697.                 else if( IsReleased(action) )
  698.                 {
  699.                     thePlayer.SetGuarded(false);
  700.                 }  
  701.             }
  702.             else
  703.             {
  704.                 thePlayer.DisplayActionDisallowedHudMessage(EIAB_Parry);               
  705.             }
  706.         }
  707.     }  
  708.    
  709.    
  710.    
  711.    
  712.    
  713.     private var pressTimestamp : float;
  714.     private const var DOUBLE_TAP_WINDOW : float;
  715.     default DOUBLE_TAP_WINDOW = 0.4;
  716.    
  717.     event OnCommSpawnHorse( action : SInputAction )
  718.     {
  719.         var isSpawnHorseSecondTap : bool;
  720.         isSpawnHorseSecondTap = false;
  721.        
  722.         if( IsPressed( action ) )
  723.             return false;
  724.        
  725.         isSpawnHorseSecondTap = pressTimestamp + DOUBLE_TAP_WINDOW >= theGame.GetEngineTimeAsSeconds();
  726.  
  727.         if( IsActionAllowed( EIAB_CallHorse )
  728.             && !thePlayer.IsInInterior() && !thePlayer.IsInAir()
  729.             && (isSpawnHorseSecondTap || theInput.LastUsedPCInput()) )
  730.         {
  731.             if ( thePlayer.IsHoldingItemInLHand () )
  732.             {
  733.                 thePlayer.OnUseSelectedItem(true);
  734.                 thePlayer.SetPlayerActionToRestore ( PATR_CallHorse );
  735.             }
  736.             else
  737.             {
  738.                 theGame.OnSpawnPlayerHorse();
  739.             }          
  740.         }
  741.         else if( isSpawnHorseSecondTap || theInput.LastUsedPCInput() )
  742.         {
  743.             if( thePlayer.IsInInterior() )
  744.                 thePlayer.DisplayActionDisallowedHudMessage( EIAB_Undefined, false, true );
  745.             else
  746.                 thePlayer.DisplayActionDisallowedHudMessage( EIAB_CallHorse );
  747.         }
  748.            
  749.         pressTimestamp = theGame.GetEngineTimeAsSeconds();
  750.            
  751.         return true;
  752.     }
  753.    
  754.    
  755.    
  756.    
  757.    
  758.    
  759.     event OnCommMenuHub( action : SInputAction )
  760.     {
  761.         if(IsReleased(action))
  762.         {
  763.             PushMenuHub();
  764.         }
  765.     }
  766.    
  767.     final function PushMenuHub()
  768.     {
  769.         if ( theGame.IsBlackscreenOrFading() )
  770.         {
  771.             return;
  772.         }
  773.         theGame.RequestMenu('CommonMenu');
  774.     }
  775.    
  776.    
  777.    
  778.     event OnCommPanelChar( action : SInputAction )
  779.     {
  780.         if(IsReleased(action))
  781.         {
  782.             PushCharacterScreen();
  783.         }
  784.     }
  785.     final function PushCharacterScreen()
  786.     {
  787.         if ( theGame.IsBlackscreenOrFading() )
  788.         {
  789.             return;
  790.         }
  791.        
  792.         if( IsActionAllowed(EIAB_OpenCharacterPanel) )
  793.         {
  794.             theGame.RequestMenuWithBackground( 'CharacterMenu', 'CommonMenu' );
  795.         }
  796.         else
  797.         {
  798.             thePlayer.DisplayActionDisallowedHudMessage(EIAB_OpenCharacterPanel);
  799.         }
  800.     }
  801.  
  802.    
  803.     event OnCommPanelInv( action : SInputAction )
  804.     {      
  805.         if (IsReleased(action))
  806.         {
  807.             PushInventoryScreen();
  808.         }
  809.     }
  810.    
  811.     final function PushInventoryScreen()
  812.     {
  813.         if ( theGame.IsBlackscreenOrFading() )
  814.         {
  815.             return;
  816.         }
  817.         if( IsActionAllowed(EIAB_OpenInventory) )      
  818.         {
  819.             theGame.RequestMenuWithBackground( 'InventoryMenu', 'CommonMenu' );
  820.         }
  821.         else
  822.         {
  823.             thePlayer.DisplayActionDisallowedHudMessage(EIAB_OpenInventory);
  824.         }
  825.     }
  826.    
  827.    
  828.     event OnCommDeckEditor( action : SInputAction )
  829.     {
  830.         if( IsReleased(action) )
  831.         {
  832.             if ( theGame.IsBlackscreenOrFading() )
  833.             {
  834.                 return false;
  835.             }
  836.             if (theGame.GetGwintManager().GetHasDoneTutorial() || theGame.GetGwintManager().HasLootedCard())
  837.             {
  838.                 if( IsActionAllowed(EIAB_OpenGwint) )      
  839.                 {
  840.                     theGame.RequestMenu( 'DeckBuilder' );
  841.                 }
  842.                 else
  843.                 {
  844.                     thePlayer.DisplayActionDisallowedHudMessage(EIAB_OpenGwint);
  845.                 }
  846.             }
  847.         }
  848.     }
  849.    
  850.    
  851.     event OnCommPanelMed( action : SInputAction )
  852.     {
  853.         if( IsReleased(action) )
  854.         {
  855.             if( IsActionAllowed(EIAB_MeditationWaiting) )
  856.             {
  857.                 GetWitcherPlayer().Meditate();
  858.             }
  859.             else
  860.             {
  861.                 thePlayer.DisplayActionDisallowedHudMessage(EIAB_MeditationWaiting);
  862.             }
  863.         }
  864.     }  
  865.    
  866.     event OnCommPanelMapPC( action : SInputAction )
  867.     {
  868.         if( IsReleased(action) )
  869.         {
  870.             PushMapScreen();
  871.         }
  872.     }
  873.    
  874.     event OnCommPanelMap( action : SInputAction )
  875.     {
  876.         if( IsPressed(action) )
  877.         {
  878.             PushMapScreen();
  879.         }
  880.     }  
  881.     final function PushMapScreen()
  882.     {
  883.         if ( theGame.IsBlackscreenOrFading() )
  884.         {
  885.             return;
  886.         }
  887.         if( IsActionAllowed(EIAB_OpenMap) )
  888.         {
  889.             theGame.RequestMenuWithBackground( 'MapMenu', 'CommonMenu' );
  890.         }
  891.         else
  892.         {
  893.             thePlayer.DisplayActionDisallowedHudMessage(EIAB_OpenMap);
  894.         }
  895.     }
  896.  
  897.    
  898.     event OnCommPanelJour( action : SInputAction )
  899.     {
  900.         if( IsReleased(action) )
  901.         {
  902.             PushJournalScreen();
  903.         }
  904.     }
  905.     final function PushJournalScreen()
  906.     {
  907.         if ( theGame.IsBlackscreenOrFading() )
  908.         {
  909.             return;
  910.         }
  911.         if( IsActionAllowed(EIAB_OpenJournal) )
  912.         {
  913.            
  914.             theGame.RequestMenuWithBackground( 'JournalQuestMenu', 'CommonMenu' );
  915.         }
  916.         else
  917.         {
  918.             thePlayer.DisplayActionDisallowedHudMessage(EIAB_OpenJournal);
  919.         }  
  920.     }
  921.    
  922.     event OnCommPanelMeditation( action : SInputAction )
  923.     {
  924.         if( IsReleased(action) )
  925.         {
  926.             PushMeditationScreen();
  927.         }
  928.     }
  929.    
  930.     final function PushMeditationScreen()
  931.     {
  932.         if ( theGame.IsBlackscreenOrFading() )
  933.         {
  934.             return;
  935.         }
  936.         if( IsActionAllowed(EIAB_OpenMeditation) )
  937.         {
  938.             theGame.RequestMenuWithBackground( 'MeditationClockMenu', 'CommonMenu' );
  939.         }
  940.         else
  941.         {
  942.             thePlayer.DisplayActionDisallowedHudMessage(EIAB_OpenMeditation);
  943.         }  
  944.     }
  945.    
  946.     event OnCommPanelCrafting( action : SInputAction )
  947.     {
  948.         if( IsReleased(action) )
  949.         {
  950.             PushCraftingScreen();
  951.         }
  952.     }
  953.    
  954.     final function PushCraftingScreen()
  955.     {
  956.         if ( theGame.IsBlackscreenOrFading() )
  957.         {
  958.             return;
  959.         }
  960.        
  961.         theGame.RequestMenuWithBackground( 'CraftingMenu', 'CommonMenu' );
  962.     }
  963.    
  964.    
  965.     event OnCommPanelBestiary( action : SInputAction )
  966.     {
  967.         if( IsReleased(action) )
  968.         {
  969.             PushBestiaryScreen();
  970.         }
  971.     }
  972.    
  973.     final function PushBestiaryScreen()
  974.     {
  975.         if ( theGame.IsBlackscreenOrFading() )
  976.         {
  977.             return;
  978.         }
  979.         if( IsActionAllowed(EIAB_OpenGlossary) )
  980.         {
  981.             theGame.RequestMenuWithBackground( 'GlossaryBestiaryMenu', 'CommonMenu' );
  982.         }
  983.         else
  984.         {
  985.             thePlayer.DisplayActionDisallowedHudMessage(EIAB_OpenGlossary);
  986.         }
  987.     }
  988.    
  989.     event OnCommPanelAlch( action : SInputAction )
  990.     {
  991.         if( IsReleased(action) )
  992.         {
  993.             PushAlchemyScreen();
  994.         }
  995.     }
  996.     final function PushAlchemyScreen()
  997.     {
  998.         if ( theGame.IsBlackscreenOrFading() )
  999.         {
  1000.             return;
  1001.         }
  1002.         if( IsActionAllowed(EIAB_OpenAlchemy) )
  1003.         {
  1004.             theGame.RequestMenuWithBackground( 'AlchemyMenu', 'CommonMenu' );
  1005.         }
  1006.         else
  1007.         {
  1008.             thePlayer.DisplayActionDisallowedHudMessage(EIAB_OpenAlchemy);
  1009.         }
  1010.     }
  1011.    
  1012.     event OnCommPanelGlossary( action : SInputAction )
  1013.     {
  1014.         if( IsReleased(action) )
  1015.         {
  1016.             PushGlossaryScreen();
  1017.         }
  1018.     }
  1019.     final function PushGlossaryScreen()
  1020.     {
  1021.         if ( theGame.IsBlackscreenOrFading() )
  1022.         {
  1023.             return;
  1024.         }
  1025.         if( IsActionAllowed(EIAB_OpenGlossary) )
  1026.         {
  1027.             theGame.RequestMenuWithBackground( 'GlossaryEncyclopediaMenu', 'CommonMenu' );
  1028.         }
  1029.         else
  1030.         {
  1031.             thePlayer.DisplayActionDisallowedHudMessage(EIAB_OpenGlossary);
  1032.         }
  1033.     }
  1034.    
  1035.     event OnShowControlsHelp( action : SInputAction )
  1036.     {
  1037.         if( IsReleased(action) )
  1038.         {
  1039.             if ( theGame.IsBlackscreenOrFading() )
  1040.             {
  1041.                 return false;
  1042.             }
  1043.            
  1044.            
  1045.         }
  1046.     }
  1047.    
  1048.     event OnCommPanelUIResize( action : SInputAction )
  1049.     {
  1050.         if( IsReleased(action) )
  1051.         {
  1052.             if ( theGame.IsBlackscreenOrFading() )
  1053.             {
  1054.                 return false;
  1055.             }
  1056.             theGame.RequestMenu( 'RescaleMenu' );
  1057.         }
  1058.     }  
  1059.  
  1060.     event OnCommPanelFakeHud( action : SInputAction )
  1061.     {
  1062.         if( IsReleased(action) )
  1063.         {
  1064.             if ( theGame.IsBlackscreenOrFading() )
  1065.             {
  1066.                 return false;
  1067.             }
  1068.            
  1069.         }
  1070.     }
  1071.    
  1072.    
  1073.    
  1074.    
  1075.     private var processedSwordHold : bool;
  1076.    
  1077.     event OnCommSteelSword( action : SInputAction )
  1078.     {
  1079.         var duringCastSign : bool;
  1080.        
  1081.         if(IsPressed(action))
  1082.             processedSwordHold = false;
  1083.        
  1084.         if ( theInput.LastUsedGamepad() && theInput.IsActionPressed('Alternate') )
  1085.         {
  1086.             return false;
  1087.         }
  1088.        
  1089.         if ( IsReleased(action) || ( IsPressed(action) && (thePlayer.GetCurrentMeleeWeaponType() == PW_None || thePlayer.GetCurrentMeleeWeaponType() == PW_Fists) ) )
  1090.         {
  1091.             if( !processedSwordHold )
  1092.             {
  1093.                 if ( IsActionAllowed(EIAB_DrawWeapon) && thePlayer.GetBIsInputAllowed() && thePlayer.GetWeaponHolster().IsMeleeWeaponReady() )
  1094.                 {
  1095.                     thePlayer.PushCombatActionOnBuffer( EBAT_Draw_Steel, BS_Pressed );
  1096.                     if ( thePlayer.GetBIsCombatActionAllowed() )
  1097.                         thePlayer.ProcessCombatActionBuffer();
  1098.                 }
  1099.                 processedSwordHold = true;
  1100.             }
  1101.         }
  1102.     }
  1103.    
  1104.     event OnCommSilverSword( action : SInputAction )
  1105.     {
  1106.         var duringCastSign : bool;
  1107.        
  1108.         if( IsPressed(action) )
  1109.             processedSwordHold = false;
  1110.        
  1111.         if ( theInput.LastUsedGamepad() && theInput.IsActionPressed('Alternate') )
  1112.         {
  1113.             return false;
  1114.         }
  1115.        
  1116.         if ( IsReleased(action) || ( IsPressed(action) && (thePlayer.GetCurrentMeleeWeaponType() == PW_None || thePlayer.GetCurrentMeleeWeaponType() == PW_Fists) ) )
  1117.         {
  1118.             if( !processedSwordHold )
  1119.             {
  1120.                 if ( IsActionAllowed(EIAB_DrawWeapon) && thePlayer.GetBIsInputAllowed() && thePlayer.GetWeaponHolster().IsMeleeWeaponReady() )
  1121.                 {
  1122.                     thePlayer.PushCombatActionOnBuffer( EBAT_Draw_Silver, BS_Pressed );
  1123.                     if ( thePlayer.GetBIsCombatActionAllowed() || duringCastSign )
  1124.                         thePlayer.ProcessCombatActionBuffer();
  1125.                 }
  1126.                 processedSwordHold = true;
  1127.             }
  1128.            
  1129.         }
  1130.     }  
  1131.    
  1132.     event OnCommSheatheAny( action : SInputAction )
  1133.     {
  1134.         var duringCastSign : bool;
  1135.        
  1136.         if( IsPressed( action ) )
  1137.         {
  1138.             if ( thePlayer.GetBIsInputAllowed() && thePlayer.GetWeaponHolster().IsMeleeWeaponReady() )
  1139.             {
  1140.                 thePlayer.PushCombatActionOnBuffer( EBAT_Sheathe_Sword, BS_Pressed );
  1141.                 if ( thePlayer.GetBIsCombatActionAllowed() || duringCastSign )
  1142.                 {
  1143.                     thePlayer.ProcessCombatActionBuffer();
  1144.                 }
  1145.             }
  1146.             processedSwordHold = true;
  1147.         }      
  1148.     }
  1149.    
  1150.     event OnCommSheatheSteel( action : SInputAction )
  1151.     {
  1152.         if( IsPressed( action ) && thePlayer.IsWeaponHeld( 'steelsword' ) && !processedSwordHold)
  1153.         {
  1154.             OnCommSheatheAny(action);
  1155.         }
  1156.     }
  1157.    
  1158.     event OnCommSheatheSilver( action : SInputAction )
  1159.     {
  1160.         if( IsPressed( action ) && thePlayer.IsWeaponHeld( 'silversword' ) && !processedSwordHold)
  1161.         {
  1162.             OnCommSheatheAny(action);
  1163.         }
  1164.     }
  1165.        
  1166.     event OnCommDrinkPot( action : SInputAction )
  1167.     {
  1168.         if(IsPressed(action))
  1169.         {
  1170.             if(!potPress)
  1171.             {
  1172.                 potPress = true;
  1173.                 potAction = action;
  1174.                 thePlayer.AddTimer('PotDrinkTimer', 0.3);
  1175.             }
  1176.             else
  1177.             {
  1178.                 PotDrinkTimer(true);
  1179.                 thePlayer.RemoveTimer('PotDrinkTimer');
  1180.             }
  1181.         }
  1182.     }
  1183.    
  1184.     public function PotDrinkTimer(isDoubleTapped : bool)
  1185.     {
  1186.         thePlayer.RemoveTimer('PotDrinkTimer');
  1187.         potPress = false;
  1188.        
  1189.         if(isDoubleTapped)
  1190.             OnCommDrinkPotion2(potAction);
  1191.         else
  1192.             OnCommDrinkPotion1(potAction);
  1193.     }
  1194.    
  1195.    
  1196.    
  1197.    
  1198.     event OnCbtComboDigitLeft( action : SInputAction )
  1199.     {
  1200.         if ( theInput.IsActionPressed('Alternate') )
  1201.         {
  1202.             OnTogglePreviousSign(action);
  1203.         }
  1204.     }
  1205.    
  1206.     event OnCbtComboDigitRight( action : SInputAction )
  1207.     {
  1208.         if ( theInput.IsActionPressed('Alternate') )
  1209.         {
  1210.             OnToggleNextSign(action);
  1211.         }
  1212.     }
  1213.    
  1214.    
  1215.     event OnSelectSign(action : SInputAction)
  1216.     {
  1217.         if( IsPressed( action ) )
  1218.         {
  1219.            
  1220.             if(altSignCasting)
  1221.             {
  1222.                 switch( action.aName )
  1223.                 {              
  1224.                     case 'SelectAard' :
  1225.                         AltCastSign(ST_Aard);
  1226.                         break;
  1227.                     case 'SelectYrden' :
  1228.                         AltCastSign(ST_Yrden);
  1229.                         break;
  1230.                     case 'SelectIgni' :
  1231.                         AltCastSign(ST_Igni);
  1232.                         break;
  1233.                     case 'SelectQuen' :
  1234.                         AltCastSign(ST_Quen);
  1235.                         break;
  1236.                     case 'SelectAxii' :
  1237.                         AltCastSign(ST_Axii);
  1238.                         break;
  1239.                     default :
  1240.                         break;
  1241.                 }
  1242.             }
  1243.            
  1244.             else
  1245.             {
  1246.                 switch( action.aName )
  1247.                 {
  1248.                     case 'SelectAard' :
  1249.                         GetWitcherPlayer().SetEquippedSign(ST_Aard);
  1250.                         break;
  1251.                     case 'SelectYrden' :
  1252.                         GetWitcherPlayer().SetEquippedSign(ST_Yrden);
  1253.                         break;
  1254.                     case 'SelectIgni' :
  1255.                         GetWitcherPlayer().SetEquippedSign(ST_Igni);
  1256.                         break;
  1257.                     case 'SelectQuen' :
  1258.                         GetWitcherPlayer().SetEquippedSign(ST_Quen);
  1259.                         break;
  1260.                     case 'SelectAxii' :
  1261.                         GetWitcherPlayer().SetEquippedSign(ST_Axii);
  1262.                         break;
  1263.                     default :
  1264.                         break;
  1265.                 }
  1266.             }
  1267.         }
  1268.        
  1269.         else if (IsReleased( action ) && altSignCasting && GetWitcherPlayer().IsCurrentSignChanneled())
  1270.         {
  1271.             thePlayer.AbortSign();
  1272.         }
  1273.        
  1274.     }
  1275.    
  1276.     event OnToggleSigns( action : SInputAction )
  1277.     {
  1278.         var tolerance : float;
  1279.         tolerance = 2.5f;
  1280.        
  1281.         if( action.value < -tolerance )
  1282.         {
  1283.             GetWitcherPlayer().TogglePreviousSign();
  1284.         }
  1285.         else if( action.value > tolerance )
  1286.         {
  1287.             GetWitcherPlayer().ToggleNextSign();
  1288.         }
  1289.     }
  1290.     event OnToggleNextSign( action : SInputAction )
  1291.     {
  1292.         if( IsPressed( action ) )
  1293.         {
  1294.             GetWitcherPlayer().ToggleNextSign();
  1295.         }
  1296.     }
  1297.     event OnTogglePreviousSign( action : SInputAction )
  1298.     {
  1299.         if( IsPressed( action ) )
  1300.         {
  1301.             GetWitcherPlayer().TogglePreviousSign();
  1302.         }
  1303.     }
  1304.    
  1305.     event OnToggleItem( action : SInputAction )
  1306.     {
  1307.         if( !IsActionAllowed( EIAB_QuickSlots ) )
  1308.         {
  1309.             thePlayer.DisplayActionDisallowedHudMessage(EIAB_QuickSlots);
  1310.             return false;
  1311.         }
  1312.        
  1313.         if( IsReleased( action ) )
  1314.         {  
  1315.             if( theInput.GetLastActivationTime( action.aName ) < 0.3 )
  1316.                 GetWitcherPlayer().ToggleNextItem();
  1317.         }
  1318.     }
  1319.    
  1320.    
  1321.    
  1322.    
  1323.    
  1324.     event OnCommDrinkpotionUpperHeld( action : SInputAction )
  1325.     {
  1326.         if(!potionModeHold)
  1327.             return false;
  1328.            
  1329.        
  1330.         if(thePlayer.IsCiri())
  1331.             return false;
  1332.            
  1333.         if(IsReleased(action))
  1334.             return false;
  1335.        
  1336.         potionUpperHeld = true;
  1337.         GetWitcherPlayer().FlipSelectedPotion(true);
  1338.     }
  1339.    
  1340.     event OnCommDrinkpotionLowerHeld( action : SInputAction )
  1341.     {
  1342.         if(!potionModeHold)
  1343.             return false;
  1344.            
  1345.        
  1346.         if(thePlayer.IsCiri())
  1347.             return false;
  1348.            
  1349.         if(IsReleased(action))
  1350.             return false;
  1351.        
  1352.         potionLowerHeld = true;
  1353.         GetWitcherPlayer().FlipSelectedPotion(false);
  1354.     }
  1355.    
  1356.     public final function SetPotionSelectionMode(b : bool)
  1357.     {
  1358.         potionModeHold = b;
  1359.     }
  1360.    
  1361.     private final function DrinkPotion(action : SInputAction, upperSlot : bool) : bool
  1362.     {
  1363.         var witcher : W3PlayerWitcher;
  1364.        
  1365.         if ( potionModeHold && IsReleased(action) )
  1366.         {
  1367.             if(!potionUpperHeld && !potionLowerHeld)
  1368.             {
  1369.                 GetWitcherPlayer().OnPotionDrinkInput(upperSlot);
  1370.             }
  1371.            
  1372.             if(upperSlot)
  1373.                 potionUpperHeld = false;
  1374.             else
  1375.                 potionLowerHeld = false;
  1376.         }      
  1377.         else if(!potionModeHold && IsPressed(action))
  1378.         {
  1379.             witcher = GetWitcherPlayer();
  1380.             if(!witcher.IsPotionDoubleTapRunning())
  1381.             {
  1382.                 witcher.SetPotionDoubleTapRunning(true, upperSlot);
  1383.                 return true;
  1384.             }
  1385.             else
  1386.             {
  1387.                 witcher.SetPotionDoubleTapRunning(false);
  1388.                 witcher.FlipSelectedPotion(upperSlot);             
  1389.                 return true;
  1390.             }
  1391.         }
  1392.        
  1393.         return false;
  1394.     }  
  1395.    
  1396.    
  1397.     event OnCommDrinkPotion1( action : SInputAction )
  1398.     {
  1399.        
  1400.         if(thePlayer.IsCiri())
  1401.             return false;
  1402.        
  1403.         if( !IsActionAllowed( EIAB_QuickSlots ) )
  1404.         {
  1405.             thePlayer.DisplayActionDisallowedHudMessage(EIAB_QuickSlots);
  1406.             return false;
  1407.         }
  1408.        
  1409.         if ( theInput.LastUsedGamepad() )
  1410.         {
  1411.             return DrinkPotion(action, true);
  1412.         }
  1413.         else
  1414.         if ( IsReleased(action) )
  1415.         {
  1416.             GetWitcherPlayer().OnPotionDrinkKeyboardsInput(EES_Potion1);
  1417.             return true;
  1418.         }
  1419.        
  1420.         return false;
  1421.     }
  1422.    
  1423.    
  1424.     event OnCommDrinkPotion2( action : SInputAction )
  1425.     {
  1426.         var witcher : W3PlayerWitcher;
  1427.        
  1428.        
  1429.         if(thePlayer.IsCiri())
  1430.             return false;
  1431.        
  1432.         if( !IsActionAllowed( EIAB_QuickSlots ) )
  1433.         {
  1434.             thePlayer.DisplayActionDisallowedHudMessage(EIAB_QuickSlots);
  1435.             return false;
  1436.         }
  1437.        
  1438.         if ( theInput.LastUsedGamepad() )
  1439.         {
  1440.             return DrinkPotion(action, false);
  1441.         }
  1442.         else
  1443.         if ( IsReleased(action) )
  1444.         {
  1445.             GetWitcherPlayer().OnPotionDrinkKeyboardsInput(EES_Potion2);
  1446.             return true;
  1447.         }
  1448.        
  1449.         return false;
  1450.     }
  1451.    
  1452.    
  1453.     event OnCommDrinkPotion3( action : SInputAction )
  1454.     {
  1455.        
  1456.         if(thePlayer.IsCiri())
  1457.             return false;
  1458.        
  1459.         if( !IsActionAllowed( EIAB_QuickSlots ) )
  1460.         {
  1461.             thePlayer.DisplayActionDisallowedHudMessage(EIAB_QuickSlots);
  1462.             return false;
  1463.         }
  1464.        
  1465.         if ( IsReleased(action) )
  1466.         {
  1467.             GetWitcherPlayer().OnPotionDrinkKeyboardsInput(EES_Potion3);
  1468.             return true;
  1469.         }
  1470.        
  1471.         return false;
  1472.     }
  1473.    
  1474.    
  1475.     event OnCommDrinkPotion4( action : SInputAction )
  1476.     {
  1477.         var witcher : W3PlayerWitcher;
  1478.        
  1479.        
  1480.         if(thePlayer.IsCiri())
  1481.             return false;
  1482.        
  1483.         if( !IsActionAllowed( EIAB_QuickSlots ) )
  1484.         {
  1485.             thePlayer.DisplayActionDisallowedHudMessage(EIAB_QuickSlots);
  1486.             return false;
  1487.         }
  1488.        
  1489.         if ( IsReleased(action) )
  1490.         {
  1491.             GetWitcherPlayer().OnPotionDrinkKeyboardsInput(EES_Potion4);
  1492.             return true;
  1493.         }
  1494.        
  1495.         return false;
  1496.     }
  1497.    
  1498.    
  1499.    
  1500.    
  1501.    
  1502.     event OnDiving( action : SInputAction )
  1503.     {
  1504.         if ( IsPressed(action) && IsActionAllowed(EIAB_Dive) )
  1505.         {
  1506.             if ( action.aName == 'DiveDown' )
  1507.             {
  1508.                 if ( thePlayer.OnAllowedDiveDown() )
  1509.                 {
  1510.                     if ( !thePlayer.OnCheckDiving() )
  1511.                         thePlayer.OnDive();
  1512.                    
  1513.                     if ( thePlayer.bLAxisReleased )
  1514.                         thePlayer.SetBehaviorVariable( 'divePitch',-1.0);
  1515.                     else
  1516.                         thePlayer.SetBehaviorVariable( 'divePitch', -0.9);
  1517.                     thePlayer.OnDiveInput(-1.f);
  1518.                    
  1519.                     if ( thePlayer.rangedWeapon.GetCurrentStateName() != 'State_WeaponWait' )
  1520.                     {
  1521.                         thePlayer.OnRangedForceHolster( true, false );
  1522.                         thePlayer.OnFullyBlendedIdle();
  1523.                     }
  1524.                 }          
  1525.             }
  1526.             else if ( action.aName == 'DiveUp' )
  1527.             {
  1528.                 if ( thePlayer.bLAxisReleased )
  1529.                     thePlayer.SetBehaviorVariable( 'divePitch',1.0);
  1530.                 else
  1531.                     thePlayer.SetBehaviorVariable( 'divePitch', 0.9);
  1532.                    
  1533.                 if ( thePlayer.rangedWeapon.GetCurrentStateName() != 'State_WeaponWait' )
  1534.                 {
  1535.                     thePlayer.OnRangedForceHolster( true, false );
  1536.                     thePlayer.OnFullyBlendedIdle();
  1537.                 }
  1538.                    
  1539.                 thePlayer.OnDiveInput(1.f);
  1540.             }
  1541.         }
  1542.         else if ( IsReleased(action) )
  1543.         {
  1544.             thePlayer.SetBehaviorVariable( 'divePitch',0.0);
  1545.             thePlayer.OnDiveInput(0.f);
  1546.         }
  1547.         else if ( IsPressed(action) && !IsActionAllowed(EIAB_Dive) )
  1548.         {
  1549.             thePlayer.DisplayActionDisallowedHudMessage(EIAB_Dive);
  1550.         }
  1551.     }
  1552.    
  1553.     event OnDivingDodge( action : SInputAction )
  1554.     {
  1555.         var isDodgeAllowed : bool;
  1556.        
  1557.         if( IsPressed(action) )
  1558.         {
  1559.             isDodgeAllowed = IsActionAllowed(EIAB_Dodge);
  1560.             if( isDodgeAllowed && IsActionAllowed(EIAB_Dive) )
  1561.             {
  1562.                 if ( thePlayer.OnCheckDiving() && thePlayer.GetBIsInputAllowed() )
  1563.                 {
  1564.                     thePlayer.PushCombatActionOnBuffer( EBAT_Dodge, BS_Pressed );
  1565.                     if ( thePlayer.GetBIsCombatActionAllowed() )
  1566.                         thePlayer.ProcessCombatActionBuffer();
  1567.                 }
  1568.             }
  1569.             else
  1570.             {
  1571.                 if(!isDodgeAllowed)
  1572.                     thePlayer.DisplayActionDisallowedHudMessage(EIAB_Dodge);
  1573.                 else
  1574.                     thePlayer.DisplayActionDisallowedHudMessage(EIAB_Dive);
  1575.             }
  1576.         }
  1577.     }
  1578.    
  1579.    
  1580.    
  1581.    
  1582.    
  1583.     event OnExpFistFightLight( action : SInputAction )
  1584.     {
  1585.         var fistsAllowed : bool;
  1586.        
  1587.         if( IsPressed(action) )
  1588.         {
  1589.             fistsAllowed = IsActionAllowed(EIAB_Fists);
  1590.             if( fistsAllowed && IsActionAllowed(EIAB_LightAttacks) )
  1591.             {
  1592.                
  1593.                 thePlayer.SetupCombatAction( EBAT_LightAttack, BS_Pressed );
  1594.             }
  1595.             else
  1596.             {
  1597.                 if(!fistsAllowed)
  1598.                     thePlayer.DisplayActionDisallowedHudMessage(EIAB_Fists);
  1599.                 else
  1600.                     thePlayer.DisplayActionDisallowedHudMessage(EIAB_LightAttacks);
  1601.             }
  1602.         }
  1603.     }
  1604.    
  1605.     event OnExpFistFightHeavy( action : SInputAction )
  1606.     {
  1607.         var fistsAllowed : bool;
  1608.        
  1609.         if( IsPressed(action) )
  1610.         {
  1611.             fistsAllowed = IsActionAllowed(EIAB_Fists);
  1612.             if( fistsAllowed && IsActionAllowed(EIAB_HeavyAttacks) )
  1613.             {
  1614.                
  1615.                 thePlayer.SetupCombatAction( EBAT_HeavyAttack, BS_Pressed );
  1616.             }
  1617.             else
  1618.             {
  1619.                 if(!fistsAllowed)
  1620.                     thePlayer.DisplayActionDisallowedHudMessage(EIAB_Fists);
  1621.                 else
  1622.                     thePlayer.DisplayActionDisallowedHudMessage(EIAB_HeavyAttacks);
  1623.             }
  1624.         }
  1625.     }
  1626.        
  1627.    
  1628.    
  1629.     event OnExpFocus( action : SInputAction )
  1630.     {
  1631.        
  1632.         if(!thePlayer.IsCiri())
  1633.         {
  1634.             if(altSignCasting && !theInput.LastUsedPCInput() && theInput.IsActionPressed('CastSign') && !GetWitcherPlayer().IsCurrentSignChanneled())
  1635.             {
  1636.                 if(IsPressed( action ))
  1637.                 {
  1638.                     theGame.GetFocusModeController().Deactivate();
  1639.                     AltCastSign(ST_Igni);
  1640.                     return false;
  1641.                 }
  1642.                 else if (IsReleased( action ) && GetWitcherPlayer().IsCurrentSignChanneled())
  1643.                 {
  1644.                     thePlayer.AbortSign();
  1645.                 }
  1646.             }
  1647.         }
  1648.        
  1649.         if(thePlayer.IsCiri() && IsActionAllowed(EIAB_ExplorationFocus))
  1650.         {
  1651.             if( IsPressed( action ) )
  1652.             {
  1653.                 if( thePlayer.GoToCombatIfNeeded() )
  1654.                 {
  1655.                     OnCommGuard( action );
  1656.                     return false;
  1657.                 }
  1658.                 theGame.GetFocusModeController().Activate();
  1659.             }
  1660.             else if( IsReleased( action ) )
  1661.             {
  1662.                 theGame.GetFocusModeController().Deactivate();
  1663.             }
  1664.         }
  1665.         else if(IsActionAllowed(EIAB_ExplorationFocus) && !GetWitcherPlayer().IsCurrentSignChanneled())
  1666.         {
  1667.             if( IsPressed( action ) )
  1668.             {
  1669.                
  1670.                 if( thePlayer.GoToCombatIfNeeded() )
  1671.                 {
  1672.                     OnCommGuard( action );
  1673.                     return false;
  1674.                 }
  1675.                 theGame.GetFocusModeController().Activate();
  1676.                
  1677.             }
  1678.             else if( IsReleased( action ) )
  1679.             {
  1680.                 theGame.GetFocusModeController().Deactivate();
  1681.             }
  1682.         }
  1683.         else
  1684.         {
  1685.             thePlayer.DisplayActionDisallowedHudMessage(EIAB_ExplorationFocus);
  1686.             theGame.GetFocusModeController().Deactivate(); 
  1687.         }
  1688.     }
  1689.    
  1690.    
  1691.    
  1692.    
  1693.    
  1694.     private function ShouldSwitchAttackType():bool
  1695.     {
  1696.         var outKeys : array<EInputKey>;
  1697.        
  1698.         if ( theInput.LastUsedPCInput() )
  1699.         {      
  1700.             theInput.GetPCKeysForAction('PCAlternate',outKeys);
  1701.             if ( outKeys.Size() > 0 )
  1702.             {
  1703.                 if ( theInput.IsActionPressed('PCAlternate') )
  1704.                 {
  1705.                     return true;
  1706.                 }
  1707.             }
  1708.         }
  1709.         return false;
  1710.     }
  1711.    
  1712.     event OnCbtAttackWithAlternateLight( action : SInputAction )
  1713.     {
  1714.         CbtAttackPC( action, false);
  1715.     }
  1716.    
  1717.     event OnCbtAttackWithAlternateHeavy( action : SInputAction )
  1718.     {
  1719.         CbtAttackPC( action, true);
  1720.     }
  1721.    
  1722.     function CbtAttackPC( action : SInputAction, isHeavy : bool )
  1723.     {
  1724.         var switchAttackType : bool;
  1725.        
  1726.         switchAttackType = ShouldSwitchAttackType();
  1727.        
  1728.         if ( !theInput.LastUsedPCInput() )
  1729.         {
  1730.             return;
  1731.         }
  1732.        
  1733.         if ( thePlayer.IsCiri() )
  1734.         {
  1735.             if ( switchAttackType != isHeavy)
  1736.             {
  1737.                 OnCbtCiriAttackHeavy(action);
  1738.             }
  1739.             else
  1740.             {
  1741.                 OnCbtAttackLight(action);
  1742.             }
  1743.         }
  1744.         else
  1745.         {
  1746.             if ( switchAttackType != isHeavy)
  1747.             {
  1748.                 OnCbtAttackHeavy(action);
  1749.             }
  1750.             else
  1751.             {
  1752.                 OnCbtAttackLight(action);
  1753.             }
  1754.         }
  1755.     }
  1756.    
  1757.     event OnCbtAttackLight( action : SInputAction )
  1758.     {
  1759.         var allowed, checkedFists           : bool;
  1760.        
  1761.         if( IsPressed(action) )
  1762.         {
  1763.            
  1764.             if(altSignCasting && !theInput.LastUsedPCInput() && theInput.IsActionPressed('CastSign') && !GetWitcherPlayer().IsCurrentSignChanneled())
  1765.             {
  1766.                 AltCastSign(ST_Axii);
  1767.                 return false;
  1768.             }
  1769.            
  1770.            
  1771.            
  1772.             if( IsActionAllowed(EIAB_LightAttacks)  )
  1773.             {
  1774.                 if (thePlayer.GetBIsInputAllowed())
  1775.                 {
  1776.                     allowed = false;                   
  1777.                    
  1778.                     if( thePlayer.GetCurrentMeleeWeaponType() == PW_Fists || thePlayer.GetCurrentMeleeWeaponType() == PW_None )
  1779.                     {
  1780.                         checkedFists = true;
  1781.                         if(IsActionAllowed(EIAB_Fists))
  1782.                             allowed = true;
  1783.                     }
  1784.                     else if(IsActionAllowed(EIAB_SwordAttack))
  1785.                     {
  1786.                         checkedFists = false;
  1787.                         allowed = true;
  1788.                     }
  1789.                    
  1790.                     if(allowed)
  1791.                     {
  1792.                         thePlayer.SetupCombatAction( EBAT_LightAttack, BS_Pressed );
  1793.                     }
  1794.                     else
  1795.                     {
  1796.                         if(checkedFists)
  1797.                             thePlayer.DisplayActionDisallowedHudMessage(EIAB_Fists);
  1798.                         else
  1799.                             thePlayer.DisplayActionDisallowedHudMessage(EIAB_SwordAttack);
  1800.                     }
  1801.                 }
  1802.             }
  1803.             else  if ( !IsActionBlockedBy(EIAB_LightAttacks,'interaction') )
  1804.             {
  1805.                 thePlayer.DisplayActionDisallowedHudMessage(EIAB_LightAttacks);
  1806.             }
  1807.         }
  1808.     }
  1809.    
  1810.     event OnCbtAttackHeavy( action : SInputAction )
  1811.     {
  1812.         var allowed, checkedSword : bool;
  1813.         var outKeys : array<EInputKey>;
  1814.        
  1815.         if ( thePlayer.GetBIsInputAllowed() )
  1816.         {
  1817.            
  1818.             if(altSignCasting && !theInput.LastUsedPCInput() && theInput.IsActionPressed('CastSign') && !GetWitcherPlayer().IsCurrentSignChanneled())
  1819.             {
  1820.                 if(IsPressed( action ))
  1821.                 {
  1822.                     AltCastSign(ST_Yrden);
  1823.                     return false;
  1824.                 }
  1825.                 else if (IsReleased( action ))
  1826.                 {
  1827.                     return false;
  1828.                 }
  1829.             }
  1830.            
  1831.        
  1832.             if( IsActionAllowed(EIAB_HeavyAttacks) )
  1833.             {
  1834.                 allowed = false;
  1835.                
  1836.                 if( thePlayer.GetCurrentMeleeWeaponType() == PW_Fists || thePlayer.GetCurrentMeleeWeaponType() == PW_None )
  1837.                 {
  1838.                     checkedSword = false;
  1839.                     if(IsActionAllowed(EIAB_Fists))
  1840.                         allowed = true;
  1841.                 }
  1842.                 else if(IsActionAllowed(EIAB_SwordAttack))
  1843.                 {
  1844.                     checkedSword = true;
  1845.                     allowed = true;
  1846.                 }
  1847.                
  1848.                 if(allowed)
  1849.                 {
  1850.                     if ( ( thePlayer.GetCurrentMeleeWeaponType() == PW_Fists || thePlayer.GetCurrentMeleeWeaponType() == PW_None ) && IsPressed(action)  )
  1851.                     {
  1852.                         thePlayer.SetupCombatAction( EBAT_HeavyAttack, BS_Released );              
  1853.                     }
  1854.                     else
  1855.                     {
  1856.                         if( IsReleased(action) && theInput.GetLastActivationTime( action.aName ) < 0.2 )
  1857.                         {
  1858.                             thePlayer.SetupCombatAction( EBAT_HeavyAttack, BS_Released );
  1859.                         }
  1860.                     }
  1861.                 }
  1862.                 else
  1863.                 {
  1864.                     if(checkedSword)
  1865.                         thePlayer.DisplayActionDisallowedHudMessage(EIAB_SwordAttack);
  1866.                     else                   
  1867.                         thePlayer.DisplayActionDisallowedHudMessage(EIAB_Fists);
  1868.                 }
  1869.             }
  1870.             else if ( !IsActionBlockedBy(EIAB_HeavyAttacks,'interaction') )
  1871.             {
  1872.                 thePlayer.DisplayActionDisallowedHudMessage(EIAB_HeavyAttacks);
  1873.             }
  1874.         }
  1875.     }
  1876.  
  1877.     private function CheckFinisherInput() : bool
  1878.     {
  1879.         var enemyInCone         : CActor;
  1880.         var npc                 : CNewNPC;
  1881.         var interactionTarget   : CInteractionComponent;
  1882.        
  1883.         var isDeadlySwordHeld   : bool;
  1884.    
  1885.         interactionTarget = theGame.GetInteractionsManager().GetActiveInteraction();
  1886.         if ( interactionTarget && interactionTarget.GetName() == "Finish" )
  1887.         {
  1888.             npc = (CNewNPC)( interactionTarget.GetEntity() );
  1889.            
  1890.             isDeadlySwordHeld = thePlayer.IsDeadlySwordHeld();
  1891.             if( ( theInput.GetActionValue( 'AttackHeavy' ) == 1.f || theInput.GetActionValue( 'AttackLight' ) == 1.f  )
  1892.                 && isDeadlySwordHeld )
  1893.             {
  1894.                 theGame.RemoveTimeScale( theGame.GetTimescaleSource(ETS_FinisherInput) );
  1895.                 npc.SignalGameplayEvent('Finisher');
  1896.                
  1897.             }
  1898.             else if ( !isDeadlySwordHeld )
  1899.             {
  1900.                 if ( thePlayer.IsWeaponHeld( 'fist' ))
  1901.                     thePlayer.SetBehaviorVariable( 'combatTauntType', 1.f );
  1902.                 else
  1903.                     thePlayer.SetBehaviorVariable( 'combatTauntType', 0.f );
  1904.                    
  1905.                 thePlayer.RaiseEvent( 'CombatTaunt' );
  1906.             }
  1907.            
  1908.             return true;
  1909.            
  1910.         }
  1911.         return false;
  1912.     }
  1913.    
  1914.     private function IsPlayerAbleToPerformSpecialAttack() : bool
  1915.     {
  1916.         if( ( thePlayer.GetCurrentStateName() == 'Exploration' ) && !( thePlayer.IsWeaponHeld( 'silversword' ) || thePlayer.IsWeaponHeld( 'steelsword' ) ) )
  1917.         {
  1918.             return false;
  1919.         }
  1920.         return true;
  1921.     }
  1922.    
  1923.     event OnCbtSpecialAttackWithAlternateLight( action : SInputAction )
  1924.     {
  1925.         CbSpecialAttackPC( action, false);
  1926.     }
  1927.    
  1928.     event OnCbtSpecialAttackWithAlternateHeavy( action : SInputAction )
  1929.     {
  1930.         CbSpecialAttackPC( action, true);
  1931.     }
  1932.    
  1933.     function CbSpecialAttackPC( action : SInputAction, isHeavy : bool )
  1934.     {
  1935.         var switchAttackType : bool;
  1936.        
  1937.         switchAttackType = ShouldSwitchAttackType();
  1938.        
  1939.         if ( !theInput.LastUsedPCInput() )
  1940.         {
  1941.             return;
  1942.         }
  1943.        
  1944.         if ( IsPressed(action) )
  1945.         {
  1946.             if ( thePlayer.IsCiri() )
  1947.             {
  1948.                
  1949.                 OnCbtCiriSpecialAttackHeavy(action);
  1950.             }
  1951.             else
  1952.             {
  1953.                 if (switchAttackType != isHeavy)
  1954.                 {
  1955.                     OnCbtSpecialAttackHeavy(action);
  1956.                 }
  1957.                 else
  1958.                 {
  1959.                     OnCbtSpecialAttackLight(action);
  1960.                 }
  1961.             }
  1962.         }
  1963.         else if ( IsReleased( action ) )
  1964.         {
  1965.             if ( thePlayer.IsCiri() )
  1966.             {
  1967.                 OnCbtCiriSpecialAttackHeavy(action);
  1968.             }
  1969.             else
  1970.             {
  1971.                
  1972.                 OnCbtSpecialAttackHeavy(action);
  1973.                 OnCbtSpecialAttackLight(action);
  1974.             }
  1975.         }
  1976.     }
  1977.    
  1978.     event OnCbtSpecialAttackLight( action : SInputAction )
  1979.     {
  1980.        
  1981.         if(!theInput.LastUsedPCInput() && IsPressed( action ) && theInput.GetActionValue( 'CastSign' ) > 0)
  1982.         {
  1983.             return false;
  1984.         }
  1985.        
  1986.    
  1987.         if ( IsReleased( action )  )
  1988.         {
  1989.             thePlayer.CancelHoldAttacks();
  1990.             return true;
  1991.         }
  1992.        
  1993.         if ( !IsPlayerAbleToPerformSpecialAttack() )
  1994.             return false;
  1995.        
  1996.         if( !IsActionAllowed(EIAB_LightAttacks) )
  1997.         {
  1998.             thePlayer.DisplayActionDisallowedHudMessage(EIAB_LightAttacks);
  1999.             return false;
  2000.         }
  2001.         if(!IsActionAllowed(EIAB_SpecialAttackLight) )
  2002.         {
  2003.             thePlayer.DisplayActionDisallowedHudMessage(EIAB_SpecialAttackLight);
  2004.             return false;
  2005.         }
  2006.        
  2007.         if( IsPressed(action) && thePlayer.CanUseSkill(S_Sword_s01) )  
  2008.         {          
  2009.             thePlayer.PrepareToAttack();
  2010.             thePlayer.SetPlayedSpecialAttackMissingResourceSound(false);
  2011.             thePlayer.AddTimer( 'IsSpecialLightAttackInputHeld', 0.00001, true );
  2012.         }
  2013.     }  
  2014.  
  2015.     event OnCbtSpecialAttackHeavy( action : SInputAction )
  2016.     {
  2017.        
  2018.         if(!theInput.LastUsedPCInput() && IsPressed( action ) && theInput.GetActionValue( 'CastSign' ) > 0)
  2019.         {
  2020.             return false;
  2021.         }
  2022.        
  2023.    
  2024.         if ( IsReleased( action )  )
  2025.         {
  2026.             thePlayer.CancelHoldAttacks();
  2027.             return true;
  2028.         }
  2029.        
  2030.         if ( !IsPlayerAbleToPerformSpecialAttack() || GetWitcherPlayer().IsInCombatAction_SpecialAttackHeavy() )
  2031.             return false;
  2032.        
  2033.         if( !IsActionAllowed(EIAB_HeavyAttacks))
  2034.         {
  2035.             thePlayer.DisplayActionDisallowedHudMessage(EIAB_HeavyAttacks);
  2036.             return false;
  2037.         }      
  2038.         if(!IsActionAllowed(EIAB_SpecialAttackHeavy))
  2039.         {
  2040.             thePlayer.DisplayActionDisallowedHudMessage(EIAB_SpecialAttackHeavy);
  2041.             return false;
  2042.         }
  2043.        
  2044.         if( IsPressed(action) && thePlayer.CanUseSkill(S_Sword_s02) )  
  2045.         {  
  2046.             thePlayer.PrepareToAttack();
  2047.             thePlayer.SetPlayedSpecialAttackMissingResourceSound(false);
  2048.             thePlayer.AddTimer( 'IsSpecialHeavyAttackInputHeld', 0.00001, true );
  2049.         }
  2050.         else if ( IsPressed(action) )
  2051.         {
  2052.             if ( theInput.IsActionPressed('AttackHeavy') )
  2053.                 theInput.ForceDeactivateAction('AttackHeavy');
  2054.             else if ( theInput.IsActionPressed('AttackWithAlternateHeavy') )
  2055.                 theInput.ForceDeactivateAction('AttackWithAlternateHeavy');
  2056.         }
  2057.     }
  2058.    
  2059.    
  2060.     event OnCbtCiriSpecialAttack( action : SInputAction )
  2061.     {
  2062.         if( !GetCiriPlayer().HasSword() )
  2063.             return false;
  2064.    
  2065.         if( thePlayer.GetBIsInputAllowed() && thePlayer.GetBIsCombatActionAllowed() && IsPressed(action) ) 
  2066.         {
  2067.             if ( thePlayer.HasAbility('CiriBlink') && ((W3ReplacerCiri)thePlayer).HasStaminaForSpecialAction(true) )
  2068.                 thePlayer.PrepareToAttack();
  2069.             thePlayer.PushCombatActionOnBuffer( EBAT_Ciri_SpecialAttack, BS_Pressed );
  2070.             thePlayer.ProcessCombatActionBuffer(); 
  2071.         }
  2072.         else if ( IsReleased( action ) && thePlayer.GetCombatAction() == EBAT_Ciri_SpecialAttack && thePlayer.GetBehaviorVariable( 'isPerformingSpecialAttack' ) != 0 )
  2073.         {
  2074.             thePlayer.PushCombatActionOnBuffer( EBAT_Ciri_SpecialAttack, BS_Released );
  2075.             thePlayer.ProcessCombatActionBuffer();     
  2076.         }
  2077.     }
  2078.    
  2079.    
  2080.     event OnCbtCiriAttackHeavy( action : SInputAction )
  2081.     {
  2082.         var specialAttackAction : SInputAction;
  2083.        
  2084.         if( !GetCiriPlayer().HasSword() )
  2085.             return false;
  2086.        
  2087.         specialAttackAction = theInput.GetAction('CiriSpecialAttackHeavy');
  2088.        
  2089.         if( thePlayer.GetBIsInputAllowed() && IsReleased(action) && thePlayer.GetBehaviorVariable( 'isPerformingSpecialAttack' ) == 0  )   
  2090.         {  
  2091.             if( IsActionAllowed(EIAB_HeavyAttacks) && IsActionAllowed(EIAB_SwordAttack) )
  2092.             {
  2093.                 if ( thePlayer.GetCurrentMeleeWeaponType() == PW_Steel )
  2094.                 {
  2095.                     thePlayer.PrepareToAttack();
  2096.                     thePlayer.SetupCombatAction( EBAT_HeavyAttack, BS_Released );
  2097.                     if ( thePlayer.GetBIsCombatActionAllowed() )
  2098.                         thePlayer.ProcessCombatActionBuffer();
  2099.                 }
  2100.             }
  2101.             else if ( !IsActionBlockedBy(EIAB_HeavyAttacks,'interaction') )
  2102.             {
  2103.                 thePlayer.DisplayActionDisallowedHudMessage(EIAB_LightAttacks);            
  2104.             }
  2105.         }
  2106.     }
  2107.    
  2108.    
  2109.     event OnCbtCiriSpecialAttackHeavy( action : SInputAction )
  2110.     {  
  2111.         if( !GetCiriPlayer().HasSword() )
  2112.             return false;
  2113.        
  2114.         if( thePlayer.GetBIsInputAllowed() && thePlayer.GetBIsCombatActionAllowed() && IsPressed(action) ) 
  2115.         {
  2116.             theInput.ForceDeactivateAction('AttackWithAlternateHeavy');
  2117.             thePlayer.PushCombatActionOnBuffer( EBAT_Ciri_SpecialAttack_Heavy, BS_Pressed );
  2118.             thePlayer.ProcessCombatActionBuffer();
  2119.         }
  2120.         else if ( IsReleased( action ) && thePlayer.GetCombatAction() == EBAT_Ciri_SpecialAttack_Heavy && thePlayer.GetBehaviorVariable( 'isPerformingSpecialAttack' ) != 0  )
  2121.         {
  2122.             theInput.ForceDeactivateAction('CiriAttackHeavy');
  2123.             theInput.ForceDeactivateAction('AttackWithAlternateHeavy');
  2124.             thePlayer.PushCombatActionOnBuffer( EBAT_Ciri_SpecialAttack_Heavy, BS_Released );
  2125.             thePlayer.ProcessCombatActionBuffer();     
  2126.         }
  2127.     }
  2128.    
  2129.     event OnCbtCiriDodge( action : SInputAction )
  2130.     {  
  2131.         if( IsActionAllowed(EIAB_Dodge) && IsPressed(action) && thePlayer.IsAlive() )  
  2132.         {
  2133.             if ( thePlayer.IsInCombatAction() && thePlayer.GetCombatAction() == EBAT_Ciri_SpecialAttack && thePlayer.GetBehaviorVariable( 'isCompletingSpecialAttack' ) <= 0 )
  2134.             {
  2135.                 thePlayer.PushCombatActionOnBuffer( EBAT_Ciri_Dodge, BS_Pressed );
  2136.                 thePlayer.ProcessCombatActionBuffer();         
  2137.             }
  2138.             else if ( thePlayer.GetBIsInputAllowed() )
  2139.             {
  2140.                 thePlayer.PushCombatActionOnBuffer( EBAT_Ciri_Dodge, BS_Pressed );
  2141.                 if ( thePlayer.GetBIsCombatActionAllowed() )
  2142.                     thePlayer.ProcessCombatActionBuffer();
  2143.             }
  2144.             else
  2145.             {
  2146.                 if ( thePlayer.IsInCombatAction() && thePlayer.GetBehaviorVariable( 'combatActionType' ) == (int)CAT_Attack )
  2147.                 {
  2148.                     if ( thePlayer.CanPlayHitAnim() && thePlayer.IsThreatened() )
  2149.                     {
  2150.                         thePlayer.CriticalEffectAnimationInterrupted("CiriDodge");
  2151.                         thePlayer.PushCombatActionOnBuffer( EBAT_Ciri_Dodge, BS_Pressed );
  2152.                         thePlayer.ProcessCombatActionBuffer();                         
  2153.                     }
  2154.                     else
  2155.                         thePlayer.PushCombatActionOnBuffer( EBAT_Ciri_Dodge, BS_Pressed );
  2156.                 }
  2157.             }
  2158.         }
  2159.         else if ( !IsActionAllowed(EIAB_Dodge) )
  2160.         {
  2161.             thePlayer.DisplayActionDisallowedHudMessage(EIAB_Dodge);
  2162.         }
  2163.     }
  2164.    
  2165.     event OnCbtCiriDash( action : SInputAction )
  2166.     {
  2167.         if ( theInput.LastUsedGamepad() && IsPressed( action ) )
  2168.         {
  2169.             thePlayer.StartDodgeTimer();
  2170.         }
  2171.         else if( IsActionAllowed(EIAB_Dodge) && thePlayer.IsAlive() )  
  2172.         {
  2173.             if ( theInput.LastUsedGamepad() )
  2174.             {
  2175.                 if ( !(thePlayer.IsDodgeTimerRunning() && !thePlayer.IsInsideInteraction() && IsReleased(action)) )
  2176.                     return false;
  2177.             }
  2178.            
  2179.             if ( thePlayer.IsInCombatAction() && thePlayer.GetCombatAction() == EBAT_Ciri_SpecialAttack && thePlayer.GetBehaviorVariable( 'isCompletingSpecialAttack' ) <= 0 )
  2180.             {
  2181.                 thePlayer.PushCombatActionOnBuffer( EBAT_Roll, BS_Released );
  2182.                 thePlayer.ProcessCombatActionBuffer();         
  2183.             }
  2184.             else if ( thePlayer.GetBIsInputAllowed() )
  2185.             {
  2186.                 thePlayer.PushCombatActionOnBuffer( EBAT_Roll, BS_Released );
  2187.                 if ( thePlayer.GetBIsCombatActionAllowed() )
  2188.                     thePlayer.ProcessCombatActionBuffer();
  2189.             }
  2190.             else
  2191.             {
  2192.                 if ( thePlayer.IsInCombatAction() && thePlayer.GetBehaviorVariable( 'combatActionType' ) == (int)CAT_Attack )
  2193.                 {
  2194.                     if ( thePlayer.CanPlayHitAnim() && thePlayer.IsThreatened() )
  2195.                     {
  2196.                         thePlayer.CriticalEffectAnimationInterrupted("CiriDodge");
  2197.                         thePlayer.PushCombatActionOnBuffer( EBAT_Roll, BS_Released );
  2198.                         thePlayer.ProcessCombatActionBuffer();                         
  2199.                     }
  2200.                     else
  2201.                         thePlayer.PushCombatActionOnBuffer( EBAT_Roll, BS_Released );
  2202.                 }
  2203.             }
  2204.         }
  2205.         else if ( !IsActionAllowed(EIAB_Dodge) )
  2206.         {
  2207.             thePlayer.DisplayActionDisallowedHudMessage(EIAB_Dodge);
  2208.         }
  2209.     }
  2210.    
  2211.     event OnCbtDodge( action : SInputAction )
  2212.     {      
  2213.         if ( IsPressed(action) )
  2214.         {
  2215.            
  2216.             if(altSignCasting && !theInput.LastUsedPCInput() && theInput.IsActionPressed('CastSign'))
  2217.             {
  2218.                
  2219.                
  2220.             }          
  2221.             else
  2222.            
  2223.             {
  2224.                 thePlayer.EvadePressed(EBAT_Dodge);
  2225.             }
  2226.         }
  2227.     }
  2228.    
  2229.     event OnCbtRoll( action : SInputAction )
  2230.     {      
  2231.         if ( theInput.LastUsedPCInput() )
  2232.         {
  2233.             if ( IsPressed( action ) )
  2234.             {
  2235.                 thePlayer.EvadePressed(EBAT_Roll);
  2236.             }
  2237.         }
  2238.         else
  2239.         {
  2240.             if ( IsPressed( action ) )
  2241.             {
  2242.                
  2243.                 if(altSignCasting && theInput.IsActionPressed('CastSign'))
  2244.                 {
  2245.                     return false;                  
  2246.                 }
  2247.                
  2248.                 else
  2249.                 {
  2250.                     thePlayer.StartDodgeTimer();
  2251.                 }
  2252.             }
  2253.             else if ( IsReleased( action ) )
  2254.             {
  2255.                 if ( thePlayer.IsDodgeTimerRunning() )
  2256.                 {
  2257.                     thePlayer.StopDodgeTimer();
  2258.                     if ( !thePlayer.IsInsideInteraction() )
  2259.                         thePlayer.EvadePressed(EBAT_Roll);
  2260.                 }
  2261.                
  2262.             }
  2263.         }
  2264.     }
  2265.    
  2266.    
  2267.     public function GetIsAltSignCasting() : bool
  2268.     {
  2269.         return altSignCasting;
  2270.     }
  2271.  
  2272.     public function GetIsAltSignCastingPressed() : bool
  2273.     {
  2274.         return altSignCasting  &&  theInput.IsActionPressed('CastSign');
  2275.     }
  2276.    
  2277.     public function SetIsAltSignCasting(enable : bool)
  2278.     {
  2279.         altSignCasting = enable;
  2280.     }
  2281.    
  2282.     private function AltCastSign(signType : ESignType)
  2283.     {
  2284.         var signSkill : ESkill;
  2285.        
  2286.         if( !thePlayer.GetBIsInputAllowed() )
  2287.         {  
  2288.             return;
  2289.         }
  2290.    
  2291.         if( !IsActionAllowed(EIAB_Signs) || GetWitcherPlayer().IsSignBlocked(signType) )
  2292.         {              
  2293.             thePlayer.DisplayActionDisallowedHudMessage(EIAB_Signs);
  2294.             return;
  2295.         }
  2296.         if ( thePlayer.IsHoldingItemInLHand() && thePlayer.IsUsableItemLBlocked() )
  2297.         {
  2298.             thePlayer.DisplayActionDisallowedHudMessage(EIAB_Undefined, false, false, true);
  2299.             return;
  2300.         }
  2301.  
  2302.         signSkill = SignEnumToSkillEnum(signType);
  2303.         if( signSkill != S_SUndefined )
  2304.         {
  2305.             if(!thePlayer.CanUseSkill(signSkill))
  2306.             {
  2307.                 thePlayer.DisplayActionDisallowedHudMessage(EIAB_Signs, false, false, true);
  2308.                 return;
  2309.             }
  2310.        
  2311.             if( thePlayer.HasStaminaToUseSkill( signSkill, false ) )
  2312.             {
  2313.                 GetWitcherPlayer().SetEquippedSign(signType);              
  2314.                 thePlayer.SetupCombatAction( EBAT_CastSign, BS_Pressed );
  2315.             }
  2316.             else
  2317.             {
  2318.                 thePlayer.SoundEvent("gui_no_stamina");
  2319.             }
  2320.         }
  2321.     }
  2322.    
  2323.    
  2324.     var lastMovementDoubleTapName : name;
  2325.    
  2326.     event OnMovementDoubleTap( action : SInputAction )
  2327.     {
  2328.         if ( IsPressed( action ) )
  2329.         {
  2330.             if ( !thePlayer.IsDodgeTimerRunning() || action.aName != lastMovementDoubleTapName )
  2331.             {
  2332.                 thePlayer.StartDodgeTimer();
  2333.                 lastMovementDoubleTapName = action.aName;
  2334.             }
  2335.             else
  2336.             {
  2337.                 thePlayer.StopDodgeTimer();
  2338.                
  2339.                 thePlayer.EvadePressed(EBAT_Dodge);
  2340.             }
  2341.            
  2342.         }
  2343.     }
  2344.    
  2345.     event OnCastSign( action : SInputAction )
  2346.     {
  2347.         var signSkill : ESkill;
  2348.  
  2349.         if( altSignCasting )
  2350.             thePlayer.ApplyCastSettings();
  2351.        
  2352.         // modTurnOnTheLights ++
  2353.         LogChannel( 'modTurnOnTheLights', "OnCastSign" );
  2354.         if( altSignCasting && theInput.LastUsedGamepad() && IsReleased(action) )
  2355.         {
  2356.             LogChannel( 'modTurnOnTheLights', "OnCastSign: IsReleased" );
  2357.             ((W3PlayerWitcher)thePlayer).turnOnTheLights.ProcessInput();
  2358.         }
  2359.         // modTurnOnTheLights --
  2360.        
  2361.         if(altSignCasting && !theInput.LastUsedPCInput())
  2362.         {
  2363.             if(IsPressed( action ) && (theInput.GetActionValue( 'LockAndGuard' ) > 0) && !GetWitcherPlayer().IsCurrentSignChanneled())
  2364.             {
  2365.                 AltCastSign(ST_Igni);
  2366.             }
  2367.             else if(IsPressed( action ))
  2368.             {
  2369.                 thePlayer.BlockAction(EIAB_Interactions, 'NGE_CastSign_Block');
  2370.                 thePlayer.BlockAction(EIAB_InteractionAction, 'NGE_CastSign_Block');
  2371.                 thePlayer.BlockAction(EIAB_InteractionContainers, 'NGE_CastSign_Block');
  2372.             }
  2373.             else if(IsReleased( action ))
  2374.             {
  2375.                 thePlayer.UnblockAction(EIAB_Interactions, 'NGE_CastSign_Block');
  2376.                 thePlayer.UnblockAction(EIAB_InteractionAction, 'NGE_CastSign_Block');
  2377.                 thePlayer.UnblockAction(EIAB_InteractionContainers, 'NGE_CastSign_Block');
  2378.             }
  2379.            
  2380.             return false;
  2381.         }
  2382.        
  2383.        
  2384.         if( !thePlayer.GetBIsInputAllowed() )
  2385.         {  
  2386.             return false;
  2387.         }
  2388.        
  2389.         if( IsPressed(action) )
  2390.         {
  2391.             if( !IsActionAllowed(EIAB_Signs) )
  2392.             {              
  2393.                 thePlayer.DisplayActionDisallowedHudMessage(EIAB_Signs);
  2394.                 return false;
  2395.             }
  2396.  if ( thePlayer.IsHoldingItemInLHand() && thePlayer.IsUsableItemLBlocked() )
  2397.             {
  2398.                 thePlayer.DisplayActionDisallowedHudMessage(EIAB_Undefined, false, false, true);
  2399.                 return false;
  2400.             }
  2401.            
  2402.             signSkill = SignEnumToSkillEnum( thePlayer.GetEquippedSign() );
  2403.             if( signSkill != S_SUndefined )
  2404.             {
  2405.                 if(!thePlayer.CanUseSkill(signSkill))
  2406.                 {
  2407.                     thePlayer.DisplayActionDisallowedHudMessage(EIAB_Signs, false, false, true);
  2408.                     return false;
  2409.                 }
  2410.            
  2411.                 if( thePlayer.HasStaminaToUseSkill( signSkill, false ) )
  2412.                 {
  2413.                     if( GetInvalidUniqueId() != thePlayer.inv.GetItemFromSlot( 'l_weapon' ) && !thePlayer.IsUsableItemLBlocked())
  2414.                     {
  2415.  
  2416.                        
  2417.                        
  2418.                     }
  2419.                     thePlayer.SetupCombatAction( EBAT_CastSign, BS_Pressed );
  2420.                 }
  2421.                 else
  2422.                 {
  2423.                     thePlayer.SoundEvent("gui_no_stamina");
  2424.                 }
  2425.             }          
  2426.         }
  2427.     }
  2428.    
  2429.    
  2430.    
  2431.    
  2432.     event OnThrowBomb(action : SInputAction)
  2433.     {
  2434.         var selectedItemId : SItemUniqueId;
  2435.    
  2436.         selectedItemId = thePlayer.GetSelectedItemId();
  2437.         if(!thePlayer.inv.IsItemBomb(selectedItemId))
  2438.             return false;
  2439.        
  2440.         if( thePlayer.inv.SingletonItemGetAmmo(selectedItemId) == 0 )
  2441.         {
  2442.            
  2443.             if(IsPressed(action))
  2444.             {          
  2445.                 thePlayer.SoundEvent( "gui_ingame_low_stamina_warning" );
  2446.             }
  2447.            
  2448.             return false;
  2449.         }
  2450.        
  2451.         if ( IsReleased(action) )
  2452.         {
  2453.             if ( thePlayer.IsThrowHold() )
  2454.             {
  2455.                 if ( thePlayer.playerAiming.GetAimedTarget() )
  2456.                 {
  2457.                     if ( thePlayer.AllowAttack( thePlayer.playerAiming.GetAimedTarget(), EBAT_ItemUse ) )
  2458.                     {
  2459.                         thePlayer.PushCombatActionOnBuffer( EBAT_ItemUse, BS_Released );
  2460.                         thePlayer.ProcessCombatActionBuffer();
  2461.                     }
  2462.                     else
  2463.                         thePlayer.BombThrowAbort();
  2464.                 }
  2465.                 else
  2466.                 {
  2467.                     thePlayer.PushCombatActionOnBuffer( EBAT_ItemUse, BS_Released );
  2468.                     thePlayer.ProcessCombatActionBuffer();             
  2469.                 }
  2470.                
  2471.                 thePlayer.SetThrowHold( false );
  2472.    
  2473.                 return true;
  2474.        
  2475.             }
  2476.             else
  2477.             {
  2478.                 if(!IsActionAllowed(EIAB_ThrowBomb))
  2479.                 {
  2480.                     thePlayer.DisplayActionDisallowedHudMessage(EIAB_ThrowBomb);
  2481.                     return false;
  2482.                 }
  2483.                
  2484.                 if ( thePlayer.IsHoldingItemInLHand() && !thePlayer.IsUsableItemLBlocked() )
  2485.                 {
  2486.                     thePlayer.SetPlayerActionToRestore ( PATR_ThrowBomb );
  2487.                     thePlayer.OnUseSelectedItem( true );
  2488.                     return true;
  2489.                 }
  2490.                 if(thePlayer.CanSetupCombatAction_Throw() && theInput.GetLastActivationTime( action.aName ) < 0.3f )   
  2491.                 {
  2492.                    
  2493.                     thePlayer.SetupCombatAction( EBAT_ItemUse, BS_Pressed );
  2494.                     return true;
  2495.                 }      
  2496.            
  2497.                 thePlayer.SetupCombatAction( EBAT_ItemUse, BS_Released );
  2498.                 return true;
  2499.             }
  2500.         }
  2501.        
  2502.         return false;
  2503.     }
  2504.    
  2505.     event OnThrowBombHold(action : SInputAction)
  2506.     {
  2507.         var locks : array<SInputActionLock>;
  2508.         var ind : int;
  2509.  
  2510.         var selectedItemId : SItemUniqueId;
  2511.    
  2512.         selectedItemId = thePlayer.GetSelectedItemId();
  2513.         if(!thePlayer.inv.IsItemBomb(selectedItemId))
  2514.             return false;
  2515.        
  2516.         if( thePlayer.inv.SingletonItemGetAmmo(selectedItemId) == 0 )
  2517.         {
  2518.            
  2519.             if(IsPressed(action))
  2520.             {          
  2521.                 thePlayer.SoundEvent( "gui_ingame_low_stamina_warning" );
  2522.             }
  2523.            
  2524.             return false;
  2525.         }
  2526.            
  2527.         if( IsPressed(action) )
  2528.         {
  2529.             if(!IsActionAllowed(EIAB_ThrowBomb))
  2530.             {
  2531.                 thePlayer.DisplayActionDisallowedHudMessage(EIAB_ThrowBomb);
  2532.                 return false;
  2533.             }
  2534.             else if(GetWitcherPlayer().GetBombDelay(GetWitcherPlayer().GetItemSlot(selectedItemId)) > 0 )
  2535.             {
  2536.                
  2537.                 return false;
  2538.             }
  2539.             if ( thePlayer.IsHoldingItemInLHand() && !thePlayer.IsUsableItemLBlocked() )
  2540.             {
  2541.                 thePlayer.SetPlayerActionToRestore ( PATR_ThrowBomb );
  2542.                 thePlayer.OnUseSelectedItem( true );
  2543.                 return true;
  2544.             }
  2545.             if(thePlayer.CanSetupCombatAction_Throw() && theInput.GetLastActivationTime( action.aName ) < 0.3f )   
  2546.             {
  2547.                 if( thePlayer.GetBIsCombatActionAllowed() )
  2548.                 {
  2549.                     thePlayer.PushCombatActionOnBuffer( EBAT_ItemUse, BS_Pressed );
  2550.                     thePlayer.ProcessCombatActionBuffer();
  2551.                 }
  2552.             }      
  2553.        
  2554.            
  2555.            
  2556.             locks = GetActionLocks(EIAB_ThrowBomb);
  2557.             ind = FindActionLockIndex(EIAB_ThrowBomb, 'BombThrow');
  2558.             if(ind >= 0)
  2559.                 locks.Erase(ind);
  2560.            
  2561.             if(locks.Size() != 0)
  2562.                 return false;
  2563.            
  2564.             thePlayer.SetThrowHold( true );
  2565.             return true;
  2566.         }
  2567.  
  2568.         return false;
  2569.     }
  2570.    
  2571.     event OnThrowBombAbort(action : SInputAction)
  2572.     {      
  2573.         if( IsPressed(action) )
  2574.         {      
  2575.             thePlayer.BombThrowAbort();
  2576.         }
  2577.     }
  2578.    
  2579.    
  2580.    
  2581.    
  2582.    
  2583.     event OnCbtThrowItem( action : SInputAction )
  2584.     {          
  2585.         var isUsableItem, isCrossbow, isBomb, ret : bool;
  2586.         var itemId : SItemUniqueId;    
  2587.        
  2588.        
  2589.         if(thePlayer.IsInAir() || thePlayer.GetWeaponHolster().IsOnTheMiddleOfHolstering())
  2590.             return false;
  2591.            
  2592.         if( thePlayer.IsSwimming() && !thePlayer.OnCheckDiving() && thePlayer.GetCurrentStateName() != 'AimThrow' )
  2593.             return false;
  2594.                
  2595.         itemId = thePlayer.GetSelectedItemId();
  2596.        
  2597.         if(!thePlayer.inv.IsIdValid(itemId))
  2598.             return false;
  2599.        
  2600.         isCrossbow = thePlayer.inv.IsItemCrossbow(itemId);
  2601.         if(!isCrossbow)
  2602.         {
  2603.             isBomb = thePlayer.inv.IsItemBomb(itemId);
  2604.             if(!isBomb)
  2605.             {
  2606.                 isUsableItem = true;
  2607.             }
  2608.         }
  2609.        
  2610.        
  2611.        
  2612.        
  2613.         if( isCrossbow )
  2614.         {
  2615.             if ( IsActionAllowed(EIAB_Crossbow) )
  2616.             {
  2617.                 if( IsPressed(action))
  2618.                 {
  2619.                     if ( thePlayer.IsHoldingItemInLHand() && !thePlayer.IsUsableItemLBlocked() )
  2620.                     {
  2621.  
  2622.                        
  2623.                         thePlayer.SetPlayerActionToRestore ( PATR_Crossbow );
  2624.                         thePlayer.OnUseSelectedItem( true );
  2625.                         ret = true;                    
  2626.                     }
  2627.                     else if ( thePlayer.GetBIsInputAllowed() && !thePlayer.IsCurrentlyUsingItemL() )
  2628.                     {
  2629.                         thePlayer.SetIsAimingCrossbow( true );
  2630.                         thePlayer.SetupCombatAction( EBAT_ItemUse, BS_Pressed );
  2631.                        
  2632.                        
  2633.                         ret = true;
  2634.                     }
  2635.                 }
  2636.                 else
  2637.                 {
  2638.  
  2639.                     if ( thePlayer.GetIsAimingCrossbow() && !thePlayer.IsCurrentlyUsingItemL() )
  2640.                     {
  2641.                         thePlayer.SetupCombatAction( EBAT_ItemUse, BS_Released );
  2642.                        
  2643.                        
  2644.                         thePlayer.SetIsAimingCrossbow( false );
  2645.                         ret = true;
  2646.                     }
  2647.                 }
  2648.             }
  2649.             else
  2650.             {
  2651.                 if ( !thePlayer.IsInShallowWater() )
  2652.                     thePlayer.DisplayActionDisallowedHudMessage(EIAB_Crossbow);            
  2653.             }
  2654.            
  2655.             if ( IsPressed(action) )
  2656.                 thePlayer.AddTimer( 'IsItemUseInputHeld', 0.00001, true );
  2657.             else
  2658.                 thePlayer.RemoveTimer('IsItemUseInputHeld');
  2659.                
  2660.             return ret;
  2661.         }
  2662.         else if(isBomb)
  2663.         {
  2664.             return OnThrowBomb(action);
  2665.         }
  2666.         else if(isUsableItem && !thePlayer.IsSwimming() )
  2667.         {
  2668.             if( IsActionAllowed(EIAB_UsableItem) )
  2669.             {
  2670.                 if(IsPressed(action) && thePlayer.HasStaminaToUseAction(ESAT_UsableItem))
  2671.                 {
  2672.                     thePlayer.SetPlayerActionToRestore ( PATR_Default );
  2673.                     thePlayer.OnUseSelectedItem();
  2674.                     return true;
  2675.                 }
  2676.  
  2677.             }
  2678.             else
  2679.             {
  2680.                 thePlayer.DisplayActionDisallowedHudMessage(EIAB_UsableItem);
  2681.             }
  2682.         }
  2683.        
  2684.         return false;
  2685.     }
  2686.    
  2687.     event OnCbtThrowItemHold( action : SInputAction )
  2688.     {
  2689.         var isBomb, isCrossbow, isUsableItem : bool;
  2690.         var itemId : SItemUniqueId;
  2691.        
  2692.        
  2693.         if(thePlayer.IsInAir() || thePlayer.GetWeaponHolster().IsOnTheMiddleOfHolstering() )
  2694.             return false;
  2695.            
  2696.         if( thePlayer.IsSwimming() && !thePlayer.OnCheckDiving() && thePlayer.GetCurrentStateName() != 'AimThrow' )
  2697.             return false;          
  2698.                
  2699.         itemId = thePlayer.GetSelectedItemId();
  2700.        
  2701.         if(!thePlayer.inv.IsIdValid(itemId))
  2702.             return false;
  2703.        
  2704.         isCrossbow = thePlayer.inv.IsItemCrossbow(itemId);
  2705.         if(!isCrossbow)
  2706.         {
  2707.             isBomb = thePlayer.inv.IsItemBomb(itemId);
  2708.             if(isBomb)
  2709.             {
  2710.                 return OnThrowBombHold(action);
  2711.             }
  2712.             else
  2713.             {
  2714.                 isUsableItem = true;
  2715.             }
  2716.         }
  2717.        
  2718.        
  2719.         if(IsPressed(action))
  2720.         {
  2721.             if( isCrossbow && !IsActionAllowed(EIAB_Crossbow) )
  2722.             {
  2723.                 thePlayer.DisplayActionDisallowedHudMessage(EIAB_Crossbow);
  2724.                 return false;
  2725.             }
  2726.            
  2727.             if( isUsableItem)
  2728.             {
  2729.                 if(!IsActionAllowed(EIAB_UsableItem))
  2730.                 {
  2731.                     thePlayer.DisplayActionDisallowedHudMessage(EIAB_UsableItem);
  2732.                     return false;
  2733.                 }
  2734.                 else if(thePlayer.IsSwimming())
  2735.                 {
  2736.                     thePlayer.DisplayActionDisallowedHudMessage(EIAB_Undefined, false, false, true);
  2737.                     return false;
  2738.                 }
  2739.             }
  2740.         }
  2741.    
  2742.         if( IsPressed(action) )
  2743.         {
  2744.             thePlayer.SetThrowHold( true );
  2745.             return true;
  2746.         }
  2747.         else if( IsReleased(action) && thePlayer.IsThrowHold())
  2748.         {
  2749.            
  2750.            
  2751.             thePlayer.SetupCombatAction( EBAT_ItemUse, BS_Released );
  2752.             thePlayer.SetThrowHold( false );
  2753.             return true;
  2754.         }
  2755.        
  2756.         return false;
  2757.     }
  2758.    
  2759.     event OnCbtThrowCastAbort( action : SInputAction )
  2760.     {
  2761.         var player : W3PlayerWitcher;
  2762.         var throwStage : EThrowStage;
  2763.        
  2764.         if(thePlayer.inv.IsItemBomb(thePlayer.GetSelectedItemId()))
  2765.         {
  2766.             return OnThrowBombAbort(action);                           
  2767.         }
  2768.        
  2769.         if( IsPressed(action) )
  2770.         {
  2771.             player = GetWitcherPlayer();
  2772.             if(player)
  2773.             {
  2774.                 if( player.IsCastingSign() )
  2775.                 {
  2776.                     player.CastSignAbort();
  2777.                 }
  2778.                 else
  2779.                 {
  2780.                     if ( thePlayer.inv.IsItemCrossbow( thePlayer.inv.GetItemFromSlot( 'l_weapon' ) ) )
  2781.                     {
  2782.                         thePlayer.OnRangedForceHolster();
  2783.                     }
  2784.                     else
  2785.                     {
  2786.                         throwStage = (int)thePlayer.GetBehaviorVariable( 'throwStage', (int)TS_Stop);
  2787.                        
  2788.                         if(throwStage == TS_Start || throwStage == TS_Loop)
  2789.                             player.ThrowingAbort();
  2790.                     }
  2791.                 }
  2792.             }
  2793.         }
  2794.     }
  2795.    
  2796.     event OnCbtSelectLockTarget( inputVector : Vector )
  2797.     {
  2798.         var newLockTarget   : CActor;
  2799.         var inputHeading    : float;
  2800.         var target          : CActor;
  2801.        
  2802.         inputVector.Y = inputVector.Y  * -1.f;
  2803.         inputHeading =  VecHeading( inputVector );
  2804.        
  2805.         newLockTarget = thePlayer.GetScreenSpaceLockTarget( thePlayer.GetDisplayTarget(), 180.f, 1.f, inputHeading );
  2806.  
  2807.         if ( newLockTarget )
  2808.             thePlayer.ProcessLockTarget( newLockTarget );
  2809.        
  2810.         target = thePlayer.GetTarget();
  2811.         if ( target )
  2812.         {
  2813.             thePlayer.SetSlideTarget( target );
  2814.            
  2815.         }
  2816.     }
  2817.  
  2818.     event OnCbtLockAndGuard( action : SInputAction )
  2819.     {
  2820.         if(thePlayer.IsCiri() && !GetCiriPlayer().HasSword())
  2821.             return false;
  2822.        
  2823.        
  2824.         if( IsReleased(action) )
  2825.         {
  2826.            
  2827.             if(altSignCasting && !theInput.LastUsedPCInput() && theInput.IsActionPressed('CastSign') && GetWitcherPlayer().IsCurrentSignChanneled())
  2828.             {              
  2829.                 thePlayer.AbortSign();
  2830.             }
  2831.            
  2832.        
  2833.             thePlayer.SetGuarded(false);
  2834.             thePlayer.OnGuardedReleased(); 
  2835.         }
  2836.        
  2837.         if( (thePlayer.IsWeaponHeld('fists') || thePlayer.GetCurrentStateName() == 'CombatFists') && !IsActionAllowed(EIAB_Fists))
  2838.         {
  2839.             thePlayer.DisplayActionDisallowedHudMessage(EIAB_Fists);
  2840.             return false;
  2841.         }
  2842.        
  2843.         if( IsPressed(action) )
  2844.         {
  2845.            
  2846.             if(altSignCasting && !theInput.LastUsedPCInput() && theInput.IsActionPressed('CastSign') && !GetWitcherPlayer().IsCurrentSignChanneled())
  2847.             {
  2848.                 AltCastSign(ST_Igni);
  2849.                 return false;
  2850.             }
  2851.            
  2852.        
  2853.        
  2854.             if( !IsActionAllowed(EIAB_Parry) )
  2855.             {
  2856.                 if ( IsActionBlockedBy(EIAB_Parry,'UsableItem') )
  2857.                 {
  2858.                     thePlayer.DisplayActionDisallowedHudMessage(EIAB_Parry);
  2859.                 }
  2860.                 return true;
  2861.             }
  2862.                
  2863.             if ( thePlayer.GetCurrentStateName() == 'Exploration' )
  2864.                 thePlayer.GoToCombatIfNeeded();
  2865.                
  2866.             if ( thePlayer.bLAxisReleased )
  2867.                 thePlayer.ResetRawPlayerHeading();
  2868.            
  2869.             if ( thePlayer.rangedWeapon && thePlayer.rangedWeapon.GetCurrentStateName() != 'State_WeaponWait' )
  2870.                 thePlayer.OnRangedForceHolster( true, true );
  2871.            
  2872.             thePlayer.AddCounterTimeStamp(theGame.GetEngineTime());
  2873.             thePlayer.SetGuarded(true);            
  2874.             thePlayer.OnPerformGuard();
  2875.         }  
  2876.     }      
  2877.    
  2878.     event OnCbtCameraLockOrSpawnHorse( action : SInputAction )
  2879.     {
  2880.         if ( OnCbtCameraLock(action) )
  2881.             return true;
  2882.            
  2883.         if ( OnCommSpawnHorse(action) )
  2884.             return true;
  2885.            
  2886.         return false;
  2887.     }
  2888.    
  2889.     event OnCbtCameraLock( action : SInputAction )
  2890.     {  
  2891.         if( IsPressed(action) )
  2892.         {
  2893.             if ( thePlayer.IsThreatened() || thePlayer.IsActorLockedToTarget() )
  2894.             {
  2895.                 if( !IsActionAllowed(EIAB_CameraLock))
  2896.                 {
  2897.                     return false;
  2898.                 }
  2899.                 else if ( !thePlayer.IsHardLockEnabled() && thePlayer.GetDisplayTarget() && (CActor)( thePlayer.GetDisplayTarget() ) && IsActionAllowed(EIAB_HardLock))
  2900.                 {  
  2901.                     if ( thePlayer.bLAxisReleased )
  2902.                         thePlayer.ResetRawPlayerHeading();
  2903.                    
  2904.                     thePlayer.HardLockToTarget( true );
  2905.                 }
  2906.                 else
  2907.                 {
  2908.                     thePlayer.HardLockToTarget( false );
  2909.                 }  
  2910.                 return true;
  2911.             }
  2912.         }
  2913.         return false;
  2914.     }
  2915.    
  2916.     event OnChangeCameraPreset( action : SInputAction )
  2917.     {
  2918.         if( IsPressed(action) )
  2919.         {
  2920.             ((CCustomCamera)theCamera.GetTopmostCameraObject()).NextPreset();
  2921.         }
  2922.     }
  2923.    
  2924.     event OnChangeCameraPresetByMouseWheel( action : SInputAction )
  2925.     {
  2926.         var tolerance : float;
  2927.         tolerance = 10.0f;
  2928.        
  2929.         if( ( action.value * totalCameraPresetChange ) < 0.0f )
  2930.         {
  2931.             totalCameraPresetChange = 0.0f;
  2932.         }
  2933.        
  2934.         totalCameraPresetChange += action.value;
  2935.         if( totalCameraPresetChange < -tolerance )
  2936.         {
  2937.             ((CCustomCamera)theCamera.GetTopmostCameraObject()).PrevPreset();
  2938.             totalCameraPresetChange = 0.0f;
  2939.         }
  2940.         else if( totalCameraPresetChange > tolerance )
  2941.         {
  2942.             ((CCustomCamera)theCamera.GetTopmostCameraObject()).NextPreset();
  2943.             totalCameraPresetChange = 0.0f;
  2944.         }
  2945.     }
  2946.    
  2947.     event OnMeditationAbort(action : SInputAction)
  2948.     {
  2949.         var med : W3PlayerWitcherStateMeditation;
  2950.        
  2951.         if (!theGame.GetGuiManager().IsAnyMenu())
  2952.         {
  2953.             med = (W3PlayerWitcherStateMeditation)GetWitcherPlayer().GetCurrentState();
  2954.             if(med)
  2955.             {
  2956.                
  2957.                
  2958.                 med.StopRequested(false);
  2959.             }
  2960.         }
  2961.     }
  2962.    
  2963.     public final function ClearLocksForNGP()
  2964.     {
  2965.         var i : int;
  2966.        
  2967.         for(i=actionLocks.Size()-1; i>=0; i-=1)
  2968.         {          
  2969.             OnActionLockChanged(i, false);
  2970.             actionLocks[i].Clear();
  2971.         }      
  2972.     }
  2973.    
  2974.    
  2975.    
  2976.    
  2977.    
  2978.     public function Dbg_UnlockAllActions()
  2979.     {
  2980.         var i : int;
  2981.        
  2982.         if( theGame.IsFinalBuild() )
  2983.         {
  2984.             return;
  2985.         }
  2986.            
  2987.         for(i=actionLocks.Size()-1; i>=0; i-=1)
  2988.         {          
  2989.             OnActionLockChanged(i, false);
  2990.         }
  2991.         actionLocks.Clear();
  2992.     }
  2993.    
  2994.     event OnDbgSpeedUp( action : SInputAction )
  2995.     {
  2996.         if( theGame.IsFinalBuild() )
  2997.         {
  2998.             return false;
  2999.         }
  3000.        
  3001.         if(IsPressed(action))
  3002.         {
  3003.             theGame.SetTimeScale(4, theGame.GetTimescaleSource(ETS_DebugInput), theGame.GetTimescalePriority(ETS_DebugInput));
  3004.         }
  3005.         else if(IsReleased(action))
  3006.         {
  3007.             theGame.RemoveTimeScale( theGame.GetTimescaleSource(ETS_DebugInput) );
  3008.         }
  3009.     }
  3010.    
  3011.     event OnDbgHit( action : SInputAction )
  3012.     {
  3013.         if( theGame.IsFinalBuild() )
  3014.         {
  3015.             return false;
  3016.         }
  3017.        
  3018.         if(IsReleased(action))
  3019.         {
  3020.             thePlayer.SetBehaviorVariable( 'HitReactionDirection',(int)EHRD_Back);
  3021.             thePlayer.SetBehaviorVariable( 'isAttackReflected', 0 );
  3022.             thePlayer.SetBehaviorVariable( 'HitReactionType', (int)EHRT_Heavy);
  3023.             thePlayer.SetBehaviorVariable( 'HitReactionWeapon', 0);
  3024.             thePlayer.SetBehaviorVariable( 'HitSwingDirection',(int)ASD_LeftRight);
  3025.             thePlayer.SetBehaviorVariable( 'HitSwingType',(int)AST_Horizontal);
  3026.            
  3027.             thePlayer.RaiseForceEvent( 'Hit' );
  3028.             thePlayer.OnRangedForceHolster( true );
  3029.             GetWitcherPlayer().SetCustomRotation( 'Hit', thePlayer.GetHeading()+180, 1080.f, 0.1f, false );
  3030.             thePlayer.CriticalEffectAnimationInterrupted("OnDbgHit");
  3031.         }
  3032.     }
  3033.    
  3034.     event OnDbgKillTarget( action : SInputAction )
  3035.     {
  3036.         var target : CActor;
  3037.        
  3038.         if( theGame.IsFinalBuild() )
  3039.         {
  3040.             return false;
  3041.         }
  3042.        
  3043.         target = thePlayer.GetTarget();
  3044.        
  3045.         if( target && IsReleased(action) )
  3046.         {
  3047.             target.Kill( 'Debug' );
  3048.         }
  3049.     }
  3050.    
  3051.     event OnDbgKillAll( action : SInputAction )
  3052.     {
  3053.         if( theGame.IsFinalBuild() )
  3054.         {
  3055.             return false;
  3056.         }
  3057.        
  3058.         if(IsReleased(action))
  3059.             thePlayer.DebugKillAll();
  3060.     }
  3061.    
  3062.    
  3063.     event OnDbgKillAllTargetingPlayer( action : SInputAction )
  3064.     {
  3065.         var i : int;
  3066.         var all : array<CActor>;
  3067.    
  3068.         if( theGame.IsFinalBuild() )
  3069.         {
  3070.             return false;
  3071.         }
  3072.        
  3073.         if(IsPressed(action))
  3074.         {
  3075.             all = GetActorsInRange(thePlayer, 10000, 10000, '', true);
  3076.             for(i=0; i<all.Size(); i+=1)
  3077.             {
  3078.                 if(all[i] != thePlayer && all[i].GetTarget() == thePlayer)
  3079.                     all[i].Kill( 'Debug' );
  3080.             }
  3081.         }
  3082.     }
  3083.    
  3084.     event OnDbgTeleportToPin( action : SInputAction )
  3085.     {
  3086.         if( theGame.IsFinalBuild() )
  3087.         {
  3088.             return false;
  3089.         }
  3090.        
  3091.         if(IsReleased(action))
  3092.             thePlayer.DebugTeleportToPin();
  3093.     }
  3094.    
  3095.    
  3096.    
  3097.     event OnBoatDismount( action : SInputAction )
  3098.     {
  3099.         var boatComp : CBoatComponent;
  3100.         var stopAction : SInputAction;
  3101.  
  3102.         stopAction = theInput.GetAction('GI_Decelerate');
  3103.        
  3104.         if( IsReleased(action) && ( theInput.LastUsedPCInput() || ( stopAction.value < 0.7 && stopAction.lastFrameValue < 0.7 ) ) )
  3105.         {
  3106.             if( thePlayer.IsActionAllowed( EIAB_DismountVehicle ) )
  3107.             {  
  3108.                 boatComp = (CBoatComponent)thePlayer.GetUsedVehicle().GetComponentByClassName( 'CBoatComponent' );
  3109.                 boatComp.IssueCommandToDismount( DT_normal );
  3110.             }
  3111.             else
  3112.             {
  3113.                 thePlayer.DisplayActionDisallowedHudMessage(EIAB_DismountVehicle);
  3114.             }
  3115.         }
  3116.     }
  3117.    
  3118.    
  3119.    
  3120.    
  3121.    
  3122.     event OnCiriDrawWeapon( action : SInputAction )
  3123.     {
  3124.         var duringCastSign : bool;
  3125.    
  3126.        
  3127.         if ( IsReleased(action) || ( IsPressed(action) && (thePlayer.GetCurrentMeleeWeaponType() == PW_None || thePlayer.GetCurrentMeleeWeaponType() == PW_Fists) ) )
  3128.         {
  3129.             if ( thePlayer.GetBIsInputAllowed() && thePlayer.GetBIsCombatActionAllowed()  )
  3130.             {
  3131.                 if (thePlayer.GetCurrentMeleeWeaponType() == PW_Steel && !thePlayer.IsThreatened() )
  3132.                     thePlayer.OnEquipMeleeWeapon( PW_None, false );
  3133.                 else
  3134.                     thePlayer.OnEquipMeleeWeapon( PW_Steel, false );
  3135.             }
  3136.         }
  3137.         else if(IsReleased(action) || ( IsPressed(action) && (thePlayer.GetCurrentMeleeWeaponType() == PW_Steel || thePlayer.GetCurrentMeleeWeaponType() == PW_Silver) ) )
  3138.         {
  3139.             CiriSheatheWeapon();
  3140.         }
  3141.     }
  3142.    
  3143.     event OnCiriHolsterWeapon( action : SInputAction )
  3144.     {
  3145.         var currWeaponType : EPlayerWeapon;
  3146.        
  3147.         if(IsPressed( action ))
  3148.         {
  3149.             currWeaponType = thePlayer.GetCurrentMeleeWeaponType();
  3150.            
  3151.             if(currWeaponType == PW_Steel || currWeaponType == PW_Silver)
  3152.             {
  3153.                 CiriSheatheWeapon();               
  3154.             }          
  3155.         }
  3156.     }
  3157.    
  3158.     private final function CiriSheatheWeapon()
  3159.     {
  3160.         if ( thePlayer.GetBIsInputAllowed() && thePlayer.GetBIsCombatActionAllowed() && !thePlayer.IsThreatened() )
  3161.         {
  3162.             thePlayer.OnEquipMeleeWeapon( PW_None, false );
  3163.         }
  3164.     }
  3165.    
  3166.    
  3167.    
  3168.    
  3169.     event OnCommHoldFastMenu( action : SInputAction )
  3170.     {
  3171.         if(IsPressed(action))
  3172.         {
  3173.             holdFastMenuInvoked = true;    
  3174.             PushInventoryScreen();
  3175.         }
  3176.     }
  3177.    
  3178.     event OnFastMenu( action : SInputAction )
  3179.     {      
  3180.         if( IsReleased(action) )
  3181.         {
  3182.             if(holdFastMenuInvoked)
  3183.             {
  3184.                 holdFastMenuInvoked = false;
  3185.                 return false;
  3186.             }
  3187.            
  3188.             if ( theGame.IsBlackscreenOrFading() )
  3189.             {
  3190.                 return false;
  3191.             }
  3192.            
  3193.             if (theGame.GetGuiManager().IsAnyMenu())
  3194.             {
  3195.                 return false;
  3196.             }
  3197.            
  3198.             if( IsActionAllowed( EIAB_OpenFastMenu ) )
  3199.             {
  3200.                 theGame.SetMenuToOpen( '' );
  3201.                 theGame.RequestMenu('CommonMenu' );
  3202.             }
  3203.             else
  3204.             {
  3205.                 thePlayer.DisplayActionDisallowedHudMessage(EIAB_OpenFastMenu);
  3206.             }
  3207.         }
  3208.     }
  3209.  
  3210.     event OnIngameMenu( action : SInputAction )
  3211.     {
  3212.         var openedPanel : name;
  3213.         openedPanel = theGame.GetMenuToOpen();
  3214.        
  3215.         if( IsReleased(action)
  3216.             && openedPanel != 'GlossaryTutorialsMenu'
  3217.             && !theGame.GetGuiManager().IsAnyMenu()
  3218.             && !theGame.IsBlackscreenOrFading()
  3219.             && FactsQuerySum("nge_pause_menu_disabled") <= 0 )
  3220.         {
  3221.             theGame.SetMenuToOpen( '' );
  3222.             theGame.RequestMenu('CommonIngameMenu' );
  3223.         }
  3224.     }
  3225.    
  3226.     event OnToggleHud( action : SInputAction )
  3227.     {
  3228.         var hud : CR4ScriptedHud;
  3229.         if ( IsReleased(action) )
  3230.         {
  3231.             hud = (CR4ScriptedHud)theGame.GetHud();
  3232.             if ( hud )
  3233.             {
  3234.                 hud.ToggleHudByUser();
  3235.             }
  3236.         }
  3237.     }
  3238.    
  3239.     public final function Debug_ClearAllActionLocks(optional action : EInputActionBlock, optional all : bool)
  3240.     {
  3241.         var i : int;
  3242.        
  3243.         if(all)
  3244.         {
  3245.             Dbg_UnlockAllActions();        
  3246.         }
  3247.         else
  3248.         {
  3249.             OnActionLockChanged(action, false);
  3250.             actionLocks[action].Clear();
  3251.         }
  3252.     }
  3253. }
  3254.  
Add Comment
Please, Sign In to add comment