* Refactor all instances of `majormods = true;` to route through G_SetGameModified, and catch a few spots I missed in the process.

* Make G_SetGameModified only console-print for major mods.
* Add amnesty to "major mod" detection while loading files with custom savedatas.
* Improved the console prints for command `isgamemodified`.
This commit is contained in:
toaster 2019-01-17 22:01:28 +00:00
parent 2f2d3768d5
commit 66273898b7
12 changed files with 80 additions and 68 deletions

View File

@ -1162,7 +1162,7 @@ void D_SRB2Main(void)
if (s) // Check for NULL? if (s) // Check for NULL?
{ {
if (!W_VerifyNMUSlumps(s)) if (!W_VerifyNMUSlumps(s))
G_SetGameModified(true); G_SetGameModified(true, false);
D_AddFile(s); D_AddFile(s);
} }
} }
@ -1189,7 +1189,7 @@ void D_SRB2Main(void)
else else
{ {
if (!M_CheckParm("-server")) if (!M_CheckParm("-server"))
G_SetGameModified(true); G_SetGameModified(true, true);
autostart = true; autostart = true;
} }
} }

View File

@ -2218,8 +2218,7 @@ static void Command_Map_f(void)
{ {
if (COM_CheckParm("-force")) if (COM_CheckParm("-force"))
{ {
G_SetGameModified(false); G_SetGameModified(false, true);
majormods = true;
} }
else else
{ {
@ -3789,7 +3788,7 @@ static void Command_RunSOC(void)
if (!P_RunSOC(fn)) if (!P_RunSOC(fn))
CONS_Printf(M_GetText("Could not find SOC.\n")); CONS_Printf(M_GetText("Could not find SOC.\n"));
else else
G_SetGameModified(multiplayer); G_SetGameModified(multiplayer, false);
return; return;
} }
@ -3843,7 +3842,7 @@ static void Got_RunSOCcmd(UINT8 **cp, INT32 playernum)
} }
P_RunSOC(filename); P_RunSOC(filename);
G_SetGameModified(true); G_SetGameModified(true, false);
} }
/** Adds a pwad at runtime. /** Adds a pwad at runtime.
@ -3880,7 +3879,7 @@ static void Command_Addfile(void)
CONS_Printf(M_GetText("Only the server or a remote admin can use this.\n")); CONS_Printf(M_GetText("Only the server or a remote admin can use this.\n"));
return; return;
} }
G_SetGameModified(multiplayer); G_SetGameModified(multiplayer, false);
} }
// Add file on your client directly if it is trivial, or you aren't in a netgame. // Add file on your client directly if it is trivial, or you aren't in a netgame.
@ -4126,7 +4125,7 @@ static void Got_Addfilecmd(UINT8 **cp, INT32 playernum)
return; return;
} }
G_SetGameModified(true); G_SetGameModified(true, false);
} }
static void Command_ListWADS_f(void) static void Command_ListWADS_f(void)
@ -4483,7 +4482,7 @@ static void Ringslinger_OnChange(void)
} }
if (cv_ringslinger.value) // Only if it's been turned on if (cv_ringslinger.value) // Only if it's been turned on
G_SetGameModified(multiplayer); G_SetGameModified(multiplayer, true);
} }
static void Gravity_OnChange(void) static void Gravity_OnChange(void)
@ -4504,7 +4503,7 @@ static void Gravity_OnChange(void)
#endif #endif
if (!CV_IsSetToDefault(&cv_gravity)) if (!CV_IsSetToDefault(&cv_gravity))
G_SetGameModified(multiplayer); G_SetGameModified(multiplayer, true);
gravity = cv_gravity.value; gravity = cv_gravity.value;
} }
@ -4900,7 +4899,7 @@ static void Fishcake_OnChange(void)
// so don't make modifiedgame always on! // so don't make modifiedgame always on!
if (cv_debug) if (cv_debug)
{ {
G_SetGameModified(multiplayer); G_SetGameModified(multiplayer, true);
} }
else if (cv_debug != cv_fishcake.value) else if (cv_debug != cv_fishcake.value)
@ -4917,11 +4916,11 @@ static void Fishcake_OnChange(void)
static void Command_Isgamemodified_f(void) static void Command_Isgamemodified_f(void)
{ {
if (savemoddata) if (savemoddata)
CONS_Printf(M_GetText("modifiedgame is true, but you can save medal and record data in this mod.\n")); CONS_Printf(M_GetText("The game is modified, but you can save medal and record data in this add-on.\n"));
else if (/*modifiedgame*/ majormods) else if (/*modifiedgame*/ majormods)
CONS_Printf(M_GetText("modifiedgame is true, extras will not be unlocked\n")); CONS_Printf(M_GetText("Major add-ons have been loaded, so you cannot play record attack.\n"));
else else
CONS_Printf(M_GetText("modifiedgame is false, you can unlock extras\n")); CONS_Printf(M_GetText("No major add-ons are loaded. You can play record attack, earn medals and unlock extras.\n"));
} }
static void Command_Cheats_f(void) static void Command_Cheats_f(void)

