Make replays single-view by default unless requested

This commit is contained in:
fickleheart 2019-02-01 20:19:52 -06:00
parent 3724d02e3b
commit ba07224a8f
2 changed files with 89 additions and 22 deletions

View file

@ -1809,7 +1809,7 @@ boolean G_Responder(event_t *ev)
else else
{ {
displayplayer++; displayplayer++;
G_ResetViews(); G_ResetViews(1);
// change statusbar also if playing back demo // change statusbar also if playing back demo
if (singledemo) if (singledemo)
@ -1823,22 +1823,58 @@ boolean G_Responder(event_t *ev)
{ {
if (ev->data1 == gamecontrolbis[gc_viewpoint][0] || ev->data1 == gamecontrolbis[gc_viewpoint][1]) if (ev->data1 == gamecontrolbis[gc_viewpoint][0] || ev->data1 == gamecontrolbis[gc_viewpoint][1])
{ {
if (!splitscreen)
{
splitscreen = 1;
secondarydisplayplayer = displayplayer;
G_ResetViews(2);
P_ResetCamera(&players[secondarydisplayplayer], &camera2);
R_ExecuteSetViewSize();
return true;
}
secondarydisplayplayer++; secondarydisplayplayer++;
G_ResetViews(); G_ResetViews(2);
return true; return true;
} }
else if (ev->data1 == gamecontrol3[gc_viewpoint][0] || ev->data1 == gamecontrol3[gc_viewpoint][1]) else if (ev->data1 == gamecontrol3[gc_viewpoint][0] || ev->data1 == gamecontrol3[gc_viewpoint][1])
{ {
if (splitscreen == 1)
{
splitscreen = 2;
thirddisplayplayer = displayplayer;
G_ResetViews(3);
P_ResetCamera(&players[thirddisplayplayer], &camera3);
R_ExecuteSetViewSize();
return true;
}
thirddisplayplayer++; thirddisplayplayer++;
G_ResetViews(); G_ResetViews(3);
return true; return true;
} }
else if (ev->data1 == gamecontrol4[gc_viewpoint][0] || ev->data1 == gamecontrol4[gc_viewpoint][1]) else if (ev->data1 == gamecontrol4[gc_viewpoint][0] || ev->data1 == gamecontrol4[gc_viewpoint][1])
{ {
if (splitscreen == 2)
{
splitscreen = 3;
fourthdisplayplayer = displayplayer;
G_ResetViews(4);
P_ResetCamera(&players[fourthdisplayplayer], &camera4);
R_ExecuteSetViewSize();
return true;
}
fourthdisplayplayer++; fourthdisplayplayer++;
G_ResetViews(); G_ResetViews(4);
return true; return true;
} }
@ -2057,7 +2093,16 @@ static INT32 G_FindView(INT32 startview)
if (!demoplayback && startview == consoleplayer) if (!demoplayback && startview == consoleplayer)
break; // End loop break; // End loop
if (startview == displayplayer || startview == secondarydisplayplayer || startview == thirddisplayplayer || startview == fourthdisplayplayer) if (startview == displayplayer)
continue;
if (splitscreen && startview == secondarydisplayplayer)
continue;
if (splitscreen >= 2 && startview == thirddisplayplayer)
continue;
if (splitscreen == 3 && startview == fourthdisplayplayer)
continue; continue;
if (!playeringame[startview]) if (!playeringame[startview])
@ -2115,26 +2160,47 @@ static INT32 G_FindView(INT32 startview)
// G_ResetViews // G_ResetViews
// Ensures all viewpoints are valid // Ensures all viewpoints are valid
// //
void G_ResetViews(void) void G_ResetViews(UINT8 viewnum)
{ {
INT32 tempplayer; INT32 tempplayer;
tempplayer = displayplayer; if (!viewnum || viewnum == 1)
displayplayer = INT32_MAX; {
displayplayer = G_FindView(tempplayer); tempplayer = displayplayer;
displayplayer = INT32_MAX;
displayplayer = G_FindView(tempplayer);
}
tempplayer = secondarydisplayplayer; if (splitscreen && demoplayback)
secondarydisplayplayer = INT32_MAX; {
secondarydisplayplayer = G_FindView(tempplayer);
tempplayer = thirddisplayplayer; if (!viewnum || viewnum == 2)
thirddisplayplayer = INT32_MAX; {
thirddisplayplayer = G_FindView(tempplayer); tempplayer = secondarydisplayplayer;
secondarydisplayplayer = INT32_MAX;
secondarydisplayplayer = G_FindView(tempplayer);
}
tempplayer = fourthdisplayplayer; if (splitscreen >= 2)
fourthdisplayplayer = INT32_MAX; {
fourthdisplayplayer = G_FindView(tempplayer); if (!viewnum || viewnum == 3)
{
tempplayer = thirddisplayplayer;
thirddisplayplayer = INT32_MAX;
thirddisplayplayer = G_FindView(tempplayer);
}
if (splitscreen == 3)
{
if (!viewnum || viewnum == 4)
{
tempplayer = fourthdisplayplayer;
fourthdisplayplayer = INT32_MAX;
fourthdisplayplayer = G_FindView(tempplayer);
}
}
}
}
if (demoplayback) if (demoplayback)
consoleplayer = displayplayer; consoleplayer = displayplayer;
} }
@ -6246,8 +6312,8 @@ void G_DoPlayDemo(char *defdemoname)
} }
if (!playeringame[displayplayer] || players[displayplayer].spectator) if (!playeringame[displayplayer] || players[displayplayer].spectator)
displayplayer = consoleplayer = p; displayplayer = consoleplayer = secondarydisplayplayer = thirddisplayplayer = fourthdisplayplayer = p;
else if (!spectator && splitscreen < 3) { /*else if (!spectator && splitscreen < 3) {
if (splitscreen == 0) { if (splitscreen == 0) {
splitscreen = 1; splitscreen = 1;
secondarydisplayplayer = p; secondarydisplayplayer = p;
@ -6258,7 +6324,7 @@ void G_DoPlayDemo(char *defdemoname)
splitscreen = 3; splitscreen = 3;
fourthdisplayplayer = p; fourthdisplayplayer = p;
} }
} }*/
playeringame[p] = true; playeringame[p] = true;
players[p].spectator = spectator; players[p].spectator = spectator;
@ -6288,6 +6354,7 @@ void G_DoPlayDemo(char *defdemoname)
p = READUINT8(demo_p); p = READUINT8(demo_p);
} }
splitscreen = 0;
R_ExecuteSetViewSize(); R_ExecuteSetViewSize();
} }

View file

@ -226,7 +226,7 @@ void G_EndGame(void); // moved from y_inter.c/h and renamed
void G_Ticker(boolean run); void G_Ticker(boolean run);
boolean G_Responder(event_t *ev); boolean G_Responder(event_t *ev);
void G_ResetViews(void); void G_ResetViews(UINT8 viewnum);
void G_AddPlayer(INT32 playernum); void G_AddPlayer(INT32 playernum);