diff --git a/src/acs/call-funcs.cpp b/src/acs/call-funcs.cpp index 812bfdbb4..b89347f28 100644 --- a/src/acs/call-funcs.cpp +++ b/src/acs/call-funcs.cpp @@ -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) { diff --git a/src/doomstat.h b/src/doomstat.h index a9e46a0e9..2e41932b5 100644 --- a/src/doomstat.h +++ b/src/doomstat.h @@ -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 diff --git a/src/g_gamedata.cpp b/src/g_gamedata.cpp index 6697c97a7..b04fe4e74 100644 --- a/src/g_gamedata.cpp +++ b/src/g_gamedata.cpp @@ -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++; } } diff --git a/src/k_menudraw.c b/src/k_menudraw.c index 7000bd6a6..12db99d55 100644 --- a/src/k_menudraw.c +++ b/src/k_menudraw.c @@ -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) { diff --git a/src/m_cond.c b/src/m_cond.c index 5b3d37daf..b853eea60 100644 --- a/src/m_cond.c +++ b/src/m_cond.c @@ -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; diff --git a/src/p_inter.c b/src/p_inter.c index ea25e08cd..0f2ed7471 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -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 diff --git a/src/p_mobj.c b/src/p_mobj.c index dc3138bca..d65d995bb 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -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) { diff --git a/src/p_setup.cpp b/src/p_setup.cpp index fa1240f7e..771ec4d3a 100644 --- a/src/p_setup.cpp +++ b/src/p_setup.cpp @@ -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;