tr1/savegame_bson: append game version
Some checks are pending
Run code linters / Run code linters (push) Waiting to run
Publish a pre-release / Build TR1 (push) Has been skipped
Publish a pre-release / Build TR2 (push) Has been skipped
Publish a pre-release / Create a prerelease (push) Has been skipped

This adds the current TRX version to the BSON payload.
This commit is contained in:
lahm86 2025-04-07 21:17:26 +01:00
parent 12edeaee37
commit 6820532711
3 changed files with 6 additions and 2 deletions

View file

@ -14,7 +14,7 @@
// creatures, triggers etc., and is what actually sets Lara's health, creatures
// status, triggers, inventory etc.
#define SAVEGAME_CURRENT_VERSION 7
#define SAVEGAME_CURRENT_VERSION 8
typedef enum {
VERSION_LEGACY = -1,
@ -31,6 +31,8 @@ typedef enum {
// access to essential data, such as the level counter and the level title,
// without the need to parse the entire BSON document.
// Added TR2+ stats ammo hits/used, health packs used, distance travelled.
VERSION_8 = 8,
// Added the current TR1X version string.
} SAVEGAME_VERSION;
void Savegame_Init(void);

View file

@ -23,6 +23,7 @@
#include <libtrx/log.h>
#include <libtrx/memory.h>
#include <libtrx/utils.h>
#include <libtrx/version.h>
#include <inttypes.h>
#include <stdio.h>
@ -1031,6 +1032,7 @@ static JSON_ARRAY *M_DumpResumeInfo(void)
static JSON_OBJECT *M_DumpMisc(void)
{
JSON_OBJECT *misc_obj = JSON_ObjectNew();
JSON_ObjectAppendString(misc_obj, "game_version", g_TRXVersion);
JSON_ObjectAppendInt(misc_obj, "bonus_flag", Game_GetBonusFlag());
const GF_LEVEL *const level = Game_GetCurrentLevel();

View file

@ -171,7 +171,6 @@ static void M_SaveRaw(MYFILE *const fp, const JSON_VALUE *const root)
File_WriteData(fp, &header, sizeof(header));
File_WriteData(fp, level->title, strlen(level->title));
File_WriteData(fp, compressed, compressed_size);
File_WriteData(fp, g_TRXVersion, strlen(g_TRXVersion));
Memory_FreePointer(&uncompressed);
Memory_FreePointer(&compressed);
@ -279,6 +278,7 @@ static JSON_VALUE *M_ParseFromBuffer(
static JSON_OBJECT *M_DumpMisc(void)
{
JSON_OBJECT *const misc_obj = JSON_ObjectNew();
JSON_ObjectAppendString(misc_obj, "game_version", g_TRXVersion);
JSON_ObjectAppendInt(misc_obj, "bonus_flag", Game_GetBonusFlag());
JSON_ObjectAppendBool(misc_obj, "are_monks_angry", g_IsMonkAngry);
return misc_obj;