lufusol

playerInput.ws for Friendly Meditation for Witcher 3 4.01

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