Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
trs:savegame:tr1 [2017/03/25 17:01] zdimensiontrs:savegame:tr1 [2021/07/15 05:00] (current) – update savegame format with new discoveries stohrendorf
Line 1: Line 1:
 ====== TR1 ====== ====== TR1 ======
 +
 +<note tip>When loading a save game, classic TR games read the name and number and then load everything after that directly into the game RAM, without checking anything. That's why savegames from original versions don't work in multipatched versions (and make the game crash). It also makes the "struct-ification" of the format very hard, as it would need decompiling the whole game (which is already being done for TR1 by some awesome people). The way the game works also makes the savegames extremely level-dependent, at least for the entity info part (which is yet to be documented here) as when creating a new game, the game simply loads the level data in RAM, and when saving it writes that down in a file. Understanding a savegame file completely therefore requires having the original level file the savegame is for.</note>
  
 <code cpp> <code cpp>
Line 7: Line 9:
     uint32_t saveNumber; // game clips it to 16 bits     uint32_t saveNumber; // game clips it to 16 bits
     uint8_t unknown2[15];     uint8_t unknown2[15];
-    // First level use block 0, second use block 1... so that at the end of the game, +    // First level use block 0, second use block 1... so that at the end of the game,
     // it sums up everything and/or checks if you found all secrets, etc     // it sums up everything and/or checks if you found all secrets, etc
     struct     struct
     {     {
-        uint16_t header; // Always 0x3E8+        uint16_t ammoPistols; // Always 1000
         uint16_t ammoMagnums; // 65,535 means unlimited         uint16_t ammoMagnums; // 65,535 means unlimited
         uint16_t ammoUzis;         uint16_t ammoUzis;
Line 20: Line 22:
         /* 0 None         /* 0 None
          * 1 Climbing          * 1 Climbing
-         * 2 ? +         * 2 Draw weapon 
-         * 3 Single shot.? +         * 3 Holster weapon 
-         * 4 Combat?+         * 4 Combat (i.e. holding a weapon)
          */          */
         uint8_t handStatus;         uint8_t handStatus;
Line 31: Line 33:
          * 4 Shotgun          * 4 Shotgun
          */          */
-        uint8_t weapon; // current held weapon +        uint8_t weapon; // current held weapon
         /* 00000001 Level unlocked         /* 00000001 Level unlocked
          * 00000010 Pistols          * 00000010 Pistols
Line 39: Line 41:
          * 00100000 Midas Hand          * 00100000 Midas Hand
          */          */
-        uint8_t weapons+        uint8_t flags
-        uint8_t unknown2+        uint8_t _padding
-    } levelInitData[21]; // for the 21 levels (315 bytes) +    } levelInitData[21]; // for the 21 levels (315 bytes)
     uint32_t elapsedTime; // in game ticks (1/30th of a second), so divide by 30 for time in seconds     uint32_t elapsedTime; // in game ticks (1/30th of a second), so divide by 30 for time in seconds
     uint32_t kills;     uint32_t kills;
-    uint16_t secretsFound;+    uint16_t secretsFound; // bitmask of the discovered secrets of the current level
     uint16_t levelNumber; // First level = 1     uint16_t levelNumber; // First level = 1
     uint8_t numPickups;     uint8_t numPickups;
Line 50: Line 52:
     uint8_t hasItem141; // From decompiled game source.     uint8_t hasItem141; // From decompiled game source.
     uint8_t hasItem142; // Strangely, those (unknown) items aren't present in any official TR1 level     uint8_t hasItem142; // Strangely, those (unknown) items aren't present in any official TR1 level
-    uint8_t puzzle[4];+    uint8_t puzzles[4];
     uint8_t keys[4];     uint8_t keys[4];
-    uint8_t pickup// the pickup item+    uint8_t leadBar;
     uint8_t levelInitDataCRC; // not implemented, always 0     uint8_t levelInitDataCRC; // not implemented, always 0
     // 10240 bytes starting from now     // 10240 bytes starting from now
     uint8_t roomsAreSwapped;     uint8_t roomsAreSwapped;
-    uint8_t flipFlags[10]; // = (FlipFlag & 0xFF00) >> 8 +    uint8_t flipFlags[10]; // = (FlipFlag & 0xFF00)>>
-    uint16_t cameraFlagsZoneIndexes[cameraCount];+    uint16_t cameraFlagsZoneIndices[cameraCount];
     // items block here todo     // items block here todo
-#pragma pack(push, 8)  +#pragma pack(push, 8)
     struct     struct
     {     {
Line 65: Line 67:
         int16_t handStatus;         int16_t handStatus;
         WeaponID currentWeapon;         WeaponID currentWeapon;
-        int16_t nextWeapon;+        WeaponID requestedWeapon;
         int16_t climbFallSpeedOverride;         int16_t climbFallSpeedOverride;
         int16_t underwaterState;         int16_t underwaterState;
Line 71: Line 73:
         int16_t collisionFrame;         int16_t collisionFrame;
         int16_t collisionAxis;         int16_t collisionAxis;
-        int16_t air; +        int16_t air; // game ticks of air left 
-        int16_t swimToDiveKeypressDuration; +        int16_t swimToDiveKeypressDuration; // game ticks 
-        int16_t deadTime;+        int16_t deadTime; // game ticks
         int16_t underwaterCurrentStrength;         int16_t underwaterCurrentStrength;
-        int16_t unknown2+        int16_t spasmEffectCounter// e.g. when Lara is hit by lightning 
-        Vertex4 *wallPosition;+        Vertex4 *spasmSource// from which direction Lara is hit
 #pragma pack(push, 1) #pragma pack(push, 1)
         struct MeshTree         struct MeshTree
Line 85: Line 87:
 #pragma pack(pop) #pragma pack(pop)
         ITEM *enemy;         ITEM *enemy;
-        Vertex2YX enemyLookRot;+        Vertex2YX weaponTargetVector;
         int16_t yRotationSpeed;         int16_t yRotationSpeed;
         int16_t movementAngle;         int16_t movementAngle;
Line 113: Line 115:
     } lara; // 236 bytes     } lara; // 236 bytes
 #pragma pack(pop) #pragma pack(pop)
-    int32_t postFxFunc; // this is usually 0xFFFFFFFF (and the last occurence of that in the file) so you can align it to that (replace the items blocks above by a filler block) so that Lara is aligned to postFxFunc+    int32_t postFxFunc; // this is usually -1 (and the last occurence of that in the file) so you can align it to that (replace the items blocks above by a filler block) so that Lara is aligned to postFxFunc
     int32_t animFxTime;     int32_t animFxTime;
 }; };
