mirror of
https://github.com/ZDoom/Raze.git
synced 2024-11-15 17:01:28 +00:00
- reorganized hightile offset storage.
This commit is contained in:
parent
16ad5f0cc8
commit
d193e199f1
7 changed files with 40 additions and 44 deletions
|
@ -617,38 +617,30 @@ static int32_t defsparser(scriptfile *script)
|
|||
if (check_tile("setuptile", tile, script, pos))
|
||||
break;
|
||||
auto& tiled = TileFiles.tiledata[tile];
|
||||
if (scriptfile_getsymbol(script,&tmp)) break; // XXX
|
||||
tiled.h_xsize = tmp;
|
||||
if (scriptfile_getsymbol(script,&tmp)) break;
|
||||
tiled.h_ysize = tmp;
|
||||
if (scriptfile_getsymbol(script,&tmp)) break;
|
||||
tiled.h_xoffs = tmp;
|
||||
if (scriptfile_getsymbol(script,&tmp)) break;
|
||||
tiled.h_yoffs = tmp;
|
||||
if (scriptfile_getsymbol(script,&tiled.hiofs.xsize)) break; // XXX
|
||||
if (scriptfile_getsymbol(script, &tiled.hiofs.ysize)) break;
|
||||
if (scriptfile_getsymbol(script, &tiled.hiofs.xoffs)) break;
|
||||
if (scriptfile_getsymbol(script, &tiled.hiofs.yoffs)) break;
|
||||
break;
|
||||
}
|
||||
case T_SETUPTILERANGE:
|
||||
{
|
||||
int tile1,tile2,xsiz,ysiz,xoffs,yoffs,i;
|
||||
int tile1,tile2;
|
||||
TileOffs t;
|
||||
|
||||
if (scriptfile_getsymbol(script,&tile1)) break;
|
||||
if (scriptfile_getsymbol(script,&tile2)) break;
|
||||
if (scriptfile_getnumber(script,&xsiz)) break;
|
||||
if (scriptfile_getnumber(script,&ysiz)) break;
|
||||
if (scriptfile_getsymbol(script,&xoffs)) break;
|
||||
if (scriptfile_getsymbol(script,&yoffs)) break;
|
||||
if (scriptfile_getnumber(script,&t.xsize)) break;
|
||||
if (scriptfile_getnumber(script,&t.ysize)) break;
|
||||
if (scriptfile_getsymbol(script,&t.xoffs)) break;
|
||||
if (scriptfile_getsymbol(script,&t.yoffs)) break;
|
||||
|
||||
if (check_tile_range("setuptilerange", &tile1, &tile2, script, pos))
|
||||
break;
|
||||
|
||||
for (i=tile1; i<=tile2; i++)
|
||||
for (int i=tile1; i<=tile2; i++)
|
||||
{
|
||||
auto& tiled = TileFiles.tiledata[i];
|
||||
|
||||
tiled.h_xsize = xsiz;
|
||||
tiled.h_ysize = ysiz;
|
||||
tiled.h_xoffs = xoffs;
|
||||
tiled.h_yoffs = yoffs;
|
||||
TileFiles.tiledata[i].hiofs = t;
|
||||
}
|
||||
|
||||
break;
|
||||
|
|
|
@ -2722,9 +2722,9 @@ void polymost_drawsprite(int32_t snum)
|
|||
|
||||
if ((globalorientation & 48) != 48) // only non-voxel sprites should do this
|
||||
{
|
||||
int const flag = hw_hightile && TileFiles.tiledata[globalpicnum].h_xsize;
|
||||
off = { (int32_t)tspr->xoffset + (flag ? TileFiles.tiledata[globalpicnum].h_xoffs : tileLeftOffset(globalpicnum)),
|
||||
(int32_t)tspr->yoffset + (flag ? TileFiles.tiledata[globalpicnum].h_yoffs : tileTopOffset(globalpicnum)) };
|
||||
int const flag = hw_hightile && TileFiles.tiledata[globalpicnum].hiofs.xsize;
|
||||
off = { (int32_t)tspr->xoffset + (flag ? TileFiles.tiledata[globalpicnum].hiofs.xoffs : tileLeftOffset(globalpicnum)),
|
||||
(int32_t)tspr->yoffset + (flag ? TileFiles.tiledata[globalpicnum].hiofs.yoffs : tileTopOffset(globalpicnum)) };
|
||||
}
|
||||
|
||||
int32_t method = DAMETH_MASK | DAMETH_CLAMPED;
|
||||
|
@ -2784,8 +2784,8 @@ void polymost_drawsprite(int32_t snum)
|
|||
|
||||
vec2_t tsiz;
|
||||
|
||||
if (hw_hightile && TileFiles.tiledata[globalpicnum].h_xsize)
|
||||
tsiz = { TileFiles.tiledata[globalpicnum].h_xsize, TileFiles.tiledata[globalpicnum].h_ysize };
|
||||
if (hw_hightile && TileFiles.tiledata[globalpicnum].hiofs.xsize)
|
||||
tsiz = { TileFiles.tiledata[globalpicnum].hiofs.xsize, TileFiles.tiledata[globalpicnum].hiofs.ysize };
|
||||
else
|
||||
tsiz = { tileWidth(globalpicnum), tileHeight(globalpicnum) };
|
||||
|
||||
|
|
|
@ -191,10 +191,10 @@ void GetWallSpritePosition(const spritetype* spr, vec2_t pos, vec2_t* out, bool
|
|||
auto tex = tileGetTexture(spr->picnum);
|
||||
|
||||
int width, leftofs;
|
||||
if (render && hw_hightile && TileFiles.tiledata[spr->picnum].h_xsize)
|
||||
if (render && hw_hightile && TileFiles.tiledata[spr->picnum].hiofs.xsize)
|
||||
{
|
||||
width = TileFiles.tiledata[spr->picnum].h_xsize;
|
||||
leftofs = (TileFiles.tiledata[spr->picnum].h_xoffs + spr->xoffset);
|
||||
width = TileFiles.tiledata[spr->picnum].hiofs.xsize;
|
||||
leftofs = (TileFiles.tiledata[spr->picnum].hiofs.xoffs + spr->xoffset);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -227,12 +227,12 @@ void GetFlatSpritePosition(const spritetype* spr, vec2_t pos, vec2_t* out, bool
|
|||
auto tex = tileGetTexture(spr->picnum);
|
||||
|
||||
int width, height, leftofs, topofs;
|
||||
if (render && hw_hightile && TileFiles.tiledata[spr->picnum].h_xsize)
|
||||
if (render && hw_hightile && TileFiles.tiledata[spr->picnum].hiofs.xsize)
|
||||
{
|
||||
width = TileFiles.tiledata[spr->picnum].h_xsize * spr->xrepeat;
|
||||
height = TileFiles.tiledata[spr->picnum].h_ysize * spr->yrepeat;
|
||||
leftofs = (TileFiles.tiledata[spr->picnum].h_xoffs + spr->xoffset) * spr->xrepeat;
|
||||
topofs = (TileFiles.tiledata[spr->picnum].h_yoffs + spr->yoffset) * spr->yrepeat;
|
||||
width = TileFiles.tiledata[spr->picnum].hiofs.xsize * spr->xrepeat;
|
||||
height = TileFiles.tiledata[spr->picnum].hiofs.ysize * spr->yrepeat;
|
||||
leftofs = (TileFiles.tiledata[spr->picnum].hiofs.xoffs + spr->xoffset) * spr->xrepeat;
|
||||
topofs = (TileFiles.tiledata[spr->picnum].hiofs.yoffs + spr->yoffset) * spr->yrepeat;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -376,12 +376,12 @@ void HWSprite::Process(HWDrawInfo* di, spritetype* spr, sectortype* sector, int
|
|||
int tilenum = spr->picnum;
|
||||
|
||||
int xsize, ysize, tilexoff, tileyoff;
|
||||
if (hw_hightile && TileFiles.tiledata[tilenum].h_xsize)
|
||||
if (hw_hightile && TileFiles.tiledata[tilenum].hiofs.xsize)
|
||||
{
|
||||
xsize = TileFiles.tiledata[tilenum].h_xsize;
|
||||
ysize = TileFiles.tiledata[tilenum].h_ysize;
|
||||
tilexoff = TileFiles.tiledata[tilenum].h_xoffs;
|
||||
tileyoff = TileFiles.tiledata[tilenum].h_yoffs;
|
||||
xsize = TileFiles.tiledata[tilenum].hiofs.xsize;
|
||||
ysize = TileFiles.tiledata[tilenum].hiofs.ysize;
|
||||
tilexoff = TileFiles.tiledata[tilenum].hiofs.xoffs;
|
||||
tileyoff = TileFiles.tiledata[tilenum].hiofs.yoffs;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -1104,10 +1104,10 @@ void HWWall::ProcessWallSprite(HWDrawInfo* di, spritetype* spr, sectortype* sect
|
|||
|
||||
|
||||
int height, topofs;
|
||||
if (hw_hightile && TileFiles.tiledata[spr->picnum].h_xsize)
|
||||
if (hw_hightile && TileFiles.tiledata[spr->picnum].hiofs.xsize)
|
||||
{
|
||||
height = TileFiles.tiledata[spr->picnum].h_ysize;
|
||||
topofs = (TileFiles.tiledata[spr->picnum].h_yoffs + spr->yoffset);
|
||||
height = TileFiles.tiledata[spr->picnum].hiofs.ysize;
|
||||
topofs = (TileFiles.tiledata[spr->picnum].hiofs.yoffs + spr->yoffset);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -145,7 +145,7 @@ void BuildTiles::Init()
|
|||
tile.RotTile = { -1,-1 };
|
||||
tile.replacement = ReplacementType::Art;
|
||||
tile.alphaThreshold = 0.5;
|
||||
tile.h_xsize = 0;
|
||||
tile.hiofs = {};
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -256,6 +256,11 @@ struct RawCacheNode
|
|||
uint64_t lastUseTime;
|
||||
};
|
||||
|
||||
struct TileOffs
|
||||
{
|
||||
int xsize, ysize, xoffs, yoffs;
|
||||
};
|
||||
|
||||
struct TileDesc
|
||||
{
|
||||
FGameTexture* texture; // the currently active tile
|
||||
|
@ -268,8 +273,7 @@ struct TileDesc
|
|||
float alphaThreshold;
|
||||
|
||||
// Sprite offset hackery for hires replacements. This only gets used for sprites in the 3D view, nothing else.
|
||||
uint16_t h_xsize, h_ysize;
|
||||
int8_t h_xoffs, h_yoffs;
|
||||
TileOffs hiofs;
|
||||
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue