Fix oversight with wall texture rotation on tile 0

git-svn-id: https://svn.eduke32.com/eduke32@7240 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2018-11-18 21:17:59 +00:00
parent 1c83bd0a01
commit 252fb58321
5 changed files with 9 additions and 9 deletions

View file

@ -832,7 +832,7 @@ typedef struct {
uint8_t sf; // anim. speed and flags
} picanm_t;
EXTERN picanm_t picanm[MAXTILES];
typedef struct { int16_t newtile; int16_t owner; } rottile_t;
typedef struct { int16_t newtile = -1; int16_t owner = -1; } rottile_t;
EXTERN rottile_t rottile[MAXTILES];
EXTERN intptr_t waloff[MAXTILES]; // stores pointers to cache -- SA

View file

@ -1618,11 +1618,11 @@ int lastUnusedTile = MAXUSERTILES-1;
static inline int findUnusedTile(void)
{
for (; lastUnusedTile > 0; --lastUnusedTile)
for (; lastUnusedTile >= 0; --lastUnusedTile)
if (tilesiz[lastUnusedTile].x * tilesiz[lastUnusedTile].y == 0)
return lastUnusedTile;
return MAXTILES;
return -1;
}
//
@ -8003,10 +8003,10 @@ int32_t renderDrawRoomsQ16(int32_t daposx, int32_t daposy, int32_t daposz,
auto &w = wall[i];
auto &tile = rottile[w.picnum+animateoffs(w.picnum)];
if (!tile.newtile && !tile.owner)
if (tile.newtile == -1 && tile.owner == -1)
{
tile.newtile = findUnusedTile();
Bassert(tile.newtile != MAXTILES);
Bassert(tile.newtile != -1);
rottile[tile.newtile].owner = w.picnum+animateoffs(w.picnum);

View file

@ -270,7 +270,7 @@ void set_globalang(fix16_t ang);
int32_t animateoffs(int tilenum);
#define DO_TILE_ANIM(Picnum, Fakevar) do { \
if (picanm[Picnum].sf&PICANM_ANIMTYPE_MASK) Picnum += animateoffs(Picnum); \
if ((((Fakevar) & 16384) == 16384) && (globalorientation & CSTAT_WALL_ROTATE_90) && rottile[Picnum].newtile) Picnum = rottile[Picnum].newtile; \
if ((((Fakevar) & 16384) == 16384) && (globalorientation & CSTAT_WALL_ROTATE_90) && rottile[Picnum].newtile != -1) Picnum = rottile[Picnum].newtile; \
} while (0)
static FORCE_INLINE int32_t bad_tspr(const uspritetype *tspr)

View file

@ -640,7 +640,7 @@ void tileLoadData(int16_t tilenume, int32_t dasiz, char *buffer)
{
int const owner = rottile[tilenume].owner;
if (owner)
if (owner != -1)
{
if (!waloff[owner])
tileLoad(owner);

View file

@ -2455,7 +2455,7 @@ int32_t AskIfSure(const char *text)
static int32_t IsValidTile(int32_t idTile)
{
// this is MAXTILES-1 because TROR uses that tile and we don't need it showing up in the tile selector, etc
return (idTile>=0 && idTile<MAXTILES-1) && (tilesiz[idTile].x && tilesiz[idTile].y) && !rottile[idTile].owner;
return (idTile>=0 && idTile<MAXTILES-1) && (tilesiz[idTile].x && tilesiz[idTile].y) && rottile[idTile].owner == -1;
}
static int32_t SelectAllTiles(int32_t iCurrentTile)
@ -3599,7 +3599,7 @@ restart:
pRawPixels = GetTilePixels(idTile);
// don't draw rotated tiles generated near MAXTILES
if (EDUKE32_PREDICT_FALSE(rottile[idTile].owner))
if (EDUKE32_PREDICT_FALSE(rottile[idTile].owner != -1))
pRawPixels = NULL;
if (pRawPixels != NULL)