diff options
author | aap <aap@papnet.eu> | 2019-07-29 19:18:03 +0200 |
---|---|---|
committer | aap <aap@papnet.eu> | 2019-07-31 14:33:27 +0200 |
commit | 5f6b235301f734b73f8307cf3e29997e7f76eac8 (patch) | |
tree | 73037842a302ae6e888e365b32e8ce74287e3f8d /src/vehicles/Train.h | |
parent | Merge pull request #175 from erorcun/erorcun (diff) | |
parent | restore original shadows fading (diff) | |
download | re3-5f6b235301f734b73f8307cf3e29997e7f76eac8.tar re3-5f6b235301f734b73f8307cf3e29997e7f76eac8.tar.gz re3-5f6b235301f734b73f8307cf3e29997e7f76eac8.tar.bz2 re3-5f6b235301f734b73f8307cf3e29997e7f76eac8.tar.lz re3-5f6b235301f734b73f8307cf3e29997e7f76eac8.tar.xz re3-5f6b235301f734b73f8307cf3e29997e7f76eac8.tar.zst re3-5f6b235301f734b73f8307cf3e29997e7f76eac8.zip |
Diffstat (limited to 'src/vehicles/Train.h')
-rw-r--r-- | src/vehicles/Train.h | 90 |
1 files changed, 79 insertions, 11 deletions
diff --git a/src/vehicles/Train.h b/src/vehicles/Train.h index 5e1e2e35..84b53537 100644 --- a/src/vehicles/Train.h +++ b/src/vehicles/Train.h @@ -1,25 +1,93 @@ #pragma once -#include "common.h" -#include "patcher.h" #include "Vehicle.h" +#include "Door.h" enum { - TRAIN_DOOR_STATE2 = 2 + 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 +}; + +enum eTrainPositions +{ + TRAIN_POS_LIGHT_FRONT, + TRAIN_POS_LIGHT_REAR, + TRAIN_POS_LEFT_ENTRY, + TRAIN_POS_MID_ENTRY, + TRAIN_POS_RIGHT_ENTRY +}; + +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 - uint8 stuff1[20]; - uint8 m_trackId; - uint8 stuff2[7]; - int16 m_doorState; - uint8 stuff3[62]; - - CTrain(int, uint8); - CTrain* ctor(int, uint8); + 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[3]; + + // 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(char *filename, CTrainNode **nodes, int16 *numNodes, int32 numStations, float *stationDists, + float *totalLength, float *totalDuration, CTrainInterpolationLine *interpLines, bool rightRail); + static void UpdateTrains(void); }; static_assert(sizeof(CTrain) == 0x2E4, "CTrain: error"); |