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,15 +684,17 @@ static void M_DisplaySaveGameList(void)
{
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);
if (g_oldverSavegame[x] && g_currentMenu!=360+x)
{
// old version and not entering new name
char buf[sizeof(ud.savegame[0])];
Bmemcpy(buf, ud.savegame[x], sizeof(ud.savegame[0]));
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);
if (ud.savegame[probey][20] == 32)
if (g_oldverSavegame[probey])
{
menutext(53,70,0,0,"Version");
menutext(48,90,0,0,"Mismatch");
@ -4930,7 +4932,7 @@ cheat_for_port_credits2:
if (g_currentMenu == MENU_LOAD)
{
// load game
if (ud.savegame[probey][0] || ud.savegame[probey][20]==32) // ...[20]==32: old version
if (ud.savegame[probey][0])
{
Menus_LoadSave_DisplayCommon1();
@ -4950,7 +4952,7 @@ cheat_for_port_credits2:
else
{
// save game
if (ud.savegame[probey][0] || ud.savegame[probey][20]==32) // ...[20]==32: old version
if (ud.savegame[probey][0])
{
Menus_LoadSave_DisplayCommon1();
}
@ -4999,7 +5001,7 @@ cheat_for_port_credits2:
case 9:
if (g_currentMenu == MENU_LOAD)
{
if (ud.savegame[x][0])
if (ud.savegame[x][0] && !g_oldverSavegame[x])
M_ChangeMenu(1000+x);
}
else

View file

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

View file

@ -67,7 +67,10 @@ void G_LoadPlayerMaybeMulti(int32_t slot);
extern void sv_postyaxload(void);
#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 uint8_t g_oldverSavegame[10];
enum
{