Advertisement
Syrwastaken

Untitled

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