Saves: Add userbyteversion to savegame header and userdef

git-svn-id: https://svn.eduke32.com/eduke32@6741 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
hendricks266 2018-03-08 03:55:07 +00:00
parent 4c48a848a3
commit 3d8e1afba9
7 changed files with 23 additions and 14 deletions

View file

@ -191,6 +191,8 @@ typedef struct {
int32_t returnvar[MAX_RETURN_VALUES-1];
uint32_t userbytever;
#if !defined LUNATIC
fix16_t cameraq16ang, cameraq16horiz;
int16_t camerasect;

View file

@ -1307,6 +1307,7 @@ const memberlabel_t UserdefsLabels[]=
{ "menu_scrollbarz", USERDEFS_MENU_SCROLLBARZ, 0, 0 },
{ "menu_scrollcursorz", USERDEFS_MENU_SCROLLCURSORZ, 0, 0 },
{ "return", USERDEFS_RETURN, LABEL_HASPARM2, MAX_RETURN_VALUES },
{ "userbyteversion", USERDEFS_USERBYTEVERSION, 0, 0 },
{ NULL, -1, 0, 0 } // END OF LIST
};

View file

@ -601,6 +601,7 @@ enum UserdefsLabel_t
USERDEFS_MENU_SCROLLBARZ,
USERDEFS_MENU_SCROLLCURSORZ,
USERDEFS_RETURN,
USERDEFS_USERBYTEVERSION,
USERDEFS_END
};

View file

@ -230,6 +230,7 @@ int32_t __fastcall VM_GetUserdef(int32_t labelNum, int32_t const lParm2)
else
labelNum = ud.returnvar[lParm2-1];
break;
case USERDEFS_USERBYTEVERSION: labelNum = ud.userbytever; break;
default: labelNum = -1; break;
}
@ -418,6 +419,7 @@ void __fastcall VM_SetUserdef(int32_t const labelNum, int32_t const lParm2, int3
else
ud.returnvar[lParm2-1] = iSet;
break;
case USERDEFS_USERBYTEVERSION: ud.userbytever = iSet; break;
default: break;
}
}

View file

@ -2213,11 +2213,11 @@ static void Menu_PreDraw(MenuID_t cm, MenuEntry_t *entry, const vec2_t origin)
menutext_centeralign(origin.x + (101<<16), origin.y + (97<<16), "Previous\nVersion");
#ifndef EDUKE32_SIMPLE_MENU
Bsprintf(tempbuf,"Saved: %d.%d.%d %d-bit", savehead.majorver, savehead.minorver,
savehead.bytever, 8*savehead.getPtrSize());
Bsprintf(tempbuf,"Saved: %d.%d.%d.%d %d-bit", savehead.majorver, savehead.minorver,
savehead.bytever, savehead.userbytever, 8*savehead.getPtrSize());
mgametext(origin.x + (31<<16), origin.y + (104<<16), tempbuf);
Bsprintf(tempbuf,"Our: %d.%d.%d %d-bit", SV_MAJOR_VER, SV_MINOR_VER, BYTEVERSION,
(int32_t)(8*sizeof(intptr_t)));
Bsprintf(tempbuf,"Our: %d.%d.%d.%d %d-bit", SV_MAJOR_VER, SV_MINOR_VER, BYTEVERSION,
ud.userbytever, (int32_t)(8*sizeof(intptr_t)));
mgametext(origin.x + ((31+16)<<16), origin.y + (114<<16), tempbuf);
#endif
@ -2273,11 +2273,11 @@ static void Menu_PreDraw(MenuID_t cm, MenuEntry_t *entry, const vec2_t origin)
menutext_centeralign(origin.x + (101<<16), origin.y + (97<<16), "Previous\nVersion");
#ifndef EDUKE32_SIMPLE_MENU
Bsprintf(tempbuf,"Saved: %d.%d.%d %d-bit", savehead.majorver, savehead.minorver,
savehead.bytever, 8*savehead.getPtrSize());
Bsprintf(tempbuf,"Saved: %d.%d.%d.%d %d-bit", savehead.majorver, savehead.minorver,
savehead.bytever, savehead.userbytever, 8*savehead.getPtrSize());
mgametext(origin.x + (31<<16), origin.y + (104<<16), tempbuf);
Bsprintf(tempbuf,"Our: %d.%d.%d %d-bit", SV_MAJOR_VER, SV_MINOR_VER, BYTEVERSION,
(int32_t)(8*sizeof(intptr_t)));
Bsprintf(tempbuf,"Our: %d.%d.%d.%d %d-bit", SV_MAJOR_VER, SV_MINOR_VER, BYTEVERSION,
ud.userbytever, (int32_t)(8*sizeof(intptr_t)));
mgametext(origin.x + ((31+16)<<16), origin.y + (114<<16), tempbuf);
#endif

View file

@ -1339,6 +1339,7 @@ int32_t sv_saveandmakesnapshot(FILE *fil, char const *name, int8_t spot, int8_t
h.minorver = SV_MINOR_VER;
h.ptrsize = sizeof(intptr_t);
h.bytever = BYTEVERSION;
h.userbytever = ud.userbytever;
h.comprthres = savegame_comprthres;
h.recdiffsp = recdiffsp;
@ -1465,12 +1466,12 @@ int32_t sv_loadheader(int32_t fil, int32_t spot, savehead_t *h)
return -2;
}
if (h->majorver != SV_MAJOR_VER || h->minorver != SV_MINOR_VER || h->bytever != BYTEVERSION)
if (h->majorver != SV_MAJOR_VER || h->minorver != SV_MINOR_VER || h->bytever != BYTEVERSION || h->userbytever != ud.userbytever)
{
if (havedemo)
OSD_Printf("Incompatible demo version. Expected %d.%d.%d, found %d.%d.%d\n",
SV_MAJOR_VER, SV_MINOR_VER, BYTEVERSION,
h->majorver, h->minorver, h->bytever);
OSD_Printf("Incompatible demo version. Expected %d.%d.%d.%d, found %d.%d.%d.%d\n",
SV_MAJOR_VER, SV_MINOR_VER, BYTEVERSION, ud.userbytever,
h->majorver, h->minorver, h->bytever, h->userbytever);
if (h->majorver == SV_MAJOR_VER && h->minorver == SV_MINOR_VER)
{

View file

@ -34,7 +34,7 @@ extern "C" {
#else
# define SV_MAJOR_VER 1
#endif
#define SV_MINOR_VER 4
#define SV_MINOR_VER 5
#pragma pack(push,1)
typedef struct
@ -44,6 +44,8 @@ typedef struct
uint16_t bytever;
// 16 bytes
uint32_t userbytever;
uint8_t comprthres;
uint8_t recdiffsp, diffcompress, synccompress;
// 4 bytes
@ -54,7 +56,7 @@ typedef struct
char savename[MAXSAVEGAMENAMESTRUCT];
uint8_t numplayers, volnum, levnum, skill;
char boardfn[BMAX_PATH];
// 282 bytes
// 286 bytes
#ifdef __ANDROID__
char skillname[32], volname[32];
#endif