diff --git a/polymer/eduke32/source/menus.c b/polymer/eduke32/source/menus.c index bd5fef7dd..1b483a239 100644 --- a/polymer/eduke32/source/menus.c +++ b/polymer/eduke32/source/menus.c @@ -472,10 +472,10 @@ static void modval(int32_t min, int32_t max,int32_t *p,int32_t dainc,int32_t dam #define MWIN(X) rotatesprite( 320<<15,200<<15,X,0,MENUSCREEN,-16,0,10+64,0,0,xdim-1,ydim-1) #define MWINXY(X,OX,OY) rotatesprite( ( 320+(OX) )<<15, ( 200+(OY) )<<15,X,0,MENUSCREEN,-16,0,10+64,0,0,xdim-1,ydim-1) -extern int32_t G_LoadSaveHeader(char spot,struct savehead *saveh); +extern int32_t G_LoadSaveHeader(char spot,struct savehead_ *saveh); #pragma pack(push,1) -static struct savehead savehead; +static struct savehead_ savehead; #pragma pack(pop) //static int32_t volnum,levnum,plrskl,numplr; @@ -496,7 +496,20 @@ static void M_DisplaySaveGameList(void) rotatesprite(103<<16,144<<16,65536L,1024+512,WINDOWBORDER1,24,0,10,0,0,xdim-1,ydim-1); for (x=0; x<=9; x++) - minitext(c,48+(12*x),ud.savegame[x],2,10+16); + { + if (ud.savegame[x][0]) + { + minitext(c,48+(12*x),ud.savegame[x],2,10+16); + } + else if (ud.savegame[x][20]==32 && g_currentMenu!=360+x) + { + // old version and not entering new name + char buf[22]; + Bmemcpy(buf, ud.savegame[x], 22); + buf[0] = '?'; + minitext(c,48+(12*x),buf,13,10+16); + } + } } static void clearfilenames(void) @@ -543,6 +556,24 @@ void G_CheckPlayerColor(int32_t *color, int32_t prev_color) } } +static void Menus_LoadSave_DisplayCommon1(void) +{ + if (lastsavehead != probey) + G_LoadSaveHeader(probey,&savehead); + lastsavehead = probey; + + rotatesprite(101<<16,97<<16,65536L>>1,512,TILE_LOADSHOT,-32,0,4+10+64,0,0,xdim-1,ydim-1); + + if (ud.savegame[probey][20] == 32) + { + menutext(40,70,0,0,"OLD VERSION"); + Bsprintf(tempbuf,"SAVED: %d", savehead.byteversion); + mgametext(40,82,tempbuf,0,2+8+16); + Bsprintf(tempbuf,"OUR: %d", BYTEVERSION); + mgametext(40+16,92,tempbuf,0,2+8+16); + } +} + void M_DisplayMenus(void) { extern int32_t g_netSync; @@ -4737,15 +4768,11 @@ cheat_for_port_credits: if (g_currentMenu == 300) { - if (ud.savegame[probey][0]) + // load game + if (ud.savegame[probey][0] || ud.savegame[probey][20]==32) // ...[20]==32: old version { - if (lastsavehead != probey) - { - G_LoadSaveHeader(probey,&savehead); - lastsavehead = probey; - } + Menus_LoadSave_DisplayCommon1(); - rotatesprite(101<<16,97<<16,65536L>>1,512,TILE_LOADSHOT,-32,0,4+10+64,0,0,xdim-1,ydim-1); Bsprintf(tempbuf,"PLAYERS: %-2d ",savehead.numplr); mgametext(160,156,tempbuf,0,2+8+16); Bsprintf(tempbuf,"EPISODE: %-2d / LEVEL: %-2d / SKILL: %-2d",1+savehead.volnum,1+savehead.levnum,savehead.plrskl); @@ -4753,18 +4780,20 @@ cheat_for_port_credits: if (savehead.volnum == 0 && savehead.levnum == 7) mgametext(160,180,savehead.boardfn,0,2+8+16); } - else menutext(69,70,0,0,"EMPTY"); + else + { + menutext(69,70,0,0,"EMPTY"); + } } else { - if (ud.savegame[probey][0]) + // save game + if (ud.savegame[probey][0] || ud.savegame[probey][20]==32) // ...[20]==32: old version { - if (lastsavehead != probey) - G_LoadSaveHeader(probey,&savehead); - lastsavehead = probey; - rotatesprite(101<<16,97<<16,65536L>>1,512,TILE_LOADSHOT,-32,0,4+10+64,0,0,xdim-1,ydim-1); + Menus_LoadSave_DisplayCommon1(); } else menutext(69,70,0,0,"EMPTY"); + Bsprintf(tempbuf,"PLAYERS: %-2d ",ud.multimode); mgametext(160,156,tempbuf,0,2+8+16); Bsprintf(tempbuf,"EPISODE: %-2d / LEVEL: %-2d / SKILL: %-2d",1+ud.volume_number,1+ud.level_number,ud.player_skill); diff --git a/polymer/eduke32/source/menus.h b/polymer/eduke32/source/menus.h index a7e793dc9..0d82e9136 100644 --- a/polymer/eduke32/source/menus.h +++ b/polymer/eduke32/source/menus.h @@ -32,7 +32,7 @@ extern int32_t g_lastSaveSlot; extern int32_t g_quitDeadline; extern int32_t probey; extern int32_t voting; -int32_t G_LoadSaveHeader(char spot,struct savehead *saveh); +int32_t G_LoadSaveHeader(char spot,struct savehead_ *saveh); int32_t menutext_(int32_t x,int32_t y,int32_t s,int32_t p,char *t,int32_t bits); void ChangeToMenu(int32_t cm); void G_CheckPlayerColor(int32_t *color,int32_t prev_color); diff --git a/polymer/eduke32/source/savegame.c b/polymer/eduke32/source/savegame.c index 4d505b6ca..db7aa7d8d 100644 --- a/polymer/eduke32/source/savegame.c +++ b/polymer/eduke32/source/savegame.c @@ -117,6 +117,8 @@ void ReadSaveGameHeaders(void) for (i=0; i<10; i++) { + int32_t oldver=0; + fn[4] = i+'0'; if ((fil = kopen4loadfrommod(fn,0)) == -1) continue; if (kdfread(&j,sizeof(int32_t),1,fil) != 1) @@ -136,9 +138,11 @@ void ReadSaveGameHeaders(void) } if (dummy != BYTEVERSION) { - kclose(fil); - continue; + oldver = 1; +// kclose(fil); +// continue; } + if (kdfread(&dummy,sizeof(dummy),1,fil) != 1) { kclose(fil); @@ -147,14 +151,26 @@ void ReadSaveGameHeaders(void) if (kdfread(&ud.savegame[i][0],21,1,fil) != 1) { ud.savegame[i][0] = 0; + + ud.savegame[i][20] = 0; + ud.savegame[i][21] = 0; } else ud.savegame[i][19] = 0; + if (oldver) + { +// Bmemset(ud.savegame[i], 0, 20); + ud.savegame[i][0] = 0; + + ud.savegame[i][20] = 32; + ud.savegame[i][21] = 0; + } + kclose(fil); } } -int32_t G_LoadSaveHeader(char spot,struct savehead *saveh) +int32_t G_LoadSaveHeader(char spot,struct savehead_ *saveh) { char fn[13]; int32_t fil; @@ -179,6 +195,7 @@ int32_t G_LoadSaveHeader(char spot,struct savehead *saveh) kclose(fil); return 1; }*/ + saveh->byteversion = bv; if (kdfread(&saveh->numplr,sizeof(int32_t),1,fil) != 1) goto corrupt; diff --git a/polymer/eduke32/source/savegame.h b/polymer/eduke32/source/savegame.h index 8239f7deb..20f82cdd4 100644 --- a/polymer/eduke32/source/savegame.h +++ b/polymer/eduke32/source/savegame.h @@ -24,9 +24,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define __savegame_h__ #pragma pack(push,1) -struct savehead +struct savehead_ { char name[21]; + int32_t byteversion; int32_t numplr,volnum,levnum,plrskl; char boardfn[BMAX_PATH]; }; @@ -40,7 +41,7 @@ int32_t sv_saveandmakesnapshot(FILE *fil,int32_t recdiffs,int32_t diffcompress,i void sv_freemem(); int32_t G_SavePlayer(int32_t spot); int32_t G_LoadPlayer(int32_t spot); -int32_t G_LoadSaveHeader(char spot,struct savehead *saveh); +int32_t G_LoadSaveHeader(char spot,struct savehead_ *saveh); void ReadSaveGameHeaders(void); extern char *bitptr;