TR5

Heavily based on the TR4 savegame format

struct TR5Savegame
{
    uint8_t levelName[75]; // CP437 C string; null-terminated (data after \0 is ignored)
    int32_t saveNumber;
    uint16_t days;
    uint16_t hours;
    uint16_t minutes;
    uint16_t seconds;
    struct {
        int16_t item_number;
        int16_t gun_status;
        int16_t gun_type;
        int16_t request_gun_type;
        int16_t last_gun_type;
        int16_t calc_fallspeed;
        int16_t water_status;
        int16_t climb_status;
        int16_t pose_count;
        int16_t hit_frame;
        int16_t hit_direction;
        int16_t air;
        int16_t dive_count;
        int16_t death_count;
        int16_t current_active;
        int16_t current_xvel;
        int16_t current_yvel;
        int16_t current_zvel;
        int16_t spaz_effect_count;
        int16_t flare_age;
        int16_t BurnCount;
        int16_t weapon_item;
        int16_t back_gun;
        int16_t flare_frame;
        int16_t poisoned;
        int16_t dpoisoned;
        uint8_t Anxiety;
        uint8_t wet[15];
        uint16_t flare_control_left : 1;
        uint16_t Unused1 : 1;
        uint16_t look : 1;
        uint16_t burn : 1;
        uint16_t keep_ducked : 1;
        uint16_t IsMoving : 1;
        uint16_t CanMonkeySwing : 1;
        uint16_t BurnBlue : 2;
        uint16_t Gassed : 1;
        uint16_t BurnSmoke : 1;
        uint16_t IsDucked : 1;
        uint16_t has_fired : 1;
        uint16_t Busy : 1;
        uint16_t LitTorch : 1;
        uint16_t IsClimbing : 1;
        uint16_t Fired : 1;
        int32_t water_surface_dist;
        struct PHD_VECTOR last_pos;
        struct FX_INFO* spaz_effect;
        int mesh_effects;
        int16_t* mesh_ptrs[15];
        struct ITEM_INFO* target;
        int16_t target_angles[2];
        int16_t turn_rate;
        int16_t move_angle;
        int16_t head_y_rot;
        int16_t head_x_rot;
        int16_t head_z_rot;
        int16_t torso_y_rot;
        int16_t torso_x_rot;
        int16_t torso_z_rot;
        struct lara_arm left_arm;
        struct lara_arm right_arm;
        uint16_t holster;
        struct creature_info* creature;
        int32_t CornerX;
        int32_t CornerZ;
        int8_t RopeSegment;
        int8_t RopeDirection;
        int16_t RopeArcFront;
        int16_t RopeArcBack;
        int16_t RopeLastX;
        int16_t RopeMaxXForward;
        int16_t RopeMaxXBackward;
        int32_t RopeDFrame;
        int32_t RopeFrame;
        uint16_t RopeFrameRate;
        uint16_t RopeY;
        int32_t RopePtr;
        void* GeneralPtr;
        int RopeOffset;
        uint32_t RopeDownVel;
        int8_t RopeFlag;
        int8_t MoveCount;
        int RopeCount;
        int8_t skelebob;
        int8_t pistols_type_carried;
        int8_t uzis_type_carried;
        int8_t shotgun_type_carried;
        int8_t crossbow_type_carried;
        int8_t hk_type_carried;
        int8_t sixshooter_type_carried;
        int8_t lasersight;
        int8_t silencer;
        int8_t binoculars;
        int8_t crowbar;
        int8_t examine1;
        int8_t examine2;
        int8_t examine3;
        int8_t wetcloth;
        int8_t bottle;
        int8_t puzzleitems[12];
        uint16_t puzzleitemscombo;
        uint16_t keyitems;
        uint16_t keyitemscombo;
        uint16_t pickupitems;
        uint16_t pickupitemscombo;
        int16_t num_small_medipack;
        int16_t num_large_medipack;
        int16_t num_flares;
        int16_t num_pistols_ammo;
        int16_t num_uzi_ammo;
        int16_t num_revolver_ammo;
        int16_t num_shotgun_ammo1;
        int16_t num_shotgun_ammo2;
        int16_t num_hk_ammo1;
        int16_t num_crossbow_ammo1;
        int16_t num_crossbow_ammo2;
        int8_t location;
        int8_t highest_location;
        int8_t locationPad;
        uint8_t TightRopeOnCount;
        uint8_t TightRopeOff;
        uint8_t TightRopeFall;
        uint8_t ChaffTimer;
    } lara;   
 
    struct 
    {
        uint32_t timer; // in game ticks (1/30th of a second), so divide by 30 for time in seconds
        uint32_t distance; // Divide by 419.007 for value in meters
        uint32_t ammoUsed; 
        uint32_t ammoHits;
        uint16_t kills;
        uint8_t secrets;
        uint8_t healthUsed;
    } levelStats, gameStats; 
    int16_t weaponObject;
    int16_t weaponAnim;
    int16_t weaponFrame;
    int16_t weaponCurrent;
    int16_t weaponGoal;
    uint32_t cutSceneTriggered1;
    uint32_t cutSceneTriggered2;
    int8_t gameComplete;
    uint8_t currentLevel;
    uint8_t campaignSecrets[4];
    uint8_t tlCount;
};