From 31e2c1567eb821755ce50dcaa877d22cc4cf4270 Mon Sep 17 00:00:00 2001 From: SteelT Date: Fri, 3 Mar 2023 23:19:46 -0500 Subject: [PATCH] Update replay save prompts to use the new button graphics - A K_drawButtonAnim function is also provided for convince, since I figured it would have more future uses - This also makes all of the button patches global, in addition --- src/k_hud.c | 39 +++++++++++++++++++++------------------ src/k_hud.h | 15 +++++++++++++++ src/st_stuff.c | 17 +++++++++++++---- src/y_inter.c | 21 ++++++++++++++++----- 4 files changed, 65 insertions(+), 27 deletions(-) diff --git a/src/k_hud.c b/src/k_hud.c index 8fd7607ec..883534094 100644 --- a/src/k_hud.c +++ b/src/k_hud.c @@ -180,19 +180,19 @@ patch_t *kp_capsuletarget_far[2]; patch_t *kp_capsuletarget_far_text[2]; patch_t *kp_capsuletarget_near[8]; -static patch_t *kp_button_a[2][2]; -static patch_t *kp_button_b[2][2]; -static patch_t *kp_button_c[2][2]; -static patch_t *kp_button_x[2][2]; -static patch_t *kp_button_y[2][2]; -static patch_t *kp_button_z[2][2]; -static patch_t *kp_button_start[2]; -static patch_t *kp_button_l[2]; -static patch_t *kp_button_r[2]; -static patch_t *kp_button_up[2]; -static patch_t *kp_button_down[2]; -static patch_t *kp_button_right[2]; -static patch_t *kp_button_left[2]; +patch_t *kp_button_a[2][2]; +patch_t *kp_button_b[2][2]; +patch_t *kp_button_c[2][2]; +patch_t *kp_button_x[2][2]; +patch_t *kp_button_y[2][2]; +patch_t *kp_button_z[2][2]; +patch_t *kp_button_start[2]; +patch_t *kp_button_l[2]; +patch_t *kp_button_r[2]; +patch_t *kp_button_up[2]; +patch_t *kp_button_down[2]; +patch_t *kp_button_right[2]; +patch_t *kp_button_left[2]; static void K_LoadButtonGraphics(patch_t *kp[2], int letter) { @@ -4639,13 +4639,16 @@ K_drawMiniPing (void) } } +void K_drawButtonAnim(INT32 x, INT32 y, INT32 flags, patch_t *button[2], tic_t animtic) +{ + const UINT8 anim_duration = 16; + const UINT8 anim = (animtic % (anim_duration * 2)) < anim_duration; + V_DrawScaledPatch(x, y, flags, button[anim]); +} + static void K_DrawDirectorButton(INT32 idx, const char *label, patch_t *kp[2], INT32 textflags) { INT32 flags = V_SNAPTORIGHT | V_SLIDEIN | V_SPLITSCREEN; - - const UINT8 anim_duration = 16; - const UINT8 anim = (leveltime % (anim_duration * 2)) < anim_duration; - INT32 x = (BASEVIDWIDTH/2) - 10; INT32 y = (idx * 16); @@ -4660,7 +4663,7 @@ static void K_DrawDirectorButton(INT32 idx, const char *label, patch_t *kp[2], I textflags |= (flags | V_6WIDTHSPACE | V_ALLOWLOWERCASE); - V_DrawScaledPatch(x, y - 4, flags, kp[anim]); + K_drawButtonAnim(x, y - 4, flags, kp, leveltime); V_DrawRightAlignedThinString(x - 2, y, textflags, label); } diff --git a/src/k_hud.h b/src/k_hud.h index e9b0603f2..ba50049f5 100644 --- a/src/k_hud.h +++ b/src/k_hud.h @@ -45,6 +45,7 @@ void K_DrawTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scorelines, IN void K_DrawMapThumbnail(INT32 x, INT32 y, INT32 width, UINT32 flags, UINT16 map, UINT8 *colormap); void K_DrawLikeMapThumbnail(INT32 x, INT32 y, INT32 width, UINT32 flags, patch_t *patch, UINT8 *colormap); void K_drawTargetHUD(const vector3_t *origin, player_t *player); +void K_drawButtonAnim(INT32 x, INT32 y, INT32 flags, patch_t *button[2], tic_t animtic); extern patch_t *kp_capsuletarget_arrow[2][2]; extern patch_t *kp_capsuletarget_icon[2]; @@ -52,6 +53,20 @@ extern patch_t *kp_capsuletarget_far[2]; extern patch_t *kp_capsuletarget_far_text[2]; extern patch_t *kp_capsuletarget_near[8]; +extern patch_t *kp_button_a[2][2]; +extern patch_t *kp_button_b[2][2]; +extern patch_t *kp_button_c[2][2]; +extern patch_t *kp_button_x[2][2]; +extern patch_t *kp_button_y[2][2]; +extern patch_t *kp_button_z[2][2]; +extern patch_t *kp_button_start[2]; +extern patch_t *kp_button_l[2]; +extern patch_t *kp_button_r[2]; +extern patch_t *kp_button_up[2]; +extern patch_t *kp_button_down[2]; +extern patch_t *kp_button_right[2]; +extern patch_t *kp_button_left[2]; + #ifdef __cplusplus } // extern "C" #endif diff --git a/src/st_stuff.c b/src/st_stuff.c index 24aa174ee..bb7a6f50d 100644 --- a/src/st_stuff.c +++ b/src/st_stuff.c @@ -1324,13 +1324,22 @@ void ST_Drawer(void) switch (demo.savemode) { case DSM_NOTSAVING: - V_DrawRightAlignedThinString(BASEVIDWIDTH - 2, 2, V_HUDTRANS|V_SNAPTOTOP|V_SNAPTORIGHT|V_ALLOWLOWERCASE|V_YELLOWMAP, "(B) or (X): Save replay"); - break; + { + INT32 buttonx = BASEVIDWIDTH; + INT32 buttony = 2; + V_DrawRightAlignedThinString(buttonx - 64, buttony, V_HUDTRANS|V_SNAPTOTOP|V_SNAPTORIGHT|V_ALLOWLOWERCASE|V_YELLOWMAP, "or"); + K_drawButtonAnim(buttonx - 65, buttony, V_HUDTRANS|V_SNAPTOTOP|V_SNAPTORIGHT, kp_button_x[1], leveltime); + V_DrawRightAlignedThinString(buttonx - 2, buttony, V_HUDTRANS|V_SNAPTOTOP|V_SNAPTORIGHT|V_ALLOWLOWERCASE|V_YELLOWMAP, "Save replay"); + break; + } case DSM_WILLAUTOSAVE: - V_DrawRightAlignedThinString(BASEVIDWIDTH - 2, 2, V_HUDTRANS|V_SNAPTOTOP|V_SNAPTORIGHT|V_ALLOWLOWERCASE|V_YELLOWMAP, "Replay will be saved. (Look Backward: Change title)"); + { + V_DrawRightAlignedThinString(BASEVIDWIDTH - 66, 2, V_HUDTRANS|V_SNAPTOTOP|V_SNAPTORIGHT|V_ALLOWLOWERCASE|V_YELLOWMAP, "Replay will be saved."); + K_drawButtonAnim(BASEVIDWIDTH - 68, 2, V_HUDTRANS|V_SNAPTOTOP|V_SNAPTORIGHT, kp_button_b[1], leveltime); + V_DrawRightAlignedThinString(BASEVIDWIDTH - 2, 2, V_HUDTRANS|V_SNAPTOTOP|V_SNAPTORIGHT|V_ALLOWLOWERCASE|V_YELLOWMAP, "Change title"); break; - + } case DSM_WILLSAVE: V_DrawRightAlignedThinString(BASEVIDWIDTH - 2, 2, V_HUDTRANS|V_SNAPTOTOP|V_SNAPTORIGHT|V_ALLOWLOWERCASE|V_YELLOWMAP, "Replay will be saved."); break; diff --git a/src/y_inter.c b/src/y_inter.c index 04b251ec5..e6864e2a3 100644 --- a/src/y_inter.c +++ b/src/y_inter.c @@ -96,6 +96,7 @@ static INT32 powertype = PWRLV_DISABLED; static INT32 intertic; static INT32 endtic = -1; static INT32 sorttic = -1; +static INT32 replayprompttic; intertype_t intertype = int_none; @@ -599,10 +600,17 @@ skiptallydrawer: { switch (demo.savemode) { - case DSM_NOTSAVING: - V_DrawRightAlignedThinString(BASEVIDWIDTH - 2, 2, V_SNAPTOTOP|V_SNAPTORIGHT|V_ALLOWLOWERCASE|hilicol, "(B) or (X): Save replay"); - break; - + case DSM_NOTSAVING: + { + INT32 buttonx = BASEVIDWIDTH; + INT32 buttony = 2; + + K_drawButtonAnim(buttonx - 87, buttony, V_SNAPTOTOP|V_SNAPTORIGHT, kp_button_b[1], replayprompttic); + V_DrawRightAlignedThinString(buttonx - 64, buttony, V_SNAPTOTOP|V_SNAPTORIGHT|V_ALLOWLOWERCASE|hilicol, "or"); + K_drawButtonAnim(buttonx - 65, buttony, V_SNAPTOTOP|V_SNAPTORIGHT, kp_button_x[1], replayprompttic); + V_DrawRightAlignedThinString(buttonx - 2, buttony, V_SNAPTOTOP|V_SNAPTORIGHT|V_ALLOWLOWERCASE|hilicol, "Save replay"); + break; + } case DSM_SAVED: V_DrawRightAlignedThinString(BASEVIDWIDTH - 2, 2, V_SNAPTOTOP|V_SNAPTORIGHT|V_ALLOWLOWERCASE|hilicol, "Replay saved!"); break; @@ -633,8 +641,11 @@ void Y_Ticker(void) if (demo.recording) { if (demo.savemode == DSM_NOTSAVING) + { + replayprompttic++; G_CheckDemoTitleEntry(); - + } + if (demo.savemode == DSM_WILLSAVE || demo.savemode == DSM_WILLAUTOSAVE) G_SaveDemo(); }