diff --git a/polymer/eduke32/build/src/engine.c b/polymer/eduke32/build/src/engine.c index 303bad46e..71119f29b 100644 --- a/polymer/eduke32/build/src/engine.c +++ b/polymer/eduke32/build/src/engine.c @@ -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 diff --git a/polymer/eduke32/build/src/polymost.c b/polymer/eduke32/build/src/polymost.c index 4b1c32658..477060afe 100644 --- a/polymer/eduke32/build/src/polymost.c +++ b/polymer/eduke32/build/src/polymost.c @@ -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; } }