Advertisement
molenmer

ingamemenu.ws

Aug 24th, 2020
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 62.39 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. enum InGameMenuActionType
  11. {
  12. IGMActionType_CommonMenu = 0,
  13. IGMActionType_Close = 1,
  14. IGMActionType_MenuHolder = 2,
  15. IGMActionType_MenuLastHolder = 3,
  16. IGMActionType_Load = 4,
  17. IGMActionType_Save = 5,
  18. IGMActionType_Quit = 6,
  19. IGMActionType_Preset = 7,
  20. IGMActionType_Toggle = 8,
  21. IGMActionType_List = 9,
  22. IGMActionType_Slider = 10,
  23. IGMActionType_LoadLastSave = 11,
  24. IGMActionType_Tutorials = 12,
  25. IGMActionType_Credits = 13,
  26. IGMActionType_Help = 14,
  27. IGMActionType_Controls = 15,
  28. IGMActionType_ControllerHelp = 16,
  29. IGMActionType_NewGame = 17,
  30. IGMActionType_CloseGame = 18,
  31. IGMActionType_UIRescale = 19,
  32. IGMActionType_Gamma = 20,
  33. IGMActionType_DebugStartQuest = 21,
  34. IGMActionType_Gwint = 22,
  35. IGMActionType_ImportSave = 23,
  36. IGMActionType_KeyBinds = 24,
  37. IGMActionType_Back = 25,
  38. IGMActionType_NewGamePlus = 26,
  39. IGMActionType_InstalledDLC = 27,
  40. IGMActionType_Button = 28,
  41.  
  42. IGMActionType_Options = 100
  43. };
  44.  
  45. enum EIngameMenuConstants
  46. {
  47. IGMC_Difficulty_mask = 7,
  48. IGMC_Tutorials_On = 1024,
  49. IGMC_Simulate_Import = 2048,
  50. IGMC_Import_Save = 4096,
  51. IGMC_EP1_Save = 8192,
  52. IGMC_New_game_plus = 16384,
  53. IGMC_EP2_Save = 32768,
  54. }
  55.  
  56. struct newGameConfig
  57. {
  58. var tutorialsOn : bool;
  59. var difficulty : int;
  60. var simulate_import : bool;
  61. var import_save_index : int;
  62. }
  63.  
  64. class CR4IngameMenu extends CR4MenuBase
  65. {
  66. protected var mInGameConfigWrapper : CInGameConfigWrapper;
  67. protected var inGameConfigBufferedWrapper : CInGameConfigBufferedWrapper;
  68.  
  69. protected var currentNewGameConfig : newGameConfig;
  70.  
  71. private var m_fxNavigateBack : CScriptedFlashFunction;
  72. private var m_fxSetIsMainMenu : CScriptedFlashFunction;
  73. private var m_fxSetCurrentUsername : CScriptedFlashFunction;
  74. private var m_fxSetVersion : CScriptedFlashFunction;
  75. private var m_fxShowHelp : CScriptedFlashFunction;
  76. private var m_fxSetVisible : CScriptedFlashFunction;
  77. private var m_fxSetPanelMode : CScriptedFlashFunction;
  78. private var m_fxRemoveOption : CScriptedFlashFunction;
  79. private var m_fxSetGameLogoLanguage : CScriptedFlashFunction;
  80. private var m_fxUpdateOptionValue : CScriptedFlashFunction;
  81. private var m_fxUpdateInputFeedback : CScriptedFlashFunction;
  82. private var m_fxOnSaveScreenshotRdy : CScriptedFlashFunction;
  83. private var m_fxSetIgnoreInput : CScriptedFlashFunction;
  84. private var m_fxForceEnterCurEntry : CScriptedFlashFunction;
  85. private var m_fxForceBackgroundVis : CScriptedFlashFunction;
  86. private var m_fxSetHardwareCursorOn : CScriptedFlashFunction;
  87. private var m_fxSetExpansionText : CScriptedFlashFunction;
  88. private var m_fxUpdateAnchorsAspectRatio : CScriptedFlashFunction;
  89.  
  90. protected var loadConfPopup : W3ApplyLoadConfirmation;
  91. protected var saveConfPopup : W3SaveGameConfirmation;
  92. protected var newGameConfPopup : W3NewGameConfirmation;
  93. protected var actionConfPopup : W3ActionConfirmation;
  94. protected var deleteConfPopup : W3DeleteSaveConf;
  95. protected var diffChangeConfPopup : W3DifficultyChangeConfirmation;
  96. protected var isShowingSaveList : bool; default isShowingSaveList = false;
  97. protected var isShowingLoadList : bool; default isShowingLoadList = false;
  98.  
  99. protected var smartKeybindingEnabled : bool; default smartKeybindingEnabled = true;
  100.  
  101. public var m_structureCreator : IngameMenuStructureCreator;
  102.  
  103. protected var isInLoadselector : bool; default isInLoadselector = false;
  104. protected var swapAcceptCancelChanged : bool; default swapAcceptCancelChanged = false;
  105. protected var alternativeRadialInputChanged : bool; default alternativeRadialInputChanged = false;
  106. protected var EnableUberMovement : bool; default EnableUberMovement = false;
  107.  
  108. protected var shouldRefreshKinect : bool; default shouldRefreshKinect = false;
  109. public var isMainMenu : bool;
  110.  
  111. protected var managingPause : bool; default managingPause = false;
  112.  
  113. protected var updateInputDeviceRequired : bool; default updateInputDeviceRequired = false;
  114.  
  115. protected var hasChangedOption : bool;
  116. default hasChangedOption = false;
  117.  
  118. protected var gmHasChangedScalingOption : bool; //modSigns
  119. default gmHasChangedScalingOption = false;
  120. protected var gmHasChangedQuestLevelsOption : bool; //modSigns
  121. default gmHasChangedQuestLevelsOption = false;
  122. protected var gmHasChangedGameplayOption : bool; //modSigns
  123. default gmHasChangedGameplayOption = false;
  124. protected var gmHasChangedQoLOption : bool; //modSigns
  125. default gmHasChangedQoLOption = false;
  126.  
  127. private var ignoreInput : bool;
  128. default ignoreInput = false;
  129.  
  130. public var disableAccountPicker : bool;
  131. default disableAccountPicker = false;
  132.  
  133. protected var lastSetTag : int;
  134.  
  135. protected var currentLangValue : string;
  136. protected var lastUsedLangValue : string;
  137. protected var currentSpeechLang : string;
  138. protected var lastUsedSpeechLang : string;
  139. private var languageName : string;
  140.  
  141. private var panelMode : bool; default panelMode = false;
  142.  
  143. public var lastSetDifficulty : int;
  144.  
  145. event OnConfigUI()
  146. {
  147. var initDataObject : W3MenuInitData;
  148. var commonIngameMenu : CR4CommonIngameMenu;
  149. var commonMainMenuBase : CR4CommonMainMenuBase;
  150. var deathScreenMenu : CR4DeathScreenMenu;
  151. var audioLanguageName : string;
  152. var tempLanguageName : string;
  153. var username : string;
  154. var lootPopup : CR4LootPopup;
  155. var ep1StatusText : string;
  156. var ep2StatusText : string;
  157. var width : int;
  158. var height : int;
  159.  
  160. super.OnConfigUI();
  161.  
  162. m_fxNavigateBack = m_flashModule.GetMemberFlashFunction("handleNavigateBack");
  163. m_fxSetIsMainMenu = m_flashModule.GetMemberFlashFunction("setIsMainMenu");
  164. m_fxSetCurrentUsername = m_flashModule.GetMemberFlashFunction("setCurrentUsername");
  165. m_fxSetVersion = m_flashModule.GetMemberFlashFunction("setVersion");
  166. m_fxShowHelp = m_flashModule.GetMemberFlashFunction("showHelpPanel");
  167. m_fxSetVisible = m_flashModule.GetMemberFlashFunction("setVisible");
  168. m_fxSetPanelMode = m_flashModule.GetMemberFlashFunction("setPanelMode");
  169. m_fxRemoveOption = m_flashModule.GetMemberFlashFunction("removeOption");
  170. m_fxSetGameLogoLanguage = m_flashModule.GetMemberFlashFunction( "setGameLogoLanguage" );
  171. m_fxUpdateOptionValue = m_flashModule.GetMemberFlashFunction( "updateOptionValue" );
  172. m_fxUpdateInputFeedback = m_flashModule.GetMemberFlashFunction( "updateInputFeedback" );
  173. m_fxOnSaveScreenshotRdy = m_flashModule.GetMemberFlashFunction( "onSaveScreenshotLoaded" );
  174. m_fxSetIgnoreInput = m_flashModule.GetMemberFlashFunction( "setIgnoreInput" );
  175. m_fxForceEnterCurEntry = m_flashModule.GetMemberFlashFunction( "forceEnterCurrentEntry" );
  176. m_fxForceBackgroundVis = m_flashModule.GetMemberFlashFunction( "setForceBackgroundVisible" );
  177. m_fxSetHardwareCursorOn = m_flashModule.GetMemberFlashFunction( "setHardwareCursorOn" );
  178. m_fxSetExpansionText = m_flashModule.GetMemberFlashFunction( "setExpansionText" );
  179. m_fxUpdateAnchorsAspectRatio = m_flashModule.GetMemberFlashFunction( "UpdateAnchorsAspectRatio" );
  180.  
  181. m_structureCreator = new IngameMenuStructureCreator in this;
  182. m_structureCreator.parentMenu = this;
  183. m_structureCreator.m_flashValueStorage = m_flashValueStorage;
  184. m_structureCreator.m_flashConstructor = m_flashValueStorage.CreateTempFlashObject();
  185.  
  186. m_hideTutorial = false;
  187. m_forceHideTutorial = false;
  188. disableAccountPicker = false;
  189.  
  190. theGame.LoadHudSettings();
  191.  
  192. mInGameConfigWrapper = (CInGameConfigWrapper)theGame.GetInGameConfigWrapper();
  193. inGameConfigBufferedWrapper = theGame.GetGuiManager().GetInGameConfigBufferedWrapper();
  194.  
  195. lootPopup = (CR4LootPopup)theGame.GetGuiManager().GetPopup('LootPopup');
  196.  
  197. if (lootPopup)
  198. {
  199. lootPopup.ClosePopup();
  200. }
  201.  
  202. commonIngameMenu = (CR4CommonIngameMenu)(GetParent());
  203. commonMainMenuBase = (CR4CommonMainMenuBase)(GetParent());
  204. deathScreenMenu = (CR4DeathScreenMenu)(GetParent());
  205.  
  206. if (commonIngameMenu)
  207. {
  208. isMainMenu = false;
  209. panelMode = false;
  210. mInGameConfigWrapper.ActivateScriptTag('inGame');
  211. mInGameConfigWrapper.DeactivateScriptTag('mainMenu');
  212. //---=== modFriendlyHUD ===---
  213. if ((!thePlayer.IsAlive() && !thePlayer.OnCheckUnconscious()) || theGame.HasBlackscreenRequested())// || theGame.IsDialogOrCutscenePlaying())
  214. //---=== modFriendlyHUD ===---
  215. {
  216. CloseMenu();
  217. return true;
  218. }
  219. }
  220. else if (commonMainMenuBase)
  221. {
  222. isMainMenu = true;
  223. panelMode = false;
  224. mInGameConfigWrapper.ActivateScriptTag('mainMenu');
  225. mInGameConfigWrapper.DeactivateScriptTag('inGame');
  226.  
  227. StartShowingCustomDialogs();
  228.  
  229. if (!theGame.IsContentAvailable('content12'))
  230. {
  231. if (theGame.GetDLCManager().IsEP1Available())
  232. {
  233. ep1StatusText = GetLocStringByKeyExt("expansion_status_installed");
  234. }
  235. else
  236. {
  237. ep1StatusText = GetLocStringByKeyExt("expansion_status_available");
  238. }
  239. ep1StatusText = GetLocStringByKeyExt("expansion_status_available");
  240. }
  241.  
  242. if (theGame.GetDLCManager().IsEP2Available())
  243. {
  244. ep2StatusText = GetLocStringByKeyExt("expansion_status_installed");
  245. }
  246. else
  247. {
  248.  
  249. ep2StatusText = GetLocStringByKeyExt("expansion_status_available");
  250. }
  251.  
  252. m_fxSetExpansionText.InvokeSelfTwoArgs(FlashArgString(ep1StatusText), FlashArgString(ep2StatusText));
  253. }
  254.  
  255. if (theGame.AreConfigResetInThisSession() && !theGame.HasShownConfigChangedMessage())
  256. {
  257. showNotification(GetLocStringByKeyExt("update_warning_message"));
  258. OnPlaySoundEvent("gui_global_denied");
  259. theGame.SetHasShownConfigChangedMessage(true);
  260. }
  261. }
  262. else if (deathScreenMenu)
  263. {
  264. isMainMenu = false;
  265. panelMode = true;
  266. mInGameConfigWrapper.DeactivateScriptTag('mainMenu');
  267. mInGameConfigWrapper.DeactivateScriptTag('inGame');
  268.  
  269. deathScreenMenu.HideInputFeedback();
  270.  
  271. if (hasSaveDataToLoad())
  272. {
  273. isInLoadselector = true;
  274. SendLoadData();
  275. m_fxSetPanelMode.InvokeSelfOneArg(FlashArgBool(true));
  276. }
  277. else
  278. {
  279. CloseMenu();
  280. }
  281. }
  282. else
  283. {
  284. initDataObject = (W3MenuInitData)GetMenuInitData();
  285.  
  286. if (initDataObject && initDataObject.getDefaultState() == 'SaveGame')
  287. {
  288. isMainMenu = false;
  289. panelMode = true;
  290.  
  291. managingPause = true;
  292. theInput.StoreContext( 'EMPTY_CONTEXT' );
  293. theGame.Pause('IngameMenu');
  294.  
  295. mInGameConfigWrapper.DeactivateScriptTag('mainMenu');
  296. mInGameConfigWrapper.DeactivateScriptTag('inGame');
  297.  
  298. SendSaveData();
  299. m_fxSetPanelMode.InvokeSelfOneArg(FlashArgBool(true));
  300. }
  301. }
  302.  
  303. IngameMenu_UpdateDLCScriptTags();
  304.  
  305. if (!panelMode)
  306. {
  307. m_fxSetIsMainMenu.InvokeSelfOneArg(FlashArgBool(isMainMenu));
  308.  
  309. if (isMainMenu)
  310. {
  311. username = FixStringForFont(theGame.GetActiveUserDisplayName());
  312. m_fxSetCurrentUsername.InvokeSelfOneArg(FlashArgString(username));
  313.  
  314. m_fxSetVersion.InvokeSelfOneArg(FlashArgString(theGame.GetApplicationVersion()));
  315.  
  316. if( !theGame.IsContentAvailable( 'content12' ) )
  317. {
  318. theGame.GetGuiManager().RefreshMainMenuAfterContentLoaded();
  319. }
  320. }
  321.  
  322. theGame.GetSecondScreenManager().SendGameMenuOpen();
  323.  
  324. lastSetDifficulty = theGame.GetDifficultyLevel();
  325.  
  326. currentLangValue = mInGameConfigWrapper.GetVarValue('Localization', 'Virtual_Localization_text');
  327. lastUsedLangValue = currentLangValue;
  328.  
  329. currentSpeechLang = mInGameConfigWrapper.GetVarValue('Localization', 'Virtual_Localization_speech');
  330. lastUsedSpeechLang = currentSpeechLang;
  331.  
  332. theGame.GetGameLanguageName(audioLanguageName,tempLanguageName);
  333. if( tempLanguageName != languageName )
  334. {
  335. languageName = tempLanguageName;
  336. m_fxSetGameLogoLanguage.InvokeSelfOneArg( FlashArgString(languageName) );
  337. }
  338.  
  339. PopulateMenuData();
  340. }
  341.  
  342. theGame.GetCurrentViewportResolution( width, height );
  343. m_fxUpdateAnchorsAspectRatio.InvokeSelfTwoArgs( FlashArgInt( width ), FlashArgInt( height ) );
  344. }
  345.  
  346. event OnRefresh()
  347. {
  348. var audioLanguageName : string;
  349. var tempLanguageName : string;
  350. var overlayPopupRef : CR4OverlayPopup;
  351. var username : string;
  352. var hud : CR4ScriptedHud;
  353. var ep1StatusText : string;
  354. var ep2StatusText : string;
  355.  
  356.  
  357. currentLangValue = mInGameConfigWrapper.GetVarValue('Localization', 'Virtual_Localization_text');
  358. lastUsedLangValue = currentLangValue;
  359.  
  360. currentSpeechLang = mInGameConfigWrapper.GetVarValue('Localization', 'Virtual_Localization_speech');
  361. lastUsedSpeechLang = currentSpeechLang;
  362.  
  363. if (isMainMenu)
  364. {
  365. username = FixStringForFont(theGame.GetActiveUserDisplayName());
  366. m_fxSetCurrentUsername.InvokeSelfOneArg(FlashArgString(username));
  367.  
  368. PopulateMenuData();
  369.  
  370.  
  371.  
  372.  
  373.  
  374.  
  375.  
  376. }
  377.  
  378. UpdateAcceptCancelSwaping();
  379. SetPlatformType(theGame.GetPlatform());
  380. hud = (CR4ScriptedHud)(theGame.GetHud());
  381. if (hud)
  382. {
  383. hud.UpdateAcceptCancelSwaping();
  384. }
  385.  
  386. overlayPopupRef = (CR4OverlayPopup) theGame.GetGuiManager().GetPopup('OverlayPopup');
  387. if (overlayPopupRef)
  388. {
  389. overlayPopupRef.UpdateAcceptCancelSwaping();
  390. }
  391.  
  392. theGame.GetGameLanguageName(audioLanguageName,tempLanguageName);
  393. if( tempLanguageName != languageName )
  394. {
  395. languageName = tempLanguageName;
  396. m_fxSetGameLogoLanguage.InvokeSelfOneArg( FlashArgString(languageName) );
  397. m_fxUpdateInputFeedback.InvokeSelf();
  398. if (overlayPopupRef)
  399. {
  400. overlayPopupRef.UpdateButtons();
  401. }
  402. }
  403.  
  404. if (!theGame.IsContentAvailable('content12'))
  405. //---=== modFriendlyHUD ===---
  406. if(!ShouldHideDLCIcons())
  407. //---=== modFriendlyHUD ===---
  408. {
  409. if (theGame.GetDLCManager().IsEP1Available())
  410. {
  411. ep1StatusText = GetLocStringByKeyExt("expansion_status_installed");
  412. }
  413. else
  414. {
  415. if (theGame.GetDLCManager().IsEP1Available())
  416. {
  417. ep1StatusText = GetLocStringByKeyExt("expansion_status_installed");
  418. }
  419. else
  420. {
  421. ep1StatusText = GetLocStringByKeyExt("expansion_status_available");
  422. }
  423.  
  424. if (theGame.GetDLCManager().IsEP2Available())
  425. {
  426. ep2StatusText = GetLocStringByKeyExt("expansion_status_installed");
  427. }
  428. else
  429. {
  430.  
  431. ep2StatusText = GetLocStringByKeyExt("expansion_status_available");
  432. }
  433.  
  434. m_fxSetExpansionText.InvokeSelfTwoArgs(FlashArgString(ep1StatusText), FlashArgString(ep2StatusText));
  435. }
  436. setArabicAligmentMode();
  437. }
  438.  
  439. function OnRequestSubMenu( menuName: name, optional initData : IScriptable )
  440. {
  441. RequestSubMenu(menuName, initData);
  442. m_fxSetVisible.InvokeSelfOneArg(FlashArgBool(false));
  443. }
  444.  
  445. function ChildRequestCloseMenu()
  446. {
  447. m_fxSetVisible.InvokeSelfOneArg(FlashArgBool(true));
  448. }
  449.  
  450. event OnCloseMenu()
  451. {
  452. CloseMenu();
  453. }
  454.  
  455. public function ReopenMenu()
  456. {
  457. var commonInGameMenu : CR4CommonIngameMenu;
  458. var commonMainMenuBase : CR4CommonMainMenuBase;
  459.  
  460. commonInGameMenu = (CR4CommonIngameMenu)m_parentMenu;
  461. if(commonInGameMenu)
  462. {
  463. commonInGameMenu.reopenRequested = true;
  464. }
  465.  
  466. commonMainMenuBase = (CR4CommonMainMenuBase)m_parentMenu;
  467. if ( commonMainMenuBase )
  468. {
  469. commonMainMenuBase.reopenRequested = true;
  470. }
  471.  
  472. CloseMenu();
  473. }
  474.  
  475. event OnClosingMenu()
  476. {
  477. var commonInGameMenu : CR4CommonIngameMenu;
  478. var commonMainMenuBase : CR4CommonMainMenuBase;
  479. var deathScreenMenu : CR4DeathScreenMenu;
  480. var controlsFeedbackModule : CR4HudModuleControlsFeedback;
  481. var interactionModule : CR4HudModuleInteractions;
  482. var hud : CR4ScriptedHud;
  483.  
  484. SaveChangedSettings();
  485.  
  486. theGame.GetSecondScreenManager().SendGameMenuClose();
  487. super.OnClosingMenu();
  488.  
  489.  
  490. hud = (CR4ScriptedHud)(theGame.GetHud());
  491. if (hud)
  492. {
  493. controlsFeedbackModule = (CR4HudModuleControlsFeedback)(hud.GetHudModule(NameToString('ControlsFeedbackModule')));
  494. if (controlsFeedbackModule)
  495. {
  496. controlsFeedbackModule.ForceModuleUpdate();
  497. }
  498.  
  499. interactionModule = (CR4HudModuleInteractions)(hud.GetHudModule(NameToString('InteractionsModule')));
  500. if (interactionModule)
  501. {
  502. interactionModule.ForceUpdateModule();
  503. }
  504. }
  505.  
  506. if (managingPause)
  507. {
  508. managingPause = false;
  509. theInput.RestoreContext( 'EMPTY_CONTEXT', true );
  510. theGame.Unpause('IngameMenu');
  511. }
  512.  
  513. if (theGame.GetGuiManager().potalConfirmationPending)
  514. {
  515. theGame.GetGuiManager().ResumePortalConfirmationPendingMessage();
  516. }
  517.  
  518. if (m_structureCreator)
  519. {
  520. delete m_structureCreator;
  521. }
  522.  
  523. if (loadConfPopup)
  524. {
  525. delete loadConfPopup;
  526. }
  527.  
  528. if (saveConfPopup)
  529. {
  530. delete saveConfPopup;
  531. }
  532.  
  533. if (actionConfPopup)
  534. {
  535. delete actionConfPopup;
  536. }
  537.  
  538. if (newGameConfPopup)
  539. {
  540. delete newGameConfPopup;
  541. }
  542.  
  543. if (deleteConfPopup)
  544. {
  545. delete deleteConfPopup;
  546. }
  547.  
  548. if (diffChangeConfPopup)
  549. {
  550. delete diffChangeConfPopup;
  551. }
  552.  
  553. commonInGameMenu = (CR4CommonIngameMenu)m_parentMenu;
  554. if(commonInGameMenu)
  555. {
  556. commonInGameMenu.ChildRequestCloseMenu();
  557. return true;
  558. }
  559.  
  560. commonMainMenuBase = (CR4CommonMainMenuBase)m_parentMenu;
  561. if ( commonMainMenuBase )
  562. {
  563. commonMainMenuBase.ChildRequestCloseMenu();
  564. return true;
  565. }
  566.  
  567. deathScreenMenu = (CR4DeathScreenMenu)m_parentMenu;
  568. if (deathScreenMenu)
  569. {
  570. deathScreenMenu.ChildRequestCloseMenu();
  571. return true;
  572. }
  573. }
  574.  
  575.  
  576. protected function CloseCurrentPopup():void
  577. {
  578. if (loadConfPopup)
  579. {
  580. loadConfPopup.ClosePopupOverlay();
  581. }
  582. else if (saveConfPopup)
  583. {
  584. saveConfPopup.ClosePopupOverlay();
  585. }
  586. else if (actionConfPopup)
  587. {
  588. actionConfPopup.ClosePopupOverlay();
  589. }
  590. else if (newGameConfPopup)
  591. {
  592. newGameConfPopup.ClosePopupOverlay();
  593. }
  594. else if (deleteConfPopup)
  595. {
  596. deleteConfPopup.ClosePopupOverlay();
  597. }
  598. else if (diffChangeConfPopup)
  599. {
  600. diffChangeConfPopup.ClosePopupOverlay();
  601. }
  602. }
  603.  
  604. public function SetIgnoreInput(value : bool) : void
  605. {
  606. if (value != ignoreInput)
  607. {
  608. ignoreInput = value;
  609. m_fxSetIgnoreInput.InvokeSelfOneArg( FlashArgBool(value) );
  610. }
  611. }
  612.  
  613. public function OnUserSignIn() : void
  614. {
  615. SetIgnoreInput(false);
  616. CloseCurrentPopup();
  617. }
  618.  
  619. public function OnUserSignInCancelled() : void
  620. {
  621. SetIgnoreInput(false);
  622. CloseCurrentPopup();
  623. }
  624.  
  625. public function OnSaveLoadingFailed() : void
  626. {
  627. SetIgnoreInput(false);
  628. CloseCurrentPopup();
  629. }
  630.  
  631. event OnItemActivated( actionType:int, menuTag:int ) : void
  632. {
  633. var l_DataFlashArray : CScriptedFlashArray;
  634.  
  635. if (ignoreInput)
  636. {
  637. m_fxNavigateBack.InvokeSelf();
  638. }
  639. else
  640. {
  641. switch (actionType)
  642. {
  643. case IGMActionType_CommonMenu:
  644. theGame.RequestMenu( 'CommonMenu' );
  645. break;
  646. case IGMActionType_MenuHolder:
  647.  
  648.  
  649. m_initialSelectionsToIgnore = 1;
  650. OnPlaySoundEvent( "gui_global_panel_open" );
  651. break;
  652. case IGMActionType_MenuLastHolder:
  653. m_initialSelectionsToIgnore = 1;
  654. OnPlaySoundEvent( "gui_global_panel_open" );
  655. break;
  656. case IGMActionType_Load:
  657. if (hasSaveDataToLoad())
  658. {
  659. SendLoadData();
  660. }
  661. else
  662. {
  663.  
  664. m_fxNavigateBack.InvokeSelf();
  665. }
  666. isInLoadselector = true;
  667. break;
  668. case IGMActionType_Save:
  669. if ( !theGame.AreSavesLocked() )
  670. {
  671. SendSaveData();
  672. }
  673. else
  674. {
  675. m_fxNavigateBack.InvokeSelf();
  676. theGame.GetGuiManager().DisplayLockedSavePopup();
  677. }
  678. isInLoadselector = false;
  679. break;
  680. case IGMActionType_Quit:
  681. if (theGame.GetPlatform() == Platform_Xbox1)
  682. {
  683. ShowActionConfPopup(IGMActionType_Quit, "", GetLocStringByKeyExt("error_message_exit_game_x1"));
  684. }
  685. else if (theGame.GetPlatform() == Platform_PS4)
  686. {
  687. ShowActionConfPopup(IGMActionType_Quit, "", GetLocStringByKeyExt("error_message_exit_game_ps4"));
  688. }
  689. else
  690. {
  691. ShowActionConfPopup(IGMActionType_Quit, "", GetLocStringByKeyExt("error_message_exit_game"));
  692. }
  693. break;
  694. case IGMActionType_Toggle:
  695. break;
  696. case IGMActionType_List:
  697. break;
  698. case IGMActionType_Slider:
  699. break;
  700. case IGMActionType_LoadLastSave:
  701. LoadLastSave();
  702. break;
  703. case IGMActionType_Close:
  704.  
  705. break;
  706. case IGMActionType_Tutorials:
  707. theGame.RequestMenuWithBackground( 'GlossaryTutorialsMenu', 'CommonMenu' );
  708. break;
  709. case IGMActionType_Credits:
  710. theGame.GetGuiManager().RequestCreditsMenu(menuTag);
  711. break;
  712. case IGMActionType_Help:
  713. showHelpPanel();
  714. break;
  715. case IGMActionType_Options:
  716. if (theGame.GetPlatform() == Platform_PC)
  717. {
  718. m_fxSetHardwareCursorOn.InvokeSelfOneArg(FlashArgBool(mInGameConfigWrapper.GetVarValue('Rendering', 'HardwareCursor')));
  719. }
  720. l_DataFlashArray = IngameMenu_FillOptionsSubMenuData(m_flashValueStorage, isMainMenu);
  721.  
  722. m_initialSelectionsToIgnore = 1;
  723. OnPlaySoundEvent( "gui_global_panel_open" );
  724.  
  725. m_flashValueStorage.SetFlashArray( "ingamemenu.options.entries", l_DataFlashArray );
  726. break;
  727. case IGMActionType_ControllerHelp:
  728. SendControllerData();
  729. break;
  730. case IGMActionType_NewGame:
  731. TryStartNewGame(menuTag);
  732. break;
  733. case IGMActionType_NewGamePlus:
  734. fetchNewGameConfigFromTag(menuTag);
  735. SendNewGamePlusSaves();
  736. break;
  737. case IGMActionType_InstalledDLC:
  738. SendInstalledDLCList();
  739. break;
  740. case IGMActionType_UIRescale:
  741. SendRescaleData();
  742. break;
  743. case IGMActionType_DebugStartQuest:
  744. RequestSubMenu( 'MainDbgStartQuestMenu', GetMenuInitData() );
  745. break;
  746. case IGMActionType_Gwint:
  747. GetRootMenu().CloseMenu();
  748. theGame.RequestMenu( 'DeckBuilder' );
  749. break;
  750. case IGMActionType_ImportSave:
  751. lastSetTag = menuTag;
  752. fetchNewGameConfigFromTag( menuTag );
  753. SendImportSaveData( );
  754. break;
  755. case IGMActionType_CloseGame:
  756. if (!isMainMenu)
  757. {
  758. ShowActionConfPopup(IGMActionType_CloseGame, "", GetLocStringByKeyExt("error_message_exit_game"));
  759. }
  760. else
  761. {
  762. theGame.RequestExit();
  763. }
  764. break;
  765. case IGMActionType_KeyBinds:
  766. SendKeybindData();
  767. break;
  768. }
  769. }
  770. }
  771.  
  772. public function HandleLoadGameFailed():void
  773. {
  774. disableAccountPicker = false;
  775. SetIgnoreInput(false);
  776. }
  777.  
  778. private function StartShowingCustomDialogs()
  779. {
  780. //this function should be empty
  781. //if you have merging conflict here, choose lines from A
  782. //and make sure that this part of merged file
  783. //matches the code in A - i.e. has only these comments
  784. //between opening and closing bracket
  785. }
  786.  
  787. protected function prepareBigMessage( epIndex : int ):void
  788. {
  789. var l_DataFlashObject : CScriptedFlashObject;
  790.  
  791. l_DataFlashObject = m_flashValueStorage.CreateTempFlashObject();
  792.  
  793. l_DataFlashObject.SetMemberFlashInt( "index", epIndex );
  794. l_DataFlashObject.SetMemberFlashString( "tfTitle1", GetLocStringByKeyExt("ep" + epIndex + "_installed_information_title_1") );
  795. l_DataFlashObject.SetMemberFlashString( "tfTitle2", GetLocStringByKeyExt("ep" + epIndex + "_installed_information_title_2") );
  796.  
  797. l_DataFlashObject.SetMemberFlashString( "tfTitlePath1", GetLocStringByKeyExt("ep" + epIndex + "_installed_information_title_path_1") );
  798. l_DataFlashObject.SetMemberFlashString( "tfTitlePath2", GetLocStringByKeyExt("ep" + epIndex + "_installed_information_title_path_2") );
  799. l_DataFlashObject.SetMemberFlashString( "tfTitlePath3", GetLocStringByKeyExt("ep" + epIndex + "_installed_information_title_path_3") );
  800.  
  801. l_DataFlashObject.SetMemberFlashString( "tfDescPath1", GetLocStringByKeyExt("ep" + epIndex + "_installed_information_title_path_1_description") );
  802. l_DataFlashObject.SetMemberFlashString( "tfDescPath2", GetLocStringByKeyExt("ep" + epIndex + "_installed_information_title_path_2_description") );
  803. l_DataFlashObject.SetMemberFlashString( "tfDescPath3", GetLocStringByKeyExt("ep" + epIndex + "_installed_information_title_path_3_description") );
  804.  
  805. l_DataFlashObject.SetMemberFlashString( "tfWarning", GetLocStringByKeyExt("ep" + epIndex + "_installed_information_warning_level") );
  806. l_DataFlashObject.SetMemberFlashString( "tfGoodLuck", GetLocStringByKeyExt("ep" + epIndex + "_installed_information_good_luck") );
  807.  
  808. m_flashValueStorage.SetFlashObject( "ingamemenu.bigMessage" + epIndex, l_DataFlashObject );
  809. }
  810.  
  811. private function prepareBigMessageGOTY( text : string )
  812. {
  813. var l_DataFlashObject : CScriptedFlashObject;
  814. var title1 : string;
  815. var content : string;
  816. var titleEnd : string;
  817.  
  818. l_DataFlashObject = m_flashValueStorage.CreateTempFlashObject();
  819.  
  820. title1 = GetLocStringByKey( text );
  821. content = GetLocStringByKey( "menu_goty_starting_message_content" );
  822. titleEnd = GetLocStringByKey( "ep1_installed_information_good_luck" );
  823.  
  824. l_DataFlashObject.SetMemberFlashInt( "index", 3 );
  825. l_DataFlashObject.SetMemberFlashString( "tfTitle1", title1 );
  826. l_DataFlashObject.SetMemberFlashString( "tfContent", content );
  827. l_DataFlashObject.SetMemberFlashString( "tfTitleEnd", titleEnd );
  828.  
  829. m_flashValueStorage.SetFlashObject( "ingamemenu.bigMessage3", l_DataFlashObject );
  830.  
  831. }
  832.  
  833. protected function LoadLastSave():void
  834. {
  835. if (theGame.GetGuiManager().GetPopup('MessagePopup') && theGame.GetGuiManager().lastMessageData.messageId == UMID_ControllerDisconnected)
  836. {
  837. return;
  838. }
  839.  
  840. SetIgnoreInput(true);
  841.  
  842. if (isMainMenu)
  843. {
  844. disableAccountPicker = true;
  845. }
  846.  
  847. theGame.LoadLastGameInit();
  848. }
  849.  
  850. protected function ShowActionConfPopup(action : int, title : string, description : string) : void
  851. {
  852. if (actionConfPopup)
  853. {
  854. delete actionConfPopup;
  855. }
  856.  
  857. actionConfPopup = new W3ActionConfirmation in this;
  858. actionConfPopup.SetMessageTitle(title);
  859. actionConfPopup.SetMessageText(description);
  860. actionConfPopup.actionID = action;
  861. actionConfPopup.menuRef = this;
  862. actionConfPopup.BlurBackground = true;
  863.  
  864. RequestSubMenu('PopupMenu', actionConfPopup);
  865. }
  866.  
  867. public function OnActionConfirmed(action:int) : void
  868. {
  869. var parentMenu : CR4MenuBase;
  870.  
  871. parentMenu = (CR4MenuBase)GetParent();
  872.  
  873. switch (action)
  874. {
  875. case IGMActionType_Quit:
  876. {
  877. parentMenu.OnCloseMenu();
  878. theGame.RequestEndGame();
  879. break;
  880. }
  881. case IGMActionType_CloseGame:
  882. {
  883. theGame.RequestExit();
  884. break;
  885. }
  886. }
  887. }
  888.  
  889. event OnPresetApplied(groupId:name, targetPresetIndex:int)
  890. {
  891. hasChangedOption = true;
  892. IngameMenu_ChangePresetValue(groupId, targetPresetIndex, this);
  893.  
  894. //modSigns
  895. if (groupId == 'GMScalingOptions')
  896. gmHasChangedScalingOption = true;
  897. if (groupId == 'GMExpOptions')
  898. gmHasChangedQuestLevelsOption = true;
  899. if (groupId == 'GMGameplayOptions')
  900. gmHasChangedGameplayOption = true;
  901. if (groupId == 'GMQOLOptions')
  902. gmHasChangedQoLOption = true;
  903.  
  904. if (groupId == 'Rendering' && !isMainMenu)
  905. {
  906. m_fxForceBackgroundVis.InvokeSelfOneArg(FlashArgBool(true));
  907. }
  908. }
  909.  
  910. public function UpdateOptions(groupId:name)
  911. {
  912. var optionChangeContainer : CScriptedFlashObject;
  913.  
  914. optionChangeContainer = m_flashValueStorage.CreateTempFlashObject();
  915. IngameMenu_GatherOptionUpdatedValues(groupId, optionChangeContainer, m_flashValueStorage);
  916.  
  917. m_flashValueStorage.SetFlashObject( "ingamemenu.optionValueChanges", optionChangeContainer );
  918. }
  919.  
  920. event OnOptionValueChanged(groupId:int, optionName:name, optionValue:string)
  921. {
  922. var groupName:name;
  923. var hud : CR4ScriptedHud;
  924. var isValid : bool;
  925. var isBuffered : bool;
  926.  
  927. hasChangedOption = true;
  928.  
  929. OnPlaySoundEvent( "gui_global_switch" );
  930.  
  931. if (groupId == NameToFlashUInt('SpecialSettingsGroupId'))
  932. {
  933. HandleSpecialValueChanged(optionName, optionValue);
  934. return true;
  935. }
  936.  
  937. if (optionName == 'HardwareCursor')
  938. {
  939. isValid = optionValue;
  940. m_fxSetHardwareCursorOn.InvokeSelfOneArg(FlashArgBool(isValid));
  941. }
  942.  
  943. //modSigns
  944. if (groupId == NameToFlashUInt('GMScalingOptions')) //for whatever reason this doesn't work
  945. gmHasChangedScalingOption = true;
  946. if (gmIsScalingOption(optionName))
  947. gmHasChangedScalingOption = true;
  948. if (optionName == 'GMNoQuestLevels')
  949. gmHasChangedQuestLevelsOption = true;
  950. if (gmIsGameplayOption(optionName))
  951. gmHasChangedGameplayOption = true;
  952. if (gmIsQoLOption(optionName))
  953. gmHasChangedQoLOption = true;
  954.  
  955. if (optionName == 'SwapAcceptCancel')
  956. {
  957. swapAcceptCancelChanged = true;
  958. }
  959.  
  960. if (optionName == 'AlternativeRadialMenuInputMode')
  961. {
  962. alternativeRadialInputChanged = true;
  963. }
  964.  
  965. if (optionName == 'EnableUberMovement')
  966. {
  967. if ( optionValue == "1" )
  968. theGame.EnableUberMovement( true );
  969. else
  970. theGame.EnableUberMovement( false );
  971. }
  972.  
  973. if (optionName == 'GwentDifficulty')
  974. {
  975. if ( optionValue == "0" )
  976. FactsSet( 'gwent_difficulty' , 1 );
  977. else if ( optionValue == "1" )
  978. FactsSet( 'gwent_difficulty' , 2 );
  979. else if ( optionValue == "2" )
  980. FactsSet( 'gwent_difficulty' , 3 );
  981.  
  982. return true;
  983. }
  984.  
  985. if (optionName == 'HardwareCursor')
  986. {
  987. updateInputDeviceRequired = true;
  988. }
  989.  
  990. groupName = mInGameConfigWrapper.GetGroupName(groupId);
  991.  
  992.  
  993. isBuffered = mInGameConfigWrapper.DoGroupHasTag( groupName, 'buffered' );
  994. if( isBuffered == false )
  995. {
  996. isBuffered = mInGameConfigWrapper.DoVarHasTag( groupName, optionName, 'buffered' );
  997. }
  998.  
  999. if( isBuffered == true )
  1000. {
  1001. inGameConfigBufferedWrapper.SetVarValue(groupName, optionName, optionValue);
  1002. }
  1003. else
  1004. {
  1005. mInGameConfigWrapper.SetVarValue(groupName, optionName, optionValue);
  1006. }
  1007.  
  1008. theGame.OnConfigValueChanged(optionName, optionValue);
  1009.  
  1010. if (groupName == 'Hud' || optionName == 'Subtitles')
  1011. {
  1012. hud = (CR4ScriptedHud)theGame.GetHud();
  1013.  
  1014. if (hud)
  1015. {
  1016. hud.UpdateHudConfig(optionName, true);
  1017. }
  1018. }
  1019.  
  1020. if (groupName == 'Localization')
  1021. {
  1022. if (optionName == 'Virtual_Localization_text')
  1023. {
  1024. currentLangValue = optionValue;
  1025. }
  1026. else if (optionName == 'Virtual_Localization_speech')
  1027. {
  1028. currentSpeechLang = optionValue;
  1029. }
  1030. }
  1031.  
  1032. if (groupName == 'Rendering' && !isMainMenu)
  1033. {
  1034. m_fxForceBackgroundVis.InvokeSelfOneArg(FlashArgBool(true));
  1035. }
  1036.  
  1037. if (groupName == 'Rendering' && optionName == 'PreserveSystemGamma')
  1038. {
  1039. theGame.GetGuiManager().DisplayRestartGameToApplyAllChanges();
  1040. }
  1041. }
  1042.  
  1043. event OnButtonClicked( optionName : name )
  1044. {
  1045. if ( optionName == 'MoreSpeechLanguages' )
  1046. {
  1047. theGame.DisplayStore();
  1048. }
  1049. }
  1050.  
  1051. protected function HandleSpecialValueChanged(optionName:name, optionValue:string):void
  1052. {
  1053. var intValue : int;
  1054.  
  1055. if (optionName == 'GameDifficulty')
  1056. {
  1057. intValue = StringToInt(optionValue, 1);
  1058.  
  1059. lastSetDifficulty = intValue + 1;
  1060. }
  1061. }
  1062.  
  1063. public function OnGraphicsUpdated(keepChanges:bool):void
  1064. {
  1065.  
  1066.  
  1067.  
  1068.  
  1069.  
  1070. }
  1071.  
  1072. event OnOptionPanelNavigateBack()
  1073. {
  1074. var graphicChangesPending:bool;
  1075. var hud : CR4ScriptedHud;
  1076.  
  1077. if (inGameConfigBufferedWrapper.AnyBufferedVarHasTag('refreshViewport'))
  1078. {
  1079. inGameConfigBufferedWrapper.ApplyNewValues();
  1080. theGame.GetGuiManager().ShowProgressDialog(UMID_GraphicsRefreshing, "", "message_text_confirm_option_changes", true, UDB_OkCancel, 100, UMPT_GraphicsRefresh, '');
  1081. ReopenMenu();
  1082. return true;
  1083. }
  1084.  
  1085. hud = (CR4ScriptedHud)theGame.GetHud();
  1086. if (hud)
  1087. {
  1088. hud.RefreshHudConfiguration();
  1089. }
  1090.  
  1091. thePlayer.SetAutoCameraCenter( inGameConfigBufferedWrapper.GetVarValue( 'Gameplay', 'AutoCameraCenter' ) );
  1092. thePlayer.SetEnemyUpscaling( inGameConfigBufferedWrapper.GetVarValue( 'Gameplay', 'EnemyUpscaling' ) );
  1093. }
  1094.  
  1095. event OnNavigatedBack()
  1096. {
  1097. var lowestDifficultyUsed : EDifficultyMode;
  1098. var hud : CR4ScriptedHud;
  1099. var overlayPopupRef : CR4OverlayPopup;
  1100. var radialMenuModule : CR4HudModuleRadialMenu;
  1101. var confirmResult : int;
  1102.  
  1103. hud = (CR4ScriptedHud)(theGame.GetHud());
  1104. overlayPopupRef = (CR4OverlayPopup) theGame.GetGuiManager().GetPopup('OverlayPopup');
  1105.  
  1106. if( inGameConfigBufferedWrapper.IsEmpty() == false )
  1107. {
  1108. if (!inGameConfigBufferedWrapper.AnyBufferedVarHasTag('refreshViewport'))
  1109. {
  1110. inGameConfigBufferedWrapper.FlushBuffer();
  1111. }
  1112.  
  1113. hasChangedOption = true;
  1114. }
  1115.  
  1116. if (currentLangValue != lastUsedLangValue || lastUsedSpeechLang != currentSpeechLang)
  1117. {
  1118. lastUsedLangValue = currentLangValue;
  1119. lastUsedSpeechLang = currentSpeechLang;
  1120. theGame.ReloadLanguage();
  1121.  
  1122. }
  1123.  
  1124. if (swapAcceptCancelChanged)
  1125. {
  1126. swapAcceptCancelChanged = false;
  1127. UpdateAcceptCancelSwaping();
  1128.  
  1129. if (hud)
  1130. {
  1131. hud.UpdateAcceptCancelSwaping();
  1132. }
  1133.  
  1134. if (overlayPopupRef)
  1135. {
  1136. overlayPopupRef.UpdateAcceptCancelSwaping();
  1137. }
  1138. }
  1139.  
  1140. if (alternativeRadialInputChanged)
  1141. {
  1142. alternativeRadialInputChanged = false;
  1143.  
  1144. if (hud)
  1145. {
  1146. radialMenuModule = (CR4HudModuleRadialMenu)hud.GetHudModule( "RadialMenuModule" );
  1147. if (radialMenuModule)
  1148. {
  1149. radialMenuModule.UpdateInputMode();
  1150. }
  1151. }
  1152. }
  1153.  
  1154. isShowingSaveList = false;
  1155. isShowingLoadList = false;
  1156.  
  1157. OnPlaySoundEvent( "gui_global_panel_close" );
  1158.  
  1159. lowestDifficultyUsed = theGame.GetLowestDifficultyUsed();
  1160.  
  1161.  
  1162.  
  1163. if (!isMainMenu && theGame.GetDifficultyLevel() != lastSetDifficulty && lowestDifficultyUsed > lastSetDifficulty && lowestDifficultyUsed > EDM_Medium)
  1164. {
  1165. diffChangeConfPopup = new W3DifficultyChangeConfirmation in this;
  1166.  
  1167. diffChangeConfPopup.SetMessageTitle("");
  1168.  
  1169. if (theGame.GetPlatform() == Platform_PS4)
  1170. {
  1171. diffChangeConfPopup.SetMessageText(GetLocStringByKeyExt("difficulty_change_warning_message_PS4"));
  1172. }
  1173. else
  1174. {
  1175. diffChangeConfPopup.SetMessageText(GetLocStringByKeyExt("difficulty_change_warning_message_X1"));
  1176. }
  1177.  
  1178. diffChangeConfPopup.menuRef = this;
  1179. diffChangeConfPopup.targetDifficulty = lastSetDifficulty;
  1180. diffChangeConfPopup.BlurBackground = true;
  1181.  
  1182. RequestSubMenu('PopupMenu', diffChangeConfPopup);
  1183. }
  1184. else if (lastSetDifficulty != theGame.GetDifficultyLevel())
  1185. {
  1186. theGame.SetDifficultyLevel(lastSetDifficulty);
  1187. theGame.OnDifficultyChanged(lastSetDifficulty);
  1188. }
  1189.  
  1190. SaveChangedSettings();
  1191.  
  1192. if (overlayPopupRef && updateInputDeviceRequired)
  1193. {
  1194. updateInputDeviceRequired = false;
  1195. overlayPopupRef.UpdateInputDevice();
  1196. }
  1197. }
  1198.  
  1199. public function CancelDifficultyChange() : void
  1200. {
  1201. var difficultyIndex:int;
  1202. var difficultyIndexAsString:string;
  1203.  
  1204. lastSetDifficulty = theGame.GetDifficultyLevel();
  1205.  
  1206. difficultyIndex = lastSetDifficulty - 1;
  1207. difficultyIndexAsString = "" + difficultyIndex;
  1208. m_fxUpdateOptionValue.InvokeSelfTwoArgs(FlashArgUInt(NameToFlashUInt('GameDifficulty')), FlashArgString(difficultyIndexAsString));
  1209. }
  1210.  
  1211. //modSigns
  1212. protected function gmUserSettings()
  1213. {
  1214. //theGame.witcherLog.AddMessage("gmHasChangedScalingOption = " + gmHasChangedScalingOption);
  1215. if(gmHasChangedScalingOption)
  1216. {
  1217. gmHasChangedScalingOption = false;
  1218. theGame.gmUserSettingsScaling();
  1219. }
  1220. if(gmHasChangedQuestLevelsOption)
  1221. {
  1222. gmHasChangedQuestLevelsOption = false;
  1223. theGame.gmUserSettingsQuestLevels();
  1224. }
  1225. if(gmHasChangedGameplayOption)
  1226. {
  1227. gmHasChangedGameplayOption = false;
  1228. theGame.gmUserSettingsGameplay();
  1229. }
  1230. if(gmHasChangedQoLOption)
  1231. {
  1232. gmHasChangedQoLOption = false;
  1233. theGame.gmUserSettingsQoL();
  1234. }
  1235. }
  1236.  
  1237. protected function SaveChangedSettings()
  1238. {
  1239. if (hasChangedOption)
  1240. {
  1241. hasChangedOption = false;
  1242. gmUserSettings(); //modSigns
  1243. theGame.SaveUserSettings();
  1244. //---=== modFriendlyHUD ===---
  1245. GetFHUDConfig().UpdateUserSettings();
  1246. //---=== modFriendlyHUD ===---
  1247. }
  1248. //modFOVTweak begin
  1249. thePlayer.ModFOVTweakUpdateFOV();
  1250. //modFOVTweak end
  1251. }
  1252.  
  1253. event OnProfileChange()
  1254. {
  1255. if( !disableAccountPicker )
  1256. {
  1257. SetIgnoreInput(true);
  1258. theGame.ChangeActiveUser();
  1259. }
  1260. }
  1261.  
  1262. event OnSaveGameCalled(type : ESaveGameType, saveArrayIndex : int)
  1263. {
  1264. var saves : array< SSavegameInfo >;
  1265. var currentSave : SSavegameInfo;
  1266.  
  1267. ignoreInput = true;
  1268.  
  1269. if ( theGame.AreSavesLocked() )
  1270. {
  1271. theGame.GetGuiManager().DisplayLockedSavePopup();
  1272. SetIgnoreInput(false);
  1273. return false;
  1274. }
  1275.  
  1276. if (saveArrayIndex >= 0)
  1277. {
  1278. if (saveConfPopup)
  1279. {
  1280. delete saveConfPopup;
  1281. }
  1282.  
  1283. theGame.ListSavedGames( saves );
  1284. currentSave = saves[ saveArrayIndex ];
  1285.  
  1286. saveConfPopup = new W3SaveGameConfirmation in this;
  1287. saveConfPopup.SetMessageTitle("");
  1288. if (theGame.GetPlatform() == Platform_Xbox1)
  1289. {
  1290. saveConfPopup.SetMessageText(GetLocStringByKeyExt("error_message_overwrite_save_x1"));
  1291. }
  1292. else if (theGame.GetPlatform() == Platform_PS4)
  1293. {
  1294. saveConfPopup.SetMessageText(GetLocStringByKeyExt("error_message_overwrite_save_ps4"));
  1295. }
  1296. else
  1297. {
  1298. saveConfPopup.SetMessageText(GetLocStringByKeyExt("error_message_overwrite_save"));
  1299. }
  1300. saveConfPopup.menuRef = this;
  1301. saveConfPopup.type = currentSave.slotType;
  1302. saveConfPopup.slot = currentSave.slotIndex;
  1303. saveConfPopup.BlurBackground = true;
  1304.  
  1305. RequestSubMenu('PopupMenu', saveConfPopup);
  1306. }
  1307. else
  1308. {
  1309. executeSave(type, -1);
  1310. SetIgnoreInput(false);
  1311. }
  1312. }
  1313.  
  1314. public function executeSave(type : ESaveGameType, slot : int)
  1315. {
  1316. var hadLoadable:bool;
  1317.  
  1318. hadLoadable = hasSaveDataToLoad();
  1319.  
  1320. theGame.SaveGame(type, slot);
  1321. m_fxNavigateBack.InvokeSelf();
  1322. }
  1323.  
  1324. event OnLoadGameCalled(type : ESaveGameType, saveListIndex : int)
  1325. {
  1326. var saveGameRef : SSavegameInfo;
  1327. var saveGames : array< SSavegameInfo >;
  1328.  
  1329. if (ignoreInput)
  1330. {
  1331. return false;
  1332. }
  1333.  
  1334. disableAccountPicker = true;
  1335.  
  1336. if (loadConfPopup)
  1337. {
  1338. delete loadConfPopup;
  1339. }
  1340.  
  1341. theGame.ListSavedGames( saveGames );
  1342. saveGameRef = saveGames[saveListIndex];
  1343.  
  1344. if (panelMode || (isMainMenu && !hasValidAutosaveData()))
  1345. {
  1346. LoadSaveRequested(saveGameRef);
  1347. }
  1348. else
  1349. {
  1350. loadConfPopup = new W3ApplyLoadConfirmation in this;
  1351.  
  1352. if (theGame.GetPlatform() == Platform_Xbox1)
  1353. {
  1354. loadConfPopup.SetMessageTitle(GetLocStringByKeyExt("panel_mainmenu_popup_load_title_x1"));
  1355. }
  1356. else if (theGame.GetPlatform() == Platform_PS4)
  1357. {
  1358. loadConfPopup.SetMessageTitle(GetLocStringByKeyExt("panel_mainmenu_popup_load_title_ps4"));
  1359. }
  1360. else
  1361. {
  1362. loadConfPopup.SetMessageTitle(GetLocStringByKeyExt("panel_mainmenu_popup_load_title"));
  1363. }
  1364.  
  1365. if (isMainMenu)
  1366. {
  1367. if (theGame.GetPlatform() == Platform_Xbox1)
  1368. {
  1369. loadConfPopup.SetMessageText(GetLocStringByKeyExt("error_message_load_game_main_menu_x1"));
  1370. }
  1371. else if (theGame.GetPlatform() == Platform_PS4)
  1372. {
  1373. loadConfPopup.SetMessageText(GetLocStringByKeyExt("error_message_load_game_main_menu_ps4"));
  1374. }
  1375. else
  1376. {
  1377. loadConfPopup.SetMessageText(GetLocStringByKeyExt("error_message_load_game_main_menu"));
  1378. }
  1379. }
  1380. else
  1381. {
  1382. if (theGame.GetPlatform() == Platform_Xbox1)
  1383. {
  1384. loadConfPopup.SetMessageText(GetLocStringByKeyExt("error_message_load_game_x1"));
  1385. }
  1386. else if (theGame.GetPlatform() == Platform_PS4)
  1387. {
  1388. loadConfPopup.SetMessageText(GetLocStringByKeyExt("error_message_load_game_ps4"));
  1389. }
  1390. else
  1391. {
  1392. loadConfPopup.SetMessageText(GetLocStringByKeyExt("error_message_load_game"));
  1393. }
  1394. }
  1395. loadConfPopup.menuRef = this;
  1396. loadConfPopup.saveSlotRef = saveGameRef;
  1397. loadConfPopup.BlurBackground = true;
  1398.  
  1399. SetIgnoreInput(true);
  1400.  
  1401. RequestSubMenu('PopupMenu', loadConfPopup);
  1402. }
  1403. }
  1404.  
  1405. public function LoadSaveRequested(saveSlotRef : SSavegameInfo) : void
  1406. {
  1407. if (theGame.GetGuiManager().GetPopup('MessagePopup') && theGame.GetGuiManager().lastMessageData.messageId == UMID_ControllerDisconnected)
  1408. {
  1409. SetIgnoreInput(false);
  1410. disableAccountPicker = false;
  1411. return;
  1412. }
  1413.  
  1414. SetIgnoreInput(true);
  1415.  
  1416. if (isMainMenu)
  1417. {
  1418. disableAccountPicker = true;
  1419. }
  1420.  
  1421. theGame.LoadGameInit( saveSlotRef );
  1422. }
  1423.  
  1424. event OnImportGameCalled(menuTag:int):void
  1425. {
  1426. var savesToImport : array< SSavegameInfo >;
  1427. var difficulty:int;
  1428. var tutorialsEnabled:bool;
  1429. var simulateImport:bool;
  1430. var maskResult:int;
  1431. var progress : float;
  1432.  
  1433. if (!theGame.IsContentAvailable('launch0'))
  1434. {
  1435. progress = theGame.ProgressToContentAvailable('launch0');
  1436. theSound.SoundEvent("gui_global_denied");
  1437. theGame.GetGuiManager().ShowProgressDialog(0, "", "error_message_new_game_not_ready", true, UDB_Ok, progress, UMPT_Content, 'launch0');
  1438.  
  1439. }
  1440. else
  1441. {
  1442. theGame.ListW2SavedGames( savesToImport );
  1443.  
  1444. if ( menuTag < savesToImport.Size() )
  1445. {
  1446. disableAccountPicker = true;
  1447.  
  1448. theGame.ClearInitialFacts();
  1449.  
  1450. if (theGame.ImportSave( savesToImport[ menuTag ] ))
  1451. {
  1452. currentNewGameConfig.import_save_index = menuTag;
  1453.  
  1454. if ((lastSetTag & IGMC_New_game_plus) == IGMC_New_game_plus)
  1455. {
  1456. m_fxForceEnterCurEntry.InvokeSelf();
  1457. }
  1458. else
  1459. {
  1460.  
  1461. theGame.SetDifficultyLevel(currentNewGameConfig.difficulty);
  1462. TutorialMessagesEnable(currentNewGameConfig.tutorialsOn);
  1463.  
  1464. if ( theGame.RequestNewGame( theGame.GetNewGameDefinitionFilename() ) )
  1465. {
  1466. OnPlaySoundEvent("gui_global_game_start");
  1467. OnPlaySoundEvent("mus_intro_usm");
  1468. GetRootMenu().CloseMenu();
  1469. }
  1470. }
  1471. }
  1472. else
  1473. {
  1474. showNotification(GetLocStringByKeyExt("import_witcher_two_failed"));
  1475. OnPlaySoundEvent("gui_global_denied");
  1476. }
  1477. }
  1478. }
  1479. }
  1480.  
  1481. event OnNewGamePlusCalled(saveListIndex:int):void
  1482. {
  1483. var startGameStatus : ENewGamePlusStatus;
  1484. var saveGameRef : SSavegameInfo;
  1485. var saveGames : array< SSavegameInfo >;
  1486. var errorMessage : string;
  1487. var progress : float;
  1488.  
  1489. var requiredContent : name = 'content12';
  1490.  
  1491. ignoreInput = true;
  1492.  
  1493. if (!theGame.IsContentAvailable(requiredContent))
  1494. {
  1495. progress = theGame.ProgressToContentAvailable(requiredContent);
  1496. theSound.SoundEvent("gui_global_denied");
  1497. SetIgnoreInput(false);
  1498. theGame.GetGuiManager().ShowProgressDialog(0, "", "error_message_new_game_not_ready", true, UDB_Ok, progress, UMPT_Content, requiredContent);
  1499. }
  1500. else
  1501. {
  1502. disableAccountPicker = true;
  1503.  
  1504. theGame.ListSavedGames( saveGames );
  1505. saveGameRef = saveGames[saveListIndex];
  1506.  
  1507. if (currentNewGameConfig.import_save_index == -1 && currentNewGameConfig.simulate_import)
  1508. {
  1509. theGame.AddInitialFact("simulate_import_ingame");
  1510. }
  1511.  
  1512. theGame.SetDifficultyLevel(currentNewGameConfig.difficulty);
  1513.  
  1514. TutorialMessagesEnable(currentNewGameConfig.tutorialsOn);
  1515.  
  1516. startGameStatus = theGame.StartNewGamePlus(saveGameRef);
  1517.  
  1518. if (startGameStatus == NGP_Success)
  1519. {
  1520. theGame.GetGuiManager().RequestMouseCursor(false);
  1521. OnPlaySoundEvent("gui_global_game_start");
  1522. OnPlaySoundEvent("mus_intro_usm");
  1523. GetRootMenu().CloseMenu();
  1524. }
  1525. else
  1526. {
  1527. errorMessage = "";
  1528. SetIgnoreInput(false);
  1529. disableAccountPicker = false;
  1530.  
  1531. switch (startGameStatus)
  1532. {
  1533. case NGP_Invalid:
  1534. errorMessage = GetLocStringByKeyExt("newgame_plus_error_invalid");
  1535. break;
  1536. case NGP_CantLoad:
  1537. errorMessage = GetLocStringByKeyExt("newgame_plus_error_cantload");
  1538. break;
  1539. case NGP_TooOld:
  1540. errorMessage = GetLocStringByKeyExt("newgame_plus_error_too_old");
  1541. break;
  1542. case NGP_RequirementsNotMet:
  1543. errorMessage = GetLocStringByKeyExt("newgame_plus_error_requirementnotmet");
  1544. break;
  1545. case NGP_InternalError:
  1546. errorMessage = GetLocStringByKeyExt("newgame_plus_error_internalerror");
  1547. break;
  1548. case NGP_ContentRequired:
  1549. errorMessage = GetLocStringByKeyExt("newgame_plus_error_contentrequired");
  1550. break;
  1551. }
  1552.  
  1553. showNotification(errorMessage);
  1554. OnPlaySoundEvent("gui_global_denied");
  1555. }
  1556. }
  1557. }
  1558.  
  1559. event OnDeleteSaveCalled(type : ESaveGameType, saveListIndex : int, isSaveMode:bool)
  1560. {
  1561. if (ignoreInput)
  1562. {
  1563. return false;
  1564. }
  1565.  
  1566. SetIgnoreInput(true);
  1567.  
  1568. disableAccountPicker = true;
  1569.  
  1570. if (deleteConfPopup)
  1571. {
  1572. delete deleteConfPopup;
  1573. }
  1574.  
  1575. deleteConfPopup = new W3DeleteSaveConf in this;
  1576. deleteConfPopup.SetMessageTitle("");
  1577. if (theGame.GetPlatform() == Platform_Xbox1)
  1578. {
  1579. deleteConfPopup.SetMessageText(GetLocStringByKeyExt("panel_mainmenu_confirm_delete_text_x1"));
  1580. }
  1581. else if (theGame.GetPlatform() == Platform_PS4)
  1582. {
  1583. deleteConfPopup.SetMessageText(GetLocStringByKeyExt("panel_mainmenu_confirm_delete_text_ps4"));
  1584. }
  1585. else
  1586. {
  1587. deleteConfPopup.SetMessageText(GetLocStringByKeyExt("panel_mainmenu_confirm_delete_text"));
  1588. }
  1589. deleteConfPopup.menuRef = this;
  1590. deleteConfPopup.type = type;
  1591. deleteConfPopup.slot = saveListIndex;
  1592. deleteConfPopup.saveMode = isSaveMode;
  1593. deleteConfPopup.BlurBackground = true;
  1594.  
  1595. RequestSubMenu('PopupMenu', deleteConfPopup);
  1596. }
  1597.  
  1598. public function DeleteSave(type : ESaveGameType, saveListIndex : int, isSaveMode:bool)
  1599. {
  1600. var saves : array< SSavegameInfo >;
  1601. var currentSave : SSavegameInfo;
  1602. var numSavesBeforeDelete : int;
  1603.  
  1604. theGame.ListSavedGames( saves );
  1605.  
  1606. numSavesBeforeDelete = saves.Size();
  1607.  
  1608. if (saveListIndex < saves.Size())
  1609. {
  1610. currentSave = saves[ saveListIndex ];
  1611. theGame.DeleteSavedGame(currentSave);
  1612. }
  1613.  
  1614. if (numSavesBeforeDelete <= 1)
  1615. {
  1616. m_fxRemoveOption.InvokeSelfOneArg(FlashArgInt(NameToFlashUInt('Continue')));
  1617. m_fxRemoveOption.InvokeSelfOneArg(FlashArgInt(NameToFlashUInt('LoadGame')));
  1618.  
  1619. if (isInLoadselector)
  1620. {
  1621. m_fxNavigateBack.InvokeSelf();
  1622. }
  1623. else
  1624. {
  1625. SendSaveData();
  1626. }
  1627. }
  1628. else
  1629. {
  1630. if (isSaveMode)
  1631. {
  1632. SendSaveData();
  1633. }
  1634. else if (hasSaveDataToLoad())
  1635. {
  1636. SendLoadData();
  1637. }
  1638. }
  1639. }
  1640.  
  1641. protected function showHelpPanel() : void
  1642. {
  1643. m_fxNavigateBack.InvokeSelf();
  1644.  
  1645. theGame.DisplaySystemHelp();
  1646. }
  1647.  
  1648. public function TryStartNewGame(optionsArray : int):void
  1649. {
  1650. var progress : float;
  1651.  
  1652. if (!theGame.IsContentAvailable('launch0'))
  1653. {
  1654. progress = theGame.ProgressToContentAvailable('launch0');
  1655. theSound.SoundEvent("gui_global_denied");
  1656. theGame.GetGuiManager().ShowProgressDialog(0, "", "error_message_new_game_not_ready", true, UDB_Ok, progress, UMPT_Content, 'launch0');
  1657. }
  1658. else
  1659. {
  1660. fetchNewGameConfigFromTag(optionsArray);
  1661.  
  1662. if ((optionsArray & IGMC_EP2_Save) == IGMC_EP2_Save)
  1663. {
  1664.  
  1665. theGame.InitStandaloneDLCLoading('bob_000_000', currentNewGameConfig.difficulty);
  1666. //theGame.EnableUberMovement( true ); //TWEAKS
  1667. //((CInGameConfigWrapper)theGame.GetInGameConfigWrapper()).SetVarValue( 'Gameplay', 'EnableUberMovement', 1 ); //TWEAKS
  1668. }
  1669. else if ((optionsArray & IGMC_EP1_Save) == IGMC_EP1_Save)
  1670. {
  1671.  
  1672. theGame.InitStandaloneDLCLoading('ep1', currentNewGameConfig.difficulty);
  1673. //theGame.EnableUberMovement( true ); //TWEAKS
  1674. //((CInGameConfigWrapper)theGame.GetInGameConfigWrapper()).SetVarValue( 'Gameplay', 'EnableUberMovement', 1 ); //TWEAKS
  1675. }
  1676. else
  1677. {
  1678. if (hasValidAutosaveData())
  1679. {
  1680. if (newGameConfPopup)
  1681. {
  1682. delete newGameConfPopup;
  1683. }
  1684.  
  1685. newGameConfPopup = new W3NewGameConfirmation in this;
  1686. newGameConfPopup.SetMessageTitle("");
  1687. if (theGame.GetPlatform() == Platform_Xbox1)
  1688. {
  1689. newGameConfPopup.SetMessageText(GetLocStringByKeyExt("error_message_start_game_x1"));
  1690. }
  1691. else if (theGame.GetPlatform() == Platform_PS4)
  1692. {
  1693. newGameConfPopup.SetMessageText(GetLocStringByKeyExt("error_message_start_game_ps4"));
  1694. }
  1695. else
  1696. {
  1697. newGameConfPopup.SetMessageText(GetLocStringByKeyExt("error_message_start_game"));
  1698. }
  1699. newGameConfPopup.menuRef = this;
  1700. newGameConfPopup.BlurBackground = true;
  1701.  
  1702. RequestSubMenu('PopupMenu', newGameConfPopup);
  1703. }
  1704. else
  1705. {
  1706. NewGameRequested();
  1707. }
  1708. }
  1709. }
  1710. }
  1711.  
  1712. protected function fetchNewGameConfigFromTag(optionsTag : int):void
  1713. {
  1714. var maskResult:int;
  1715.  
  1716. currentNewGameConfig.difficulty = optionsTag & IGMC_Difficulty_mask;
  1717.  
  1718. maskResult = optionsTag & IGMC_Tutorials_On;
  1719. currentNewGameConfig.tutorialsOn = (maskResult == IGMC_Tutorials_On);
  1720.  
  1721. maskResult = optionsTag & IGMC_Import_Save;
  1722. if (maskResult != IGMC_Import_Save)
  1723. {
  1724. currentNewGameConfig.import_save_index = -1;
  1725. }
  1726.  
  1727. maskResult = optionsTag & IGMC_Simulate_Import;
  1728. currentNewGameConfig.simulate_import = (maskResult == IGMC_Simulate_Import);
  1729. }
  1730.  
  1731. public function NewGameRequested():void
  1732. {
  1733. disableAccountPicker = true;
  1734.  
  1735. if (currentNewGameConfig.import_save_index == -1)
  1736. {
  1737. theGame.ClearInitialFacts();
  1738. }
  1739.  
  1740. if (currentNewGameConfig.import_save_index == -1 && currentNewGameConfig.simulate_import)
  1741. {
  1742. theGame.AddInitialFact("simulate_import_ingame");
  1743. }
  1744.  
  1745. theGame.SetDifficultyLevel(currentNewGameConfig.difficulty);
  1746.  
  1747. TutorialMessagesEnable(currentNewGameConfig.tutorialsOn);
  1748.  
  1749. StartNewGame();
  1750. }
  1751.  
  1752. event OnUpdateRescale(hScale : float, vScale : float)
  1753. {
  1754. var hud : CR4ScriptedHud;
  1755. var needRescale : bool;
  1756.  
  1757. hud = (CR4ScriptedHud)theGame.GetHud();
  1758. needRescale = false;
  1759.  
  1760. if( theGame.GetUIHorizontalFrameScale() != hScale )
  1761. {
  1762. theGame.SetUIHorizontalFrameScale(hScale);
  1763. mInGameConfigWrapper.SetVarValue('Hidden', 'uiHorizontalFrameScale', FloatToString(hScale));
  1764. needRescale = true;
  1765. hasChangedOption = true;
  1766. }
  1767. if( theGame.GetUIVerticalFrameScale() != vScale )
  1768. {
  1769. theGame.SetUIVerticalFrameScale(vScale);
  1770. mInGameConfigWrapper.SetVarValue('Hidden', 'uiVerticalFrameScale', FloatToString(vScale));
  1771. needRescale = true;
  1772. hasChangedOption = true;
  1773. }
  1774.  
  1775. if( needRescale && hud )
  1776. {
  1777. hud.RescaleModules();
  1778. }
  1779. }
  1780.  
  1781. public function ShowTutorialChosen(enabled:bool):void
  1782. {
  1783. TutorialMessagesEnable(enabled);
  1784.  
  1785. StartNewGame();
  1786. }
  1787.  
  1788. public function StartNewGame():void
  1789. {
  1790. if (theGame.GetGuiManager().GetPopup('MessagePopup') && theGame.GetGuiManager().lastMessageData.messageId == UMID_ControllerDisconnected)
  1791. {
  1792. return;
  1793. }
  1794.  
  1795. if ( theGame.RequestNewGame( theGame.GetNewGameDefinitionFilename() ) )
  1796. {
  1797. theGame.GetGuiManager().RequestMouseCursor(false);
  1798. OnPlaySoundEvent("gui_global_game_start");
  1799. OnPlaySoundEvent("mus_intro_usm");
  1800. GetRootMenu().CloseMenu();
  1801. }
  1802. }
  1803.  
  1804. function PopulateMenuData()
  1805. {
  1806. var l_DataFlashArray : CScriptedFlashArray;
  1807. var l_ChildMenuFlashArray : CScriptedFlashArray;
  1808. var l_DataFlashObject : CScriptedFlashObject;
  1809. var l_subDataFlashObject : CScriptedFlashObject;
  1810.  
  1811. l_DataFlashArray = m_structureCreator.PopulateMenuData();
  1812.  
  1813. m_flashValueStorage.SetFlashArray( "ingamemenu.entries", l_DataFlashArray );
  1814. }
  1815.  
  1816. protected function addInLoadOption():void
  1817. {
  1818. var l_DataFlashObject : CScriptedFlashObject;
  1819. var l_ChildMenuFlashArray : CScriptedFlashArray;
  1820.  
  1821. l_DataFlashObject = m_flashValueStorage.CreateTempFlashObject();
  1822. l_DataFlashObject.SetMemberFlashString( "id", "mainmenu_loadgame");
  1823. l_DataFlashObject.SetMemberFlashUInt( "tag", NameToFlashUInt('LoadGame') );
  1824. l_DataFlashObject.SetMemberFlashString( "label", GetLocStringByKeyExt("panel_mainmenu_loadgame") );
  1825.  
  1826. l_DataFlashObject.SetMemberFlashUInt( "type", IGMActionType_Load );
  1827.  
  1828. l_ChildMenuFlashArray = m_flashValueStorage.CreateTempFlashArray();
  1829. l_DataFlashObject.SetMemberFlashArray( "subElements", l_ChildMenuFlashArray );
  1830.  
  1831. m_flashValueStorage.SetFlashObject( "ingamemenu.addloading", l_DataFlashObject );
  1832. }
  1833.  
  1834. event OnBack()
  1835. {
  1836. CloseMenu();
  1837. }
  1838.  
  1839. public function HasSavesToImport() : bool
  1840. {
  1841. var savesToImport : array< SSavegameInfo >;
  1842.  
  1843. theGame.ListW2SavedGames( savesToImport );
  1844. return savesToImport.Size() != 0;
  1845. }
  1846.  
  1847. protected function SendImportSaveData()
  1848. {
  1849. var dataFlashArray : CScriptedFlashArray;
  1850.  
  1851. dataFlashArray = m_flashValueStorage.CreateTempFlashArray();
  1852.  
  1853. IngameMenu_PopulateImportSaveData(m_flashValueStorage, dataFlashArray);
  1854.  
  1855. m_initialSelectionsToIgnore = 1;
  1856. OnPlaySoundEvent( "gui_global_panel_open" );
  1857.  
  1858. isShowingSaveList = true;
  1859. m_flashValueStorage.SetFlashArray( "ingamemenu.importSlots", dataFlashArray );
  1860. }
  1861.  
  1862. protected function hasValidAutosaveData() : bool
  1863. {
  1864. var currentSave : SSavegameInfo;
  1865. var num : int;
  1866. var i : int;
  1867.  
  1868. num = theGame.GetNumSaveSlots( SGT_AutoSave );
  1869. for ( i = 0; i < num; i = i + 1 )
  1870. {
  1871. if ( theGame.GetSaveInSlot( SGT_AutoSave, i, currentSave ) )
  1872. {
  1873. return true;
  1874. }
  1875. }
  1876.  
  1877. num = theGame.GetNumSaveSlots( SGT_CheckPoint );
  1878. for ( i = 0; i < num; i = i + 1 )
  1879. {
  1880. if ( theGame.GetSaveInSlot( SGT_CheckPoint, i, currentSave ) )
  1881. {
  1882. return true;
  1883. }
  1884. }
  1885.  
  1886. return false;
  1887. }
  1888.  
  1889. public function HandleSaveListUpdate():void
  1890. {
  1891. if (isShowingSaveList)
  1892. {
  1893. SendSaveData();
  1894. }
  1895. else if (isShowingLoadList)
  1896. {
  1897. SendLoadData();
  1898. }
  1899.  
  1900. if (hasSaveDataToLoad())
  1901. {
  1902. addInLoadOption();
  1903. }
  1904. }
  1905.  
  1906. protected function SendLoadData():void
  1907. {
  1908. var dataFlashArray : CScriptedFlashArray;
  1909.  
  1910. dataFlashArray = m_flashValueStorage.CreateTempFlashArray();
  1911.  
  1912. PopulateSaveDataForSlotType(-1, dataFlashArray, false);
  1913.  
  1914. m_initialSelectionsToIgnore = 1;
  1915. OnPlaySoundEvent( "gui_global_panel_open" );
  1916.  
  1917. if (dataFlashArray.GetLength() == 0)
  1918. {
  1919. m_fxNavigateBack.InvokeSelf();
  1920. }
  1921. else
  1922. {
  1923. isShowingLoadList = true;
  1924. m_flashValueStorage.SetFlashArray( "ingamemenu.loadSlots", dataFlashArray );
  1925. }
  1926. }
  1927.  
  1928.  
  1929. protected function SendSaveData():void
  1930. {
  1931. var dataFlashArray : CScriptedFlashArray;
  1932.  
  1933. dataFlashArray = m_flashValueStorage.CreateTempFlashArray();
  1934.  
  1935.  
  1936.  
  1937. PopulateSaveDataForSlotType(SGT_Manual, dataFlashArray, true);
  1938.  
  1939. m_initialSelectionsToIgnore = 1;
  1940. OnPlaySoundEvent( "gui_global_panel_open" );
  1941.  
  1942. isShowingSaveList = true;
  1943. m_flashValueStorage.SetFlashArray( "ingamemenu.saveSlots", dataFlashArray );
  1944.  
  1945. if ( theGame.ShouldShowSaveCompatibilityWarning() )
  1946. {
  1947. theGame.GetGuiManager().ShowUserDialog( UMID_SaveCompatWarning, "", "error_save_not_compatible", UDB_Ok );
  1948. }
  1949. }
  1950.  
  1951. protected function SendNewGamePlusSaves():void
  1952. {
  1953. var dataFlashArray : CScriptedFlashArray;
  1954.  
  1955. dataFlashArray = m_flashValueStorage.CreateTempFlashArray();
  1956.  
  1957. PopulateSaveDataForSlotType(-1, dataFlashArray, false);
  1958.  
  1959. theGame.GetGuiManager().ShowUserDialog(0, "", "message_new_game_plus_reminder", UDB_Ok);
  1960.  
  1961. if (dataFlashArray.GetLength() == 0)
  1962. {
  1963. OnPlaySoundEvent("gui_global_denied");
  1964. showNotification(GetLocStringByKeyExt("mainmenu_newgame_plus_no_saves"));
  1965. m_fxNavigateBack.InvokeSelf();
  1966. }
  1967. else
  1968. {
  1969. m_initialSelectionsToIgnore = 1;
  1970. OnPlaySoundEvent( "gui_global_panel_open" );
  1971. m_flashValueStorage.SetFlashArray( "ingamemenu.newGamePlusSlots", dataFlashArray );
  1972. }
  1973. }
  1974.  
  1975. protected function PopulateSaveDataForSlotType(saveType:int, parentObject:CScriptedFlashArray, allowEmptySlot:bool):void
  1976. {
  1977. IngameMenu_PopulateSaveDataForSlotType(m_flashValueStorage, saveType, parentObject, allowEmptySlot);
  1978. }
  1979.  
  1980. event OnLoadSaveImageCancelled():void
  1981. {
  1982. theGame.FreeScreenshotData();
  1983. }
  1984.  
  1985. event OnScreenshotDataRequested(saveIndex:int):void
  1986. {
  1987. var targetSaveInfo : SSavegameInfo;
  1988. var saveGames : array< SSavegameInfo >;
  1989.  
  1990. theGame.ListSavedGames( saveGames );
  1991.  
  1992. if (saveIndex >= 0 && saveIndex < saveGames.Size())
  1993. {
  1994. targetSaveInfo = saveGames[saveIndex];
  1995.  
  1996. theGame.RequestScreenshotData(targetSaveInfo);
  1997. }
  1998. }
  1999.  
  2000. event OnCheckScreenshotDataReady():void
  2001. {
  2002. if (theGame.IsScreenshotDataReady())
  2003. {
  2004. m_fxOnSaveScreenshotRdy.InvokeSelf();
  2005. }
  2006. }
  2007.  
  2008. protected function SendInstalledDLCList():void
  2009. {
  2010. var currentData : CScriptedFlashObject;
  2011. var dataArray : CScriptedFlashArray;
  2012. var dlcManager : CDLCManager;
  2013. var i : int;
  2014. var dlcList : array<name>;
  2015.  
  2016. var currentName : string;
  2017. var currentDesc : string;
  2018.  
  2019.  
  2020.  
  2021. dataArray = m_flashValueStorage.CreateTempFlashArray();
  2022.  
  2023. dlcManager = theGame.GetDLCManager();
  2024. dlcManager.GetDLCs(dlcList);
  2025.  
  2026. for (i = 0; i < dlcList.Size(); i += 1)
  2027. {
  2028.  
  2029.  
  2030. currentData = m_flashValueStorage.CreateTempFlashObject();
  2031.  
  2032. currentName = GetLocStringByKeyExt( "content_name_" + NameToString(dlcList[i]) );
  2033. currentDesc = "";
  2034.  
  2035. if (currentName != "")
  2036. {
  2037. currentData.SetMemberFlashString("label", currentName);
  2038. currentData.SetMemberFlashString("desc", currentDesc);
  2039.  
  2040. dataArray.PushBackFlashObject(currentData);
  2041. }
  2042.  
  2043. }
  2044.  
  2045.  
  2046.  
  2047. m_flashValueStorage.SetFlashArray("ingamemenu.installedDLCs", dataArray);
  2048. }
  2049.  
  2050. protected function SendRescaleData():void
  2051. {
  2052. var currentData : CScriptedFlashObject;
  2053.  
  2054. currentData = m_flashValueStorage.CreateTempFlashObject();
  2055.  
  2056. currentData.SetMemberFlashNumber("initialHScale", theGame.GetUIHorizontalFrameScale() );
  2057. currentData.SetMemberFlashNumber("initialVScale", theGame.GetUIVerticalFrameScale() );
  2058.  
  2059. m_flashValueStorage.SetFlashObject("ingamemenu.uirescale", currentData);
  2060. }
  2061.  
  2062. protected function SendControllerData():void
  2063. {
  2064. var dataFlashArray : CScriptedFlashArray;
  2065.  
  2066. if ( (W3ReplacerCiri)thePlayer )
  2067. {
  2068. dataFlashArray = InGameMenu_CreateControllerDataCiri(m_flashValueStorage);
  2069. }
  2070. else
  2071. {
  2072. dataFlashArray = InGameMenu_CreateControllerData(m_flashValueStorage);
  2073. }
  2074.  
  2075. m_flashValueStorage.SetFlashArray( "ingamemenu.gamepad.mappings", dataFlashArray );
  2076. }
  2077.  
  2078. protected function SendKeybindData():void
  2079. {
  2080. var dataFlashArray : CScriptedFlashArray;
  2081.  
  2082. dataFlashArray = m_flashValueStorage.CreateTempFlashArray();
  2083.  
  2084. IngameMenu_GatherKeybindData(dataFlashArray, m_flashValueStorage);
  2085.  
  2086. m_flashValueStorage.SetFlashArray( "ingamemenu.keybindValues", dataFlashArray );
  2087. }
  2088.  
  2089. event OnClearKeybind(keybindTag:name):void
  2090. {
  2091. hasChangedOption = true;
  2092. mInGameConfigWrapper.SetVarValue('PCInput', keybindTag, "IK_None;IK_None");
  2093. SendKeybindData();
  2094. }
  2095.  
  2096.  
  2097.  
  2098. protected function GetKeybindGroupTag(keybindName : name) : name
  2099. {
  2100. if (mInGameConfigWrapper.DoVarHasTag('PCInput', keybindName, 'input_overlap1'))
  2101. {
  2102. return 'input_overlap1';
  2103. }
  2104. else if (mInGameConfigWrapper.DoVarHasTag('PCInput', keybindName, 'input_overlap2'))
  2105. {
  2106. return 'input_overlap2';
  2107. }
  2108. else if (mInGameConfigWrapper.DoVarHasTag('PCInput', keybindName, 'input_overlap3'))
  2109. {
  2110. return 'input_overlap3';
  2111. }
  2112. else if (mInGameConfigWrapper.DoVarHasTag('PCInput', keybindName, 'input_overlap4'))
  2113. {
  2114. return 'input_overlap4';
  2115. }
  2116. //---=== modFriendlyMeditation ===---
  2117. else if (mInGameConfigWrapper.DoVarHasTag('PCInput', keybindName, 'input_overlap_fmed1')
  2118. || keybindName == 'HoldToMeditate' || keybindName == 'PanelMeditation')
  2119. {
  2120. return 'input_overlap_fmed1';
  2121. }
  2122. //---=== modFriendlyMeditation ===---
  2123. else if (mInGameConfigWrapper.DoVarHasTag('PCInput', keybindName, 'input_overlap5'))
  2124. {
  2125. return 'input_overlap5';
  2126. }
  2127. //---=== modFriendlyHUD ===---
  2128. else if (mInGameConfigWrapper.DoVarHasTag('PCInput', keybindName, 'input_overlap_fhud1')
  2129. || keybindName == 'HoldToSeeEssentials' || keybindName == 'HubMenu')
  2130. {
  2131. return 'input_overlap_fhud1';
  2132. }
  2133. else if (mInGameConfigWrapper.DoVarHasTag('PCInput', keybindName, 'input_overlap_fhud2')
  2134. || keybindName == 'HoldToSeeCharStats' || keybindName == 'PanelChar')
  2135. {
  2136. return 'input_overlap_fhud2';
  2137. }
  2138. else if (mInGameConfigWrapper.DoVarHasTag('PCInput', keybindName, 'input_overlap_fhud3')
  2139. || keybindName == 'HoldToSeeMap' || keybindName == 'PanelMap')
  2140. {
  2141. return 'input_overlap_fhud3';
  2142. }
  2143. else if (mInGameConfigWrapper.DoVarHasTag('PCInput', keybindName, 'input_overlap_fhud4')
  2144. || keybindName == 'HoldToSeeQuests' || keybindName == 'PanelJour')
  2145. {
  2146. return 'input_overlap_fhud4';
  2147. }
  2148. //---=== modFriendlyHUD ===---
  2149.  
  2150. return '';
  2151. }
  2152.  
  2153. event OnChangeKeybind(keybindTag:name, newKeybindValue:EInputKey):void
  2154. {
  2155. var newSettingString : string;
  2156. var exisitingKeybind : name;
  2157. var groupIndex : int;
  2158. var keybindChangedMessage : string;
  2159. var numKeybinds : int;
  2160. var i : int;
  2161. var currentBindingTag : name;
  2162.  
  2163. var iterator_KeybindName : name;
  2164. var iterator_KeybindKey : string;
  2165.  
  2166. hasChangedOption = true;
  2167.  
  2168. newSettingString = newKeybindValue;
  2169.  
  2170.  
  2171.  
  2172. {
  2173. groupIndex = IngameMenu_GetPCInputGroupIndex();
  2174.  
  2175. if (groupIndex != -1)
  2176. {
  2177. numKeybinds = mInGameConfigWrapper.GetVarsNumByGroupName('PCInput');
  2178. currentBindingTag = GetKeybindGroupTag(keybindTag);
  2179.  
  2180. for (i = 0; i < numKeybinds; i += 1)
  2181. {
  2182. iterator_KeybindName = mInGameConfigWrapper.GetVarName(groupIndex, i);
  2183. iterator_KeybindKey = mInGameConfigWrapper.GetVarValue('PCInput', iterator_KeybindName);
  2184.  
  2185. iterator_KeybindKey = StrReplace(iterator_KeybindKey, ";IK_None", "");
  2186. iterator_KeybindKey = StrReplace(iterator_KeybindKey, "IK_None;", "");
  2187.  
  2188. if (iterator_KeybindKey == newSettingString && iterator_KeybindName != keybindTag &&
  2189. (currentBindingTag == '' || currentBindingTag != GetKeybindGroupTag(iterator_KeybindName)))
  2190. {
  2191. if (keybindChangedMessage != "")
  2192. {
  2193. keybindChangedMessage += ", ";
  2194. }
  2195. keybindChangedMessage += IngameMenu_GetLocalizedKeybindName(iterator_KeybindName);
  2196. OnClearKeybind(iterator_KeybindName);
  2197. }
  2198. }
  2199. }
  2200.  
  2201. if (keybindChangedMessage != "")
  2202. {
  2203. keybindChangedMessage += " </br>" + GetLocStringByKeyExt("key_unbound_message");
  2204. showNotification(keybindChangedMessage);
  2205. }
  2206. }
  2207.  
  2208. newSettingString = newKeybindValue + ";IK_None";
  2209. mInGameConfigWrapper.SetVarValue('PCInput', keybindTag, newSettingString);
  2210. SendKeybindData();
  2211. }
  2212.  
  2213. event OnSmartKeybindEnabledChanged(value:bool):void
  2214. {
  2215. smartKeybindingEnabled = value;
  2216. }
  2217.  
  2218. event OnInvalidKeybindTried(keyCode:EInputKey):void
  2219. {
  2220. showNotification(GetLocStringByKeyExt("menu_cannot_perform_action_now"));
  2221. OnPlaySoundEvent("gui_global_denied");
  2222. }
  2223.  
  2224. event OnLockedKeybindTried():void
  2225. {
  2226. showNotification(GetLocStringByKeyExt("menu_cannot_perform_action_now"));
  2227. OnPlaySoundEvent("gui_global_denied");
  2228. }
  2229.  
  2230. //---=== modFriendlyHUD ===---
  2231. function ShouldHideDLCIcons() : bool
  2232. {
  2233. return theGame.GetInGameConfigWrapper().GetVarValue('fhudMainMenu', 'fhudHideDLC');
  2234. }
  2235. //---=== modFriendlyHUD ===---
  2236.  
  2237. event OnResetKeybinds():void
  2238. {
  2239. mInGameConfigWrapper.ResetGroupToDefaults('PCInput');
  2240. SendKeybindData();
  2241. showNotification(inGameMenu_TryLocalize("menu_option_reset_successful"));
  2242.  
  2243. hasChangedOption = true;
  2244. }
  2245.  
  2246. function PlayOpenSoundEvent()
  2247. {
  2248. }
  2249. }
  2250.  
  2251. exec function ddd()
  2252. {
  2253. LogChannel('asd', "[" + GetLocStringByKey( "menu_goty_starting_message_content" ) + "]" );
  2254. LogChannel('asd', "[" + GetLocStringById( 1217650 ) + "]" );
  2255. }
  2256.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement