Advertisement
haha_veryfunny

Untitled

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