diff --git a/polymer/eduke32/build/include/build.h b/polymer/eduke32/build/include/build.h index 735027fc2..26dcc6aa0 100644 --- a/polymer/eduke32/build/include/build.h +++ b/polymer/eduke32/build/include/build.h @@ -150,6 +150,9 @@ void yax_drawrooms(void (*SpriteAnimFunc)(int32_t,int32_t,int32_t,int32_t), // max x/y val (= max editorgridextent in Mapster32) #define BXY_MAX 524288 +// ROTATESPRITE_MAX-1 is the mask of all externally available orientation bits +#define ROTATESPRITE_MAX 2048 + //Make all variables in BUILD.H defined in the ENGINE, //and externed in GAME #ifdef ENGINE diff --git a/polymer/eduke32/build/src/engine.c b/polymer/eduke32/build/src/engine.c index 2de0a24a6..fa7891056 100644 --- a/polymer/eduke32/build/src/engine.c +++ b/polymer/eduke32/build/src/engine.c @@ -6856,7 +6856,7 @@ void dorotspr_handle_bit2(int32_t *sxptr, int32_t *syptr, int32_t *z, int32_t da if (!(dastat & 1024) && 4*ydim <= 3*xdim) { *ret_yxaspect = (12<<16)/10; - *ret_xyaspect = ((1<<16)*10)/12; + *ret_xyaspect = (10<<16)/12; // *sxptr and *syptr and *z are left unchanged } @@ -6869,61 +6869,65 @@ void dorotspr_handle_bit2(int32_t *sxptr, int32_t *syptr, int32_t *z, int32_t da const int32_t oxdim = xdim; int32_t xdim = oxdim; // SHADOWS global - int32_t x, sx=*sxptr, sy=*syptr; + int32_t zoomsc, sx=*sxptr, sy=*syptr; int32_t ouryxaspect = yxaspect, ourxyaspect = xyaspect; + // screen center to s[xy], 320<<16 coords. + const int32_t normxofs = sx-(320<<15), normyofs = sy-(200<<15); + if (!(dastat & 1024) && 4*ydim <= 3*xdim) { xdim = (4*ydim)/3; ouryxaspect = (12<<16)/10; - ourxyaspect = ((1<<16)*10)/12; + ourxyaspect = (10<<16)/12; } // nasty hacks go here if (!(dastat&8)) { - const int32_t cxs = cx1_plus_cx2+2; - int32_t sthelse; + const int32_t twice_midcx = cx1_plus_cx2+2; - x = xdimenscale; //= scale(xdimen,yxaspect,320); + // screen x center to sx1, scaled to viewport + const int32_t scaledxofs = scale(normxofs, scale(xdimen, xdim, oxdim), 320); - sthelse = scale(sx-(320<<15), scale(xdimen, xdim, oxdim), 320); + int32_t xbord = 0; + if (dastat & (256|512)) { - int32_t xbord = 0; + xbord = scale(oxdim-xdim, twice_midcx, oxdim); - if (dastat & (256|512)) - { - xbord = scale(oxdim-xdim, cxs, oxdim); - - if ((dastat & 512)==0) - xbord = -xbord; - } - - sx = ((cxs+xbord)<<15) + sthelse; + if ((dastat & 512)==0) + xbord = -xbord; } - sy = ((cy1_plus_cy2+2)<<15)+mulscale16(sy-(200<<15), x); + sx = ((twice_midcx+xbord)<<15) + scaledxofs; + + zoomsc = xdimenscale; //= scale(xdimen,yxaspect,320); + sy = ((cy1_plus_cy2+2)<<15) + mulscale16(normyofs, zoomsc); } else { //If not clipping to startmosts, & auto-scaling on, as a //hard-coded bonus, scale to full screen instead - x = scale(xdim,ouryxaspect,320); - sx = (xdim<<15)+32768 + scale(sx-(320<<15),xdim,320); - sy = (ydim<<15)+32768 + mulscale16(sy-(200<<15),x); + sx = (xdim<<15)+32768 + scale(normxofs,xdim,320); if (dastat & 512) sx += (oxdim-xdim)<<16; else if ((dastat & 256) == 0) sx += (oxdim-xdim)<<15; + + if (dastat&(1<<29)) + sx += oxdim<<15; + + zoomsc = scale(xdim, ouryxaspect, 320); + sy = (ydim<<15)+32768 + mulscale16(normyofs, zoomsc); } *sxptr = sx; *syptr = sy; - *z = mulscale16(*z,x); + *z = mulscale16(*z, zoomsc); *ret_yxaspect = ouryxaspect; *ret_xyaspect = ourxyaspect; @@ -13630,6 +13634,10 @@ void rotatesprite(int32_t sx, int32_t sy, int32_t z, int16_t a, int16_t picnum, if (picanm[picnum]&192) picnum += animateoffs(picnum,(int16_t)0xc000); if ((tilesizx[picnum] <= 0) || (tilesizy[picnum] <= 0)) return; + // Experimental / development bits. ONLY FOR INTERNAL USE! + // bit (1<<29): see dorotspr_handle_bit2 + //////////////////// + if (((dastat&128) == 0) || (numpages < 2) || (beforedrawrooms != 0)) { begindrawing(); //{{{ diff --git a/polymer/eduke32/source/game.c b/polymer/eduke32/source/game.c index e8062ba73..0e1b13082 100644 --- a/polymer/eduke32/source/game.c +++ b/polymer/eduke32/source/game.c @@ -60,8 +60,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # include "lunatic.h" #endif -#define ROTATESPRITE_MAX 2048 - #if KRANDDEBUG # define GAME_INLINE # define GAME_STATIC diff --git a/polymer/eduke32/source/gameexec.c b/polymer/eduke32/source/gameexec.c index f8d951f57..8ddc28ae4 100644 --- a/polymer/eduke32/source/gameexec.c +++ b/polymer/eduke32/source/gameexec.c @@ -1966,6 +1966,8 @@ nullquote: int32_t x=Gv_GetVarX(*insptr++), y=Gv_GetVarX(*insptr++), tilenum=Gv_GetVarX(*insptr++); int32_t shade=Gv_GetVarX(*insptr++), orientation=Gv_GetVarX(*insptr++); + orientation &= (ROTATESPRITE_MAX-1); + switch (tw) { case CON_MYOS: @@ -2510,6 +2512,8 @@ nullquote: continue; } + orientation &= (ROTATESPRITE_MAX-1); + rotatesprite(x,y,z,a,tilenum,shade,pal,2|orientation,x1,y1,x2,y2); continue; } @@ -2546,6 +2550,8 @@ nullquote: continue; } + orientation &= (ROTATESPRITE_MAX-1); + G_PrintGameText(0,tilenum,x>>1,y,ScriptQuotes[q],shade,pal,orientation,x1,y1,x2,y2,z); continue; } @@ -2569,6 +2575,8 @@ nullquote: continue; } + orientation &= (ROTATESPRITE_MAX-1); + G_DrawTXDigiNumZ(tilenum,x,y,q,shade,pal,orientation,x1,y1,x2,y2,z); continue; }