summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authoreray orçunus <erayorcunus@gmail.com>2019-07-18 04:28:06 +0200
committereray orçunus <erayorcunus@gmail.com>2019-07-18 04:28:06 +0200
commit993944c05c9f204a2caf61b973d68b7f7a1c56ab (patch)
tree998813788845b3a334f2f04612136b390a1e872c /src
parentThe Peds, mainly dying/injuring (diff)
parentmore CAutomobile::ProcessControl (diff)
downloadre3-993944c05c9f204a2caf61b973d68b7f7a1c56ab.tar
re3-993944c05c9f204a2caf61b973d68b7f7a1c56ab.tar.gz
re3-993944c05c9f204a2caf61b973d68b7f7a1c56ab.tar.bz2
re3-993944c05c9f204a2caf61b973d68b7f7a1c56ab.tar.lz
re3-993944c05c9f204a2caf61b973d68b7f7a1c56ab.tar.xz
re3-993944c05c9f204a2caf61b973d68b7f7a1c56ab.tar.zst
re3-993944c05c9f204a2caf61b973d68b7f7a1c56ab.zip
Diffstat (limited to 'src')
-rw-r--r--src/control/Bridge.cpp49
-rw-r--r--src/control/CarCtrl.cpp8
-rw-r--r--src/control/CarCtrl.h1
-rw-r--r--src/control/Replay.cpp2
-rw-r--r--src/core/Clock.cpp7
-rw-r--r--src/core/Clock.h2
-rw-r--r--src/core/Pad.h3
-rw-r--r--src/core/Stats.cpp1
-rw-r--r--src/core/Stats.h1
-rw-r--r--src/core/Streaming.cpp2
-rw-r--r--src/modelinfo/ModelIndices.h5
-rw-r--r--src/render/Fluff.cpp828
-rw-r--r--src/render/Fluff.h86
-rw-r--r--src/render/Rubbish.cpp1
-rw-r--r--src/render/Rubbish.h3
-rw-r--r--src/vehicles/Automobile.cpp473
-rw-r--r--src/vehicles/Automobile.h37
-rw-r--r--src/vehicles/DamageManager.h2
-rw-r--r--src/vehicles/HandlingMgr.cpp2
-rw-r--r--src/vehicles/HandlingMgr.h4
-rw-r--r--src/vehicles/Transmission.cpp93
-rw-r--r--src/vehicles/Transmission.h1
-rw-r--r--src/vehicles/Vehicle.cpp4
-rw-r--r--src/vehicles/Vehicle.h2
24 files changed, 1548 insertions, 69 deletions
diff --git a/src/control/Bridge.cpp b/src/control/Bridge.cpp
index 3215ea2d..81f43f32 100644
--- a/src/control/Bridge.cpp
+++ b/src/control/Bridge.cpp
@@ -46,6 +46,7 @@ void CBridge::Update()
float liftHeight;
+ // Set bridge height and state
if (CStats::CommercialPassed)
{
if (TimeOfBridgeBecomingOperational == 0)
@@ -81,30 +82,6 @@ void CBridge::Update()
liftHeight = 25.0;
State = STATE_LIFT_PART_IS_UP;
}
-
- // Move bridge part
- if (liftHeight != OldLift)
- {
- pLiftPart->GetPosition().z = DefaultZLiftPart + liftHeight;
- pLiftPart->GetMatrix().UpdateRW();
- pLiftPart->UpdateRwFrame();
- if (pLiftRoad)
- {
- pLiftRoad->GetPosition().z = DefaultZLiftRoad + liftHeight;
- pLiftRoad->GetMatrix().UpdateRW();
- pLiftRoad->UpdateRwFrame();
- }
- pWeight->GetPosition().z = DefaultZLiftWeight - liftHeight;
- pWeight->GetMatrix().UpdateRW();
- pWeight->UpdateRwFrame();
-
- OldLift = liftHeight;
- }
-
- if (State == STATE_LIFT_PART_ABOUT_TO_MOVE_UP && OldState == STATE_LIFT_PART_IS_DOWN)
- 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);
}
else
{
@@ -112,6 +89,30 @@ void CBridge::Update()
TimeOfBridgeBecomingOperational = 0;
State = STATE_BRIDGE_LOCKED;
}
+
+ // Move bridge part
+ if (liftHeight != OldLift)
+ {
+ pLiftPart->GetPosition().z = DefaultZLiftPart + liftHeight;
+ pLiftPart->GetMatrix().UpdateRW();
+ pLiftPart->UpdateRwFrame();
+ if (pLiftRoad)
+ {
+ pLiftRoad->GetPosition().z = DefaultZLiftRoad + liftHeight;
+ pLiftRoad->GetMatrix().UpdateRW();
+ pLiftRoad->UpdateRwFrame();
+ }
+ pWeight->GetPosition().z = DefaultZLiftWeight - liftHeight;
+ pWeight->GetMatrix().UpdateRW();
+ pWeight->UpdateRwFrame();
+
+ OldLift = liftHeight;
+ }
+
+ if (State == STATE_LIFT_PART_ABOUT_TO_MOVE_UP && OldState == STATE_LIFT_PART_IS_DOWN)
+ 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);
}
bool CBridge::ShouldLightsBeFlashing() { return State != STATE_LIFT_PART_IS_DOWN; }
diff --git a/src/control/CarCtrl.cpp b/src/control/CarCtrl.cpp
index 7acfa64a..edf4d1ae 100644
--- a/src/control/CarCtrl.cpp
+++ b/src/control/CarCtrl.cpp
@@ -16,3 +16,11 @@ WRAPPER bool CCarCtrl::JoinCarWithRoadSystemGotoCoors(CVehicle*, CVector, bool)
WRAPPER void CCarCtrl::JoinCarWithRoadSystem(CVehicle*) { EAXJMP(0x41F820); }
WRAPPER void CCarCtrl::SteerAICarWithPhysics(CVehicle*) { EAXJMP(0x41DA60); }
WRAPPER void CCarCtrl::UpdateCarOnRails(CVehicle*) { EAXJMP(0x418880); }
+
+bool
+CCarCtrl::MapCouldMoveInThisArea(float x, float y)
+{
+ // bridge moves up and down
+ return x > -342.0f && x < -219.0f &&
+ y > -677.0f && y < -580.0f;
+}
diff --git a/src/control/CarCtrl.h b/src/control/CarCtrl.h
index a15279d3..7e3f70a9 100644
--- a/src/control/CarCtrl.h
+++ b/src/control/CarCtrl.h
@@ -13,6 +13,7 @@ public:
static void JoinCarWithRoadSystem(CVehicle*);
static void SteerAICarWithPhysics(CVehicle*);
static void UpdateCarOnRails(CVehicle*);
+ static bool MapCouldMoveInThisArea(float x, float y);
static int32 &NumLawEnforcerCars;
static int32 &NumAmbulancesOnDuty;
diff --git a/src/control/Replay.cpp b/src/control/Replay.cpp
index 3ce9085f..29bdacd7 100644
--- a/src/control/Replay.cpp
+++ b/src/control/Replay.cpp
@@ -718,7 +718,7 @@ void CReplay::ProcessCarUpdate(CVehicle *vehicle, float interpolation, CAddressI
}
vehicle->bEngineOn = true;
if (vehicle->IsCar())
- ((CAutomobile*)vehicle)->m_nWheelsOnGround = 4;
+ ((CAutomobile*)vehicle)->m_nDriveWheelsOnGround = 4;
CWorld::Remove(vehicle);
CWorld::Add(vehicle);
if (vehicle->IsBoat())
diff --git a/src/core/Clock.cpp b/src/core/Clock.cpp
index 707b0e57..a97dcb5f 100644
--- a/src/core/Clock.cpp
+++ b/src/core/Clock.cpp
@@ -15,7 +15,7 @@ uint8 &CClock::ms_Stored_nGameClockHours = *(uint8*)0x95CD7B;
uint8 &CClock::ms_Stored_nGameClockMinutes = *(uint8*)0x95CD9B;
uint16 &CClock::ms_Stored_nGameClockSeconds = *(uint16*)0x95CC9C;
uint32 &CClock::ms_nMillisecondsPerGameMinute = *(uint32*)0x8F2C64;
-int32 &CClock::ms_nLastClockTick = *(int32*)0x9430E4;
+uint32 &CClock::ms_nLastClockTick = *(uint32*)0x9430E4;
bool &CClock::ms_bClockHasBeenStored = *(bool*)0x95CD82;
void
@@ -67,10 +67,7 @@ CClock::Update(void)
}
}
}
- ms_nGameClockSeconds +=
- 60
- * (CTimer::GetTimeInMilliseconds() - ms_nLastClockTick)
- / ms_nMillisecondsPerGameMinute;
+ ms_nGameClockSeconds = 60 * (CTimer::GetTimeInMilliseconds() - ms_nLastClockTick) / ms_nMillisecondsPerGameMinute;
}
void
diff --git a/src/core/Clock.h b/src/core/Clock.h
index e11b2293..ea4263bd 100644
--- a/src/core/Clock.h
+++ b/src/core/Clock.h
@@ -9,7 +9,7 @@ class CClock
static uint8 &ms_Stored_nGameClockMinutes;
static uint16 &ms_Stored_nGameClockSeconds;
static uint32 &ms_nMillisecondsPerGameMinute;
- static int32 &ms_nLastClockTick;
+ static uint32 &ms_nLastClockTick;
static bool &ms_bClockHasBeenStored;
public:
diff --git a/src/core/Pad.h b/src/core/Pad.h
index f853a8cd..f84ca742 100644
--- a/src/core/Pad.h
+++ b/src/core/Pad.h
@@ -197,7 +197,7 @@ public:
int16 Mode;
int16 ShakeDur;
uint8 ShakeFreq;
- int8 bHornHistory[5];
+ bool bHornHistory[5];
uint8 iCurrHornHistory;
uint8 DisablePlayerControls;
int8 bApplyBrakes;
@@ -377,6 +377,7 @@ public:
bool ArePlayerControlsDisabled(void) { return DisablePlayerControls != PLAYERCONTROL_ENABLED; }
};
VALIDATE_SIZE(CPad, 0xFC);
+extern CPad *Pads; //[2]
#define IsButtonJustDown(pad, btn) \
(!(pad)->OldState.btn && (pad)->NewState.btn)
diff --git a/src/core/Stats.cpp b/src/core/Stats.cpp
index 921586bb..01bbf82e 100644
--- a/src/core/Stats.cpp
+++ b/src/core/Stats.cpp
@@ -4,6 +4,7 @@
int32 &CStats::DaysPassed = *(int32*)0x8F2BB8;
int32 &CStats::HeadShots = *(int32*)0x8F647C;
bool& CStats::CommercialPassed = *(bool*)0x8F4334;
+bool& CStats::IndustrialPassed = *(bool*)0x8E2A68;
int32 &CStats::NumberKillFrenziesPassed = *(int32*)0x8E287C;
int32 &CStats::PeopleKilledByOthers = *(int32*)0x8E2C50;
diff --git a/src/core/Stats.h b/src/core/Stats.h
index 30058a59..c536465f 100644
--- a/src/core/Stats.h
+++ b/src/core/Stats.h
@@ -6,6 +6,7 @@ public:
static int32 &DaysPassed;
static int32 &HeadShots;
static bool& CommercialPassed;
+ static bool& IndustrialPassed;
static int32 &NumberKillFrenziesPassed;
static int32 &PeopleKilledByOthers;
diff --git a/src/core/Streaming.cpp b/src/core/Streaming.cpp
index a23e35be..9d9241e4 100644
--- a/src/core/Streaming.cpp
+++ b/src/core/Streaming.cpp
@@ -1048,8 +1048,6 @@ CStreaming::RemoveReferencedTxds(int32 mem)
return false;
}
-// TODO: RemoveCurrentZonesModels
-
void
CStreaming::RemoveUnusedModelsInLoadedList(void)
{
diff --git a/src/modelinfo/ModelIndices.h b/src/modelinfo/ModelIndices.h
index 135f3424..a0d3f70c 100644
--- a/src/modelinfo/ModelIndices.h
+++ b/src/modelinfo/ModelIndices.h
@@ -315,6 +315,11 @@ enum
MI_TOYZ,
MI_GHOST,
+ // leftovers on PC
+ MI_MIAMI_RCBARON = 154,
+ MI_MIAMI_RCRAIDER = 155,
+ MI_MIAMI_SPARROW = 159,
+
MI_GRENADE = 170,
MI_AK47,
MI_BASEBALL_BAT,
diff --git a/src/render/Fluff.cpp b/src/render/Fluff.cpp
index b1b8aa92..678b9f43 100644
--- a/src/render/Fluff.cpp
+++ b/src/render/Fluff.cpp
@@ -1,5 +1,831 @@
#include "common.h"
#include "patcher.h"
#include "Fluff.h"
+#include "Camera.h"
+#include "Sprite.h"
+#include "Coronas.h"
+#include "General.h"
+#include "Timer.h"
+#include "Clock.h"
+#include "Pad.h"
+#include "Weather.h"
+#include "Stats.h"
+#include "math/maths.h"
+#include "Frontend.h"
-WRAPPER void CMovingThings::Render(void) { EAXJMP(0x4FF210); }
+uint8 ScrollCharSet[59][5] = {
+ { 0x00, 0x00, 0x00, 0x00, 0x00 }, // ' '
+ { 0x00, 0x00, 0x1D, 0x00, 0x00 }, // '!'
+ { 0x00, 0x00, 0x00, 0x00, 0x00 }, // '"'
+ { 0x0A, 0x1F, 0x0A, 0x1F, 0x0A }, // '#'
+ { 0x00, 0x09, 0x1F, 0x12, 0x00 }, // '$'
+ { 0x18, 0x18, 0x00, 0x03, 0x03 }, // '%'
+ { 0x00, 0x00, 0x00, 0x00, 0x00 }, // '&'
+ { 0x00, 0x00, 0x00, 0x00, 0x00 }, // '''
+ { 0x01, 0x02, 0x04, 0x08, 0x10 }, // '('
+ { 0x00, 0x00, 0x18, 0x00, 0x00 }, // ')'
+ { 0x15, 0x04, 0x1F, 0x04, 0x15 }, // '*'
+ { 0x00, 0x04, 0x0E, 0x04, 0x00 }, // '+'
+ { 0x00, 0x00, 0x03, 0x00, 0x00 }, // ','
+ { 0x00, 0x04, 0x04, 0x04, 0x00 }, // '-'
+ { 0x00, 0x00, 0x01, 0x00, 0x00 }, // '.'
+ { 0x00, 0x00, 0x00, 0x00, 0x00 }, // '/'
+ { 0x0E, 0x11, 0x11, 0x11, 0x0E }, // '0'
+ { 0x01, 0x09, 0x1F, 0x01, 0x01 }, // '1'
+ { 0x03, 0x15, 0x15, 0x15, 0x09 }, // '2'
+ { 0x11, 0x11, 0x15, 0x15, 0x0A }, // '3'
+ { 0x02, 0x06, 0x0A, 0x1F, 0x02 }, // '4'
+ { 0x1D, 0x15, 0x15, 0x15, 0x12 }, // '5'
+ { 0x0E, 0x15, 0x15, 0x15, 0x12 }, // '6'
+ { 0x18, 0x10, 0x13, 0x14, 0x18 }, // '7'
+ { 0x0A, 0x15, 0x15, 0x15, 0x0A }, // '8'
+ { 0x08, 0x15, 0x15, 0x15, 0x0E }, // '9'
+ { 0x00, 0x00, 0x0A, 0x00, 0x00 }, // ':'
+ { 0x18, 0x18, 0x00, 0x03, 0x03 }, // ';'
+ { 0x04, 0x08, 0x1F, 0x08, 0x04 }, // '<'
+ { 0x00, 0x0A, 0x0A, 0x0A, 0x00 }, // '='
+ { 0x04, 0x02, 0x1F, 0x02, 0x04 }, // '>'
+ { 0x10, 0x10, 0x15, 0x14, 0x1D }, // '?'
+ { 0x00, 0x1C, 0x14, 0x1C, 0x00 }, // '@'
+ { 0x0F, 0x12, 0x12, 0x12, 0x0F }, // 'A'
+ { 0x1F, 0x15, 0x15, 0x15, 0x0A }, // 'B'
+ { 0x0E, 0x11, 0x11, 0x11, 0x0A }, // 'C'
+ { 0x1F, 0x11, 0x11, 0x11, 0x0E }, // 'D'
+ { 0x1F, 0x15, 0x15, 0x11, 0x11 }, // 'E'
+ { 0x1F, 0x14, 0x14, 0x10, 0x10 }, // 'F'
+ { 0x0E, 0x11, 0x15, 0x15, 0x06 }, // 'G'
+ { 0x1F, 0x04, 0x04, 0x04, 0x1F }, // 'H'
+ { 0x11, 0x11, 0x1F, 0x11, 0x11 }, // 'I'
+ { 0x02, 0x01, 0x01, 0x01, 0x1E }, // 'J'
+ { 0x1F, 0x04, 0x0C, 0x12, 0x01 }, // 'K'
+ { 0x1F, 0x01, 0x01, 0x01, 0x01 }, // 'L'
+ { 0x1F, 0x08, 0x06, 0x08, 0x1F }, // 'M'
+ { 0x1F, 0x08, 0x04, 0x02, 0x1F }, // 'N'
+ { 0x0E, 0x11, 0x11, 0x11, 0x0E }, // 'O'
+ { 0x1F, 0x12, 0x12, 0x12, 0x0C }, // 'P'
+ { 0x0C, 0x12, 0x12, 0x13, 0x0D }, // 'Q'
+ { 0x1F, 0x14, 0x14, 0x16, 0x09 }, // 'R'
+ { 0x09, 0x15, 0x15, 0x15, 0x02 }, // 'S'
+ { 0x10, 0x10, 0x1F, 0x10, 0x10 }, // 'T'
+ { 0x1E, 0x01, 0x01, 0x01, 0x1E }, // 'U'
+ { 0x1C, 0x02, 0x01, 0x02, 0x1C }, // 'V'
+ { 0x1E, 0x01, 0x06, 0x01, 0x1E }, // 'W'
+ { 0x11, 0x0A, 0x04, 0x0A, 0x11 }, // 'X'
+ { 0x18, 0x04, 0x03, 0x04, 0x18 }, // 'Y'
+ { 0x11, 0x13, 0x15, 0x19, 0x11 } // 'Z'
+};
+
+// ---------- CMovingThings ----------
+enum eScrollBarTypes
+{
+ SCROLL_BUSINESS,
+ SCROLL_TRAFFIC,
+ SCROLL_ENTERTAINMENT,
+ SCROLL_AIRPORT_DOORS,
+ SCROLL_AIRPORT_FRONT,
+ SCROLL_STORE,
+ SCROLL_USED_CARS
+};
+
+CScrollBar aScrollBars[11];
+CTowerClock aTowerClocks[2];
+CDigitalClock aDigitalClocks[3];
+
+void CMovingThings::Init()
+{
+ /*
+ * Some unused code about CMovingThing was here...
+ */
+
+ // Initialize scroll bars
+ aScrollBars[0].Init(CVector( 228.3f, -669.0f, 39.0f ), SCROLL_BUSINESS, 0.0, 0.5, 0.5, 255, 128, 0, 0.3);
+ aScrollBars[1].Init(CVector( 772.0f, 164.0f, -9.5f ), SCROLL_TRAFFIC, 0.0, 0.5, 0.25, 128, 255, 0, 0.3);
+ aScrollBars[2].Init(CVector(-1089.61f, -584.224f, 13.246f), SCROLL_AIRPORT_DOORS, 0.0, -0.1706, 0.107, 255, 0, 0, 0.11);
+ aScrollBars[3].Init(CVector(-1089.61f, -602.04602f, 13.246f), SCROLL_AIRPORT_DOORS, 0.0, -0.1706, 0.107, 0, 255, 0, 0.11);
+ aScrollBars[4].Init(CVector(-1089.61f, -619.81702f, 13.246f), SCROLL_AIRPORT_DOORS, 0.0, -0.1706, 0.107, 255, 128, 0, 0.11);
+ aScrollBars[5].Init(CVector(-754.578f, -633.50897f, 18.411f), SCROLL_AIRPORT_FRONT, 0.0, 0.591, 0.52, 100, 100, 255, 0.3);
+ aScrollBars[6].Init(CVector( -754.578f, -586.672f, 18.411f), SCROLL_AIRPORT_FRONT, 0.0, 0.591, 0.52, 100, 100, 255, 0.3);
+ aScrollBars[7].Init(CVector( 85.473f, -1069.512f, 30.5f ), SCROLL_STORE, 0.625, -0.3125, 0.727, 100, 100, 255, 0.5);
+ aScrollBars[8].Init(CVector( 74.823f, -1086.879f, 31.495f), SCROLL_ENTERTAINMENT, -0.2083, 0.1041, 0.5, 255, 255, 128, 0.3);
+ aScrollBars[9].Init(CVector( -36.459f, -1031.2371f, 32.534f), SCROLL_ENTERTAINMENT, -0.1442, 0.0721, 0.229, 150, 255, 50, 0.3);
+ aScrollBars[10].Init(CVector( 1208.0f, -62.208f, 19.157f), SCROLL_USED_CARS, 0.0642, -0.20365, 0.229, 255, 128, 0, 0.3);
+
+ // Initialize tower clocks
+ aTowerClocks[0].Init(CVector(59.4f, -1081.3f, 54.15f), -1.0f, 0.0f, 0, 0, 0, 80.0f, 2.0f);
+ aTowerClocks[1].Init(CVector(55.4f, -1083.6f, 54.15f), 0.0f, -1.0f, 0, 0, 0, 80.0f, 2.0f);
+
+ // Initialize digital clocks
+ CVector2D sz(3.7f, 2.144f);
+ sz.Normalise();
+ aDigitalClocks[0].Init(
+ CVector(54.485f - sz.x * 0.05f + sz.y * 0.3f, -1081.679f - sz.y * 0.05f - sz.x * 0.3f, 32.803f),
+ sz.y, -sz.x, 255, 0, 0, 100.0f, 0.8f
+ );
+ aDigitalClocks[1].Init(
+ CVector(60.564f + sz.x * 0.05f - sz.y * 0.3f, -1083.089f + sz.y * 0.05f + sz.x * 0.3f, 32.803f),
+ -sz.y, sz.x, 0, 0, 255, 100.0f, 0.8f
+ );
+ aDigitalClocks[2].Init(
+ CVector(58.145f - sz.y * 0.05f - sz.x * 0.3f, -1079.268f + sz.x * 0.05f - sz.y * 0.3f, 32.803f),
+ -sz.x, -sz.y, 0, 255, 0, 100.0f, 0.8f
+ );
+}
+
+void CMovingThings::Shutdown()
+{
+ int i;
+ for (i = 0; i < 11; ++i)
+ aScrollBars[i].SetVisibility(false);
+ for (i = 0; i < 2; ++i)
+ aTowerClocks[i].SetVisibility(false);
+ for (i = 0; i < 3; ++i)
+ aDigitalClocks[i].SetVisibility(false);
+}
+
+void CMovingThings::Update()
+{
+ /*
+ * Some unused code about CMovingThing was here...
+ */
+
+ int i;
+ for (i = 0; i < 11; ++i)
+ {
+ if (aScrollBars[i].IsVisible() || (CTimer::GetFrameCounter() + i) % 8 == 0)
+ aScrollBars[i].Update();
+ }
+ for (i = 0; i < 2; ++i)
+ {
+ if (aTowerClocks[i].IsVisible() || (CTimer::GetFrameCounter() + i) % 8 == 0)
+ aTowerClocks[i].Update();
+ }
+ for (i = 0; i < 3; ++i)
+ {
+ if (aDigitalClocks[i].IsVisible() || (CTimer::GetFrameCounter() + i) % 8 == 0)
+ aDigitalClocks[i].Update();
+ }
+}
+
+void CMovingThings::Render()
+{
+ int i;
+ for (i = 0; i < 11; ++i)
+ {
+ if (aScrollBars[i].IsVisible())
+ aScrollBars[i].Render();
+ }
+ for (i = 0; i < 2; ++i)
+ {
+ if (aTowerClocks[i].IsVisible())
+ aTowerClocks[i].Render();
+ }
+ for (i = 0; i < 3; ++i)
+ {
+ if (aDigitalClocks[i].IsVisible())
+ aDigitalClocks[i].Render();
+ }
+}
+
+// ---------- CMovingThing ----------
+WRAPPER void CMovingThing::Update() { EAXJMP(0x4FF290); }
+WRAPPER void CMovingThing::AddToList() { EAXJMP(0x4FF320); }
+WRAPPER void CMovingThing::RemoveFromList() { EAXJMP(0x4FF340); }
+
+// ---------- Find message functions ----------
+const char* FindTunnelMessage()
+{
+ if (CStats::CommercialPassed)
+ return "LIBERTY TUNNEL HAS BEEN OPENED TO ALL TRAFFIC . . . ";
+
+ if (CStats::IndustrialPassed)
+ return "FIRST PHASE LIBERTY TUNNEL HAS BEEN COMPLETED . . . ";
+
+ return "FIRST PHASE LIBERTY TUNNEL ABOUT TO BE COMPLETED . . . ";
+}
+
+const char* FindBridgeMessage()
+{
+ if (CStats::CommercialPassed)
+ return "STAUNTON LIFT BRIDGE IS OPERATIONAL AGAIN ";
+
+ if (CStats::IndustrialPassed)
+ return "LONG DELAYS BEHIND US AS CALLAHAN BRIDGE IS FIXED . . . STAUNTON LIFT BRIDGE STUCK OPEN ";
+
+ return "CHAOS AS CALLAHAN BRIDGE IS UNDER REPAIR. . . ";
+}
+
+char String_Time[] = "THE TIME IS 12:34 ";
+const char* FindTimeMessage()
+{
+ String_Time[12] = '0' + CClock::GetHours() / 10;
+ String_Time[13] = '0' + CClock::GetHours() % 10;
+ String_Time[15] = '0' + CClock::GetMinutes() / 10;
+ String_Time[16] = '0' + CClock::GetMinutes() % 10;
+ return String_Time;
+}
+
+char String_DigitalClock[] = "12:34";
+const char* FindDigitalClockMessage()
+{
+ if (((CTimer::GetTimeInMilliseconds() >> 10) & 7) < 6)
+ {
+ String_DigitalClock[0] = '0' + CClock::GetHours() / 10;
+ String_DigitalClock[1] = '0' + CClock::GetHours() % 10;
+ String_DigitalClock[2] = CTimer::GetTimeInMilliseconds() & 0x200 ? ':' : ' ';
+ String_DigitalClock[3] = '0' + CClock::GetMinutes() / 10;
+ String_DigitalClock[4] = '0' + CClock::GetMinutes() % 10;
+ }
+ else
+ {
+ int temperature = 13.0f - 6.0f * Cos((CClock::GetMinutes() + 60.0f * CClock::GetHours()) * 0.0043611112f - 1.0f);
+ String_DigitalClock[0] = '0' + temperature / 10;
+ if (String_DigitalClock[0] == '0')
+ String_DigitalClock[0] = ' ';
+ String_DigitalClock[1] = '0' + temperature % 10;
+ String_DigitalClock[2] = ' ';
+ String_DigitalClock[3] = '@';
+ String_DigitalClock[4] = 'C';
+ }
+ return String_DigitalClock;
+}
+
+// ---------- CScrollBar ----------
+void CScrollBar::Init(CVector position, uint8 type, float sizeX, float sizeY, float sizeZ, uint8 red, uint8 green, uint8 blue, float scale)
+{
+ for (int i = 0; i < 40; ++i)
+ m_MessageBar[i] = 0;
+
+ m_pMessage = ". ";
+ m_MessageCurrentChar = 0;
+ m_MessageLength = 2;
+
+ m_Counter = 0;
+ m_bVisible = false;
+ m_Position = position;
+ m_Type = type;
+ m_Size.x = sizeX;
+ m_Size.y = sizeY;
+ m_Size.z = sizeZ;
+ m_uRed = red;
+ m_uGreen = green;
+ m_uBlue = blue;
+ m_fScale = scale;
+}
+
+void CScrollBar::Update()
+{
+ float distanceFromCamera = (TheCamera.GetPosition() - m_Position).Magnitude();
+ if (distanceFromCamera > 100.0f)
+ {
+ m_bVisible = false;
+ return;
+ }
+
+ m_bVisible = true;
+
+ if (distanceFromCamera < 75.0f)
+ m_fIntensity = 1.0f;
+ else
+ m_fIntensity = 1.0f - 4.0f * (distanceFromCamera - 75.0f) / 100.0f;
+
+ m_Counter = (m_Counter + 1) % 8;
+
+ // if message is fully printed, load up the next one
+ if (m_Counter == 0 && ++m_MessageCurrentChar >= m_MessageLength)
+ {
+ const char* previousMessage = m_pMessage;
+ switch (m_Type)
+ {
+ case SCROLL_BUSINESS:
+ while (previousMessage == m_pMessage)
+ {
+ switch (CGeneral::GetRandomNumber() % 7)
+ {
+ case 0:
+ m_pMessage = "SHARES UYE<10% DWD<20% NDWE>22% . . . ";
+ break;
+ case 1:
+ m_pMessage = "CRIME WAVE HITS LIBERTY CITY . . . ";
+ break;
+ case 2:
+ m_pMessage = "SHARES OBR>29% MADD<76% LEZ<11% ADAMSKI>53% AAG>110%. . . ";
+ break;
+ case 3:
+ m_pMessage = FindTunnelMessage();
+ break;
+ case 4:
+ m_pMessage = FindBridgeMessage();
+ break;
+ case 5:
+ m_pMessage = FindTimeMessage();
+ break;
+ case 6:
+ if (CMenuManager::m_PrefsLanguage == LANGUAGE_FRENCH || CMenuManager::m_PrefsLanguage == LANGUAGE_GERMAN)
+ m_pMessage = FindTimeMessage();
+ else
+ m_pMessage = "WWW.GRANDTHEFTAUTO3.COM ";
+ break;
+ }
+ }
+ break;
+ case SCROLL_TRAFFIC:
+ while (previousMessage == m_pMessage)
+ {
+ switch (CGeneral::GetRandomNumber() % 8)
+ {
+ case 0:
+ m_pMessage = "DRIVE CAREFULLY . . . ";
+ break;
+ case 1:
+ m_pMessage = "RECENT WAVE OF CARJACKINGS. KEEP YOUR DOORS LOCKED !!! ";
+ break;
+ case 2:
+ m_pMessage = "CHECK YOUR SPEED . . . ";
+ break;
+ case 3:
+ m_pMessage = "KEEP YOUR EYES ON THE ROAD AND NOT ON THIS SIGN ";
+ break;
+ case 4:
+ if (CWeather::Foggyness > 0.5)
+ m_pMessage = "POOR VISIBILITY ! ";
+ else if (CWeather::WetRoads > 0.5)
+ m_pMessage = "ROADS ARE SLIPPERY ! ";
+ else
+ m_pMessage = "ENJOY YOUR TRIP ";
+ break;
+ case 5:
+ m_pMessage = FindTunnelMessage();
+ break;
+ case 6:
+ m_pMessage = FindBridgeMessage();
+ break;
+ case 7:
+ m_pMessage = FindTimeMessage();
+ break;
+ }
+ }
+ break;
+ case SCROLL_ENTERTAINMENT:
+ while (previousMessage == m_pMessage)
+ {
+ switch (CGeneral::GetRandomNumber() % 12)
+ {
+ case 0:
+ m_pMessage = " )69TH STREET) STILL HOLDS TOP POSITION THIS MONTH AT THE BOX-OFFICE WITH )MY FAIR LADYBOY) JUST CREEPING UP BEHIND. ";
+ break;
+ case 1:
+ m_pMessage = " TALKING OF )FANNIE). THERE IS STILL TIME TO CATCH THIS LOVELY FAMILY MUSICAL, ABOUT THE ORPHAN WHO IS SO EASILY TAKEN IN BY ANY MAN WITH LOADS OF MONEY. ";
+ break;
+ case 2:
+ m_pMessage = " DO NOT MISS )GTA3, THE MUSICAL) . . . ";
+ break;
+ case 3:
+ m_pMessage =
+ " STILL RUNNING ARE )RATS) AND )GUYS AND DOGS), BETWEEN THEN THEY SHOULD HAVE THE LEGS TO LAST TILL THE AND OF THE YEAR. . . "
+ " ALSO FOR FOUR LEGGED FANS, THE STAGE VERSION OF THE GRITTY REALISTIC )SATERDAY NIGHT BEAVER) OPENED LAST WEEKEND,"
+ " AND I FOR ONE CERTAINLY ENJOYED THAT. ";
+ break;
+ case 4:
+ m_pMessage =
+ " NOW SHOWING STATE-WIDE, ARNOLD STEELONE, HOLLYWOODS BEST LIVING SPECIAL EFFECT, APPEARS AGAIN AS A HALF_MAN,"
+ " HALF ANDROID IN THE HALF-BAKED ROMP, )TOP DOWN CITY). AN HOMAGE TO HIS EARLIER TWO MULTI_MILLION MAKING MOVIES,"
+ " IN WHICH HE PLAYED TWO-DEE, AN OUT OF CONTROL MONSTER, INTENT ON CORRUPTING CIVILISATION! ";
+ break;
+ case 5:
+ m_pMessage =
+ " ALSO APPEARING THIS WEEK )HALF-COCKED) SEES CHUCK SCHWARTZ UP TO HIS USUAL NONSENSE AS HE TAKES ON HALF OF LIBERTY CITY"
+ " IN AN ATTEMPT TO SAVE HIS CROSS-DRESSING LADY-BOY SIDEKICK, )MISS PING-PONG), FROM A GANG OF RUTHLESS COSMETIC SURGEONS. ";
+ break;
+ case 6:
+ m_pMessage =
+ " STILL SHOWING: )SOLDIERS OF MISFORTUNE), ATTROCIOUS ACTING WHICH SEES BOYZ 2 GIRLZ) TRANSITION FROM THE CHARTS TO THE BIG SCREEN,"
+ " AT LEAST THEY ALL DIE AT THE END. . . ";
+ break;
+ case 7:
+ m_pMessage =
+ " )BADFELLAS) IS STILL GOING STRONG WITH CROWDS ALMOST BEING PUSHED INTO CINEMAS TO SEE THIS ONE."
+ " ANOTHER ONE WORTH LOOKING INTO IS )THE TUNNEL). ";
+ break;
+ case 8:
+ m_pMessage = FindTunnelMessage();
+ break;
+ case 9:
+ m_pMessage = FindBridgeMessage();
+ break;
+ case 10:
+ m_pMessage = FindTimeMessage();
+ break;
+ case 11:
+ m_pMessage = "WWW.ROCKSTARGAMES.COM ";
+ break;
+ }
+ }
+ break;
+ case SCROLL_AIRPORT_DOORS:
+ while (previousMessage == m_pMessage)
+ {
+ switch (CGeneral::GetRandomNumber() % 4)
+ {
+ case 0:
+ m_pMessage = "WELCOME TO LIBERTY CITY . . . ";
+ break;
+ case 1:
+ m_pMessage = "PLEASE HAVE YOUR PASSPORT READY . . . ";
+ break;
+ case 2:
+ m_pMessage = "PLACE KEYS, FIREARMS, CHANGE AND OTHER METAL OBJECTS ON THE TRAY PLEASE . . . ";
+ break;
+ case 3:
+ m_pMessage = FindTimeMessage();
+ break;
+ }
+ }
+ break;
+ case SCROLL_AIRPORT_FRONT:
+ while (previousMessage == m_pMessage)
+ {
+ switch (CGeneral::GetRandomNumber() % 4)
+ {
+ case 0:
+ m_pMessage = "WELCOME TO FRANCIS INTERNATIONAL AIRPORT . . . ";
+ break;
+ case 1:
+ m_pMessage = "PLEASE DO NOT LEAVE LUGGAGE UNATTENDED . . . ";
+ break;
+ case 2:
+ m_pMessage = "FOLLOW 1 FOR LONG AND SHORT TERM PARKING ";
+ break;
+ case 3:
+ m_pMessage = FindTimeMessage();
+ break;
+ }
+ }
+ break;
+ case SCROLL_STORE:
+ while (previousMessage == m_pMessage)
+ {
+ switch (CGeneral::GetRandomNumber() % 10)
+ {
+ case 0:
+ m_pMessage = "WWW.ROCKSTARGAMES.COM ";
+ break;
+ case 1:
+ m_pMessage = "GTA3 OUT NOW . . . ";
+ break;
+ case 2:
+ m_pMessage = "OUR STUFF IS CHEAP CHEAP CHEAP ";
+ break;
+ case 3:
+ m_pMessage = "BUY 12 CDS GET ONE FREE . . . ";
+ break;
+ case 4:
+ m_pMessage = "APPEARING IN SHOP SOON, )THE BLOODY CHOPPERS), WITH THEIR NEW ALBUM, )IS THAT MY DAUGHTER?) ";
+ break;
+ case 5:
+ m_pMessage = "THIS MONTH IS OUR CRAZY CLEAROUT MONTH, EVERYTHING MUST GO, CDS, DVDS, STAFF, EVEN OUR CARPETS! ";
+ break;
+ case 6:
+ m_pMessage =
+ "OUT THIS WEEK: THE THEME TUNE TO )BOYS TO GIRLS) FIRST MOVIE )SOLDIERS OF MISFORTUNE), "
+ "THE SINGLE )LET ME IN YOU)RE BODY-BAG) IS TAKEN FROM THE SOUNDTRACK ALBUM, )BOOT CAMP BOYS). "
+ "ALSO INCLUDES THE SMASH SINGLE, )PRAY IT GOES OK). ";
+ break;
+ case 7:
+ m_pMessage =
+ "ALBUMS OUT THIS WEEK: MARYDANCING, )MUTHA O) CHRIST), FEATURING THE SINGLE )WASH HIM OFF), "
+ "ALSO CRAIG GRAYS) DEBUT, )FADE AWAY), INCLUDES THE SINGLE OF THE SAME NAME. . . ";
+ break;
+ case 8:
+ m_pMessage =
+ "ON THE FILM FRONT, A NELY COMPILED COMPILATION OF ARNOLD STEELONES GREATEST MOVIES ON DVD. "
+ "THE PACK INCLUDES THE EARLY )BY-CEP), THE CULT CLASSIC )FUTURE ANNHILATOR), AND THE HILARIOUS CROSS-DRESSING COMEDY )SISTERS). "
+ "ONE FOR ALL THE FAMILY. . . ";
+ break;
+ case 9:
+ m_pMessage = (char*)FindTimeMessage();
+ break;
+ }
+ }
+ break;
+ case SCROLL_USED_CARS:
+ while (previousMessage == m_pMessage)
+ {
+ switch (CGeneral::GetRandomNumber() % 11)
+ {
+ case 0:
+ m_pMessage = "QUICK, TAKE A LOOK AT OUR CURRENT STOCK )CAUSE THESE AUTOS ARE MOVIN) FAST . . . ";
+ break;
+ case 1:
+ m_pMessage = "THAT)S RIGHT, HERE AT )CAPITAL AUTO SALES) OUR VEHICLES ARE SO GOOD THAT THEY PRACTICALLY DRIVE THEMSELVES OFF OUR LOT . . . ";
+ break;
+ case 2:
+ m_pMessage = "EASY CREDIT ON ALL CARS . . . ";
+ break;
+ case 3:
+ m_pMessage = "FEEL LIKE A STUD IN ONE OF OUR STALLIONS OR TEST-DRIVE OUR BANSHEE, IT)S A REAL STEAL!!! ";
+ break;
+ case 4:
+ m_pMessage = "TRY OUR HARDY PERENNIAL, IT)LL LAST YOU THE WHOLE YEAR. OUR BOBCATS AIN)T NO PUSSIES EITHER!!! ";
+ break;
+ case 5:
+ m_pMessage = "IF IT)S A GUARANTEE YOU'RE AFTER, GO SOMEWHERE ELSE, )CAPITAL) CARS ARE THAT GOOD THEY DON)T NEED GUARANTEES!!! ";
+ break;
+ case 6:
+ m_pMessage = "TOP DOLLAR OFFERED FOR YOUR OLD WHEELS, NOT YOUR CAR, JUST IT)S WHEELS. . . ";
+ break;
+ case 7:
+ m_pMessage = "THAT)S RIGHT WE)RE CAR SILLY. TEST DRIVE ANY CAR, YOU WON)T WANT TO BRING IT BACK!!! ";
+ break;
+ case 8:
+ m_pMessage = "FREE FLUFFY DICE WITH ALL PURCHASES. . .";
+ break;
+ case 9:
+ if (CMenuManager::m_PrefsLanguage == LANGUAGE_FRENCH || CMenuManager::m_PrefsLanguage == LANGUAGE_GERMAN)
+ m_pMessage = "QUICK, TAKE A LOOK AT OUR CURRENT STOCK )CAUSE THESE AUTOS ARE MOVIN) FAST . . . ";
+ else
+ m_pMessage = "HTTP:((ROCKSTARGAMES.COM(GRANDTHEFTAUTO3(CAPITALAUTOS ";
+ break;
+ case 10:
+ m_pMessage = FindTimeMessage();
+ break;
+ }
+ }
+ break;
+ }
+
+ m_MessageLength = strlen(m_pMessage);
+ m_MessageCurrentChar = 0;
+ }
+
+ // Scroll
+ for (int i = 0; i < 39; i++)
+ m_MessageBar[i] = m_MessageBar[i + 1];
+ m_MessageBar[39] = m_Counter < 5 ? ScrollCharSet[m_pMessage[m_MessageCurrentChar] - ' '][m_Counter] : 0;
+
+ // Introduce some random displaying glitches; signs aren't supposed to be perfect :P
+ switch (CGeneral::GetRandomNumber() & 0xFF)
+ {
+ case 0x0D: m_MessageBar[39] = 0; break;
+ case 0xE3: m_MessageBar[39] = 0xE3; break;
+ case 0x64: m_MessageBar[39] = ~m_MessageBar[39]; break;
+ }
+}
+
+void CScrollBar::Render()
+{
+ if (!TheCamera.IsSphereVisible(m_Position, 2.0f * 20.0f * (ABS(m_Size.x) + ABS(m_Size.y))))
+ return;
+
+ CSprite::InitSpriteBuffer();
+
+ // Calculate intensity of colours
+ uint8 r = m_fIntensity * m_uRed;
+ uint8 g = m_fIntensity * m_uGreen;
+ uint8 b = m_fIntensity * m_uBlue;
+
+ // Set render states
+ RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)FALSE);
+ RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)TRUE);
+ RwRenderStateSet(rwRENDERSTATESRCBLEND, (void*)rwBLENDONE);
+ RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDONE);
+ RwRenderStateSet(rwRENDERSTATETEXTUREFILTER, (void*)rwFILTERLINEAR);
+ RwRenderStateSet(rwRENDERSTATETEXTURERASTER, RwTextureGetRaster(gpCoronaTexture[0]));
+ RwRenderStateSet(rwRENDERSTATEZTESTENABLE, (void*)TRUE);
+
+ CVector coronaCoord, screenCoord;
+ float screenW, screenH;
+ for (int i = 1; i < 40; ++i)
+ {
+ for (int j = 0; j < 5; ++j)
+ {
+ coronaCoord.x = m_Position.x + m_Size.x * i;
+ coronaCoord.y = m_Position.y + m_Size.y * i;
+ coronaCoord.z = m_Position.z + m_Size.z * j;
+
+ // Render main coronas
+ if (m_MessageBar[i] & (1 << j))
+ {
+ if (CSprite::CalcScreenCoors(coronaCoord, screenCoord, &screenW, &screenH, true))
+ {
+ CSprite::RenderBufferedOneXLUSprite(
+ screenCoord.x, screenCoord.y, screenCoord.z,
+ screenW * m_fScale, screenH * m_fScale,
+ r, g, b,
+ 255, 1.0f / screenCoord.z, 255);
+ }
+ }
+ // Render smaller and faded coronas for a trailing effect
+ else if (m_MessageBar[i - 1] & (1 << j))
+ {
+ if (CSprite::CalcScreenCoors(coronaCoord, screenCoord, &screenW, &screenH, true))
+ {
+ CSprite::RenderBufferedOneXLUSprite(
+ screenCoord.x, screenCoord.y, screenCoord.z,
+ screenW * m_fScale * 0.8f,
+ screenH * m_fScale * 0.8f,
+ r / 2,
+ g / 2,
+ b / 2,
+ 255, 1.0 / screenCoord.z, 255);
+ }
+ }
+ }
+ }
+
+ CSprite::FlushSpriteBuffer();
+}
+
+// ---------- CTowerClock ----------
+void CTowerClock::Init(CVector position, float sizeX, float sizeY, uint8 red, uint8 green, uint8 blue, float drawDistance, float scale)
+{
+ m_bVisible = false;
+ m_Position = position;
+ m_Size.x = sizeX;
+ m_Size.y = sizeY;
+ m_Size.z = 0.0f;
+ m_uRed = red;
+ m_uGreen = green;
+ m_uBlue = blue;
+ m_fDrawDistance = drawDistance;
+ m_fScale = scale;
+}
+
+void CTowerClock::Update()
+{
+ float distanceFromCamera = (TheCamera.GetPosition() - m_Position).Magnitude();
+ if (distanceFromCamera < m_fDrawDistance)
+ {
+ m_bVisible = true;
+ if (distanceFromCamera < 0.75f * m_fDrawDistance)
+ m_fIntensity = 1.0f;
+ else
+ m_fIntensity = 1.0f - (distanceFromCamera - 0.75f * m_fDrawDistance) * 4.0f / m_fDrawDistance;
+ }
+ else
+ m_bVisible = false;
+}
+
+RwIm3DVertex TempV[4];
+void CTowerClock::Render()
+{
+ if (TheCamera.IsSphereVisible(m_Position, m_fScale))
+ {
+ // Calculate angle for each clock index
+ float angleHour = 2.0f * (float)PI * (CClock::GetMinutes() + 60.0f * CClock::GetHours()) / 720.0f;
+ float angleMinute = 2.0f * (float)PI * (CClock::GetSeconds() + 60.0f * CClock::GetMinutes()) / 3600.0f;
+
+ // Prepare render states
+ RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)TRUE);
+ RwRenderStateSet(rwRENDERSTATEZTESTENABLE, (void*)TRUE);
+ RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)TRUE);
+ RwRenderStateSet(rwRENDERSTATESRCBLEND, (void*)rwBLENDSRCALPHA);
+ RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDINVSRCALPHA);
+ RwRenderStateSet(rwRENDERSTATETEXTUREFILTER, (void*)rwFILTERLINEAR);
+ RwRenderStateSet(rwRENDERSTATETEXTURERASTER, nil);
+
+ // Set vertices colors
+ RwIm3DVertexSetRGBA(&TempV[0], m_uRed, m_uGreen, m_uBlue, (uint8)(m_fIntensity * 255.0f));
+ RwIm3DVertexSetRGBA(&TempV[1], m_uRed, m_uGreen, m_uBlue, (uint8)(m_fIntensity * 255.0f));
+ RwIm3DVertexSetRGBA(&TempV[2], m_uRed, m_uGreen, m_uBlue, (uint8)(m_fIntensity * 255.0f));
+ RwIm3DVertexSetRGBA(&TempV[3], m_uRed, m_uGreen, m_uBlue, (uint8)(m_fIntensity * 255.0f));
+
+ // Set vertices position
+ RwIm3DVertexSetPos(&TempV[0], m_Position.x, m_Position.y, m_Position.z);
+ RwIm3DVertexSetPos(
+ &TempV[1],
+ m_Position.x + Sin(angleMinute) * m_fScale * m_Size.x,
+ m_Position.y + Sin(angleMinute) * m_fScale * m_Size.y,
+ m_Position.z + Cos(angleMinute) * m_fScale;
+ );
+ RwIm3DVertexSetPos(&TempV[2], m_Position.x, m_Position.y, m_Position.z);
+ RwIm3DVertexSetPos(
+ &TempV[3],
+ m_Position.x + Sin(angleHour) * 0.75f * m_fScale * m_Size.x,
+ m_Position.y + Sin(angleHour) * 0.75f * m_fScale * m_Size.y,
+ m_Position.z + Cos(angleHour) * 0.75f * m_fScale;
+ );
+
+ // Stupid thing that does absolutely nothing
+ LittleTest();
+
+ // Draw lines
+ if (RwIm3DTransform(TempV, 4, nil, 0))
+ {
+ RwIm3DRenderLine(0, 1);
+ RwIm3DRenderLine(2, 3);
+ RwIm3DEnd();
+ }
+ }
+}
+
+// ---------- CDigitalClock ----------
+void CDigitalClock::Init(CVector position, float sizeX, float sizeY, uint8 red, uint8 green, uint8 blue, float drawDistance, float scale)
+{
+ m_bVisible = false;
+ m_Position = position;
+ m_Size.x = sizeX;
+ m_Size.y = sizeY;
+ m_Size.z = 0.0f;
+ m_uRed = red;
+ m_uGreen = green;
+ m_uBlue = blue;
+ m_fDrawDistance = drawDistance;
+ m_fScale = scale;
+}
+
+void CDigitalClock::Update()
+{
+ float distanceFromCamera = (TheCamera.GetPosition() - m_Position).Magnitude();
+ if (distanceFromCamera < m_fDrawDistance)
+ {
+ m_bVisible = true;
+ if (distanceFromCamera < 0.75f * m_fDrawDistance)
+ m_fIntensity = 1.0f;
+ else
+ m_fIntensity = 1.0f - (distanceFromCamera - 0.75f * m_fDrawDistance) * 4.0f / m_fDrawDistance;
+ }
+ else
+ m_bVisible = false;
+}
+
+void CDigitalClock::Render()
+{
+ if (TheCamera.IsSphereVisible(m_Position, 5.0f * m_fScale))
+ {
+ CSprite::InitSpriteBuffer();
+
+ // Simulate flicker
+ float currentIntensity = m_fIntensity * CGeneral::GetRandomNumberInRange(0x300, 0x400) / 1024.0f;
+
+ uint8 r = currentIntensity * m_uRed;
+ uint8 g = currentIntensity * m_uGreen;
+ uint8 b = currentIntensity * m_uBlue;
+
+ // Set render states
+ RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)FALSE);
+ RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)TRUE);
+ RwRenderStateSet(rwRENDERSTATESRCBLEND, (void*)rwBLENDONE);
+ RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDONE);
+ RwRenderStateSet(rwRENDERSTATETEXTUREFILTER, (void*)rwFILTERLINEAR);
+ RwRenderStateSet(rwRENDERSTATETEXTURERASTER, RwTextureGetRaster(gpCoronaTexture[0]));
+ RwRenderStateSet(rwRENDERSTATEZTESTENABLE, (void*)TRUE);
+
+ const char* clockMessage = FindDigitalClockMessage();
+
+ CVector coronaCoord, screenCoord;
+ float screenW, screenH;
+ for (int c = 0; c < 5; ++c) // for each char to be displayed
+ {
+ for (int i = 0; i < 5; ++i) // for each column of coronas
+ {
+ for (int j = 0; j < 5; ++j) // for each row of coronas
+ {
+ if (ScrollCharSet[clockMessage[c] - ' '][i] & (1 << j))
+ {
+ coronaCoord.x = m_Position.x + (8 * c + i) * m_Size.x * m_fScale / 8.0f;
+ coronaCoord.y = m_Position.y + (8 * c + i) * m_Size.y * m_fScale / 8.0f;
+ coronaCoord.z = m_Position.z + j * m_fScale / 8.0f;
+
+ if (CSprite::CalcScreenCoors(coronaCoord, screenCoord, &screenW, &screenH, true))
+ {
+ CSprite::RenderBufferedOneXLUSprite(
+ screenCoord.x, screenCoord.y, screenCoord.z,
+ screenW * m_fScale * 0.12,
+ screenW * m_fScale * 0.12,
+ r, g, b,
+ 255,
+ 1.0 / screenCoord.z,
+ 255);
+ }
+ }
+ }
+ }
+ }
+
+ CSprite::FlushSpriteBuffer();
+ }
+}
+
+STARTPATCHES
+InjectHook(0x4FE7C0, &CMovingThings::Init, PATCH_JUMP);
+InjectHook(0x4FF020, &CMovingThings::Shutdown, PATCH_JUMP);
+InjectHook(0x4FF0D0, &CMovingThings::Update, PATCH_JUMP);
+InjectHook(0x4FF210, &CMovingThings::Render, PATCH_JUMP);
+
+InjectHook(0x4FF360, &FindTunnelMessage, PATCH_JUMP);
+InjectHook(0x4FF390, &FindBridgeMessage, PATCH_JUMP);
+InjectHook(0x4FF3C0, &FindTimeMessage, PATCH_JUMP);
+InjectHook(0x4FF450, &FindDigitalClockMessage, PATCH_JUMP);
+
+InjectHook(0x4FF610, &CScrollBar::Init, PATCH_JUMP);
+InjectHook(0x4FF6E0, &CScrollBar::Update, PATCH_JUMP);
+InjectHook(0x4FFCE0, &CScrollBar::Render, PATCH_JUMP);
+
+InjectHook(0x5000D0, &CTowerClock::Init, PATCH_JUMP);
+InjectHook(0x500130, &CTowerClock::Update, PATCH_JUMP);
+InjectHook(0x5001D0, &CTowerClock::Render, PATCH_JUMP);
+
+InjectHook(0x5004F0, &CDigitalClock::Init, PATCH_JUMP);
+InjectHook(0x500550, &CDigitalClock::Update, PATCH_JUMP);
+InjectHook(0x5005F0, &CDigitalClock::Render, PATCH_JUMP);
+ENDPATCHES \ No newline at end of file
diff --git a/src/render/Fluff.h b/src/render/Fluff.h
index 33532efa..f33b016e 100644
--- a/src/render/Fluff.h
+++ b/src/render/Fluff.h
@@ -1,7 +1,91 @@
#pragma once
+#include "common.h"
+#include "math/Vector.h"
class CMovingThings
{
public:
- static void Render(void);
+ static void Init();
+ static void Shutdown();
+ static void Update();
+ static void Render();
};
+
+class CMovingThing
+{
+public:
+ void Update();
+ void AddToList();
+ void RemoveFromList();
+};
+
+class CScrollBar
+{
+private:
+ uint8 m_Counter;
+ const char* m_pMessage;
+ CVector m_Position;
+ uint32 m_MessageCurrentChar;
+ uint32 m_MessageLength;
+ CVector m_Size;
+ float m_fIntensity;
+ uint8 m_MessageBar[40];
+ uint8 m_Type;
+ bool m_bVisible;
+ uint8 m_uRed;
+ uint8 m_uGreen;
+ uint8 m_uBlue;
+ float m_fScale;
+
+public:
+ void SetVisibility(bool visible) { m_bVisible = visible; }
+ bool IsVisible() { return m_bVisible; }
+
+ void Init(CVector, uint8, float, float, float, uint8, uint8, uint8, float);
+ void Update();
+ void Render();
+};
+
+class CTowerClock
+{
+private:
+ CVector m_Position;
+ CVector m_Size;
+ float m_fDrawDistance;
+ float m_fScale;
+ uint8 m_uRed;
+ uint8 m_uGreen;
+ uint8 m_uBlue;
+ bool m_bVisible;
+ float m_fIntensity;
+
+public:
+ void SetVisibility(bool visible) { m_bVisible = visible; }
+ bool IsVisible() { return m_bVisible; }
+
+ void Init(CVector, float, float, uint8, uint8, uint8, float, float);
+ void Update();
+ void Render();
+};
+
+class CDigitalClock
+{
+private:
+ CVector m_Position;
+ CVector m_Size;
+ float m_fDrawDistance;
+ float m_fScale;
+ uint8 m_uRed;
+ uint8 m_uGreen;
+ uint8 m_uBlue;
+ bool m_bVisible;
+ float m_fIntensity;
+
+public:
+ void SetVisibility(bool visible) { m_bVisible = visible; }
+ bool IsVisible() { return m_bVisible; }
+
+ void Init(CVector, float, float, uint8, uint8, uint8, float, float);
+ void Update();
+ void Render();
+}; \ No newline at end of file
diff --git a/src/render/Rubbish.cpp b/src/render/Rubbish.cpp
index 975f2554..c925df1c 100644
--- a/src/render/Rubbish.cpp
+++ b/src/render/Rubbish.cpp
@@ -3,3 +3,4 @@
#include "Rubbish.h"
WRAPPER void CRubbish::Render(void) { EAXJMP(0x512190); }
+WRAPPER void CRubbish::StirUp(CVehicle *veh) { EAXJMP(0x512690); }
diff --git a/src/render/Rubbish.h b/src/render/Rubbish.h
index f4f976e9..9f946dc2 100644
--- a/src/render/Rubbish.h
+++ b/src/render/Rubbish.h
@@ -1,7 +1,10 @@
#pragma once
+class CVehicle;
+
class CRubbish
{
public:
static void Render(void);
+ static void StirUp(CVehicle *veh); // CAutomobile on PS2
};
diff --git a/src/vehicles/Automobile.cpp b/src/vehicles/Automobile.cpp
index 6e31414f..5580ee6d 100644
--- a/src/vehicles/Automobile.cpp
+++ b/src/vehicles/Automobile.cpp
@@ -7,6 +7,7 @@
#include "DMAudio.h"
#include "Camera.h"
#include "Darkel.h"
+#include "Rubbish.h"
#include "Fire.h"
#include "Explosion.h"
#include "World.h"
@@ -24,6 +25,8 @@
#include "Object.h"
#include "Automobile.h"
+bool bAllCarCheat; // unused
+
RwObject *GetCurrentAtomicObjectCB(RwObject *object, void *data);
bool &CAutomobile::m_sAllTaxiLights = *(bool*)0x95CD21;
@@ -102,7 +105,7 @@ CAutomobile::ProcessControl(void)
// Process driver
if(pDriver){
- if(!bHadDriver && m_bombType == 5){
+ if(!bHadDriver && m_bombType == CARBOMB_ONIGNITIONACTIVE){
// If someone enters the car and there is a bomb, detonate
m_nBombTimer = 1000;
m_pBlowUpEntity = field_4DC;
@@ -131,7 +134,7 @@ CAutomobile::ProcessControl(void)
pPassengers[i]->SetObjective(OBJECTIVE_LEAVE_VEHICLE, this);
}
- // CRubbish::StirUp
+ CRubbish::StirUp(this);
// blend in clump
int clumpAlpha = CVisibilityPlugins::GetClumpAlpha((RpClump*)m_rwObject);
@@ -200,9 +203,9 @@ CAutomobile::ProcessControl(void)
CPhysical::ProcessControl();
CCarCtrl::UpdateCarOnRails(this);
- m_nWheelsOnGround_2 = 4;
- m_nWheelsOnGroundPrev = m_nWheelsOnGround;
m_nWheelsOnGround = 4;
+ m_nDriveWheelsOnGroundPrev = m_nDriveWheelsOnGround;
+ m_nDriveWheelsOnGround = 4;
pHandling->Transmission.CalculateGearForSimpleCar(AutoPilot.m_fMaxTrafficSpeed/50.0f, m_nCurrentGear);
@@ -252,13 +255,55 @@ CAutomobile::ProcessControl(void)
break;
}
- if(GetPosition().z < -0.6f){
- assert(0);
- }
+ // what's going on here?
+ if(GetPosition().z < -0.6f &&
+ Abs(m_vecMoveSpeed.x) < 0.05f &&
+ Abs(m_vecMoveSpeed.y) < 0.05f)
+ m_vecTurnSpeed *= Pow(0.95f, CTimer::GetTimeStep());
+ // Skip physics if object is found to have been static recently
bool skipPhysics = false;
- if(!bIsStuck){
- assert(0);
+ if(!bIsStuck && (m_status == STATUS_ABANDONED || m_status == STATUS_WRECKED)){
+ bool makeStatic = false;
+ float moveSpeedLimit, turnSpeedLimit, distanceLimit;
+
+ if(!bVehicleColProcessed &&
+ m_vecMoveSpeed.IsZero() &&
+ // BUG? m_aSuspensionSpringRatioPrev[3] is checked twice in the game. also, why 3?
+ m_aSuspensionSpringRatioPrev[3] != 1.0f)
+ makeStatic = true;
+
+ if(m_status == STATUS_WRECKED){
+ moveSpeedLimit = 0.006f;
+ turnSpeedLimit = 0.0015f;
+ distanceLimit = 0.015f;
+ }else{
+ moveSpeedLimit = 0.003f;
+ turnSpeedLimit = 0.0009f;
+ distanceLimit = 0.005f;
+ }
+
+ m_vecMoveSpeedAvg = (m_vecMoveSpeedAvg + m_vecMoveSpeed)/2.0f;
+ m_vecTurnSpeedAvg = (m_vecTurnSpeedAvg + m_vecTurnSpeed)/2.0f;
+
+ if(m_vecMoveSpeedAvg.MagnitudeSqr() <= sq(moveSpeedLimit*CTimer::GetTimeStep()) &&
+ m_vecTurnSpeedAvg.MagnitudeSqr() <= sq(turnSpeedLimit*CTimer::GetTimeStep()) &&
+ m_fDistanceTravelled < distanceLimit ||
+ makeStatic){
+ m_nStaticFrames++;
+
+ if(m_nStaticFrames > 10 || makeStatic)
+ if(!CCarCtrl::MapCouldMoveInThisArea(GetPosition().x, GetPosition().y)){
+ if(!makeStatic || m_nStaticFrames > 10)
+ m_nStaticFrames = 10;
+
+ skipPhysics = true;
+
+ m_vecMoveSpeed = CVector(0.0f, 0.0f, 0.0f);
+ m_vecTurnSpeed = CVector(0.0f, 0.0f, 0.0f);
+ }
+ }else
+ m_nStaticFrames = 0;
}
// Postpone
@@ -268,15 +313,27 @@ CAutomobile::ProcessControl(void)
return;
}
- // VehicleDamage
+ VehicleDamage(1.0f, 0);
// special control
switch(GetModelIndex()){
case MI_FIRETRUCK:
+ FireTruckControl();
+ break;
case MI_RHINO:
+ TankControl();
+ BlowUpCarsInPath();
+ break;
case MI_YARDIE:
+ // beta also had esperanto here it seems
+ HydraulicControl();
+ break;
default:
- assert(0);
+ if(CVehicle::bCheat3){
+ // strong grip cheat
+ // TODO: make cars jump when horn key is pressed
+ }
+ break;
}
if(skipPhysics){
@@ -402,7 +459,369 @@ CAutomobile::ProcessControl(void)
}
}
- assert(0);
+
+ bool gripCheat = true;
+ fwdSpeed = DotProduct(m_vecMoveSpeed, GetForward());
+ if(!strongGrip1 && !CVehicle::bCheat3)
+ gripCheat = false;
+ float acceleration = pHandling->Transmission.CalculateDriveAcceleration(m_fGasPedal, m_nCurrentGear, m_fChangeGearTime, fwdSpeed, gripCheat);
+ acceleration /= fForceMultiplier;
+
+ // unused
+ if(GetModelIndex() == MI_MIAMI_RCBARON ||
+ GetModelIndex() == MI_MIAMI_RCRAIDER ||
+ GetModelIndex() == MI_MIAMI_SPARROW)
+ acceleration = 0.0f;
+
+ float brake = m_fBrakePedal * pHandling->fBrakeDeceleration * CTimer::GetTimeStep();
+ bool neutralHandling = !!(pHandling->Flags & HANDLING_NEUTRALHANDLING);
+ float brakeBiasFront = neutralHandling ? 1.0f : 2.0f*pHandling->fBrakeBias;
+ float brakeBiasRear = neutralHandling ? 1.0f : 2.0f*(1.0f-pHandling->fBrakeBias);
+ float tractionBiasFront = neutralHandling ? 1.0f : 2.0f*pHandling->fTractionBias;
+ float tractionBiasRear = neutralHandling ? 1.0f : 2.0f*(1.0f-pHandling->fTractionBias);
+
+ // Count how many wheels are touching the ground
+
+ m_nWheelsOnGround = 0;
+ m_nDriveWheelsOnGroundPrev = m_nDriveWheelsOnGround;
+ m_nDriveWheelsOnGround = 0;
+
+ for(i = 0; i < 4; i++){
+ if(m_aSuspensionSpringRatio[i] < 1.0f)
+ m_aWheelTimer[i] = 4.0f;
+ else
+ m_aWheelTimer[i] = max(m_aWheelTimer[i]-CTimer::GetTimeStep(), 0.0f);
+
+ if(m_aWheelTimer[i] > 0.0f){
+ m_nWheelsOnGround++;
+ switch(pHandling->Transmission.nDriveType){
+ case '4':
+ m_nDriveWheelsOnGround++;
+ break;
+ case 'F':
+ if(i == CARWHEEL_FRONT_LEFT || i == CARWHEEL_FRONT_RIGHT)
+ m_nDriveWheelsOnGround++;
+ break;
+ case 'R':
+ if(i == CARWHEEL_REAR_LEFT || i == CARWHEEL_REAR_RIGHT)
+ m_nDriveWheelsOnGround++;
+ break;
+ }
+ }
+ }
+
+ float traction;
+ if(m_status == STATUS_PHYSICS)
+ traction = 0.004f * m_fTraction;
+ else
+ traction = 0.004f;
+ traction *= pHandling->fTractionMultiplier / 4.0f;
+ traction /= fForceMultiplier;
+ if(CVehicle::bCheat3)
+ traction *= 4.0f;
+
+ if(FindPlayerVehicle() && FindPlayerVehicle() == this){
+ if(CPad::GetPad(0)->WeaponJustDown()){
+ if(m_bombType == CARBOMB_TIMED){
+ m_bombType = CARBOMB_TIMEDACTIVE;
+ m_nBombTimer = 7000;
+ m_pBlowUpEntity = FindPlayerPed();
+ CGarages::TriggerMessage("GA_12", -1, 3000, -1);
+ DMAudio.PlayOneShot(m_audioEntityId, SOUND_BOMB_TIMED_ACTIVATED, 1.0f);
+ }else{
+ m_bombType = CARBOMB_ONIGNITIONACTIVE;
+ CGarages::TriggerMessage("GA_12", -1, 3000, -1);
+ DMAudio.PlayOneShot(m_audioEntityId, SOUND_BOMB_ONIGNITION_ACTIVATED, 1.0f);
+ }
+ }
+ }else if(strongGrip1 || CVehicle::bCheat3){
+ traction *= 1.2f;
+ acceleration *= 1.4f;
+ if(strongGrip2 || CVehicle::bCheat3){
+ traction *= 1.3f;
+ acceleration *= 1.4f;
+ }
+ }
+
+ static float fThrust;
+ static tWheelState WheelState[4];
+
+ // Process front wheels on ground
+
+ if(m_aWheelTimer[CARWHEEL_FRONT_LEFT] > 0.0f || m_aWheelTimer[CARWHEEL_FRONT_RIGHT] > 0.0f){
+ float s = Sin(m_fSteerAngle);
+ float c = Cos(m_fSteerAngle);
+ CVector wheelFwd = Multiply3x3(GetMatrix(), CVector(-s, c, 0.0f));
+ CVector wheelRight = Multiply3x3(GetMatrix(), CVector(c, s, 0.0f));
+
+ if(m_aWheelTimer[CARWHEEL_FRONT_LEFT] > 0.0f){
+ if(mod_HandlingManager.HasRearWheelDrive(pHandling->nIdentifier))
+ fThrust = 0.0f;
+ else
+ fThrust = acceleration;
+
+ m_aWheelColPoints[CARWHEEL_FRONT_LEFT].surfaceA = SURFACE_RUBBER29;
+ float adhesion = CSurfaceTable::GetAdhesiveLimit(m_aWheelColPoints[CARWHEEL_FRONT_LEFT])*traction;
+ if(m_status == STATUS_PLAYER)
+ adhesion *= CSurfaceTable::GetWetMultiplier(m_aWheelColPoints[CARWHEEL_FRONT_LEFT].surfaceB);
+ WheelState[CARWHEEL_FRONT_LEFT] = m_aWheelState[CARWHEEL_FRONT_LEFT];
+
+ if(Damage.GetWheelStatus(VEHWHEEL_FRONT_LEFT) == WHEEL_STATUS_BURST)
+ ProcessWheel(wheelFwd, wheelRight,
+ contactSpeeds[CARWHEEL_FRONT_LEFT], contactPoints[CARWHEEL_FRONT_LEFT],
+ m_nWheelsOnGround, fThrust,
+ brake*brakeBiasFront,
+ adhesion*tractionBiasFront*Damage.m_fWheelDamageEffect,
+ CARWHEEL_FRONT_LEFT,
+ &m_aWheelSpeed[CARWHEEL_FRONT_LEFT],
+ &WheelState[CARWHEEL_FRONT_LEFT],
+ WHEEL_STATUS_BURST);
+ else
+ ProcessWheel(wheelFwd, wheelRight,
+ contactSpeeds[CARWHEEL_FRONT_LEFT], contactPoints[CARWHEEL_FRONT_LEFT],
+ m_nWheelsOnGround, fThrust,
+ brake*brakeBiasFront,
+ adhesion*tractionBiasFront,
+ CARWHEEL_FRONT_LEFT,
+ &m_aWheelSpeed[CARWHEEL_FRONT_LEFT],
+ &WheelState[CARWHEEL_FRONT_LEFT],
+ WHEEL_STATUS_OK);
+ }
+
+ if(m_aWheelTimer[CARWHEEL_FRONT_RIGHT] > 0.0f){
+ if(mod_HandlingManager.HasRearWheelDrive(pHandling->nIdentifier))
+ fThrust = 0.0f;
+ else
+ fThrust = acceleration;
+
+ m_aWheelColPoints[CARWHEEL_FRONT_RIGHT].surfaceA = SURFACE_RUBBER29;
+ float adhesion = CSurfaceTable::GetAdhesiveLimit(m_aWheelColPoints[CARWHEEL_FRONT_RIGHT])*traction;
+ if(m_status == STATUS_PLAYER)
+ adhesion *= CSurfaceTable::GetWetMultiplier(m_aWheelColPoints[CARWHEEL_FRONT_RIGHT].surfaceB);
+ WheelState[CARWHEEL_FRONT_RIGHT] = m_aWheelState[CARWHEEL_FRONT_RIGHT];
+
+ if(Damage.GetWheelStatus(VEHWHEEL_FRONT_RIGHT) == WHEEL_STATUS_BURST)
+ ProcessWheel(wheelFwd, wheelRight,
+ contactSpeeds[CARWHEEL_FRONT_RIGHT], contactPoints[CARWHEEL_FRONT_RIGHT],
+ m_nWheelsOnGround, fThrust,
+ brake*brakeBiasFront,
+ adhesion*tractionBiasFront*Damage.m_fWheelDamageEffect,
+ CARWHEEL_FRONT_RIGHT,
+ &m_aWheelSpeed[CARWHEEL_FRONT_RIGHT],
+ &WheelState[CARWHEEL_FRONT_RIGHT],
+ WHEEL_STATUS_BURST);
+ else
+ ProcessWheel(wheelFwd, wheelRight,
+ contactSpeeds[CARWHEEL_FRONT_RIGHT], contactPoints[CARWHEEL_FRONT_RIGHT],
+ m_nWheelsOnGround, fThrust,
+ brake*brakeBiasFront,
+ adhesion*tractionBiasFront,
+ CARWHEEL_FRONT_RIGHT,
+ &m_aWheelSpeed[CARWHEEL_FRONT_RIGHT],
+ &WheelState[CARWHEEL_FRONT_RIGHT],
+ WHEEL_STATUS_OK);
+ }
+ }
+
+ // Process front wheels off ground
+
+ if(m_aWheelTimer[CARWHEEL_FRONT_LEFT] <= 0.0f){
+ if(mod_HandlingManager.HasRearWheelDrive(pHandling->nIdentifier) || acceleration == 0.0f)
+ m_aWheelSpeed[CARWHEEL_FRONT_LEFT] *= 0.95f;
+ else{
+ if(acceleration > 0.0f){
+ if(m_aWheelSpeed[CARWHEEL_FRONT_LEFT] < 2.0f)
+ m_aWheelSpeed[CARWHEEL_FRONT_LEFT] -= 0.2f;
+ }else{
+ if(m_aWheelSpeed[CARWHEEL_FRONT_LEFT] > -2.0f)
+ m_aWheelSpeed[CARWHEEL_FRONT_LEFT] += 0.1f;
+ }
+ }
+ m_aWheelRotation[CARWHEEL_FRONT_LEFT] += m_aWheelSpeed[CARWHEEL_FRONT_LEFT];
+ }
+ if(m_aWheelTimer[CARWHEEL_FRONT_RIGHT] <= 0.0f){
+ if(mod_HandlingManager.HasRearWheelDrive(pHandling->nIdentifier) || acceleration == 0.0f)
+ m_aWheelSpeed[CARWHEEL_FRONT_RIGHT] *= 0.95f;
+ else{
+ if(acceleration > 0.0f){
+ if(m_aWheelSpeed[CARWHEEL_FRONT_RIGHT] < 2.0f)
+ m_aWheelSpeed[CARWHEEL_FRONT_RIGHT] -= 0.2f;
+ }else{
+ if(m_aWheelSpeed[CARWHEEL_FRONT_RIGHT] > -2.0f)
+ m_aWheelSpeed[CARWHEEL_FRONT_RIGHT] += 0.1f;
+ }
+ }
+ m_aWheelRotation[CARWHEEL_FRONT_RIGHT] += m_aWheelSpeed[CARWHEEL_FRONT_RIGHT];
+ }
+
+ // Process rear wheels
+
+ if(m_aWheelTimer[CARWHEEL_REAR_LEFT] > 0.0f || m_aWheelTimer[CARWHEEL_REAR_RIGHT] > 0.0f){
+ CVector wheelFwd = GetForward();
+ CVector wheelRight = GetRight();
+
+ if(bIsHandbrakeOn)
+ brake = 20000.0f;
+
+ if(m_aWheelTimer[CARWHEEL_REAR_LEFT] > 0.0f){
+ if(mod_HandlingManager.HasFrontWheelDrive(pHandling->nIdentifier))
+ fThrust = 0.0f;
+ else
+ fThrust = acceleration;
+
+ m_aWheelColPoints[CARWHEEL_REAR_LEFT].surfaceA = SURFACE_RUBBER29;
+ float adhesion = CSurfaceTable::GetAdhesiveLimit(m_aWheelColPoints[CARWHEEL_REAR_LEFT])*traction;
+ if(m_status == STATUS_PLAYER)
+ adhesion *= CSurfaceTable::GetWetMultiplier(m_aWheelColPoints[CARWHEEL_REAR_LEFT].surfaceB);
+ WheelState[CARWHEEL_REAR_LEFT] = m_aWheelState[CARWHEEL_REAR_LEFT];
+
+ if(Damage.GetWheelStatus(VEHWHEEL_REAR_LEFT) == WHEEL_STATUS_BURST)
+ ProcessWheel(wheelFwd, wheelRight,
+ contactSpeeds[CARWHEEL_REAR_LEFT], contactPoints[CARWHEEL_REAR_LEFT],
+ m_nWheelsOnGround, fThrust,
+ brake*brakeBiasRear,
+ adhesion*tractionBiasRear*Damage.m_fWheelDamageEffect,
+ CARWHEEL_REAR_LEFT,
+ &m_aWheelSpeed[CARWHEEL_REAR_LEFT],
+ &WheelState[CARWHEEL_REAR_LEFT],
+ WHEEL_STATUS_BURST);
+ else
+ ProcessWheel(wheelFwd, wheelRight,
+ contactSpeeds[CARWHEEL_REAR_LEFT], contactPoints[CARWHEEL_REAR_LEFT],
+ m_nWheelsOnGround, fThrust,
+ brake*brakeBiasRear,
+ adhesion*tractionBiasRear,
+ CARWHEEL_REAR_LEFT,
+ &m_aWheelSpeed[CARWHEEL_REAR_LEFT],
+ &WheelState[CARWHEEL_REAR_LEFT],
+ WHEEL_STATUS_OK);
+ }
+
+ if(m_aWheelTimer[CARWHEEL_REAR_RIGHT] > 0.0f){
+ if(mod_HandlingManager.HasFrontWheelDrive(pHandling->nIdentifier))
+ fThrust = 0.0f;
+ else
+ fThrust = acceleration;
+
+ m_aWheelColPoints[CARWHEEL_REAR_RIGHT].surfaceA = SURFACE_RUBBER29;
+ float adhesion = CSurfaceTable::GetAdhesiveLimit(m_aWheelColPoints[CARWHEEL_REAR_RIGHT])*traction;
+ if(m_status == STATUS_PLAYER)
+ adhesion *= CSurfaceTable::GetWetMultiplier(m_aWheelColPoints[CARWHEEL_REAR_RIGHT].surfaceB);
+ WheelState[CARWHEEL_REAR_RIGHT] = m_aWheelState[CARWHEEL_REAR_RIGHT];
+
+ if(Damage.GetWheelStatus(VEHWHEEL_REAR_RIGHT) == WHEEL_STATUS_BURST)
+ ProcessWheel(wheelFwd, wheelRight,
+ contactSpeeds[CARWHEEL_REAR_RIGHT], contactPoints[CARWHEEL_REAR_RIGHT],
+ m_nWheelsOnGround, fThrust,
+ brake*brakeBiasRear,
+ adhesion*tractionBiasRear*Damage.m_fWheelDamageEffect,
+ CARWHEEL_REAR_RIGHT,
+ &m_aWheelSpeed[CARWHEEL_REAR_RIGHT],
+ &WheelState[CARWHEEL_REAR_RIGHT],
+ WHEEL_STATUS_BURST);
+ else
+ ProcessWheel(wheelFwd, wheelRight,
+ contactSpeeds[CARWHEEL_REAR_RIGHT], contactPoints[CARWHEEL_REAR_RIGHT],
+ m_nWheelsOnGround, fThrust,
+ brake*brakeBiasRear,
+ adhesion*tractionBiasRear,
+ CARWHEEL_REAR_RIGHT,
+ &m_aWheelSpeed[CARWHEEL_REAR_RIGHT],
+ &WheelState[CARWHEEL_REAR_RIGHT],
+ WHEEL_STATUS_OK);
+ }
+ }
+
+ // Process rear wheels off ground
+
+ if(m_aWheelTimer[CARWHEEL_REAR_LEFT] <= 0.0f){
+ if(mod_HandlingManager.HasFrontWheelDrive(pHandling->nIdentifier) || acceleration == 0.0f)
+ m_aWheelSpeed[CARWHEEL_REAR_LEFT] *= 0.95f;
+ else{
+ if(acceleration > 0.0f){
+ if(m_aWheelSpeed[CARWHEEL_REAR_LEFT] < 2.0f)
+ m_aWheelSpeed[CARWHEEL_REAR_LEFT] -= 0.2f;
+ }else{
+ if(m_aWheelSpeed[CARWHEEL_REAR_LEFT] > -2.0f)
+ m_aWheelSpeed[CARWHEEL_REAR_LEFT] += 0.1f;
+ }
+ }
+ m_aWheelRotation[CARWHEEL_REAR_LEFT] += m_aWheelSpeed[CARWHEEL_REAR_LEFT];
+ }
+ if(m_aWheelTimer[CARWHEEL_REAR_RIGHT] <= 0.0f){
+ if(mod_HandlingManager.HasFrontWheelDrive(pHandling->nIdentifier) || acceleration == 0.0f)
+ m_aWheelSpeed[CARWHEEL_REAR_RIGHT] *= 0.95f;
+ else{
+ if(acceleration > 0.0f){
+ if(m_aWheelSpeed[CARWHEEL_REAR_RIGHT] < 2.0f)
+ m_aWheelSpeed[CARWHEEL_REAR_RIGHT] -= 0.2f;
+ }else{
+ if(m_aWheelSpeed[CARWHEEL_REAR_RIGHT] > -2.0f)
+ m_aWheelSpeed[CARWHEEL_REAR_RIGHT] += 0.1f;
+ }
+ }
+ m_aWheelRotation[CARWHEEL_REAR_RIGHT] += m_aWheelSpeed[CARWHEEL_REAR_RIGHT];
+ }
+
+ for(i = 0; i < 4; i++){
+ float wheelPos = colModel->lines[i].p0.z;
+ if(m_aSuspensionSpringRatio[i] > 0.0f)
+ wheelPos -= m_aSuspensionSpringRatio[i]*m_aSuspensionLineLength[i];
+ m_aWheelPosition[i] += (wheelPos - m_aWheelPosition[i])*0.75f;
+ }
+ for(i = 0; i < 4; i++)
+ m_aWheelState[i] = WheelState[i];
+
+ // Process horn
+
+ if(m_status != STATUS_PLAYER){
+ ReduceHornCounter();
+ }else{
+ if(GetModelIndex() == MI_MRWHOOP){
+ if(Pads[0].bHornHistory[Pads[0].iCurrHornHistory] &&
+ !Pads[0].bHornHistory[(Pads[0].iCurrHornHistory+4) % 5]){
+ m_bSirenOrAlarm = !m_bSirenOrAlarm;
+ printf("m_bSirenOrAlarm toggled to %d\n", m_bSirenOrAlarm);
+ }
+ }else if(UsesSiren(GetModelIndex())){
+ if(Pads[0].bHornHistory[Pads[0].iCurrHornHistory]){
+ if(Pads[0].bHornHistory[(Pads[0].iCurrHornHistory+4) % 5] &&
+ Pads[0].bHornHistory[(Pads[0].iCurrHornHistory+3) % 5])
+ m_nCarHornTimer = 1;
+ else
+ m_nCarHornTimer = 0;
+ }else if(Pads[0].bHornHistory[(Pads[0].iCurrHornHistory+4) % 5] &&
+ !Pads[0].bHornHistory[(Pads[0].iCurrHornHistory+1) % 5]){
+ m_nCarHornTimer = 0;
+ m_bSirenOrAlarm = !m_bSirenOrAlarm;
+ }else
+ m_nCarHornTimer = 0;
+ }else if(GetModelIndex() != MI_YARDIE && !CVehicle::bCheat3){
+ if(Pads[0].GetHorn())
+ m_nCarHornTimer = 1;
+ else
+ m_nCarHornTimer = 0;
+ }
+ }
+
+ // Flying
+
+ if(m_status != STATUS_PLAYER && m_status != STATUS_PLAYER_REMOTE && m_status != STATUS_PHYSICS){
+ if(GetModelIndex() == MI_MIAMI_RCRAIDER || GetModelIndex() == MI_MIAMI_SPARROW)
+ m_aWheelSpeed[0] = max(m_aWheelSpeed[0]-0.0005f, 0.0f);
+ }else if((GetModelIndex() == MI_DODO || CVehicle::bAllDodosCheat) &&
+ m_vecMoveSpeed.Magnitude() > 0.0f && CTimer::GetTimeStep() > 0.0f){
+ FlyingControl(FLIGHT_MODEL_DODO);
+ }else if(GetModelIndex() == MI_MIAMI_RCBARON){
+ FlyingControl(FLIGHT_MODEL_HELI);
+ }else if(GetModelIndex() == MI_MIAMI_RCRAIDER || GetModelIndex() == MI_MIAMI_SPARROW || bAllCarCheat){
+ if(CPad::GetPad(0)->GetCircleJustDown())
+ m_aWheelSpeed[0] = max(m_aWheelSpeed[0]-0.03f, 0.0f);
+ if(m_aWheelSpeed[0] < 0.22f)
+ m_aWheelSpeed[0] += 0.0001f;
+ if(m_aWheelSpeed[0] > 0.15f)
+ FlyingControl(FLIGHT_MODEL_HELI);
+ }
}
assert(0 && "misc stuff");
@@ -640,6 +1059,27 @@ CAutomobile::ProcessControlInputs(uint8 pad)
}
WRAPPER void
+CAutomobile::FireTruckControl(void)
+{ EAXJMP(0x522590);
+}
+
+WRAPPER void
+CAutomobile::TankControl(void)
+{ EAXJMP(0x53D530);
+}
+
+WRAPPER void
+CAutomobile::HydraulicControl(void)
+{ EAXJMP(0x52D4E0);
+}
+
+WRAPPER void
+CAutomobile::VehicleDamage(float impulse, uint16 damagedPiece)
+{ EAXJMP(0x52F390);
+}
+
+
+WRAPPER void
CAutomobile::ProcessBuoyancy(void)
{ EAXJMP(0x5308D0);
}
@@ -900,6 +1340,7 @@ CAutomobile::BlowUpCar(CEntity *culprit)
SetDoorDamage(CAR_DOOR_LR, DOOR_REAR_LEFT);
SetDoorDamage(CAR_DOOR_RR, DOOR_REAR_RIGHT);
SpawnFlyingComponent(CAR_WHEEL_LF, COMPGROUP_WHEEL);
+ atomic = nil;
RwFrameForAllObjects(m_aCarNodes[CAR_WHEEL_LF], GetCurrentAtomicObjectCB, &atomic);
if(atomic)
RpAtomicSetFlags(atomic, 0);
@@ -907,7 +1348,7 @@ CAutomobile::BlowUpCar(CEntity *culprit)
m_fHealth = 0.0f;
m_nBombTimer = 0;
- m_bombType = 0;
+ m_bombType = CARBOMB_NONE;
TheCamera.CamShake(0.7f, GetPosition().x, GetPosition().y, GetPosition().z);
@@ -1056,9 +1497,9 @@ CAutomobile::ResetSuspension(void)
int i;
for(i = 0; i < 4; i++){
m_aSuspensionSpringRatio[i] = 1.0f;
- m_aWheelSkidThing[i] = 0.0f;
+ m_aWheelTimer[i] = 0.0f;
m_aWheelRotation[i] = 0.0f;
- m_aWheelState[i] = 0; // TODO: enum?
+ m_aWheelState[i] = WHEEL_STATE_0;
}
}
@@ -1561,7 +2002,7 @@ CAutomobile::SetTaxiLight(bool light)
bool
CAutomobile::GetAllWheelsOffGround(void)
{
- return m_nWheelsOnGround == 0;
+ return m_nDriveWheelsOnGround == 0;
}
void
diff --git a/src/vehicles/Automobile.h b/src/vehicles/Automobile.h
index 6ed5e154..69df9bb3 100644
--- a/src/vehicles/Automobile.h
+++ b/src/vehicles/Automobile.h
@@ -6,11 +6,24 @@
class CObject;
-// Wheels are in order:
-// FRONT LEFT
-// REAR LEFT
-// FRONT RIGHT
-// REAR RIGHT
+// These are used for all the wheel arrays
+// DON'T confuse with VEHWHEEL, which are vehicle components
+enum {
+ CARWHEEL_FRONT_LEFT,
+ CARWHEEL_REAR_LEFT,
+ CARWHEEL_FRONT_RIGHT,
+ CARWHEEL_REAR_RIGHT
+};
+
+enum eBombType
+{
+ CARBOMB_NONE,
+ CARBOMB_TIMED,
+ CARBOMB_ONIGNITION,
+ CARBOMB_REMOTE,
+ CARBOMB_TIMEDACTIVE,
+ CARBOMB_ONIGNITIONACTIVE,
+};
class CAutomobile : public CVehicle
{
@@ -22,7 +35,7 @@ public:
CColPoint m_aWheelColPoints[4];
float m_aSuspensionSpringRatio[4];
float m_aSuspensionSpringRatioPrev[4];
- float m_aWheelSkidThing[4];
+ float m_aWheelTimer[4]; // set to 4.0 when wheel is touching ground, then decremented
float field_49C;
bool m_aWheelSkidmarkMuddy[4];
bool m_aWheelSkidmarkBloody[4];
@@ -44,7 +57,7 @@ public:
float m_aSuspensionSpringLength[4];
float m_aSuspensionLineLength[4];
float m_fHeightAboveRoad;
- float m_fImprovedHandling;
+ float m_fTraction;
uint8 stuff6[28];
float field_530;
CPhysical *m_aGroundPhysical[4]; // physicals touching wheels
@@ -56,11 +69,11 @@ public:
float m_fCarGunUD;
float m_fWindScreenRotation;
uint8 stuff4[4];
- uint8 m_nWheelsOnGround_2;
uint8 m_nWheelsOnGround;
- uint8 m_nWheelsOnGroundPrev;
+ uint8 m_nDriveWheelsOnGround;
+ uint8 m_nDriveWheelsOnGroundPrev;
uint8 stuff5[5];
- int32 m_aWheelState[4];
+ tWheelState m_aWheelState[4];
static bool &m_sAllTaxiLights;
@@ -95,6 +108,10 @@ public:
float GetHeightAboveRoad(void);
void PlayCarHorn(void);
+ void FireTruckControl(void);
+ void TankControl(void);
+ void HydraulicControl(void);
+ void VehicleDamage(float impulse, uint16 damagedPiece);
void ProcessBuoyancy(void);
void DoDriveByShootings(void);
int32 RcbanditCheckHitWheels(void);
diff --git a/src/vehicles/DamageManager.h b/src/vehicles/DamageManager.h
index f2044ec2..ee1297d9 100644
--- a/src/vehicles/DamageManager.h
+++ b/src/vehicles/DamageManager.h
@@ -66,7 +66,7 @@ class CDamageManager
{
public:
- float field_0;
+ float m_fWheelDamageEffect;
uint8 m_engineStatus;
uint8 m_wheelStatus[4];
uint8 m_doorStatus[6];
diff --git a/src/vehicles/HandlingMgr.cpp b/src/vehicles/HandlingMgr.cpp
index 9bcaaf81..4d3a94a8 100644
--- a/src/vehicles/HandlingMgr.cpp
+++ b/src/vehicles/HandlingMgr.cpp
@@ -127,7 +127,7 @@ cHandlingDataMgr::LoadHandlingData(void)
handlingId = FindExactWord(word, (const char*)VehicleNames, 14, NUMHANDLINGS);
assert(handlingId >= 0 && handlingId < NUMHANDLINGS);
handling = &HandlingData[handlingId];
- handling->nIdentifier = handlingId;
+ handling->nIdentifier = (eHandlingId)handlingId;
break;
case 1: handling->fMass = strtod(word, nil); break;
case 2: handling->Dimension.x = strtod(word, nil); break;
diff --git a/src/vehicles/HandlingMgr.h b/src/vehicles/HandlingMgr.h
index 7d8613da..70f1c005 100644
--- a/src/vehicles/HandlingMgr.h
+++ b/src/vehicles/HandlingMgr.h
@@ -85,7 +85,7 @@ enum
struct tHandlingData
{
- int32 nIdentifier;
+ eHandlingId nIdentifier;
float fMass;
float fInvMass;
float fTurnMass;
@@ -136,6 +136,8 @@ public:
void ConvertDataToGameUnits(tHandlingData *handling);
int32 GetHandlingId(const char *name);
tHandlingData *GetHandlingData(eHandlingId id) { return &HandlingData[id]; }
+ bool HasRearWheelDrive(eHandlingId id) { return HandlingData[id].Transmission.nDriveType == 'R'; }
+ bool HasFrontWheelDrive(eHandlingId id) { return HandlingData[id].Transmission.nDriveType == 'F'; }
};
VALIDATE_SIZE(cHandlingDataMgr, 0x3030);
extern cHandlingDataMgr &mod_HandlingManager;
diff --git a/src/vehicles/Transmission.cpp b/src/vehicles/Transmission.cpp
index f8c345f1..d500d004 100644
--- a/src/vehicles/Transmission.cpp
+++ b/src/vehicles/Transmission.cpp
@@ -1,5 +1,7 @@
#include "common.h"
#include "patcher.h"
+#include "Timer.h"
+#include "HandlingMgr.h"
#include "Transmission.h"
void
@@ -39,7 +41,9 @@ cTransmission::InitGearRatios(void)
void
cTransmission::CalculateGearForSimpleCar(float speed, uint8 &gear)
{
- static tGear *pGearRatio = &Gears[gear];
+ static tGear *pGearRatio;
+
+ pGearRatio = &Gears[gear];
fCurVelocity = speed;
if(speed > pGearRatio->fShiftUpVelocity)
gear++;
@@ -50,3 +54,90 @@ cTransmission::CalculateGearForSimpleCar(float speed, uint8 &gear)
gear--;
}
}
+
+float
+cTransmission::CalculateDriveAcceleration(const float &gasPedal, uint8 &gear, float &time, const float &velocity, bool cheat)
+{
+ static float fAcceleration = 0.0f;
+ static float fVelocity;
+ static float fCheat;
+ static tGear *pGearRatio;
+
+ fVelocity = velocity;
+ if(fVelocity < fMaxReverseVelocity){
+ fVelocity = fMaxReverseVelocity;
+ return 0.0f;
+ }
+ if(fVelocity > fMaxVelocity){
+ fVelocity = fMaxVelocity;
+ return 0.0f;
+ }
+ fCurVelocity = fVelocity;
+
+ assert(gear <= nNumberOfGears);
+
+ pGearRatio = &Gears[gear];
+ if(fVelocity > pGearRatio->fShiftUpVelocity){
+ if(gear != 0 || gasPedal > 0.0f){
+ gear++;
+ time = 0.0f;
+ return CalculateDriveAcceleration(gasPedal, gear, time, fVelocity, false);
+ }
+ }else if(fVelocity < pGearRatio->fShiftDownVelocity && gear != 0){
+ if(gear != 1 || gasPedal < 0.0f){
+ gear--;
+ time = 0.0f;
+ return CalculateDriveAcceleration(gasPedal, gear, time, fVelocity, false);
+ }
+ }
+
+ if(time > 0.0f){
+ // changing gears currently, can't accelerate
+ fAcceleration = 0.0f;
+ time -= CTimer::GetTimeStepInSeconds();
+ }else{
+ float speedMul, accelMul;
+
+ if(gear < 1){
+ // going reverse
+ accelMul = (Flags & HANDLING_2G_BOOST) ? 2.0f : 1.0f;
+ speedMul = -1.0f;
+ }else if(nNumberOfGears == 1){
+ accelMul = 1.0f;
+ speedMul = 1.0f;
+ }else{
+ // BUG or not? this is 1.0 normally but 0.0 in the highest gear
+ float f = 1.0f - (gear-1)/(nNumberOfGears-1);
+ speedMul = 3.0f*sq(f) + 1.0f;
+ // This is pretty ugly, could be written more clearly
+ if(Flags & HANDLING_2G_BOOST){
+ if(gear == 1)
+ accelMul = (Flags & HANDLING_1G_BOOST) ? 3.0f : 2.0f;
+ else if(gear == 2)
+ accelMul = 1.3f;
+ else
+ accelMul = 1.0f;
+ }else if(Flags & HANDLING_1G_BOOST && gear == 1){
+ accelMul = 3.0f;
+ }else
+ accelMul = 1.0f;
+ }
+
+ if(cheat)
+ fCheat = 1.2f;
+ else
+ fCheat = 1.0f;
+ float targetVelocity = Gears[gear].fMaxVelocity*speedMul*fCheat;
+ float accel = fEngineAcceleration*accelMul * (targetVelocity - fVelocity)/Abs(targetVelocity);
+ if(Abs(fVelocity) < Abs(Gears[gear].fMaxVelocity*fCheat))
+ fAcceleration = gasPedal * accel * CTimer::GetTimeStep();
+ else
+ fAcceleration = 0.0f;
+ }
+ return fAcceleration;
+}
+
+STARTPATCHES
+ InjectHook(0x550A00, &cTransmission::CalculateGearForSimpleCar, PATCH_JUMP);
+ InjectHook(0x5506B0, &cTransmission::CalculateDriveAcceleration, PATCH_JUMP);
+ENDPATCHES
diff --git a/src/vehicles/Transmission.h b/src/vehicles/Transmission.h
index ea67b62c..8eeef1e8 100644
--- a/src/vehicles/Transmission.h
+++ b/src/vehicles/Transmission.h
@@ -24,4 +24,5 @@ public:
void InitGearRatios(void);
void CalculateGearForSimpleCar(float speed, uint8 &gear);
+ float CalculateDriveAcceleration(const float &gasPedal, uint8 &gear, float &time, const float &velocity, bool cheat);
};
diff --git a/src/vehicles/Vehicle.cpp b/src/vehicles/Vehicle.cpp
index ea5dea73..e521a699 100644
--- a/src/vehicles/Vehicle.cpp
+++ b/src/vehicles/Vehicle.cpp
@@ -35,7 +35,7 @@ CVehicle::CVehicle(uint8 CreatedBy)
int i;
m_nCurrentGear = 0;
- field_208 = 0;
+ m_fChangeGearTime = 0;
m_fSteerRatio = 0.0f;
m_type = ENTITY_TYPE_VEHICLE;
VehicleCreatedBy = CreatedBy;
@@ -380,7 +380,7 @@ CVehicle::ProcessDelayedExplosion(void)
else
m_nBombTimer -= tick;
- if(IsCar() && ((CAutomobile*)this)->m_bombType == 4 && (m_nBombTimer & 0xFE00) != 0xFE00)
+ if(IsCar() && ((CAutomobile*)this)->m_bombType == CARBOMB_TIMEDACTIVE && (m_nBombTimer & 0xFE00) != 0xFE00)
DMAudio.PlayOneShot(m_audioEntityId, SOUND_CAR_BOMB_TICK, 0.0f);
if (m_nBombTimer != 0)
diff --git a/src/vehicles/Vehicle.h b/src/vehicles/Vehicle.h
index b37ea84d..de74264b 100644
--- a/src/vehicles/Vehicle.h
+++ b/src/vehicles/Vehicle.h
@@ -191,7 +191,7 @@ public:
float m_fHealth; // 1000.0f = full health. 0 -> explode
uint8 m_nCurrentGear;
int8 field_205[3];
- int field_208;
+ float m_fChangeGearTime;
uint32 m_nGunFiringTime; // last time when gun on vehicle was fired (used on boats)
uint32 m_nTimeOfDeath;
int16 field_214;