Revert "make game use seperate save when addons are loaded"

This reverts commit 07e1c9e993.
This commit is contained in:
Alug committed 2025-01-13 15:58:28 +01:00
1 parent 723f5a97f2
commit 6fa1ec8a07
5 files changed
+9 -69

No files matched your search

+5 -4
View File
@@ -1800,7 +1800,7 @@ static void readsound(MYFILE *f, INT32 num, const char *savesfxnames[])
* \sa readmaincfg()
* \author Graue <graue@oceanbase.org>
*/
/*static boolean GoodDataFileName(const char *s)
static boolean GoodDataFileName(const char *s)
{
const char *p;
const char *tail = ".dat";
@@ -1820,7 +1820,7 @@ static void readsound(MYFILE *f, INT32 num, const char *savesfxnames[])
if (fasticmp(s, "online.dat")) return false; // SRB2Kart online replay folder
return true;
}*/
}
static void reademblemdata(MYFILE *f, INT32 num)
{
@@ -2598,7 +2598,8 @@ static void readmaincfg(MYFILE *f)
{
maxXtraLife = (UINT8)get_number(word2);
}
/*else if (fastcmp(word, "GAMEDATA"))
else if (fastcmp(word, "GAMEDATA"))
{
size_t filenamelen;
@@ -2625,7 +2626,7 @@ static void readmaincfg(MYFILE *f)
strcatbf(savegamename, srb2home, PATHSEP);
refreshdirmenu |= REFRESHDIR_GAMEDATA;
}*/
}
else if (fastcmp(word, "RESETDATA"))
{
P_ResetData(value);
+1 -1
View File
@@ -351,7 +351,7 @@ enum GameType // SRB2Kart
// String names for gametypes
extern const char *Gametype_Names[NUMGAMETYPES];
extern tic_t totalplaytime, raplaytime, onlineplaytime, raceplaytime, battleplaytime;
extern tic_t totalplaytime;
extern UINT32 matchesplayed;
extern UINT8 stagefailed;
+2 -50
View File
@@ -175,7 +175,7 @@ INT32 tokenbits; // Used for setting token bits
// Old Special Stage
INT32 sstimer; // Time allotted in the special stage
tic_t totalplaytime, raplaytime, onlineplaytime, raceplaytime, battleplaytime;
tic_t totalplaytime;
UINT32 matchesplayed; // SRB2Kart
boolean gamedataloaded = false;
@@ -609,31 +609,6 @@ tic_t G_GetBestTime(INT16 map)
return mainrecords[map-1]->time;
}
// hack t
static void G_SetSaveGameModified(void)
{
size_t filenamelen;
savemoddata = true;
majormods = false; // FIXME: this breaks the menu warning screen from popping up, id still want to use it to mention the diff savefile
strlcpy(gamedatafilename, "modkartdata.dat", sizeof (gamedatafilename));
strlwr(gamedatafilename);
// Also save a time attack folder
filenamelen = strlen(gamedatafilename)-4; // Strip off the extension
filenamelen = min(filenamelen, sizeof (timeattackfolder));
memcpy(timeattackfolder, gamedatafilename, filenamelen);
timeattackfolder[min(filenamelen, sizeof (timeattackfolder) - 1)] = '\0';
strcpy(savegamename, timeattackfolder);
strlcat(savegamename, "%u.ssg", sizeof(savegamename));
// can't use sprintf since there is %u in savegamename
strcatbf(savegamename, srb2home, PATHSEP);
G_LoadGameData();
}
// for consistency among messages: this modifies the game and removes savemoddata.
void G_SetGameModified(boolean silent, boolean major)
{
@@ -648,10 +623,8 @@ void G_SetGameModified(boolean silent, boolean major)
//savemoddata = false; -- there is literally no reason to do this anymore.
majormods = true;
G_SetSaveGameModified();
if (!silent)
CONS_Alert(CONS_NOTICE, M_GetText("Record Attack data will be saved to seperate save.\n"));
CONS_Alert(CONS_NOTICE, M_GetText("Game must be restarted to play Record Attack.\n"));
// If in record attack recording, cancel it.
if (modeattacking)
@@ -3594,10 +3567,6 @@ void G_LoadGameData(void)
M_ClearSecrets(); // emblems, unlocks, maps visited, etc
totalplaytime = 0; // total play time (separate from all)
matchesplayed = 0; // SRB2Kart: matches played & finished
raplaytime = 0; // SRB2Kart: Record attack play time
onlineplaytime = 0; // SRB2Kart: online play time
raceplaytime = 0; // SRB2Kart: race mode play time
battleplaytime = 0; // SRB2Kart: battle mode play time
if (M_CheckParm("-nodata"))
return; // Don't load.
@@ -3629,15 +3598,6 @@ void G_LoadGameData(void)
totalplaytime = READUINT32(save.p);
matchesplayed = READUINT32(save.p);
// well no clue but dont think it would like reading garbage from vanilla files
if (strcmp(gamedatafilename, "modkartdata.dat") == 0)
{
raplaytime = READUINT32(save.p);
onlineplaytime = READUINT32(save.p);
raceplaytime = READUINT32(save.p);
battleplaytime = READUINT32(save.p);
}
modded = READUINT8(save.p);
// Aha! Someone's been screwing with the save file!
@@ -3753,14 +3713,6 @@ void G_SaveGameData(boolean force)
WRITEUINT32(save.p, totalplaytime);
WRITEUINT32(save.p, matchesplayed);
if (strcmp(gamedatafilename, "modkartdata.dat") == 0)
{
WRITEUINT32(save.p, raplaytime);
WRITEUINT32(save.p, onlineplaytime);
WRITEUINT32(save.p, raceplaytime);
WRITEUINT32(save.p, battleplaytime);
}
btemp = (UINT8)(savemoddata); // what used to be here was profoundly dunderheaded
WRITEUINT8(save.p, btemp);
+1 -1
View File
@@ -6245,7 +6245,7 @@ static boolean M_AddonsRefresh(void)
else if (majormods && !prevmajormods)
{
S_StartSound(NULL, sfx_s221);
message = va("%c%s\x80\nYou've loaded a gameplay-modifying addon.\n\nRecord Attack data will be saved to seperate save.\n\n(Press a key)\n", ('\x80' + (highlightflags>>V_CHARCOLORSHIFT)), refreshdirname);
message = va("%c%s\x80\nYou've loaded a gameplay-modifying addon.\n\nRecord Attack has been disabled, but you\ncan still play alone in local Multiplayer.\n\nIf you wish to play Record Attack mode, restart the game to disable loaded addons.\n\n(Press a key)\n", ('\x80' + (highlightflags>>V_CHARCOLORSHIFT)), refreshdirname);
prevmajormods = majormods;
}
-13
View File
@@ -618,21 +618,8 @@ void P_Ticker(boolean run)
// Keep track of how long they've been playing!
if (!demo.playback) // Don't increment if a demo is playing.
{
totalplaytime++;
if (netgame)
onlineplaytime++;
else if (modeattacking)
raplaytime++;
if (G_RaceGametype())
raceplaytime++;
else if (G_BattleGametype())
battleplaytime++;
}
if (run)
{
// Dynamic slopeness