GTA_BRIDGE and GTA_TRAIN defines

This commit is contained in:
aap 2020-05-03 17:28:54 +02:00
parent 702da55ec9
commit 67467f15d1
7 changed files with 65 additions and 4 deletions

View File

@ -23,6 +23,7 @@ uint32 CBridge::TimeOfBridgeBecomingOperational;
void CBridge::Init() void CBridge::Init()
{ {
#ifdef GTA_BRIDGE
FindBridgeEntities(); FindBridgeEntities();
OldLift = -1.0f; OldLift = -1.0f;
if (pLiftPart && pWeight) if (pLiftPart && pWeight)
@ -35,10 +36,12 @@ void CBridge::Init()
ThePaths.SetLinksBridgeLights(-330.0, -230.0, -700.0, -588.0, true); ThePaths.SetLinksBridgeLights(-330.0, -230.0, -700.0, -588.0, true);
} }
#endif
} }
void CBridge::Update() void CBridge::Update()
{ {
#ifdef GTA_BRIDGE
if (!pLiftPart || !pWeight) if (!pLiftPart || !pWeight)
return; return;
@ -113,12 +116,21 @@ void CBridge::Update()
ThePaths.SetLinksBridgeLights(-330.0, -230.0, -700.0, -588.0, true); ThePaths.SetLinksBridgeLights(-330.0, -230.0, -700.0, -588.0, true);
else if (State == STATE_LIFT_PART_IS_DOWN && OldState == STATE_LIFT_PART_MOVING_DOWN) else if (State == STATE_LIFT_PART_IS_DOWN && OldState == STATE_LIFT_PART_MOVING_DOWN)
ThePaths.SetLinksBridgeLights(-330.0, -230.0, -700.0, -588.0, false); ThePaths.SetLinksBridgeLights(-330.0, -230.0, -700.0, -588.0, false);
#endif
} }
bool CBridge::ShouldLightsBeFlashing() { return State != STATE_LIFT_PART_IS_DOWN; } bool CBridge::ShouldLightsBeFlashing()
{
#ifdef GTA_BRIDGE
return State != STATE_LIFT_PART_IS_DOWN;
#else
return false;
#endif
}
void CBridge::FindBridgeEntities() void CBridge::FindBridgeEntities()
{ {
#ifdef GTA_BRIDGE
pWeight = nil; pWeight = nil;
pLiftRoad = nil; pLiftRoad = nil;
pLiftPart = nil; pLiftPart = nil;
@ -135,12 +147,17 @@ void CBridge::FindBridgeEntities()
pWeight = entry; pWeight = entry;
} }
} }
#endif
} }
bool CBridge::ThisIsABridgeObjectMovingUp(int index) bool CBridge::ThisIsABridgeObjectMovingUp(int index)
{ {
#ifdef GTA_BRIDGE
if (index != MI_BRIDGEROADSEGMENT && index != MI_BRIDGELIFT) if (index != MI_BRIDGEROADSEGMENT && index != MI_BRIDGELIFT)
return false; return false;
return State == STATE_LIFT_PART_ABOUT_TO_MOVE_UP || State == STATE_LIFT_PART_MOVING_UP; return State == STATE_LIFT_PART_ABOUT_TO_MOVE_UP || State == STATE_LIFT_PART_MOVING_UP;
#else
return false;
#endif
} }

View File

@ -2740,7 +2740,11 @@ bool CCarCtrl::ThisRoadObjectCouldMove(int16 mi)
bool CCarCtrl::MapCouldMoveInThisArea(float x, float y) bool CCarCtrl::MapCouldMoveInThisArea(float x, float y)
{ {
#ifdef GTA_BRIDGE // actually they forgot that in VC...
// bridge moves up and down // bridge moves up and down
return x > -342.0f && x < -219.0f && return x > -342.0f && x < -219.0f &&
y > -677.0f && y < -580.0f; y > -677.0f && y < -580.0f;
#else
return false;
#endif
} }

View File

@ -1425,7 +1425,7 @@ CPathFind::RemoveBadStartNode(CVector pos, CPathNode **nodes, int16 *n)
} }
} }
//--MIAMI: removed, put behind BRIDGE define #ifdef GTA_BRIDGE
void void
CPathFind::SetLinksBridgeLights(float x1, float x2, float y1, float y2, bool enable) CPathFind::SetLinksBridgeLights(float x1, float x2, float y1, float y2, bool enable)
{ {
@ -1437,6 +1437,7 @@ CPathFind::SetLinksBridgeLights(float x1, float x2, float y1, float y2, bool ena
m_carPathLinks[i].bBridgeLights = enable; m_carPathLinks[i].bBridgeLights = enable;
} }
} }
#endif
//--MIAMI: done //--MIAMI: done
void void

View File

