From f56684d04e06af21f423ad4bc1c47bc2b09fccea Mon Sep 17 00:00:00 2001 From: nmzik Date: Sat, 19 Oct 2019 01:23:40 +0300 Subject: CGame::Process() && CGame::ReloadIPLs --- src/core/Game.cpp | 152 +++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 151 insertions(+), 1 deletion(-) (limited to 'src/core/Game.cpp') diff --git a/src/core/Game.cpp b/src/core/Game.cpp index b488a217..f455757c 100644 --- a/src/core/Game.cpp +++ b/src/core/Game.cpp @@ -2,8 +2,59 @@ #include "patcher.h" #include "Game.h" #include "main.h" +#include "AccidentManager.h" +#include "Antennas.h" +#include "Bridge.h" +#include "Camera.h" +#include "CarCtrl.h" +#include "CarGen.h" #include "CdStream.h" +#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" #include "FileMgr.h" +#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" +#include "User.h" +#include "WaterCannon.h" +#include "Weapon.h" +#include "Weather.h" +#include "World.h" +#include "ZoneCull.h" +#include "Zones.h" eLevelName &CGame::currLevel = *(eLevelName*)0x941514; bool &CGame::bDemoMode = *(bool*)0x5F4DD0; @@ -25,9 +76,104 @@ CGame::InitialiseOnceBeforeRW(void) } WRAPPER void CGame::Initialise(const char *datFile) { EAXJMP(0x48BED0); } +#if 0 WRAPPER void CGame::Process(void) { EAXJMP(0x48C850); } +#else +void CGame::Process(void) +{ + CPad::UpdatePads(); + TheCamera.SetMotionBlurAlpha(0); + if (TheCamera.m_BlurType == 0 || TheCamera.m_BlurType == 1 || TheCamera.m_BlurType == 2) + TheCamera.SetMotionBlur(0, 0, 0, 0, 0); + CCutsceneMgr::Update(); + if (!CCutsceneMgr::ms_cutsceneProcessing && !CTimer::GetIsCodePaused()) + 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 - +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(); +} WRAPPER bool CGame::InitialiseRenderWare(void) { EAXJMP(0x48BBA0); } WRAPPER void CGame::ShutdownRenderWare(void) { EAXJMP(0x48BCB0); } @@ -36,3 +182,7 @@ WRAPPER void CGame::ShutDown(void) { EAXJMP(0x48C3A0); } WRAPPER void CGame::ShutDownForRestart(void) { EAXJMP(0x48C6B0); } WRAPPER void CGame::InitialiseWhenRestarting(void) { EAXJMP(0x48C740); } WRAPPER bool CGame::InitialiseOnceAfterRW(void) { EAXJMP(0x48BD50); } + +STARTPATCHES +InjectHook(0x48C850, CGame::Process, PATCH_JUMP); +ENDPATCHES -- cgit v1.2.3