View File

@ -426,7 +426,7 @@ void CL_LoadServerFiles(void)
else if (fileneeded[i].status == FS_FOUND) else if (fileneeded[i].status == FS_FOUND)
{ {
P_AddWadFile(fileneeded[i].filename); P_AddWadFile(fileneeded[i].filename);
G_SetGameModified(true); G_SetGameModified(true, false);
fileneeded[i].status = FS_OPEN; fileneeded[i].status = FS_OPEN;
} }
else if (fileneeded[i].status == FS_MD5SUMBAD) else if (fileneeded[i].status == FS_MD5SUMBAD)

View File

@ -21,6 +21,7 @@
#include "w_wad.h" #include "w_wad.h"
#include "m_menu.h" #include "m_menu.h"
#include "m_misc.h" #include "m_misc.h"
#include "filesrch.h" // for refreshdirmenu
#include "f_finale.h" #include "f_finale.h"
#include "dehacked.h" #include "dehacked.h"
#include "st_stuff.h" #include "st_stuff.h"
@ -79,8 +80,6 @@ static powertype_t get_power(const char *word);
boolean deh_loaded = false; boolean deh_loaded = false;
static int dbg_line; static int dbg_line;
static boolean gamedataadded = false;
#ifdef DELFILE #ifdef DELFILE
typedef struct undehacked_s typedef struct undehacked_s
{ {
@ -3149,6 +3148,7 @@ static void readmaincfg(MYFILE *f)
strlcpy(gamedatafilename, word2, sizeof (gamedatafilename)); strlcpy(gamedatafilename, word2, sizeof (gamedatafilename));
strlwr(gamedatafilename); strlwr(gamedatafilename);
savemoddata = true; savemoddata = true;
majormods = false;
// Also save a time attack folder // Also save a time attack folder
filenamelen = strlen(gamedatafilename)-4; // Strip off the extension filenamelen = strlen(gamedatafilename)-4; // Strip off the extension
@ -3161,7 +3161,7 @@ static void readmaincfg(MYFILE *f)
// can't use sprintf since there is %u in savegamename // can't use sprintf since there is %u in savegamename
strcatbf(savegamename, srb2home, PATHSEP); strcatbf(savegamename, srb2home, PATHSEP);
gamedataadded = true; refreshdirmenu |= REFRESHDIR_GAMEDATA;
} }
else if (fastcmp(word, "RESETDATA")) else if (fastcmp(word, "RESETDATA"))
{ {
@ -3392,8 +3392,6 @@ static void DEH_LoadDehackedFile(MYFILE *f, UINT16 wad)
for (i = 0; i < NUMSFX; i++) for (i = 0; i < NUMSFX; i++)
savesfxnames[i] = S_sfx[i].name; savesfxnames[i] = S_sfx[i].name;
gamedataadded = false;
// it doesn't test the version of SRB2 and version of dehacked file // it doesn't test the version of SRB2 and version of dehacked file
dbg_line = -1; // start at -1 so the first line is 0. dbg_line = -1; // start at -1 so the first line is 0.
while (!myfeof(f)) while (!myfeof(f))
@ -3427,21 +3425,21 @@ static void DEH_LoadDehackedFile(MYFILE *f, UINT16 wad)
if (fastcmp(word, "FREESLOT")) if (fastcmp(word, "FREESLOT"))
{ {
readfreeslots(f); readfreeslots(f);
//majormods = true; //G_SetGameModified(multiplayer, true);
continue; continue;
} }
else if (fastcmp(word, "MAINCFG")) else if (fastcmp(word, "MAINCFG"))
{ {
G_SetGameModified(multiplayer, true);
readmaincfg(f); readmaincfg(f);
DEH_WriteUndoline(word, "", UNDO_HEADER); DEH_WriteUndoline(word, "", UNDO_HEADER);
majormods = true;
continue; continue;
} }
else if (fastcmp(word, "WIPES")) else if (fastcmp(word, "WIPES"))
{ {
readwipes(f); readwipes(f);
DEH_WriteUndoline(word, "", UNDO_HEADER); DEH_WriteUndoline(word, "", UNDO_HEADER);
//majormods = true; //G_SetGameModified(multiplayer, true);
continue; continue;
} }
word2 = strtok(NULL, " "); word2 = strtok(NULL, " ");
@ -3462,7 +3460,7 @@ static void DEH_LoadDehackedFile(MYFILE *f, UINT16 wad)
ignorelines(f); ignorelines(f);
} }
DEH_WriteUndoline(word, word2, UNDO_HEADER); DEH_WriteUndoline(word, word2, UNDO_HEADER);
//majormods = true; //G_SetGameModified(multiplayer, true);
continue; continue;
} }
if (word2) if (word2)
@ -3476,14 +3474,14 @@ static void DEH_LoadDehackedFile(MYFILE *f, UINT16 wad)
// Read texture from spec file. // Read texture from spec file.
readtexture(f, word2); readtexture(f, word2);
DEH_WriteUndoline(word, word2, UNDO_HEADER); DEH_WriteUndoline(word, word2, UNDO_HEADER);
//majormods = true; //G_SetGameModified(multiplayer, true);
} }
else if (fastcmp(word, "PATCH")) else if (fastcmp(word, "PATCH"))
{ {
// Read patch from spec file. // Read patch from spec file.
readpatch(f, word2, wad); readpatch(f, word2, wad);
DEH_WriteUndoline(word, word2, UNDO_HEADER); DEH_WriteUndoline(word, word2, UNDO_HEADER);
//majormods = true; //G_SetGameModified(multiplayer, true);
} }
else if (fastcmp(word, "THING") || fastcmp(word, "MOBJ") || fastcmp(word, "OBJECT")) else if (fastcmp(word, "THING") || fastcmp(word, "MOBJ") || fastcmp(word, "OBJECT"))
{ {
@ -3492,7 +3490,7 @@ static void DEH_LoadDehackedFile(MYFILE *f, UINT16 wad)
if (i < NUMMOBJTYPES && i >= 0) if (i < NUMMOBJTYPES && i >= 0)
{ {
if (i < (MT_FIRSTFREESLOT+freeslotusage[1][1])) if (i < (MT_FIRSTFREESLOT+freeslotusage[1][1]))
majormods = true; // affecting something earlier than the first freeslot allocated in this .wad? DENIED G_SetGameModified(multiplayer, true); // affecting something earlier than the first freeslot allocated in this .wad? DENIED
readthing(f, i); readthing(f, i);
} }
else else
@ -3505,7 +3503,7 @@ static void DEH_LoadDehackedFile(MYFILE *f, UINT16 wad)
/* else if (fastcmp(word, "ANIMTEX")) /* else if (fastcmp(word, "ANIMTEX"))
{ {
readAnimTex(f, i); readAnimTex(f, i);
//majormods = true; //G_SetGameModified(multiplayer, true);
}*/ }*/
else if (fastcmp(word, "LIGHT")) else if (fastcmp(word, "LIGHT"))
{ {
@ -3519,7 +3517,7 @@ static void DEH_LoadDehackedFile(MYFILE *f, UINT16 wad)
ignorelines(f); ignorelines(f);
} }
DEH_WriteUndoline(word, word2, UNDO_HEADER); DEH_WriteUndoline(word, word2, UNDO_HEADER);
//majormods = true; //G_SetGameModified(multiplayer, true);
#endif #endif
} }
else if (fastcmp(word, "SPRITE")) else if (fastcmp(word, "SPRITE"))
@ -3535,7 +3533,7 @@ static void DEH_LoadDehackedFile(MYFILE *f, UINT16 wad)
ignorelines(f); ignorelines(f);
} }
DEH_WriteUndoline(word, word2, UNDO_HEADER); DEH_WriteUndoline(word, word2, UNDO_HEADER);
//majormods = true; //G_SetGameModified(multiplayer, true);
#endif #endif
} }
else if (fastcmp(word, "LEVEL")) else if (fastcmp(word, "LEVEL"))
@ -3550,7 +3548,7 @@ static void DEH_LoadDehackedFile(MYFILE *f, UINT16 wad)
if (i > 0 && i <= NUMMAPS) if (i > 0 && i <= NUMMAPS)
{ {
if (mapheaderinfo[i]) if (mapheaderinfo[i])
majormods = true; // only mark as a major mod if it replaces an already-existing mapheaderinfo G_SetGameModified(multiplayer, true); // only mark as a major mod if it replaces an already-existing mapheaderinfo
readlevelheader(f, i); readlevelheader(f, i);
} }
else else
@ -3570,7 +3568,7 @@ static void DEH_LoadDehackedFile(MYFILE *f, UINT16 wad)
ignorelines(f); ignorelines(f);
} }
DEH_WriteUndoline(word, word2, UNDO_HEADER); DEH_WriteUndoline(word, word2, UNDO_HEADER);
//majormods = true; -- might have to reconsider in a future update //G_SetGameModified(multiplayer, true); -- might have to reconsider in a future update
} }
else if (fastcmp(word, "FRAME") || fastcmp(word, "STATE")) else if (fastcmp(word, "FRAME") || fastcmp(word, "STATE"))
{ {
@ -3579,7 +3577,7 @@ static void DEH_LoadDehackedFile(MYFILE *f, UINT16 wad)
if (i < NUMSTATES && i >= 0) if (i < NUMSTATES && i >= 0)
{ {
if (i < (S_FIRSTFREESLOT+freeslotusage[0][1])) if (i < (S_FIRSTFREESLOT+freeslotusage[0][1]))
majormods = true; // affecting something earlier than the first freeslot allocated in this .wad? DENIED G_SetGameModified(multiplayer, true); // affecting something earlier than the first freeslot allocated in this .wad? DENIED
readframe(f, i); readframe(f, i);
} }
else else
@ -3610,7 +3608,7 @@ static void DEH_LoadDehackedFile(MYFILE *f, UINT16 wad)
} }
else else
deh_warning("pointer (Frame %d) : missing ')'", i); deh_warning("pointer (Frame %d) : missing ')'", i);
majormods = true; G_SetGameModified(multiplayer, true);
}*/ }*/
else if (fastcmp(word, "SOUND")) else if (fastcmp(word, "SOUND"))
{ {
@ -3624,7 +3622,7 @@ static void DEH_LoadDehackedFile(MYFILE *f, UINT16 wad)
ignorelines(f); ignorelines(f);
} }
DEH_WriteUndoline(word, word2, UNDO_HEADER); DEH_WriteUndoline(word, word2, UNDO_HEADER);
//majormods = true; -- ...this won't bite me in the ass later, will it? //G_SetGameModified(multiplayer, true); -- ...this won't bite me in the ass later, will it?
} }
/* else if (fastcmp(word, "SPRITE")) /* else if (fastcmp(word, "SPRITE"))
{ {
@ -3645,7 +3643,7 @@ static void DEH_LoadDehackedFile(MYFILE *f, UINT16 wad)
} }
else else
deh_warning("Sprite %d doesn't exist",i); deh_warning("Sprite %d doesn't exist",i);
//majormods = true; //G_SetGameModified(multiplayer, true);
}*/ }*/
else if (fastcmp(word, "HUDITEM")) else if (fastcmp(word, "HUDITEM"))
{ {
@ -3659,11 +3657,11 @@ static void DEH_LoadDehackedFile(MYFILE *f, UINT16 wad)
ignorelines(f); ignorelines(f);
} }
DEH_WriteUndoline(word, word2, UNDO_HEADER); DEH_WriteUndoline(word, word2, UNDO_HEADER);
//majormods = true; //G_SetGameModified(multiplayer, true);
} }
else if (fastcmp(word, "EMBLEM")) else if (fastcmp(word, "EMBLEM"))
{ {
if (!gamedataadded) if (!(refreshdirmenu & REFRESHDIR_GAMEDATA))
{ {
deh_warning("You must define a custom gamedata to use \"%s\"", word); deh_warning("You must define a custom gamedata to use \"%s\"", word);
ignorelines(f); ignorelines(f);
@ -3673,7 +3671,7 @@ static void DEH_LoadDehackedFile(MYFILE *f, UINT16 wad)
if (numemblems < i) if (numemblems < i)
numemblems = i; numemblems = i;
reademblemdata(f, i); reademblemdata(f, i);
majormods = true; G_SetGameModified(multiplayer, true);
} }
else else
{ {
@ -3684,7 +3682,7 @@ static void DEH_LoadDehackedFile(MYFILE *f, UINT16 wad)
} }
else if (fastcmp(word, "EXTRAEMBLEM")) else if (fastcmp(word, "EXTRAEMBLEM"))
{ {
if (!gamedataadded) if (!(refreshdirmenu & REFRESHDIR_GAMEDATA))
{ {
deh_warning("You must define a custom gamedata to use \"%s\"", word); deh_warning("You must define a custom gamedata to use \"%s\"", word);
ignorelines(f); ignorelines(f);
@ -3694,7 +3692,7 @@ static void DEH_LoadDehackedFile(MYFILE *f, UINT16 wad)
if (numextraemblems < i) if (numextraemblems < i)
numextraemblems = i; numextraemblems = i;
readextraemblemdata(f, i); readextraemblemdata(f, i);
majormods = true; G_SetGameModified(multiplayer, true);
} }
else else
{ {
@ -3705,7 +3703,7 @@ static void DEH_LoadDehackedFile(MYFILE *f, UINT16 wad)
} }
else if (fastcmp(word, "UNLOCKABLE")) else if (fastcmp(word, "UNLOCKABLE"))
{ {
if (!gamedataadded) if (!(refreshdirmenu & REFRESHDIR_GAMEDATA))
{ {
deh_warning("You must define a custom gamedata to use \"%s\"", word); deh_warning("You must define a custom gamedata to use \"%s\"", word);
ignorelines(f); ignorelines(f);
@ -3713,7 +3711,7 @@ static void DEH_LoadDehackedFile(MYFILE *f, UINT16 wad)
else if (i > 0 && i <= MAXUNLOCKABLES) else if (i > 0 && i <= MAXUNLOCKABLES)
{ {
readunlockable(f, i - 1); readunlockable(f, i - 1);
majormods = true; G_SetGameModified(multiplayer, true);
} }
else else
{ {
@ -3724,7 +3722,7 @@ static void DEH_LoadDehackedFile(MYFILE *f, UINT16 wad)
} }
else if (fastcmp(word, "CONDITIONSET")) else if (fastcmp(word, "CONDITIONSET"))
{ {
if (!gamedataadded) if (!(refreshdirmenu & REFRESHDIR_GAMEDATA))
{ {
deh_warning("You must define a custom gamedata to use \"%s\"", word); deh_warning("You must define a custom gamedata to use \"%s\"", word);
ignorelines(f); ignorelines(f);
@ -3732,7 +3730,7 @@ static void DEH_LoadDehackedFile(MYFILE *f, UINT16 wad)
else if (i > 0 && i <= MAXCONDITIONSETS) else if (i > 0 && i <= MAXCONDITIONSETS)
{ {
readconditionset(f, (UINT8)i); readconditionset(f, (UINT8)i);
majormods = true; G_SetGameModified(multiplayer, true);
} }
else else
{ {
@ -3761,7 +3759,7 @@ static void DEH_LoadDehackedFile(MYFILE *f, UINT16 wad)
{ {
boolean clearall = (fastcmp(word2, "ALL")); boolean clearall = (fastcmp(word2, "ALL"));
if (!gamedataadded) if (!(refreshdirmenu & REFRESHDIR_GAMEDATA))
{ {
deh_warning("You must define a custom gamedata to use \"%s\"", word); deh_warning("You must define a custom gamedata to use \"%s\"", word);
continue; continue;
@ -3788,7 +3786,7 @@ static void DEH_LoadDehackedFile(MYFILE *f, UINT16 wad)
if (clearall || fastcmp(word2, "LEVELS")) if (clearall || fastcmp(word2, "LEVELS"))
clear_levels(); clear_levels();
majormods = true; G_SetGameModified(multiplayer, true);
} }
else else
deh_warning("Unknown word: %s", word); deh_warning("Unknown word: %s", word);
@ -3800,8 +3798,8 @@ static void DEH_LoadDehackedFile(MYFILE *f, UINT16 wad)
deh_warning("No word in this line: %s", s); deh_warning("No word in this line: %s", s);
} // end while } // end while
if (gamedataadded) /*if (gamedataadded) -- REFRESHDIR_GAMEDATA murdered this
G_LoadGameData(); G_LoadGameData();*/
dbg_line = -1; dbg_line = -1;
if (deh_num_warning) if (deh_num_warning)

View File

@ -88,7 +88,8 @@ typedef enum
REFRESHDIR_WARNING = 4, REFRESHDIR_WARNING = 4,
REFRESHDIR_ERROR = 8, REFRESHDIR_ERROR = 8,
REFRESHDIR_NOTLOADED = 16, REFRESHDIR_NOTLOADED = 16,
REFRESHDIR_MAX = 32 REFRESHDIR_MAX = 32,
REFRESHDIR_GAMEDATA = 64
} refreshdir_enum; } refreshdir_enum;
void closefilemenu(boolean validsize); void closefilemenu(boolean validsize);

View File

@ -16,6 +16,7 @@
#include "d_main.h" #include "d_main.h"
#include "d_player.h" #include "d_player.h"
#include "f_finale.h" #include "f_finale.h"
#include "filesrch.h" // for refreshdirmenu
#include "p_setup.h" #include "p_setup.h"
#include "p_saveg.h" #include "p_saveg.h"
#include "i_system.h" #include "i_system.h"
@ -753,16 +754,21 @@ void G_SetNightsRecords(void)
}*/ }*/
// for consistency among messages: this modifies the game and removes savemoddata. // for consistency among messages: this modifies the game and removes savemoddata.
void G_SetGameModified(boolean silent) void G_SetGameModified(boolean silent, boolean major)
{ {
if (modifiedgame && !savemoddata) if ((majormods && modifiedgame && !savemoddata) || (refreshdirmenu & REFRESHDIR_GAMEDATA)) // new gamedata amnesty?
return; return;
modifiedgame = true; modifiedgame = true;
savemoddata = false; savemoddata = false;
if (!major)
return;
majormods = true;
if (!silent) if (!silent)
CONS_Alert(CONS_NOTICE, M_GetText("Game must be restarted to record statistics.\n")); CONS_Alert(CONS_NOTICE, M_GetText("Game must be restarted to play record attack.\n"));
// If in record attack recording, cancel it. // If in record attack recording, cancel it.
if (modeattacking) if (modeattacking)

View File

@ -227,7 +227,7 @@ boolean G_GetRetryFlag(void);
void G_LoadGameData(void); void G_LoadGameData(void);
void G_LoadGameSettings(void); void G_LoadGameSettings(void);
void G_SetGameModified(boolean silent); void G_SetGameModified(boolean silent, boolean major);
void G_SetGamestate(gamestate_t newstate); void G_SetGamestate(gamestate_t newstate);

View File

@ -213,7 +213,7 @@ void LUA_LoadLump(UINT16 wad, UINT16 lump)
LUA_LoadFile(&f, name); // actually load file! LUA_LoadFile(&f, name); // actually load file!
// Okay, we've modified the game beyond the point of no return. // Okay, we've modified the game beyond the point of no return.
majormods = true; G_SetGameModified(multiplayer, true);
free(name); free(name);
Z_Free(f.data); Z_Free(f.data);

View File

@ -121,7 +121,7 @@ static UINT8 cheatf_devmode(void)
S_StartSound(0, sfx_itemup); S_StartSound(0, sfx_itemup);
// Just unlock all the things and turn on -debug and console devmode. // Just unlock all the things and turn on -debug and console devmode.
G_SetGameModified(false); G_SetGameModified(false, false); // might need to revist the latter later
for (i = 0; i < MAXUNLOCKABLES; i++) for (i = 0; i < MAXUNLOCKABLES; i++)
unlockables[i].unlocked = true; unlockables[i].unlocked = true;
devparm = true; devparm = true;
@ -295,7 +295,7 @@ void Command_CheatNoClip_f(void)
plyr->pflags ^= PF_NOCLIP; plyr->pflags ^= PF_NOCLIP;
CONS_Printf(M_GetText("No Clipping %s\n"), plyr->pflags & PF_NOCLIP ? M_GetText("On") : M_GetText("Off")); CONS_Printf(M_GetText("No Clipping %s\n"), plyr->pflags & PF_NOCLIP ? M_GetText("On") : M_GetText("Off"));
G_SetGameModified(multiplayer); G_SetGameModified(multiplayer, true);
} }
void Command_CheatGod_f(void) void Command_CheatGod_f(void)
@ -310,7 +310,7 @@ void Command_CheatGod_f(void)
plyr->pflags ^= PF_GODMODE; plyr->pflags ^= PF_GODMODE;
CONS_Printf(M_GetText("Sissy Mode %s\n"), plyr->pflags & PF_GODMODE ? M_GetText("On") : M_GetText("Off")); CONS_Printf(M_GetText("Sissy Mode %s\n"), plyr->pflags & PF_GODMODE ? M_GetText("On") : M_GetText("Off"));
G_SetGameModified(multiplayer); G_SetGameModified(multiplayer, true);
} }
void Command_CheatNoTarget_f(void) void Command_CheatNoTarget_f(void)
@ -325,7 +325,7 @@ void Command_CheatNoTarget_f(void)
plyr->pflags ^= PF_INVIS; plyr->pflags ^= PF_INVIS;
CONS_Printf(M_GetText("SEP Field %s\n"), plyr->pflags & PF_INVIS ? M_GetText("On") : M_GetText("Off")); CONS_Printf(M_GetText("SEP Field %s\n"), plyr->pflags & PF_INVIS ? M_GetText("On") : M_GetText("Off"));
G_SetGameModified(multiplayer); G_SetGameModified(multiplayer, true);
} }
void Command_Scale_f(void) void Command_Scale_f(void)
@ -727,7 +727,7 @@ void Command_Devmode_f(void)
return; return;
} }
G_SetGameModified(multiplayer); G_SetGameModified(multiplayer, true);
} }
/*void Command_Setrings_f(void) /*void Command_Setrings_f(void)
@ -1267,8 +1267,7 @@ void Command_ObjectPlace_f(void)
REQUIRE_SINGLEPLAYER; REQUIRE_SINGLEPLAYER;
REQUIRE_NOULTIMATE; REQUIRE_NOULTIMATE;
G_SetGameModified(multiplayer); G_SetGameModified(multiplayer, true);
majormods = true;
// Entering objectplace? // Entering objectplace?
if (!objectplacing) if (!objectplacing)

View File

@ -4555,7 +4555,7 @@ static boolean prevmajormods = false;
static void M_AddonsClearName(INT32 choice) static void M_AddonsClearName(INT32 choice)
{ {
if (majormods == prevmajormods || savemoddata) if (!majormods || prevmajormods)
{ {
CLEARNAME; CLEARNAME;
} }
@ -4568,10 +4568,14 @@ static boolean M_AddonsRefresh(void)
if ((refreshdirmenu & REFRESHDIR_NORMAL) && !preparefilemenu(true)) if ((refreshdirmenu & REFRESHDIR_NORMAL) && !preparefilemenu(true))
{ {
UNEXIST; UNEXIST;
CLEARNAME;
return true; return true;
} }
if ((refreshdirmenu & REFRESHDIR_ADDFILE) || (majormods != prevmajormods && !savemoddata)) if (!majormods && prevmajormods)
prevmajormods = false;
if ((refreshdirmenu & REFRESHDIR_ADDFILE) || (majormods && !prevmajormods))
{ {
char *message = NULL; char *message = NULL;
@ -4588,7 +4592,7 @@ static boolean M_AddonsRefresh(void)
S_StartSound(NULL, sfx_s224); S_StartSound(NULL, sfx_s224);
message = va("%c%s\x80\nA file was loaded with %s.\nCheck the console log for more information.\n\n(Press a key)\n", ('\x80' + (highlightflags>>V_CHARCOLORSHIFT)), refreshdirname, ((refreshdirmenu & REFRESHDIR_ERROR) ? "errors" : "warnings")); message = va("%c%s\x80\nA file was loaded with %s.\nCheck the console log for more information.\n\n(Press a key)\n", ('\x80' + (highlightflags>>V_CHARCOLORSHIFT)), refreshdirname, ((refreshdirmenu & REFRESHDIR_ERROR) ? "errors" : "warnings"));
} }
else if (majormods != prevmajormods && !savemoddata) else if (majormods && !prevmajormods && !savemoddata)
{ {
S_StartSound(NULL, sfx_s221); S_StartSound(NULL, sfx_s221);
message = va("%c%s\x80\nGameplay has now been modified.\nIf you want to play record attack mode, restart the game to clear existing add-ons.\n\n(Press a key)\n", ('\x80' + (highlightflags>>V_CHARCOLORSHIFT)), refreshdirname); message = va("%c%s\x80\nGameplay has now been modified.\nIf you want to play record attack mode, restart the game to clear existing add-ons.\n\n(Press a key)\n", ('\x80' + (highlightflags>>V_CHARCOLORSHIFT)), refreshdirname);
@ -5141,7 +5145,7 @@ static void M_GetAllEmeralds(INT32 choice)
emeralds = ((EMERALD7)*2)-1; emeralds = ((EMERALD7)*2)-1;
M_StartMessage(M_GetText("You now have all 7 emeralds.\nUse them wisely.\nWith great power comes great ring drain.\n"),NULL,MM_NOTHING); M_StartMessage(M_GetText("You now have all 7 emeralds.\nUse them wisely.\nWith great power comes great ring drain.\n"),NULL,MM_NOTHING);
G_SetGameModified(multiplayer); G_SetGameModified(multiplayer, true);
} }
static void M_DestroyRobotsResponse(INT32 ch) static void M_DestroyRobotsResponse(INT32 ch)
@ -5152,7 +5156,7 @@ static void M_DestroyRobotsResponse(INT32 ch)
// Destroy all robots // Destroy all robots
P_DestroyRobots(); P_DestroyRobots();
G_SetGameModified(multiplayer); G_SetGameModified(multiplayer, true);
} }
static void M_DestroyRobots(INT32 choice) static void M_DestroyRobots(INT32 choice)

View File

@ -3459,7 +3459,7 @@ boolean P_AddWadFile(const char *wadfilename)
if (num <= NUMMAPS && mapheaderinfo[num-1]) if (num <= NUMMAPS && mapheaderinfo[num-1])
{ {
if (mapheaderinfo[num-1]->menuflags & LF2_EXISTSHACK) if (mapheaderinfo[num-1]->menuflags & LF2_EXISTSHACK)
majormods = true; // oops, double-defined - no record attack privileges for you G_SetGameModified(multiplayer, true); // oops, double-defined - no record attack privileges for you
mapheaderinfo[num-1]->menuflags |= LF2_EXISTSHACK; mapheaderinfo[num-1]->menuflags |= LF2_EXISTSHACK;
} }
@ -3489,6 +3489,8 @@ boolean P_AddWadFile(const char *wadfilename)
SendNetXCmd(XD_EXITLEVEL, NULL, 0); SendNetXCmd(XD_EXITLEVEL, NULL, 0);
} }
refreshdirmenu &= ~REFRESHDIR_GAMEDATA; // Under usual circumstances we'd wait for REFRESHDIR_GAMEDATA to disappear the next frame, but it's a bit too dangerous for that...
return true; return true;
} }

View File

@ -34,6 +34,7 @@
#include "z_zone.h" #include "z_zone.h"
#include "fastcmp.h" #include "fastcmp.h"
#include "g_game.h" // G_LoadGameData
#include "filesrch.h" #include "filesrch.h"
#include "i_video.h" // rendermode #include "i_video.h" // rendermode
@ -799,6 +800,8 @@ UINT16 W_InitFile(const char *filename)
break; break;
} }
if (refreshdirmenu & REFRESHDIR_GAMEDATA)
G_LoadGameData();
DEH_UpdateMaxFreeslots(); DEH_UpdateMaxFreeslots();
W_InvalidateLumpnumCache(); W_InvalidateLumpnumCache();