Advertisement
Guest User

r4game.ws

a guest
Dec 29th, 2021
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 60.00 KB | None | 0 0
  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.  
  10. import struct SSavegameInfo
  11. {
  12.     import var filename : string;          
  13.     import var slotType : ESaveGameType;   
  14.     import var slotIndex : int;            
  15.                                            
  16. };
  17.  
  18.  
  19. enum Platform
  20. {
  21.     Platform_PC = 0,
  22.     Platform_Xbox1 = 1,
  23.     Platform_PS4 = 2,
  24.     Platform_Unknown = 3
  25. }
  26.  
  27. struct SPostponedPreAttackEvent
  28. {
  29.     var entity      : CGameplayEntity;
  30.     var eventName   : name;
  31.     var eventType   : EAnimationEventType;
  32.     var data        : CPreAttackEventData;
  33.     var animInfo    : SAnimationEventAnimInfo;
  34. };
  35.  
  36. import class CR4Game extends CCommonGame
  37. {
  38.     saved var zoneName : EZoneName;    
  39.     private var gamerProfile : W3GamerProfile;
  40.     private var isDialogOrCutscenePlaying : bool;                  
  41.     private saved var recentDialogOrCutsceneEndGameTime : GameTime;    
  42.     public var isCutscenePlaying : bool;
  43.     public var isDialogDisplayDisabled : bool;
  44.     default isDialogDisplayDisabled = false;
  45.     public var witcherLog : W3GameLog;
  46.     public var deathSaveLockId : int;
  47.     private var currentPresence : name;
  48.     private var restoreUsableItemL : bool;
  49.    
  50.     private saved var savedEnchanterFunds           : int;
  51.     private saved var gameplayFactsForRemoval       : array<SGameplayFactRemoval>;
  52.     private saved var gameplayFacts                 : array<SGameplayFact>;
  53.     private saved var tutorialManagerHandle         : EntityHandle;        
  54.     private saved var diffChangePostponed           : EDifficultyMode;     
  55.     private saved var dynamicallySpawnedBoats       : array<EntityHandle>;     
  56.     private saved var dynamicallySpawnedBoatsToDestroy : array<EntityHandle>;  
  57.    
  58.     private saved var uberMovement : bool;  default uberMovement = false;
  59.    
  60.     function EnableUberMovement( flag : bool )
  61.     {
  62.         uberMovement = flag;
  63.     }
  64.    
  65.     public function IsUberMovementEnabled() : bool
  66.     {
  67.         return uberMovement;
  68.     }  
  69.    
  70.         default diffChangePostponed = EDM_NotSet;
  71.    
  72.    
  73.     import final function ShowSteamControllerBindingPanel() : bool;
  74.    
  75.     import final function ActivateHorseCamera( activate : bool, blendTime : float, optional instantMount : bool );
  76.    
  77.     import final function GetFocusModeController() : CFocusModeController;
  78.    
  79.     public var isRespawningInLastCheckpoint : bool;
  80.     default isRespawningInLastCheckpoint = false;
  81.     private var environmentID : int;
  82.    
  83.     public function SetIsRespawningInLastCheckpoint()
  84.     {
  85.         isRespawningInLastCheckpoint = true;
  86.     }
  87.    
  88.     event  OnGameSaveListUpdated()
  89.     {
  90.         var menuBase    : CR4MenuBase;
  91.         var ingameMenu  : CR4IngameMenu;
  92.        
  93.         menuBase = (CR4MenuBase)(theGame.GetGuiManager().GetRootMenu());
  94.        
  95.         if (menuBase)
  96.         {
  97.             ingameMenu = (CR4IngameMenu)(menuBase.GetSubMenu());
  98.            
  99.             if (ingameMenu)
  100.             {
  101.                 ingameMenu.HandleSaveListUpdate();
  102.             }
  103.         }
  104.     }
  105.    
  106.     event  OnGameLoadInitFinished()
  107.     {
  108.         var requiredContent : array< name >;
  109.         var blockedContentTag : name;
  110.         var i : int;
  111.         var progress : float;
  112.         var loadResult : ELoadGameResult;
  113.         var ingameMenu : CR4IngameMenu;
  114.         var menuBase : CR4MenuBase;
  115.    
  116.         loadResult = GetLoadGameProgress();
  117.         blockedContentTag = 'launch0';
  118.        
  119.         if ( loadResult != LOAD_MissingContent && loadResult != LOAD_Error )
  120.         {
  121.             theSound.SoundEvent("stop_music");
  122.             theSound.SoundEvent("gui_global_game_start");
  123.             theGame.GetGuiManager().RequestMouseCursor(false);
  124.         }
  125.        
  126.         if ( loadResult == LOAD_NotInitialized || loadResult == LOAD_Initializing || loadResult == LOAD_Loading )
  127.         {
  128.             LogChannel( 'Save', "Event OnGameLoadInitFinished() called, but load not initialized / not ready / already loading. DEBUG THIS!" );
  129.             isRespawningInLastCheckpoint = false;
  130.             return true;
  131.         }
  132.        
  133.         if ( loadResult == LOAD_MissingContent )
  134.         {
  135.             GetContentRequiredByLastSave( requiredContent );
  136.            
  137.             theSound.SoundEvent("gui_global_denied");
  138.            
  139.             for ( i = ( requiredContent.Size() - 1 ); i >= 0; i -= 1 )
  140.             {
  141.                 if ( !IsContentAvailable( requiredContent[ i ] ) )
  142.                 {
  143.                     blockedContentTag = requiredContent[ i ];
  144.                     break;
  145.                 }
  146.             }
  147.            
  148.             progress = ProgressToContentAvailable( blockedContentTag );
  149.             GetGuiManager().ShowProgressDialog( UMID_MissingContentOnLoadError, "", "error_message_new_game_not_ready", true, UDB_Ok, progress, UMPT_Content, blockedContentTag );
  150.             isRespawningInLastCheckpoint = false;
  151.            
  152.             menuBase = (CR4MenuBase)(theGame.GetGuiManager().GetRootMenu());
  153.             if (menuBase)
  154.             {
  155.                 ingameMenu = (CR4IngameMenu)(menuBase.GetSubMenu());
  156.                
  157.                 if (ingameMenu)
  158.                 {
  159.                     ingameMenu.HandleLoadGameFailed();
  160.                 }
  161.             }
  162.            
  163.             return true;
  164.         }
  165.        
  166.         if ( loadResult == LOAD_Error )
  167.         {
  168.             menuBase = (CR4MenuBase)(theGame.GetGuiManager().GetRootMenu());
  169.            
  170.             theSound.SoundEvent("gui_global_denied");
  171.            
  172.             if (menuBase)
  173.             {
  174.                 ingameMenu = (CR4IngameMenu)(menuBase.GetSubMenu());
  175.                
  176.                 if (ingameMenu)
  177.                 {
  178.                     ingameMenu.HandleLoadGameFailed();
  179.                 }
  180.             }
  181.         }
  182.  
  183.         if ( loadResult != LOAD_MissingContent && loadResult != LOAD_Error && isRespawningInLastCheckpoint )
  184.         {
  185.             ReleaseNoSaveLock( deathSaveLockId );
  186.             theInput.RestoreContext( 'Exploration', true );
  187.             isRespawningInLastCheckpoint = false;
  188.         }
  189.     }
  190.    
  191.     event  OnGameLoadInitFinishedSuccess()
  192.     {
  193.         GetGuiManager().GetRootMenu().CloseMenu();
  194.     }
  195.    
  196.     public function IsFocusModeActive() : bool
  197.     {
  198.         var focusModeController : CFocusModeController;
  199.         focusModeController = GetFocusModeController();
  200.         if ( focusModeController )
  201.         {
  202.             return focusModeController.IsActive();
  203.         }
  204.         return false;
  205.     }
  206.    
  207.     var logEnabled  : bool;
  208.     default logEnabled = true;
  209.    
  210.     public function EnableLog( enable : bool )
  211.     {
  212.         logEnabled = enable;
  213.     }
  214.    
  215.     public function CanLog() : bool
  216.     {
  217.         return logEnabled && !IsFinalBuild();
  218.     }
  219.        
  220.     import final function GetSurfacePostFX() : CGameplayFXSurfacePost;
  221.    
  222.     import final function GetCommonMapManager() : CCommonMapManager;
  223.  
  224.     import final function GetJournalManager() : CWitcherJournalManager;
  225.  
  226.     import final function GetLootManager() : CR4LootManager;
  227.    
  228.     import final function GetInteractionsManager() : CInteractionsManager;
  229.    
  230.     import final function GetCityLightManager() : CCityLightManager;   
  231.    
  232.     import final function GetSecondScreenManager() : CR4SecondScreenManagerScriptProxy;
  233.        
  234.     import final function GetGuiManager() : CR4GuiManager;
  235.  
  236.     import final function GetGlobalEventsScriptsDispatcher() : CR4GlobalEventsScriptsDispatcher;
  237.    
  238.     import final function GetFastForwardSystem() : CGameFastForwardSystem;
  239.    
  240.     import final function NotifyOpeningJournalEntry( jorunalEntry : CJournalBase );
  241.    
  242.     var globalEventsScriptsDispatcherInternal : CR4GlobalEventsScriptsDispatcher;
  243.     public function GetGlobalEventsManager() : CR4GlobalEventsScriptsDispatcher
  244.     {
  245.         if ( !globalEventsScriptsDispatcherInternal )
  246.         {
  247.             globalEventsScriptsDispatcherInternal = GetGlobalEventsScriptsDispatcher();
  248.         }
  249.         return globalEventsScriptsDispatcherInternal;
  250.     }
  251.        
  252.    
  253.     import final function StartSepiaEffect( fadeInTime: float ) : bool;
  254.    
  255.    
  256.     import final function StopSepiaEffect( fadeOutTime: float ) : bool;
  257.    
  258.    
  259.     import final function GetWindAtPoint( point : Vector ) : Vector;
  260.    
  261.     import final function GetWindAtPointForVisuals( point : Vector ) : Vector;
  262.    
  263.     import final function GetGameCamera() : CCustomCamera;
  264.    
  265.    
  266.     import final function GetBuffImmunitiesForActor( actor : CActor ) : CBuffImmunity;
  267.     import final function GetMonsterParamsForActor( actor : CActor, out monsterCategory : EMonsterCategory, out soundMonsterName : CName, out isTeleporting : bool, out canBeTargeted : bool, out canBeHitByFists : bool ) : bool;
  268.     import final function GetMonsterParamForActor( actor : CActor, out val : CMonsterParam ) : bool;
  269.    
  270.    
  271.     import final function GetVolumePathManager() : CVolumePathManager;
  272.    
  273.    
  274.     import final function SummonPlayerHorse( teleportToSafeSpot : bool, createEntityHelper : CR4CreateEntityHelper );
  275.  
  276.    
  277.     import final function ToggleMenus();
  278.     import final function ToggleInput();
  279.    
  280.     import final function GetResourceAliases( out aliases : array< string > );
  281.    
  282.    
  283.     import final function GetKinectSpeechRecognizer() : CR4KinectSpeechRecognizerListenerScriptProxy;
  284.    
  285.    
  286.     import final function GetTutorialSystem() : CR4TutorialSystem;
  287.    
  288.    
  289.     import final function DisplaySystemHelp();
  290.     import final function DisplayStore();
  291.     import final function DisplayUserProfileSystemDialog();
  292.     import final function SetRichPresence( presence : name );
  293.  
  294.    
  295.     import final function OnUserDialogCallback( message, action : int );
  296.    
  297.    
  298.     import final function SaveUserSettings();
  299.    
  300.    
  301.    
  302.     //modSigns
  303.     public final function gmUserSettingsScaling()
  304.     {
  305.         var i : int;
  306.         var all : array<CActor>;
  307.        
  308.         all = GetActorsInRange(thePlayer, 10000.f, 10000, '', true);
  309.         for(i = 0; i < all.Size(); i += 1)
  310.         {
  311.             if((CNewNPC)all[i])
  312.                 ((CNewNPC)all[i]).ResetLevel();
  313.         }
  314.     }
  315.  
  316.     //modSigns
  317.     public final function gmUserSettingsQuestLevels()
  318.     {
  319.         LoadQuestLevels( "gameplay\globals\quest_levels.csv" );
  320.         if(theGame.GetDLCManager().IsEP1Enabled())
  321.             LoadQuestLevels( "dlc\ep1\data\gameplay\globals\quest_levels.csv" );
  322.         if(theGame.GetDLCManager().IsEP2Enabled())
  323.             LoadQuestLevels( "dlc\bob\data\gameplay\globals\quest_levels.csv" );
  324.     }
  325.  
  326.     //modSigns
  327.     public final function gmUserSettingsGameplay()
  328.     {
  329.         params.gmResetCachedValuesGameplay();
  330.         gmUpdateRegenEffects();
  331.     }
  332.  
  333.     //modSigns
  334.     public final function gmUserSettingsQoL()
  335.     {
  336.         params.gmResetCachedValuesQoL();
  337.         thePlayer.StopLowStaminaSFX();
  338.         thePlayer.CheckForLowStamina();
  339.     }
  340.    
  341.    
  342.    
  343.     public final function UpdateRichPresence(presence : name)
  344.     {
  345.         SetRichPresence(presence);
  346.         currentPresence = presence;
  347.     }
  348.    
  349.     public final function ClearRichPresence(presence : name)
  350.     {
  351.         var manager: CCommonMapManager;
  352.         var currentArea : EAreaName;
  353.        
  354.        
  355.         if(currentPresence == presence)
  356.         {
  357.             manager = theGame.GetCommonMapManager();
  358.             currentArea = manager.GetCurrentJournalArea();
  359.             currentPresence =  manager.GetLocalisationNameFromAreaType( currentArea );
  360.             SetRichPresence(currentPresence);
  361.            
  362.         }
  363.     }
  364.    
  365.    
  366.     import var params : W3GameParams;
  367.  
  368.     private var minimapSettings : C2dArray;
  369.     public var playerStatisticsSettings : C2dArray;
  370.     public var hudSettings : C2dArray;
  371.  
  372.    
  373.     public var damageMgr : W3DamageManager;
  374.  
  375.    
  376.     public var effectMgr : W3GameEffectManager;
  377.    
  378.    
  379.     private var timescaleSources : array<STimescaleSource>;
  380.  
  381.    
  382.     public saved var envMgr : W3EnvironmentManager;
  383.    
  384.     public var runewordMgr : W3RunewordManager;
  385.    
  386.     private var questLevelsFilePaths : array<string>;
  387.     public var questLevelsContainer : array<C2dArray>;
  388.     public var expGlobalModifiers : C2dArray;
  389.     public var expGlobalMod_kills : float;
  390.     public var expGlobalMod_quests : float;
  391.    
  392.    
  393.     private var syncAnimManager : W3SyncAnimationManager;
  394.     public function GetSyncAnimManager() : W3SyncAnimationManager
  395.     {
  396.         if( !syncAnimManager )
  397.         {
  398.             syncAnimManager = new W3SyncAnimationManager in this;
  399.         }
  400.        
  401.         return syncAnimManager;
  402.     }
  403.    
  404.    
  405.    
  406.    
  407.     public function SetEnvironmentID( id : int )
  408.     {
  409.         environmentID = id;
  410.     }
  411.    
  412.     private function SetTimescaleSources()
  413.     {
  414.         timescaleSources.Clear();
  415.         timescaleSources.Grow( EnumGetMax('ETimescaleSource') + 1 );
  416.  
  417.        
  418.         timescaleSources[ ETS_PotionBlizzard ].sourceType = ETS_PotionBlizzard;
  419.         timescaleSources[ ETS_PotionBlizzard ].sourceName = 'PotionBlizzard';
  420.         timescaleSources[ ETS_PotionBlizzard ].sourcePriority = 10;
  421.        
  422.        
  423.         timescaleSources[ ETS_SlowMoTask ].sourceType = ETS_SlowMoTask;
  424.         timescaleSources[ ETS_SlowMoTask ].sourceName = 'SlowMotionTask';
  425.         timescaleSources[ ETS_SlowMoTask ].sourcePriority = 15;
  426.        
  427.        
  428.         timescaleSources[ ETS_HeavyAttack ].sourceType = ETS_HeavyAttack;
  429.         timescaleSources[ ETS_HeavyAttack ].sourceName = 'HeavyAttack';
  430.         timescaleSources[ ETS_HeavyAttack ].sourcePriority = 15;
  431.        
  432.        
  433.         timescaleSources[ ETS_ThrowingAim ].sourceType = ETS_ThrowingAim;
  434.         timescaleSources[ ETS_ThrowingAim ].sourceName = 'ThrowingAim';
  435.         timescaleSources[ ETS_ThrowingAim ].sourcePriority = 15;
  436.        
  437.        
  438.         timescaleSources[ ETS_RaceSlowMo ].sourceType = ETS_RaceSlowMo;
  439.         timescaleSources[ ETS_RaceSlowMo ].sourceName = 'RaceSlowMo';
  440.         timescaleSources[ ETS_RaceSlowMo ].sourcePriority = 10;
  441.        
  442.        
  443.         timescaleSources[ ETS_RadialMenu ].sourceType = ETS_RadialMenu;
  444.         timescaleSources[ ETS_RadialMenu ].sourceName = 'RadialMenu';
  445.         timescaleSources[ ETS_RadialMenu ].sourcePriority = 20;
  446.        
  447.        
  448.         timescaleSources[ ETS_CFM_PlayAnim ].sourceType = ETS_CFM_PlayAnim;
  449.         timescaleSources[ ETS_CFM_PlayAnim ].sourceName = 'CFM_PlayAnim';
  450.         timescaleSources[ ETS_CFM_PlayAnim ].sourcePriority = 25;
  451.        
  452.        
  453.         timescaleSources[ ETS_CFM_On ].sourceType = ETS_CFM_On;
  454.         timescaleSources[ ETS_CFM_On ].sourceName = 'CFM_On';
  455.         timescaleSources[ ETS_CFM_On ].sourcePriority = 20;
  456.        
  457.        
  458.         timescaleSources[ ETS_DebugInput ].sourceType = ETS_DebugInput;
  459.         timescaleSources[ ETS_DebugInput ].sourceName = 'debug_input';
  460.         timescaleSources[ ETS_DebugInput ].sourcePriority = 30;
  461.        
  462.        
  463.         timescaleSources[ ETS_SkillFrenzy ].sourceType = ETS_SkillFrenzy;
  464.         timescaleSources[ ETS_SkillFrenzy ].sourceName = 'skill_frenzy';
  465.         timescaleSources[ ETS_SkillFrenzy ].sourcePriority = 15;
  466.        
  467.        
  468.         timescaleSources[ ETS_HorseMelee ].sourceType = ETS_HorseMelee;
  469.         timescaleSources[ ETS_HorseMelee ].sourceName = 'horse_melee';
  470.         timescaleSources[ ETS_HorseMelee ].sourcePriority = 15;
  471.        
  472.        
  473.         timescaleSources[ ETS_FinisherInput ].sourceType = ETS_FinisherInput;
  474.         timescaleSources[ ETS_FinisherInput ].sourceName = 'finisher_input';
  475.         timescaleSources[ ETS_FinisherInput ].sourcePriority = 15;
  476.        
  477.        
  478.         timescaleSources[ ETS_TutorialFight ].sourceType = ETS_TutorialFight;
  479.         timescaleSources[ ETS_TutorialFight ].sourceName = 'tutorial_fight';
  480.         timescaleSources[ ETS_TutorialFight ].sourcePriority = 25;
  481.        
  482.        
  483.         timescaleSources[ ETS_InstantKill ].sourceType = ETS_InstantKill;
  484.         timescaleSources[ ETS_InstantKill ].sourceName = 'instant_kill';
  485.         timescaleSources[ ETS_InstantKill ].sourcePriority = 5;
  486.     }
  487.    
  488.     public function GetTimescaleSource(src : ETimescaleSource) : name
  489.     {
  490.         return timescaleSources[src].sourceName;
  491.     }
  492.    
  493.     public function GetTimescalePriority(src : ETimescaleSource) : int
  494.     {
  495.         return timescaleSources[src].sourcePriority;
  496.     }
  497.    
  498.     private function UpdateSecondScreen()
  499.     {
  500.         var areaMapPins             : array< SAreaMapPinInfo >;
  501.         var areaMapPinsCount        : int;
  502.         var index_areas             : int;
  503.         var worldPath               : string;
  504.         var localMapPins            : array< SCommonMapPinInstance >;
  505.         var globalMapPins           : array< SCommonMapPinInstance >;
  506.         var mapPin                  : SCommonMapPinInstance;
  507.    
  508.         areaMapPins         = GetCommonMapManager().GetAreaMapPins();
  509.         areaMapPinsCount    = areaMapPins.Size();
  510.         for ( index_areas = 0; index_areas < areaMapPinsCount; index_areas += 1 )
  511.         {      
  512.             mapPin.id = areaMapPins[ index_areas ].areaType;
  513.             mapPin.tag = '0';
  514.             mapPin.type = 'WorldMap';
  515.             mapPin.position = areaMapPins[ index_areas ].position;
  516.             mapPin.isDiscovered = true;
  517.             globalMapPins.PushBack( mapPin );
  518.            
  519.             localMapPins    = GetCommonMapManager().GetMapPinInstances( areaMapPins[ index_areas ].worldPath );
  520.             GetSecondScreenManager().SendAreaMapPins( areaMapPins[ index_areas ].areaType, localMapPins );         
  521.         }      
  522.        
  523.         GetSecondScreenManager().SendGlobalMapPins( globalMapPins );   
  524.     }
  525.    
  526.    
  527.     import final function GetPlatform():int;
  528.    
  529.     private var isSignedIn:bool;
  530.     default isSignedIn = false;
  531.    
  532.     public function isUserSignedIn():bool
  533.     {
  534.         if (GetPlatform() == Platform_PC)
  535.         {
  536.             return true;
  537.         }
  538.         else
  539.         {
  540.             return isSignedIn;
  541.         }
  542.     }
  543.    
  544.     event OnUserSignedIn()
  545.     {
  546.         isSignedIn = true;
  547.        
  548.         GetGuiManager().OnSignIn();
  549.     }
  550.    
  551.     event OnUserSignedOut()
  552.     {
  553.         isSignedIn = false;
  554.        
  555.         GetGuiManager().OnSignOut();
  556.     }
  557.    
  558.     event OnSignInStarted()
  559.     {
  560.         GetGuiManager().OnSignInStarted();
  561.     }
  562.    
  563.     event OnSignInCancelled()
  564.     {
  565.         GetGuiManager().OnSignInCancelled();
  566.     }
  567.    
  568.     import final function SetActiveUserPromiscuous();
  569.    
  570.     import final function ChangeActiveUser();
  571.    
  572.     import final function GetActiveUserDisplayName() : string;
  573.    
  574.    
  575.     import final function IsContentAvailable( content : name ) : bool;
  576.    
  577.    
  578.     import final function ProgressToContentAvailable( content : name ) : int;
  579.    
  580.     import final function ShouldForceInstallVideo() : bool;
  581.    
  582.     import final function IsDebugQuestMenuEnabled() : bool;
  583.    
  584.    
  585.     import final function EnableNewGamePlus( enable : bool );
  586.    
  587.    
  588.     import final function StartNewGamePlus( save : SSavegameInfo ) : ENewGamePlusStatus;
  589.    
  590.     public function OnConfigValueChanged( varName : name, value : string ) : void
  591.     {
  592.         var kinect : CR4KinectSpeechRecognizerListenerScriptProxy;
  593.         kinect = GetKinectSpeechRecognizer();
  594.        
  595.         if ( varName == 'Kinect' )
  596.         {
  597.             if ( value == "true" )
  598.                 kinect.SetEnabled( true );
  599.             else
  600.                 kinect.SetEnabled( false );
  601.         }
  602.     }
  603.    
  604.     public function LoadQuestLevels( filePath: string ) : void
  605.     {  
  606.         var index : int;   
  607.        
  608.         //modSigns: no quest levels option
  609.         if( theGame.params.GetNoQuestLevels() )
  610.         {
  611.             questLevelsFilePaths.Clear();
  612.             questLevelsContainer.Clear();
  613.             return;
  614.         }
  615.        
  616.         index = questLevelsFilePaths.FindFirst( filePath );    
  617.         if( index == -1 )
  618.         {      
  619.             questLevelsFilePaths.PushBack( filePath ); 
  620.             questLevelsContainer.PushBack( LoadCSV( filePath ) );
  621.         }
  622.     }
  623.    
  624.     public function UnloadQuestLevels( filePath: string ) : void
  625.     {  
  626.         var index : int;   
  627.         index = questLevelsFilePaths.FindFirst( filePath );    
  628.         if( index != -1 )
  629.         {
  630.             questLevelsFilePaths.Erase( index );   
  631.             questLevelsContainer.Erase( index );
  632.         }        
  633.     }
  634.    
  635.     event OnGameStarting(restored : bool )
  636.     {
  637.         var diff : int;
  638.    
  639.         if(!restored)
  640.         {
  641.            
  642.             gameplayFacts.Clear();
  643.             gameplayFactsForRemoval.Clear();
  644.         }
  645.        
  646.         if (!FactsDoesExist("lowest_difficulty_used") || GetLowestDifficultyUsed() == EDM_NotSet)
  647.         {
  648.             SetLowestDifficultyUsed(GetDifficultyLevel());
  649.         }
  650.            
  651.         SetHoursPerMinute(0.25);   
  652.         SetTimescaleSources();
  653.        
  654.        
  655.         isDialogOrCutscenePlaying = false;
  656.    
  657.        
  658.         params.Init();
  659.        
  660.        
  661.         witcherLog = new W3GameLog in this;
  662.                
  663.         InitGamerProfile();
  664.            
  665.        
  666.         damageMgr = new W3DamageManager in this;
  667.  
  668.         tooltipSettings = LoadCSV("gameplay\globals\tooltip_settings.csv");
  669.         minimapSettings = LoadCSV("gameplay\globals\minimap_settings.csv");
  670.         LoadHudSettings();
  671.         playerStatisticsSettings = LoadCSV("gameplay\globals\player_statistics_settings.csv");
  672.                    
  673.         LoadQuestLevels( "gameplay\globals\quest_levels.csv" );      
  674.        
  675.         expGlobalModifiers = LoadCSV("gameplay\globals\exp_mods.csv");
  676.         expGlobalMod_kills = StringToFloat( expGlobalModifiers.GetValueAt(0,0) );
  677.         expGlobalMod_quests = StringToFloat( expGlobalModifiers.GetValueAt(1,0) );
  678.        
  679.         InitializeEffectManager();
  680.  
  681.         envMgr = new W3EnvironmentManager in this;
  682.         envMgr.Initialize();
  683.        
  684.         runewordMgr = new W3RunewordManager in this;
  685.         runewordMgr.Init();
  686.        
  687.         theGame.RequestPopup( 'OverlayPopup' );
  688.        
  689.         theSound.Initialize(); 
  690.         if(IsLoadingScreenVideoPlaying())
  691.         {
  692.             theSound.EnterGameState(ESGS_Movie);
  693.         }
  694.     }
  695.        
  696.     private function InitGamerProfile()
  697.     {
  698.         gamerProfile = new W3GamerProfile in this;
  699.         gamerProfile.Init();
  700.     }
  701.    
  702.     public function GetGamerProfile() : W3GamerProfile
  703.     {
  704.        
  705.         if(!gamerProfile)
  706.             InitGamerProfile();
  707.        
  708.         return gamerProfile;
  709.     }
  710.    
  711.     public function OnTick()
  712.     {
  713.         if(envMgr)
  714.             envMgr.Update();
  715.            
  716.        
  717.         if(diffChangePostponed != EDM_NotSet && thePlayer)
  718.         {
  719.             OnDifficultyChanged(diffChangePostponed);
  720.             diffChangePostponed = EDM_NotSet;
  721.         }
  722.        
  723.         FirePostponedPreAttackEvents();
  724.     }  
  725.    
  726.     event OnGameStarted(restored : bool)
  727.     {
  728.         var focusModeController : CFocusModeController;
  729.        
  730.         focusModeController = GetFocusModeController();
  731.        
  732.         if( !restored )
  733.         {
  734.            
  735.             if(FactsQuerySum("started_new_game") <= 0)
  736.             {
  737.                 thePlayer.displayedQuestsGUID.Clear();
  738.  
  739.                 dynamicallySpawnedBoats.Clear();
  740.                 FactsAdd("started_new_game", 1);
  741.             }
  742.         }
  743.        
  744.         if ( FactsQuerySum( "q704_long_night_starts" ) == 0 )
  745.         {
  746.             GetWorld().HideLayerGroup( "quests\main_quests\q704_the_truth\q704_vampires\custom_land_borders" );
  747.         }
  748.        
  749.         if ( focusModeController )
  750.         {
  751.             focusModeController.OnGameStarted();
  752.         }
  753.    
  754.         GetCommonMapManager().OnGameStarted();
  755.        
  756.        
  757.         ClearRichPresence(currentPresence);    
  758.  
  759.         theSound.InitializeAreaMusic( GetCommonMapManager().GetCurrentArea() );
  760.         UpdateSecondScreen();
  761.        
  762.         if( thePlayer && thePlayer.teleportedOnBoatToOtherHUB )
  763.         {
  764.             thePlayer.SetTeleportedOnBoatToOtherHUB( false );
  765.             thePlayer.AddTimer( 'DelayedSpawnAndMountBoat', 0.001f, false );
  766.         }
  767.     }
  768.    
  769.     event OnHandleWorldChange()
  770.     {
  771.         thePlayer.SetTeleportedOnBoatToOtherHUB( true );
  772.     }
  773.  
  774.    
  775.     event OnBeforeWorldChange( worldName : string )
  776.     {
  777.        
  778.         var manager : CCommonMapManager = theGame.GetCommonMapManager();
  779.         if ( manager )
  780.         {
  781.             manager.CacheMapPins();
  782.             manager.ForceSettingLoadingScreenVideoForWorld( worldName );
  783.         }
  784.  
  785.        
  786.         thePlayer.SetUsedVehicle( NULL );
  787.     }
  788.    
  789.     event OnAfterLoadingScreenGameStart()
  790.     {
  791.         var tut : STutorialMessage;
  792.        
  793.        
  794.         theSound.LeaveGameState(ESGS_Movie);
  795.        
  796.        
  797.         theSound.SoundEvent("system_resume");
  798.        
  799.        
  800.         if(ShouldProcessTutorial('TutorialStash') && FactsQuerySum("tut_stash_fresh_playthrough") <= 0)
  801.         {          
  802.            
  803.             tut.type = ETMT_Message;
  804.             tut.tutorialScriptTag = 'TutorialStash';
  805.             tut.canBeShownInMenus = false;
  806.             tut.glossaryLink = false;
  807.             tut.markAsSeenOnShow = true;
  808.            
  809.            
  810.             theGame.GetTutorialSystem().DisplayTutorial(tut);
  811.         }
  812.     }
  813.    
  814.     event  OnSaveStarted( type : ESaveGameType )
  815.     {
  816.         LogChannel( 'Savegame', "OnSaveStarted " + type );
  817.        
  818.     }
  819.  
  820.     event  OnSaveCompleted( type : ESaveGameType, succeeded : bool )
  821.     {
  822.         var hud : CR4ScriptedHud;
  823.         var text : string;
  824.  
  825.         LogChannel( 'Savegame', "OnSaveCompleted " + type + " " + succeeded );
  826.        
  827.         if ( succeeded )
  828.         {
  829.             theGame.GetGuiManager().ShowSavingIndicator();
  830.             theGame.GetGuiManager().HideSavingIndicator();
  831.        
  832.             if (theGame.GetPlatform() == Platform_Xbox1)
  833.             {
  834.                 text = "panel_hud_message_gamesaved_X1";
  835.             }
  836.             else if (theGame.GetPlatform() == Platform_PS4)
  837.             {
  838.                 text = "panel_hud_message_gamesaved_PS4";
  839.             }
  840.             else
  841.             {
  842.                 text = "panel_hud_message_gamesaved";
  843.             }
  844.            
  845.             if ( type == SGT_AutoSave || type == SGT_CheckPoint || type == SGT_ForcedCheckPoint )
  846.             {
  847.                 hud = ( CR4ScriptedHud )GetHud();
  848.                 if ( hud )
  849.                 {
  850.                     hud.HudConsoleMsg( GetLocStringByKeyExt(text) );
  851.                 }
  852.             }
  853.             else
  854.             {
  855.                 thePlayer.DisplayHudMessage( text );
  856.             }
  857.         }
  858.         else if ( type == SGT_QuickSave || type == SGT_Manual )
  859.         {
  860.             if (theGame.GetPlatform() == Platform_Xbox1)
  861.             {
  862.                 text = "panel_hud_message_gamesavedfailed_X1"; 
  863.             }
  864.             else if (theGame.GetPlatform() == Platform_PS4)
  865.             {
  866.                 text = "panel_hud_message_gamesavedfailed_PS4";
  867.             }
  868.             else
  869.             {
  870.                 text = "panel_hud_message_gamesavedfailed";
  871.             }
  872.            
  873.             theGame.GetGuiManager().ShowUserDialog(0, "", text, UDB_Ok);
  874.         }
  875.     }
  876.  
  877.     event OnControllerReconnected()
  878.     {
  879.         if(!theGame.IsBlackscreen() && theGame.IsActive())
  880.         {
  881.             if(theGame.GetGuiManager().IsAnyMenu())
  882.             {
  883.                 theSound.SoundEvent("system_resume_music_only");
  884.             }
  885.             else
  886.             {
  887.                 theSound.SoundEvent("system_resume");
  888.             }
  889.         }
  890.        
  891.         GetGuiManager().OnControllerReconnected();
  892.     }
  893.    
  894.     event OnControllerDisconnected()
  895.     {
  896.         if(!theGame.IsBlackscreen() && theGame.IsActive() && !theGame.GetGuiManager().IsAnyMenu())
  897.         {
  898.            
  899.             theSound.SoundEvent("system_pause");
  900.         }
  901.        
  902.         GetGuiManager().OnControllerDisconnected();
  903.     }
  904.    
  905.     //modSigns: reworked
  906.     event OnGiveReward( target : CEntity, rewardName : name, rewrd : SReward )
  907.     {
  908.         var i                       : int;
  909.         var itemCount               : int;
  910.         var gameplayEntity          : CGameplayEntity;
  911.         var inv                     : CInventoryComponent;
  912.         var goldMultiplier          : float;
  913.         var itemMultiplier          : float;
  914.         var itemsCount              : int;
  915.         var ids                     : array<SItemUniqueId>;
  916.         var itemCategory            : name;
  917.         var moneyWon                : int;
  918.         var rewardMultData          : SRewardMultiplier;
  919.         var lvlDiff                 : int;
  920.         var playerLevel, rewardLevel: int;
  921.         var expModifier             : float;
  922.         var expPoints               : int;
  923.        
  924.         if ( target == thePlayer )
  925.         {
  926.             // exp
  927.             if ( rewrd.experience > 0 && GetWitcherPlayer())
  928.             {
  929.                 expModifier = 1.f; //start with 100% exp
  930.                 playerLevel = thePlayer.GetLevel();
  931.                 if(FactsQuerySum("NewGamePlus") > 0) //reward levels are set for base game
  932.                     playerLevel -= params.GetNewGamePlusLevel(); //decrease player level for NG+
  933.                 if(theGame.params.GetNoQuestLevels()) //no quest levels option
  934.                     rewardLevel = 0;
  935.                 else
  936.                     rewardLevel = rewrd.level;
  937.                 if(theGame.params.GetFixedExp() == false && rewardLevel > 0) //default exp option
  938.                 {
  939.                     lvlDiff = rewardLevel - playerLevel; //level difference: negative for low level quests, positive for hight level quests
  940.                     //lower lever quests give increasingly less exp and higher level quests give more
  941.                     expModifier += lvlDiff * theGame.params.LEVEL_DIFF_XP_MOD;
  942.                     //0% min, 150% max
  943.                     expModifier = ClampF(expModifier, 0, theGame.params.MAX_XP_MOD);
  944.             }
  945.                 //calculate exp
  946.                 expPoints = RoundMath(rewrd.experience * expGlobalMod_quests * expModifier);
  947.                 //always get at least 5 exp
  948.                 expPoints = Max(5, expPoints);
  949.                 //final exp modifier
  950.                 if( theGame.params.GetQuestExpModifier() != 0 )
  951.                     expPoints = RoundMath(expPoints * (1 + theGame.params.GetQuestExpModifier()));
  952.                 GetWitcherPlayer().AddPoints(EExperiencePoint, expPoints, true);
  953.            
  954.             if ( rewrd.achievement > 0 )
  955.             {
  956.                 theGame.GetGamerProfile().AddAchievement( rewrd.achievement );
  957.             }
  958.         }
  959.        
  960.         gameplayEntity = (CGameplayEntity)target;
  961.         if ( gameplayEntity )
  962.         {
  963.             inv = gameplayEntity.GetInventory();
  964.             if ( inv )
  965.             {
  966.                 rewardMultData = thePlayer.GetRewardMultiplierData( rewardName );
  967.                 //modSigns: debug
  968.                 //theGame.witcherLog.AddMessage("rewardName = " + rewardMultData.rewardName);
  969.                
  970.                 if( rewardMultData.isItemMultiplier )
  971.                 {
  972.                     goldMultiplier = 1.0;
  973.                     itemMultiplier = rewardMultData.rewardMultiplier;
  974.                     //modSigns: debug
  975.                     //theGame.witcherLog.AddMessage("itemMultiplier = " + rewardMultData.rewardMultiplier);
  976.                 }
  977.                 else
  978.                 {
  979.                     goldMultiplier = rewardMultData.rewardMultiplier;
  980.                     itemMultiplier = 1.0;
  981.                     //modSigns: debug
  982.                     //theGame.witcherLog.AddMessage("goldMultiplier = " + rewardMultData.rewardMultiplier);
  983.                 }
  984.                
  985.                
  986.                 if ( rewrd.gold > 0 )
  987.                 {
  988.                     inv.AddMoney( (int)(rewrd.gold * goldMultiplier) );
  989.                     thePlayer.RemoveRewardMultiplier(rewardName);      
  990.                     if( target == thePlayer )
  991.                     {
  992.                         moneyWon = (int)(rewrd.gold * goldMultiplier);
  993.                        
  994.                         if ( moneyWon > 0 )
  995.                             thePlayer.DisplayItemRewardNotification('Crowns', moneyWon );
  996.                     }
  997.                 }
  998.                
  999.                
  1000.                
  1001.                 for ( i = 0; i < rewrd.items.Size(); i += 1 )
  1002.                 {
  1003.                     itemsCount = RoundF( rewrd.items[ i ].amount * itemMultiplier );
  1004.                    
  1005.                     if( itemsCount > 0 )
  1006.                     {
  1007.                         ids = inv.AddAnItem( rewrd.items[ i ].item, itemsCount );
  1008.                        
  1009.                         for ( itemCount = 0; itemCount < ids.Size(); itemCount += 1 )
  1010.                         {
  1011.                            
  1012.                             if ( inv.ItemHasTag( ids[i], 'Autogen' ) && GetWitcherPlayer().GetLevel() - 1 > 1 )
  1013.                             {
  1014.                                 inv.GenerateItemLevel( ids[i], true );
  1015.                             }
  1016.                         }
  1017.                        
  1018.                         itemCategory = inv.GetItemCategory( ids[0] );
  1019.                         if ( itemCategory == 'alchemy_recipe' ||  itemCategory == 'crafting_schematic' )
  1020.                         {
  1021.                             inv.ReadSchematicsAndRecipes( ids[0] );
  1022.                         }                      
  1023.                        
  1024.                         if(target == thePlayer)
  1025.                         {
  1026.                            
  1027.                             if( !inv.ItemHasTag( ids[0], 'GwintCard') )
  1028.                             {
  1029.                                 thePlayer.DisplayItemRewardNotification(rewrd.items[ i ].item, RoundF( rewrd.items[ i ].amount * itemMultiplier ) );
  1030.                             }
  1031.                         }
  1032.                     }
  1033.                 }
  1034.             }
  1035.         }
  1036.     }
  1037.  
  1038.     public function IsEffectManagerInitialized() : bool
  1039.     {
  1040.         if(!effectMgr)
  1041.             return false;
  1042.        
  1043.         return effectMgr.IsReady();
  1044.     }
  1045.    
  1046.     public function InitializeEffectManager()
  1047.     {
  1048.         effectMgr = new W3GameEffectManager in this;
  1049.         effectMgr.Initialize();
  1050.     }
  1051.    
  1052.     public function GetLowestDifficultyUsed() : EDifficultyMode
  1053.     {
  1054.         return FactsQuerySum("lowest_difficulty_used");
  1055.     }
  1056.    
  1057.     public function SetLowestDifficultyUsed(d : EDifficultyMode)
  1058.     {
  1059.         FactsSet("lowest_difficulty_used", (int)d);
  1060.     }
  1061.    
  1062.    
  1063.     event OnGameEnded()
  1064.     {  
  1065.         var focusModeController : CFocusModeController;
  1066.        
  1067.         if ( runewordMgr )
  1068.         {
  1069.             delete runewordMgr;
  1070.             runewordMgr = NULL;
  1071.         }
  1072.        
  1073.         focusModeController = GetFocusModeController();
  1074.         if ( focusModeController )
  1075.         {
  1076.             focusModeController.OnGameEnded();
  1077.         }
  1078.        
  1079.         DeactivateEnvironment( environmentID, 0 );
  1080.            
  1081.         if(effectMgr)
  1082.         {
  1083.             delete effectMgr;
  1084.             effectMgr = NULL;
  1085.         }
  1086.        
  1087.         if(envMgr)
  1088.         {
  1089.             delete envMgr;
  1090.             envMgr = NULL;
  1091.         }
  1092.        
  1093.         if( syncAnimManager )
  1094.         {
  1095.             delete syncAnimManager;
  1096.             syncAnimManager = NULL;
  1097.         }
  1098.        
  1099.         RemoveTimeScale( GetTimescaleSource(ETS_RadialMenu) );
  1100.  
  1101.        
  1102.         theSound.Finalize();
  1103.        
  1104.        
  1105.         LogChannel( 'HUD', "GUI Closed" );
  1106.     }
  1107.        
  1108.     public var m_runReactionSceneDialog : bool;
  1109.     public function SetRunReactionSceneDialog( val : bool ){ m_runReactionSceneDialog = val; }
  1110.    
  1111.     public function SetIsDialogOrCutscenePlaying(b : bool)
  1112.     {
  1113.         var witcher         : W3PlayerWitcher;
  1114.         var activePoster    : W3Poster;
  1115.         var hud             : CR4ScriptedHud;
  1116.         var radialModule    : CR4HudModuleRadialMenu;
  1117.         var lootPopup       : CR4LootPopup;
  1118.         var bolts           : SItemUniqueId;
  1119.        
  1120.         isDialogOrCutscenePlaying = b;
  1121.         recentDialogOrCutsceneEndGameTime = GetGameTime();
  1122.        
  1123.         if ( b)
  1124.         {
  1125.             hud = (CR4ScriptedHud)GetHud();
  1126.    
  1127.             if( hud )
  1128.             {
  1129.                 radialModule = (CR4HudModuleRadialMenu)hud.GetHudModule("RadialMenuModule");
  1130.                 if (radialModule && radialModule.IsRadialMenuOpened())
  1131.                 {
  1132.                     radialModule.HideRadialMenu();
  1133.                 }
  1134.             }
  1135.            
  1136.             lootPopup = (CR4LootPopup)GetGuiManager().GetPopup('LootPopup');
  1137.            
  1138.             if (lootPopup)
  1139.             {
  1140.                 lootPopup.ClosePopup();
  1141.             }
  1142.         }
  1143.        
  1144.         if(theGame.GetTutorialSystem() && theGame.GetTutorialSystem().IsRunning())
  1145.         {
  1146.             theGame.GetTutorialSystem().OnCutsceneOrDialogChange(b);
  1147.            
  1148.             if(b)
  1149.             {
  1150.                 FactsAdd("tut_dialog_started", 1, CeilF(ConvertRealTimeSecondsToGameSeconds(1)));
  1151.             }
  1152.         }
  1153.        
  1154.        
  1155.         witcher = GetWitcherPlayer();
  1156.         if(b && witcher && witcher.IsAnyQuenActive())
  1157.         {
  1158.             witcher.FinishQuen( true, true );          
  1159.         }
  1160.        
  1161.         activePoster = thePlayer.GetActivePoster ();
  1162.        
  1163.         if ( activePoster )
  1164.         {
  1165.             CloseMenu('PosterMenu');
  1166.             activePoster.OnEndedObservingPoster();
  1167.         }
  1168.        
  1169.         if ( b && thePlayer.IsHoldingItemInLHand ())
  1170.         {
  1171.             thePlayer.HideUsableItem( true );
  1172.             restoreUsableItemL = true;
  1173.         }
  1174.         if ( !b && restoreUsableItemL )
  1175.         {
  1176.             restoreUsableItemL = false;
  1177.            
  1178.             if ( !thePlayer.IsInCombat() )
  1179.             {
  1180.                 thePlayer.OnUseSelectedItem();
  1181.             }
  1182.         }
  1183.        
  1184.        
  1185.        
  1186.         if(!b && witcher)
  1187.         {
  1188.            
  1189.             if(!witcher.GetItemEquippedOnSlot(EES_Bolt, bolts) || witcher.inv.ItemHasTag(bolts, theGame.params.TAG_INFINITE_AMMO))         
  1190.                 witcher.AddAndEquipInfiniteBolt();
  1191.         }
  1192.     }
  1193.    
  1194.     public final function IsDialogOrCutscenePlaying() : bool
  1195.     {
  1196.         return isDialogOrCutscenePlaying;
  1197.     }
  1198.    
  1199.     public final function GetRecentDialogOrCutsceneEndGameTime() : GameTime
  1200.     {
  1201.         return recentDialogOrCutsceneEndGameTime;
  1202.     }
  1203.    
  1204.     public final function GetSavedEnchanterFunds() : int
  1205.     {
  1206.         return savedEnchanterFunds;
  1207.     }
  1208.  
  1209.     public final function SetSavedEnchanterFunds( value : int )
  1210.     {
  1211.         savedEnchanterFunds = value;
  1212.     }
  1213.  
  1214.    
  1215.     public function SetIsCutscenePlaying(b : bool)
  1216.     {
  1217.         isCutscenePlaying = b;
  1218.     }
  1219.    
  1220.    
  1221.    
  1222.    
  1223.    
  1224.      public function PopulateMenuQueueStartupOnce( out menus : array< name > )
  1225.     {
  1226.         menus.PushBack( 'StartupMoviesMenu' );
  1227.     }
  1228.    
  1229.      public function PopulateMenuQueueStartupAlways( out menus : array< name > )
  1230.     {
  1231.         var menuType : int;
  1232.        
  1233.         menuType = ChooseRandomMainMenuIfNotChosenYet();
  1234.         if (GetPlatform() != Platform_PC)
  1235.         {
  1236.             switch ( menuType )
  1237.             {
  1238.                 case 1:
  1239.                     menus.PushBack( 'StartScreenMenuEP1' );
  1240.                     break;
  1241.                 case 2:
  1242.                     menus.PushBack( 'StartScreenMenuEP2' );
  1243.                     break;
  1244.                 case 0:
  1245.                 default:
  1246.                     menus.PushBack( 'StartScreenMenu' );
  1247.                     break;
  1248.             }
  1249.         }
  1250.     }
  1251.    
  1252.      public function PopulateMenuQueueConfig( out menus : array< name > )
  1253.     {
  1254.         var inGameConfigWrapper : CInGameConfigWrapper;
  1255.         inGameConfigWrapper = (CInGameConfigWrapper)theGame.GetInGameConfigWrapper();
  1256.        
  1257.         if( GetPlatform() != Platform_PC )
  1258.         {
  1259.             menus.PushBack( 'RescaleMenu' );
  1260.             menus.PushBack( 'MainGammaMenu' );
  1261.         }
  1262.     }
  1263.  
  1264.      public function PopulateMenuQueueMainOnce( out menus : array< name > )
  1265.     {
  1266.         if (GetPlatform() != Platform_PC)
  1267.         {
  1268.             menus.PushBack( 'AutosaveWarningMenu' );
  1269.         }
  1270.         menus.PushBack( 'RecapMoviesMenu' );
  1271.     }
  1272.    
  1273.      public function PopulateMenuQueueMainAlways( out menus : array< name > )
  1274.     {
  1275.         var menuType : int;
  1276.        
  1277.         menuType = ChooseRandomMainMenuIfNotChosenYet();
  1278.         switch ( menuType )
  1279.         {
  1280.             case 1:
  1281.                 menus.PushBack( 'CommonMainMenuEP1' );
  1282.                 break;
  1283.             case 2:
  1284.                 menus.PushBack( 'CommonMainMenuEP2' );
  1285.                 break;
  1286.             case 0:
  1287.             default:
  1288.                 menus.PushBack( 'CommonMainMenu' );
  1289.                 break;
  1290.         }
  1291.     }
  1292.  
  1293.     private var _mainMenuType : int; default _mainMenuType = -1;
  1294.  
  1295.     public function GetChosenMainMenuType() : int
  1296.     {
  1297.         return _mainMenuType;
  1298.     }
  1299.    
  1300.     private function ChooseRandomMainMenuIfNotChosenYet() : int
  1301.     {
  1302.         var availableMainMenuTypes : array< int >;
  1303.         var seed : int;
  1304.         var index : int;
  1305.        
  1306.         if ( _mainMenuType > -1 )
  1307.         {
  1308.             return _mainMenuType;
  1309.         }
  1310.        
  1311.         availableMainMenuTypes.PushBack( 0 );
  1312.        
  1313.         if (theGame.GetDLCManager().IsEP1Available())
  1314.         {
  1315.             availableMainMenuTypes.PushBack( 1 );
  1316.         }
  1317.         if (theGame.GetDLCManager().IsEP2Available())
  1318.         {
  1319.             availableMainMenuTypes.PushBack( 2 );
  1320.         }
  1321.  
  1322.         seed = CalcSeed( theGame );
  1323.         index = (int)RandNoiseF( seed, availableMainMenuTypes.Size() );
  1324.  
  1325.         _mainMenuType = availableMainMenuTypes[ index ];
  1326.         LogChannel('asd', "RAND " + seed + "   " + index + "   " + _mainMenuType );
  1327.  
  1328.         return _mainMenuType;
  1329.     }
  1330.  
  1331.     public function GetNewGameDefinitionFilename() : string
  1332.     {
  1333.         return "game/witcher3.redgame";
  1334.     }
  1335.    
  1336.    
  1337.    
  1338.    
  1339.    
  1340.     public function GetCurrentZone() : EZoneName
  1341.     {
  1342.         return zoneName;
  1343.     }
  1344.    
  1345.     public function SetCurrentZone( tag : name )
  1346.     {
  1347.         zoneName = ZoneNameToType( tag );
  1348.     }
  1349.        
  1350.    
  1351.    
  1352.    
  1353.    
  1354.     private var uiHorizontalFrameScale : float; default uiHorizontalFrameScale              = 1.0;
  1355.     private var uiVerticalFrameScale : float;   default uiVerticalFrameScale                = 1.0;
  1356.     private var uiScale : float;                default uiScale                             = 1.0; 
  1357.     private var uiGamepadScaleGain : float;     default uiGamepadScaleGain                  = 0.0;
  1358.     private var uiOpacity : float;              default uiOpacity                           = 0.8;
  1359.    
  1360.    
  1361.     protected var isColorBlindMode:bool;
  1362.     public function getColorBlindMode():bool
  1363.     {
  1364.         return isColorBlindMode;
  1365.     }
  1366.     public function setColorBlindMode(value:bool)
  1367.     {
  1368.         isColorBlindMode = value;
  1369.     }
  1370.    
  1371.    
  1372.     private var menuToOpen : name;
  1373.     public function GetMenuToOpen() : name
  1374.     {
  1375.         return menuToOpen;
  1376.     }
  1377.     public function SetMenuToOpen( menu : name )
  1378.     {
  1379.         menuToOpen = menu;
  1380.     }
  1381.    
  1382.     public function RequestMenuWithBackground( menu : name, backgroundMenu : name, optional initData : IScriptable )
  1383.     {
  1384.         var commonMenu : CR4CommonMenu;
  1385.         var guiManager : CR4GuiManager;
  1386.        
  1387.         guiManager = GetGuiManager();
  1388.         commonMenu = (CR4CommonMenu)guiManager.GetRootMenu();
  1389.         if( commonMenu )
  1390.         {
  1391.             commonMenu.SwitchToSubMenu(menu,"");
  1392.         }
  1393.         else
  1394.         {
  1395.             if ( guiManager.IsAnyMenu() )
  1396.             {
  1397.                 guiManager.GetRootMenu().CloseMenu();
  1398.             }
  1399.            
  1400.             SetMenuToOpen( menu );
  1401.             theGame.RequestMenu( backgroundMenu, initData );
  1402.         }
  1403.     }
  1404.    
  1405.     public function OpenPopup(DataObject : W3PopupData) : void
  1406.     {
  1407.         theGame.RequestMenu('PopupMenu', DataObject);
  1408.     }
  1409.  
  1410.     public function SetUIVerticalFrameScale( value : float )
  1411.     {
  1412.         uiVerticalFrameScale = value;
  1413.     }
  1414.  
  1415.     public function GetUIVerticalFrameScale() : float
  1416.     {
  1417.         return uiVerticalFrameScale;
  1418.     }
  1419.  
  1420.     public function SetUIHorizontalFrameScale( value : float )
  1421.     {
  1422.         var horizontalPlusFrameScale : float;
  1423.         uiHorizontalFrameScale = value;
  1424.         horizontalPlusFrameScale = theGame.GetUIHorizontalPlusFrameScale();
  1425.         uiHorizontalFrameScale = uiHorizontalFrameScale * horizontalPlusFrameScale;
  1426.     }
  1427.    
  1428.     public function GetUIHorizontalFrameScale() : float
  1429.     {
  1430.         return uiHorizontalFrameScale;
  1431.     }
  1432.    
  1433.     public function SetUIScale( value : float )
  1434.     {
  1435.         uiScale = value;
  1436.     }
  1437.  
  1438.     public function GetUIScale() : float
  1439.     {
  1440.         return uiScale;
  1441.     }
  1442.  
  1443.     public function SetUIGamepadScaleGain( value : float )
  1444.     {
  1445.         uiGamepadScaleGain = value;
  1446.     }
  1447.  
  1448.     public function GetUIGamepadScaleGain() : float
  1449.     {
  1450.         return uiGamepadScaleGain;
  1451.     }
  1452.  
  1453.     public function SetDeathSaveLockId(i : int)
  1454.     {
  1455.         deathSaveLockId = i;
  1456.     }
  1457.    
  1458.     public function SetUIOpacity( value : float )
  1459.     {
  1460.         uiOpacity = value;
  1461.     }
  1462.  
  1463.     public function GetUIOpacity() : float
  1464.     {
  1465.         return uiOpacity;
  1466.     }
  1467.    
  1468.     public function setDialogDisplayDisabled( value : bool )
  1469.     {
  1470.         isDialogDisplayDisabled = value;
  1471.     }
  1472.  
  1473.     public function LoadHudSettings()
  1474.     {
  1475.         var inGameConfigWrapper : CInGameConfigWrapper;
  1476.        
  1477.         hudSettings = LoadCSV("gameplay\globals\hud_settings.csv");
  1478.            
  1479.         inGameConfigWrapper = (CInGameConfigWrapper)theGame.GetInGameConfigWrapper();
  1480.            
  1481.         isDialogDisplayDisabled = inGameConfigWrapper.GetVarValue('Localization', 'Subtitles') == "false";
  1482.            
  1483.         SetUIVerticalFrameScale( StringToFloat(inGameConfigWrapper.GetVarValue('Hidden', 'uiVerticalFrameScale')) );
  1484.         SetUIHorizontalFrameScale( StringToFloat(inGameConfigWrapper.GetVarValue('Hidden', 'uiHorizontalFrameScale')) );
  1485.            
  1486.         uiScale = StringToFloat(theGame.hudSettings.GetValueAt(1,theGame.hudSettings.GetRowIndexAt( 0, "uiScale" )));  
  1487.         uiOpacity = StringToFloat(theGame.hudSettings.GetValueAt(1,theGame.hudSettings.GetRowIndexAt( 0, "uiOpacity" )));  
  1488.     }
  1489.    
  1490.     event OnRefreshUIScaling()
  1491.     {
  1492.         var inGameConfigWrapper : CInGameConfigWrapper;
  1493.         inGameConfigWrapper = (CInGameConfigWrapper)theGame.GetInGameConfigWrapper();
  1494.         SetUIVerticalFrameScale( StringToFloat(inGameConfigWrapper.GetVarValue('Hidden', 'uiVerticalFrameScale')) );
  1495.         SetUIHorizontalFrameScale( StringToFloat(inGameConfigWrapper.GetVarValue('Hidden', 'uiHorizontalFrameScale')) );
  1496.     }
  1497.    
  1498.     event OnSpawnPlayerHorse( )
  1499.     {
  1500.         var createEntityHelper              : CR4CreateEntityHelper;
  1501.        
  1502.         thePlayer.RaiseEvent('HorseSummon');
  1503.        
  1504.         if( !thePlayer.GetHorseWithInventory()
  1505.             ||  !thePlayer.GetHorseWithInventory().IsAlive()
  1506.             ||  ( !thePlayer.WasVisibleInScaledFrame( thePlayer.GetHorseWithInventory(), 1.5f, 1.5f ) && VecDistanceSquared( thePlayer.GetWorldPosition(), thePlayer.GetHorseWithInventory().GetWorldPosition() ) > 900 )
  1507.             ||  VecDistanceSquared( thePlayer.GetWorldPosition(), thePlayer.GetHorseWithInventory().GetWorldPosition() ) > 1600 )
  1508.         {
  1509.             createEntityHelper = new CR4CreateEntityHelper in this;
  1510.             createEntityHelper.SetPostAttachedCallback( this, 'OnPlayerHorseSummoned' );
  1511.             theGame.SummonPlayerHorse( true, createEntityHelper );
  1512.         }
  1513.         else
  1514.         {
  1515.            
  1516.             thePlayer.GetHorseWithInventory().SignalGameplayEventParamObject( 'HorseSummon', thePlayer );
  1517.         }
  1518.        
  1519.         thePlayer.OnSpawnHorse();
  1520.     }
  1521.  
  1522.     private function OnPlayerHorseSummoned( horseEntity : CEntity )
  1523.     {
  1524.         var saddle          : SItemUniqueId;
  1525.         var horseManager    : W3HorseManager;
  1526.         var horse           : CActor;
  1527.  
  1528.        
  1529.         horseManager = GetWitcherPlayer().GetHorseManager();
  1530.         saddle = horseManager.GetItemInSlot(EES_HorseSaddle);
  1531.         if ( horseManager.GetInventoryComponent().GetItemName(saddle) == 'Devil Saddle' )
  1532.         {
  1533.            
  1534.             horse = (CActor)horseEntity;
  1535.             horse.AddEffectDefault(EET_WeakeningAura, horse, 'horse saddle', false);
  1536.         }
  1537.        
  1538.         thePlayer.GetHorseWithInventory().SignalGameplayEventParamObject( 'HorseSummon', thePlayer );
  1539.        
  1540.         GetWitcherPlayer().GetHorseManager().ApplyHorseUpdateOnSpawn();
  1541.     }
  1542.    
  1543.    
  1544.     event OnTutorialMessageForChoiceLines( flags : int )
  1545.     {
  1546.        
  1547.        
  1548.        
  1549.         GameplayFactsSet('dialog_choice_flags', flags);
  1550.         GameplayFactsAdd('dialog_choice_is_set', 1, 1);
  1551.     }
  1552.    
  1553.     event OnTutorialMessageForChoiceLineChosen( flags : int )
  1554.     {
  1555.         GameplayFactsSet('dialog_used_choice_flags', flags);
  1556.         GameplayFactsAdd('dialog_used_choice_is_set', 1, 1);
  1557.     }  
  1558.    
  1559.    
  1560.    
  1561.    
  1562.    
  1563.    
  1564.    
  1565.  
  1566.     public function GameplayFactsAdd(factName : string, optional value : int, optional realtimeSecsValidFor : int)
  1567.     {
  1568.         var idx : int;
  1569.         var newFact : SGameplayFact;
  1570.         var newFactRemoval : SGameplayFactRemoval;
  1571.        
  1572.         if(value < 0)
  1573.             return;
  1574.         else if(value == 0)
  1575.             value = 1;
  1576.            
  1577.         idx = GetGameplayFactIndex(factName);
  1578.         if(idx >= 0)
  1579.         {
  1580.             gameplayFacts[idx].value += value;
  1581.         }
  1582.         else
  1583.         {
  1584.             newFact.factName = factName;
  1585.             newFact.value = value;
  1586.             gameplayFacts.PushBack(newFact);
  1587.         }
  1588.        
  1589.         if(realtimeSecsValidFor > 0)
  1590.         {
  1591.             newFactRemoval.factName = factName;
  1592.             newFactRemoval.value = value;
  1593.             newFactRemoval.timerID = thePlayer.AddTimer('GameplayFactRemove', realtimeSecsValidFor, , , , true, false);
  1594.            
  1595.             gameplayFactsForRemoval.PushBack(newFactRemoval);
  1596.         }
  1597.     }
  1598.    
  1599.     public function GameplayFactsSet(factName : string, value : int)
  1600.     {
  1601.         var idx : int;
  1602.         var newFact : SGameplayFact;
  1603.        
  1604.         idx = GetGameplayFactIndex(factName);
  1605.         if(idx >= 0)
  1606.         {
  1607.             gameplayFacts[idx].value = value;
  1608.         }
  1609.         else
  1610.         {
  1611.             newFact.factName = factName;
  1612.             newFact.value = value;
  1613.             gameplayFacts.PushBack(newFact);
  1614.         }
  1615.     }
  1616.    
  1617.     public function GameplayFactsRemove(factName : string)
  1618.     {
  1619.         var i : int;
  1620.        
  1621.         for(i=0; i<gameplayFacts.Size(); i+=1)
  1622.         {
  1623.             if(gameplayFacts[i].factName == factName)
  1624.             {
  1625.                 gameplayFacts.EraseFast(i);
  1626.                 return;
  1627.             }
  1628.         }
  1629.     }
  1630.    
  1631.    
  1632.     public function GameplayFactRemoveFromTimer(timerID : int)
  1633.     {
  1634.         var idx, factIdx : int;
  1635.        
  1636.         idx = GetGameplayFactsForRemovalIndex(timerID);
  1637.         if(idx < 0)
  1638.         {
  1639.             LogAssert(false, "CR4Game.GameplayFactRemoveFromTimer: trying to process non-existant timer <<" + timerID + ">>");
  1640.             return;
  1641.         }
  1642.        
  1643.         factIdx = GetGameplayFactIndex(gameplayFactsForRemoval[idx].factName);
  1644.         if(factIdx < 0)                
  1645.             return;
  1646.        
  1647.         gameplayFacts[factIdx].value -= gameplayFactsForRemoval[idx].value;
  1648.         if(gameplayFacts[factIdx].value <= 0)
  1649.             gameplayFacts.EraseFast(factIdx);
  1650.            
  1651.         gameplayFactsForRemoval.EraseFast(idx);
  1652.     }
  1653.  
  1654.     public function GameplayFactsQuerySum(factName : string) : int
  1655.     {
  1656.         var idx : int;
  1657.        
  1658.         idx = GetGameplayFactIndex(factName);
  1659.         if(idx >= 0)       
  1660.             return gameplayFacts[idx].value;
  1661.            
  1662.         return 0;
  1663.     }
  1664.    
  1665.     private function GetGameplayFactIndex(factName : string) : int
  1666.     {
  1667.         var i : int;
  1668.        
  1669.         for(i=0; i<gameplayFacts.Size(); i+=1)
  1670.         {
  1671.             if(gameplayFacts[i].factName == factName)
  1672.                 return i;          
  1673.         }
  1674.        
  1675.         return -1;
  1676.     }
  1677.    
  1678.     private function GetGameplayFactsForRemovalIndex(timerID : int) : int
  1679.     {
  1680.         var i : int;
  1681.        
  1682.         for(i=0; i<gameplayFactsForRemoval.Size(); i+=1)
  1683.         {
  1684.             if(gameplayFactsForRemoval[i].timerID == timerID)
  1685.                 return i;          
  1686.         }
  1687.        
  1688.         return -1;
  1689.     }
  1690.    
  1691.     public function GetR4ReactionManager() : CR4ReactionManager
  1692.     {
  1693.         return ( CR4ReactionManager ) GetBehTreeReactionManager();
  1694.     }
  1695.        
  1696.     public function GetDifficultyMode() : EDifficultyMode
  1697.     {
  1698.         var diff : EDifficultyMode;
  1699.                
  1700.         diff = GetDifficultyLevel();
  1701.        
  1702.        
  1703.         if(diff == EDM_NotSet)
  1704.         {
  1705.             return EDM_Medium;
  1706.         }
  1707.        
  1708.         return diff;
  1709.     }
  1710.    
  1711.     event OnDifficultyChanged(newDifficulty : int)
  1712.     {
  1713.         var i : int;
  1714.         var lowestDiff : EDifficultyMode;
  1715.        
  1716.        
  1717.         if(!thePlayer)
  1718.         {
  1719.             diffChangePostponed = newDifficulty;
  1720.             return false;
  1721.         }
  1722.        
  1723.         theTelemetry.SetCommonStatI32(CS_DIFFICULTY_LVL, newDifficulty);
  1724.  
  1725.        
  1726.         lowestDiff = GetLowestDifficultyUsed();    
  1727.         if(lowestDiff != newDifficulty && MinDiffMode(lowestDiff, newDifficulty) == newDifficulty)
  1728.             SetLowestDifficultyUsed(newDifficulty);
  1729.            
  1730.         UpdateStatsForDifficultyLevel( GetSpawnDifficultyMode() );
  1731.     }
  1732.    
  1733.    
  1734.     public function OnPlayerChanged()
  1735.     {
  1736.         var i : int;
  1737.         var buffs : array<CBaseGameplayEffect>;
  1738.         var witcher : W3PlayerWitcher;
  1739.        
  1740.        
  1741.         thePlayer.RemoveAllNonAutoBuffs( , true );
  1742.        
  1743.        
  1744.         buffs = thePlayer.GetBuffs();
  1745.         for(i=0; i<buffs.Size(); i+=1)
  1746.         {
  1747.             buffs[i].ResumeForced();
  1748.         }
  1749.    
  1750.        
  1751.         GetGameCamera().StopEffect( 'frost' );
  1752.         DisableCatViewFx( 1.0f );
  1753.         thePlayer.StopEffect('critical_low_health');
  1754.         DisableDrunkFx();
  1755.         thePlayer.StopEffect('critical_toxicity');
  1756.        
  1757.         if(GetWitcherPlayer())
  1758.             GetWitcherPlayer().UpdateEncumbrance();
  1759.    
  1760.        
  1761.        
  1762.         UpdateStatsForDifficultyLevel( GetSpawnDifficultyMode() );
  1763.        
  1764.        
  1765.         RemoveAllTimeScales();
  1766.     }
  1767.    
  1768.    
  1769.    
  1770.     public function GetSpawnDifficultyMode() : EDifficultyMode
  1771.     {
  1772.         //if( thePlayer && thePlayer.IsCiri() )
  1773.         //{
  1774.         //  return MinDiffMode( GetDifficultyMode(), EDM_Medium );
  1775.         //}
  1776.         return GetDifficultyMode();
  1777.     }
  1778.    
  1779.     public function UpdateStatsForDifficultyLevel( difficulty : EDifficultyMode )
  1780.     {
  1781.         var i : int;
  1782.         var actor : CActor;
  1783.         var npcs : array< CNewNPC >;
  1784.         GetAllNPCs( npcs );
  1785.         for( i=0; i < npcs.Size(); i+=1 )
  1786.         {
  1787.             actor = (CActor)npcs[i];
  1788.             if( actor )
  1789.             {
  1790.                 actor.UpdateStatsForDifficultyLevel( difficulty );
  1791.             }
  1792.         }
  1793.     }
  1794.  
  1795.     public function CanTrackQuest( questEntry : CJournalQuest ) : bool
  1796.     {
  1797.         var questName : string;
  1798.         var baseName : string;
  1799.         var i : int;
  1800.         var questCount : int;
  1801.         var playerLevel : int;
  1802.         var questLevel : int;
  1803.         var questLevels : C2dArray;
  1804.         var questLevelsCount : int;
  1805.         var iterQuestLevels : int;
  1806.        
  1807.         baseName = questEntry.baseName;
  1808.         playerLevel = thePlayer.GetLevel();
  1809.  
  1810.         if ( questEntry.GetType() == MonsterHunt )
  1811.         {
  1812.             questLevelsCount = theGame.questLevelsContainer.Size();
  1813.             for( iterQuestLevels = 0; iterQuestLevels < questLevelsCount; iterQuestLevels += 1 )
  1814.             {
  1815.                 questLevels = theGame.questLevelsContainer[iterQuestLevels];
  1816.            
  1817.                 questCount = questLevels.GetNumRows();
  1818.                 for( i = 0; i < questCount; i += 1 )
  1819.                 {
  1820.                     questName = questLevels.GetValueAtAsName( 0, i );
  1821.                     if ( questName == baseName )
  1822.                     {
  1823.                         questLevel = NameToInt( questLevels.GetValueAtAsName( 1, i ) );
  1824.                         return playerLevel >= questLevel - 5;
  1825.                     }
  1826.                 }
  1827.             }
  1828.         }
  1829.         return true;
  1830.     }
  1831.    
  1832.     import final function GetGwintManager() : CR4GwintManager;
  1833.    
  1834.     public function IsBlackscreenOrFading() : bool
  1835.     {
  1836.         return IsBlackscreen() || IsFading();
  1837.     }
  1838.        
  1839.    
  1840.    
  1841.    
  1842.  
  1843.     var postponedPreAttackEvents : array< SPostponedPreAttackEvent >;
  1844.    
  1845.     event OnPreAttackEvent( entity : CGameplayEntity, animEventName : name, animEventType : EAnimationEventType, data : CPreAttackEventData, animInfo : SAnimationEventAnimInfo )
  1846.     {
  1847.         var postponedPreAttackEvent : SPostponedPreAttackEvent;
  1848.        
  1849.         postponedPreAttackEvent.entity      = entity;
  1850.         postponedPreAttackEvent.eventName   = animEventName;
  1851.         postponedPreAttackEvent.eventType   = animEventType;
  1852.         postponedPreAttackEvent.data        = data;
  1853.         postponedPreAttackEvent.animInfo    = animInfo;
  1854.        
  1855.         postponedPreAttackEvents.PushBack( postponedPreAttackEvent );
  1856.     }
  1857.  
  1858.     function FirePostponedPreAttackEvents()
  1859.     {
  1860.         var i, size : int;
  1861.         var entity : CGameplayEntity;
  1862.        
  1863.         size = postponedPreAttackEvents.Size();
  1864.         for ( i = 0; i < size; i+=1 )
  1865.         {
  1866.             entity = postponedPreAttackEvents[i].entity;
  1867.             if ( entity )
  1868.             {
  1869.                 entity.OnPreAttackEvent( postponedPreAttackEvents[i].eventName,
  1870.                                          postponedPreAttackEvents[i].eventType,
  1871.                                          postponedPreAttackEvents[i].data,
  1872.                                          postponedPreAttackEvents[i].animInfo );
  1873.             }
  1874.         }
  1875.         postponedPreAttackEvents.Clear();
  1876.     }
  1877.    
  1878.     public final function AddDynamicallySpawnedBoatHandle(handle : EntityHandle)
  1879.     {
  1880.         var i : int;
  1881.        
  1882.         if(EntityHandleGet(handle))
  1883.         {          
  1884.             dynamicallySpawnedBoats.PushBack(handle);
  1885.            
  1886.             if(dynamicallySpawnedBoats.Size() >= theGame.params.MAX_DYNAMICALLY_SPAWNED_BOATS)
  1887.             {
  1888.                
  1889.                 for(i=dynamicallySpawnedBoatsToDestroy.Size()-1; i>=0; i-=1)
  1890.                 {
  1891.                     if(!EntityHandleGet(dynamicallySpawnedBoats[i]))
  1892.                         dynamicallySpawnedBoats.EraseFast(i);
  1893.                 }
  1894.            
  1895.                 if(dynamicallySpawnedBoats.Size() >= theGame.params.MAX_DYNAMICALLY_SPAWNED_BOATS)
  1896.                 {
  1897.                     dynamicallySpawnedBoatsToDestroy.PushBack( dynamicallySpawnedBoats[0] );
  1898.                     dynamicallySpawnedBoats.Erase(0);
  1899.                 }
  1900.             }
  1901.         }
  1902.     }
  1903.    
  1904.     public final function IsBoatMarkedForDestroy(boat : W3Boat) : bool
  1905.     {
  1906.         var handle : EntityHandle;
  1907.         var i : int;
  1908.        
  1909.         EntityHandleSet(handle, boat);
  1910.         for(i=0; i<dynamicallySpawnedBoatsToDestroy.Size(); i+=1)
  1911.         {
  1912.             if(handle == dynamicallySpawnedBoatsToDestroy[i])
  1913.             {
  1914.                 dynamicallySpawnedBoatsToDestroy.EraseFast(i);
  1915.                 return true;
  1916.             }
  1917.         }
  1918.        
  1919.         return false;
  1920.     }
  1921.  
  1922.     public final function VibrateControllerVeryLight(optional duration : float)
  1923.     {
  1924.         if ( !theInput.LastUsedGamepad() )
  1925.             return;
  1926.            
  1927.         if(duration == 0)
  1928.             duration = 0.15f;
  1929.            
  1930.         if(IsSpecificRumbleActive(0.2, 0))
  1931.         {
  1932.             OverrideRumbleDuration(0.2, 0, duration);
  1933.         }
  1934.         else
  1935.         {
  1936.             VibrateController(0.2, 0, duration);
  1937.         }
  1938.     }
  1939.    
  1940.     public final function VibrateControllerLight(optional duration : float)
  1941.     {
  1942.         if ( !theInput.LastUsedGamepad() )
  1943.             return;
  1944.            
  1945.         if(duration == 0)
  1946.             duration = 0.2f;
  1947.            
  1948.         if(IsSpecificRumbleActive(0.5, 0))
  1949.         {
  1950.             OverrideRumbleDuration(0.5, 0, duration);
  1951.         }
  1952.         else
  1953.         {
  1954.             VibrateController(0.5, 0, duration);
  1955.         }
  1956.     }
  1957.    
  1958.     public final function VibrateControllerHard(optional duration : float)
  1959.     {
  1960.         if ( !theInput.LastUsedGamepad() )
  1961.             return;
  1962.            
  1963.         if(duration == 0)
  1964.             duration = 0.2f;
  1965.        
  1966.         if(IsSpecificRumbleActive(0.75, 0.75))
  1967.         {
  1968.             OverrideRumbleDuration(0.75, 0.75, duration);
  1969.         }
  1970.         else
  1971.         {
  1972.             VibrateController(0.75, 0.75, duration);
  1973.         }
  1974.     }
  1975.    
  1976.     public final function VibrateControllerVeryHard(optional duration : float)
  1977.     {
  1978.         if ( !theInput.LastUsedGamepad() )
  1979.             return;
  1980.            
  1981.         if(duration == 0)
  1982.             duration = 0.5f;
  1983.        
  1984.         if(IsSpecificRumbleActive(1, 1))
  1985.         {
  1986.             OverrideRumbleDuration(1, 1, duration);
  1987.         }
  1988.         else
  1989.         {
  1990.             VibrateController(1, 1, duration);
  1991.         }
  1992.     }
  1993.     import public final function GetWorldDLCExtender() : CR4WorldDLCExtender;
  1994.    
  1995.     public function GetMiniMapSize( areaType : int ) : float
  1996.     {
  1997.         var mapSize  : float;
  1998.         var valueAsString : string;
  1999.        
  2000.         valueAsString = minimapSettings.GetValueAt( 1, areaType );
  2001.        
  2002.         if( StrLen( valueAsString ) != 0 )
  2003.         {
  2004.             mapSize = StringToFloat( valueAsString );
  2005.         }
  2006.         else
  2007.         {
  2008.             mapSize = GetWorldDLCExtender().GetMiniMapSize( areaType );
  2009.         }
  2010.         return mapSize;
  2011.     }
  2012.    
  2013.     public function GetMiniMapTileCount( areaType : int ) : int
  2014.     {
  2015.         var tileCount  : int;
  2016.         var valueAsString : string;
  2017.        
  2018.         valueAsString = minimapSettings.GetValueAt( 2, areaType );
  2019.        
  2020.         if( StrLen( valueAsString ) != 0 )
  2021.         {
  2022.             tileCount = StringToInt( valueAsString );
  2023.         }
  2024.         else
  2025.         {
  2026.             tileCount = GetWorldDLCExtender().GetMiniMapTileCount( areaType );
  2027.         }
  2028.         return tileCount;
  2029.     }
  2030.    
  2031.     public function GetMiniMapExteriorTextureSize( areaType : int ) : int
  2032.     {
  2033.         var exteriorTextureSize  : int;
  2034.         var valueAsString : string;
  2035.        
  2036.         valueAsString = minimapSettings.GetValueAt( 3, areaType );
  2037.        
  2038.         if( StrLen( valueAsString ) != 0 )
  2039.         {
  2040.             exteriorTextureSize = StringToInt( valueAsString );
  2041.         }
  2042.         else
  2043.         {
  2044.             exteriorTextureSize = GetWorldDLCExtender().GetMiniMapExteriorTextureSize( areaType );
  2045.         }
  2046.         return exteriorTextureSize;
  2047.     }
  2048.    
  2049.        
  2050.     public function GetMiniMapInteriorTextureSize( areaType : int ) : int
  2051.     {
  2052.         var interiorTextureSize  : int;
  2053.         var valueAsString : string;
  2054.        
  2055.         valueAsString = minimapSettings.GetValueAt( 4, areaType );
  2056.        
  2057.         if( StrLen( valueAsString ) != 0 )
  2058.         {
  2059.             interiorTextureSize = StringToInt( valueAsString );
  2060.         }
  2061.         else
  2062.         {
  2063.             interiorTextureSize = GetWorldDLCExtender().GetMiniMapInteriorTextureSize( areaType );
  2064.         }
  2065.         return interiorTextureSize;
  2066.     }
  2067.    
  2068.     public function GetMiniMapTextureSize( areaType : int ) : int
  2069.     {
  2070.         var textureSize  : int;
  2071.         var valueAsString : string;
  2072.        
  2073.         valueAsString = minimapSettings.GetValueAt( 5, areaType );
  2074.        
  2075.         if( StrLen( valueAsString ) != 0 )
  2076.         {
  2077.             textureSize = StringToInt( valueAsString );
  2078.         }
  2079.         else
  2080.         {
  2081.             textureSize = GetWorldDLCExtender().GetMiniMapTextureSize( areaType );
  2082.         }
  2083.         return textureSize;
  2084.     }
  2085.    
  2086.     public function GetMiniMapMinLod( areaType : int ) : int
  2087.     {
  2088.         var minLod  : int;
  2089.         var valueAsString : string;
  2090.        
  2091.         valueAsString = minimapSettings.GetValueAt( 6, areaType );
  2092.        
  2093.         if( StrLen( valueAsString ) != 0 )
  2094.         {
  2095.             minLod = StringToInt( valueAsString );
  2096.         }
  2097.         else
  2098.         {
  2099.             minLod = GetWorldDLCExtender().GetMiniMapMinLod( areaType );
  2100.         }
  2101.         return minLod;
  2102.     }
  2103.    
  2104.     public function GetMiniMapMaxLod( areaType : int ) : int
  2105.     {
  2106.         var maxLod  : int;
  2107.         var valueAsString : string;
  2108.        
  2109.         valueAsString = minimapSettings.GetValueAt( 7, areaType );
  2110.        
  2111.         if( StrLen( valueAsString ) != 0 )
  2112.         {
  2113.             maxLod = StringToInt( valueAsString );
  2114.         }
  2115.         else
  2116.         {
  2117.             maxLod = GetWorldDLCExtender().GetMiniMapMaxLod( areaType );
  2118.         }
  2119.         return maxLod;
  2120.     }
  2121.  
  2122.    
  2123.     public function GetMiniMapExteriorTextureExtension( areaType : int ) : string
  2124.     {
  2125.         var exteriorTextureExtension  : string;
  2126.         var valueAsString : string;
  2127.        
  2128.         valueAsString = minimapSettings.GetValueAt( 8, areaType );
  2129.        
  2130.         if( StrLen( valueAsString ) != 0 )
  2131.         {
  2132.             exteriorTextureExtension = ExtractStringFromCSV( valueAsString );
  2133.         }
  2134.         else
  2135.         {
  2136.             exteriorTextureExtension = GetWorldDLCExtender().GetMiniMapExteriorTextureExtension( areaType );
  2137.         }
  2138.         return exteriorTextureExtension;
  2139.     }
  2140.    
  2141.     public function GetMiniMapInteriorTextureExtension( areaType : int ) : string
  2142.     {
  2143.         var interiorTextureExtension  : string;
  2144.         var valueAsString : string;
  2145.        
  2146.         valueAsString = minimapSettings.GetValueAt( 9, areaType );
  2147.        
  2148.         if( StrLen( valueAsString ) != 0 )
  2149.         {
  2150.             interiorTextureExtension = ExtractStringFromCSV( valueAsString );
  2151.         }
  2152.         else
  2153.         {
  2154.             interiorTextureExtension = GetWorldDLCExtender().GetMiniMapInteriorTextureExtension( areaType );
  2155.         }
  2156.         return interiorTextureExtension;
  2157.     }
  2158.    
  2159.     public function GetMiniMapVminX( areaType : int ) : int
  2160.     {
  2161.         var vminX  : int;
  2162.         var valueAsString : string;
  2163.        
  2164.         valueAsString = minimapSettings.GetValueAt( 11, areaType );
  2165.        
  2166.         if( StrLen( valueAsString ) != 0 )
  2167.         {
  2168.             vminX = StringToInt( valueAsString );
  2169.         }
  2170.         else
  2171.         {
  2172.             vminX = GetWorldDLCExtender().GetMiniMapVminX( areaType );
  2173.         }
  2174.         return vminX;
  2175.     }
  2176.    
  2177.     public function GetMiniMapVmaxX( areaType : int ) : int
  2178.     {
  2179.         var vmaxX  : int;
  2180.         var valueAsString : string;
  2181.        
  2182.         valueAsString = minimapSettings.GetValueAt( 12, areaType );
  2183.        
  2184.         if( StrLen( valueAsString ) != 0 )
  2185.         {
  2186.             vmaxX = StringToInt( valueAsString );
  2187.         }
  2188.         else
  2189.         {
  2190.             vmaxX = GetWorldDLCExtender().GetMiniMapVmaxX( areaType );
  2191.         }
  2192.         return vmaxX;
  2193.     }
  2194.    
  2195.     public function GetMiniMapVminY( areaType : int ) : int
  2196.     {
  2197.         var vminY  : int;
  2198.         var valueAsString : string;
  2199.        
  2200.         valueAsString = minimapSettings.GetValueAt( 13, areaType );
  2201.        
  2202.         if( StrLen( valueAsString ) != 0 )
  2203.         {
  2204.             vminY = StringToInt( valueAsString );
  2205.         }
  2206.         else
  2207.         {
  2208.             vminY = GetWorldDLCExtender().GetMiniMapVminY( areaType );
  2209.         }
  2210.         return vminY;
  2211.     }
  2212.    
  2213.     public function GetMiniMapVmaxY( areaType : int ) : int
  2214.     {
  2215.         var vmaxY  : int;
  2216.         var valueAsString : string;
  2217.        
  2218.         valueAsString = minimapSettings.GetValueAt( 14, areaType );
  2219.        
  2220.         if( StrLen( valueAsString ) != 0 )
  2221.         {
  2222.             vmaxY = StringToInt( valueAsString );
  2223.         }
  2224.         else
  2225.         {
  2226.             vmaxY = GetWorldDLCExtender().GetMiniMapVmaxY( areaType );
  2227.         }
  2228.         return vmaxY;
  2229.     }
  2230.    
  2231.     public function GetMiniMapSminX( areaType : int ) : int
  2232.     {
  2233.         var sminX  : int;
  2234.         var valueAsString : string;
  2235.        
  2236.         valueAsString = minimapSettings.GetValueAt( 15, areaType );
  2237.        
  2238.         if( StrLen( valueAsString ) != 0 )
  2239.         {
  2240.             sminX = StringToInt( valueAsString );
  2241.         }
  2242.         else
  2243.         {
  2244.             sminX = GetWorldDLCExtender().GetMiniMapSminX( areaType );
  2245.         }
  2246.         return sminX;
  2247.     }
  2248.    
  2249.     public function GetMiniMapSmaxX( areaType : int ) : int
  2250.     {
  2251.         var smaxX  : int;
  2252.         var valueAsString : string;
  2253.        
  2254.         valueAsString = minimapSettings.GetValueAt( 16, areaType );
  2255.        
  2256.         if( StrLen( valueAsString ) != 0 )
  2257.         {
  2258.             smaxX = StringToInt( valueAsString );
  2259.         }
  2260.         else
  2261.         {
  2262.             smaxX = GetWorldDLCExtender().GetMiniMapSmaxX( areaType );
  2263.         }
  2264.         return smaxX;
  2265.     }
  2266.    
  2267.     public function GetMiniMapSminY( areaType : int ) : int
  2268.     {
  2269.         var sminY  : int;
  2270.         var valueAsString : string;
  2271.        
  2272.         valueAsString = minimapSettings.GetValueAt( 17, areaType );
  2273.        
  2274.         if( StrLen( valueAsString ) != 0 )
  2275.         {
  2276.             sminY = StringToInt( valueAsString );
  2277.         }
  2278.         else
  2279.         {
  2280.             sminY = GetWorldDLCExtender().GetMiniMapSminY( areaType );
  2281.         }
  2282.         return sminY;
  2283.     }
  2284.    
  2285.     public function GetMiniMapSmaxY( areaType : int ) : int
  2286.     {
  2287.         var smaxY  : int;
  2288.         var valueAsString : string;
  2289.        
  2290.         valueAsString = minimapSettings.GetValueAt( 18, areaType );
  2291.        
  2292.         if( StrLen( valueAsString ) != 0 )
  2293.         {
  2294.             smaxY = StringToInt( valueAsString );
  2295.         }
  2296.         else
  2297.         {
  2298.             smaxY = GetWorldDLCExtender().GetMiniMapSmaxY( areaType );
  2299.         }
  2300.         return smaxY;
  2301.     }
  2302.    
  2303.     public function GetMiniMapMinZoom( areaType : int ) : float
  2304.     {
  2305.         var minZoom  : float;
  2306.         var valueAsString : string;
  2307.        
  2308.         valueAsString = minimapSettings.GetValueAt( 19, areaType );
  2309.        
  2310.         if( StrLen( valueAsString ) != 0 )
  2311.         {
  2312.             minZoom = StringToFloat( valueAsString );
  2313.         }
  2314.         else
  2315.         {
  2316.             minZoom = GetWorldDLCExtender().GetMiniMapMinZoom( areaType );
  2317.         }
  2318.         return minZoom;
  2319.     }
  2320.    
  2321.     public function GetMiniMapMaxZoom( areaType : int ) : float
  2322.     {
  2323.         var maxZoom  : float;
  2324.         var valueAsString : string;
  2325.        
  2326.         valueAsString = minimapSettings.GetValueAt( 20, areaType );
  2327.        
  2328.         if( StrLen( valueAsString ) != 0 )
  2329.         {
  2330.             maxZoom = StringToFloat( valueAsString );
  2331.         }
  2332.         else
  2333.         {
  2334.             maxZoom = GetWorldDLCExtender().GetMiniMapMaxZoom( areaType );
  2335.         }
  2336.         return maxZoom;
  2337.     }
  2338.    
  2339.     public function GetMiniMapZoom12( areaType : int ) : float
  2340.     {
  2341.         var zoom12  : float;
  2342.         var valueAsString : string;
  2343.        
  2344.         valueAsString = minimapSettings.GetValueAt( 21, areaType );
  2345.        
  2346.         if( StrLen( valueAsString ) != 0 )
  2347.         {
  2348.             zoom12 = StringToFloat( valueAsString );
  2349.         }
  2350.         else
  2351.         {
  2352.             zoom12 = GetWorldDLCExtender().GetMiniMapZoom12( areaType );
  2353.         }
  2354.         return zoom12;
  2355.     }
  2356.    
  2357.     public function GetMiniMapZoom23( areaType : int ) : float
  2358.     {
  2359.         var zoom23  : float;
  2360.         var valueAsString : string;
  2361.        
  2362.         valueAsString = minimapSettings.GetValueAt( 22, areaType );
  2363.        
  2364.         if( StrLen( valueAsString ) != 0 )
  2365.         {
  2366.             zoom23 = StringToFloat( valueAsString );
  2367.         }
  2368.         else
  2369.         {
  2370.             zoom23 = GetWorldDLCExtender().GetMiniMapZoom23( areaType );
  2371.         }
  2372.         return zoom23;
  2373.     }
  2374.    
  2375.     public function GetMiniMapZoom34( areaType : int ) : float
  2376.     {
  2377.         var zoom34  : float;
  2378.         var valueAsString : string;
  2379.        
  2380.         valueAsString = minimapSettings.GetValueAt( 23, areaType );
  2381.        
  2382.         if( StrLen( valueAsString ) != 0 )
  2383.         {
  2384.             zoom34 = StringToFloat( valueAsString );
  2385.         }
  2386.         else
  2387.         {
  2388.             zoom34 = GetWorldDLCExtender().GetMiniMapZoom34( areaType );
  2389.         }
  2390.         return zoom34;
  2391.     }
  2392.    
  2393.     public function GetGradientScale( areaType : int ) : float
  2394.     {
  2395.         var scale  : float;
  2396.         var valueAsString : string;
  2397.        
  2398.         valueAsString = minimapSettings.GetValueAt( 24, areaType );
  2399.        
  2400.         if( StrLen( valueAsString ) != 0 )
  2401.         {
  2402.             scale = StringToFloat( valueAsString );
  2403.         }
  2404.         else
  2405.         {
  2406.             scale = GetWorldDLCExtender().GetGradientScale( areaType );
  2407.         }
  2408.         return scale;
  2409.     }
  2410.    
  2411.     public function GetPreviewHeight( areaType : int ) : float
  2412.     {
  2413.         var height  : float;
  2414.         var valueAsString : string;
  2415.        
  2416.         valueAsString = minimapSettings.GetValueAt( 25, areaType );
  2417.        
  2418.         if( StrLen( valueAsString ) != 0 )
  2419.         {
  2420.             height = StringToFloat( valueAsString );
  2421.         }
  2422.         else
  2423.         {
  2424.             height = GetWorldDLCExtender().GetPreviewHeight( areaType );
  2425.         }
  2426.         return height;
  2427.     }
  2428.  
  2429.     private function UnlockMissedAchievements()
  2430.     {
  2431.         var manager : CCommonMapManager = theGame.GetCommonMapManager();   
  2432.         if ( manager )
  2433.         {
  2434.             manager.CheckExplorerAchievement();
  2435.         }
  2436.  
  2437.         GetWitcherPlayer().CheckForFullyArmedAchievement();
  2438.         GetGamerProfile().CheckProgressOfAllStats();
  2439.         if (FactsDoesExist("witcher3_game_finished"))
  2440.         {
  2441.             Achievement_FinishedGame();
  2442.         }
  2443.     }
  2444.    
  2445.     public final function MutationHUDFeedback( type : EMutationFeedbackType )
  2446.     {
  2447.         var hud : CR4ScriptedHud;
  2448.         var hudWolfHeadModule : CR4HudModuleWolfHead;      
  2449.  
  2450.         hud = (CR4ScriptedHud)GetHud();
  2451.         if ( hud )
  2452.         {
  2453.             hudWolfHeadModule = (CR4HudModuleWolfHead)hud.GetHudModule( "WolfHeadModule" );
  2454.             if ( hudWolfHeadModule )
  2455.             {
  2456.                 hudWolfHeadModule.DisplayMutationFeedback( type );
  2457.             }
  2458.         }
  2459.     }
  2460. }
  2461.  
  2462. function hasSaveDataToLoad():bool
  2463. {
  2464.     var currentSave : SSavegameInfo;
  2465.     var saveGames   : array< SSavegameInfo >;
  2466.    
  2467.     theGame.ListSavedGames( saveGames );
  2468.     if ( saveGames.Size() > 0 )
  2469.     {
  2470.         return true;
  2471.     }
  2472.    
  2473.     return false;
  2474. }
  2475.  
  2476. exec function EnableLog( enable : bool )
  2477. {
  2478.     theGame.EnableLog( enable );
  2479. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement