Teach players how to interact with Goner Setup just before input is first required

- Checks for whether a Gamepad is connected
    - If yes, says you can use "your Gamepad"
    - If no, says you can use "Enter, ESC, and the Arrow Keys"
- Show ENTER and ESC on any Message prompt (instead of A/B/X) if no Gamepad is connected
    - Add M_DrawMediocreKeyboardKey, a genericisation of the previous entry in the series' Time Attack HUD
This commit is contained in:
toaster 2023-12-18 14:30:58 +00:00
parent c63ebf2129
commit 55e3abf58d
2 changed files with 91 additions and 18 deletions

View file

@ -632,6 +632,31 @@ static void M_DrawMenuTyping(void)
}
static void M_DrawMediocreKeyboardKey(const char *text, INT32 *workx, INT32 worky, boolean push, boolean rightaligned)
{
INT32 buttonwidth = V_StringWidth(text, 0) + 2;
if (rightaligned)
{
(*workx) -= buttonwidth;
}
if (push)
{
worky += 2;
}
else
{
V_DrawFill((*workx)-1, worky+10, buttonwidth, 2, 24);
}
V_DrawFill((*workx)-1, worky, buttonwidth, 10, 16);
V_DrawString(
(*workx), worky + 1,
0, text
);
}
// Draw the message popup submenu
void M_DrawMenuMessage(void)
{
@ -658,6 +683,10 @@ void M_DrawMenuMessage(void)
INT32 workx = x + menumessage.x;
INT32 worky = y + menumessage.y;
boolean standardbuttons = (
cv_currprofile.value != -1 || G_GetNumAvailableGamepads()
);
boolean push;
if (menumessage.closing)
@ -678,19 +707,26 @@ void M_DrawMenuMessage(void)
workx -= 2;
workx -= SHORT(kp_button_x[1][0]->width);
K_drawButton(
workx * FRACUNIT, worky * FRACUNIT,
0, kp_button_x[1],
push
);
if (standardbuttons)
{
workx -= SHORT(kp_button_x[1][0]->width);
K_drawButton(
workx * FRACUNIT, worky * FRACUNIT,
0, kp_button_x[1],
push
);
workx -= SHORT(kp_button_b[1][0]->width);
K_drawButton(
workx * FRACUNIT, worky * FRACUNIT,
0, kp_button_b[1],
push
);
workx -= SHORT(kp_button_b[1][0]->width);
K_drawButton(
workx * FRACUNIT, worky * FRACUNIT,
0, kp_button_b[1],
push
);
}
else
{
M_DrawMediocreKeyboardKey("ESC", &workx, worky, push, true);
}
if (menumessage.confirmstr)
{
@ -710,12 +746,19 @@ void M_DrawMenuMessage(void)
workx -= 2;
}
workx -= SHORT(kp_button_a[1][0]->width);
K_drawButton(
workx * FRACUNIT, worky * FRACUNIT,
0, kp_button_a[1],
push
);
if (standardbuttons)
{
workx -= SHORT(kp_button_a[1][0]->width);
K_drawButton(
workx * FRACUNIT, worky * FRACUNIT,
0, kp_button_a[1],
push
);
}
else
{
M_DrawMediocreKeyboardKey("ENTER", &workx, worky, push, true);
}
}
x -= 4;

View file

@ -14,6 +14,7 @@
#include "../m_random.h"
#include "../r_main.h"
#include "../m_easing.h"
#include "../g_input.h"
#include <forward_list>
@ -399,6 +400,32 @@ void M_GonerResetText(void)
goner_scrollend = -1;
}
static void Initial_Control_Info(void)
{
if (cv_currprofile.value != -1)
return;
auto line = GonerChatLine(GONERSPEAKER_TAILS, 0,
va("You should be able to use ""\x86""%s""\x80"" to operate this menu.",
(!G_GetNumAvailableGamepads()
? "Enter, ESC, and the Arrow Keys"
: "your Gamepad"
)
)
);
if (LinesToDigest.empty())
{
LinesToDigest.emplace_front(line);
return;
}
LinesToDigest.emplace_after(
LinesToDigest.begin(),
line
);
}
void M_AddGonerLines(void)
{
SRB2_ASSERT(LinesToDigest.empty());
@ -472,6 +499,9 @@ void M_AddGonerLines(void)
"Alright, Metal! I don't remember your specifications offhand. "\
"First things first, go ahead and set up your "\
"\x87""Video Options""\x80"" yourself.");
LinesToDigest.emplace_front(0, Initial_Control_Info);
break;
}
case GDGONER_SOUND: