Fix cstat 1024 in classic and Polymer

git-svn-id: https://svn.eduke32.com/eduke32@5484 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2015-12-23 04:05:58 +00:00
parent febd50cc18
commit 32ba947b4b
2 changed files with 41 additions and 50 deletions

View file

@ -2624,12 +2624,11 @@ static int get_screen_coords(const vec2_t p1, const vec2_t p2,
//
static void scansector(int16_t startsectnum)
{
int32_t sectorbordercnt;
if (startsectnum < 0)
return;
sectorborder[0] = startsectnum, sectorbordercnt = 1;
sectorborder[0] = startsectnum;
int32_t sectorbordercnt = 1;
do
{
@ -2642,16 +2641,15 @@ static void scansector(int16_t startsectnum)
{
const spritetype *const spr = &sprite[i];
if (((spr->cstat&0x8000) == 0 || showinvisibility) &&
spr->xrepeat > 0 && spr->yrepeat > 0)
{
int32_t xs = spr->x-globalposx, ys = spr->y-globalposy;
if (((spr->cstat & 0x8000) && !showinvisibility) || spr->xrepeat == 0 || spr->yrepeat == 0)
continue;
if ((spr->cstat&48) || ((coord_t)xs*cosglobalang+(coord_t)ys*singlobalang > 0))
if ((spr->cstat&(64+48))!=(64+16) || dmulscale6(sintable[(spr->ang+512)&2047],-xs, sintable[spr->ang&2047],-ys) > 0)
if (engine_addtsprite(i, sectnum))
break;
}
vec2_t const s = { spr->x-globalposx, spr->y-globalposy };
if ((spr->cstat&48) || ((coord_t)s.x*cosglobalang+(coord_t)s.y*singlobalang > 0))
if ((spr->cstat&(64+48))!=(64+16) || dmulscale6(sintable[(spr->ang+512)&2047],-s.x, sintable[spr->ang&2047],-s.y) > 0)
if (engine_addtsprite(i, sectnum))
break;
}
gotsector[sectnum>>3] |= pow2char[sectnum&7];
@ -9893,11 +9891,7 @@ killsprite:
while (i)
{
i--;
if (tspriteptr[i] != NULL && ((tspriteptr[i]->cstat & 1024) != 1024
#ifdef POLYMER
|| getrendermode() == REND_POLYMER
#endif
))
if (tspriteptr[i] != NULL)
{
vec2f_t spr;
const tspritetype *tspr = tspriteptr[i];
@ -9969,10 +9963,10 @@ killsprite:
{
debugmask_add(i | 32768, tspr->owner);
drawsprite(i);
#ifdef POLYMER
if (tspr->cstat & 1024 && getrendermode() == REND_POLYMER)
if (tspr->cstat & 1024 && getrendermode() == REND_POLYMOST)
continue;
#endif
tspriteptr[i] = NULL;
}
}
@ -9988,36 +9982,33 @@ killsprite:
while (i)
{
i--;
if (tspriteptr[i] != NULL && ((tspriteptr[i]->cstat & 1024) != 1024
#ifdef POLYMER
|| getrendermode() == REND_POLYMER
#endif
))
if (tspriteptr[i] != NULL)
{
debugmask_add(i | 32768, tspriteptr[i]->owner);
drawsprite(i);
tspriteptr[i] = NULL;
if ((tspriteptr[i]->cstat & 1024) != 1024 || getrendermode() != REND_POLYMOST)
tspriteptr[i] = NULL;
}
}
#ifdef USE_OPENGL
if (getrendermode() >= REND_POLYMOST)
bglDepthMask(GL_FALSE);
#endif
while (spritesortcnt)
if (getrendermode() == REND_POLYMOST)
{
spritesortcnt--;
if (tspriteptr[spritesortcnt] != NULL && (tspriteptr[spritesortcnt]->cstat & 1024))
{
drawsprite(spritesortcnt);
tspriteptr[spritesortcnt] = NULL;
}
}
bglDepthMask(GL_FALSE);
while (spritesortcnt)
{
spritesortcnt--;
if (tspriteptr[spritesortcnt] != NULL && (tspriteptr[spritesortcnt]->cstat & 1024))
{
drawsprite(spritesortcnt);
tspriteptr[spritesortcnt] = NULL;
}
}
#ifdef USE_OPENGL
if (getrendermode() >= REND_POLYMOST)
bglDepthMask(GL_TRUE);
}
#endif
#ifdef POLYMER

View file

@ -3406,17 +3406,17 @@ void polymost_scansector(int32_t sectnum)
for (int z=headspritesect[sectnum]; z>=0; z=nextspritesect[z])
{
tspritetype const * const spr = (tspritetype *)&sprite[z];
if ((((spr->cstat&0x8000) == 0) || (showinvisibility)) &&
(spr->xrepeat > 0) && (spr->yrepeat > 0))
{
vec2_t const s = { spr->x-globalposx, spr->y-globalposy };
if ((spr->cstat&48) || (usemodels && tile2model[spr->picnum].modelid>=0) || ((s.x * gcosang) + (s.y * gsinang) > 0))
{
if ((spr->cstat&(64+48))!=(64+16) || dmulscale6(sintable[(spr->ang+512)&2047],-s.x, sintable[spr->ang&2047],-s.y) > 0)
if (engine_addtsprite(z, sectnum))
break;
}
if ((spr->cstat & 0x8000 && !showinvisibility) || spr->xrepeat == 0 || spr->yrepeat == 0)
continue;
vec2_t const s = { spr->x-globalposx, spr->y-globalposy };
if ((spr->cstat&48) || (usemodels && tile2model[spr->picnum].modelid>=0) || ((s.x * gcosang) + (s.y * gsinang) > 0))
{
if ((spr->cstat&(64+48))!=(64+16) || dmulscale6(sintable[(spr->ang+512)&2047],-s.x, sintable[spr->ang&2047],-s.y) > 0)
if (engine_addtsprite(z, sectnum))
break;
}
}