- got rid of gotpic.

Now everything uses the 'seen' flag in the texture which indicates that the texture was actually used for hardware rendering since the last check.
It's also only the 3 places checking this flag which are responsible for clearing it.
This commit is contained in:
Christoph Oelckers 2022-12-06 09:17:12 +01:00
parent a0722c55ea
commit 49f87e6227
10 changed files with 15 additions and 35 deletions

View file

@ -527,7 +527,6 @@ static void renderDrawMapView(const DVector2& cpos, const DVector2& cangvect, co
int translation = TRANSLATION(Translation_Remap + curbasepal, sector[i].floorpal);
PalEntry light = shadeToLight(sector[i].floorshade);
gotpic.Set(picnum);
for (auto section : sectionsPerSector[i])
{
@ -581,7 +580,6 @@ static void renderDrawMapView(const DVector2& cpos, const DVector2& cangvect, co
int translation = TRANSLATION(Translation_Remap + curbasepal, actor->spr.pal);
int picnum = actor->spr.picnum;
gotpic.Set(picnum);
const static unsigned indices[] = { 0, 1, 2, 0, 2, 3 };
twod->AddPoly(tileGetTexture(picnum, true), vertices.Data(), vertices.Size(), indices, 6, translation, color, rs, &viewport3d);
}

View file

@ -288,7 +288,6 @@ void HWDrawInfo::DispatchSprites()
if (tspr->cstat2 & CSTAT2_SPRITE_FULLBRIGHT)
tspr->shade = -127;
tspr->picnum = tilenum;
gotpic.Set(tilenum);
if (!(actor->sprext.renderflags & SPREXT_NOTMD))
{

View file

@ -352,7 +352,6 @@ void HWFlat::ProcessSector(HWDrawInfo *di, sectortype * frontsector, int section
if (alpha != 0.f)
{
int tilenum = frontsector->floorpicnum;
gotpic.Set(tilenum);
tileUpdatePicnum(&tilenum);
texture = tileGetTexture(tilenum);
if (texture && texture->isValid())
@ -396,7 +395,6 @@ void HWFlat::ProcessSector(HWDrawInfo *di, sectortype * frontsector, int section
//iboindex = frontsector->iboindex[sector_t::ceiling];
int tilenum = frontsector->ceilingpicnum;
gotpic.Set(tilenum);
tileUpdatePicnum(&tilenum);
texture = tileGetTexture(tilenum);
if (texture && texture->isValid())

View file

@ -1011,7 +1011,6 @@ void HWWall::Process(HWDrawInfo* di, walltype* wal, sectortype* frontsector, sec
// normal texture
int tilenum = ((wal->cstat & CSTAT_WALL_1WAY) && wal->nextwall != -1) ? wal->overpicnum : wal->wallpicnum;
gotpic.Set(tilenum);
tileUpdatePicnum(&tilenum);
texture = tileGetTexture(tilenum);
if (texture && texture->isValid())
@ -1049,7 +1048,6 @@ void HWWall::Process(HWDrawInfo* di, walltype* wal, sectortype* frontsector, sec
if (bch1a < fch1 || bch2a < fch2)
{
int tilenum = wal->wallpicnum;
gotpic.Set(tilenum);
tileUpdatePicnum(&tilenum);
texture = tileGetTexture(tilenum);
if (texture && texture->isValid())
@ -1062,7 +1060,6 @@ void HWWall::Process(HWDrawInfo* di, walltype* wal, sectortype* frontsector, sec
if (wal->cstat & (CSTAT_WALL_MASKED | CSTAT_WALL_1WAY))
{
int tilenum = wal->overpicnum;
gotpic.Set(tilenum);
tileUpdatePicnum(&tilenum);
texture = tileGetTexture(tilenum);
if (texture && texture->isValid())
@ -1088,7 +1085,6 @@ void HWWall::Process(HWDrawInfo* di, walltype* wal, sectortype* frontsector, sec
{
auto w = (wal->cstat & CSTAT_WALL_BOTTOM_SWAP) ? backwall : wal;
int tilenum = w->wallpicnum;
gotpic.Set(tilenum);
tileUpdatePicnum(&tilenum);
texture = tileGetTexture(tilenum);
if (texture && texture->isValid())

View file

@ -493,13 +493,3 @@ struct SetAnim
class FGameTexture;
bool PickTexture(FGameTexture* tex, int paletteid, TexturePick& pick, bool wantindexed = false);
FCanvasTexture* tileGetCanvas(int tilenum);
inline FixedBitArray<MAXTILES> gotpic;
inline bool testgotpic(int32_t tilenume, bool reset = false)
{
bool res = gotpic[tilenume];
if (reset) gotpic.Clear(tilenume);
return res;
}

View file

@ -119,14 +119,18 @@ void FireInit(void)
void FireProcess(void)
{
// This assumes a smooth high frame rate. Ugh...
static int lastUpdate;
int clock = I_GetBuildTime() / 2;
if (clock < lastUpdate || lastUpdate + 2 < clock)
auto tex = tileGetTexture(2342);
if (tex->isSeen(true))
{
DoFireFrame();
lastUpdate = clock;
TileFiles.InvalidateTile(2342);
// This assumes a smooth high frame rate. Ugh...
static int lastUpdate;
int clock = I_GetBuildTime() / 2;
if (clock < lastUpdate || lastUpdate + 2 < clock)
{
DoFireFrame();
lastUpdate = clock;
TileFiles.InvalidateTile(2342);
}
}
}

View file

@ -594,10 +594,7 @@ void viewDrawScreen(bool sceneonly)
{
PLAYER* pPlayer = &gPlayer[gViewIndex];
if (testgotpic(2342, true))
{
FireProcess();
}
FireProcess();
double interpfrac;

View file

@ -450,7 +450,7 @@ void thunder(void)
if (!thunderflash)
{
if (testgotpic(RTILE_RRTHUNDERSKY, true))
if (ps[screenpeek].actor->sector()->ceilingstat & CSTAT_SECTOR_SKY)
{
g_relvisibility = 0;
if (krand() > 65000)
@ -477,7 +477,8 @@ void thunder(void)
}
if (!winderflash)
{
if (testgotpic(RTILE_RRTILE2562, true))
auto tex = tileGetTexture(RTILE_RRTILE2562);
if (tex->isSeen(true))
{
if (krand() > 65000)
{

View file

@ -979,8 +979,6 @@ static int LoadTheMap(MapRecord *mi, player_struct*p, int gamemode)
STAT_NewLevel(mi->fileName);
TITLE_InformName(mi->name);
gotpic.Zero();
auto actorlist = spawnactors(sprites);
if (isRR()) prelevel_r(gamemode, actorlist);

View file

@ -448,7 +448,6 @@ void GameInterface::SerializeGameState(FSerializer& arc)
ps[myconnectindex].over_shoulder_on = 1;
}
gotpic.Zero();
if (isRR()) cacheit_r(); else cacheit_d();
Mus_ResumeSaved();