some more GTA_VERSION

This commit is contained in:
aap 2020-12-01 00:22:57 +01:00
parent 4b9fb631fc
commit 2c59e1c894
3 changed files with 85 additions and 27 deletions

View File

@ -59,7 +59,13 @@ CFileLoader::LoadLevel(const char *filename)
savedTxd = RwTexDictionaryCreate(); savedTxd = RwTexDictionaryCreate();
RwTexDictionarySetCurrent(savedTxd); RwTexDictionarySetCurrent(savedTxd);
} }
#if GTA_VERSION <= GTA3_PS2_160
CFileMgr::ChangeDir("\\DATA\\");
fd = CFileMgr::OpenFile(filename, "r"); fd = CFileMgr::OpenFile(filename, "r");
CFileMgr::ChangeDir("\\");
#else
fd = CFileMgr::OpenFile(filename, "r");
#endif
assert(fd > 0); assert(fd > 0);
for(line = LoadLine(fd); line; line = LoadLine(fd)){ for(line = LoadLine(fd); line; line = LoadLine(fd)){

View File

@ -265,16 +265,19 @@ void CGame::ShutdownRenderWare(void)
#endif #endif
} }
// missing altogether on PS2
bool CGame::InitialiseOnceAfterRW(void) bool CGame::InitialiseOnceAfterRW(void)
{ {
#if GTA_VERSION > GTA3_PS2_160
TheText.Load(); TheText.Load();
DMAudio.Initialise(); DMAudio.Initialise(); // before TheGame() on PS2
CTimer::Initialise(); CTimer::Initialise();
CTempColModels::Initialise(); CTempColModels::Initialise();
mod_HandlingManager.Initialise(); mod_HandlingManager.Initialise();
CSurfaceTable::Initialise("DATA\\SURFACE.DAT"); CSurfaceTable::Initialise("DATA\\SURFACE.DAT");
CPedStats::Initialise(); CPedStats::Initialise();
CTimeCycle::Initialise(); CTimeCycle::Initialise();
#endif
if ( DMAudio.GetNum3DProvidersAvailable() == 0 ) if ( DMAudio.GetNum3DProvidersAvailable() == 0 )
FrontEndMenuManager.m_nPrefsAudio3DProviderIndex = -1; FrontEndMenuManager.m_nPrefsAudio3DProviderIndex = -1;
@ -330,10 +333,15 @@ bool CGame::Initialise(const char* datFile)
{ {
#ifdef GTA_PS2 #ifdef GTA_PS2
// TODO: upload VU0 collision code here // TODO: upload VU0 collision code here
#else #endif
#if GTA_VERSION > GTA3_PS2_160
ResetLoadingScreenBar(); ResetLoadingScreenBar();
strcpy(aDatFile, datFile); strcpy(aDatFile, datFile);
CPools::Initialise(); // done in CWorld on PS2 CPools::Initialise(); // done in CWorld on PS2
#endif
#ifndef GTA_PS2
CIniFile::LoadIniFile(); CIniFile::LoadIniFile();
#endif #endif
@ -367,13 +375,15 @@ bool CGame::Initialise(const char* datFile)
CWeather::Init(); CWeather::Init();
CCullZones::Init(); CCullZones::Init();
CCollision::Init(); CCollision::Init();
#ifdef PS2_MENU #ifdef PS2_MENU // TODO: is this the right define?
TheText.Load(); TheText.Load();
#endif #endif
CTheZones::Init(); CTheZones::Init();
CUserDisplay::Init(); CUserDisplay::Init();
CMessages::Init(); CMessages::Init();
#if GTA_VERSION > GTA3_PS2_160
CMessages::ClearAllMessagesDisplayedByGame(); CMessages::ClearAllMessagesDisplayedByGame();
#endif
CRecordDataForGame::Init(); CRecordDataForGame::Init();
CRestart::Initialise(); CRestart::Initialise();
@ -381,11 +391,17 @@ bool CGame::Initialise(const char* datFile)
CWorld::Initialise(); CWorld::Initialise();
POP_MEMID(); POP_MEMID();
#if GTA_VERSION <= GTA3_PS2_160
mod_HandlingManager.Initialise();
CSurfaceTable::Initialise("DATA\\SURFACE.DAT");
CTempColModels::Initialise();
#endif
PUSH_MEMID(MEMID_TEXTURES); PUSH_MEMID(MEMID_TEXTURES);
CParticle::Initialise(); CParticle::Initialise();
POP_MEMID(); POP_MEMID();
#ifdef GTA_PS2 #if GTA_VERSION <= GTA3_PS2_160
gStartX = -180.0f; gStartX = -180.0f;
gStartY = 180.0f; gStartY = 180.0f;
gStartZ = 14.0f; gStartZ = 14.0f;
@ -400,20 +416,31 @@ bool CGame::Initialise(const char* datFile)
CCarCtrl::Init(); CCarCtrl::Init();
POP_MEMID(); POP_MEMID();
#ifndef GTA_PS2 #if GTA_VERSION > GTA3_PS2_160
InitModelIndices(); InitModelIndices();
#endif #endif
PUSH_MEMID(MEMID_DEF_MODELS); PUSH_MEMID(MEMID_DEF_MODELS);
CModelInfo::Initialise(); CModelInfo::Initialise();
#ifndef GTA_PS2 #if GTA_VERSION <= GTA3_PS2_160
CPedStats::Initialise(); // InitialiseOnceAfterRW
#else
// probably moved before LoadLevel for multiplayer maps? // probably moved before LoadLevel for multiplayer maps?
CPickups::Init(); CPickups::Init();
CTheCarGenerators::Init(); CTheCarGenerators::Init();
#endif #endif
#ifndef GTA_PS2 // or GTA_VERSION?
CdStreamAddImage("MODELS\\GTA3.IMG"); CdStreamAddImage("MODELS\\GTA3.IMG");
#endif
#if GTA_VERSION > GTA3_PS2_160
CFileLoader::LoadLevel("DATA\\DEFAULT.DAT"); CFileLoader::LoadLevel("DATA\\DEFAULT.DAT");
CFileLoader::LoadLevel(datFile); CFileLoader::LoadLevel(datFile);
#else
CFileLoader::LoadLevel("GTA3.DAT");
#endif
#ifdef EXTENDED_PIPELINES #ifdef EXTENDED_PIPELINES
// for generic fallback // for generic fallback
CustomPipes::SetTxdFindCallback(); CustomPipes::SetTxdFindCallback();
@ -424,18 +451,25 @@ bool CGame::Initialise(const char* datFile)
CTheZones::PostZoneCreation(); CTheZones::PostZoneCreation();
POP_MEMID(); POP_MEMID();
#if GTA_VERSION <= GTA3_PS2_160
TestModelIndices();
#endif
LoadingScreen("Loading the Game", "Setup paths", GetRandomSplashScreen()); LoadingScreen("Loading the Game", "Setup paths", GetRandomSplashScreen());
ThePaths.PreparePathData(); ThePaths.PreparePathData();
// done elsewhere on PS2 #if GTA_VERSION > GTA3_PS2_160
for (int i = 0; i < NUMPLAYERS; i++) for (int i = 0; i < NUMPLAYERS; i++)
CWorld::Players[i].Clear(); CWorld::Players[i].Clear();
CWorld::Players[0].LoadPlayerSkin(); CWorld::Players[0].LoadPlayerSkin();
TestModelIndices(); TestModelIndices();
// #endif
LoadingScreen("Loading the Game", "Setup water", nil); LoadingScreen("Loading the Game", "Setup water", nil);
CWaterLevel::Initialise("DATA\\WATER.DAT"); CWaterLevel::Initialise("DATA\\WATER.DAT");
#if GTA_VERSION <= GTA3_PS2_160
CTimeCycle::Initialise(); // InitialiseOnceAfterRW
#else
TheConsole.Init(); TheConsole.Init();
#endif
CDraw::SetFOV(120.0f); CDraw::SetFOV(120.0f);
CDraw::ms_fLODDistance = 500.0f; CDraw::ms_fLODDistance = 500.0f;
@ -472,6 +506,11 @@ bool CGame::Initialise(const char* datFile)
LoadingScreen("Loading the Game", "Setup game variables", nil); LoadingScreen("Loading the Game", "Setup game variables", nil);
CPopulation::Initialise(); 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; CWorld::PlayerInFocus = 0;
CCoronas::Init(); CCoronas::Init();
CShadows::Init(); CShadows::Init();
@ -480,7 +519,7 @@ bool CGame::Initialise(const char* datFile)
CAntennas::Init(); CAntennas::Init();
CGlass::Init(); CGlass::Init();
gPhoneInfo.Initialise(); gPhoneInfo.Initialise();
#ifndef GTA_PS2 #ifndef GTA_PS2 // TODO: define for this
CSceneEdit::Initialise(); CSceneEdit::Initialise();
#endif #endif
@ -491,11 +530,11 @@ bool CGame::Initialise(const char* datFile)
POP_MEMID(); POP_MEMID();
LoadingScreen("Loading the Game", "Setup game variables", nil); LoadingScreen("Loading the Game", "Setup game variables", nil);
#ifdef GTA_PS2 #if GTA_VERSION <= GTA3_PS2_160
CTimer::Initialise(); CTimer::Initialise();
#endif #endif
CClock::Initialise(1000); CClock::Initialise(1000);
#ifdef GTA_PS2 #if GTA_VERSION <= GTA3_PS2_160
CTheCarGenerators::Init(); CTheCarGenerators::Init();
#endif #endif
CHeli::InitHelis(); CHeli::InitHelis();
@ -503,44 +542,52 @@ bool CGame::Initialise(const char* datFile)
CMovingThings::Init(); CMovingThings::Init();
CDarkel::Init(); CDarkel::Init();
CStats::Init(); CStats::Init();
#ifdef GTA_PS2 #if GTA_VERSION <= GTA3_PS2_160
CPickups::Init(); CPickups::Init();
#endif #endif
CPacManPickups::Init(); CPacManPickups::Init();
// CGarages::Init(); here on PS2 instead #if GTA_VERSION <= GTA3_PS2_160
CGarages::Init();
#endif
CRubbish::Init(); CRubbish::Init();
CClouds::Init(); CClouds::Init();
#ifdef GTA_PS2 #if GTA_VERSION <= GTA3_PS2_160
CRemote::Init(); CRemote::Init();
#endif #endif
CSpecialFX::Init(); CSpecialFX::Init();
CWaterCannons::Init(); CWaterCannons::Init();
CBridge::Init(); CBridge::Init();
#if GTA_VERSION > GTA3_PS2_160
CGarages::Init(); CGarages::Init();
#endif
LoadingScreen("Loading the Game", "Position dynamic objects", nil); LoadingScreen("Loading the Game", "Position dynamic objects", nil);
CWorld::RepositionCertainDynamicObjects(); 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); LoadingScreen("Loading the Game", "Initialise vehicle paths", nil);
#if GTA_VERSION > GTA3_PS2_160
CCullZones::ResolveVisibilities(); CCullZones::ResolveVisibilities();
#endif
CTrain::InitTrains(); CTrain::InitTrains();
CPlane::InitPlanes(); CPlane::InitPlanes();
CCredits::Init(); CCredits::Init();
CRecordDataForChase::Init(); CRecordDataForChase::Init();
#ifndef GTA_PS2 // TODO: define for that
CReplay::Init(); CReplay::Init();
#endif
#ifdef PS2_MENU #ifdef PS2_MENU
if ( !TheMemoryCard.m_bWantToLoad ) if ( !TheMemoryCard.m_bWantToLoad )
#endif
{ {
#endif LoadingScreen("Loading the Game", "Start script", nil);
LoadingScreen("Loading the Game", "Start script", nil); CTheScripts::StartTestScript();
CTheScripts::StartTestScript(); CTheScripts::Process();
CTheScripts::Process(); TheCamera.Process();
TheCamera.Process();
#ifdef PS2_MENU
} }
#endif
LoadingScreen("Loading the Game", "Load scene", nil); LoadingScreen("Loading the Game", "Load scene", nil);
CModelInfo::RemoveColModelsFromOtherLevels(currLevel); CModelInfo::RemoveColModelsFromOtherLevels(currLevel);
@ -556,7 +603,7 @@ bool CGame::ShutDown(void)
CPlane::Shutdown(); CPlane::Shutdown();
CTrain::Shutdown(); CTrain::Shutdown();
CSpecialFX::Shutdown(); CSpecialFX::Shutdown();
#ifndef PS2 #if GTA_VERSION > GTA3_PS2_160
CGarages::Shutdown(); CGarages::Shutdown();
#endif #endif
CMovingThings::Shutdown(); CMovingThings::Shutdown();
@ -597,7 +644,9 @@ bool CGame::ShutDown(void)
CSkidmarks::Shutdown(); CSkidmarks::Shutdown();
CWeaponEffects::Shutdown(); CWeaponEffects::Shutdown();
CParticle::Shutdown(); CParticle::Shutdown();
#if GTA_VERSION > GTA3_PS2_160
CPools::ShutDown(); CPools::ShutDown();
#endif
CTxdStore::RemoveTxdSlot(gameTxdSlot); CTxdStore::RemoveTxdSlot(gameTxdSlot);
CdStreamRemoveImages(); CdStreamRemoveImages();
return true; return true;
@ -623,7 +672,7 @@ void CGame::ReInitGameObjectVariables(void)
CWorld::bDoingCarCollisions = false; CWorld::bDoingCarCollisions = false;
CHud::ReInitialise(); CHud::ReInitialise();
CRadar::Initialise(); CRadar::Initialise();
#ifdef GTA_PS2 #if GTA_VERSION <= GTA3_PS2_160
gStartX = -180.0f; gStartX = -180.0f;
gStartY = 180.0f; gStartY = 180.0f;
gStartZ = 14.0f; gStartZ = 14.0f;
@ -646,7 +695,7 @@ void CGame::ReInitGameObjectVariables(void)
CWorld::Players[i].Clear(); CWorld::Players[i].Clear();
CWorld::PlayerInFocus = 0; CWorld::PlayerInFocus = 0;
#ifdef GTA_PS2 #if GTA_VERSION <= GTA3_PS2_160
CWeaponEffects::Init(); CWeaponEffects::Init();
CSkidmarks::Init(); CSkidmarks::Init();
#endif #endif
@ -669,7 +718,7 @@ void CGame::ReInitGameObjectVariables(void)
CPickups::Init(); CPickups::Init();
CPacManPickups::Init(); CPacManPickups::Init();
CGarages::Init(); CGarages::Init();
#ifdef GTA_PS2 #if GTA_VERSION <= GTA3_PS2_160
CClouds::Init(); CClouds::Init();
CRemote::Init(); CRemote::Init();
#endif #endif

View File

@ -53,7 +53,7 @@ bool CWorld::bIncludeCarTyres;
void void
CWorld::Initialise() CWorld::Initialise()
{ {
#ifdef GTA_PS2 #if GTA_VERSION <= GTA3_PS2_160
CPools::Initialise(); CPools::Initialise();
#endif #endif
pIgnoreEntity = nil; pIgnoreEntity = nil;
@ -1783,6 +1783,9 @@ CWorld::ShutDown(void)
} }
} }
ms_listMovingEntityPtrs.Flush(); ms_listMovingEntityPtrs.Flush();
#if GTA_VERSION <= GTA3_PS2_160
CPools::Shutdown();
#endif
} }
void void