@ -273,8 +273,12 @@ CTrafficLights::ShouldCarStopForLight(CVehicle *vehicle, bool alwaysStop)
bool bool
CTrafficLights::ShouldCarStopForBridge(CVehicle *vehicle) CTrafficLights::ShouldCarStopForBridge(CVehicle *vehicle)
{ {
#ifdef GTA_BRIDGE
return ThePaths.m_carPathLinks[vehicle->AutoPilot.m_nNextPathNodeInfo].bBridgeLights && return ThePaths.m_carPathLinks[vehicle->AutoPilot.m_nNextPathNodeInfo].bBridgeLights &&
!ThePaths.m_carPathLinks[vehicle->AutoPilot.m_nCurrentPathNodeInfo].bBridgeLights; !ThePaths.m_carPathLinks[vehicle->AutoPilot.m_nCurrentPathNodeInfo].bBridgeLights;
#else
return false;
#endif
} }
int int

View File

@ -633,7 +633,11 @@ CCamera::CamControl(void)
m_bInitialNodeFound = false; m_bInitialNodeFound = false;
m_bInitialNoNodeStaticsSet = false; m_bInitialNoNodeStaticsSet = false;
} }
#ifdef GTA_TRAIN
Process_Train_Camera_Control(); Process_Train_Camera_Control();
#else
assert(0 && "this can't happen");
#endif
}else{ }else{
if(((CVehicle*)pTargetEntity)->IsBoat()) if(((CVehicle*)pTargetEntity)->IsBoat())
boatTarget = true; boatTarget = true;
@ -2707,7 +2711,7 @@ CCamera::DontProcessObbeCinemaCamera(void)
bDidWeProcessAnyCinemaCam = false; bDidWeProcessAnyCinemaCam = false;
} }
#ifdef GTA_TRAIN
void void
CCamera::LoadTrainCamNodes(char const *name) CCamera::LoadTrainCamNodes(char const *name)
{ {
@ -2885,7 +2889,7 @@ CCamera::Process_Train_Camera_Control(void)
} }
} }
} }
#endif
void void

View File

