lufusol

playerInput.ws for E3 Wolf Follower for Witcher 3 4.01

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