Advertisement
Zbig_

Untitled

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