From 43b4c8dd335ecf0948d5da1218c2298d2c043cb7 Mon Sep 17 00:00:00 2001 From: aap Date: Sun, 20 Dec 2020 19:13:58 +0100 Subject: [PATCH] some more little ps2 fixes --- src/core/Game.cpp | 4 ++++ src/core/Game.h | 4 ++++ src/core/main.cpp | 15 +++++++++++---- 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/src/core/Game.cpp b/src/core/Game.cpp index 0b9ef767..126f0341 100644 --- a/src/core/Game.cpp +++ b/src/core/Game.cpp @@ -371,7 +371,11 @@ CGame::FinalShutdown(void) CdStreamShutdown(); } +#if GTA_VERSION <= GTA3_PS2_160 +bool CGame::Initialise(void) +#else bool CGame::Initialise(const char* datFile) +#endif { #ifdef GTA_PS2 // TODO: upload VU0 collision code here diff --git a/src/core/Game.h b/src/core/Game.h index b55793af..002033a0 100644 --- a/src/core/Game.h +++ b/src/core/Game.h @@ -30,7 +30,11 @@ public: static void ShutdownRenderWare(void); static bool InitialiseOnceAfterRW(void); static void FinalShutdown(void); +#if GTA_VERSION <= GTA3_PS2_160 + static bool Initialise(void); +#else static bool Initialise(const char *datFile); +#endif static bool ShutDown(void); static void ReInitGameObjectVariables(void); static void ReloadIPLs(void); diff --git a/src/core/main.cpp b/src/core/main.cpp index dabb962a..3a855e20 100644 --- a/src/core/main.cpp +++ b/src/core/main.cpp @@ -1688,7 +1688,7 @@ void TheGame(void) CTimer::Initialise(); -#ifdef GTA_PS2 +#if GTA_VERSION <= GTA3_PS2_160 CGame::Initialise(); #else CGame::Initialise("DATA\\GTA3.DAT"); @@ -1758,7 +1758,7 @@ void TheGame(void) PUSH_MEMID(MEMID_RENDER); - if (!FrontEndMenuManager.m_bMenuActive || FrontEndMenuManager.m_bRenderGameInMenu == true && TheCamera.GetScreenFadeStatus() != FADE_2 ) + if ((!FrontEndMenuManager.m_bMenuActive || FrontEndMenuManager.m_bRenderGameInMenu == true) && TheCamera.GetScreenFadeStatus() != FADE_2 ) { PUSH_MEMID(MEMID_RENDERLIST); @@ -1766,14 +1766,22 @@ void TheGame(void) CRenderer::PreRender(); POP_MEMID(); +#ifdef FIX_BUGS + // This has to be done BEFORE RwCameraBeginUpdate + RwCameraSetFarClipPlane(Scene.camera, CTimeCycle::GetFarClip()); + RwCameraSetFogDistance(Scene.camera, CTimeCycle::GetFogStart()); +#endif + if (CWeather::LightningFlash && !CCullZones::CamNoRain()) DoRWStuffStartOfFrame_Horizon(255, 255, 255, 255, 255, 255, 255); else DoRWStuffStartOfFrame_Horizon(CTimeCycle::GetSkyTopRed(), CTimeCycle::GetSkyTopGreen(), CTimeCycle::GetSkyTopBlue(), CTimeCycle::GetSkyBottomRed(), CTimeCycle::GetSkyBottomGreen(), CTimeCycle::GetSkyBottomBlue(), 255); DefinedState(); +#ifndef FIX_BUGS RwCameraSetFarClipPlane(Scene.camera, CTimeCycle::GetFarClip()); RwCameraSetFogDistance(Scene.camera, CTimeCycle::GetFogStart()); +#endif RenderScene(); RenderDebugShit(); @@ -1794,8 +1802,7 @@ void TheGame(void) #endif CVisibilityPlugins::SetRenderWareCamera(Scene.camera); RwCameraClear(Scene.camera, &gColourTop, rwCAMERACLEARZ); - if (!RsCameraBeginUpdate(Scene.camera)) - break; + RsCameraBeginUpdate(Scene.camera); } RenderMenus();