Guest User

Untitled

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