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
This commit is contained in:
SteelT 2023-03-03 23:19:46 -05:00
parent 0fa1e99a82
commit 31e2c1567e
4 changed files with 65 additions and 27 deletions

View file

@ -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);
}

View file

@ -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

View file

@ -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;

View file

@ -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();
}