Maybe localdisplayplayers is a bad idea

This commit is contained in:
James R 2020-02-23 18:20:55 -08:00
parent 1e89d512a7
commit 4f40edaf01
17 changed files with 169 additions and 188 deletions

View file

@ -2747,8 +2747,8 @@ void CL_RemovePlayer(INT32 playernum, INT32 reason)
G_RemovePartyMember(playernum); G_RemovePartyMember(playernum);
if (playernum == displayplayers[localdisplayplayers[0]] && !demo.playback) if (playernum == g_localplayers[0] && !demo.playback)
displayplayers[localdisplayplayers[0]] = consoleplayer; // don't look through someone's view who isn't there g_localplayers[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]);
@ -3529,7 +3529,7 @@ static void Got_AddPlayer(UINT8 **p, INT32 playernum)
if (splitscreenplayer) if (splitscreenplayer)
{ {
displayplayers[splitscreenplayer] = newplayernum; displayplayers[splitscreenplayer] = newplayernum;
localdisplayplayers[splitscreenplayer] = splitscreenplayer; g_localplayers[splitscreenplayer] = newplayernum;
DEBFILE(va("spawning sister # %d\n", splitscreenplayer)); DEBFILE(va("spawning sister # %d\n", splitscreenplayer));
if (splitscreenplayer == 1 && botingame) if (splitscreenplayer == 1 && botingame)
players[newplayernum].bot = 1; players[newplayernum].bot = 1;
@ -3540,7 +3540,7 @@ static void Got_AddPlayer(UINT8 **p, INT32 playernum)
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++) for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
{ {
displayplayers[i] = newplayernum; displayplayers[i] = newplayernum;
localdisplayplayers[i] = 0; g_localplayers[i] = newplayernum;
} }
splitscreen_partied[newplayernum] = true; splitscreen_partied[newplayernum] = true;
DEBFILE("spawning me\n"); DEBFILE("spawning me\n");
@ -3751,7 +3751,6 @@ 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

@ -780,7 +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); memset(g_localplayers, 0, sizeof g_localplayers);
consoleplayer = 0; consoleplayer = 0;
//demosequence = -1; //demosequence = -1;
gametype = GT_RACE; // SRB2kart gametype = GT_RACE; // SRB2kart

View file

