Credits and Evaluation: Replace dedicated Responder functions with Menu-style input processing

The former method responded with an arbitrary approximation of standard inputs.
This method benefits from the general-case stability of the Menu system to correctly parse triggers and other unique inputs.
The only major consequence of this change is that ESC is no longer hardcoded to activate these.
Otherwise, the game is cleaner for pure benefit.
This commit is contained in:
toaster 2023-09-01 19:49:35 +01:00
parent c46889c924
commit 4ad0beebb4
3 changed files with 33 additions and 147 deletions

View file

@ -824,6 +824,13 @@ void F_CreditTicker(void)
// Do this here rather than in the drawer you doofus! (this is why dedicated mode broke at credits)
const boolean reachedbottom = (!credits[i] && y <= 120<<FRACBITS);
if (reachedbottom && !timetonext)
{
timetonext = 5*TICRATE;
}
if (finalecount)
{
if (--finalecount == 0)
@ -833,7 +840,20 @@ void F_CreditTicker(void)
return;
}
if (keypressed)
if (reachedbottom)
{
finalecount = 5*TICRATE;
// You watched all the credits? What a trooper!
gamedata->everfinishedcredits = true;
if (M_UpdateUnlockablesAndExtraEmblems(true, true))
G_SaveGameData();
}
else if (timetonext)
;
/*else if (!(gamedata->timesBeaten) && !(netgame || multiplayer) && !cht_debug)
;*/
else if (!menuactive && M_MenuConfirmPressed(0))
{
finalecount = TICRATE;
@ -845,79 +865,6 @@ void F_CreditTicker(void)
return;
}
}
else if (!credits[i] && y <= 120<<FRACBITS)
{
timetonext = 5*TICRATE;
finalecount = 5*TICRATE;
// You watched all the credits? What a trooper!
gamedata->everfinishedcredits = true;
if (M_UpdateUnlockablesAndExtraEmblems(true, true))
G_SaveGameData();
}
}
boolean F_CreditResponder(event_t *event)
{
INT32 key = event->data1;
// remap virtual keys (mouse & joystick buttons)
switch (key)
{
case KEY_MOUSE1:
key = KEY_ENTER;
break;
case KEY_MOUSE1 + 1:
key = KEY_BACKSPACE;
break;
case KEY_JOY1:
case KEY_JOY1 + 2:
key = KEY_ENTER;
break;
case KEY_JOY1 + 3:
key = 'n';
break;
case KEY_JOY1 + 1:
key = KEY_BACKSPACE;
break;
case KEY_HAT1:
key = KEY_UPARROW;
break;
case KEY_HAT1 + 1:
key = KEY_DOWNARROW;
break;
case KEY_HAT1 + 2:
key = KEY_LEFTARROW;
break;
case KEY_HAT1 + 3:
key = KEY_RIGHTARROW;
break;
}
if (event->type != ev_keydown)
return false;
if (key == KEY_DOWNARROW || key == KEY_SPACE)
{
if (!timetonext && !finalecount)
animtimer += 7;
return false;
}
/*if (!(gamedata->timesBeaten) && !(netgame || multiplayer) && !cht_debug)
return false;*/
if (key != KEY_ESCAPE && key != KEY_ENTER && key != KEY_BACKSPACE)
return false;
if (timetonext)
return false;
if (keypressed)
return true;
keypressed = true;
return true;
}
// ============
@ -1312,6 +1259,18 @@ void F_GameEvaluationTicker(void)
return;
}
if (keypressed)
;
else if (finalecount <= EVALLEN_HALFWAY + TICRATE)
;
else if (finalecount >= (timetonext - TICRATE))
;
else if (!menuactive && M_MenuConfirmPressed(0))
{
keypressed = true;
timetonext = finalecount + TICRATE;
}
if (finalecount == EVALLEN_HALFWAY)
{
if (!usedCheats)
@ -1324,63 +1283,6 @@ void F_GameEvaluationTicker(void)
}
}
boolean F_EvaluationResponder(event_t *event)
{
INT32 key = event->data1;
// remap virtual keys (mouse & joystick buttons)
switch (key)
{
case KEY_MOUSE1:
key = KEY_ENTER;
break;
case KEY_MOUSE1 + 1:
key = KEY_BACKSPACE;
break;
case KEY_JOY1:
case KEY_JOY1 + 2:
key = KEY_ENTER;
break;
case KEY_JOY1 + 3:
key = 'n';
break;
case KEY_JOY1 + 1:
key = KEY_BACKSPACE;
break;
case KEY_HAT1:
key = KEY_UPARROW;
break;
case KEY_HAT1 + 1:
key = KEY_DOWNARROW;
break;
case KEY_HAT1 + 2:
key = KEY_LEFTARROW;
break;
case KEY_HAT1 + 3:
key = KEY_RIGHTARROW;
break;
}
if (event->type != ev_keydown)
return false;
if (key != KEY_ESCAPE && key != KEY_ENTER && key != KEY_BACKSPACE)
return false;
if (finalecount <= EVALLEN_HALFWAY + TICRATE)
return false;
if (finalecount > (timetonext - TICRATE))
return true;
if (keypressed)
return true;
keypressed = true;
timetonext = finalecount + TICRATE;
return true;
}
#undef EVALLEN_NORMAL
#undef EVALLEN_HALFWAY
#undef EVALLEN_PERFECT

View file

@ -30,8 +30,6 @@ extern "C" {
// Called by main loop.
boolean F_IntroResponder(event_t *ev);
boolean F_CutsceneResponder(event_t *ev);
boolean F_CreditResponder(event_t *ev);
boolean F_EvaluationResponder(event_t *ev);
// Called by main loop.
void F_IntroTicker(void);

View file

@ -1361,20 +1361,6 @@ boolean G_Responder(event_t *ev)
return true;
}
}
else if (gamestate == GS_CREDITS)
{
if (F_CreditResponder(ev))
{
return true;
}
}
else if (gamestate == GS_EVALUATION)
{
if (F_EvaluationResponder(ev))
{
return true;
}
}
else if (gamestate == GS_CEREMONY)
{
if (K_CeremonyResponder(ev))