From 004cde8a5761180641050ba39de599337a8a1f30 Mon Sep 17 00:00:00 2001 From: toaster Date: Sat, 26 Jan 2019 16:58:45 +0000 Subject: [PATCH] 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`. --- src/d_netcmd.c | 2 +- src/dehacked.c | 22 +++++++++++----------- src/g_game.c | 2 +- src/m_cond.c | 3 +-- src/m_menu.c | 4 ++-- src/p_setup.c | 4 ++-- src/y_inter.c | 2 +- 7 files changed, 19 insertions(+), 20 deletions(-) diff --git a/src/d_netcmd.c b/src/d_netcmd.c index 1da2c5234..67f8c3a2b 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -2209,7 +2209,7 @@ static void Command_Map_f(void) return; } - if (!(netgame || multiplayer) && (!majormods || savemoddata)) + if (!(netgame || multiplayer) && !majormods) { if (COM_CheckParm("-force")) { diff --git a/src/dehacked.c b/src/dehacked.c index 835502820..0ad67ff0b 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -3425,7 +3425,7 @@ static void DEH_LoadDehackedFile(MYFILE *f, UINT16 wad) if (fastcmp(word, "FREESLOT")) { readfreeslots(f); - //G_SetGameModified(multiplayer, true); + // This is not a major mod. continue; } else if (fastcmp(word, "MAINCFG")) @@ -3439,7 +3439,7 @@ static void DEH_LoadDehackedFile(MYFILE *f, UINT16 wad) { readwipes(f); DEH_WriteUndoline(word, "", UNDO_HEADER); - //G_SetGameModified(multiplayer, true); + // This is not a major mod. continue; } word2 = strtok(NULL, " "); @@ -3460,7 +3460,7 @@ static void DEH_LoadDehackedFile(MYFILE *f, UINT16 wad) ignorelines(f); } DEH_WriteUndoline(word, word2, UNDO_HEADER); - //G_SetGameModified(multiplayer, true); + // This is not a major mod. continue; } if (word2) @@ -3474,14 +3474,14 @@ static void DEH_LoadDehackedFile(MYFILE *f, UINT16 wad) // Read texture from spec file. readtexture(f, word2); DEH_WriteUndoline(word, word2, UNDO_HEADER); - //G_SetGameModified(multiplayer, true); + // This is not a major mod. } else if (fastcmp(word, "PATCH")) { // Read patch from spec file. readpatch(f, word2, wad); 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")) { @@ -3503,7 +3503,7 @@ static void DEH_LoadDehackedFile(MYFILE *f, UINT16 wad) /* else if (fastcmp(word, "ANIMTEX")) { readAnimTex(f, i); - //G_SetGameModified(multiplayer, true); + // This is not a major mod. }*/ else if (fastcmp(word, "LIGHT")) { @@ -3517,7 +3517,7 @@ static void DEH_LoadDehackedFile(MYFILE *f, UINT16 wad) ignorelines(f); } DEH_WriteUndoline(word, word2, UNDO_HEADER); - //G_SetGameModified(multiplayer, true); + // This is not a major mod. #endif } else if (fastcmp(word, "SPRITE")) @@ -3533,7 +3533,7 @@ static void DEH_LoadDehackedFile(MYFILE *f, UINT16 wad) ignorelines(f); } DEH_WriteUndoline(word, word2, UNDO_HEADER); - //G_SetGameModified(multiplayer, true); + // This is not a major mod. #endif } else if (fastcmp(word, "LEVEL")) @@ -3622,7 +3622,7 @@ static void DEH_LoadDehackedFile(MYFILE *f, UINT16 wad) ignorelines(f); } 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")) { @@ -3643,7 +3643,7 @@ static void DEH_LoadDehackedFile(MYFILE *f, UINT16 wad) } else deh_warning("Sprite %d doesn't exist",i); - //G_SetGameModified(multiplayer, true); + // This is not a major mod. }*/ else if (fastcmp(word, "HUDITEM")) { @@ -3657,7 +3657,7 @@ static void DEH_LoadDehackedFile(MYFILE *f, UINT16 wad) ignorelines(f); } DEH_WriteUndoline(word, word2, UNDO_HEADER); - //G_SetGameModified(multiplayer, true); + // This is not a major mod. } else if (fastcmp(word, "EMBLEM")) { diff --git a/src/g_game.c b/src/g_game.c index e347cf7c5..1e0744f4c 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -756,7 +756,7 @@ void G_SetNightsRecords(void) // for consistency among messages: this modifies the game and removes savemoddata. 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; modifiedgame = true; diff --git a/src/m_cond.c b/src/m_cond.c index b0e49a683..b777e7d22 100644 --- a/src/m_cond.c +++ b/src/m_cond.c @@ -385,8 +385,7 @@ UINT8 M_UpdateUnlockablesAndExtraEmblems(boolean force) char cechoText[992] = ""; UINT8 cechoLines = 0; - if (/*modifiedgame*/ majormods && !savemoddata - && !force) // SRB2Kart: for enabling unlocks online in modified servers + if (majormods && !force) // SRB2Kart: for enabling unlocks online in modified servers return false; M_CheckUnlockConditions(); diff --git a/src/m_menu.c b/src/m_menu.c index 1edb1cdff..2ea7234c2 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -2738,7 +2738,7 @@ boolean M_Responder(event_t *ev) || (currentMenu->menuitems[itemOn].status & IT_TYPE)==IT_SUBMENU) && (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); 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); 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); 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); diff --git a/src/p_setup.c b/src/p_setup.c index fcb1ac786..912791cf9 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -1120,7 +1120,7 @@ static inline void P_SpawnEmblems(void) static void P_SpawnSecretItems(boolean loademblems) { // 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; if (loademblems) @@ -3272,7 +3272,7 @@ boolean P_SetupLevel(boolean skipprecip) nextmapoverride = 0; skipstats = false; - if (!(netgame || multiplayer) && (/*!modifiedgame*/ !majormods || savemoddata)) + if (!(netgame || multiplayer) && !majormods) mapvisited[gamemap-1] |= MV_VISITED; levelloading = false; diff --git a/src/y_inter.c b/src/y_inter.c index 046d6d6d3..795f7f1b4 100644 --- a/src/y_inter.c +++ b/src/y_inter.c @@ -786,7 +786,7 @@ void Y_StartIntermission(void) } 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 mapvisited[gamemap-1] |= MV_BEATEN;