From f164320c8817ae96c48ba149a2b01368c5cff49d Mon Sep 17 00:00:00 2001 From: James R Date: Thu, 20 Feb 2020 21:46:55 -0800 Subject: [PATCH] Make the order of displayplayers irrelevant and split splitscreen into splitscreen and r_splitscreen --- src/d_clisrv.c | 8 ++- src/d_main.c | 7 +- src/d_netcmd.c | 140 +++++++++++++++++++-------------------- src/doomstat.h | 3 + src/g_game.c | 69 +++++++++---------- src/hu_stuff.c | 26 ++++---- src/k_kart.c | 154 +++++++++++++++++++++---------------------- src/lua_consolelib.c | 2 +- src/lua_hudlib.c | 16 ++--- src/m_menu.c | 32 ++++----- src/m_misc.c | 10 +-- src/p_enemy.c | 2 +- src/p_floor.c | 16 ++--- src/p_inter.c | 12 ++-- src/p_map.c | 4 +- src/p_mobj.c | 50 +++++++------- src/p_setup.c | 30 ++++----- src/p_spec.c | 2 +- src/p_telept.c | 12 ++-- src/p_tick.c | 6 +- src/p_user.c | 30 ++++----- src/r_bsp.c | 4 +- src/r_draw.c | 2 +- src/r_main.c | 38 ++++++----- src/r_plane.c | 8 +-- src/r_sky.c | 2 +- src/r_things.c | 12 ++-- src/s_sound.c | 50 +++++++------- src/st_stuff.c | 22 +++---- src/v_video.c | 6 +- src/y_inter.c | 16 ++--- 31 files changed, 404 insertions(+), 387 deletions(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 1dacabd9f..a53a61cf0 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -2718,8 +2718,8 @@ void CL_RemovePlayer(INT32 playernum, INT32 reason) RemoveAdminPlayer(playernum); // don't stay admin after you're gone } - if (playernum == displayplayers[0] && !demo.playback) - displayplayers[0] = consoleplayer; // don't look through someone's view who isn't there + if (playernum == displayplayers[localdisplayplayers[0]] && !demo.playback) + displayplayers[localdisplayplayers[0]] = consoleplayer; // don't look through someone's view who isn't there #ifdef HAVE_BLUA LUA_InvalidatePlayer(&players[playernum]); @@ -3503,7 +3503,10 @@ static void Got_AddPlayer(UINT8 **p, INT32 playernum) { consoleplayer = newplayernum; for (i = 0; i < MAXSPLITSCREENPLAYERS; i++) + { displayplayers[i] = newplayernum; + localdisplayplayers[i] = i; + } DEBFILE("spawning me\n"); } @@ -3705,6 +3708,7 @@ 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 dee752107..e0ba654ad 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -416,7 +416,7 @@ static void D_Display(void) // draw the view directly if (cv_renderview.value && !automapactive) { - for (i = 0; i <= splitscreen; i++) + for (i = 0; i <= r_splitscreen; i++) { if (players[displayplayers[i]].mo || players[displayplayers[i]].playerstate == PST_DEAD) { @@ -443,7 +443,7 @@ static void D_Display(void) switch (i) { case 1: - if (splitscreen > 1) + if (r_splitscreen > 1) { viewwindowx = viewwidth; viewwindowy = 0; @@ -482,7 +482,7 @@ static void D_Display(void) if (rendermode == render_soft) { - for (i = 0; i <= splitscreen; i++) + for (i = 0; i <= r_splitscreen; i++) { if (postimgtype[i]) V_DoPostProcessor(i, postimgtype[i], postimgparam[i]); @@ -780,6 +780,7 @@ void D_StartTitle(void) gameaction = ga_nothing; memset(displayplayers, 0, sizeof(displayplayers)); + memset(localdisplayplayers, 0, sizeof localdisplayplayers); consoleplayer = 0; //demosequence = -1; gametype = GT_RACE; // SRB2kart diff --git a/src/d_netcmd.c b/src/d_netcmd.c index 70dff2fcf..334509389 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -1180,11 +1180,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[1] || (!netgame && playernum == 1)) + else if (playernum == displayplayers[localdisplayplayers[1]] || (!netgame && playernum == 1)) CV_StealthSet(&cv_playername2, tmpname); - else if (playernum == displayplayers[2] || (!netgame && playernum == 2)) + else if (playernum == displayplayers[localdisplayplayers[2]] || (!netgame && playernum == 2)) CV_StealthSet(&cv_playername3, tmpname); - else if (playernum == displayplayers[3] || (!netgame && playernum == 3)) + else if (playernum == displayplayers[localdisplayplayers[3]] || (!netgame && playernum == 3)) CV_StealthSet(&cv_playername4, tmpname); else I_Assert(((void)"CleanupPlayerName used on non-local player", 0)); @@ -1292,11 +1292,11 @@ static void ForceAllSkins(INT32 forcedskin) { if (i == consoleplayer) CV_StealthSet(&cv_skin, skins[forcedskin].name); - else if (i == displayplayers[1]) + else if (i == displayplayers[localdisplayplayers[1]]) CV_StealthSet(&cv_skin2, skins[forcedskin].name); - else if (i == displayplayers[2]) + else if (i == displayplayers[localdisplayplayers[2]]) CV_StealthSet(&cv_skin3, skins[forcedskin].name); - else if (i == displayplayers[3]) + else if (i == displayplayers[localdisplayplayers[3]]) CV_StealthSet(&cv_skin4, skins[forcedskin].name); } } @@ -1431,8 +1431,8 @@ static void SendNameAndColor2(void) if (splitscreen < 1 && !botingame) return; // can happen if skin2/color2/name2 changed - if (displayplayers[1] != consoleplayer) - secondplaya = displayplayers[1]; + if (displayplayers[localdisplayplayers[1]] != consoleplayer) + secondplaya = displayplayers[localdisplayplayers[1]]; else if (!netgame) // HACK secondplaya = 1; @@ -1520,14 +1520,14 @@ static void SendNameAndColor2(void) snac2pending++; // Don't change name if muted - if (cv_mute.value && !(server || IsPlayerAdmin(displayplayers[1]))) - CV_StealthSet(&cv_playername2, player_names[displayplayers[1]]); + if (cv_mute.value && !(server || IsPlayerAdmin(displayplayers[localdisplayplayers[1]]))) + CV_StealthSet(&cv_playername2, player_names[displayplayers[localdisplayplayers[1]]]); else // Cleanup name if changing it - CleanupPlayerName(displayplayers[1], cv_playername2.zstring); + CleanupPlayerName(displayplayers[localdisplayplayers[1]], cv_playername2.zstring); // Don't change skin if the server doesn't want you to. - if (!CanChangeSkin(displayplayers[1])) - CV_StealthSet(&cv_skin2, skins[players[displayplayers[1]].skin].name); + if (!CanChangeSkin(displayplayers[localdisplayplayers[1]])) + CV_StealthSet(&cv_skin2, skins[players[displayplayers[localdisplayplayers[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) @@ -1554,8 +1554,8 @@ static void SendNameAndColor3(void) if (splitscreen < 2) return; // can happen if skin3/color3/name3 changed - if (displayplayers[2] != consoleplayer) - thirdplaya = displayplayers[2]; + if (displayplayers[localdisplayplayers[2]] != consoleplayer) + thirdplaya = displayplayers[localdisplayplayers[2]]; else if (!netgame) // HACK thirdplaya = 2; @@ -1635,14 +1635,14 @@ static void SendNameAndColor3(void) snac3pending++; // Don't change name if muted - if (cv_mute.value && !(server || IsPlayerAdmin(displayplayers[2]))) - CV_StealthSet(&cv_playername3, player_names[displayplayers[2]]); + if (cv_mute.value && !(server || IsPlayerAdmin(displayplayers[localdisplayplayers[2]]))) + CV_StealthSet(&cv_playername3, player_names[displayplayers[localdisplayplayers[2]]]); else // Cleanup name if changing it - CleanupPlayerName(displayplayers[2], cv_playername3.zstring); + CleanupPlayerName(displayplayers[localdisplayplayers[2]], cv_playername3.zstring); // Don't change skin if the server doesn't want you to. - if (!CanChangeSkin(displayplayers[2])) - CV_StealthSet(&cv_skin3, skins[players[displayplayers[2]].skin].name); + if (!CanChangeSkin(displayplayers[localdisplayplayers[2]])) + CV_StealthSet(&cv_skin3, skins[players[displayplayers[localdisplayplayers[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) @@ -1669,8 +1669,8 @@ static void SendNameAndColor4(void) if (splitscreen < 3) return; // can happen if skin4/color4/name4 changed - if (displayplayers[3] != consoleplayer) - fourthplaya = displayplayers[3]; + if (displayplayers[localdisplayplayers[3]] != consoleplayer) + fourthplaya = displayplayers[localdisplayplayers[3]]; else if (!netgame) // HACK fourthplaya = 3; @@ -1758,14 +1758,14 @@ static void SendNameAndColor4(void) snac4pending++; // Don't change name if muted - if (cv_mute.value && !(server || IsPlayerAdmin(displayplayers[3]))) - CV_StealthSet(&cv_playername4, player_names[displayplayers[3]]); + if (cv_mute.value && !(server || IsPlayerAdmin(displayplayers[localdisplayplayers[3]]))) + CV_StealthSet(&cv_playername4, player_names[displayplayers[localdisplayplayers[3]]]); else // Cleanup name if changing it - CleanupPlayerName(displayplayers[3], cv_playername4.zstring); + CleanupPlayerName(displayplayers[localdisplayplayers[3]], cv_playername4.zstring); // Don't change skin if the server doesn't want you to. - if (!CanChangeSkin(displayplayers[3])) - CV_StealthSet(&cv_skin4, skins[players[displayplayers[3]].skin].name); + if (!CanChangeSkin(displayplayers[localdisplayplayers[3]])) + CV_StealthSet(&cv_skin4, skins[players[displayplayers[localdisplayplayers[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) @@ -1796,11 +1796,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[1]) + else if (playernum == displayplayers[localdisplayplayers[1]]) snac2pending--; - else if (playernum == displayplayers[2]) + else if (playernum == displayplayers[localdisplayplayers[2]]) snac3pending--; - else if (playernum == displayplayers[3]) + else if (playernum == displayplayers[localdisplayplayers[3]]) snac4pending--; #ifdef PARANOIA @@ -1823,8 +1823,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[1]] - && p != &players[displayplayers[2]] && p != &players[displayplayers[3]])) + if (server && (p != &players[consoleplayer] && p != &players[displayplayers[localdisplayplayers[1]]] + && p != &players[displayplayers[localdisplayplayers[2]]] && p != &players[displayplayers[localdisplayplayers[3]]])) { boolean kick = false; @@ -1861,11 +1861,11 @@ static void Got_NameAndColor(UINT8 **cp, INT32 playernum) if (playernum == consoleplayer) CV_StealthSet(&cv_skin, skins[forcedskin].name); - else if (playernum == displayplayers[1]) + else if (playernum == displayplayers[localdisplayplayers[1]]) CV_StealthSet(&cv_skin2, skins[forcedskin].name); - else if (playernum == displayplayers[2]) + else if (playernum == displayplayers[localdisplayplayers[2]]) CV_StealthSet(&cv_skin3, skins[forcedskin].name); - else if (playernum == displayplayers[3]) + else if (playernum == displayplayers[localdisplayplayers[3]]) CV_StealthSet(&cv_skin4, skins[forcedskin].name); } else @@ -1988,7 +1988,7 @@ void D_SendPlayerConfig(void) // Only works for displayplayer, sorry! static void Command_ResetCamera_f(void) { - P_ResetCamera(&players[displayplayers[0]], &camera[0]); + P_ResetCamera(&players[displayplayers[localdisplayplayers[0]]], &camera[0]); } /* Consider replacing nametonum with this */ @@ -2144,7 +2144,7 @@ static void Command_View_f(void) } else/* print current view */ { - if (splitscreen < viewnum-1)/* We can't see those guys! */ + if (r_splitscreen < viewnum-1)/* We can't see those guys! */ return; PRINTVIEWPOINT ("Currently ",) } @@ -2169,7 +2169,7 @@ static void Command_SetViews_f(void) return; } - splits = splitscreen+1; + splits = r_splitscreen+1; newsplits = atoi(COM_Argv(1)); newsplits = min(max(newsplits, 1), 4); @@ -2177,7 +2177,7 @@ static void Command_SetViews_f(void) G_AdjustView(newsplits, 0, true); else { - splitscreen = newsplits-1; + r_splitscreen = newsplits-1; R_ExecuteSetViewSize(); } } @@ -2426,7 +2426,7 @@ void D_ModifyClientVote(SINT8 voted, UINT8 splitplayer) UINT8 player = consoleplayer; if (splitplayer > 0) - player = displayplayers[splitplayer]; + player = displayplayers[localdisplayplayers[splitplayer]]; WRITESINT8(p, voted); WRITEUINT8(p, player); @@ -3078,11 +3078,11 @@ static void Command_Teamchange2_f(void) return; } - if (players[displayplayers[1]].spectator) - error = !(NetPacket.packet.newteam || (players[displayplayers[1]].pflags & PF_WANTSTOJOIN)); + if (players[displayplayers[localdisplayplayers[1]]].spectator) + error = !(NetPacket.packet.newteam || (players[displayplayers[localdisplayplayers[1]]].pflags & PF_WANTSTOJOIN)); else if (G_GametypeHasTeams()) - error = (NetPacket.packet.newteam == (unsigned)players[displayplayers[1]].ctfteam); - else if (G_GametypeHasSpectators() && !players[displayplayers[1]].spectator) + error = (NetPacket.packet.newteam == (unsigned)players[displayplayers[localdisplayplayers[1]]].ctfteam); + else if (G_GametypeHasSpectators() && !players[displayplayers[localdisplayplayers[1]]].spectator) error = (NetPacket.packet.newteam == 3); #ifdef PARANOIA else @@ -3169,11 +3169,11 @@ static void Command_Teamchange3_f(void) return; } - if (players[displayplayers[2]].spectator) - error = !(NetPacket.packet.newteam || (players[displayplayers[2]].pflags & PF_WANTSTOJOIN)); + if (players[displayplayers[localdisplayplayers[2]]].spectator) + error = !(NetPacket.packet.newteam || (players[displayplayers[localdisplayplayers[2]]].pflags & PF_WANTSTOJOIN)); else if (G_GametypeHasTeams()) - error = (NetPacket.packet.newteam == (unsigned)players[displayplayers[2]].ctfteam); - else if (G_GametypeHasSpectators() && !players[displayplayers[2]].spectator) + error = (NetPacket.packet.newteam == (unsigned)players[displayplayers[localdisplayplayers[2]]].ctfteam); + else if (G_GametypeHasSpectators() && !players[displayplayers[localdisplayplayers[2]]].spectator) error = (NetPacket.packet.newteam == 3); #ifdef PARANOIA else @@ -3260,11 +3260,11 @@ static void Command_Teamchange4_f(void) return; } - if (players[displayplayers[3]].spectator) - error = !(NetPacket.packet.newteam || (players[displayplayers[3]].pflags & PF_WANTSTOJOIN)); + if (players[displayplayers[localdisplayplayers[3]]].spectator) + error = !(NetPacket.packet.newteam || (players[displayplayers[localdisplayplayers[3]]].pflags & PF_WANTSTOJOIN)); else if (G_GametypeHasTeams()) - error = (NetPacket.packet.newteam == (unsigned)players[displayplayers[3]].ctfteam); - else if (G_GametypeHasSpectators() && !players[displayplayers[3]].spectator) + error = (NetPacket.packet.newteam == (unsigned)players[displayplayers[localdisplayplayers[3]]].ctfteam); + else if (G_GametypeHasSpectators() && !players[displayplayers[localdisplayplayers[3]]].spectator) error = (NetPacket.packet.newteam == 3); #ifdef PARANOIA else @@ -3661,8 +3661,8 @@ static void Got_Teamchange(UINT8 **cp, INT32 playernum) HU_AddChatText(va("\x82*%s became a spectator.", player_names[playernum]), false); // "entered the game" text was moved to P_SpectatorJoinGame //reset view if you are changed, or viewing someone who was changed. - if (playernum == consoleplayer || displayplayers[0] == playernum) - displayplayers[0] = consoleplayer; + if (playernum == consoleplayer || displayplayers[localdisplayplayers[0]] == playernum) + displayplayers[localdisplayplayers[0]] = consoleplayer; if (G_GametypeHasTeams()) { @@ -5299,7 +5299,7 @@ static void Got_PickVotecmd(UINT8 **cp, INT32 playernum) */ static void Command_Displayplayer_f(void) { - CONS_Printf(M_GetText("Displayplayer is %d\n"), displayplayers[0]); + CONS_Printf(M_GetText("Displayplayer is %d\n"), displayplayers[localdisplayplayers[0]]); } /** Quits a game and returns to the title screen. @@ -5494,7 +5494,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[1]]); + CV_StealthSet(&cv_playername2, player_names[displayplayers[localdisplayplayers[1]]]); } else SendNameAndColor2(); @@ -5505,7 +5505,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[2]]); + CV_StealthSet(&cv_playername3, player_names[displayplayers[localdisplayplayers[2]]]); } else SendNameAndColor3(); @@ -5516,7 +5516,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[3]]); + CV_StealthSet(&cv_playername4, player_names[displayplayers[localdisplayplayers[3]]]); } else SendNameAndColor4(); @@ -5557,12 +5557,12 @@ static void Skin2_OnChange(void) if (!Playing() || !splitscreen) return; // do whatever you want - if (CanChangeSkin(displayplayers[1]) && !P_PlayerMoving(displayplayers[1])) + if (CanChangeSkin(displayplayers[localdisplayplayers[1]]) && !P_PlayerMoving(displayplayers[localdisplayplayers[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[1]].skin].name); + CV_StealthSet(&cv_skin2, skins[players[displayplayers[localdisplayplayers[1]]].skin].name); } } @@ -5571,12 +5571,12 @@ static void Skin3_OnChange(void) if (!Playing() || splitscreen < 2) return; // do whatever you want - if (CanChangeSkin(displayplayers[2]) && !P_PlayerMoving(displayplayers[2])) + if (CanChangeSkin(displayplayers[localdisplayplayers[2]]) && !P_PlayerMoving(displayplayers[localdisplayplayers[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[2]].skin].name); + CV_StealthSet(&cv_skin3, skins[players[displayplayers[localdisplayplayers[2]]].skin].name); } } @@ -5585,12 +5585,12 @@ static void Skin4_OnChange(void) if (!Playing() || splitscreen < 3) return; // do whatever you want - if (CanChangeSkin(displayplayers[3]) && !P_PlayerMoving(displayplayers[3])) + if (CanChangeSkin(displayplayers[localdisplayplayers[3]]) && !P_PlayerMoving(displayplayers[localdisplayplayers[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[3]].skin].name); + CV_StealthSet(&cv_skin4, skins[players[displayplayers[localdisplayplayers[3]]].skin].name); } } @@ -5631,7 +5631,7 @@ static void Color2_OnChange(void) if (!Playing() || !splitscreen) return; // do whatever you want - if (!P_PlayerMoving(displayplayers[1])) + if (!P_PlayerMoving(displayplayers[localdisplayplayers[1]])) { // Color change menu scrolling fix is no longer necessary SendNameAndColor2(); @@ -5639,7 +5639,7 @@ static void Color2_OnChange(void) else { CV_StealthSetValue(&cv_playercolor2, - players[displayplayers[1]].skincolor); + players[displayplayers[localdisplayplayers[1]]].skincolor); } } @@ -5648,7 +5648,7 @@ static void Color3_OnChange(void) if (!Playing() || splitscreen < 2) return; // do whatever you want - if (!P_PlayerMoving(displayplayers[2])) + if (!P_PlayerMoving(displayplayers[localdisplayplayers[2]])) { // Color change menu scrolling fix is no longer necessary SendNameAndColor3(); @@ -5656,7 +5656,7 @@ static void Color3_OnChange(void) else { CV_StealthSetValue(&cv_playercolor3, - players[displayplayers[2]].skincolor); + players[displayplayers[localdisplayplayers[2]]].skincolor); } } @@ -5665,7 +5665,7 @@ static void Color4_OnChange(void) if (!Playing() || splitscreen < 3) return; // do whatever you want - if (!P_PlayerMoving(displayplayers[3])) + if (!P_PlayerMoving(displayplayers[localdisplayplayers[3]])) { // Color change menu scrolling fix is no longer necessary SendNameAndColor4(); @@ -5673,7 +5673,7 @@ static void Color4_OnChange(void) else { CV_StealthSetValue(&cv_playercolor4, - players[displayplayers[3]].skincolor); + players[displayplayers[localdisplayplayers[3]]].skincolor); } } diff --git a/src/doomstat.h b/src/doomstat.h index 59e2bd5c4..1d43b4986 100644 --- a/src/doomstat.h +++ b/src/doomstat.h @@ -82,6 +82,7 @@ extern INT16 gametype; #define MAXSPLITSCREENPLAYERS 4 // Max number of players on a single computer extern UINT8 splitscreen; +extern int r_splitscreen; extern boolean circuitmap; // Does this level have 'circuit mode'? extern boolean fromlevelselect; @@ -122,6 +123,8 @@ extern boolean gamedataloaded; // Player taking events, and displaying. extern INT32 consoleplayer; extern INT32 displayplayers[MAXSPLITSCREENPLAYERS]; +/* displayplayers[localdisplayplayers[0]] = consoleplayer */ +extern INT32 localdisplayplayers[MAXSPLITSCREENPLAYERS]; // Maps of special importance extern INT16 spstage_start; diff --git a/src/g_game.c b/src/g_game.c index d4d48f7c2..871eafaab 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -115,6 +115,7 @@ player_t players[MAXPLAYERS]; INT32 consoleplayer; // player taking events and displaying INT32 displayplayers[MAXSPLITSCREENPLAYERS]; // view being displayed +INT32 localdisplayplayers[MAXSPLITSCREENPLAYERS]; tic_t gametic; tic_t levelstarttic; // gametic at level start @@ -1256,7 +1257,7 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer) if (ssplayer == 1) player = &players[consoleplayer]; else - player = &players[displayplayers[ssplayer-1]]; + player = &players[displayplayers[localdisplayplayers[ssplayer-1]]]; if (ssplayer == 2) thiscam = (player->bot == 2 ? &camera[0] : &camera[ssplayer-1]); @@ -1595,8 +1596,8 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer) //Reset away view if a command is given. if ((cmd->forwardmove || cmd->sidemove || cmd->buttons) - && displayplayers[0] != consoleplayer && ssplayer == 1) - displayplayers[0] = consoleplayer; + && displayplayers[localdisplayplayers[0]] != consoleplayer && ssplayer == 1) + displayplayers[localdisplayplayers[0]] = consoleplayer; } @@ -1748,12 +1749,12 @@ void G_DoLoadLevel(boolean resetplayer) if (!resetplayer) P_FindEmerald(); - displayplayers[0] = consoleplayer; // view the guy you are playing + displayplayers[localdisplayplayers[0]] = consoleplayer; // view the guy you are playing for (i = 0; i < MAXSPLITSCREENPLAYERS; i++) { - if (i > 0 && !(i == 1 && botingame) && splitscreen < i) - displayplayers[i] = consoleplayer; + if (i > 0 && !(i == 1 && botingame) && r_splitscreen < i) + displayplayers[localdisplayplayers[i]] = consoleplayer; } gameaction = ga_nothing; @@ -1761,10 +1762,10 @@ void G_DoLoadLevel(boolean resetplayer) Z_CheckHeap(-2); #endif - for (i = 0; i <= splitscreen; i++) + for (i = 0; i <= r_splitscreen; i++) { if (camera[i].chase) - P_ResetCamera(&players[displayplayers[i]], &camera[i]); + P_ResetCamera(&players[displayplayers[localdisplayplayers[i]]], &camera[i]); } // clear cmd building stuff @@ -1874,8 +1875,8 @@ boolean G_Responder(event_t *ev) if (gamestate == GS_LEVEL && ev->type == ev_keydown && (ev->data1 == KEY_F12 || ev->data1 == gamecontrol[gc_viewpoint][0] || ev->data1 == gamecontrol[gc_viewpoint][1])) { - if (!demo.playback && (splitscreen || !netgame)) - displayplayers[0] = consoleplayer; + if (!demo.playback && (r_splitscreen || !netgame)) + displayplayers[localdisplayplayers[0]] = consoleplayer; else { G_AdjustView(1, 1, true); @@ -2139,7 +2140,7 @@ boolean G_CanView(INT32 playernum, UINT8 viewnum, boolean onlyactive) if (!(onlyactive ? G_CouldView(playernum) : (playeringame[playernum] && !players[playernum].spectator))) return false; - splits = splitscreen+1; + splits = r_splitscreen+1; if (viewnum > splits) viewnum = splits; @@ -2210,7 +2211,7 @@ void G_ResetView(UINT8 viewnum, INT32 playernum, boolean onlyactive) INT32 olddisplayplayer; INT32 playersviewable; - splits = splitscreen+1; + splits = r_splitscreen+1; /* Promote splits */ if (viewnum > splits) @@ -2221,7 +2222,7 @@ void G_ResetView(UINT8 viewnum, INT32 playernum, boolean onlyactive) if (viewnum > playersviewable) viewnum = playersviewable; - splitscreen = viewnum-1; + r_splitscreen = viewnum-1; /* Prepare extra views for G_FindView to pass. */ for (viewd = splits+1; viewd < viewnum; ++viewd) @@ -2294,14 +2295,14 @@ void G_ResetViews(void) INT32 playersviewable; - splits = splitscreen+1; + splits = r_splitscreen+1; playersviewable = G_CountPlayersPotentiallyViewable(false); /* Demote splits */ if (playersviewable < splits) { splits = playersviewable; - splitscreen = max(splits-1, 0); + r_splitscreen = max(splits-1, 0); R_ExecuteSetViewSize(); } @@ -2884,18 +2885,18 @@ void G_SpawnPlayer(INT32 playernum, boolean starpost) if (nummapthings) { if (playernum == consoleplayer - || (splitscreen && playernum == displayplayers[1]) - || (splitscreen > 1 && playernum == displayplayers[2]) - || (splitscreen > 2 && playernum == displayplayers[3])) + || (splitscreen && playernum == displayplayers[localdisplayplayers[1]]) + || (splitscreen > 1 && playernum == displayplayers[localdisplayplayers[2]]) + || (splitscreen > 2 && playernum == displayplayers[localdisplayplayers[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[1]) - || (splitscreen > 1 && playernum == displayplayers[2]) - || (splitscreen > 2 && playernum == displayplayers[3])) + || (splitscreen && playernum == displayplayers[localdisplayplayers[1]]) + || (splitscreen > 1 && playernum == displayplayers[localdisplayplayers[2]]) + || (splitscreen > 2 && playernum == displayplayers[localdisplayplayers[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. } @@ -2990,17 +2991,17 @@ mapthing_t *G_FindMatchStart(INT32 playernum) return deathmatchstarts[i]; } if (playernum == consoleplayer - || (splitscreen && playernum == displayplayers[1]) - || (splitscreen > 1 && playernum == displayplayers[2]) - || (splitscreen > 2 && playernum == displayplayers[3])) + || (splitscreen && playernum == displayplayers[localdisplayplayers[1]]) + || (splitscreen > 1 && playernum == displayplayers[localdisplayplayers[2]]) + || (splitscreen > 2 && playernum == displayplayers[localdisplayplayers[3]])) CONS_Alert(CONS_WARNING, M_GetText("Could not spawn at any Deathmatch starts!\n")); return NULL; } if (playernum == consoleplayer - || (splitscreen && playernum == displayplayers[1]) - || (splitscreen > 1 && playernum == displayplayers[2]) - || (splitscreen > 2 && playernum == displayplayers[3])) + || (splitscreen && playernum == displayplayers[localdisplayplayers[1]]) + || (splitscreen > 1 && playernum == displayplayers[localdisplayplayers[2]]) + || (splitscreen > 2 && playernum == displayplayers[localdisplayplayers[3]])) CONS_Alert(CONS_WARNING, M_GetText("No Deathmatch starts in this map!\n")); return NULL; } @@ -3088,17 +3089,17 @@ mapthing_t *G_FindRaceStart(INT32 playernum) //return playerstarts[0]; if (playernum == consoleplayer - || (splitscreen && playernum == displayplayers[1]) - || (splitscreen > 1 && playernum == displayplayers[2]) - || (splitscreen > 2 && playernum == displayplayers[3])) + || (splitscreen && playernum == displayplayers[localdisplayplayers[1]]) + || (splitscreen > 1 && playernum == displayplayers[localdisplayplayers[2]]) + || (splitscreen > 2 && playernum == displayplayers[localdisplayplayers[3]])) CONS_Alert(CONS_WARNING, M_GetText("Could not spawn at any Race starts!\n")); return NULL; } if (playernum == consoleplayer - || (splitscreen && playernum == displayplayers[1]) - || (splitscreen > 1 && playernum == displayplayers[2]) - || (splitscreen > 2 && playernum == displayplayers[3])) + || (splitscreen && playernum == displayplayers[localdisplayplayers[1]]) + || (splitscreen > 1 && playernum == displayplayers[localdisplayplayers[2]]) + || (splitscreen > 2 && playernum == displayplayers[localdisplayplayers[3]])) CONS_Alert(CONS_WARNING, M_GetText("No Race starts in this map!\n")); return NULL; } @@ -3712,7 +3713,7 @@ static void G_DoCompleted(void) } // play some generic music if there's no win/cool/lose music going on (for exitlevel commands) - if (G_RaceGametype() && ((multiplayer && demo.playback) || j == splitscreen+1) && (cv_inttime.value > 0)) + if (G_RaceGametype() && ((multiplayer && demo.playback) || j == r_splitscreen+1) && (cv_inttime.value > 0)) S_ChangeMusicInternal("racent", true); if (automapactive) diff --git a/src/hu_stuff.c b/src/hu_stuff.c index 1afa133b3..ad64552d8 100644 --- a/src/hu_stuff.c +++ b/src/hu_stuff.c @@ -1477,7 +1477,7 @@ static void HU_drawMiniChat(void) if (!chat_nummsg_min) return; // needless to say it's useless to do anything if we don't have anything to draw. - if (splitscreen > 1) + if (r_splitscreen > 1) boxw = max(64, boxw/2); for (; i>0; i--) @@ -1529,10 +1529,10 @@ static void HU_drawMiniChat(void) y = chaty - charheight*(msglines+1); #ifdef NETSPLITSCREEN - if (splitscreen) + if (r_splitscreen) { y -= BASEVIDHEIGHT/2; - if (splitscreen > 1) + if (r_splitscreen > 1) y += 16; } else @@ -1620,10 +1620,10 @@ static void HU_drawChatLog(INT32 offset) chat_scroll = chat_maxscroll; #ifdef NETSPLITSCREEN - if (splitscreen) + if (r_splitscreen) { boxh = max(6, boxh/2); - if (splitscreen > 1) + if (r_splitscreen > 1) boxw = max(64, boxw/2); } #endif @@ -1631,10 +1631,10 @@ static void HU_drawChatLog(INT32 offset) y = chaty - offset*charheight - (chat_scroll*charheight) - boxh*charheight - 12; #ifdef NETSPLITSCREEN - if (splitscreen) + if (r_splitscreen) { y -= BASEVIDHEIGHT/2; - if (splitscreen > 1) + if (r_splitscreen > 1) y += 16; } else @@ -1739,10 +1739,10 @@ static void HU_DrawChat(void) const char *mute = "Chat has been muted."; #ifdef NETSPLITSCREEN - if (splitscreen) + if (r_splitscreen) { y -= BASEVIDHEIGHT/2; - if (splitscreen > 1) + if (r_splitscreen > 1) { y += 16; boxw = max(64, boxw/2); @@ -1836,10 +1836,10 @@ static void HU_DrawChat(void) INT32 count = 0; INT32 p_dispy = chaty - charheight -1; #ifdef NETSPLITSCREEN - if (splitscreen) + if (r_splitscreen) { p_dispy -= BASEVIDHEIGHT/2; - if (splitscreen > 1) + if (r_splitscreen > 1) p_dispy += 16; } else @@ -2250,7 +2250,7 @@ void HU_DrawSongCredits(void) { char *str; INT32 len, destx; - INT32 y = (splitscreen ? (BASEVIDHEIGHT/2)-4 : 32); + INT32 y = (r_splitscreen ? (BASEVIDHEIGHT/2)-4 : 32); INT32 bgt; if (!cursongcredit.def) // No def @@ -3022,7 +3022,7 @@ static void HU_DrawRankings(void) // When you play, you quickly see your score because your name is displayed in white. // When playing back a demo, you quickly see who's the view. - if (!splitscreen) + if (!r_splitscreen) whiteplayer = demo.playback ? displayplayers[0] : consoleplayer; scorelines = 0; diff --git a/src/k_kart.c b/src/k_kart.c index 230662d2a..ebce1458e 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -1058,7 +1058,7 @@ static void K_KartItemRoulette(player_t *player, ticcmd_t *cmd) if ((player->kartstuff[k_itemroulette] % 3) == 1 && P_IsDisplayPlayer(player)) { #define PLAYROULETTESND S_StartSound(NULL, sfx_itrol1 + ((player->kartstuff[k_itemroulette] / 3) % 8)) - for (i = 0; i <= splitscreen; i++) + for (i = 0; i <= r_splitscreen; i++) { if (player == &players[displayplayers[i]] && players[displayplayers[i]].kartstuff[k_itemroulette]) PLAYROULETTESND; @@ -3925,7 +3925,7 @@ static void K_DoHyudoroSteal(player_t *player) players[stealplayer].kartstuff[k_itemamount] = 0; players[stealplayer].kartstuff[k_itemheld] = 0; - if (P_IsDisplayPlayer(&players[stealplayer]) && !splitscreen) + if (P_IsDisplayPlayer(&players[stealplayer]) && !r_splitscreen) S_StartSound(NULL, sfx_s3k92); } } @@ -6500,7 +6500,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground) if (player->kartstuff[k_hyudorotimer] > 0) { - if (splitscreen) + if (r_splitscreen) { if (leveltime & 1) player->mo->flags2 |= MF2_DONTDRAW; @@ -6511,9 +6511,9 @@ void K_MoveKartPlayer(player_t *player, boolean onground) { if (player == &players[displayplayers[1]]) player->mo->eflags |= MFE_DRAWONLYFORP2; - else if (player == &players[displayplayers[2]] && splitscreen > 1) + else if (player == &players[displayplayers[2]] && r_splitscreen > 1) player->mo->eflags |= MFE_DRAWONLYFORP3; - else if (player == &players[displayplayers[3]] && splitscreen > 2) + else if (player == &players[displayplayers[3]] && r_splitscreen > 2) player->mo->eflags |= MFE_DRAWONLYFORP4; else if (player == &players[displayplayers[0]]) player->mo->eflags |= MFE_DRAWONLYFORP1; @@ -6635,7 +6635,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground) } // Play the starting countdown sounds - if (player == &players[displayplayers[0]]) // Don't play louder in splitscreen + if (player == &players[displayplayers[localdisplayplayers[0]]]) // Don't play louder in splitscreen { if ((leveltime == starttime-(3*TICRATE)) || (leveltime == starttime-(2*TICRATE)) || (leveltime == starttime-TICRATE)) S_StartSound(NULL, sfx_s3ka7); @@ -7521,7 +7521,7 @@ static void K_initKartHUD(void) WANT_X = BASEVIDWIDTH - 55; // 270 WANT_Y = BASEVIDHEIGHT- 71; // 176 - if (splitscreen) // Splitscreen + if (r_splitscreen) // Splitscreen { ITEM_X = 5; ITEM_Y = 3; @@ -7534,7 +7534,7 @@ static void K_initKartHUD(void) MINI_Y = (BASEVIDHEIGHT/2); - if (splitscreen > 1) // 3P/4P Small Splitscreen + if (r_splitscreen > 1) // 3P/4P Small Splitscreen { // 1P (top left) ITEM_X = -9; @@ -7563,7 +7563,7 @@ static void K_initKartHUD(void) MINI_X = (3*BASEVIDWIDTH/4); MINI_Y = (3*BASEVIDHEIGHT/4); - if (splitscreen > 2) // 4P-only + if (r_splitscreen > 2) // 4P-only { MINI_X = (BASEVIDWIDTH/2); MINI_Y = (BASEVIDHEIGHT/2); @@ -7583,20 +7583,20 @@ INT32 K_calcSplitFlags(INT32 snapflags) { INT32 splitflags = 0; - if (splitscreen == 0) + if (r_splitscreen == 0) return snapflags; if (stplyr != &players[displayplayers[0]]) { - if (splitscreen == 1 && stplyr == &players[displayplayers[1]]) + if (r_splitscreen == 1 && stplyr == &players[displayplayers[1]]) { splitflags |= V_SPLITSCREEN; } - else if (splitscreen > 1) + else if (r_splitscreen > 1) { - if (stplyr == &players[displayplayers[2]] || (splitscreen == 3 && stplyr == &players[displayplayers[3]])) + if (stplyr == &players[displayplayers[2]] || (r_splitscreen == 3 && stplyr == &players[displayplayers[3]])) splitflags |= V_SPLITSCREEN; - if (stplyr == &players[displayplayers[1]] || (splitscreen == 3 && stplyr == &players[displayplayers[3]])) + if (stplyr == &players[displayplayers[1]] || (r_splitscreen == 3 && stplyr == &players[displayplayers[3]])) splitflags |= V_HORZSCREEN; } } @@ -7606,7 +7606,7 @@ INT32 K_calcSplitFlags(INT32 snapflags) else snapflags &= ~V_SNAPTOBOTTOM; - if (splitscreen > 1) + if (r_splitscreen > 1) { if (splitflags & V_HORZSCREEN) snapflags &= ~V_SNAPTOLEFT; @@ -7624,7 +7624,7 @@ static void K_drawKartItem(void) // Why write V_DrawScaledPatch calls over and over when they're all the same? // Set to 'no item' just in case. - const UINT8 offset = ((splitscreen > 1) ? 1 : 0); + const UINT8 offset = ((r_splitscreen > 1) ? 1 : 0); patch_t *localpatch = kp_nodraw; patch_t *localbg = ((offset) ? kp_itembg[2] : kp_itembg[0]); patch_t *localinv = ((offset) ? kp_invincibility[((leveltime % (6*3)) / 3) + 7] : kp_invincibility[(leveltime % (7*3)) / 3]); @@ -7633,7 +7633,7 @@ static void K_drawKartItem(void) const INT32 numberdisplaymin = ((!offset && stplyr->kartstuff[k_itemtype] == KITEM_ORBINAUT) ? 5 : 2); INT32 itembar = 0; INT32 maxl = 0; // itembar's normal highest value - const INT32 barlength = (splitscreen > 1 ? 12 : 26); + const INT32 barlength = (r_splitscreen > 1 ? 12 : 26); UINT8 localcolor = SKINCOLOR_NONE; SINT8 colormode = TC_RAINBOW; UINT8 *colmap = NULL; @@ -7865,7 +7865,7 @@ static void K_drawKartItem(void) } // pain and suffering defined below - if (splitscreen < 2) // don't change shit for THIS splitscreen. + if (r_splitscreen < 2) // don't change shit for THIS splitscreen. { fx = ITEM_X; fy = ITEM_Y; @@ -8110,19 +8110,19 @@ static void K_DrawKartPositionNum(INT32 num) scale *= 2; overtake = true; // this is used for splitscreen stuff in conjunction with flipdraw. } - if (splitscreen) + if (r_splitscreen) scale /= 2; W = FixedMul(W<>FRACBITS; // pain and suffering defined below - if (!splitscreen) + if (!r_splitscreen) { fx = POSI_X; fy = BASEVIDHEIGHT - 8; fflags = V_SNAPTOBOTTOM|V_SNAPTORIGHT; } - else if (splitscreen == 1) // for this splitscreen, we'll use case by case because it's a bit different. + else if (r_splitscreen == 1) // for this splitscreen, we'll use case by case because it's a bit different. { fx = POSI_X; if (stplyr == &players[displayplayers[0]]) // for player 1: display this at the top right, above the minimap. @@ -8487,16 +8487,16 @@ static void K_drawKartLapsAndRings(void) { ringflip = V_FLIP; ringanim_realframe = RINGANIM_NUMFRAMES-stplyr->karthud[khud_ringframe]; - ringx += SHORT((splitscreen > 1) ? kp_smallring[ringanim_realframe]->width : kp_ring[ringanim_realframe]->width); + ringx += SHORT((r_splitscreen > 1) ? kp_smallring[ringanim_realframe]->width : kp_ring[ringanim_realframe]->width); } - if (splitscreen > 1) + if (r_splitscreen > 1) { INT32 fx = 0, fy = 0, fr = 0; INT32 flipflag = 0; // pain and suffering defined below - if (splitscreen < 2) // don't change shit for THIS splitscreen. + if (r_splitscreen < 2) // don't change shit for THIS splitscreen. { fx = LAPS_X; fy = LAPS_Y; @@ -8679,13 +8679,13 @@ static void K_drawKartBumpersOrKarma(void) UINT8 *colormap = R_GetTranslationColormap(TC_DEFAULT, stplyr->skincolor, GTC_CACHE); INT32 splitflags = K_calcSplitFlags(V_SNAPTOBOTTOM|V_SNAPTOLEFT); - if (splitscreen > 1) + if (r_splitscreen > 1) { INT32 fx = 0, fy = 0; INT32 flipflag = 0; // pain and suffering defined below - if (splitscreen < 2) // don't change shit for THIS splitscreen. + if (r_splitscreen < 2) // don't change shit for THIS splitscreen. { fx = LAPS_X; fy = LAPS_Y; @@ -8782,7 +8782,7 @@ static fixed_t K_FindCheckX(fixed_t px, fixed_t py, angle_t ang, fixed_t mx, fix if (encoremode) x = 320-x; - if (splitscreen > 1) + if (r_splitscreen > 1) x /= 2; return x; @@ -8808,17 +8808,17 @@ static void K_drawKartWanted(void) return; // set X/Y coords depending on splitscreen. - if (splitscreen < 3) // 1P and 2P use the same code. + if (r_splitscreen < 3) // 1P and 2P use the same code. { basex = WANT_X; basey = WANT_Y; - if (splitscreen == 2) + if (r_splitscreen == 2) { basey += 16; // slight adjust for 3P basex -= 6; } } - else if (splitscreen == 3) // 4P splitscreen... + else if (r_splitscreen == 3) // 4P splitscreen... { basex = BASEVIDWIDTH/2 - (SHORT(kp_wantedsplit->width)/2); // center on screen basey = BASEVIDHEIGHT - 55; @@ -8827,13 +8827,13 @@ static void K_drawKartWanted(void) if (battlewanted[0] != -1) colormap = R_GetTranslationColormap(0, players[battlewanted[0]].skincolor, GTC_CACHE); - V_DrawFixedPatch(basex< 1 ? kp_wantedsplit : kp_wanted), colormap); + V_DrawFixedPatch(basex< 1 ? kp_wantedsplit : kp_wanted), colormap); /*if (basey2) V_DrawFixedPatch(basex< 1 ? 13 : 8), y = basey+(splitscreen > 1 ? 16 : 21); + INT32 x = basex+(r_splitscreen > 1 ? 13 : 8), y = basey+(r_splitscreen > 1 ? 16 : 21); fixed_t scale = FRACUNIT/2; player_t *p = &players[battlewanted[i]]; @@ -8853,7 +8853,7 @@ static void K_drawKartWanted(void) if (players[battlewanted[i]].skincolor) { colormap = R_GetTranslationColormap(TC_RAINBOW, p->skincolor, GTC_CACHE); - V_DrawFixedPatch(x<skin] : facerankprefix[p->skin]), colormap); + V_DrawFixedPatch(x<skin] : facerankprefix[p->skin]), colormap); /*if (basey2) // again with 4p stuff V_DrawFixedPatch(x<skin] : facerankprefix[p->skin]), colormap);*/ } @@ -8990,7 +8990,7 @@ static void K_drawKartMinimap(void) patch_t *AutomapPic; INT32 i = 0; INT32 x, y; - INT32 minimaptrans, splitflags = (splitscreen == 3 ? 0 : V_SNAPTORIGHT); // flags should only be 0 when it's centered (4p split) + INT32 minimaptrans, splitflags = (r_splitscreen == 3 ? 0 : V_SNAPTORIGHT); // flags should only be 0 when it's centered (4p split) UINT8 skin = 0; UINT8 *colormap = NULL; SINT8 localplayers[4]; @@ -9035,7 +9035,7 @@ static void K_drawKartMinimap(void) else V_DrawScaledPatch(x, y, splitflags, AutomapPic); - if (!(splitscreen == 2)) + if (!(r_splitscreen == 2)) { splitflags &= ~minimaptrans; splitflags |= V_HUDTRANSHALF; @@ -9104,7 +9104,7 @@ static void K_drawKartMinimap(void) if (!players[i].mo || players[i].spectator) continue; - if (i != displayplayers[0] || splitscreen) + if (i != displayplayers[0] || r_splitscreen) { if (G_BattleGametype() && players[i].kartstuff[k_bumper] <= 0) continue; @@ -9194,7 +9194,7 @@ static void K_drawKartStartCountdown(void) pnum++; if ((leveltime % (2*5)) / 5) // blink pnum += 4; - if (splitscreen) // splitscreen + if (r_splitscreen) // splitscreen pnum += 8; V_DrawScaledPatch(STCD_X - (SHORT(kp_startcountdown[pnum]->width)/2), STCD_Y - (SHORT(kp_startcountdown[pnum]->height)/2), splitflags, kp_startcountdown[pnum]); @@ -9210,7 +9210,7 @@ static void K_drawKartFinish(void) if ((stplyr->karthud[khud_cardanimation] % (2*5)) / 5) // blink pnum = 1; - if (splitscreen > 1) // 3/4p, stationary FIN + if (r_splitscreen > 1) // 3/4p, stationary FIN { pnum += 2; V_DrawScaledPatch(STCD_X - (SHORT(kp_racefinish[pnum]->width)/2), STCD_Y - (SHORT(kp_racefinish[pnum]->height)/2), splitflags, kp_racefinish[pnum]); @@ -9221,14 +9221,14 @@ static void K_drawKartFinish(void) { INT32 x, xval; - if (splitscreen) // wide splitscreen + if (r_splitscreen) // wide splitscreen pnum += 4; x = ((vid.width<width)<karthud[khud_cardanimation])*(xval > x ? xval : x))/TICRATE; - if (splitscreen && stplyr == &players[displayplayers[1]]) + if (r_splitscreen && stplyr == &players[displayplayers[1]]) x = -x; V_DrawFixedPatch(x + (STCD_X<>1), @@ -9250,11 +9250,11 @@ static void K_drawBattleFullscreen(void) drawcomebacktimer = false; #endif - if (splitscreen) + if (r_splitscreen) { - if ((splitscreen == 1 && stplyr == &players[displayplayers[1]]) - || (splitscreen > 1 && (stplyr == &players[displayplayers[2]] - || (stplyr == &players[displayplayers[3]] && splitscreen > 2)))) + if ((r_splitscreen == 1 && stplyr == &players[displayplayers[1]]) + || (r_splitscreen > 1 && (stplyr == &players[displayplayers[2]] + || (stplyr == &players[displayplayers[3]] && r_splitscreen > 2)))) { y = 232-(stplyr->karthud[khud_cardanimation]/2); splitflags = V_SNAPTOBOTTOM; @@ -9262,12 +9262,12 @@ static void K_drawBattleFullscreen(void) else y = -32+(stplyr->karthud[khud_cardanimation]/2); - if (splitscreen > 1) + if (r_splitscreen > 1) { scale /= 2; if (stplyr == &players[displayplayers[1]] - || (stplyr == &players[displayplayers[3]] && splitscreen > 2)) + || (stplyr == &players[displayplayers[3]] && r_splitscreen > 2)) x = 3*BASEVIDWIDTH/4; else x = BASEVIDWIDTH/4; @@ -9303,7 +9303,7 @@ static void K_drawBattleFullscreen(void) else if (stplyr->kartstuff[k_bumper] <= 0 && stplyr->kartstuff[k_comebacktimer] && comeback && !stplyr->spectator && drawcomebacktimer) { UINT16 t = stplyr->kartstuff[k_comebacktimer]/(10*TICRATE); - INT32 txoff, adjust = (splitscreen > 1) ? 4 : 6; // normal string is 8, kart string is 12, half of that for ease + INT32 txoff, adjust = (r_splitscreen > 1) ? 4 : 6; // normal string is 8, kart string is 12, half of that for ease INT32 ty = (BASEVIDHEIGHT/2)+66; txoff = adjust; @@ -9314,13 +9314,13 @@ static void K_drawBattleFullscreen(void) t /= 10; } - if (splitscreen) + if (r_splitscreen) { - if (splitscreen > 1) + if (r_splitscreen > 1) ty = (BASEVIDHEIGHT/4)+33; - if ((splitscreen == 1 && stplyr == &players[displayplayers[1]]) - || (stplyr == &players[displayplayers[2]] && splitscreen > 1) - || (stplyr == &players[displayplayers[3]] && splitscreen > 2)) + if ((r_splitscreen == 1 && stplyr == &players[displayplayers[1]]) + || (stplyr == &players[displayplayers[2]] && r_splitscreen > 1) + || (stplyr == &players[displayplayers[3]] && r_splitscreen > 2)) ty += (BASEVIDHEIGHT/2); } else @@ -9331,7 +9331,7 @@ static void K_drawBattleFullscreen(void) else V_DrawFixedPatch(x< 1) + if (r_splitscreen > 1) V_DrawString(x-txoff, ty, 0, va("%d", stplyr->kartstuff[k_comebacktimer]/TICRATE)); else { @@ -9373,24 +9373,24 @@ static void K_drawKartFirstPerson(void) if (stplyr->spectator || !stplyr->mo || (stplyr->mo->flags2 & MF2_DONTDRAW)) return; - if (stplyr == &players[displayplayers[1]] && splitscreen) + if (stplyr == &players[displayplayers[1]] && r_splitscreen) { pn = pnum[1]; tn = turn[1]; dr = drift[1]; } - else if (stplyr == &players[displayplayers[2]] && splitscreen > 1) + else if (stplyr == &players[displayplayers[2]] && r_splitscreen > 1) { pn = pnum[2]; tn = turn[2]; dr = drift[2]; } - else if (stplyr == &players[displayplayers[3]] && splitscreen > 2) + else if (stplyr == &players[displayplayers[3]] && r_splitscreen > 2) { pn = pnum[3]; tn = turn[3]; dr = drift[3]; } else { pn = pnum[0]; tn = turn[0]; dr = drift[0]; } - if (splitscreen) + if (r_splitscreen) { y >>= 1; - if (splitscreen > 1) + if (r_splitscreen > 1) x >>= 1; } { - if (stplyr->speed < (20*stplyr->mo->scale) && (leveltime & 1) && !splitscreen) + if (stplyr->speed < (20*stplyr->mo->scale) && (leveltime & 1) && !r_splitscreen) y++; // the following isn't EXPLICITLY right, it just gets the result we want, but i'm too lazy to look up the right way to do it if (stplyr->mo->flags2 & MF2_SHADOW) @@ -9434,12 +9434,12 @@ static void K_drawKartFirstPerson(void) if (dr != stplyr->kartstuff[k_drift]*16) dr -= (dr - (stplyr->kartstuff[k_drift]*16))/8; - if (splitscreen == 1) + if (r_splitscreen == 1) { scale = (2*FRACUNIT)/3; y += FRACUNIT/(vid.dupx < vid.dupy ? vid.dupx : vid.dupy); // correct a one-pixel gap on the screen view (not the basevid view) } - else if (splitscreen) + else if (r_splitscreen) scale = FRACUNIT/2; else scale = FRACUNIT; @@ -9457,7 +9457,7 @@ static void K_drawKartFirstPerson(void) fixed_t xoffs = -P_ReturnThrustY(stplyr->mo, ang, (BASEVIDWIDTH<<(FRACBITS-2))/2); fixed_t yoffs = -(P_ReturnThrustX(stplyr->mo, ang, 4*FRACUNIT) - 4*FRACUNIT); - if (splitscreen) + if (r_splitscreen) xoffs = FixedMul(xoffs, scale); xoffs -= (tn)*scale; @@ -9470,7 +9470,7 @@ static void K_drawKartFirstPerson(void) if (mag < FRACUNIT) { xoffs = FixedMul(xoffs, mag); - if (!splitscreen) + if (!r_splitscreen) yoffs = FixedMul(yoffs, mag); } } @@ -9482,7 +9482,7 @@ static void K_drawKartFirstPerson(void) x -= xoffs; else x += xoffs; - if (!splitscreen) + if (!r_splitscreen) y += yoffs; } @@ -9502,11 +9502,11 @@ static void K_drawKartFirstPerson(void) V_DrawFixedPatch(x, y, scale, splitflags, kp_fpview[target], colmap); - if (stplyr == &players[displayplayers[1]] && splitscreen) + if (stplyr == &players[displayplayers[1]] && r_splitscreen) { pnum[1] = pn; turn[1] = tn; drift[1] = dr; } - else if (stplyr == &players[displayplayers[2]] && splitscreen > 1) + else if (stplyr == &players[displayplayers[2]] && r_splitscreen > 1) { pnum[2] = pn; turn[2] = tn; drift[2] = dr; } - else if (stplyr == &players[displayplayers[3]] && splitscreen > 2) + else if (stplyr == &players[displayplayers[3]] && r_splitscreen > 2) { pnum[3] = pn; turn[3] = tn; drift[3] = dr; } else { pnum[0] = pn; turn[0] = tn; drift[0] = dr; } @@ -9832,7 +9832,7 @@ void K_drawKartHUD(void) K_initKartHUD(); // Draw that fun first person HUD! Drawn ASAP so it looks more "real". - for (i = 0; i <= splitscreen; i++) + for (i = 0; i <= r_splitscreen; i++) { if (stplyr == &players[displayplayers[i]] && !camera[i].chase) K_drawKartFirstPerson(); @@ -9852,10 +9852,10 @@ void K_drawKartHUD(void) && comeback && stplyr->playerstate == PST_LIVE))); - if (!demo.title && (!battlefullscreen || splitscreen)) + if (!demo.title && (!battlefullscreen || r_splitscreen)) { // Draw the CHECK indicator before the other items, so it's overlapped by everything else - if (cv_kartcheck.value && !splitscreen && !players[displayplayers[0]].exiting) + if (cv_kartcheck.value && !r_splitscreen && !players[displayplayers[0]].exiting) K_drawKartPlayerCheck(); // Draw WANTED status @@ -9892,7 +9892,7 @@ void K_drawKartHUD(void) K_drawKartItem(); // If not splitscreen, draw... - if (!splitscreen && !demo.title) + if (!r_splitscreen && !demo.title) { // Draw the timestamp #ifdef HAVE_BLUA @@ -9913,7 +9913,7 @@ void K_drawKartHUD(void) if (!stplyr->spectator) // Bottom of the screen elements, don't need in spectate mode { // Draw the speedometer - if (cv_kartspeedometer.value && !splitscreen) + if (cv_kartspeedometer.value && !r_splitscreen) { #ifdef HAVE_BLUA if (LUA_HudEnabled(hud_speedometer)) @@ -9925,7 +9925,7 @@ void K_drawKartHUD(void) { INT32 x = BASEVIDWIDTH - 32, y = 128, offs; - if (splitscreen == 3) + if (r_splitscreen == 3) { x = BASEVIDWIDTH/2 + 10; y = BASEVIDHEIGHT/2 - 30; @@ -9984,11 +9984,11 @@ void K_drawKartHUD(void) if (leveltime >= starttime-(3*TICRATE) && leveltime < starttime+TICRATE) K_drawKartStartCountdown(); - else if (countdown && (!splitscreen || !stplyr->exiting)) + else if (countdown && (!r_splitscreen || !stplyr->exiting)) { char *countstr = va("%d", countdown/TICRATE); - if (splitscreen > 1) + if (r_splitscreen > 1) V_DrawCenteredString(BASEVIDWIDTH/4, LAPS_Y+1, K_calcSplitFlags(0), countstr); else { @@ -10002,14 +10002,14 @@ void K_drawKartHUD(void) { if (stplyr->exiting) K_drawKartFinish(); - else if (stplyr->karthud[khud_lapanimation] && !splitscreen) + else if (stplyr->karthud[khud_lapanimation] && !r_splitscreen) K_drawLapStartAnim(); } if (modeattacking) // everything after here is MP and debug only return; - if (G_BattleGametype() && !splitscreen && (stplyr->karthud[khud_yougotem] % 2)) // * YOU GOT EM * + if (G_BattleGametype() && !r_splitscreen && (stplyr->karthud[khud_yougotem] % 2)) // * YOU GOT EM * V_DrawScaledPatch(BASEVIDWIDTH/2 - (SHORT(kp_yougotem->width)/2), 32, V_HUDTRANS, kp_yougotem); // Draw FREE PLAY. diff --git a/src/lua_consolelib.c b/src/lua_consolelib.c index 299870e00..2ce3e89ae 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[1]; + playernum = displayplayers[localdisplayplayers[1]]; } if (netgame) diff --git a/src/lua_hudlib.c b/src/lua_hudlib.c index ec76552d1..d10a8dd0a 100644 --- a/src/lua_hudlib.c +++ b/src/lua_hudlib.c @@ -426,15 +426,15 @@ static int libd_drawOnMinimap(lua_State *L) // first, check what position the mmap is supposed to be in (pasted from k_kart.c): MM_X = BASEVIDWIDTH - 50; // 270 MM_Y = (BASEVIDHEIGHT/2)-16; // 84 - if (splitscreen) + if (r_splitscreen) { MM_Y = (BASEVIDHEIGHT/2); - if (splitscreen > 1) // 3P : bottom right + if (r_splitscreen > 1) // 3P : bottom right { MM_X = (3*BASEVIDWIDTH/4); MM_Y = (3*BASEVIDHEIGHT/4); - if (splitscreen > 2) // 4P: centered + if (r_splitscreen > 2) // 4P: centered { MM_X = (BASEVIDWIDTH/2); MM_Y = (BASEVIDHEIGHT/2); @@ -443,7 +443,7 @@ static int libd_drawOnMinimap(lua_State *L) } // splitscreen flags - splitflags = (splitscreen == 3 ? 0 : V_SNAPTORIGHT); // flags should only be 0 when it's centered (4p split) + splitflags = (r_splitscreen == 3 ? 0 : V_SNAPTORIGHT); // flags should only be 0 when it's centered (4p split) // translucency: if (timeinmap > 105) @@ -461,7 +461,7 @@ static int libd_drawOnMinimap(lua_State *L) minimaptrans = ((10-minimaptrans)< 2 && stplayr == &players[displayplayers[3]]) + if (r_splitscreen > 2 && stplayr == &players[displayplayers[3]]) { LUA_PushUserdata(gL, &camera[3], META_CAMERA); camnum = 4; } - else if (splitscreen > 1 && stplayr == &players[displayplayers[2]]) + else if (r_splitscreen > 1 && stplayr == &players[displayplayers[2]]) { LUA_PushUserdata(gL, &camera[2], META_CAMERA); camnum = 3; } - else if (splitscreen && stplayr == &players[displayplayers[1]]) + else if (r_splitscreen && stplayr == &players[displayplayers[1]]) { LUA_PushUserdata(gL, &camera[1], META_CAMERA); camnum = 2; diff --git a/src/m_menu.c b/src/m_menu.c index d5084dff2..3fe0198df 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -5789,9 +5789,9 @@ static void M_DrawPlaybackMenu(void) { PlaybackMenu[playback_viewcount].status = IT_ARROWS|IT_STRING; - for (i = 0; i <= splitscreen; i++) + for (i = 0; i <= r_splitscreen; i++) PlaybackMenu[playback_view1+i].status = IT_ARROWS|IT_STRING; - for (i = splitscreen+1; i < 4; i++) + for (i = r_splitscreen+1; i < 4; i++) PlaybackMenu[playback_view1+i].status = IT_DISABLED; //PlaybackMenu[playback_moreoptions].alphaKey = 156; @@ -5814,7 +5814,7 @@ static void M_DrawPlaybackMenu(void) { if (modeattacking) continue; - if (splitscreen >= i - playback_view1) + if (r_splitscreen >= i - playback_view1) { INT32 ply = displayplayers[i - playback_view1]; @@ -5850,18 +5850,18 @@ static void M_DrawPlaybackMenu(void) { char *str; - if (!(i == playback_viewcount && splitscreen == 3)) + if (!(i == playback_viewcount && r_splitscreen == 3)) V_DrawCharacter(BASEVIDWIDTH/2 - 4, currentMenu->y + 28 - (skullAnimCounter/5), '\x1A' | V_SNAPTOTOP|highlightflags, false); // up arrow - if (!(i == playback_viewcount && splitscreen == 0)) + if (!(i == playback_viewcount && r_splitscreen == 0)) V_DrawCharacter(BASEVIDWIDTH/2 - 4, currentMenu->y + 48 + (skullAnimCounter/5), '\x1B' | V_SNAPTOTOP|highlightflags, false); // down arrow switch (i) { case playback_viewcount: - str = va("%d", splitscreen+1); + str = va("%d", r_splitscreen+1); break; case playback_view1: @@ -5954,12 +5954,12 @@ static void M_PlaybackSetViews(INT32 choice) { if (choice > 0) { - if (splitscreen < 3) - G_AdjustView(splitscreen + 2, 0, true); + if (r_splitscreen < 3) + G_AdjustView(r_splitscreen + 2, 0, true); } - else if (splitscreen) + else if (r_splitscreen) { - splitscreen--; + r_splitscreen--; R_ExecuteSetViewSize(); } } @@ -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[1]]; + setupm_player = &players[displayplayers[localdisplayplayers[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[1])) + if (splitscreen && !CanChangeSkin(displayplayers[localdisplayplayers[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[2]]; + setupm_player = &players[displayplayers[localdisplayplayers[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[2])) + if (splitscreen > 1 && !CanChangeSkin(displayplayers[localdisplayplayers[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[3]]; + setupm_player = &players[displayplayers[localdisplayplayers[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[3])) + if (splitscreen > 2 && !CanChangeSkin(displayplayers[localdisplayplayers[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 f4a4ec291..b232bce9a 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[0]] && players[displayplayers[0]].mo) + if (gamestate == GS_LEVEL && &players[displayplayers[localdisplayplayers[0]]] && players[displayplayers[localdisplayplayers[0]]].mo) snprintf(locationtxt, 40, "X:%d Y:%d Z:%d A:%d", - players[displayplayers[0]].mo->x>>FRACBITS, - players[displayplayers[0]].mo->y>>FRACBITS, - players[displayplayers[0]].mo->z>>FRACBITS, - FixedInt(AngleFixed(players[displayplayers[0]].mo->angle))); + 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))); else snprintf(locationtxt, 40, "Unknown"); diff --git a/src/p_enemy.c b/src/p_enemy.c index 76f6b3159..a9b8d30b3 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -4229,7 +4229,7 @@ void A_OverlayThink(mobj_t *actor) if (!actor->target) return; - if (!splitscreen && rendermode != render_soft) + if (!r_splitscreen && rendermode != render_soft) { angle_t viewingangle; diff --git a/src/p_floor.c b/src/p_floor.c index ccbfd6eae..a6419b409 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[0]].mo) + if (players[displayplayers[localdisplayplayers[0]]].mo) { - if (players[displayplayers[0]].mo->subsector->sector == elevator->actionsector) + if (players[displayplayers[localdisplayplayers[0]]].mo->subsector->sector == elevator->actionsector) { if (t_cam_dist == -42) t_cam_dist = cv_cam_dist.value; @@ -2564,9 +2564,9 @@ void T_CameraScanner(elevator_t *elevator) } } - if (splitscreen && players[displayplayers[1]].mo) + if (splitscreen && players[displayplayers[localdisplayplayers[1]]].mo) { - if (players[displayplayers[1]].mo->subsector->sector == elevator->actionsector) + if (players[displayplayers[localdisplayplayers[1]]].mo->subsector->sector == elevator->actionsector) { if (t_cam2_rotate == -42) t_cam2_dist = cv_cam2_dist.value; @@ -2592,9 +2592,9 @@ void T_CameraScanner(elevator_t *elevator) } } - if (splitscreen > 1 && players[displayplayers[2]].mo) + if (splitscreen > 1 && players[displayplayers[localdisplayplayers[2]]].mo) { - if (players[displayplayers[2]].mo->subsector->sector == elevator->actionsector) + if (players[displayplayers[localdisplayplayers[2]]].mo->subsector->sector == elevator->actionsector) { if (t_cam3_rotate == -42) t_cam3_dist = cv_cam3_dist.value; @@ -2620,9 +2620,9 @@ void T_CameraScanner(elevator_t *elevator) } } - if (splitscreen > 2 && players[displayplayers[3]].mo) + if (splitscreen > 2 && players[displayplayers[localdisplayplayers[3]]].mo) { - if (players[displayplayers[3]].mo->subsector->sector == elevator->actionsector) + if (players[displayplayers[localdisplayplayers[3]]].mo->subsector->sector == elevator->actionsector) { if (t_cam4_rotate == -42) t_cam4_dist = cv_cam4_dist.value; diff --git a/src/p_inter.c b/src/p_inter.c index 7a975951c..d53423a46 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[1]]) + else if (splitscreen && FFInfo->player == &players[displayplayers[localdisplayplayers[1]]]) I_Tactile2(ConstantForce, &ConstantQuake); - else if (splitscreen > 1 && FFInfo->player == &players[displayplayers[2]]) + else if (splitscreen > 1 && FFInfo->player == &players[displayplayers[localdisplayplayers[2]]]) I_Tactile3(ConstantForce, &ConstantQuake); - else if (splitscreen > 2 && FFInfo->player == &players[displayplayers[3]]) + else if (splitscreen > 2 && FFInfo->player == &players[displayplayers[localdisplayplayers[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[1]]) + else if (splitscreen && FFInfo->player == &players[displayplayers[localdisplayplayers[1]]]) I_Tactile2(ConstantForce, &RampQuake); - else if (splitscreen > 1 && FFInfo->player == &players[displayplayers[2]]) + else if (splitscreen > 1 && FFInfo->player == &players[displayplayers[localdisplayplayers[2]]]) I_Tactile3(ConstantForce, &RampQuake); - else if (splitscreen > 2 && FFInfo->player == &players[displayplayers[3]]) + else if (splitscreen > 2 && FFInfo->player == &players[displayplayers[localdisplayplayers[3]]]) I_Tactile4(ConstantForce, &RampQuake); } diff --git a/src/p_map.c b/src/p_map.c index e9bc95712..253be0955 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -2568,7 +2568,7 @@ boolean P_TryCameraMove(fixed_t x, fixed_t y, camera_t *thiscam) itsatwodlevel = true; else { - for (i = 0; i <= splitscreen; i++) + for (i = 0; i <= r_splitscreen; i++) { if (thiscam == &camera[i] && players[displayplayers[i]].mo && (players[displayplayers[i]].mo->flags2 & MF2_TWOD)) @@ -2584,7 +2584,7 @@ boolean P_TryCameraMove(fixed_t x, fixed_t y, camera_t *thiscam) fixed_t tryx = thiscam->x; fixed_t tryy = thiscam->y; - for (i = 0; i <= splitscreen; i++) + for (i = 0; i <= r_splitscreen; i++) { #ifndef NOCLIPCAM if ((thiscam == &camera[i] && (players[displayplayers[i]].pflags & PF_NOCLIP)) || (leveltime < introtime)) // Noclipping player camera noclips too!! diff --git a/src/p_mobj.c b/src/p_mobj.c index b220ff4e6..d648ff0f3 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -1171,7 +1171,7 @@ static void P_PlayerFlip(mobj_t *mo) mo->player->aiming = InvAngle(mo->player->aiming); - for (i = 0; i <= splitscreen; i++) + for (i = 0; i <= r_splitscreen; i++) { if (mo->player-players == displayplayers[i]) { @@ -3565,7 +3565,7 @@ boolean P_CameraThinker(player_t *player, camera_t *thiscam, boolean resetcalled itsatwodlevel = true; else { - for (i = 0; i <= splitscreen; i++) + for (i = 0; i <= r_splitscreen; i++) { if (thiscam == &camera[i] && players[displayplayers[i]].mo && (players[displayplayers[i]].mo->flags2 & MF2_TWOD)) @@ -3606,7 +3606,7 @@ boolean P_CameraThinker(player_t *player, camera_t *thiscam, boolean resetcalled if (postimg != postimg_none) { - for (i = 0; i <= splitscreen; i++) + for (i = 0; i <= r_splitscreen; i++) { if (player == &players[displayplayers[i]]) postimgtype[i] = postimg; @@ -3656,11 +3656,11 @@ boolean P_CameraThinker(player_t *player, camera_t *thiscam, boolean resetcalled fixed_t cam_height = cv_cam_height.value; thiscam->z = thiscam->floorz; - if (player == &players[displayplayers[1]]) + if (player == &players[displayplayers[localdisplayplayers[1]]]) cam_height = cv_cam2_height.value; - if (player == &players[displayplayers[2]]) + if (player == &players[displayplayers[localdisplayplayers[2]]]) cam_height = cv_cam3_height.value; - if (player == &players[displayplayers[3]]) + if (player == &players[displayplayers[localdisplayplayers[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)) { @@ -6112,7 +6112,7 @@ void P_RunOverlays(void) if (!mo->target) continue; - if (!splitscreen /*&& rendermode != render_soft*/) + if (!r_splitscreen /*&& rendermode != render_soft*/) { angle_t viewingangle; @@ -6635,7 +6635,7 @@ void P_RunBattleOvertime(void) { UINT8 transparency = tr_trans50; - if (!splitscreen && players[displayplayers[0]].mo) + if (!r_splitscreen && players[displayplayers[0]].mo) { INT32 dist = P_AproxDistance(battleovertime.x-players[displayplayers[0]].mo->x, battleovertime.y-players[displayplayers[0]].mo->y); transparency = max(0, NUMTRANSMAPS - ((256 + (dist>>FRACBITS)) / 256)); @@ -7094,7 +7094,7 @@ void P_MobjThinker(mobj_t *mobj) mobj->angle = R_PointToAngle(mobj->x, mobj->y) + ANGLE_90; // literally only happened because i wanted to ^L^R the SPR_ITEM's - if (!splitscreen && players[displayplayers[0]].mo) + if (!r_splitscreen && players[displayplayers[0]].mo) { scale = mobj->target->scale + FixedMul(FixedDiv(abs(P_AproxDistance(players[displayplayers[0]].mo->x-mobj->target->x, players[displayplayers[0]].mo->y-mobj->target->y)), RING_DIST), mobj->target->scale); @@ -7282,7 +7282,7 @@ void P_MobjThinker(mobj_t *mobj) if (mobj->target && mobj->target->health && mobj->tracer && mobj->target->player && !mobj->target->player->spectator && mobj->target->player->health && mobj->target->player->playerstate != PST_DEAD - && players[displayplayers[0]].mo && !players[displayplayers[0]].spectator) + && players[displayplayers[localdisplayplayers[0]]].mo && !players[displayplayers[localdisplayplayers[0]]].spectator) { fixed_t scale = 3*mobj->target->scale; @@ -7302,7 +7302,7 @@ void P_MobjThinker(mobj_t *mobj) mobj->x = mobj->target->x; mobj->y = mobj->target->y; - if (!splitscreen && players[displayplayers[0]].mo) + if (!r_splitscreen && players[displayplayers[0]].mo) { scale = mobj->target->scale + FixedMul(FixedDiv(abs(P_AproxDistance(players[displayplayers[0]].mo->x-mobj->target->x, players[displayplayers[0]].mo->y-mobj->target->y)), RING_DIST), mobj->target->scale); @@ -8807,7 +8807,7 @@ void P_MobjThinker(mobj_t *mobj) } P_SetScale(mobj, (mobj->destscale = (5*mobj->target->destscale)>>2)); - if (!splitscreen /*&& rendermode != render_soft*/) + if (!r_splitscreen /*&& rendermode != render_soft*/) { angle_t viewingangle; statenum_t curstate = ((mobj->tics == 1) ? (mobj->state->nextstate) : ((statenum_t)(mobj->state-states))); @@ -11136,13 +11136,13 @@ void P_PrecipitationEffects(void) // Local effects from here on out! // If we're not in game fully yet, we don't worry about them. - if (!playeringame[displayplayers[0]] || !players[displayplayers[0]].mo) + if (!playeringame[displayplayers[localdisplayplayers[0]]] || !players[displayplayers[localdisplayplayers[0]]].mo) return; if (sound_disabled) return; // Sound off? D'aw, no fun. - if (players[displayplayers[0]].mo->subsector->sector->ceilingpic == skyflatnum) + if (players[displayplayers[localdisplayplayers[0]]].mo->subsector->sector->ceilingpic == skyflatnum) volume = 255; // Sky above? We get it full blast. 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[0]].mo->y - 1024*FRACUNIT; - yh = players[displayplayers[0]].mo->y + 1024*FRACUNIT; - xl = players[displayplayers[0]].mo->x - 1024*FRACUNIT; - xh = players[displayplayers[0]].mo->x + 1024*FRACUNIT; + 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; 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[0]].mo->x, players[displayplayers[0]].mo->y, 0, x, y, 0); + newdist = S_CalculateSoundDistance(players[displayplayers[localdisplayplayers[0]]].mo->x, players[displayplayers[localdisplayplayers[0]]].mo->y, 0, x, y, 0); if (newdist < closedist) closedist = newdist; } @@ -11175,7 +11175,7 @@ void P_PrecipitationEffects(void) volume = 255; if (sounds_rain && (!leveltime || leveltime % 80 == 1)) - S_StartSoundAtVolume(players[displayplayers[0]].mo, sfx_rainin, volume); + S_StartSoundAtVolume(players[displayplayers[localdisplayplayers[0]]].mo, sfx_rainin, volume); if (!sounds_thunder) 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[0]].mo, sfx_litng1 + M_RandomKey(4), volume); + S_StartSoundAtVolume(players[displayplayers[localdisplayplayers[0]]].mo, sfx_litng1 + M_RandomKey(4), volume); } else if (thunderchance < 20) { @@ -11191,7 +11191,7 @@ void P_PrecipitationEffects(void) if (volume < 80) volume = 80; - S_StartSoundAtVolume(players[displayplayers[0]].mo, sfx_athun1 + M_RandomKey(2), volume); + S_StartSoundAtVolume(players[displayplayers[localdisplayplayers[0]]].mo, sfx_athun1 + M_RandomKey(2), volume); } } @@ -11525,9 +11525,9 @@ void P_AfterPlayerSpawn(INT32 playernum) if (playernum == consoleplayer) localangle[0] = mobj->angle; - else if (splitscreen) + else if (r_splitscreen) { - for (i = 1; i <= splitscreen; i++) + for (i = 1; i <= r_splitscreen; i++) { if (playernum == displayplayers[i]) { @@ -11557,7 +11557,7 @@ void P_AfterPlayerSpawn(INT32 playernum) SV_SpawnPlayer(playernum, mobj->x, mobj->y, mobj->angle); - for (i = 0; i <= splitscreen; i++) + for (i = 0; i <= r_splitscreen; i++) { if (camera[i].chase) { diff --git a/src/p_setup.c b/src/p_setup.c index 5acc72746..491127d5b 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[1], forcecharskin); - if ((unsigned)cv_playercolor2.value != skins[players[displayplayers[1]].skin].prefcolor && !modeattacking) + SetPlayerSkin(displayplayers[localdisplayplayers[1]], forcecharskin); + if ((unsigned)cv_playercolor2.value != skins[players[displayplayers[localdisplayplayers[1]]].skin].prefcolor && !modeattacking) { - CV_StealthSetValue(&cv_playercolor2, skins[players[displayplayers[1]].skin].prefcolor); - players[displayplayers[1]].skincolor = skins[players[displayplayers[1]].skin].prefcolor; + CV_StealthSetValue(&cv_playercolor2, skins[players[displayplayers[localdisplayplayers[1]]].skin].prefcolor); + players[displayplayers[localdisplayplayers[1]]].skincolor = skins[players[displayplayers[localdisplayplayers[1]]].skin].prefcolor; } if (splitscreen > 1) { - SetPlayerSkin(displayplayers[2], forcecharskin); - if ((unsigned)cv_playercolor3.value != skins[players[displayplayers[2]].skin].prefcolor && !modeattacking) + SetPlayerSkin(displayplayers[localdisplayplayers[2]], forcecharskin); + if ((unsigned)cv_playercolor3.value != skins[players[displayplayers[localdisplayplayers[2]]].skin].prefcolor && !modeattacking) { - CV_StealthSetValue(&cv_playercolor3, skins[players[displayplayers[2]].skin].prefcolor); - players[displayplayers[2]].skincolor = skins[players[displayplayers[2]].skin].prefcolor; + CV_StealthSetValue(&cv_playercolor3, skins[players[displayplayers[localdisplayplayers[2]]].skin].prefcolor); + players[displayplayers[localdisplayplayers[2]]].skincolor = skins[players[displayplayers[localdisplayplayers[2]]].skin].prefcolor; } if (splitscreen > 2) { - SetPlayerSkin(displayplayers[3], forcecharskin); - if ((unsigned)cv_playercolor4.value != skins[players[displayplayers[3]].skin].prefcolor && !modeattacking) + SetPlayerSkin(displayplayers[localdisplayplayers[3]], forcecharskin); + if ((unsigned)cv_playercolor4.value != skins[players[displayplayers[localdisplayplayers[3]]].skin].prefcolor && !modeattacking) { - CV_StealthSetValue(&cv_playercolor4, skins[players[displayplayers[3]].skin].prefcolor); - players[displayplayers[3]].skincolor = skins[players[displayplayers[3]].skin].prefcolor; + CV_StealthSetValue(&cv_playercolor4, skins[players[displayplayers[localdisplayplayers[3]]].skin].prefcolor); + players[displayplayers[localdisplayplayers[3]]].skincolor = skins[players[displayplayers[localdisplayplayers[3]]].skin].prefcolor; } } } @@ -2824,7 +2824,7 @@ boolean P_SetupLevel(boolean skipprecip) P_LevelInitStuff(); - for (i = 0; i <= splitscreen; i++) + for (i = 0; i <= r_splitscreen; i++) postimgtype[i] = postimg_none; if (mapheaderinfo[gamemap-1]->forcecharacter[0] != '\0') @@ -3228,7 +3228,7 @@ boolean P_SetupLevel(boolean skipprecip) if (!dedicated) { - for (i = 0; i <= splitscreen; i++) + for (i = 0; i <= r_splitscreen; i++) P_SetupCamera(displayplayers[i], &camera[i]); // Salt: CV_ClearChangedFlags() messes with your settings :( @@ -3270,7 +3270,7 @@ boolean P_SetupLevel(boolean skipprecip) /*if (rendermode != render_none) CV_Set(&cv_fov, cv_fov.defaultvalue);*/ - displayplayers[0] = consoleplayer; // Start with your OWN view, please! + displayplayers[localdisplayplayers[0]] = consoleplayer; // Start with your OWN view, please! } /*if (cv_useranalog.value) diff --git a/src/p_spec.c b/src/p_spec.c index 93e88e2ce..e62f1410c 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -2386,7 +2386,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) if (bot) // This might put poor Tails in a wall if he's too far behind! D: But okay, whatever! >:3 P_TeleportMove(bot, bot->x + x, bot->y + y, bot->z + z); - for (i = 0; i <= splitscreen; i++) + for (i = 0; i <= r_splitscreen; i++) { if (mo->player == &players[displayplayers[i]] && camera[i].chase) { diff --git a/src/p_telept.c b/src/p_telept.c index 74f9d462c..8c2f8ed70 100644 --- a/src/p_telept.c +++ b/src/p_telept.c @@ -66,9 +66,9 @@ void P_MixUp(mobj_t *thing, fixed_t x, fixed_t y, fixed_t z, angle_t angle, // absolute angle position if (thing == players[consoleplayer].mo) localangle[0] = angle; - else if (splitscreen) + else if (r_splitscreen) { - for (i = 1; i <= splitscreen; i++) + for (i = 1; i <= r_splitscreen; i++) { if (thing == players[displayplayers[i]].mo) { @@ -79,7 +79,7 @@ void P_MixUp(mobj_t *thing, fixed_t x, fixed_t y, fixed_t z, angle_t angle, } // move chasecam at new player location - for (i = 0; i <= splitscreen; i++) + for (i = 0; i <= r_splitscreen; i++) { if (thing->player == &players[displayplayers[i]] && camera[i].chase) P_ResetCamera(thing->player, &camera[i]); @@ -151,9 +151,9 @@ boolean P_Teleport(mobj_t *thing, fixed_t x, fixed_t y, fixed_t z, angle_t angle // absolute angle position if (thing == players[consoleplayer].mo) localangle[0] = angle; - else if (splitscreen) + else if (r_splitscreen) { - for (i = 1; i <= splitscreen; i++) + for (i = 1; i <= r_splitscreen; i++) { if (thing == players[displayplayers[i]].mo) { @@ -164,7 +164,7 @@ boolean P_Teleport(mobj_t *thing, fixed_t x, fixed_t y, fixed_t z, angle_t angle } // move chasecam at new player location - for (i = 0; i <= splitscreen; i++) + for (i = 0; i <= r_splitscreen; i++) { if (thing->player == &players[displayplayers[i]] && camera[i].chase) P_ResetCamera(thing->player, &camera[i]); diff --git a/src/p_tick.c b/src/p_tick.c index b285c35d0..a5214a5ab 100644 --- a/src/p_tick.c +++ b/src/p_tick.c @@ -601,7 +601,7 @@ void P_Ticker(boolean run) return; } - for (i = 0; i <= splitscreen; i++) + for (i = 0; i <= r_splitscreen; i++) postimgtype[i] = postimg_none; P_MapStart(); @@ -751,7 +751,7 @@ void P_Ticker(boolean run) } // Always move the camera. - for (i = 0; i <= splitscreen; i++) + for (i = 0; i <= r_splitscreen; i++) { if (camera[i].chase) P_MoveChaseCamera(&players[displayplayers[i]], &camera[i], false); @@ -771,7 +771,7 @@ void P_PreTicker(INT32 frames) INT32 i,framecnt; ticcmd_t temptic; - for (i = 0; i <= splitscreen; i++) + for (i = 0; i <= r_splitscreen; i++) postimgtype[i] = postimg_none; for (framecnt = 0; framecnt < frames; ++framecnt) diff --git a/src/p_user.c b/src/p_user.c index 8185667a0..bb9eae095 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -1122,12 +1122,12 @@ boolean P_EndingMusic(player_t *player) // Event - Level Finish // Check for if this is valid or not - if (splitscreen) + if (r_splitscreen) { if (!((players[displayplayers[0]].exiting || (players[displayplayers[0]].pflags & PF_TIMEOVER)) || (players[displayplayers[1]].exiting || (players[displayplayers[1]].pflags & PF_TIMEOVER)) - || ((splitscreen < 2) && (players[displayplayers[2]].exiting || (players[displayplayers[2]].pflags & PF_TIMEOVER))) - || ((splitscreen < 3) && (players[displayplayers[3]].exiting || (players[displayplayers[3]].pflags & PF_TIMEOVER))))) + || ((r_splitscreen < 2) && (players[displayplayers[2]].exiting || (players[displayplayers[2]].pflags & PF_TIMEOVER))) + || ((r_splitscreen < 3) && (players[displayplayers[3]].exiting || (players[displayplayers[3]].pflags & PF_TIMEOVER))))) return false; bestlocalplayer = &players[displayplayers[0]]; @@ -1139,9 +1139,9 @@ boolean P_EndingMusic(player_t *player) bestlocalpos = ((players[p].pflags & PF_TIMEOVER) ? MAXPLAYERS+1 : players[p].kartstuff[k_position]); \ } setbests(displayplayers[1]); - if (splitscreen > 1) + if (r_splitscreen > 1) setbests(displayplayers[2]); - if (splitscreen > 2) + if (r_splitscreen > 2) setbests(displayplayers[3]); #undef setbests } @@ -1211,7 +1211,7 @@ void P_RestoreMusic(player_t *player) { INT32 wantedmus = 0; // 0 is level music, 1 is invincibility, 2 is grow - if (splitscreen) + if (r_splitscreen) { INT32 bestlocaltimer = 1; @@ -1225,9 +1225,9 @@ void P_RestoreMusic(player_t *player) } setbests(displayplayers[0]); setbests(displayplayers[1]); - if (splitscreen > 1) + if (r_splitscreen > 1) setbests(displayplayers[2]); - if (splitscreen > 2) + if (r_splitscreen > 2) setbests(displayplayers[3]); #undef setbests } @@ -1490,9 +1490,9 @@ boolean P_IsLocalPlayer(player_t *player) if (player == &players[consoleplayer]) return true; - else if (splitscreen) + else if (r_splitscreen) { - for (i = 1; i <= splitscreen; i++) // Skip P1 + for (i = 1; i <= r_splitscreen; i++) // Skip P1 { if (player == &players[displayplayers[i]]) return true; @@ -1512,7 +1512,7 @@ boolean P_IsDisplayPlayer(player_t *player) { UINT8 i; - for (i = 0; i <= splitscreen; i++) // DON'T skip P1 + for (i = 0; i <= r_splitscreen; i++) // DON'T skip P1 { if (player == &players[displayplayers[i]]) return true; @@ -7913,7 +7913,7 @@ static void P_CalcPostImg(player_t *player) pviewheight = player->awayviewmobj->z + 20*FRACUNIT; } - for (i = 0; i <= splitscreen; i++) + for (i = 0; i <= r_splitscreen; i++) { if (player == &players[displayplayers[i]]) { @@ -8078,7 +8078,7 @@ void P_PlayerThink(player_t *player) } #ifdef SEENAMES - if (netgame && player == &players[displayplayers[0]] && !(leveltime % (TICRATE/5)) && !splitscreen) + if (netgame && player == &players[displayplayers[0]] && !(leveltime % (TICRATE/5)) && !r_splitscreen) { seenplayer = NULL; @@ -8434,7 +8434,7 @@ void P_PlayerThink(player_t *player) // Hide the mobj from our sights if we're the displayplayer and chasecam is off. // Why not just not spawn the mobj? Well, I'd rather only flirt with // consistency so much... - for (i = 0; i <= splitscreen; i++) + for (i = 0; i <= r_splitscreen; i++) { if (player == &players[displayplayers[i]] && !camera[i].chase) { @@ -8664,7 +8664,7 @@ void P_PlayerAfterThink(player_t *player) P_PlayerInSpecialSector(player); #endif - for (i = 0; i <= splitscreen; i++) + for (i = 0; i <= r_splitscreen; i++) { if (player == &players[displayplayers[i]]) { diff --git a/src/r_bsp.c b/src/r_bsp.c index 296cbbe87..d7641838e 100644 --- a/src/r_bsp.c +++ b/src/r_bsp.c @@ -254,7 +254,7 @@ sector_t *R_FakeFlat(sector_t *sec, sector_t *tempsec, INT32 *floorlightlevel, boolean underwater; UINT8 i; - for (i = 0; i <= splitscreen; i++) + for (i = 0; i <= r_splitscreen; i++) { if (viewplayer == &players[displayplayers[i]] && camera[i].chase) { @@ -263,7 +263,7 @@ sector_t *R_FakeFlat(sector_t *sec, sector_t *tempsec, INT32 *floorlightlevel, } } - if (i > splitscreen && viewmobj) + if (i > r_splitscreen && viewmobj) heightsec = R_PointInSubsector(viewmobj->x, viewmobj->y)->sector->heightsec; else return sec; diff --git a/src/r_draw.c b/src/r_draw.c index 1931ce6ee..70e487342 100644 --- a/src/r_draw.c +++ b/src/r_draw.c @@ -299,7 +299,7 @@ void R_InitViewBuffer(INT32 width, INT32 height) for (i = 0; i < height; i++) { ylookup[i] = ylookup1[i] = screens[0] + i*vid.width*bytesperpixel; - if (splitscreen == 1) + if (r_splitscreen == 1) ylookup2[i] = screens[0] + (i+viewheight)*vid.width*bytesperpixel; else ylookup2[i] = screens[0] + i*vid.width*bytesperpixel + (viewwidth*bytesperpixel); diff --git a/src/r_main.c b/src/r_main.c index 0d14bed73..cf16802cb 100644 --- a/src/r_main.c +++ b/src/r_main.c @@ -73,6 +73,8 @@ boolean skyVisiblePerPlayer[MAXSPLITSCREENPLAYERS]; // saved values of skyVisibl sector_t *viewsector; player_t *viewplayer; +int r_splitscreen; + // PORTALS! // You can thank and/or curse JTE for these. UINT8 portalrender; @@ -192,6 +194,12 @@ void SplitScreen_OnChange(void) { UINT8 i; + /* + local splitscreen is updated before you're in a game, + so this is the first value for renderer splitscreen + */ + r_splitscreen = splitscreen; + // recompute screen size R_ExecuteSetViewSize(); @@ -659,12 +667,12 @@ void R_ExecuteSetViewSize(void) scaledviewwidth = vid.width; viewheight = vid.height; - if (splitscreen) + if (r_splitscreen) viewheight >>= 1; viewwidth = scaledviewwidth; - if (splitscreen > 1) + if (r_splitscreen > 1) { viewwidth >>= 1; scaledviewwidth >>= 1; @@ -677,7 +685,7 @@ void R_ExecuteSetViewSize(void) fov = FixedAngle(cv_fov.value/2) + ANGLE_90; fovtan = FINETANGENT(fov >> ANGLETOFINESHIFT); - if (splitscreen == 1) // Splitscreen FOV should be adjusted to maintain expected vertical view + if (r_splitscreen == 1) // Splitscreen FOV should be adjusted to maintain expected vertical view fovtan = 17*fovtan/10; projection = projectiony = FixedDiv(centerxfrac, fovtan); @@ -848,9 +856,9 @@ void R_SkyboxFrame(player_t *player) camera_t *thiscam = &camera[0]; UINT8 i; - if (splitscreen) + if (r_splitscreen) { - for (i = 1; i <= splitscreen; i++) + for (i = 1; i <= r_splitscreen; i++) { if (player == &players[displayplayers[i]]) { @@ -891,9 +899,9 @@ void R_SkyboxFrame(player_t *player) viewangle = localangle[0]; // WARNING: camera uses this aimingangle = localaiming[0]; } - else if (splitscreen) + else if (r_splitscreen) { - for (i = 1; i <= splitscreen; i++) + for (i = 1; i <= r_splitscreen; i++) { if (player == &players[displayplayers[i]]) { @@ -1080,17 +1088,17 @@ void R_SetupFrame(player_t *player, boolean skybox) camera_t *thiscam; boolean chasecam = false; - if (splitscreen > 2 && player == &players[displayplayers[3]]) + if (r_splitscreen > 2 && player == &players[displayplayers[3]]) { thiscam = &camera[3]; chasecam = (cv_chasecam4.value != 0); } - else if (splitscreen > 1 && player == &players[displayplayers[2]]) + else if (r_splitscreen > 1 && player == &players[displayplayers[2]]) { thiscam = &camera[2]; chasecam = (cv_chasecam3.value != 0); } - else if (splitscreen && player == &players[displayplayers[1]]) + else if (r_splitscreen && player == &players[displayplayers[1]]) { thiscam = &camera[1]; chasecam = (cv_chasecam2.value != 0); @@ -1150,10 +1158,10 @@ void R_SetupFrame(player_t *player, boolean skybox) viewangle = localangle[0]; // WARNING: camera uses this aimingangle = localaiming[0]; } - else if (splitscreen) + else if (r_splitscreen) { UINT8 i; - for (i = 1; i <= splitscreen; i++) + for (i = 1; i <= r_splitscreen; i++) { if (player == &players[displayplayers[i]]) { @@ -1334,7 +1342,7 @@ void R_RenderPlayerView(player_t *player) V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 32+(timeinmap&15)); } // Draw over the fourth screen so you don't have to stare at a HOM :V - else if (splitscreen == 2 && player == &players[displayplayers[2]]) + else if (r_splitscreen == 2 && player == &players[displayplayers[2]]) #if 1 { // V_DrawPatchFill, but for the fourth screen only @@ -1353,7 +1361,7 @@ void R_RenderPlayerView(player_t *player) #endif // load previous saved value of skyVisible for the player - for (i = 0; i <= splitscreen; i++) + for (i = 0; i <= r_splitscreen; i++) { if (player == &players[displayplayers[i]]) { @@ -1463,7 +1471,7 @@ void R_RenderPlayerView(player_t *player) // save value to skyVisiblePerPlayer // this is so that P1 can't affect whether P2 can see a skybox or not, or vice versa - for (i = 0; i <= splitscreen; i++) + for (i = 0; i <= r_splitscreen; i++) { if (player == &players[displayplayers[i]]) { diff --git a/src/r_plane.c b/src/r_plane.c index ec105bf75..08a449e6c 100644 --- a/src/r_plane.c +++ b/src/r_plane.c @@ -883,12 +883,12 @@ void R_DrawSinglePlane(visplane_t *pl) if (bottom > vid.height) bottom = vid.height; - if (splitscreen > 2 && viewplayer == &players[displayplayers[3]]) // Only copy the part of the screen we need + if (r_splitscreen > 2 && viewplayer == &players[displayplayers[3]]) // Only copy the part of the screen we need scr = (screens[0] + (top+(viewheight))*vid.width + viewwidth); - else if ((splitscreen == 1 && viewplayer == &players[displayplayers[1]]) - || (splitscreen > 1 && viewplayer == &players[displayplayers[2]])) + else if ((r_splitscreen == 1 && viewplayer == &players[displayplayers[1]]) + || (r_splitscreen > 1 && viewplayer == &players[displayplayers[2]])) scr = (screens[0] + (top+(viewheight))*vid.width); - else if (splitscreen > 1 && viewplayer == &players[displayplayers[1]]) + else if (r_splitscreen > 1 && viewplayer == &players[displayplayers[1]]) scr = (screens[0] + ((top)*vid.width) + viewwidth); else scr = (screens[0] + ((top)*vid.width)); diff --git a/src/r_sky.c b/src/r_sky.c index 1fe0fe0e6..3904eba3a 100644 --- a/src/r_sky.c +++ b/src/r_sky.c @@ -81,7 +81,7 @@ void R_SetSkyScale(void) { fixed_t difference = vid.fdupx-(vid.dupx< 1) + if (r_splitscreen > 1) scr *= 2; skyscale = FixedDiv(scr, vid.fdupx+difference); } diff --git a/src/r_things.c b/src/r_things.c index 1afbb125c..239c9def0 100644 --- a/src/r_things.c +++ b/src/r_things.c @@ -1761,7 +1761,7 @@ void R_AddSprites(sector_t *sec, INT32 lightlevel) if (thing->sprite == SPR_NULL || thing->flags2 & MF2_DONTDRAW) continue; - if (splitscreen) + if (r_splitscreen) { if (thing->eflags & MFE_DRAWONLYFORP1) if (viewssnum != 0) @@ -1771,11 +1771,11 @@ void R_AddSprites(sector_t *sec, INT32 lightlevel) if (viewssnum != 1) continue; - if (thing->eflags & MFE_DRAWONLYFORP3 && splitscreen > 1) + if (thing->eflags & MFE_DRAWONLYFORP3 && r_splitscreen > 1) if (viewssnum != 2) continue; - if (thing->eflags & MFE_DRAWONLYFORP4 && splitscreen > 2) + if (thing->eflags & MFE_DRAWONLYFORP4 && r_splitscreen > 2) if (viewssnum != 3) continue; } @@ -1796,7 +1796,7 @@ void R_AddSprites(sector_t *sec, INT32 lightlevel) if (thing->sprite == SPR_NULL || thing->flags2 & MF2_DONTDRAW) continue; - if (splitscreen) + if (r_splitscreen) { if (thing->eflags & MFE_DRAWONLYFORP1) if (viewssnum != 0) @@ -1806,11 +1806,11 @@ void R_AddSprites(sector_t *sec, INT32 lightlevel) if (viewssnum != 1) continue; - if (thing->eflags & MFE_DRAWONLYFORP3 && splitscreen > 1) + if (thing->eflags & MFE_DRAWONLYFORP3 && r_splitscreen > 1) if (viewssnum != 2) continue; - if (thing->eflags & MFE_DRAWONLYFORP4 && splitscreen > 2) + if (thing->eflags & MFE_DRAWONLYFORP4 && r_splitscreen > 2) if (viewssnum != 3) continue; } diff --git a/src/s_sound.c b/src/s_sound.c index 21b668f28..82435d3dc 100644 --- a/src/s_sound.c +++ b/src/s_sound.c @@ -457,19 +457,19 @@ void S_StartSoundAtVolume(const void *origin_p, sfxenum_t sfx_id, INT32 volume) if (players[displayplayers[0]].awayviewtics) listenmobj = players[displayplayers[0]].awayviewmobj; - if (splitscreen) + if (r_splitscreen) { listenmobj2 = players[displayplayers[1]].mo; if (players[displayplayers[1]].awayviewtics) listenmobj2 = players[displayplayers[1]].awayviewmobj; - if (splitscreen > 1) + if (r_splitscreen > 1) { listenmobj3 = players[displayplayers[2]].mo; if (players[displayplayers[2]].awayviewtics) listenmobj3 = players[displayplayers[2]].awayviewmobj; - if (splitscreen > 2) + if (r_splitscreen > 2) { listenmobj4 = players[displayplayers[3]].mo; if (players[displayplayers[3]].awayviewtics) @@ -574,10 +574,10 @@ void S_StartSoundAtVolume(const void *origin_p, sfxenum_t sfx_id, INT32 volume) pitch = NORM_PITCH; priority = NORM_PRIORITY; - if (splitscreen && origin) - volume = FixedDiv(volume<>FRACBITS; + if (r_splitscreen && origin) + volume = FixedDiv(volume<>FRACBITS; - if (splitscreen && listenmobj2) // Copy the sound for the split player + if (r_splitscreen && listenmobj2) // Copy the sound for the split player { // Check to see if it is audible, and if not, modify the params if (origin && origin != listenmobj2) @@ -633,7 +633,7 @@ void S_StartSoundAtVolume(const void *origin_p, sfxenum_t sfx_id, INT32 volume) dontplay: - if (splitscreen > 1 && listenmobj3) // Copy the sound for the third player + if (r_splitscreen > 1 && listenmobj3) // Copy the sound for the third player { // Check to see if it is audible, and if not, modify the params if (origin && origin != listenmobj3) @@ -689,7 +689,7 @@ dontplay: dontplay3: - if (splitscreen > 2 && listenmobj4) // Copy the sound for the split player + if (r_splitscreen > 2 && listenmobj4) // Copy the sound for the split player { // Check to see if it is audible, and if not, modify the params if (origin && origin != listenmobj4) @@ -942,19 +942,19 @@ void S_UpdateSounds(void) if (players[displayplayers[0]].awayviewtics) listenmobj = players[displayplayers[0]].awayviewmobj; - if (splitscreen) + if (r_splitscreen) { listenmobj2 = players[displayplayers[1]].mo; if (players[displayplayers[1]].awayviewtics) listenmobj2 = players[displayplayers[1]].awayviewmobj; - if (splitscreen > 1) + if (r_splitscreen > 1) { listenmobj3 = players[displayplayers[2]].mo; if (players[displayplayers[2]].awayviewtics) listenmobj3 = players[displayplayers[2]].awayviewmobj; - if (splitscreen > 2) + if (r_splitscreen > 2) { listenmobj4 = players[displayplayers[3]].mo; if (players[displayplayers[3]].awayviewtics) @@ -1058,24 +1058,24 @@ void S_UpdateSounds(void) pitch = NORM_PITCH; sep = NORM_SEP; - if (splitscreen && c->origin) - volume = FixedDiv(volume<>FRACBITS; + if (r_splitscreen && c->origin) + volume = FixedDiv(volume<>FRACBITS; // check non-local sounds for distance clipping // or modify their params - if (c->origin && ((c->origin != players[consoleplayer].mo) - || (splitscreen && c->origin != players[displayplayers[1]].mo) - || (splitscreen > 1 && c->origin != players[displayplayers[2]].mo) - || (splitscreen > 2 && c->origin != players[displayplayers[3]].mo))) + if (c->origin && ((c->origin != players[displayplayers[0]].mo) + || (r_splitscreen && c->origin != players[displayplayers[1]].mo) + || (r_splitscreen > 1 && c->origin != players[displayplayers[2]].mo) + || (r_splitscreen > 2 && c->origin != players[displayplayers[3]].mo))) { // Whomever is closer gets the sound, but only in splitscreen. - if (splitscreen) + if (r_splitscreen) { const mobj_t *soundmobj = c->origin; fixed_t recdist = -1; INT32 i, p = -1; - for (i = 0; i <= splitscreen; i++) + for (i = 0; i <= r_splitscreen; i++) { fixed_t thisdist = -1; @@ -1130,7 +1130,7 @@ void S_UpdateSounds(void) S_StopChannel(cnum); } } - else if (listenmobj && !splitscreen) + else if (listenmobj && !r_splitscreen) { // In the case of a single player, he or she always should get updated sound. audible = S_AdjustSoundParams(listenmobj, c->origin, &volume, &sep, &pitch, @@ -1258,21 +1258,21 @@ INT32 S_AdjustSoundParams(const mobj_t *listener, const mobj_t *source, INT32 *v listensource.z = camera[0].z; listensource.angle = camera[0].angle; } - else if (splitscreen && listener == players[displayplayers[1]].mo && camera[1].chase) + else if (r_splitscreen && listener == players[displayplayers[1]].mo && camera[1].chase) { listensource.x = camera[1].x; listensource.y = camera[1].y; listensource.z = camera[1].z; listensource.angle = camera[1].angle; } - else if (splitscreen > 1 && listener == players[displayplayers[2]].mo && camera[2].chase) + else if (r_splitscreen > 1 && listener == players[displayplayers[2]].mo && camera[2].chase) { listensource.x = camera[2].x; listensource.y = camera[2].y; listensource.z = camera[2].z; listensource.angle = camera[2].angle; } - else if (splitscreen > 2 && listener == players[displayplayers[3]].mo && camera[3].chase) + else if (r_splitscreen > 2 && listener == players[displayplayers[3]].mo && camera[3].chase) { listensource.x = camera[3].x; listensource.y = camera[3].y; @@ -1372,8 +1372,8 @@ INT32 S_AdjustSoundParams(const mobj_t *listener, const mobj_t *source, INT32 *v *vol = (15 * ((S_CLIPPING_DIST - approx_dist)>>FRACBITS)) / S_ATTENUATOR; } - if (splitscreen) - *vol = FixedDiv((*vol)<>FRACBITS; + if (r_splitscreen) + *vol = FixedDiv((*vol)<>FRACBITS; return (*vol > 0); } diff --git a/src/st_stuff.c b/src/st_stuff.c index caed81f3e..280984ca7 100644 --- a/src/st_stuff.c +++ b/src/st_stuff.c @@ -230,7 +230,7 @@ void ST_doPaletteStuff(void) if (rendermode != render_none) { //V_SetPaletteLump(GetPalette()); // Reset the palette -- is this needed? - if (!splitscreen) + if (!r_splitscreen) V_SetPalette(palette); } } @@ -515,9 +515,9 @@ static INT32 SCR(INT32 r) #define ST_DrawNumFromHud(h,n) V_DrawTallNum(SCX(hudinfo[h].x), SCY(hudinfo[h].y), V_NOSCALESTART|V_HUDTRANS, n) #define ST_DrawPadNumFromHud(h,n,q) V_DrawPaddedTallNum(SCX(hudinfo[h].x), SCY(hudinfo[h].y), V_NOSCALESTART|V_HUDTRANS, n, q) #define ST_DrawPatchFromHud(h,p) V_DrawScaledPatch(SCX(hudinfo[h].x), SCY(hudinfo[h].y), V_NOSCALESTART|V_HUDTRANS, p) -#define ST_DrawNumFromHudWS(h,n) V_DrawTallNum(SCX(hudinfo[h+!!splitscreen].x), SCY(hudinfo[h+!!splitscreen].y), V_NOSCALESTART|V_HUDTRANS, n) -#define ST_DrawPadNumFromHudWS(h,n,q) V_DrawPaddedTallNum(SCX(hudinfo[h+!!splitscreen].x), SCY(hudinfo[h+!!splitscreen].y), V_NOSCALESTART|V_HUDTRANS, n, q) -#define ST_DrawPatchFromHudWS(h,p) V_DrawScaledPatch(SCX(hudinfo[h+!!splitscreen].x), SCY(hudinfo[h+!!splitscreen].y), V_NOSCALESTART|V_HUDTRANS, p) +#define ST_DrawNumFromHudWS(h,n) V_DrawTallNum(SCX(hudinfo[h+!!r_splitscreen].x), SCY(hudinfo[h+!!r_splitscreen].y), V_NOSCALESTART|V_HUDTRANS, n) +#define ST_DrawPadNumFromHudWS(h,n,q) V_DrawPaddedTallNum(SCX(hudinfo[h+!!r_splitscreen].x), SCY(hudinfo[h+!!r_splitscreen].y), V_NOSCALESTART|V_HUDTRANS, n, q) +#define ST_DrawPatchFromHudWS(h,p) V_DrawScaledPatch(SCX(hudinfo[h+!!r_splitscreen].x), SCY(hudinfo[h+!!r_splitscreen].y), V_NOSCALESTART|V_HUDTRANS, p) /* // Draw a number, scaled, over the view, maybe with set translucency @@ -757,7 +757,7 @@ static void ST_drawLevelTitle(void) INT32 dupcalc = (vid.width/vid.dupx); UINT8 gtc = G_GetGametypeColor(gametype); INT32 sub = 0; - INT32 bary = (splitscreen) + INT32 bary = (r_splitscreen) ? BASEVIDHEIGHT/2 : 163; INT32 lvlw; @@ -1910,12 +1910,12 @@ static void ST_overlayDrawer(void) else if (!demo.title) { - if (!splitscreen) + if (!r_splitscreen) { V_DrawCenteredString((BASEVIDWIDTH/2), BASEVIDHEIGHT-40, V_HUDTRANSHALF, M_GetText("Viewpoint:")); V_DrawCenteredString((BASEVIDWIDTH/2), BASEVIDHEIGHT-32, V_HUDTRANSHALF|V_ALLOWLOWERCASE, player_names[stplyr-players]); } - else if (splitscreen == 1) + else if (r_splitscreen == 1) { char name[MAXPLAYERNAME+12]; @@ -1923,7 +1923,7 @@ static void ST_overlayDrawer(void) sprintf(name, "VIEWPOINT: %s", player_names[stplyr-players]); V_DrawRightAlignedThinString(BASEVIDWIDTH-40, y, V_HUDTRANSHALF|V_ALLOWLOWERCASE|K_calcSplitFlags(V_SNAPTOTOP|V_SNAPTOBOTTOM|V_SNAPTORIGHT), name); } - else if (splitscreen) + else if (r_splitscreen) { V_DrawCenteredThinString((vid.width/vid.dupx)/4, BASEVIDHEIGHT/2 - 12, V_HUDTRANSHALF|V_ALLOWLOWERCASE|K_calcSplitFlags(V_SNAPTOBOTTOM|V_SNAPTOLEFT), player_names[stplyr-players]); } @@ -1998,7 +1998,7 @@ static void ST_overlayDrawer(void) } // SRB2kart: changed positions & text - if (splitscreen) + if (r_splitscreen) { INT32 splitflags = K_calcSplitFlags(0); V_DrawThinString(2, (BASEVIDHEIGHT/2)-20, V_YELLOWMAP|V_HUDTRANSHALF|splitflags, M_GetText("- SPECTATING -")); @@ -2089,7 +2089,7 @@ void ST_Drawer(void) UINT8 i; #ifdef SEENAMES - if (cv_seenames.value && cv_allowseenames.value && displayplayers[0] == consoleplayer && seenplayer && seenplayer->mo && !mapreset) + if (cv_seenames.value && cv_allowseenames.value && displayplayers[localdisplayplayers[0]] == consoleplayer && seenplayer && seenplayer->mo && !mapreset) { if (cv_seenames.value == 1) V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT/2 + 15, V_HUDTRANSHALF, player_names[seenplayer-players]); @@ -2123,7 +2123,7 @@ void ST_Drawer(void) if (st_overlay) { // No deadview! - for (i = 0; i <= splitscreen; i++) + for (i = 0; i <= r_splitscreen; i++) { stplyr = &players[displayplayers[i]]; ST_overlayDrawer(); diff --git a/src/v_video.c b/src/v_video.c index 297eae9c4..55e8e7b90 100644 --- a/src/v_video.c +++ b/src/v_video.c @@ -2503,15 +2503,15 @@ void V_DoPostProcessor(INT32 view, postimg_t type, INT32 param) return; #endif - if (view < 0 || view > 3 || view > splitscreen) + if (view < 0 || view > 3 || view > r_splitscreen) return; - if ((view == 1 && splitscreen == 1) || view >= 2) + if ((view == 1 && r_splitscreen == 1) || view >= 2) yoffset = viewheight; else yoffset = 0; - if ((view == 1 || view == 3) && splitscreen > 1) + if ((view == 1 || view == 3) && r_splitscreen > 1) xoffset = viewwidth; else xoffset = 0; diff --git a/src/y_inter.c b/src/y_inter.c index f5380d565..e27289b87 100644 --- a/src/y_inter.c +++ b/src/y_inter.c @@ -366,7 +366,7 @@ void Y_IntermissionDrawer(void) if (usebuffer) // Fade everything out V_DrawFadeScreen(0xFF00, 22); - if (!splitscreen) + if (!r_splitscreen) whiteplayer = demo.playback ? displayplayers[0] : consoleplayer; if (cons_menuhighlight.value) @@ -1263,19 +1263,19 @@ void Y_VoteDrawer(void) { case 1: thiscurs = cursor2; - p = displayplayers[1]; + p = displayplayers[localdisplayplayers[1]]; break; case 2: thiscurs = cursor3; - p = displayplayers[2]; + p = displayplayers[localdisplayplayers[2]]; break; case 3: thiscurs = cursor4; - p = displayplayers[3]; + p = displayplayers[localdisplayplayers[3]]; break; default: thiscurs = cursor1; - p = displayplayers[0]; + p = displayplayers[localdisplayplayers[0]]; break; } @@ -1563,13 +1563,13 @@ void Y_VoteTicker(void) switch (i) { case 1: - p = displayplayers[1]; + p = displayplayers[localdisplayplayers[1]]; break; case 2: - p = displayplayers[2]; + p = displayplayers[localdisplayplayers[2]]; break; case 3: - p = displayplayers[3]; + p = displayplayers[localdisplayplayers[3]]; break; default: p = consoleplayer;