mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
"Clear GP and Record Data" has handed off some of its respnsibilities
- Map visitation flags (used for level select access) are now cleared by using "Clear Challenges Data" instead
- Custom courses will still have their data completely wiped here because it's the case most likely to mean "I want to remove everything", and because I don't want to pick through all the possible places to nuke 'em
- Skin stats (and Eidolon's map stats) are now cleared by using "Clear Statistics Data" instead
This commit is contained in:
parent
e46f246c95
commit
a1ed3f8b23
2 changed files with 59 additions and 15 deletions
21
src/g_game.c
21
src/g_game.c
|
|
@ -344,14 +344,10 @@ void G_ClearRecords(void)
|
||||||
{
|
{
|
||||||
UINT16 i;
|
UINT16 i;
|
||||||
|
|
||||||
for (i = 0; i < numskins; i++)
|
|
||||||
{
|
|
||||||
memset(&skins[i].records, 0, sizeof(skins[i].records));
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0; i < nummapheaders; i++)
|
for (i = 0; i < nummapheaders; i++)
|
||||||
{
|
{
|
||||||
memset(&mapheaderinfo[i]->records, 0, sizeof(recorddata_t));
|
memset(&mapheaderinfo[i]->records.timeattack, 0, sizeof(recordtimes_t));
|
||||||
|
memset(&mapheaderinfo[i]->records.spbattack, 0, sizeof(recordtimes_t));
|
||||||
}
|
}
|
||||||
|
|
||||||
cupheader_t *cup;
|
cupheader_t *cup;
|
||||||
|
|
@ -360,14 +356,11 @@ void G_ClearRecords(void)
|
||||||
memset(&cup->windata, 0, sizeof(cup->windata));
|
memset(&cup->windata, 0, sizeof(cup->windata));
|
||||||
}
|
}
|
||||||
|
|
||||||
unloaded_skin_t *unloadedskin, *nextunloadedskin = NULL;
|
// TODO: Technically, these should only remove time attack records here.
|
||||||
for (unloadedskin = unloadedskins; unloadedskin; unloadedskin = nextunloadedskin)
|
// But I'm out of juice for dev (+ literally, just finished some OJ).
|
||||||
{
|
// The stats need to be cleared in M_ClearStats, and I guess there's
|
||||||
nextunloadedskin = unloadedskin->next;
|
// no perfect place to wipe mapvisited because it's not actually part of
|
||||||
Z_Free(unloadedskin);
|
// basegame progression... so here's fine for launch. ~toast 100424
|
||||||
}
|
|
||||||
unloadedskins = NULL;
|
|
||||||
|
|
||||||
unloaded_mapheader_t *unloadedmap, *nextunloadedmap = NULL;
|
unloaded_mapheader_t *unloadedmap, *nextunloadedmap = NULL;
|
||||||
for (unloadedmap = unloadedmapheaders; unloadedmap; unloadedmap = nextunloadedmap)
|
for (unloadedmap = unloadedmapheaders; unloadedmap; unloadedmap = nextunloadedmap)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
53
src/m_cond.c
53
src/m_cond.c
|
|
@ -650,7 +650,8 @@ void M_ClearConditionSet(UINT16 set)
|
||||||
// Clear ALL secrets.
|
// Clear ALL secrets.
|
||||||
void M_ClearStats(void)
|
void M_ClearStats(void)
|
||||||
{
|
{
|
||||||
UINT8 i;
|
UINT16 i;
|
||||||
|
|
||||||
gamedata->totalplaytime = 0;
|
gamedata->totalplaytime = 0;
|
||||||
gamedata->totalnetgametime = 0;
|
gamedata->totalnetgametime = 0;
|
||||||
gamedata->timeattackingtotaltime = 0;
|
gamedata->timeattackingtotaltime = 0;
|
||||||
|
|
@ -678,6 +679,54 @@ void M_ClearStats(void)
|
||||||
gamedata->musicstate = GDMUSIC_NONE;
|
gamedata->musicstate = GDMUSIC_NONE;
|
||||||
|
|
||||||
gamedata->importprofilewins = false;
|
gamedata->importprofilewins = false;
|
||||||
|
|
||||||
|
// Skins only store stats, not progression metrics. Good to clear entirely here.
|
||||||
|
|
||||||
|
for (i = 0; i < numskins; i++)
|
||||||
|
{
|
||||||
|
memset(&skins[i].records, 0, sizeof(skins[i].records));
|
||||||
|
}
|
||||||
|
|
||||||
|
unloaded_skin_t *unloadedskin, *nextunloadedskin = NULL;
|
||||||
|
for (unloadedskin = unloadedskins; unloadedskin; unloadedskin = nextunloadedskin)
|
||||||
|
{
|
||||||
|
nextunloadedskin = unloadedskin->next;
|
||||||
|
Z_Free(unloadedskin);
|
||||||
|
}
|
||||||
|
unloadedskins = NULL;
|
||||||
|
|
||||||
|
// We retain exclusively the most important stuff from maps.
|
||||||
|
|
||||||
|
UINT8 restoremapvisited;
|
||||||
|
recordtimes_t restoretimeattack;
|
||||||
|
recordtimes_t restorespbattack;
|
||||||
|
|
||||||
|
for (i = 0; i < nummapheaders; i++)
|
||||||
|
{
|
||||||
|
restoremapvisited = mapheaderinfo[i]->records.mapvisited;
|
||||||
|
restoretimeattack = mapheaderinfo[i]->records.timeattack;
|
||||||
|
restorespbattack = mapheaderinfo[i]->records.spbattack;
|
||||||
|
|
||||||
|
memset(&mapheaderinfo[i]->records, 0, sizeof(recorddata_t));
|
||||||
|
|
||||||
|
mapheaderinfo[i]->records.mapvisited = restoremapvisited;
|
||||||
|
mapheaderinfo[i]->records.timeattack = restoretimeattack;
|
||||||
|
mapheaderinfo[i]->records.spbattack = restorespbattack;
|
||||||
|
}
|
||||||
|
|
||||||
|
unloaded_mapheader_t *unloadedmap;
|
||||||
|
for (unloadedmap = unloadedmapheaders; unloadedmap; unloadedmap = unloadedmap->next)
|
||||||
|
{
|
||||||
|
restoremapvisited = unloadedmap->records.mapvisited;
|
||||||
|
restoretimeattack = unloadedmap->records.timeattack;
|
||||||
|
restorespbattack = unloadedmap->records.spbattack;
|
||||||
|
|
||||||
|
memset(&unloadedmap->records, 0, sizeof(recorddata_t));
|
||||||
|
|
||||||
|
unloadedmap->records.mapvisited = restoremapvisited;
|
||||||
|
unloadedmap->records.timeattack = restoretimeattack;
|
||||||
|
unloadedmap->records.spbattack = restorespbattack;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void M_ClearSecrets(void)
|
void M_ClearSecrets(void)
|
||||||
|
|
@ -707,6 +756,8 @@ void M_ClearSecrets(void)
|
||||||
if (!mapheaderinfo[i])
|
if (!mapheaderinfo[i])
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
mapheaderinfo[i]->records.mapvisited = 0;
|
||||||
|
|
||||||
mapheaderinfo[i]->cache_spraycan = UINT16_MAX;
|
mapheaderinfo[i]->cache_spraycan = UINT16_MAX;
|
||||||
|
|
||||||
mapheaderinfo[i]->cache_maplock = MAXUNLOCKABLES;
|
mapheaderinfo[i]->cache_maplock = MAXUNLOCKABLES;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue