aslann817

Untitled

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