Merge branch 'gp_buttone' into 'master'

Intermission Button Slide-in

See merge request KartKrew/Kart!1450
This commit is contained in:
Oni 2023-09-03 23:35:24 +00:00
commit 1c0a6c719c
8 changed files with 198 additions and 267 deletions

View file

@ -440,38 +440,18 @@ static void D_Display(void)
switch (gamestate)
{
case GS_TITLESCREEN:
if (!titlemapinaction || !curbghide) {
if (!titlemapinaction || !curbghide)
{
F_TitleScreenDrawer();
break;
}
/* FALLTHRU */
case GS_LEVEL:
if (!gametic)
break;
HU_Erase();
AM_Drawer();
break;
case GS_INTERMISSION:
Y_IntermissionDrawer();
HU_Erase();
HU_Drawer();
break;
case GS_VOTING:
Y_VoteDrawer();
HU_Erase();
HU_Drawer();
break;
case GS_CEREMONY:
if (!gametic)
break;
HU_Erase();
HU_Drawer();
break;
case GS_MENU:
break;
case GS_INTRO:
@ -485,24 +465,14 @@ static void D_Display(void)
case GS_CUTSCENE:
F_CutsceneDrawer();
HU_Erase();
HU_Drawer();
break;
case GS_EVALUATION:
F_GameEvaluationDrawer();
HU_Erase();
HU_Drawer();
break;
case GS_CONTINUING:
//F_ContinueDrawer();
break;
case GS_CREDITS:
F_CreditDrawer();
HU_Erase();
HU_Drawer();
break;
case GS_WAITINGPLAYERS:
@ -511,14 +481,15 @@ static void D_Display(void)
{
// I don't think HOM from nothing drawing is independent...
F_WaitingPlayersDrawer();
HU_Erase();
HU_Drawer();
}
case GS_DEDICATEDSERVER:
case GS_NULL:
default:
break;
}
HU_Erase();
// STUPID race condition...
{
wipegamestate = gamestate;
@ -628,9 +599,9 @@ static void D_Display(void)
{
case GS_LEVEL:
{
AM_Drawer();
ST_Drawer();
F_TextPromptDrawer();
HU_Drawer();
break;
}
case GS_TITLESCREEN:
@ -655,6 +626,11 @@ static void D_Display(void)
}
}
if (Playing())
{
HU_Drawer();
}
// change gamma if needed
// (GS_LEVEL handles this already due to level-specific palettes)
if (forcerefresh && G_GamestateUsesLevel() == false)

View file

@ -712,6 +712,7 @@ void F_StartCredits(void)
finalecount = 0;
animtimer = 0;
timetonext = 2*TICRATE;
keypressed = false;
}
void F_CreditDrawer(void)
@ -769,6 +770,15 @@ void F_CreditDrawer(void)
if (((y>>FRACBITS) * vid.dupy) > vid.height)
break;
}
if (finalecount)
{
Y_DrawIntermissionButton(-1, (timetonext ? 5*TICRATE : TICRATE) - finalecount);
}
else
{
Y_DrawIntermissionButton(timetonext, 0);
}
}
void F_CreditTicker(void)
@ -805,18 +815,6 @@ void F_CreditTicker(void)
break;
}
// Do this here rather than in the drawer you doofus! (this is why dedicated mode broke at credits)
if (!credits[i] && y <= 120<<FRACBITS && !finalecount)
{
timetonext = 5*TICRATE+1;
finalecount = 5*TICRATE;
// You watched all the credits? What a trooper!
gamedata->everfinishedcredits = true;
if (M_UpdateUnlockablesAndExtraEmblems(true, true))
G_SaveGameData();
}
if (timetonext)
timetonext--;
else
@ -824,68 +822,49 @@ void F_CreditTicker(void)
credbgtimer++;
if (finalecount && --finalecount == 0)
F_StartGameEvaluation();
}
// Do this here rather than in the drawer you doofus! (this is why dedicated mode broke at credits)
boolean F_CreditResponder(event_t *event)
{
INT32 key = event->data1;
const boolean reachedbottom = (!credits[i] && y <= 120<<FRACBITS);
// remap virtual keys (mouse & joystick buttons)
switch (key)
if (reachedbottom && !timetonext)
{
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;
timetonext = 5*TICRATE;
}
if (event->type != ev_keydown)
return false;
if (key == KEY_DOWNARROW || key == KEY_SPACE)
if (finalecount)
{
if (!timetonext && !finalecount)
animtimer += 7;
return false;
if (--finalecount == 0)
{
F_StartGameEvaluation();
}
return;
}
/*if (!(gamedata->timesBeaten) && !(netgame || multiplayer) && !cht_debug)
return false;*/
if (reachedbottom)
{
finalecount = 5*TICRATE;
if (key != KEY_ESCAPE && key != KEY_ENTER && key != KEY_BACKSPACE)
return false;
// 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;
if (keypressed)
return true;
keypressed = true;
return true;
if (netgame
&& (server || IsPlayerAdmin(consoleplayer))
)
{
SendNetXCmd(XD_EXITLEVEL, NULL, 0);
return;
}
}
}
// ============
@ -901,8 +880,13 @@ typedef enum
EVAL_MAX
} evaluationtype_t;
#define EVALLEN_PERFECT (18*TICRATE)
#define EVALLEN_NORMAL (14*TICRATE)
#define EVALLEN_HALFWAY (EVALLEN_NORMAL/2)
// tyron made something perfect and i would sooner
// smite everyone in this room starting with myself
// over the idea of cutting it ~toast 250623
#define EVALLEN_PERFECT (18*TICRATE)
static evaluationtype_t evaluationtype;
UINT16 finaleemeralds = 0;
@ -956,10 +940,13 @@ void F_StartGameEvaluation(void)
else
evaluationtype = EVAL_PERFECT;
timetonext = (evaluationtype == EVAL_PERFECT) ? EVALLEN_PERFECT : EVALLEN_NORMAL;
gameaction = ga_nothing;
paused = false;
CON_ToggleOff();
keypressed = false;
finalecount = -1;
}
@ -1241,19 +1228,14 @@ void F_GameEvaluationDrawer(void)
endingtext = va("%s, %s%s", skins[players[consoleplayer].skin].realname, rtatext, cuttext);
V_DrawCenteredString(BASEVIDWIDTH/2, 182, V_SNAPTOBOTTOM|(ultimatemode ? V_REDMAP : V_YELLOWMAP), endingtext);
}
Y_DrawIntermissionButton(EVALLEN_HALFWAY + TICRATE - finalecount, (finalecount + TICRATE) - timetonext);
}
void F_GameEvaluationTicker(void)
{
INT32 evallen = EVALLEN_NORMAL;
if (evaluationtype == EVAL_PERFECT)
{
// tyron made something perfect and i would sooner
// smite everyone in this room starting with myself
// over the idea of cutting it ~toast 250623
evallen = EVALLEN_PERFECT;
if (finalecount == 1)
{
// sitting on that distant _shore
@ -1263,7 +1245,7 @@ void F_GameEvaluationTicker(void)
}
else
{
if (finalecount == 1)
if (finalecount == TICRATE/2)
{
// _drift across open waters
Music_Remap("shore", "_DRIFT");
@ -1271,13 +1253,25 @@ void F_GameEvaluationTicker(void)
}
}
if (++finalecount > evallen)
if (++finalecount == timetonext)
{
F_StartGameEnd();
return;
}
if (finalecount == evallen/2)
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)
{
@ -1289,8 +1283,9 @@ void F_GameEvaluationTicker(void)
}
}
#undef EVALLEN_PERFECT
#undef EVALLEN_NORMAL
#undef EVALLEN_HALFWAY
#undef EVALLEN_PERFECT
// ==========
// GAME END

