Merge branch 'postrace-director' into 'master'

Postrace director cam

Closes #1475

See merge request kart-krew-dev/ring-racers-internal!2565
This commit is contained in:
Oni VelocitOni 2025-06-04 00:37:43 +00:00
commit a7b4c6dcdc
5 changed files with 52 additions and 12 deletions

View file

@ -73,6 +73,7 @@
#include "k_bans.h"
#include "k_director.h"
#include "k_credits.h"
#include "k_hud.h" // K_AddMessage
#ifdef SRB2_CONFIG_ENABLE_WEBM_MOVIES
#include "m_avrecorder.h"
@ -180,6 +181,8 @@ static void Command_Archivetest_f(void);
static void Command_KartGiveItem_f(void);
static void Command_DebugMessageFeed(void);
static void Command_Schedule_Add(void);
static void Command_Schedule_Clear(void);
static void Command_Schedule_List(void);
@ -434,6 +437,8 @@ void D_RegisterServerCommands(void)
COM_AddDebugCommand("give3", Command_KartGiveItem_f);
COM_AddDebugCommand("give4", Command_KartGiveItem_f);
COM_AddDebugCommand("debugmessagefeed", Command_DebugMessageFeed);
COM_AddCommand("schedule_add", Command_Schedule_Add);
COM_AddCommand("schedule_clear", Command_Schedule_Clear);
COM_AddCommand("schedule_list", Command_Schedule_List);
@ -6369,6 +6374,11 @@ static void Command_Archivetest_f(void)
}
#endif
static void Command_DebugMessageFeed(void)
{
K_AddMessage("Hello world! A = <a>, Right = <right>", true, false);
}
/** Give yourself an, optional quantity or one of, an item.
*/
static void Command_KartGiveItem_f(void)

View file

@ -7204,17 +7204,19 @@ static std::vector<messagestate_t> messagestates{MAXSPLITSCREENPLAYERS};
void K_AddMessage(const char *msg, boolean interrupt, boolean persist)
{
for (auto &state : messagestates)
for (UINT8 i = 0; i <= r_splitscreen; i++)
{
if (interrupt)
state.clear();
messagestate_t *state = &messagestates[i];
std::string parsedmsg = srb2::Draw::TextElement().parse(msg).string();
if (interrupt)
state->clear();
std::string parsedmsg = srb2::Draw::TextElement().as(g_localplayers[i]).parse(msg).string();
if (persist)
state.objective = parsedmsg;
state->objective = parsedmsg;
else
state.add(parsedmsg);
state->add(parsedmsg);
}
}

View file

@ -37,6 +37,7 @@
#include "g_party.h"
#include "g_input.h"
#include "k_objects.h"
#include "k_director.h"
boolean level_tally_t::UseBonuses(void)
{
@ -781,6 +782,24 @@ void level_tally_t::Tick(void)
return;
}
if (done == true)
{
if (directorWait < TALLY_DIRECTOR_TIME)
{
directorWait++;
if (directorWait == TALLY_DIRECTOR_TIME && G_IsPartyLocal(owner - players) == true)
{
// Finished tally, go to director while we wait for others to finish.
K_ToggleDirector(G_PartyPosition(owner - players), true);
}
}
}
else
{
directorWait = 0;
}
if (transition < FRACUNIT)
{
if (transitionTime <= 0)

View file

@ -57,6 +57,8 @@ typedef enum
TALLY_ST_GAMEOVER_DONE,
} tally_state_e;
#define TALLY_DIRECTOR_TIME (4 * TICRATE)
struct level_tally_t
{
boolean active;
@ -97,6 +99,7 @@ struct level_tally_t
boolean showGrade;
boolean done;
boolean releasedFastForward;
INT32 directorWait;
#ifdef __cplusplus
boolean UseBonuses(void);

View file

@ -22,6 +22,7 @@
#include "z_zone.h"
#include "k_profiles.h" // controls
#include "p_local.h" // stplyr
#include "r_fps.h" // R_GetViewNumber()
using srb2::Draw;
using Chain = Draw::Chain;
@ -176,17 +177,22 @@ Draw::TextElement& Draw::TextElement::parse(std::string_view raw)
else if (auto it = translation.find(code); it != translation.end()) // This represents a gamecontrol, turn into Saturn button or generic button.
{
UINT8 localplayer = 0;
UINT8 indexedplayer = as_.value_or(stplyr - players);
for (UINT8 i = 0; i < MAXSPLITSCREENPLAYERS; i++)
UINT8 localplayer = R_GetViewNumber();
if (as_.has_value())
{
if (g_localplayers[i] == indexedplayer)
UINT8 indexedplayer = as_.value();
for (UINT8 i = 0; i < MAXSPLITSCREENPLAYERS; i++)
{
localplayer = i;
break;
if (g_localplayers[i] == indexedplayer)
{
localplayer = i;
break;
}
}
}
// This isn't how v_video.cpp checks for buttons and I don't know why.
if (cv_descriptiveinput[localplayer].value && ((it->second & 0xF0) != 0x80)) // Should we do game control translation?
{