diff --git a/src/dehacked.c b/src/dehacked.c index 3e113072..a44a26b0 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -3082,7 +3082,7 @@ static void readmaincfg(MYFILE *f) if (!GoodDataFileName(word2)) I_Error("Maincfg: bad data file name '%s'\n", word2); - G_SaveGameData(); + G_SaveGameData(false); DEH_WriteUndoline(word, gamedatafilename, UNDO_NONE); strlcpy(gamedatafilename, word2, sizeof (gamedatafilename)); strlwr(gamedatafilename); diff --git a/src/f_finale.c b/src/f_finale.c index 5f018e7d..5d77e63b 100644 --- a/src/f_finale.c +++ b/src/f_finale.c @@ -775,10 +775,10 @@ void F_GameEvaluationDrawer(void) /*if (ultimatemode) ++timesBeatenUltimate;*/ - if (M_UpdateUnlockablesAndExtraEmblems()) + if (M_UpdateUnlockablesAndExtraEmblems(false)) S_StartSound(NULL, sfx_ncitem); - G_SaveGameData(); + G_SaveGameData(false); } } diff --git a/src/g_game.c b/src/g_game.c index b896c30f..d6b3e8dd 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -2259,10 +2259,10 @@ static inline void G_PlayerFinishLevel(INT32 player) if (legitimateexit && !demoplayback) // (yes you're allowed to unlock stuff this way when the game is modified) { matchesplayed++; - if (M_UpdateUnlockablesAndExtraEmblems()) + if (M_UpdateUnlockablesAndExtraEmblems(true)) { S_StartSound(NULL, sfx_ncitem); - G_SaveGameData(); // only save if unlocked something + G_SaveGameData(true); // only save if unlocked something } } @@ -3643,7 +3643,7 @@ void G_LoadGameData(void) // G_SaveGameData // Saves the main data file, which stores information such as emblems found, etc. -void G_SaveGameData(void) +void G_SaveGameData(boolean force) { size_t length; INT32 i, j; @@ -3661,7 +3661,8 @@ void G_SaveGameData(void) return; } - if (modifiedgame && !savemoddata) + if (modifiedgame && !savemoddata + && !force) // SRB2Kart: for enabling unlocks online in modified servers { free(savebuffer); save_p = savebuffer = NULL; diff --git a/src/g_game.h b/src/g_game.h index 78f08e36..f59641fb 100644 --- a/src/g_game.h +++ b/src/g_game.h @@ -127,7 +127,7 @@ void G_DeferedPlayDemo(const char *demo); // Can be called by the startup code or M_Responder, calls P_SetupLevel. void G_LoadGame(UINT32 slot, INT16 mapoverride); -void G_SaveGameData(void); +void G_SaveGameData(boolean force); void G_SaveGame(UINT32 slot); diff --git a/src/m_cond.c b/src/m_cond.c index 9025c521..f2b163ea 100644 --- a/src/m_cond.c +++ b/src/m_cond.c @@ -295,13 +295,14 @@ void M_CheckUnlockConditions(void) } } -UINT8 M_UpdateUnlockablesAndExtraEmblems(void) +UINT8 M_UpdateUnlockablesAndExtraEmblems(boolean force) { INT32 i; char cechoText[992] = ""; UINT8 cechoLines = 0; - if (modifiedgame && !savemoddata) + if (modifiedgame && !savemoddata + && !force) // SRB2Kart: for enabling unlocks online in modified servers return false; M_CheckUnlockConditions(); diff --git a/src/m_cond.h b/src/m_cond.h index aadf301b..052c31f2 100644 --- a/src/m_cond.h +++ b/src/m_cond.h @@ -152,7 +152,7 @@ void M_ClearSecrets(void); // Updating conditions and unlockables void M_CheckUnlockConditions(void); UINT8 M_CheckCondition(condition_t *cn); -UINT8 M_UpdateUnlockablesAndExtraEmblems(void); +UINT8 M_UpdateUnlockablesAndExtraEmblems(boolean force); void M_SilentUpdateUnlockablesAndEmblems(void); UINT8 M_CheckLevelEmblems(void); diff --git a/src/p_inter.c b/src/p_inter.c index 98481ebb..da84a1fc 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -607,9 +607,9 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) return; emblemlocations[special->health-1].collected = true; - M_UpdateUnlockablesAndExtraEmblems(); + M_UpdateUnlockablesAndExtraEmblems(false); - G_SaveGameData(); + G_SaveGameData(false); break; } diff --git a/src/p_spec.c b/src/p_spec.c index 46e6685d..2c097884 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -3015,10 +3015,10 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) unlocktriggers |= 1 << trigid; // Unlocked something? - if (M_UpdateUnlockablesAndExtraEmblems()) + if (M_UpdateUnlockablesAndExtraEmblems(false)) { S_StartSound(NULL, sfx_ncitem); - G_SaveGameData(); // only save if unlocked something + G_SaveGameData(false); // only save if unlocked something } } } diff --git a/src/p_user.c b/src/p_user.c index f2cf84f4..92dc9d0d 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -1650,7 +1650,7 @@ void P_DoPlayerExit(player_t *player) || (splitscreen && player == &players[secondarydisplayplayer]) || (splitscreen > 1 && player == &players[thirddisplayplayer]) || (splitscreen > 2 && player == &players[fourthdisplayplayer])) - && (!player->spectator && ((!modifiedgame || savemoddata) && !demoplayback))) + && (!player->spectator && !demoplayback)) legitimateexit = true; if (G_RaceGametype()) // If in Race Mode, allow @@ -9286,6 +9286,7 @@ void P_PlayerThink(player_t *player) CONS_Printf(M_GetText("%s ran out of time.\n"), player_names[player-players]); player->pflags |= PF_TIMEOVER; + legitimateexit = true; // SRB2kart: losing a race is still seeing it through to the end :p if (player->pflags & PF_NIGHTSMODE) { diff --git a/src/sdl/i_system.c b/src/sdl/i_system.c index 4a987609..9ee17cc3 100644 --- a/src/sdl/i_system.c +++ b/src/sdl/i_system.c @@ -2770,7 +2770,7 @@ void I_Quit(void) #ifndef NONET D_SaveBan(); // save the ban list #endif - G_SaveGameData(); // Tails 12-08-2002 + G_SaveGameData(false); // Tails 12-08-2002 //added:16-02-98: when recording a demo, should exit using 'q' key, // but sometimes we forget and use 'F10'.. so save here too. @@ -2853,7 +2853,7 @@ void I_Error(const char *error, ...) if (errorcount == 9) { M_SaveConfig(NULL); - G_SaveGameData(); + G_SaveGameData(false); } if (errorcount > 20) { @@ -2887,7 +2887,7 @@ void I_Error(const char *error, ...) #ifndef NONET D_SaveBan(); // save the ban list #endif - G_SaveGameData(); // Tails 12-08-2002 + G_SaveGameData(false); // Tails 12-08-2002 // Shutdown. Here might be other errors. if (demorecording) diff --git a/src/y_inter.c b/src/y_inter.c index d2fe08e9..d6f2aa30 100644 --- a/src/y_inter.c +++ b/src/y_inter.c @@ -781,10 +781,10 @@ void Y_Ticker(void) // Update when done with tally if ((!modifiedgame || savemoddata) && !(netgame || multiplayer) && !demoplayback) { - if (M_UpdateUnlockablesAndExtraEmblems()) + if (M_UpdateUnlockablesAndExtraEmblems(false)) S_StartSound(NULL, sfx_ncitem); - G_SaveGameData(); + G_SaveGameData(false); } } else if (!(intertic & 1)) @@ -848,10 +848,10 @@ void Y_Ticker(void) // Update when done with tally if ((!modifiedgame || savemoddata) && !(netgame || multiplayer) && !demoplayback) { - if (M_UpdateUnlockablesAndExtraEmblems()) + if (M_UpdateUnlockablesAndExtraEmblems(false)) S_StartSound(NULL, sfx_ncitem); - G_SaveGameData(); + G_SaveGameData(false); } } else if (!(intertic & 1))