View file

@ -30,7 +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);
// Called by main loop.
void F_IntroTicker(void);

View file

@ -1329,13 +1329,20 @@ boolean G_Responder(event_t *ev)
return false;
}
if (gamestate == GS_LEVEL)
if (Playing())
{
// If you're playing, chat is real.
// Neatly sidesteps a class of bugs where whenever we add a
// new gamestate accessible in netplay, chat was console-only.
if (HU_Responder(ev))
{
hu_keystrokes = true;
return true; // chat ate the event
}
}
if (gamestate == GS_LEVEL)
{
if (AM_Responder(ev))
return true; // automap ate it
// map the event (key/mouse/joy) to a gamecontrol
@ -1351,73 +1358,12 @@ boolean G_Responder(event_t *ev)
}
else if (gamestate == GS_CUTSCENE)
{
if (HU_Responder(ev))
{
hu_keystrokes = true;
return true; // chat ate the event
}
if (F_CutsceneResponder(ev))
{
D_StartTitle();
return true;
}
}
else if (gamestate == GS_CREDITS)
{
if (HU_Responder(ev))
{
hu_keystrokes = true;
return true; // chat ate the event
}
if (F_CreditResponder(ev))
{
// Skip credits for everyone
if (! netgame)
F_StartGameEvaluation();
else if (server || IsPlayerAdmin(consoleplayer))
SendNetXCmd(XD_EXITLEVEL, NULL, 0);
return true;
}
}
else if (gamestate == GS_CEREMONY)
{
if (HU_Responder(ev))
{
hu_keystrokes = true;
return true; // chat ate the event
}
if (K_CeremonyResponder(ev))
{
if (grandprixinfo.gp == true
&& grandprixinfo.cup != NULL
&& grandprixinfo.cup->playcredits == true)
{
nextmap = NEXTMAP_CREDITS;
}
else
{
nextmap = NEXTMAP_TITLE;
}
G_EndGame();
return true;
}
}
else if (gamestate == GS_CONTINUING)
{
return true;
}
else if (gamestate == GS_INTERMISSION || gamestate == GS_VOTING || gamestate == GS_EVALUATION)
{
if (HU_Responder(ev))
{
hu_keystrokes = true;
return true; // chat ate the event
}
}
if (gamestate == GS_LEVEL && ev->type == ev_keydown && multiplayer && demo.playback && !demo.freecam)
{

View file

@ -461,70 +461,36 @@ void K_CeremonyTicker(boolean run)
podiumData.delay = 0;
}
}
else if (podiumData.delay == TICRATE)
{
if (!menuactive && M_MenuConfirmPressed(0))
{
podiumData.delay++;
}
}
else
{
if (++podiumData.delay == 2*TICRATE)
{
if (grandprixinfo.gp == true
&& grandprixinfo.cup != NULL
&& grandprixinfo.cup->playcredits == true)
{
nextmap = NEXTMAP_CREDITS;
}
else
{
nextmap = NEXTMAP_TITLE;
}
G_EndGame();
return;
}
}
}
}
}
/*--------------------------------------------------
boolean K_CeremonyResponder(event_t *event)
See header file for description.
--------------------------------------------------*/
boolean K_CeremonyResponder(event_t *event)
{
INT32 key = event->data1;
if (podiumData.ranking == false || podiumData.state < PODIUM_STATES)
{
return false;
}
// 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;
}
return true;
}
/*--------------------------------------------------
void K_CeremonyDrawer(void)
@ -625,11 +591,8 @@ void K_CeremonyDrawer(void)
);
break;
}
case 9:
default:
{
V_DrawThinString(2, BASEVIDHEIGHT - 10, V_SNAPTOBOTTOM|V_SNAPTOLEFT|V_6WIDTHSPACE,
"Press some button type deal to continue"
);
break;
}
}
@ -643,4 +606,9 @@ void K_CeremonyDrawer(void)
// Level fade-in
V_DrawCustomFadeScreen(((levelfadecol == 0) ? "FADEMAP1" : "FADEMAP0"), 31-(timeinmap*2));
}
if (podiumData.state == PODIUM_STATES)
{
Y_DrawIntermissionButton(TICRATE - podiumData.delay, podiumData.delay - TICRATE);
}
}

View file

@ -189,24 +189,6 @@ void K_ResetCeremony(void);
void K_CeremonyTicker(boolean run);
/*--------------------------------------------------
void K_CeremonyResponder(event_t *ev);
Responder function to be ran during the podium
cutscene mode gamestate. Handles key presses
ending the podium scene.
Input Arguments:-
ev - The player input event.
Return:-
true to end the podium cutscene and return
to the title screen, otherwise false.
--------------------------------------------------*/
boolean K_CeremonyResponder(event_t *ev);
/*--------------------------------------------------
void K_CeremonyDrawer(void);

View file

@ -1349,6 +1349,67 @@ void Y_RoundQueueDrawer(y_data_t *standings, INT32 offset, boolean doanimations,
}
}
#define INTERBUTTONSLIDEIN (TICRATE/2)
//
// Y_DrawIntermissionButton
//
// It's a button that slides at the given time
//
void Y_DrawIntermissionButton(INT32 startslide, INT32 through)
{
INT32 percentslide = 0;
const INT32 slidetime = (TICRATE/4);
boolean pressed = false;
if (startslide >= 0)
{
through = startslide;
}
else
{
through -= ((TICRATE/2) + 1);
pressed = (!menuactive && M_MenuConfirmHeld(0));
}
if (through >= 0)
{
if (through >= slidetime)
{
percentslide = FRACUNIT;
}
else
{
percentslide = R_InterpolateFixed(
(through - 1) * FRACUNIT,
(through * FRACUNIT)
) / slidetime;
}
}
if (percentslide < FRACUNIT)
{
INT32 offset = 0;
if (percentslide)
{
offset = Easing_InCubic(
percentslide,
0,
16 * FRACUNIT
);
}
K_drawButton(
2*FRACUNIT - offset,
(BASEVIDHEIGHT - 16)*FRACUNIT,
0,
kp_button_a[1],
pressed
);
}
}
//
// Y_IntermissionDrawer
//
@ -1541,13 +1602,7 @@ finalcounter:
if (Y_CanSkipIntermission())
{
K_drawButton(
2*FRACUNIT,
(BASEVIDHEIGHT - 16)*FRACUNIT,
0,
kp_button_a[1],
M_MenuConfirmHeld(0)
);
Y_DrawIntermissionButton(INTERBUTTONSLIDEIN - intertic, 3*TICRATE - timer);
}
else
{
@ -1597,14 +1652,22 @@ void Y_Ticker(void)
if (Y_CanSkipIntermission())
{
if (M_MenuConfirmPressed(0))
if (intertic < INTERBUTTONSLIDEIN)
{
intertic++;
return;
}
boolean preventintertic = (intertic == INTERBUTTONSLIDEIN);
if (!menuactive && M_MenuConfirmPressed(0))
{
// If there is a roundqueue, make time for it.
// Else, end instantly on button press.
// Actually, give it a slight delay, so the "kaching" sound isn't cut off.
const tic_t end = roundqueue.size != 0 ? 3*TICRATE : TICRATE;
if (intertic == -1) // card flip hasn't started
if (intertic == INTERBUTTONSLIDEIN) // card flip hasn't started
{
if (sorttic != -1)
{
@ -1612,9 +1675,10 @@ void Y_Ticker(void)
}
else
{
intertic = 0;
timer = end;
}
preventintertic = false;
}
else if (timer >= INFINITE_TIMER && intertic >= sorttic + 16) // card done flipping
{
@ -1629,7 +1693,7 @@ void Y_Ticker(void)
}
}
if (intertic == -1)
if (preventintertic)
{
return;
}

View file

@ -51,6 +51,7 @@ void Y_Ticker(void);
// Specific sub-drawers
void Y_PlayerStandingsDrawer(y_data_t *standings, INT32 xoffset);
void Y_RoundQueueDrawer(y_data_t *standings, INT32 offset, boolean doanimations, boolean widescreen);
void Y_DrawIntermissionButton(INT32 startslide, INT32 through);
void Y_StartIntermission(void);
void Y_EndIntermission(void);