Advertisement
Guest User

Untitled

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