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

View file

@ -3406,17 +3406,17 @@ void polymost_scansector(int32_t sectnum)
for (int z=headspritesect[sectnum]; z>=0; z=nextspritesect[z]) for (int z=headspritesect[sectnum]; z>=0; z=nextspritesect[z])
{ {
tspritetype const * const spr = (tspritetype *)&sprite[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 & 0x8000 && !showinvisibility) || spr->xrepeat == 0 || spr->yrepeat == 0)
{ continue;
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)) vec2_t const s = { spr->x-globalposx, spr->y-globalposy };
break;
} 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;
} }
} }