Move cache_spraycan on the mapheader_t struct to recorddata_t

Still in that struct, just in a more appropriate container
This commit is contained in:
toaster 2025-02-24 13:04:05 +00:00
parent 0449156d2e
commit 3f9c0685eb
8 changed files with 14 additions and 16 deletions

View file

@ -1913,7 +1913,7 @@ bool CallFunc_GetGrabbedSprayCan(ACSVM::Thread *thread, const ACSVM::Word *argV,
&& gamemap-1 < basenummapheaders)
{
// See also P_SprayCanInit
UINT16 can_id = mapheaderinfo[gamemap-1]->cache_spraycan;
UINT16 can_id = mapheaderinfo[gamemap-1]->records.spraycan;
if (can_id < gamedata->numspraycans)
{

View file

@ -164,9 +164,10 @@ struct recordtimes_t
struct recorddata_t
{
UINT8 mapvisited;
UINT8 mapvisited; ///< Generalised flags
recordtimes_t timeattack; ///< Best times for Time Attack
recordtimes_t spbattack; ///< Best times for SPB Attack
UINT16 spraycan; ///< Associated spraycan id
UINT32 timeplayed;
UINT32 netgametimeplayed;
UINT32 modetimeplayed[GDGT_MAX];
@ -575,7 +576,6 @@ struct mapheader_t
mobjtype_t destroyforchallenge[MAXDESTRUCTIBLES]; ///< Assistive for UCRP_MAPDESTROYOBJECTS
UINT8 destroyforchallenge_size; ///< Number for above
UINT16 cache_spraycan; ///< Cached Spraycan ID
UINT16 cache_maplock; ///< Cached Unlockable ID
// Lua information

View file

@ -703,9 +703,9 @@ void srb2::load_ng_gamedata()
gamedata->spraycans[gamedata->gotspraycans] = gamedata->spraycans[i];
gamedata->spraycans[i] = copycan;
mapheaderinfo[copycan.map]->cache_spraycan = i;
mapheaderinfo[copycan.map]->records.spraycan = i;
}
mapheaderinfo[mapnum]->cache_spraycan = gamedata->gotspraycans;
mapheaderinfo[mapnum]->records.spraycan = gamedata->gotspraycans;
gamedata->gotspraycans++;
}
}

View file

@ -3358,9 +3358,9 @@ void M_DrawCupSelect(void)
{
incj = true;
if (mapheaderinfo[map]->cache_spraycan < gamedata->numspraycans)
if (mapheaderinfo[map]->records.spraycan < gamedata->numspraycans)
{
work_array[j].col = gamedata->spraycans[mapheaderinfo[map]->cache_spraycan].col;
work_array[j].col = gamedata->spraycans[mapheaderinfo[map]->records.spraycan].col;
}
if (mapheaderinfo[map]->records.mapvisited & MV_MYSTICMELODY)
@ -8324,9 +8324,9 @@ static INT32 M_DrawMapMedals(INT32 mapnum, INT32 x, INT32 y, boolean allowtime,
if (hasmedals)
x -= 4;
if (mapheaderinfo[mapnum]->cache_spraycan < gamedata->numspraycans)
if (mapheaderinfo[mapnum]->records.spraycan < gamedata->numspraycans)
{
UINT16 col = gamedata->spraycans[mapheaderinfo[mapnum]->cache_spraycan].col;
UINT16 col = gamedata->spraycans[mapheaderinfo[mapnum]->records.spraycan].col;
if (draw && col < numskincolors)
{

View file

@ -743,8 +743,7 @@ void M_ClearSecrets(void)
continue;
mapheaderinfo[i]->records.mapvisited = 0;
mapheaderinfo[i]->cache_spraycan = UINT16_MAX;
mapheaderinfo[i]->records.spraycan = UINT16_MAX;
mapheaderinfo[i]->cache_maplock = MAXUNLOCKABLES;

View file

@ -779,7 +779,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
}
// See also P_SprayCanInit
UINT16 can_id = mapheaderinfo[gamemap-1]->cache_spraycan;
UINT16 can_id = mapheaderinfo[gamemap-1]->records.spraycan;
if (can_id < gamedata->numspraycans)
{
@ -821,7 +821,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
if (gamedata->spraycans[can_id].map >= nummapheaders)
{
gamedata->spraycans[can_id].map = gamemap-1;
mapheaderinfo[gamemap-1]->cache_spraycan = can_id;
mapheaderinfo[gamemap-1]->records.spraycan = can_id;
if (gamedata->gotspraycans == 0
&& gametype == GT_TUTORIAL

View file

@ -12915,7 +12915,7 @@ static boolean P_SetupEmblem(mapthing_t *mthing, mobj_t *mobj)
void P_SprayCanInit(mobj_t* mobj)
{
// See also P_TouchSpecialThing
UINT16 can_id = mapheaderinfo[gamemap-1]->cache_spraycan;
UINT16 can_id = mapheaderinfo[gamemap-1]->records.spraycan;
if (can_id < gamedata->numspraycans)
{

View file

@ -498,14 +498,13 @@ static void P_ClearSingleMapHeaderInfo(INT16 num)
#endif
memset(&mapheaderinfo[num]->records, 0, sizeof(recorddata_t));
mapheaderinfo[num]->records.spraycan = UINT16_MAX;
mapheaderinfo[num]->justPlayed = 0;
mapheaderinfo[num]->anger = 0;
mapheaderinfo[num]->destroyforchallenge_size = 0;
mapheaderinfo[num]->cache_spraycan = UINT16_MAX;
mapheaderinfo[num]->cache_maplock = MAXUNLOCKABLES;
mapheaderinfo[num]->customopts = NULL;