Merge branch 'tally-ff' into 'master'

Fast-forward through tally screen in GP

Closes #793

See merge request KartKrew/Kart!2094
This commit is contained in:
AJ Martinez 2024-03-13 22:21:02 +00:00
commit 3490aefa35
8 changed files with 65 additions and 11 deletions

View file

@ -3959,6 +3959,7 @@ void G_StopDemo(void)
demobuf.buffer = NULL; demobuf.buffer = NULL;
demo.playback = false; demo.playback = false;
demo.timing = false; demo.timing = false;
demo.waitingfortally = false;
g_singletics = false; g_singletics = false;
{ {
@ -3990,7 +3991,13 @@ boolean G_CheckDemoStatus(void)
if (demo.quitafterplaying) if (demo.quitafterplaying)
I_Quit(); I_Quit();
if (multiplayer && !demo.attract) // When this replay was recorded, the player skipped
// the Tally and ended the demo early.
// Keep the demo open and don't boot to intermission
// YET, pause demo playback.
if (!demo.waitingfortally && modeattacking && exitcountdown)
demo.waitingfortally = true;
else if (!demo.attract)
G_FinishExitLevel(); G_FinishExitLevel();
else else
{ {
@ -4025,6 +4032,7 @@ boolean G_CheckDemoStatus(void)
Z_Free(demobuf.buffer); Z_Free(demobuf.buffer);
demo.recording = false; demo.recording = false;
demo.waitingfortally = false;
return false; return false;
} }

View file

@ -90,6 +90,7 @@ struct demovars_s {
boolean quitafterplaying; // quit after playing a demo from cmdline boolean quitafterplaying; // quit after playing a demo from cmdline
boolean deferstart; // don't start playing demo right away boolean deferstart; // don't start playing demo right away
boolean netgame; // multiplayer netgame boolean netgame; // multiplayer netgame
boolean waitingfortally; // demo ended but we're keeping the level open for the tally to finish
tic_t savebutton; // Used to determine when the local player can choose to save the replay while the race is still going tic_t savebutton; // Used to determine when the local player can choose to save the replay while the race is still going
boolean willsave; boolean willsave;

View file

@ -2003,7 +2003,7 @@ void G_Ticker(boolean run)
memset(player_name_changes, 0, sizeof player_name_changes); memset(player_name_changes, 0, sizeof player_name_changes);
} }
if (Playing() == true) if (Playing() == true || demo.playback)
{ {
if (musiccountdown > 1) if (musiccountdown > 1)
{ {
@ -2017,7 +2017,10 @@ void G_Ticker(boolean run)
P_EndingMusic(); P_EndingMusic();
} }
} }
}
if (Playing() == true)
{
P_InvincGrowMusic(); P_InvincGrowMusic();
K_TickMidVote(); K_TickMidVote();

View file

@ -101,7 +101,7 @@ public:
bool local() const bool local() const
{ {
// consoleplayer is not valid yet. // consoleplayer is not valid yet.
if (!addedtogame) if (!addedtogame && !demo.playback)
{ {
return false; return false;
} }

View file

@ -35,6 +35,7 @@
#include "st_stuff.h" #include "st_stuff.h"
#include "r_fps.h" #include "r_fps.h"
#include "g_party.h" #include "g_party.h"
#include "g_input.h"
boolean level_tally_t::UseBonuses(void) boolean level_tally_t::UseBonuses(void)
{ {
@ -311,6 +312,7 @@ void level_tally_t::Init(player_t *player)
laps = totalLaps = 0; laps = totalLaps = 0;
points = pointLimit = 0; points = pointLimit = 0;
powerStones = 0; powerStones = 0;
releasedFastForward = false;
rank = GRADE_INVALID; rank = GRADE_INVALID;
@ -1392,7 +1394,42 @@ void K_InitPlayerTally(player_t *player)
void K_TickPlayerTally(player_t *player) void K_TickPlayerTally(player_t *player)
{ {
player->tally.Tick(); boolean fastForwardInput = !demo.playback && P_IsMachineLocalPlayer(player) &&
G_PlayerInputDown(G_LocalSplitscreenPartyPosition(player - players), gc_a, 0);
boolean allowFastForward = player->tally.state > TALLY_ST_GOTTHRU_SLIDEIN
&& player->tally.state <= TALLY_ST_DONE
&& player->tally.releasedFastForward
// - Not allowed online so we don't have to do any
// networking.
// - Not allowed in replays because splitscreen party
// doesn't exist and it's just simpler to not think
// about.
&& (!netgame && !demo.playback)
&& player->tally.state != TALLY_ST_DONE;
if (fastForwardInput && allowFastForward)
{
do
player->tally.Tick();
while (player->tally.state != TALLY_ST_DONE && player->tally.state != TALLY_ST_GAMEOVER_DONE);
player->tally.delay = std::min(player->tally.delay, TICRATE);
musiccountdown = 2; // gets decremented to 1 in G_Ticker to immediately trigger intermission music [blows raspberry]
}
else
{
player->tally.Tick();
}
if (!fastForwardInput)
{
player->tally.releasedFastForward = true;
}
else
{
player->tally.releasedFastForward = false;
}
} }
void K_DrawPlayerTally(void) void K_DrawPlayerTally(void)

View file

@ -96,6 +96,7 @@ struct level_tally_t
UINT8 xtraBlink; UINT8 xtraBlink;
boolean showGrade; boolean showGrade;
boolean done; boolean done;
boolean releasedFastForward;
#ifdef __cplusplus #ifdef __cplusplus
boolean UseBonuses(void); boolean UseBonuses(void);

View file

@ -904,7 +904,7 @@ void P_Ticker(boolean run)
if (playeringame[i]) if (playeringame[i])
G_WriteDemoTiccmd(&players[i].cmd, i); G_WriteDemoTiccmd(&players[i].cmd, i);
} }
if (demo.playback) if (demo.playback && !demo.waitingfortally)
{ {
G_ReadDemoExtraData(); G_ReadDemoExtraData();
for (i = 0; i < MAXPLAYERS; i++) for (i = 0; i < MAXPLAYERS; i++)
@ -1150,9 +1150,12 @@ void P_Ticker(boolean run)
exitcountdown--; exitcountdown--;
} }
if (server && exitcountdown == 1) if (exitcountdown == 1)
{ {
SendNetXCmd(XD_EXITLEVEL, NULL, 0); if (demo.playback)
G_FinishExitLevel();
else if (server)
SendNetXCmd(XD_EXITLEVEL, NULL, 0);
} }
} }
} }
@ -1204,14 +1207,15 @@ void P_Ticker(boolean run)
if (cv_recordmultiplayerdemos.value && demo.savebutton && demo.savebutton + 3*TICRATE < leveltime) if (cv_recordmultiplayerdemos.value && demo.savebutton && demo.savebutton + 3*TICRATE < leveltime)
G_CheckDemoTitleEntry(); G_CheckDemoTitleEntry();
} }
else if (demo.playback) // Use Ghost data for consistency checks. else if (demo.playback && !demo.waitingfortally) // Use Ghost data for consistency checks.
{ {
G_ConsAllGhostTics(); G_ConsAllGhostTics();
} }
if (modeattacking) if (modeattacking)
{ {
G_GhostTicker(); if (!demo.waitingfortally)
G_GhostTicker();
if (!demo.playback) if (!demo.playback)
G_TickTimeStickerMedals(); G_TickTimeStickerMedals();
} }

View file

@ -1273,7 +1273,7 @@ void P_DoPlayerExit(player_t *player, pflags_t flags)
K_UpdatePowerLevelsFinalize(player, false); K_UpdatePowerLevelsFinalize(player, false);
if (P_IsPartyPlayer(player) && !specialout && musiccountdown == 0) if (G_IsPartyLocal(player - players) && !specialout && musiccountdown == 0)
{ {
Music_Play("finish_silence"); Music_Play("finish_silence");
musiccountdown = MUSIC_COUNTDOWN_MAX; musiccountdown = MUSIC_COUNTDOWN_MAX;
@ -3844,7 +3844,7 @@ void P_DoTimeOver(player_t *player)
P_DamageMobj(player->mo, NULL, NULL, 1, DMG_TIMEOVER); P_DamageMobj(player->mo, NULL, NULL, 1, DMG_TIMEOVER);
} }
if (P_IsPartyPlayer(player) && musiccountdown == 0) if (G_IsPartyLocal(player - players) && musiccountdown == 0)
{ {
Music_Play("finish_silence"); Music_Play("finish_silence");
musiccountdown = MUSIC_COUNTDOWN_MAX; musiccountdown = MUSIC_COUNTDOWN_MAX;