Add support for spb attack records in json gamedata

This commit is contained in:
Eidolon 2024-02-20 19:29:41 -06:00
parent a5b870a0b3
commit ec1041eaa2
2 changed files with 28 additions and 8 deletions

View file

@ -121,8 +121,10 @@ void srb2::save_ng_gamedata()
map.visited.encore = mapheaderinfo[i]->records.mapvisited & MV_ENCORE;
map.visited.spbattack = mapheaderinfo[i]->records.mapvisited & MV_SPBATTACK;
map.visited.mysticmelody = mapheaderinfo[i]->records.mapvisited & MV_MYSTICMELODY;
map.stats.besttime = mapheaderinfo[i]->records.time;
map.stats.bestlap = mapheaderinfo[i]->records.lap;
map.stats.timeattack.besttime = mapheaderinfo[i]->records.time;
map.stats.timeattack.bestlap = mapheaderinfo[i]->records.lap;
map.stats.spbattack.besttime = 0;
map.stats.spbattack.bestlap = 0;
ng.maps[lumpname] = map;
}
for (auto unloadedmap = unloadedmapheaders; unloadedmap; unloadedmap = unloadedmap->next)
@ -134,8 +136,10 @@ void srb2::save_ng_gamedata()
map.visited.encore = unloadedmap->records.mapvisited & MV_ENCORE;
map.visited.spbattack = unloadedmap->records.mapvisited & MV_SPBATTACK;
map.visited.mysticmelody = unloadedmap->records.mapvisited & MV_MYSTICMELODY;
map.stats.besttime = unloadedmap->records.time;
map.stats.bestlap = unloadedmap->records.lap;
map.stats.timeattack.besttime = unloadedmap->records.time;
map.stats.timeattack.bestlap = unloadedmap->records.lap;
map.stats.spbattack.besttime = 0;
map.stats.spbattack.bestlap = 0;
ng.maps[lumpname] = map;
}
for (int i = 0; i < gamedata->numspraycans; i++)
@ -499,8 +503,8 @@ void srb2::load_ng_gamedata()
dummyrecord.mapvisited |= mappair.second.visited.encore ? MV_ENCORE : 0;
dummyrecord.mapvisited |= mappair.second.visited.spbattack ? MV_SPBATTACK : 0;
dummyrecord.mapvisited |= mappair.second.visited.mysticmelody ? MV_SPBATTACK : 0;
dummyrecord.lap = mappair.second.stats.bestlap;
dummyrecord.time = mappair.second.stats.besttime;
dummyrecord.time = mappair.second.stats.timeattack.besttime;
dummyrecord.lap = mappair.second.stats.timeattack.bestlap;
if (mapnum < nummapheaders && mapheaderinfo[mapnum])
{

View file

@ -126,12 +126,28 @@ struct GamedataMapVisitedJson final
NLOHMANN_DEFINE_TYPE_INTRUSIVE_WITH_DEFAULT(GamedataMapVisitedJson, visited, beaten, encore, spbattack, mysticmelody)
};
struct GamedataMapStatsJson final
struct GamedataMapStatsTimeAttackJson final
{
uint32_t besttime;
uint32_t bestlap;
NLOHMANN_DEFINE_TYPE_INTRUSIVE_WITH_DEFAULT(GamedataMapStatsJson, besttime, bestlap)
NLOHMANN_DEFINE_TYPE_INTRUSIVE_WITH_DEFAULT(GamedataMapStatsTimeAttackJson, besttime, bestlap)
};
struct GamedataMapStatsSpbAttackJson final
{
uint32_t besttime;
uint32_t bestlap;
NLOHMANN_DEFINE_TYPE_INTRUSIVE_WITH_DEFAULT(GamedataMapStatsSpbAttackJson, besttime, bestlap)
};
struct GamedataMapStatsJson final
{
GamedataMapStatsTimeAttackJson timeattack;
GamedataMapStatsSpbAttackJson spbattack;
NLOHMANN_DEFINE_TYPE_INTRUSIVE_WITH_DEFAULT(GamedataMapStatsJson, timeattack, spbattack)
};
struct GamedataMapJson final