mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-24 02:30:46 +00:00
Factor out some repeated code into G_{Load,Save}PlayerMaybeMulti.
This currently says that MP saving/loading isn't supported, but doesn't really work correctly. Also, properly bound-check the immediate argument to CON's 'save' command and one more ... -> G_HandleAsync(). git-svn-id: https://svn.eduke32.com/eduke32@2999 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
0665d961d2
commit
1729f8fa38
6 changed files with 47 additions and 60 deletions
|
@ -738,8 +738,7 @@ nextdemo:
|
|||
rotatesprite_fs((320-50)<<16,9<<16,65536L,0,BETAVERSION,0,0,2+8+16+128);
|
||||
}
|
||||
|
||||
handleevents();
|
||||
Net_GetPackets();
|
||||
G_HandleAsync();
|
||||
|
||||
if (!ud.recstat)
|
||||
nextpage();
|
||||
|
|
|
@ -7936,16 +7936,8 @@ FAKE_F3:
|
|||
/* inputloc = Bstrlen(&ud.savegame[g_lastSaveSlot][0]);
|
||||
g_currentMenu = 360+g_lastSaveSlot;
|
||||
probey = g_lastSaveSlot; */
|
||||
if (g_netServer || ud.multimode > 1)
|
||||
{
|
||||
Bstrcpy(ScriptQuotes[QUOTE_RESERVED4], "Multiplayer Saving Not Yet Supported");
|
||||
P_DoQuote(QUOTE_RESERVED4, g_player[myconnectindex].ps);
|
||||
//G_SavePlayer(-1-(g_lastSaveSlot));
|
||||
}
|
||||
else
|
||||
{
|
||||
G_SavePlayer(g_lastSaveSlot);
|
||||
}
|
||||
|
||||
G_SavePlayerMaybeMulti(g_lastSaveSlot);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -8003,20 +7995,7 @@ FAKE_F3:
|
|||
KB_ClearKeysDown();
|
||||
FX_StopAllSounds();
|
||||
|
||||
if (g_netServer || ud.multimode > 1)
|
||||
{
|
||||
Bstrcpy(ScriptQuotes[QUOTE_RESERVED4], "Multiplayer Loading Not Yet Supported");
|
||||
P_DoQuote(QUOTE_RESERVED4, g_player[myconnectindex].ps);
|
||||
|
||||
// G_LoadPlayer(-1-g_lastSaveSlot);
|
||||
// g_player[myconnectindex].ps->gm = MODE_GAME;
|
||||
}
|
||||
else
|
||||
{
|
||||
i = G_LoadPlayer(g_lastSaveSlot);
|
||||
if (i == 0)
|
||||
g_player[myconnectindex].ps->gm = MODE_GAME;
|
||||
}
|
||||
G_LoadPlayerMaybeMulti(g_lastSaveSlot);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -3032,16 +3032,14 @@ nullquote:
|
|||
case CON_SAVE:
|
||||
insptr++;
|
||||
{
|
||||
time_t curtime;
|
||||
|
||||
g_lastSaveSlot = *insptr++;
|
||||
|
||||
if (g_lastSaveSlot > 9)
|
||||
if ((unsigned)g_lastSaveSlot >= 10)
|
||||
continue;
|
||||
|
||||
if (tw == CON_SAVE || ud.savegame[g_lastSaveSlot][0] == 0)
|
||||
{
|
||||
curtime = time(NULL);
|
||||
time_t curtime = time(NULL);
|
||||
Bstrcpy(tempbuf,asctime(localtime(&curtime)));
|
||||
clearbufbyte(ud.savegame[g_lastSaveSlot],sizeof(ud.savegame[g_lastSaveSlot]),0);
|
||||
Bsprintf(ud.savegame[g_lastSaveSlot],"Auto");
|
||||
|
@ -3059,9 +3057,8 @@ nullquote:
|
|||
g_screenCapture = 1;
|
||||
G_DrawRooms(myconnectindex,65536);
|
||||
g_screenCapture = 0;
|
||||
if ((g_netServer || ud.multimode > 1))
|
||||
G_SavePlayer(-1-(g_lastSaveSlot));
|
||||
else G_SavePlayer(g_lastSaveSlot);
|
||||
|
||||
G_SavePlayerMaybeMulti(g_lastSaveSlot);
|
||||
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -1453,20 +1453,7 @@ void M_DisplayMenus(void)
|
|||
KB_ClearKeysDown();
|
||||
FX_StopAllSounds();
|
||||
|
||||
if (g_netServer || ud.multimode > 1)
|
||||
{
|
||||
Bstrcpy(ScriptQuotes[QUOTE_RESERVED4], "Multiplayer Loading Not Yet Supported");
|
||||
P_DoQuote(QUOTE_RESERVED4, g_player[myconnectindex].ps);
|
||||
|
||||
// G_LoadPlayer(-1-g_lastSaveSlot);
|
||||
// g_player[myconnectindex].ps->gm = MODE_GAME;
|
||||
}
|
||||
else
|
||||
{
|
||||
c = G_LoadPlayer(g_lastSaveSlot);
|
||||
if (c == 0)
|
||||
g_player[myconnectindex].ps->gm = MODE_GAME;
|
||||
}
|
||||
G_LoadPlayerMaybeMulti(g_lastSaveSlot);
|
||||
}
|
||||
|
||||
break;
|
||||
|
@ -1622,9 +1609,7 @@ void M_DisplayMenus(void)
|
|||
totalclock = ototalclock;
|
||||
}
|
||||
|
||||
c = G_LoadPlayer(g_lastSaveSlot);
|
||||
if (c == 0)
|
||||
g_player[myconnectindex].ps->gm = MODE_GAME;
|
||||
G_LoadPlayerMaybeMulti(g_lastSaveSlot);
|
||||
|
||||
break;
|
||||
}
|
||||
|
@ -4853,16 +4838,8 @@ cheat_for_port_credits:
|
|||
ud.savegame[g_currentMenu-360][20] = 127;
|
||||
}
|
||||
|
||||
if (g_netServer || ud.multimode > 1)
|
||||
{
|
||||
Bstrcpy(ScriptQuotes[QUOTE_RESERVED4], "Multiplayer Saving Not Yet Supported");
|
||||
P_DoQuote(QUOTE_RESERVED4, g_player[myconnectindex].ps);
|
||||
//G_SavePlayer(-1-(g_currentMenu-360));
|
||||
}
|
||||
else
|
||||
{
|
||||
G_SavePlayer(g_currentMenu-360);
|
||||
}
|
||||
G_SavePlayerMaybeMulti(g_currentMenu-360);
|
||||
|
||||
g_lastSaveSlot = g_currentMenu-360;
|
||||
g_player[myconnectindex].ps->gm = MODE_GAME;
|
||||
|
||||
|
|
|
@ -361,6 +361,39 @@ int32_t G_SavePlayer(int32_t spot)
|
|||
return 0;
|
||||
}
|
||||
|
||||
void G_LoadPlayerMaybeMulti(int32_t slot)
|
||||
{
|
||||
if (g_netServer || ud.multimode > 1)
|
||||
{
|
||||
Bstrcpy(ScriptQuotes[QUOTE_RESERVED4], "Multiplayer Loading Not Yet Supported");
|
||||
P_DoQuote(QUOTE_RESERVED4, g_player[myconnectindex].ps);
|
||||
|
||||
// G_LoadPlayer(-1-g_lastSaveSlot);
|
||||
// g_player[myconnectindex].ps->gm = MODE_GAME;
|
||||
}
|
||||
else
|
||||
{
|
||||
int32_t c = G_LoadPlayer(slot);
|
||||
if (c == 0)
|
||||
g_player[myconnectindex].ps->gm = MODE_GAME;
|
||||
}
|
||||
}
|
||||
|
||||
void G_SavePlayerMaybeMulti(int32_t slot)
|
||||
{
|
||||
Bassert(slot >= 0);
|
||||
|
||||
if (g_netServer || ud.multimode > 1)
|
||||
{
|
||||
Bstrcpy(ScriptQuotes[QUOTE_RESERVED4], "Multiplayer Saving Not Yet Supported");
|
||||
P_DoQuote(QUOTE_RESERVED4, g_player[myconnectindex].ps);
|
||||
// G_SavePlayer(-1-slot);
|
||||
}
|
||||
else
|
||||
{
|
||||
G_SavePlayer(slot);
|
||||
}
|
||||
}
|
||||
|
||||
////////// GENERIC SAVING/LOADING SYSTEM //////////
|
||||
|
||||
|
|
|
@ -60,6 +60,8 @@ int32_t G_LoadPlayer(int32_t spot);
|
|||
int32_t G_LoadSaveHeaderNew(int32_t spot, savehead_t *saveh);
|
||||
//int32_t G_LoadSaveHeader(char spot,struct savehead_ *saveh);
|
||||
void ReadSaveGameHeaders(void);
|
||||
void G_SavePlayerMaybeMulti(int32_t slot);
|
||||
void G_LoadPlayerMaybeMulti(int32_t slot);
|
||||
|
||||
#ifdef YAX_ENABLE
|
||||
extern void sv_postyaxload(void);
|
||||
|
|
Loading…
Reference in a new issue