summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authoraap <aap@papnet.eu>2020-12-01 00:22:57 +0100
committeraap <aap@papnet.eu>2020-12-01 00:22:57 +0100
commit2c59e1c8945a5c6de6415611d4f1dbc720790d73 (patch)
tree8fad006f6ef1b6699daad8a75966246ad8b6c9a1 /src
parentadded a few registered pointers and memory debug (diff)
downloadre3-2c59e1c8945a5c6de6415611d4f1dbc720790d73.tar
re3-2c59e1c8945a5c6de6415611d4f1dbc720790d73.tar.gz
re3-2c59e1c8945a5c6de6415611d4f1dbc720790d73.tar.bz2
re3-2c59e1c8945a5c6de6415611d4f1dbc720790d73.tar.lz
re3-2c59e1c8945a5c6de6415611d4f1dbc720790d73.tar.xz
re3-2c59e1c8945a5c6de6415611d4f1dbc720790d73.tar.zst
re3-2c59e1c8945a5c6de6415611d4f1dbc720790d73.zip
Diffstat (limited to 'src')
-rw-r--r--src/core/FileLoader.cpp6
-rw-r--r--src/core/Game.cpp101
-rw-r--r--src/core/World.cpp5
3 files changed, 85 insertions, 27 deletions
diff --git a/src/core/FileLoader.cpp b/src/core/FileLoader.cpp
index aeaede56..b9d475b8 100644
--- a/src/core/FileLoader.cpp
+++ b/src/core/FileLoader.cpp
@@ -59,7 +59,13 @@ CFileLoader::LoadLevel(const char *filename)
savedTxd = RwTexDictionaryCreate();
RwTexDictionarySetCurrent(savedTxd);
}
+#if GTA_VERSION <= GTA3_PS2_160
+ CFileMgr::ChangeDir("\\DATA\\");
fd = CFileMgr::OpenFile(filename, "r");
+ CFileMgr::ChangeDir("\\");
+#else
+ fd = CFileMgr::OpenFile(filename, "r");
+#endif
assert(fd > 0);
for(line = LoadLine(fd); line; line = LoadLine(fd)){
diff --git a/src/core/Game.cpp b/src/core/Game.cpp
index d22a7184..7043a5b2 100644
--- a/src/core/Game.cpp
+++ b/src/core/Game.cpp
@@ -265,16 +265,19 @@ void CGame::ShutdownRenderWare(void)
#endif
}
+// missing altogether on PS2
bool CGame::InitialiseOnceAfterRW(void)
{
+#if GTA_VERSION > GTA3_PS2_160
TheText.Load();
- DMAudio.Initialise();
+ DMAudio.Initialise(); // before TheGame() on PS2
CTimer::Initialise();
CTempColModels::Initialise();
mod_HandlingManager.Initialise();
CSurfaceTable::Initialise("DATA\\SURFACE.DAT");
CPedStats::Initialise();
CTimeCycle::Initialise();
+#endif
if ( DMAudio.GetNum3DProvidersAvailable() == 0 )
FrontEndMenuManager.m_nPrefsAudio3DProviderIndex = -1;
@@ -330,10 +333,15 @@ bool CGame::Initialise(const char* datFile)
{
#ifdef GTA_PS2
// TODO: upload VU0 collision code here
-#else
+#endif
+
+#if GTA_VERSION > GTA3_PS2_160
ResetLoadingScreenBar();
strcpy(aDatFile, datFile);
CPools::Initialise(); // done in CWorld on PS2
+#endif
+
+#ifndef GTA_PS2
CIniFile::LoadIniFile();
#endif
@@ -367,13 +375,15 @@ bool CGame::Initialise(const char* datFile)
CWeather::Init();
CCullZones::Init();
CCollision::Init();
-#ifdef PS2_MENU
+#ifdef PS2_MENU // TODO: is this the right define?
TheText.Load();
#endif
CTheZones::Init();
CUserDisplay::Init();
CMessages::Init();
+#if GTA_VERSION > GTA3_PS2_160
CMessages::ClearAllMessagesDisplayedByGame();
+#endif
CRecordDataForGame::Init();
CRestart::Initialise();
@@ -381,11 +391,17 @@ bool CGame::Initialise(const char* datFile)
CWorld::Initialise();
POP_MEMID();
+#if GTA_VERSION <= GTA3_PS2_160
+ mod_HandlingManager.Initialise();
+ CSurfaceTable::Initialise("DATA\\SURFACE.DAT");
+ CTempColModels::Initialise();
+#endif
+
PUSH_MEMID(MEMID_TEXTURES);
CParticle::Initialise();
POP_MEMID();
-#ifdef GTA_PS2
+#if GTA_VERSION <= GTA3_PS2_160
gStartX = -180.0f;
gStartY = 180.0f;
gStartZ = 14.0f;
@@ -400,20 +416,31 @@ bool CGame::Initialise(const char* datFile)
CCarCtrl::Init();
POP_MEMID();
-#ifndef GTA_PS2
+#if GTA_VERSION > GTA3_PS2_160
InitModelIndices();
#endif
PUSH_MEMID(MEMID_DEF_MODELS);
CModelInfo::Initialise();
-#ifndef GTA_PS2
+#if GTA_VERSION <= GTA3_PS2_160
+ CPedStats::Initialise(); // InitialiseOnceAfterRW
+#else
// probably moved before LoadLevel for multiplayer maps?
CPickups::Init();
CTheCarGenerators::Init();
#endif
+
+#ifndef GTA_PS2 // or GTA_VERSION?
CdStreamAddImage("MODELS\\GTA3.IMG");
+#endif
+
+#if GTA_VERSION > GTA3_PS2_160
CFileLoader::LoadLevel("DATA\\DEFAULT.DAT");
CFileLoader::LoadLevel(datFile);
+#else
+ CFileLoader::LoadLevel("GTA3.DAT");
+#endif
+
#ifdef EXTENDED_PIPELINES
// for generic fallback
CustomPipes::SetTxdFindCallback();
@@ -424,18 +451,25 @@ bool CGame::Initialise(const char* datFile)
CTheZones::PostZoneCreation();
POP_MEMID();
+#if GTA_VERSION <= GTA3_PS2_160
+ TestModelIndices();
+#endif
LoadingScreen("Loading the Game", "Setup paths", GetRandomSplashScreen());
ThePaths.PreparePathData();
- // done elsewhere on PS2
+#if GTA_VERSION > GTA3_PS2_160
for (int i = 0; i < NUMPLAYERS; i++)
CWorld::Players[i].Clear();
CWorld::Players[0].LoadPlayerSkin();
TestModelIndices();
- //
+#endif
LoadingScreen("Loading the Game", "Setup water", nil);
CWaterLevel::Initialise("DATA\\WATER.DAT");
+#if GTA_VERSION <= GTA3_PS2_160
+ CTimeCycle::Initialise(); // InitialiseOnceAfterRW
+#else
TheConsole.Init();
+#endif
CDraw::SetFOV(120.0f);
CDraw::ms_fLODDistance = 500.0f;
@@ -472,6 +506,11 @@ bool CGame::Initialise(const char* datFile)
LoadingScreen("Loading the Game", "Setup game variables", nil);
CPopulation::Initialise();
+#if GTA_VERSION <= GTA3_PS2_160
+ for (int i = 0; i < NUMPLAYERS; i++)
+ CWorld::Players[i].Clear();
+// CWorld::Players[0].LoadPlayerSkin(); // TODO: use a define for this
+#endif
CWorld::PlayerInFocus = 0;
CCoronas::Init();
CShadows::Init();
@@ -480,7 +519,7 @@ bool CGame::Initialise(const char* datFile)
CAntennas::Init();
CGlass::Init();
gPhoneInfo.Initialise();
-#ifndef GTA_PS2
+#ifndef GTA_PS2 // TODO: define for this
CSceneEdit::Initialise();
#endif
@@ -491,11 +530,11 @@ bool CGame::Initialise(const char* datFile)
POP_MEMID();
LoadingScreen("Loading the Game", "Setup game variables", nil);
-#ifdef GTA_PS2
+#if GTA_VERSION <= GTA3_PS2_160
CTimer::Initialise();
#endif
CClock::Initialise(1000);
-#ifdef GTA_PS2
+#if GTA_VERSION <= GTA3_PS2_160
CTheCarGenerators::Init();
#endif
CHeli::InitHelis();
@@ -503,44 +542,52 @@ bool CGame::Initialise(const char* datFile)
CMovingThings::Init();
CDarkel::Init();
CStats::Init();
-#ifdef GTA_PS2
+#if GTA_VERSION <= GTA3_PS2_160
CPickups::Init();
#endif
CPacManPickups::Init();
- // CGarages::Init(); here on PS2 instead
+#if GTA_VERSION <= GTA3_PS2_160
+ CGarages::Init();
+#endif
CRubbish::Init();
CClouds::Init();
-#ifdef GTA_PS2
+#if GTA_VERSION <= GTA3_PS2_160
CRemote::Init();
#endif
CSpecialFX::Init();
CWaterCannons::Init();
CBridge::Init();
+#if GTA_VERSION > GTA3_PS2_160
CGarages::Init();
+#endif
LoadingScreen("Loading the Game", "Position dynamic objects", nil);
CWorld::RepositionCertainDynamicObjects();
- // CCullZones::ResolveVisibilities(); on PS2 here instead
+#if GTA_VERSION <= GTA3_PS2_160
+ CCullZones::ResolveVisibilities();
+#endif
LoadingScreen("Loading the Game", "Initialise vehicle paths", nil);
+#if GTA_VERSION > GTA3_PS2_160
CCullZones::ResolveVisibilities();
+#endif
CTrain::InitTrains();
CPlane::InitPlanes();
CCredits::Init();
CRecordDataForChase::Init();
+#ifndef GTA_PS2 // TODO: define for that
CReplay::Init();
+#endif
#ifdef PS2_MENU
if ( !TheMemoryCard.m_bWantToLoad )
- {
#endif
- LoadingScreen("Loading the Game", "Start script", nil);
- CTheScripts::StartTestScript();
- CTheScripts::Process();
- TheCamera.Process();
-#ifdef PS2_MENU
+ {
+ LoadingScreen("Loading the Game", "Start script", nil);
+ CTheScripts::StartTestScript();
+ CTheScripts::Process();
+ TheCamera.Process();
}
-#endif
LoadingScreen("Loading the Game", "Load scene", nil);
CModelInfo::RemoveColModelsFromOtherLevels(currLevel);
@@ -556,7 +603,7 @@ bool CGame::ShutDown(void)
CPlane::Shutdown();
CTrain::Shutdown();
CSpecialFX::Shutdown();
-#ifndef PS2
+#if GTA_VERSION > GTA3_PS2_160
CGarages::Shutdown();
#endif
CMovingThings::Shutdown();
@@ -597,7 +644,9 @@ bool CGame::ShutDown(void)
CSkidmarks::Shutdown();
CWeaponEffects::Shutdown();
CParticle::Shutdown();
+#if GTA_VERSION > GTA3_PS2_160
CPools::ShutDown();
+#endif
CTxdStore::RemoveTxdSlot(gameTxdSlot);
CdStreamRemoveImages();
return true;
@@ -623,7 +672,7 @@ void CGame::ReInitGameObjectVariables(void)
CWorld::bDoingCarCollisions = false;
CHud::ReInitialise();
CRadar::Initialise();
-#ifdef GTA_PS2
+#if GTA_VERSION <= GTA3_PS2_160
gStartX = -180.0f;
gStartY = 180.0f;
gStartZ = 14.0f;
@@ -646,7 +695,7 @@ void CGame::ReInitGameObjectVariables(void)
CWorld::Players[i].Clear();
CWorld::PlayerInFocus = 0;
-#ifdef GTA_PS2
+#if GTA_VERSION <= GTA3_PS2_160
CWeaponEffects::Init();
CSkidmarks::Init();
#endif
@@ -669,7 +718,7 @@ void CGame::ReInitGameObjectVariables(void)
CPickups::Init();
CPacManPickups::Init();
CGarages::Init();
-#ifdef GTA_PS2
+#if GTA_VERSION <= GTA3_PS2_160
CClouds::Init();
CRemote::Init();
#endif
diff --git a/src/core/World.cpp b/src/core/World.cpp
index 33c2f1c1..62d8d002 100644
--- a/src/core/World.cpp
+++ b/src/core/World.cpp
@@ -53,7 +53,7 @@ bool CWorld::bIncludeCarTyres;
void
CWorld::Initialise()
{
-#ifdef GTA_PS2
+#if GTA_VERSION <= GTA3_PS2_160
CPools::Initialise();
#endif
pIgnoreEntity = nil;
@@ -1783,6 +1783,9 @@ CWorld::ShutDown(void)
}
}
ms_listMovingEntityPtrs.Flush();
+#if GTA_VERSION <= GTA3_PS2_160
+ CPools::Shutdown();
+#endif
}
void