- avoid using widthBits and heightBits outside of engine code.

This commit is contained in:
Christoph Oelckers 2020-11-09 20:50:27 +01:00
parent f24786af71
commit 51115e75df

View file

@ -280,34 +280,34 @@ void DoSectorPanning(void)
if (pXSector->panFloor) // Floor
{
int nTile = pSector->floorpicnum;
int px = (pSector->floorxpanning<<8)+pXSector->floorXPanFrac;
int py = (pSector->floorypanning<<8)+pXSector->floorYPanFrac;
if (pSector->floorstat&64)
int px = (pSector->floorxpanning << 8) + pXSector->floorXPanFrac;
int py = (pSector->floorypanning << 8) + pXSector->floorYPanFrac;
if (pSector->floorstat & 64)
angle -= 512;
int xBits = (widthBits(nTile))-((pSector->floorstat&8)!=0);
px += mulscale30(speed<<2, Cos(angle))>>xBits;
int yBits = (heightBits(nTile))-((pSector->floorstat&8)!=0);
py -= mulscale30(speed<<2, Sin(angle))>>yBits;
pSector->floorxpanning = px>>8;
pSector->floorypanning = py>>8;
pXSector->floorXPanFrac = px&255;
pXSector->floorYPanFrac = py&255;
int xBits = tileWidth(nTile) >> int((pSector->floorstat & 8) != 0);
px += mulscale30(speed << 2, Cos(angle)) / xBits;
int yBits = tileHeight(nTile) >> int((pSector->floorstat & 8) != 0);
py -= mulscale30(speed << 2, Sin(angle)) / yBits;
pSector->floorxpanning = px >> 8;
pSector->floorypanning = py >> 8;
pXSector->floorXPanFrac = px & 255;
pXSector->floorYPanFrac = py & 255;
}
if (pXSector->panCeiling) // Ceiling
{
int nTile = pSector->ceilingpicnum;
int px = (pSector->ceilingxpanning<<8)+pXSector->ceilXPanFrac;
int py = (pSector->ceilingypanning<<8)+pXSector->ceilYPanFrac;
if (pSector->ceilingstat&64)
int px = (pSector->ceilingxpanning << 8) + pXSector->ceilXPanFrac;
int py = (pSector->ceilingypanning << 8) + pXSector->ceilYPanFrac;
if (pSector->ceilingstat & 64)
angle -= 512;
int xBits = (widthBits(nTile))-((pSector->ceilingstat&8)!=0);
px += mulscale30(speed<<2, Cos(angle))>>xBits;
int yBits = (heightBits(nTile))-((pSector->ceilingstat&8)!=0);
py -= mulscale30(speed<<2, Sin(angle))>>yBits;
pSector->ceilingxpanning = px>>8;
pSector->ceilingypanning = py>>8;
pXSector->ceilXPanFrac = px&255;
pXSector->ceilYPanFrac = py&255;
int xBits = tileWidth(nTile) >> int((pSector->floorstat & 8) != 0);
px += mulscale30(speed << 2, Cos(angle)) / xBits;
int yBits = tileHeight(nTile) >> int((pSector->floorstat & 8) != 0);
py -= mulscale30(speed << 2, Sin(angle)) / yBits;
pSector->ceilingxpanning = px >> 8;
pSector->ceilingypanning = py >> 8;
pXSector->ceilXPanFrac = px & 255;
pXSector->ceilYPanFrac = py & 255;
}
}
}
@ -329,8 +329,8 @@ void DoSectorPanning(void)
int nTile = wall[nWall].picnum;
int px = (wall[nWall].xpanning<<8)+pXWall->xpanFrac;
int py = (wall[nWall].ypanning<<8)+pXWall->ypanFrac;
px += (psx << 2) >> widthBits(nTile);
py += (psy << 2) >> heightBits(nTile);
px += (psx << 2) / tileWidth(nTile);
py += (psy << 2) / tileHeight(nTile);
wall[nWall].xpanning = px>>8;
wall[nWall].ypanning = py>>8;
pXWall->xpanFrac = px&255;