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]; int32_t returnvar[MAX_RETURN_VALUES-1];
uint32_t userbytever;
#if !defined LUNATIC #if !defined LUNATIC
fix16_t cameraq16ang, cameraq16horiz; fix16_t cameraq16ang, cameraq16horiz;
int16_t camerasect; int16_t camerasect;

View file

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

View file

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

View file

@ -230,6 +230,7 @@ int32_t __fastcall VM_GetUserdef(int32_t labelNum, int32_t const lParm2)
else else
labelNum = ud.returnvar[lParm2-1]; labelNum = ud.returnvar[lParm2-1];
break; break;
case USERDEFS_USERBYTEVERSION: labelNum = ud.userbytever; break;
default: labelNum = -1; break; default: labelNum = -1; break;
} }
@ -418,6 +419,7 @@ void __fastcall VM_SetUserdef(int32_t const labelNum, int32_t const lParm2, int3
else else
ud.returnvar[lParm2-1] = iSet; ud.returnvar[lParm2-1] = iSet;
break; break;
case USERDEFS_USERBYTEVERSION: ud.userbytever = iSet; break;
default: 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"); menutext_centeralign(origin.x + (101<<16), origin.y + (97<<16), "Previous\nVersion");
#ifndef EDUKE32_SIMPLE_MENU #ifndef EDUKE32_SIMPLE_MENU
Bsprintf(tempbuf,"Saved: %d.%d.%d %d-bit", savehead.majorver, savehead.minorver, Bsprintf(tempbuf,"Saved: %d.%d.%d.%d %d-bit", savehead.majorver, savehead.minorver,
savehead.bytever, 8*savehead.getPtrSize()); savehead.bytever, savehead.userbytever, 8*savehead.getPtrSize());
mgametext(origin.x + (31<<16), origin.y + (104<<16), tempbuf); 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, Bsprintf(tempbuf,"Our: %d.%d.%d.%d %d-bit", SV_MAJOR_VER, SV_MINOR_VER, BYTEVERSION,
(int32_t)(8*sizeof(intptr_t))); ud.userbytever, (int32_t)(8*sizeof(intptr_t)));
mgametext(origin.x + ((31+16)<<16), origin.y + (114<<16), tempbuf); mgametext(origin.x + ((31+16)<<16), origin.y + (114<<16), tempbuf);
#endif #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"); menutext_centeralign(origin.x + (101<<16), origin.y + (97<<16), "Previous\nVersion");
#ifndef EDUKE32_SIMPLE_MENU #ifndef EDUKE32_SIMPLE_MENU
Bsprintf(tempbuf,"Saved: %d.%d.%d %d-bit", savehead.majorver, savehead.minorver, Bsprintf(tempbuf,"Saved: %d.%d.%d.%d %d-bit", savehead.majorver, savehead.minorver,
savehead.bytever, 8*savehead.getPtrSize()); savehead.bytever, savehead.userbytever, 8*savehead.getPtrSize());
mgametext(origin.x + (31<<16), origin.y + (104<<16), tempbuf); 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, Bsprintf(tempbuf,"Our: %d.%d.%d.%d %d-bit", SV_MAJOR_VER, SV_MINOR_VER, BYTEVERSION,
(int32_t)(8*sizeof(intptr_t))); ud.userbytever, (int32_t)(8*sizeof(intptr_t)));
mgametext(origin.x + ((31+16)<<16), origin.y + (114<<16), tempbuf); mgametext(origin.x + ((31+16)<<16), origin.y + (114<<16), tempbuf);
#endif #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.minorver = SV_MINOR_VER;
h.ptrsize = sizeof(intptr_t); h.ptrsize = sizeof(intptr_t);
h.bytever = BYTEVERSION; h.bytever = BYTEVERSION;
h.userbytever = ud.userbytever;
h.comprthres = savegame_comprthres; h.comprthres = savegame_comprthres;
h.recdiffsp = recdiffsp; h.recdiffsp = recdiffsp;
@ -1465,12 +1466,12 @@ int32_t sv_loadheader(int32_t fil, int32_t spot, savehead_t *h)
return -2; 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) if (havedemo)
OSD_Printf("Incompatible demo version. Expected %d.%d.%d, found %d.%d.%d\n", OSD_Printf("Incompatible demo version. Expected %d.%d.%d.%d, found %d.%d.%d.%d\n",
SV_MAJOR_VER, SV_MINOR_VER, BYTEVERSION, SV_MAJOR_VER, SV_MINOR_VER, BYTEVERSION, ud.userbytever,
h->majorver, h->minorver, h->bytever); h->majorver, h->minorver, h->bytever, h->userbytever);
if (h->majorver == SV_MAJOR_VER && h->minorver == SV_MINOR_VER) if (h->majorver == SV_MAJOR_VER && h->minorver == SV_MINOR_VER)
{ {

View file

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