mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-05-09 02:11:49 +00:00
Flash button prompt before closing Menu Message, for improved conveyance
Needs a sound, we can do that later
This commit is contained in:
parent
d450faeaaf
commit
3391b0e9a5
3 changed files with 73 additions and 20 deletions
|
|
@ -517,10 +517,11 @@ typedef enum
|
||||||
} manswer_e;
|
} manswer_e;
|
||||||
|
|
||||||
#define MAXMENUMESSAGE 256
|
#define MAXMENUMESSAGE 256
|
||||||
|
#define MENUMESSAGECLOSE 2
|
||||||
extern struct menumessage_s
|
extern struct menumessage_s
|
||||||
{
|
{
|
||||||
boolean active;
|
boolean active;
|
||||||
boolean closing;
|
UINT8 closing;
|
||||||
|
|
||||||
INT32 flags; // MM_
|
INT32 flags; // MM_
|
||||||
const char *header;
|
const char *header;
|
||||||
|
|
|
||||||
|
|
@ -606,15 +606,15 @@ static void M_DrawMenuTyping(void)
|
||||||
// Draw the message popup submenu
|
// Draw the message popup submenu
|
||||||
void M_DrawMenuMessage(void)
|
void M_DrawMenuMessage(void)
|
||||||
{
|
{
|
||||||
|
if (!menumessage.active)
|
||||||
|
return;
|
||||||
|
|
||||||
INT32 x = (BASEVIDWIDTH - menumessage.x)/2;
|
INT32 x = (BASEVIDWIDTH - menumessage.x)/2;
|
||||||
INT32 y = (BASEVIDHEIGHT - menumessage.y)/2 + floor(pow(2, (double)(9 - menumessage.fadetimer)));
|
INT32 y = (BASEVIDHEIGHT - menumessage.y)/2 + floor(pow(2, (double)(9 - menumessage.fadetimer)));
|
||||||
size_t i, start = 0;
|
size_t i, start = 0;
|
||||||
char string[MAXMENUMESSAGE];
|
char string[MAXMENUMESSAGE];
|
||||||
const char *msg = menumessage.message;
|
const char *msg = menumessage.message;
|
||||||
|
|
||||||
if (!menumessage.active)
|
|
||||||
return;
|
|
||||||
|
|
||||||
V_DrawFadeScreen(31, menumessage.fadetimer);
|
V_DrawFadeScreen(31, menumessage.fadetimer);
|
||||||
|
|
||||||
V_DrawFill(0, y, BASEVIDWIDTH, menumessage.y, 159);
|
V_DrawFill(0, y, BASEVIDWIDTH, menumessage.y, 159);
|
||||||
|
|
@ -629,25 +629,64 @@ void M_DrawMenuMessage(void)
|
||||||
INT32 workx = x + menumessage.x;
|
INT32 workx = x + menumessage.x;
|
||||||
INT32 worky = y + menumessage.y;
|
INT32 worky = y + menumessage.y;
|
||||||
|
|
||||||
|
boolean push;
|
||||||
|
|
||||||
|
if (menumessage.closing)
|
||||||
|
push = (menumessage.answer != MA_YES);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
const UINT8 anim_duration = 16;
|
||||||
|
push = ((menumessage.timer % (anim_duration * 2)) < anim_duration);
|
||||||
|
}
|
||||||
|
|
||||||
workx -= V_ThinStringWidth(menumessage.defaultstr, V_6WIDTHSPACE|V_ALLOWLOWERCASE);
|
workx -= V_ThinStringWidth(menumessage.defaultstr, V_6WIDTHSPACE|V_ALLOWLOWERCASE);
|
||||||
V_DrawThinString(workx, worky + 1, V_6WIDTHSPACE|V_ALLOWLOWERCASE, menumessage.defaultstr);
|
V_DrawThinString(
|
||||||
|
workx, worky + 1,
|
||||||
|
V_6WIDTHSPACE|V_ALLOWLOWERCASE
|
||||||
|
| ((push && (menumessage.closing & MENUMESSAGECLOSE)) ? highlightflags : 0),
|
||||||
|
menumessage.defaultstr
|
||||||
|
);
|
||||||
|
|
||||||
|
workx -= 2;
|
||||||
|
|
||||||
workx -= SHORT(kp_button_x[1][0]->width);
|
workx -= SHORT(kp_button_x[1][0]->width);
|
||||||
K_drawButtonAnim(workx, worky, 0, kp_button_x[1], menumessage.timer);
|
K_drawButton(
|
||||||
|
workx * FRACUNIT, worky * FRACUNIT,
|
||||||
|
0, kp_button_x[1],
|
||||||
|
push
|
||||||
|
);
|
||||||
|
|
||||||
workx -= SHORT(kp_button_b[1][0]->width);
|
workx -= SHORT(kp_button_b[1][0]->width);
|
||||||
K_drawButtonAnim(workx, worky, 0, kp_button_b[1], menumessage.timer);
|
K_drawButton(
|
||||||
|
workx * FRACUNIT, worky * FRACUNIT,
|
||||||
|
0, kp_button_b[1],
|
||||||
|
push
|
||||||
|
);
|
||||||
|
|
||||||
if (menumessage.confirmstr)
|
if (menumessage.confirmstr)
|
||||||
{
|
{
|
||||||
workx -= 12;
|
workx -= 12;
|
||||||
|
|
||||||
|
if (menumessage.closing)
|
||||||
|
push = !push;
|
||||||
|
|
||||||
workx -= V_ThinStringWidth(menumessage.confirmstr, V_6WIDTHSPACE|V_ALLOWLOWERCASE);
|
workx -= V_ThinStringWidth(menumessage.confirmstr, V_6WIDTHSPACE|V_ALLOWLOWERCASE);
|
||||||
V_DrawThinString(workx, worky + 1, V_6WIDTHSPACE|V_ALLOWLOWERCASE, menumessage.confirmstr);
|
V_DrawThinString(
|
||||||
|
workx, worky + 1,
|
||||||
|
V_6WIDTHSPACE|V_ALLOWLOWERCASE
|
||||||
|
| ((push && (menumessage.closing & MENUMESSAGECLOSE)) ? highlightflags : 0),
|
||||||
|
menumessage.confirmstr
|
||||||
|
);
|
||||||
|
|
||||||
|
workx -= 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
workx -= SHORT(kp_button_a[1][0]->width);
|
workx -= SHORT(kp_button_a[1][0]->width);
|
||||||
K_drawButtonAnim(workx, worky, 0, kp_button_a[1], menumessage.timer);
|
K_drawButton(
|
||||||
|
workx * FRACUNIT, worky * FRACUNIT,
|
||||||
|
0, kp_button_a[1],
|
||||||
|
push
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
x -= 4;
|
x -= 4;
|
||||||
|
|
|
||||||
|
|
@ -74,7 +74,7 @@ void M_StartMessage(const char *header, const char *string, void (*routine)(INT3
|
||||||
menumessage.answer = MA_NONE;
|
menumessage.answer = MA_NONE;
|
||||||
menumessage.fadetimer = 1;
|
menumessage.fadetimer = 1;
|
||||||
menumessage.timer = 0;
|
menumessage.timer = 0;
|
||||||
menumessage.closing = false;
|
menumessage.closing = 0;
|
||||||
menumessage.active = true;
|
menumessage.active = true;
|
||||||
|
|
||||||
start = 0;
|
start = 0;
|
||||||
|
|
@ -141,9 +141,15 @@ void M_StopMessage(INT32 choice)
|
||||||
|
|
||||||
const char pid = 0;
|
const char pid = 0;
|
||||||
|
|
||||||
menumessage.closing = true;
|
// Set the answer.
|
||||||
menumessage.timer = 0;
|
|
||||||
menumessage.answer = choice;
|
menumessage.answer = choice;
|
||||||
|
|
||||||
|
// Intended length of time.
|
||||||
|
menumessage.closing = (TICRATE/2);
|
||||||
|
|
||||||
|
// This weird operation is necessary so the text flash is consistently timed.
|
||||||
|
menumessage.closing |= ((2*MENUMESSAGECLOSE) - 1);
|
||||||
|
|
||||||
M_SetMenuDelay(pid);
|
M_SetMenuDelay(pid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -151,18 +157,25 @@ boolean M_MenuMessageTick(void)
|
||||||
{
|
{
|
||||||
if (menumessage.closing)
|
if (menumessage.closing)
|
||||||
{
|
{
|
||||||
if (menumessage.fadetimer > 0)
|
if (menumessage.closing > MENUMESSAGECLOSE)
|
||||||
{
|
{
|
||||||
menumessage.fadetimer--;
|
menumessage.closing--;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
if (menumessage.fadetimer == 0)
|
|
||||||
{
|
{
|
||||||
menumessage.active = false;
|
if (menumessage.fadetimer > 0)
|
||||||
|
|
||||||
if (menumessage.routine)
|
|
||||||
{
|
{
|
||||||
menumessage.routine(menumessage.answer);
|
menumessage.fadetimer--;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (menumessage.fadetimer == 0)
|
||||||
|
{
|
||||||
|
menumessage.active = false;
|
||||||
|
|
||||||
|
if (menumessage.routine)
|
||||||
|
{
|
||||||
|
menumessage.routine(menumessage.answer);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue