mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
Remove translucenthud cvar, let V_HUDTRANS fade in like V_SLIDEIN
- V_HUDTRANS does not fade if combined with V_SLIDEIN (since sliding elements are not supposed to fade). - If not V_SPLITSCREEN, uses most opaque fade value among splitscreen players (since Tally will fade back out for specific players).
This commit is contained in:
parent
653db93022
commit
afeba341c0
9 changed files with 66 additions and 62 deletions
|
|
@ -446,7 +446,6 @@ consvar_t cv_splitplayers = Player("splitplayers", "One").values({{1, "One"}, {2
|
|||
|
||||
consvar_t cv_ticrate = Player(cvlist_screen)("showfps", "No").yes_no();
|
||||
consvar_t cv_tilting = Player("tilting", "On").on_off();
|
||||
consvar_t cv_translucenthud = Player("translucenthud", "10").min_max(0, 10);
|
||||
|
||||
// first time memory
|
||||
consvar_t cv_tutorialprompt = Player("tutorialprompt", "On").on_off();
|
||||
|
|
|
|||
|
|
@ -321,11 +321,11 @@ void HWR_DrawStretchyFixedPatch(patch_t *gpatch, fixed_t x, fixed_t y, fixed_t p
|
|||
flags |= HWR_GetBlendModeFlag(blendmode);
|
||||
|
||||
if (alphalevel == 10)
|
||||
Surf.PolyColor.s.alpha = softwaretranstogl_lo[st_translucency];
|
||||
Surf.PolyColor.s.alpha = softwaretranstogl_lo[V_GetHUDTranslucency(option)];
|
||||
else if (alphalevel == 11)
|
||||
Surf.PolyColor.s.alpha = softwaretranstogl[st_translucency];
|
||||
Surf.PolyColor.s.alpha = softwaretranstogl[V_GetHUDTranslucency(option)];
|
||||
else if (alphalevel == 12)
|
||||
Surf.PolyColor.s.alpha = softwaretranstogl_hi[st_translucency];
|
||||
Surf.PolyColor.s.alpha = softwaretranstogl_hi[V_GetHUDTranslucency(option)];
|
||||
else
|
||||
Surf.PolyColor.s.alpha = softwaretranstogl[10-alphalevel];
|
||||
|
||||
|
|
@ -475,11 +475,11 @@ void HWR_DrawCroppedPatch(patch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscale,
|
|||
flags |= HWR_GetBlendModeFlag(blendmode);
|
||||
|
||||
if (alphalevel == 10)
|
||||
Surf.PolyColor.s.alpha = softwaretranstogl_lo[st_translucency];
|
||||
Surf.PolyColor.s.alpha = softwaretranstogl_lo[V_GetHUDTranslucency(option)];
|
||||
else if (alphalevel == 11)
|
||||
Surf.PolyColor.s.alpha = softwaretranstogl[st_translucency];
|
||||
Surf.PolyColor.s.alpha = softwaretranstogl[V_GetHUDTranslucency(option)];
|
||||
else if (alphalevel == 12)
|
||||
Surf.PolyColor.s.alpha = softwaretranstogl_hi[st_translucency];
|
||||
Surf.PolyColor.s.alpha = softwaretranstogl_hi[V_GetHUDTranslucency(option)];
|
||||
else
|
||||
Surf.PolyColor.s.alpha = softwaretranstogl[10-alphalevel];
|
||||
|
||||
|
|
|
|||
|
|
@ -1172,14 +1172,6 @@ static int libd_getlocaltransflag(lua_State *L)
|
|||
return 1;
|
||||
}
|
||||
|
||||
// Get cv_translucenthud's value for HUD rendering as a normal V_xxTRANS int
|
||||
static int libd_getusertransflag(lua_State *L)
|
||||
{
|
||||
HUDONLY
|
||||
lua_pushinteger(L, (10-cv_translucenthud.value)*V_10TRANS); // A bit weird that it's called "translucenthud" yet 10 is fully opaque :V
|
||||
return 1;
|
||||
}
|
||||
|
||||
// Return the time elapsed for the previous frame, in tics.
|
||||
static int libd_getDeltaTime(lua_State *L)
|
||||
{
|
||||
|
|
@ -1226,7 +1218,6 @@ static luaL_Reg lib_draw[] = {
|
|||
{"renderer", libd_renderer},
|
||||
{"localTransFlag", libd_getlocaltransflag},
|
||||
{"drawOnMinimap", libd_drawOnMinimap},
|
||||
{"userTransFlag", libd_getusertransflag},
|
||||
{"getDeltaTime", libd_getDeltaTime},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -12,9 +12,6 @@ menuitem_t OPTIONS_HUD[] =
|
|||
{IT_STRING | IT_CVAR, "Show HUD (F3)", "Toggles HUD display. Great for taking screenshots!",
|
||||
NULL, {.cvar = &cv_showhud}, 0, 0},
|
||||
|
||||
{IT_STRING | IT_CVAR | IT_CV_SLIDER, "HUD Opacity", "Non opaque values may have performance impacts in software mode.",
|
||||
NULL, {.cvar = &cv_translucenthud}, 0, 0},
|
||||
|
||||
{IT_SPACE | IT_NOTHING, NULL, NULL,
|
||||
NULL, {NULL}, 0, 0},
|
||||
|
||||
|
|
|
|||
|
|
@ -123,7 +123,7 @@ extern struct RenderStats g_renderstats;
|
|||
// REFRESH - the actual rendering functions.
|
||||
//
|
||||
|
||||
extern consvar_t cv_showhud, cv_translucenthud;
|
||||
extern consvar_t cv_showhud;
|
||||
extern consvar_t cv_homremoval;
|
||||
extern consvar_t cv_chasecam[MAXSPLITSCREENPLAYERS];
|
||||
extern consvar_t cv_flipcam[MAXSPLITSCREENPLAYERS];
|
||||
|
|
|
|||
|
|
@ -1475,21 +1475,27 @@ void ST_Drawer(void)
|
|||
#endif
|
||||
if (rendermode != render_none) ST_doPaletteStuff();
|
||||
|
||||
{
|
||||
#if 0
|
||||
const tic_t length = TICRATE/2;
|
||||
fixed_t localfadein[MAXSPLITSCREENPLAYERS];
|
||||
|
||||
if (lt_exitticker)
|
||||
// HUD fading for anything not tied to a single player,
|
||||
// i.e. the minimap. Since individual splitscreen
|
||||
// players' HUDs may fade away before other's, use the
|
||||
// the last one remaining.
|
||||
{
|
||||
fixed_t maxFade = 0;
|
||||
UINT8 i;
|
||||
|
||||
for (i = 0; i <= r_splitscreen; i++)
|
||||
{
|
||||
st_translucency = cv_translucenthud.value;
|
||||
if (lt_exitticker < length)
|
||||
st_translucency = (((INT32)(lt_ticker - lt_endtime))*st_translucency)/((INT32)length);
|
||||
localfadein[i] = ST_CalculateFadeIn(&players[displayplayers[i]]);
|
||||
|
||||
if (localfadein[i] > maxFade)
|
||||
{
|
||||
maxFade = localfadein[i];
|
||||
}
|
||||
}
|
||||
else
|
||||
st_translucency = 0;
|
||||
#else
|
||||
st_translucency = cv_translucenthud.value;
|
||||
#endif
|
||||
|
||||
st_translucency = FixedMul(10, maxFade);
|
||||
}
|
||||
|
||||
// Check for a valid level title
|
||||
|
|
@ -1509,7 +1515,7 @@ void ST_Drawer(void)
|
|||
for (i = 0; i <= r_splitscreen; i++)
|
||||
{
|
||||
stplyr = &players[displayplayers[i]];
|
||||
st_fadein = ST_FadeIn(stplyr);
|
||||
st_fadein = localfadein[i];
|
||||
R_SetViewContext(VIEWCONTEXT_PLAYER1 + i);
|
||||
R_InterpolateView(rendertimefrac); // to assist with object tracking
|
||||
ST_overlayDrawer();
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ boolean ST_SameTeam(player_t *a, player_t *b);
|
|||
|
||||
extern boolean st_overlay; // sb overlay on or off when fullscreen
|
||||
extern INT32 st_palette; // 0 is default, any others are special palettes.
|
||||
extern UINT32 st_translucency;
|
||||
extern UINT32 st_translucency; // HUD fading for elements not attached to specific players
|
||||
extern fixed_t st_fadein; // transitioning value per player, FRACUNIT = fully in view
|
||||
|
||||
extern lumpnum_t st_borderpatchnum;
|
||||
|
|
|
|||
|
|
@ -734,6 +734,39 @@ static inline UINT8 transmappedpdraw(const UINT8 *dest, const UINT8 *source, fix
|
|||
return *(v_translevel + (((*(v_colormap + source[ofs>>FRACBITS]))<<8)&0xff00) + (*dest&0xff));
|
||||
}
|
||||
|
||||
UINT32 V_GetHUDTranslucency(INT32 scrn)
|
||||
{
|
||||
if (scrn & V_SLIDEIN)
|
||||
{
|
||||
return 10;
|
||||
}
|
||||
|
||||
if (scrn & V_SPLITSCREEN)
|
||||
{
|
||||
return FixedMul(10, st_fadein);
|
||||
}
|
||||
|
||||
return st_translucency;
|
||||
}
|
||||
|
||||
static UINT32 V_GetAlphaLevel(INT32 scrn)
|
||||
{
|
||||
switch (scrn & V_ALPHAMASK)
|
||||
{
|
||||
case V_HUDTRANSHALF:
|
||||
return hudminusalpha[V_GetHUDTranslucency(scrn)];
|
||||
|
||||
case V_HUDTRANS:
|
||||
return 10 - V_GetHUDTranslucency(scrn);
|
||||
|
||||
case V_HUDTRANSDOUBLE:
|
||||
return hudplusalpha[V_GetHUDTranslucency(scrn)];
|
||||
|
||||
default:
|
||||
return (scrn & V_ALPHAMASK) >> V_ALPHASHIFT;
|
||||
}
|
||||
}
|
||||
|
||||
// Draws a patch scaled to arbitrary size.
|
||||
void V_DrawStretchyFixedPatch(fixed_t x, fixed_t y, fixed_t pscale, fixed_t vscale, INT32 scrn, patch_t *patch, const UINT8 *colormap)
|
||||
{
|
||||
|
|
@ -759,18 +792,8 @@ void V_DrawStretchyFixedPatch(fixed_t x, fixed_t y, fixed_t pscale, fixed_t vsca
|
|||
|
||||
if ((blendmode = ((scrn & V_BLENDMASK) >> V_BLENDSHIFT)))
|
||||
blendmode++; // realign to constants
|
||||
if ((alphalevel = ((scrn & V_ALPHAMASK) >> V_ALPHASHIFT)))
|
||||
{
|
||||
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) // Still inelegible to render?
|
||||
return;
|
||||
}
|
||||
if ((alphalevel = V_GetAlphaLevel(scrn)) >= 10)
|
||||
return;
|
||||
|
||||
dupx = vid.dupx;
|
||||
dupy = vid.dupy;
|
||||
|
|
@ -1108,18 +1131,8 @@ void V_DrawFillConsoleMap(INT32 x, INT32 y, INT32 w, INT32 h, INT32 c)
|
|||
}
|
||||
#endif
|
||||
|
||||
if ((alphalevel = ((c & V_ALPHAMASK) >> V_ALPHASHIFT)))
|
||||
{
|
||||
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) // Still inelegible to render?
|
||||
return;
|
||||
}
|
||||
if ((alphalevel = V_GetAlphaLevel(c)) >= 10)
|
||||
return;
|
||||
|
||||
if (!(c & V_NOSCALESTART))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -155,10 +155,6 @@ void V_CubeApply(RGBA_t *input);
|
|||
#define V_HUDTRANSHALF 0x000A0000
|
||||
#define V_HUDTRANS 0x000B0000 // draw the hud translucent
|
||||
#define V_HUDTRANSDOUBLE 0x000C0000
|
||||
// Macros follow
|
||||
#define V_USERHUDTRANSHALF ((10-(cv_translucenthud.value/2))<<V_ALPHASHIFT)
|
||||
#define V_USERHUDTRANS ((10-cv_translucenthud.value)<<V_ALPHASHIFT)
|
||||
#define V_USERHUDTRANSDOUBLE ((10-min(cv_translucenthud.value*2, 10))<<V_ALPHASHIFT)
|
||||
|
||||
// use bits 21-23 for blendmodes
|
||||
#define V_BLENDSHIFT 20
|
||||
|
|
@ -182,6 +178,8 @@ void V_CubeApply(RGBA_t *input);
|
|||
#define V_NOSCALESTART 0x40000000 // don't scale x, y, start coords
|
||||
#define V_SPLITSCREEN 0x80000000 // Add half of screen width or height automatically depending on player number
|
||||
|
||||
UINT32 V_GetHUDTranslucency(INT32 scrn);
|
||||
|
||||
void V_AdjustXYWithSnap(INT32 *x, INT32 *y, UINT32 options, INT32 dupx, INT32 dupy);
|
||||
|
||||
struct cliprect_t
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue