mirror of
https://github.com/fabiangreffrath/woof.git
synced 2025-09-25 22:05:20 -04:00
save and restore bloodcolor (#215)
This commit is contained in:
parent
005e3b0f68
commit
cf48dd6126
@ -1413,6 +1413,8 @@ static void G_DoPlayDemo(void)
|
||||
// killough 2/22/98: version id string format for savegames
|
||||
#define VERSIONID "MBF %d"
|
||||
|
||||
#define CURRENT_SAVE_VERSION "Woof 6.0.0"
|
||||
|
||||
static char *savename = NULL;
|
||||
|
||||
//
|
||||
@ -1544,13 +1546,14 @@ static void G_DoSaveGame(void)
|
||||
|
||||
save_p = savebuffer = malloc(savegamesize);
|
||||
|
||||
CheckSaveGame(SAVESTRINGSIZE+VERSIONSIZE+sizeof(unsigned long));
|
||||
CheckSaveGame(SAVESTRINGSIZE+VERSIONSIZE+sizeof(uint64_t));
|
||||
memcpy (save_p, description, SAVESTRINGSIZE);
|
||||
save_p += SAVESTRINGSIZE;
|
||||
memset (name2,0,sizeof(name2));
|
||||
|
||||
// killough 2/22/98: "proprietary" version string :-)
|
||||
sprintf (name2,VERSIONID,MBFVERSION);
|
||||
strcpy(name2, CURRENT_SAVE_VERSION);
|
||||
saveg_compat = saveg_current;
|
||||
|
||||
memcpy (save_p, name2, VERSIONSIZE);
|
||||
save_p += VERSIONSIZE;
|
||||
@ -1656,8 +1659,14 @@ static void G_DoLoadGame(void)
|
||||
// killough 2/22/98: "proprietary" version string :-)
|
||||
sprintf (vcheck,VERSIONID,MBFVERSION);
|
||||
|
||||
if (strncmp((char *) save_p, CURRENT_SAVE_VERSION, strlen(CURRENT_SAVE_VERSION)) == 0)
|
||||
{
|
||||
saveg_compat = saveg_current;
|
||||
}
|
||||
|
||||
// killough 2/22/98: Friendly savegame version difference message
|
||||
if (!forced_loadgame && strncmp((char *) save_p, vcheck, VERSIONSIZE))
|
||||
if (!forced_loadgame && strncmp((char *) save_p, vcheck, VERSIONSIZE) &&
|
||||
saveg_compat != saveg_current)
|
||||
{
|
||||
G_LoadGameErr("Different Savegame Version!!!\n\nAre you sure?");
|
||||
return;
|
||||
|
@ -863,7 +863,7 @@ void M_LoadSelect(int choice)
|
||||
|
||||
name = G_SaveGameName(choice);
|
||||
|
||||
saveg_compat = saveg_woof;
|
||||
saveg_compat = saveg_woof510;
|
||||
|
||||
if (access(name, F_OK) != 0)
|
||||
{
|
||||
|
@ -38,7 +38,7 @@
|
||||
|
||||
byte *save_p;
|
||||
|
||||
saveg_compat_t saveg_compat = saveg_woof;
|
||||
saveg_compat_t saveg_compat = saveg_woof510;
|
||||
|
||||
// Endian-safe integer read/write functions
|
||||
|
||||
@ -345,7 +345,7 @@ static void saveg_read_mobj_t(mobj_t *str)
|
||||
// int flags;
|
||||
str->flags = saveg_read32();
|
||||
|
||||
if (saveg_compat == saveg_mbf21)
|
||||
if (saveg_compat > saveg_woof510)
|
||||
{
|
||||
// [Woof!]: mbf21: int flags2;
|
||||
str->flags2 = saveg_read32();
|
||||
@ -451,6 +451,16 @@ static void saveg_read_mobj_t(mobj_t *str)
|
||||
str->oldz = 0;
|
||||
str->oldangle = 0;
|
||||
}
|
||||
|
||||
if (saveg_compat > saveg_woof510)
|
||||
{
|
||||
// [Woof!]: int bloodcolor;
|
||||
str->bloodcolor = saveg_read32();
|
||||
}
|
||||
else
|
||||
{
|
||||
str->bloodcolor = 0;
|
||||
}
|
||||
}
|
||||
|
||||
static void saveg_write_mobj_t(mobj_t *str)
|
||||
@ -533,7 +543,7 @@ static void saveg_write_mobj_t(mobj_t *str)
|
||||
// int flags;
|
||||
saveg_write32(str->flags);
|
||||
|
||||
if (saveg_compat == saveg_mbf21)
|
||||
if (saveg_compat > saveg_woof510)
|
||||
{
|
||||
// [Woof!]: mbf21: int flags2;
|
||||
saveg_write32(str->flags2);
|
||||
@ -616,6 +626,12 @@ static void saveg_write_mobj_t(mobj_t *str)
|
||||
|
||||
// [Woof!]: int oldangle;
|
||||
saveg_write32(str->oldangle);
|
||||
|
||||
if (saveg_compat > saveg_woof510)
|
||||
{
|
||||
// [Woof!]: int bloodcolor;
|
||||
saveg_write32(str->bloodcolor);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -60,11 +60,11 @@ void saveg_write32(int value);
|
||||
int64_t saveg_read64(void);
|
||||
void saveg_write64(int64_t value);
|
||||
|
||||
typedef enum saveg_compat_s
|
||||
typedef enum saveg_compat_e
|
||||
{
|
||||
saveg_mbf,
|
||||
saveg_woof,
|
||||
saveg_mbf21
|
||||
saveg_woof510,
|
||||
saveg_current,
|
||||
} saveg_compat_t;
|
||||
|
||||
extern saveg_compat_t saveg_compat;
|
||||
|
Loading…
x
Reference in New Issue
Block a user