Merge branch 'battle-director' into 'master'

Director in Battle; Director toggle in replays

Closes #975

See merge request KartKrew/Kart!2091
This commit is contained in:
AJ Martinez 2024-03-13 12:43:40 +00:00
commit 65cee65b47
3 changed files with 31 additions and 8 deletions

View file

@ -22,6 +22,11 @@
extern "C" consvar_t cv_devmode_screen; extern "C" consvar_t cv_devmode_screen;
static bool race_rules()
{
return gametyperules & GTR_CIRCUIT;
}
#define SWITCHTIME TICRATE * 5 // cooldown between unforced switches #define SWITCHTIME TICRATE * 5 // cooldown between unforced switches
#define BOREDOMTIME 3 * TICRATE / 2 // how long until players considered far apart? #define BOREDOMTIME 3 * TICRATE / 2 // how long until players considered far apart?
#define TRANSFERTIME TICRATE // how long to delay reaction shots? #define TRANSFERTIME TICRATE // how long to delay reaction shots?
@ -86,7 +91,9 @@ struct DirectorInfo
} }
// if there's only one player left in the list, just switch to that player // if there's only one player left in the list, just switch to that player
if (playerstat[0].sorted != -1 && playerstat[1].sorted == -1) if (playerstat[0].sorted != -1 && (playerstat[1].sorted == -1 ||
// TODO: Battle; I just threw this together quick. Focus on leader.
!race_rules()))
{ {
change(playerstat[0].sorted, false); change(playerstat[0].sorted, false);
return; return;

View file

@ -547,6 +547,7 @@ typedef enum
playback_view2, playback_view2,
playback_view3, playback_view3,
playback_view4, playback_view4,
playback_director,
playback_freecam, playback_freecam,
playback_quit playback_quit
} playback_e; } playback_e;

View file

@ -10,9 +10,22 @@
#include "../../d_main.h" // D_StartTitle #include "../../d_main.h" // D_StartTitle
#include "../../k_credits.h" #include "../../k_credits.h"
#include "../../g_demo.h" #include "../../g_demo.h"
#include "../../k_director.h"
static void M_PlaybackTick(void); static void M_PlaybackTick(void);
// This is barebones, just toggle director on all screens.
static void M_PlaybackToggleDirector(INT32 choice)
{
(void)choice;
UINT8 i;
for (i = 0; i <= r_splitscreen; ++i)
{
K_ToggleDirector(i, !K_DirectorIsEnabled(i));
}
}
menuitem_t PAUSE_PlaybackMenu[] = menuitem_t PAUSE_PlaybackMenu[] =
{ {
{IT_CALL | IT_STRING, "Hide Menu", NULL, "M_PHIDE", {.routine = M_SelectableClearMenus}, 0, 0}, {IT_CALL | IT_STRING, "Hide Menu", NULL, "M_PHIDE", {.routine = M_SelectableClearMenus}, 0, 0},
@ -30,8 +43,9 @@ menuitem_t PAUSE_PlaybackMenu[] =
{IT_ARROWS | IT_STRING, "Viewpoint 3", NULL, "M_PNVIEW", {.routine = M_PlaybackAdjustView}, 120, 0}, {IT_ARROWS | IT_STRING, "Viewpoint 3", NULL, "M_PNVIEW", {.routine = M_PlaybackAdjustView}, 120, 0},
{IT_ARROWS | IT_STRING, "Viewpoint 4", NULL, "M_PNVIEW", {.routine = M_PlaybackAdjustView}, 136, 0}, {IT_ARROWS | IT_STRING, "Viewpoint 4", NULL, "M_PNVIEW", {.routine = M_PlaybackAdjustView}, 136, 0},
{IT_CALL | IT_STRING, "Toggle Free Camera", NULL, "M_PVIEWS", {.routine = M_PlaybackToggleFreecam}, 156, 0}, {IT_CALL | IT_STRING, "Toggle Director", NULL, "UN_IC11A", {.routine = M_PlaybackToggleDirector}, 156, 0},
{IT_CALL | IT_STRING, "Stop Playback", NULL, "M_PEXIT", {.routine = M_PlaybackQuit}, 172, 0}, {IT_CALL | IT_STRING, "Toggle Free Camera", NULL, "M_PVIEWS", {.routine = M_PlaybackToggleFreecam}, 172, 0},
{IT_CALL | IT_STRING, "Stop Playback", NULL, "M_PEXIT", {.routine = M_PlaybackQuit}, 188, 0},
}; };
menu_t PAUSE_PlaybackMenuDef = { menu_t PAUSE_PlaybackMenuDef = {
@ -39,7 +53,7 @@ menu_t PAUSE_PlaybackMenuDef = {
NULL, NULL,
0, 0,
PAUSE_PlaybackMenu, PAUSE_PlaybackMenu,
BASEVIDWIDTH/2 - 88, 2, BASEVIDWIDTH/2 - 96, 2,
0, 0, 0, 0,
MBF_UD_LR_FLIPPED, MBF_UD_LR_FLIPPED,
NULL, NULL,
@ -155,7 +169,7 @@ static void M_PlaybackTick(void)
if (modeattacking) if (modeattacking)
{ {
for (i = playback_viewcount; i <= playback_view4; i++) for (i = playback_viewcount; i <= playback_director; i++)
PAUSE_PlaybackMenu[i].status = IT_DISABLED; PAUSE_PlaybackMenu[i].status = IT_DISABLED;
PAUSE_PlaybackMenu[playback_freecam].mvar1 = 72; PAUSE_PlaybackMenu[playback_freecam].mvar1 = 72;
@ -166,17 +180,18 @@ static void M_PlaybackTick(void)
else else
{ {
PAUSE_PlaybackMenu[playback_viewcount].status = IT_ARROWS|IT_STRING; PAUSE_PlaybackMenu[playback_viewcount].status = IT_ARROWS|IT_STRING;
PAUSE_PlaybackMenu[playback_freecam].status = IT_CALL|IT_STRING;
for (i = 0; i <= r_splitscreen; i++) for (i = 0; i <= r_splitscreen; i++)
PAUSE_PlaybackMenu[playback_view1+i].status = IT_ARROWS|IT_STRING; PAUSE_PlaybackMenu[playback_view1+i].status = IT_ARROWS|IT_STRING;
for (i = r_splitscreen+1; i < 4; i++) for (i = r_splitscreen+1; i < 4; i++)
PAUSE_PlaybackMenu[playback_view1+i].status = IT_DISABLED; PAUSE_PlaybackMenu[playback_view1+i].status = IT_DISABLED;
PAUSE_PlaybackMenu[playback_freecam].mvar1 = 156; PAUSE_PlaybackMenu[playback_freecam].mvar1 = 172;
PAUSE_PlaybackMenu[playback_quit].mvar1 = 172; PAUSE_PlaybackMenu[playback_quit].mvar1 = 188;
//currentMenu->x = BASEVIDWIDTH/2 - 94; //currentMenu->x = BASEVIDWIDTH/2 - 94;
currentMenu->x = BASEVIDWIDTH/2 - 88; currentMenu->x = BASEVIDWIDTH/2 - 96;
} }
} }