mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-11-25 05:41:42 +00:00
add transparency flag support to V_DrawFill
This commit is contained in:
parent
e6780f2bee
commit
754a11f7f1
2 changed files with 48 additions and 3 deletions
|
@ -1333,6 +1333,7 @@ void HWR_DrawFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 color)
|
|||
FOutVector v[4];
|
||||
FSurfaceInfo Surf;
|
||||
float fx, fy, fw, fh;
|
||||
UINT8 alphalevel = ((color & V_ALPHAMASK) >> V_ALPHASHIFT);
|
||||
|
||||
UINT8 perplayershuffle = 0;
|
||||
|
||||
|
@ -1499,8 +1500,16 @@ void HWR_DrawFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 color)
|
|||
|
||||
Surf.PolyColor = V_GetColor(color);
|
||||
|
||||
if (alphalevel)
|
||||
{
|
||||
if (alphalevel == 10) Surf.PolyColor.s.alpha = softwaretranstogl_lo[st_translucency]; // V_HUDTRANSHALF
|
||||
else if (alphalevel == 11) Surf.PolyColor.s.alpha = softwaretranstogl[st_translucency]; // V_HUDTRANS
|
||||
else if (alphalevel == 12) Surf.PolyColor.s.alpha = softwaretranstogl_hi[st_translucency]; // V_HUDTRANSDOUBLE
|
||||
else Surf.PolyColor.s.alpha = softwaretranstogl[10-alphalevel];
|
||||
}
|
||||
|
||||
HWD.pfnDrawPolygon(&Surf, v, 4,
|
||||
PF_Modulated|PF_NoTexture|PF_NoDepthTest);
|
||||
PF_Modulated|PF_NoTexture|PF_NoDepthTest|PF_Translucent);
|
||||
}
|
||||
|
||||
#ifdef HAVE_PNG
|
||||
|
|
|
@ -1187,12 +1187,33 @@ void V_DrawFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 c)
|
|||
{
|
||||
UINT8 *dest;
|
||||
const UINT8 *deststop;
|
||||
UINT32 alphalevel = ((c & V_ALPHAMASK) >> V_ALPHASHIFT);
|
||||
UINT32 blendmode = ((c & V_BLENDMASK) >> V_BLENDSHIFT);
|
||||
INT32 u;
|
||||
|
||||
UINT8 perplayershuffle = 0;
|
||||
|
||||
if (rendermode == render_none)
|
||||
return;
|
||||
|
||||
v_translevel = NULL;
|
||||
if (alphalevel || blendmode)
|
||||
{
|
||||
if (alphalevel == 10) // V_HUDTRANSHALF
|
||||
alphalevel = hudminusalpha[st_translucency];
|
||||
else if (alphalevel == 11) // V_HUDTRANS
|
||||
alphalevel = 10 - st_translucency;
|
||||
else if (alphalevel == 12) // V_HUDTRANSDOUBLE
|
||||
alphalevel = hudplusalpha[st_translucency];
|
||||
|
||||
if (alphalevel >= 10)
|
||||
return; // invis
|
||||
|
||||
if (alphalevel || blendmode)
|
||||
v_translevel = R_GetBlendTable(blendmode+1, alphalevel);
|
||||
}
|
||||
|
||||
|
||||
#ifdef HWRENDER
|
||||
//if (rendermode != render_soft && !con_startup) // Not this again
|
||||
if (rendermode == render_opengl)
|
||||
|
@ -1202,6 +1223,8 @@ void V_DrawFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 c)
|
|||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
if (splitscreen && (c & V_PERPLAYER))
|
||||
{
|
||||
fixed_t adjusty = ((c & V_NOSCALESTART) ? vid.height : BASEVIDHEIGHT)>>1;
|
||||
|
@ -1338,8 +1361,21 @@ void V_DrawFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 c)
|
|||
|
||||
c &= 255;
|
||||
|
||||
for (;(--h >= 0) && dest < deststop; dest += vid.width)
|
||||
memset(dest, c, w * vid.bpp);
|
||||
// borrowing this from jimitia's new hud drawing functions rq
|
||||
if (alphalevel)
|
||||
{
|
||||
v_translevel += c<<8;
|
||||
for (;(--h >= 0) && dest < deststop; dest += vid.width)
|
||||
{
|
||||
for (x = 0; x < w; x++)
|
||||
dest[x] = v_translevel[dest[x]];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (;(--h >= 0) && dest < deststop; dest += vid.width)
|
||||
memset(dest, c, w * vid.bpp);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef HWRENDER
|
||||
|
|
Loading…
Reference in a new issue