Some preparation for engineering a solution to the rendermode flag/V_*TRANS flag conflict.

* None of the following things (grouped by the fact they fade/slide in) use hardcoded static numbers; they'e now attached to the titlecard ticker.
    * Minimap.
    * All V_HUDTRANS items. (Not add/sub) - this was previously broken entirely
    * FREE PLAY
    * Record Attack Input (no longer slides in at all - needs to be visible from start of play.)
* Fixed a rare case where V_SLIDEIN HUD elements would occasionally jump a step too far.
This commit is contained in:
toaster 2021-03-30 22:55:09 +01:00
parent a4cf9932f0
commit 6f8033ab76
6 changed files with 74 additions and 73 deletions

View file

@ -750,9 +750,8 @@ void K_AdjustXYWithSnap(INT32 *x, INT32 *y, UINT32 options, INT32 dupx, INT32 du
if (options & V_SLIDEIN) if (options & V_SLIDEIN)
{ {
const tic_t length = TICRATE/2; const tic_t length = TICRATE/2;
const tic_t end = (lt_endtime + length);
if (lt_ticker < end) if (lt_exitticker < length)
{ {
INT32 offset = screenwidth - ((lt_exitticker * screenwidth) / length); INT32 offset = screenwidth - ((lt_exitticker * screenwidth) / length);
boolean slidefromright = false; boolean slidefromright = false;
@ -3048,16 +3047,17 @@ static void K_drawKartMinimap(void)
x = MINI_X - (AutomapPic->width/2); x = MINI_X - (AutomapPic->width/2);
y = MINI_Y - (AutomapPic->height/2); y = MINI_Y - (AutomapPic->height/2);
if (timeinmap > 105)
{ {
const tic_t length = TICRATE/2;
if (!lt_exitticker)
return;
minimaptrans = cv_kartminimap.value; minimaptrans = cv_kartminimap.value;
if (timeinmap <= 113) if (lt_exitticker < length)
minimaptrans = ((((INT32)timeinmap) - 105)*minimaptrans)/(113-105); minimaptrans = (((INT32)lt_exitticker)*minimaptrans)/((INT32)length);
if (!minimaptrans) if (!minimaptrans)
return; return;
} }
else
return;
minimaptrans = ((10-minimaptrans)<<FF_TRANSSHIFT); minimaptrans = ((10-minimaptrans)<<FF_TRANSSHIFT);
splitflags |= minimaptrans; splitflags |= minimaptrans;
@ -3617,7 +3617,7 @@ static void K_drawBattleFullscreen(void)
} }
} }
if (netgame && !stplyr->spectator && timeinmap > 113) // FREE PLAY? if (netgame && !stplyr->spectator) // FREE PLAY?
{ {
UINT8 i; UINT8 i;
@ -3631,7 +3631,7 @@ static void K_drawBattleFullscreen(void)
} }
if (LUA_HudEnabled(hud_freeplay)) if (LUA_HudEnabled(hud_freeplay))
K_drawKartFreePlay(leveltime); K_drawKartFreePlay();
} }
} }
@ -3804,18 +3804,6 @@ static void K_drawInput(void)
const INT32 accent2 = splitflags | skincolors[stplyr->skincolor].ramp[9]; const INT32 accent2 = splitflags | skincolors[stplyr->skincolor].ramp[9];
ticcmd_t *cmd = &stplyr->cmd; ticcmd_t *cmd = &stplyr->cmd;
if (timeinmap <= 105)
return;
if (timeinmap < 113)
{
INT32 count = ((INT32)(timeinmap) - 105);
offs = 64;
while (count-- > 0)
offs >>= 1;
x += offs;
}
#define BUTTW 8 #define BUTTW 8
#define BUTTH 11 #define BUTTH 11
@ -3963,12 +3951,15 @@ static void K_drawLapStartAnim(void)
} }
} }
void K_drawKartFreePlay(UINT32 flashtime) void K_drawKartFreePlay(void)
{ {
// no splitscreen support because it's not FREE PLAY if you have more than one player in-game // no splitscreen support because it's not FREE PLAY if you have more than one player in-game
// (you fool, you can take splitscreen online. :V) // (you fool, you can take splitscreen online. :V)
if ((flashtime % TICRATE) < TICRATE/2) if (lt_exitticker < TICRATE/2)
return;
if (((leveltime-lt_endtime) % TICRATE) < TICRATE/2)
return; return;
V_DrawKartString((BASEVIDWIDTH - (LAPS_X+1)) - (12*9), // mirror the laps thingy V_DrawKartString((BASEVIDWIDTH - (LAPS_X+1)) - (12*9), // mirror the laps thingy
@ -4240,25 +4231,17 @@ void K_drawKartHUD(void)
{ {
if (demo.title) // Draw title logo instead in demo.titles if (demo.title) // Draw title logo instead in demo.titles
{ {
INT32 x = BASEVIDWIDTH - 32, y = 128, offs; INT32 x = BASEVIDWIDTH - 32, y = 128, snapflags = V_SNAPTOBOTTOM|V_SNAPTORIGHT;
if (r_splitscreen == 3) if (r_splitscreen == 3)
{ {
x = BASEVIDWIDTH/2 + 10; x = BASEVIDWIDTH/2 + 10;
y = BASEVIDHEIGHT/2 - 30; y = BASEVIDHEIGHT/2 - 30;
snapflags = 0;
} }
if (timeinmap < 113) V_DrawTinyScaledPatch(x-54, y, snapflags|V_SLIDEIN, W_CachePatchName("TTKBANNR", PU_CACHE));
{ V_DrawTinyScaledPatch(x-54, y+25, snapflags|V_SLIDEIN, W_CachePatchName("TTKART", PU_CACHE));
INT32 count = ((INT32)(timeinmap) - 104);
offs = 256;
while (count-- > 0)
offs >>= 1;
x += offs;
}
V_DrawTinyScaledPatch(x-54, y, 0, W_CachePatchName("TTKBANNR", PU_CACHE));
V_DrawTinyScaledPatch(x-54, y+25, 0, W_CachePatchName("TTKART", PU_CACHE));
} }
else if (gametype == GT_RACE) // Race-only elements else if (gametype == GT_RACE) // Race-only elements
{ {
@ -4339,10 +4322,10 @@ void K_drawKartHUD(void)
V_DrawScaledPatch(BASEVIDWIDTH/2 - (SHORT(kp_yougotem->width)/2), 32, V_HUDTRANS, kp_yougotem); V_DrawScaledPatch(BASEVIDWIDTH/2 - (SHORT(kp_yougotem->width)/2), 32, V_HUDTRANS, kp_yougotem);
// Draw FREE PLAY. // Draw FREE PLAY.
if (isfreeplay && !stplyr->spectator && timeinmap > 113) if (isfreeplay && !stplyr->spectator)
{ {
if (LUA_HudEnabled(hud_freeplay)) if (LUA_HudEnabled(hud_freeplay))
K_drawKartFreePlay(leveltime); K_drawKartFreePlay();
} }
if (r_splitscreen == 0 && stplyr->kartstuff[k_wrongway] && ((leveltime / 8) & 1)) if (r_splitscreen == 0 && stplyr->kartstuff[k_wrongway] && ((leveltime / 8) & 1))

View file

@ -33,7 +33,7 @@ void K_ObjectTracking(trackingResult_t *result, vector3_t *point, UINT8 cameraNu
const char *K_GetItemPatch(UINT8 item, boolean tiny); const char *K_GetItemPatch(UINT8 item, boolean tiny);
void K_LoadKartHUDGraphics(void); void K_LoadKartHUDGraphics(void);
void K_drawKartHUD(void); void K_drawKartHUD(void);
void K_drawKartFreePlay(UINT32 flashtime); void K_drawKartFreePlay(void);
void K_drawKartTimestamp(tic_t drawtime, INT32 TX, INT32 TY, INT16 emblemmap, UINT8 mode); void K_drawKartTimestamp(tic_t drawtime, INT32 TX, INT32 TY, INT16 emblemmap, UINT8 mode);
void K_DrawTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scorelines, INT32 whiteplayer, INT32 hilicol); void K_DrawTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scorelines, INT32 whiteplayer, INT32 hilicol);

View file

@ -705,17 +705,17 @@ static int libd_drawOnMinimap(lua_State *L)
// splitscreen flags // splitscreen flags
splitflags = (r_splitscreen == 3 ? 0 : V_SNAPTORIGHT); // flags should only be 0 when it's centered (4p split) splitflags = (r_splitscreen == 3 ? 0 : V_SNAPTORIGHT); // flags should only be 0 when it's centered (4p split)
// translucency:
if (timeinmap > 105)
{ {
const tic_t length = TICRATE/2;
if (!lt_exitticker)
return 0;
minimaptrans = cv_kartminimap.value; minimaptrans = cv_kartminimap.value;
if (timeinmap <= 113) if (lt_exitticker < length)
minimaptrans = ((((INT32)timeinmap) - 105)*minimaptrans)/(113-105); minimaptrans = (((INT32)lt_exitticker)*minimaptrans)/((INT32)length);
if (!minimaptrans) if (!minimaptrans)
return 0; return 0;
} }
else
return 0;
minimaptrans = ((10-minimaptrans)<<FF_TRANSSHIFT); minimaptrans = ((10-minimaptrans)<<FF_TRANSSHIFT);

View file

@ -211,7 +211,7 @@ void ST_Ticker(boolean run)
// 0 is default, any others are special palettes. // 0 is default, any others are special palettes.
INT32 st_palette = 0; INT32 st_palette = 0;
INT32 st_translucency = 10; UINT32 st_translucency = 10;
void ST_doPaletteStuff(void) void ST_doPaletteStuff(void)
{ {
@ -670,7 +670,6 @@ void ST_preDrawTitleCard(void)
return; return;
// Kart: nothing // Kart: nothing
st_translucency = cv_translucenthud.value;
} }
// //
@ -1050,7 +1049,18 @@ void ST_Drawer(void)
#endif #endif
if (rendermode != render_none) ST_doPaletteStuff(); if (rendermode != render_none) ST_doPaletteStuff();
st_translucency = cv_translucenthud.value; {
const tic_t length = TICRATE/2;
if (lt_exitticker)
{
st_translucency = cv_translucenthud.value;
if (lt_exitticker < length)
st_translucency = (((INT32)(lt_ticker - lt_endtime))*st_translucency)/((INT32)length);
}
else
st_translucency = 0;
}
// Check for a valid level title // Check for a valid level title
// If the HUD is enabled // If the HUD is enabled

View file

@ -78,7 +78,7 @@ boolean ST_SameTeam(player_t *a, player_t *b);
extern boolean st_overlay; // sb overlay on or off when fullscreen extern boolean st_overlay; // sb overlay on or off when fullscreen
extern INT32 st_palette; // 0 is default, any others are special palettes. extern INT32 st_palette; // 0 is default, any others are special palettes.
extern INT32 st_translucency; extern UINT32 st_translucency;
extern lumpnum_t st_borderpatchnum; extern lumpnum_t st_borderpatchnum;
// patches, also used in intermission // patches, also used in intermission

View file

@ -491,7 +491,6 @@ void VID_BlitLinearScreen(const UINT8 *srcptr, UINT8 *destptr, INT32 width, INT3
static UINT8 hudplusalpha[11] = { 10, 8, 6, 4, 2, 0, 0, 0, 0, 0, 0}; static UINT8 hudplusalpha[11] = { 10, 8, 6, 4, 2, 0, 0, 0, 0, 0, 0};
static UINT8 hudminusalpha[11] = { 10, 9, 9, 8, 8, 7, 7, 6, 6, 5, 5}; static UINT8 hudminusalpha[11] = { 10, 9, 9, 8, 8, 7, 7, 6, 6, 5, 5};
UINT8 hudtrans = 0;
static const UINT8 *v_colormap = NULL; static const UINT8 *v_colormap = NULL;
static const UINT8 *v_translevel = NULL; static const UINT8 *v_translevel = NULL;
@ -544,15 +543,18 @@ void V_DrawStretchyFixedPatch(fixed_t x, fixed_t y, fixed_t pscale, fixed_t vsca
v_translevel = NULL; v_translevel = NULL;
if ((alphalevel = ((scrn & V_ALPHAMASK) >> V_ALPHASHIFT))) if ((alphalevel = ((scrn & V_ALPHAMASK) >> V_ALPHASHIFT)))
{ {
if (alphalevel == 13) if (alphalevel > 11) // not standard, V_ADDTRANS or V_SUBTRANS
alphalevel = hudminusalpha[st_translucency]; {
else if (alphalevel == 14) if (alphalevel == 13) // V_HUDTRANSHALF
alphalevel = 10 - st_translucency; alphalevel = hudminusalpha[st_translucency];
else if (alphalevel == 15) else if (alphalevel == 14) // V_HUDTRANS
alphalevel = hudplusalpha[st_translucency]; alphalevel = 10 - st_translucency;
else if (alphalevel == 15) // V_HUDTRANSDOUBLE
alphalevel = hudplusalpha[st_translucency];
if (alphalevel >= 12) if (alphalevel >= 10) // Still inelegible to render?
return; // invis return;
}
if (alphalevel) if (alphalevel)
{ {
@ -737,15 +739,18 @@ void V_DrawCroppedPatch(fixed_t x, fixed_t y, fixed_t pscale, INT32 scrn, patch_
v_translevel = NULL; v_translevel = NULL;
if ((alphalevel = ((scrn & V_ALPHAMASK) >> V_ALPHASHIFT))) if ((alphalevel = ((scrn & V_ALPHAMASK) >> V_ALPHASHIFT)))
{ {
if (alphalevel == 13) if (alphalevel > 11) // not standard, V_ADDTRANS or V_SUBTRANS
alphalevel = hudminusalpha[st_translucency]; {
else if (alphalevel == 14) if (alphalevel == 13) // V_HUDTRANSHALF
alphalevel = 10 - st_translucency; alphalevel = hudminusalpha[st_translucency];
else if (alphalevel == 15) else if (alphalevel == 14) // V_HUDTRANS
alphalevel = hudplusalpha[st_translucency]; alphalevel = 10 - st_translucency;
else if (alphalevel == 15) // V_HUDTRANSDOUBLE
alphalevel = hudplusalpha[st_translucency];
if (alphalevel >= 12) if (alphalevel >= 10) // Still inelegible to render?
return; // invis return;
}
if (alphalevel) if (alphalevel)
{ {
@ -990,15 +995,18 @@ void V_DrawFillConsoleMap(INT32 x, INT32 y, INT32 w, INT32 h, INT32 c)
if ((alphalevel = ((c & V_ALPHAMASK) >> V_ALPHASHIFT))) if ((alphalevel = ((c & V_ALPHAMASK) >> V_ALPHASHIFT)))
{ {
if (alphalevel == 13) if (alphalevel > 11) // not standard, V_ADDTRANS or V_SUBTRANS
alphalevel = hudminusalpha[st_translucency]; {
else if (alphalevel == 14) if (alphalevel == 13) // V_HUDTRANSHALF
alphalevel = 10 - st_translucency; alphalevel = hudminusalpha[st_translucency];
else if (alphalevel == 15) else if (alphalevel == 14) // V_HUDTRANS
alphalevel = hudplusalpha[st_translucency]; alphalevel = 10 - st_translucency;
else if (alphalevel == 15) // V_HUDTRANSDOUBLE
alphalevel = hudplusalpha[st_translucency];
if (alphalevel >= 12) if (alphalevel >= 10) // Still inelegible to render?
return; // invis return;
}
} }
if (!(c & V_NOSCALESTART)) if (!(c & V_NOSCALESTART))