mirror of
https://github.com/DrBeef/Raze.git
synced 2024-11-15 17:01:51 +00:00
Introduce additional rotatesprite bit for internal use and mask ext. ones from CON.
ROTATESPRITE_MAX is moved to build.h and all orientation bits from CON commands using rotatesprite are ANDed with (ROTATESPRITE_MAX-1). Some of the functions use ROTATESPRITE_MAX for different internal purposes, which will not be exposed to CON now (a good thing). Also, dorotspr_handle_bit2 is made clearer. git-svn-id: https://svn.eduke32.com/eduke32@2929 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
88eb1fac78
commit
99160ede88
4 changed files with 41 additions and 24 deletions
|
@ -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
|
||||
|
|
|
@ -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))
|
||||
{
|
||||
xbord = scale(oxdim-xdim, cxs, oxdim);
|
||||
xbord = scale(oxdim-xdim, twice_midcx, oxdim);
|
||||
|
||||
if ((dastat & 512)==0)
|
||||
xbord = -xbord;
|
||||
}
|
||||
|
||||
sx = ((cxs+xbord)<<15) + sthelse;
|
||||
}
|
||||
sx = ((twice_midcx+xbord)<<15) + scaledxofs;
|
||||
|
||||
sy = ((cy1_plus_cy2+2)<<15)+mulscale16(sy-(200<<15), x);
|
||||
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(); //{{{
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue