Rewrite old-version-savegame signaling in a cleaner fashion.

git-svn-id: https://svn.eduke32.com/eduke32@3156 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2012-11-13 10:50:06 +00:00
parent 00084e9e22
commit 51c544f4da
3 changed files with 25 additions and 29 deletions

View file

@ -684,16 +684,18 @@ static void M_DisplaySaveGameList(void)
{ {
if (ud.savegame[x][0]) if (ud.savegame[x][0])
{ {
minitext(c,48+(12*x),ud.savegame[x],2,10+16); if (g_oldverSavegame[x] && g_currentMenu!=360+x)
}
else if (ud.savegame[x][20]==32 && g_currentMenu!=360+x)
{ {
// old version and not entering new name // old version and not entering new name
char buf[22]; char buf[sizeof(ud.savegame[0])];
Bmemcpy(buf, ud.savegame[x], 22); Bmemcpy(buf, ud.savegame[x], sizeof(ud.savegame[0]));
buf[0] = '?';
minitext(c,48+(12*x),buf,13,10+16); minitext(c,48+(12*x),buf,13,10+16);
} }
else
{
minitext(c,48+(12*x),ud.savegame[x],2,10+16);
}
}
} }
} }
@ -723,7 +725,7 @@ static void Menus_LoadSave_DisplayCommon1(void)
rotatesprite_fs(101<<16,97<<16,65536L>>1,512,TILE_LOADSHOT,-32,0,4+10+64); rotatesprite_fs(101<<16,97<<16,65536L>>1,512,TILE_LOADSHOT,-32,0,4+10+64);
if (ud.savegame[probey][20] == 32) if (g_oldverSavegame[probey])
{ {
menutext(53,70,0,0,"Version"); menutext(53,70,0,0,"Version");
menutext(48,90,0,0,"Mismatch"); menutext(48,90,0,0,"Mismatch");
@ -4930,7 +4932,7 @@ cheat_for_port_credits2:
if (g_currentMenu == MENU_LOAD) if (g_currentMenu == MENU_LOAD)
{ {
// load game // load game
if (ud.savegame[probey][0] || ud.savegame[probey][20]==32) // ...[20]==32: old version if (ud.savegame[probey][0])
{ {
Menus_LoadSave_DisplayCommon1(); Menus_LoadSave_DisplayCommon1();
@ -4950,7 +4952,7 @@ cheat_for_port_credits2:
else else
{ {
// save game // save game
if (ud.savegame[probey][0] || ud.savegame[probey][20]==32) // ...[20]==32: old version if (ud.savegame[probey][0])
{ {
Menus_LoadSave_DisplayCommon1(); Menus_LoadSave_DisplayCommon1();
} }
@ -4999,7 +5001,7 @@ cheat_for_port_credits2:
case 9: case 9:
if (g_currentMenu == MENU_LOAD) if (g_currentMenu == MENU_LOAD)
{ {
if (ud.savegame[x][0]) if (ud.savegame[x][0] && !g_oldverSavegame[x])
M_ChangeMenu(1000+x); M_ChangeMenu(1000+x);
} }
else else

View file

@ -29,6 +29,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
extern char *bitptr; extern char *bitptr;
uint8_t g_oldverSavegame[10];
#define BITPTR_POINTER 1 #define BITPTR_POINTER 1
// For storing pointers in files. // For storing pointers in files.
@ -150,16 +152,9 @@ void ReadSaveGameHeaders(void)
k = sv_loadheader(fil, i, &h); k = sv_loadheader(fil, i, &h);
if (k) if (k)
{ {
// old version, signal to menu code
if (k==2 || k==3) if (k==2 || k==3)
{ g_oldverSavegame[i] = 1;
// old version, signal to menu code (which should be rewritten
// more cleanly)
h.savename[0] = 0;
h.savename[20] = 32;
h.savename[21] = 0;
}
// else h.savename is all zeros (fatal failure, like wrong header // else h.savename is all zeros (fatal failure, like wrong header
// magic or too short header) // magic or too short header)
} }
@ -1236,6 +1231,8 @@ int32_t sv_saveandmakesnapshot(FILE *fil, int8_t spot, int8_t recdiffsp, int8_t
} }
} }
g_oldverSavegame[spot] = 0;
return 0; return 0;
} }
@ -1808,19 +1805,13 @@ static void postloadplayer(int32_t savegamep)
//3.5 //3.5
if (savegamep) if (savegamep)
{ {
int32_t i = headspritestat[STAT_FX]; for (SPRITES_OF(STAT_FX, i))
while (i >= 0)
{
if (sprite[i].picnum == MUSICANDSFX) if (sprite[i].picnum == MUSICANDSFX)
{ {
T2 = ud.config.SoundToggle; T2 = ud.config.SoundToggle;
T1 = 0; T1 = 0;
} }
i = nextspritestat[i];
}
G_UpdateScreenArea(); G_UpdateScreenArea();
FX_SetReverb(0); FX_SetReverb(0);
} }

View file

@ -67,7 +67,10 @@ void G_LoadPlayerMaybeMulti(int32_t slot);
extern void sv_postyaxload(void); extern void sv_postyaxload(void);
#endif #endif
// XXX: The 'bitptr' decl really belongs into gamedef.h, but we don't want to
// pull all of it in savegame.c?
extern char *bitptr; extern char *bitptr;
extern uint8_t g_oldverSavegame[10];
enum enum
{ {