@ -1196,11 +1196,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[localdisplayplayers[1]] || (!netgame && playernum == 1)) else if (playernum == g_localplayers[1] || (!netgame && playernum == 1))
CV_StealthSet(&cv_playername2, tmpname); CV_StealthSet(&cv_playername2, tmpname);
else if (playernum == displayplayers[localdisplayplayers[2]] || (!netgame && playernum == 2)) else if (playernum == g_localplayers[2] || (!netgame && playernum == 2))
CV_StealthSet(&cv_playername3, tmpname); CV_StealthSet(&cv_playername3, tmpname);
else if (playernum == displayplayers[localdisplayplayers[3]] || (!netgame && playernum == 3)) else if (playernum == g_localplayers[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));
@ -1308,11 +1308,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[localdisplayplayers[1]]) else if (i == g_localplayers[1])
CV_StealthSet(&cv_skin2, skins[forcedskin].name); CV_StealthSet(&cv_skin2, skins[forcedskin].name);
else if (i == displayplayers[localdisplayplayers[2]]) else if (i == g_localplayers[2])
CV_StealthSet(&cv_skin3, skins[forcedskin].name); CV_StealthSet(&cv_skin3, skins[forcedskin].name);
else if (i == displayplayers[localdisplayplayers[3]]) else if (i == g_localplayers[3])
CV_StealthSet(&cv_skin4, skins[forcedskin].name); CV_StealthSet(&cv_skin4, skins[forcedskin].name);
} }
} }
@ -1479,8 +1479,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[localdisplayplayers[1]] != consoleplayer) if (g_localplayers[1] != consoleplayer)
secondplaya = displayplayers[localdisplayplayers[1]]; secondplaya = g_localplayers[1];
else if (!netgame) // HACK else if (!netgame) // HACK
secondplaya = 1; secondplaya = 1;
@ -1568,14 +1568,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[localdisplayplayers[1]]))) if (cv_mute.value && !(server || IsPlayerAdmin(g_localplayers[1])))
CV_StealthSet(&cv_playername2, player_names[displayplayers[localdisplayplayers[1]]]); CV_StealthSet(&cv_playername2, player_names[g_localplayers[1]]);
else // Cleanup name if changing it else // Cleanup name if changing it
CleanupPlayerName(displayplayers[localdisplayplayers[1]], cv_playername2.zstring); CleanupPlayerName(g_localplayers[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[localdisplayplayers[1]])) if (!CanChangeSkin(g_localplayers[1]))
CV_StealthSet(&cv_skin2, skins[players[displayplayers[localdisplayplayers[1]]].skin].name); CV_StealthSet(&cv_skin2, skins[players[g_localplayers[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)
@ -1602,8 +1602,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[localdisplayplayers[2]] != consoleplayer) if (g_localplayers[2] != consoleplayer)
thirdplaya = displayplayers[localdisplayplayers[2]]; thirdplaya = g_localplayers[2];
else if (!netgame) // HACK else if (!netgame) // HACK
thirdplaya = 2; thirdplaya = 2;
@ -1683,14 +1683,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[localdisplayplayers[2]]))) if (cv_mute.value && !(server || IsPlayerAdmin(g_localplayers[2])))
CV_StealthSet(&cv_playername3, player_names[displayplayers[localdisplayplayers[2]]]); CV_StealthSet(&cv_playername3, player_names[g_localplayers[2]]);
else // Cleanup name if changing it else // Cleanup name if changing it
CleanupPlayerName(displayplayers[localdisplayplayers[2]], cv_playername3.zstring); CleanupPlayerName(g_localplayers[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[localdisplayplayers[2]])) if (!CanChangeSkin(g_localplayers[2]))
CV_StealthSet(&cv_skin3, skins[players[displayplayers[localdisplayplayers[2]]].skin].name); CV_StealthSet(&cv_skin3, skins[players[g_localplayers[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)
@ -1717,8 +1717,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[localdisplayplayers[3]] != consoleplayer) if (g_localplayers[3] != consoleplayer)
fourthplaya = displayplayers[localdisplayplayers[3]]; fourthplaya = g_localplayers[3];
else if (!netgame) // HACK else if (!netgame) // HACK
fourthplaya = 3; fourthplaya = 3;
@ -1806,14 +1806,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[localdisplayplayers[3]]))) if (cv_mute.value && !(server || IsPlayerAdmin(g_localplayers[3])))
CV_StealthSet(&cv_playername4, player_names[displayplayers[localdisplayplayers[3]]]); CV_StealthSet(&cv_playername4, player_names[g_localplayers[3]]);
else // Cleanup name if changing it else // Cleanup name if changing it
CleanupPlayerName(displayplayers[localdisplayplayers[3]], cv_playername4.zstring); CleanupPlayerName(g_localplayers[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[localdisplayplayers[3]])) if (!CanChangeSkin(g_localplayers[3]))
CV_StealthSet(&cv_skin4, skins[players[displayplayers[localdisplayplayers[3]]].skin].name); CV_StealthSet(&cv_skin4, skins[players[g_localplayers[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)
@ -1844,11 +1844,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[localdisplayplayers[1]]) else if (playernum == g_localplayers[1])
snac2pending--; snac2pending--;
else if (playernum == displayplayers[localdisplayplayers[2]]) else if (playernum == g_localplayers[2])
snac3pending--; snac3pending--;
else if (playernum == displayplayers[localdisplayplayers[3]]) else if (playernum == g_localplayers[3])
snac4pending--; snac4pending--;
#ifdef PARANOIA #ifdef PARANOIA
@ -1871,8 +1871,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[localdisplayplayers[1]]] if (server && (p != &players[consoleplayer] && p != &players[g_localplayers[1]]
&& p != &players[displayplayers[localdisplayplayers[2]]] && p != &players[displayplayers[localdisplayplayers[3]]])) && p != &players[g_localplayers[2]] && p != &players[g_localplayers[3]]))
{ {
boolean kick = false; boolean kick = false;
@ -1909,11 +1909,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[localdisplayplayers[1]]) else if (playernum == g_localplayers[1])
CV_StealthSet(&cv_skin2, skins[forcedskin].name); CV_StealthSet(&cv_skin2, skins[forcedskin].name);
else if (playernum == displayplayers[localdisplayplayers[2]]) else if (playernum == g_localplayers[2])
CV_StealthSet(&cv_skin3, skins[forcedskin].name); CV_StealthSet(&cv_skin3, skins[forcedskin].name);
else if (playernum == displayplayers[localdisplayplayers[3]]) else if (playernum == g_localplayers[3])
CV_StealthSet(&cv_skin4, skins[forcedskin].name); CV_StealthSet(&cv_skin4, skins[forcedskin].name);
} }
else else
@ -2184,7 +2184,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[localdisplayplayers[0]]], &camera[0]); P_ResetCamera(&players[g_localplayers[0]], &camera[0]);
} }
/* Consider replacing nametonum with this */ /* Consider replacing nametonum with this */
@ -2721,7 +2721,7 @@ void D_ModifyClientVote(SINT8 voted, UINT8 splitplayer)
UINT8 player = consoleplayer; UINT8 player = consoleplayer;
if (splitplayer > 0) if (splitplayer > 0)
player = displayplayers[localdisplayplayers[splitplayer]]; player = g_localplayers[splitplayer];
WRITESINT8(p, voted); WRITESINT8(p, voted);
WRITEUINT8(p, player); WRITEUINT8(p, player);
@ -3373,11 +3373,11 @@ static void Command_Teamchange2_f(void)
return; return;
} }
if (players[displayplayers[localdisplayplayers[1]]].spectator) if (players[g_localplayers[1]].spectator)
error = !(NetPacket.packet.newteam || (players[displayplayers[localdisplayplayers[1]]].pflags & PF_WANTSTOJOIN)); error = !(NetPacket.packet.newteam || (players[g_localplayers[1]].pflags & PF_WANTSTOJOIN));
else if (G_GametypeHasTeams()) else if (G_GametypeHasTeams())
error = (NetPacket.packet.newteam == (unsigned)players[displayplayers[localdisplayplayers[1]]].ctfteam); error = (NetPacket.packet.newteam == (unsigned)players[g_localplayers[1]].ctfteam);
else if (G_GametypeHasSpectators() && !players[displayplayers[localdisplayplayers[1]]].spectator) else if (G_GametypeHasSpectators() && !players[g_localplayers[1]].spectator)
error = (NetPacket.packet.newteam == 3); error = (NetPacket.packet.newteam == 3);
#ifdef PARANOIA #ifdef PARANOIA
else else
@ -3464,11 +3464,11 @@ static void Command_Teamchange3_f(void)
return; return;
} }
if (players[displayplayers[localdisplayplayers[2]]].spectator) if (players[g_localplayers[2]].spectator)
error = !(NetPacket.packet.newteam || (players[displayplayers[localdisplayplayers[2]]].pflags & PF_WANTSTOJOIN)); error = !(NetPacket.packet.newteam || (players[g_localplayers[2]].pflags & PF_WANTSTOJOIN));
else if (G_GametypeHasTeams()) else if (G_GametypeHasTeams())
error = (NetPacket.packet.newteam == (unsigned)players[displayplayers[localdisplayplayers[2]]].ctfteam); error = (NetPacket.packet.newteam == (unsigned)players[g_localplayers[2]].ctfteam);
else if (G_GametypeHasSpectators() && !players[displayplayers[localdisplayplayers[2]]].spectator) else if (G_GametypeHasSpectators() && !players[g_localplayers[2]].spectator)
error = (NetPacket.packet.newteam == 3); error = (NetPacket.packet.newteam == 3);
#ifdef PARANOIA #ifdef PARANOIA
else else
@ -3555,11 +3555,11 @@ static void Command_Teamchange4_f(void)
return; return;
} }
if (players[displayplayers[localdisplayplayers[3]]].spectator) if (players[g_localplayers[3]].spectator)
error = !(NetPacket.packet.newteam || (players[displayplayers[localdisplayplayers[3]]].pflags & PF_WANTSTOJOIN)); error = !(NetPacket.packet.newteam || (players[g_localplayers[3]].pflags & PF_WANTSTOJOIN));
else if (G_GametypeHasTeams()) else if (G_GametypeHasTeams())
error = (NetPacket.packet.newteam == (unsigned)players[displayplayers[localdisplayplayers[3]]].ctfteam); error = (NetPacket.packet.newteam == (unsigned)players[g_localplayers[3]].ctfteam);
else if (G_GametypeHasSpectators() && !players[displayplayers[localdisplayplayers[3]]].spectator) else if (G_GametypeHasSpectators() && !players[g_localplayers[3]].spectator)
error = (NetPacket.packet.newteam == 3); error = (NetPacket.packet.newteam == 3);
#ifdef PARANOIA #ifdef PARANOIA
else else
@ -3956,8 +3956,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[localdisplayplayers[0]] == playernum) if (playernum == consoleplayer || g_localplayers[0] == playernum)
displayplayers[localdisplayplayers[0]] = consoleplayer; g_localplayers[0] = consoleplayer;
if (G_GametypeHasTeams()) if (G_GametypeHasTeams())
{ {
@ -5598,7 +5598,7 @@ static void Command_Displayplayer_f(void)
int i; int i;
for (i = 0; i <= splitscreen; ++i) for (i = 0; i <= splitscreen; ++i)
{ {
playernum = displayplayers[localdisplayplayers[i]]; playernum = g_localplayers[i];
CONS_Printf( CONS_Printf(
"local player %d: \x84(%d) \x83%s\x80\n", "local player %d: \x84(%d) \x83%s\x80\n",
i, i,
@ -5811,7 +5811,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[localdisplayplayers[1]]]); CV_StealthSet(&cv_playername2, player_names[g_localplayers[1]]);
} }
else else
SendNameAndColor2(); SendNameAndColor2();
@ -5822,7 +5822,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[localdisplayplayers[2]]]); CV_StealthSet(&cv_playername3, player_names[g_localplayers[2]]);
} }
else else
SendNameAndColor3(); SendNameAndColor3();
@ -5833,7 +5833,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[localdisplayplayers[3]]]); CV_StealthSet(&cv_playername4, player_names[g_localplayers[3]]);
} }
else else
SendNameAndColor4(); SendNameAndColor4();
@ -5874,12 +5874,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[localdisplayplayers[1]]) && !P_PlayerMoving(displayplayers[localdisplayplayers[1]])) if (CanChangeSkin(g_localplayers[1]) && !P_PlayerMoving(g_localplayers[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[localdisplayplayers[1]]].skin].name); CV_StealthSet(&cv_skin2, skins[players[g_localplayers[1]].skin].name);
} }
} }
@ -5888,12 +5888,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[localdisplayplayers[2]]) && !P_PlayerMoving(displayplayers[localdisplayplayers[2]])) if (CanChangeSkin(g_localplayers[2]) && !P_PlayerMoving(g_localplayers[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[localdisplayplayers[2]]].skin].name); CV_StealthSet(&cv_skin3, skins[players[g_localplayers[2]].skin].name);
} }
} }
@ -5902,12 +5902,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[localdisplayplayers[3]]) && !P_PlayerMoving(displayplayers[localdisplayplayers[3]])) if (CanChangeSkin(g_localplayers[3]) && !P_PlayerMoving(g_localplayers[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[localdisplayplayers[3]]].skin].name); CV_StealthSet(&cv_skin4, skins[players[g_localplayers[3]].skin].name);
} }
} }
@ -5948,7 +5948,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[localdisplayplayers[1]])) if (!P_PlayerMoving(g_localplayers[1]))
{ {
// Color change menu scrolling fix is no longer necessary // Color change menu scrolling fix is no longer necessary
SendNameAndColor2(); SendNameAndColor2();
@ -5956,7 +5956,7 @@ static void Color2_OnChange(void)
else else
{ {
CV_StealthSetValue(&cv_playercolor2, CV_StealthSetValue(&cv_playercolor2,
players[displayplayers[localdisplayplayers[1]]].skincolor); players[g_localplayers[1]].skincolor);
} }
} }
@ -5965,7 +5965,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[localdisplayplayers[2]])) if (!P_PlayerMoving(g_localplayers[2]))
{ {
// Color change menu scrolling fix is no longer necessary // Color change menu scrolling fix is no longer necessary
SendNameAndColor3(); SendNameAndColor3();
@ -5973,7 +5973,7 @@ static void Color3_OnChange(void)
else else
{ {
CV_StealthSetValue(&cv_playercolor3, CV_StealthSetValue(&cv_playercolor3,
players[displayplayers[localdisplayplayers[2]]].skincolor); players[g_localplayers[2]].skincolor);
} }
} }
@ -5982,7 +5982,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[localdisplayplayers[3]])) if (!P_PlayerMoving(g_localplayers[3]))
{ {
// Color change menu scrolling fix is no longer necessary // Color change menu scrolling fix is no longer necessary
SendNameAndColor4(); SendNameAndColor4();
@ -5990,7 +5990,7 @@ static void Color4_OnChange(void)
else else
{ {
CV_StealthSetValue(&cv_playercolor4, CV_StealthSetValue(&cv_playercolor4,
players[displayplayers[localdisplayplayers[3]]].skincolor); players[g_localplayers[3]].skincolor);
} }
} }

