summaryrefslogtreecommitdiffstats
path: root/src/core
diff options
context:
space:
mode:
authoreray orçunus <erayorcunus@gmail.com>2020-08-29 18:22:25 +0200
committereray orçunus <erayorcunus@gmail.com>2020-08-30 11:40:30 +0200
commit3e549a7d4484340d8d71500a7e61f81f403f48cc (patch)
tree3506aaab712cf59e5a0e687090ac7ebedd866c6b /src/core
parentupdate librw (diff)
downloadre3-3e549a7d4484340d8d71500a7e61f81f403f48cc.tar
re3-3e549a7d4484340d8d71500a7e61f81f403f48cc.tar.gz
re3-3e549a7d4484340d8d71500a7e61f81f403f48cc.tar.bz2
re3-3e549a7d4484340d8d71500a7e61f81f403f48cc.tar.lz
re3-3e549a7d4484340d8d71500a7e61f81f403f48cc.tar.xz
re3-3e549a7d4484340d8d71500a7e61f81f403f48cc.tar.zst
re3-3e549a7d4484340d8d71500a7e61f81f403f48cc.zip
Diffstat (limited to '')
-rw-r--r--src/core/Accident.cpp2
-rw-r--r--src/core/Camera.cpp6
-rw-r--r--src/core/Clock.cpp10
-rw-r--r--src/core/Frontend.cpp5
-rw-r--r--src/core/Game.cpp80
-rw-r--r--src/core/config.h1
-rw-r--r--src/core/main.cpp28
-rw-r--r--src/core/re3.cpp2
8 files changed, 95 insertions, 39 deletions
diff --git a/src/core/Accident.cpp b/src/core/Accident.cpp
index c8611323..cb46e181 100644
--- a/src/core/Accident.cpp
+++ b/src/core/Accident.cpp
@@ -6,6 +6,8 @@
#include "Pools.h"
#include "World.h"
+// --MIAMI: File done
+
CAccidentManager gAccidentManager;
CAccident*
diff --git a/src/core/Camera.cpp b/src/core/Camera.cpp
index df778815..704e77b8 100644
--- a/src/core/Camera.cpp
+++ b/src/core/Camera.cpp
@@ -2044,7 +2044,11 @@ CCamera::GetScreenRect(CRect &rect)
{
rect.left = 0.0f;
rect.right = SCREEN_WIDTH;
- if(m_WideScreenOn){
+ if(m_WideScreenOn
+#ifdef CUTSCENE_BORDERS_SWITCH
+ && CMenuManager::m_PrefsCutsceneBorders
+#endif
+ ){
float borderSize = (SCREEN_HEIGHT / 2) * (m_ScreenReductionPercentage / 100.f);
rect.top = borderSize - SCREEN_SCALE_Y(22.f);
rect.bottom = SCREEN_HEIGHT - borderSize - SCREEN_SCALE_Y(14.f);
diff --git a/src/core/Clock.cpp b/src/core/Clock.cpp
index e4b908e0..6c54ac63 100644
--- a/src/core/Clock.cpp
+++ b/src/core/Clock.cpp
@@ -5,6 +5,8 @@
#include "Clock.h"
#include "Stats.h"
+// --MIAMI: File done
+
_TODO("gbFastTime");
bool gbFastTime;
@@ -73,8 +75,14 @@ CClock::Update(void)
void
CClock::SetGameClock(uint8 h, uint8 m)
{
- ms_nGameClockHours = h;
+ while (m >= 60) {
+ m -= 60;
+ h++;
+ }
ms_nGameClockMinutes = m;
+ while (h >= 24)
+ h -= 24;
+ ms_nGameClockHours = h;
ms_nGameClockSeconds = 0;
ms_nLastClockTick = CTimer::GetTimeInMilliseconds();
}
diff --git a/src/core/Frontend.cpp b/src/core/Frontend.cpp
index c55b139c..715e9061 100644
--- a/src/core/Frontend.cpp
+++ b/src/core/Frontend.cpp
@@ -3507,8 +3507,9 @@ CMenuManager::Process(void)
UserInput();
ProcessFileActions();
DMAudio.Service();
-
- // Game calls some texture pool cleanup functions in here
+#ifdef USE_TEXTURE_POOL
+ // TODO
+#endif
}
SwitchMenuOnAndOff();
diff --git a/src/core/Game.cpp b/src/core/Game.cpp
index ee3c32b1..d108c78d 100644
--- a/src/core/Game.cpp
+++ b/src/core/Game.cpp
@@ -109,6 +109,7 @@ bool CGame::japaneseGame = false;
int gameTxdSlot;
+// --MIAMI: File done
bool DoRWStuffStartOfFrame(int16 TopRed, int16 TopGreen, int16 TopBlue, int16 BottomRed, int16 BottomGreen, int16 BottomBlue, int16 Alpha);
void DoRWStuffEndOfFrame(void);
@@ -153,7 +154,11 @@ CGame::InitialiseOnceBeforeRW(void)
{
CFileMgr::Initialise();
CdStreamInit(MAX_CDCHANNELS);
- ValidateVersion();
+ debug("size of matrix %d\n", sizeof(CMatrix));
+ debug("size of placeable %d\n", sizeof(CPlaceable));
+ debug("size of entity %d\n", sizeof(CEntity));
+ debug("size of building %d\n", sizeof(CBuilding));
+ debug("size of dummy %d\n", sizeof(CDummy));
#ifdef EXTENDED_COLOURFILTER
CPostFX::InitOnce();
#endif
@@ -172,6 +177,7 @@ void ReplaceAtomicPipeCallback();
bool
CGame::InitialiseRenderWare(void)
{
+ ValidateVersion();
#ifdef USE_TEXTURE_POOL
_TexturePoolsInitialise();
#endif
@@ -237,7 +243,6 @@ CGame::InitialiseRenderWare(void)
void CGame::ShutdownRenderWare(void)
{
- CMBlur::MotionBlurClose();
DestroySplashScreen();
CHud::Shutdown();
CFont::Shutdown();
@@ -293,7 +298,6 @@ bool CGame::InitialiseOnceAfterRW(void)
DMAudio.SetEffectsMasterVolume(FrontEndMenuManager.m_PrefsSfxVolume);
DMAudio.SetEffectsFadeVol(127);
DMAudio.SetMusicFadeVol(127);
- CWorld::Players[0].SetPlayerSkin(FrontEndMenuManager.m_PrefsSkinFile);
return true;
}
@@ -311,7 +315,11 @@ bool CGame::Initialise(const char* datFile)
strcpy(aDatFile, datFile);
CPools::Initialise();
CIniFile::LoadIniFile();
+#ifdef USE_TEXTURE_POOL
+ _TexturePoolsUnknown(false);
+#endif
currLevel = LEVEL_BEACH;
+ currArea = AREA_MAIN_MAP;
LoadingScreen("Loading the Game", "Loading generic textures", GetRandomSplashScreen());
gameTxdSlot = CTxdStore::AddTxdSlot("generic");
CTxdStore::Create(gameTxdSlot);
@@ -362,11 +370,12 @@ bool CGame::Initialise(const char* datFile)
// for generic fallback
CustomPipes::SetTxdFindCallback();
#endif
+ LoadingScreen("Loading the Game", "Add Particles", nil);
CWorld::AddParticles();
CVehicleModelInfo::LoadVehicleColours();
CVehicleModelInfo::LoadEnvironmentMaps();
CTheZones::PostZoneCreation();
- LoadingScreen("Loading the Game", "Setup paths", GetRandomSplashScreen());
+ LoadingScreen("Loading the Game", "Setup paths", nil);
ThePaths.PreparePathData();
for (int i = 0; i < NUMPLAYERS; i++)
CWorld::Players[i].Clear();
@@ -382,10 +391,12 @@ bool CGame::Initialise(const char* datFile)
CStreaming::LoadInitialPeds();
CStreaming::RequestBigBuildings(LEVEL_GENERIC);
CStreaming::LoadAllRequestedModels(false);
+ CStreaming::RemoveIslandsNotUsed(currLevel);
printf("Streaming uses %zuK of its memory", CStreaming::ms_memoryUsed / 1024); // original modifier was %d
LoadingScreen("Loading the Game", "Load animations", GetRandomSplashScreen());
CAnimManager::LoadAnimFiles();
CStreaming::LoadInitialWeapons();
+ CStreaming::LoadAllRequestedModels(0);
CPed::Initialise();
CRouteNode::Initialise();
CEventList::Initialise();
@@ -449,6 +460,9 @@ bool CGame::Initialise(const char* datFile)
CCollision::ms_collisionInMemory = currLevel;
for (int i = 0; i < MAX_PADS; i++)
CPad::GetPad(i)->Clear(true);
+#ifdef USE_TEXTURE_POOL
+ _TexturePoolsUnknown(true);
+#endif
// TODO(Miami)
// DMAudio.SetStartingTrackPositions(1);
DMAudio.ChangeMusicMode(MUSICMODE_GAME);
@@ -457,10 +471,16 @@ bool CGame::Initialise(const char* datFile)
bool CGame::ShutDown(void)
{
+#ifdef USE_TEXTURE_POOL
+ _TexturePoolsUnknown(false);
+#endif
CReplay::FinishPlayback();
+ CReplay::EmptyReplayBuffer();
CPlane::Shutdown();
CTrain::Shutdown();
CScriptPaths::Shutdown();
+ // TODO(Miami)
+ // CWaterCreatures::RemoveAll();
CSpecialFX::Shutdown();
#ifndef PS2
CGarages::Shutdown();
@@ -495,7 +515,7 @@ bool CGame::ShutDown(void)
CStreaming::Shutdown();
CTxdStore::GameShutdown();
CCollision::Shutdown();
- CWaterLevel::Shutdown();
+ CWaterLevel::DestroyWavyAtomic();
CRubbish::Shutdown();
CClouds::Shutdown();
CShadows::Shutdown();
@@ -505,7 +525,11 @@ bool CGame::ShutDown(void)
CParticle::Shutdown();
CPools::ShutDown();
CTxdStore::RemoveTxdSlot(gameTxdSlot);
+ CMBlur::MotionBlurClose();
CdStreamRemoveImages();
+#ifdef USE_TEXTURE_POOL
+ _TexturePoolsFinalShutdown();
+#endif
return true;
}
@@ -539,7 +563,10 @@ void CGame::ReInitGameObjectVariables(void)
CDraw::SetFOV(120.0f);
CDraw::ms_fLODDistance = 500.0f;
CStreaming::RequestBigBuildings(LEVEL_GENERIC);
+ CStreaming::RemoveIslandsNotUsed(LEVEL_BEACH);
+ CStreaming::RemoveIslandsNotUsed(LEVEL_MAINLAND);
CStreaming::LoadAllRequestedModels(false);
+ currArea = AREA_MAIN_MAP;
CPed::Initialise();
CEventList::Initialise();
CWeapon::InitialiseWeapons();
@@ -603,9 +630,13 @@ void CGame::ReloadIPLs(void)
void CGame::ShutDownForRestart(void)
{
+#ifdef USE_TEXTURE_POOL
+ _TexturePoolsUnknown(false);
+#endif
CReplay::FinishPlayback();
CReplay::EmptyReplayBuffer();
DMAudio.DestroyAllGameCreatedEntities();
+ CMovingThings::Shutdown();
for (int i = 0; i < NUMPLAYERS; i++)
CWorld::Players[i].Clear();
@@ -620,11 +651,10 @@ void CGame::ShutDownForRestart(void)
CRadar::RemoveRadarSections();
FrontEndMenuManager.UnloadTextures();
CParticleObject::RemoveAllExpireableParticleObjects();
- //CWaterCreatures::RemoveAll(); //TODO VC
+ //CWaterCreatures::RemoveAll(); //TODO(Miami)
CSetPieces::Init();
CPedType::Shutdown();
CSpecialFX::Shutdown();
- TidyUpMemory(true, false);
}
void CGame::InitialiseWhenRestarting(void)
@@ -649,13 +679,15 @@ void CGame::InitialiseWhenRestarting(void)
if ( FrontEndMenuManager.m_bWantToLoad == true )
{
RestoreForStartLoad();
- CStreaming::LoadScene(TheCamera.GetPosition());
}
ReInitGameObjectVariables();
if ( FrontEndMenuManager.m_bWantToLoad == true )
{
+ FrontEndMenuManager.m_bWantToLoad = false;
+ // TODO(Miami)
+ //InitRadioStationPositionList();
if ( GenericLoad() == true )
{
DMAudio.ResetTimers(CTimer::GetTimeInMilliseconds());
@@ -670,6 +702,7 @@ void CGame::InitialiseWhenRestarting(void)
FrontEndMenuManager.MessageScreen("FED_LFL", true); // Loading save game has failed. The game will restart now.
}
+ TheCamera.SetFadeColour(0, 0, 0);
ShutDownForRestart();
CTimer::Stop();
CTimer::Initialise();
@@ -683,6 +716,9 @@ void CGame::InitialiseWhenRestarting(void)
CTimer::Update();
DMAudio.ChangeMusicMode(MUSICMODE_GAME);
+#ifdef USE_TEXTURE_POOL
+ _TexturePoolsUnknown(true);
+#endif
}
void CGame::Process(void)
@@ -691,20 +727,20 @@ void CGame::Process(void)
#ifdef GTA_PS2
ProcessTidyUpMemory();
#endif
- TheCamera.SetMotionBlurAlpha(0);
- if (TheCamera.m_BlurType == MOTION_BLUR_NONE || TheCamera.m_BlurType == MOTION_BLUR_SNIPER || TheCamera.m_BlurType == MOTION_BLUR_LIGHT_SCENE)
- TheCamera.SetMotionBlur(0, 0, 0, 0, MOTION_BLUR_NONE);
#ifdef DEBUGMENU
DebugMenuProcess();
#endif
CCutsceneMgr::Update();
if (!CCutsceneMgr::IsCutsceneProcessing() && !CTimer::GetIsCodePaused())
FrontEndMenuManager.Process();
+ CTheZones::Update();
+ // DRM call in here
+ uint32 startTime = CTimer::GetCurrentTimeInCycles() / CTimer::GetCyclesPerMillisecond();
CStreaming::Update();
+ uint32 processTime = CTimer::GetCurrentTimeInCycles() / CTimer::GetCyclesPerMillisecond() - startTime;
CWindModifiers::Number = 0;
if (!CTimer::GetIsPaused())
{
- CTheZones::Update();
CSprite2d::SetRecipNearClip();
CSprite2d::InitPerFrame();
CFont::InitPerFrame();
@@ -728,7 +764,13 @@ void CGame::Process(void)
CEventList::Update();
CParticle::Update();
gFireManager.Update();
- CPopulation::Update();
+ if (processTime >= 2) {
+ CPopulation::Update(false);
+ } else {
+ uint32 startTime = CTimer::GetCurrentTimeInCycles() / CTimer::GetCyclesPerMillisecond();
+ CPopulation::Update(true);
+ processTime = CTimer::GetCurrentTimeInCycles() / CTimer::GetCyclesPerMillisecond() - startTime;
+ }
CWeapon::UpdateWeapons();
if (!CCutsceneMgr::IsRunning())
CTheCarGenerators::Process();
@@ -761,9 +803,11 @@ void CGame::Process(void)
gPhoneInfo.Update();
if (!CReplay::IsPlayingBack())
{
- CCarCtrl::GenerateRandomCars();
+ if (processTime < 2)
+ CCarCtrl::GenerateRandomCars();
CRoadBlocks::GenerateRoadBlocks();
CCarCtrl::RemoveDistantCars();
+ CCarCtrl::RemoveCarsIfThePoolGetsFull();
}
}
}
@@ -794,16 +838,22 @@ CGame::CanSeeOutSideFromCurrArea(void)
void CGame::DrasticTidyUpMemory(bool)
{
+#ifdef USE_TEXTURE_POOL
+ // TODO
+#endif
#ifdef PS2
// meow
#endif
}
-void CGame::TidyUpMemory(bool, bool)
+void CGame::TidyUpMemory(bool unk1, bool unk2)
{
#ifdef PS2
// meow
#endif
+ if (unk2) {
+ DrasticTidyUpMemory(true); // parameter is unknown too
+ }
}
void CGame::ProcessTidyUpMemory(void)
diff --git a/src/core/config.h b/src/core/config.h
index 62c3fa73..276ddefd 100644
--- a/src/core/config.h
+++ b/src/core/config.h
@@ -304,7 +304,6 @@ enum Config {
#define PED_SKIN // support for skinned geometry on peds
#define ANIMATE_PED_COL_MODEL
#define VC_PED_PORTS // various ports from VC's CPed, mostly subtle
-// #define NEW_WALK_AROUND_ALGORITHM // to make walking around vehicles/objects less awkward
#define CANCELLABLE_CAR_ENTER
// Camera
diff --git a/src/core/main.cpp b/src/core/main.cpp
index 0009048d..5a31ad22 100644
--- a/src/core/main.cpp
+++ b/src/core/main.cpp
@@ -256,26 +256,11 @@ DoFade(void)
fadeColor.a = alpha;
}
- // This is CCamera::GetScreenRect in VC
- if(TheCamera.m_WideScreenOn
-#ifdef CUTSCENE_BORDERS_SWITCH
- && CMenuManager::m_PrefsCutsceneBorders
-#endif
- ){
- float y = SCREEN_HEIGHT/2 * TheCamera.m_ScreenReductionPercentage/100.0f;
- rect.left = 0.0f;
- rect.right = SCREEN_WIDTH;
- rect.top = y - SCREEN_SCALE_Y(22.0f);
- rect.bottom = SCREEN_HEIGHT - y - SCREEN_SCALE_Y(14.0f);
- }else{
- rect.left = 0.0f;
- rect.right = SCREEN_WIDTH;
- rect.top = 0.0f;
- rect.bottom = SCREEN_HEIGHT;
- }
+ TheCamera.GetScreenRect(rect);
CSprite2d::DrawRect(rect, fadeColor);
if(CDraw::FadeValue != 0 && TheCamera.m_FadeTargetIsSplashScreen){
+ RwRenderStateSet(rwRENDERSTATETEXTUREFILTER, (void*)rwFILTERLINEAR);
fadeColor.r = 255;
fadeColor.g = 255;
fadeColor.b = 255;
@@ -954,11 +939,12 @@ Render2dStuff(void)
if(cammode == CCam::MODE_SNIPER ||
cammode == CCam::MODE_SNIPER_RUNABOUT ||
cammode == CCam::MODE_ROCKETLAUNCHER ||
- cammode == CCam::MODE_ROCKETLAUNCHER_RUNABOUT)
+ cammode == CCam::MODE_ROCKETLAUNCHER_RUNABOUT ||
+ cammode == CCam::MODE_CAMERA)
firstPersonWeapon = true;
// Draw black border for sniper and rocket launcher
- if((weaponType == WEAPONTYPE_SNIPERRIFLE || weaponType == WEAPONTYPE_ROCKETLAUNCHER) && firstPersonWeapon){
+ if((weaponType == WEAPONTYPE_SNIPERRIFLE || weaponType == WEAPONTYPE_ROCKETLAUNCHER || weaponType == WEAPONTYPE_LASERSCOPE) && firstPersonWeapon){
CRGBA black(0, 0, 0, 255);
// top and bottom strips
@@ -980,13 +966,17 @@ Render2dStuff(void)
CSceneEdit::Draw();
else
CHud::Draw();
+ // TODO(Miami)
+ // CSpecialFX::Render2DFXs();
CUserDisplay::OnscnTimer.ProcessForDisplay();
CMessages::Display();
CDarkel::DrawMessages();
CGarages::PrintMessages();
CPad::PrintErrorMessage();
CFont::DrawFonts();
+#ifndef MASTER
COcclusion::Render();
+#endif
#ifdef DEBUGMENU
DebugMenuRender();
diff --git a/src/core/re3.cpp b/src/core/re3.cpp
index ce34dc0f..0b80862e 100644
--- a/src/core/re3.cpp
+++ b/src/core/re3.cpp
@@ -429,7 +429,9 @@ DebugMenuPopulate(void)
DebugMenuAddVarBool8("Render", "Motion Blur", &CPostFX::MotionBlurOn, nil);
#endif
DebugMenuAddVar("Render", "Drunkness", &CMBlur::Drunkness, nil, 0.05f, 0, 1.0f);
+#ifndef MASTER
DebugMenuAddVarBool8("Render", "Occlusion debug", &bDisplayOccDebugStuff, nil);
+#endif
#ifdef EXTENDED_PIPELINES
static const char *vehpipenames[] = { "MatFX", "Neo" };
e = DebugMenuAddVar("Render", "Vehicle Pipeline", &CustomPipes::VehiclePipeSwitch, nil,