mirror of
https://github.com/DrBeef/Raze.git
synced 2025-01-19 07:31:03 +00:00
- wrapped hiofs in a getter function.
This makes it a lot easier later to refactor.
This commit is contained in:
parent
aa58b152ab
commit
0bacb05c1b
5 changed files with 30 additions and 17 deletions
|
@ -205,10 +205,11 @@ void GetWallSpritePosition(const spritetypebase* spr, const DVector2& pos, DVect
|
|||
auto tex = TexMan.GetGameTexture(spr->spritetexture());
|
||||
|
||||
double width, xoffset;
|
||||
if (render && hw_hightile && TileFiles.tiledata[spr->picnum].hiofs.xsize)
|
||||
TileOffs* tofs;
|
||||
if (render && hw_hightile && (tofs = GetHiresOffset(spr->spritetexture())))
|
||||
{
|
||||
width = TileFiles.tiledata[spr->picnum].hiofs.xsize;
|
||||
xoffset = (TileFiles.tiledata[spr->picnum].hiofs.xoffs + spr->xoffset);
|
||||
width = tofs->xsize;
|
||||
xoffset = (tofs->xoffs + spr->xoffset);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -244,12 +245,13 @@ void TGetFlatSpritePosition(const spritetypebase* spr, const DVector2& pos, DVec
|
|||
int xo = heinum ? 0 : spr->xoffset;
|
||||
int yo = heinum ? 0 : spr->yoffset;
|
||||
|
||||
if (render && hw_hightile && TileFiles.tiledata[spr->picnum].hiofs.xsize)
|
||||
TileOffs* tofs;
|
||||
if (render && hw_hightile && (tofs = GetHiresOffset(spr->spritetexture())))
|
||||
{
|
||||
width = TileFiles.tiledata[spr->picnum].hiofs.xsize * xrepeat;
|
||||
height = TileFiles.tiledata[spr->picnum].hiofs.ysize * yrepeat;
|
||||
leftofs = (TileFiles.tiledata[spr->picnum].hiofs.xoffs + xo) * xrepeat;
|
||||
topofs = (TileFiles.tiledata[spr->picnum].hiofs.yoffs + yo) * yrepeat;
|
||||
width = tofs->xsize * xrepeat;
|
||||
height = tofs->ysize * yrepeat;
|
||||
leftofs = (tofs->xoffs + xo) * xrepeat;
|
||||
topofs = (tofs->yoffs + yo) * yrepeat;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -343,15 +343,16 @@ void HWSprite::Process(HWDrawInfo* di, tspritetype* spr, sectortype* sector, int
|
|||
if (modelframe == 0)
|
||||
{
|
||||
int flags = spr->cstat;
|
||||
int tilenum = spr->picnum;
|
||||
|
||||
int xsize, ysize, tilexoff, tileyoff;
|
||||
if (hw_hightile && TileFiles.tiledata[tilenum].hiofs.xsize)
|
||||
TileOffs* tofs;
|
||||
|
||||
if (hw_hightile && (tofs = GetHiresOffset(spr->spritetexture())))
|
||||
{
|
||||
xsize = TileFiles.tiledata[tilenum].hiofs.xsize;
|
||||
ysize = TileFiles.tiledata[tilenum].hiofs.ysize;
|
||||
tilexoff = TileFiles.tiledata[tilenum].hiofs.xoffs;
|
||||
tileyoff = TileFiles.tiledata[tilenum].hiofs.yoffs;
|
||||
xsize = tofs->xsize;
|
||||
ysize = tofs->ysize;
|
||||
tilexoff = tofs->xoffs;
|
||||
tileyoff = tofs->yoffs;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -1163,11 +1163,12 @@ void HWWall::ProcessWallSprite(HWDrawInfo* di, tspritetype* spr, sectortype* sec
|
|||
|
||||
SetSpriteTranslucency(Sprite, alpha, RenderStyle);
|
||||
|
||||
TileOffs* tofs;
|
||||
int height, topofs;
|
||||
if (hw_hightile && TileFiles.tiledata[spr->picnum].hiofs.xsize)
|
||||
if (hw_hightile && (tofs = GetHiresOffset(spr->spritetexture())))
|
||||
{
|
||||
height = TileFiles.tiledata[spr->picnum].hiofs.ysize;
|
||||
topofs = (TileFiles.tiledata[spr->picnum].hiofs.yoffs + spr->yoffset);
|
||||
height = tofs->ysize;
|
||||
topofs = tofs->yoffs + spr->yoffset;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -810,3 +810,11 @@ void walltype::setovertexture(FTextureID tex)
|
|||
if (p) overpicnum = *p;
|
||||
else overpicnum = -1; // unlike the others this one can be invalid.
|
||||
}
|
||||
|
||||
TileOffs* GetHiresOffset(FTextureID tex)
|
||||
{
|
||||
// fixme: This must return nullptr if the tile has no replacement.
|
||||
auto p = TileFiles.textotile.CheckKey(tex.GetIndex());
|
||||
if (p && TileFiles.tiledata[*p].hiofs.xsize != 0) return &TileFiles.tiledata[*p].hiofs;
|
||||
else return nullptr;
|
||||
}
|
||||
|
|
|
@ -430,6 +430,7 @@ void tileUpdateAnimations();
|
|||
const uint8_t* GetRawPixels(FTextureID texid);
|
||||
uint8_t* GetWritablePixels(FTextureID texid);
|
||||
void InvalidateTexture(FTextureID num);
|
||||
TileOffs* GetHiresOffset(FTextureID num);
|
||||
|
||||
class FGameTexture;
|
||||
bool PickTexture(FGameTexture* tex, int paletteid, TexturePick& pick, bool wantindexed = false);
|
||||
|
|
Loading…
Reference in a new issue