@@ -117,13 +117,11 @@ CCore::CCore()
117117 m_pfnMessageProcessor = NULL ;
118118 m_pMessageBox = NULL ;
119119
120- m_bFirstFrame = true ;
121120 m_bIsOfflineMod = false ;
122121 m_bQuitOnPulse = false ;
123122 m_bDestroyMessageBox = false ;
124123 m_bCursorToggleControls = false ;
125124 m_bLastFocused = true ;
126- m_bWaitToSetNick = false ;
127125 m_DiagnosticDebug = EDiagnosticDebug::NONE;
128126
129127 // Create our Direct3DData handler.
@@ -151,14 +149,14 @@ CCore::CCore()
151149 m_bDoneFrameRateLimit = false ;
152150 m_uiFrameRateLimit = 0 ;
153151 m_uiServerFrameRateLimit = 0 ;
154- m_uiNewNickWaitFrames = 0 ;
155152 m_iUnminimizeFrameCounter = 0 ;
156153 m_bDidRecreateRenderTargets = false ;
157154 m_fMinStreamingMemory = 0 ;
158155 m_fMaxStreamingMemory = 0 ;
159156 m_bGettingIdleCallsFromMultiplayer = false ;
160157 m_bWindowsTimerEnabled = false ;
161158 m_timeDiscordAppLastUpdate = 0 ;
159+ m_CurrentRefreshRate = 60 ;
162160
163161 // Create tray icon
164162 m_pTrayIcon = new CTrayIcon ();
@@ -515,7 +513,7 @@ void CCore::EnableChatInput(char* szCommand, DWORD dwColor)
515513{
516514 if (m_pLocalGUI)
517515 {
518- if (m_pGame->GetSystemState () == 9 /* GS_PLAYING_GAME */ && m_pModManager->GetCurrentMod () != NULL && !IsOfflineMod () && !m_pGame->IsAtMenu () &&
516+ if (m_pGame->GetSystemState () == 9 /* GS_PLAYING_GAME */ && m_pModManager->IsLoaded () && !IsOfflineMod () && !m_pGame->IsAtMenu () &&
519517 !m_pLocalGUI->GetMainMenu ()->IsVisible () && !m_pLocalGUI->GetConsole ()->IsVisible () && !m_pLocalGUI->IsChatBoxInputEnabled ())
520518 {
521519 CChat* pChat = m_pLocalGUI->GetChat ();
@@ -1236,16 +1234,22 @@ void CCore::DoPostFramePulse()
12361234 // This is the first frame in the menu?
12371235 if (m_pGame->GetSystemState () == 7 ) // GS_FRONTEND
12381236 {
1239- if (m_bFirstFrame)
1240- {
1241- m_bFirstFrame = false ;
1237+ if (m_menuFrame < 255 )
1238+ ++m_menuFrame;
12421239
1240+ if (m_menuFrame == 1 )
1241+ {
12431242 WatchDogCompletedSection (" L2" ); // gta_sa.set seems ok
12441243 WatchDogCompletedSection (" L3" ); // No hang on startup
12451244 HandleCrashDumpEncryption ();
12461245
12471246 // Disable vsync while it's all dark
12481247 m_pGame->DisableVSync ();
1248+ }
1249+ 1250+ if (m_menuFrame >= 5 && !m_isNetworkReady && m_pNet->IsReady ())
1251+ {
1252+ m_isNetworkReady = true ;
12491253
12501254 // Parse the command line
12511255 // Does it begin with mtasa://?
@@ -1262,33 +1266,18 @@ void CCore::DoPostFramePulse()
12621266 {
12631267 // We want to load a mod?
12641268 const char * szOptionValue;
1265- if (szOptionValue = GetCommandLineOption (" l" ))
1266- {
1267- // Try to load the mod
1268- if (!m_pModManager->Load (szOptionValue, m_szCommandLineArgs))
1269- {
1270- SString strTemp (_ (" Error running mod specified in command line ('%s')" ), szOptionValue);
1271- ShowMessageBox (_ (" Error" ) + _E (" CC42" ), strTemp, MB_BUTTON_OK | MB_ICON_ERROR); // Command line Mod load failed
1272- }
1273- }
1274- // We want to connect to a server?
1275- else if (szOptionValue = GetCommandLineOption (" c" ))
1269+ if (szOptionValue = GetCommandLineOption (" c" ))
12761270 {
12771271 CCommandFuncs::Connect (szOptionValue);
12781272 }
12791273 }
12801274 }
12811275
1282- if (m_bWaitToSetNick && GetLocalGUI ()->GetMainMenu ()->IsVisible () && !GetLocalGUI ()->GetMainMenu ()->IsFading ())
1276+ if (m_menuFrame >= 75 && m_requestNewNickname && GetLocalGUI ()->GetMainMenu ()->IsVisible () && !GetLocalGUI ()->GetMainMenu ()->IsFading ())
12831277 {
1284- if (m_uiNewNickWaitFrames > 75 )
1285- {
1286- // Request a new nickname if we're waiting for one
1287- GetLocalGUI ()->GetMainMenu ()->GetSettingsWindow ()->RequestNewNickname ();
1288- m_bWaitToSetNick = false ;
1289- }
1290- else
1291- m_uiNewNickWaitFrames++;
1278+ // Request a new nickname if we're waiting for one
1279+ GetLocalGUI ()->GetMainMenu ()->GetSettingsWindow ()->RequestNewNickname ();
1280+ m_requestNewNickname = false ;
12921281 }
12931282 }
12941283
@@ -1847,6 +1836,9 @@ void CCore::RecalculateFrameRateLimit(uint uiServerFrameRateLimit, bool bLogToCo
18471836 if ((m_uiFrameRateLimit == 0 || uiClientScriptRate < m_uiFrameRateLimit) && uiClientScriptRate > 0 )
18481837 m_uiFrameRateLimit = uiClientScriptRate;
18491838
1839+ if (!IsConnected ())
1840+ m_uiFrameRateLimit = m_CurrentRefreshRate;
1841+ 18501842 // Removes Limiter from Frame Graph if limit is zero and skips frame limit
18511843 if (m_uiFrameRateLimit == 0 )
18521844 {
@@ -1873,6 +1865,12 @@ void CCore::SetClientScriptFrameRateLimit(uint uiClientScriptFrameRateLimit)
18731865 RecalculateFrameRateLimit (-1 , false );
18741866}
18751867
1868+ void CCore::SetCurrentRefreshRate (uint value)
1869+ {
1870+ m_CurrentRefreshRate = value;
1871+ RecalculateFrameRateLimit (-1 , false );
1872+ }
1873+ 18761874//
18771875// Make sure the frame rate limit has been applied since the last call
18781876//
@@ -1933,7 +1931,7 @@ void CCore::ApplyQueuedFrameRateLimit()
19331931 double dSpare = dTargetTimeToUse - m_FrameRateTimer.Get ();
19341932 if (dSpare <= 0.0 )
19351933 break ;
1936- if (dSpare >= 2 .0 )
1934+ if (dSpare >= 10 .0 )
19371935 Sleep (1 );
19381936 }
19391937 m_FrameRateTimer.Reset ();
@@ -2195,8 +2193,9 @@ void CCore::HandleIdlePulse()
21952193 DoPreFramePulse ();
21962194 DoPostFramePulse ();
21972195 }
2198- if (m_pModManager->GetCurrentMod ())
2199- m_pModManager->GetCurrentMod ()->IdleHandler ();
2196+ 2197+ if (m_pModManager->IsLoaded ())
2198+ m_pModManager->GetClient ()->IdleHandler ();
22002199}
22012200
22022201//
0 commit comments