Advertisement
DarkSeaFog

Witcher 3 Script Error

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