@ -154,6 +154,11 @@ enum Config {
//#define GTA_PS2 //#define GTA_PS2
//#define GTA_XBOX //#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 // This enables things from the PS2 version on PC
#define GTA_PS2_STUFF #define GTA_PS2_STUFF

View File

@ -38,6 +38,7 @@ CVector CTrain::aStationCoors_S[4];
CTrain::CTrain(int32 id, uint8 CreatedBy) CTrain::CTrain(int32 id, uint8 CreatedBy)
: CVehicle(CreatedBy) : CVehicle(CreatedBy)
{ {
#ifdef GTA_TRAIN
CVehicleModelInfo *mi = (CVehicleModelInfo*)CModelInfo::GetModelInfo(id); CVehicleModelInfo *mi = (CVehicleModelInfo*)CModelInfo::GetModelInfo(id);
m_vehType = VEHICLE_TYPE_TRAIN; m_vehType = VEHICLE_TYPE_TRAIN;
pHandling = mod_HandlingManager.GetHandlingData((eHandlingId)mi->m_handlingId); pHandling = mod_HandlingManager.GetHandlingData((eHandlingId)mi->m_handlingId);
@ -60,22 +61,28 @@ CTrain::CTrain(int32 id, uint8 CreatedBy)
bUsesCollision = true; bUsesCollision = true;
SetStatus(STATUS_TRAIN_MOVING); SetStatus(STATUS_TRAIN_MOVING);
#else
assert(0 && "No trains in this game");
#endif
} }
void void
CTrain::SetModelIndex(uint32 id) CTrain::SetModelIndex(uint32 id)
{ {
#ifdef GTA_TRAIN
int i; int i;
CVehicle::SetModelIndex(id); CVehicle::SetModelIndex(id);
for(i = 0; i < NUM_TRAIN_NODES; i++) for(i = 0; i < NUM_TRAIN_NODES; i++)
m_aTrainNodes[i] = nil; m_aTrainNodes[i] = nil;
CClumpModelInfo::FillFrameArray(GetClump(), m_aTrainNodes); CClumpModelInfo::FillFrameArray(GetClump(), m_aTrainNodes);
#endif
} }
void void
CTrain::ProcessControl(void) CTrain::ProcessControl(void)
{ {
#ifdef GTA_TRAIN
if(gbModelViewer || m_isFarAway && (CTimer::GetFrameCounter() + m_nWagonId) & 0xF) if(gbModelViewer || m_isFarAway && (CTimer::GetFrameCounter() + m_nWagonId) & 0xF)
return; return;
@ -278,11 +285,13 @@ CTrain::ProcessControl(void)
TrainHitStuff(s->m_lists[ENTITYLIST_PEDS_OVERLAP]); TrainHitStuff(s->m_lists[ENTITYLIST_PEDS_OVERLAP]);
} }
} }
#endif GTA_TRAIN
} }
void void
CTrain::PreRender(void) CTrain::PreRender(void)
{ {
#ifdef GTA_TRAIN
CVehicleModelInfo *mi = (CVehicleModelInfo*)CModelInfo::GetModelInfo(GetModelIndex()); CVehicleModelInfo *mi = (CVehicleModelInfo*)CModelInfo::GetModelInfo(GetModelIndex());
if(m_bIsFirstWagon){ if(m_bIsFirstWagon){
@ -342,17 +351,21 @@ CTrain::PreRender(void)
CCoronas::TYPE_NORMAL, CCoronas::FLARE_NONE, CCoronas::REFLECTION_ON, CCoronas::TYPE_NORMAL, CCoronas::FLARE_NONE, CCoronas::REFLECTION_ON,
CCoronas::LOSCHECK_OFF, CCoronas::STREAK_ON, 0.0f); CCoronas::LOSCHECK_OFF, CCoronas::STREAK_ON, 0.0f);
} }
#endif
} }
void void
CTrain::Render(void) CTrain::Render(void)
{ {
#ifdef GTA_TRAIN
CEntity::Render(); CEntity::Render();
#endif
} }
void void
CTrain::TrainHitStuff(CPtrList &list) CTrain::TrainHitStuff(CPtrList &list)
{ {
#ifdef GTA_TRAIN
CPtrNode *node; CPtrNode *node;
CPhysical *phys; CPhysical *phys;
@ -361,11 +374,13 @@ CTrain::TrainHitStuff(CPtrList &list)
if(phys != this && Abs(this->GetPosition().z - phys->GetPosition().z) < 1.5f) if(phys != this && Abs(this->GetPosition().z - phys->GetPosition().z) < 1.5f)
phys->bHitByTrain = true; phys->bHitByTrain = true;
} }
#endif
} }
void void
CTrain::AddPassenger(CPed *ped) CTrain::AddPassenger(CPed *ped)
{ {
#ifdef GTA_TRAIN
int i = ped->m_vehEnterType; int i = ped->m_vehEnterType;
if((i == TRAIN_POS_LEFT_ENTRY || i == TRAIN_POS_MID_ENTRY || i == TRAIN_POS_RIGHT_ENTRY) && pPassengers[i] == nil){ if((i == TRAIN_POS_LEFT_ENTRY || i == TRAIN_POS_MID_ENTRY || i == TRAIN_POS_RIGHT_ENTRY) && pPassengers[i] == nil){
pPassengers[i] = ped; pPassengers[i] = ped;
@ -378,11 +393,13 @@ CTrain::AddPassenger(CPed *ped)
return; return;
} }
} }
#endif
} }
void void
CTrain::OpenTrainDoor(float ratio) CTrain::OpenTrainDoor(float ratio)
{ {
#ifdef GTA_TRAIN
if(m_rwObject == nil) if(m_rwObject == nil)
return; return;
@ -407,6 +424,7 @@ CTrain::OpenTrainDoor(float ratio)
doorL.UpdateRW(); doorL.UpdateRW();
doorR.UpdateRW(); doorR.UpdateRW();
#endif
} }
@ -414,6 +432,7 @@ CTrain::OpenTrainDoor(float ratio)
void void
CTrain::InitTrains(void) CTrain::InitTrains(void)
{ {
#ifdef GTA_TRAIN
int i, j; int i, j;
CTrain *train; CTrain *train;
@ -480,21 +499,25 @@ CTrain::InitTrains(void)
for(j = 0; pTrackNodes_S[j].t < StationDist_S[i]; j++); for(j = 0; pTrackNodes_S[j].t < StationDist_S[i]; j++);
aStationCoors_S[i] = pTrackNodes_S[j].p; aStationCoors_S[i] = pTrackNodes_S[j].p;
} }
#endif
} }
void void
CTrain::Shutdown(void) CTrain::Shutdown(void)
{ {
#ifdef GTA_TRAIN
delete[] pTrackNodes; delete[] pTrackNodes;
delete[] pTrackNodes_S; delete[] pTrackNodes_S;
pTrackNodes = nil; pTrackNodes = nil;
pTrackNodes_S = nil; pTrackNodes_S = nil;
#endif
} }
void void
CTrain::ReadAndInterpretTrackFile(char *filename, CTrainNode **nodes, int16 *numNodes, int32 numStations, float *stationDists, CTrain::ReadAndInterpretTrackFile(char *filename, CTrainNode **nodes, int16 *numNodes, int32 numStations, float *stationDists,
float *totalLength, float *totalDuration, CTrainInterpolationLine *interpLines, bool rightRail) float *totalLength, float *totalDuration, CTrainInterpolationLine *interpLines, bool rightRail)
{ {
#ifdef GTA_TRAIN
bool readingFile = false; bool readingFile = false;
int bp, lp; int bp, lp;
int i, tmp; int i, tmp;
@ -616,6 +639,7 @@ CTrain::ReadAndInterpretTrackFile(char *filename, CTrainNode **nodes, int16 *num
// end // end
interpLines[j].time = *totalDuration; interpLines[j].time = *totalDuration;
#endif
} }
void void
@ -627,6 +651,7 @@ ProcessTrainAnnouncements(void)
void void
CTrain::UpdateTrains(void) CTrain::UpdateTrains(void)
{ {
#ifdef GTA_TRAIN
int i, j; int i, j;
uint32 time; uint32 time;
float t, deltaT; float t, deltaT;
@ -690,4 +715,5 @@ CTrain::UpdateTrains(void)
// time offset for each train // time offset for each train
time += 0x40000/4; time += 0x40000/4;
} }
#endif
} }