From 4f40edaf01ce104265b4b942ba8182e1e113f6a2 Mon Sep 17 00:00:00 2001 From: James R Date: Sun, 23 Feb 2020 18:20:55 -0800 Subject: [PATCH] Maybe localdisplayplayers is a bad idea --- src/d_clisrv.c | 9 ++- src/d_main.c | 2 +- src/d_netcmd.c | 134 +++++++++++++++++++++---------------------- src/doomstat.h | 4 +- src/g_game.c | 52 ++++++++--------- src/g_splitscreen.c | 22 +------ src/k_kart.c | 2 +- src/lua_consolelib.c | 2 +- src/m_menu.c | 12 ++-- src/m_misc.c | 10 ++-- src/p_floor.c | 16 +++--- src/p_inter.c | 12 ++-- src/p_mobj.c | 28 ++++----- src/p_setup.c | 26 ++++----- src/p_user.c | 10 ++-- src/st_stuff.c | 2 +- src/y_inter.c | 14 ++--- 17 files changed, 169 insertions(+), 188 deletions(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 7c3f1aa30..a6190a0dc 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -2747,8 +2747,8 @@ void CL_RemovePlayer(INT32 playernum, INT32 reason) G_RemovePartyMember(playernum); - if (playernum == displayplayers[localdisplayplayers[0]] && !demo.playback) - displayplayers[localdisplayplayers[0]] = consoleplayer; // don't look through someone's view who isn't there + if (playernum == g_localplayers[0] && !demo.playback) + g_localplayers[0] = consoleplayer; // don't look through someone's view who isn't there #ifdef HAVE_BLUA LUA_InvalidatePlayer(&players[playernum]); @@ -3529,7 +3529,7 @@ static void Got_AddPlayer(UINT8 **p, INT32 playernum) if (splitscreenplayer) { displayplayers[splitscreenplayer] = newplayernum; - localdisplayplayers[splitscreenplayer] = splitscreenplayer; + g_localplayers[splitscreenplayer] = newplayernum; DEBFILE(va("spawning sister # %d\n", splitscreenplayer)); if (splitscreenplayer == 1 && botingame) players[newplayernum].bot = 1; @@ -3540,7 +3540,7 @@ static void Got_AddPlayer(UINT8 **p, INT32 playernum) for (i = 0; i < MAXSPLITSCREENPLAYERS; i++) { displayplayers[i] = newplayernum; - localdisplayplayers[i] = 0; + g_localplayers[i] = newplayernum; } splitscreen_partied[newplayernum] = true; DEBFILE("spawning me\n"); @@ -3751,7 +3751,6 @@ void SV_StopServer(void) D_Clearticcmd(i); consoleplayer = 0; - localdisplayplayers[0] = 0; cl_mode = CL_SEARCHING; maketic = gametic+1; neededtic = maketic; diff --git a/src/d_main.c b/src/d_main.c index e0ba654ad..8a01ec45e 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -780,7 +780,7 @@ void D_StartTitle(void) gameaction = ga_nothing; memset(displayplayers, 0, sizeof(displayplayers)); - memset(localdisplayplayers, 0, sizeof localdisplayplayers); + memset(g_localplayers, 0, sizeof g_localplayers); consoleplayer = 0; //demosequence = -1; gametype = GT_RACE; // SRB2kart diff --git a/src/d_netcmd.c b/src/d_netcmd.c index a2e566d63..fa10c1640 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -1196,11 +1196,11 @@ static void CleanupPlayerName(INT32 playernum, const char *newname) // spaces may have been removed if (playernum == consoleplayer) 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); - else if (playernum == displayplayers[localdisplayplayers[2]] || (!netgame && playernum == 2)) + else if (playernum == g_localplayers[2] || (!netgame && playernum == 2)) 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); else I_Assert(((void)"CleanupPlayerName used on non-local player", 0)); @@ -1308,11 +1308,11 @@ static void ForceAllSkins(INT32 forcedskin) { if (i == consoleplayer) 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); - else if (i == displayplayers[localdisplayplayers[2]]) + else if (i == g_localplayers[2]) 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); } } @@ -1479,8 +1479,8 @@ static void SendNameAndColor2(void) if (splitscreen < 1 && !botingame) return; // can happen if skin2/color2/name2 changed - if (displayplayers[localdisplayplayers[1]] != consoleplayer) - secondplaya = displayplayers[localdisplayplayers[1]]; + if (g_localplayers[1] != consoleplayer) + secondplaya = g_localplayers[1]; else if (!netgame) // HACK secondplaya = 1; @@ -1568,14 +1568,14 @@ static void SendNameAndColor2(void) snac2pending++; // Don't change name if muted - if (cv_mute.value && !(server || IsPlayerAdmin(displayplayers[localdisplayplayers[1]]))) - CV_StealthSet(&cv_playername2, player_names[displayplayers[localdisplayplayers[1]]]); + if (cv_mute.value && !(server || IsPlayerAdmin(g_localplayers[1]))) + CV_StealthSet(&cv_playername2, player_names[g_localplayers[1]]); 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. - if (!CanChangeSkin(displayplayers[localdisplayplayers[1]])) - CV_StealthSet(&cv_skin2, skins[players[displayplayers[localdisplayplayers[1]]].skin].name); + if (!CanChangeSkin(g_localplayers[1])) + CV_StealthSet(&cv_skin2, skins[players[g_localplayers[1]].skin].name); // check if player has the skin loaded (cv_skin2 may have // the name of a skin that was available in the previous game) @@ -1602,8 +1602,8 @@ static void SendNameAndColor3(void) if (splitscreen < 2) return; // can happen if skin3/color3/name3 changed - if (displayplayers[localdisplayplayers[2]] != consoleplayer) - thirdplaya = displayplayers[localdisplayplayers[2]]; + if (g_localplayers[2] != consoleplayer) + thirdplaya = g_localplayers[2]; else if (!netgame) // HACK thirdplaya = 2; @@ -1683,14 +1683,14 @@ static void SendNameAndColor3(void) snac3pending++; // Don't change name if muted - if (cv_mute.value && !(server || IsPlayerAdmin(displayplayers[localdisplayplayers[2]]))) - CV_StealthSet(&cv_playername3, player_names[displayplayers[localdisplayplayers[2]]]); + if (cv_mute.value && !(server || IsPlayerAdmin(g_localplayers[2]))) + CV_StealthSet(&cv_playername3, player_names[g_localplayers[2]]); 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. - if (!CanChangeSkin(displayplayers[localdisplayplayers[2]])) - CV_StealthSet(&cv_skin3, skins[players[displayplayers[localdisplayplayers[2]]].skin].name); + if (!CanChangeSkin(g_localplayers[2])) + CV_StealthSet(&cv_skin3, skins[players[g_localplayers[2]].skin].name); // check if player has the skin loaded (cv_skin3 may have // the name of a skin that was available in the previous game) @@ -1717,8 +1717,8 @@ static void SendNameAndColor4(void) if (splitscreen < 3) return; // can happen if skin4/color4/name4 changed - if (displayplayers[localdisplayplayers[3]] != consoleplayer) - fourthplaya = displayplayers[localdisplayplayers[3]]; + if (g_localplayers[3] != consoleplayer) + fourthplaya = g_localplayers[3]; else if (!netgame) // HACK fourthplaya = 3; @@ -1806,14 +1806,14 @@ static void SendNameAndColor4(void) snac4pending++; // Don't change name if muted - if (cv_mute.value && !(server || IsPlayerAdmin(displayplayers[localdisplayplayers[3]]))) - CV_StealthSet(&cv_playername4, player_names[displayplayers[localdisplayplayers[3]]]); + if (cv_mute.value && !(server || IsPlayerAdmin(g_localplayers[3]))) + CV_StealthSet(&cv_playername4, player_names[g_localplayers[3]]); 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. - if (!CanChangeSkin(displayplayers[localdisplayplayers[3]])) - CV_StealthSet(&cv_skin4, skins[players[displayplayers[localdisplayplayers[3]]].skin].name); + if (!CanChangeSkin(g_localplayers[3])) + CV_StealthSet(&cv_skin4, skins[players[g_localplayers[3]].skin].name); // check if player has the skin loaded (cv_skin4 may have // 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) snacpending--; // TODO: make snacpending an array instead of 4 separate vars? - else if (playernum == displayplayers[localdisplayplayers[1]]) + else if (playernum == g_localplayers[1]) snac2pending--; - else if (playernum == displayplayers[localdisplayplayers[2]]) + else if (playernum == g_localplayers[2]) snac3pending--; - else if (playernum == displayplayers[localdisplayplayers[3]]) + else if (playernum == g_localplayers[3]) snac4pending--; #ifdef PARANOIA @@ -1871,8 +1871,8 @@ static void Got_NameAndColor(UINT8 **cp, INT32 playernum) demo_extradata[playernum] |= DXD_COLOR; // normal player colors - if (server && (p != &players[consoleplayer] && p != &players[displayplayers[localdisplayplayers[1]]] - && p != &players[displayplayers[localdisplayplayers[2]]] && p != &players[displayplayers[localdisplayplayers[3]]])) + if (server && (p != &players[consoleplayer] && p != &players[g_localplayers[1]] + && p != &players[g_localplayers[2]] && p != &players[g_localplayers[3]])) { boolean kick = false; @@ -1909,11 +1909,11 @@ static void Got_NameAndColor(UINT8 **cp, INT32 playernum) if (playernum == consoleplayer) 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); - else if (playernum == displayplayers[localdisplayplayers[2]]) + else if (playernum == g_localplayers[2]) 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); } else @@ -2184,7 +2184,7 @@ void D_SendPlayerConfig(void) // Only works for displayplayer, sorry! 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 */ @@ -2721,7 +2721,7 @@ void D_ModifyClientVote(SINT8 voted, UINT8 splitplayer) UINT8 player = consoleplayer; if (splitplayer > 0) - player = displayplayers[localdisplayplayers[splitplayer]]; + player = g_localplayers[splitplayer]; WRITESINT8(p, voted); WRITEUINT8(p, player); @@ -3373,11 +3373,11 @@ static void Command_Teamchange2_f(void) return; } - if (players[displayplayers[localdisplayplayers[1]]].spectator) - error = !(NetPacket.packet.newteam || (players[displayplayers[localdisplayplayers[1]]].pflags & PF_WANTSTOJOIN)); + if (players[g_localplayers[1]].spectator) + error = !(NetPacket.packet.newteam || (players[g_localplayers[1]].pflags & PF_WANTSTOJOIN)); else if (G_GametypeHasTeams()) - error = (NetPacket.packet.newteam == (unsigned)players[displayplayers[localdisplayplayers[1]]].ctfteam); - else if (G_GametypeHasSpectators() && !players[displayplayers[localdisplayplayers[1]]].spectator) + error = (NetPacket.packet.newteam == (unsigned)players[g_localplayers[1]].ctfteam); + else if (G_GametypeHasSpectators() && !players[g_localplayers[1]].spectator) error = (NetPacket.packet.newteam == 3); #ifdef PARANOIA else @@ -3464,11 +3464,11 @@ static void Command_Teamchange3_f(void) return; } - if (players[displayplayers[localdisplayplayers[2]]].spectator) - error = !(NetPacket.packet.newteam || (players[displayplayers[localdisplayplayers[2]]].pflags & PF_WANTSTOJOIN)); + if (players[g_localplayers[2]].spectator) + error = !(NetPacket.packet.newteam || (players[g_localplayers[2]].pflags & PF_WANTSTOJOIN)); else if (G_GametypeHasTeams()) - error = (NetPacket.packet.newteam == (unsigned)players[displayplayers[localdisplayplayers[2]]].ctfteam); - else if (G_GametypeHasSpectators() && !players[displayplayers[localdisplayplayers[2]]].spectator) + error = (NetPacket.packet.newteam == (unsigned)players[g_localplayers[2]].ctfteam); + else if (G_GametypeHasSpectators() && !players[g_localplayers[2]].spectator) error = (NetPacket.packet.newteam == 3); #ifdef PARANOIA else @@ -3555,11 +3555,11 @@ static void Command_Teamchange4_f(void) return; } - if (players[displayplayers[localdisplayplayers[3]]].spectator) - error = !(NetPacket.packet.newteam || (players[displayplayers[localdisplayplayers[3]]].pflags & PF_WANTSTOJOIN)); + if (players[g_localplayers[3]].spectator) + error = !(NetPacket.packet.newteam || (players[g_localplayers[3]].pflags & PF_WANTSTOJOIN)); else if (G_GametypeHasTeams()) - error = (NetPacket.packet.newteam == (unsigned)players[displayplayers[localdisplayplayers[3]]].ctfteam); - else if (G_GametypeHasSpectators() && !players[displayplayers[localdisplayplayers[3]]].spectator) + error = (NetPacket.packet.newteam == (unsigned)players[g_localplayers[3]].ctfteam); + else if (G_GametypeHasSpectators() && !players[g_localplayers[3]].spectator) error = (NetPacket.packet.newteam == 3); #ifdef PARANOIA 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 //reset view if you are changed, or viewing someone who was changed. - if (playernum == consoleplayer || displayplayers[localdisplayplayers[0]] == playernum) - displayplayers[localdisplayplayers[0]] = consoleplayer; + if (playernum == consoleplayer || g_localplayers[0] == playernum) + g_localplayers[0] = consoleplayer; if (G_GametypeHasTeams()) { @@ -5598,7 +5598,7 @@ static void Command_Displayplayer_f(void) int i; for (i = 0; i <= splitscreen; ++i) { - playernum = displayplayers[localdisplayplayers[i]]; + playernum = g_localplayers[i]; CONS_Printf( "local player %d: \x84(%d) \x83%s\x80\n", i, @@ -5811,7 +5811,7 @@ static void Name2_OnChange(void) 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")); - CV_StealthSet(&cv_playername2, player_names[displayplayers[localdisplayplayers[1]]]); + CV_StealthSet(&cv_playername2, player_names[g_localplayers[1]]); } else SendNameAndColor2(); @@ -5822,7 +5822,7 @@ static void Name3_OnChange(void) 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")); - CV_StealthSet(&cv_playername3, player_names[displayplayers[localdisplayplayers[2]]]); + CV_StealthSet(&cv_playername3, player_names[g_localplayers[2]]); } else SendNameAndColor3(); @@ -5833,7 +5833,7 @@ static void Name4_OnChange(void) 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")); - CV_StealthSet(&cv_playername4, player_names[displayplayers[localdisplayplayers[3]]]); + CV_StealthSet(&cv_playername4, player_names[g_localplayers[3]]); } else SendNameAndColor4(); @@ -5874,12 +5874,12 @@ static void Skin2_OnChange(void) if (!Playing() || !splitscreen) 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(); else { 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) 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(); else { 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) 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(); else { 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) 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 SendNameAndColor2(); @@ -5956,7 +5956,7 @@ static void Color2_OnChange(void) else { 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) 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 SendNameAndColor3(); @@ -5973,7 +5973,7 @@ static void Color3_OnChange(void) else { 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) 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 SendNameAndColor4(); @@ -5990,7 +5990,7 @@ static void Color4_OnChange(void) else { CV_StealthSetValue(&cv_playercolor4, - players[displayplayers[localdisplayplayers[3]]].skincolor); + players[g_localplayers[3]].skincolor); } } diff --git a/src/doomstat.h b/src/doomstat.h index fbda4df2a..675f79d38 100644 --- a/src/doomstat.h +++ b/src/doomstat.h @@ -122,8 +122,8 @@ extern boolean gamedataloaded; // Player taking events, and displaying. extern INT32 consoleplayer; extern INT32 displayplayers[MAXSPLITSCREENPLAYERS]; -/* displayplayers[localdisplayplayers[0]] = consoleplayer */ -extern INT32 localdisplayplayers[MAXSPLITSCREENPLAYERS]; +/* g_localplayers[0] = consoleplayer */ +extern INT32 g_localplayers[MAXSPLITSCREENPLAYERS]; /* spitscreen players sync */ extern int splitscreen_original_party_size[MAXPLAYERS]; diff --git a/src/g_game.c b/src/g_game.c index 871eafaab..ffb75f3fb 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -115,7 +115,7 @@ player_t players[MAXPLAYERS]; INT32 consoleplayer; // player taking events and displaying INT32 displayplayers[MAXSPLITSCREENPLAYERS]; // view being displayed -INT32 localdisplayplayers[MAXSPLITSCREENPLAYERS]; +INT32 g_localplayers[MAXSPLITSCREENPLAYERS]; tic_t gametic; tic_t levelstarttic; // gametic at level start @@ -1257,7 +1257,7 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer) if (ssplayer == 1) player = &players[consoleplayer]; else - player = &players[displayplayers[localdisplayplayers[ssplayer-1]]]; + player = &players[g_localplayers[ssplayer-1]]; if (ssplayer == 2) 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. if ((cmd->forwardmove || cmd->sidemove || cmd->buttons) - && displayplayers[localdisplayplayers[0]] != consoleplayer && ssplayer == 1) - displayplayers[localdisplayplayers[0]] = consoleplayer; + && g_localplayers[0] != consoleplayer && ssplayer == 1) + g_localplayers[0] = consoleplayer; } @@ -1749,12 +1749,12 @@ void G_DoLoadLevel(boolean resetplayer) if (!resetplayer) 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++) { if (i > 0 && !(i == 1 && botingame) && r_splitscreen < i) - displayplayers[localdisplayplayers[i]] = consoleplayer; + g_localplayers[i] = consoleplayer; } gameaction = ga_nothing; @@ -1765,7 +1765,7 @@ void G_DoLoadLevel(boolean resetplayer) for (i = 0; i <= r_splitscreen; i++) { if (camera[i].chase) - P_ResetCamera(&players[displayplayers[localdisplayplayers[i]]], &camera[i]); + P_ResetCamera(&players[g_localplayers[i]], &camera[i]); } // 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])) { if (!demo.playback && (r_splitscreen || !netgame)) - displayplayers[localdisplayplayers[0]] = consoleplayer; + g_localplayers[0] = consoleplayer; else { G_AdjustView(1, 1, true); @@ -2885,18 +2885,18 @@ void G_SpawnPlayer(INT32 playernum, boolean starpost) if (nummapthings) { if (playernum == consoleplayer - || (splitscreen && playernum == displayplayers[localdisplayplayers[1]]) - || (splitscreen > 1 && playernum == displayplayers[localdisplayplayers[2]]) - || (splitscreen > 2 && playernum == displayplayers[localdisplayplayers[3]])) + || (splitscreen && playernum == g_localplayers[1]) + || (splitscreen > 1 && playernum == g_localplayers[2]) + || (splitscreen > 2 && playernum == g_localplayers[3])) CONS_Alert(CONS_ERROR, M_GetText("No player spawns found, spawning at the first mapthing!\n")); spawnpoint = &mapthings[0]; } else { if (playernum == consoleplayer - || (splitscreen && playernum == displayplayers[localdisplayplayers[1]]) - || (splitscreen > 1 && playernum == displayplayers[localdisplayplayers[2]]) - || (splitscreen > 2 && playernum == displayplayers[localdisplayplayers[3]])) + || (splitscreen && playernum == g_localplayers[1]) + || (splitscreen > 1 && playernum == g_localplayers[2]) + || (splitscreen > 2 && playernum == g_localplayers[3])) 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. } @@ -2991,17 +2991,17 @@ mapthing_t *G_FindMatchStart(INT32 playernum) return deathmatchstarts[i]; } if (playernum == consoleplayer - || (splitscreen && playernum == displayplayers[localdisplayplayers[1]]) - || (splitscreen > 1 && playernum == displayplayers[localdisplayplayers[2]]) - || (splitscreen > 2 && playernum == displayplayers[localdisplayplayers[3]])) + || (splitscreen && playernum == g_localplayers[1]) + || (splitscreen > 1 && playernum == g_localplayers[2]) + || (splitscreen > 2 && playernum == g_localplayers[3])) CONS_Alert(CONS_WARNING, M_GetText("Could not spawn at any Deathmatch starts!\n")); return NULL; } if (playernum == consoleplayer - || (splitscreen && playernum == displayplayers[localdisplayplayers[1]]) - || (splitscreen > 1 && playernum == displayplayers[localdisplayplayers[2]]) - || (splitscreen > 2 && playernum == displayplayers[localdisplayplayers[3]])) + || (splitscreen && playernum == g_localplayers[1]) + || (splitscreen > 1 && playernum == g_localplayers[2]) + || (splitscreen > 2 && playernum == g_localplayers[3])) CONS_Alert(CONS_WARNING, M_GetText("No Deathmatch starts in this map!\n")); return NULL; } @@ -3089,17 +3089,17 @@ mapthing_t *G_FindRaceStart(INT32 playernum) //return playerstarts[0]; if (playernum == consoleplayer - || (splitscreen && playernum == displayplayers[localdisplayplayers[1]]) - || (splitscreen > 1 && playernum == displayplayers[localdisplayplayers[2]]) - || (splitscreen > 2 && playernum == displayplayers[localdisplayplayers[3]])) + || (splitscreen && playernum == g_localplayers[1]) + || (splitscreen > 1 && playernum == g_localplayers[2]) + || (splitscreen > 2 && playernum == g_localplayers[3])) CONS_Alert(CONS_WARNING, M_GetText("Could not spawn at any Race starts!\n")); return NULL; } if (playernum == consoleplayer - || (splitscreen && playernum == displayplayers[localdisplayplayers[1]]) - || (splitscreen > 1 && playernum == displayplayers[localdisplayplayers[2]]) - || (splitscreen > 2 && playernum == displayplayers[localdisplayplayers[3]])) + || (splitscreen && playernum == g_localplayers[1]) + || (splitscreen > 1 && playernum == g_localplayers[2]) + || (splitscreen > 2 && playernum == g_localplayers[3])) CONS_Alert(CONS_WARNING, M_GetText("No Race starts in this map!\n")); return NULL; } diff --git a/src/g_splitscreen.c b/src/g_splitscreen.c index 6f5a69297..d99f85ea3 100644 --- a/src/g_splitscreen.c +++ b/src/g_splitscreen.c @@ -45,13 +45,11 @@ G_ResetSplitscreen (int playernum) /* easier to just rebuild displayplayers with local players */ for (i = 0; i <= splitscreen; ++i) { - displayplayers[i] = old_displayplayers[localdisplayplayers[i]]; - localdisplayplayers[i] = i; + displayplayers[i] = g_localplayers[i]; } while (i < MAXSPLITSCREENPLAYERS) { displayplayers[i] = consoleplayer; - localdisplayplayers[i] = 0; i++; } @@ -94,15 +92,6 @@ G_RemovePartyMember (int playernum) memcpy(&new_party[before], &old_party[after], ( 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 ); for (i = 0; i < old_party_size; ++i) @@ -197,20 +186,13 @@ G_AddPartyMember (int invitation, int playernum) { splitscreen_partied[invitation] = true; - for (i = 0; i <= splitscreen; ++i) - { - localdisplayplayers[i] = ( old_party_size + i ); - displayplayers[i] = party[i]; - } - while (++i < new_party_size) + for (i = 0; i < new_party_size; ++i) { displayplayers[i] = party[i]; - localdisplayplayers[i] = old_party_size; } while (i < MAXSPLITSCREENPLAYERS) { displayplayers[i] = consoleplayer; - localdisplayplayers[i] = old_party_size; i++; } diff --git a/src/k_kart.c b/src/k_kart.c index ebce1458e..8fdc61529 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -6635,7 +6635,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground) } // 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)) S_StartSound(NULL, sfx_s3ka7); diff --git a/src/lua_consolelib.c b/src/lua_consolelib.c index 2ce3e89ae..4e75ca8f7 100644 --- a/src/lua_consolelib.c +++ b/src/lua_consolelib.c @@ -125,7 +125,7 @@ void COM_Lua_f(void) lua_pop(gL, 1); // pop command info table return; // can't execute splitscreen command without player 2! } - playernum = displayplayers[localdisplayplayers[1]]; + playernum = g_localplayers[1]; } if (netgame) diff --git a/src/m_menu.c b/src/m_menu.c index 3fe0198df..df4e2ed39 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -9525,7 +9525,7 @@ static void M_SetupMultiPlayer2(INT32 choice) strcpy (setupm_name, cv_playername2.string); // set for splitscreen secondary player - setupm_player = &players[displayplayers[localdisplayplayers[1]]]; + setupm_player = &players[g_localplayers[1]]; setupm_cvskin = &cv_skin2; setupm_cvcolor = &cv_playercolor2; setupm_cvname = &cv_playername2; @@ -9537,7 +9537,7 @@ static void M_SetupMultiPlayer2(INT32 choice) setupm_fakecolor = setupm_cvcolor->value; // 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); else MP_PlayerSetupMenu[2].status = (IT_KEYHANDLER | IT_STRING); @@ -9556,7 +9556,7 @@ static void M_SetupMultiPlayer3(INT32 choice) strcpy(setupm_name, cv_playername3.string); // set for splitscreen third player - setupm_player = &players[displayplayers[localdisplayplayers[2]]]; + setupm_player = &players[g_localplayers[2]]; setupm_cvskin = &cv_skin3; setupm_cvcolor = &cv_playercolor3; setupm_cvname = &cv_playername3; @@ -9568,7 +9568,7 @@ static void M_SetupMultiPlayer3(INT32 choice) setupm_fakecolor = setupm_cvcolor->value; // 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); else MP_PlayerSetupMenu[2].status = (IT_KEYHANDLER | IT_STRING); @@ -9587,7 +9587,7 @@ static void M_SetupMultiPlayer4(INT32 choice) strcpy(setupm_name, cv_playername4.string); // set for splitscreen fourth player - setupm_player = &players[displayplayers[localdisplayplayers[3]]]; + setupm_player = &players[g_localplayers[3]]; setupm_cvskin = &cv_skin4; setupm_cvcolor = &cv_playercolor4; setupm_cvname = &cv_playername4; @@ -9599,7 +9599,7 @@ static void M_SetupMultiPlayer4(INT32 choice) setupm_fakecolor = setupm_cvcolor->value; // 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); else MP_PlayerSetupMenu[2].status = (IT_KEYHANDLER | IT_STRING); diff --git a/src/m_misc.c b/src/m_misc.c index b232bce9a..c3b8776b0 100644 --- a/src/m_misc.c +++ b/src/m_misc.c @@ -743,12 +743,12 @@ static void M_PNGText(png_structp png_ptr, png_infop png_info_ptr, PNG_CONST png else 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", - players[displayplayers[localdisplayplayers[0]]].mo->x>>FRACBITS, - players[displayplayers[localdisplayplayers[0]]].mo->y>>FRACBITS, - players[displayplayers[localdisplayplayers[0]]].mo->z>>FRACBITS, - FixedInt(AngleFixed(players[displayplayers[localdisplayplayers[0]]].mo->angle))); + players[g_localplayers[0]].mo->x>>FRACBITS, + players[g_localplayers[0]].mo->y>>FRACBITS, + players[g_localplayers[0]].mo->z>>FRACBITS, + FixedInt(AngleFixed(players[g_localplayers[0]].mo->angle))); else snprintf(locationtxt, 40, "Unknown"); diff --git a/src/p_floor.c b/src/p_floor.c index a6419b409..510832b90 100644 --- a/src/p_floor.c +++ b/src/p_floor.c @@ -2536,9 +2536,9 @@ void T_CameraScanner(elevator_t *elevator) 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) 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) 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) 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) t_cam4_dist = cv_cam4_dist.value; diff --git a/src/p_inter.c b/src/p_inter.c index d53423a46..81240d72f 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -63,11 +63,11 @@ void P_ForceConstant(const BasicFF_t *FFInfo) ConstantQuake.Magnitude = FFInfo->Magnitude; if (FFInfo->player == &players[consoleplayer]) 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); - else if (splitscreen > 1 && FFInfo->player == &players[displayplayers[localdisplayplayers[2]]]) + else if (splitscreen > 1 && FFInfo->player == &players[g_localplayers[2]]) 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); } 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; if (FFInfo->player == &players[consoleplayer]) 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); - else if (splitscreen > 1 && FFInfo->player == &players[displayplayers[localdisplayplayers[2]]]) + else if (splitscreen > 1 && FFInfo->player == &players[g_localplayers[2]]) 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); } diff --git a/src/p_mobj.c b/src/p_mobj.c index d648ff0f3..b0c8f43cb 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -3656,11 +3656,11 @@ boolean P_CameraThinker(player_t *player, camera_t *thiscam, boolean resetcalled fixed_t cam_height = cv_cam_height.value; thiscam->z = thiscam->floorz; - if (player == &players[displayplayers[localdisplayplayers[1]]]) + if (player == &players[g_localplayers[1]]) cam_height = cv_cam2_height.value; - if (player == &players[displayplayers[localdisplayplayers[2]]]) + if (player == &players[g_localplayers[2]]) cam_height = cv_cam3_height.value; - if (player == &players[displayplayers[localdisplayplayers[3]]]) + if (player == &players[g_localplayers[3]]) cam_height = cv_cam4_height.value; 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 && mobj->target->player && !mobj->target->player->spectator && 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; @@ -11136,13 +11136,13 @@ void P_PrecipitationEffects(void) // Local effects from here on out! // 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; if (sound_disabled) 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. else { @@ -11150,17 +11150,17 @@ void P_PrecipitationEffects(void) fixed_t closedist, newdist; // Essentially check in a 1024 unit radius of the player for an outdoor area. - yl = players[displayplayers[localdisplayplayers[0]]].mo->y - 1024*FRACUNIT; - yh = players[displayplayers[localdisplayplayers[0]]].mo->y + 1024*FRACUNIT; - xl = players[displayplayers[localdisplayplayers[0]]].mo->x - 1024*FRACUNIT; - xh = players[displayplayers[localdisplayplayers[0]]].mo->x + 1024*FRACUNIT; + yl = players[g_localplayers[0]].mo->y - 1024*FRACUNIT; + yh = players[g_localplayers[0]].mo->y + 1024*FRACUNIT; + xl = players[g_localplayers[0]].mo->x - 1024*FRACUNIT; + xh = players[g_localplayers[0]].mo->x + 1024*FRACUNIT; closedist = 2048*FRACUNIT; for (y = yl; y <= yh; y += FRACUNIT*64) for (x = xl; x <= xh; x += FRACUNIT*64) { 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) closedist = newdist; } @@ -11175,7 +11175,7 @@ void P_PrecipitationEffects(void) volume = 255; 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) return; @@ -11183,7 +11183,7 @@ void P_PrecipitationEffects(void) if (effects_lightning && lightningStrike && volume) { // 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) { @@ -11191,7 +11191,7 @@ void P_PrecipitationEffects(void) if (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); } } diff --git a/src/p_setup.c b/src/p_setup.c index 491127d5b..0b237c520 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -2567,29 +2567,29 @@ static void P_ForceCharacter(const char *forcecharskin) { if (splitscreen) { - SetPlayerSkin(displayplayers[localdisplayplayers[1]], forcecharskin); - if ((unsigned)cv_playercolor2.value != skins[players[displayplayers[localdisplayplayers[1]]].skin].prefcolor && !modeattacking) + SetPlayerSkin(g_localplayers[1], forcecharskin); + if ((unsigned)cv_playercolor2.value != skins[players[g_localplayers[1]].skin].prefcolor && !modeattacking) { - CV_StealthSetValue(&cv_playercolor2, skins[players[displayplayers[localdisplayplayers[1]]].skin].prefcolor); - players[displayplayers[localdisplayplayers[1]]].skincolor = skins[players[displayplayers[localdisplayplayers[1]]].skin].prefcolor; + CV_StealthSetValue(&cv_playercolor2, skins[players[g_localplayers[1]].skin].prefcolor); + players[g_localplayers[1]].skincolor = skins[players[g_localplayers[1]].skin].prefcolor; } if (splitscreen > 1) { - SetPlayerSkin(displayplayers[localdisplayplayers[2]], forcecharskin); - if ((unsigned)cv_playercolor3.value != skins[players[displayplayers[localdisplayplayers[2]]].skin].prefcolor && !modeattacking) + SetPlayerSkin(g_localplayers[2], forcecharskin); + if ((unsigned)cv_playercolor3.value != skins[players[g_localplayers[2]].skin].prefcolor && !modeattacking) { - CV_StealthSetValue(&cv_playercolor3, skins[players[displayplayers[localdisplayplayers[2]]].skin].prefcolor); - players[displayplayers[localdisplayplayers[2]]].skincolor = skins[players[displayplayers[localdisplayplayers[2]]].skin].prefcolor; + CV_StealthSetValue(&cv_playercolor3, skins[players[g_localplayers[2]].skin].prefcolor); + players[g_localplayers[2]].skincolor = skins[players[g_localplayers[2]].skin].prefcolor; } if (splitscreen > 2) { - SetPlayerSkin(displayplayers[localdisplayplayers[3]], forcecharskin); - if ((unsigned)cv_playercolor4.value != skins[players[displayplayers[localdisplayplayers[3]]].skin].prefcolor && !modeattacking) + SetPlayerSkin(g_localplayers[3], forcecharskin); + if ((unsigned)cv_playercolor4.value != skins[players[g_localplayers[3]].skin].prefcolor && !modeattacking) { - CV_StealthSetValue(&cv_playercolor4, skins[players[displayplayers[localdisplayplayers[3]]].skin].prefcolor); - players[displayplayers[localdisplayplayers[3]]].skincolor = skins[players[displayplayers[localdisplayplayers[3]]].skin].prefcolor; + CV_StealthSetValue(&cv_playercolor4, skins[players[g_localplayers[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) 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) diff --git a/src/p_user.c b/src/p_user.c index 6a660f20f..193d597b5 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -7347,17 +7347,17 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall focusangle = localangle[0]; focusaiming = localaiming[0]; } - else if (player == &players[displayplayers[localdisplayplayers[1]]]) + else if (player == &players[g_localplayers[1]]) { focusangle = localangle[1]; focusaiming = localaiming[1]; } - else if (player == &players[displayplayers[localdisplayplayers[2]]]) + else if (player == &players[g_localplayers[2]]) { focusangle = localangle[2]; focusaiming = localaiming[2]; } - else if (player == &players[displayplayers[localdisplayplayers[3]]]) + else if (player == &players[g_localplayers[3]]) { focusangle = localangle[3]; focusaiming = localaiming[3]; @@ -7893,8 +7893,8 @@ boolean P_SpectatorJoinGame(player_t *player) player->playerstate = PST_REBORN; //Reset away view - if (P_IsLocalPlayer(player) && displayplayers[localdisplayplayers[0]] != consoleplayer) - displayplayers[localdisplayplayers[0]] = consoleplayer; + if (P_IsLocalPlayer(player) && g_localplayers[0] != consoleplayer) + g_localplayers[0] = consoleplayer; HU_AddChatText(va(M_GetText("\x82*%s entered the game."), player_names[player-players]), false); return true; // no more player->mo, cannot continue. diff --git a/src/st_stuff.c b/src/st_stuff.c index 280984ca7..02c4fe445 100644 --- a/src/st_stuff.c +++ b/src/st_stuff.c @@ -2089,7 +2089,7 @@ void ST_Drawer(void) UINT8 i; #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) V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT/2 + 15, V_HUDTRANSHALF, player_names[seenplayer-players]); diff --git a/src/y_inter.c b/src/y_inter.c index e27289b87..85bfcad06 100644 --- a/src/y_inter.c +++ b/src/y_inter.c @@ -1263,19 +1263,19 @@ void Y_VoteDrawer(void) { case 1: thiscurs = cursor2; - p = displayplayers[localdisplayplayers[1]]; + p = g_localplayers[1]; break; case 2: thiscurs = cursor3; - p = displayplayers[localdisplayplayers[2]]; + p = g_localplayers[2]; break; case 3: thiscurs = cursor4; - p = displayplayers[localdisplayplayers[3]]; + p = g_localplayers[3]; break; default: thiscurs = cursor1; - p = displayplayers[localdisplayplayers[0]]; + p = g_localplayers[0]; break; } @@ -1563,13 +1563,13 @@ void Y_VoteTicker(void) switch (i) { case 1: - p = displayplayers[localdisplayplayers[1]]; + p = g_localplayers[1]; break; case 2: - p = displayplayers[localdisplayplayers[2]]; + p = g_localplayers[2]; break; case 3: - p = displayplayers[localdisplayplayers[3]]; + p = g_localplayers[3]; break; default: p = consoleplayer;