Make the order of displayplayers irrelevant and split splitscreen into splitscreen and r_splitscreen

This commit is contained in:
James R 2020-02-20 21:46:55 -08:00
parent 2c67c97c58
commit f164320c88
31 changed files with 404 additions and 387 deletions

View file

@ -2718,8 +2718,8 @@ void CL_RemovePlayer(INT32 playernum, INT32 reason)
RemoveAdminPlayer(playernum); // don't stay admin after you're gone RemoveAdminPlayer(playernum); // don't stay admin after you're gone
} }
if (playernum == displayplayers[0] && !demo.playback) if (playernum == displayplayers[localdisplayplayers[0]] && !demo.playback)
displayplayers[0] = consoleplayer; // don't look through someone's view who isn't there displayplayers[localdisplayplayers[0]] = consoleplayer; // don't look through someone's view who isn't there
#ifdef HAVE_BLUA #ifdef HAVE_BLUA
LUA_InvalidatePlayer(&players[playernum]); LUA_InvalidatePlayer(&players[playernum]);
@ -3503,7 +3503,10 @@ static void Got_AddPlayer(UINT8 **p, INT32 playernum)
{ {
consoleplayer = newplayernum; consoleplayer = newplayernum;
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++) for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
{
displayplayers[i] = newplayernum; displayplayers[i] = newplayernum;
localdisplayplayers[i] = i;
}
DEBFILE("spawning me\n"); DEBFILE("spawning me\n");
} }
@ -3705,6 +3708,7 @@ void SV_StopServer(void)
D_Clearticcmd(i); D_Clearticcmd(i);
consoleplayer = 0; consoleplayer = 0;
localdisplayplayers[0] = 0;
cl_mode = CL_SEARCHING; cl_mode = CL_SEARCHING;
maketic = gametic+1; maketic = gametic+1;
neededtic = maketic; neededtic = maketic;

View file

