From bf4b39781ba64076c06e00825277a6c7f67c0949 Mon Sep 17 00:00:00 2001 From: Nikolay Korolev Date: Sun, 25 Jul 2021 21:44:21 +0300 Subject: low effort save support --- src/core/Game.cpp | 34 ++++++++++++++++++++++++++-------- src/core/Game.h | 2 +- src/core/config.h | 2 +- 3 files changed, 28 insertions(+), 10 deletions(-) (limited to 'src/core') diff --git a/src/core/Game.cpp b/src/core/Game.cpp index a370c9d4..d2646512 100644 --- a/src/core/Game.cpp +++ b/src/core/Game.cpp @@ -648,7 +648,7 @@ bool CGame::ShutDown(void) return true; } -void CGame::ReInitGameObjectVariables(void) +bool CGame::ReInitGameObjectVariables(bool load) { CGameLogic::InitAtStartOfGame(); #ifdef PS2_MENU @@ -693,7 +693,7 @@ void CGame::ReInitGameObjectVariables(void) gPhoneInfo.Initialise(); PUSH_MEMID(MEMID_SCRIPT); - CTheScripts::Init(); + bool res = CTheScripts::Init(load); CGangs::Initialise(); POP_MEMID(); @@ -706,12 +706,14 @@ void CGame::ReInitGameObjectVariables(void) CStats::Init(); CPickups::Init(); CPacManPickups::Init(); - CGarages::Init(); + if (!load) + CGarages::Init(); CSpecialFX::Init(); CRopes::Init(); CWaterCannons::Init(); CScriptPaths::Init(); CParticle::ReloadConfig(); + CParticle::SetPixelData(); #ifdef PS2_MENU if ( !TheMemoryCard.m_bWantToLoad ) @@ -730,6 +732,8 @@ void CGame::ReInitGameObjectVariables(void) for (int32 i = 0; i < MAX_PADS; i++) CPad::GetPad(i)->Clear(true); + + return res; } void CGame::ReloadIPLs(void) @@ -800,13 +804,12 @@ void CGame::InitialiseWhenRestarting(void) RestoreForStartLoad(); } - ReInitGameObjectVariables(); + bool bLoadSuccessful = ReInitGameObjectVariables(FrontEndMenuManager.m_bWantToLoad); if ( FrontEndMenuManager.m_bWantToLoad == true ) { - FrontEndMenuManager.m_bWantToLoad = false; InitRadioStationPositionList(); - if ( GenericLoad() == true ) + if ( bLoadSuccessful == true ) { DMAudio.ResetTimers(CTimer::GetTimeInMilliseconds()); CFerry::InitFerrys(); @@ -825,8 +828,8 @@ void CGame::InitialiseWhenRestarting(void) ShutDownForRestart(); CTimer::Stop(); CTimer::Initialise(); - FrontEndMenuManager.m_bWantToLoad = false; - ReInitGameObjectVariables(); + //FrontEndMenuManager.m_bWantToLoad = false; + ReInitGameObjectVariables(false); currLevel = LEVEL_GENERIC; CCollision::SortOutCollisionAfterLoad(); } @@ -835,6 +838,7 @@ void CGame::InitialiseWhenRestarting(void) #endif } + FrontEndMenuManager.m_bWantToLoad = true; CTimer::Update(); DMAudio.ChangeMusicMode(MUSICMODE_GAME); @@ -845,6 +849,20 @@ void CGame::InitialiseWhenRestarting(void) void CGame::Process(void) { + if (FrontEndMenuManager.m_bWantToLoad) { + CTheScripts::StartTestScript(); + CTheScripts::Process(); + TheCamera.Process(); + CStreaming::LoadScene(TheCamera.GetPosition()); + //CGame::GenerateTempPedAtStartOfNetworkGame(); + if (/* ?*/true){ + CStreaming::RequestSpecialModel(MI_PLAYER, "player", STREAMFLAGS_DEPENDENCY | STREAMFLAGS_DONT_REMOVE); + CStreaming::LoadAllRequestedModels(false); + } + TheCamera.Process(); + CStreaming::LoadScene(TheCamera.GetPosition()); + FrontEndMenuManager.m_bWantToLoad = false; + } CPad::UpdatePads(); #ifdef USE_CUSTOM_ALLOCATOR ProcessTidyUpMemory(); diff --git a/src/core/Game.h b/src/core/Game.h index dd14278a..e6016888 100644 --- a/src/core/Game.h +++ b/src/core/Game.h @@ -62,7 +62,7 @@ public: static void FinalShutdown(void); static bool Initialise(const char *datFile); static bool ShutDown(void); - static void ReInitGameObjectVariables(void); + static bool ReInitGameObjectVariables(bool); static void ReloadIPLs(void); static void ShutDownForRestart(void); static void InitialiseWhenRestarting(void); diff --git a/src/core/config.h b/src/core/config.h index d8d62782..bee60489 100644 --- a/src/core/config.h +++ b/src/core/config.h @@ -274,7 +274,7 @@ enum Config { #define FIX_BUGS // fixes bugs that we've came across during reversing. You can undefine this only on release builds. //#define MORE_LANGUAGES // Add more translations to the game #define COMPATIBLE_SAVES // this allows changing structs while keeping saves compatible, and keeps saves compatible between platforms -#define FIX_INCOMPATIBLE_SAVES // try to fix incompatible saves, requires COMPATIBLE_SAVES +//#define FIX_INCOMPATIBLE_SAVES // try to fix incompatible saves, requires COMPATIBLE_SAVES #define LOAD_INI_SETTINGS // as the name suggests. fundamental for CUSTOM_FRONTEND_OPTIONS #define NO_MOVIES // add option to disable intro videos -- cgit v1.2.3