- made gotpic a FixedBitArray.

gets rid of some inline garbage.
This commit is contained in:
Christoph Oelckers 2021-12-17 22:36:59 +01:00
parent 5f18109371
commit 11f41a97d5
14 changed files with 29 additions and 40 deletions

View file

@ -223,10 +223,6 @@ extern int16_t pskybits_override;
// (or -1 if freelist is empty):
EXTERN int16_t tailspritefree;
EXTERN uint8_t gotpic[(MAXTILES+7)>>3];
extern BitArray gotsector;
extern uint32_t drawlinepat;
extern uint8_t globalr, globalg, globalb;
@ -467,21 +463,4 @@ inline void tileUpdatePicnum(int* const tileptr, int const obj, int stat)
tile = RotTile(tile).newtile;
}
inline void setgotpic(int32_t tilenume)
{
gotpic[tilenume >> 3] |= 1 << (tilenume & 7);
}
inline void cleargotpic(int32_t tilenume)
{
gotpic[tilenume >> 3] &= ~(1 << (tilenume & 7));
}
inline bool testgotpic(int32_t tilenume, bool reset = false)
{
bool res = gotpic[tilenume >> 3] & (1 << (tilenume & 7));
if (reset) gotpic[tilenume >> 3] &= ~(1 << (tilenume & 7));
return res;
}
#endif // build_h_

View file