@ -416,7 +416,7 @@ static void D_Display(void)
// draw the view directly // draw the view directly
if (cv_renderview.value && !automapactive) if (cv_renderview.value && !automapactive)
{ {
for (i = 0; i <= splitscreen; i++) for (i = 0; i <= r_splitscreen; i++)
{ {
if (players[displayplayers[i]].mo || players[displayplayers[i]].playerstate == PST_DEAD) if (players[displayplayers[i]].mo || players[displayplayers[i]].playerstate == PST_DEAD)
{ {
@ -443,7 +443,7 @@ static void D_Display(void)
switch (i) switch (i)
{ {
case 1: case 1:
if (splitscreen > 1) if (r_splitscreen > 1)
{ {
viewwindowx = viewwidth; viewwindowx = viewwidth;
viewwindowy = 0; viewwindowy = 0;
@ -482,7 +482,7 @@ static void D_Display(void)
if (rendermode == render_soft) if (rendermode == render_soft)
{ {
for (i = 0; i <= splitscreen; i++) for (i = 0; i <= r_splitscreen; i++)
{ {
if (postimgtype[i]) if (postimgtype[i])
V_DoPostProcessor(i, postimgtype[i], postimgparam[i]); V_DoPostProcessor(i, postimgtype[i], postimgparam[i]);
@ -780,6 +780,7 @@ void D_StartTitle(void)
gameaction = ga_nothing; gameaction = ga_nothing;
memset(displayplayers, 0, sizeof(displayplayers)); memset(displayplayers, 0, sizeof(displayplayers));
memset(localdisplayplayers, 0, sizeof localdisplayplayers);
consoleplayer = 0; consoleplayer = 0;
//demosequence = -1; //demosequence = -1;
gametype = GT_RACE; // SRB2kart gametype = GT_RACE; // SRB2kart

View file

@ -1180,11 +1180,11 @@ static void CleanupPlayerName(INT32 playernum, const char *newname)
// spaces may have been removed // spaces may have been removed
if (playernum == consoleplayer) if (playernum == consoleplayer)
CV_StealthSet(&cv_playername, tmpname); CV_StealthSet(&cv_playername, tmpname);
else if (playernum == displayplayers[1] || (!netgame && playernum == 1)) else if (playernum == displayplayers[localdisplayplayers[1]] || (!netgame && playernum == 1))
CV_StealthSet(&cv_playername2, tmpname); CV_StealthSet(&cv_playername2, tmpname);
else if (playernum == displayplayers[2] || (!netgame && playernum == 2)) else if (playernum == displayplayers[localdisplayplayers[2]] || (!netgame && playernum == 2))
CV_StealthSet(&cv_playername3, tmpname); CV_StealthSet(&cv_playername3, tmpname);
else if (playernum == displayplayers[3] || (!netgame && playernum == 3)) else if (playernum == displayplayers[localdisplayplayers[3]] || (!netgame && playernum == 3))
CV_StealthSet(&cv_playername4, tmpname); CV_StealthSet(&cv_playername4, tmpname);
else I_Assert(((void)"CleanupPlayerName used on non-local player", 0)); else I_Assert(((void)"CleanupPlayerName used on non-local player", 0));
@ -1292,11 +1292,11 @@ static void ForceAllSkins(INT32 forcedskin)
{ {
if (i == consoleplayer) if (i == consoleplayer)
CV_StealthSet(&cv_skin, skins[forcedskin].name); CV_StealthSet(&cv_skin, skins[forcedskin].name);
else if (i == displayplayers[1]) else if (i == displayplayers[localdisplayplayers[1]])
CV_StealthSet(&cv_skin2, skins[forcedskin].name); CV_StealthSet(&cv_skin2, skins[forcedskin].name);
else if (i == displayplayers[2]) else if (i == displayplayers[localdisplayplayers[2]])
CV_StealthSet(&cv_skin3, skins[forcedskin].name); CV_StealthSet(&cv_skin3, skins[forcedskin].name);
else if (i == displayplayers[3]) else if (i == displayplayers[localdisplayplayers[3]])
CV_StealthSet(&cv_skin4, skins[forcedskin].name); CV_StealthSet(&cv_skin4, skins[forcedskin].name);
} }
} }
@ -1431,8 +1431,8 @@ static void SendNameAndColor2(void)
if (splitscreen < 1 && !botingame) if (splitscreen < 1 && !botingame)
return; // can happen if skin2/color2/name2 changed return; // can happen if skin2/color2/name2 changed
if (displayplayers[1] != consoleplayer) if (displayplayers[localdisplayplayers[1]] != consoleplayer)
secondplaya = displayplayers[1]; secondplaya = displayplayers[localdisplayplayers[1]];
else if (!netgame) // HACK else if (!netgame) // HACK
secondplaya = 1; secondplaya = 1;
@ -1520,14 +1520,14 @@ static void SendNameAndColor2(void)
snac2pending++; snac2pending++;
// Don't change name if muted // Don't change name if muted
if (cv_mute.value && !(server || IsPlayerAdmin(displayplayers[1]))) if (cv_mute.value && !(server || IsPlayerAdmin(displayplayers[localdisplayplayers[1]])))
CV_StealthSet(&cv_playername2, player_names[displayplayers[1]]); CV_StealthSet(&cv_playername2, player_names[displayplayers[localdisplayplayers[1]]]);
else // Cleanup name if changing it else // Cleanup name if changing it
CleanupPlayerName(displayplayers[1], cv_playername2.zstring); CleanupPlayerName(displayplayers[localdisplayplayers[1]], cv_playername2.zstring);
// Don't change skin if the server doesn't want you to. // Don't change skin if the server doesn't want you to.
if (!CanChangeSkin(displayplayers[1])) if (!CanChangeSkin(displayplayers[localdisplayplayers[1]]))
CV_StealthSet(&cv_skin2, skins[players[displayplayers[1]].skin].name); CV_StealthSet(&cv_skin2, skins[players[displayplayers[localdisplayplayers[1]]].skin].name);
// check if player has the skin loaded (cv_skin2 may have // check if player has the skin loaded (cv_skin2 may have
// the name of a skin that was available in the previous game) // the name of a skin that was available in the previous game)
@ -1554,8 +1554,8 @@ static void SendNameAndColor3(void)
if (splitscreen < 2) if (splitscreen < 2)
return; // can happen if skin3/color3/name3 changed return; // can happen if skin3/color3/name3 changed
if (displayplayers[2] != consoleplayer) if (displayplayers[localdisplayplayers[2]] != consoleplayer)
thirdplaya = displayplayers[2]; thirdplaya = displayplayers[localdisplayplayers[2]];
else if (!netgame) // HACK else if (!netgame) // HACK
thirdplaya = 2; thirdplaya = 2;
@ -1635,14 +1635,14 @@ static void SendNameAndColor3(void)
snac3pending++; snac3pending++;
// Don't change name if muted // Don't change name if muted
if (cv_mute.value && !(server || IsPlayerAdmin(displayplayers[2]))) if (cv_mute.value && !(server || IsPlayerAdmin(displayplayers[localdisplayplayers[2]])))
CV_StealthSet(&cv_playername3, player_names[displayplayers[2]]); CV_StealthSet(&cv_playername3, player_names[displayplayers[localdisplayplayers[2]]]);
else // Cleanup name if changing it else // Cleanup name if changing it
CleanupPlayerName(displayplayers[2], cv_playername3.zstring); CleanupPlayerName(displayplayers[localdisplayplayers[2]], cv_playername3.zstring);
// Don't change skin if the server doesn't want you to. // Don't change skin if the server doesn't want you to.
if (!CanChangeSkin(displayplayers[2])) if (!CanChangeSkin(displayplayers[localdisplayplayers[2]]))
CV_StealthSet(&cv_skin3, skins[players[displayplayers[2]].skin].name); CV_StealthSet(&cv_skin3, skins[players[displayplayers[localdisplayplayers[2]]].skin].name);
// check if player has the skin loaded (cv_skin3 may have // check if player has the skin loaded (cv_skin3 may have
// the name of a skin that was available in the previous game) // the name of a skin that was available in the previous game)
@ -1669,8 +1669,8 @@ static void SendNameAndColor4(void)
if (splitscreen < 3) if (splitscreen < 3)
return; // can happen if skin4/color4/name4 changed return; // can happen if skin4/color4/name4 changed
if (displayplayers[3] != consoleplayer) if (displayplayers[localdisplayplayers[3]] != consoleplayer)
fourthplaya = displayplayers[3]; fourthplaya = displayplayers[localdisplayplayers[3]];
else if (!netgame) // HACK else if (!netgame) // HACK
fourthplaya = 3; fourthplaya = 3;
@ -1758,14 +1758,14 @@ static void SendNameAndColor4(void)
snac4pending++; snac4pending++;
// Don't change name if muted // Don't change name if muted
if (cv_mute.value && !(server || IsPlayerAdmin(displayplayers[3]))) if (cv_mute.value && !(server || IsPlayerAdmin(displayplayers[localdisplayplayers[3]])))
CV_StealthSet(&cv_playername4, player_names[displayplayers[3]]); CV_StealthSet(&cv_playername4, player_names[displayplayers[localdisplayplayers[3]]]);
else // Cleanup name if changing it else // Cleanup name if changing it
CleanupPlayerName(displayplayers[3], cv_playername4.zstring); CleanupPlayerName(displayplayers[localdisplayplayers[3]], cv_playername4.zstring);
// Don't change skin if the server doesn't want you to. // Don't change skin if the server doesn't want you to.
if (!CanChangeSkin(displayplayers[3])) if (!CanChangeSkin(displayplayers[localdisplayplayers[3]]))
CV_StealthSet(&cv_skin4, skins[players[displayplayers[3]].skin].name); CV_StealthSet(&cv_skin4, skins[players[displayplayers[localdisplayplayers[3]]].skin].name);
// check if player has the skin loaded (cv_skin4 may have // check if player has the skin loaded (cv_skin4 may have
// the name of a skin that was available in the previous game) // the name of a skin that was available in the previous game)
@ -1796,11 +1796,11 @@ static void Got_NameAndColor(UINT8 **cp, INT32 playernum)
if (playernum == consoleplayer) if (playernum == consoleplayer)
snacpending--; // TODO: make snacpending an array instead of 4 separate vars? snacpending--; // TODO: make snacpending an array instead of 4 separate vars?
else if (playernum == displayplayers[1]) else if (playernum == displayplayers[localdisplayplayers[1]])
snac2pending--; snac2pending--;
else if (playernum == displayplayers[2]) else if (playernum == displayplayers[localdisplayplayers[2]])
snac3pending--; snac3pending--;
else if (playernum == displayplayers[3]) else if (playernum == displayplayers[localdisplayplayers[3]])
snac4pending--; snac4pending--;
#ifdef PARANOIA #ifdef PARANOIA
@ -1823,8 +1823,8 @@ static void Got_NameAndColor(UINT8 **cp, INT32 playernum)
demo_extradata[playernum] |= DXD_COLOR; demo_extradata[playernum] |= DXD_COLOR;
// normal player colors // normal player colors
if (server && (p != &players[consoleplayer] && p != &players[displayplayers[1]] if (server && (p != &players[consoleplayer] && p != &players[displayplayers[localdisplayplayers[1]]]
&& p != &players[displayplayers[2]] && p != &players[displayplayers[3]])) && p != &players[displayplayers[localdisplayplayers[2]]] && p != &players[displayplayers[localdisplayplayers[3]]]))
{ {
boolean kick = false; boolean kick = false;
@ -1861,11 +1861,11 @@ static void Got_NameAndColor(UINT8 **cp, INT32 playernum)
if (playernum == consoleplayer) if (playernum == consoleplayer)
CV_StealthSet(&cv_skin, skins[forcedskin].name); CV_StealthSet(&cv_skin, skins[forcedskin].name);
else if (playernum == displayplayers[1]) else if (playernum == displayplayers[localdisplayplayers[1]])
CV_StealthSet(&cv_skin2, skins[forcedskin].name); CV_StealthSet(&cv_skin2, skins[forcedskin].name);
else if (playernum == displayplayers[2]) else if (playernum == displayplayers[localdisplayplayers[2]])
CV_StealthSet(&cv_skin3, skins[forcedskin].name); CV_StealthSet(&cv_skin3, skins[forcedskin].name);
else if (playernum == displayplayers[3]) else if (playernum == displayplayers[localdisplayplayers[3]])
CV_StealthSet(&cv_skin4, skins[forcedskin].name); CV_StealthSet(&cv_skin4, skins[forcedskin].name);
} }
else else
@ -1988,7 +1988,7 @@ void D_SendPlayerConfig(void)
// Only works for displayplayer, sorry! // Only works for displayplayer, sorry!
static void Command_ResetCamera_f(void) static void Command_ResetCamera_f(void)
{ {
P_ResetCamera(&players[displayplayers[0]], &camera[0]); P_ResetCamera(&players[displayplayers[localdisplayplayers[0]]], &camera[0]);
} }
/* Consider replacing nametonum with this */ /* Consider replacing nametonum with this */
@ -2144,7 +2144,7 @@ static void Command_View_f(void)
} }
else/* print current view */ else/* print current view */
{ {
if (splitscreen < viewnum-1)/* We can't see those guys! */ if (r_splitscreen < viewnum-1)/* We can't see those guys! */
return; return;
PRINTVIEWPOINT ("Currently ",) PRINTVIEWPOINT ("Currently ",)
} }
@ -2169,7 +2169,7 @@ static void Command_SetViews_f(void)
return; return;
} }
splits = splitscreen+1; splits = r_splitscreen+1;
newsplits = atoi(COM_Argv(1)); newsplits = atoi(COM_Argv(1));
newsplits = min(max(newsplits, 1), 4); newsplits = min(max(newsplits, 1), 4);
@ -2177,7 +2177,7 @@ static void Command_SetViews_f(void)
G_AdjustView(newsplits, 0, true); G_AdjustView(newsplits, 0, true);
else else
{ {
splitscreen = newsplits-1; r_splitscreen = newsplits-1;
R_ExecuteSetViewSize(); R_ExecuteSetViewSize();
} }
} }
@ -2426,7 +2426,7 @@ void D_ModifyClientVote(SINT8 voted, UINT8 splitplayer)
UINT8 player = consoleplayer; UINT8 player = consoleplayer;
if (splitplayer > 0) if (splitplayer > 0)
player = displayplayers[splitplayer]; player = displayplayers[localdisplayplayers[splitplayer]];
WRITESINT8(p, voted); WRITESINT8(p, voted);
WRITEUINT8(p, player); WRITEUINT8(p, player);
@ -3078,11 +3078,11 @@ static void Command_Teamchange2_f(void)
return; return;
} }
if (players[displayplayers[1]].spectator) if (players[displayplayers[localdisplayplayers[1]]].spectator)
error = !(NetPacket.packet.newteam || (players[displayplayers[1]].pflags & PF_WANTSTOJOIN)); error = !(NetPacket.packet.newteam || (players[displayplayers[localdisplayplayers[1]]].pflags & PF_WANTSTOJOIN));
else if (G_GametypeHasTeams()) else if (G_GametypeHasTeams())
error = (NetPacket.packet.newteam == (unsigned)players[displayplayers[1]].ctfteam); error = (NetPacket.packet.newteam == (unsigned)players[displayplayers[localdisplayplayers[1]]].ctfteam);
else if (G_GametypeHasSpectators() && !players[displayplayers[1]].spectator) else if (G_GametypeHasSpectators() && !players[displayplayers[localdisplayplayers[1]]].spectator)
error = (NetPacket.packet.newteam == 3); error = (NetPacket.packet.newteam == 3);
#ifdef PARANOIA #ifdef PARANOIA
else else
@ -3169,11 +3169,11 @@ static void Command_Teamchange3_f(void)
return; return;
} }
if (players[displayplayers[2]].spectator) if (players[displayplayers[localdisplayplayers[2]]].spectator)
error = !(NetPacket.packet.newteam || (players[displayplayers[2]].pflags & PF_WANTSTOJOIN)); error = !(NetPacket.packet.newteam || (players[displayplayers[localdisplayplayers[2]]].pflags & PF_WANTSTOJOIN));
else if (G_GametypeHasTeams()) else if (G_GametypeHasTeams())
error = (NetPacket.packet.newteam == (unsigned)players[displayplayers[2]].ctfteam); error = (NetPacket.packet.newteam == (unsigned)players[displayplayers[localdisplayplayers[2]]].ctfteam);
else if (G_GametypeHasSpectators() && !players[displayplayers[2]].spectator) else if (G_GametypeHasSpectators() && !players[displayplayers[localdisplayplayers[2]]].spectator)
error = (NetPacket.packet.newteam == 3); error = (NetPacket.packet.newteam == 3);
#ifdef PARANOIA #ifdef PARANOIA
else else
@ -3260,11 +3260,11 @@ static void Command_Teamchange4_f(void)
return; return;
} }
if (players[displayplayers[3]].spectator) if (players[displayplayers[localdisplayplayers[3]]].spectator)
error = !(NetPacket.packet.newteam || (players[displayplayers[3]].pflags & PF_WANTSTOJOIN)); error = !(NetPacket.packet.newteam || (players[displayplayers[localdisplayplayers[3]]].pflags & PF_WANTSTOJOIN));
else if (G_GametypeHasTeams()) else if (G_GametypeHasTeams())
error = (NetPacket.packet.newteam == (unsigned)players[displayplayers[3]].ctfteam); error = (NetPacket.packet.newteam == (unsigned)players[displayplayers[localdisplayplayers[3]]].ctfteam);
else if (G_GametypeHasSpectators() && !players[displayplayers[3]].spectator) else if (G_GametypeHasSpectators() && !players[displayplayers[localdisplayplayers[3]]].spectator)
error = (NetPacket.packet.newteam == 3); error = (NetPacket.packet.newteam == 3);
#ifdef PARANOIA #ifdef PARANOIA
else else
@ -3661,8 +3661,8 @@ static void Got_Teamchange(UINT8 **cp, INT32 playernum)
HU_AddChatText(va("\x82*%s became a spectator.", player_names[playernum]), false); // "entered the game" text was moved to P_SpectatorJoinGame HU_AddChatText(va("\x82*%s became a spectator.", player_names[playernum]), false); // "entered the game" text was moved to P_SpectatorJoinGame
//reset view if you are changed, or viewing someone who was changed. //reset view if you are changed, or viewing someone who was changed.
if (playernum == consoleplayer || displayplayers[0] == playernum) if (playernum == consoleplayer || displayplayers[localdisplayplayers[0]] == playernum)
displayplayers[0] = consoleplayer; displayplayers[localdisplayplayers[0]] = consoleplayer;
if (G_GametypeHasTeams()) if (G_GametypeHasTeams())
{ {
@ -5299,7 +5299,7 @@ static void Got_PickVotecmd(UINT8 **cp, INT32 playernum)
*/ */
static void Command_Displayplayer_f(void) static void Command_Displayplayer_f(void)
{ {
CONS_Printf(M_GetText("Displayplayer is %d\n"), displayplayers[0]); CONS_Printf(M_GetText("Displayplayer is %d\n"), displayplayers[localdisplayplayers[0]]);
} }
/** Quits a game and returns to the title screen. /** Quits a game and returns to the title screen.
@ -5494,7 +5494,7 @@ static void Name2_OnChange(void)
if (cv_mute.value) //Secondary player can't be admin. if (cv_mute.value) //Secondary player can't be admin.
{ {
CONS_Alert(CONS_NOTICE, M_GetText("You may not change your name when chat is muted.\n")); CONS_Alert(CONS_NOTICE, M_GetText("You may not change your name when chat is muted.\n"));
CV_StealthSet(&cv_playername2, player_names[displayplayers[1]]); CV_StealthSet(&cv_playername2, player_names[displayplayers[localdisplayplayers[1]]]);
} }
else else
SendNameAndColor2(); SendNameAndColor2();
@ -5505,7 +5505,7 @@ static void Name3_OnChange(void)
if (cv_mute.value) //Third player can't be admin. if (cv_mute.value) //Third player can't be admin.
{ {
CONS_Alert(CONS_NOTICE, M_GetText("You may not change your name when chat is muted.\n")); CONS_Alert(CONS_NOTICE, M_GetText("You may not change your name when chat is muted.\n"));
CV_StealthSet(&cv_playername3, player_names[displayplayers[2]]); CV_StealthSet(&cv_playername3, player_names[displayplayers[localdisplayplayers[2]]]);
} }
else else
SendNameAndColor3(); SendNameAndColor3();
@ -5516,7 +5516,7 @@ static void Name4_OnChange(void)
if (cv_mute.value) //Secondary player can't be admin. if (cv_mute.value) //Secondary player can't be admin.
{ {
CONS_Alert(CONS_NOTICE, M_GetText("You may not change your name when chat is muted.\n")); CONS_Alert(CONS_NOTICE, M_GetText("You may not change your name when chat is muted.\n"));
CV_StealthSet(&cv_playername4, player_names[displayplayers[3]]); CV_StealthSet(&cv_playername4, player_names[displayplayers[localdisplayplayers[3]]]);
} }
else else
SendNameAndColor4(); SendNameAndColor4();
@ -5557,12 +5557,12 @@ static void Skin2_OnChange(void)
if (!Playing() || !splitscreen) if (!Playing() || !splitscreen)
return; // do whatever you want return; // do whatever you want
if (CanChangeSkin(displayplayers[1]) && !P_PlayerMoving(displayplayers[1])) if (CanChangeSkin(displayplayers[localdisplayplayers[1]]) && !P_PlayerMoving(displayplayers[localdisplayplayers[1]]))
SendNameAndColor2(); SendNameAndColor2();
else else
{ {
CONS_Alert(CONS_NOTICE, M_GetText("You can't change your skin at the moment.\n")); CONS_Alert(CONS_NOTICE, M_GetText("You can't change your skin at the moment.\n"));
CV_StealthSet(&cv_skin2, skins[players[displayplayers[1]].skin].name); CV_StealthSet(&cv_skin2, skins[players[displayplayers[localdisplayplayers[1]]].skin].name);
} }
} }
@ -5571,12 +5571,12 @@ static void Skin3_OnChange(void)
if (!Playing() || splitscreen < 2) if (!Playing() || splitscreen < 2)
return; // do whatever you want return; // do whatever you want
if (CanChangeSkin(displayplayers[2]) && !P_PlayerMoving(displayplayers[2])) if (CanChangeSkin(displayplayers[localdisplayplayers[2]]) && !P_PlayerMoving(displayplayers[localdisplayplayers[2]]))
SendNameAndColor3(); SendNameAndColor3();
else else
{ {
CONS_Alert(CONS_NOTICE, M_GetText("You can't change your skin at the moment.\n")); CONS_Alert(CONS_NOTICE, M_GetText("You can't change your skin at the moment.\n"));
CV_StealthSet(&cv_skin3, skins[players[displayplayers[2]].skin].name); CV_StealthSet(&cv_skin3, skins[players[displayplayers[localdisplayplayers[2]]].skin].name);
} }
} }
@ -5585,12 +5585,12 @@ static void Skin4_OnChange(void)
if (!Playing() || splitscreen < 3) if (!Playing() || splitscreen < 3)
return; // do whatever you want return; // do whatever you want
if (CanChangeSkin(displayplayers[3]) && !P_PlayerMoving(displayplayers[3])) if (CanChangeSkin(displayplayers[localdisplayplayers[3]]) && !P_PlayerMoving(displayplayers[localdisplayplayers[3]]))
SendNameAndColor4(); SendNameAndColor4();
else else
{ {
CONS_Alert(CONS_NOTICE, M_GetText("You can't change your skin at the moment.\n")); CONS_Alert(CONS_NOTICE, M_GetText("You can't change your skin at the moment.\n"));
CV_StealthSet(&cv_skin4, skins[players[displayplayers[3]].skin].name); CV_StealthSet(&cv_skin4, skins[players[displayplayers[localdisplayplayers[3]]].skin].name);
} }
} }
@ -5631,7 +5631,7 @@ static void Color2_OnChange(void)
if (!Playing() || !splitscreen) if (!Playing() || !splitscreen)
return; // do whatever you want return; // do whatever you want
if (!P_PlayerMoving(displayplayers[1])) if (!P_PlayerMoving(displayplayers[localdisplayplayers[1]]))
{ {
// Color change menu scrolling fix is no longer necessary // Color change menu scrolling fix is no longer necessary
SendNameAndColor2(); SendNameAndColor2();
@ -5639,7 +5639,7 @@ static void Color2_OnChange(void)
else else
{ {
CV_StealthSetValue(&cv_playercolor2, CV_StealthSetValue(&cv_playercolor2,
players[displayplayers[1]].skincolor); players[displayplayers[localdisplayplayers[1]]].skincolor);
} }
} }
@ -5648,7 +5648,7 @@ static void Color3_OnChange(void)
if (!Playing() || splitscreen < 2) if (!Playing() || splitscreen < 2)
return; // do whatever you want return; // do whatever you want
if (!P_PlayerMoving(displayplayers[2])) if (!P_PlayerMoving(displayplayers[localdisplayplayers[2]]))
{ {
// Color change menu scrolling fix is no longer necessary // Color change menu scrolling fix is no longer necessary
SendNameAndColor3(); SendNameAndColor3();
@ -5656,7 +5656,7 @@ static void Color3_OnChange(void)
else else
{ {
CV_StealthSetValue(&cv_playercolor3, CV_StealthSetValue(&cv_playercolor3,
players[displayplayers[2]].skincolor); players[displayplayers[localdisplayplayers[2]]].skincolor);
} }
} }
@ -5665,7 +5665,7 @@ static void Color4_OnChange(void)
if (!Playing() || splitscreen < 3) if (!Playing() || splitscreen < 3)
return; // do whatever you want return; // do whatever you want
if (!P_PlayerMoving(displayplayers[3])) if (!P_PlayerMoving(displayplayers[localdisplayplayers[3]]))
{ {
// Color change menu scrolling fix is no longer necessary // Color change menu scrolling fix is no longer necessary
SendNameAndColor4(); SendNameAndColor4();
@ -5673,7 +5673,7 @@ static void Color4_OnChange(void)
else else
{ {
CV_StealthSetValue(&cv_playercolor4, CV_StealthSetValue(&cv_playercolor4,
players[displayplayers[3]].skincolor); players[displayplayers[localdisplayplayers[3]]].skincolor);
} }
} }

View file

@ -82,6 +82,7 @@ extern INT16 gametype;
#define MAXSPLITSCREENPLAYERS 4 // Max number of players on a single computer #define MAXSPLITSCREENPLAYERS 4 // Max number of players on a single computer
extern UINT8 splitscreen; extern UINT8 splitscreen;
extern int r_splitscreen;
extern boolean circuitmap; // Does this level have 'circuit mode'? extern boolean circuitmap; // Does this level have 'circuit mode'?
extern boolean fromlevelselect; extern boolean fromlevelselect;
@ -122,6 +123,8 @@ extern boolean gamedataloaded;
// Player taking events, and displaying. // Player taking events, and displaying.
extern INT32 consoleplayer; extern INT32 consoleplayer;
extern INT32 displayplayers[MAXSPLITSCREENPLAYERS]; extern INT32 displayplayers[MAXSPLITSCREENPLAYERS];
/* displayplayers[localdisplayplayers[0]] = consoleplayer */
extern INT32 localdisplayplayers[MAXSPLITSCREENPLAYERS];
// Maps of special importance // Maps of special importance
extern INT16 spstage_start; extern INT16 spstage_start;

View file

@ -115,6 +115,7 @@ player_t players[MAXPLAYERS];
INT32 consoleplayer; // player taking events and displaying INT32 consoleplayer; // player taking events and displaying
INT32 displayplayers[MAXSPLITSCREENPLAYERS]; // view being displayed INT32 displayplayers[MAXSPLITSCREENPLAYERS]; // view being displayed
INT32 localdisplayplayers[MAXSPLITSCREENPLAYERS];
tic_t gametic; tic_t gametic;
tic_t levelstarttic; // gametic at level start tic_t levelstarttic; // gametic at level start
@ -1256,7 +1257,7 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
if (ssplayer == 1) if (ssplayer == 1)
player = &players[consoleplayer]; player = &players[consoleplayer];
else else
player = &players[displayplayers[ssplayer-1]]; player = &players[displayplayers[localdisplayplayers[ssplayer-1]]];
if (ssplayer == 2) if (ssplayer == 2)
thiscam = (player->bot == 2 ? &camera[0] : &camera[ssplayer-1]); thiscam = (player->bot == 2 ? &camera[0] : &camera[ssplayer-1]);
@ -1595,8 +1596,8 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
//Reset away view if a command is given. //Reset away view if a command is given.
if ((cmd->forwardmove || cmd->sidemove || cmd->buttons) if ((cmd->forwardmove || cmd->sidemove || cmd->buttons)
&& displayplayers[0] != consoleplayer && ssplayer == 1) && displayplayers[localdisplayplayers[0]] != consoleplayer && ssplayer == 1)
displayplayers[0] = consoleplayer; displayplayers[localdisplayplayers[0]] = consoleplayer;
} }
@ -1748,12 +1749,12 @@ void G_DoLoadLevel(boolean resetplayer)
if (!resetplayer) if (!resetplayer)
P_FindEmerald(); P_FindEmerald();
displayplayers[0] = consoleplayer; // view the guy you are playing displayplayers[localdisplayplayers[0]] = consoleplayer; // view the guy you are playing
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++) for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
{ {
if (i > 0 && !(i == 1 && botingame) && splitscreen < i) if (i > 0 && !(i == 1 && botingame) && r_splitscreen < i)
displayplayers[i] = consoleplayer; displayplayers[localdisplayplayers[i]] = consoleplayer;
} }
gameaction = ga_nothing; gameaction = ga_nothing;
@ -1761,10 +1762,10 @@ void G_DoLoadLevel(boolean resetplayer)
Z_CheckHeap(-2); Z_CheckHeap(-2);
#endif #endif
for (i = 0; i <= splitscreen; i++) for (i = 0; i <= r_splitscreen; i++)
{ {
if (camera[i].chase) if (camera[i].chase)
P_ResetCamera(&players[displayplayers[i]], &camera[i]); P_ResetCamera(&players[displayplayers[localdisplayplayers[i]]], &camera[i]);
} }
// clear cmd building stuff // clear cmd building stuff
@ -1874,8 +1875,8 @@ boolean G_Responder(event_t *ev)
if (gamestate == GS_LEVEL && ev->type == ev_keydown if (gamestate == GS_LEVEL && ev->type == ev_keydown
&& (ev->data1 == KEY_F12 || ev->data1 == gamecontrol[gc_viewpoint][0] || ev->data1 == gamecontrol[gc_viewpoint][1])) && (ev->data1 == KEY_F12 || ev->data1 == gamecontrol[gc_viewpoint][0] || ev->data1 == gamecontrol[gc_viewpoint][1]))
{ {
if (!demo.playback && (splitscreen || !netgame)) if (!demo.playback && (r_splitscreen || !netgame))
displayplayers[0] = consoleplayer; displayplayers[localdisplayplayers[0]] = consoleplayer;
else else
{ {
G_AdjustView(1, 1, true); G_AdjustView(1, 1, true);
@ -2139,7 +2140,7 @@ boolean G_CanView(INT32 playernum, UINT8 viewnum, boolean onlyactive)
if (!(onlyactive ? G_CouldView(playernum) : (playeringame[playernum] && !players[playernum].spectator))) if (!(onlyactive ? G_CouldView(playernum) : (playeringame[playernum] && !players[playernum].spectator)))
return false; return false;
splits = splitscreen+1; splits = r_splitscreen+1;
if (viewnum > splits) if (viewnum > splits)
viewnum = splits; viewnum = splits;
@ -2210,7 +2211,7 @@ void G_ResetView(UINT8 viewnum, INT32 playernum, boolean onlyactive)
INT32 olddisplayplayer; INT32 olddisplayplayer;
INT32 playersviewable; INT32 playersviewable;
splits = splitscreen+1; splits = r_splitscreen+1;
/* Promote splits */ /* Promote splits */
if (viewnum > splits) if (viewnum > splits)
@ -2221,7 +2222,7 @@ void G_ResetView(UINT8 viewnum, INT32 playernum, boolean onlyactive)
if (viewnum > playersviewable) if (viewnum > playersviewable)
viewnum = playersviewable; viewnum = playersviewable;
splitscreen = viewnum-1; r_splitscreen = viewnum-1;
/* Prepare extra views for G_FindView to pass. */ /* Prepare extra views for G_FindView to pass. */
for (viewd = splits+1; viewd < viewnum; ++viewd) for (viewd = splits+1; viewd < viewnum; ++viewd)
@ -2294,14 +2295,14 @@ void G_ResetViews(void)
INT32 playersviewable; INT32 playersviewable;
splits = splitscreen+1; splits = r_splitscreen+1;
playersviewable = G_CountPlayersPotentiallyViewable(false); playersviewable = G_CountPlayersPotentiallyViewable(false);
/* Demote splits */ /* Demote splits */
if (playersviewable < splits) if (playersviewable < splits)
{ {
splits = playersviewable; splits = playersviewable;
splitscreen = max(splits-1, 0); r_splitscreen = max(splits-1, 0);
R_ExecuteSetViewSize(); R_ExecuteSetViewSize();
} }
@ -2884,18 +2885,18 @@ void G_SpawnPlayer(INT32 playernum, boolean starpost)
if (nummapthings) if (nummapthings)
{ {
if (playernum == consoleplayer if (playernum == consoleplayer
|| (splitscreen && playernum == displayplayers[1]) || (splitscreen && playernum == displayplayers[localdisplayplayers[1]])
|| (splitscreen > 1 && playernum == displayplayers[2]) || (splitscreen > 1 && playernum == displayplayers[localdisplayplayers[2]])
|| (splitscreen > 2 && playernum == displayplayers[3])) || (splitscreen > 2 && playernum == displayplayers[localdisplayplayers[3]]))
CONS_Alert(CONS_ERROR, M_GetText("No player spawns found, spawning at the first mapthing!\n")); CONS_Alert(CONS_ERROR, M_GetText("No player spawns found, spawning at the first mapthing!\n"));
spawnpoint = &mapthings[0]; spawnpoint = &mapthings[0];
} }
else else
{ {
if (playernum == consoleplayer if (playernum == consoleplayer
|| (splitscreen && playernum == displayplayers[1]) || (splitscreen && playernum == displayplayers[localdisplayplayers[1]])
|| (splitscreen > 1 && playernum == displayplayers[2]) || (splitscreen > 1 && playernum == displayplayers[localdisplayplayers[2]])
|| (splitscreen > 2 && playernum == displayplayers[3])) || (splitscreen > 2 && playernum == displayplayers[localdisplayplayers[3]]))
CONS_Alert(CONS_ERROR, M_GetText("No player spawns found, spawning at the origin!\n")); CONS_Alert(CONS_ERROR, M_GetText("No player spawns found, spawning at the origin!\n"));
//P_MovePlayerToSpawn handles this fine if the spawnpoint is NULL. //P_MovePlayerToSpawn handles this fine if the spawnpoint is NULL.
} }
@ -2990,17 +2991,17 @@ mapthing_t *G_FindMatchStart(INT32 playernum)
return deathmatchstarts[i]; return deathmatchstarts[i];
} }
if (playernum == consoleplayer if (playernum == consoleplayer
|| (splitscreen && playernum == displayplayers[1]) || (splitscreen && playernum == displayplayers[localdisplayplayers[1]])
|| (splitscreen > 1 && playernum == displayplayers[2]) || (splitscreen > 1 && playernum == displayplayers[localdisplayplayers[2]])
|| (splitscreen > 2 && playernum == displayplayers[3])) || (splitscreen > 2 && playernum == displayplayers[localdisplayplayers[3]]))
CONS_Alert(CONS_WARNING, M_GetText("Could not spawn at any Deathmatch starts!\n")); CONS_Alert(CONS_WARNING, M_GetText("Could not spawn at any Deathmatch starts!\n"));
return NULL; return NULL;
} }
if (playernum == consoleplayer if (playernum == consoleplayer
|| (splitscreen && playernum == displayplayers[1]) || (splitscreen && playernum == displayplayers[localdisplayplayers[1]])
|| (splitscreen > 1 && playernum == displayplayers[2]) || (splitscreen > 1 && playernum == displayplayers[localdisplayplayers[2]])
|| (splitscreen > 2 && playernum == displayplayers[3])) || (splitscreen > 2 && playernum == displayplayers[localdisplayplayers[3]]))
CONS_Alert(CONS_WARNING, M_GetText("No Deathmatch starts in this map!\n")); CONS_Alert(CONS_WARNING, M_GetText("No Deathmatch starts in this map!\n"));
return NULL; return NULL;
} }
@ -3088,17 +3089,17 @@ mapthing_t *G_FindRaceStart(INT32 playernum)
//return playerstarts[0]; //return playerstarts[0];
if (playernum == consoleplayer if (playernum == consoleplayer
|| (splitscreen && playernum == displayplayers[1]) || (splitscreen && playernum == displayplayers[localdisplayplayers[1]])
|| (splitscreen > 1 && playernum == displayplayers[2]) || (splitscreen > 1 && playernum == displayplayers[localdisplayplayers[2]])
|| (splitscreen > 2 && playernum == displayplayers[3])) || (splitscreen > 2 && playernum == displayplayers[localdisplayplayers[3]]))
CONS_Alert(CONS_WARNING, M_GetText("Could not spawn at any Race starts!\n")); CONS_Alert(CONS_WARNING, M_GetText("Could not spawn at any Race starts!\n"));
return NULL; return NULL;
} }
if (playernum == consoleplayer if (playernum == consoleplayer
|| (splitscreen && playernum == displayplayers[1]) || (splitscreen && playernum == displayplayers[localdisplayplayers[1]])
|| (splitscreen > 1 && playernum == displayplayers[2]) || (splitscreen > 1 && playernum == displayplayers[localdisplayplayers[2]])
|| (splitscreen > 2 && playernum == displayplayers[3])) || (splitscreen > 2 && playernum == displayplayers[localdisplayplayers[3]]))
CONS_Alert(CONS_WARNING, M_GetText("No Race starts in this map!\n")); CONS_Alert(CONS_WARNING, M_GetText("No Race starts in this map!\n"));
return NULL; return NULL;
} }
@ -3712,7 +3713,7 @@ static void G_DoCompleted(void)
} }
// play some generic music if there's no win/cool/lose music going on (for exitlevel commands) // play some generic music if there's no win/cool/lose music going on (for exitlevel commands)
if (G_RaceGametype() && ((multiplayer && demo.playback) || j == splitscreen+1) && (cv_inttime.value > 0)) if (G_RaceGametype() && ((multiplayer && demo.playback) || j == r_splitscreen+1) && (cv_inttime.value > 0))
S_ChangeMusicInternal("racent", true); S_ChangeMusicInternal("racent", true);
if (automapactive) if (automapactive)

View file

