revert to LF_SAVEGAME system code, removing all traces of saveoverride
(I believe Sal wanted us to do this anyway, so...)
This commit is contained in:
parent
a050ed956a
commit
f3796dc7f6
|
@ -1216,19 +1216,6 @@ static void readlevelheader(MYFILE *f, INT32 num)
|
||||||
|
|
||||||
else if (fastcmp(word, "MAXBONUSLIVES"))
|
else if (fastcmp(word, "MAXBONUSLIVES"))
|
||||||
mapheaderinfo[num-1]->maxbonuslives = (SINT8)i;
|
mapheaderinfo[num-1]->maxbonuslives = (SINT8)i;
|
||||||
|
|
||||||
else if (fastcmp(word, "SAVEOVERRIDE"))
|
|
||||||
{
|
|
||||||
if (fastcmp(word2, "DEFAULT")) i = SAVE_DEFAULT;
|
|
||||||
else if (fastcmp(word2, "ALWAYS")) i = SAVE_ALWAYS;
|
|
||||||
else if (fastcmp(word2, "NEVER")) i = SAVE_NEVER;
|
|
||||||
|
|
||||||
if (i >= SAVE_NEVER && i <= SAVE_ALWAYS)
|
|
||||||
mapheaderinfo[num-1]->saveoverride = (SINT8)i;
|
|
||||||
else
|
|
||||||
deh_warning("Level header %d: invalid save override number %d", num, i);
|
|
||||||
}
|
|
||||||
|
|
||||||
else if (fastcmp(word, "LEVELFLAGS"))
|
else if (fastcmp(word, "LEVELFLAGS"))
|
||||||
mapheaderinfo[num-1]->levelflags = (UINT8)i;
|
mapheaderinfo[num-1]->levelflags = (UINT8)i;
|
||||||
else if (fastcmp(word, "MENUFLAGS"))
|
else if (fastcmp(word, "MENUFLAGS"))
|
||||||
|
@ -7894,11 +7881,6 @@ struct {
|
||||||
{"LF2_NOVISITNEEDED",LF2_NOVISITNEEDED},
|
{"LF2_NOVISITNEEDED",LF2_NOVISITNEEDED},
|
||||||
{"LF2_WIDEICON",LF2_WIDEICON},
|
{"LF2_WIDEICON",LF2_WIDEICON},
|
||||||
|
|
||||||
// Save override
|
|
||||||
{"SAVE_NEVER",SAVE_NEVER},
|
|
||||||
{"SAVE_DEFAULT",SAVE_DEFAULT},
|
|
||||||
{"SAVE_ALWAYS",SAVE_ALWAYS},
|
|
||||||
|
|
||||||
// NiGHTS grades
|
// NiGHTS grades
|
||||||
{"GRADE_F",GRADE_F},
|
{"GRADE_F",GRADE_F},
|
||||||
{"GRADE_E",GRADE_E},
|
{"GRADE_E",GRADE_E},
|
||||||
|
|
|
@ -304,7 +304,6 @@ typedef struct
|
||||||
UINT8 levelselect; ///< Is this map available in the level select? If so, which map list is it available in?
|
UINT8 levelselect; ///< Is this map available in the level select? If so, which map list is it available in?
|
||||||
SINT8 bonustype; ///< What type of bonus does this level have? (-1 for null.)
|
SINT8 bonustype; ///< What type of bonus does this level have? (-1 for null.)
|
||||||
SINT8 maxbonuslives; ///< How many bonus lives to award at Intermission? (-1 for unlimited.)
|
SINT8 maxbonuslives; ///< How many bonus lives to award at Intermission? (-1 for unlimited.)
|
||||||
SINT8 saveoverride; ///< Set how the game is allowed to save (1 for always, -1 for never, 0 is 2.1 default)
|
|
||||||
|
|
||||||
UINT8 levelflags; ///< LF_flags: merged eight booleans into one UINT8 for space, see below
|
UINT8 levelflags; ///< LF_flags: merged eight booleans into one UINT8 for space, see below
|
||||||
UINT8 menuflags; ///< LF2_flags: options that affect record attack / nights mode menus
|
UINT8 menuflags; ///< LF2_flags: options that affect record attack / nights mode menus
|
||||||
|
@ -340,11 +339,6 @@ typedef struct
|
||||||
#define LF2_NOVISITNEEDED 16 ///< Available in time attack/nights mode without visiting the level
|
#define LF2_NOVISITNEEDED 16 ///< Available in time attack/nights mode without visiting the level
|
||||||
#define LF2_WIDEICON 32 ///< If you're in a circumstance where it fits, use a wide map icon
|
#define LF2_WIDEICON 32 ///< If you're in a circumstance where it fits, use a wide map icon
|
||||||
|
|
||||||
// Save override
|
|
||||||
#define SAVE_NEVER -1
|
|
||||||
#define SAVE_DEFAULT 0
|
|
||||||
#define SAVE_ALWAYS 1
|
|
||||||
|
|
||||||
extern mapheader_t* mapheaderinfo[NUMMAPS];
|
extern mapheader_t* mapheaderinfo[NUMMAPS];
|
||||||
|
|
||||||
enum TypeOfLevel
|
enum TypeOfLevel
|
||||||
|
|
|
@ -2070,8 +2070,6 @@ static int mapheaderinfo_get(lua_State *L)
|
||||||
lua_pushinteger(L, header->bonustype);
|
lua_pushinteger(L, header->bonustype);
|
||||||
else if (fastcmp(field,"maxbonuslives"))
|
else if (fastcmp(field,"maxbonuslives"))
|
||||||
lua_pushinteger(L, header->maxbonuslives);
|
lua_pushinteger(L, header->maxbonuslives);
|
||||||
else if (fastcmp(field,"saveoverride"))
|
|
||||||
lua_pushinteger(L, header->saveoverride);
|
|
||||||
else if (fastcmp(field,"levelflags"))
|
else if (fastcmp(field,"levelflags"))
|
||||||
lua_pushinteger(L, header->levelflags);
|
lua_pushinteger(L, header->levelflags);
|
||||||
else if (fastcmp(field,"menuflags"))
|
else if (fastcmp(field,"menuflags"))
|
||||||
|
|
|
@ -230,7 +230,6 @@ static void P_ClearSingleMapHeaderInfo(INT16 i)
|
||||||
mapheaderinfo[num]->levelselect = 0;
|
mapheaderinfo[num]->levelselect = 0;
|
||||||
mapheaderinfo[num]->bonustype = 0;
|
mapheaderinfo[num]->bonustype = 0;
|
||||||
mapheaderinfo[num]->maxbonuslives = -1;
|
mapheaderinfo[num]->maxbonuslives = -1;
|
||||||
mapheaderinfo[num]->saveoverride = SAVE_DEFAULT;
|
|
||||||
mapheaderinfo[num]->levelflags = 0;
|
mapheaderinfo[num]->levelflags = 0;
|
||||||
mapheaderinfo[num]->menuflags = 0;
|
mapheaderinfo[num]->menuflags = 0;
|
||||||
#if 1 // equivalent to "FlickyList = DEMO"
|
#if 1 // equivalent to "FlickyList = DEMO"
|
||||||
|
@ -2632,27 +2631,19 @@ static void P_SetupCamera(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static boolean P_CanSave(void)
|
static boolean CanSaveLevel(INT32 mapnum)
|
||||||
{
|
{
|
||||||
// Saving is completely ignored under these conditions:
|
if (ultimatemode) // never save in ultimate (probably redundant with cursaveslot also being checked)
|
||||||
if ((cursaveslot < 0) // Playing without saving
|
|
||||||
|| (modifiedgame && !savemoddata) // Game is modified
|
|
||||||
|| (netgame || multiplayer) // Not in single-player
|
|
||||||
|| (demoplayback || demorecording || metalrecording) // Currently in demo
|
|
||||||
|| (players[consoleplayer].lives <= 0) // Completely dead
|
|
||||||
|| (modeattacking || ultimatemode || G_IsSpecialStage(gamemap))) // Specialized instances
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (mapheaderinfo[gamemap-1]->saveoverride == SAVE_ALWAYS
|
if (G_IsSpecialStage(mapnum) // don't save in special stages
|
||||||
|| (mapheaderinfo[gamemap-1]->levelflags & LF_SAVEGAME))
|
|| mapnum == lastmaploaded) // don't save if the last map loaded was this one
|
||||||
return true; // Saving should ALWAYS happen!
|
return false;
|
||||||
else if (mapheaderinfo[gamemap-1]->saveoverride == SAVE_NEVER)
|
|
||||||
return false; // Saving should NEVER happen!
|
|
||||||
|
|
||||||
// Default condition: In a non-hidden map, at the beginning of a zone or on a completed save-file, and not on save reload.
|
// Any levels that have the savegame flag can save normally.
|
||||||
return (!(mapheaderinfo[gamemap-1]->menuflags & LF2_HIDEINMENU)
|
// If the game is complete for this save slot, then any level can save!
|
||||||
&& (mapheaderinfo[gamemap-1]->actnum < 2 || gamecomplete)
|
// On the other side of the spectrum, if lastmaploaded is 0, then the save file has only just been created and needs to save ASAP!
|
||||||
&& (gamemap != lastmaploaded));
|
return (mapheaderinfo[mapnum-1]->levelflags & LF_SAVEGAME || gamecomplete || !lastmaploaded);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Loads a level from a lump or external wad.
|
/** Loads a level from a lump or external wad.
|
||||||
|
@ -3176,7 +3167,8 @@ boolean P_SetupLevel(boolean skipprecip)
|
||||||
|
|
||||||
P_RunCachedActions();
|
P_RunCachedActions();
|
||||||
|
|
||||||
if (P_CanSave())
|
if (!(netgame || multiplayer || demoplayback || demorecording || metalrecording || modeattacking || players[consoleplayer].lives <= 0)
|
||||||
|
&& (!modifiedgame || savemoddata) && cursaveslot > 0 && CanSaveLevel(gamemap))
|
||||||
G_SaveGame((UINT32)cursaveslot);
|
G_SaveGame((UINT32)cursaveslot);
|
||||||
|
|
||||||
lastmaploaded = gamemap; // HAS to be set after saving!!
|
lastmaploaded = gamemap; // HAS to be set after saving!!
|
||||||
|
|
Loading…
Reference in New Issue