Advertisement
Guest User

Untitled

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