From 349b27e0de0cfcad04bc67f0ae2c1200a01a3924 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Mon, 18 Dec 2017 20:59:04 -0500 Subject: [PATCH] Change splitscreen into UINT8, fix HUD slightly more --- src/d_clisrv.c | 67 ++++---- src/d_clisrv.h | 4 +- src/d_main.c | 26 ++- src/d_net.h | 4 +- src/d_netcmd.c | 38 ++--- src/dehacked.c | 8 +- src/doomstat.h | 4 +- src/g_game.c | 114 ++++++------- src/hardware/hw_defs.h | 2 +- src/hardware/hw_main.c | 104 ++++------- src/hardware/r_opengl/r_opengl.c | 8 +- src/hu_stuff.c | 2 +- src/k_kart.c | 284 +++++++++++-------------------- src/lua_hudlib.c | 6 +- src/m_menu.c | 31 +--- src/p_enemy.c | 2 +- src/p_floor.c | 6 +- src/p_inter.c | 12 +- src/p_mobj.c | 30 ++-- src/p_setup.c | 48 +++--- src/p_spec.c | 12 +- src/p_telept.c | 12 +- src/p_user.c | 54 +++--- src/r_bsp.c | 6 +- src/r_draw.c | 2 +- src/r_main.c | 75 ++++---- src/r_plane.c | 8 +- src/s_sound.c | 78 ++++----- src/st_stuff.c | 67 ++++---- src/v_video.c | 9 +- 30 files changed, 474 insertions(+), 649 deletions(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 4b47d4a5..cfe05dec 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -95,8 +95,8 @@ UINT32 playerpingtable[MAXPLAYERS]; //table of player latency values. #endif SINT8 nodetoplayer[MAXNETNODES]; SINT8 nodetoplayer2[MAXNETNODES]; // say the numplayer for this node if any (splitscreen) -SINT8 nodetoplayer3[MAXNETNODES]; // say the numplayer for this node if any (splitscreen3) -SINT8 nodetoplayer4[MAXNETNODES]; // say the numplayer for this node if any (splitscreen4) +SINT8 nodetoplayer3[MAXNETNODES]; // say the numplayer for this node if any (splitscreen == 2) +SINT8 nodetoplayer4[MAXNETNODES]; // say the numplayer for this node if any (splitscreen == 3) UINT8 playerpernode[MAXNETNODES]; // used specialy for splitscreen boolean nodeingame[MAXNETNODES]; // set false as nodes leave game static tic_t nettics[MAXNETNODES]; // what tic the client have received @@ -129,8 +129,8 @@ static UINT8 mynode; // my address pointofview server static UINT8 localtextcmd[MAXTEXTCMD]; static UINT8 localtextcmd2[MAXTEXTCMD]; // splitscreen -static UINT8 localtextcmd3[MAXTEXTCMD]; // splitscreen3 -static UINT8 localtextcmd4[MAXTEXTCMD]; // splitscreen4 +static UINT8 localtextcmd3[MAXTEXTCMD]; // splitscreen == 2 +static UINT8 localtextcmd4[MAXTEXTCMD]; // splitscreen == 3 static tic_t neededtic; SINT8 servernode = 0; // the number of the server node /// \brief do we accept new players? @@ -1254,11 +1254,9 @@ static boolean CL_SendJoin(void) CONS_Printf(M_GetText("Sending join request...\n")); netbuffer->packettype = PT_CLIENTJOIN; - if ((splitscreen || splitscreen3 || splitscreen4) || botingame) - localplayers++; - if (splitscreen3 || splitscreen4) - localplayers++; - if (splitscreen4) + if (splitscreen) + localplayers += splitscreen; + else if (botingame) localplayers++; netbuffer->u.clientcfg.localplayers = localplayers; @@ -2357,7 +2355,7 @@ static void Command_connect(void) CONS_Alert(CONS_ERROR, M_GetText("There is no network driver\n")); } - splitscreen = splitscreen3 = splitscreen4 = false; + splitscreen = 0; SplitScreen_OnChange(); botingame = false; botskin = 0; @@ -3133,7 +3131,7 @@ static void Got_AddPlayer(UINT8 **p, INT32 playernum) // Clear player before joining, lest some things get set incorrectly // HACK: don't do this for splitscreen, it relies on preset values - if (!(splitscreen || splitscreen3 || splitscreen4) && !botingame) + if (!splitscreen && !botingame) CL_ClearPlayer(newplayernum); playeringame[newplayernum] = true; G_AddPlayer(newplayernum); @@ -3228,7 +3226,7 @@ static boolean SV_AddWaitingPlayers(void) for (node = 0; node < MAXNETNODES; node++) { - // splitscreen can allow 2 player in one node + // splitscreen can allow 2+ players in one node for (; nodewaiting[node] > 0; nodewaiting[node]--) { newplayer = true; @@ -3371,7 +3369,7 @@ void SV_StartSinglePlayerServer(void) // no more tic the game with this settings! SV_StopServer(); - if (splitscreen || splitscreen3 || splitscreen4) + if (splitscreen) multiplayer = true; } @@ -4381,22 +4379,21 @@ static void CL_SendClientCmd(void) { netbuffer->packettype += 2; G_MoveTiccmd(&netbuffer->u.client2pak.cmd2, &localcmds2, 1); - packetsize = sizeof (client2cmd_pak); - } - else if (splitscreen3) - { - netbuffer->packettype += 4; - G_MoveTiccmd(&netbuffer->u.client2pak.cmd2, &localcmds2, 1); - G_MoveTiccmd(&netbuffer->u.client3pak.cmd3, &localcmds3, 1); - packetsize = sizeof (client3cmd_pak); - } - else if (splitscreen4) - { - netbuffer->packettype += 6; - G_MoveTiccmd(&netbuffer->u.client2pak.cmd2, &localcmds2, 1); - G_MoveTiccmd(&netbuffer->u.client3pak.cmd3, &localcmds3, 1); - G_MoveTiccmd(&netbuffer->u.client4pak.cmd4, &localcmds4, 1); - packetsize = sizeof (client4cmd_pak); + if (splitscreen > 1) + { + netbuffer->packettype += 2; + G_MoveTiccmd(&netbuffer->u.client3pak.cmd3, &localcmds3, 1); + if (splitscreen > 2) + { + netbuffer->packettype += 2; + G_MoveTiccmd(&netbuffer->u.client4pak.cmd4, &localcmds4, 1); + packetsize = sizeof (client4cmd_pak); + } + else + packetsize = sizeof (client3cmd_pak); + } + else + packetsize = sizeof (client2cmd_pak); } else packetsize = sizeof (clientcmd_pak); @@ -4416,7 +4413,7 @@ static void CL_SendClientCmd(void) localtextcmd[0] = 0; } - // Send extra data if needed for player 2 (splitscreen) + // Send extra data if needed for player 2 (splitscreen == 1) if (localtextcmd2[0]) { netbuffer->packettype = PT_TEXTCMD2; @@ -4426,7 +4423,7 @@ static void CL_SendClientCmd(void) localtextcmd2[0] = 0; } - // Send extra data if needed for player 3 (splitscreen3) + // Send extra data if needed for player 3 (splitscreen == 2) if (localtextcmd3[0]) { netbuffer->packettype = PT_TEXTCMD3; @@ -4436,7 +4433,7 @@ static void CL_SendClientCmd(void) localtextcmd3[0] = 0; } - // Send extra data if needed for player 4 (splitscreen4) + // Send extra data if needed for player 4 (splitscreen == 3) if (localtextcmd4[0]) { netbuffer->packettype = PT_TEXTCMD4; @@ -4576,13 +4573,13 @@ static void Local_Maketic(INT32 realtics) if (!dedicated) rendergametic = gametic; // translate inputs (keyboard/mouse/joystick) into game controls G_BuildTiccmd(&localcmds, realtics, 1); - if ((splitscreen || splitscreen3 || splitscreen4) || botingame) + if (splitscreen || botingame) { G_BuildTiccmd(&localcmds2, realtics, 2); - if (splitscreen3 || splitscreen4) + if (splitscreen > 1) { G_BuildTiccmd(&localcmds3, realtics, 3); - if (splitscreen4) + if (splitscreen > 2) G_BuildTiccmd(&localcmds4, realtics, 4); } } diff --git a/src/d_clisrv.h b/src/d_clisrv.h index bc902ac5..2d49bd61 100644 --- a/src/d_clisrv.h +++ b/src/d_clisrv.h @@ -113,7 +113,7 @@ typedef struct ticcmd_t cmd, cmd2; } ATTRPACK client2cmd_pak; -// Splitscreen3 packet +// 3P Splitscreen packet // WARNING: must have the same format of clientcmd_pak, for more easy use typedef struct { @@ -123,7 +123,7 @@ typedef struct ticcmd_t cmd, cmd2, cmd3; } ATTRPACK client3cmd_pak; -// Splitscreen4 packet +// 4P Splitscreen packet // WARNING: must have the same format of clientcmd_pak, for more easy use typedef struct { diff --git a/src/d_main.c b/src/d_main.c index aae7cd74..f63e23ef 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -404,7 +404,7 @@ static void D_Display(void) } // render the second screen - if ((splitscreen || splitscreen3 || splitscreen4) && players[secondarydisplayplayer].mo) + if (splitscreen && players[secondarydisplayplayer].mo) { #ifdef HWRENDER if (rendermode != render_soft) @@ -413,7 +413,7 @@ static void D_Display(void) #endif if (rendermode != render_none) { - if (splitscreen3 || splitscreen4) + if (splitscreen > 1) { viewwindowx = viewwidth; viewwindowy = 0; @@ -436,7 +436,7 @@ static void D_Display(void) } // render the third screen - if ((splitscreen3 || splitscreen4) && players[thirddisplayplayer].mo) + if (splitscreen > 1 && players[thirddisplayplayer].mo) { #ifdef HWRENDER if (rendermode != render_soft) @@ -458,9 +458,7 @@ static void D_Display(void) } } - //if (splitscreen3) // Fill up the fourth screen in 3P mode so you aren't gazing into the abyss :V - //V_DrawFill(viewwidth, viewheight, viewwidth, viewheight, 31); - if (splitscreen4 && players[fourthdisplayplayer].mo) // render the fourth screen + if (splitscreen > 2 && players[fourthdisplayplayer].mo) // render the fourth screen { #ifdef HWRENDER if (rendermode != render_soft) @@ -695,14 +693,14 @@ void D_SRB2Loop(void) // Lagless camera! Yay! if (gamestate == GS_LEVEL && netgame) { - if ((splitscreen || splitscreen3 || splitscreen4) && camera2.chase) - P_MoveChaseCamera(&players[secondarydisplayplayer], &camera2, false); - if ((splitscreen3 || splitscreen4) && camera3.chase) - P_MoveChaseCamera(&players[thirddisplayplayer], &camera3, false); - if (splitscreen4 && camera4.chase) - P_MoveChaseCamera(&players[fourthdisplayplayer], &camera4, false); if (camera.chase) P_MoveChaseCamera(&players[displayplayer], &camera, false); + if (splitscreen && camera2.chase) + P_MoveChaseCamera(&players[secondarydisplayplayer], &camera2, false); + if (splitscreen > 1 && camera3.chase) + P_MoveChaseCamera(&players[thirddisplayplayer], &camera3, false); + if (splitscreen > 2 && camera4.chase) + P_MoveChaseCamera(&players[fourthdisplayplayer], &camera4, false); } D_Display(); @@ -776,9 +774,7 @@ void D_StartTitle(void) for (i = 0; i < MAXPLAYERS; i++) CL_ClearPlayer(i); - splitscreen = false; - splitscreen3 = false; - splitscreen4 = false; + splitscreen = 0; SplitScreen_OnChange(); botingame = false; botskin = 0; diff --git a/src/d_net.h b/src/d_net.h index 45fd8683..f6544ab2 100644 --- a/src/d_net.h +++ b/src/d_net.h @@ -36,8 +36,8 @@ extern INT64 sendbytes; // Realtime updated extern SINT8 nodetoplayer[MAXNETNODES]; extern SINT8 nodetoplayer2[MAXNETNODES]; // Say the numplayer for this node if any (splitscreen) -extern SINT8 nodetoplayer3[MAXNETNODES]; // Say the numplayer for this node if any (splitscreen3) -extern SINT8 nodetoplayer4[MAXNETNODES]; // Say the numplayer for this node if any (splitscreen4) +extern SINT8 nodetoplayer3[MAXNETNODES]; // Say the numplayer for this node if any (splitscreen == 2) +extern SINT8 nodetoplayer4[MAXNETNODES]; // Say the numplayer for this node if any (splitscreen == 3) extern UINT8 playerpernode[MAXNETNODES]; // Used specially for splitscreen extern boolean nodeingame[MAXNETNODES]; // Set false as nodes leave game diff --git a/src/d_netcmd.c b/src/d_netcmd.c index bc5d90a1..3aca3b2a 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -433,9 +433,7 @@ consvar_t cv_mute = {"mute", "Off", CV_NETVAR|CV_CALL, CV_OnOff, Mute_OnChange, consvar_t cv_sleep = {"cpusleep", "-1", CV_SAVE, sleeping_cons_t, NULL, -1, NULL, NULL, 0, 0, NULL}; INT16 gametype = GT_RACE; // SRB2kart -boolean splitscreen = false; -boolean splitscreen3 = false; -boolean splitscreen4 = false; +UINT8 splitscreen = 0; boolean circuitmap = true; // SRB2kart INT32 adminplayers[MAXPLAYERS]; @@ -1306,7 +1304,7 @@ static void SendNameAndColor2(void) { INT32 secondplaya; - if (!(splitscreen || splitscreen3 || splitscreen4) && !botingame) + if (!splitscreen && !botingame) return; // can happen if skin2/color2/name2 changed if (secondarydisplayplayer != consoleplayer) @@ -1403,7 +1401,7 @@ static void SendNameAndColor3(void) { INT32 thirdplaya; - if (!(splitscreen3 || splitscreen4)) + if (splitscreen < 2) return; // can happen if skin3/color3/name3 changed if (thirddisplayplayer != consoleplayer) @@ -1492,7 +1490,7 @@ static void SendNameAndColor4(void) { INT32 fourthplaya; - if (!splitscreen4) + if (splitscreen < 3) return; // can happen if skin4/color4/name4 changed if (fourthdisplayplayer != consoleplayer) @@ -1735,18 +1733,18 @@ static void Got_WeaponPref(UINT8 **cp,INT32 playernum) void D_SendPlayerConfig(void) { SendNameAndColor(); - if ((splitscreen || splitscreen3 || splitscreen4) || botingame) + if (splitscreen || botingame) SendNameAndColor2(); - if (splitscreen3 || splitscreen4) + if (splitscreen > 1) SendNameAndColor3(); - if (splitscreen4) + if (splitscreen > 2) SendNameAndColor4(); SendWeaponPref(); - if (splitscreen || splitscreen3 || splitscreen4) + if (splitscreen) SendWeaponPref2(); - if (splitscreen3 || splitscreen4) + if (splitscreen > 1) SendWeaponPref3(); - if (splitscreen4) + if (splitscreen > 2) SendWeaponPref4(); } @@ -4383,9 +4381,7 @@ void Command_ExitGame_f(void) for (i = 0; i < MAXPLAYERS; i++) CL_ClearPlayer(i); - splitscreen = false; - splitscreen3 = false; - splitscreen4 = false; + splitscreen = 0; SplitScreen_OnChange(); botingame = false; botskin = 0; @@ -4634,7 +4630,7 @@ static void Skin_OnChange(void) */ static void Skin2_OnChange(void) { - if (!Playing() || !(splitscreen || splitscreen3 || splitscreen4)) + if (!Playing() || !splitscreen) return; // do whatever you want if (CanChangeSkin(secondarydisplayplayer) && !P_PlayerMoving(secondarydisplayplayer)) @@ -4648,7 +4644,7 @@ static void Skin2_OnChange(void) static void Skin3_OnChange(void) { - if (!Playing() || !(splitscreen3 || splitscreen4)) + if (!Playing() || splitscreen < 2) return; // do whatever you want if (CanChangeSkin(thirddisplayplayer) && !P_PlayerMoving(thirddisplayplayer)) @@ -4662,7 +4658,7 @@ static void Skin3_OnChange(void) static void Skin4_OnChange(void) { - if (!Playing() || !splitscreen4) + if (!Playing() || splitscreen < 3) return; // do whatever you want if (CanChangeSkin(fourthdisplayplayer) && !P_PlayerMoving(fourthdisplayplayer)) @@ -4708,7 +4704,7 @@ static void Color_OnChange(void) */ static void Color2_OnChange(void) { - if (!Playing() || !(splitscreen || splitscreen3 || splitscreen4)) + if (!Playing() || !splitscreen) return; // do whatever you want if (!P_PlayerMoving(secondarydisplayplayer)) @@ -4725,7 +4721,7 @@ static void Color2_OnChange(void) static void Color3_OnChange(void) { - if (!Playing() || !(splitscreen3 || splitscreen4)) + if (!Playing() || splitscreen < 2) return; // do whatever you want if (!P_PlayerMoving(thirddisplayplayer)) @@ -4742,7 +4738,7 @@ static void Color3_OnChange(void) static void Color4_OnChange(void) { - if (!Playing() || !splitscreen4) + if (!Playing() || splitscreen < 3) return; // do whatever you want if (!P_PlayerMoving(fourthdisplayplayer)) diff --git a/src/dehacked.c b/src/dehacked.c index b67ad454..93308fda 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -8756,13 +8756,7 @@ static inline int lib_getenum(lua_State *L) lua_pushboolean(L, modeattacking); return 1; } else if (fastcmp(word,"splitscreen")) { - lua_pushboolean(L, splitscreen); - return 1; - } else if (fastcmp(word,"splitscreen3")) { - lua_pushboolean(L, splitscreen3); - return 1; - } else if (fastcmp(word,"splitscreen4")) { - lua_pushboolean(L, splitscreen4); + lua_pushinteger(L, splitscreen); return 1; } else if (fastcmp(word,"gamecomplete")) { lua_pushboolean(L, gamecomplete); diff --git a/src/doomstat.h b/src/doomstat.h index e225c810..ad0ea996 100644 --- a/src/doomstat.h +++ b/src/doomstat.h @@ -77,9 +77,7 @@ extern boolean addedtogame; // true after the server has added you extern boolean multiplayer; extern INT16 gametype; -extern boolean splitscreen; -extern boolean splitscreen3; -extern boolean splitscreen4; +extern UINT8 splitscreen; extern boolean circuitmap; // Does this level have 'circuit mode'? extern boolean fromlevelselect; diff --git a/src/g_game.c b/src/g_game.c index c1579725..cf1e0a21 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -1703,7 +1703,7 @@ static void Analog_OnChange(void) static void Analog2_OnChange(void) { - if (!((splitscreen || splitscreen3 || splitscreen4) || botingame) || !cv_cam2_dist.string) + if (!(splitscreen || botingame) || !cv_cam2_dist.string) return; // cameras are not initialized at this point @@ -1723,7 +1723,7 @@ static void Analog2_OnChange(void) static void Analog3_OnChange(void) { - if (!(splitscreen3 || splitscreen4) || !cv_cam3_dist.string) + if (splitscreen < 2 || !cv_cam3_dist.string) return; // cameras are not initialized at this point @@ -1743,7 +1743,7 @@ static void Analog3_OnChange(void) static void Analog4_OnChange(void) { - if (!(splitscreen4) || !cv_cam4_dist.string) + if (splitscreen < 3 || !cv_cam4_dist.string) return; // cameras are not initialized at this point @@ -1799,11 +1799,11 @@ void G_DoLoadLevel(boolean resetplayer) P_FindEmerald(); displayplayer = consoleplayer; // view the guy you are playing - if (!(splitscreen || splitscreen3 || splitscreen4) && !botingame) + if (!splitscreen && !botingame) secondarydisplayplayer = consoleplayer; - if (!(splitscreen3 || splitscreen4)) + if (splitscreen < 2) thirddisplayplayer = consoleplayer; - if (!splitscreen4) + if (splitscreen < 3) fourthdisplayplayer = consoleplayer; gameaction = ga_nothing; @@ -1813,11 +1813,11 @@ void G_DoLoadLevel(boolean resetplayer) if (camera.chase) P_ResetCamera(&players[displayplayer], &camera); - if (camera2.chase && (splitscreen || splitscreen3 || splitscreen4)) + if (camera2.chase && splitscreen) P_ResetCamera(&players[secondarydisplayplayer], &camera2); - if (camera3.chase && (splitscreen3 || splitscreen4)) + if (camera3.chase && splitscreen > 1) P_ResetCamera(&players[thirddisplayplayer], &camera3); - if (camera4.chase && splitscreen4) + if (camera4.chase && splitscreen > 2) P_ResetCamera(&players[fourthdisplayplayer], &camera4); // clear cmd building stuff @@ -1848,7 +1848,7 @@ boolean G_Responder(event_t *ev) // allow spy mode changes even during the demo if (gamestate == GS_LEVEL && ev->type == ev_keydown && ev->data1 == KEY_F12) { - if ((splitscreen || splitscreen3 || splitscreen4) || !netgame) + if (splitscreen || !netgame) displayplayer = consoleplayer; else { @@ -2595,18 +2595,18 @@ void G_SpawnPlayer(INT32 playernum, boolean starpost) if (nummapthings) { if (playernum == consoleplayer - || ((splitscreen || splitscreen3 || splitscreen4) && playernum == secondarydisplayplayer) - || ((splitscreen3 || splitscreen4) && playernum == thirddisplayplayer) - || (splitscreen4 && playernum == fourthdisplayplayer)) + || (splitscreen && playernum == secondarydisplayplayer) + || (splitscreen > 1 && playernum == thirddisplayplayer) + || (splitscreen > 2 && playernum == fourthdisplayplayer)) CONS_Alert(CONS_ERROR, M_GetText("No player spawns found, spawning at the first mapthing!\n")); spawnpoint = &mapthings[0]; } else { if (playernum == consoleplayer - || ((splitscreen || splitscreen3 || splitscreen4) && playernum == secondarydisplayplayer) - || ((splitscreen3 || splitscreen4) && playernum == thirddisplayplayer) - || (splitscreen4 && playernum == fourthdisplayplayer)) + || (splitscreen && playernum == secondarydisplayplayer) + || (splitscreen > 1 && playernum == thirddisplayplayer) + || (splitscreen > 2 && playernum == fourthdisplayplayer)) 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. } @@ -2626,9 +2626,9 @@ mapthing_t *G_FindCTFStart(INT32 playernum) if (!numredctfstarts && !numbluectfstarts) //why even bother, eh? { if (playernum == consoleplayer - || ((splitscreen || splitscreen3 || splitscreen4) && playernum == secondarydisplayplayer) - || ((splitscreen3 || splitscreen4) && playernum == thirddisplayplayer) - || (splitscreen4 && playernum == fourthdisplayplayer)) + || (splitscreen && playernum == secondarydisplayplayer) + || (splitscreen > 1 && playernum == thirddisplayplayer) + || (splitscreen > 2 && playernum == fourthdisplayplayer)) CONS_Alert(CONS_WARNING, M_GetText("No CTF starts in this map!\n")); return NULL; } @@ -2638,9 +2638,9 @@ mapthing_t *G_FindCTFStart(INT32 playernum) if (!numredctfstarts) { if (playernum == consoleplayer - || ((splitscreen || splitscreen3 || splitscreen4) && playernum == secondarydisplayplayer) - || ((splitscreen3 || splitscreen4) && playernum == thirddisplayplayer) - || (splitscreen4 && playernum == fourthdisplayplayer)) + || (splitscreen && playernum == secondarydisplayplayer) + || (splitscreen > 1 && playernum == thirddisplayplayer) + || (splitscreen > 2 && playernum == fourthdisplayplayer)) CONS_Alert(CONS_WARNING, M_GetText("No Red Team starts in this map!\n")); return NULL; } @@ -2653,9 +2653,9 @@ mapthing_t *G_FindCTFStart(INT32 playernum) } if (playernum == consoleplayer - || ((splitscreen || splitscreen3 || splitscreen4) && playernum == secondarydisplayplayer) - || ((splitscreen3 || splitscreen4) && playernum == thirddisplayplayer) - || (splitscreen4 && playernum == fourthdisplayplayer)) + || (splitscreen && playernum == secondarydisplayplayer) + || (splitscreen > 1 && playernum == thirddisplayplayer) + || (splitscreen > 2 && playernum == fourthdisplayplayer)) CONS_Alert(CONS_WARNING, M_GetText("Could not spawn at any Red Team starts!\n")); return NULL; } @@ -2664,9 +2664,9 @@ mapthing_t *G_FindCTFStart(INT32 playernum) if (!numbluectfstarts) { if (playernum == consoleplayer - || ((splitscreen || splitscreen3 || splitscreen4) && playernum == secondarydisplayplayer) - || ((splitscreen3 || splitscreen4) && playernum == thirddisplayplayer) - || (splitscreen4 && playernum == fourthdisplayplayer)) + || (splitscreen && playernum == secondarydisplayplayer) + || (splitscreen > 1 && playernum == thirddisplayplayer) + || (splitscreen > 2 && playernum == fourthdisplayplayer)) CONS_Alert(CONS_WARNING, M_GetText("No Blue Team starts in this map!\n")); return NULL; } @@ -2678,9 +2678,9 @@ mapthing_t *G_FindCTFStart(INT32 playernum) return bluectfstarts[i]; } if (playernum == consoleplayer - || ((splitscreen || splitscreen3 || splitscreen4) && playernum == secondarydisplayplayer) - || ((splitscreen3 || splitscreen4) && playernum == thirddisplayplayer) - || (splitscreen4 && playernum == fourthdisplayplayer)) + || (splitscreen && playernum == secondarydisplayplayer) + || (splitscreen > 1 && playernum == thirddisplayplayer) + || (splitscreen > 2 && playernum == fourthdisplayplayer)) CONS_Alert(CONS_WARNING, M_GetText("Could not spawn at any Blue Team starts!\n")); return NULL; } @@ -2701,17 +2701,17 @@ mapthing_t *G_FindMatchStart(INT32 playernum) return deathmatchstarts[i]; } if (playernum == consoleplayer - || ((splitscreen || splitscreen3 || splitscreen4) && playernum == secondarydisplayplayer) - || ((splitscreen3 || splitscreen4) && playernum == thirddisplayplayer) - || (splitscreen4 && playernum == fourthdisplayplayer)) + || (splitscreen && playernum == secondarydisplayplayer) + || (splitscreen > 1 && playernum == thirddisplayplayer) + || (splitscreen > 2 && playernum == fourthdisplayplayer)) CONS_Alert(CONS_WARNING, M_GetText("Could not spawn at any Deathmatch starts!\n")); return NULL; } if (playernum == consoleplayer - || ((splitscreen || splitscreen3 || splitscreen4) && playernum == secondarydisplayplayer) - || ((splitscreen3 || splitscreen4) && playernum == thirddisplayplayer) - || (splitscreen4 && playernum == fourthdisplayplayer)) + || (splitscreen && playernum == secondarydisplayplayer) + || (splitscreen > 1 && playernum == thirddisplayplayer) + || (splitscreen > 2 && playernum == fourthdisplayplayer)) CONS_Alert(CONS_WARNING, M_GetText("No Deathmatch starts in this map!\n")); return NULL; } @@ -2730,9 +2730,9 @@ mapthing_t *G_FindCoopStart(INT32 playernum) } if (playernum == consoleplayer - || ((splitscreen || splitscreen3 || splitscreen4) && playernum == secondarydisplayplayer) - || ((splitscreen3 || splitscreen4) && playernum == thirddisplayplayer) - || (splitscreen4 && playernum == fourthdisplayplayer)) + || (splitscreen && playernum == secondarydisplayplayer) + || (splitscreen > 1 && playernum == thirddisplayplayer) + || (splitscreen > 2 && playernum == fourthdisplayplayer)) CONS_Alert(CONS_WARNING, M_GetText("No Co-op starts in this map!\n")); return NULL; } @@ -2829,11 +2829,11 @@ void G_DoReborn(INT32 playernum) if (camera.chase) P_ResetCamera(&players[displayplayer], &camera); - if (camera2.chase && (splitscreen || splitscreen3 || splitscreen4)) + if (camera2.chase && splitscreen > 0) P_ResetCamera(&players[secondarydisplayplayer], &camera2); - if (camera3.chase && (splitscreen3 || splitscreen4)) + if (camera3.chase && splitscreen > 1) P_ResetCamera(&players[thirddisplayplayer], &camera3); - if (camera4.chase && splitscreen4) + if (camera4.chase && splitscreen > 2) P_ResetCamera(&players[fourthdisplayplayer], &camera4); // clear cmd building stuff @@ -3645,7 +3645,8 @@ static void M_ForceLoadGameResponse(INT32 ch) cursaveslot = -1; displayplayer = consoleplayer; - multiplayer = splitscreen = splitscreen3 = splitscreen4 = false; + multiplayer = false; + splitscreen = 0; if (setsizeneeded) R_ExecuteSetViewSize(); @@ -3733,7 +3734,8 @@ void G_LoadGame(UINT32 slot, INT16 mapoverride) // gameaction = ga_nothing; // G_SetGamestate(GS_LEVEL); displayplayer = consoleplayer; - multiplayer = splitscreen = splitscreen3 = splitscreen4 = false; + multiplayer = false; + splitscreen = 0; // G_DeferedInitNew(sk_medium, G_BuildMapName(1), 0, 0, 1); if (setsizeneeded) @@ -3816,27 +3818,9 @@ void G_DeferedInitNew(boolean pultmode, const char *mapname, INT32 pickedchar, U botcolor = savedata.botcolor; botingame = (botskin != 0); } - else if (!splitscreen4 && ssplayers == 4) + else if (splitscreen != ssplayers) { - splitscreen4 = true; - splitscreen = splitscreen3 = false; - SplitScreen_OnChange(); - } - else if (!splitscreen3 && ssplayers == 3) - { - splitscreen3 = true; - splitscreen = splitscreen4 = false; - SplitScreen_OnChange(); - } - else if (!splitscreen && ssplayers == 2) - { - splitscreen = true; - splitscreen3 = splitscreen4 = false; - SplitScreen_OnChange(); - } - else if ((splitscreen || splitscreen3 || splitscreen4) && ssplayers == 1) - { - splitscreen = splitscreen3 = splitscreen4 = false; + splitscreen = ssplayers; SplitScreen_OnChange(); } diff --git a/src/hardware/hw_defs.h b/src/hardware/hw_defs.h index 02093955..48029138 100644 --- a/src/hardware/hw_defs.h +++ b/src/hardware/hw_defs.h @@ -107,7 +107,7 @@ typedef struct FLOAT anglex,angley; // aimingangle / viewangle FLOAT scalex,scaley,scalez; FLOAT fovxangle, fovyangle; - INT32 splitscreen; + UINT8 splitscreen; boolean flip; // screenflip boolean mirror; // SRB2Kart: Mirror Mode } FTransform; diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index ae047954..be4fda78 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -4059,18 +4059,12 @@ static void HWR_DrawSpriteShadow(gr_vissprite_t *spr, GLPatch_t *gpatch, float t angle_t shadowdir; // Set direction - if ((splitscreen || splitscreen3 || splitscreen4) && stplyr == &players[secondarydisplayplayer]) - { + if (splitscreen && stplyr == &players[secondarydisplayplayer]) shadowdir = localangle2 + FixedAngle(cv_cam2_rotate.value); - - if ((splitscreen3 || splitscreen4) && stplyr == &players[thirddisplayplayer]) - { - shadowdir = localangle3 + FixedAngle(cv_cam3_rotate.value); - - if (splitscreen4 && stplyr == &players[fourthdisplayplayer]) - shadowdir = localangle4 + FixedAngle(cv_cam4_rotate.value); - } - } + else if (splitscreen > 1 && stplyr == &players[thirddisplayplayer]) + shadowdir = localangle3 + FixedAngle(cv_cam3_rotate.value); + else if (splitscreen > 2 && stplyr == &players[fourthdisplayplayer]) + shadowdir = localangle4 + FixedAngle(cv_cam4_rotate.value); else shadowdir = localangle + FixedAngle(cv_cam_rotate.value); @@ -5516,10 +5510,10 @@ void HWR_SetViewSize(void) gr_viewwidth = (float)vid.width; gr_viewheight = (float)vid.height; - if (splitscreen || splitscreen3 || splitscreen4) + if (splitscreen) gr_viewheight /= 2; - if (splitscreen3 || splitscreen4) + if (splitscreen > 1) gr_viewwidth /= 2; gr_basecenterx = gr_viewwidth / 2; @@ -5544,11 +5538,11 @@ void HWR_RenderSkyboxView(INT32 viewnumber, player_t *player) FTransform stransform; postimg_t *type; - if ((splitscreen || splitscreen3 || splitscreen4) && player == &players[secondarydisplayplayer]) + if (splitscreen && player == &players[secondarydisplayplayer]) type = &postimgtype2; - else if ((splitscreen3 || splitscreen4) && player == &players[thirddisplayplayer]) + else if (splitscreen > 1 && player == &players[thirddisplayplayer]) type = &postimgtype3; - else if (splitscreen4 && player == &players[fourthdisplayplayer]) + else if (splitscreen > 2 && player == &players[fourthdisplayplayer]) type = &postimgtype4; else type = &postimgtype; @@ -5581,13 +5575,13 @@ void HWR_RenderSkyboxView(INT32 viewnumber, player_t *player) gr_viewwindowy = gr_baseviewwindowy; gr_windowcentery = gr_basewindowcentery; - if ((splitscreen && viewnumber == 1) || ((splitscreen3 || splitscreen4) && viewnumber >= 2)) + if ((splitscreen == 1 && viewnumber == 1) || (splitscreen > 1 && viewnumber > 1)) { gr_viewwindowy += gr_viewheight; gr_windowcentery += gr_viewheight; } - if ((splitscreen3 || splitscreen4) && (viewnumber == 1 || viewnumber == 3)) + if (splitscreen > 1 && viewnumber & 1) { gr_viewwindowx += gr_viewwidth; gr_windowcenterx += gr_viewwidth; @@ -5628,15 +5622,7 @@ void HWR_RenderSkyboxView(INT32 viewnumber, player_t *player) atransform.scalez = 1; atransform.fovxangle = fpov; // Tails atransform.fovyangle = fpov; // Tails - - if (splitscreen4) - atransform.splitscreen = 3; - else if (splitscreen3) - atransform.splitscreen = 2; - else if (splitscreen) - atransform.splitscreen = 1; - else - atransform.splitscreen = 0; + atransform.splitscreen = splitscreen; // Transform for sprites stransform.anglex = 0.0f; @@ -5660,15 +5646,7 @@ void HWR_RenderSkyboxView(INT32 viewnumber, player_t *player) stransform.scalez = 1; stransform.fovxangle = 90.0f; stransform.fovyangle = 90.0f; - - if (splitscreen4) - stransform.splitscreen = 3; - else if (splitscreen3) - stransform.splitscreen = 2; - else if (splitscreen) - stransform.splitscreen = 1; - else - stransform.splitscreen = 0; + stransform.splitscreen = splitscreen; gr_fovlud = (float)(1.0l/tan((double)(fpov*M_PIl/360l))); @@ -5691,7 +5669,7 @@ if (0) #endif //Hurdler: it doesn't work in splitscreen mode - drawsky = (splitscreen || splitscreen3 || splitscreen4); + drawsky = splitscreen; HWR_ClearSprites(); @@ -5711,11 +5689,11 @@ if (0) // Make a viewangle int so we can render things based on mouselook if (player == &players[consoleplayer]) viewangle = localaiming; - else if ((splitscreen || splitscreen3 || splitscreen4) && player == &players[secondarydisplayplayer]) + else if (splitscreen && player == &players[secondarydisplayplayer]) viewangle = localaiming2; - else if ((splitscreen3 || splitscreen4) && player == &players[thirddisplayplayer]) + else if (splitscreen > 1 && player == &players[thirddisplayplayer]) viewangle = localaiming3; - else if (splitscreen4 && player == &players[fourthdisplayplayer]) + else if (splitscreen > 2 && player == &players[fourthdisplayplayer]) viewangle = localaiming4; // Handle stuff when you are looking farther up or down. @@ -5807,11 +5785,11 @@ void HWR_RenderPlayerView(INT32 viewnumber, player_t *player) FRGBAFloat ClearColor; - if ((splitscreen || splitscreen3 || splitscreen4) && player == &players[secondarydisplayplayer]) + if (splitscreen && player == &players[secondarydisplayplayer]) type = &postimgtype2; - else if ((splitscreen3 || splitscreen4) && player == &players[thirddisplayplayer]) + else if (splitscreen > 1 && player == &players[thirddisplayplayer]) type = &postimgtype3; - else if (splitscreen4 && player == &players[fourthdisplayplayer]) + else if (splitscreen > 2 && player == &players[fourthdisplayplayer]) type = &postimgtype4; else type = &postimgtype; @@ -5855,13 +5833,13 @@ void HWR_RenderPlayerView(INT32 viewnumber, player_t *player) gr_viewwindowy = gr_baseviewwindowy; gr_windowcentery = gr_basewindowcentery; - if ((splitscreen && viewnumber == 1) || ((splitscreen3 || splitscreen4) && viewnumber >= 2)) + if ((splitscreen == 1 && viewnumber == 1) || (splitscreen > 1 && viewnumber > 1)) { gr_viewwindowy += gr_viewheight; gr_windowcentery += gr_viewheight; } - if ((splitscreen3 || splitscreen4) && (viewnumber == 1 || viewnumber == 3)) + if (splitscreen > 1 && viewnumber & 1) { gr_viewwindowx += gr_viewwidth; gr_windowcenterx += gr_viewwidth; @@ -5902,15 +5880,7 @@ void HWR_RenderPlayerView(INT32 viewnumber, player_t *player) atransform.scalez = 1; atransform.fovxangle = fpov; // Tails atransform.fovyangle = fpov; // Tails - - if (splitscreen4) - atransform.splitscreen = 3; - else if (splitscreen3) - atransform.splitscreen = 2; - else if (splitscreen) - atransform.splitscreen = 1; - else - atransform.splitscreen = 0; + atransform.splitscreen = splitscreen; // Transform for sprites stransform.anglex = 0.0f; @@ -5934,15 +5904,7 @@ void HWR_RenderPlayerView(INT32 viewnumber, player_t *player) stransform.scalez = 1; stransform.fovxangle = 90.0f; stransform.fovyangle = 90.0f; - - if (splitscreen4) - stransform.splitscreen = 3; - else if (splitscreen3) - stransform.splitscreen = 2; - else if (splitscreen) - stransform.splitscreen = 1; - else - stransform.splitscreen = 0; + stransform.splitscreen = splitscreen; gr_fovlud = (float)(1.0l/tan((double)(fpov*M_PIl/360l))); @@ -5965,7 +5927,7 @@ if (0) #endif //Hurdler: it doesn't work in splitscreen mode - drawsky = (splitscreen || splitscreen3 || splitscreen4); + drawsky = splitscreen; HWR_ClearSprites(); @@ -5985,11 +5947,11 @@ if (0) // Make a viewangle int so we can render things based on mouselook if (player == &players[consoleplayer]) viewangle = localaiming; - else if ((splitscreen || splitscreen3 || splitscreen4) && player == &players[secondarydisplayplayer]) + else if (splitscreen && player == &players[secondarydisplayplayer]) viewangle = localaiming2; - else if ((splitscreen3 || splitscreen4) && player == &players[thirddisplayplayer]) + else if (splitscreen > 1 && player == &players[thirddisplayplayer]) viewangle = localaiming3; - else if (splitscreen4 && player == &players[fourthdisplayplayer]) + else if (splitscreen > 2 && player == &players[fourthdisplayplayer]) viewangle = localaiming4; // Handle stuff when you are looking farther up or down. @@ -6477,11 +6439,11 @@ void HWR_DoPostProcessor(player_t *player) { postimg_t *type; - if (splitscreen4 && player == &players[fourthdisplayplayer]) + if (splitscreen > 2 && player == &players[fourthdisplayplayer]) type = &postimgtype4; - else if ((splitscreen3 || splitscreen4) && player == &players[thirddisplayplayer]) + else if (splitscreen > 1 && player == &players[thirddisplayplayer]) type = &postimgtype3; - else if ((splitscreen || splitscreen3 || splitscreen4) && player == &players[secondarydisplayplayer]) + else if (splitscreen && player == &players[secondarydisplayplayer]) type = &postimgtype2; else type = &postimgtype; @@ -6515,7 +6477,7 @@ void HWR_DoPostProcessor(player_t *player) if(gamestate != GS_INTERMISSION) HWD.pfnMakeScreenTexture(); - if (splitscreen || splitscreen3 || splitscreen4) // Not supported in splitscreen - someone want to add support? + if (splitscreen) // Not supported in splitscreen - someone want to add support? return; #ifdef SHUFFLE diff --git a/src/hardware/r_opengl/r_opengl.c b/src/hardware/r_opengl/r_opengl.c index 3fbcf733..39b9c980 100644 --- a/src/hardware/r_opengl/r_opengl.c +++ b/src/hardware/r_opengl/r_opengl.c @@ -2006,7 +2006,7 @@ EXPORT void HWRAPI(DrawMD2) (INT32 *gl_cmd_buffer, md2_frame_t *frame, FTransfor // -----------------+ EXPORT void HWRAPI(SetTransform) (FTransform *stransform) { - static INT32 special_splitscreen; + static boolean special_splitscreen; pglLoadIdentity(); if (stransform) { @@ -2027,8 +2027,8 @@ EXPORT void HWRAPI(SetTransform) (FTransform *stransform) pglMatrixMode(GL_PROJECTION); pglLoadIdentity(); if (stransform->splitscreen == 1 && stransform->fovxangle == 90.0f); - special_splitscreen = stransform->splitscreen; - if (special_splitscreen == 1) + special_splitscreen = true; + if (special_splitscreen) GLPerspective(53.13l, 2*ASPECT_RATIO); // 53.13 = 2*atan(0.5) else GLPerspective(stransform->fovxangle, ASPECT_RATIO); @@ -2043,7 +2043,7 @@ EXPORT void HWRAPI(SetTransform) (FTransform *stransform) pglMatrixMode(GL_PROJECTION); pglLoadIdentity(); - if (special_splitscreen == 1) + if (special_splitscreen) GLPerspective(53.13l, 2*ASPECT_RATIO); // 53.13 = 2*atan(0.5) else //Hurdler: is "fov" correct? diff --git a/src/hu_stuff.c b/src/hu_stuff.c index 22d802c0..ded7e889 100644 --- a/src/hu_stuff.c +++ b/src/hu_stuff.c @@ -1805,7 +1805,7 @@ static void HU_DrawRankings(void) HU_DrawDualTabRankings(32, 32, tab, scorelines, whiteplayer); // draw spectators in a ticker across the bottom - if (!(splitscreen || splitscreen3 || splitscreen4) && G_GametypeHasSpectators()) + if (!splitscreen && G_GametypeHasSpectators()) HU_DrawSpectatorTicker(); } diff --git a/src/k_kart.c b/src/k_kart.c index 177eaecb..2c9ba2cb 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -3551,13 +3551,13 @@ void K_MoveKartPlayer(player_t *player, boolean onground) if (player->kartstuff[k_bootimer] > 0) { if ((player == &players[displayplayer] - || ((splitscreen || splitscreen3 || splitscreen4) && player == &players[secondarydisplayplayer]) - || ((splitscreen3 || splitscreen4) && player == &players[thirddisplayplayer]) - || (splitscreen4 && player == &players[fourthdisplayplayer])) + || (splitscreen && player == &players[secondarydisplayplayer]) + || (splitscreen > 1 && player == &players[thirddisplayplayer]) + || (splitscreen > 2 && player == &players[fourthdisplayplayer])) || (!(player == &players[displayplayer] - || ((splitscreen || splitscreen3 || splitscreen4) && player == &players[secondarydisplayplayer]) - || ((splitscreen3 || splitscreen4) && player == &players[thirddisplayplayer]) - || (splitscreen4 && player == &players[fourthdisplayplayer])) + || (splitscreen && player == &players[secondarydisplayplayer]) + || (splitscreen > 1 && player == &players[thirddisplayplayer]) + || (splitscreen > 2 && player == &players[fourthdisplayplayer])) && (player->kartstuff[k_bootimer] < 1*TICRATE/2 || player->kartstuff[k_bootimer] > bootime-(1*TICRATE/2)))) { if (leveltime & 1) @@ -3704,12 +3704,7 @@ void K_CheckBalloons(void) UINT8 numingame = 0; INT8 winnernum = -1; -// Set to 1 if you need to test comeback in splitscreen -#if 0 - return; -#endif - - if (!(multiplayer || netgame)) + if (!multiplayer) return; if (gametype == GT_RACE) @@ -4098,7 +4093,7 @@ static void K_initKartHUD(void) // CHECK graphic CHEK_Y = BASEVIDHEIGHT; // 200 - if (splitscreen || splitscreen3 || splitscreen4) // Splitscreen + if (splitscreen) // Splitscreen { ITEM_X = 9; ITEM_Y = 24; @@ -4109,7 +4104,7 @@ static void K_initKartHUD(void) POSI_Y = (BASEVIDHEIGHT/2)-56; - if (splitscreen3 || splitscreen4) // 3P/4P Small Splitscreen + if (splitscreen > 1) // 3P/4P Small Splitscreen { ITEM_X = 4; ITEM_Y = 4; @@ -4127,6 +4122,39 @@ static void K_initKartHUD(void) POSI_Y = SCX(POSI_Y);*/ } +static INT32 K_calcSplitFlags(INT32 snapflags) +{ + INT32 splitflags = 0; + + if (!splitscreen) + return snapflags; + + if (stplyr != &players[displayplayer]) + { + if (splitscreen == 1 && stplyr == &players[secondarydisplayplayer]) + splitflags |= V_SPLITSCREEN; + else if (splitscreen > 1) + { + if (stplyr == &players[thirddisplayplayer] || stplyr == &players[fourthdisplayplayer]) + splitflags |= V_SPLITSCREEN; + if (stplyr == &players[secondarydisplayplayer] || stplyr == &players[fourthdisplayplayer]) + splitflags |= V_HORZSCREEN; + } + } + + if (splitflags & V_SPLITSCREEN) + snapflags &= ~V_SNAPTOTOP; + else + snapflags &= ~V_SNAPTOBOTTOM; + + if (splitflags & V_HORZSCREEN) + snapflags &= ~V_SNAPTOLEFT; + else + snapflags &= ~V_SNAPTORIGHT; + + return (splitflags|snapflags); +} + static void K_drawKartItemClose(void) { // ITEM_X = BASEVIDWIDTH-50; // 270 @@ -4136,19 +4164,9 @@ static void K_drawKartItemClose(void) // Set to 'no draw' just in case. patch_t *localpatch = kp_nodraw; - INT32 splitflags = 0; - if (stplyr != &players[displayplayer]) - { - if (splitscreen && stplyr == &players[secondarydisplayplayer]) - splitflags |= V_SPLITSCREEN; - else if (splitscreen3 || splitscreen4) - { - if (stplyr == &players[thirddisplayplayer] || stplyr == &players[fourthdisplayplayer]) - splitflags |= V_SPLITSCREEN; - if (stplyr == &players[secondarydisplayplayer] || stplyr == &players[fourthdisplayplayer]) - splitflags |= V_HORZSCREEN; - } - } + INT32 splitflags = K_calcSplitFlags(V_SNAPTOTOP|V_SNAPTOLEFT); + if (!splitscreen) + splitflags = V_SNAPTOTOP|V_SNAPTORIGHT; /*if () switch (stplyr->kartstuff[k_itemclose]) @@ -4172,7 +4190,7 @@ static void K_drawKartItemClose(void) } if (localpatch != kp_nodraw) - V_DrawScaledPatch(ITEM_X, ITEM_Y, V_SNAPTORIGHT|V_SNAPTOTOP|splitflags, localpatch); + V_DrawScaledPatch(ITEM_X, ITEM_Y, splitflags, localpatch); } void K_drawMinimap(void) @@ -4244,7 +4262,7 @@ void K_drawMinimap(void) } } } - if (!(splitscreen || splitscreen3 || splitscreen4) && maptol & TOL_KART && !hu_showscores) + if (!splitscreen && maptol & TOL_KART && !hu_showscores) HU_DrawRaceRankings(); }*/ ; @@ -4259,19 +4277,10 @@ static void K_drawKartItemRoulette(void) // Set to 'no item' just in case. patch_t *localpatch = kp_nodraw; - INT32 splitflags = 0; - if (stplyr != &players[displayplayer]) - { - if (splitscreen && stplyr == &players[secondarydisplayplayer]) - splitflags |= V_SPLITSCREEN; - else if (splitscreen3 || splitscreen4) - { - if (stplyr == &players[thirddisplayplayer] || stplyr == &players[fourthdisplayplayer]) - splitflags |= V_SPLITSCREEN; - if (stplyr == &players[secondarydisplayplayer] || stplyr == &players[fourthdisplayplayer]) - splitflags |= V_HORZSCREEN; - } - } + INT32 splitflags = K_calcSplitFlags(V_SNAPTOTOP|V_SNAPTOLEFT); + if (!splitscreen) + splitflags = V_SNAPTOTOP|V_SNAPTORIGHT; + /*if () switch(stplyr->kartstuff[k_itemroulette] % 53) { @@ -4323,7 +4332,7 @@ static void K_drawKartItemRoulette(void) default: break; } - V_DrawScaledPatch(ITEM_X, ITEM_Y, V_SNAPTORIGHT|V_SNAPTOTOP|splitflags, localpatch); + V_DrawScaledPatch(ITEM_X, ITEM_Y, splitflags, localpatch); } static void K_drawKartRetroItem(void) @@ -4335,19 +4344,9 @@ static void K_drawKartRetroItem(void) // Set to 'no item' just in case. patch_t *localpatch = kp_nodraw; - INT32 splitflags = 0; - if (stplyr != &players[displayplayer]) - { - if (splitscreen && stplyr == &players[secondarydisplayplayer]) - splitflags |= V_SPLITSCREEN; - else if (splitscreen3 || splitscreen4) - { - if (stplyr == &players[thirddisplayplayer] || stplyr == &players[fourthdisplayplayer]) - splitflags |= V_SPLITSCREEN; - if (stplyr == &players[secondarydisplayplayer] || stplyr == &players[fourthdisplayplayer]) - splitflags |= V_HORZSCREEN; - } - } + INT32 splitflags = K_calcSplitFlags(V_SNAPTOTOP|V_SNAPTOLEFT); + if (!splitscreen) + splitflags = V_SNAPTOTOP|V_SNAPTORIGHT; // I'm doing this a little weird and drawing mostly in reverse order // The only actual reason is to make triple/double/single mushrooms line up this way in the code below @@ -4382,7 +4381,7 @@ static void K_drawKartRetroItem(void) else if (stplyr->kartstuff[k_boo] == 1) localpatch = kp_boo; else if (stplyr->kartstuff[k_magnet] == 1) localpatch = kp_magnet; - V_DrawScaledPatch(ITEM_X, ITEM_Y, V_SNAPTORIGHT|V_SNAPTOTOP|splitflags, localpatch); + V_DrawScaledPatch(ITEM_X, ITEM_Y, splitflags, localpatch); } /* @@ -4490,22 +4489,9 @@ static void K_drawKartTimestamp(void) // TIME_Y = 6; // 6 INT32 TIME_XB; + INT32 splitflags = K_calcSplitFlags(V_SNAPTOTOP|V_SNAPTORIGHT); - INT32 splitflags = 0; - if (stplyr != &players[displayplayer]) - { - if (splitscreen && stplyr == &players[secondarydisplayplayer]) - splitflags |= V_SPLITSCREEN; - else if (splitscreen3 || splitscreen4) - { - if (stplyr == &players[thirddisplayplayer] || stplyr == &players[fourthdisplayplayer]) - splitflags |= V_SPLITSCREEN; - if (stplyr == &players[secondarydisplayplayer] || stplyr == &players[fourthdisplayplayer]) - splitflags |= V_HORZSCREEN; - } - } - - V_DrawScaledPatch(TIME_X, TIME_Y, V_SNAPTOTOP|V_SNAPTORIGHT|splitflags, kp_timestickerwide); + V_DrawScaledPatch(TIME_X, TIME_Y, splitflags, kp_timestickerwide); TIME_XB = TIME_X+33; @@ -4514,44 +4500,44 @@ static void K_drawKartTimestamp(void) // zero minute if (stplyr->realtime/(60*TICRATE) < 10) { - V_DrawKartString(TIME_XB, TIME_Y+3, V_SNAPTOTOP|V_SNAPTORIGHT|splitflags, va("0")); + V_DrawKartString(TIME_XB, TIME_Y+3, splitflags, va("0")); // minutes time 0 __ __ - V_DrawKartString(TIME_XB+12, TIME_Y+3, V_SNAPTOTOP|V_SNAPTORIGHT|splitflags, va("%d", stplyr->realtime/(60*TICRATE))); + V_DrawKartString(TIME_XB+12, TIME_Y+3, splitflags, va("%d", stplyr->realtime/(60*TICRATE))); } // minutes time 0 __ __ else - V_DrawKartString(TIME_XB, TIME_Y+3, V_SNAPTOTOP|V_SNAPTORIGHT|splitflags, va("%d", stplyr->realtime/(60*TICRATE))); + V_DrawKartString(TIME_XB, TIME_Y+3, splitflags, va("%d", stplyr->realtime/(60*TICRATE))); // apostrophe location _'__ __ - V_DrawKartString(TIME_XB+24, TIME_Y+3, V_SNAPTOTOP|V_SNAPTORIGHT|splitflags, va("'")); + V_DrawKartString(TIME_XB+24, TIME_Y+3, splitflags, va("'")); // zero second _ 0_ __ if ((stplyr->realtime/TICRATE % 60) < 10) { - V_DrawKartString(TIME_XB+36, TIME_Y+3, V_SNAPTOTOP|V_SNAPTORIGHT|splitflags, va("0")); + V_DrawKartString(TIME_XB+36, TIME_Y+3, splitflags, va("0")); // seconds time _ _0 __ - V_DrawKartString(TIME_XB+48, TIME_Y+3, V_SNAPTOTOP|V_SNAPTORIGHT|splitflags, va("%d", stplyr->realtime/TICRATE % 60)); + V_DrawKartString(TIME_XB+48, TIME_Y+3, splitflags, va("%d", stplyr->realtime/TICRATE % 60)); } // zero second _ 00 __ else - V_DrawKartString(TIME_XB+36, TIME_Y+3, V_SNAPTOTOP|V_SNAPTORIGHT|splitflags, va("%d", stplyr->realtime/TICRATE % 60)); + V_DrawKartString(TIME_XB+36, TIME_Y+3, splitflags, va("%d", stplyr->realtime/TICRATE % 60)); // quotation mark location _ __"__ - V_DrawKartString(TIME_XB+60, TIME_Y+3, V_SNAPTOTOP|V_SNAPTORIGHT|splitflags, va("\"")); + V_DrawKartString(TIME_XB+60, TIME_Y+3, splitflags, va("\"")); // zero tick _ __ 0_ if (G_TicsToCentiseconds(stplyr->realtime) < 10) { - V_DrawKartString(TIME_XB+72, TIME_Y+3, V_SNAPTOTOP|V_SNAPTORIGHT|splitflags, va("0")); + V_DrawKartString(TIME_XB+72, TIME_Y+3, splitflags, va("0")); // tics _ __ _0 - V_DrawKartString(TIME_XB+84, TIME_Y+3, V_SNAPTOTOP|V_SNAPTORIGHT|splitflags, va("%d", G_TicsToCentiseconds(stplyr->realtime))); + V_DrawKartString(TIME_XB+84, TIME_Y+3, splitflags, va("%d", G_TicsToCentiseconds(stplyr->realtime))); } // zero tick _ __ 00 if (G_TicsToCentiseconds(stplyr->realtime) >= 10) - V_DrawKartString(TIME_XB+72, TIME_Y+3, V_SNAPTOTOP|V_SNAPTORIGHT|splitflags, va("%d", G_TicsToCentiseconds(stplyr->realtime))); + V_DrawKartString(TIME_XB+72, TIME_Y+3, splitflags, va("%d", G_TicsToCentiseconds(stplyr->realtime))); } else - V_DrawKartString(TIME_XB, TIME_Y+3, V_SNAPTORIGHT|V_SNAPTOTOP|splitflags, va("99'59\"99")); + V_DrawKartString(TIME_XB, TIME_Y+3, splitflags, va("99'59\"99")); } static void K_DrawKartPositionNum(INT32 num) @@ -4563,24 +4549,12 @@ static void K_DrawKartPositionNum(INT32 num) INT32 W = SHORT(kp_positionnum[0][0]->width); patch_t *localpatch = kp_positionnum[0][0]; - INT32 splitflags = 0; - if (stplyr != &players[displayplayer]) - { - if (splitscreen && stplyr == &players[secondarydisplayplayer]) - splitflags |= V_SPLITSCREEN; - else if (splitscreen3 || splitscreen4) - { - if (stplyr == &players[thirddisplayplayer] || stplyr == &players[fourthdisplayplayer]) - splitflags |= V_SPLITSCREEN; - if (stplyr == &players[secondarydisplayplayer] || stplyr == &players[fourthdisplayplayer]) - splitflags |= V_HORZSCREEN; - } - } + INT32 splitflags = K_calcSplitFlags(V_SNAPTOBOTTOM|V_SNAPTORIGHT); // Special case for 0 if (!num) { - V_DrawTranslucentPatch(X-W, POSI_Y, V_TRANSLUCENT|V_SNAPTORIGHT|V_SNAPTOBOTTOM|splitflags, kp_positionnum[0][0]); + V_DrawTranslucentPatch(X-W, POSI_Y, V_TRANSLUCENT|splitflags, kp_positionnum[0][0]); return; } @@ -4628,19 +4602,19 @@ static void K_DrawKartPositionNum(INT32 num) switch (leveltime % 9) { case 1: case 2: case 3: - if (stplyr->kartstuff[k_position] >= 4 || (splitscreen && stplyr->kartstuff[k_position] >= 2)) + if (stplyr->kartstuff[k_position] >= 4 || (splitscreen && stplyr->kartstuff[k_position] >= splitscreen+1)) localpatch = kp_positionnum[num % 10][4]; else localpatch = kp_positionnum[num % 10][1]; break; case 4: case 5: case 6: - if (stplyr->kartstuff[k_position] >= 4 || (splitscreen && stplyr->kartstuff[k_position] >= 2)) + if (stplyr->kartstuff[k_position] >= 4 || (splitscreen && stplyr->kartstuff[k_position] >= splitscreen+1)) localpatch = kp_positionnum[num % 10][5]; else localpatch = kp_positionnum[num % 10][2]; break; case 7: case 8: case 9: - if (stplyr->kartstuff[k_position] >= 4 || (splitscreen && stplyr->kartstuff[k_position] >= 2)) + if (stplyr->kartstuff[k_position] >= 4 || (splitscreen && stplyr->kartstuff[k_position] >= splitscreen+1)) localpatch = kp_positionnum[num % 10][6]; else localpatch = kp_positionnum[num % 10][3]; @@ -4653,7 +4627,7 @@ static void K_DrawKartPositionNum(INT32 num) else localpatch = kp_positionnum[num % 10][0]; - V_DrawTranslucentPatch(X, POSI_Y, V_TRANSLUCENT|V_SNAPTORIGHT|V_SNAPTOBOTTOM|splitflags, localpatch); + V_DrawTranslucentPatch(X, POSI_Y, V_TRANSLUCENT|splitflags, localpatch); num /= 10; } } @@ -4798,100 +4772,62 @@ static void K_drawKartPositionFaces(void) static void K_drawKartLaps(void) { - INT32 splitflags = 0; - if (stplyr != &players[displayplayer]) - { - if (splitscreen && stplyr == &players[secondarydisplayplayer]) - splitflags |= V_SPLITSCREEN; - else if (splitscreen3 || splitscreen4) - { - if (stplyr == &players[thirddisplayplayer] || stplyr == &players[fourthdisplayplayer]) - splitflags |= V_SPLITSCREEN; - if (stplyr == &players[secondarydisplayplayer] || stplyr == &players[fourthdisplayplayer]) - splitflags |= V_HORZSCREEN; - } - } + INT32 splitflags = K_calcSplitFlags(V_SNAPTOBOTTOM|V_SNAPTOLEFT); - V_DrawScaledPatch(LAPS_X, LAPS_Y, V_SNAPTOLEFT|V_SNAPTOBOTTOM|splitflags, kp_lapsticker); + V_DrawScaledPatch(LAPS_X, LAPS_Y, splitflags, kp_lapsticker); if (stplyr->exiting) - V_DrawKartString(LAPS_X+33, LAPS_Y+3, V_SNAPTOLEFT|V_SNAPTOBOTTOM|splitflags, "FIN"); + V_DrawKartString(LAPS_X+33, LAPS_Y+3, splitflags, "FIN"); else - V_DrawKartString(LAPS_X+33, LAPS_Y+3, V_SNAPTOLEFT|V_SNAPTOBOTTOM|splitflags, va("%d/%d", stplyr->laps+1, cv_numlaps.value)); + V_DrawKartString(LAPS_X+33, LAPS_Y+3, splitflags, va("%d/%d", stplyr->laps+1, cv_numlaps.value)); } static void K_drawKartSpeedometer(void) { fixed_t convSpeed; - - INT32 splitflags = 0; - if (stplyr != &players[displayplayer]) - { - if (splitscreen && stplyr == &players[secondarydisplayplayer]) - splitflags |= V_SPLITSCREEN; - else if (splitscreen3 || splitscreen4) - { - if (stplyr == &players[thirddisplayplayer] || stplyr == &players[fourthdisplayplayer]) - splitflags |= V_SPLITSCREEN; - if (stplyr == &players[secondarydisplayplayer] || stplyr == &players[fourthdisplayplayer]) - splitflags |= V_HORZSCREEN; - } - } + INT32 splitflags = K_calcSplitFlags(V_SNAPTOBOTTOM|V_SNAPTOLEFT); if (cv_speedometer.value == 1) { convSpeed = FixedMul(stplyr->speed, 142371)/FRACUNIT; // 2.172409058 - V_DrawKartString(SPDM_X, SPDM_Y, V_SNAPTOLEFT|V_SNAPTOBOTTOM|splitflags, va("%3d km/h", convSpeed)); + V_DrawKartString(SPDM_X, SPDM_Y, splitflags, va("%3d km/h", convSpeed)); } else if (cv_speedometer.value == 2) { convSpeed = FixedMul(stplyr->speed, 88465)/FRACUNIT; // 1.349868774 - V_DrawKartString(SPDM_X, SPDM_Y, V_SNAPTOLEFT|V_SNAPTOBOTTOM|splitflags, va("%3d mph", convSpeed)); + V_DrawKartString(SPDM_X, SPDM_Y, splitflags, va("%3d mph", convSpeed)); } else if (cv_speedometer.value == 3) { convSpeed = stplyr->speed/FRACUNIT; - V_DrawKartString(SPDM_X, SPDM_Y, V_SNAPTOLEFT|V_SNAPTOBOTTOM|splitflags, va("%3d fu/s", convSpeed)); + V_DrawKartString(SPDM_X, SPDM_Y, splitflags, va("%3d fu/s", convSpeed)); } } static void K_drawKartBalloonsOrKarma(void) { UINT8 *colormap = R_GetTranslationColormap(-1, stplyr->skincolor, 0); - - INT32 splitflags = 0; - if (stplyr != &players[displayplayer]) - { - if (splitscreen && stplyr == &players[secondarydisplayplayer]) - splitflags |= V_SPLITSCREEN; - else if (splitscreen3 || splitscreen4) - { - if (stplyr == &players[thirddisplayplayer] || stplyr == &players[fourthdisplayplayer]) - splitflags |= V_SPLITSCREEN; - if (stplyr == &players[secondarydisplayplayer] || stplyr == &players[fourthdisplayplayer]) - splitflags |= V_HORZSCREEN; - } - } + INT32 splitflags = K_calcSplitFlags(V_SNAPTOBOTTOM|V_SNAPTOLEFT); if (stplyr->kartstuff[k_balloon] <= 0) { - V_DrawMappedPatch(LAPS_X, LAPS_Y, V_SNAPTOLEFT|V_SNAPTOBOTTOM|splitflags, kp_karmasticker, colormap); - V_DrawKartString(LAPS_X+58, LAPS_Y+3, V_SNAPTOLEFT|V_SNAPTOBOTTOM|splitflags, va("%d", stplyr->kartstuff[k_comebackpoints])); - V_DrawKartString(LAPS_X+85, LAPS_Y+3, V_SNAPTOLEFT|V_SNAPTOBOTTOM|splitflags, va("3")); + V_DrawMappedPatch(LAPS_X, LAPS_Y, splitflags, kp_karmasticker, colormap); + V_DrawKartString(LAPS_X+58, LAPS_Y+3, splitflags, va("%d", stplyr->kartstuff[k_comebackpoints])); + V_DrawKartString(LAPS_X+85, LAPS_Y+3, splitflags, va("3")); } else { if (cv_kartballoons.value > 9) { - V_DrawMappedPatch(LAPS_X, LAPS_Y, V_SNAPTOLEFT|V_SNAPTOBOTTOM|splitflags, kp_balloonstickerwide, colormap); - V_DrawKartString(LAPS_X+46, LAPS_Y+3, V_SNAPTOLEFT|V_SNAPTOBOTTOM|splitflags, va("%2d", stplyr->kartstuff[k_balloon])); - V_DrawKartString(LAPS_X+83, LAPS_Y+3, V_SNAPTOLEFT|V_SNAPTOBOTTOM|splitflags, va("%2d", cv_kartballoons.value)); + V_DrawMappedPatch(LAPS_X, LAPS_Y, splitflags, kp_balloonstickerwide, colormap); + V_DrawKartString(LAPS_X+46, LAPS_Y+3, splitflags, va("%2d", stplyr->kartstuff[k_balloon])); + V_DrawKartString(LAPS_X+83, LAPS_Y+3, splitflags, va("%2d", cv_kartballoons.value)); } else { - V_DrawMappedPatch(LAPS_X, LAPS_Y, V_SNAPTOLEFT|V_SNAPTOBOTTOM|splitflags, kp_balloonsticker, colormap); - V_DrawKartString(LAPS_X+46, LAPS_Y+3, V_SNAPTOLEFT|V_SNAPTOBOTTOM|splitflags, va("%d", stplyr->kartstuff[k_balloon])); - V_DrawKartString(LAPS_X+73, LAPS_Y+3, V_SNAPTOLEFT|V_SNAPTOBOTTOM|splitflags, va("%d", cv_kartballoons.value)); + V_DrawMappedPatch(LAPS_X, LAPS_Y, splitflags, kp_balloonsticker, colormap); + V_DrawKartString(LAPS_X+46, LAPS_Y+3, splitflags, va("%d", stplyr->kartstuff[k_balloon])); + V_DrawKartString(LAPS_X+73, LAPS_Y+3, splitflags, va("%d", cv_kartballoons.value)); } } } @@ -4918,7 +4854,7 @@ fixed_t K_FindCheckX(fixed_t px, fixed_t py, angle_t ang, fixed_t mx, fixed_t my if (cv_kartmirror.value) x = 320-x; - if (splitscreen3 || splitscreen4) + if (splitscreen > 1) x /= 2; return x; @@ -4931,19 +4867,7 @@ static void K_drawKartPlayerCheck(void) INT32 x; patch_t *localpatch; - INT32 splitflags = 0; - if (stplyr != &players[displayplayer]) - { - if (splitscreen && stplyr == &players[secondarydisplayplayer]) - splitflags |= V_SPLITSCREEN; - else if (splitscreen3 || splitscreen4) - { - if (stplyr == &players[thirddisplayplayer] || stplyr == &players[fourthdisplayplayer]) - splitflags |= V_SPLITSCREEN; - if (stplyr == &players[secondarydisplayplayer] || stplyr == &players[fourthdisplayplayer]) - splitflags |= V_HORZSCREEN; - } - } + INT32 splitflags = K_calcSplitFlags(V_SNAPTOBOTTOM); if (!(stplyr->mo)) return; @@ -4986,7 +4910,7 @@ static void K_drawKartPlayerCheck(void) x = 306; colormap = R_GetTranslationColormap(-1, players[i].mo->color, 0); - V_DrawMappedPatch(x, CHEK_Y, V_SNAPTOBOTTOM|splitflags, localpatch, colormap); + V_DrawMappedPatch(x, CHEK_Y, splitflags, localpatch, colormap); } } } @@ -4995,10 +4919,10 @@ static void K_drawBattleFullscreen(void) { INT32 y = -64+(stplyr->kartstuff[k_cardanimation]); // card animation goes from 0 to 164, 164 is the middle of the screen - if (splitscreen || splitscreen3 || splitscreen4) + if (splitscreen) { - if ((splitscreen && stplyr == &players[secondarydisplayplayer]) - || ((splitscreen3 || splitscreen4) && (stplyr == &players[thirddisplayplayer] || stplyr == &players[fourthdisplayplayer]))) + if ((splitscreen == 1 && stplyr == &players[secondarydisplayplayer]) + || (splitscreen > 1 && (stplyr == &players[thirddisplayplayer] || stplyr == &players[fourthdisplayplayer]))) y = 232-(stplyr->kartstuff[k_cardanimation]/2); else y = -32+(stplyr->kartstuff[k_cardanimation]/2); @@ -5008,7 +4932,7 @@ static void K_drawBattleFullscreen(void) if (stplyr->exiting) { - if (splitscreen) + if (splitscreen == 1) { if (stplyr == &players[displayplayer]) V_DrawFadeScreen(); @@ -5178,7 +5102,7 @@ void K_drawKartHUD(void) // Draw Lakitu // This is done first so that regardless of HUD layers, // he'll appear to be in the 'real world' - if (!(splitscreen || splitscreen3 || splitscreen4)) + if (!splitscreen) { if (leveltime < 178) K_drawStartLakitu(); @@ -5207,13 +5131,13 @@ void K_drawKartHUD(void) //K_DrawKartTripleItem(); // If not splitscreen, draw... - if (!(splitscreen3 || splitscreen4)) // Tiny screen, don't clutter it too much + if (splitscreen < 2) // Tiny screen, don't clutter it too much { // Draw the timestamp K_drawKartTimestamp(); } - if (!(splitscreen || splitscreen3 || splitscreen4) && !modeattacking) // Unnecessary stuff + if (!splitscreen && !modeattacking) // Unnecessary stuff { // The little triple-item icons at the bottom // The top-four faces on the left diff --git a/src/lua_hudlib.c b/src/lua_hudlib.c index ce46ad79..f9428c8c 100644 --- a/src/lua_hudlib.c +++ b/src/lua_hudlib.c @@ -716,11 +716,11 @@ void LUAh_GameHUD(player_t *stplayr) lua_remove(gL, -3); // pop HUD LUA_PushUserdata(gL, stplayr, META_PLAYER); - if (splitscreen4 && stplayr == &players[fourthdisplayplayer]) + if (splitscreen > 2 && stplayr == &players[fourthdisplayplayer]) LUA_PushUserdata(gL, &camera4, META_CAMERA); - else if ((splitscreen3 || splitscreen4) && stplayr == &players[thirddisplayplayer]) + else if (splitscreen > 1 && stplayr == &players[thirddisplayplayer]) LUA_PushUserdata(gL, &camera3, META_CAMERA); - else if ((splitscreen || splitscreen3 || splitscreen4) && stplayr == &players[secondarydisplayplayer]) + else if (splitscreen && stplayr == &players[secondarydisplayplayer]) LUA_PushUserdata(gL, &camera2, META_CAMERA); else LUA_PushUserdata(gL, &camera, META_CAMERA); diff --git a/src/m_menu.c b/src/m_menu.c index b0d82f31..32940c2b 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -6329,14 +6329,14 @@ static INT32 M_FindFirstMap(INT32 gtype) static void M_StartServer(INT32 choice) { - UINT8 ssplayers = 1; + UINT8 ssplayers = 0; if (currentMenu == &MP_SplitServerDef) - ssplayers = 2; + ssplayers = 1; else if (currentMenu == &MP_3PServerDef) - ssplayers = 3; + ssplayers = 2; else if (currentMenu == &MP_4PServerDef) - ssplayers = 4; + ssplayers = 3; (void)choice; if (ssplayers < 2) @@ -6352,7 +6352,7 @@ static void M_StartServer(INT32 choice) if (metalrecording) G_StopMetalDemo(); - if (ssplayers < 2) + if (ssplayers < 1) { D_MapChange(cv_nextmap.value, cv_newgametype.value, false, 1, 1, false, false); COM_BufAddText("dummyconsvar 1\n"); @@ -6362,22 +6362,9 @@ static void M_StartServer(INT32 choice) paused = false; SV_StartSinglePlayerServer(); - if (!splitscreen4 && ssplayers == 4) + if (splitscreen != ssplayers) { - splitscreen4 = true; - splitscreen = splitscreen3 = false; - SplitScreen_OnChange(); - } - else if (!splitscreen3 && ssplayers == 3) - { - splitscreen3 = true; - splitscreen = splitscreen4 = false; - SplitScreen_OnChange(); - } - else if (!splitscreen && ssplayers == 2) - { - splitscreen = true; - splitscreen3 = splitscreen4 = false; + splitscreen = ssplayers; SplitScreen_OnChange(); } @@ -6959,7 +6946,7 @@ static void M_SetupMultiPlayer3(INT32 choice) setupm_fakecolor = setupm_cvcolor->value; // disable skin changes if we can't actually change skins - if (splitscreen && !CanChangeSkin(thirddisplayplayer)) + if (splitscreen > 1 && !CanChangeSkin(thirddisplayplayer)) MP_PlayerSetupMenu[2].status = (IT_GRAYEDOUT); else MP_PlayerSetupMenu[2].status = (IT_KEYHANDLER | IT_STRING); @@ -6990,7 +6977,7 @@ static void M_SetupMultiPlayer4(INT32 choice) setupm_fakecolor = setupm_cvcolor->value; // disable skin changes if we can't actually change skins - if (splitscreen && !CanChangeSkin(fourthdisplayplayer)) + if (splitscreen > 2 && !CanChangeSkin(fourthdisplayplayer)) MP_PlayerSetupMenu[2].status = (IT_GRAYEDOUT); else MP_PlayerSetupMenu[2].status = (IT_KEYHANDLER | IT_STRING); diff --git a/src/p_enemy.c b/src/p_enemy.c index 93fc8db6..59a4a076 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -4075,7 +4075,7 @@ void A_OverlayThink(mobj_t *actor) if (!actor->target) return; - if (!(splitscreen || splitscreen3 || splitscreen4) && rendermode != render_soft) + if (!splitscreen && rendermode != render_soft) { angle_t viewingangle; diff --git a/src/p_floor.c b/src/p_floor.c index b9b542ce..e761903c 100644 --- a/src/p_floor.c +++ b/src/p_floor.c @@ -2526,7 +2526,7 @@ void T_CameraScanner(elevator_t *elevator) } } - if ((splitscreen || splitscreen3 || splitscreen4) && players[secondarydisplayplayer].mo) + if (splitscreen && players[secondarydisplayplayer].mo) { if (players[secondarydisplayplayer].mo->subsector->sector == elevator->actionsector) { @@ -2554,7 +2554,7 @@ void T_CameraScanner(elevator_t *elevator) } } - if ((splitscreen3 || splitscreen4) && players[thirddisplayplayer].mo) + if (splitscreen > 1 && players[thirddisplayplayer].mo) { if (players[thirddisplayplayer].mo->subsector->sector == elevator->actionsector) { @@ -2582,7 +2582,7 @@ void T_CameraScanner(elevator_t *elevator) } } - if (splitscreen4 && players[fourthdisplayplayer].mo) + if (splitscreen > 2 && players[fourthdisplayplayer].mo) { if (players[fourthdisplayplayer].mo->subsector->sector == elevator->actionsector) { diff --git a/src/p_inter.c b/src/p_inter.c index e6b7f4ae..ac8e3001 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -62,11 +62,11 @@ void P_ForceConstant(const BasicFF_t *FFInfo) ConstantQuake.Magnitude = FFInfo->Magnitude; if (FFInfo->player == &players[consoleplayer]) I_Tactile(ConstantForce, &ConstantQuake); - else if ((splitscreen || splitscreen3 || splitscreen4) && FFInfo->player == &players[secondarydisplayplayer]) + else if (splitscreen && FFInfo->player == &players[secondarydisplayplayer]) I_Tactile2(ConstantForce, &ConstantQuake); - else if ((splitscreen3 || splitscreen4) && FFInfo->player == &players[thirddisplayplayer]) + else if (splitscreen > 1 && FFInfo->player == &players[thirddisplayplayer]) I_Tactile3(ConstantForce, &ConstantQuake); - else if (splitscreen4 && FFInfo->player == &players[fourthdisplayplayer]) + else if (splitscreen > 2 && FFInfo->player == &players[fourthdisplayplayer]) I_Tactile4(ConstantForce, &ConstantQuake); } void P_RampConstant(const BasicFF_t *FFInfo, INT32 Start, INT32 End) @@ -83,11 +83,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 || splitscreen3 || splitscreen4) && FFInfo->player == &players[secondarydisplayplayer]) + else if (splitscreen && FFInfo->player == &players[secondarydisplayplayer]) I_Tactile2(ConstantForce, &RampQuake); - else if ((splitscreen3 || splitscreen4) && FFInfo->player == &players[thirddisplayplayer]) + else if (splitscreen > 1 && FFInfo->player == &players[thirddisplayplayer]) I_Tactile3(ConstantForce, &RampQuake); - else if (splitscreen4 && FFInfo->player == &players[fourthdisplayplayer]) + else if (splitscreen > 2 && FFInfo->player == &players[fourthdisplayplayer]) I_Tactile4(ConstantForce, &RampQuake); } diff --git a/src/p_mobj.c b/src/p_mobj.c index 3db6e517..477cd0af 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -3632,11 +3632,11 @@ boolean P_CameraThinker(player_t *player, camera_t *thiscam, boolean resetcalled if (postimg != postimg_none) { - if ((splitscreen || splitscreen3 || splitscreen4) && player == &players[secondarydisplayplayer]) + if (splitscreen && player == &players[secondarydisplayplayer]) postimgtype2 = postimg; - else if ((splitscreen3 || splitscreen4) && player == &players[thirddisplayplayer]) + else if (splitscreen > 1 && player == &players[thirddisplayplayer]) postimgtype3 = postimg; - else if (splitscreen4 && player == &players[fourthdisplayplayer]) + else if (splitscreen > 2 && player == &players[fourthdisplayplayer]) postimgtype4 = postimg; else postimgtype = postimg; @@ -6145,7 +6145,7 @@ void P_RunOverlays(void) if (!mo->target) continue; - if (!(splitscreen || splitscreen3 || splitscreen4) /*&& rendermode != render_soft*/) + if (!splitscreen /*&& rendermode != render_soft*/) { angle_t viewingangle; @@ -6520,13 +6520,13 @@ void P_MobjThinker(mobj_t *mobj) if (mobj->target->player->kartstuff[k_bootimer] > 0) { if ((mobj->target->player == &players[displayplayer] - || ((splitscreen || splitscreen3 || splitscreen4) && mobj->target->player == &players[secondarydisplayplayer]) - || ((splitscreen3 || splitscreen4) && mobj->target->player == &players[thirddisplayplayer]) - || (splitscreen4 && mobj->target->player == &players[fourthdisplayplayer])) + || (splitscreen && mobj->target->player == &players[secondarydisplayplayer]) + || (splitscreen > 1 && mobj->target->player == &players[thirddisplayplayer]) + || (splitscreen > 2 && mobj->target->player == &players[fourthdisplayplayer])) || (!(mobj->target->player == &players[displayplayer] - || ((splitscreen || splitscreen3 || splitscreen4) && mobj->target->player == &players[secondarydisplayplayer]) - || ((splitscreen3 || splitscreen4) && mobj->target->player == &players[thirddisplayplayer]) - || (splitscreen4 && mobj->target->player == &players[fourthdisplayplayer])) + || (splitscreen && mobj->target->player == &players[secondarydisplayplayer]) + || (splitscreen > 1 && mobj->target->player == &players[thirddisplayplayer]) + || (splitscreen > 2 && mobj->target->player == &players[fourthdisplayplayer])) && (mobj->target->player->kartstuff[k_bootimer] < 1*TICRATE/2 || mobj->target->player->kartstuff[k_bootimer] > bootime-(1*TICRATE/2)))) { if (leveltime & 1) @@ -8103,7 +8103,7 @@ void P_MobjThinker(mobj_t *mobj) CONS_Printf(M_GetText("The %c%s%c has returned to base.\n"), 0x85, M_GetText("Red flag"), 0x80); // Assumedly in splitscreen players will be on opposing teams - if (players[consoleplayer].ctfteam == 1 || (splitscreen || splitscreen3 || splitscreen4)) + if (players[consoleplayer].ctfteam == 1 || splitscreen) S_StartSound(NULL, sfx_hoop1); redflag = flagmo; @@ -8114,7 +8114,7 @@ void P_MobjThinker(mobj_t *mobj) CONS_Printf(M_GetText("The %c%s%c has returned to base.\n"), 0x84, M_GetText("Blue flag"), 0x80); // Assumedly in splitscreen players will be on opposing teams - if (players[consoleplayer].ctfteam == 2 || (splitscreen || splitscreen3 || splitscreen4)) + if (players[consoleplayer].ctfteam == 2 || splitscreen) S_StartSound(NULL, sfx_hoop1); blueflag = flagmo; @@ -9626,17 +9626,17 @@ void P_AfterPlayerSpawn(INT32 playernum) if (displayplayer == playernum) P_ResetCamera(p, &camera); } - if (camera2.chase && (splitscreen || splitscreen3 || splitscreen4)) + if (camera2.chase && splitscreen) { if (secondarydisplayplayer == playernum) P_ResetCamera(p, &camera2); } - if (camera3.chase && (splitscreen3 || splitscreen4)) + if (camera3.chase && splitscreen > 1) { if (thirddisplayplayer == playernum) P_ResetCamera(p, &camera3); } - if (camera4.chase && splitscreen4) + if (camera4.chase && splitscreen > 2) { if (fourthdisplayplayer == playernum) P_ResetCamera(p, &camera4); diff --git a/src/p_setup.c b/src/p_setup.c index c49f058f..7507c66e 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -2359,15 +2359,15 @@ static void P_ForceCharacter(const char *forcecharskin) if (netgame) { char skincmd[33]; - if (splitscreen || splitscreen3 || splitscreen4) + if (splitscreen) { sprintf(skincmd, "skin2 %s\n", forcecharskin); CV_Set(&cv_skin2, forcecharskin); - if (splitscreen3 || splitscreen4) + if (splitscreen > 1) { sprintf(skincmd, "skin3 %s\n", forcecharskin); CV_Set(&cv_skin3, forcecharskin); - if (splitscreen4) + if (splitscreen > 2) { sprintf(skincmd, "skin4 %s\n", forcecharskin); CV_Set(&cv_skin4, forcecharskin); @@ -2380,7 +2380,7 @@ static void P_ForceCharacter(const char *forcecharskin) } else { - if (splitscreen || splitscreen3 || splitscreen4) + if (splitscreen) { SetPlayerSkin(secondarydisplayplayer, forcecharskin); if ((unsigned)cv_playercolor2.value != skins[players[secondarydisplayplayer].skin].prefcolor && !modeattacking) @@ -2388,25 +2388,25 @@ static void P_ForceCharacter(const char *forcecharskin) CV_StealthSetValue(&cv_playercolor2, skins[players[secondarydisplayplayer].skin].prefcolor); players[secondarydisplayplayer].skincolor = skins[players[secondarydisplayplayer].skin].prefcolor; } - } - if (splitscreen3 || splitscreen4) - { - SetPlayerSkin(thirddisplayplayer, forcecharskin); - if ((unsigned)cv_playercolor3.value != skins[players[thirddisplayplayer].skin].prefcolor && !modeattacking) + if (splitscreen > 1) { - CV_StealthSetValue(&cv_playercolor3, skins[players[thirddisplayplayer].skin].prefcolor); - players[thirddisplayplayer].skincolor = skins[players[thirddisplayplayer].skin].prefcolor; - } - } + SetPlayerSkin(thirddisplayplayer, forcecharskin); + if ((unsigned)cv_playercolor3.value != skins[players[thirddisplayplayer].skin].prefcolor && !modeattacking) + { + CV_StealthSetValue(&cv_playercolor3, skins[players[thirddisplayplayer].skin].prefcolor); + players[thirddisplayplayer].skincolor = skins[players[thirddisplayplayer].skin].prefcolor; + } - if (splitscreen4) - { - SetPlayerSkin(fourthdisplayplayer, forcecharskin); - if ((unsigned)cv_playercolor4.value != skins[players[fourthdisplayplayer].skin].prefcolor && !modeattacking) - { - CV_StealthSetValue(&cv_playercolor4, skins[players[fourthdisplayplayer].skin].prefcolor); - players[fourthdisplayplayer].skincolor = skins[players[fourthdisplayplayer].skin].prefcolor; + if (splitscreen > 2) + { + SetPlayerSkin(fourthdisplayplayer, forcecharskin); + if ((unsigned)cv_playercolor4.value != skins[players[fourthdisplayplayer].skin].prefcolor && !modeattacking) + { + CV_StealthSetValue(&cv_playercolor4, skins[players[fourthdisplayplayer].skin].prefcolor); + players[fourthdisplayplayer].skincolor = skins[players[fourthdisplayplayer].skin].prefcolor; + } + } } } @@ -2961,15 +2961,13 @@ boolean P_SetupLevel(boolean skipprecip) if (cv_useranalog.value) CV_SetValue(&cv_analog, true); - if ((splitscreen || splitscreen3 || splitscreen4) && cv_useranalog2.value) - CV_SetValue(&cv_analog2, true); - else if (botingame) + if ((splitscreen && cv_useranalog2.value) || botingame) CV_SetValue(&cv_analog2, true); - if ((splitscreen3 || splitscreen4) && cv_useranalog3.value) + if (splitscreen > 1 && cv_useranalog3.value) CV_SetValue(&cv_analog3, true); - if (splitscreen4 && cv_useranalog4.value) + if (splitscreen > 2 && cv_useranalog4.value) CV_SetValue(&cv_analog4, true); if (twodlevel) diff --git a/src/p_spec.c b/src/p_spec.c index feb87b2c..7db68fa5 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -2381,21 +2381,21 @@ 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); - if (splitscreen4 && mo->player == &players[fourthdisplayplayer] && camera4.chase) + if (splitscreen > 2 && mo->player == &players[fourthdisplayplayer] && camera4.chase) { camera4.x += x; camera4.y += y; camera4.z += z; camera4.subsector = R_PointInSubsector(camera4.x, camera4.y); } - else if ((splitscreen3 || splitscreen4) && mo->player == &players[thirddisplayplayer] && camera3.chase) + else if (splitscreen > 1 && mo->player == &players[thirddisplayplayer] && camera3.chase) { camera3.x += x; camera3.y += y; camera3.z += z; camera3.subsector = R_PointInSubsector(camera3.x, camera3.y); } - else if ((splitscreen || splitscreen3 || splitscreen4) && mo->player == &players[secondarydisplayplayer] && camera2.chase) + else if (splitscreen && mo->player == &players[secondarydisplayplayer] && camera2.chase) { camera2.x += x; camera2.y += y; @@ -3898,7 +3898,7 @@ DoneSection2: HU_SetCEchoDuration(5); HU_DoCEcho(va(M_GetText("%s\\captured the blue flag.\\\\\\\\"), player_names[player-players])); - if ((splitscreen || splitscreen3 || splitscreen4) || players[consoleplayer].ctfteam == 1) + if (splitscreen || players[consoleplayer].ctfteam == 1) S_StartSound(NULL, sfx_flgcap); else if (players[consoleplayer].ctfteam == 2) S_StartSound(NULL, sfx_lose); @@ -3931,7 +3931,7 @@ DoneSection2: HU_SetCEchoDuration(5); HU_DoCEcho(va(M_GetText("%s\\captured the red flag.\\\\\\\\"), player_names[player-players])); - if ((splitscreen || splitscreen3 || splitscreen4) || players[consoleplayer].ctfteam == 2) + if (splitscreen || players[consoleplayer].ctfteam == 2) S_StartSound(NULL, sfx_flgcap); else if (players[consoleplayer].ctfteam == 1) S_StartSound(NULL, sfx_lose); @@ -4189,7 +4189,7 @@ DoneSection2: if (P_IsLocalPlayer(player)) { // SRB2kart 200117 - if (!(splitscreen || splitscreen3 || splitscreen4)) + if (!splitscreen) { if (player->kartstuff[k_position] == 1) S_ChangeMusicInternal("karwin", true); diff --git a/src/p_telept.c b/src/p_telept.c index 3f9883b6..69573640 100644 --- a/src/p_telept.c +++ b/src/p_telept.c @@ -73,11 +73,11 @@ void P_MixUp(mobj_t *thing, fixed_t x, fixed_t y, fixed_t z, angle_t angle, localangle4 = angle; // move chasecam at new player location - if (splitscreen4 && camera4.chase && thing->player == &players[fourthdisplayplayer]) + if (splitscreen > 2 && camera4.chase && thing->player == &players[fourthdisplayplayer]) P_ResetCamera(thing->player, &camera4); - else if ((splitscreen3 || splitscreen4) && camera3.chase && thing->player == &players[thirddisplayplayer]) + else if (splitscreen > 1 && camera3.chase && thing->player == &players[thirddisplayplayer]) P_ResetCamera(thing->player, &camera3); - else if ((splitscreen || splitscreen3 || splitscreen4) && camera2.chase && thing->player == &players[secondarydisplayplayer]) + else if (splitscreen && camera2.chase && thing->player == &players[secondarydisplayplayer]) P_ResetCamera(thing->player, &camera2); else if (camera.chase && thing->player == &players[displayplayer]) P_ResetCamera(thing->player, &camera); @@ -158,11 +158,11 @@ boolean P_Teleport(mobj_t *thing, fixed_t x, fixed_t y, fixed_t z, angle_t angle localangle4 = angle; // move chasecam at new player location - if (splitscreen4 && camera4.chase && thing->player == &players[fourthdisplayplayer]) + if (splitscreen > 2 && camera4.chase && thing->player == &players[fourthdisplayplayer]) P_ResetCamera(thing->player, &camera4); - else if ((splitscreen3 || splitscreen4) && camera3.chase && thing->player == &players[thirddisplayplayer]) + else if (splitscreen > 1 && camera3.chase && thing->player == &players[thirddisplayplayer]) P_ResetCamera(thing->player, &camera3); - else if ((splitscreen || splitscreen3 || splitscreen4) && camera2.chase && thing->player == &players[secondarydisplayplayer]) + else if (splitscreen && camera2.chase && thing->player == &players[secondarydisplayplayer]) P_ResetCamera(thing->player, &camera2); else if (camera.chase && thing->player == &players[displayplayer]) P_ResetCamera(thing->player, &camera); diff --git a/src/p_user.c b/src/p_user.c index e45fb160..75a34559 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -1396,9 +1396,9 @@ fixed_t P_GetPlayerSpinHeight(player_t *player) // boolean P_IsLocalPlayer(player_t *player) { - return ((splitscreen4 && player == &players[fourthdisplayplayer]) - || ((splitscreen3 || splitscreen4) && player == &players[thirddisplayplayer]) - || ((splitscreen || splitscreen3 || splitscreen4) && player == &players[secondarydisplayplayer]) + return ((splitscreen > 2 && player == &players[fourthdisplayplayer]) + || (splitscreen > 1 && player == &players[thirddisplayplayer]) + || (splitscreen && player == &players[secondarydisplayplayer]) || player == &players[consoleplayer]); } @@ -1663,7 +1663,7 @@ void P_DoPlayerExit(player_t *player) if (P_IsLocalPlayer(player) && cv_inttime.value > 0) { - if (!(splitscreen || splitscreen3 || splitscreen4)) + if (!splitscreen) { if (player->kartstuff[k_position] == 1) S_ChangeMusicInternal("karwin", true); @@ -2388,7 +2388,7 @@ static void P_DoPlayerHeadSigns(player_t *player) { // Spawn a got-flag message over the head of the player that // has it (but not on your own screen if you have the flag). - if ((splitscreen || splitscreen3 || splitscreen4) || player != &players[consoleplayer]) + if (splitscreen || player != &players[consoleplayer]) { if (player->gotflag & GF_REDFLAG) { @@ -4388,11 +4388,11 @@ INT32 P_GetPlayerControlDirection(player_t *player) fixed_t tempx = 0, tempy = 0; angle_t tempangle, origtempangle; - if (splitscreen4 && player == &players[fourthdisplayplayer]) + if (splitscreen > 2 && player == &players[fourthdisplayplayer]) thiscam = &camera4; - else if ((splitscreen3 || splitscreen4) && player == &players[thirddisplayplayer]) + else if (splitscreen > 1 && player == &players[thirddisplayplayer]) thiscam = &camera3; - else if ((splitscreen || splitscreen3 || splitscreen4) && player == &players[secondarydisplayplayer]) + else if (splitscreen && player == &players[secondarydisplayplayer]) thiscam = &camera2; else thiscam = &camera; @@ -6804,9 +6804,9 @@ static void P_MovePlayer(player_t *player) // Ok, we'll stop now. else if ((player->kartstuff[k_drift] == 0) && (player == &players[consoleplayer] - || ((splitscreen || splitscreen3 || splitscreen4) && player == &players[secondarydisplayplayer]) - || ((splitscreen3 || splitscreen4) && player == &players[thirddisplayplayer]) - || (splitscreen4 && player == &players[fourthdisplayplayer]))) + || (splitscreen && player == &players[secondarydisplayplayer]) + || (splitscreen > 1 && player == &players[thirddisplayplayer]) + || (splitscreen > 2 && player == &players[fourthdisplayplayer]))) S_StopSoundByID(player->mo, sfx_mkdrft); } } @@ -8531,12 +8531,12 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall dist = camdist; // in splitscreen modes, mess with the camera distances to make it feel proportional to how it feels normally - if (splitscreen) // widescreen splits should get x1.5 distance + if (splitscreen == 1) // widescreen splits should get x1.5 distance { dist = FixedMul(dist, 3*FRACUNIT/2); height = FixedMul(height, 3*FRACUNIT/2); } - else if (splitscreen3 || splitscreen4) // smallscreen splits should get 7/8 distance (shorter feels better, oddly enough) + else if (splitscreen > 1) // smallscreen splits should get 7/8 distance (shorter feels better, oddly enough) { dist = FixedMul(dist, 7*FRACUNIT/8); height = FixedMul(height, 7*FRACUNIT/8); @@ -8870,7 +8870,7 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall } // Make player translucent if camera is too close (only in single player). - /*if (!(multiplayer || netgame) && !(splitscreen || splitscreen3 || splitscreen4)) + /*if (!(multiplayer || netgame) && !splitscreen) { fixed_t vx = 0, vy = 0; if (player->awayviewtics) { @@ -9045,17 +9045,17 @@ static void P_CalcPostImg(player_t *player) pviewheight = player->awayviewmobj->z + 20*FRACUNIT; } - if (splitscreen4 && player == &players[fourthdisplayplayer]) + if (splitscreen > 2 && player == &players[fourthdisplayplayer]) { type = &postimgtype4; param = &postimgparam4; } - else if ((splitscreen3 || splitscreen4) && player == &players[thirddisplayplayer]) + else if (splitscreen > 1 && player == &players[thirddisplayplayer]) { type = &postimgtype3; param = &postimgparam3; } - else if ((splitscreen || splitscreen3 || splitscreen4) && player == &players[secondarydisplayplayer]) + else if (splitscreen && player == &players[secondarydisplayplayer]) { type = &postimgtype2; param = &postimgparam2; @@ -9410,7 +9410,7 @@ void P_PlayerThink(player_t *player) player->realtime = 0; } - if ((netgame || (splitscreen || splitscreen3 || splitscreen4)) && player->spectator && cmd->buttons & BT_ATTACK && !player->powers[pw_flashing]) + if ((netgame || splitscreen) && player->spectator && cmd->buttons & BT_ATTACK && !player->powers[pw_flashing]) { if (P_SpectatorJoinGame(player)) return; // player->mo was removed. @@ -9525,9 +9525,9 @@ void P_PlayerThink(player_t *player) // Why not just not spawn the mobj? Well, I'd rather only flirt with // consistency so much... if ((player == &players[displayplayer] && !camera.chase) - || ((splitscreen || splitscreen3 || splitscreen4) && player == &players[secondarydisplayplayer] && !camera2.chase) - || ((splitscreen3 || splitscreen4) && player == &players[thirddisplayplayer] && !camera3.chase) - || (splitscreen4 && player == &players[fourthdisplayplayer] && !camera4.chase)) + || (splitscreen && player == &players[secondarydisplayplayer] && !camera2.chase) + || (splitscreen > 1 && player == &players[thirddisplayplayer] && !camera3.chase) + || (splitscreen > 2 && player == &players[fourthdisplayplayer] && !camera4.chase)) gmobj->flags2 |= MF2_DONTDRAW; } #endif @@ -9653,9 +9653,9 @@ void P_PlayerThink(player_t *player) { // SRB2kart - fixes boo not flashing when it should. Mega doesn't flash either. Flashing is local. if ((player == &players[displayplayer] - || ((splitscreen || splitscreen3 || splitscreen4) && player == &players[secondarydisplayplayer]) - || ((splitscreen3 || splitscreen4) && player == &players[thirddisplayplayer]) - || (splitscreen4 && player == &players[fourthdisplayplayer])) + || (splitscreen && player == &players[secondarydisplayplayer]) + || (splitscreen > 1 && player == &players[thirddisplayplayer]) + || (splitscreen > 2 && player == &players[fourthdisplayplayer])) && player->kartstuff[k_bootimer] == 0 && player->kartstuff[k_growshrinktimer] <= 0 && (player->kartstuff[k_comebacktimer] == 0 || (gametype == GT_RACE || player->kartstuff[k_balloon] > 0))) { @@ -9746,11 +9746,11 @@ void P_PlayerAfterThink(player_t *player) P_PlayerInSpecialSector(player); #endif - if (splitscreen4 && player == &players[fourthdisplayplayer]) + if (splitscreen > 2 && player == &players[fourthdisplayplayer]) thiscam = &camera4; - else if ((splitscreen3 || splitscreen4) && player == &players[thirddisplayplayer]) + else if (splitscreen > 1 && player == &players[thirddisplayplayer]) thiscam = &camera3; - else if ((splitscreen || splitscreen3 || splitscreen4) && player == &players[secondarydisplayplayer]) + else if (splitscreen && player == &players[secondarydisplayplayer]) thiscam = &camera2; else if (player == &players[displayplayer]) thiscam = &camera; diff --git a/src/r_bsp.c b/src/r_bsp.c index 27045d8c..10fac7a5 100644 --- a/src/r_bsp.c +++ b/src/r_bsp.c @@ -257,11 +257,11 @@ sector_t *R_FakeFlat(sector_t *sec, sector_t *tempsec, INT32 *floorlightlevel, INT32 heightsec; boolean underwater; - if (splitscreen4 && viewplayer == &players[fourthdisplayplayer] && camera4.chase) + if (splitscreen > 2 && viewplayer == &players[fourthdisplayplayer] && camera4.chase) heightsec = R_PointInSubsector(camera4.x, camera4.y)->sector->heightsec; - else if ((splitscreen3 || splitscreen4) && viewplayer == &players[thirddisplayplayer] && camera3.chase) + else if (splitscreen > 1 && viewplayer == &players[thirddisplayplayer] && camera3.chase) heightsec = R_PointInSubsector(camera3.x, camera3.y)->sector->heightsec; - else if ((splitscreen || splitscreen3 || splitscreen4) && viewplayer == &players[secondarydisplayplayer] && camera2.chase) + else if (splitscreen && viewplayer == &players[secondarydisplayplayer] && camera2.chase) heightsec = R_PointInSubsector(camera2.x, camera2.y)->sector->heightsec; else if (camera.chase && viewplayer == &players[displayplayer]) heightsec = R_PointInSubsector(camera.x, camera.y)->sector->heightsec; diff --git a/src/r_draw.c b/src/r_draw.c index 491c4bce..5560ffa0 100644 --- a/src/r_draw.c +++ b/src/r_draw.c @@ -633,7 +633,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) + if (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 a96b9b14..690bfe4c 100644 --- a/src/r_main.c +++ b/src/r_main.c @@ -176,12 +176,14 @@ consvar_t cv_maxportals = {"maxportals", "2", CV_SAVE, maxportals_cons_t, NULL, void SplitScreen_OnChange(void) { + UINT8 i; + if (!cv_debug && netgame) { - if (splitscreen || splitscreen3 || splitscreen4) + if (splitscreen) { CONS_Alert(CONS_NOTICE, M_GetText("Splitscreen not supported in netplay, sorry!\n")); - splitscreen = splitscreen3 = splitscreen4 = false; + splitscreen = 0; } return; } @@ -191,23 +193,23 @@ void SplitScreen_OnChange(void) if (!demoplayback && !botingame) { - if (splitscreen || splitscreen3 || splitscreen4) - CL_AddSplitscreenPlayer(); - else - CL_RemoveSplitscreenPlayer(secondarydisplayplayer); - - if (splitscreen3 || splitscreen4) - CL_AddSplitscreenPlayer(); - else - CL_RemoveSplitscreenPlayer(thirddisplayplayer); - - if (splitscreen4) - CL_AddSplitscreenPlayer(); - else - CL_RemoveSplitscreenPlayer(fourthdisplayplayer); + for (i = 1; i < 3; i++) + { + if (i > splitscreen) + { + if (i == 1) + CL_RemoveSplitscreenPlayer(secondarydisplayplayer); + else if (i == 2) + CL_RemoveSplitscreenPlayer(thirddisplayplayer); + else if (i == 3) + CL_RemoveSplitscreenPlayer(fourthdisplayplayer); + } + else + CL_AddSplitscreenPlayer(); + } if (server && !netgame) - multiplayer = (splitscreen || splitscreen3 || splitscreen4); + multiplayer = splitscreen; } else { @@ -219,20 +221,11 @@ void SplitScreen_OnChange(void) if (playeringame[i] && i != consoleplayer) { if (secondarydisplayplayer == consoleplayer) - { secondarydisplayplayer = i; - continue; - } else if (thirddisplayplayer == consoleplayer) - { thirddisplayplayer = i; - continue; - } else if (fourthdisplayplayer == consoleplayer) - { fourthdisplayplayer = i; - break; - } else break; } @@ -657,12 +650,12 @@ void R_ExecuteSetViewSize(void) scaledviewwidth = vid.width; viewheight = vid.height; - if (splitscreen || splitscreen3 || splitscreen4) + if (splitscreen) viewheight >>= 1; viewwidth = scaledviewwidth; - if (splitscreen3 || splitscreen4) + if (splitscreen > 1) { viewwidth >>= 1; scaledviewwidth >>= 1; @@ -832,11 +825,11 @@ void R_SkyboxFrame(player_t *player) INT32 dy = 0; camera_t *thiscam; - if (splitscreen4 && player == &players[fourthdisplayplayer]) + if (splitscreen > 2 && player == &players[fourthdisplayplayer]) thiscam = &camera4; - else if ((splitscreen3 || splitscreen4) && player == &players[thirddisplayplayer]) + else if (splitscreen > 1 && player == &players[thirddisplayplayer]) thiscam = &camera3; - else if ((splitscreen || splitscreen3 || splitscreen4) && player == &players[secondarydisplayplayer]) + else if (splitscreen && player == &players[secondarydisplayplayer]) thiscam = &camera2; else thiscam = &camera; @@ -1081,17 +1074,17 @@ void R_SetupFrame(player_t *player, boolean skybox) camera_t *thiscam; boolean chasecam = false; - if (splitscreen4 && player == &players[fourthdisplayplayer]) + if (splitscreen > 2 && player == &players[fourthdisplayplayer]) { thiscam = &camera4; chasecam = (cv_chasecam4.value != 0); } - else if ((splitscreen3 || splitscreen4) && player == &players[thirddisplayplayer]) + else if (splitscreen > 1 && player == &players[thirddisplayplayer]) { thiscam = &camera3; chasecam = (cv_chasecam3.value != 0); } - else if ((splitscreen || splitscreen3 || splitscreen4) && player == &players[secondarydisplayplayer]) + else if (splitscreen && player == &players[secondarydisplayplayer]) { thiscam = &camera2; chasecam = (cv_chasecam2.value != 0); @@ -1345,18 +1338,18 @@ void R_RenderPlayerView(player_t *player) if (cv_homremoval.value && player == &players[displayplayer]) // if this is display player 1 { - if (cv_homremoval.value == 1 || splitscreen3) // BAD HACK, V_DrawFill isn't letting me cover up only the 4th screen, so let's just sliently force this + if (cv_homremoval.value == 1 || splitscreen == 2) // BAD HACK, V_DrawFill isn't letting me cover up only the 4th screen, so let's just sliently force this V_DrawFill(0, 0, vid.width, vid.height, 31); // No HOM effect! else //'development' HOM removal -- makes it blindingly obvious if HOM is spotted. V_DrawFill(0, 0, vid.width, vid.height, 128+(timeinmap&15)); } // load previous saved value of skyVisible for the player - if (splitscreen4 && player == &players[fourthdisplayplayer]) + if (splitscreen > 2 && player == &players[fourthdisplayplayer]) skyVisible = skyVisible4; - else if ((splitscreen3 || splitscreen4) && player == &players[thirddisplayplayer]) + else if (splitscreen > 1 && player == &players[thirddisplayplayer]) skyVisible = skyVisible3; - else if ((splitscreen || splitscreen3 || splitscreen4) && player == &players[secondarydisplayplayer]) + else if (splitscreen && player == &players[secondarydisplayplayer]) skyVisible = skyVisible2; else skyVisible = skyVisible1; @@ -1462,11 +1455,11 @@ void R_RenderPlayerView(player_t *player) // save value to skyVisible1 or skyVisible2 // this is so that P1 can't affect whether P2 can see a skybox or not, or vice versa - if (splitscreen4 && player == &players[fourthdisplayplayer]) + if (splitscreen > 2 && player == &players[fourthdisplayplayer]) skyVisible4 = skyVisible; - else if ((splitscreen3 || splitscreen4) && player == &players[thirddisplayplayer]) + else if (splitscreen > 1 && player == &players[thirddisplayplayer]) skyVisible3 = skyVisible; - else if ((splitscreen || splitscreen3 || splitscreen4) && player == &players[secondarydisplayplayer]) + else if (splitscreen && player == &players[secondarydisplayplayer]) skyVisible2 = skyVisible; else skyVisible1 = skyVisible; diff --git a/src/r_plane.c b/src/r_plane.c index 8cb0d785..3ec97efb 100644 --- a/src/r_plane.c +++ b/src/r_plane.c @@ -858,12 +858,12 @@ void R_DrawSinglePlane(visplane_t *pl) if (bottom > vid.height) bottom = vid.height; - if (splitscreen4 && viewplayer == &players[fourthdisplayplayer]) // Only copy the part of the screen we need + if (splitscreen > 2 && viewplayer == &players[fourthdisplayplayer]) // Only copy the part of the screen we need scr = (screens[0] + (top+(viewheight))*vid.width + viewwidth); - else if ((splitscreen && viewplayer == &players[secondarydisplayplayer]) - || ((splitscreen3 || splitscreen4) && viewplayer == &players[thirddisplayplayer])) + else if ((splitscreen == 1 && viewplayer == &players[secondarydisplayplayer]) + || (splitscreen > 1 && viewplayer == &players[thirddisplayplayer])) scr = (screens[0] + (top+(viewheight))*vid.width); - else if ((splitscreen3 || splitscreen4) && viewplayer == &players[secondarydisplayplayer]) + else if (splitscreen > 1 && viewplayer == &players[secondarydisplayplayer]) scr = (screens[0] + ((top)*vid.width) + viewwidth); else scr = (screens[0] + ((top)*vid.width)); diff --git a/src/s_sound.c b/src/s_sound.c index 8940a9b8..e63aca15 100644 --- a/src/s_sound.c +++ b/src/s_sound.c @@ -414,25 +414,25 @@ void S_StartSoundAtVolume(const void *origin_p, sfxenum_t sfx_id, INT32 volume) if (players[displayplayer].awayviewtics) listenmobj = players[displayplayer].awayviewmobj; - if (splitscreen || splitscreen3 || splitscreen4) + if (splitscreen) { listenmobj2 = players[secondarydisplayplayer].mo; if (players[secondarydisplayplayer].awayviewtics) listenmobj2 = players[secondarydisplayplayer].awayviewmobj; - } - if (splitscreen3 || splitscreen4) - { - listenmobj3 = players[thirddisplayplayer].mo; - if (players[thirddisplayplayer].awayviewtics) - listenmobj3 = players[thirddisplayplayer].awayviewmobj; - } + if (splitscreen > 1) + { + listenmobj3 = players[thirddisplayplayer].mo; + if (players[thirddisplayplayer].awayviewtics) + listenmobj3 = players[thirddisplayplayer].awayviewmobj; - if (splitscreen4) - { - listenmobj4 = players[fourthdisplayplayer].mo; - if (players[fourthdisplayplayer].awayviewtics) - listenmobj4 = players[fourthdisplayplayer].awayviewmobj; + if (splitscreen > 2) + { + listenmobj4 = players[fourthdisplayplayer].mo; + if (players[fourthdisplayplayer].awayviewtics) + listenmobj4 = players[fourthdisplayplayer].awayviewmobj; + } + } } #ifdef HW3SOUND @@ -531,7 +531,7 @@ void S_StartSoundAtVolume(const void *origin_p, sfxenum_t sfx_id, INT32 volume) pitch = NORM_PITCH; priority = NORM_PRIORITY; - if ((splitscreen || splitscreen3 || splitscreen4) && listenmobj2) // Copy the sound for the split player + if (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) @@ -586,7 +586,7 @@ void S_StartSoundAtVolume(const void *origin_p, sfxenum_t sfx_id, INT32 volume) channels[cnum].handle = I_StartSound(sfx_id, volume, sep, pitch, priority); } - if ((splitscreen3 || splitscreen4) && listenmobj3) // Copy the sound for the third player + if (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) @@ -641,7 +641,7 @@ void S_StartSoundAtVolume(const void *origin_p, sfxenum_t sfx_id, INT32 volume) channels[cnum].handle = I_StartSound(sfx_id, volume, sep, pitch, priority); } - if (splitscreen4 && listenmobj4) // Copy the sound for the split player + if (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) @@ -895,25 +895,25 @@ void S_UpdateSounds(void) if (players[displayplayer].awayviewtics) listenmobj = players[displayplayer].awayviewmobj; - if (splitscreen || splitscreen3 || splitscreen4) + if (splitscreen) { listenmobj2 = players[secondarydisplayplayer].mo; if (players[secondarydisplayplayer].awayviewtics) listenmobj2 = players[secondarydisplayplayer].awayviewmobj; - } - if (splitscreen3 || splitscreen4) - { - listenmobj3 = players[thirddisplayplayer].mo; - if (players[thirddisplayplayer].awayviewtics) - listenmobj3 = players[thirddisplayplayer].awayviewmobj; - } + if (splitscreen > 1) + { + listenmobj3 = players[thirddisplayplayer].mo; + if (players[thirddisplayplayer].awayviewtics) + listenmobj3 = players[thirddisplayplayer].awayviewmobj; - if (splitscreen4) - { - listenmobj4 = players[fourthdisplayplayer].mo; - if (players[fourthdisplayplayer].awayviewtics) - listenmobj4 = players[fourthdisplayplayer].awayviewmobj; + if (splitscreen > 2) + { + listenmobj4 = players[fourthdisplayplayer].mo; + if (players[fourthdisplayplayer].awayviewtics) + listenmobj4 = players[fourthdisplayplayer].awayviewmobj; + } + } } if (camera.chase && !players[displayplayer].awayviewtics) @@ -1014,12 +1014,12 @@ void S_UpdateSounds(void) // check non-local sounds for distance clipping // or modify their params if (c->origin && ((c->origin != players[consoleplayer].mo) - || ((splitscreen || splitscreen3 || splitscreen4) && c->origin != players[secondarydisplayplayer].mo) - || ((splitscreen3 || splitscreen4) && c->origin != players[thirddisplayplayer].mo) - || (splitscreen4 && c->origin != players[fourthdisplayplayer].mo))) + || (splitscreen && c->origin != players[secondarydisplayplayer].mo) + || (splitscreen > 1 && c->origin != players[thirddisplayplayer].mo) + || (splitscreen > 2 && c->origin != players[fourthdisplayplayer].mo))) { // Whomever is closer gets the sound, but only in splitscreen. - if (listenmobj && listenmobj2 && (splitscreen || splitscreen3 || splitscreen4)) + if (listenmobj && listenmobj2 && splitscreen) { const mobj_t *soundmobj = c->origin; @@ -1045,7 +1045,7 @@ void S_UpdateSounds(void) else S_StopChannel(cnum); } - else if (listenmobj && listenmobj3 && (splitscreen3 || splitscreen4)) // TODO: make 3/4P compare their distances with all players, not just the first player and themselves V: + else if (listenmobj && listenmobj3 && splitscreen > 1) // TODO: make 3/4P compare their distances with all players, not just the first player and themselves V: { const mobj_t *soundmobj = c->origin; @@ -1071,7 +1071,7 @@ void S_UpdateSounds(void) else S_StopChannel(cnum); } - else if (listenmobj && listenmobj4 && splitscreen4) + else if (listenmobj && listenmobj4 && splitscreen > 2) { const mobj_t *soundmobj = c->origin; @@ -1097,7 +1097,7 @@ void S_UpdateSounds(void) else S_StopChannel(cnum); } - else if (listenmobj && !(splitscreen || splitscreen3 || splitscreen4)) + else if (listenmobj && !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, @@ -1223,21 +1223,21 @@ INT32 S_AdjustSoundParams(const mobj_t *listener, const mobj_t *source, INT32 *v listensource.z = camera.z; listensource.angle = camera.angle; } - else if ((splitscreen || splitscreen3 || splitscreen4) && listener == players[secondarydisplayplayer].mo && camera2.chase) + else if (splitscreen && listener == players[secondarydisplayplayer].mo && camera2.chase) { listensource.x = camera2.x; listensource.y = camera2.y; listensource.z = camera2.z; listensource.angle = camera2.angle; } - else if ((splitscreen3 || splitscreen4) && listener == players[thirddisplayplayer].mo && camera3.chase) + else if (splitscreen > 1 && listener == players[thirddisplayplayer].mo && camera3.chase) { listensource.x = camera3.x; listensource.y = camera3.y; listensource.z = camera3.z; listensource.angle = camera3.angle; } - else if (splitscreen4 && listener == players[fourthdisplayplayer].mo && camera4.chase) + else if (splitscreen > 2 && listener == players[fourthdisplayplayer].mo && camera4.chase) { listensource.x = camera4.x; listensource.y = camera4.y; diff --git a/src/st_stuff.c b/src/st_stuff.c index c3aee555..1e4029fc 100644 --- a/src/st_stuff.c +++ b/src/st_stuff.c @@ -229,7 +229,7 @@ void ST_doPaletteStuff(void) if (rendermode != render_none) { V_SetPaletteLump(GetPalette()); // Reset the palette - if (!(splitscreen || splitscreen3 || splitscreen4)) + if (!splitscreen) V_SetPalette(palette); } } @@ -445,7 +445,7 @@ static INT32 SCY(INT32 y) // do not scale to resolution for hardware accelerated // because these modes always scale by default y = SCZ(y); // scale to resolution - if (splitscreen || splitscreen3 || splitscreen4) + if (splitscreen) { y >>= 1; if (stplyr != &players[displayplayer]) @@ -459,7 +459,7 @@ static INT32 STRINGY(INT32 y) //31/10/99: fixed by Hurdler so it _works_ also in hardware mode // do not scale to resolution for hardware accelerated // because these modes always scale by default - if (splitscreen || splitscreen3 || splitscreen4) + if (splitscreen) { y >>= 1; if (stplyr != &players[displayplayer]) @@ -472,7 +472,7 @@ static INT32 STRINGY(INT32 y) static INT32 SPLITFLAGS(INT32 f) { // Pass this V_SNAPTO(TOP|BOTTOM) and it'll trim them to account for splitscreen! -Red - if (splitscreen || splitscreen3 || splitscreen4) + if (splitscreen) { if (stplyr != &players[displayplayer]) f &= ~V_SNAPTOTOP; @@ -496,7 +496,7 @@ static INT32 SCR(INT32 r) // do not scale to resolution for hardware accelerated // because these modes always scale by default y = FixedMul(r*FRACUNIT, vid.fdupy); // scale to resolution - if (splitscreen || splitscreen3 || splitscreen4) + if (splitscreen) { y >>= 1; if (stplyr != &players[displayplayer]) @@ -668,7 +668,7 @@ static void ST_drawTime(void) ST_DrawPatchFromHudWS(HUD_TIMECOLON, sbocolon); // Colon ST_DrawPadNumFromHudWS(HUD_SECONDS, seconds, 2); // Seconds - if (!(splitscreen || splitscreen3 || splitscreen4) && (cv_timetic.value == 2 || modeattacking)) // there's not enough room for tics in splitscreen, don't even bother trying! + if (!splitscreen && (cv_timetic.value == 2 || modeattacking)) // there's not enough room for tics in splitscreen, don't even bother trying! { ST_DrawPatchFromHud(HUD_TIMETICCOLON, sboperiod); // Period ST_DrawPadNumFromHud(HUD_TICS, tictrn, 2); // Tics @@ -700,7 +700,7 @@ static inline void ST_drawRings(void) /* static void ST_drawLives(void) // SRB2kart - unused. { - const INT32 v_splitflag = ((splitscreen || splitscreen3 || splitscreen4) && stplyr == &players[displayplayer] ? V_SPLITSCREEN : 0); + const INT32 v_splitflag = (splitscreen && stplyr == &players[displayplayer] ? V_SPLITSCREEN : 0); if (!stplyr->skincolor) return; // Just joined a server, skin isn't loaded yet! @@ -838,7 +838,7 @@ static void ST_drawFirstPersonHUD(void) if (p) { - if (splitscreen || splitscreen3 || splitscreen4) + if (splitscreen) V_DrawSmallScaledPatch(312, STRINGY(24), V_SNAPTORIGHT|V_SNAPTOTOP|V_HUDTRANS, p); else V_DrawScaledPatch(304, 24, V_SNAPTORIGHT|V_SNAPTOTOP|V_HUDTRANS, p); @@ -848,7 +848,7 @@ static void ST_drawFirstPersonHUD(void) invulntime = player->powers[pw_flashing] ? 1 : player->powers[pw_invulnerability]; if (invulntime > 3*TICRATE || (invulntime && leveltime & 1)) { - if (splitscreen || splitscreen3 || splitscreen4) + if (splitscreen) V_DrawSmallScaledPatch(312, STRINGY(24) + 14, V_SNAPTORIGHT|V_SNAPTOTOP|V_HUDTRANS, invincibility); else V_DrawScaledPatch(304, 24 + 28, V_SNAPTORIGHT|V_SNAPTOTOP|V_HUDTRANS, invincibility); @@ -856,7 +856,7 @@ static void ST_drawFirstPersonHUD(void) if (player->powers[pw_sneakers] > 3*TICRATE || (player->powers[pw_sneakers] && leveltime & 1)) { - if (splitscreen || splitscreen3 || splitscreen4) + if (splitscreen) V_DrawSmallScaledPatch(312, STRINGY(24) + 28, V_SNAPTORIGHT|V_SNAPTOTOP|V_HUDTRANS, sneakers); else V_DrawScaledPatch(304, 24 + 56, V_SNAPTORIGHT|V_SNAPTOTOP|V_HUDTRANS, sneakers); @@ -994,7 +994,7 @@ static void ST_drawNiGHTSHUD(void) // SRB2kart - unused. INT32 origamount; INT32 minlink = 1; INT32 total_ringcount; - boolean nosshack = false; + UINT8 nosshack = 0; // When debugging, show "0 Link". if (cv_debug & DBG_NIGHTSBASIC) @@ -1010,7 +1010,7 @@ static void ST_drawNiGHTSHUD(void) // SRB2kart - unused. if (stplyr != &players[displayplayer]) return; nosshack = splitscreen; - splitscreen = false; + splitscreen = 0; } // Link drawing @@ -1108,7 +1108,7 @@ static void ST_drawNiGHTSHUD(void) // SRB2kart - unused. } else if (nosshack) { // Even dirtier hack-of-a-hack to draw seperate drill meters in splitscreen special stages but nothing else. - splitscreen = true; + splitscreen = nosshack; V_DrawScaledPatch(locx, STRINGY(locy)-3, V_HUDTRANS, drillbar); for (dfill = 0; dfill < stplyr->drillmeter/20 && dfill < 96; ++dfill) V_DrawScaledPatch(locx + 2 + dfill, STRINGY(locy + 3), V_HUDTRANS, drillfill[fillpatch]); @@ -1121,7 +1121,7 @@ static void ST_drawNiGHTSHUD(void) // SRB2kart - unused. for (dfill = 0; dfill < stplyr->drillmeter/20 && dfill < 96; ++dfill) V_DrawScaledPatch(locx + 2 + dfill, STRINGY(locy + 3), V_SNAPTOBOTTOM|V_HUDTRANS, drillfill[fillpatch]); stplyr = &players[displayplayer]; - splitscreen = false; + splitscreen = 0; } else { // Draw normally. <:3 @@ -1365,8 +1365,7 @@ static void ST_drawNiGHTSHUD(void) // SRB2kart - unused. #endif ST_drawNightsRecords(); - if (nosshack) - splitscreen = true; + splitscreen = nosshack; } */ @@ -1620,11 +1619,11 @@ static void ST_drawCTFHUD(void) // SRB2kart - unused. static inline void ST_drawTeamName(void) { if (stplyr->ctfteam == 1) - V_DrawString(256, (splitscreen || splitscreen3 || splitscreen4) ? STRINGY(184) : STRINGY(192), V_HUDTRANSHALF, "RED TEAM"); + V_DrawString(256, splitscreen ? STRINGY(184) : STRINGY(192), V_HUDTRANSHALF, "RED TEAM"); else if (stplyr->ctfteam == 2) - V_DrawString(248, (splitscreen || splitscreen3 || splitscreen4) ? STRINGY(184) : STRINGY(192), V_HUDTRANSHALF, "BLUE TEAM"); + V_DrawString(248, splitscreen ? STRINGY(184) : STRINGY(192), V_HUDTRANSHALF, "BLUE TEAM"); else - V_DrawString(244, (splitscreen || splitscreen3 || splitscreen4) ? STRINGY(184) : STRINGY(192), V_HUDTRANSHALF, "SPECTATOR"); + V_DrawString(244, splitscreen ? STRINGY(184) : STRINGY(192), V_HUDTRANSHALF, "SPECTATOR"); } /* @@ -1893,9 +1892,9 @@ static void ST_overlayDrawer(void) // This is where we draw all the fun cheese if you have the chasecam off! if ((stplyr == &players[displayplayer] && !camera.chase) - || (((splitscreen || splitscreen3 || splitscreen4) && stplyr == &players[secondarydisplayplayer]) && !camera2.chase) - || (((splitscreen3 || splitscreen4) && stplyr == &players[thirddisplayplayer]) && !camera3.chase) - || ((splitscreen4 && stplyr == &players[fourthdisplayplayer]) && !camera4.chase)) + || ((splitscreen && stplyr == &players[secondarydisplayplayer]) && !camera2.chase) + || ((splitscreen > 1 && stplyr == &players[thirddisplayplayer]) && !camera3.chase) + || ((splitscreen > 2 && stplyr == &players[fourthdisplayplayer]) && !camera4.chase)) { ST_drawFirstPersonHUD(); } @@ -1914,7 +1913,7 @@ static void ST_overlayDrawer(void) ) ST_drawLevelTitle(); - if (!hu_showscores && !(splitscreen || splitscreen3 || splitscreen4) && netgame && displayplayer == consoleplayer) + if (!hu_showscores && !splitscreen && netgame && displayplayer == consoleplayer) { if (G_GametypeUsesLives() && stplyr->lives <= 0 && countdown != 1) V_DrawCenteredString(BASEVIDWIDTH/2, STRINGY(132), 0, M_GetText("Press F12 to watch another player.")); @@ -1993,22 +1992,22 @@ void ST_Drawer(void) stplyr = &players[displayplayer]; ST_overlayDrawer(); - if (splitscreen || splitscreen3 || splitscreen4) + if (splitscreen) { stplyr = &players[secondarydisplayplayer]; ST_overlayDrawer(); - } - if (splitscreen3 || splitscreen4) - { - stplyr = &players[thirddisplayplayer]; - ST_overlayDrawer(); - } + if (splitscreen > 1) + { + stplyr = &players[thirddisplayplayer]; + ST_overlayDrawer(); - if (splitscreen4) - { - stplyr = &players[fourthdisplayplayer]; - ST_overlayDrawer(); + if (splitscreen > 2) + { + stplyr = &players[fourthdisplayplayer]; + ST_overlayDrawer(); + } + } } } } diff --git a/src/v_video.c b/src/v_video.c index bd313875..e615a1dd 100644 --- a/src/v_video.c +++ b/src/v_video.c @@ -1982,18 +1982,15 @@ void V_DoPostProcessor(INT32 view, postimg_t type, INT32 param) return; #endif - if (view < 0 || view >= 3 - || (view == 1 && !(splitscreen || splitscreen3 || splitscreen4)) - || (view == 2 && !(splitscreen3 || splitscreen4)) - || (view == 3 && !splitscreen4)) + if (view < 0 || view >= 3 || (view > splitscreen)) return; - if ((view == 1 && splitscreen) || view >= 2) + if ((view == 1 && splitscreen == 1) || view >= 2) yoffset = viewheight; else yoffset = 0; - if (view & 1 && !splitscreen) + if (view & 1 && splitscreen > 1) xoffset = viewwidth; else xoffset = 0;