Code cleanup as requested by Sal and Sryder.

* majormods and savemoddata cannot coexist as true values, so going through and making situations that involve both only reference one.
* Clean up comments in `dehacked.c`.
This commit is contained in:
toaster 2019-01-26 16:58:45 +00:00
parent d045af07b1
commit 1a21c5efbe
7 changed files with 19 additions and 20 deletions

View file

@ -2209,7 +2209,7 @@ static void Command_Map_f(void)
return; return;
} }
if (!(netgame || multiplayer) && (!majormods || savemoddata)) if (!(netgame || multiplayer) && !majormods)
{ {
if (COM_CheckParm("-force")) if (COM_CheckParm("-force"))
{ {

View file

@ -3425,7 +3425,7 @@ static void DEH_LoadDehackedFile(MYFILE *f, UINT16 wad)
if (fastcmp(word, "FREESLOT")) if (fastcmp(word, "FREESLOT"))
{ {
readfreeslots(f); readfreeslots(f);
//G_SetGameModified(multiplayer, true); // This is not a major mod.
continue; continue;
} }
else if (fastcmp(word, "MAINCFG")) else if (fastcmp(word, "MAINCFG"))
@ -3439,7 +3439,7 @@ static void DEH_LoadDehackedFile(MYFILE *f, UINT16 wad)
{ {
readwipes(f); readwipes(f);
DEH_WriteUndoline(word, "", UNDO_HEADER); DEH_WriteUndoline(word, "", UNDO_HEADER);
//G_SetGameModified(multiplayer, true); // This is not a major mod.
continue; continue;
} }
word2 = strtok(NULL, " "); word2 = strtok(NULL, " ");
@ -3460,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);
//G_SetGameModified(multiplayer, true); // This is not a major mod.
continue; continue;
} }
if (word2) if (word2)
@ -3474,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);
//G_SetGameModified(multiplayer, true); // This is not a major mod.
} }
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);
//G_SetGameModified(multiplayer, true); // This is not a major mod.
} }
else if (fastcmp(word, "THING") || fastcmp(word, "MOBJ") || fastcmp(word, "OBJECT")) else if (fastcmp(word, "THING") || fastcmp(word, "MOBJ") || fastcmp(word, "OBJECT"))
{ {
@ -3503,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);
//G_SetGameModified(multiplayer, true); // This is not a major mod.
}*/ }*/
else if (fastcmp(word, "LIGHT")) else if (fastcmp(word, "LIGHT"))
{ {
@ -3517,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);
//G_SetGameModified(multiplayer, true); // This is not a major mod.
#endif #endif
} }
else if (fastcmp(word, "SPRITE")) else if (fastcmp(word, "SPRITE"))
@ -3533,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);
//G_SetGameModified(multiplayer, true); // This is not a major mod.
#endif #endif
} }
else if (fastcmp(word, "LEVEL")) else if (fastcmp(word, "LEVEL"))
@ -3622,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);
//G_SetGameModified(multiplayer, true); -- ...this won't bite me in the ass later, will it? // This is not a major mod.
} }
/* else if (fastcmp(word, "SPRITE")) /* else if (fastcmp(word, "SPRITE"))
{ {
@ -3643,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);
//G_SetGameModified(multiplayer, true); // This is not a major mod.
}*/ }*/
else if (fastcmp(word, "HUDITEM")) else if (fastcmp(word, "HUDITEM"))
{ {
@ -3657,7 +3657,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);
//G_SetGameModified(multiplayer, true); // This is not a major mod.
} }
else if (fastcmp(word, "EMBLEM")) else if (fastcmp(word, "EMBLEM"))
{ {

View file

@ -756,7 +756,7 @@ 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, boolean major) void G_SetGameModified(boolean silent, boolean major)
{ {
if ((majormods && modifiedgame && !savemoddata) || !mainwads || (refreshdirmenu & REFRESHDIR_GAMEDATA)) // new gamedata amnesty? if ((majormods && modifiedgame) || !mainwads || (refreshdirmenu & REFRESHDIR_GAMEDATA)) // new gamedata amnesty?
return; return;
modifiedgame = true; modifiedgame = true;

View file

@ -385,8 +385,7 @@ UINT8 M_UpdateUnlockablesAndExtraEmblems(boolean force)
char cechoText[992] = ""; char cechoText[992] = "";
UINT8 cechoLines = 0; UINT8 cechoLines = 0;
if (/*modifiedgame*/ majormods && !savemoddata if (majormods && !force) // SRB2Kart: for enabling unlocks online in modified servers
&& !force) // SRB2Kart: for enabling unlocks online in modified servers
return false; return false;
M_CheckUnlockConditions(); M_CheckUnlockConditions();

View file

@ -2738,7 +2738,7 @@ boolean M_Responder(event_t *ev)
|| (currentMenu->menuitems[itemOn].status & IT_TYPE)==IT_SUBMENU) || (currentMenu->menuitems[itemOn].status & IT_TYPE)==IT_SUBMENU)
&& (currentMenu->menuitems[itemOn].status & IT_CALLTYPE)) && (currentMenu->menuitems[itemOn].status & IT_CALLTYPE))
{ {
if (((currentMenu->menuitems[itemOn].status & IT_CALLTYPE) & IT_CALL_NOTMODIFIED) && /*modifiedgame*/ majormods && !savemoddata) if (((currentMenu->menuitems[itemOn].status & IT_CALLTYPE) & IT_CALL_NOTMODIFIED) && majormods)
{ {
S_StartSound(NULL, sfx_menu1); S_StartSound(NULL, sfx_menu1);
M_StartMessage(M_GetText("This cannot be done with complex add-ons\nor in a cheated game.\n\n(Press a key)\n"), NULL, MM_NOTHING); M_StartMessage(M_GetText("This cannot be done with complex add-ons\nor in a cheated game.\n\n(Press a key)\n"), NULL, MM_NOTHING);
@ -4567,7 +4567,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)
{ {
S_StartSound(NULL, sfx_s221); S_StartSound(NULL, sfx_s221);
message = va("%c%s\x80\nGameplay has now been modified.\nif you wish 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 wish to play record attack mode, restart the game to clear existing add-ons.\n\n(Press a key)\n", ('\x80' + (highlightflags>>V_CHARCOLORSHIFT)), refreshdirname);

View file

@ -1120,7 +1120,7 @@ static inline void P_SpawnEmblems(void)
static void P_SpawnSecretItems(boolean loademblems) static void P_SpawnSecretItems(boolean loademblems)
{ {
// Now let's spawn those funky emblem things! Tails 12-08-2002 // Now let's spawn those funky emblem things! Tails 12-08-2002
if (netgame || multiplayer || (/*modifiedgame*/ majormods && !savemoddata)) // No cheating!! if (netgame || multiplayer || majormods) // No cheating!!
return; return;
if (loademblems) if (loademblems)
@ -3272,7 +3272,7 @@ boolean P_SetupLevel(boolean skipprecip)
nextmapoverride = 0; nextmapoverride = 0;
skipstats = false; skipstats = false;
if (!(netgame || multiplayer) && (/*!modifiedgame*/ !majormods || savemoddata)) if (!(netgame || multiplayer) && !majormods)
mapvisited[gamemap-1] |= MV_VISITED; mapvisited[gamemap-1] |= MV_VISITED;
levelloading = false; levelloading = false;

View file

@ -786,7 +786,7 @@ void Y_StartIntermission(void)
} }
case int_race: // (time-only race) case int_race: // (time-only race)
{ {
if ((/*!modifiedgame*/ !majormods || savemoddata) && !multiplayer && !demoplayback) // remove this once we have a proper time attack screen if (!majormods && !multiplayer && !demoplayback) // remove this once we have a proper time attack screen
{ {
// Update visitation flags // Update visitation flags
mapvisited[gamemap-1] |= MV_BEATEN; mapvisited[gamemap-1] |= MV_BEATEN;