summaryrefslogtreecommitdiffstats
path: root/src/core
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/core/Debug.cpp12
-rw-r--r--src/core/Debug.h11
-rw-r--r--src/core/Game.cpp157
-rw-r--r--src/core/Game.h2
-rw-r--r--src/core/RwHelper.cpp7
-rw-r--r--src/core/RwHelper.h6
-rw-r--r--src/core/Stats.cpp2
-rw-r--r--src/core/Stats.h2
-rw-r--r--src/core/World.cpp3
-rw-r--r--src/core/World.h3
-rw-r--r--src/core/config.h4
-rw-r--r--src/core/main.cpp18
-rw-r--r--src/core/main.h1
13 files changed, 216 insertions, 12 deletions
diff --git a/src/core/Debug.cpp b/src/core/Debug.cpp
new file mode 100644
index 00000000..1bd353d3
--- /dev/null
+++ b/src/core/Debug.cpp
@@ -0,0 +1,12 @@
+#include "Debug.h"
+
+int CDebug::ms_nCurrentTextLine;
+
+void CDebug::DebugInitTextBuffer()
+{
+ ms_nCurrentTextLine = 0;
+}
+
+void CDebug::DebugDisplayTextBuffer()
+{
+} \ No newline at end of file
diff --git a/src/core/Debug.h b/src/core/Debug.h
new file mode 100644
index 00000000..daee2e2a
--- /dev/null
+++ b/src/core/Debug.h
@@ -0,0 +1,11 @@
+#pragma once
+
+class CDebug
+{
+ static int ms_nCurrentTextLine;
+
+public:
+ static void DebugInitTextBuffer();
+ static void DebugDisplayTextBuffer();
+
+}; \ No newline at end of file
diff --git a/src/core/Game.cpp b/src/core/Game.cpp
index 08751cf9..e89d62a0 100644
--- a/src/core/Game.cpp
+++ b/src/core/Game.cpp
@@ -12,10 +12,13 @@
#include "Clock.h"
#include "Clouds.h"
#include "Collision.h"
+#include "Console.h"
#include "Coronas.h"
#include "Cranes.h"
+#include "Credits.h"
#include "CutsceneMgr.h"
#include "Darkel.h"
+#include "Debug.h"
#include "EventList.h"
#include "FileLoader.h"
#include "FileMgr.h"
@@ -27,6 +30,8 @@
#include "Garages.h"
#include "Glass.h"
#include "Heli.h"
+#include "IniFile.h"
+#include "Messages.h"
#include "Pad.h"
#include "Particle.h"
#include "Phones.h"
@@ -36,14 +41,18 @@
#include "Record.h"
#include "Renderer.h"
#include "Replay.h"
+#include "Restart.h"
#include "RoadBlocks.h"
+#include "PedRoutes.h"
#include "Rubbish.h"
+#include "RwHelper.h"
#include "SceneEdit.h"
#include "Script.h"
#include "Shadows.h"
#include "Skidmarks.h"
#include "SpecialFX.h"
#include "Sprite2d.h"
+#include "Stats.h"
#include "Streaming.h"
#include "TimeCycle.h"
#include "TrafficLights.h"
@@ -51,7 +60,9 @@
#include "TxdStore.h"
#include "User.h"
#include "WaterCannon.h"
+#include "WaterLevel.h"
#include "Weapon.h"
+#include "WeaponEffects.h"
#include "Weather.h"
#include "World.h"
#include "ZoneCull.h"
@@ -76,7 +87,151 @@ CGame::InitialiseOnceBeforeRW(void)
return true;
}
-WRAPPER void CGame::Initialise(const char *datFile) { EAXJMP(0x48BED0); }
+int &gameTxdSlot = *(int*)0x628D88;
+
+bool CGame::Initialise(const char* datFile)
+{
+ ResetLoadingScreenBar();
+ strcpy(aDatFile, datFile);
+ CPools::Initialise();
+ CIniFile::LoadIniFile();
+ currLevel = LEVEL_INDUSTRIAL;
+ LoadingScreen("Loading the Game", "Loading generic textures", GetRandomSplashScreen());
+ gameTxdSlot = CTxdStore::AddTxdSlot("generic");
+ CTxdStore::Create(gameTxdSlot);
+ CTxdStore::AddRef(gameTxdSlot);
+ LoadingScreen("Loading the Game", "Loading particles", nil);
+ int particleTxdSlot = CTxdStore::AddTxdSlot("particle");
+ CTxdStore::LoadTxd(particleTxdSlot, "MODELS/PARTICLE.TXD");
+ CTxdStore::AddRef(particleTxdSlot);
+ CTxdStore::SetCurrentTxd(gameTxdSlot);
+ LoadingScreen("Loading the Game", "Setup game variables", nil);
+ CGameLogic::InitAtStartOfGame();
+ CReferences::Init();
+ TheCamera.Init();
+ TheCamera.SetRwCamera(Scene.camera);
+ CDebug::DebugInitTextBuffer();
+ ThePaths.Init();
+ ThePaths.AllocatePathFindInfoMem(4500);
+ CWeather::Init();
+ CCullZones::Init();
+ CCollision::Init();
+ CTheZones::Init();
+ CUserDisplay::Init();
+ CMessages::Init();
+ CMessages::ClearAllMessagesDisplayedByGame();
+ CRecordDataForGame::Init();
+ CRestart::Initialise();
+ CWorld::Initialise();
+ CParticle::Initialise();
+ CAnimManager::Initialise();
+ CCutsceneMgr::Initialise();
+ CCarCtrl::Init();
+ InitModelIndices();
+ CModelInfo::Initialise();
+ CPickups::Init();
+ CTheCarGenerators::Init();
+ CdStreamAddImage("MODELS\\GTA3.IMG");
+ CFileLoader::LoadLevel("DATA\\DEFAULT.DAT");
+ CFileLoader::LoadLevel(datFile);
+ CWorld::AddParticles();
+ CVehicleModelInfo::LoadVehicleColours();
+ CVehicleModelInfo::LoadEnvironmentMaps();
+ CTheZones::PostZoneCreation();
+ LoadingScreen("Loading the Game", "Setup paths", GetRandomSplashScreen());
+ ThePaths.PreparePathData();
+ for (int i = 0; i < NUMPLAYERS; i++)
+ CWorld::Players[i].Clear();
+ CWorld::Players[0].LoadPlayerSkin();
+ TestModelIndices();
+ LoadingScreen("Loading the Game", "Setup water", nil);
+ CWaterLevel::Initialise("DATA\\WATER.DAT");
+ TheConsole.Init();
+ CDraw::SetFOV(120.0f);
+ CDraw::ms_fLODDistance = 500.0f;
+ LoadingScreen("Loading the Game", "Setup streaming", nil);
+ int txdHandle = CFileMgr::OpenFile("MODELS\\TXD.IMG", "r");
+ if (txdHandle)
+ CFileMgr::CloseFile(txdHandle);
+ if (!CheckVideoCardCaps() && txdHandle) {
+ CdStreamAddImage("MODELS\\TXD.IMG");
+ CStreaming::Init();
+ } else {
+ CStreaming::Init();
+ if (ConvertTextures()) {
+ CStreaming::Shutdown();
+ CdStreamAddImage("MODELS\\TXD.IMG");
+ CStreaming::Init();
+ }
+ }
+ CStreaming::LoadInitialVehicles();
+ CStreaming::LoadInitialPeds();
+ CStreaming::RequestBigBuildings(LEVEL_NONE);
+ CStreaming::LoadAllRequestedModels(false);
+ printf("Streaming uses %dK of its memory", CStreaming::ms_memoryUsed / 1024);
+ LoadingScreen("Loading the Game", "Load animations", GetRandomSplashScreen());
+ CAnimManager::LoadAnimFiles();
+ CPed::Initialise();
+ CRouteNode::Initialise();
+ CEventList::Initialise();
+ LoadingScreen("Loading the Game", "Find big buildings", nil);
+ CRenderer::Init();
+ LoadingScreen("Loading the Game", "Setup game variables", nil);
+ CRadar::Initialise();
+ CRadar::LoadTextures();
+ CWeapon::InitialiseWeapons();
+ LoadingScreen("Loading the Game", "Setup traffic lights", nil);
+ CTrafficLights::ScanForLightsOnMap();
+ CRoadBlocks::Init();
+ LoadingScreen("Loading the Game", "Setup game variables", nil);
+ CPopulation::Initialise();
+ CWorld::PlayerInFocus = 0;
+ CCoronas::Init();
+ CShadows::Init();
+ CWeaponEffects::Init();
+ CSkidmarks::Init();
+ CAntennas::Init();
+ CGlass::Init();
+ gPhoneInfo.Initialise();
+ CSceneEdit::Init();
+ LoadingScreen("Loading the Game", "Load scripts", nil);
+ CTheScripts::Init();
+ CGangs::Initialize();
+ LoadingScreen("Loading the Game", "Setup game variables", nil);
+ CClock::Initialise(1000);
+ CHeli::InitHelis();
+ CCranes::InitCranes();
+ CMovingThings::Init();
+ CDarkel::Init();
+ CStats::Init();
+ CPacManPickups::Init();
+ CRubbish::Init();
+ CClouds::Init();
+ CSpecialFX::Init();
+ CWaterCannons::Init();
+ CBridge::Init();
+ CGarages::Init();
+ LoadingScreen("Loading the Game", "Position dynamic objects", nil);
+ CWorld::RepositionCertainDynamicObjects();
+ LoadingScreen("Loading the Game", "Initialise vehicle paths", nil);
+ CCullZones::ResolveVisibilities();
+ CTrain::InitTrains();
+ CPlane::InitPlanes();
+ CCredits::Init();
+ CRecordDataForChase::Init();
+ CReplay::Init();
+ LoadingScreen("Loading the Game", "Start script", nil);
+ CTheScripts::StartTestScript();
+ CTheScripts::Process();
+ TheCamera.Process();
+ LoadingScreen("Loading the Game", "Load scene", nil);
+ CModelInfo::RemoveColModelsFromOtherLevels(CGame::currLevel);
+ CCollision::ms_collisionInMemory = CGame::currLevel;
+ for (int i = 0; i < MAX_PADS; i++)
+ CPad::GetPad(i)->Clear(true);
+ return true;
+}
+
#if 0
WRAPPER void CGame::Process(void) { EAXJMP(0x48C850); }
#else
diff --git a/src/core/Game.h b/src/core/Game.h
index dca38bdb..7b20099c 100644
--- a/src/core/Game.h
+++ b/src/core/Game.h
@@ -20,7 +20,7 @@ public:
static bool &playingIntro;
static char *aDatFile; //[32];
- static void Initialise(const char *datFile);
+ static bool Initialise(const char *datFile);
static bool InitialiseOnceBeforeRW(void);
static bool InitialiseRenderWare(void);
static bool InitialiseOnceAfterRW(void);
diff --git a/src/core/RwHelper.cpp b/src/core/RwHelper.cpp
index 8dade266..1030d69e 100644
--- a/src/core/RwHelper.cpp
+++ b/src/core/RwHelper.cpp
@@ -347,6 +347,13 @@ CameraCreate(RwInt32 width, RwInt32 height, RwBool zBuffer)
return (nil);
}
+WRAPPER void ReadVideoCardCapsFile(uint32&, uint32&, uint32&, uint32&) { EAXJMP(0x5926C0); }
+WRAPPER bool CheckVideoCardCaps(void) { EAXJMP(0x592740); }
+WRAPPER void WriteVideoCardCapsFile(void) { EAXJMP(0x5927D0); }
+WRAPPER void ConvertingTexturesScreen(uint32, uint32, const char*) { EAXJMP(0x592880); }
+WRAPPER void DealWithTxdWriteError(uint32, uint32, const char*) { EAXJMP(0x592BF0); }
+WRAPPER bool ConvertTextures() { EAXJMP(0x592C70); }
+
STARTPATCHES
//InjectHook(0x526450, GetFirstObjectCallback, PATCH_JUMP);
InjectHook(0x526460, GetFirstObject, PATCH_JUMP);
diff --git a/src/core/RwHelper.h b/src/core/RwHelper.h
index ef20467d..1f0290cc 100644
--- a/src/core/RwHelper.h
+++ b/src/core/RwHelper.h
@@ -12,6 +12,12 @@ RwTexture *GetFirstTexture(RwTexDictionary *txd);
RwTexDictionary *RwTexDictionaryGtaStreamRead(RwStream *stream);
RwTexDictionary *RwTexDictionaryGtaStreamRead1(RwStream *stream);
RwTexDictionary *RwTexDictionaryGtaStreamRead2(RwStream *stream, RwTexDictionary *texDict);
+void ReadVideoCardCapsFile(uint32&, uint32&, uint32&, uint32&);
+bool CheckVideoCardCaps(void);
+void WriteVideoCardCapsFile(void);
+void ConvertingTexturesScreen(uint32, uint32, const char*);
+void DealWithTxdWriteError(uint32, uint32, const char*);
+bool ConvertTextures(); // not a real name
bool RpClumpGtaStreamRead1(RwStream *stream);
RpClump *RpClumpGtaStreamRead2(RwStream *stream);
diff --git a/src/core/Stats.cpp b/src/core/Stats.cpp
index 1d088e04..93eeb759 100644
--- a/src/core/Stats.cpp
+++ b/src/core/Stats.cpp
@@ -135,3 +135,5 @@ void CStats::SetTotalNumberMissions(int32 total)
{
TotalNumberMissions = total;
}
+
+WRAPPER void CStats::Init() { EAXJMP(0x4AAC60); } \ No newline at end of file
diff --git a/src/core/Stats.h b/src/core/Stats.h
index 4bf99c45..0a750d5e 100644
--- a/src/core/Stats.h
+++ b/src/core/Stats.h
@@ -74,4 +74,6 @@ public:
static void CheckPointReachedSuccessfully() { TotalLegitimateKills += KillsSinceLastCheckpoint; KillsSinceLastCheckpoint = 0; };
static void RegisterElBurroTime(int32);
static void SaveStats(uint8 *buf, uint32 *size);
+
+ static void Init(void);
};
diff --git a/src/core/World.cpp b/src/core/World.cpp
index f6106bb5..cbceb292 100644
--- a/src/core/World.cpp
+++ b/src/core/World.cpp
@@ -27,7 +27,7 @@ uint16 &CWorld::ms_nCurrentScanCode = *(uint16*)0x95CC64;
CColPoint &CWorld::ms_testSpherePoint = *(CColPoint*)0x6E64C0;
uint8 &CWorld::PlayerInFocus = *(uint8 *)0x95CD61;
-CPlayerInfo *CWorld::Players = (CPlayerInfo *)0x9412F0;
+CPlayerInfo (&CWorld::Players)[NUMPLAYERS] = *(CPlayerInfo (*)[NUMPLAYERS])*(uintptr*)0x9412F0;
bool &CWorld::bNoMoreCollisionTorque = *(bool*)0x95CDCC;
CEntity *&CWorld::pIgnoreEntity = *(CEntity**)0x8F6494;
bool &CWorld::bIncludeDeadPeds = *(bool*)0x95CD8F;
@@ -38,6 +38,7 @@ bool &CWorld::bProcessCutsceneOnly = *(bool*)0x95CD8B;
bool &CWorld::bDoingCarCollisions = *(bool*)0x95CD8C;
bool &CWorld::bIncludeCarTyres = *(bool*)0x95CDAA;
+WRAPPER void CWorld::AddParticles(void) { EAXJMP(0x4B4010); }
WRAPPER void CWorld::ShutDown(void) { EAXJMP(0x4AE450); }
WRAPPER void CWorld::RepositionCertainDynamicObjects() { EAXJMP(0x4B42B0); }
WRAPPER void CWorld::RemoveStaticObjects() { EAXJMP(0x4B4D50); }
diff --git a/src/core/World.h b/src/core/World.h
index 12582d49..1ad65ac4 100644
--- a/src/core/World.h
+++ b/src/core/World.h
@@ -63,7 +63,7 @@ public:
static CColPoint& ms_testSpherePoint;
static uint8 &PlayerInFocus;
- static CPlayerInfo *Players;
+ static CPlayerInfo (&Players)[NUMPLAYERS];
static CEntity *&pIgnoreEntity;
static bool &bIncludeDeadPeds;
static bool &bNoMoreCollisionTorque;
@@ -134,6 +134,7 @@ public:
static void ExtinguishAllCarFiresInArea(CVector, float);
static void Initialise();
+ static void AddParticles();
static void ShutDown();
static void RepositionCertainDynamicObjects();
static void RemoveStaticObjects();
diff --git a/src/core/config.h b/src/core/config.h
index 8d52dac4..c1f96eea 100644
--- a/src/core/config.h
+++ b/src/core/config.h
@@ -1,6 +1,8 @@
#pragma once
enum Config {
+ NUMPLAYERS = 1,
+
NUMCDIMAGES = 12, // gta3.img duplicates (not used on PC)
MAX_CDIMAGES = 8, // additional cdimages
MAX_CDCHANNELS = 5,
@@ -99,6 +101,8 @@ enum Config {
NUMVISIBLEENTITIES = 2000,
NUMINVISIBLEENTITIES = 150,
+
+ NUM_CONSOLEMESSAGES = 8
};
// We'll use this once we're ready to become independent of the game
diff --git a/src/core/main.cpp b/src/core/main.cpp
index 90afff72..95ea345a 100644
--- a/src/core/main.cpp
+++ b/src/core/main.cpp
@@ -49,6 +49,8 @@
#include "Frontend.h"
#include "AnimViewer.h"
#include "Script.h"
+#include "Debug.h"
+#include "Console.h"
#define DEFAULT_VIEWWINDOW (Tan(DEGTORAD(CDraw::GetFOV() * 0.5f)))
@@ -323,7 +325,7 @@ DoRWStuffStartOfFrame_Horizon(int16 TopRed, int16 TopGreen, int16 TopBlue, int16
void
DoRWStuffEndOfFrame(void)
{
- // CDebug::DebugDisplayTextBuffer();
+ CDebug::DebugDisplayTextBuffer();
// FlushObrsPrintfs();
RwCameraEndUpdate(Scene.camera);
RsCameraShowRaster(Scene.camera);
@@ -429,7 +431,7 @@ Render2dStuff(void)
}
MusicManager.DisplayRadioStationName();
-// TheConsole.Display();
+ TheConsole.Display();
/*
if(CSceneEdit::m_bEditOn)
CSceneEdit::Draw();
@@ -724,6 +726,12 @@ DestroySplashScreen(void)
float NumberOfChunksLoaded;
#define TOTALNUMCHUNKS 73.0f
+void
+ResetLoadingScreenBar()
+{
+ NumberOfChunksLoaded = 0.0f;
+}
+
// TODO: compare with PS2
void
LoadingScreen(const char *str1, const char *str2, const char *splashscreen)
@@ -792,12 +800,6 @@ LoadingScreen(const char *str1, const char *str2, const char *splashscreen)
}
void
-ResetLoadingScreenBar(void)
-{
- NumberOfChunksLoaded = 0.0f;
-}
-
-void
LoadingIslandScreen(const char *levelName)
{
CSprite2d *splash;
diff --git a/src/core/main.h b/src/core/main.h
index d6724d2b..570189b3 100644
--- a/src/core/main.h
+++ b/src/core/main.h
@@ -32,6 +32,7 @@ char *GetLevelSplashScreen(int level);
char *GetRandomSplashScreen(void);
void LittleTest(void);
void ValidateVersion();
+void ResetLoadingScreenBar(void);
#ifndef MASTER
void TheModelViewer(void);
#endif