diff --git a/polymer/eduke32/build/src/engine.c b/polymer/eduke32/build/src/engine.c index 448a45cc2..eb36289de 100644 --- a/polymer/eduke32/build/src/engine.c +++ b/polymer/eduke32/build/src/engine.c @@ -252,7 +252,7 @@ static int16_t maphacklight[PR_MAXLIGHTS]; int32_t getscreenvdisp(int32_t bz, int32_t zoome); void screencoords(int32_t *xres, int32_t *yres, int32_t x, int32_t y, int32_t zoome); -static void scansector(int16_t sectnum); +static void scansector(int16_t startsectnum); static void draw_rainbow_background(void); int16_t editstatus = 0; @@ -2358,7 +2358,7 @@ static intptr_t globalbufplc; static int32_t globaly1, globalx2; -int16_t sectorborder[256], sectorbordercnt; +int16_t sectorborder[256]; int32_t ydim16, qsetmode = 0; int16_t pointhighlight=-1, linehighlight=-1, highlightcnt=0; static int32_t lastx[MAXYDIM]; @@ -2583,30 +2583,34 @@ int32_t engine_addtsprite(int16_t z, int16_t sectnum) // // scansector (internal) // -static void scansector(int16_t sectnum) +static void scansector(int16_t startsectnum) { - walltype *wal, *wal2; - spritetype *spr; - int32_t xs, ys, x1, y1, x2, y2, xp1, yp1, xp2=0, yp2=0, tempint; - int16_t z, zz, startwall, endwall, numscansbefore, scanfirst, bunchfrst; - int16_t nextsectnum; + int32_t xp1, yp1, xp2=0, yp2=0, tempint; + int32_t sectorbordercnt; - if (sectnum < 0) return; + if (startsectnum < 0) + return; + + sectorborder[0] = startsectnum, sectorbordercnt = 1; - sectorborder[0] = sectnum, sectorbordercnt = 1; do { - sectnum = sectorborder[--sectorbordercnt]; + int32_t z, startwall, endwall, numscansbefore, scanfirst, bunchfrst; + const int32_t sectnum = sectorborder[--sectorbordercnt]; + walltype *wal; + #ifdef YAX_ENABLE if (scansector_collectsprites) #endif for (z=headspritesect[sectnum]; z>=0; z=nextspritesect[z]) { - spr = &sprite[z]; + const spritetype *const spr = &sprite[z]; + if ((((spr->cstat&0x8000) == 0) || (showinvisibility)) && (spr->xrepeat > 0) && (spr->yrepeat > 0)) { - xs = spr->x-globalposx; ys = spr->y-globalposy; + int32_t xs = spr->x-globalposx, ys = spr->y-globalposy; + if ((spr->cstat&48) || ((int64_t)xs*cosglobalang+(int64_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(z, sectnum)) @@ -2624,11 +2628,11 @@ static void scansector(int16_t sectnum) scanfirst = numscans; for (z=startwall,wal=&wall[z]; znextsector; + const int32_t nextsectnum = wal->nextsector; + const walltype *const wal2 = &wall[wal->point2]; - wal2 = &wall[wal->point2]; - x1 = wal->x-globalposx; y1 = wal->y-globalposy; - x2 = wal2->x-globalposx; y2 = wal2->y-globalposy; + const int32_t x1 = wal->x-globalposx, y1 = wal->y-globalposy; + const int32_t x2 = wal2->x-globalposx, y2 = wal2->y-globalposy; if ((nextsectnum >= 0) && ((wal->cstat&32) == 0)) #ifdef YAX_ENABLE @@ -2721,6 +2725,7 @@ skipitaddwall: for (z=bunchfrst; z=0; zz=p2[zz]); bunchlast[z] = zz; } diff --git a/polymer/eduke32/build/src/engine_priv.h b/polymer/eduke32/build/src/engine_priv.h index 0e9c3934d..fcc9e9966 100644 --- a/polymer/eduke32/build/src/engine_priv.h +++ b/polymer/eduke32/build/src/engine_priv.h @@ -60,7 +60,7 @@ extern char inpreparemirror; extern int32_t curbrightness, gammabrightness; extern char britable[16][256]; extern char picsiz[MAXTILES]; -extern int16_t sectorborder[256], sectorbordercnt; +extern int16_t sectorborder[256]; extern int32_t qsetmode; extern int32_t hitallsprites; diff --git a/polymer/eduke32/build/src/polymost.c b/polymer/eduke32/build/src/polymost.c index a77bd0d0c..f7308f93c 100644 --- a/polymer/eduke32/build/src/polymost.c +++ b/polymer/eduke32/build/src/polymost.c @@ -3084,6 +3084,8 @@ void polymost_scansector(int32_t sectnum) int32_t z, zz, startwall, endwall, numscansbefore, scanfirst, bunchfrst, nextsectnum; int32_t xs, ys, x1, y1, x2, y2; + int32_t sectorbordercnt; + if (sectnum < 0) return; sectorborder[0] = sectnum, sectorbordercnt = 1;