From 702da55ec9d0e8e02df25a26390a113e452676e3 Mon Sep 17 00:00:00 2001 From: aap Date: Sun, 3 May 2020 15:57:57 +0200 Subject: implemented most of vice city path system --- src/core/Pad.cpp | 2 +- src/core/World.cpp | 4 ++-- src/core/config.h | 11 +++++++++++ src/core/re3.cpp | 2 +- 4 files changed, 15 insertions(+), 4 deletions(-) (limited to 'src/core') diff --git a/src/core/Pad.cpp b/src/core/Pad.cpp index c4c4a69e..da86d15e 100644 --- a/src/core/Pad.cpp +++ b/src/core/Pad.cpp @@ -106,7 +106,7 @@ void TankCheat() CAutomobile *tank = new CAutomobile(MI_RHINO, MISSION_VEHICLE); #endif if (tank != nil) { - CVector pos = ThePaths.m_pathNodes[node].pos; + CVector pos = ThePaths.m_pathNodes[node].GetPosition(); pos.z += 4.0f; tank->SetPosition(pos); tank->SetOrientation(0.0f, 0.0f, DEGTORAD(200.0f)); diff --git a/src/core/World.cpp b/src/core/World.cpp index 30d086df..2833c59c 100644 --- a/src/core/World.cpp +++ b/src/core/World.cpp @@ -1618,7 +1618,7 @@ CWorld::RemoveFallenPeds(void) if(ped->CharCreatedBy != RANDOM_CHAR || ped->IsPlayer()) { int closestNode = ThePaths.FindNodeClosestToCoors(ped->GetPosition(), PATH_PED, 999999.9f, false, false); - CVector newPos = ThePaths.m_pathNodes[closestNode].pos; + CVector newPos = ThePaths.m_pathNodes[closestNode].GetPosition(); newPos.z += 2.0f; ped->Teleport(newPos); ped->m_vecMoveSpeed = CVector(0.0f, 0.0f, 0.0f); @@ -1642,7 +1642,7 @@ CWorld::RemoveFallenCars(void) (veh->pDriver && veh->pDriver->IsPlayer())) { int closestNode = ThePaths.FindNodeClosestToCoors(veh->GetPosition(), PATH_CAR, 999999.9f, false, false); - CVector newPos = ThePaths.m_pathNodes[closestNode].pos; + CVector newPos = ThePaths.m_pathNodes[closestNode].GetPosition(); newPos.z += 3.0f; veh->Teleport(newPos); veh->m_vecMoveSpeed = CVector(0.0f, 0.0f, 0.0f); diff --git a/src/core/config.h b/src/core/config.h index 7c1fab5b..86189920 100644 --- a/src/core/config.h +++ b/src/core/config.h @@ -41,10 +41,17 @@ enum Config { NUMTEMPOBJECTS = 30, // Path data +#ifndef MIAMI NUM_PATHNODES = 4930, NUM_CARPATHLINKS = 2076, NUM_MAPOBJECTS = 1250, NUM_PATHCONNECTIONS = 10260, +#else + NUM_PATHNODES = 9650, + NUM_CARPATHLINKS = 3500, + NUM_MAPOBJECTS = 1250, + NUM_PATHCONNECTIONS = 20400, +#endif // Link list lengths NUMALPHALIST = 20, @@ -110,7 +117,11 @@ enum Config { NUMMODELSPERPEDGROUP = 8, NUMSHOTINFOS = 100, +#ifndef MIAMI NUMROADBLOCKS = 600, +#else + NUMROADBLOCKS = 300, +#endif NUMVISIBLEENTITIES = 2000, NUMINVISIBLEENTITIES = 150, diff --git a/src/core/re3.cpp b/src/core/re3.cpp index e6409523..44253c14 100644 --- a/src/core/re3.cpp +++ b/src/core/re3.cpp @@ -118,7 +118,7 @@ SpawnCar(int id) if(CModelInfo::IsBoatModel(id)) v->SetPosition(TheCamera.GetPosition() + TheCamera.GetForward()*15.0f); else - v->SetPosition(ThePaths.m_pathNodes[node].pos); + v->SetPosition(ThePaths.m_pathNodes[node].GetPosition()); v->GetMatrix().GetPosition().z += 4.0f; v->SetOrientation(0.0f, 0.0f, 3.49f); -- cgit v1.2.3 From 67467f15d1dd8e545acc47c5e24beb74e4ca78b3 Mon Sep 17 00:00:00 2001 From: aap Date: Sun, 3 May 2020 17:28:54 +0200 Subject: GTA_BRIDGE and GTA_TRAIN defines --- src/core/Camera.cpp | 8 ++++++-- src/core/config.h | 5 +++++ 2 files changed, 11 insertions(+), 2 deletions(-) (limited to 'src/core') diff --git a/src/core/Camera.cpp b/src/core/Camera.cpp index 9a053056..379b9c36 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; @@ -2707,7 +2711,7 @@ CCamera::DontProcessObbeCinemaCamera(void) bDidWeProcessAnyCinemaCam = false; } - +#ifdef GTA_TRAIN void CCamera::LoadTrainCamNodes(char const *name) { @@ -2885,7 +2889,7 @@ CCamera::Process_Train_Camera_Control(void) } } } - +#endif void diff --git a/src/core/config.h b/src/core/config.h index 86189920..1fc78eb8 100644 --- a/src/core/config.h +++ b/src/core/config.h @@ -154,6 +154,11 @@ 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 +#endif + // This enables things from the PS2 version on PC #define GTA_PS2_STUFF -- cgit v1.2.3 From a073dda5ecdbf3342378384648453108ad793d87 Mon Sep 17 00:00:00 2001 From: aap Date: Sun, 3 May 2020 17:44:10 +0200 Subject: GTA_ZONECULL define --- src/core/Game.cpp | 6 ++++++ src/core/ZoneCull.cpp | 19 ++++++++++++++++--- src/core/config.h | 1 + 3 files changed, 23 insertions(+), 3 deletions(-) (limited to 'src/core') diff --git a/src/core/Game.cpp b/src/core/Game.cpp index 3053c761..0e618c84 100644 --- a/src/core/Game.cpp +++ b/src/core/Game.cpp @@ -387,7 +387,9 @@ 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(); @@ -504,7 +506,9 @@ void CGame::ReInitGameObjectVariables(void) CSpecialFX::Init(); CWaterCannons::Init(); CParticle::ReloadConfig(); +#ifdef GTA_ZONECULL CCullZones::ResolveVisibilities(); +#endif if ( !FrontEndMenuManager.m_bWantToLoad ) { @@ -537,7 +541,9 @@ 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/ZoneCull.cpp b/src/core/ZoneCull.cpp index 5ce18a4d..1e9c00f0 100644 --- a/src/core/ZoneCull.cpp +++ b/src/core/ZoneCull.cpp @@ -34,20 +34,23 @@ CCullZones::Init(void) int i; NumAttributeZones = 0; - NumCullZones = 0; CurrentWantedLevelDrop_Player = 0; CurrentFlags_Camera = 0; CurrentFlags_Player = 0; + bCurrentSubwayIsInvisible = false; +#ifdef GTA_ZONECULL + NumCullZones = 0; OldCullZone = -1; EntityIndicesUsed = 0; - bCurrentSubwayIsInvisible = false; for(i = 0; i < NUMBUILDINGS; i++) 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,7 +398,7 @@ CCullZones::AddCullZone(CVector const &position, } - +#ifdef GTA_ZONECULL void CCullZone::DoStuffLeavingZone(void) { @@ -562,3 +574,4 @@ CCullZones::DoWeHaveMoreThanXOccurencesOfSet(int32 count, uint16 *set) } return false; } +#endif \ No newline at end of file diff --git a/src/core/config.h b/src/core/config.h index 1fc78eb8..f4f7205b 100644 --- a/src/core/config.h +++ b/src/core/config.h @@ -157,6 +157,7 @@ enum Config { #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 -- cgit v1.2.3