In EDuke32 loading/saving menus, when finding old version savegame, display

some information about it instead of simply omitting it.
Internally, struct savegame --> struct savegame_ for easier grepping.

git-svn-id: https://svn.eduke32.com/eduke32@2188 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2011-12-21 18:41:38 +00:00
parent 297738389a
commit 89d321c01f
4 changed files with 69 additions and 22 deletions

View file

@ -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);

View file

@ -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);

View file

@ -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;

View file

@ -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;