Advertisement
Guest User

Untitled

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