View file

@ -122,8 +122,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 */ /* g_localplayers[0] = consoleplayer */
extern INT32 localdisplayplayers[MAXSPLITSCREENPLAYERS]; extern INT32 g_localplayers[MAXSPLITSCREENPLAYERS];
/* spitscreen players sync */ /* spitscreen players sync */
extern int splitscreen_original_party_size[MAXPLAYERS]; extern int splitscreen_original_party_size[MAXPLAYERS];

View file

@ -115,7 +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]; INT32 g_localplayers[MAXSPLITSCREENPLAYERS];
tic_t gametic; tic_t gametic;
tic_t levelstarttic; // gametic at level start tic_t levelstarttic; // gametic at level start
@ -1257,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[localdisplayplayers[ssplayer-1]]]; player = &players[g_localplayers[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]);
@ -1596,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[localdisplayplayers[0]] != consoleplayer && ssplayer == 1) && g_localplayers[0] != consoleplayer && ssplayer == 1)
displayplayers[localdisplayplayers[0]] = consoleplayer; g_localplayers[0] = consoleplayer;
} }
@ -1749,12 +1749,12 @@ void G_DoLoadLevel(boolean resetplayer)
if (!resetplayer) if (!resetplayer)
P_FindEmerald(); P_FindEmerald();
displayplayers[localdisplayplayers[0]] = consoleplayer; // view the guy you are playing g_localplayers[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) && r_splitscreen < i) if (i > 0 && !(i == 1 && botingame) && r_splitscreen < i)
displayplayers[localdisplayplayers[i]] = consoleplayer; g_localplayers[i] = consoleplayer;
} }
gameaction = ga_nothing; gameaction = ga_nothing;
@ -1765,7 +1765,7 @@ void G_DoLoadLevel(boolean resetplayer)
for (i = 0; i <= r_splitscreen; i++) for (i = 0; i <= r_splitscreen; i++)
{ {
if (camera[i].chase) if (camera[i].chase)
P_ResetCamera(&players[displayplayers[localdisplayplayers[i]]], &camera[i]); P_ResetCamera(&players[g_localplayers[i]], &camera[i]);
} }
// clear cmd building stuff // clear cmd building stuff
@ -1876,7 +1876,7 @@ boolean G_Responder(event_t *ev)
&& (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 && (r_splitscreen || !netgame)) if (!demo.playback && (r_splitscreen || !netgame))
displayplayers[localdisplayplayers[0]] = consoleplayer; g_localplayers[0] = consoleplayer;
else else
{ {
G_AdjustView(1, 1, true); G_AdjustView(1, 1, true);
@ -2885,18 +2885,18 @@ void G_SpawnPlayer(INT32 playernum, boolean starpost)
if (nummapthings) if (nummapthings)
{ {
if (playernum == consoleplayer if (playernum == consoleplayer
|| (splitscreen && playernum == displayplayers[localdisplayplayers[1]]) || (splitscreen && playernum == g_localplayers[1])
|| (splitscreen > 1 && playernum == displayplayers[localdisplayplayers[2]]) || (splitscreen > 1 && playernum == g_localplayers[2])
|| (splitscreen > 2 && playernum == displayplayers[localdisplayplayers[3]])) || (splitscreen > 2 && playernum == g_localplayers[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[localdisplayplayers[1]]) || (splitscreen && playernum == g_localplayers[1])
|| (splitscreen > 1 && playernum == displayplayers[localdisplayplayers[2]]) || (splitscreen > 1 && playernum == g_localplayers[2])
|| (splitscreen > 2 && playernum == displayplayers[localdisplayplayers[3]])) || (splitscreen > 2 && playernum == g_localplayers[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.
} }
@ -2991,17 +2991,17 @@ mapthing_t *G_FindMatchStart(INT32 playernum)
return deathmatchstarts[i]; return deathmatchstarts[i];
} }
if (playernum == consoleplayer if (playernum == consoleplayer
|| (splitscreen && playernum == displayplayers[localdisplayplayers[1]]) || (splitscreen && playernum == g_localplayers[1])
|| (splitscreen > 1 && playernum == displayplayers[localdisplayplayers[2]]) || (splitscreen > 1 && playernum == g_localplayers[2])
|| (splitscreen > 2 && playernum == displayplayers[localdisplayplayers[3]])) || (splitscreen > 2 && playernum == g_localplayers[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[localdisplayplayers[1]]) || (splitscreen && playernum == g_localplayers[1])
|| (splitscreen > 1 && playernum == displayplayers[localdisplayplayers[2]]) || (splitscreen > 1 && playernum == g_localplayers[2])
|| (splitscreen > 2 && playernum == displayplayers[localdisplayplayers[3]])) || (splitscreen > 2 && playernum == g_localplayers[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;
} }
@ -3089,17 +3089,17 @@ mapthing_t *G_FindRaceStart(INT32 playernum)
//return playerstarts[0]; //return playerstarts[0];
if (playernum == consoleplayer if (playernum == consoleplayer
|| (splitscreen && playernum == displayplayers[localdisplayplayers[1]]) || (splitscreen && playernum == g_localplayers[1])
|| (splitscreen > 1 && playernum == displayplayers[localdisplayplayers[2]]) || (splitscreen > 1 && playernum == g_localplayers[2])
|| (splitscreen > 2 && playernum == displayplayers[localdisplayplayers[3]])) || (splitscreen > 2 && playernum == g_localplayers[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[localdisplayplayers[1]]) || (splitscreen && playernum == g_localplayers[1])
|| (splitscreen > 1 && playernum == displayplayers[localdisplayplayers[2]]) || (splitscreen > 1 && playernum == g_localplayers[2])
|| (splitscreen > 2 && playernum == displayplayers[localdisplayplayers[3]])) || (splitscreen > 2 && playernum == g_localplayers[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;
} }

View file

@ -45,13 +45,11 @@ G_ResetSplitscreen (int playernum)
/* easier to just rebuild displayplayers with local players */ /* easier to just rebuild displayplayers with local players */
for (i = 0; i <= splitscreen; ++i) for (i = 0; i <= splitscreen; ++i)
{ {
displayplayers[i] = old_displayplayers[localdisplayplayers[i]]; displayplayers[i] = g_localplayers[i];
localdisplayplayers[i] = i;
} }
while (i < MAXSPLITSCREENPLAYERS) while (i < MAXSPLITSCREENPLAYERS)
{ {
displayplayers[i] = consoleplayer; displayplayers[i] = consoleplayer;
localdisplayplayers[i] = 0;
i++; i++;
} }
@ -94,15 +92,6 @@ G_RemovePartyMember (int playernum)
memcpy(&new_party[before], &old_party[after], memcpy(&new_party[before], &old_party[after],
( old_party_size - after ) * sizeof *new_party); ( old_party_size - after ) * sizeof *new_party);
if (splitscreen_partied[playernum])
{
for (i = 0; i < MAXSPLITSCREENPLAYERS &&
localdisplayplayers[i] >= after; ++i)
{
localdisplayplayers[i] -= views;
}
}
views = ( old_party_size - views ); views = ( old_party_size - views );
for (i = 0; i < old_party_size; ++i) for (i = 0; i < old_party_size; ++i)
@ -197,20 +186,13 @@ G_AddPartyMember (int invitation, int playernum)
{ {
splitscreen_partied[invitation] = true; splitscreen_partied[invitation] = true;
for (i = 0; i <= splitscreen; ++i) for (i = 0; i < new_party_size; ++i)
{
localdisplayplayers[i] = ( old_party_size + i );
displayplayers[i] = party[i];
}
while (++i < new_party_size)
{ {
displayplayers[i] = party[i]; displayplayers[i] = party[i];
localdisplayplayers[i] = old_party_size;
} }
while (i < MAXSPLITSCREENPLAYERS) while (i < MAXSPLITSCREENPLAYERS)
{ {
displayplayers[i] = consoleplayer; displayplayers[i] = consoleplayer;
localdisplayplayers[i] = old_party_size;
i++; i++;
} }

View file

@ -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[localdisplayplayers[0]]]) // Don't play louder in splitscreen if (player == &players[g_localplayers[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);

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[localdisplayplayers[1]]; playernum = g_localplayers[1];
} }
if (netgame) if (netgame)

View file

@ -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[localdisplayplayers[1]]]; setupm_player = &players[g_localplayers[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[localdisplayplayers[1]])) if (splitscreen && !CanChangeSkin(g_localplayers[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[localdisplayplayers[2]]]; setupm_player = &players[g_localplayers[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[localdisplayplayers[2]])) if (splitscreen > 1 && !CanChangeSkin(g_localplayers[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[localdisplayplayers[3]]]; setupm_player = &players[g_localplayers[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[localdisplayplayers[3]])) if (splitscreen > 2 && !CanChangeSkin(g_localplayers[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[localdisplayplayers[0]]] && players[displayplayers[localdisplayplayers[0]]].mo) if (gamestate == GS_LEVEL && &players[g_localplayers[0]] && players[g_localplayers[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[localdisplayplayers[0]]].mo->x>>FRACBITS, players[g_localplayers[0]].mo->x>>FRACBITS,
players[displayplayers[localdisplayplayers[0]]].mo->y>>FRACBITS, players[g_localplayers[0]].mo->y>>FRACBITS,
players[displayplayers[localdisplayplayers[0]]].mo->z>>FRACBITS, players[g_localplayers[0]].mo->z>>FRACBITS,
FixedInt(AngleFixed(players[displayplayers[localdisplayplayers[0]]].mo->angle))); FixedInt(AngleFixed(players[g_localplayers[0]].mo->angle)));
else else
snprintf(locationtxt, 40, "Unknown"); snprintf(locationtxt, 40, "Unknown");

View file

@ -2536,9 +2536,9 @@ void T_CameraScanner(elevator_t *elevator)
lastleveltime = leveltime; lastleveltime = leveltime;
} }
if (players[displayplayers[localdisplayplayers[0]]].mo) if (players[g_localplayers[0]].mo)
{ {
if (players[displayplayers[localdisplayplayers[0]]].mo->subsector->sector == elevator->actionsector) if (players[g_localplayers[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[localdisplayplayers[1]]].mo) if (splitscreen && players[g_localplayers[1]].mo)
{ {
if (players[displayplayers[localdisplayplayers[1]]].mo->subsector->sector == elevator->actionsector) if (players[g_localplayers[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[localdisplayplayers[2]]].mo) if (splitscreen > 1 && players[g_localplayers[2]].mo)
{ {
if (players[displayplayers[localdisplayplayers[2]]].mo->subsector->sector == elevator->actionsector) if (players[g_localplayers[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[localdisplayplayers[3]]].mo) if (splitscreen > 2 && players[g_localplayers[3]].mo)
{ {
if (players[displayplayers[localdisplayplayers[3]]].mo->subsector->sector == elevator->actionsector) if (players[g_localplayers[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[localdisplayplayers[1]]]) else if (splitscreen && FFInfo->player == &players[g_localplayers[1]])
I_Tactile2(ConstantForce, &ConstantQuake); I_Tactile2(ConstantForce, &ConstantQuake);
else if (splitscreen > 1 && FFInfo->player == &players[displayplayers[localdisplayplayers[2]]]) else if (splitscreen > 1 && FFInfo->player == &players[g_localplayers[2]])
I_Tactile3(ConstantForce, &ConstantQuake); I_Tactile3(ConstantForce, &ConstantQuake);
else if (splitscreen > 2 && FFInfo->player == &players[displayplayers[localdisplayplayers[3]]]) else if (splitscreen > 2 && FFInfo->player == &players[g_localplayers[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[localdisplayplayers[1]]]) else if (splitscreen && FFInfo->player == &players[g_localplayers[1]])
I_Tactile2(ConstantForce, &RampQuake); I_Tactile2(ConstantForce, &RampQuake);
else if (splitscreen > 1 && FFInfo->player == &players[displayplayers[localdisplayplayers[2]]]) else if (splitscreen > 1 && FFInfo->player == &players[g_localplayers[2]])
I_Tactile3(ConstantForce, &RampQuake); I_Tactile3(ConstantForce, &RampQuake);
else if (splitscreen > 2 && FFInfo->player == &players[displayplayers[localdisplayplayers[3]]]) else if (splitscreen > 2 && FFInfo->player == &players[g_localplayers[3]])
I_Tactile4(ConstantForce, &RampQuake); I_Tactile4(ConstantForce, &RampQuake);
} }

View file

@ -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[localdisplayplayers[1]]]) if (player == &players[g_localplayers[1]])
cam_height = cv_cam2_height.value; cam_height = cv_cam2_height.value;
if (player == &players[displayplayers[localdisplayplayers[2]]]) if (player == &players[g_localplayers[2]])
cam_height = cv_cam3_height.value; cam_height = cv_cam3_height.value;
if (player == &players[displayplayers[localdisplayplayers[3]]]) if (player == &players[g_localplayers[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))
{ {
@ -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[localdisplayplayers[0]]].mo && !players[displayplayers[localdisplayplayers[0]]].spectator) && players[g_localplayers[0]].mo && !players[g_localplayers[0]].spectator)
{ {
fixed_t scale = 3*mobj->target->scale; fixed_t scale = 3*mobj->target->scale;
@ -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[localdisplayplayers[0]]] || !players[displayplayers[localdisplayplayers[0]]].mo) if (!playeringame[g_localplayers[0]] || !players[g_localplayers[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[localdisplayplayers[0]]].mo->subsector->sector->ceilingpic == skyflatnum) if (players[g_localplayers[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[localdisplayplayers[0]]].mo->y - 1024*FRACUNIT; yl = players[g_localplayers[0]].mo->y - 1024*FRACUNIT;
yh = players[displayplayers[localdisplayplayers[0]]].mo->y + 1024*FRACUNIT; yh = players[g_localplayers[0]].mo->y + 1024*FRACUNIT;
xl = players[displayplayers[localdisplayplayers[0]]].mo->x - 1024*FRACUNIT; xl = players[g_localplayers[0]].mo->x - 1024*FRACUNIT;
xh = players[displayplayers[localdisplayplayers[0]]].mo->x + 1024*FRACUNIT; xh = players[g_localplayers[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[localdisplayplayers[0]]].mo->x, players[displayplayers[localdisplayplayers[0]]].mo->y, 0, x, y, 0); newdist = S_CalculateSoundDistance(players[g_localplayers[0]].mo->x, players[g_localplayers[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[localdisplayplayers[0]]].mo, sfx_rainin, volume); S_StartSoundAtVolume(players[g_localplayers[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[localdisplayplayers[0]]].mo, sfx_litng1 + M_RandomKey(4), volume); S_StartSoundAtVolume(players[g_localplayers[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[localdisplayplayers[0]]].mo, sfx_athun1 + M_RandomKey(2), volume); S_StartSoundAtVolume(players[g_localplayers[0]].mo, sfx_athun1 + M_RandomKey(2), volume);
} }
} }

View file

@ -2567,29 +2567,29 @@ static void P_ForceCharacter(const char *forcecharskin)
{ {
if (splitscreen) if (splitscreen)
{ {
SetPlayerSkin(displayplayers[localdisplayplayers[1]], forcecharskin); SetPlayerSkin(g_localplayers[1], forcecharskin);
if ((unsigned)cv_playercolor2.value != skins[players[displayplayers[localdisplayplayers[1]]].skin].prefcolor && !modeattacking) if ((unsigned)cv_playercolor2.value != skins[players[g_localplayers[1]].skin].prefcolor && !modeattacking)
{ {
CV_StealthSetValue(&cv_playercolor2, skins[players[displayplayers[localdisplayplayers[1]]].skin].prefcolor); CV_StealthSetValue(&cv_playercolor2, skins[players[g_localplayers[1]].skin].prefcolor);
players[displayplayers[localdisplayplayers[1]]].skincolor = skins[players[displayplayers[localdisplayplayers[1]]].skin].prefcolor; players[g_localplayers[1]].skincolor = skins[players[g_localplayers[1]].skin].prefcolor;
} }
if (splitscreen > 1) if (splitscreen > 1)
{ {
SetPlayerSkin(displayplayers[localdisplayplayers[2]], forcecharskin); SetPlayerSkin(g_localplayers[2], forcecharskin);
if ((unsigned)cv_playercolor3.value != skins[players[displayplayers[localdisplayplayers[2]]].skin].prefcolor && !modeattacking) if ((unsigned)cv_playercolor3.value != skins[players[g_localplayers[2]].skin].prefcolor && !modeattacking)
{ {
CV_StealthSetValue(&cv_playercolor3, skins[players[displayplayers[localdisplayplayers[2]]].skin].prefcolor); CV_StealthSetValue(&cv_playercolor3, skins[players[g_localplayers[2]].skin].prefcolor);
players[displayplayers[localdisplayplayers[2]]].skincolor = skins[players[displayplayers[localdisplayplayers[2]]].skin].prefcolor; players[g_localplayers[2]].skincolor = skins[players[g_localplayers[2]].skin].prefcolor;
} }
if (splitscreen > 2) if (splitscreen > 2)
{ {
SetPlayerSkin(displayplayers[localdisplayplayers[3]], forcecharskin); SetPlayerSkin(g_localplayers[3], forcecharskin);
if ((unsigned)cv_playercolor4.value != skins[players[displayplayers[localdisplayplayers[3]]].skin].prefcolor && !modeattacking) if ((unsigned)cv_playercolor4.value != skins[players[g_localplayers[3]].skin].prefcolor && !modeattacking)
{ {
CV_StealthSetValue(&cv_playercolor4, skins[players[displayplayers[localdisplayplayers[3]]].skin].prefcolor); CV_StealthSetValue(&cv_playercolor4, skins[players[g_localplayers[3]].skin].prefcolor);
players[displayplayers[localdisplayplayers[3]]].skincolor = skins[players[displayplayers[localdisplayplayers[3]]].skin].prefcolor; players[g_localplayers[3]].skincolor = skins[players[g_localplayers[3]].skin].prefcolor;
} }
} }
} }
@ -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[localdisplayplayers[0]] = consoleplayer; // Start with your OWN view, please! g_localplayers[0] = consoleplayer; // Start with your OWN view, please!
} }
/*if (cv_useranalog.value) /*if (cv_useranalog.value)

View file

@ -7347,17 +7347,17 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
focusangle = localangle[0]; focusangle = localangle[0];
focusaiming = localaiming[0]; focusaiming = localaiming[0];
} }
else if (player == &players[displayplayers[localdisplayplayers[1]]]) else if (player == &players[g_localplayers[1]])
{ {
focusangle = localangle[1]; focusangle = localangle[1];
focusaiming = localaiming[1]; focusaiming = localaiming[1];
} }
else if (player == &players[displayplayers[localdisplayplayers[2]]]) else if (player == &players[g_localplayers[2]])
{ {
focusangle = localangle[2]; focusangle = localangle[2];
focusaiming = localaiming[2]; focusaiming = localaiming[2];
} }
else if (player == &players[displayplayers[localdisplayplayers[3]]]) else if (player == &players[g_localplayers[3]])
{ {
focusangle = localangle[3]; focusangle = localangle[3];
focusaiming = localaiming[3]; focusaiming = localaiming[3];
@ -7893,8 +7893,8 @@ boolean P_SpectatorJoinGame(player_t *player)
player->playerstate = PST_REBORN; player->playerstate = PST_REBORN;
//Reset away view //Reset away view
if (P_IsLocalPlayer(player) && displayplayers[localdisplayplayers[0]] != consoleplayer) if (P_IsLocalPlayer(player) && g_localplayers[0] != consoleplayer)
displayplayers[localdisplayplayers[0]] = consoleplayer; g_localplayers[0] = consoleplayer;
HU_AddChatText(va(M_GetText("\x82*%s entered the game."), player_names[player-players]), false); HU_AddChatText(va(M_GetText("\x82*%s entered the game."), player_names[player-players]), false);
return true; // no more player->mo, cannot continue. return true; // no more player->mo, cannot continue.

View file

@ -2089,7 +2089,7 @@ void ST_Drawer(void)
UINT8 i; UINT8 i;
#ifdef SEENAMES #ifdef SEENAMES
if (cv_seenames.value && cv_allowseenames.value && displayplayers[localdisplayplayers[0]] == consoleplayer && seenplayer && seenplayer->mo && !mapreset) if (cv_seenames.value && cv_allowseenames.value && g_localplayers[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]);

View file

@ -1263,19 +1263,19 @@ void Y_VoteDrawer(void)
{ {
case 1: case 1:
thiscurs = cursor2; thiscurs = cursor2;
p = displayplayers[localdisplayplayers[1]]; p = g_localplayers[1];
break; break;
case 2: case 2:
thiscurs = cursor3; thiscurs = cursor3;
p = displayplayers[localdisplayplayers[2]]; p = g_localplayers[2];
break; break;
case 3: case 3:
thiscurs = cursor4; thiscurs = cursor4;
p = displayplayers[localdisplayplayers[3]]; p = g_localplayers[3];
break; break;
default: default:
thiscurs = cursor1; thiscurs = cursor1;
p = displayplayers[localdisplayplayers[0]]; p = g_localplayers[0];
break; break;
} }
@ -1563,13 +1563,13 @@ void Y_VoteTicker(void)
switch (i) switch (i)
{ {
case 1: case 1:
p = displayplayers[localdisplayplayers[1]]; p = g_localplayers[1];
break; break;
case 2: case 2:
p = displayplayers[localdisplayplayers[2]]; p = g_localplayers[2];
break; break;
case 3: case 3:
p = displayplayers[localdisplayplayers[3]]; p = g_localplayers[3];
break; break;
default: default:
p = consoleplayer; p = consoleplayer;