Automatically load splits up to new viewpoint

Basically, you can start viewing your third split and the second one views
another!
This commit is contained in:
james 2019-02-04 17:58:55 -08:00
parent 67d6ee3b12
commit ac9356a02b

View file

@ -1823,14 +1823,6 @@ 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)
{
secondarydisplayplayer = displayplayer;
G_ResetViews(2);
return true;
}
secondarydisplayplayer++; secondarydisplayplayer++;
G_ResetViews(2); G_ResetViews(2);
@ -1838,14 +1830,6 @@ boolean G_Responder(event_t *ev)
} }
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)
{
thirddisplayplayer = displayplayer;
G_ResetViews(3);
return true;
}
thirddisplayplayer++; thirddisplayplayer++;
G_ResetViews(3); G_ResetViews(3);
@ -1853,14 +1837,6 @@ boolean G_Responder(event_t *ev)
} }
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)
{
fourthdisplayplayer = displayplayer;
G_ResetViews(4);
return true;
}
fourthdisplayplayer++; fourthdisplayplayer++;
G_ResetViews(4); G_ResetViews(4);
@ -2156,65 +2132,69 @@ G_GetDisplayplayerPtr (UINT8 viewnum)
return &displayplayer; return &displayplayer;
} }
/* Reset only one view */
static void
G_ResetView (UINT8 viewnum)
{
INT32 *displayplayerp;
camera_t *camerap;
INT32 newdisplayplayer;
UINT8 viewd, splits;
splits = splitscreen+1;
displayplayerp = (G_GetDisplayplayerPtr(viewnum));
newdisplayplayer = (*displayplayerp);
(*displayplayerp) = INT32_MAX;
(*displayplayerp) = G_FindView(newdisplayplayer);
if (viewnum > splits)
{
splitscreen = viewnum-1;
for (viewd = splits+1; viewd < viewnum; ++viewd)
{
(*(G_GetDisplayplayerPtr(viewd))) = INT32_MAX;/* ensure clean */
}
/* Initialise views up from current splitscreen. */
for (viewd = splits+1 ;; )
{
displayplayerp = (G_GetDisplayplayerPtr(viewd));
camerap = (P_GetCameraPtr(viewd));
P_ResetCamera(&players[(*displayplayerp)], camerap);
R_ExecuteSetViewSize();
if (++viewd > viewnum)
break;
/* Correct up to but viewnum */
(*displayplayerp) = G_FindView((*displayplayerp));
}
}
}
// //
// G_ResetViews // G_ResetViews
// Ensures all viewpoints are valid // Ensures all viewpoints are valid
// //
void G_ResetViews(UINT8 viewnum) void G_ResetViews(UINT8 viewnum)
{ {
INT32 tempplayer; UINT8 splits = splitscreen+1;
INT32 *displayplayerp;
camera_t *camerap;
if (!viewnum || viewnum == 1) if (viewnum == 0)
{ {
tempplayer = displayplayer; while (viewnum++ < splits)
displayplayer = INT32_MAX;
displayplayer = G_FindView(tempplayer);
}
if (viewnum > 1 && multiplayer && demoplayback)
if (viewnum == splitscreen+2)
{ {
splitscreen = viewnum-1; G_ResetView(viewnum);
displayplayerp = (G_GetDisplayplayerPtr(viewnum));
camerap = (P_GetCameraPtr(viewnum));
P_ResetCamera(&players[(*displayplayerp)], camerap);
R_ExecuteSetViewSize();
}
if (splitscreen && demoplayback)
{
if (!viewnum || viewnum == 2)
{
tempplayer = secondarydisplayplayer;
secondarydisplayplayer = INT32_MAX;
secondarydisplayplayer = G_FindView(tempplayer);
}
if (splitscreen >= 2)
{
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);
}
} }
} }
else
{
G_ResetView(viewnum);
} }
if (demoplayback) if (demoplayback)
consoleplayer = displayplayer; consoleplayer = displayplayer;
} }