diff options
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/Camera.cpp | 6 | ||||
-rw-r--r-- | src/core/ColStore.cpp | 231 | ||||
-rw-r--r-- | src/core/ColStore.h | 43 | ||||
-rw-r--r-- | src/core/Game.cpp | 6 | ||||
-rw-r--r-- | src/core/Streaming.cpp | 6 | ||||
-rw-r--r-- | src/core/ZoneCull.cpp | 16 | ||||
-rw-r--r-- | src/core/config.h | 6 |
7 files changed, 1 insertions, 313 deletions
diff --git a/src/core/Camera.cpp b/src/core/Camera.cpp index 3f4684e7..9b178f35 100644 --- a/src/core/Camera.cpp +++ b/src/core/Camera.cpp @@ -633,11 +633,7 @@ 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; @@ -2711,7 +2707,6 @@ CCamera::DontProcessObbeCinemaCamera(void) bDidWeProcessAnyCinemaCam = false; } -#ifdef GTA_TRAIN void CCamera::LoadTrainCamNodes(char const *name) { @@ -2889,7 +2884,6 @@ CCamera::Process_Train_Camera_Control(void) } } } -#endif void diff --git a/src/core/ColStore.cpp b/src/core/ColStore.cpp deleted file mode 100644 index 0c3356c5..00000000 --- a/src/core/ColStore.cpp +++ /dev/null @@ -1,231 +0,0 @@ -#include "common.h" -#ifdef MIAMI - -#include "templates.h" -#include "General.h" -#include "ModelInfo.h" -#include "Streaming.h" -#include "FileLoader.h" -#include "Script.h" -#include "Timer.h" -#include "Camera.h" -#include "Frontend.h" -#include "ColStore.h" - -CPool<ColDef,ColDef> *CColStore::ms_pColPool; - -void -CColStore::Initialise(void) -{ - if(ms_pColPool == nil) - ms_pColPool = new CPool<ColDef,ColDef>(COLSTORESIZE, "CollisionFiles"); - AddColSlot("generic"); // slot 0. not streamed -} - -void -CColStore::Shutdown(void) -{ - int i; - for(i = 0; i < COLSTORESIZE; i++) - RemoveColSlot(i); - if(ms_pColPool) - delete ms_pColPool; - ms_pColPool = nil; -} - -int -CColStore::AddColSlot(const char *name) -{ - ColDef *def = ms_pColPool->New(); - assert(def); - def->isLoaded = false; - def->a = 0; - def->bounds.left = 1000000.0f; - def->bounds.top = 1000000.0f; - def->bounds.right = -1000000.0f; - def->bounds.bottom = -1000000.0f; - def->minIndex = INT16_MAX; - def->maxIndex = INT16_MIN; - strcpy(def->name, name); - return ms_pColPool->GetJustIndex(def); -} - -void -CColStore::RemoveColSlot(int slot) -{ - if(GetSlot(slot)){ - if(GetSlot(slot)->isLoaded) - RemoveCol(slot); - ms_pColPool->Delete(GetSlot(slot)); - } -} - -int -CColStore::FindColSlot(const char *name) -{ - ColDef *def; - int size = ms_pColPool->GetSize(); - for(int i = 0; i < size; i++){ - def = GetSlot(i); - if(def && !CGeneral::faststricmp(def->name, name)) - return i; - } - return -1; -} - -char* -CColStore::GetColName(int32 slot) -{ - return GetSlot(slot)->name; -} - -CRect& -CColStore::GetBoundingBox(int32 slot) -{ - return GetSlot(slot)->bounds; -} - -void -CColStore::IncludeModelIndex(int32 slot, int32 modelIndex) -{ - ColDef *def = GetSlot(slot); - if(modelIndex < def->minIndex) - def->minIndex = modelIndex; - if(modelIndex > def->maxIndex) - def->maxIndex = modelIndex; -} - -bool -CColStore::LoadCol(int32 slot, uint8 *buffer, int32 bufsize) -{ - bool success; - ColDef *def = GetSlot(slot); - if(def->minIndex > def->maxIndex) - success = CFileLoader::LoadCollisionFileFirstTime(buffer, bufsize, slot); - else - success = CFileLoader::LoadCollisionFile(buffer, bufsize, slot); - if(success) - def->isLoaded = true; - else - debug("Failed to load Collision\n"); - return success; -} - -void -CColStore::RemoveCol(int32 slot) -{ - int id; - GetSlot(slot)->isLoaded = false; - for(id = 0; id < MODELINFOSIZE; id++){ - CBaseModelInfo *mi = CModelInfo::GetModelInfo(id); - if(mi){ - CColModel *col = mi->GetColModel(); - if(col && col->level == slot) - col->RemoveCollisionVolumes(); - } - } -} - -void -CColStore::LoadAllCollision(void) -{ - int i; - for(i = 1; i < COLSTORESIZE; i++) - if(GetSlot(i)) - CStreaming::RequestCol(i, 0); - CStreaming::LoadAllRequestedModels(false); -} - -void -CColStore::RemoveAllCollision(void) -{ - int i; - for(i = 1; i < COLSTORESIZE; i++) - if(GetSlot(i)) - if(CStreaming::CanRemoveCol(i)) - CStreaming::RemoveCol(i); -} - -static bool bLoadAtSecondPosition; -static CVector2D secondPosition; - -void -CColStore::AddCollisionNeededAtPosn(const CVector2D &pos) -{ - bLoadAtSecondPosition = true; - secondPosition = pos; -} - -void -CColStore::LoadCollision(const CVector2D &pos) -{ - int i; - - if(CStreaming::ms_disableStreaming) - return; - - for(i = 1; i < COLSTORESIZE; i++){ - if(GetSlot(i) == nil) - continue; - - bool wantThisOne = false; - - if(GetBoundingBox(i).IsPointInside(pos) || - bLoadAtSecondPosition && GetBoundingBox(i).IsPointInside(secondPosition, -119.0f) || - CGeneral::faststrcmp(GetColName(i), "yacht") == 0){ - wantThisOne = true; - }else{ - // TODO: check mission cleanup list - } - - if(wantThisOne) - CStreaming::RequestCol(i, STREAMFLAGS_PRIORITY); - else - CStreaming::RemoveCol(i); - } - bLoadAtSecondPosition = false; -} - -void -CColStore::RequestCollision(const CVector2D &pos) -{ - int i; - - for(i = 1; i < COLSTORESIZE; i++) - if(GetSlot(i) && GetBoundingBox(i).IsPointInside(pos, -115.0f)) - CStreaming::RequestCol(i, STREAMFLAGS_PRIORITY); -} - -void -CColStore::EnsureCollisionIsInMemory(const CVector2D &pos) -{ - int i; - - if(CStreaming::ms_disableStreaming) - return; - - for(i = 1; i < COLSTORESIZE; i++) - if(GetSlot(i) && GetBoundingBox(i).IsPointInside(pos, -110.0f) && - !CStreaming::HasColLoaded(i)){ - CStreaming::RequestCol(i, 0); - if(TheCamera.GetScreenFadeStatus() == FADE_0) - FrontEndMenuManager.MessageScreen("LOADCOL", false); - CTimer::Suspend(); - CStreaming::LoadAllRequestedModels(false); - CTimer::Resume(); - } -} - -bool -CColStore::HasCollisionLoaded(const CVector2D &pos) -{ - int i; - - for(i = 1; i < COLSTORESIZE; i++) - if(GetSlot(i) && GetBoundingBox(i).IsPointInside(pos, -110.0f) && - !GetSlot(i)->isLoaded) - return false; - return true; -} - -#endif diff --git a/src/core/ColStore.h b/src/core/ColStore.h deleted file mode 100644 index 0d686ffd..00000000 --- a/src/core/ColStore.h +++ /dev/null @@ -1,43 +0,0 @@ -#pragma once - -#include "templates.h" - -struct ColDef { // made up name - int32 a; - bool isLoaded; - CRect bounds; - char name[20]; - int16 minIndex; - int16 maxIndex; -}; - -class CColStore -{ - static CPool<ColDef,ColDef> *ms_pColPool; - -public: - static void Initialise(void); - static void Shutdown(void); - static int AddColSlot(const char *name); - static void RemoveColSlot(int32 slot); - static int FindColSlot(const char *name); - static char *GetColName(int32 slot); - static CRect &GetBoundingBox(int32 slot); - static void IncludeModelIndex(int32 slot, int32 modelIndex); - static bool LoadCol(int32 storeID, uint8 *buffer, int32 bufsize); - static void RemoveCol(int32 slot); - static void AddCollisionNeededAtPosn(const CVector2D &pos); - static void LoadAllCollision(void); - static void RemoveAllCollision(void); - static void LoadCollision(const CVector2D &pos); - static void RequestCollision(const CVector2D &pos); - static void EnsureCollisionIsInMemory(const CVector2D &pos); - static bool HasCollisionLoaded(const CVector2D &pos); - - static ColDef *GetSlot(int slot) { - assert(slot >= 0); - assert(ms_pColPool); - assert(slot < ms_pColPool->GetSize()); - return ms_pColPool->GetSlot(slot); - } -}; diff --git a/src/core/Game.cpp b/src/core/Game.cpp index 27731f8a..d0f412d8 100644 --- a/src/core/Game.cpp +++ b/src/core/Game.cpp @@ -370,9 +370,7 @@ bool CGame::Initialise(const char* datFile) LoadingScreen("Loading the Game", "Position dynamic objects", nil); CWorld::RepositionCertainDynamicObjects(); LoadingScreen("Loading the Game", "Initialise vehicle paths", nil); -#ifdef GTA_ZONECULL CCullZones::ResolveVisibilities(); -#endif CTrain::InitTrains(); CPlane::InitPlanes(); CCredits::Init(); @@ -489,9 +487,7 @@ void CGame::ReInitGameObjectVariables(void) CSpecialFX::Init(); CWaterCannons::Init(); CParticle::ReloadConfig(); -#ifdef GTA_ZONECULL CCullZones::ResolveVisibilities(); -#endif if ( !FrontEndMenuManager.m_bWantToLoad ) { @@ -524,9 +520,7 @@ void CGame::ReloadIPLs(void) CCranes::InitCranes(); CGarages::Init(); CWorld::RepositionCertainDynamicObjects(); -#ifdef GTA_ZONECULL CCullZones::ResolveVisibilities(); -#endif CRenderer::SortBIGBuildings(); CTimer::Update(); } diff --git a/src/core/Streaming.cpp b/src/core/Streaming.cpp index 978e0bb8..da9e7d33 100644 --- a/src/core/Streaming.cpp +++ b/src/core/Streaming.cpp @@ -1982,9 +1982,7 @@ 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); } } @@ -2008,9 +2006,7 @@ 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); } } @@ -2434,9 +2430,7 @@ CStreaming::LoadScene(const CVector &pos) RemoveModel(si - ms_aInfoForModel); } CRenderer::m_loadingPriority = false; -#ifdef GTA_ZONECULL CCullZones::ForceCullZoneCoors(pos); -#endif DeleteAllRwObjects(); AddModelsToRequestList(pos); CRadar::StreamRadarSections(pos); diff --git a/src/core/ZoneCull.cpp b/src/core/ZoneCull.cpp index 1e9c00f0..780c180e 100644 --- a/src/core/ZoneCull.cpp +++ b/src/core/ZoneCull.cpp @@ -38,7 +38,6 @@ CCullZones::Init(void) CurrentFlags_Camera = 0; CurrentFlags_Player = 0; bCurrentSubwayIsInvisible = false; -#ifdef GTA_ZONECULL NumCullZones = 0; OldCullZone = -1; EntityIndicesUsed = 0; @@ -47,10 +46,8 @@ 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; @@ -216,7 +213,6 @@ CCullZones::DoVisibilityTestCullZone(int zoneId, bool doIt) } } } -#endif void CCullZones::Update(void) @@ -229,10 +225,8 @@ CCullZones::Update(void) switch(CTimer::GetFrameCounter() & 7){ case 0: case 4: -#ifdef GTA_ZONECULL /* Update Cull zone */ ForceCullZoneCoors(TheCamera.GetGameCamPosition()); -#endif break; case 2: @@ -256,7 +250,6 @@ CCullZones::Update(void) void CCullZones::ForceCullZoneCoors(CVector coors) { -#ifdef GTA_ZONECULL int32 z; z = FindCullZoneForCoors(coors); if(z != OldCullZone){ @@ -266,10 +259,8 @@ CCullZones::ForceCullZoneCoors(CVector coors) aZones[z].DoStuffEnteringZone(); OldCullZone = z; } -#endif } -#ifdef GTA_ZONECULL int32 CCullZones::FindCullZoneForCoors(CVector coors) { @@ -282,7 +273,6 @@ CCullZones::FindCullZoneForCoors(CVector coors) return i; return -1; } -#endif int32 CCullZones::FindAttributesForCoors(CVector coors, int32 *wantedLevel) @@ -360,7 +350,6 @@ CCullZones::AddCullZone(CVector const &position, CAttributeZone *attrib; CVector v; -#ifdef GTA_ZONECULL if((flag & ATTRZONE_NOTCULLZONE) == 0){ cull = &aZones[NumCullZones++]; v = position; @@ -383,7 +372,6 @@ 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; @@ -398,7 +386,6 @@ CCullZones::AddCullZone(CVector const &position, } -#ifdef GTA_ZONECULL void CCullZone::DoStuffLeavingZone(void) { @@ -573,5 +560,4 @@ CCullZones::DoWeHaveMoreThanXOccurencesOfSet(int32 count, uint16 *set) } } return false; -} -#endif
\ No newline at end of file +}
\ No newline at end of file diff --git a/src/core/config.h b/src/core/config.h index 0bbc883e..7c1fab5b 100644 --- a/src/core/config.h +++ b/src/core/config.h @@ -143,12 +143,6 @@ 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 |