summaryrefslogtreecommitdiff
path: root/src/vehicles/Train.h
diff options
context:
space:
mode:
authorclaude-bot <[email protected]>2026-07-13 12:27:07 +0000
committerclaude-bot <[email protected]>2026-07-13 12:27:07 +0000
commit9f61c9e6ac6b1ac5692cf6352d2ebbd47a31a686 (patch)
treea84756b82513739a2672db3a1f0ec579db6d18ff /src/vehicles/Train.h
downloadre3-miami.tar.gz
re3-miami.zip
Import Cai1Hsu/re3 @ miami (reVC / GTA:VC decompilation)HEADmiami
Snapshot import (no upstream history) into git.ancap.in.ua/claude, per @lzcnt. Source: https://github.com/Cai1Hsu/re3 branch miami.
Diffstat (limited to 'src/vehicles/Train.h')
-rw-r--r--src/vehicles/Train.h84
1 files changed, 84 insertions, 0 deletions
diff --git a/src/vehicles/Train.h b/src/vehicles/Train.h
new file mode 100644
index 0000000..57cd28d
--- /dev/null
+++ b/src/vehicles/Train.h
@@ -0,0 +1,84 @@
+#pragma once
+
+#include "Vehicle.h"
+#include "Door.h"
+
+enum
+{
+ TRACK_ELTRAIN,
+ TRACK_SUBWAY
+};
+
+enum
+{
+ TRAIN_DOOR_CLOSED,
+ TRAIN_DOOR_OPENING,
+ TRAIN_DOOR_OPEN,
+ TRAIN_DOOR_CLOSING
+};
+
+enum eTrainNodes
+{
+ TRAIN_DOOR_LHS = 1,
+ TRAIN_DOOR_RHS,
+ NUM_TRAIN_NODES
+};
+
+struct CTrainNode
+{
+ CVector p; // position
+ float t; // xy-distance from start on track
+};
+
+struct CTrainInterpolationLine
+{
+ uint8 type;
+ float time; // when does this keyframe start
+ // initial values at start of frame
+ float position;
+ float speed;
+ float acceleration;
+};
+
+class CTrain : public CVehicle
+{
+public:
+ // 0x288
+ float m_fWagonPosition;
+ int16 m_nWagonId;
+ int16 m_isFarAway; // don't update so often?
+ int16 m_nCurTrackNode;
+ int16 m_nWagonGroup;
+ float m_fSpeed;
+ bool m_bProcessDoor;
+ bool m_bTrainStopping;
+ bool m_bIsFirstWagon;
+ bool m_bIsLastWagon;
+ uint8 m_nTrackId; // or m_bUsesSubwayTracks?
+ uint32 m_nDoorTimer;
+ int16 m_nDoorState;
+ CTrainDoor Doors[2];
+ RwFrame *m_aTrainNodes[NUM_TRAIN_NODES];
+
+ // unused
+ static CVector aStationCoors[3];
+ static CVector aStationCoors_S[4];
+
+ CTrain(int32 id, uint8 CreatedBy);
+
+ // from CEntity
+ void SetModelIndex(uint32 id);
+ void ProcessControl(void);
+ void PreRender(void);
+ void Render(void);
+
+ void AddPassenger(CPed *ped);
+ void OpenTrainDoor(float ratio);
+ void TrainHitStuff(CPtrList &list);
+
+ static void InitTrains(void);
+ static void Shutdown(void);
+ static void ReadAndInterpretTrackFile(Const char *filename, CTrainNode **nodes, int16 *numNodes, int32 numStations, float *stationDists,
+ float *totalLength, float *totalDuration, CTrainInterpolationLine *interpLines, bool rightRail);
+ static void UpdateTrains(void);
+};