re3-wiiu/src/core/Game.cpp

205 lines
5.1 KiB
C++
Raw Normal View History

2019-05-15 16:52:37 +02:00
#include "common.h"
#include "patcher.h"
#include "Game.h"
2019-07-31 17:54:18 +02:00
#include "main.h"
2020-01-11 13:50:11 +01:00
#include "Accident.h"
2019-10-19 00:23:40 +02:00
#include "Antennas.h"
#include "Bridge.h"
#include "Camera.h"
#include "CarCtrl.h"
#include "CarGen.h"
2019-07-24 18:55:43 +02:00
#include "CdStream.h"
2019-10-19 00:23:40 +02:00
#include "Clock.h"
#include "Clouds.h"
#include "Collision.h"
#include "Coronas.h"
#include "Cranes.h"
#include "CutsceneMgr.h"
#include "Darkel.h"
#include "EventList.h"
#include "FileLoader.h"
2019-07-24 18:55:43 +02:00
#include "FileMgr.h"
2019-10-19 00:23:40 +02:00
#include "Fire.h"
#include "Fluff.h"
#include "Font.h"
#include "Frontend.h"
#include "GameLogic.h"
#include "Garages.h"
#include "Glass.h"
#include "Heli.h"
#include "Pad.h"
#include "Particle.h"
#include "Phones.h"
#include "Pickups.h"
#include "Plane.h"
#include "Population.h"
#include "Record.h"
#include "Renderer.h"
#include "Replay.h"
#include "RoadBlocks.h"
#include "Rubbish.h"
#include "SceneEdit.h"
#include "Script.h"
#include "Shadows.h"
#include "Skidmarks.h"
#include "SpecialFX.h"
#include "Sprite2d.h"
#include "Streaming.h"
#include "TimeCycle.h"
#include "TrafficLights.h"
#include "Train.h"
2019-10-21 15:47:08 +02:00
#include "TxdStore.h"
2019-10-19 00:23:40 +02:00
#include "User.h"
#include "WaterCannon.h"
#include "Weapon.h"
#include "Weather.h"
#include "World.h"
#include "ZoneCull.h"
#include "Zones.h"
2019-05-15 16:52:37 +02:00
2019-06-28 19:23:28 +02:00
eLevelName &CGame::currLevel = *(eLevelName*)0x941514;
2019-05-31 11:44:43 +02:00
bool &CGame::bDemoMode = *(bool*)0x5F4DD0;
bool &CGame::nastyGame = *(bool*)0x5F4DD4;
bool &CGame::frenchGame = *(bool*)0x95CDCB;
bool &CGame::germanGame = *(bool*)0x95CD1E;
bool &CGame::noProstitutes = *(bool*)0x95CDCF;
2019-06-13 02:35:26 +02:00
bool &CGame::playingIntro = *(bool*)0x95CDC2;
2019-06-17 10:30:02 +02:00
char *CGame::aDatFile = (char*)0x773A48;
2019-05-31 11:44:43 +02:00
2019-07-24 18:55:43 +02:00
bool
CGame::InitialiseOnceBeforeRW(void)
{
CFileMgr::Initialise();
CdStreamInit(MAX_CDCHANNELS);
ValidateVersion();
return true;
}
2019-06-28 19:23:28 +02:00
WRAPPER void CGame::Initialise(const char *datFile) { EAXJMP(0x48BED0); }
2019-10-19 00:23:40 +02:00
#if 0
2019-05-31 11:44:43 +02:00
WRAPPER void CGame::Process(void) { EAXJMP(0x48C850); }
2019-10-19 00:23:40 +02:00
#else
2019-10-25 01:25:11 +02:00
extern void (*DebugMenuProcess)(void);
2019-10-19 00:23:40 +02:00
void CGame::Process(void)
{
CPad::UpdatePads();
TheCamera.SetMotionBlurAlpha(0);
2019-10-19 13:12:18 +02:00
if (TheCamera.m_BlurType == MBLUR_NONE || TheCamera.m_BlurType == MBLUR_SNIPER || TheCamera.m_BlurType == MBLUR_NORMAL)
2019-10-19 13:20:51 +02:00
TheCamera.SetMotionBlur(0, 0, 0, 0, MBLUR_NONE);
2019-10-25 01:25:11 +02:00
DebugMenuProcess();
2019-10-19 00:23:40 +02:00
CCutsceneMgr::Update();
2019-10-19 13:12:18 +02:00
if (!CCutsceneMgr::IsCutsceneProcessing() && !CTimer::GetIsCodePaused())
2019-10-19 00:23:40 +02:00
FrontEndMenuManager.Process();
CStreaming::Update();
if (!CTimer::GetIsPaused())
{
CTheZones::Update();
CSprite2d::SetRecipNearClip();
CSprite2d::InitPerFrame();
CFont::InitPerFrame();
CRecordDataForGame::SaveOrRetrieveDataForThisFrame();
CRecordDataForChase::SaveOrRetrieveDataForThisFrame();
CPad::DoCheats();
CClock::Update();
CWeather::Update();
CTheScripts::Process();
CCollision::Update();
CTrain::UpdateTrains();
CPlane::UpdatePlanes();
CHeli::UpdateHelis();
CDarkel::Update();
CSkidmarks::Update();
CAntennas::Update();
CGlass::Update();
CSceneEdit::Update();
CEventList::Update();
CParticle::Update();
gFireManager.Update();
CPopulation::Update();
CWeapon::UpdateWeapons();
if (!CCutsceneMgr::IsRunning())
CTheCarGenerators::Process();
if (!CReplay::IsPlayingBack())
CCranes::UpdateCranes();
CClouds::Update();
CMovingThings::Update();
CWaterCannons::Update();
CUserDisplay::Process();
CReplay::Update();
CWorld::Process();
gAccidentManager.Update();
CPacManPickups::Update();
CPickups::Update();
CGarages::Update();
CRubbish::Update();
CSpecialFX::Update();
CTimeCycle::Update();
if (CReplay::ShouldStandardCameraBeProcessed())
TheCamera.Process();
CCullZones::Update();
if (!CReplay::IsPlayingBack())
CGameLogic::Update();
CBridge::Update();
CCoronas::DoSunAndMoon();
CCoronas::Update();
CShadows::UpdateStaticShadows();
CShadows::UpdatePermanentShadows();
gPhoneInfo.Update();
if (!CReplay::IsPlayingBack())
{
CCarCtrl::GenerateRandomCars();
CRoadBlocks::GenerateRoadBlocks();
CCarCtrl::RemoveDistantCars();
}
}
}
#endif
2019-07-24 18:55:43 +02:00
2019-10-19 00:23:40 +02:00
void CGame::ReloadIPLs(void)
{
CTimer::Stop();
CWorld::RemoveStaticObjects();
ThePaths.Init();
CCullZones::Init();
CFileLoader::ReloadPaths("GTA3.IDE");
CFileLoader::LoadScene("INDUST.IPL");
CFileLoader::LoadScene("COMMER.IPL");
CFileLoader::LoadScene("SUBURBAN.IPL");
CFileLoader::LoadScene("CULL.IPL");
ThePaths.PreparePathData();
CTrafficLights::ScanForLightsOnMap();
CRoadBlocks::Init();
CCranes::InitCranes();
CGarages::Init();
CWorld::RepositionCertainDynamicObjects();
CCullZones::ResolveVisibilities();
CRenderer::SortBIGBuildings();
CTimer::Update();
}
2019-07-24 18:55:43 +02:00
2019-10-21 15:47:08 +02:00
#if 0
WRAPPER void CGame::FinalShutdown(void) { EAXJMP(0x48BEC0); }
#else
void
CGame::FinalShutdown(void)
{
CTxdStore::Shutdown();
CPedStats::Shutdown();
CdStreamShutdown();
}
#endif
2019-06-17 00:16:38 +02:00
WRAPPER bool CGame::InitialiseRenderWare(void) { EAXJMP(0x48BBA0); }
2019-05-31 19:02:26 +02:00
WRAPPER void CGame::ShutdownRenderWare(void) { EAXJMP(0x48BCB0); }
WRAPPER void CGame::ShutDown(void) { EAXJMP(0x48C3A0); }
WRAPPER void CGame::ShutDownForRestart(void) { EAXJMP(0x48C6B0); }
WRAPPER void CGame::InitialiseWhenRestarting(void) { EAXJMP(0x48C740); }
2019-06-17 00:16:38 +02:00
WRAPPER bool CGame::InitialiseOnceAfterRW(void) { EAXJMP(0x48BD50); }
2019-10-19 00:23:40 +02:00
STARTPATCHES
2019-10-21 15:47:08 +02:00
InjectHook(0x48C850, CGame::Process, PATCH_JUMP);
InjectHook(0x48BEC0, CGame::FinalShutdown, PATCH_JUMP);
2019-10-19 00:23:40 +02:00
ENDPATCHES