- wrap a few more accesses to picnum variables

This commit is contained in:
Christoph Oelckers 2022-12-06 14:14:10 +01:00
parent a6db974a62
commit 8b0e86e88b
6 changed files with 14 additions and 13 deletions

View file

@ -342,9 +342,9 @@ int VectorScan(DBloodActor* actor, double nOffset, double nZOffset, const DVecto
if (pWall->cstat & CSTAT_WALL_YFLIP)
nOfs = -nOfs;
int nPicnum = pWall->overpicnum;
int nSizX = tileWidth(nPicnum);
int nSizY = tileHeight(nPicnum);
auto nTex = TexMan.GetGameTexture(pWall->overtexture());
int nSizX = int(nTex->GetDisplayWidth());
int nSizY = int(nTex->GetDisplayHeight());
if (!nSizX || !nSizY)
return 0;
@ -359,7 +359,7 @@ int VectorScan(DBloodActor* actor, double nOffset, double nZOffset, const DVecto
int nHOffset = int(pWall->xpan_ + ((fHOffset * pWall->xrepeat) * 8) / nLength) % nSizX;
nnOfs %= nSizY;
auto pData = tilePtr(nPicnum);
auto pData = tilePtr(pWall->overpicnum);
int nPixel = nHOffset * nSizY + nnOfs;
if (pData[nPixel] == TRANSPARENT_INDEX)

View file

@ -4260,7 +4260,7 @@ bool condCheckWall(DBloodActor* aCond, int cmpOp, bool PUSH)
{
default: break;
case 0:
return condCmp(pWall->overpicnum, arg1, arg2, cmpOp);
return condCmp(legacyTileNum(pWall->overtexture()), arg1, arg2, cmpOp);
case 5:
if (PUSH) condPush(aCond, pWall->sectorp());
return true;

View file

@ -972,12 +972,12 @@ void DoWall(bool bSet, int lVar1, int lLabelID, int lVar2, DDukeActor* sActor, i
else SetGameVarID(lVar2, wallp->cstat, sActor, sPlayer);
break;
case WALL_PICNUM:
if (bSet) wallp->wallpicnum = lValue;
else SetGameVarID(lVar2, wallp->wallpicnum, sActor, sPlayer);
if (bSet) wallp->setwalltexture(tileGetTextureID(lValue));
else SetGameVarID(lVar2, legacyTileNum(wallp->walltexture()), sActor, sPlayer);
break;
case WALL_OVERPICNUM:
if (bSet) wallp->overpicnum = lValue;
else SetGameVarID(lVar2, wallp->overpicnum, sActor, sPlayer);
if (bSet) wallp->setovertexture(tileGetTextureID(lValue));
else SetGameVarID(lVar2, legacyTileNum(wallp->overtexture()), sActor, sPlayer);
break;
case WALL_SHADE:
if (bSet) wallp->shade = lValue;

View file

@ -306,7 +306,7 @@ void AddFlash(sectortype* pSector, const DVector3& pos, int val)
wal.shade = max( -127, wal.shade + walldist);
if (!var_1C && !wal.overpicnum && pNextSector)
if (!var_1C && !wal.overtexture().isValid() && pNextSector)
{
AddFlash(pNextSector, pos, val);
}

View file

@ -483,7 +483,7 @@ BREAK_INFO* SetupWallForBreak(walltype* wallp)
wallp->extra |= (WALLFX_DONT_STICK);
}
if (wallp->overpicnum > 0 && (wallp->cstat & CSTAT_WALL_MASKED))
if (wallp->overtexture().isValid() && (wallp->cstat & CSTAT_WALL_MASKED))
{
break_info = FindWallBreakInfo(wallp->overpicnum);
if (break_info)
@ -583,7 +583,7 @@ int AutoBreakWall(walltype* wallp, const DVector3& hit_pos, DAngle ang, int type
}
}
if (wallp->overpicnum > 0 && (wallp->cstat & CSTAT_WALL_MASKED))
if (wallp->overtexture().isValid() && (wallp->cstat & CSTAT_WALL_MASKED))
break_info = FindWallBreakInfo(wallp->overpicnum);
else
break_info = FindWallBreakInfo(wallp->wallpicnum);

View file

@ -58,7 +58,8 @@ void CopySectorWalls(sectortype* dest_sect, sectortype* src_sect)
// this looks broken.
do
{
dwall->wallpicnum = swall->wallpicnum;
dwall->setwalltexture(swall->walltexture());
dwall->setovertexture(swall->overtexture());
dwall->xrepeat = swall->xrepeat;
dwall->yrepeat = swall->yrepeat;