GTA_ZONECULL define

This commit is contained in:
aap 2020-05-03 17:44:10 +02:00
parent 67467f15d1
commit a073dda5ec
3 changed files with 23 additions and 3 deletions

View File

@ -387,7 +387,9 @@ bool CGame::Initialise(const char* datFile)
LoadingScreen("Loading the Game", "Position dynamic objects", nil); LoadingScreen("Loading the Game", "Position dynamic objects", nil);
CWorld::RepositionCertainDynamicObjects(); CWorld::RepositionCertainDynamicObjects();
LoadingScreen("Loading the Game", "Initialise vehicle paths", nil); LoadingScreen("Loading the Game", "Initialise vehicle paths", nil);
#ifdef GTA_ZONECULL
CCullZones::ResolveVisibilities(); CCullZones::ResolveVisibilities();
#endif
CTrain::InitTrains(); CTrain::InitTrains();
CPlane::InitPlanes(); CPlane::InitPlanes();
CCredits::Init(); CCredits::Init();
@ -504,7 +506,9 @@ void CGame::ReInitGameObjectVariables(void)
CSpecialFX::Init(); CSpecialFX::Init();
CWaterCannons::Init(); CWaterCannons::Init();
CParticle::ReloadConfig(); CParticle::ReloadConfig();
#ifdef GTA_ZONECULL
CCullZones::ResolveVisibilities(); CCullZones::ResolveVisibilities();
#endif
if ( !FrontEndMenuManager.m_bWantToLoad ) if ( !FrontEndMenuManager.m_bWantToLoad )
{ {
@ -537,7 +541,9 @@ void CGame::ReloadIPLs(void)
CCranes::InitCranes(); CCranes::InitCranes();
CGarages::Init(); CGarages::Init();
CWorld::RepositionCertainDynamicObjects(); CWorld::RepositionCertainDynamicObjects();
#ifdef GTA_ZONECULL
CCullZones::ResolveVisibilities(); CCullZones::ResolveVisibilities();
#endif
CRenderer::SortBIGBuildings(); CRenderer::SortBIGBuildings();
CTimer::Update(); CTimer::Update();
} }

View File

@ -34,20 +34,23 @@ CCullZones::Init(void)
int i; int i;
NumAttributeZones = 0; NumAttributeZones = 0;
NumCullZones = 0;
CurrentWantedLevelDrop_Player = 0; CurrentWantedLevelDrop_Player = 0;
CurrentFlags_Camera = 0; CurrentFlags_Camera = 0;
CurrentFlags_Player = 0; CurrentFlags_Player = 0;
bCurrentSubwayIsInvisible = false;
#ifdef GTA_ZONECULL
NumCullZones = 0;
OldCullZone = -1; OldCullZone = -1;
EntityIndicesUsed = 0; EntityIndicesUsed = 0;
bCurrentSubwayIsInvisible = false;
for(i = 0; i < NUMBUILDINGS; i++) for(i = 0; i < NUMBUILDINGS; i++)
aPointersToBigBuildingsForBuildings[i] = -1; aPointersToBigBuildingsForBuildings[i] = -1;
for(i = 0; i < NUMTREADABLES; i++) for(i = 0; i < NUMTREADABLES; i++)
aPointersToBigBuildingsForTreadables[i] = -1; aPointersToBigBuildingsForTreadables[i] = -1;
#endif
} }
#ifdef GTA_ZONECULL
bool CCullZone::TestLine(CVector vec1, CVector vec2) bool CCullZone::TestLine(CVector vec1, CVector vec2)
{ {
CColPoint colPoint; CColPoint colPoint;
@ -213,6 +216,7 @@ CCullZones::DoVisibilityTestCullZone(int zoneId, bool doIt)
} }
} }
} }
#endif
void void
CCullZones::Update(void) CCullZones::Update(void)
@ -225,8 +229,10 @@ CCullZones::Update(void)
switch(CTimer::GetFrameCounter() & 7){ switch(CTimer::GetFrameCounter() & 7){
case 0: case 0:
case 4: case 4:
#ifdef GTA_ZONECULL
/* Update Cull zone */ /* Update Cull zone */
ForceCullZoneCoors(TheCamera.GetGameCamPosition()); ForceCullZoneCoors(TheCamera.GetGameCamPosition());
#endif
break; break;
case 2: case 2:
@ -250,6 +256,7 @@ CCullZones::Update(void)
void void
CCullZones::ForceCullZoneCoors(CVector coors) CCullZones::ForceCullZoneCoors(CVector coors)
{ {
#ifdef GTA_ZONECULL
int32 z; int32 z;
z = FindCullZoneForCoors(coors); z = FindCullZoneForCoors(coors);
if(z != OldCullZone){ if(z != OldCullZone){
@ -259,8 +266,10 @@ CCullZones::ForceCullZoneCoors(CVector coors)
aZones[z].DoStuffEnteringZone(); aZones[z].DoStuffEnteringZone();
OldCullZone = z; OldCullZone = z;
} }
#endif
} }
#ifdef GTA_ZONECULL
int32 int32
CCullZones::FindCullZoneForCoors(CVector coors) CCullZones::FindCullZoneForCoors(CVector coors)
{ {
@ -273,6 +282,7 @@ CCullZones::FindCullZoneForCoors(CVector coors)
return i; return i;
return -1; return -1;
} }
#endif
int32 int32
CCullZones::FindAttributesForCoors(CVector coors, int32 *wantedLevel) CCullZones::FindAttributesForCoors(CVector coors, int32 *wantedLevel)
@ -350,6 +360,7 @@ CCullZones::AddCullZone(CVector const &position,
CAttributeZone *attrib; CAttributeZone *attrib;
CVector v; CVector v;
#ifdef GTA_ZONECULL
if((flag & ATTRZONE_NOTCULLZONE) == 0){ if((flag & ATTRZONE_NOTCULLZONE) == 0){
cull = &aZones[NumCullZones++]; cull = &aZones[NumCullZones++];
v = position; v = position;
@ -372,6 +383,7 @@ CCullZones::AddCullZone(CVector const &position,
cull->m_groupIndexCount[2] = 0; cull->m_groupIndexCount[2] = 0;
cull->m_indexStart = 0; cull->m_indexStart = 0;
} }
#endif
if(flag & ~ATTRZONE_NOTCULLZONE){ if(flag & ~ATTRZONE_NOTCULLZONE){
attrib = &aAttributeZones[NumAttributeZones++]; attrib = &aAttributeZones[NumAttributeZones++];
attrib->minx = minx; attrib->minx = minx;
@ -386,7 +398,7 @@ CCullZones::AddCullZone(CVector const &position,
} }
#ifdef GTA_ZONECULL
void void
CCullZone::DoStuffLeavingZone(void) CCullZone::DoStuffLeavingZone(void)
{ {
@ -562,3 +574,4 @@ CCullZones::DoWeHaveMoreThanXOccurencesOfSet(int32 count, uint16 *set)
} }
return false; return false;
} }
#endif

View File

@ -157,6 +157,7 @@ enum Config {
#ifndef MIAMI #ifndef MIAMI
#define GTA_TRAIN // This game has trains #define GTA_TRAIN // This game has trains
#define GTA_BRIDGE // This game has the bridge #define GTA_BRIDGE // This game has the bridge
#define GTA_ZONECULL // This game culls by zones
#endif #endif
// This enables things from the PS2 version on PC // This enables things from the PS2 version on PC