mirror of
https://github.com/halpz/re3.git
synced 2025-07-04 07:50:42 +00:00
CGame::Initialise
This commit is contained in:
12
src/core/Debug.cpp
Normal file
12
src/core/Debug.cpp
Normal file
@ -0,0 +1,12 @@
|
||||
#include "Debug.h"
|
||||
|
||||
int CDebug::ms_nCurrentTextLine;
|
||||
|
||||
void CDebug::DebugInitTextBuffer()
|
||||
{
|
||||
ms_nCurrentTextLine = 0;
|
||||
}
|
||||
|
||||
void CDebug::DebugDisplayTextBuffer()
|
||||
{
|
||||
}
|
11
src/core/Debug.h
Normal file
11
src/core/Debug.h
Normal file
@ -0,0 +1,11 @@
|
||||
#pragma once
|
||||
|
||||
class CDebug
|
||||
{
|
||||
static int ms_nCurrentTextLine;
|
||||
|
||||
public:
|
||||
static void DebugInitTextBuffer();
|
||||
static void DebugDisplayTextBuffer();
|
||||
|
||||
};
|
@ -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
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -135,3 +135,5 @@ void CStats::SetTotalNumberMissions(int32 total)
|
||||
{
|
||||
TotalNumberMissions = total;
|
||||
}
|
||||
|
||||
WRAPPER void CStats::Init() { EAXJMP(0x4AAC60); }
|
@ -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);
|
||||
};
|
||||
|
@ -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); }
|
||||
|
@ -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();
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
@ -791,12 +799,6 @@ LoadingScreen(const char *str1, const char *str2, const char *splashscreen)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ResetLoadingScreenBar(void)
|
||||
{
|
||||
NumberOfChunksLoaded = 0.0f;
|
||||
}
|
||||
|
||||
void
|
||||
LoadingIslandScreen(const char *levelName)
|
||||
{
|
||||
|
@ -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
|
||||
|
Reference in New Issue
Block a user