Line 170: Line 172:
 }; };
 #pragma pack(pop) #pragma pack(pop)
 +
 </code> </code>
-<note tip>The ''%%xxxxCount%%'' values are available in the table below.</note> 
- 
  
 +<note tip>The ''<nowiki>xxxxCount</nowiki>'' values are available in the table below.</note>
 ===== Identifications ===== ===== Identifications =====
  
 ==== Levels ==== ==== Levels ====
  
-^ ID ^ Level ^ Filename ^ Camera count ^ Items ^  Secrets ^ Puzzle ^^^^ Key ^^^^ +^ID^Level^Filename^Camera count^Items^  Secrets^Puzzle^^^^Key^^^| 
-::: ::: ::: ::: ::: ::: ^ 1 ^ 2 ^ 3 ^ 4 ^ 1 ^ 2 ^ 3 ^ 4 ^ +::: ::: ::: ::: ::: ::: ^1^2^3^4^1^2^3^4| 
-|  0 |  Lara's Home  |  ''%%GYM%%''  |  1 |  1 |  0 |         +|  0|  Lara's Home  |  ''<nowiki>GYM</nowiki>''    |  1|  1|  0|                 
-|  1 |  Caves  |  ''%%LEVEL1%%''  |  2 |  60 |  3 |         +|  1|  Caves  |  ''<nowiki>LEVEL1</nowiki>''    |  2|  60|  3|                 
-|  2 |  City of Vilcabamba  |  ''%%LEVEL2%%''  |  6 |  95 |  3 |  Gold Idol  |    |  Silver Key  |    +|  2|  City of Vilcabamba  |  ''<nowiki>LEVEL2</nowiki>''    |  6|  95|  3|  Gold Idol  |       |  Silver Key  |       
-|  3 |  Lost Valley  |  ''%%LEVEL3A%%''  |  6 |  64 |  5 |  Machine Cog  |        +|  3|  Lost Valley  |  ''<nowiki>LEVEL3A</nowiki>''    |  6|  64|  5|  Machine Cog  |               
-|  4 |  Tomb of Qualopec  |  ''%%LEVEL3B%%''  |  10 |  77 |  3 |         +|  4|  Tomb of Qualopec  |  ''<nowiki>LEVEL3B</nowiki>''    |  10|  77|  3|                 
-|  5 |  St. Francis' Folly  |  ''%%LEVEL4%%''  |  14 |  107 |  4 |     |  Neptune Key  |  Atlas Key  |  Damocles Key  |  Thor Key  | +|  5|  St. Francis' Folly  |  ''<nowiki>LEVEL4</nowiki>''    |  14|  107|  4|         |  Neptune Key  |  Atlas Key  |  Damocles Key  |  Thor Key  | 
-|  6 |  Colosseum  |  ''%%LEVEL5%%''  |  10 |  86 |  3 |     |  Rusty Key  |    +|  6|  Colosseum  |  ''<nowiki>LEVEL5</nowiki>''    |  10|  86|  3|         |  Rusty Key  |       
-|  7 |  Palace Midas  |  ''%%LEVEL6%%''  |  7 |  136 |  3 |  Gold Bar  |        +|  7|  Palace Midas  |  ''<nowiki>LEVEL6</nowiki>''    |  7|  136|  3|  Gold Bar  |               
-|  8 |  The Cistern  |  ''%%LEVEL7A%%''  |  7 |  112 |  3 |     |  Gold Key  |  Silver Key  |  Rusty Key  |  +|  8|  The Cistern  |  ''<nowiki>LEVEL7A</nowiki>''    |  7|  112|  3|         |  Gold Key  |  Silver Key  |  Rusty Key  |   
-|  9 |  Tomb of Tihocan  |  ''%%LEVEL7B%%''  |  15 |  88 |  2 |     |  Gold Key  |  Rusty Key  |  Rusty Key  |  +|  9|  Tomb of Tihocan  |  ''<nowiki>LEVEL7B</nowiki>''    |  15|  88|  2|         |  Gold Key  |  Rusty Key  |  Rusty Key  |   
-|  10 |  City of Khamoon  |  ''%%LEVEL8A%%''  |  3 |  93 |  3 |     |  Saphire Key  |    +|  10|  City of Khamoon  |  ''<nowiki>LEVEL8A</nowiki>''    |  3|  93|  3|         |  Saphire Key  |       
-|  11 |  Obelisk of Khamoon  |  ''%%LEVEL8B%%''  |  8 |  103 |  3 |  Eye of Horus  |  Scarab  |  Seal of Anubis  |  Ankh  |  Saphire Key  |    +|  11|  Obelisk of Khamoon  |  ''<nowiki>LEVEL8B</nowiki>''    |  8|  103|  3|  Eye of Horus  |  Scarab  |  Seal of Anubis  |  Ankh  |  Saphire Key  |       
-|  12 |  Sanctuary of the Scion  |  ''%%LEVEL8C%%''  |  12 |  74 |  1 |  Ankh  |  Scarab   |  Gold Key  |    +|  12|  Sanctuary of the Scion  |  ''<nowiki>LEVEL8C</nowiki>''    |  12|  74|  1|  Ankh  |  Scarab     |  Gold Key  |       
-|  13 |  Natla's Mines  |  ''%%LEVEL10A%%''  |  15 |  101 |  3 |  Fuse  |  Pyramid Key  |       +|  13|  Natla's Mines  |  ''<nowiki>LEVEL10A</nowiki>''    |  15|  101|  3|  Fuse  |  Pyramid Key  |             
-|  14 |  Atlantis  |  ''%%LEVEL10B%%''  |  6 |  192 |  3 |         +|  14|  Atlantis  |  ''<nowiki>LEVEL10B</nowiki>''    |  6|  192|  3|                 
-|  15 |  The Great Pyramid  |  ''%%LEVEL10C%%''  |  2 |  129 |  3 |         +|  15|  The Great Pyramid  |  ''<nowiki>LEVEL10C</nowiki>''    |  2|  129|  3|                 
-|  16 |  Cut Scene 1  |  ''%%CUT1%%''  |  1 |  3 |  N/A  ||||||||| +|  16|  Cut Scene 1  |  ''<nowiki>CUT1</nowiki>''    |  1|  3|  N/A  ||||||||| 
-|  17 |  Cut Scene 2  |  ''%%CUT2%%''  |  0 |  1 | ::: ||||||||| +|  17|  Cut Scene 2  |  ''<nowiki>CUT2</nowiki>''    |  0|  1| ::: ||||||||| 
-|  18 |  Cut Scene 3  |  ''%%CUT3%%''  |  0 |  4 | ::: ||||||||| +|  18|  Cut Scene 3  |  ''<nowiki>CUT3</nowiki>''    |  0|  4| ::: ||||||||| 
-|  19 |  Cut Scene 4  |  ''%%CUT4%%''  |  0 |  6 | ::: ||||||||| +|  19|  Cut Scene 4  |  ''<nowiki>CUT4</nowiki>''    |  0|  6| ::: ||||||||| 
-|  20 |  Title  |  ''%%TITLE%%''  |  0 |  1 | ::: ||||||||| +|  20|  Title  |  ''<nowiki>TITLE</nowiki>''    |  0|  1| ::: ||||||||| 
-|  21 |  Current Position  |  ''%%CURRENT%%''  |     | ::: |||||||||+|  21|  Current Position  |  ''<nowiki>CURRENT</nowiki>''    |     | ::: ||||||||| 
 + 
 +<note important>The level "Current Position" (ID 21) seems to have been used internally during the development of the game, and its purposes are unknown. Its file "''<nowiki>CURRENT.PHD</nowiki>''" isn't present in any of the official releases. TODO: Check in the betas.</note> 
  
-<note important>The level "Current Position" (ID 21) seems to have been used internally during the development of the game, and its purposes are unknown. Its file "''%%CURRENT.PHD%%''" isn't present in any of the official releases. TODO: Check in the betas.</note> 
trs/savegame/tr1.1490457687.txt.gz · Last modified: 2017/03/25 17:01 by zdimension
Back to top
CC Attribution-Share Alike 4.0 International
Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0