mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-11-11 07:11:39 +00:00
Implement alpha into rotatesprite (rotatesprite_) on the engine side.
git-svn-id: https://svn.eduke32.com/eduke32@3609 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
c5044b3ecd
commit
3d46bc1551
4 changed files with 47 additions and 15 deletions
|
@ -770,8 +770,8 @@ void drawmasks(void);
|
|||
void clearview(int32_t dacol);
|
||||
void clearallviews(int32_t dacol);
|
||||
void drawmapview(int32_t dax, int32_t day, int32_t zoome, int16_t ang);
|
||||
void rotatesprite(int32_t sx, int32_t sy, int32_t z, int16_t a, int16_t picnum,
|
||||
int8_t dashade, char dapalnum, int32_t dastat,
|
||||
void rotatesprite_(int32_t sx, int32_t sy, int32_t z, int16_t a, int16_t picnum,
|
||||
int8_t dashade, char dapalnum, int32_t dastat, uint8_t daalpha,
|
||||
int32_t cx1, int32_t cy1, int32_t cx2, int32_t cy2);
|
||||
void drawline256(int32_t x1, int32_t y1, int32_t x2, int32_t y2, char col);
|
||||
int32_t printext16(int32_t xpos, int32_t ypos, int16_t col, int16_t backcol,
|
||||
|
@ -781,16 +781,22 @@ void printext256(int32_t xpos, int32_t ypos, int16_t col, int16_t backcol,
|
|||
|
||||
////////// specialized rotatesprite wrappers for (very) often used cases //////////
|
||||
// don't clip at all, i.e. the whole screen real estate is available
|
||||
static inline void rotatesprite(int32_t sx, int32_t sy, int32_t z, int16_t a, int16_t picnum,
|
||||
int8_t dashade, char dapalnum, int32_t dastat,
|
||||
int32_t cx1, int32_t cy1, int32_t cx2, int32_t cy2)
|
||||
{
|
||||
rotatesprite_(sx, sy, z, a, picnum, dashade, dapalnum, dastat, 0, cx1, cy1, cx2, cy2);
|
||||
}
|
||||
static inline void rotatesprite_fs(int32_t sx, int32_t sy, int32_t z, int16_t a, int16_t picnum,
|
||||
int8_t dashade, char dapalnum, int32_t dastat)
|
||||
{
|
||||
rotatesprite(sx, sy, z, a, picnum, dashade, dapalnum, dastat, 0,0,xdim-1,ydim-1);
|
||||
rotatesprite_(sx, sy, z, a, picnum, dashade, dapalnum, dastat, 0, 0,0,xdim-1,ydim-1);
|
||||
}
|
||||
|
||||
static inline void rotatesprite_win(int32_t sx, int32_t sy, int32_t z, int16_t a, int16_t picnum,
|
||||
int8_t dashade, char dapalnum, int32_t dastat)
|
||||
{
|
||||
rotatesprite(sx, sy, z, a, picnum, dashade, dapalnum, dastat, windowx1,windowy1,windowx2,windowy2);
|
||||
rotatesprite_(sx, sy, z, a, picnum, dashade, dapalnum, dastat, 0, windowx1,windowy1,windowx2,windowy2);
|
||||
}
|
||||
|
||||
void bfirst_search_init(int16_t *list, uint8_t *bitmap, int32_t *eltnumptr, int32_t maxnum, int16_t firstelt);
|
||||
|
|
|
@ -40,7 +40,7 @@ void uploadtexture(int32_t doalloc, int32_t xsiz, int32_t ysiz, int32_t intexfmt
|
|||
void polymost_drawsprite(int32_t snum);
|
||||
void polymost_drawmaskwall(int32_t damaskwallcnt);
|
||||
void polymost_dorotatesprite(int32_t sx, int32_t sy, int32_t z, int16_t a, int16_t picnum,
|
||||
int8_t dashade, char dapalnum, int32_t dastat, int32_t cx1, int32_t cy1, int32_t cx2, int32_t cy2, int32_t uniqid);
|
||||
int8_t dashade, char dapalnum, int32_t dastat, uint8_t daalpha, int32_t cx1, int32_t cy1, int32_t cx2, int32_t cy2, int32_t uniqid);
|
||||
void polymost_fillpolygon(int32_t npoints);
|
||||
void polymost_initosdfuncs(void);
|
||||
void polymost_drawrooms(void);
|
||||
|
|
|
@ -2311,7 +2311,9 @@ typedef struct
|
|||
int32_t sx, sy, z;
|
||||
int16_t a, picnum;
|
||||
int8_t dashade;
|
||||
char dapalnum, dastat, pagesleft;
|
||||
char dapalnum, dastat;
|
||||
uint8_t daalpha;
|
||||
char pagesleft;
|
||||
int32_t cx1, cy1, cx2, cy2;
|
||||
int32_t uniqid; //JF extension
|
||||
} permfifotype;
|
||||
|
@ -7128,7 +7130,7 @@ void dorotspr_handle_bit2(int32_t *sxptr, int32_t *syptr, int32_t *z, int32_t da
|
|||
//
|
||||
//JBF 20031206: Thanks to Ken's hunting, s/(rx1|ry1|rx2|ry2)/n\1/ in this function
|
||||
static void dorotatesprite(int32_t sx, int32_t sy, int32_t z, int16_t a, int16_t picnum,
|
||||
int8_t dashade, char dapalnum, int32_t dastat,
|
||||
int8_t dashade, char dapalnum, int32_t dastat, uint8_t daalpha,
|
||||
int32_t cx1, int32_t cy1, int32_t cx2, int32_t cy2,
|
||||
int32_t uniqid)
|
||||
{
|
||||
|
@ -7152,7 +7154,7 @@ static void dorotatesprite(int32_t sx, int32_t sy, int32_t z, int16_t a, int16_t
|
|||
#ifdef USE_OPENGL
|
||||
if (rendmode >= 3 && qsetmode == 200)
|
||||
{
|
||||
polymost_dorotatesprite(sx,sy,z,a,picnum,dashade,dapalnum,dastat,cx1,cy1,cx2,cy2,uniqid);
|
||||
polymost_dorotatesprite(sx,sy,z,a,picnum,dashade,dapalnum,dastat,daalpha,cx1,cy1,cx2,cy2,uniqid);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
@ -7255,6 +7257,24 @@ static void dorotatesprite(int32_t sx, int32_t sy, int32_t z, int16_t a, int16_t
|
|||
if (palookup[dapalnum] == NULL) dapalnum = 0;
|
||||
palookupoffs = FP_OFF(palookup[dapalnum]) + (getpalookup(0, dashade)<<8);
|
||||
|
||||
// hack pending proper alpha implentation
|
||||
// TODO: a real implementation
|
||||
if (daalpha > 84) // if alpha is 0 (which is the default) this structure should only necessitate one comparison
|
||||
{
|
||||
if ((dastat&1) && daalpha > 127) // this covers the multiplicative aspect used in the Polymodes
|
||||
dastat |= 32;
|
||||
|
||||
dastat |= 1;
|
||||
|
||||
if (daalpha > 168)
|
||||
{
|
||||
dastat |= 32;
|
||||
|
||||
if (daalpha == 255)
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
i = divscale32(1L,z);
|
||||
xv = mulscale14(sinang,i);
|
||||
yv = mulscale14(cosang,i);
|
||||
|
@ -10567,7 +10587,7 @@ void nextpage(void)
|
|||
per = &permfifo[i];
|
||||
if ((per->pagesleft > 0) && (per->pagesleft <= numpages))
|
||||
dorotatesprite(per->sx,per->sy,per->z,per->a,per->picnum,
|
||||
per->dashade,per->dapalnum,per->dastat,
|
||||
per->dashade,per->dapalnum,per->dastat,per->daalpha,
|
||||
per->cx1,per->cy1,per->cx2,per->cy2,per->uniqid);
|
||||
}
|
||||
enddrawing(); //}}}
|
||||
|
@ -10581,7 +10601,7 @@ void nextpage(void)
|
|||
per = &permfifo[i];
|
||||
if (per->pagesleft >= 130)
|
||||
dorotatesprite(per->sx,per->sy,per->z,per->a,per->picnum,
|
||||
per->dashade,per->dapalnum,per->dastat,
|
||||
per->dashade,per->dapalnum,per->dastat,per->daalpha,
|
||||
per->cx1,per->cy1,per->cx2,per->cy2,per->uniqid);
|
||||
|
||||
if (per->pagesleft&127) per->pagesleft--;
|
||||
|
@ -13734,8 +13754,8 @@ void flushperms(void)
|
|||
//
|
||||
// rotatesprite
|
||||
//
|
||||
void rotatesprite(int32_t sx, int32_t sy, int32_t z, int16_t a, int16_t picnum,
|
||||
int8_t dashade, char dapalnum, int32_t dastat,
|
||||
void rotatesprite_(int32_t sx, int32_t sy, int32_t z, int16_t a, int16_t picnum,
|
||||
int8_t dashade, char dapalnum, int32_t dastat, uint8_t daalpha,
|
||||
int32_t cx1, int32_t cy1, int32_t cx2, int32_t cy2)
|
||||
{
|
||||
int32_t i;
|
||||
|
@ -13756,7 +13776,7 @@ void rotatesprite(int32_t sx, int32_t sy, int32_t z, int16_t a, int16_t picnum,
|
|||
if (((dastat&128) == 0) || (numpages < 2) || (beforedrawrooms != 0))
|
||||
{
|
||||
begindrawing(); //{{{
|
||||
dorotatesprite(sx,sy,z,a,picnum,dashade,dapalnum,dastat,cx1,cy1,cx2,cy2,guniqhudid);
|
||||
dorotatesprite(sx,sy,z,a,picnum,dashade,dapalnum,dastat,daalpha,cx1,cy1,cx2,cy2,guniqhudid);
|
||||
enddrawing(); //}}}
|
||||
}
|
||||
|
||||
|
@ -13772,6 +13792,7 @@ void rotatesprite(int32_t sx, int32_t sy, int32_t z, int16_t a, int16_t picnum,
|
|||
per->picnum = picnum;
|
||||
per->dashade = dashade; per->dapalnum = dapalnum;
|
||||
per->dastat = dastat;
|
||||
per->daalpha = daalpha;
|
||||
per->pagesleft = numpages+((beforedrawrooms&1)<<7);
|
||||
per->cx1 = cx1; per->cy1 = cy1; per->cx2 = cx2; per->cy2 = cy2;
|
||||
per->uniqid = guniqhudid; //JF extension
|
||||
|
|
|
@ -5371,7 +5371,7 @@ void polymost_drawsprite(int32_t snum)
|
|||
//dastat&128 1:draw all pages (permanent)
|
||||
//cx1,... clip window (actual screen coords)
|
||||
void polymost_dorotatesprite(int32_t sx, int32_t sy, int32_t z, int16_t a, int16_t picnum,
|
||||
int8_t dashade, char dapalnum, int32_t dastat,
|
||||
int8_t dashade, char dapalnum, int32_t dastat, uint8_t daalpha,
|
||||
int32_t cx1, int32_t cy1, int32_t cx2, int32_t cy2, int32_t uniqid)
|
||||
{
|
||||
static int32_t onumframes = 0;
|
||||
|
@ -5537,6 +5537,8 @@ void polymost_dorotatesprite(int32_t sx, int32_t sy, int32_t z, int16_t a, int16
|
|||
}
|
||||
|
||||
#ifdef USE_OPENGL
|
||||
spriteext[tspr.owner].alpha = daalpha / 255.0f;
|
||||
|
||||
if (!nofog) bglDisable(GL_FOG);
|
||||
if (rendmode < 4)
|
||||
mddraw(&tspr);
|
||||
|
@ -5579,6 +5581,8 @@ void polymost_dorotatesprite(int32_t sx, int32_t sy, int32_t z, int16_t a, int16
|
|||
if (!nofog) bglEnable(GL_FOG);
|
||||
#else
|
||||
mddraw(&tspr);
|
||||
|
||||
spriteext[tspr.owner].alpha = 0.f;
|
||||
#endif
|
||||
viewingrange = oldviewingrange;
|
||||
gxyaspect = ogxyaspect;
|
||||
|
@ -5641,6 +5645,8 @@ void polymost_dorotatesprite(int32_t sx, int32_t sy, int32_t z, int16_t a, int16
|
|||
}
|
||||
method |= 4; //Use OpenGL clamping - dorotatesprite never repeats
|
||||
|
||||
alpha = daalpha / 255.0f;
|
||||
|
||||
xsiz = tilesizx[globalpicnum];
|
||||
ysiz = tilesizy[globalpicnum];
|
||||
|
||||
|
@ -5743,7 +5749,6 @@ void polymost_dorotatesprite(int32_t sx, int32_t sy, int32_t z, int16_t a, int16
|
|||
}
|
||||
while (z);
|
||||
|
||||
alpha = 0.f;
|
||||
#ifdef USE_OPENGL
|
||||
if (!nofog) bglDisable(GL_FOG);
|
||||
pow2xsplit = 0; drawpoly(px,py,n,method);
|
||||
|
|
Loading…
Reference in a new issue