From 22e8b0e419ad811c977c67ea2f2c06d53ea3be5e Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Tue, 5 May 2020 18:34:46 +0300 Subject: Revert "Remove GTA_TRAIN, GTA_BRIDGE, GTA_ZONECULL" This reverts commit 1eb817de7713ea95bbbcbd7543ffce61ced8ffec. # Conflicts: # src/core/Game.cpp --- src/core/Camera.cpp | 6 ++++++ src/core/Game.cpp | 6 ++++++ src/core/Streaming.cpp | 6 ++++++ src/core/ZoneCull.cpp | 16 +++++++++++++++- src/core/config.h | 6 ++++++ 5 files changed, 39 insertions(+), 1 deletion(-) (limited to 'src/core') diff --git a/src/core/Camera.cpp b/src/core/Camera.cpp index 30f4287b..830a2bb2 100644 --- a/src/core/Camera.cpp +++ b/src/core/Camera.cpp @@ -633,7 +633,11 @@ CCamera::CamControl(void) m_bInitialNodeFound = false; m_bInitialNoNodeStaticsSet = false; } +#ifdef GTA_TRAIN Process_Train_Camera_Control(); +#else + assert(0 && "this can't happen"); +#endif }else{ if(((CVehicle*)pTargetEntity)->IsBoat()) boatTarget = true; @@ -2709,6 +2713,7 @@ CCamera::DontProcessObbeCinemaCamera(void) bDidWeProcessAnyCinemaCam = false; } +#ifdef GTA_TRAIN void CCamera::LoadTrainCamNodes(char const *name) { @@ -2886,6 +2891,7 @@ CCamera::Process_Train_Camera_Control(void) } } } +#endif void diff --git a/src/core/Game.cpp b/src/core/Game.cpp index 96109e56..d0b3f5a3 100644 --- a/src/core/Game.cpp +++ b/src/core/Game.cpp @@ -377,7 +377,9 @@ bool CGame::Initialise(const char* datFile) CWorld::RepositionCertainDynamicObjects(); #endif LoadingScreen("Loading the Game", "Initialise vehicle paths", nil); +#ifdef GTA_ZONECULL CCullZones::ResolveVisibilities(); +#endif CTrain::InitTrains(); CPlane::InitPlanes(); CCredits::Init(); @@ -496,7 +498,9 @@ void CGame::ReInitGameObjectVariables(void) CSpecialFX::Init(); CWaterCannons::Init(); CParticle::ReloadConfig(); +#ifdef GTA_ZONECULL CCullZones::ResolveVisibilities(); +#endif if ( !FrontEndMenuManager.m_bWantToLoad ) { @@ -531,7 +535,9 @@ void CGame::ReloadIPLs(void) #ifndef MIAMI CWorld::RepositionCertainDynamicObjects(); #endif +#ifdef GTA_ZONECULL CCullZones::ResolveVisibilities(); +#endif CRenderer::SortBIGBuildings(); CTimer::Update(); } diff --git a/src/core/Streaming.cpp b/src/core/Streaming.cpp index daeda35d..d212dd05 100644 --- a/src/core/Streaming.cpp +++ b/src/core/Streaming.cpp @@ -2235,7 +2235,9 @@ CStreaming::ProcessEntitiesInSectorList(CPtrList &list, float x, float y, float if(xmin < pos.x && pos.x < xmax && ymin < pos.y && pos.y < ymax && (CVector2D(x, y) - pos).MagnitudeSqr() < lodDistSq) +#ifdef GTA_ZONECULL if(CRenderer::IsEntityCullZoneVisible(e)) +#endif RequestModel(e->GetModelIndex(), 0); } } @@ -2259,7 +2261,9 @@ CStreaming::ProcessEntitiesInSectorList(CPtrList &list) (!e->IsObject() || ((CObject*)e)->ObjectCreatedBy != TEMP_OBJECT)){ CTimeModelInfo *mi = (CTimeModelInfo*)CModelInfo::GetModelInfo(e->GetModelIndex()); if (mi->GetModelType() != MITYPE_TIME || CClock::GetIsTimeInRange(mi->GetTimeOn(), mi->GetTimeOff())) +#ifdef GTA_ZONECULL if(CRenderer::IsEntityCullZoneVisible(e)) +#endif RequestModel(e->GetModelIndex(), 0); } } @@ -2683,7 +2687,9 @@ CStreaming::LoadScene(const CVector &pos) RemoveModel(si - ms_aInfoForModel); } CRenderer::m_loadingPriority = false; +#ifdef GTA_ZONECULL CCullZones::ForceCullZoneCoors(pos); +#endif DeleteAllRwObjects(); #ifndef MIAMI AddModelsToRequestList(pos); diff --git a/src/core/ZoneCull.cpp b/src/core/ZoneCull.cpp index 780c180e..1e9c00f0 100644 --- a/src/core/ZoneCull.cpp +++ b/src/core/ZoneCull.cpp @@ -38,6 +38,7 @@ CCullZones::Init(void) CurrentFlags_Camera = 0; CurrentFlags_Player = 0; bCurrentSubwayIsInvisible = false; +#ifdef GTA_ZONECULL NumCullZones = 0; OldCullZone = -1; EntityIndicesUsed = 0; @@ -46,8 +47,10 @@ CCullZones::Init(void) aPointersToBigBuildingsForBuildings[i] = -1; for(i = 0; i < NUMTREADABLES; i++) aPointersToBigBuildingsForTreadables[i] = -1; +#endif } +#ifdef GTA_ZONECULL bool CCullZone::TestLine(CVector vec1, CVector vec2) { CColPoint colPoint; @@ -213,6 +216,7 @@ CCullZones::DoVisibilityTestCullZone(int zoneId, bool doIt) } } } +#endif void CCullZones::Update(void) @@ -225,8 +229,10 @@ CCullZones::Update(void) switch(CTimer::GetFrameCounter() & 7){ case 0: case 4: +#ifdef GTA_ZONECULL /* Update Cull zone */ ForceCullZoneCoors(TheCamera.GetGameCamPosition()); +#endif break; case 2: @@ -250,6 +256,7 @@ CCullZones::Update(void) void CCullZones::ForceCullZoneCoors(CVector coors) { +#ifdef GTA_ZONECULL int32 z; z = FindCullZoneForCoors(coors); if(z != OldCullZone){ @@ -259,8 +266,10 @@ CCullZones::ForceCullZoneCoors(CVector coors) aZones[z].DoStuffEnteringZone(); OldCullZone = z; } +#endif } +#ifdef GTA_ZONECULL int32 CCullZones::FindCullZoneForCoors(CVector coors) { @@ -273,6 +282,7 @@ CCullZones::FindCullZoneForCoors(CVector coors) return i; return -1; } +#endif int32 CCullZones::FindAttributesForCoors(CVector coors, int32 *wantedLevel) @@ -350,6 +360,7 @@ CCullZones::AddCullZone(CVector const &position, CAttributeZone *attrib; CVector v; +#ifdef GTA_ZONECULL if((flag & ATTRZONE_NOTCULLZONE) == 0){ cull = &aZones[NumCullZones++]; v = position; @@ -372,6 +383,7 @@ CCullZones::AddCullZone(CVector const &position, cull->m_groupIndexCount[2] = 0; cull->m_indexStart = 0; } +#endif if(flag & ~ATTRZONE_NOTCULLZONE){ attrib = &aAttributeZones[NumAttributeZones++]; attrib->minx = minx; @@ -386,6 +398,7 @@ CCullZones::AddCullZone(CVector const &position, } +#ifdef GTA_ZONECULL void CCullZone::DoStuffLeavingZone(void) { @@ -560,4 +573,5 @@ CCullZones::DoWeHaveMoreThanXOccurencesOfSet(int32 count, uint16 *set) } } return false; -} \ No newline at end of file +} +#endif \ No newline at end of file diff --git a/src/core/config.h b/src/core/config.h index c0597db2..c3904fa9 100644 --- a/src/core/config.h +++ b/src/core/config.h @@ -160,6 +160,12 @@ enum Config { //#define GTA_PS2 //#define GTA_XBOX +#ifndef MIAMI +#define GTA_TRAIN // This game has trains +#define GTA_BRIDGE // This game has the bridge +#define GTA_ZONECULL // This game culls by zones +#endif + // This enables things from the PS2 version on PC #define GTA_PS2_STUFF -- cgit v1.2.3