From 2d9f205c69a7a48fd63a9e969325a50aba7ed3e0 Mon Sep 17 00:00:00 2001 From: terminx Date: Fri, 13 May 2016 22:15:20 +0000 Subject: [PATCH] Revert bad attempt at fixing cstat 1024 git-svn-id: https://svn.eduke32.com/eduke32@5723 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/build/src/engine.c | 67 +++++++++++++++++------------- 1 file changed, 38 insertions(+), 29 deletions(-) diff --git a/polymer/eduke32/build/src/engine.c b/polymer/eduke32/build/src/engine.c index 98f40da8a..8824eff47 100644 --- a/polymer/eduke32/build/src/engine.c +++ b/polymer/eduke32/build/src/engine.c @@ -2624,11 +2624,12 @@ 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; - int32_t sectorbordercnt = 1; + sectorborder[0] = startsectnum, sectorbordercnt = 1; do { @@ -2641,15 +2642,16 @@ static void scansector(int16_t startsectnum) { const spritetype *const spr = &sprite[i]; - if (((spr->cstat & 0x8000) && !showinvisibility) || spr->xrepeat == 0 || spr->yrepeat == 0) - continue; + if (((spr->cstat&0x8000) == 0 || showinvisibility) && + spr->xrepeat > 0 && spr->yrepeat > 0) + { + int32_t xs = spr->x-globalposx, ys = spr->y-globalposy; - 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; + 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; + } } gotsector[sectnum>>3] |= pow2char[sectnum&7]; @@ -9893,7 +9895,11 @@ killsprite: while (i) { i--; - if (tspriteptr[i] != NULL) + if (tspriteptr[i] != NULL && ((tspriteptr[i]->cstat & 1024) != 1024 +#ifdef POLYMER + || getrendermode() == REND_POLYMER +#endif + )) { vec2f_t spr; const tspritetype *tspr = tspriteptr[i]; @@ -9965,10 +9971,10 @@ killsprite: { debugmask_add(i | 32768, tspr->owner); drawsprite(i); - - if (tspr->cstat & 1024 && getrendermode() == REND_POLYMOST) +#ifdef POLYMER + if (tspr->cstat & 1024 && getrendermode() == REND_POLYMER) continue; - +#endif tspriteptr[i] = NULL; } } @@ -9984,33 +9990,36 @@ killsprite: while (i) { i--; - if (tspriteptr[i] != NULL) + if (tspriteptr[i] != NULL && ((tspriteptr[i]->cstat & 1024) != 1024 +#ifdef POLYMER + || getrendermode() == REND_POLYMER +#endif + )) { debugmask_add(i | 32768, tspriteptr[i]->owner); drawsprite(i); - - if ((tspriteptr[i]->cstat & 1024) != 1024 || getrendermode() != REND_POLYMOST) - tspriteptr[i] = NULL; + tspriteptr[i] = NULL; } } #ifdef USE_OPENGL - if (getrendermode() == REND_POLYMOST) - { + if (getrendermode() >= REND_POLYMOST) bglDepthMask(GL_FALSE); +#endif - while (spritesortcnt) + while (spritesortcnt) + { + spritesortcnt--; + if (tspriteptr[spritesortcnt] != NULL && (tspriteptr[spritesortcnt]->cstat & 1024)) { - spritesortcnt--; - if (tspriteptr[spritesortcnt] != NULL && (tspriteptr[spritesortcnt]->cstat & 1024)) - { - drawsprite(spritesortcnt); - tspriteptr[spritesortcnt] = NULL; - } + drawsprite(spritesortcnt); + tspriteptr[spritesortcnt] = NULL; } - - bglDepthMask(GL_TRUE); } + +#ifdef USE_OPENGL + if (getrendermode() >= REND_POLYMOST) + bglDepthMask(GL_TRUE); #endif #ifdef POLYMER