@ -1477,7 +1477,7 @@ static void HU_drawMiniChat(void)
if (!chat_nummsg_min) if (!chat_nummsg_min)
return; // needless to say it's useless to do anything if we don't have anything to draw. return; // needless to say it's useless to do anything if we don't have anything to draw.
if (splitscreen > 1) if (r_splitscreen > 1)
boxw = max(64, boxw/2); boxw = max(64, boxw/2);
for (; i>0; i--) for (; i>0; i--)
@ -1529,10 +1529,10 @@ static void HU_drawMiniChat(void)
y = chaty - charheight*(msglines+1); y = chaty - charheight*(msglines+1);
#ifdef NETSPLITSCREEN #ifdef NETSPLITSCREEN
if (splitscreen) if (r_splitscreen)
{ {
y -= BASEVIDHEIGHT/2; y -= BASEVIDHEIGHT/2;
if (splitscreen > 1) if (r_splitscreen > 1)
y += 16; y += 16;
} }
else else
@ -1620,10 +1620,10 @@ static void HU_drawChatLog(INT32 offset)
chat_scroll = chat_maxscroll; chat_scroll = chat_maxscroll;
#ifdef NETSPLITSCREEN #ifdef NETSPLITSCREEN
if (splitscreen) if (r_splitscreen)
{ {
boxh = max(6, boxh/2); boxh = max(6, boxh/2);
if (splitscreen > 1) if (r_splitscreen > 1)
boxw = max(64, boxw/2); boxw = max(64, boxw/2);
} }
#endif #endif
@ -1631,10 +1631,10 @@ static void HU_drawChatLog(INT32 offset)
y = chaty - offset*charheight - (chat_scroll*charheight) - boxh*charheight - 12; y = chaty - offset*charheight - (chat_scroll*charheight) - boxh*charheight - 12;
#ifdef NETSPLITSCREEN #ifdef NETSPLITSCREEN
if (splitscreen) if (r_splitscreen)
{ {
y -= BASEVIDHEIGHT/2; y -= BASEVIDHEIGHT/2;
if (splitscreen > 1) if (r_splitscreen > 1)
y += 16; y += 16;
} }
else else
@ -1739,10 +1739,10 @@ static void HU_DrawChat(void)
const char *mute = "Chat has been muted."; const char *mute = "Chat has been muted.";
#ifdef NETSPLITSCREEN #ifdef NETSPLITSCREEN
if (splitscreen) if (r_splitscreen)
{ {
y -= BASEVIDHEIGHT/2; y -= BASEVIDHEIGHT/2;
if (splitscreen > 1) if (r_splitscreen > 1)
{ {
y += 16; y += 16;
boxw = max(64, boxw/2); boxw = max(64, boxw/2);
@ -1836,10 +1836,10 @@ static void HU_DrawChat(void)
INT32 count = 0; INT32 count = 0;
INT32 p_dispy = chaty - charheight -1; INT32 p_dispy = chaty - charheight -1;
#ifdef NETSPLITSCREEN #ifdef NETSPLITSCREEN
if (splitscreen) if (r_splitscreen)
{ {
p_dispy -= BASEVIDHEIGHT/2; p_dispy -= BASEVIDHEIGHT/2;
if (splitscreen > 1) if (r_splitscreen > 1)
p_dispy += 16; p_dispy += 16;
} }
else else
@ -2250,7 +2250,7 @@ void HU_DrawSongCredits(void)
{ {
char *str; char *str;
INT32 len, destx; INT32 len, destx;
INT32 y = (splitscreen ? (BASEVIDHEIGHT/2)-4 : 32); INT32 y = (r_splitscreen ? (BASEVIDHEIGHT/2)-4 : 32);
INT32 bgt; INT32 bgt;
if (!cursongcredit.def) // No def if (!cursongcredit.def) // No def
@ -3022,7 +3022,7 @@ static void HU_DrawRankings(void)
// When you play, you quickly see your score because your name is displayed in white. // When you play, you quickly see your score because your name is displayed in white.
// When playing back a demo, you quickly see who's the view. // When playing back a demo, you quickly see who's the view.
if (!splitscreen) if (!r_splitscreen)
whiteplayer = demo.playback ? displayplayers[0] : consoleplayer; whiteplayer = demo.playback ? displayplayers[0] : consoleplayer;
scorelines = 0; scorelines = 0;

View file

@ -1058,7 +1058,7 @@ static void K_KartItemRoulette(player_t *player, ticcmd_t *cmd)
if ((player->kartstuff[k_itemroulette] % 3) == 1 && P_IsDisplayPlayer(player)) if ((player->kartstuff[k_itemroulette] % 3) == 1 && P_IsDisplayPlayer(player))
{ {
#define PLAYROULETTESND S_StartSound(NULL, sfx_itrol1 + ((player->kartstuff[k_itemroulette] / 3) % 8)) #define PLAYROULETTESND S_StartSound(NULL, sfx_itrol1 + ((player->kartstuff[k_itemroulette] / 3) % 8))
for (i = 0; i <= splitscreen; i++) for (i = 0; i <= r_splitscreen; i++)
{ {
if (player == &players[displayplayers[i]] && players[displayplayers[i]].kartstuff[k_itemroulette]) if (player == &players[displayplayers[i]] && players[displayplayers[i]].kartstuff[k_itemroulette])
PLAYROULETTESND; PLAYROULETTESND;
@ -3925,7 +3925,7 @@ static void K_DoHyudoroSteal(player_t *player)
players[stealplayer].kartstuff[k_itemamount] = 0; players[stealplayer].kartstuff[k_itemamount] = 0;
players[stealplayer].kartstuff[k_itemheld] = 0; players[stealplayer].kartstuff[k_itemheld] = 0;
if (P_IsDisplayPlayer(&players[stealplayer]) && !splitscreen) if (P_IsDisplayPlayer(&players[stealplayer]) && !r_splitscreen)
S_StartSound(NULL, sfx_s3k92); S_StartSound(NULL, sfx_s3k92);
} }
} }
@ -6500,7 +6500,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
if (player->kartstuff[k_hyudorotimer] > 0) if (player->kartstuff[k_hyudorotimer] > 0)
{ {
if (splitscreen) if (r_splitscreen)
{ {
if (leveltime & 1) if (leveltime & 1)
player->mo->flags2 |= MF2_DONTDRAW; player->mo->flags2 |= MF2_DONTDRAW;
@ -6511,9 +6511,9 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
{ {
if (player == &players[displayplayers[1]]) if (player == &players[displayplayers[1]])
player->mo->eflags |= MFE_DRAWONLYFORP2; player->mo->eflags |= MFE_DRAWONLYFORP2;
else if (player == &players[displayplayers[2]] && splitscreen > 1) else if (player == &players[displayplayers[2]] && r_splitscreen > 1)
player->mo->eflags |= MFE_DRAWONLYFORP3; player->mo->eflags |= MFE_DRAWONLYFORP3;
else if (player == &players[displayplayers[3]] && splitscreen > 2) else if (player == &players[displayplayers[3]] && r_splitscreen > 2)
player->mo->eflags |= MFE_DRAWONLYFORP4; player->mo->eflags |= MFE_DRAWONLYFORP4;
else if (player == &players[displayplayers[0]]) else if (player == &players[displayplayers[0]])
player->mo->eflags |= MFE_DRAWONLYFORP1; player->mo->eflags |= MFE_DRAWONLYFORP1;
@ -6635,7 +6635,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
} }
// Play the starting countdown sounds // Play the starting countdown sounds
if (player == &players[displayplayers[0]]) // Don't play louder in splitscreen if (player == &players[displayplayers[localdisplayplayers[0]]]) // Don't play louder in splitscreen
{ {
if ((leveltime == starttime-(3*TICRATE)) || (leveltime == starttime-(2*TICRATE)) || (leveltime == starttime-TICRATE)) if ((leveltime == starttime-(3*TICRATE)) || (leveltime == starttime-(2*TICRATE)) || (leveltime == starttime-TICRATE))
S_StartSound(NULL, sfx_s3ka7); S_StartSound(NULL, sfx_s3ka7);
@ -7521,7 +7521,7 @@ static void K_initKartHUD(void)
WANT_X = BASEVIDWIDTH - 55; // 270 WANT_X = BASEVIDWIDTH - 55; // 270
WANT_Y = BASEVIDHEIGHT- 71; // 176 WANT_Y = BASEVIDHEIGHT- 71; // 176
if (splitscreen) // Splitscreen if (r_splitscreen) // Splitscreen
{ {
ITEM_X = 5; ITEM_X = 5;
ITEM_Y = 3; ITEM_Y = 3;
@ -7534,7 +7534,7 @@ static void K_initKartHUD(void)
MINI_Y = (BASEVIDHEIGHT/2); MINI_Y = (BASEVIDHEIGHT/2);
if (splitscreen > 1) // 3P/4P Small Splitscreen if (r_splitscreen > 1) // 3P/4P Small Splitscreen
{ {
// 1P (top left) // 1P (top left)
ITEM_X = -9; ITEM_X = -9;
@ -7563,7 +7563,7 @@ static void K_initKartHUD(void)
MINI_X = (3*BASEVIDWIDTH/4); MINI_X = (3*BASEVIDWIDTH/4);
MINI_Y = (3*BASEVIDHEIGHT/4); MINI_Y = (3*BASEVIDHEIGHT/4);
if (splitscreen > 2) // 4P-only if (r_splitscreen > 2) // 4P-only
{ {
MINI_X = (BASEVIDWIDTH/2); MINI_X = (BASEVIDWIDTH/2);
MINI_Y = (BASEVIDHEIGHT/2); MINI_Y = (BASEVIDHEIGHT/2);
@ -7583,20 +7583,20 @@ INT32 K_calcSplitFlags(INT32 snapflags)
{ {
INT32 splitflags = 0; INT32 splitflags = 0;
if (splitscreen == 0) if (r_splitscreen == 0)
return snapflags; return snapflags;
if (stplyr != &players[displayplayers[0]]) if (stplyr != &players[displayplayers[0]])
{ {
if (splitscreen == 1 && stplyr == &players[displayplayers[1]]) if (r_splitscreen == 1 && stplyr == &players[displayplayers[1]])
{ {
splitflags |= V_SPLITSCREEN; splitflags |= V_SPLITSCREEN;
} }
else if (splitscreen > 1) else if (r_splitscreen > 1)
{ {
if (stplyr == &players[displayplayers[2]] || (splitscreen == 3 && stplyr == &players[displayplayers[3]])) if (stplyr == &players[displayplayers[2]] || (r_splitscreen == 3 && stplyr == &players[displayplayers[3]]))
splitflags |= V_SPLITSCREEN; splitflags |= V_SPLITSCREEN;
if (stplyr == &players[displayplayers[1]] || (splitscreen == 3 && stplyr == &players[displayplayers[3]])) if (stplyr == &players[displayplayers[1]] || (r_splitscreen == 3 && stplyr == &players[displayplayers[3]]))
splitflags |= V_HORZSCREEN; splitflags |= V_HORZSCREEN;
} }
} }
@ -7606,7 +7606,7 @@ INT32 K_calcSplitFlags(INT32 snapflags)
else else
snapflags &= ~V_SNAPTOBOTTOM; snapflags &= ~V_SNAPTOBOTTOM;
if (splitscreen > 1) if (r_splitscreen > 1)
{ {
if (splitflags & V_HORZSCREEN) if (splitflags & V_HORZSCREEN)
snapflags &= ~V_SNAPTOLEFT; snapflags &= ~V_SNAPTOLEFT;
@ -7624,7 +7624,7 @@ static void K_drawKartItem(void)
// Why write V_DrawScaledPatch calls over and over when they're all the same? // Why write V_DrawScaledPatch calls over and over when they're all the same?
// Set to 'no item' just in case. // Set to 'no item' just in case.
const UINT8 offset = ((splitscreen > 1) ? 1 : 0); const UINT8 offset = ((r_splitscreen > 1) ? 1 : 0);
patch_t *localpatch = kp_nodraw; patch_t *localpatch = kp_nodraw;
patch_t *localbg = ((offset) ? kp_itembg[2] : kp_itembg[0]); patch_t *localbg = ((offset) ? kp_itembg[2] : kp_itembg[0]);
patch_t *localinv = ((offset) ? kp_invincibility[((leveltime % (6*3)) / 3) + 7] : kp_invincibility[(leveltime % (7*3)) / 3]); patch_t *localinv = ((offset) ? kp_invincibility[((leveltime % (6*3)) / 3) + 7] : kp_invincibility[(leveltime % (7*3)) / 3]);
@ -7633,7 +7633,7 @@ static void K_drawKartItem(void)
const INT32 numberdisplaymin = ((!offset && stplyr->kartstuff[k_itemtype] == KITEM_ORBINAUT) ? 5 : 2); const INT32 numberdisplaymin = ((!offset && stplyr->kartstuff[k_itemtype] == KITEM_ORBINAUT) ? 5 : 2);
INT32 itembar = 0; INT32 itembar = 0;
INT32 maxl = 0; // itembar's normal highest value INT32 maxl = 0; // itembar's normal highest value
const INT32 barlength = (splitscreen > 1 ? 12 : 26); const INT32 barlength = (r_splitscreen > 1 ? 12 : 26);
UINT8 localcolor = SKINCOLOR_NONE; UINT8 localcolor = SKINCOLOR_NONE;
SINT8 colormode = TC_RAINBOW; SINT8 colormode = TC_RAINBOW;
UINT8 *colmap = NULL; UINT8 *colmap = NULL;
@ -7865,7 +7865,7 @@ static void K_drawKartItem(void)
} }
// pain and suffering defined below // pain and suffering defined below
if (splitscreen < 2) // don't change shit for THIS splitscreen. if (r_splitscreen < 2) // don't change shit for THIS splitscreen.
{ {
fx = ITEM_X; fx = ITEM_X;
fy = ITEM_Y; fy = ITEM_Y;
@ -8110,19 +8110,19 @@ static void K_DrawKartPositionNum(INT32 num)
scale *= 2; scale *= 2;
overtake = true; // this is used for splitscreen stuff in conjunction with flipdraw. overtake = true; // this is used for splitscreen stuff in conjunction with flipdraw.
} }
if (splitscreen) if (r_splitscreen)
scale /= 2; scale /= 2;
W = FixedMul(W<<FRACBITS, scale)>>FRACBITS; W = FixedMul(W<<FRACBITS, scale)>>FRACBITS;
// pain and suffering defined below // pain and suffering defined below
if (!splitscreen) if (!r_splitscreen)
{ {
fx = POSI_X; fx = POSI_X;
fy = BASEVIDHEIGHT - 8; fy = BASEVIDHEIGHT - 8;
fflags = V_SNAPTOBOTTOM|V_SNAPTORIGHT; fflags = V_SNAPTOBOTTOM|V_SNAPTORIGHT;
} }
else if (splitscreen == 1) // for this splitscreen, we'll use case by case because it's a bit different. else if (r_splitscreen == 1) // for this splitscreen, we'll use case by case because it's a bit different.
{ {
fx = POSI_X; fx = POSI_X;
if (stplyr == &players[displayplayers[0]]) // for player 1: display this at the top right, above the minimap. if (stplyr == &players[displayplayers[0]]) // for player 1: display this at the top right, above the minimap.
@ -8487,16 +8487,16 @@ static void K_drawKartLapsAndRings(void)
{ {
ringflip = V_FLIP; ringflip = V_FLIP;
ringanim_realframe = RINGANIM_NUMFRAMES-stplyr->karthud[khud_ringframe]; ringanim_realframe = RINGANIM_NUMFRAMES-stplyr->karthud[khud_ringframe];
ringx += SHORT((splitscreen > 1) ? kp_smallring[ringanim_realframe]->width : kp_ring[ringanim_realframe]->width); ringx += SHORT((r_splitscreen > 1) ? kp_smallring[ringanim_realframe]->width : kp_ring[ringanim_realframe]->width);
} }
if (splitscreen > 1) if (r_splitscreen > 1)
{ {
INT32 fx = 0, fy = 0, fr = 0; INT32 fx = 0, fy = 0, fr = 0;
INT32 flipflag = 0; INT32 flipflag = 0;
// pain and suffering defined below // pain and suffering defined below
if (splitscreen < 2) // don't change shit for THIS splitscreen. if (r_splitscreen < 2) // don't change shit for THIS splitscreen.
{ {
fx = LAPS_X; fx = LAPS_X;
fy = LAPS_Y; fy = LAPS_Y;
@ -8679,13 +8679,13 @@ static void K_drawKartBumpersOrKarma(void)
UINT8 *colormap = R_GetTranslationColormap(TC_DEFAULT, stplyr->skincolor, GTC_CACHE); UINT8 *colormap = R_GetTranslationColormap(TC_DEFAULT, stplyr->skincolor, GTC_CACHE);
INT32 splitflags = K_calcSplitFlags(V_SNAPTOBOTTOM|V_SNAPTOLEFT); INT32 splitflags = K_calcSplitFlags(V_SNAPTOBOTTOM|V_SNAPTOLEFT);
if (splitscreen > 1) if (r_splitscreen > 1)
{ {
INT32 fx = 0, fy = 0; INT32 fx = 0, fy = 0;
INT32 flipflag = 0; INT32 flipflag = 0;
// pain and suffering defined below // pain and suffering defined below
if (splitscreen < 2) // don't change shit for THIS splitscreen. if (r_splitscreen < 2) // don't change shit for THIS splitscreen.
{ {
fx = LAPS_X; fx = LAPS_X;
fy = LAPS_Y; fy = LAPS_Y;
@ -8782,7 +8782,7 @@ static fixed_t K_FindCheckX(fixed_t px, fixed_t py, angle_t ang, fixed_t mx, fix
if (encoremode) if (encoremode)
x = 320-x; x = 320-x;
if (splitscreen > 1) if (r_splitscreen > 1)
x /= 2; x /= 2;
return x; return x;
@ -8808,17 +8808,17 @@ static void K_drawKartWanted(void)
return; return;
// set X/Y coords depending on splitscreen. // set X/Y coords depending on splitscreen.
if (splitscreen < 3) // 1P and 2P use the same code. if (r_splitscreen < 3) // 1P and 2P use the same code.
{ {
basex = WANT_X; basex = WANT_X;
basey = WANT_Y; basey = WANT_Y;
if (splitscreen == 2) if (r_splitscreen == 2)
{ {
basey += 16; // slight adjust for 3P basey += 16; // slight adjust for 3P
basex -= 6; basex -= 6;
} }
} }
else if (splitscreen == 3) // 4P splitscreen... else if (r_splitscreen == 3) // 4P splitscreen...
{ {
basex = BASEVIDWIDTH/2 - (SHORT(kp_wantedsplit->width)/2); // center on screen basex = BASEVIDWIDTH/2 - (SHORT(kp_wantedsplit->width)/2); // center on screen
basey = BASEVIDHEIGHT - 55; basey = BASEVIDHEIGHT - 55;
@ -8827,13 +8827,13 @@ static void K_drawKartWanted(void)
if (battlewanted[0] != -1) if (battlewanted[0] != -1)
colormap = R_GetTranslationColormap(0, players[battlewanted[0]].skincolor, GTC_CACHE); colormap = R_GetTranslationColormap(0, players[battlewanted[0]].skincolor, GTC_CACHE);
V_DrawFixedPatch(basex<<FRACBITS, basey<<FRACBITS, FRACUNIT, V_HUDTRANS|(splitscreen < 3 ? V_SNAPTORIGHT : 0)|V_SNAPTOBOTTOM, (splitscreen > 1 ? kp_wantedsplit : kp_wanted), colormap); V_DrawFixedPatch(basex<<FRACBITS, basey<<FRACBITS, FRACUNIT, V_HUDTRANS|(r_splitscreen < 3 ? V_SNAPTORIGHT : 0)|V_SNAPTOBOTTOM, (r_splitscreen > 1 ? kp_wantedsplit : kp_wanted), colormap);
/*if (basey2) /*if (basey2)
V_DrawFixedPatch(basex<<FRACBITS, basey2<<FRACBITS, FRACUNIT, V_HUDTRANS|V_SNAPTOTOP, (splitscreen == 3 ? kp_wantedsplit : kp_wanted), colormap); // < used for 4p splits.*/ V_DrawFixedPatch(basex<<FRACBITS, basey2<<FRACBITS, FRACUNIT, V_HUDTRANS|V_SNAPTOTOP, (splitscreen == 3 ? kp_wantedsplit : kp_wanted), colormap); // < used for 4p splits.*/
for (i = 0; i < numwanted; i++) for (i = 0; i < numwanted; i++)
{ {
INT32 x = basex+(splitscreen > 1 ? 13 : 8), y = basey+(splitscreen > 1 ? 16 : 21); INT32 x = basex+(r_splitscreen > 1 ? 13 : 8), y = basey+(r_splitscreen > 1 ? 16 : 21);
fixed_t scale = FRACUNIT/2; fixed_t scale = FRACUNIT/2;
player_t *p = &players[battlewanted[i]]; player_t *p = &players[battlewanted[i]];
@ -8853,7 +8853,7 @@ static void K_drawKartWanted(void)
if (players[battlewanted[i]].skincolor) if (players[battlewanted[i]].skincolor)
{ {
colormap = R_GetTranslationColormap(TC_RAINBOW, p->skincolor, GTC_CACHE); colormap = R_GetTranslationColormap(TC_RAINBOW, p->skincolor, GTC_CACHE);
V_DrawFixedPatch(x<<FRACBITS, y<<FRACBITS, FRACUNIT, V_HUDTRANS|(splitscreen < 3 ? V_SNAPTORIGHT : 0)|V_SNAPTOBOTTOM, (scale == FRACUNIT ? facewantprefix[p->skin] : facerankprefix[p->skin]), colormap); V_DrawFixedPatch(x<<FRACBITS, y<<FRACBITS, FRACUNIT, V_HUDTRANS|(r_splitscreen < 3 ? V_SNAPTORIGHT : 0)|V_SNAPTOBOTTOM, (scale == FRACUNIT ? facewantprefix[p->skin] : facerankprefix[p->skin]), colormap);
/*if (basey2) // again with 4p stuff /*if (basey2) // again with 4p stuff
V_DrawFixedPatch(x<<FRACBITS, (y - (basey-basey2))<<FRACBITS, FRACUNIT, V_HUDTRANS|V_SNAPTOTOP, (scale == FRACUNIT ? facewantprefix[p->skin] : facerankprefix[p->skin]), colormap);*/ V_DrawFixedPatch(x<<FRACBITS, (y - (basey-basey2))<<FRACBITS, FRACUNIT, V_HUDTRANS|V_SNAPTOTOP, (scale == FRACUNIT ? facewantprefix[p->skin] : facerankprefix[p->skin]), colormap);*/
} }
@ -8990,7 +8990,7 @@ static void K_drawKartMinimap(void)
patch_t *AutomapPic; patch_t *AutomapPic;
INT32 i = 0; INT32 i = 0;
INT32 x, y; INT32 x, y;
INT32 minimaptrans, splitflags = (splitscreen == 3 ? 0 : V_SNAPTORIGHT); // flags should only be 0 when it's centered (4p split) INT32 minimaptrans, splitflags = (r_splitscreen == 3 ? 0 : V_SNAPTORIGHT); // flags should only be 0 when it's centered (4p split)
UINT8 skin = 0; UINT8 skin = 0;
UINT8 *colormap = NULL; UINT8 *colormap = NULL;
SINT8 localplayers[4]; SINT8 localplayers[4];
@ -9035,7 +9035,7 @@ static void K_drawKartMinimap(void)
else else
V_DrawScaledPatch(x, y, splitflags, AutomapPic); V_DrawScaledPatch(x, y, splitflags, AutomapPic);
if (!(splitscreen == 2)) if (!(r_splitscreen == 2))
{ {
splitflags &= ~minimaptrans; splitflags &= ~minimaptrans;
splitflags |= V_HUDTRANSHALF; splitflags |= V_HUDTRANSHALF;
@ -9104,7 +9104,7 @@ static void K_drawKartMinimap(void)
if (!players[i].mo || players[i].spectator) if (!players[i].mo || players[i].spectator)
continue; continue;
if (i != displayplayers[0] || splitscreen) if (i != displayplayers[0] || r_splitscreen)
{ {
if (G_BattleGametype() && players[i].kartstuff[k_bumper] <= 0) if (G_BattleGametype() && players[i].kartstuff[k_bumper] <= 0)
continue; continue;
@ -9194,7 +9194,7 @@ static void K_drawKartStartCountdown(void)
pnum++; pnum++;
if ((leveltime % (2*5)) / 5) // blink if ((leveltime % (2*5)) / 5) // blink
pnum += 4; pnum += 4;
if (splitscreen) // splitscreen if (r_splitscreen) // splitscreen
pnum += 8; pnum += 8;
V_DrawScaledPatch(STCD_X - (SHORT(kp_startcountdown[pnum]->width)/2), STCD_Y - (SHORT(kp_startcountdown[pnum]->height)/2), splitflags, kp_startcountdown[pnum]); V_DrawScaledPatch(STCD_X - (SHORT(kp_startcountdown[pnum]->width)/2), STCD_Y - (SHORT(kp_startcountdown[pnum]->height)/2), splitflags, kp_startcountdown[pnum]);
@ -9210,7 +9210,7 @@ static void K_drawKartFinish(void)
if ((stplyr->karthud[khud_cardanimation] % (2*5)) / 5) // blink if ((stplyr->karthud[khud_cardanimation] % (2*5)) / 5) // blink
pnum = 1; pnum = 1;
if (splitscreen > 1) // 3/4p, stationary FIN if (r_splitscreen > 1) // 3/4p, stationary FIN
{ {
pnum += 2; pnum += 2;
V_DrawScaledPatch(STCD_X - (SHORT(kp_racefinish[pnum]->width)/2), STCD_Y - (SHORT(kp_racefinish[pnum]->height)/2), splitflags, kp_racefinish[pnum]); V_DrawScaledPatch(STCD_X - (SHORT(kp_racefinish[pnum]->width)/2), STCD_Y - (SHORT(kp_racefinish[pnum]->height)/2), splitflags, kp_racefinish[pnum]);
@ -9221,14 +9221,14 @@ static void K_drawKartFinish(void)
{ {
INT32 x, xval; INT32 x, xval;
if (splitscreen) // wide splitscreen if (r_splitscreen) // wide splitscreen
pnum += 4; pnum += 4;
x = ((vid.width<<FRACBITS)/vid.dupx); x = ((vid.width<<FRACBITS)/vid.dupx);
xval = (SHORT(kp_racefinish[pnum]->width)<<FRACBITS); xval = (SHORT(kp_racefinish[pnum]->width)<<FRACBITS);
x = ((TICRATE - stplyr->karthud[khud_cardanimation])*(xval > x ? xval : x))/TICRATE; x = ((TICRATE - stplyr->karthud[khud_cardanimation])*(xval > x ? xval : x))/TICRATE;
if (splitscreen && stplyr == &players[displayplayers[1]]) if (r_splitscreen && stplyr == &players[displayplayers[1]])
x = -x; x = -x;
V_DrawFixedPatch(x + (STCD_X<<FRACBITS) - (xval>>1), V_DrawFixedPatch(x + (STCD_X<<FRACBITS) - (xval>>1),
@ -9250,11 +9250,11 @@ static void K_drawBattleFullscreen(void)
drawcomebacktimer = false; drawcomebacktimer = false;
#endif #endif
if (splitscreen) if (r_splitscreen)
{ {
if ((splitscreen == 1 && stplyr == &players[displayplayers[1]]) if ((r_splitscreen == 1 && stplyr == &players[displayplayers[1]])
|| (splitscreen > 1 && (stplyr == &players[displayplayers[2]] || (r_splitscreen > 1 && (stplyr == &players[displayplayers[2]]
|| (stplyr == &players[displayplayers[3]] && splitscreen > 2)))) || (stplyr == &players[displayplayers[3]] && r_splitscreen > 2))))
{ {
y = 232-(stplyr->karthud[khud_cardanimation]/2); y = 232-(stplyr->karthud[khud_cardanimation]/2);
splitflags = V_SNAPTOBOTTOM; splitflags = V_SNAPTOBOTTOM;
@ -9262,12 +9262,12 @@ static void K_drawBattleFullscreen(void)
else else
y = -32+(stplyr->karthud[khud_cardanimation]/2); y = -32+(stplyr->karthud[khud_cardanimation]/2);
if (splitscreen > 1) if (r_splitscreen > 1)
{ {
scale /= 2; scale /= 2;
if (stplyr == &players[displayplayers[1]] if (stplyr == &players[displayplayers[1]]
|| (stplyr == &players[displayplayers[3]] && splitscreen > 2)) || (stplyr == &players[displayplayers[3]] && r_splitscreen > 2))
x = 3*BASEVIDWIDTH/4; x = 3*BASEVIDWIDTH/4;
else else
x = BASEVIDWIDTH/4; x = BASEVIDWIDTH/4;
@ -9303,7 +9303,7 @@ static void K_drawBattleFullscreen(void)
else if (stplyr->kartstuff[k_bumper] <= 0 && stplyr->kartstuff[k_comebacktimer] && comeback && !stplyr->spectator && drawcomebacktimer) else if (stplyr->kartstuff[k_bumper] <= 0 && stplyr->kartstuff[k_comebacktimer] && comeback && !stplyr->spectator && drawcomebacktimer)
{ {
UINT16 t = stplyr->kartstuff[k_comebacktimer]/(10*TICRATE); UINT16 t = stplyr->kartstuff[k_comebacktimer]/(10*TICRATE);
INT32 txoff, adjust = (splitscreen > 1) ? 4 : 6; // normal string is 8, kart string is 12, half of that for ease INT32 txoff, adjust = (r_splitscreen > 1) ? 4 : 6; // normal string is 8, kart string is 12, half of that for ease
INT32 ty = (BASEVIDHEIGHT/2)+66; INT32 ty = (BASEVIDHEIGHT/2)+66;
txoff = adjust; txoff = adjust;
@ -9314,13 +9314,13 @@ static void K_drawBattleFullscreen(void)
t /= 10; t /= 10;
} }
if (splitscreen) if (r_splitscreen)
{ {
if (splitscreen > 1) if (r_splitscreen > 1)
ty = (BASEVIDHEIGHT/4)+33; ty = (BASEVIDHEIGHT/4)+33;
if ((splitscreen == 1 && stplyr == &players[displayplayers[1]]) if ((r_splitscreen == 1 && stplyr == &players[displayplayers[1]])
|| (stplyr == &players[displayplayers[2]] && splitscreen > 1) || (stplyr == &players[displayplayers[2]] && r_splitscreen > 1)
|| (stplyr == &players[displayplayers[3]] && splitscreen > 2)) || (stplyr == &players[displayplayers[3]] && r_splitscreen > 2))
ty += (BASEVIDHEIGHT/2); ty += (BASEVIDHEIGHT/2);
} }
else else
@ -9331,7 +9331,7 @@ static void K_drawBattleFullscreen(void)
else else
V_DrawFixedPatch(x<<FRACBITS, y<<FRACBITS, scale, splitflags, kp_battlewait, NULL); V_DrawFixedPatch(x<<FRACBITS, y<<FRACBITS, scale, splitflags, kp_battlewait, NULL);
if (splitscreen > 1) if (r_splitscreen > 1)
V_DrawString(x-txoff, ty, 0, va("%d", stplyr->kartstuff[k_comebacktimer]/TICRATE)); V_DrawString(x-txoff, ty, 0, va("%d", stplyr->kartstuff[k_comebacktimer]/TICRATE));
else else
{ {
@ -9373,24 +9373,24 @@ static void K_drawKartFirstPerson(void)
if (stplyr->spectator || !stplyr->mo || (stplyr->mo->flags2 & MF2_DONTDRAW)) if (stplyr->spectator || !stplyr->mo || (stplyr->mo->flags2 & MF2_DONTDRAW))
return; return;
if (stplyr == &players[displayplayers[1]] && splitscreen) if (stplyr == &players[displayplayers[1]] && r_splitscreen)
{ pn = pnum[1]; tn = turn[1]; dr = drift[1]; } { pn = pnum[1]; tn = turn[1]; dr = drift[1]; }
else if (stplyr == &players[displayplayers[2]] && splitscreen > 1) else if (stplyr == &players[displayplayers[2]] && r_splitscreen > 1)
{ pn = pnum[2]; tn = turn[2]; dr = drift[2]; } { pn = pnum[2]; tn = turn[2]; dr = drift[2]; }
else if (stplyr == &players[displayplayers[3]] && splitscreen > 2) else if (stplyr == &players[displayplayers[3]] && r_splitscreen > 2)
{ pn = pnum[3]; tn = turn[3]; dr = drift[3]; } { pn = pnum[3]; tn = turn[3]; dr = drift[3]; }
else else
{ pn = pnum[0]; tn = turn[0]; dr = drift[0]; } { pn = pnum[0]; tn = turn[0]; dr = drift[0]; }
if (splitscreen) if (r_splitscreen)
{ {
y >>= 1; y >>= 1;
if (splitscreen > 1) if (r_splitscreen > 1)
x >>= 1; x >>= 1;
} }
{ {
if (stplyr->speed < (20*stplyr->mo->scale) && (leveltime & 1) && !splitscreen) if (stplyr->speed < (20*stplyr->mo->scale) && (leveltime & 1) && !r_splitscreen)
y++; y++;
// the following isn't EXPLICITLY right, it just gets the result we want, but i'm too lazy to look up the right way to do it // the following isn't EXPLICITLY right, it just gets the result we want, but i'm too lazy to look up the right way to do it
if (stplyr->mo->flags2 & MF2_SHADOW) if (stplyr->mo->flags2 & MF2_SHADOW)
@ -9434,12 +9434,12 @@ static void K_drawKartFirstPerson(void)
if (dr != stplyr->kartstuff[k_drift]*16) if (dr != stplyr->kartstuff[k_drift]*16)
dr -= (dr - (stplyr->kartstuff[k_drift]*16))/8; dr -= (dr - (stplyr->kartstuff[k_drift]*16))/8;
if (splitscreen == 1) if (r_splitscreen == 1)
{ {
scale = (2*FRACUNIT)/3; scale = (2*FRACUNIT)/3;
y += FRACUNIT/(vid.dupx < vid.dupy ? vid.dupx : vid.dupy); // correct a one-pixel gap on the screen view (not the basevid view) y += FRACUNIT/(vid.dupx < vid.dupy ? vid.dupx : vid.dupy); // correct a one-pixel gap on the screen view (not the basevid view)
} }
else if (splitscreen) else if (r_splitscreen)
scale = FRACUNIT/2; scale = FRACUNIT/2;
else else
scale = FRACUNIT; scale = FRACUNIT;
@ -9457,7 +9457,7 @@ static void K_drawKartFirstPerson(void)
fixed_t xoffs = -P_ReturnThrustY(stplyr->mo, ang, (BASEVIDWIDTH<<(FRACBITS-2))/2); fixed_t xoffs = -P_ReturnThrustY(stplyr->mo, ang, (BASEVIDWIDTH<<(FRACBITS-2))/2);
fixed_t yoffs = -(P_ReturnThrustX(stplyr->mo, ang, 4*FRACUNIT) - 4*FRACUNIT); fixed_t yoffs = -(P_ReturnThrustX(stplyr->mo, ang, 4*FRACUNIT) - 4*FRACUNIT);
if (splitscreen) if (r_splitscreen)
xoffs = FixedMul(xoffs, scale); xoffs = FixedMul(xoffs, scale);
xoffs -= (tn)*scale; xoffs -= (tn)*scale;
@ -9470,7 +9470,7 @@ static void K_drawKartFirstPerson(void)
if (mag < FRACUNIT) if (mag < FRACUNIT)
{ {
xoffs = FixedMul(xoffs, mag); xoffs = FixedMul(xoffs, mag);
if (!splitscreen) if (!r_splitscreen)
yoffs = FixedMul(yoffs, mag); yoffs = FixedMul(yoffs, mag);
} }
} }
@ -9482,7 +9482,7 @@ static void K_drawKartFirstPerson(void)
x -= xoffs; x -= xoffs;
else else
x += xoffs; x += xoffs;
if (!splitscreen) if (!r_splitscreen)
y += yoffs; y += yoffs;
} }
@ -9502,11 +9502,11 @@ static void K_drawKartFirstPerson(void)
V_DrawFixedPatch(x, y, scale, splitflags, kp_fpview[target], colmap); V_DrawFixedPatch(x, y, scale, splitflags, kp_fpview[target], colmap);
if (stplyr == &players[displayplayers[1]] && splitscreen) if (stplyr == &players[displayplayers[1]] && r_splitscreen)
{ pnum[1] = pn; turn[1] = tn; drift[1] = dr; } { pnum[1] = pn; turn[1] = tn; drift[1] = dr; }
else if (stplyr == &players[displayplayers[2]] && splitscreen > 1) else if (stplyr == &players[displayplayers[2]] && r_splitscreen > 1)
{ pnum[2] = pn; turn[2] = tn; drift[2] = dr; } { pnum[2] = pn; turn[2] = tn; drift[2] = dr; }
else if (stplyr == &players[displayplayers[3]] && splitscreen > 2) else if (stplyr == &players[displayplayers[3]] && r_splitscreen > 2)
{ pnum[3] = pn; turn[3] = tn; drift[3] = dr; } { pnum[3] = pn; turn[3] = tn; drift[3] = dr; }
else else
{ pnum[0] = pn; turn[0] = tn; drift[0] = dr; } { pnum[0] = pn; turn[0] = tn; drift[0] = dr; }
@ -9832,7 +9832,7 @@ void K_drawKartHUD(void)
K_initKartHUD(); K_initKartHUD();
// Draw that fun first person HUD! Drawn ASAP so it looks more "real". // Draw that fun first person HUD! Drawn ASAP so it looks more "real".
for (i = 0; i <= splitscreen; i++) for (i = 0; i <= r_splitscreen; i++)
{ {
if (stplyr == &players[displayplayers[i]] && !camera[i].chase) if (stplyr == &players[displayplayers[i]] && !camera[i].chase)
K_drawKartFirstPerson(); K_drawKartFirstPerson();
@ -9852,10 +9852,10 @@ void K_drawKartHUD(void)
&& comeback && comeback
&& stplyr->playerstate == PST_LIVE))); && stplyr->playerstate == PST_LIVE)));
if (!demo.title && (!battlefullscreen || splitscreen)) if (!demo.title && (!battlefullscreen || r_splitscreen))
{ {
// Draw the CHECK indicator before the other items, so it's overlapped by everything else // Draw the CHECK indicator before the other items, so it's overlapped by everything else
if (cv_kartcheck.value && !splitscreen && !players[displayplayers[0]].exiting) if (cv_kartcheck.value && !r_splitscreen && !players[displayplayers[0]].exiting)
K_drawKartPlayerCheck(); K_drawKartPlayerCheck();
// Draw WANTED status // Draw WANTED status
@ -9892,7 +9892,7 @@ void K_drawKartHUD(void)
K_drawKartItem(); K_drawKartItem();
// If not splitscreen, draw... // If not splitscreen, draw...
if (!splitscreen && !demo.title) if (!r_splitscreen && !demo.title)
{ {
// Draw the timestamp // Draw the timestamp
#ifdef HAVE_BLUA #ifdef HAVE_BLUA
@ -9913,7 +9913,7 @@ void K_drawKartHUD(void)
if (!stplyr->spectator) // Bottom of the screen elements, don't need in spectate mode if (!stplyr->spectator) // Bottom of the screen elements, don't need in spectate mode
{ {
// Draw the speedometer // Draw the speedometer
if (cv_kartspeedometer.value && !splitscreen) if (cv_kartspeedometer.value && !r_splitscreen)
{ {
#ifdef HAVE_BLUA #ifdef HAVE_BLUA
if (LUA_HudEnabled(hud_speedometer)) if (LUA_HudEnabled(hud_speedometer))
@ -9925,7 +9925,7 @@ void K_drawKartHUD(void)
{ {
INT32 x = BASEVIDWIDTH - 32, y = 128, offs; INT32 x = BASEVIDWIDTH - 32, y = 128, offs;
if (splitscreen == 3) if (r_splitscreen == 3)
{ {
x = BASEVIDWIDTH/2 + 10; x = BASEVIDWIDTH/2 + 10;
y = BASEVIDHEIGHT/2 - 30; y = BASEVIDHEIGHT/2 - 30;
@ -9984,11 +9984,11 @@ void K_drawKartHUD(void)
if (leveltime >= starttime-(3*TICRATE) if (leveltime >= starttime-(3*TICRATE)
&& leveltime < starttime+TICRATE) && leveltime < starttime+TICRATE)
K_drawKartStartCountdown(); K_drawKartStartCountdown();
else if (countdown && (!splitscreen || !stplyr->exiting)) else if (countdown && (!r_splitscreen || !stplyr->exiting))
{ {
char *countstr = va("%d", countdown/TICRATE); char *countstr = va("%d", countdown/TICRATE);
if (splitscreen > 1) if (r_splitscreen > 1)
V_DrawCenteredString(BASEVIDWIDTH/4, LAPS_Y+1, K_calcSplitFlags(0), countstr); V_DrawCenteredString(BASEVIDWIDTH/4, LAPS_Y+1, K_calcSplitFlags(0), countstr);
else else
{ {
@ -10002,14 +10002,14 @@ void K_drawKartHUD(void)
{ {
if (stplyr->exiting) if (stplyr->exiting)
K_drawKartFinish(); K_drawKartFinish();
else if (stplyr->karthud[khud_lapanimation] && !splitscreen) else if (stplyr->karthud[khud_lapanimation] && !r_splitscreen)
K_drawLapStartAnim(); K_drawLapStartAnim();
} }
if (modeattacking) // everything after here is MP and debug only if (modeattacking) // everything after here is MP and debug only
return; return;
if (G_BattleGametype() && !splitscreen && (stplyr->karthud[khud_yougotem] % 2)) // * YOU GOT EM * if (G_BattleGametype() && !r_splitscreen && (stplyr->karthud[khud_yougotem] % 2)) // * YOU GOT EM *
V_DrawScaledPatch(BASEVIDWIDTH/2 - (SHORT(kp_yougotem->width)/2), 32, V_HUDTRANS, kp_yougotem); V_DrawScaledPatch(BASEVIDWIDTH/2 - (SHORT(kp_yougotem->width)/2), 32, V_HUDTRANS, kp_yougotem);
// Draw FREE PLAY. // Draw FREE PLAY.

View file

@ -125,7 +125,7 @@ void COM_Lua_f(void)
lua_pop(gL, 1); // pop command info table lua_pop(gL, 1); // pop command info table
return; // can't execute splitscreen command without player 2! return; // can't execute splitscreen command without player 2!
} }
playernum = displayplayers[1]; playernum = displayplayers[localdisplayplayers[1]];
} }
if (netgame) if (netgame)

View file

@ -426,15 +426,15 @@ static int libd_drawOnMinimap(lua_State *L)
// first, check what position the mmap is supposed to be in (pasted from k_kart.c): // first, check what position the mmap is supposed to be in (pasted from k_kart.c):
MM_X = BASEVIDWIDTH - 50; // 270 MM_X = BASEVIDWIDTH - 50; // 270
MM_Y = (BASEVIDHEIGHT/2)-16; // 84 MM_Y = (BASEVIDHEIGHT/2)-16; // 84
if (splitscreen) if (r_splitscreen)
{ {
MM_Y = (BASEVIDHEIGHT/2); MM_Y = (BASEVIDHEIGHT/2);
if (splitscreen > 1) // 3P : bottom right if (r_splitscreen > 1) // 3P : bottom right
{ {
MM_X = (3*BASEVIDWIDTH/4); MM_X = (3*BASEVIDWIDTH/4);
MM_Y = (3*BASEVIDHEIGHT/4); MM_Y = (3*BASEVIDHEIGHT/4);
if (splitscreen > 2) // 4P: centered if (r_splitscreen > 2) // 4P: centered
{ {
MM_X = (BASEVIDWIDTH/2); MM_X = (BASEVIDWIDTH/2);
MM_Y = (BASEVIDHEIGHT/2); MM_Y = (BASEVIDHEIGHT/2);
@ -443,7 +443,7 @@ static int libd_drawOnMinimap(lua_State *L)
} }
// splitscreen flags // splitscreen flags
splitflags = (splitscreen == 3 ? 0 : V_SNAPTORIGHT); // flags should only be 0 when it's centered (4p split) splitflags = (r_splitscreen == 3 ? 0 : V_SNAPTORIGHT); // flags should only be 0 when it's centered (4p split)
// translucency: // translucency:
if (timeinmap > 105) if (timeinmap > 105)
@ -461,7 +461,7 @@ static int libd_drawOnMinimap(lua_State *L)
minimaptrans = ((10-minimaptrans)<<FF_TRANSSHIFT); minimaptrans = ((10-minimaptrans)<<FF_TRANSSHIFT);
splitflags |= minimaptrans; splitflags |= minimaptrans;
if (!(splitscreen == 2)) if (!(r_splitscreen == 2))
{ {
splitflags &= ~minimaptrans; splitflags &= ~minimaptrans;
splitflags |= V_HUDTRANSHALF; splitflags |= V_HUDTRANSHALF;
@ -973,17 +973,17 @@ void LUAh_GameHUD(player_t *stplayr)
lua_remove(gL, -3); // pop HUD lua_remove(gL, -3); // pop HUD
LUA_PushUserdata(gL, stplayr, META_PLAYER); LUA_PushUserdata(gL, stplayr, META_PLAYER);
if (splitscreen > 2 && stplayr == &players[displayplayers[3]]) if (r_splitscreen > 2 && stplayr == &players[displayplayers[3]])
{ {
LUA_PushUserdata(gL, &camera[3], META_CAMERA); LUA_PushUserdata(gL, &camera[3], META_CAMERA);
camnum = 4; camnum = 4;
} }
else if (splitscreen > 1 && stplayr == &players[displayplayers[2]]) else if (r_splitscreen > 1 && stplayr == &players[displayplayers[2]])
{ {
LUA_PushUserdata(gL, &camera[2], META_CAMERA); LUA_PushUserdata(gL, &camera[2], META_CAMERA);
camnum = 3; camnum = 3;
} }
else if (splitscreen && stplayr == &players[displayplayers[1]]) else if (r_splitscreen && stplayr == &players[displayplayers[1]])
{ {
LUA_PushUserdata(gL, &camera[1], META_CAMERA); LUA_PushUserdata(gL, &camera[1], META_CAMERA);
camnum = 2; camnum = 2;

View file

@ -5789,9 +5789,9 @@ static void M_DrawPlaybackMenu(void)
{ {
PlaybackMenu[playback_viewcount].status = IT_ARROWS|IT_STRING; PlaybackMenu[playback_viewcount].status = IT_ARROWS|IT_STRING;
for (i = 0; i <= splitscreen; i++) for (i = 0; i <= r_splitscreen; i++)
PlaybackMenu[playback_view1+i].status = IT_ARROWS|IT_STRING; PlaybackMenu[playback_view1+i].status = IT_ARROWS|IT_STRING;
for (i = splitscreen+1; i < 4; i++) for (i = r_splitscreen+1; i < 4; i++)
PlaybackMenu[playback_view1+i].status = IT_DISABLED; PlaybackMenu[playback_view1+i].status = IT_DISABLED;
//PlaybackMenu[playback_moreoptions].alphaKey = 156; //PlaybackMenu[playback_moreoptions].alphaKey = 156;
@ -5814,7 +5814,7 @@ static void M_DrawPlaybackMenu(void)
{ {
if (modeattacking) continue; if (modeattacking) continue;
if (splitscreen >= i - playback_view1) if (r_splitscreen >= i - playback_view1)
{ {
INT32 ply = displayplayers[i - playback_view1]; INT32 ply = displayplayers[i - playback_view1];
@ -5850,18 +5850,18 @@ static void M_DrawPlaybackMenu(void)
{ {
char *str; char *str;
if (!(i == playback_viewcount && splitscreen == 3)) if (!(i == playback_viewcount && r_splitscreen == 3))
V_DrawCharacter(BASEVIDWIDTH/2 - 4, currentMenu->y + 28 - (skullAnimCounter/5), V_DrawCharacter(BASEVIDWIDTH/2 - 4, currentMenu->y + 28 - (skullAnimCounter/5),
'\x1A' | V_SNAPTOTOP|highlightflags, false); // up arrow '\x1A' | V_SNAPTOTOP|highlightflags, false); // up arrow
if (!(i == playback_viewcount && splitscreen == 0)) if (!(i == playback_viewcount && r_splitscreen == 0))
V_DrawCharacter(BASEVIDWIDTH/2 - 4, currentMenu->y + 48 + (skullAnimCounter/5), V_DrawCharacter(BASEVIDWIDTH/2 - 4, currentMenu->y + 48 + (skullAnimCounter/5),
'\x1B' | V_SNAPTOTOP|highlightflags, false); // down arrow '\x1B' | V_SNAPTOTOP|highlightflags, false); // down arrow
switch (i) switch (i)
{ {
case playback_viewcount: case playback_viewcount:
str = va("%d", splitscreen+1); str = va("%d", r_splitscreen+1);
break; break;
case playback_view1: case playback_view1:
@ -5954,12 +5954,12 @@ static void M_PlaybackSetViews(INT32 choice)
{ {
if (choice > 0) if (choice > 0)
{ {
if (splitscreen < 3) if (r_splitscreen < 3)
G_AdjustView(splitscreen + 2, 0, true); G_AdjustView(r_splitscreen + 2, 0, true);
} }
else if (splitscreen) else if (r_splitscreen)
{ {
splitscreen--; r_splitscreen--;
R_ExecuteSetViewSize(); R_ExecuteSetViewSize();
} }
} }
@ -9525,7 +9525,7 @@ static void M_SetupMultiPlayer2(INT32 choice)
strcpy (setupm_name, cv_playername2.string); strcpy (setupm_name, cv_playername2.string);
// set for splitscreen secondary player // set for splitscreen secondary player
setupm_player = &players[displayplayers[1]]; setupm_player = &players[displayplayers[localdisplayplayers[1]]];
setupm_cvskin = &cv_skin2; setupm_cvskin = &cv_skin2;
setupm_cvcolor = &cv_playercolor2; setupm_cvcolor = &cv_playercolor2;
setupm_cvname = &cv_playername2; setupm_cvname = &cv_playername2;
@ -9537,7 +9537,7 @@ static void M_SetupMultiPlayer2(INT32 choice)
setupm_fakecolor = setupm_cvcolor->value; setupm_fakecolor = setupm_cvcolor->value;
// disable skin changes if we can't actually change skins // disable skin changes if we can't actually change skins
if (splitscreen && !CanChangeSkin(displayplayers[1])) if (splitscreen && !CanChangeSkin(displayplayers[localdisplayplayers[1]]))
MP_PlayerSetupMenu[2].status = (IT_GRAYEDOUT); MP_PlayerSetupMenu[2].status = (IT_GRAYEDOUT);
else else
MP_PlayerSetupMenu[2].status = (IT_KEYHANDLER | IT_STRING); MP_PlayerSetupMenu[2].status = (IT_KEYHANDLER | IT_STRING);
@ -9556,7 +9556,7 @@ static void M_SetupMultiPlayer3(INT32 choice)
strcpy(setupm_name, cv_playername3.string); strcpy(setupm_name, cv_playername3.string);
// set for splitscreen third player // set for splitscreen third player
setupm_player = &players[displayplayers[2]]; setupm_player = &players[displayplayers[localdisplayplayers[2]]];
setupm_cvskin = &cv_skin3; setupm_cvskin = &cv_skin3;
setupm_cvcolor = &cv_playercolor3; setupm_cvcolor = &cv_playercolor3;
setupm_cvname = &cv_playername3; setupm_cvname = &cv_playername3;
@ -9568,7 +9568,7 @@ static void M_SetupMultiPlayer3(INT32 choice)
setupm_fakecolor = setupm_cvcolor->value; setupm_fakecolor = setupm_cvcolor->value;
// disable skin changes if we can't actually change skins // disable skin changes if we can't actually change skins
if (splitscreen > 1 && !CanChangeSkin(displayplayers[2])) if (splitscreen > 1 && !CanChangeSkin(displayplayers[localdisplayplayers[2]]))
MP_PlayerSetupMenu[2].status = (IT_GRAYEDOUT); MP_PlayerSetupMenu[2].status = (IT_GRAYEDOUT);
else else
MP_PlayerSetupMenu[2].status = (IT_KEYHANDLER | IT_STRING); MP_PlayerSetupMenu[2].status = (IT_KEYHANDLER | IT_STRING);
@ -9587,7 +9587,7 @@ static void M_SetupMultiPlayer4(INT32 choice)
strcpy(setupm_name, cv_playername4.string); strcpy(setupm_name, cv_playername4.string);
// set for splitscreen fourth player // set for splitscreen fourth player
setupm_player = &players[displayplayers[3]]; setupm_player = &players[displayplayers[localdisplayplayers[3]]];
setupm_cvskin = &cv_skin4; setupm_cvskin = &cv_skin4;
setupm_cvcolor = &cv_playercolor4; setupm_cvcolor = &cv_playercolor4;
setupm_cvname = &cv_playername4; setupm_cvname = &cv_playername4;
@ -9599,7 +9599,7 @@ static void M_SetupMultiPlayer4(INT32 choice)
setupm_fakecolor = setupm_cvcolor->value; setupm_fakecolor = setupm_cvcolor->value;
// disable skin changes if we can't actually change skins // disable skin changes if we can't actually change skins
if (splitscreen > 2 && !CanChangeSkin(displayplayers[3])) if (splitscreen > 2 && !CanChangeSkin(displayplayers[localdisplayplayers[3]]))
MP_PlayerSetupMenu[2].status = (IT_GRAYEDOUT); MP_PlayerSetupMenu[2].status = (IT_GRAYEDOUT);
else else
MP_PlayerSetupMenu[2].status = (IT_KEYHANDLER | IT_STRING); MP_PlayerSetupMenu[2].status = (IT_KEYHANDLER | IT_STRING);

View file

@ -743,12 +743,12 @@ static void M_PNGText(png_structp png_ptr, png_infop png_info_ptr, PNG_CONST png
else else
snprintf(lvlttltext, 48, "Unknown"); snprintf(lvlttltext, 48, "Unknown");
if (gamestate == GS_LEVEL && &players[displayplayers[0]] && players[displayplayers[0]].mo) if (gamestate == GS_LEVEL && &players[displayplayers[localdisplayplayers[0]]] && players[displayplayers[localdisplayplayers[0]]].mo)
snprintf(locationtxt, 40, "X:%d Y:%d Z:%d A:%d", snprintf(locationtxt, 40, "X:%d Y:%d Z:%d A:%d",
players[displayplayers[0]].mo->x>>FRACBITS, players[displayplayers[localdisplayplayers[0]]].mo->x>>FRACBITS,
players[displayplayers[0]].mo->y>>FRACBITS, players[displayplayers[localdisplayplayers[0]]].mo->y>>FRACBITS,
players[displayplayers[0]].mo->z>>FRACBITS, players[displayplayers[localdisplayplayers[0]]].mo->z>>FRACBITS,
FixedInt(AngleFixed(players[displayplayers[0]].mo->angle))); FixedInt(AngleFixed(players[displayplayers[localdisplayplayers[0]]].mo->angle)));
else else
snprintf(locationtxt, 40, "Unknown"); snprintf(locationtxt, 40, "Unknown");

View file

@ -4229,7 +4229,7 @@ void A_OverlayThink(mobj_t *actor)
if (!actor->target) if (!actor->target)
return; return;
if (!splitscreen && rendermode != render_soft) if (!r_splitscreen && rendermode != render_soft)
{ {
angle_t viewingangle; angle_t viewingangle;

View file

@ -2536,9 +2536,9 @@ void T_CameraScanner(elevator_t *elevator)
lastleveltime = leveltime; lastleveltime = leveltime;
} }
if (players[displayplayers[0]].mo) if (players[displayplayers[localdisplayplayers[0]]].mo)
{ {
if (players[displayplayers[0]].mo->subsector->sector == elevator->actionsector) if (players[displayplayers[localdisplayplayers[0]]].mo->subsector->sector == elevator->actionsector)
{ {
if (t_cam_dist == -42) if (t_cam_dist == -42)
t_cam_dist = cv_cam_dist.value; t_cam_dist = cv_cam_dist.value;
@ -2564,9 +2564,9 @@ void T_CameraScanner(elevator_t *elevator)
} }
} }
if (splitscreen && players[displayplayers[1]].mo) if (splitscreen && players[displayplayers[localdisplayplayers[1]]].mo)
{ {
if (players[displayplayers[1]].mo->subsector->sector == elevator->actionsector) if (players[displayplayers[localdisplayplayers[1]]].mo->subsector->sector == elevator->actionsector)
{ {
if (t_cam2_rotate == -42) if (t_cam2_rotate == -42)
t_cam2_dist = cv_cam2_dist.value; t_cam2_dist = cv_cam2_dist.value;
@ -2592,9 +2592,9 @@ void T_CameraScanner(elevator_t *elevator)
} }
} }
if (splitscreen > 1 && players[displayplayers[2]].mo) if (splitscreen > 1 && players[displayplayers[localdisplayplayers[2]]].mo)
{ {
if (players[displayplayers[2]].mo->subsector->sector == elevator->actionsector) if (players[displayplayers[localdisplayplayers[2]]].mo->subsector->sector == elevator->actionsector)
{ {
if (t_cam3_rotate == -42) if (t_cam3_rotate == -42)
t_cam3_dist = cv_cam3_dist.value; t_cam3_dist = cv_cam3_dist.value;
@ -2620,9 +2620,9 @@ void T_CameraScanner(elevator_t *elevator)
} }
} }
if (splitscreen > 2 && players[displayplayers[3]].mo) if (splitscreen > 2 && players[displayplayers[localdisplayplayers[3]]].mo)
{ {
if (players[displayplayers[3]].mo->subsector->sector == elevator->actionsector) if (players[displayplayers[localdisplayplayers[3]]].mo->subsector->sector == elevator->actionsector)
{ {
if (t_cam4_rotate == -42) if (t_cam4_rotate == -42)
t_cam4_dist = cv_cam4_dist.value; t_cam4_dist = cv_cam4_dist.value;

View file

@ -63,11 +63,11 @@ void P_ForceConstant(const BasicFF_t *FFInfo)
ConstantQuake.Magnitude = FFInfo->Magnitude; ConstantQuake.Magnitude = FFInfo->Magnitude;
if (FFInfo->player == &players[consoleplayer]) if (FFInfo->player == &players[consoleplayer])
I_Tactile(ConstantForce, &ConstantQuake); I_Tactile(ConstantForce, &ConstantQuake);
else if (splitscreen && FFInfo->player == &players[displayplayers[1]]) else if (splitscreen && FFInfo->player == &players[displayplayers[localdisplayplayers[1]]])
I_Tactile2(ConstantForce, &ConstantQuake); I_Tactile2(ConstantForce, &ConstantQuake);
else if (splitscreen > 1 && FFInfo->player == &players[displayplayers[2]]) else if (splitscreen > 1 && FFInfo->player == &players[displayplayers[localdisplayplayers[2]]])
I_Tactile3(ConstantForce, &ConstantQuake); I_Tactile3(ConstantForce, &ConstantQuake);
else if (splitscreen > 2 && FFInfo->player == &players[displayplayers[3]]) else if (splitscreen > 2 && FFInfo->player == &players[displayplayers[localdisplayplayers[3]]])
I_Tactile4(ConstantForce, &ConstantQuake); I_Tactile4(ConstantForce, &ConstantQuake);
} }
void P_RampConstant(const BasicFF_t *FFInfo, INT32 Start, INT32 End) void P_RampConstant(const BasicFF_t *FFInfo, INT32 Start, INT32 End)
@ -84,11 +84,11 @@ void P_RampConstant(const BasicFF_t *FFInfo, INT32 Start, INT32 End)
RampQuake.End = End; RampQuake.End = End;
if (FFInfo->player == &players[consoleplayer]) if (FFInfo->player == &players[consoleplayer])
I_Tactile(ConstantForce, &RampQuake); I_Tactile(ConstantForce, &RampQuake);
else if (splitscreen && FFInfo->player == &players[displayplayers[1]]) else if (splitscreen && FFInfo->player == &players[displayplayers[localdisplayplayers[1]]])
I_Tactile2(ConstantForce, &RampQuake); I_Tactile2(ConstantForce, &RampQuake);
else if (splitscreen > 1 && FFInfo->player == &players[displayplayers[2]]) else if (splitscreen > 1 && FFInfo->player == &players[displayplayers[localdisplayplayers[2]]])
I_Tactile3(ConstantForce, &RampQuake); I_Tactile3(ConstantForce, &RampQuake);
else if (splitscreen > 2 && FFInfo->player == &players[displayplayers[3]]) else if (splitscreen > 2 && FFInfo->player == &players[displayplayers[localdisplayplayers[3]]])
I_Tactile4(ConstantForce, &RampQuake); I_Tactile4(ConstantForce, &RampQuake);
} }

View file

@ -2568,7 +2568,7 @@ boolean P_TryCameraMove(fixed_t x, fixed_t y, camera_t *thiscam)
itsatwodlevel = true; itsatwodlevel = true;
else else
{ {
for (i = 0; i <= splitscreen; i++) for (i = 0; i <= r_splitscreen; i++)
{ {
if (thiscam == &camera[i] && players[displayplayers[i]].mo if (thiscam == &camera[i] && players[displayplayers[i]].mo
&& (players[displayplayers[i]].mo->flags2 & MF2_TWOD)) && (players[displayplayers[i]].mo->flags2 & MF2_TWOD))
@ -2584,7 +2584,7 @@ boolean P_TryCameraMove(fixed_t x, fixed_t y, camera_t *thiscam)
fixed_t tryx = thiscam->x; fixed_t tryx = thiscam->x;
fixed_t tryy = thiscam->y; fixed_t tryy = thiscam->y;
for (i = 0; i <= splitscreen; i++) for (i = 0; i <= r_splitscreen; i++)
{ {
#ifndef NOCLIPCAM #ifndef NOCLIPCAM
if ((thiscam == &camera[i] && (players[displayplayers[i]].pflags & PF_NOCLIP)) || (leveltime < introtime)) // Noclipping player camera noclips too!! if ((thiscam == &camera[i] && (players[displayplayers[i]].pflags & PF_NOCLIP)) || (leveltime < introtime)) // Noclipping player camera noclips too!!

View file

@ -1171,7 +1171,7 @@ static void P_PlayerFlip(mobj_t *mo)
mo->player->aiming = InvAngle(mo->player->aiming); mo->player->aiming = InvAngle(mo->player->aiming);
for (i = 0; i <= splitscreen; i++) for (i = 0; i <= r_splitscreen; i++)
{ {
if (mo->player-players == displayplayers[i]) if (mo->player-players == displayplayers[i])
{ {
@ -3565,7 +3565,7 @@ boolean P_CameraThinker(player_t *player, camera_t *thiscam, boolean resetcalled
itsatwodlevel = true; itsatwodlevel = true;
else else
{ {
for (i = 0; i <= splitscreen; i++) for (i = 0; i <= r_splitscreen; i++)
{ {
if (thiscam == &camera[i] && players[displayplayers[i]].mo if (thiscam == &camera[i] && players[displayplayers[i]].mo
&& (players[displayplayers[i]].mo->flags2 & MF2_TWOD)) && (players[displayplayers[i]].mo->flags2 & MF2_TWOD))
@ -3606,7 +3606,7 @@ boolean P_CameraThinker(player_t *player, camera_t *thiscam, boolean resetcalled
if (postimg != postimg_none) if (postimg != postimg_none)
{ {
for (i = 0; i <= splitscreen; i++) for (i = 0; i <= r_splitscreen; i++)
{ {
if (player == &players[displayplayers[i]]) if (player == &players[displayplayers[i]])
postimgtype[i] = postimg; postimgtype[i] = postimg;
@ -3656,11 +3656,11 @@ boolean P_CameraThinker(player_t *player, camera_t *thiscam, boolean resetcalled
fixed_t cam_height = cv_cam_height.value; fixed_t cam_height = cv_cam_height.value;
thiscam->z = thiscam->floorz; thiscam->z = thiscam->floorz;
if (player == &players[displayplayers[1]]) if (player == &players[displayplayers[localdisplayplayers[1]]])
cam_height = cv_cam2_height.value; cam_height = cv_cam2_height.value;
if (player == &players[displayplayers[2]]) if (player == &players[displayplayers[localdisplayplayers[2]]])
cam_height = cv_cam3_height.value; cam_height = cv_cam3_height.value;
if (player == &players[displayplayers[3]]) if (player == &players[displayplayers[localdisplayplayers[3]]])
cam_height = cv_cam4_height.value; cam_height = cv_cam4_height.value;
if (thiscam->z > player->mo->z + player->mo->height + FixedMul(cam_height*FRACUNIT + 16*FRACUNIT, player->mo->scale)) if (thiscam->z > player->mo->z + player->mo->height + FixedMul(cam_height*FRACUNIT + 16*FRACUNIT, player->mo->scale))
{ {
@ -6112,7 +6112,7 @@ void P_RunOverlays(void)
if (!mo->target) if (!mo->target)
continue; continue;
if (!splitscreen /*&& rendermode != render_soft*/) if (!r_splitscreen /*&& rendermode != render_soft*/)
{ {
angle_t viewingangle; angle_t viewingangle;
@ -6635,7 +6635,7 @@ void P_RunBattleOvertime(void)
{ {
UINT8 transparency = tr_trans50; UINT8 transparency = tr_trans50;
if (!splitscreen && players[displayplayers[0]].mo) if (!r_splitscreen && players[displayplayers[0]].mo)
{ {
INT32 dist = P_AproxDistance(battleovertime.x-players[displayplayers[0]].mo->x, battleovertime.y-players[displayplayers[0]].mo->y); INT32 dist = P_AproxDistance(battleovertime.x-players[displayplayers[0]].mo->x, battleovertime.y-players[displayplayers[0]].mo->y);
transparency = max(0, NUMTRANSMAPS - ((256 + (dist>>FRACBITS)) / 256)); transparency = max(0, NUMTRANSMAPS - ((256 + (dist>>FRACBITS)) / 256));
@ -7094,7 +7094,7 @@ void P_MobjThinker(mobj_t *mobj)
mobj->angle = R_PointToAngle(mobj->x, mobj->y) + ANGLE_90; // literally only happened because i wanted to ^L^R the SPR_ITEM's mobj->angle = R_PointToAngle(mobj->x, mobj->y) + ANGLE_90; // literally only happened because i wanted to ^L^R the SPR_ITEM's
if (!splitscreen && players[displayplayers[0]].mo) if (!r_splitscreen && players[displayplayers[0]].mo)
{ {
scale = mobj->target->scale + FixedMul(FixedDiv(abs(P_AproxDistance(players[displayplayers[0]].mo->x-mobj->target->x, scale = mobj->target->scale + FixedMul(FixedDiv(abs(P_AproxDistance(players[displayplayers[0]].mo->x-mobj->target->x,
players[displayplayers[0]].mo->y-mobj->target->y)), RING_DIST), mobj->target->scale); players[displayplayers[0]].mo->y-mobj->target->y)), RING_DIST), mobj->target->scale);
@ -7282,7 +7282,7 @@ void P_MobjThinker(mobj_t *mobj)
if (mobj->target && mobj->target->health && mobj->tracer if (mobj->target && mobj->target->health && mobj->tracer
&& mobj->target->player && !mobj->target->player->spectator && mobj->target->player && !mobj->target->player->spectator
&& mobj->target->player->health && mobj->target->player->playerstate != PST_DEAD && mobj->target->player->health && mobj->target->player->playerstate != PST_DEAD
&& players[displayplayers[0]].mo && !players[displayplayers[0]].spectator) && players[displayplayers[localdisplayplayers[0]]].mo && !players[displayplayers[localdisplayplayers[0]]].spectator)
{ {
fixed_t scale = 3*mobj->target->scale; fixed_t scale = 3*mobj->target->scale;
@ -7302,7 +7302,7 @@ void P_MobjThinker(mobj_t *mobj)
mobj->x = mobj->target->x; mobj->x = mobj->target->x;
mobj->y = mobj->target->y; mobj->y = mobj->target->y;
if (!splitscreen && players[displayplayers[0]].mo) if (!r_splitscreen && players[displayplayers[0]].mo)
{ {
scale = mobj->target->scale + FixedMul(FixedDiv(abs(P_AproxDistance(players[displayplayers[0]].mo->x-mobj->target->x, scale = mobj->target->scale + FixedMul(FixedDiv(abs(P_AproxDistance(players[displayplayers[0]].mo->x-mobj->target->x,
players[displayplayers[0]].mo->y-mobj->target->y)), RING_DIST), mobj->target->scale); players[displayplayers[0]].mo->y-mobj->target->y)), RING_DIST), mobj->target->scale);
@ -8807,7 +8807,7 @@ void P_MobjThinker(mobj_t *mobj)
} }
P_SetScale(mobj, (mobj->destscale = (5*mobj->target->destscale)>>2)); P_SetScale(mobj, (mobj->destscale = (5*mobj->target->destscale)>>2));
if (!splitscreen /*&& rendermode != render_soft*/) if (!r_splitscreen /*&& rendermode != render_soft*/)
{ {
angle_t viewingangle; angle_t viewingangle;
statenum_t curstate = ((mobj->tics == 1) ? (mobj->state->nextstate) : ((statenum_t)(mobj->state-states))); statenum_t curstate = ((mobj->tics == 1) ? (mobj->state->nextstate) : ((statenum_t)(mobj->state-states)));
@ -11136,13 +11136,13 @@ void P_PrecipitationEffects(void)
// Local effects from here on out! // Local effects from here on out!
// If we're not in game fully yet, we don't worry about them. // If we're not in game fully yet, we don't worry about them.
if (!playeringame[displayplayers[0]] || !players[displayplayers[0]].mo) if (!playeringame[displayplayers[localdisplayplayers[0]]] || !players[displayplayers[localdisplayplayers[0]]].mo)
return; return;
if (sound_disabled) if (sound_disabled)
return; // Sound off? D'aw, no fun. return; // Sound off? D'aw, no fun.
if (players[displayplayers[0]].mo->subsector->sector->ceilingpic == skyflatnum) if (players[displayplayers[localdisplayplayers[0]]].mo->subsector->sector->ceilingpic == skyflatnum)
volume = 255; // Sky above? We get it full blast. volume = 255; // Sky above? We get it full blast.
else else
{ {
@ -11150,17 +11150,17 @@ void P_PrecipitationEffects(void)
fixed_t closedist, newdist; fixed_t closedist, newdist;
// Essentially check in a 1024 unit radius of the player for an outdoor area. // Essentially check in a 1024 unit radius of the player for an outdoor area.
yl = players[displayplayers[0]].mo->y - 1024*FRACUNIT; yl = players[displayplayers[localdisplayplayers[0]]].mo->y - 1024*FRACUNIT;
yh = players[displayplayers[0]].mo->y + 1024*FRACUNIT; yh = players[displayplayers[localdisplayplayers[0]]].mo->y + 1024*FRACUNIT;
xl = players[displayplayers[0]].mo->x - 1024*FRACUNIT; xl = players[displayplayers[localdisplayplayers[0]]].mo->x - 1024*FRACUNIT;
xh = players[displayplayers[0]].mo->x + 1024*FRACUNIT; xh = players[displayplayers[localdisplayplayers[0]]].mo->x + 1024*FRACUNIT;
closedist = 2048*FRACUNIT; closedist = 2048*FRACUNIT;
for (y = yl; y <= yh; y += FRACUNIT*64) for (y = yl; y <= yh; y += FRACUNIT*64)
for (x = xl; x <= xh; x += FRACUNIT*64) for (x = xl; x <= xh; x += FRACUNIT*64)
{ {
if (R_PointInSubsector(x, y)->sector->ceilingpic == skyflatnum) // Found the outdoors! if (R_PointInSubsector(x, y)->sector->ceilingpic == skyflatnum) // Found the outdoors!
{ {
newdist = S_CalculateSoundDistance(players[displayplayers[0]].mo->x, players[displayplayers[0]].mo->y, 0, x, y, 0); newdist = S_CalculateSoundDistance(players[displayplayers[localdisplayplayers[0]]].mo->x, players[displayplayers[localdisplayplayers[0]]].mo->y, 0, x, y, 0);
if (newdist < closedist) if (newdist < closedist)
closedist = newdist; closedist = newdist;
} }
@ -11175,7 +11175,7 @@ void P_PrecipitationEffects(void)
volume = 255; volume = 255;
if (sounds_rain && (!leveltime || leveltime % 80 == 1)) if (sounds_rain && (!leveltime || leveltime % 80 == 1))
S_StartSoundAtVolume(players[displayplayers[0]].mo, sfx_rainin, volume); S_StartSoundAtVolume(players[displayplayers[localdisplayplayers[0]]].mo, sfx_rainin, volume);
if (!sounds_thunder) if (!sounds_thunder)
return; return;
@ -11183,7 +11183,7 @@ void P_PrecipitationEffects(void)
if (effects_lightning && lightningStrike && volume) if (effects_lightning && lightningStrike && volume)
{ {
// Large, close thunder sounds to go with our lightning. // Large, close thunder sounds to go with our lightning.
S_StartSoundAtVolume(players[displayplayers[0]].mo, sfx_litng1 + M_RandomKey(4), volume); S_StartSoundAtVolume(players[displayplayers[localdisplayplayers[0]]].mo, sfx_litng1 + M_RandomKey(4), volume);
} }
else if (thunderchance < 20) else if (thunderchance < 20)
{ {
@ -11191,7 +11191,7 @@ void P_PrecipitationEffects(void)
if (volume < 80) if (volume < 80)
volume = 80; volume = 80;
S_StartSoundAtVolume(players[displayplayers[0]].mo, sfx_athun1 + M_RandomKey(2), volume); S_StartSoundAtVolume(players[displayplayers[localdisplayplayers[0]]].mo, sfx_athun1 + M_RandomKey(2), volume);
} }
} }
@ -11525,9 +11525,9 @@ void P_AfterPlayerSpawn(INT32 playernum)
if (playernum == consoleplayer) if (playernum == consoleplayer)
localangle[0] = mobj->angle; localangle[0] = mobj->angle;
else if (splitscreen) else if (r_splitscreen)
{ {
for (i = 1; i <= splitscreen; i++) for (i = 1; i <= r_splitscreen; i++)
{ {
if (playernum == displayplayers[i]) if (playernum == displayplayers[i])
{ {
@ -11557,7 +11557,7 @@ void P_AfterPlayerSpawn(INT32 playernum)
SV_SpawnPlayer(playernum, mobj->x, mobj->y, mobj->angle); SV_SpawnPlayer(playernum, mobj->x, mobj->y, mobj->angle);
for (i = 0; i <= splitscreen; i++) for (i = 0; i <= r_splitscreen; i++)
{ {
if (camera[i].chase) if (camera[i].chase)
{ {

View file

@ -2567,29 +2567,29 @@ static void P_ForceCharacter(const char *forcecharskin)
{ {
if (splitscreen) if (splitscreen)
{ {
SetPlayerSkin(displayplayers[1], forcecharskin); SetPlayerSkin(displayplayers[localdisplayplayers[1]], forcecharskin);
if ((unsigned)cv_playercolor2.value != skins[players[displayplayers[1]].skin].prefcolor && !modeattacking) if ((unsigned)cv_playercolor2.value != skins[players[displayplayers[localdisplayplayers[1]]].skin].prefcolor && !modeattacking)
{ {
CV_StealthSetValue(&cv_playercolor2, skins[players[displayplayers[1]].skin].prefcolor); CV_StealthSetValue(&cv_playercolor2, skins[players[displayplayers[localdisplayplayers[1]]].skin].prefcolor);
players[displayplayers[1]].skincolor = skins[players[displayplayers[1]].skin].prefcolor; players[displayplayers[localdisplayplayers[1]]].skincolor = skins[players[displayplayers[localdisplayplayers[1]]].skin].prefcolor;
} }
if (splitscreen > 1) if (splitscreen > 1)
{ {
SetPlayerSkin(displayplayers[2], forcecharskin); SetPlayerSkin(displayplayers[localdisplayplayers[2]], forcecharskin);
if ((unsigned)cv_playercolor3.value != skins[players[displayplayers[2]].skin].prefcolor && !modeattacking) if ((unsigned)cv_playercolor3.value != skins[players[displayplayers[localdisplayplayers[2]]].skin].prefcolor && !modeattacking)
{ {
CV_StealthSetValue(&cv_playercolor3, skins[players[displayplayers[2]].skin].prefcolor); CV_StealthSetValue(&cv_playercolor3, skins[players[displayplayers[localdisplayplayers[2]]].skin].prefcolor);
players[displayplayers[2]].skincolor = skins[players[displayplayers[2]].skin].prefcolor; players[displayplayers[localdisplayplayers[2]]].skincolor = skins[players[displayplayers[localdisplayplayers[2]]].skin].prefcolor;
} }
if (splitscreen > 2) if (splitscreen > 2)
{ {
SetPlayerSkin(displayplayers[3], forcecharskin); SetPlayerSkin(displayplayers[localdisplayplayers[3]], forcecharskin);
if ((unsigned)cv_playercolor4.value != skins[players[displayplayers[3]].skin].prefcolor && !modeattacking) if ((unsigned)cv_playercolor4.value != skins[players[displayplayers[localdisplayplayers[3]]].skin].prefcolor && !modeattacking)
{ {
CV_StealthSetValue(&cv_playercolor4, skins[players[displayplayers[3]].skin].prefcolor); CV_StealthSetValue(&cv_playercolor4, skins[players[displayplayers[localdisplayplayers[3]]].skin].prefcolor);
players[displayplayers[3]].skincolor = skins[players[displayplayers[3]].skin].prefcolor; players[displayplayers[localdisplayplayers[3]]].skincolor = skins[players[displayplayers[localdisplayplayers[3]]].skin].prefcolor;
} }
} }
} }
@ -2824,7 +2824,7 @@ boolean P_SetupLevel(boolean skipprecip)
P_LevelInitStuff(); P_LevelInitStuff();
for (i = 0; i <= splitscreen; i++) for (i = 0; i <= r_splitscreen; i++)
postimgtype[i] = postimg_none; postimgtype[i] = postimg_none;
if (mapheaderinfo[gamemap-1]->forcecharacter[0] != '\0') if (mapheaderinfo[gamemap-1]->forcecharacter[0] != '\0')
@ -3228,7 +3228,7 @@ boolean P_SetupLevel(boolean skipprecip)
if (!dedicated) if (!dedicated)
{ {
for (i = 0; i <= splitscreen; i++) for (i = 0; i <= r_splitscreen; i++)
P_SetupCamera(displayplayers[i], &camera[i]); P_SetupCamera(displayplayers[i], &camera[i]);
// Salt: CV_ClearChangedFlags() messes with your settings :( // Salt: CV_ClearChangedFlags() messes with your settings :(
@ -3270,7 +3270,7 @@ boolean P_SetupLevel(boolean skipprecip)
/*if (rendermode != render_none) /*if (rendermode != render_none)
CV_Set(&cv_fov, cv_fov.defaultvalue);*/ CV_Set(&cv_fov, cv_fov.defaultvalue);*/
displayplayers[0] = consoleplayer; // Start with your OWN view, please! displayplayers[localdisplayplayers[0]] = consoleplayer; // Start with your OWN view, please!
} }
/*if (cv_useranalog.value) /*if (cv_useranalog.value)

View file

@ -2386,7 +2386,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
if (bot) // This might put poor Tails in a wall if he's too far behind! D: But okay, whatever! >:3 if (bot) // This might put poor Tails in a wall if he's too far behind! D: But okay, whatever! >:3
P_TeleportMove(bot, bot->x + x, bot->y + y, bot->z + z); P_TeleportMove(bot, bot->x + x, bot->y + y, bot->z + z);
for (i = 0; i <= splitscreen; i++) for (i = 0; i <= r_splitscreen; i++)
{ {
if (mo->player == &players[displayplayers[i]] && camera[i].chase) if (mo->player == &players[displayplayers[i]] && camera[i].chase)
{ {

View file

@ -66,9 +66,9 @@ void P_MixUp(mobj_t *thing, fixed_t x, fixed_t y, fixed_t z, angle_t angle,
// absolute angle position // absolute angle position
if (thing == players[consoleplayer].mo) if (thing == players[consoleplayer].mo)
localangle[0] = angle; localangle[0] = angle;
else if (splitscreen) else if (r_splitscreen)
{ {
for (i = 1; i <= splitscreen; i++) for (i = 1; i <= r_splitscreen; i++)
{ {
if (thing == players[displayplayers[i]].mo) if (thing == players[displayplayers[i]].mo)
{ {
@ -79,7 +79,7 @@ void P_MixUp(mobj_t *thing, fixed_t x, fixed_t y, fixed_t z, angle_t angle,
} }
// move chasecam at new player location // move chasecam at new player location
for (i = 0; i <= splitscreen; i++) for (i = 0; i <= r_splitscreen; i++)
{ {
if (thing->player == &players[displayplayers[i]] && camera[i].chase) if (thing->player == &players[displayplayers[i]] && camera[i].chase)
P_ResetCamera(thing->player, &camera[i]); P_ResetCamera(thing->player, &camera[i]);
@ -151,9 +151,9 @@ boolean P_Teleport(mobj_t *thing, fixed_t x, fixed_t y, fixed_t z, angle_t angle
// absolute angle position // absolute angle position
if (thing == players[consoleplayer].mo) if (thing == players[consoleplayer].mo)
localangle[0] = angle; localangle[0] = angle;
else if (splitscreen) else if (r_splitscreen)
{ {
for (i = 1; i <= splitscreen; i++) for (i = 1; i <= r_splitscreen; i++)
{ {
if (thing == players[displayplayers[i]].mo) if (thing == players[displayplayers[i]].mo)
{ {
@ -164,7 +164,7 @@ boolean P_Teleport(mobj_t *thing, fixed_t x, fixed_t y, fixed_t z, angle_t angle
} }
// move chasecam at new player location // move chasecam at new player location
for (i = 0; i <= splitscreen; i++) for (i = 0; i <= r_splitscreen; i++)
{ {
if (thing->player == &players[displayplayers[i]] && camera[i].chase) if (thing->player == &players[displayplayers[i]] && camera[i].chase)
P_ResetCamera(thing->player, &camera[i]); P_ResetCamera(thing->player, &camera[i]);

View file

@ -601,7 +601,7 @@ void P_Ticker(boolean run)
return; return;
} }
for (i = 0; i <= splitscreen; i++) for (i = 0; i <= r_splitscreen; i++)
postimgtype[i] = postimg_none; postimgtype[i] = postimg_none;
P_MapStart(); P_MapStart();
@ -751,7 +751,7 @@ void P_Ticker(boolean run)
} }
// Always move the camera. // Always move the camera.
for (i = 0; i <= splitscreen; i++) for (i = 0; i <= r_splitscreen; i++)
{ {
if (camera[i].chase) if (camera[i].chase)
P_MoveChaseCamera(&players[displayplayers[i]], &camera[i], false); P_MoveChaseCamera(&players[displayplayers[i]], &camera[i], false);
@ -771,7 +771,7 @@ void P_PreTicker(INT32 frames)
INT32 i,framecnt; INT32 i,framecnt;
ticcmd_t temptic; ticcmd_t temptic;
for (i = 0; i <= splitscreen; i++) for (i = 0; i <= r_splitscreen; i++)
postimgtype[i] = postimg_none; postimgtype[i] = postimg_none;
for (framecnt = 0; framecnt < frames; ++framecnt) for (framecnt = 0; framecnt < frames; ++framecnt)

View file

@ -1122,12 +1122,12 @@ boolean P_EndingMusic(player_t *player)
// Event - Level Finish // Event - Level Finish
// Check for if this is valid or not // Check for if this is valid or not
if (splitscreen) if (r_splitscreen)
{ {
if (!((players[displayplayers[0]].exiting || (players[displayplayers[0]].pflags & PF_TIMEOVER)) if (!((players[displayplayers[0]].exiting || (players[displayplayers[0]].pflags & PF_TIMEOVER))
|| (players[displayplayers[1]].exiting || (players[displayplayers[1]].pflags & PF_TIMEOVER)) || (players[displayplayers[1]].exiting || (players[displayplayers[1]].pflags & PF_TIMEOVER))
|| ((splitscreen < 2) && (players[displayplayers[2]].exiting || (players[displayplayers[2]].pflags & PF_TIMEOVER))) || ((r_splitscreen < 2) && (players[displayplayers[2]].exiting || (players[displayplayers[2]].pflags & PF_TIMEOVER)))
|| ((splitscreen < 3) && (players[displayplayers[3]].exiting || (players[displayplayers[3]].pflags & PF_TIMEOVER))))) || ((r_splitscreen < 3) && (players[displayplayers[3]].exiting || (players[displayplayers[3]].pflags & PF_TIMEOVER)))))
return false; return false;
bestlocalplayer = &players[displayplayers[0]]; bestlocalplayer = &players[displayplayers[0]];
@ -1139,9 +1139,9 @@ boolean P_EndingMusic(player_t *player)
bestlocalpos = ((players[p].pflags & PF_TIMEOVER) ? MAXPLAYERS+1 : players[p].kartstuff[k_position]); \ bestlocalpos = ((players[p].pflags & PF_TIMEOVER) ? MAXPLAYERS+1 : players[p].kartstuff[k_position]); \
} }
setbests(displayplayers[1]); setbests(displayplayers[1]);
if (splitscreen > 1) if (r_splitscreen > 1)
setbests(displayplayers[2]); setbests(displayplayers[2]);
if (splitscreen > 2) if (r_splitscreen > 2)
setbests(displayplayers[3]); setbests(displayplayers[3]);
#undef setbests #undef setbests
} }
@ -1211,7 +1211,7 @@ void P_RestoreMusic(player_t *player)
{ {
INT32 wantedmus = 0; // 0 is level music, 1 is invincibility, 2 is grow INT32 wantedmus = 0; // 0 is level music, 1 is invincibility, 2 is grow
if (splitscreen) if (r_splitscreen)
{ {
INT32 bestlocaltimer = 1; INT32 bestlocaltimer = 1;
@ -1225,9 +1225,9 @@ void P_RestoreMusic(player_t *player)
} }
setbests(displayplayers[0]); setbests(displayplayers[0]);
setbests(displayplayers[1]); setbests(displayplayers[1]);
if (splitscreen > 1) if (r_splitscreen > 1)
setbests(displayplayers[2]); setbests(displayplayers[2]);
if (splitscreen > 2) if (r_splitscreen > 2)
setbests(displayplayers[3]); setbests(displayplayers[3]);
#undef setbests #undef setbests
} }
@ -1490,9 +1490,9 @@ boolean P_IsLocalPlayer(player_t *player)
if (player == &players[consoleplayer]) if (player == &players[consoleplayer])
return true; return true;
else if (splitscreen) else if (r_splitscreen)
{ {
for (i = 1; i <= splitscreen; i++) // Skip P1 for (i = 1; i <= r_splitscreen; i++) // Skip P1
{ {
if (player == &players[displayplayers[i]]) if (player == &players[displayplayers[i]])
return true; return true;
@ -1512,7 +1512,7 @@ boolean P_IsDisplayPlayer(player_t *player)
{ {
UINT8 i; UINT8 i;
for (i = 0; i <= splitscreen; i++) // DON'T skip P1 for (i = 0; i <= r_splitscreen; i++) // DON'T skip P1
{ {
if (player == &players[displayplayers[i]]) if (player == &players[displayplayers[i]])
return true; return true;
@ -7913,7 +7913,7 @@ static void P_CalcPostImg(player_t *player)
pviewheight = player->awayviewmobj->z + 20*FRACUNIT; pviewheight = player->awayviewmobj->z + 20*FRACUNIT;
} }
for (i = 0; i <= splitscreen; i++) for (i = 0; i <= r_splitscreen; i++)
{ {
if (player == &players[displayplayers[i]]) if (player == &players[displayplayers[i]])
{ {
@ -8078,7 +8078,7 @@ void P_PlayerThink(player_t *player)
} }
#ifdef SEENAMES #ifdef SEENAMES
if (netgame && player == &players[displayplayers[0]] && !(leveltime % (TICRATE/5)) && !splitscreen) if (netgame && player == &players[displayplayers[0]] && !(leveltime % (TICRATE/5)) && !r_splitscreen)
{ {
seenplayer = NULL; seenplayer = NULL;
@ -8434,7 +8434,7 @@ void P_PlayerThink(player_t *player)
// Hide the mobj from our sights if we're the displayplayer and chasecam is off. // Hide the mobj from our sights if we're the displayplayer and chasecam is off.
// Why not just not spawn the mobj? Well, I'd rather only flirt with // Why not just not spawn the mobj? Well, I'd rather only flirt with
// consistency so much... // consistency so much...
for (i = 0; i <= splitscreen; i++) for (i = 0; i <= r_splitscreen; i++)
{ {
if (player == &players[displayplayers[i]] && !camera[i].chase) if (player == &players[displayplayers[i]] && !camera[i].chase)
{ {
@ -8664,7 +8664,7 @@ void P_PlayerAfterThink(player_t *player)
P_PlayerInSpecialSector(player); P_PlayerInSpecialSector(player);
#endif #endif
for (i = 0; i <= splitscreen; i++) for (i = 0; i <= r_splitscreen; i++)
{ {
if (player == &players[displayplayers[i]]) if (player == &players[displayplayers[i]])
{ {

View file

@ -254,7 +254,7 @@ sector_t *R_FakeFlat(sector_t *sec, sector_t *tempsec, INT32 *floorlightlevel,
boolean underwater; boolean underwater;
UINT8 i; UINT8 i;
for (i = 0; i <= splitscreen; i++) for (i = 0; i <= r_splitscreen; i++)
{ {
if (viewplayer == &players[displayplayers[i]] && camera[i].chase) if (viewplayer == &players[displayplayers[i]] && camera[i].chase)
{ {
@ -263,7 +263,7 @@ sector_t *R_FakeFlat(sector_t *sec, sector_t *tempsec, INT32 *floorlightlevel,
} }
} }
if (i > splitscreen && viewmobj) if (i > r_splitscreen && viewmobj)
heightsec = R_PointInSubsector(viewmobj->x, viewmobj->y)->sector->heightsec; heightsec = R_PointInSubsector(viewmobj->x, viewmobj->y)->sector->heightsec;
else else
return sec; return sec;

View file

@ -299,7 +299,7 @@ void R_InitViewBuffer(INT32 width, INT32 height)
for (i = 0; i < height; i++) for (i = 0; i < height; i++)
{ {
ylookup[i] = ylookup1[i] = screens[0] + i*vid.width*bytesperpixel; ylookup[i] = ylookup1[i] = screens[0] + i*vid.width*bytesperpixel;
if (splitscreen == 1) if (r_splitscreen == 1)
ylookup2[i] = screens[0] + (i+viewheight)*vid.width*bytesperpixel; ylookup2[i] = screens[0] + (i+viewheight)*vid.width*bytesperpixel;
else else
ylookup2[i] = screens[0] + i*vid.width*bytesperpixel + (viewwidth*bytesperpixel); ylookup2[i] = screens[0] + i*vid.width*bytesperpixel + (viewwidth*bytesperpixel);

View file

@ -73,6 +73,8 @@ boolean skyVisiblePerPlayer[MAXSPLITSCREENPLAYERS]; // saved values of skyVisibl
sector_t *viewsector; sector_t *viewsector;
player_t *viewplayer; player_t *viewplayer;
int r_splitscreen;
// PORTALS! // PORTALS!
// You can thank and/or curse JTE for these. // You can thank and/or curse JTE for these.
UINT8 portalrender; UINT8 portalrender;
@ -192,6 +194,12 @@ void SplitScreen_OnChange(void)
{ {
UINT8 i; UINT8 i;
/*
local splitscreen is updated before you're in a game,
so this is the first value for renderer splitscreen
*/
r_splitscreen = splitscreen;
// recompute screen size // recompute screen size
R_ExecuteSetViewSize(); R_ExecuteSetViewSize();
@ -659,12 +667,12 @@ void R_ExecuteSetViewSize(void)
scaledviewwidth = vid.width; scaledviewwidth = vid.width;
viewheight = vid.height; viewheight = vid.height;
if (splitscreen) if (r_splitscreen)
viewheight >>= 1; viewheight >>= 1;
viewwidth = scaledviewwidth; viewwidth = scaledviewwidth;
if (splitscreen > 1) if (r_splitscreen > 1)
{ {
viewwidth >>= 1; viewwidth >>= 1;
scaledviewwidth >>= 1; scaledviewwidth >>= 1;
@ -677,7 +685,7 @@ void R_ExecuteSetViewSize(void)
fov = FixedAngle(cv_fov.value/2) + ANGLE_90; fov = FixedAngle(cv_fov.value/2) + ANGLE_90;
fovtan = FINETANGENT(fov >> ANGLETOFINESHIFT); fovtan = FINETANGENT(fov >> ANGLETOFINESHIFT);
if (splitscreen == 1) // Splitscreen FOV should be adjusted to maintain expected vertical view if (r_splitscreen == 1) // Splitscreen FOV should be adjusted to maintain expected vertical view
fovtan = 17*fovtan/10; fovtan = 17*fovtan/10;
projection = projectiony = FixedDiv(centerxfrac, fovtan); projection = projectiony = FixedDiv(centerxfrac, fovtan);
@ -848,9 +856,9 @@ void R_SkyboxFrame(player_t *player)
camera_t *thiscam = &camera[0]; camera_t *thiscam = &camera[0];
UINT8 i; UINT8 i;
if (splitscreen) if (r_splitscreen)
{ {
for (i = 1; i <= splitscreen; i++) for (i = 1; i <= r_splitscreen; i++)
{ {
if (player == &players[displayplayers[i]]) if (player == &players[displayplayers[i]])
{ {
@ -891,9 +899,9 @@ void R_SkyboxFrame(player_t *player)
viewangle = localangle[0]; // WARNING: camera uses this viewangle = localangle[0]; // WARNING: camera uses this
aimingangle = localaiming[0]; aimingangle = localaiming[0];
} }
else if (splitscreen) else if (r_splitscreen)
{ {
for (i = 1; i <= splitscreen; i++) for (i = 1; i <= r_splitscreen; i++)
{ {
if (player == &players[displayplayers[i]]) if (player == &players[displayplayers[i]])
{ {
@ -1080,17 +1088,17 @@ void R_SetupFrame(player_t *player, boolean skybox)
camera_t *thiscam; camera_t *thiscam;
boolean chasecam = false; boolean chasecam = false;
if (splitscreen > 2 && player == &players[displayplayers[3]]) if (r_splitscreen > 2 && player == &players[displayplayers[3]])
{ {
thiscam = &camera[3]; thiscam = &camera[3];
chasecam = (cv_chasecam4.value != 0); chasecam = (cv_chasecam4.value != 0);
} }
else if (splitscreen > 1 && player == &players[displayplayers[2]]) else if (r_splitscreen > 1 && player == &players[displayplayers[2]])
{ {
thiscam = &camera[2]; thiscam = &camera[2];
chasecam = (cv_chasecam3.value != 0); chasecam = (cv_chasecam3.value != 0);
} }
else if (splitscreen && player == &players[displayplayers[1]]) else if (r_splitscreen && player == &players[displayplayers[1]])
{ {
thiscam = &camera[1]; thiscam = &camera[1];
chasecam = (cv_chasecam2.value != 0); chasecam = (cv_chasecam2.value != 0);
@ -1150,10 +1158,10 @@ void R_SetupFrame(player_t *player, boolean skybox)
viewangle = localangle[0]; // WARNING: camera uses this viewangle = localangle[0]; // WARNING: camera uses this
aimingangle = localaiming[0]; aimingangle = localaiming[0];
} }
else if (splitscreen) else if (r_splitscreen)
{ {
UINT8 i; UINT8 i;
for (i = 1; i <= splitscreen; i++) for (i = 1; i <= r_splitscreen; i++)
{ {
if (player == &players[displayplayers[i]]) if (player == &players[displayplayers[i]])
{ {
@ -1334,7 +1342,7 @@ void R_RenderPlayerView(player_t *player)
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 32+(timeinmap&15)); V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 32+(timeinmap&15));
} }
// Draw over the fourth screen so you don't have to stare at a HOM :V // Draw over the fourth screen so you don't have to stare at a HOM :V
else if (splitscreen == 2 && player == &players[displayplayers[2]]) else if (r_splitscreen == 2 && player == &players[displayplayers[2]])
#if 1 #if 1
{ {
// V_DrawPatchFill, but for the fourth screen only // V_DrawPatchFill, but for the fourth screen only
@ -1353,7 +1361,7 @@ void R_RenderPlayerView(player_t *player)
#endif #endif
// load previous saved value of skyVisible for the player // load previous saved value of skyVisible for the player
for (i = 0; i <= splitscreen; i++) for (i = 0; i <= r_splitscreen; i++)
{ {
if (player == &players[displayplayers[i]]) if (player == &players[displayplayers[i]])
{ {
@ -1463,7 +1471,7 @@ void R_RenderPlayerView(player_t *player)
// save value to skyVisiblePerPlayer // save value to skyVisiblePerPlayer
// this is so that P1 can't affect whether P2 can see a skybox or not, or vice versa // this is so that P1 can't affect whether P2 can see a skybox or not, or vice versa
for (i = 0; i <= splitscreen; i++) for (i = 0; i <= r_splitscreen; i++)
{ {
if (player == &players[displayplayers[i]]) if (player == &players[displayplayers[i]])
{ {

View file

@ -883,12 +883,12 @@ void R_DrawSinglePlane(visplane_t *pl)
if (bottom > vid.height) if (bottom > vid.height)
bottom = vid.height; bottom = vid.height;
if (splitscreen > 2 && viewplayer == &players[displayplayers[3]]) // Only copy the part of the screen we need if (r_splitscreen > 2 && viewplayer == &players[displayplayers[3]]) // Only copy the part of the screen we need
scr = (screens[0] + (top+(viewheight))*vid.width + viewwidth); scr = (screens[0] + (top+(viewheight))*vid.width + viewwidth);
else if ((splitscreen == 1 && viewplayer == &players[displayplayers[1]]) else if ((r_splitscreen == 1 && viewplayer == &players[displayplayers[1]])
|| (splitscreen > 1 && viewplayer == &players[displayplayers[2]])) || (r_splitscreen > 1 && viewplayer == &players[displayplayers[2]]))
scr = (screens[0] + (top+(viewheight))*vid.width); scr = (screens[0] + (top+(viewheight))*vid.width);
else if (splitscreen > 1 && viewplayer == &players[displayplayers[1]]) else if (r_splitscreen > 1 && viewplayer == &players[displayplayers[1]])
scr = (screens[0] + ((top)*vid.width) + viewwidth); scr = (screens[0] + ((top)*vid.width) + viewwidth);
else else
scr = (screens[0] + ((top)*vid.width)); scr = (screens[0] + ((top)*vid.width));

View file

@ -81,7 +81,7 @@ void R_SetSkyScale(void)
{ {
fixed_t difference = vid.fdupx-(vid.dupx<<FRACBITS); fixed_t difference = vid.fdupx-(vid.dupx<<FRACBITS);
fixed_t scr = FRACUNIT; fixed_t scr = FRACUNIT;
if (splitscreen > 1) if (r_splitscreen > 1)
scr *= 2; scr *= 2;
skyscale = FixedDiv(scr, vid.fdupx+difference); skyscale = FixedDiv(scr, vid.fdupx+difference);
} }

View file

@ -1761,7 +1761,7 @@ void R_AddSprites(sector_t *sec, INT32 lightlevel)
if (thing->sprite == SPR_NULL || thing->flags2 & MF2_DONTDRAW) if (thing->sprite == SPR_NULL || thing->flags2 & MF2_DONTDRAW)
continue; continue;
if (splitscreen) if (r_splitscreen)
{ {
if (thing->eflags & MFE_DRAWONLYFORP1) if (thing->eflags & MFE_DRAWONLYFORP1)
if (viewssnum != 0) if (viewssnum != 0)
@ -1771,11 +1771,11 @@ void R_AddSprites(sector_t *sec, INT32 lightlevel)
if (viewssnum != 1) if (viewssnum != 1)
continue; continue;
if (thing->eflags & MFE_DRAWONLYFORP3 && splitscreen > 1) if (thing->eflags & MFE_DRAWONLYFORP3 && r_splitscreen > 1)
if (viewssnum != 2) if (viewssnum != 2)
continue; continue;
if (thing->eflags & MFE_DRAWONLYFORP4 && splitscreen > 2) if (thing->eflags & MFE_DRAWONLYFORP4 && r_splitscreen > 2)
if (viewssnum != 3) if (viewssnum != 3)
continue; continue;
} }
@ -1796,7 +1796,7 @@ void R_AddSprites(sector_t *sec, INT32 lightlevel)
if (thing->sprite == SPR_NULL || thing->flags2 & MF2_DONTDRAW) if (thing->sprite == SPR_NULL || thing->flags2 & MF2_DONTDRAW)
continue; continue;
if (splitscreen) if (r_splitscreen)
{ {
if (thing->eflags & MFE_DRAWONLYFORP1) if (thing->eflags & MFE_DRAWONLYFORP1)
if (viewssnum != 0) if (viewssnum != 0)
@ -1806,11 +1806,11 @@ void R_AddSprites(sector_t *sec, INT32 lightlevel)
if (viewssnum != 1) if (viewssnum != 1)
continue; continue;
if (thing->eflags & MFE_DRAWONLYFORP3 && splitscreen > 1) if (thing->eflags & MFE_DRAWONLYFORP3 && r_splitscreen > 1)
if (viewssnum != 2) if (viewssnum != 2)
continue; continue;
if (thing->eflags & MFE_DRAWONLYFORP4 && splitscreen > 2) if (thing->eflags & MFE_DRAWONLYFORP4 && r_splitscreen > 2)
if (viewssnum != 3) if (viewssnum != 3)
continue; continue;
} }

View file

@ -457,19 +457,19 @@ void S_StartSoundAtVolume(const void *origin_p, sfxenum_t sfx_id, INT32 volume)
if (players[displayplayers[0]].awayviewtics) if (players[displayplayers[0]].awayviewtics)
listenmobj = players[displayplayers[0]].awayviewmobj; listenmobj = players[displayplayers[0]].awayviewmobj;
if (splitscreen) if (r_splitscreen)
{ {
listenmobj2 = players[displayplayers[1]].mo; listenmobj2 = players[displayplayers[1]].mo;
if (players[displayplayers[1]].awayviewtics) if (players[displayplayers[1]].awayviewtics)
listenmobj2 = players[displayplayers[1]].awayviewmobj; listenmobj2 = players[displayplayers[1]].awayviewmobj;
if (splitscreen > 1) if (r_splitscreen > 1)
{ {
listenmobj3 = players[displayplayers[2]].mo; listenmobj3 = players[displayplayers[2]].mo;
if (players[displayplayers[2]].awayviewtics) if (players[displayplayers[2]].awayviewtics)
listenmobj3 = players[displayplayers[2]].awayviewmobj; listenmobj3 = players[displayplayers[2]].awayviewmobj;
if (splitscreen > 2) if (r_splitscreen > 2)
{ {
listenmobj4 = players[displayplayers[3]].mo; listenmobj4 = players[displayplayers[3]].mo;
if (players[displayplayers[3]].awayviewtics) if (players[displayplayers[3]].awayviewtics)
@ -574,10 +574,10 @@ void S_StartSoundAtVolume(const void *origin_p, sfxenum_t sfx_id, INT32 volume)
pitch = NORM_PITCH; pitch = NORM_PITCH;
priority = NORM_PRIORITY; priority = NORM_PRIORITY;
if (splitscreen && origin) if (r_splitscreen && origin)
volume = FixedDiv(volume<<FRACBITS, FixedSqrt((splitscreen+1)<<FRACBITS))>>FRACBITS; volume = FixedDiv(volume<<FRACBITS, FixedSqrt((r_splitscreen+1)<<FRACBITS))>>FRACBITS;
if (splitscreen && listenmobj2) // Copy the sound for the split player if (r_splitscreen && listenmobj2) // Copy the sound for the split player
{ {
// Check to see if it is audible, and if not, modify the params // Check to see if it is audible, and if not, modify the params
if (origin && origin != listenmobj2) if (origin && origin != listenmobj2)
@ -633,7 +633,7 @@ void S_StartSoundAtVolume(const void *origin_p, sfxenum_t sfx_id, INT32 volume)
dontplay: dontplay:
if (splitscreen > 1 && listenmobj3) // Copy the sound for the third player if (r_splitscreen > 1 && listenmobj3) // Copy the sound for the third player
{ {
// Check to see if it is audible, and if not, modify the params // Check to see if it is audible, and if not, modify the params
if (origin && origin != listenmobj3) if (origin && origin != listenmobj3)
@ -689,7 +689,7 @@ dontplay:
dontplay3: dontplay3:
if (splitscreen > 2 && listenmobj4) // Copy the sound for the split player if (r_splitscreen > 2 && listenmobj4) // Copy the sound for the split player
{ {
// Check to see if it is audible, and if not, modify the params // Check to see if it is audible, and if not, modify the params
if (origin && origin != listenmobj4) if (origin && origin != listenmobj4)
@ -942,19 +942,19 @@ void S_UpdateSounds(void)
if (players[displayplayers[0]].awayviewtics) if (players[displayplayers[0]].awayviewtics)
listenmobj = players[displayplayers[0]].awayviewmobj; listenmobj = players[displayplayers[0]].awayviewmobj;
if (splitscreen) if (r_splitscreen)
{ {
listenmobj2 = players[displayplayers[1]].mo; listenmobj2 = players[displayplayers[1]].mo;
if (players[displayplayers[1]].awayviewtics) if (players[displayplayers[1]].awayviewtics)
listenmobj2 = players[displayplayers[1]].awayviewmobj; listenmobj2 = players[displayplayers[1]].awayviewmobj;
if (splitscreen > 1) if (r_splitscreen > 1)
{ {
listenmobj3 = players[displayplayers[2]].mo; listenmobj3 = players[displayplayers[2]].mo;
if (players[displayplayers[2]].awayviewtics) if (players[displayplayers[2]].awayviewtics)
listenmobj3 = players[displayplayers[2]].awayviewmobj; listenmobj3 = players[displayplayers[2]].awayviewmobj;
if (splitscreen > 2) if (r_splitscreen > 2)
{ {
listenmobj4 = players[displayplayers[3]].mo; listenmobj4 = players[displayplayers[3]].mo;
if (players[displayplayers[3]].awayviewtics) if (players[displayplayers[3]].awayviewtics)
@ -1058,24 +1058,24 @@ void S_UpdateSounds(void)
pitch = NORM_PITCH; pitch = NORM_PITCH;
sep = NORM_SEP; sep = NORM_SEP;
if (splitscreen && c->origin) if (r_splitscreen && c->origin)
volume = FixedDiv(volume<<FRACBITS, FixedSqrt((splitscreen+1)<<FRACBITS))>>FRACBITS; volume = FixedDiv(volume<<FRACBITS, FixedSqrt((r_splitscreen+1)<<FRACBITS))>>FRACBITS;
// check non-local sounds for distance clipping // check non-local sounds for distance clipping
// or modify their params // or modify their params
if (c->origin && ((c->origin != players[consoleplayer].mo) if (c->origin && ((c->origin != players[displayplayers[0]].mo)
|| (splitscreen && c->origin != players[displayplayers[1]].mo) || (r_splitscreen && c->origin != players[displayplayers[1]].mo)
|| (splitscreen > 1 && c->origin != players[displayplayers[2]].mo) || (r_splitscreen > 1 && c->origin != players[displayplayers[2]].mo)
|| (splitscreen > 2 && c->origin != players[displayplayers[3]].mo))) || (r_splitscreen > 2 && c->origin != players[displayplayers[3]].mo)))
{ {
// Whomever is closer gets the sound, but only in splitscreen. // Whomever is closer gets the sound, but only in splitscreen.
if (splitscreen) if (r_splitscreen)
{ {
const mobj_t *soundmobj = c->origin; const mobj_t *soundmobj = c->origin;
fixed_t recdist = -1; fixed_t recdist = -1;
INT32 i, p = -1; INT32 i, p = -1;
for (i = 0; i <= splitscreen; i++) for (i = 0; i <= r_splitscreen; i++)
{ {
fixed_t thisdist = -1; fixed_t thisdist = -1;
@ -1130,7 +1130,7 @@ void S_UpdateSounds(void)
S_StopChannel(cnum); S_StopChannel(cnum);
} }
} }
else if (listenmobj && !splitscreen) else if (listenmobj && !r_splitscreen)
{ {
// In the case of a single player, he or she always should get updated sound. // In the case of a single player, he or she always should get updated sound.
audible = S_AdjustSoundParams(listenmobj, c->origin, &volume, &sep, &pitch, audible = S_AdjustSoundParams(listenmobj, c->origin, &volume, &sep, &pitch,
@ -1258,21 +1258,21 @@ INT32 S_AdjustSoundParams(const mobj_t *listener, const mobj_t *source, INT32 *v
listensource.z = camera[0].z; listensource.z = camera[0].z;
listensource.angle = camera[0].angle; listensource.angle = camera[0].angle;
} }
else if (splitscreen && listener == players[displayplayers[1]].mo && camera[1].chase) else if (r_splitscreen && listener == players[displayplayers[1]].mo && camera[1].chase)
{ {
listensource.x = camera[1].x; listensource.x = camera[1].x;
listensource.y = camera[1].y; listensource.y = camera[1].y;
listensource.z = camera[1].z; listensource.z = camera[1].z;
listensource.angle = camera[1].angle; listensource.angle = camera[1].angle;
} }
else if (splitscreen > 1 && listener == players[displayplayers[2]].mo && camera[2].chase) else if (r_splitscreen > 1 && listener == players[displayplayers[2]].mo && camera[2].chase)
{ {
listensource.x = camera[2].x; listensource.x = camera[2].x;
listensource.y = camera[2].y; listensource.y = camera[2].y;
listensource.z = camera[2].z; listensource.z = camera[2].z;
listensource.angle = camera[2].angle; listensource.angle = camera[2].angle;
} }
else if (splitscreen > 2 && listener == players[displayplayers[3]].mo && camera[3].chase) else if (r_splitscreen > 2 && listener == players[displayplayers[3]].mo && camera[3].chase)
{ {
listensource.x = camera[3].x; listensource.x = camera[3].x;
listensource.y = camera[3].y; listensource.y = camera[3].y;
@ -1372,8 +1372,8 @@ INT32 S_AdjustSoundParams(const mobj_t *listener, const mobj_t *source, INT32 *v
*vol = (15 * ((S_CLIPPING_DIST - approx_dist)>>FRACBITS)) / S_ATTENUATOR; *vol = (15 * ((S_CLIPPING_DIST - approx_dist)>>FRACBITS)) / S_ATTENUATOR;
} }
if (splitscreen) if (r_splitscreen)
*vol = FixedDiv((*vol)<<FRACBITS, FixedSqrt((splitscreen+1)<<FRACBITS))>>FRACBITS; *vol = FixedDiv((*vol)<<FRACBITS, FixedSqrt((r_splitscreen+1)<<FRACBITS))>>FRACBITS;
return (*vol > 0); return (*vol > 0);
} }

View file

@ -230,7 +230,7 @@ void ST_doPaletteStuff(void)
if (rendermode != render_none) if (rendermode != render_none)
{ {
//V_SetPaletteLump(GetPalette()); // Reset the palette -- is this needed? //V_SetPaletteLump(GetPalette()); // Reset the palette -- is this needed?
if (!splitscreen) if (!r_splitscreen)
V_SetPalette(palette); V_SetPalette(palette);
} }
} }
@ -515,9 +515,9 @@ static INT32 SCR(INT32 r)
#define ST_DrawNumFromHud(h,n) V_DrawTallNum(SCX(hudinfo[h].x), SCY(hudinfo[h].y), V_NOSCALESTART|V_HUDTRANS, n) #define ST_DrawNumFromHud(h,n) V_DrawTallNum(SCX(hudinfo[h].x), SCY(hudinfo[h].y), V_NOSCALESTART|V_HUDTRANS, n)
#define ST_DrawPadNumFromHud(h,n,q) V_DrawPaddedTallNum(SCX(hudinfo[h].x), SCY(hudinfo[h].y), V_NOSCALESTART|V_HUDTRANS, n, q) #define ST_DrawPadNumFromHud(h,n,q) V_DrawPaddedTallNum(SCX(hudinfo[h].x), SCY(hudinfo[h].y), V_NOSCALESTART|V_HUDTRANS, n, q)
#define ST_DrawPatchFromHud(h,p) V_DrawScaledPatch(SCX(hudinfo[h].x), SCY(hudinfo[h].y), V_NOSCALESTART|V_HUDTRANS, p) #define ST_DrawPatchFromHud(h,p) V_DrawScaledPatch(SCX(hudinfo[h].x), SCY(hudinfo[h].y), V_NOSCALESTART|V_HUDTRANS, p)
#define ST_DrawNumFromHudWS(h,n) V_DrawTallNum(SCX(hudinfo[h+!!splitscreen].x), SCY(hudinfo[h+!!splitscreen].y), V_NOSCALESTART|V_HUDTRANS, n) #define ST_DrawNumFromHudWS(h,n) V_DrawTallNum(SCX(hudinfo[h+!!r_splitscreen].x), SCY(hudinfo[h+!!r_splitscreen].y), V_NOSCALESTART|V_HUDTRANS, n)
#define ST_DrawPadNumFromHudWS(h,n,q) V_DrawPaddedTallNum(SCX(hudinfo[h+!!splitscreen].x), SCY(hudinfo[h+!!splitscreen].y), V_NOSCALESTART|V_HUDTRANS, n, q) #define ST_DrawPadNumFromHudWS(h,n,q) V_DrawPaddedTallNum(SCX(hudinfo[h+!!r_splitscreen].x), SCY(hudinfo[h+!!r_splitscreen].y), V_NOSCALESTART|V_HUDTRANS, n, q)
#define ST_DrawPatchFromHudWS(h,p) V_DrawScaledPatch(SCX(hudinfo[h+!!splitscreen].x), SCY(hudinfo[h+!!splitscreen].y), V_NOSCALESTART|V_HUDTRANS, p) #define ST_DrawPatchFromHudWS(h,p) V_DrawScaledPatch(SCX(hudinfo[h+!!r_splitscreen].x), SCY(hudinfo[h+!!r_splitscreen].y), V_NOSCALESTART|V_HUDTRANS, p)
/* /*
// Draw a number, scaled, over the view, maybe with set translucency // Draw a number, scaled, over the view, maybe with set translucency
@ -757,7 +757,7 @@ static void ST_drawLevelTitle(void)
INT32 dupcalc = (vid.width/vid.dupx); INT32 dupcalc = (vid.width/vid.dupx);
UINT8 gtc = G_GetGametypeColor(gametype); UINT8 gtc = G_GetGametypeColor(gametype);
INT32 sub = 0; INT32 sub = 0;
INT32 bary = (splitscreen) INT32 bary = (r_splitscreen)
? BASEVIDHEIGHT/2 ? BASEVIDHEIGHT/2
: 163; : 163;
INT32 lvlw; INT32 lvlw;
@ -1910,12 +1910,12 @@ static void ST_overlayDrawer(void)
else if (!demo.title) else if (!demo.title)
{ {
if (!splitscreen) if (!r_splitscreen)
{ {
V_DrawCenteredString((BASEVIDWIDTH/2), BASEVIDHEIGHT-40, V_HUDTRANSHALF, M_GetText("Viewpoint:")); V_DrawCenteredString((BASEVIDWIDTH/2), BASEVIDHEIGHT-40, V_HUDTRANSHALF, M_GetText("Viewpoint:"));
V_DrawCenteredString((BASEVIDWIDTH/2), BASEVIDHEIGHT-32, V_HUDTRANSHALF|V_ALLOWLOWERCASE, player_names[stplyr-players]); V_DrawCenteredString((BASEVIDWIDTH/2), BASEVIDHEIGHT-32, V_HUDTRANSHALF|V_ALLOWLOWERCASE, player_names[stplyr-players]);
} }
else if (splitscreen == 1) else if (r_splitscreen == 1)
{ {
char name[MAXPLAYERNAME+12]; char name[MAXPLAYERNAME+12];
@ -1923,7 +1923,7 @@ static void ST_overlayDrawer(void)
sprintf(name, "VIEWPOINT: %s", player_names[stplyr-players]); sprintf(name, "VIEWPOINT: %s", player_names[stplyr-players]);
V_DrawRightAlignedThinString(BASEVIDWIDTH-40, y, V_HUDTRANSHALF|V_ALLOWLOWERCASE|K_calcSplitFlags(V_SNAPTOTOP|V_SNAPTOBOTTOM|V_SNAPTORIGHT), name); V_DrawRightAlignedThinString(BASEVIDWIDTH-40, y, V_HUDTRANSHALF|V_ALLOWLOWERCASE|K_calcSplitFlags(V_SNAPTOTOP|V_SNAPTOBOTTOM|V_SNAPTORIGHT), name);
} }
else if (splitscreen) else if (r_splitscreen)
{ {
V_DrawCenteredThinString((vid.width/vid.dupx)/4, BASEVIDHEIGHT/2 - 12, V_HUDTRANSHALF|V_ALLOWLOWERCASE|K_calcSplitFlags(V_SNAPTOBOTTOM|V_SNAPTOLEFT), player_names[stplyr-players]); V_DrawCenteredThinString((vid.width/vid.dupx)/4, BASEVIDHEIGHT/2 - 12, V_HUDTRANSHALF|V_ALLOWLOWERCASE|K_calcSplitFlags(V_SNAPTOBOTTOM|V_SNAPTOLEFT), player_names[stplyr-players]);
} }
@ -1998,7 +1998,7 @@ static void ST_overlayDrawer(void)
} }
// SRB2kart: changed positions & text // SRB2kart: changed positions & text
if (splitscreen) if (r_splitscreen)
{ {
INT32 splitflags = K_calcSplitFlags(0); INT32 splitflags = K_calcSplitFlags(0);
V_DrawThinString(2, (BASEVIDHEIGHT/2)-20, V_YELLOWMAP|V_HUDTRANSHALF|splitflags, M_GetText("- SPECTATING -")); V_DrawThinString(2, (BASEVIDHEIGHT/2)-20, V_YELLOWMAP|V_HUDTRANSHALF|splitflags, M_GetText("- SPECTATING -"));
@ -2089,7 +2089,7 @@ void ST_Drawer(void)
UINT8 i; UINT8 i;
#ifdef SEENAMES #ifdef SEENAMES
if (cv_seenames.value && cv_allowseenames.value && displayplayers[0] == consoleplayer && seenplayer && seenplayer->mo && !mapreset) if (cv_seenames.value && cv_allowseenames.value && displayplayers[localdisplayplayers[0]] == consoleplayer && seenplayer && seenplayer->mo && !mapreset)
{ {
if (cv_seenames.value == 1) if (cv_seenames.value == 1)
V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT/2 + 15, V_HUDTRANSHALF, player_names[seenplayer-players]); V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT/2 + 15, V_HUDTRANSHALF, player_names[seenplayer-players]);
@ -2123,7 +2123,7 @@ void ST_Drawer(void)
if (st_overlay) if (st_overlay)
{ {
// No deadview! // No deadview!
for (i = 0; i <= splitscreen; i++) for (i = 0; i <= r_splitscreen; i++)
{ {
stplyr = &players[displayplayers[i]]; stplyr = &players[displayplayers[i]];
ST_overlayDrawer(); ST_overlayDrawer();

View file

@ -2503,15 +2503,15 @@ void V_DoPostProcessor(INT32 view, postimg_t type, INT32 param)
return; return;
#endif #endif
if (view < 0 || view > 3 || view > splitscreen) if (view < 0 || view > 3 || view > r_splitscreen)
return; return;
if ((view == 1 && splitscreen == 1) || view >= 2) if ((view == 1 && r_splitscreen == 1) || view >= 2)
yoffset = viewheight; yoffset = viewheight;
else else
yoffset = 0; yoffset = 0;
if ((view == 1 || view == 3) && splitscreen > 1) if ((view == 1 || view == 3) && r_splitscreen > 1)
xoffset = viewwidth; xoffset = viewwidth;
else else
xoffset = 0; xoffset = 0;

View file

@ -366,7 +366,7 @@ void Y_IntermissionDrawer(void)
if (usebuffer) // Fade everything out if (usebuffer) // Fade everything out
V_DrawFadeScreen(0xFF00, 22); V_DrawFadeScreen(0xFF00, 22);
if (!splitscreen) if (!r_splitscreen)
whiteplayer = demo.playback ? displayplayers[0] : consoleplayer; whiteplayer = demo.playback ? displayplayers[0] : consoleplayer;
if (cons_menuhighlight.value) if (cons_menuhighlight.value)
@ -1263,19 +1263,19 @@ void Y_VoteDrawer(void)
{ {
case 1: case 1:
thiscurs = cursor2; thiscurs = cursor2;
p = displayplayers[1]; p = displayplayers[localdisplayplayers[1]];
break; break;
case 2: case 2:
thiscurs = cursor3; thiscurs = cursor3;
p = displayplayers[2]; p = displayplayers[localdisplayplayers[2]];
break; break;
case 3: case 3:
thiscurs = cursor4; thiscurs = cursor4;
p = displayplayers[3]; p = displayplayers[localdisplayplayers[3]];
break; break;
default: default:
thiscurs = cursor1; thiscurs = cursor1;
p = displayplayers[0]; p = displayplayers[localdisplayplayers[0]];
break; break;
} }
@ -1563,13 +1563,13 @@ void Y_VoteTicker(void)
switch (i) switch (i)
{ {
case 1: case 1:
p = displayplayers[1]; p = displayplayers[localdisplayplayers[1]];
break; break;
case 2: case 2:
p = displayplayers[2]; p = displayplayers[localdisplayplayers[2]];
break; break;
case 3: case 3:
p = displayplayers[3]; p = displayplayers[localdisplayplayers[3]];
break; break;
default: default:
p = consoleplayer; p = consoleplayer;