kill splitscreen director again
This commit is contained in:
1 parent
743d1a0e86
commit
7465e1ae4b
9 files changed
+71
-115
No files matched your search
+1
-5
@@ -1010,11 +1010,7 @@ void D_RegisterClientCommands(void)
|
||||
CV_RegisterVar(&cv_showviewpointtext);
|
||||
CV_RegisterVar(&cv_showdownloadprompt);
|
||||
|
||||
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
|
||||
{
|
||||
CV_RegisterVar(&cv_director[i]);
|
||||
}
|
||||
|
||||
CV_RegisterVar(&cv_director);
|
||||
CV_RegisterVar(&cv_kartdebugdirector);
|
||||
CV_RegisterVar(&cv_showdirectorhud);
|
||||
|
||||
|
||||
+1
-2
@@ -197,8 +197,7 @@ extern consvar_t cv_ps_thinkframe_page;
|
||||
extern consvar_t cv_ps_samplesize;
|
||||
extern consvar_t cv_ps_descriptor;
|
||||
|
||||
extern consvar_t cv_director[4]; // screw you includes
|
||||
extern consvar_t cv_kartdebugdirector, cv_showdirectorhud;
|
||||
extern consvar_t cv_director, cv_kartdebugdirector, cv_showdirectorhud;
|
||||
|
||||
extern consvar_t cv_showtrackaddon;
|
||||
|
||||
|
||||
+7
-27
@@ -338,7 +338,7 @@ INT16 prevmap, nextmap;
|
||||
|
||||
// save if director is enabled
|
||||
// so demos can disable it by default and restore it after
|
||||
static int directorstate[MAXSPLITSCREENPLAYERS] = {0,0,0,0};
|
||||
static int directorstate = 0;
|
||||
tic_t directortoggletimer = 0;
|
||||
|
||||
static CV_PossibleValue_t recordmultiplayerdemos_cons_t[] = {{0, "Disabled"}, {1, "Manual Save"}, {2, "Auto Save"}, {0, NULL}};
|
||||
@@ -360,8 +360,6 @@ void SendWeaponPref2(void);
|
||||
void SendWeaponPref3(void);
|
||||
void SendWeaponPref4(void);
|
||||
|
||||
static void G_FixCamera(UINT8 view);
|
||||
|
||||
// don't mind me putting these here, I was lazy to figure out where else I could put those without blowing up the compiler.
|
||||
|
||||
// chat timer thingy
|
||||
@@ -1549,19 +1547,7 @@ boolean G_Responder(event_t *ev)
|
||||
|
||||
if (ev->data1 == gamecontrol[gc_director][0] || ev->data1 == gamecontrol[gc_director][1])
|
||||
{
|
||||
K_ToggleDirector(0);
|
||||
}
|
||||
else if (ev->data1 == gamecontrolbis[gc_director][0] || ev->data1 == gamecontrolbis[gc_director][1])
|
||||
{
|
||||
K_ToggleDirector(1);
|
||||
}
|
||||
else if (ev->data1 == gamecontrol3[gc_director][0] || ev->data1 == gamecontrol3[gc_director][1])
|
||||
{
|
||||
K_ToggleDirector(2);
|
||||
}
|
||||
else if (ev->data1 == gamecontrol4[gc_director][0] || ev->data1 == gamecontrol4[gc_director][1])
|
||||
{
|
||||
K_ToggleDirector(3);
|
||||
K_ToggleDirector();
|
||||
}
|
||||
|
||||
if (ev->data1 == gamecontrol[gc_freecam][0] || ev->data1 == gamecontrol[gc_freecam][1])
|
||||
@@ -1715,7 +1701,7 @@ INT32 G_CountPlayersPotentiallyViewable(boolean active)
|
||||
// Reset camera position, angle and interpolation on a view
|
||||
// after changing state.
|
||||
//
|
||||
static void G_FixCamera(UINT8 view)
|
||||
void G_FixCamera(UINT8 view)
|
||||
{
|
||||
player_t *player = &players[displayplayers[view - 1]];
|
||||
|
||||
@@ -7336,11 +7322,8 @@ post_compat:
|
||||
players[i].kartweight = kartweight[i];
|
||||
}
|
||||
|
||||
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
|
||||
{
|
||||
directorstate[i] = cv_director[i].value;
|
||||
CV_SetValue(&cv_director[i], 0);
|
||||
}
|
||||
directorstate = cv_director.value;
|
||||
CV_SetValue(&cv_director, 0);
|
||||
|
||||
demo.deferstart = true;
|
||||
}
|
||||
@@ -7907,11 +7890,8 @@ void G_StopDemo(void)
|
||||
demobuf.buffer = NULL;
|
||||
if (demo.playback)
|
||||
{
|
||||
for (UINT8 i = 0; i < MAXSPLITSCREENPLAYERS; i++)
|
||||
{
|
||||
CV_SetValue(&cv_director[i], directorstate[i]);
|
||||
directorstate[i] = 0;
|
||||
}
|
||||
CV_SetValue(&cv_director, directorstate);
|
||||
directorstate = 0;
|
||||
}
|
||||
demo.playback = false;
|
||||
if (demo.title)
|
||||
|
||||
@@ -66,9 +66,6 @@ struct demovars_s {
|
||||
DSM_WILLSAVE,
|
||||
DSM_SAVED
|
||||
} savemode;
|
||||
|
||||
boolean freecam;
|
||||
|
||||
};
|
||||
|
||||
extern struct demovars_s demo;
|
||||
|
||||
+57
-71
@@ -83,11 +83,6 @@ static boolean K_DirectorIsEnabled(void)
|
||||
return (cv_director.value && K_DirectorIsAvailable());
|
||||
}
|
||||
|
||||
static boolean K_DirectorIsEnabled(const UINT8 viewnum)
|
||||
{
|
||||
return (cv_director[viewnum].value && K_DirectorIsAvailable(viewnum));
|
||||
}
|
||||
|
||||
void K_InitDirector(void)
|
||||
{
|
||||
INT32 playernum;
|
||||
@@ -98,20 +93,11 @@ void K_InitDirector(void)
|
||||
directorinfo.maxdist = 0;
|
||||
directorinfo.viewplayer = NULL;
|
||||
|
||||
for (UINT8 i = 0; i < MAXSPLITSCREENPLAYERS; i++)
|
||||
for (playernum = 0; playernum < MAXPLAYERS; playernum++)
|
||||
{
|
||||
directorinfosplit[i].cooldown = SWITCHTIME;
|
||||
directorinfosplit[i].freeze = 0;
|
||||
directorinfosplit[i].attacker = 0;
|
||||
directorinfosplit[i].maxdist = 0;
|
||||
directorinfosplit[i].viewplayer = NULL;
|
||||
|
||||
for (playernum = 0; playernum < MAXPLAYERS; playernum++)
|
||||
{
|
||||
directorinfosplit[i].sortedplayers[playernum] = -1;
|
||||
directorinfosplit[i].gap[playernum] = INT32_MAX;
|
||||
directorinfosplit[i].boredom[playernum] = 0;
|
||||
}
|
||||
directorinfo.sortedplayers[playernum] = -1;
|
||||
directorinfo.gap[playernum] = INT32_MAX;
|
||||
directorinfo.boredom[playernum] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -174,13 +160,13 @@ static fixed_t K_GetFinishGap(INT32 leader, INT32 follower)
|
||||
}
|
||||
}
|
||||
|
||||
static void K_UpdateDirectorPositions(const UINT8 viewnum)
|
||||
static void K_UpdateDirectorPositions(void)
|
||||
{
|
||||
INT32 playernum;
|
||||
INT32 position;
|
||||
player_t* target;
|
||||
|
||||
memset(directorinfosplit[viewnum].sortedplayers, -1, sizeof(directorinfo.sortedplayers));
|
||||
memset(directorinfo.sortedplayers, -1, sizeof(directorinfo.sortedplayers));
|
||||
|
||||
for (playernum = 0; playernum < MAXPLAYERS; playernum++)
|
||||
{
|
||||
@@ -188,43 +174,43 @@ static void K_UpdateDirectorPositions(const UINT8 viewnum)
|
||||
|
||||
if (playeringame[playernum] && !target->spectator && target->kartstuff[k_position] > 0)
|
||||
{
|
||||
directorinfosplit[viewnum].sortedplayers[target->kartstuff[k_position] - 1] = playernum;
|
||||
directorinfo.sortedplayers[target->kartstuff[k_position] - 1] = playernum;
|
||||
}
|
||||
}
|
||||
|
||||
for (position = 0; position < MAXPLAYERS - 1; position++)
|
||||
{
|
||||
directorinfosplit[viewnum].gap[position] = INT32_MAX;
|
||||
directorinfo.gap[position] = INT32_MAX;
|
||||
|
||||
if (directorinfosplit[viewnum].sortedplayers[position] == -1 || directorinfosplit[viewnum].sortedplayers[position + 1] == -1)
|
||||
if (directorinfo.sortedplayers[position] == -1 || directorinfo.sortedplayers[position + 1] == -1)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
directorinfosplit[viewnum].gap[position] = ScaleFromMap(K_GetFinishGap(directorinfosplit[viewnum].sortedplayers[position], directorinfosplit[viewnum].sortedplayers[position + 1]), FRACUNIT);
|
||||
directorinfo.gap[position] = ScaleFromMap(K_GetFinishGap(directorinfo.sortedplayers[position], directorinfo.sortedplayers[position + 1]), FRACUNIT);
|
||||
|
||||
if (directorinfosplit[viewnum].gap[position] >= BREAKAWAYDIST)
|
||||
if (directorinfo.gap[position] >= BREAKAWAYDIST)
|
||||
{
|
||||
directorinfosplit[viewnum].boredom[position] = (INT32)(min(BOREDOMTIME * 2, directorinfosplit[viewnum].boredom[position] + 1));
|
||||
directorinfo.boredom[position] = (INT32)(min(BOREDOMTIME * 2, directorinfo.boredom[position] + 1));
|
||||
}
|
||||
else if (directorinfosplit[viewnum].boredom[position] > 0)
|
||||
else if (directorinfo.boredom[position] > 0)
|
||||
{
|
||||
directorinfosplit[viewnum].boredom[position]--;
|
||||
directorinfo.boredom[position]--;
|
||||
}
|
||||
}
|
||||
|
||||
if (directorinfosplit[viewnum].sortedplayers[0] == -1)
|
||||
if (directorinfo.sortedplayers[0] == -1)
|
||||
{
|
||||
directorinfosplit[viewnum].maxdist = -1;
|
||||
directorinfo.maxdist = -1;
|
||||
return;
|
||||
}
|
||||
|
||||
directorinfosplit[viewnum].maxdist = ScaleFromMap(K_GetDistanceToFinish(players[directorinfosplit[viewnum].sortedplayers[0]]), FRACUNIT);
|
||||
directorinfo.maxdist = ScaleFromMap(K_GetDistanceToFinish(players[directorinfo.sortedplayers[0]]), FRACUNIT);
|
||||
}
|
||||
|
||||
static boolean K_CanSwitchDirector(const UINT8 viewnum)
|
||||
static boolean K_CanSwitchDirector(void)
|
||||
{
|
||||
if (directorinfosplit[viewnum].cooldown > 0)
|
||||
if (directorinfo.cooldown > 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -232,9 +218,9 @@ static boolean K_CanSwitchDirector(const UINT8 viewnum)
|
||||
return true;
|
||||
}
|
||||
|
||||
static void K_DirectorSwitch(INT32 player, boolean force, const UINT8 viewnum)
|
||||
static void K_DirectorSwitch(INT32 player, boolean force)
|
||||
{
|
||||
if (!K_DirectorIsEnabled(viewnum))
|
||||
if (!K_DirectorIsEnabled())
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -244,29 +230,29 @@ static void K_DirectorSwitch(INT32 player, boolean force, const UINT8 viewnum)
|
||||
return;
|
||||
}
|
||||
|
||||
if (!force && !K_CanSwitchDirector(viewnum))
|
||||
if (!force && !K_CanSwitchDirector())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
G_ResetView(viewnum+1, player, true);
|
||||
directorinfosplit[viewnum].cooldown = SWITCHTIME;
|
||||
G_ResetView(1, player, true);
|
||||
directorinfo.cooldown = SWITCHTIME;
|
||||
}
|
||||
|
||||
static void K_DirectorForceSwitch(INT32 player, INT32 time, const UINT8 viewnum)
|
||||
static void K_DirectorForceSwitch(INT32 player, INT32 time)
|
||||
{
|
||||
if (players[player].exiting)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
directorinfosplit[viewnum].attacker = player;
|
||||
directorinfosplit[viewnum].freeze = time;
|
||||
directorinfo.attacker = player;
|
||||
directorinfo.freeze = time;
|
||||
}
|
||||
|
||||
void K_DirectorFollowAttack(player_t *player, mobj_t *inflictor, mobj_t *source)
|
||||
{
|
||||
if (!K_DirectorIsEnabled(directorinfo.viewnum))
|
||||
if (!K_DirectorIsEnabled())
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -278,11 +264,11 @@ void K_DirectorFollowAttack(player_t *player, mobj_t *inflictor, mobj_t *source)
|
||||
|
||||
if (inflictor && inflictor->player)
|
||||
{
|
||||
K_DirectorForceSwitch(inflictor->player - players, TRANSFERTIME, directorinfo.viewnum);
|
||||
K_DirectorForceSwitch(inflictor->player - players, TRANSFERTIME);
|
||||
}
|
||||
else if (source && source->player)
|
||||
{
|
||||
K_DirectorForceSwitch(source->player - players, TRANSFERTIME, directorinfo.viewnum);
|
||||
K_DirectorForceSwitch(source->player - players, TRANSFERTIME);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -302,14 +288,14 @@ void K_DrawDirectorDebugger(void)
|
||||
V_DrawThinString(40, 0, V_70TRANS, va("CONF?"));
|
||||
V_DrawThinString(80, 0, V_70TRANS, va("GAP"));
|
||||
V_DrawThinString(120, 0, V_70TRANS, va("BORED"));
|
||||
V_DrawThinString(150, 0, V_70TRANS, va("COOLDOWN: %d", directorinfosplit[0].cooldown));
|
||||
V_DrawThinString(230, 0, V_70TRANS, va("MAXDIST: %d", directorinfosplit[0].maxdist));
|
||||
V_DrawThinString(150, 0, V_70TRANS, va("COOLDOWN: %d", directorinfo.cooldown));
|
||||
V_DrawThinString(230, 0, V_70TRANS, va("MAXDIST: %d", directorinfo.maxdist));
|
||||
|
||||
for (position = 0; position < MAXPLAYERS - 1; position++)
|
||||
{
|
||||
ytxt = 10 * (position + 1);
|
||||
leader = directorinfosplit[0].sortedplayers[position];
|
||||
follower = directorinfosplit[0].sortedplayers[position + 1];
|
||||
leader = directorinfo.sortedplayers[position];
|
||||
follower = directorinfo.sortedplayers[position + 1];
|
||||
|
||||
if (leader == -1 || follower == -1)
|
||||
break;
|
||||
@@ -322,15 +308,15 @@ void K_DrawDirectorDebugger(void)
|
||||
V_DrawThinString(40, ytxt, V_70TRANS, va("NG"));
|
||||
}
|
||||
|
||||
V_DrawThinString(80, ytxt, V_70TRANS, va("%d", directorinfosplit[0].gap[position]));
|
||||
V_DrawThinString(80, ytxt, V_70TRANS, va("%d", directorinfo.gap[position]));
|
||||
|
||||
if (directorinfosplit[0].boredom[position] >= BOREDOMTIME)
|
||||
if (directorinfo.boredom[position] >= BOREDOMTIME)
|
||||
{
|
||||
V_DrawThinString(120, ytxt, V_70TRANS, va("BORED"));
|
||||
}
|
||||
else
|
||||
{
|
||||
V_DrawThinString(120, ytxt, V_70TRANS, va("%d", directorinfosplit[0].boredom[position]));
|
||||
V_DrawThinString(120, ytxt, V_70TRANS, va("%d", directorinfo.boredom[position]));
|
||||
}
|
||||
|
||||
V_DrawThinString(150, ytxt, V_70TRANS, va("%s", player_names[leader]));
|
||||
@@ -338,37 +324,37 @@ void K_DrawDirectorDebugger(void)
|
||||
}
|
||||
}
|
||||
|
||||
void K_UpdateDirector(const UINT8 viewnum)
|
||||
void K_UpdateDirector(void)
|
||||
{
|
||||
INT32 targetposition;
|
||||
directorinfo.viewplayer = &players[displayplayers[0]];
|
||||
|
||||
if (!K_DirectorIsEnabled(directorinfo.viewnum))
|
||||
if (!K_DirectorIsEnabled())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
K_UpdateDirectorPositions(directorinfo.viewnum);
|
||||
K_UpdateDirectorPositions();
|
||||
|
||||
if (directorinfosplit[directorinfo.viewnum].cooldown > 0) {
|
||||
directorinfosplit[directorinfo.viewnum].cooldown--;
|
||||
if (directorinfo.cooldown > 0) {
|
||||
directorinfo.cooldown--;
|
||||
}
|
||||
|
||||
// handle pending forced switches
|
||||
if (directorinfosplit[directorinfo.viewnum].freeze > 0)
|
||||
if (directorinfo.freeze > 0)
|
||||
{
|
||||
if (!(--directorinfosplit[directorinfo.viewnum].freeze))
|
||||
K_DirectorSwitch(directorinfosplit[directorinfo.viewnum].attacker, true, directorinfo.viewnum);
|
||||
if (!(--directorinfo.freeze))
|
||||
K_DirectorSwitch(directorinfo.attacker, true);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// if there's only one player left in the list, just switch to that player
|
||||
if (directorinfosplit[directorinfo.viewnum].sortedplayers[0] != -1 && (directorinfosplit[directorinfo.viewnum].sortedplayers[1] == -1 ||
|
||||
if (directorinfo.sortedplayers[0] != -1 && (directorinfo.sortedplayers[1] == -1 ||
|
||||
// TODO: Battle; I just threw this together quick. Focus on leader.
|
||||
!race_rules()))
|
||||
{
|
||||
K_DirectorSwitch(directorinfosplit[directorinfo.viewnum].sortedplayers[0], false, directorinfo.viewnum);
|
||||
K_DirectorSwitch(directorinfo.sortedplayers[0], false);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -380,36 +366,36 @@ void K_UpdateDirector(const UINT8 viewnum)
|
||||
INT32 target;
|
||||
|
||||
// you are out of players, try again
|
||||
if (directorinfosplit[directorinfo.viewnum].sortedplayers[targetposition] == -1)
|
||||
if (directorinfo.sortedplayers[targetposition] == -1)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
// pair too far apart? try the next one
|
||||
if (directorinfosplit[directorinfo.viewnum].boredom[targetposition - 1] >= BOREDOMTIME)
|
||||
if (directorinfo.boredom[targetposition - 1] >= BOREDOMTIME)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// pair finished? try the next one
|
||||
if (players[directorinfosplit[directorinfo.viewnum].sortedplayers[targetposition]].exiting)
|
||||
if (players[directorinfo.sortedplayers[targetposition]].exiting)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// don't risk switching away from forward pairs at race end, might miss something!
|
||||
if (directorinfosplit[directorinfo.viewnum].maxdist > PINCHDIST)
|
||||
if (directorinfo.maxdist > PINCHDIST)
|
||||
{
|
||||
// if the "next" player is close enough, they should be able to see everyone fine!
|
||||
// walk back through the standings to find a vantage that gets everyone in frame.
|
||||
// (also creates a pretty cool effect w/ overtakes at speed)
|
||||
while (targetposition < MAXPLAYERS && directorinfosplit[directorinfo.viewnum].gap[targetposition] < WALKBACKDIST)
|
||||
while (targetposition < MAXPLAYERS && directorinfo.gap[targetposition] < WALKBACKDIST)
|
||||
{
|
||||
targetposition++;
|
||||
}
|
||||
}
|
||||
|
||||
target = directorinfosplit[directorinfo.viewnum].sortedplayers[targetposition];
|
||||
target = directorinfo.sortedplayers[targetposition];
|
||||
|
||||
// stop here since we're already viewing this player
|
||||
if (displayplayers[0] == target)
|
||||
@@ -420,20 +406,20 @@ void K_UpdateDirector(const UINT8 viewnum)
|
||||
// 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, directorinfo.viewnum);
|
||||
K_DirectorSwitch(target, false);
|
||||
}
|
||||
|
||||
// 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, directorinfo.viewnum);
|
||||
K_DirectorSwitch(target, false);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void K_ToggleDirector(const UINT8 viewnum)
|
||||
void K_ToggleDirector(void)
|
||||
{
|
||||
if (!K_DirectorIsAvailable())
|
||||
return;
|
||||
@@ -442,7 +428,7 @@ void K_ToggleDirector(const UINT8 viewnum)
|
||||
|
||||
if (!K_DirectorIsEnabled())
|
||||
{
|
||||
directorinfosplit[viewnum].cooldown = 0; // switch immediately
|
||||
directorinfo.cooldown = 0; // switch immediately
|
||||
}
|
||||
|
||||
directortoggletimer = 0;
|
||||
|
||||
+2
-2
@@ -12,7 +12,7 @@
|
||||
|
||||
boolean K_DirectorIsAvailable(void);
|
||||
void K_InitDirector(void);
|
||||
void K_UpdateDirector(UINT8 viewnum);
|
||||
void K_UpdateDirector(void);
|
||||
void K_DrawDirectorDebugger(void);
|
||||
void K_DirectorFollowAttack(player_t *player, mobj_t *inflictor, mobj_t *source);
|
||||
void K_ToggleDirector(UINT8 viewnum);
|
||||
void K_ToggleDirector(void);
|
||||
+1
-4
@@ -726,10 +726,7 @@ void P_Ticker(boolean run)
|
||||
PS_STOP_TIMING(ps_lua_postthinkframe_time);
|
||||
}
|
||||
|
||||
for (i = 0; i <= splitscreen; i++)
|
||||
{
|
||||
K_UpdateDirector(i);
|
||||
}
|
||||
K_UpdateDirector();
|
||||
|
||||
// Always move the camera.
|
||||
P_RunChaseCameras();
|
||||
|
||||
@@ -3150,6 +3150,7 @@ void P_ToggleDemoCamera(UINT8 viewnum)
|
||||
else // toggle off
|
||||
{
|
||||
cam->freecam = false;
|
||||
G_FixCamera(viewnum+1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -683,7 +683,7 @@ static void ST_overlayDrawer(void)
|
||||
{
|
||||
char directortext[20] = {0};
|
||||
|
||||
snprintf(directortext, 20, "Director: %s", cv_director[0].value ? "On" : "Off");
|
||||
snprintf(directortext, 20, "Director: %s", cv_director.value ? "On" : "Off");
|
||||
|
||||
if ((!demo.playback && directortoggletimer < 13*TICRATE) || (demo.playback && directortoggletimer < 4*TICRATE))
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user