mirror of
https://github.com/LostArtefacts/TRX.git
synced 2025-04-28 12:47:58 +03:00
tr1/savegame_bson: append game version
This adds the current TRX version to the BSON payload.
This commit is contained in:
parent
12edeaee37
commit
6820532711
3 changed files with 6 additions and 2 deletions
|
@ -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);
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue