mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
GAMEDATA MainCfg SOC block adustment
Discussed in DMs - All other `MainCfg` block properties require a custom gamedata (or be a main file) to be modified - When a custom gamedata is set, clear all unlockables, conditionsets, and emblems are unconditionally cleared - You may also Clear Levels only if a custom gamedata is used
This commit is contained in:
parent
b26da37477
commit
117b4c6a7b
3 changed files with 47 additions and 54 deletions
|
|
@ -2525,7 +2525,7 @@ void readconditionset(MYFILE *f, UINT8 setnum)
|
||||||
Z_Free(s);
|
Z_Free(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
void readmaincfg(MYFILE *f)
|
void readmaincfg(MYFILE *f, boolean mainfile)
|
||||||
{
|
{
|
||||||
char *s = Z_Malloc(MAXLINELEN, PU_STATIC, NULL);
|
char *s = Z_Malloc(MAXLINELEN, PU_STATIC, NULL);
|
||||||
char *word = s;
|
char *word = s;
|
||||||
|
|
@ -2565,7 +2565,49 @@ void readmaincfg(MYFILE *f)
|
||||||
|
|
||||||
value = atoi(word2); // used for numerical settings
|
value = atoi(word2); // used for numerical settings
|
||||||
|
|
||||||
if (fastcmp(word, "EXECCFG"))
|
if (fastcmp(word, "GAMEDATA"))
|
||||||
|
{
|
||||||
|
size_t filenamelen;
|
||||||
|
|
||||||
|
// Check the data filename so that mods
|
||||||
|
// can't write arbitrary files.
|
||||||
|
if (!GoodDataFileName(word2))
|
||||||
|
I_Error("Maincfg: bad data file name '%s'\n", word2);
|
||||||
|
|
||||||
|
G_SaveGameData();
|
||||||
|
strlcpy(gamedatafilename, word2, sizeof (gamedatafilename));
|
||||||
|
strlwr(gamedatafilename);
|
||||||
|
savemoddata = true;
|
||||||
|
majormods = false;
|
||||||
|
|
||||||
|
// Also save a time attack folder
|
||||||
|
filenamelen = strlen(gamedatafilename)-4; // Strip off the extension
|
||||||
|
filenamelen = min(filenamelen, sizeof (timeattackfolder));
|
||||||
|
strncpy(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);
|
||||||
|
|
||||||
|
strcpy(liveeventbackup, va("live%s.bkp", timeattackfolder));
|
||||||
|
strcatbf(liveeventbackup, srb2home, PATHSEP);
|
||||||
|
|
||||||
|
refreshdirmenu |= REFRESHDIR_GAMEDATA;
|
||||||
|
gamedataadded = true;
|
||||||
|
titlechanged = true;
|
||||||
|
|
||||||
|
clear_unlockables();
|
||||||
|
clear_conditionsets();
|
||||||
|
clear_emblems();
|
||||||
|
//clear_levels();
|
||||||
|
}
|
||||||
|
else if (!mainfile && !gamedataadded)
|
||||||
|
{
|
||||||
|
deh_warning("You must define a custom gamedata to use \"%s\"", word);
|
||||||
|
}
|
||||||
|
else if (fastcmp(word, "EXECCFG"))
|
||||||
{
|
{
|
||||||
if (strchr(word2, '.'))
|
if (strchr(word2, '.'))
|
||||||
COM_BufAddText(va("exec %s\n", word2));
|
COM_BufAddText(va("exec %s\n", word2));
|
||||||
|
|
@ -2750,40 +2792,6 @@ void readmaincfg(MYFILE *f)
|
||||||
{
|
{
|
||||||
maxXtraLife = (UINT8)get_number(word2);
|
maxXtraLife = (UINT8)get_number(word2);
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (fastcmp(word, "GAMEDATA"))
|
|
||||||
{
|
|
||||||
size_t filenamelen;
|
|
||||||
|
|
||||||
// Check the data filename so that mods
|
|
||||||
// can't write arbitrary files.
|
|
||||||
if (!GoodDataFileName(word2))
|
|
||||||
I_Error("Maincfg: bad data file name '%s'\n", word2);
|
|
||||||
|
|
||||||
G_SaveGameData();
|
|
||||||
strlcpy(gamedatafilename, word2, sizeof (gamedatafilename));
|
|
||||||
strlwr(gamedatafilename);
|
|
||||||
savemoddata = true;
|
|
||||||
majormods = false;
|
|
||||||
|
|
||||||
// Also save a time attack folder
|
|
||||||
filenamelen = strlen(gamedatafilename)-4; // Strip off the extension
|
|
||||||
filenamelen = min(filenamelen, sizeof (timeattackfolder));
|
|
||||||
strncpy(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);
|
|
||||||
|
|
||||||
strcpy(liveeventbackup, va("live%s.bkp", timeattackfolder));
|
|
||||||
strcatbf(liveeventbackup, srb2home, PATHSEP);
|
|
||||||
|
|
||||||
refreshdirmenu |= REFRESHDIR_GAMEDATA;
|
|
||||||
gamedataadded = true;
|
|
||||||
titlechanged = true;
|
|
||||||
}
|
|
||||||
else if (fastcmp(word, "RESETDATA"))
|
else if (fastcmp(word, "RESETDATA"))
|
||||||
{
|
{
|
||||||
P_ResetData(value);
|
P_ResetData(value);
|
||||||
|
|
|
||||||
|
|
@ -57,7 +57,7 @@ sfxenum_t get_sfx(const char *word);
|
||||||
skincolornum_t get_skincolor(const char *word);
|
skincolornum_t get_skincolor(const char *word);
|
||||||
|
|
||||||
void readwipes(MYFILE *f);
|
void readwipes(MYFILE *f);
|
||||||
void readmaincfg(MYFILE *f);
|
void readmaincfg(MYFILE *f, boolean mainfile);
|
||||||
void readconditionset(MYFILE *f, UINT8 setnum);
|
void readconditionset(MYFILE *f, UINT8 setnum);
|
||||||
void readunlockable(MYFILE *f, INT32 num);
|
void readunlockable(MYFILE *f, INT32 num);
|
||||||
void reademblemdata(MYFILE *f, INT32 num);
|
void reademblemdata(MYFILE *f, INT32 num);
|
||||||
|
|
|
||||||
|
|
@ -217,7 +217,7 @@ static void DEH_LoadDehackedFile(MYFILE *f, boolean mainfile)
|
||||||
else if (fastcmp(word, "MAINCFG"))
|
else if (fastcmp(word, "MAINCFG"))
|
||||||
{
|
{
|
||||||
G_SetGameModified(multiplayer, true);
|
G_SetGameModified(multiplayer, true);
|
||||||
readmaincfg(f);
|
readmaincfg(f, mainfile);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else if (fastcmp(word, "WIPES"))
|
else if (fastcmp(word, "WIPES"))
|
||||||
|
|
@ -548,28 +548,13 @@ static void DEH_LoadDehackedFile(MYFILE *f, boolean mainfile)
|
||||||
// (then again, modifiedgame will prevent game data saving anyway)
|
// (then again, modifiedgame will prevent game data saving anyway)
|
||||||
else if (fastcmp(word, "CLEAR"))
|
else if (fastcmp(word, "CLEAR"))
|
||||||
{
|
{
|
||||||
boolean clearall = (fastcmp(word2, "ALL"));
|
|
||||||
|
|
||||||
if (!mainfile && !gamedataadded)
|
if (!mainfile && !gamedataadded)
|
||||||
{
|
{
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (clearall || fastcmp(word2, "UNLOCKABLES"))
|
if (fastcmp(word2, "LEVELS"))
|
||||||
{
|
|
||||||
clear_unlockables();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (clearall || fastcmp(word2, "EMBLEMS"))
|
|
||||||
{
|
|
||||||
clear_emblems();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (clearall || fastcmp(word2, "CONDITIONSETS"))
|
|
||||||
clear_conditionsets();
|
|
||||||
|
|
||||||
if (clearall || fastcmp(word2, "LEVELS"))
|
|
||||||
clear_levels();
|
clear_levels();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue