Merge branch 'Saturn-Next' into freecamstuffs

This commit is contained in:
Alug committed 2024-12-30 11:30:46 +01:00
commit 6f3443232e
8 files changed
+58 -45

No files matched your search

+1
View File
@@ -573,6 +573,7 @@ static CV_PossibleValue_t ps_descriptor_cons_t[] = {
consvar_t cv_ps_descriptor = {"ps_descriptor", "Average", 0, ps_descriptor_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_director = {"director", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_kartdebugdirector = {"debugdirector", "Off", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_showdirectorhud = {"showdirectorhud", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
+29 -10
View File
@@ -1209,9 +1209,6 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
{
displayplayers[0] = consoleplayer;
G_FixCamera(1);
// i dont like this lmao
if (cv_director.value)
CV_SetValue(&cv_director, 0);
}
}
@@ -1547,8 +1544,8 @@ boolean G_Responder(event_t *ev)
COM_ImmedExecute("changeteam4 spectator");
}
}
if (ev->data1 == gamecontrol[gc_director][0]
|| ev->data1 == gamecontrol[gc_director][1])
if (ev->data1 == gamecontrol[gc_director][0] || ev->data1 == gamecontrol[gc_director][1])
{
K_ToggleDirector();
}
@@ -6068,10 +6065,23 @@ void G_BeginRecording(void)
UINT8 *m;
if (!cv_recordmultiplayerdemos.value)
{
G_ResetDemoRecording();
return;
}
if (demobuf.p || demobuf.buffer == NULL)
if (demobuf.buffer == NULL)
{
CONS_Alert(CONS_ERROR, "No demo buffer allocated\n");
G_ResetDemoRecording();
return;
}
if (demobuf.p)
{
G_ResetDemoRecording();
return;
}
memset(name,0,sizeof(name));
@@ -6227,8 +6237,20 @@ void G_BeginMetal(void)
{
mobj_t *mo = players[consoleplayer].mo;
if (demobuf.p || demobuf.buffer == NULL)
if (demobuf.buffer == NULL)
{
CONS_Alert(CONS_ERROR, "No metal demo buffer allocated\n");
metalrecording = false;
return;
}
if (demobuf.p)
{
Z_Free(demobuf.buffer);
demobuf.buffer = NULL;
metalrecording = false;
return;
}
demobuf.p = demobuf.buffer;
@@ -6844,9 +6866,6 @@ void G_DoPlayDemo(char *defdemoname)
boolean spectator;
UINT8 slots[MAXPLAYERS], kartspeed[MAXPLAYERS], kartweight[MAXPLAYERS], numslots = 0;
if (demobuf.buffer == NULL)
return;
G_InitDemoRewind();
skin[16] = '\0';
-2
View File
@@ -438,8 +438,6 @@ FUNCMATH INT32 G_TicsToSeconds(tic_t tics);
FUNCMATH INT32 G_TicsToCentiseconds(tic_t tics);
FUNCMATH INT32 G_TicsToMilliseconds(tic_t tics);
boolean K_DirectorIsPlayerAlone(void); // idk where else to put this lol
// Don't split up TOL handling
INT16 G_TOLFlag(INT32 pgametype);
+24 -23
View File
@@ -12,6 +12,7 @@
//#include "k_kart.h"
#include "doomdef.h"
#include "doomstat.h"
#include "g_game.h"
#include "v_video.h"
#include "k_director.h"
@@ -28,6 +29,7 @@
struct directorinfo
{
player_t* viewplayer;
tic_t cooldown; // how long has it been since we last switched?
tic_t freeze; // when nonzero, fixed switch pending, freeze logic!
INT32 attacker; // who to switch to when freeze delay elapses
@@ -38,7 +40,7 @@ struct directorinfo
INT32 boredom[MAXPLAYERS]; // how long has a given position had no credible attackers?
} directorinfo;
boolean K_DirectorIsPlayerAlone(void)
static boolean K_DirectorIsPlayerAlone(void)
{
UINT8 pingame = 0;
@@ -67,9 +69,16 @@ static fixed_t ScaleFromMap(fixed_t n, fixed_t scale)
return FixedMul(n, FixedDiv(scale, mapobjectscale));
}
boolean K_DirectorIsAvailable(void)
{
if ((demo.playback && demo.title) || modeattacking)
return false;
return ((gamestate == GS_LEVEL) && (demo.playback || (players[consoleplayer].spectator && !K_DirectorIsPlayerAlone())));
}
static boolean K_DirectorIsEnabled(void)
{
return cv_director.value && !splitscreen && (gamestate == GS_LEVEL && (((!playeringame[consoleplayer] || players[consoleplayer].spectator)) || (demo.playback && !camera[0].freecam && (!demo.title || !modeattacking))) && !K_DirectorIsPlayerAlone());
return (cv_director.value && K_DirectorIsAvailable());
}
void K_InitDirector(void)
@@ -80,6 +89,7 @@ void K_InitDirector(void)
directorinfo.freeze = 0;
directorinfo.attacker = 0;
directorinfo.maxdist = 0;
directorinfo.viewplayer = NULL;
for (playernum = 0; playernum < MAXPLAYERS; playernum++)
{
@@ -104,8 +114,8 @@ static fixed_t K_GetDistanceToFinish(player_t player)
continue;
dist = P_AproxDistance(P_AproxDistance(mo->x - player.mo->x,
mo->y - player.mo->y),
mo->z - player.mo->z) / FRACUNIT;
mo->y - player.mo->y),
mo->z - player.mo->z) / FRACUNIT;
break;
}
@@ -124,7 +134,7 @@ static fixed_t K_GetDistanceToFinish(player_t player)
dist = P_AproxDistance(P_AproxDistance(mo->x - player.mo->x,
mo->y - player.mo->y),
mo->z - player.mo->z) / FRACUNIT;
mo->z - player.mo->z) / FRACUNIT;
break;
}
@@ -213,11 +223,6 @@ static void K_DirectorSwitch(INT32 player, boolean force)
return;
}
if (P_IsDisplayPlayer(&players[player]))
{
return;
}
if (players[player].exiting)
{
return;
@@ -250,7 +255,7 @@ void K_DirectorFollowAttack(player_t *player, mobj_t *inflictor, mobj_t *source)
return;
}
if (!P_IsDisplayPlayer(player))
if (directorinfo.viewplayer != player)
{
return;
}
@@ -319,8 +324,8 @@ void K_DrawDirectorDebugger(void)
void K_UpdateDirector(void)
{
INT32 *displayplayerp = &displayplayers[0];
INT32 targetposition;
directorinfo.viewplayer = &players[displayplayers[0]];
if (!K_DirectorIsEnabled())
{
@@ -391,25 +396,19 @@ void K_UpdateDirector(void)
target = directorinfo.sortedplayers[targetposition];
// stop here since we're already viewing this player
if (*displayplayerp == target)
if (displayplayers[0] == target)
{
break;
}
// if this is a splitscreen player, try next pair
if (P_IsDisplayPlayer(&players[target]))
{
continue;
}
// if we're certain the back half of the pair is actually in this position, try to switch
if (!players[target].kartstuff[k_positiondelay])
{
K_DirectorSwitch(target, false);
}
// even if we're not certain, if we're certain we're watching the WRONG player, try to switch
if (players[*displayplayerp].kartstuff[k_position] != targetposition+1 && !players[*displayplayerp].kartstuff[k_positiondelay])
// even if we're not certain, if we're cetain we're watching the WRONG player, try to switch
if (directorinfo.viewplayer->kartstuff[k_position] != targetposition+1 && !directorinfo.viewplayer->kartstuff[k_positiondelay])
{
K_DirectorSwitch(target, false);
}
@@ -420,9 +419,11 @@ void K_UpdateDirector(void)
void K_ToggleDirector(void)
{
if (!directortextactive)
if (!K_DirectorIsAvailable())
return;
G_AdjustView(1, 1, true);
if (!K_DirectorIsEnabled())
{
directorinfo.cooldown = 0; // switch immediately
@@ -430,5 +431,5 @@ void K_ToggleDirector(void)
directortoggletimer = 0;
COM_ImmedExecute("add director 1");
CV_SetValue(&cv_director, (cv_director.value ^ 1));
}
+1
View File
@@ -10,6 +10,7 @@
/// \file k_director.h
/// \brief SRB2kart automatic spectator camera.
boolean K_DirectorIsAvailable(void);
void K_InitDirector(void);
void K_UpdateDirector(void);
void K_DrawDirectorDebugger(void);
-2
View File
@@ -3406,12 +3406,10 @@ void PDistort_menu_Onchange(void)
{
if (!cv_sloperoll.value)
{
OP_PlayerDistortMenu[sloperotate].status = IT_GRAYEDOUT;
OP_PlayerDistortMenu[sliptide].status = IT_GRAYEDOUT;
}
else
{
OP_PlayerDistortMenu[sloperotate].status = IT_STRING | IT_CVAR;
OP_PlayerDistortMenu[sliptide].status = IT_STRING | IT_CVAR;
}
+3 -6
View File
@@ -16,6 +16,7 @@
#include "doomdef.h"
#include "g_game.h"
#include "g_input.h"
#include "k_director.h"
#include "r_local.h"
#include "p_local.h"
#include "f_finale.h"
@@ -156,8 +157,6 @@ static patch_t *envelope;
player_t *stplyr;
UINT8 stplyrnum;
boolean directortextactive = false;
// SRB2kart
hudinfo_t hudinfo[NUMHUDITEMS] =
@@ -679,14 +678,13 @@ static void ST_overlayDrawer(void)
if (!hu_showscores) // hide the following if TAB is held
{
if (cv_showdirectorhud.value && !splitscreen && ((demo.playback && !camera[stplyrnum].freecam && (!demo.title || !modeattacking)) || !P_IsLocalPlayer(stplyr)) && !K_DirectorIsPlayerAlone())
// TODO: splitscreen support!
if (cv_showdirectorhud.value && !splitscreen && !P_IsLocalPlayer(stplyr) && K_DirectorIsAvailable())
{
char directortext[20] = {0};
snprintf(directortext, 20, "Director: %s", cv_director.value ? "On" : "Off");
directortextactive = true;
if ((!demo.playback && directortoggletimer < 13*TICRATE) || (demo.playback && directortoggletimer < 4*TICRATE))
{
if (renderisnewtic)
@@ -701,7 +699,6 @@ static void ST_overlayDrawer(void)
else
{
directortoggletimer = 0;
directortextactive = false;
}
if (cv_showviewpointtext.value)
-2
View File
@@ -146,6 +146,4 @@ extern UINT16 objectsdrawn;
extern consvar_t cv_lessflicker;
extern consvar_t cv_stagetitle;
extern boolean directortextactive;
#endif