@ -361,7 +361,7 @@ static void polymost_drawpoly(FVector2 const * const dpxy, int32_t const n, int3
globalfloorpal = globalpal = 0;
//Load texture (globalpicnum)
setgotpic(globalpicnum);
gotpic.Set(globalpicnum);
vec2_t tsiz = { tilesize.x, tilesize.y };
assert(n <= MAX_DRAWPOLY_VERTS);

View file

@ -583,7 +583,7 @@ void renderDrawMapView(int cposx, int cposy, int czoom, int cang)
int translation = TRANSLATION(Translation_Remap + curbasepal, sector[i].floorpal);
PalEntry light = shadeToLight(sector[i].floorshade);
setgotpic(picnum);
gotpic.Set(picnum);
for (auto sect : sectionsPerSector[i])
{
@ -646,7 +646,7 @@ void renderDrawMapView(int cposx, int cposy, int czoom, int cang)
int translation = TRANSLATION(Translation_Remap + curbasepal, spr->pal);
int picnum = spr->picnum;
setgotpic(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,
windowxy1.x, windowxy1.y, windowxy2.x + 1, windowxy2.y + 1);

View file

@ -546,6 +546,7 @@ extern TArray<walltype> wall;
extern TArray<sectortype> sectorbackup;
extern TArray<walltype> wallbackup;
extern int numsectors, numwalls;
extern BitArray gotsector;
//=============================================================================
//

View file

@ -285,7 +285,7 @@ void HWDrawInfo::DispatchSprites()
tileUpdatePicnum(&tilenum, (actor->GetIndex() & 16383) + 32768, 0);
tspr->picnum = tilenum;
setgotpic(tilenum);
gotpic.Set(tilenum);
if (!(actor->sx().flags & SPREXT_NOTMD))
{

View file

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

View file

@ -1036,7 +1036,7 @@ 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->picnum;
setgotpic(tilenum);
gotpic.Set(tilenum);
tileUpdatePicnum(&tilenum, wallnum(wal) + 16384, wal->cstat);
texture = tileGetTexture(tilenum);
if (texture && texture->isValid())
@ -1074,7 +1074,7 @@ void HWWall::Process(HWDrawInfo* di, walltype* wal, sectortype* frontsector, sec
if (bch1a < fch1 || bch2a < fch2)
{
int tilenum = wal->picnum;
setgotpic(tilenum);
gotpic.Set(tilenum);
tileUpdatePicnum(&tilenum, wallnum(wal) + 16384, wal->cstat);
texture = tileGetTexture(tilenum);
if (texture && texture->isValid())
@ -1087,7 +1087,7 @@ void HWWall::Process(HWDrawInfo* di, walltype* wal, sectortype* frontsector, sec
if (wal->cstat & (CSTAT_WALL_MASKED | CSTAT_WALL_1WAY))
{
int tilenum = wal->overpicnum;
setgotpic(tilenum);
gotpic.Set(tilenum);
tileUpdatePicnum(&tilenum, wallnum(wal) + 16384, wal->cstat);
texture = tileGetTexture(tilenum);
if (texture && texture->isValid())
@ -1113,7 +1113,7 @@ void HWWall::Process(HWDrawInfo* di, walltype* wal, sectortype* frontsector, sec
{
auto w = (wal->cstat & CSTAT_WALL_BOTTOM_SWAP) ? backwall : wal;
int tilenum = w->picnum;
setgotpic(tilenum);
gotpic.Set(tilenum);
tileUpdatePicnum(&tilenum, wallnum(wal) + 16384, w->cstat);
texture = tileGetTexture(tilenum);
if (texture && texture->isValid())

View file

@ -422,7 +422,7 @@ FGameTexture* BuildTiles::ValidateCustomTile(int tilenum, ReplacementType type)
int32_t BuildTiles::artLoadFiles(const char* filename)
{
TileFiles.LoadArtSet(filename);
memset(gotpic, 0, sizeof(gotpic));
gotpic.Zero();
return 0;
}

View file

@ -493,3 +493,12 @@ void processSetAnim(const char* cmd, FScriptPosition& pos, SetAnim& imp);
class FGameTexture;
bool PickTexture(FGameTexture* tex, int paletteid, TexturePick& pick, bool wantindexed = false);
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

@ -277,7 +277,7 @@ void DrawMirrors(int x, int y, int z, fixed_t a, fixed_t horiz, int smooth, int
renderDrawMasks();
sector[nSector].floorstat = fstat;
for (int i = 0; i < 16; i++)
cleargotpic(4080 + i);
gotpic.Clear(4080 + i);
if (viewPlayer >= 0)
{
gPlayer[viewPlayer].pSprite->cstat = bakCstat;
@ -309,7 +309,7 @@ void DrawMirrors(int x, int y, int z, fixed_t a, fixed_t horiz, int smooth, int
renderDrawMasks();
sector[nSector].ceilingstat = cstat;
for (int i = 0; i < 16; i++)
cleargotpic(4080 + i);
gotpic.Clear(4080 + i);
if (viewPlayer >= 0)
{
gPlayer[viewPlayer].pSprite->cstat = bakCstat;

View file

@ -5015,11 +5015,11 @@ void MoveDude(DBloodActor* actor)
{
case kMarkerLowStack:
if (pPlayer == gView)
setgotpic(pSprite->sector()->floorpicnum);
gotpic.Set(pSprite->sector()->floorpicnum);
break;
case kMarkerUpStack:
if (pPlayer == gView)
setgotpic(pSprite->sector()->ceilingpicnum);
gotpic.Set(pSprite->sector()->ceilingpicnum);
break;
case kMarkerLowWater:
case kMarkerLowGoo:

View file

@ -983,7 +983,7 @@ static int LoadTheMap(MapRecord *mi, struct player_struct *p, int gamemode)
p->angle.ang = buildang(lbang);
memset(gotpic, 0, sizeof(gotpic));
gotpic.Zero();
auto actorlist = spawnactors(sprites);

View file

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

View file

@ -125,7 +125,7 @@ void FAF_DrawRooms(int x, int y, int z, fixed_t q16ang, fixed_t q16horiz, int se
// manually set gotpic
if (gotsector[sp->sectno()])
{
setgotpic(FAF_MIRROR_PIC);
gotpic.Set(FAF_MIRROR_PIC);
}
if (SP_TAG3(sp) == 0)
@ -194,7 +194,7 @@ void JS_DrawMirrors(PLAYERp pp, int tx, int ty, int tz, fixed_t tpq16ang, fixed
}
else if ((unsigned)mirror[cnt].campic < MAXTILES && testgotpic(mirror[cnt].campic))
{
cleargotpic(mirror[cnt].campic);
gotpic.Clear(mirror[cnt].campic);
}
mirrorinview = true;