summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSergeanur <s.anureev@yandex.ua>2020-05-05 17:34:46 +0200
committerSergeanur <s.anureev@yandex.ua>2020-05-05 17:34:46 +0200
commit22e8b0e419ad811c977c67ea2f2c06d53ea3be5e (patch)
tree655dc6cff470ac28d19678c392a0aebb49cea937
parentMerge branch 'master' into miami (diff)
downloadre3-22e8b0e419ad811c977c67ea2f2c06d53ea3be5e.tar
re3-22e8b0e419ad811c977c67ea2f2c06d53ea3be5e.tar.gz
re3-22e8b0e419ad811c977c67ea2f2c06d53ea3be5e.tar.bz2
re3-22e8b0e419ad811c977c67ea2f2c06d53ea3be5e.tar.lz
re3-22e8b0e419ad811c977c67ea2f2c06d53ea3be5e.tar.xz
re3-22e8b0e419ad811c977c67ea2f2c06d53ea3be5e.tar.zst
re3-22e8b0e419ad811c977c67ea2f2c06d53ea3be5e.zip
Diffstat (limited to '')
-rw-r--r--src/control/Bridge.cpp14
-rw-r--r--src/control/CarCtrl.cpp8
-rw-r--r--src/control/PathFind.cpp2
-rw-r--r--src/control/TrafficLights.cpp4
-rw-r--r--src/core/Camera.cpp6
-rw-r--r--src/core/Game.cpp6
-rw-r--r--src/core/Streaming.cpp6
-rw-r--r--src/core/ZoneCull.cpp16
-rw-r--r--src/core/config.h6
-rw-r--r--src/entities/Entity.cpp17
-rw-r--r--src/entities/Entity.h3
-rw-r--r--src/peds/CopPed.cpp2
-rw-r--r--src/render/Renderer.cpp12
-rw-r--r--src/render/Renderer.h2
-rw-r--r--src/vehicles/Train.cpp26
15 files changed, 126 insertions, 4 deletions
diff --git a/src/control/Bridge.cpp b/src/control/Bridge.cpp
index e873062b..1e63cf30 100644
--- a/src/control/Bridge.cpp
+++ b/src/control/Bridge.cpp
@@ -23,6 +23,7 @@ uint32 CBridge::TimeOfBridgeBecomingOperational;
void CBridge::Init()
{
+#ifdef GTA_BRIDGE
FindBridgeEntities();
OldLift = -1.0f;
if (pLiftPart && pWeight)
@@ -35,10 +36,12 @@ void CBridge::Init()
ThePaths.SetLinksBridgeLights(-330.0, -230.0, -700.0, -588.0, true);
}
+#endif
}
void CBridge::Update()
{
+#ifdef GTA_BRIDGE
if (!pLiftPart || !pWeight)
return;
@@ -113,15 +116,21 @@ void CBridge::Update()
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)
ThePaths.SetLinksBridgeLights(-330.0, -230.0, -700.0, -588.0, false);
+#endif
}
bool CBridge::ShouldLightsBeFlashing()
{
+#ifdef GTA_BRIDGE
return State != STATE_LIFT_PART_IS_DOWN;
+#else
+ return false;
+#endif
}
void CBridge::FindBridgeEntities()
{
+#ifdef GTA_BRIDGE
pWeight = nil;
pLiftRoad = nil;
pLiftPart = nil;
@@ -138,12 +147,17 @@ void CBridge::FindBridgeEntities()
pWeight = entry;
}
}
+#endif
}
bool CBridge::ThisIsABridgeObjectMovingUp(int index)
{
+#ifdef GTA_BRIDGE
if (index != MI_BRIDGEROADSEGMENT && index != MI_BRIDGELIFT)
return false;
return State == STATE_LIFT_PART_ABOUT_TO_MOVE_UP || State == STATE_LIFT_PART_MOVING_UP;
+#else
+ return false;
+#endif
}
diff --git a/src/control/CarCtrl.cpp b/src/control/CarCtrl.cpp
index d5b86478..f0f95941 100644
--- a/src/control/CarCtrl.cpp
+++ b/src/control/CarCtrl.cpp
@@ -696,7 +696,7 @@ CCarCtrl::PossiblyRemoveVehicle(CVehicle* pVehicle)
if (pVehicle->bExtendedRange)
threshold *= 1.5f;
if (distanceToPlayer > threshold && !CGarages::IsPointWithinHideOutGarage(pVehicle->GetPosition())){
- if (pVehicle->GetIsOnScreen() && CRenderer::IsEntityCullZoneVisible(pVehicle)) {
+ if (pVehicle->GetIsOnScreenAndNotCulled()){
pVehicle->bFadeOut = true;
}else{
CWorld::Remove(pVehicle);
@@ -722,7 +722,7 @@ CCarCtrl::PossiblyRemoveVehicle(CVehicle* pVehicle)
if (pVehicle->GetStatus() != STATUS_WRECKED || pVehicle->m_nTimeOfDeath == 0)
return;
if (CTimer::GetTimeInMilliseconds() > pVehicle->m_nTimeOfDeath + 60000 &&
- !(pVehicle->GetIsOnScreen() && CRenderer::IsEntityCullZoneVisible(pVehicle)) ){
+ !pVehicle->GetIsOnScreenAndNotCulled()){
if ((pVehicle->GetPosition() - vecPlayerPos).MagnitudeSqr() > SQR(7.5f)){
if (!CGarages::IsPointWithinHideOutGarage(pVehicle->GetPosition())){
CWorld::Remove(pVehicle);
@@ -2743,9 +2743,13 @@ bool CCarCtrl::ThisRoadObjectCouldMove(int16 mi)
bool CCarCtrl::MapCouldMoveInThisArea(float x, float y)
{
+#ifdef GTA_BRIDGE // actually they forgot that in VC...
// bridge moves up and down
return x > -342.0f && x < -219.0f &&
y > -677.0f && y < -580.0f;
+#else
+ return false;
+#endif
}
float CCarCtrl::FindSpeedMultiplierWithSpeedFromNodes(int8 type)
diff --git a/src/control/PathFind.cpp b/src/control/PathFind.cpp
index fd1b4950..b8203821 100644
--- a/src/control/PathFind.cpp
+++ b/src/control/PathFind.cpp
@@ -1424,6 +1424,7 @@ CPathFind::RemoveBadStartNode(CVector pos, CPathNode **nodes, int16 *n)
}
}
+#ifdef GTA_BRIDGE
void
CPathFind::SetLinksBridgeLights(float x1, float x2, float y1, float y2, bool enable)
{
@@ -1435,6 +1436,7 @@ CPathFind::SetLinksBridgeLights(float x1, float x2, float y1, float y2, bool ena
m_carPathLinks[i].bBridgeLights = enable;
}
}
+#endif
//--MIAMI: done
void
diff --git a/src/control/TrafficLights.cpp b/src/control/TrafficLights.cpp
index b2f0900e..f2dd6814 100644
--- a/src/control/TrafficLights.cpp
+++ b/src/control/TrafficLights.cpp
@@ -273,8 +273,12 @@ CTrafficLights::ShouldCarStopForLight(CVehicle *vehicle, bool alwaysStop)
bool
CTrafficLights::ShouldCarStopForBridge(CVehicle *vehicle)
{
+#ifdef GTA_BRIDGE
return ThePaths.m_carPathLinks[vehicle->AutoPilot.m_nNextPathNodeInfo].bBridgeLights &&
!ThePaths.m_carPathLinks[vehicle->AutoPilot.m_nCurrentPathNodeInfo].bBridgeLights;
+#else
+ return false;
+#endif
}
int
diff --git a/src/core/Camera.cpp b/src/core/Camera.cpp
index 30f4287b..830a2bb2 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;
@@ -2709,6 +2713,7 @@ CCamera::DontProcessObbeCinemaCamera(void)
bDidWeProcessAnyCinemaCam = false;
}
+#ifdef GTA_TRAIN
void
CCamera::LoadTrainCamNodes(char const *name)
{
@@ -2886,6 +2891,7 @@ CCamera::Process_Train_Camera_Control(void)
}
}
}
+#endif
void
diff --git a/src/core/Game.cpp b/src/core/Game.cpp
index 96109e56..d0b3f5a3 100644
--- a/src/core/Game.cpp
+++ b/src/core/Game.cpp
@@ -377,7 +377,9 @@ bool CGame::Initialise(const char* datFile)
CWorld::RepositionCertainDynamicObjects();
#endif
LoadingScreen("Loading the Game", "Initialise vehicle paths", nil);
+#ifdef GTA_ZONECULL
CCullZones::ResolveVisibilities();
+#endif
CTrain::InitTrains();
CPlane::InitPlanes();
CCredits::Init();
@@ -496,7 +498,9 @@ void CGame::ReInitGameObjectVariables(void)
CSpecialFX::Init();
CWaterCannons::Init();
CParticle::ReloadConfig();
+#ifdef GTA_ZONECULL
CCullZones::ResolveVisibilities();
+#endif
if ( !FrontEndMenuManager.m_bWantToLoad )
{
@@ -531,7 +535,9 @@ void CGame::ReloadIPLs(void)
#ifndef MIAMI
CWorld::RepositionCertainDynamicObjects();
#endif
+#ifdef GTA_ZONECULL
CCullZones::ResolveVisibilities();
+#endif
CRenderer::SortBIGBuildings();
CTimer::Update();
}
diff --git a/src/core/Streaming.cpp b/src/core/Streaming.cpp
index daeda35d..d212dd05 100644
--- a/src/core/Streaming.cpp
+++ b/src/core/Streaming.cpp
@@ -2235,7 +2235,9 @@ 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);
}
}
@@ -2259,7 +2261,9 @@ 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);
}
}
@@ -2683,7 +2687,9 @@ CStreaming::LoadScene(const CVector &pos)
RemoveModel(si - ms_aInfoForModel);
}
CRenderer::m_loadingPriority = false;
+#ifdef GTA_ZONECULL
CCullZones::ForceCullZoneCoors(pos);
+#endif
DeleteAllRwObjects();
#ifndef MIAMI
AddModelsToRequestList(pos);
diff --git a/src/core/ZoneCull.cpp b/src/core/ZoneCull.cpp
index 780c180e..1e9c00f0 100644
--- a/src/core/ZoneCull.cpp
+++ b/src/core/ZoneCull.cpp
@@ -38,6 +38,7 @@ CCullZones::Init(void)
CurrentFlags_Camera = 0;
CurrentFlags_Player = 0;
bCurrentSubwayIsInvisible = false;
+#ifdef GTA_ZONECULL
NumCullZones = 0;
OldCullZone = -1;
EntityIndicesUsed = 0;
@@ -46,8 +47,10 @@ 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;
@@ -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,6 +398,7 @@ CCullZones::AddCullZone(CVector const &position,
}
+#ifdef GTA_ZONECULL
void
CCullZone::DoStuffLeavingZone(void)
{
@@ -560,4 +573,5 @@ CCullZones::DoWeHaveMoreThanXOccurencesOfSet(int32 count, uint16 *set)
}
}
return false;
-} \ No newline at end of file
+}
+#endif \ No newline at end of file
diff --git a/src/core/config.h b/src/core/config.h
index c0597db2..c3904fa9 100644
--- a/src/core/config.h
+++ b/src/core/config.h
@@ -160,6 +160,12 @@ 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
diff --git a/src/entities/Entity.cpp b/src/entities/Entity.cpp
index 1f85015e..955f32a8 100644
--- a/src/entities/Entity.cpp
+++ b/src/entities/Entity.cpp
@@ -63,8 +63,10 @@ CEntity::CEntity(void)
bMeleeProof = false;
bOnlyDamagedByPlayer = false;
bStreamingDontDelete = false;
+#ifdef GTA_ZONECULL
bZoneCulled = false;
bZoneCulled2 = false;
+#endif
bRemoveFromWorld = false;
bHasHitWall = false;
@@ -151,6 +153,17 @@ CEntity::GetIsOnScreenComplex(void)
return TheCamera.IsBoxVisible(boundBox, &TheCamera.GetCameraMatrix());
}
+bool
+CEntity::GetIsOnScreenAndNotCulled(void)
+{
+#ifdef GTA_ZONECULL
+ return GetIsOnScreen() && CRenderer::IsEntityCullZoneVisible(this);
+#else
+ return GetIsOnScreen();
+#endif
+}
+
+
void
CEntity::Add(void)
{
@@ -962,8 +975,10 @@ CEntity::SaveEntityFlags(uint8*& buf)
if (bMeleeProof) tmp |= BIT(27);
if (bOnlyDamagedByPlayer) tmp |= BIT(28);
if (bStreamingDontDelete) tmp |= BIT(29);
+#ifdef GTA_ZONECULL
if (bZoneCulled) tmp |= BIT(30);
if (bZoneCulled2) tmp |= BIT(31);
+#endif
WriteSaveBuf<uint32>(buf, tmp);
@@ -1015,8 +1030,10 @@ CEntity::LoadEntityFlags(uint8*& buf)
bMeleeProof = !!(tmp & BIT(27));
bOnlyDamagedByPlayer = !!(tmp & BIT(28));
bStreamingDontDelete = !!(tmp & BIT(29));
+#ifdef GTA_ZONECULL
bZoneCulled = !!(tmp & BIT(30));
bZoneCulled2 = !!(tmp & BIT(31));
+#endif
tmp = ReadSaveBuf<uint32>(buf);
diff --git a/src/entities/Entity.h b/src/entities/Entity.h
index ffafa705..49c6932c 100644
--- a/src/entities/Entity.h
+++ b/src/entities/Entity.h
@@ -71,8 +71,10 @@ public:
uint32 bMeleeProof : 1;
uint32 bOnlyDamagedByPlayer : 1;
uint32 bStreamingDontDelete : 1; // Dont let the streaming remove this
+#ifdef GTA_ZONECULL
uint32 bZoneCulled : 1;
uint32 bZoneCulled2 : 1; // only treadables+10m
+#endif
// flagsD
uint32 bRemoveFromWorld : 1; // remove this entity next time it should be processed
@@ -154,6 +156,7 @@ public:
bool GetIsTouching(CVector const &center, float r);
bool GetIsOnScreen(void);
bool GetIsOnScreenComplex(void);
+ bool GetIsOnScreenAndNotCulled(void);
bool IsVisible(void) { return m_rwObject && bIsVisible && GetIsOnScreen(); }
bool IsVisibleComplex(void) { return m_rwObject && bIsVisible && GetIsOnScreenComplex(); }
int16 GetModelIndex(void) const { return m_modelIndex; }
diff --git a/src/peds/CopPed.cpp b/src/peds/CopPed.cpp
index 0fb0b9e0..7140af76 100644
--- a/src/peds/CopPed.cpp
+++ b/src/peds/CopPed.cpp
@@ -717,7 +717,7 @@ CCopPed::ProcessControl(void)
return;
bool dontShoot = false;
- if (GetIsOnScreen() && CRenderer::IsEntityCullZoneVisible(this)) {
+ if (GetIsOnScreenAndNotCulled()) {
if (((CTimer::GetFrameCounter() + m_randomSeed) & 0x1F) == 17) {
CEntity *foundBuilding = nil;
CColPoint foundCol;
diff --git a/src/render/Renderer.cpp b/src/render/Renderer.cpp
index 982c61cd..03bc175a 100644
--- a/src/render/Renderer.cpp
+++ b/src/render/Renderer.cpp
@@ -1263,7 +1263,9 @@ CRenderer::ScanSectorList(CPtrList *lists)
continue; // already seen
ent->m_scanCode = CWorld::GetCurrentScanCode();
+#ifdef GTA_ZONECULL
if(IsEntityCullZoneVisible(ent))
+#endif
switch(SetupEntityVisibility(ent)){
case VIS_VISIBLE:
ms_aVisibleEntityPtrs[ms_nNoOfVisibleEntities++] = ent;
@@ -1286,12 +1288,14 @@ CRenderer::ScanSectorList(CPtrList *lists)
CStreaming::RequestModel(ent->GetModelIndex(), 0);
break;
}
+#ifdef GTA_ZONECULL
else if(ent->IsBuilding() && ((CBuilding*)ent)->GetIsATreadable()){
if(!CStreaming::ms_disableStreaming)
if(SetupEntityVisibility(ent) == VIS_STREAMME)
if(!m_loadingPriority || CStreaming::ms_numModelsRequested < 10)
CStreaming::RequestModel(ent->GetModelIndex(), 0);
}
+#endif
}
}
}
@@ -1313,7 +1317,9 @@ CRenderer::ScanSectorList_Priority(CPtrList *lists)
continue; // already seen
ent->m_scanCode = CWorld::GetCurrentScanCode();
+#ifdef GTA_ZONECULL
if(IsEntityCullZoneVisible(ent))
+#endif
switch(SetupEntityVisibility(ent)){
case VIS_VISIBLE:
ms_aVisibleEntityPtrs[ms_nNoOfVisibleEntities++] = ent;
@@ -1338,11 +1344,13 @@ CRenderer::ScanSectorList_Priority(CPtrList *lists)
}
break;
}
+#ifdef GTA_ZONECULL
else if(ent->IsBuilding() && ((CBuilding*)ent)->GetIsATreadable()){
if(!CStreaming::ms_disableStreaming)
if(SetupEntityVisibility(ent) == VIS_STREAMME)
CStreaming::RequestModel(ent->GetModelIndex(), 0);
}
+#endif
}
}
}
@@ -1395,7 +1403,9 @@ CRenderer::ScanSectorList_RequestModels(CPtrList *lists)
if(ent->m_scanCode == CWorld::GetCurrentScanCode())
continue; // already seen
ent->m_scanCode = CWorld::GetCurrentScanCode();
+#ifdef GTA_ZONECULL
if(IsEntityCullZoneVisible(ent))
+#endif
if(ShouldModelBeStreamed(ent))
CStreaming::RequestModel(ent->GetModelIndex(), 0);
}
@@ -1441,6 +1451,7 @@ CRenderer::ShouldModelBeStreamed(CEntity *ent)
return dist - FADE_DISTANCE - STREAM_DISTANCE < mi->GetLargestLodDistance();
}
+#ifdef GTA_ZONECULL
bool
CRenderer::IsEntityCullZoneVisible(CEntity *ent)
{
@@ -1483,6 +1494,7 @@ CRenderer::IsVehicleCullZoneVisible(CEntity *ent)
return !(v->m_pCurGroundEntity && v->m_pCurGroundEntity->bZoneCulled2);
return true;
}
+#endif
void
CRenderer::RemoveVehiclePedLights(CEntity *ent, bool reset)
diff --git a/src/render/Renderer.h b/src/render/Renderer.h
index 362741e3..e28995c3 100644
--- a/src/render/Renderer.h
+++ b/src/render/Renderer.h
@@ -64,8 +64,10 @@ public:
static void SortBIGBuildingsForSectorList(CPtrList *list);
static bool ShouldModelBeStreamed(CEntity *ent);
+#ifdef GTA_ZONECULL
static bool IsEntityCullZoneVisible(CEntity *ent);
static bool IsVehicleCullZoneVisible(CEntity *ent);
+#endif
static void RemoveVehiclePedLights(CEntity *ent, bool reset);
};
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
}