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/vehicles/Automobile.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/vehicles') diff --git a/src/vehicles/Automobile.cpp b/src/vehicles/Automobile.cpp index acca4d60..58971786 100644 --- a/src/vehicles/Automobile.cpp +++ b/src/vehicles/Automobile.cpp @@ -4146,7 +4146,7 @@ CAutomobile::HasCarStoppedBecauseOfLight(void) if(AutoPilot.m_nCurrentRouteNode && AutoPilot.m_nNextRouteNode){ CPathNode *curnode = &ThePaths.m_pathNodes[AutoPilot.m_nCurrentRouteNode]; for(i = 0; i < curnode->numLinks; i++) - if(ThePaths.m_connections[curnode->firstLink + i] == AutoPilot.m_nNextRouteNode) + if(ThePaths.ConnectedNode(curnode->firstLink + i) == AutoPilot.m_nNextRouteNode) break; if(i < curnode->numLinks && ThePaths.m_carPathLinks[ThePaths.m_carPathConnections[curnode->firstLink + i]].trafficLightType & 3) @@ -4156,7 +4156,7 @@ CAutomobile::HasCarStoppedBecauseOfLight(void) if(AutoPilot.m_nCurrentRouteNode && AutoPilot.m_nPrevRouteNode){ CPathNode *curnode = &ThePaths.m_pathNodes[AutoPilot.m_nCurrentRouteNode]; for(i = 0; i < curnode->numLinks; i++) - if(ThePaths.m_connections[curnode->firstLink + i] == AutoPilot.m_nPrevRouteNode) + if(ThePaths.ConnectedNode(curnode->firstLink + i) == AutoPilot.m_nPrevRouteNode) break; if(i < curnode->numLinks && ThePaths.m_carPathLinks[ThePaths.m_carPathConnections[curnode->firstLink + i]].trafficLightType & 3) -- 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/vehicles/Train.cpp | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'src/vehicles') diff --git a/src/vehicles/Train.cpp b/src/vehicles/Train.cpp index 7831a0c8..fef712e6 100644 --- a/src/vehicles/Train.cpp +++ b/src/vehicles/Train.cpp @@ -38,6 +38,7 @@ CVector CTrain::aStationCoors_S[4]; CTrain::CTrain(int32 id, uint8 CreatedBy) : CVehicle(CreatedBy) { +#ifdef GTA_TRAIN CVehicleModelInfo *mi = (CVehicleModelInfo*)CModelInfo::GetModelInfo(id); m_vehType = VEHICLE_TYPE_TRAIN; pHandling = mod_HandlingManager.GetHandlingData((eHandlingId)mi->m_handlingId); @@ -60,22 +61,28 @@ CTrain::CTrain(int32 id, uint8 CreatedBy) bUsesCollision = true; SetStatus(STATUS_TRAIN_MOVING); +#else + assert(0 && "No trains in this game"); +#endif } void CTrain::SetModelIndex(uint32 id) { +#ifdef GTA_TRAIN int i; CVehicle::SetModelIndex(id); for(i = 0; i < NUM_TRAIN_NODES; i++) m_aTrainNodes[i] = nil; CClumpModelInfo::FillFrameArray(GetClump(), m_aTrainNodes); +#endif } void CTrain::ProcessControl(void) { +#ifdef GTA_TRAIN if(gbModelViewer || m_isFarAway && (CTimer::GetFrameCounter() + m_nWagonId) & 0xF) return; @@ -278,11 +285,13 @@ CTrain::ProcessControl(void) TrainHitStuff(s->m_lists[ENTITYLIST_PEDS_OVERLAP]); } } +#endif GTA_TRAIN } void CTrain::PreRender(void) { +#ifdef GTA_TRAIN CVehicleModelInfo *mi = (CVehicleModelInfo*)CModelInfo::GetModelInfo(GetModelIndex()); if(m_bIsFirstWagon){ @@ -342,17 +351,21 @@ CTrain::PreRender(void) CCoronas::TYPE_NORMAL, CCoronas::FLARE_NONE, CCoronas::REFLECTION_ON, CCoronas::LOSCHECK_OFF, CCoronas::STREAK_ON, 0.0f); } +#endif } void CTrain::Render(void) { +#ifdef GTA_TRAIN CEntity::Render(); +#endif } void CTrain::TrainHitStuff(CPtrList &list) { +#ifdef GTA_TRAIN CPtrNode *node; CPhysical *phys; @@ -361,11 +374,13 @@ CTrain::TrainHitStuff(CPtrList &list) if(phys != this && Abs(this->GetPosition().z - phys->GetPosition().z) < 1.5f) phys->bHitByTrain = true; } +#endif } void CTrain::AddPassenger(CPed *ped) { +#ifdef GTA_TRAIN int i = ped->m_vehEnterType; if((i == TRAIN_POS_LEFT_ENTRY || i == TRAIN_POS_MID_ENTRY || i == TRAIN_POS_RIGHT_ENTRY) && pPassengers[i] == nil){ pPassengers[i] = ped; @@ -378,11 +393,13 @@ CTrain::AddPassenger(CPed *ped) return; } } +#endif } void CTrain::OpenTrainDoor(float ratio) { +#ifdef GTA_TRAIN if(m_rwObject == nil) return; @@ -407,6 +424,7 @@ CTrain::OpenTrainDoor(float ratio) doorL.UpdateRW(); doorR.UpdateRW(); +#endif } @@ -414,6 +432,7 @@ CTrain::OpenTrainDoor(float ratio) void CTrain::InitTrains(void) { +#ifdef GTA_TRAIN int i, j; CTrain *train; @@ -480,21 +499,25 @@ CTrain::InitTrains(void) for(j = 0; pTrackNodes_S[j].t < StationDist_S[i]; j++); aStationCoors_S[i] = pTrackNodes_S[j].p; } +#endif } void CTrain::Shutdown(void) { +#ifdef GTA_TRAIN delete[] pTrackNodes; delete[] pTrackNodes_S; pTrackNodes = nil; pTrackNodes_S = nil; +#endif } void CTrain::ReadAndInterpretTrackFile(char *filename, CTrainNode **nodes, int16 *numNodes, int32 numStations, float *stationDists, float *totalLength, float *totalDuration, CTrainInterpolationLine *interpLines, bool rightRail) { +#ifdef GTA_TRAIN bool readingFile = false; int bp, lp; int i, tmp; @@ -616,6 +639,7 @@ CTrain::ReadAndInterpretTrackFile(char *filename, CTrainNode **nodes, int16 *num // end interpLines[j].time = *totalDuration; +#endif } void @@ -627,6 +651,7 @@ ProcessTrainAnnouncements(void) void CTrain::UpdateTrains(void) { +#ifdef GTA_TRAIN int i, j; uint32 time; float t, deltaT; @@ -690,4 +715,5 @@ CTrain::UpdateTrains(void) // time offset for each train time += 0x40000/4; } +#endif } -- cgit v1.2.3