Merge branch 'parties' into 'master'

Parties (Online Splitscreen Mk. II)

See merge request KartKrew/Kart!198
This commit is contained in:
Sal 2020-03-23 00:43:33 -04:00
commit 14bd304b06
41 changed files with 1233 additions and 440 deletions

View file

@ -487,6 +487,7 @@ OBJS:=$(i_main_o) \
$(OBJDIR)/f_wipe.o \
$(OBJDIR)/g_game.o \
$(OBJDIR)/g_input.o \
$(OBJDIR)/g_splitscreen.o\
$(OBJDIR)/am_map.o \
$(OBJDIR)/command.o \
$(OBJDIR)/console.o \

View file

@ -85,6 +85,8 @@ static boolean serverrunning = false;
INT32 serverplayer = 0;
char motd[254], server_context[8]; // Message of the Day, Unique Context (even without Mumble support)
UINT8 playerconsole[MAXPLAYERS];
// Server specific vars
UINT8 playernode[MAXPLAYERS];
@ -1508,6 +1510,8 @@ static boolean SV_SendServerConfig(INT32 node)
UINT8 *p, *op;
boolean waspacketsent;
memset(&netbuffer->u.servercfg, 0, sizeof netbuffer->u.servercfg);
netbuffer->packettype = PT_SERVERCFG;
netbuffer->u.servercfg.version = VERSION;
@ -1527,7 +1531,6 @@ static boolean SV_SendServerConfig(INT32 node)
memset(netbuffer->u.servercfg.playercolor, 0xFF, sizeof(netbuffer->u.servercfg.playercolor));
memset(netbuffer->u.servercfg.adminplayers, -1, sizeof(netbuffer->u.servercfg.adminplayers));
memset(netbuffer->u.servercfg.powerlevels, 0, sizeof(netbuffer->u.servercfg.powerlevels));
for (i = 0; i < MAXPLAYERS; i++)
{
@ -1538,6 +1541,19 @@ static boolean SV_SendServerConfig(INT32 node)
if (!playeringame[i])
continue;
netbuffer->u.servercfg.consoleplayers[i] = playerconsole[i];
netbuffer->u.servercfg.invitations[i] = splitscreen_invitations[i];
netbuffer->u.servercfg.party_size[i] = splitscreen_party_size[i];
netbuffer->u.servercfg.original_party_size[i] =
splitscreen_original_party_size[i];
for (j = 0; j < MAXSPLITSCREENPLAYERS; ++j)
{
netbuffer->u.servercfg.party[i][j] = splitscreen_party[i][j];
netbuffer->u.servercfg.original_party[i][j] =
splitscreen_original_party[i][j];
}
netbuffer->u.servercfg.playerskins[i] = (UINT8)players[i].skin;
netbuffer->u.servercfg.playercolor[i] = (UINT8)players[i].skincolor;
}
@ -2622,6 +2638,8 @@ static void ResetNode(INT32 node);
//
void CL_ClearPlayer(INT32 playernum)
{
int i;
if (players[playernum].mo)
{
// Don't leave a NiGHTS ghost!
@ -2629,6 +2647,17 @@ void CL_ClearPlayer(INT32 playernum)
P_RemoveMobj(players[playernum].mo->tracer);
P_RemoveMobj(players[playernum].mo);
}
for (i = 0; i < MAXPLAYERS; ++i)
{
if (splitscreen_invitations[i] == playernum)
splitscreen_invitations[i] = -1;
}
splitscreen_invitations[playernum] = -1;
splitscreen_party_size[playernum] = 0;
splitscreen_original_party_size[playernum] = 0;
memset(&players[playernum], 0, sizeof (player_t));
}
@ -2704,6 +2733,8 @@ void CL_RemovePlayer(INT32 playernum, INT32 reason)
(void)reason;
#endif
G_RemovePartyMember(playernum);
// Reset player data
CL_ClearPlayer(playernum);
@ -2721,8 +2752,8 @@ void CL_RemovePlayer(INT32 playernum, INT32 reason)
RemoveAdminPlayer(playernum); // don't stay admin after you're gone
}
if (playernum == displayplayers[0] && !demo.playback)
displayplayers[0] = consoleplayer; // don't look through someone's view who isn't there
if (playernum == g_localplayers[0] && !demo.playback)
g_localplayers[0] = consoleplayer; // don't look through someone's view who isn't there
#ifdef HAVE_BLUA
LUA_InvalidatePlayer(&players[playernum]);
@ -3354,8 +3385,11 @@ void SV_ResetServer(void)
sprintf(player_names[i], "Player %d", i + 1);
adminplayers[i] = -1; // Populate the entire adminplayers array with -1.
K_ClearClientPowerLevels();
splitscreen_invitations[i] = -1;
}
memset(splitscreen_partied, 0, sizeof splitscreen_partied);
mynode = 0;
cl_packetmissed = false;
@ -3458,6 +3492,7 @@ static inline void SV_AddNode(INT32 node)
static void Got_AddPlayer(UINT8 **p, INT32 playernum)
{
INT16 node, newplayernum;
UINT8 console;
UINT8 splitscreenplayer = 0;
UINT8 i;
@ -3478,6 +3513,7 @@ static void Got_AddPlayer(UINT8 **p, INT32 playernum)
node = (UINT8)READUINT8(*p);
newplayernum = (UINT8)READUINT8(*p);
console = (UINT8)READUINT8(*p);
splitscreenplayer = (UINT8)READUINT8(*p);
CONS_Debug(DBG_NETPLAY, "addplayer: %d %d %d\n", node, newplayernum, splitscreenplayer);
@ -3498,6 +3534,7 @@ static void Got_AddPlayer(UINT8 **p, INT32 playernum)
if (splitscreenplayer)
{
displayplayers[splitscreenplayer] = newplayernum;
g_localplayers[splitscreenplayer] = newplayernum;
DEBFILE(va("spawning sister # %d\n", splitscreenplayer));
if (splitscreenplayer == 1 && botingame)
players[newplayernum].bot = 1;
@ -3506,7 +3543,11 @@ static void Got_AddPlayer(UINT8 **p, INT32 playernum)
{
consoleplayer = newplayernum;
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
{
displayplayers[i] = newplayernum;
g_localplayers[i] = newplayernum;
}
splitscreen_partied[newplayernum] = true;
DEBFILE("spawning me\n");
}
@ -3516,6 +3557,12 @@ static void Got_AddPlayer(UINT8 **p, INT32 playernum)
players[newplayernum].splitscreenindex = splitscreenplayer;
playerconsole[newplayernum] = console;
splitscreen_original_party_size[console] =
++splitscreen_party_size[console];
splitscreen_original_party[console][splitscreenplayer] =
splitscreen_party[console][splitscreenplayer] = newplayernum;
if (netgame)
{
if (server && cv_showjoinaddress.value)
@ -3577,7 +3624,7 @@ static boolean SV_AddWaitingPlayers(void)
// splitscreen can allow 2+ players in one node
for (; nodewaiting[node] > 0; nodewaiting[node]--)
{
UINT8 buf[3];
UINT8 buf[4];
UINT8 *buf_p = buf;
newplayer = true;
@ -3614,6 +3661,7 @@ static boolean SV_AddWaitingPlayers(void)
else if (playerpernode[node] < 4)
nodetoplayer4[node] = newplayernum;
WRITEUINT8(buf_p, nodetoplayer[node]); // consoleplayer
WRITEUINT8(buf_p, playerpernode[node]); // splitscreen num
playerpernode[node]++;
@ -4144,6 +4192,21 @@ static void HandlePacketFromAwayNode(SINT8 node)
adminplayers[j] = netbuffer->u.servercfg.adminplayers[j];
for (k = 0; k < PWRLV_NUMTYPES; k++)
clientpowerlevels[j][k] = netbuffer->u.servercfg.powerlevels[j][k];
/* all spitscreen related */
playerconsole[j] = netbuffer->u.servercfg.consoleplayers[j];
splitscreen_invitations[j] = netbuffer->u.servercfg.invitations[j];
splitscreen_original_party_size[j] =
netbuffer->u.servercfg.original_party_size[j];
splitscreen_party_size[j] =
netbuffer->u.servercfg.party_size[j];
for (k = 0; k < MAXSPLITSCREENPLAYERS; ++k)
{
splitscreen_original_party[j][k] =
netbuffer->u.servercfg.original_party[j][k];
splitscreen_party[j][k] =
netbuffer->u.servercfg.party[j][k];
}
}
memcpy(server_context, netbuffer->u.servercfg.server_context, 8);
}

View file

@ -328,6 +328,14 @@ typedef struct
SINT8 adminplayers[MAXPLAYERS]; // Needs to be signed
UINT16 powerlevels[MAXPLAYERS][PWRLV_NUMTYPES]; // SRB2kart: player power levels
UINT8 consoleplayers[MAXPLAYERS];
/* splitscreen */
SINT8 invitations[MAXPLAYERS];
UINT8 party_size[MAXPLAYERS];
UINT8 party[MAXPLAYERS][MAXSPLITSCREENPLAYERS];
UINT8 original_party_size[MAXPLAYERS];
UINT8 original_party[MAXPLAYERS][MAXSPLITSCREENPLAYERS];
char server_context[8]; // Unique context id, generated at server startup.
UINT8 varlengthinputs[0]; // Playernames and netvars
@ -601,6 +609,8 @@ SINT8 nametonum(const char *name);
extern char motd[254], server_context[8];
extern UINT8 playernode[MAXPLAYERS];
/* consoleplayer of this player (splitscreen) */
extern UINT8 playerconsole[MAXPLAYERS];
INT32 D_NumPlayers(void);
void D_ResetTiccmds(void);

View file

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

View file

@ -64,6 +64,10 @@
static void Got_NameAndColor(UINT8 **cp, INT32 playernum);
static void Got_WeaponPref(UINT8 **cp, INT32 playernum);
static void Got_PowerLevel(UINT8 **cp, INT32 playernum);
static void Got_PartyInvite(UINT8 **cp, INT32 playernum);
static void Got_AcceptPartyInvite(UINT8 **cp, INT32 playernum);
static void Got_CancelPartyInvite(UINT8 **cp, INT32 playernum);
static void Got_LeaveParty(UINT8 **cp, INT32 playernum);
static void Got_Mapcmd(UINT8 **cp, INT32 playernum);
static void Got_ExitLevelcmd(UINT8 **cp, INT32 playernum);
static void Got_SetupVotecmd(UINT8 **cp, INT32 playernum);
@ -137,6 +141,12 @@ static void Command_ResetCamera_f(void);
static void Command_View_f (void);
static void Command_SetViews_f(void);
static void Command_Invite_f(void);
static void Command_CancelInvite_f(void);
static void Command_AcceptInvite_f(void);
static void Command_RejectInvite_f(void);
static void Command_LeaveParty_f(void);
static void Command_Addfile(void);
static void Command_ListWADS_f(void);
#ifdef DELFILE
@ -553,6 +563,10 @@ void D_RegisterServerCommands(void)
RegisterNetXCmd(XD_NAMEANDCOLOR, Got_NameAndColor);
RegisterNetXCmd(XD_WEAPONPREF, Got_WeaponPref);
RegisterNetXCmd(XD_POWERLEVEL, Got_PowerLevel);
RegisterNetXCmd(XD_PARTYINVITE, Got_PartyInvite);
RegisterNetXCmd(XD_ACCEPTPARTYINVITE, Got_AcceptPartyInvite);
RegisterNetXCmd(XD_CANCELPARTYINVITE, Got_CancelPartyInvite);
RegisterNetXCmd(XD_LEAVEPARTY, Got_LeaveParty);
RegisterNetXCmd(XD_MAP, Got_Mapcmd);
RegisterNetXCmd(XD_EXITLEVEL, Got_ExitLevelcmd);
RegisterNetXCmd(XD_ADDFILE, Got_Addfilecmd);
@ -764,6 +778,12 @@ void D_RegisterClientCommands(void)
COM_AddCommand("changeteam3", Command_Teamchange3_f);
COM_AddCommand("changeteam4", Command_Teamchange4_f);
COM_AddCommand("invite", Command_Invite_f);
COM_AddCommand("cancelinvite", Command_CancelInvite_f);
COM_AddCommand("acceptinvite", Command_AcceptInvite_f);
COM_AddCommand("rejectinvite", Command_RejectInvite_f);
COM_AddCommand("leaveparty", Command_LeaveParty_f);
COM_AddCommand("playdemo", Command_Playdemo_f);
COM_AddCommand("timedemo", Command_Timedemo_f);
COM_AddCommand("stopdemo", Command_Stopdemo_f);
@ -1191,11 +1211,11 @@ static void CleanupPlayerName(INT32 playernum, const char *newname)
// spaces may have been removed
if (playernum == consoleplayer)
CV_StealthSet(&cv_playername, tmpname);
else if (playernum == displayplayers[1] || (!netgame && playernum == 1))
else if (playernum == g_localplayers[1] || (!netgame && playernum == 1))
CV_StealthSet(&cv_playername2, tmpname);
else if (playernum == displayplayers[2] || (!netgame && playernum == 2))
else if (playernum == g_localplayers[2] || (!netgame && playernum == 2))
CV_StealthSet(&cv_playername3, tmpname);
else if (playernum == displayplayers[3] || (!netgame && playernum == 3))
else if (playernum == g_localplayers[3] || (!netgame && playernum == 3))
CV_StealthSet(&cv_playername4, tmpname);
else I_Assert(((void)"CleanupPlayerName used on non-local player", 0));
@ -1303,16 +1323,50 @@ static void ForceAllSkins(INT32 forcedskin)
{
if (i == consoleplayer)
CV_StealthSet(&cv_skin, skins[forcedskin].name);
else if (i == displayplayers[1])
else if (i == g_localplayers[1])
CV_StealthSet(&cv_skin2, skins[forcedskin].name);
else if (i == displayplayers[2])
else if (i == g_localplayers[2])
CV_StealthSet(&cv_skin3, skins[forcedskin].name);
else if (i == displayplayers[3])
else if (i == g_localplayers[3])
CV_StealthSet(&cv_skin4, skins[forcedskin].name);
}
}
}
static const char *
VaguePartyDescription (int playernum, int *party_sizes, int default_color)
{
static char party_description
[1 + MAXPLAYERNAME + 1 + sizeof " and x others"];
const char *name;
int size;
name = player_names[playernum];
size = party_sizes[playernum];
/*
less than check for the dumb compiler because I KNOW it'll
complain about "writing x bytes into an area of y bytes"!!!
*/
if (size > 1 && size <= MAXSPLITSCREENPLAYERS)
{
sprintf(party_description,
"\x83%s%c and %d other%s",
name,
default_color,
( size - 1 ),
( (size > 2) ? "s" : "" )
);
}
else
{
sprintf(party_description,
"\x83%s%c",
name,
default_color
);
}
return party_description;
}
static INT32 snacpending = 0, snac2pending = 0, snac3pending = 0, snac4pending = 0, chmappending = 0;
// name, color, or skin has changed
@ -1442,8 +1496,8 @@ static void SendNameAndColor2(void)
if (splitscreen < 1 && !botingame)
return; // can happen if skin2/color2/name2 changed
if (displayplayers[1] != consoleplayer)
secondplaya = displayplayers[1];
if (g_localplayers[1] != consoleplayer)
secondplaya = g_localplayers[1];
else if (!netgame) // HACK
secondplaya = 1;
@ -1531,14 +1585,14 @@ static void SendNameAndColor2(void)
snac2pending++;
// Don't change name if muted
if (cv_mute.value && !(server || IsPlayerAdmin(displayplayers[1])))
CV_StealthSet(&cv_playername2, player_names[displayplayers[1]]);
if (cv_mute.value && !(server || IsPlayerAdmin(g_localplayers[1])))
CV_StealthSet(&cv_playername2, player_names[g_localplayers[1]]);
else // Cleanup name if changing it
CleanupPlayerName(displayplayers[1], cv_playername2.zstring);
CleanupPlayerName(g_localplayers[1], cv_playername2.zstring);
// Don't change skin if the server doesn't want you to.
if (!CanChangeSkin(displayplayers[1]))
CV_StealthSet(&cv_skin2, skins[players[displayplayers[1]].skin].name);
if (!CanChangeSkin(g_localplayers[1]))
CV_StealthSet(&cv_skin2, skins[players[g_localplayers[1]].skin].name);
// check if player has the skin loaded (cv_skin2 may have
// the name of a skin that was available in the previous game)
@ -1565,8 +1619,8 @@ static void SendNameAndColor3(void)
if (splitscreen < 2)
return; // can happen if skin3/color3/name3 changed
if (displayplayers[2] != consoleplayer)
thirdplaya = displayplayers[2];
if (g_localplayers[2] != consoleplayer)
thirdplaya = g_localplayers[2];
else if (!netgame) // HACK
thirdplaya = 2;
@ -1646,14 +1700,14 @@ static void SendNameAndColor3(void)
snac3pending++;
// Don't change name if muted
if (cv_mute.value && !(server || IsPlayerAdmin(displayplayers[2])))
CV_StealthSet(&cv_playername3, player_names[displayplayers[2]]);
if (cv_mute.value && !(server || IsPlayerAdmin(g_localplayers[2])))
CV_StealthSet(&cv_playername3, player_names[g_localplayers[2]]);
else // Cleanup name if changing it
CleanupPlayerName(displayplayers[2], cv_playername3.zstring);
CleanupPlayerName(g_localplayers[2], cv_playername3.zstring);
// Don't change skin if the server doesn't want you to.
if (!CanChangeSkin(displayplayers[2]))
CV_StealthSet(&cv_skin3, skins[players[displayplayers[2]].skin].name);
if (!CanChangeSkin(g_localplayers[2]))
CV_StealthSet(&cv_skin3, skins[players[g_localplayers[2]].skin].name);
// check if player has the skin loaded (cv_skin3 may have
// the name of a skin that was available in the previous game)
@ -1680,8 +1734,8 @@ static void SendNameAndColor4(void)
if (splitscreen < 3)
return; // can happen if skin4/color4/name4 changed
if (displayplayers[3] != consoleplayer)
fourthplaya = displayplayers[3];
if (g_localplayers[3] != consoleplayer)
fourthplaya = g_localplayers[3];
else if (!netgame) // HACK
fourthplaya = 3;
@ -1769,14 +1823,14 @@ static void SendNameAndColor4(void)
snac4pending++;
// Don't change name if muted
if (cv_mute.value && !(server || IsPlayerAdmin(displayplayers[3])))
CV_StealthSet(&cv_playername4, player_names[displayplayers[3]]);
if (cv_mute.value && !(server || IsPlayerAdmin(g_localplayers[3])))
CV_StealthSet(&cv_playername4, player_names[g_localplayers[3]]);
else // Cleanup name if changing it
CleanupPlayerName(displayplayers[3], cv_playername4.zstring);
CleanupPlayerName(g_localplayers[3], cv_playername4.zstring);
// Don't change skin if the server doesn't want you to.
if (!CanChangeSkin(displayplayers[3]))
CV_StealthSet(&cv_skin4, skins[players[displayplayers[3]].skin].name);
if (!CanChangeSkin(g_localplayers[3]))
CV_StealthSet(&cv_skin4, skins[players[g_localplayers[3]].skin].name);
// check if player has the skin loaded (cv_skin4 may have
// the name of a skin that was available in the previous game)
@ -1807,11 +1861,11 @@ static void Got_NameAndColor(UINT8 **cp, INT32 playernum)
if (playernum == consoleplayer)
snacpending--; // TODO: make snacpending an array instead of 4 separate vars?
else if (playernum == displayplayers[1])
else if (playernum == g_localplayers[1])
snac2pending--;
else if (playernum == displayplayers[2])
else if (playernum == g_localplayers[2])
snac3pending--;
else if (playernum == displayplayers[3])
else if (playernum == g_localplayers[3])
snac4pending--;
#ifdef PARANOIA
@ -1834,8 +1888,8 @@ static void Got_NameAndColor(UINT8 **cp, INT32 playernum)
demo_extradata[playernum] |= DXD_COLOR;
// normal player colors
if (server && (p != &players[consoleplayer] && p != &players[displayplayers[1]]
&& p != &players[displayplayers[2]] && p != &players[displayplayers[3]]))
if (server && (p != &players[consoleplayer] && p != &players[g_localplayers[1]]
&& p != &players[g_localplayers[2]] && p != &players[g_localplayers[3]]))
{
boolean kick = false;
@ -1872,11 +1926,11 @@ static void Got_NameAndColor(UINT8 **cp, INT32 playernum)
if (playernum == consoleplayer)
CV_StealthSet(&cv_skin, skins[forcedskin].name);
else if (playernum == displayplayers[1])
else if (playernum == g_localplayers[1])
CV_StealthSet(&cv_skin2, skins[forcedskin].name);
else if (playernum == displayplayers[2])
else if (playernum == g_localplayers[2])
CV_StealthSet(&cv_skin3, skins[forcedskin].name);
else if (playernum == displayplayers[3])
else if (playernum == g_localplayers[3])
CV_StealthSet(&cv_skin4, skins[forcedskin].name);
}
else
@ -1943,6 +1997,193 @@ static void Got_PowerLevel(UINT8 **cp,INT32 playernum)
CONS_Debug(DBG_GAMELOGIC, "set player %d to power %d\n", playernum, race);
}
static void Got_PartyInvite(UINT8 **cp,INT32 playernum)
{
UINT8 invitee;
boolean kick = false;
invitee = READUINT8 (*cp);
if (
invitee < MAXPLAYERS &&
playeringame[invitee] &&
playerconsole[playernum] == playernum/* only consoleplayer may! */
){
invitee = playerconsole[invitee];
/* you cannot invite yourself or your computer */
if (invitee == playernum)
kick = true;
}
else
kick = true;
if (kick)
{
CONS_Alert(CONS_WARNING, M_GetText("Illegal splitscreen invitation received from %s\n"), player_names[playernum]);
if (server)
{
XBOXSTATIC UINT8 buf[2];
buf[0] = (UINT8)playernum;
buf[1] = KICK_MSG_CON_FAIL;
SendNetXCmd(XD_KICK, &buf, 2);
}
return;
}
if (splitscreen_invitations[invitee] < 0)
{
splitscreen_invitations[invitee] = playernum;
if (invitee == consoleplayer)/* hey that's me! */
{
HU_AddChatText(va(
"\x82*You have been invited to join %s.",
VaguePartyDescription(
playernum, splitscreen_party_size, '\x82')
), true);
}
}
}
static void Got_AcceptPartyInvite(UINT8 **cp,INT32 playernum)
{
int invitation;
int old_party_size;
int views;
(void)cp;
if (playerconsole[playernum] != playernum)
{
CONS_Alert(CONS_WARNING, M_GetText("Illegal accept splitscreen invite received from %s\n"), player_names[playernum]);
if (server)
{
XBOXSTATIC UINT8 buf[2];
buf[0] = (UINT8)playernum;
buf[1] = KICK_MSG_CON_FAIL;
SendNetXCmd(XD_KICK, &buf, 2);
}
return;
}
invitation = splitscreen_invitations[playernum];
if (invitation >= 0)
{
if (splitscreen_partied[invitation])
{
HU_AddChatText(va(
"\x82*%s joined your party!",
VaguePartyDescription(
playernum, splitscreen_original_party_size, '\x82')
), true);
}
else if (playernum == consoleplayer)
{
HU_AddChatText(va(
"\x82*You joined %s's party!",
VaguePartyDescription(
invitation, splitscreen_party_size, '\x82')
), true);
}
old_party_size = splitscreen_party_size[invitation];
views = splitscreen_original_party_size[playernum];
if (( old_party_size + views ) <= MAXSPLITSCREENPLAYERS)
{
G_RemovePartyMember(playernum);
G_AddPartyMember(invitation, playernum);
}
splitscreen_invitations[playernum] = -1;
}
}
static void Got_CancelPartyInvite(UINT8 **cp,INT32 playernum)
{
UINT8 invitee;
invitee = READUINT8 (*cp);
if (
invitee < MAXPLAYERS &&
playeringame[invitee]
){
invitee = playerconsole[invitee];
if (splitscreen_invitations[invitee] == playerconsole[playernum])
{
splitscreen_invitations[invitee] = -1;
if (consoleplayer == invitee)
{
HU_AddChatText("\x85*Your invitation has been rescinded.", true);
}
}
}
else
{
CONS_Alert(CONS_WARNING, M_GetText("Illegal cancel splitscreen invite received from %s\n"), player_names[playernum]);
if (server)
{
XBOXSTATIC UINT8 buf[2];
buf[0] = (UINT8)playernum;
buf[1] = KICK_MSG_CON_FAIL;
SendNetXCmd(XD_KICK, &buf, 2);
}
}
}
static void Got_LeaveParty(UINT8 **cp,INT32 playernum)
{
(void)cp;
if (playerconsole[playernum] != playernum)
{
CONS_Alert(CONS_WARNING, M_GetText("Illegal accept splitscreen invite received from %s\n"), player_names[playernum]);
if (server)
{
XBOXSTATIC UINT8 buf[2];
buf[0] = (UINT8)playernum;
buf[1] = KICK_MSG_CON_FAIL;
SendNetXCmd(XD_KICK, &buf, 2);
}
return;
}
if (consoleplayer == splitscreen_invitations[playernum])
{
HU_AddChatText(va(
"\x85*\x83%s\x85 rejected your invitation.",
player_names[playernum]
), true);
}
splitscreen_invitations[playernum] = -1;
if (splitscreen_party_size[playernum] >
splitscreen_original_party_size[playernum])
{
if (splitscreen_partied[playernum] && playernum != consoleplayer)
{
HU_AddChatText(va(
"\x85*%s left your party.",
VaguePartyDescription(
playernum, splitscreen_original_party_size, '\x85')
), true);
}
G_RemovePartyMember(playernum);
G_ResetSplitscreen(playernum);
}
}
void D_SendPlayerConfig(void)
{
SendNameAndColor();
@ -1989,7 +2230,7 @@ void D_SendPlayerConfig(void)
// Only works for displayplayer, sorry!
static void Command_ResetCamera_f(void)
{
P_ResetCamera(&players[displayplayers[0]], &camera[0]);
P_ResetCamera(&players[g_localplayers[0]], &camera[0]);
}
/* Consider replacing nametonum with this */
@ -2145,7 +2386,7 @@ static void Command_View_f(void)
}
else/* print current view */
{
if (splitscreen < viewnum-1)/* We can't see those guys! */
if (r_splitscreen < viewnum-1)/* We can't see those guys! */
return;
PRINTVIEWPOINT ("Currently ",)
}
@ -2170,7 +2411,7 @@ static void Command_SetViews_f(void)
return;
}
splits = splitscreen+1;
splits = r_splitscreen+1;
newsplits = atoi(COM_Argv(1));
newsplits = min(max(newsplits, 1), 4);
@ -2178,11 +2419,157 @@ static void Command_SetViews_f(void)
G_AdjustView(newsplits, 0, true);
else
{
splitscreen = newsplits-1;
r_splitscreen = newsplits-1;
R_ExecuteSetViewSize();
}
}
static void
Command_Invite_f (void)
{
UINT8 buffer[1];
int invitee;
if (COM_Argc() != 2)
{
CONS_Printf("invite <player>: Invite a player to your party.\n");
return;
}
if (r_splitscreen >= MAXSPLITSCREENPLAYERS)
{
CONS_Alert(CONS_WARNING, "Your party is full!\n");
return;
}
invitee = LookupPlayer(COM_Argv(1));
if (invitee == -1)
{
CONS_Alert(CONS_WARNING, "There is no player by that name!\n");
return;
}
if (!playeringame[invitee])
{
CONS_Alert(CONS_WARNING, "There is no player using that slot!\n");
return;
}
if (invitee == consoleplayer)
{
CONS_Alert(CONS_WARNING, "You cannot invite yourself! Bruh!\n");
return;
}
if (splitscreen_invitations[invitee] >= 0)
{
CONS_Alert(CONS_WARNING,
"That player has already been invited to join another party.\n");
}
if (( splitscreen_party_size[consoleplayer] +
splitscreen_original_party_size[invitee] ) > MAXSPLITSCREENPLAYERS)
{
CONS_Alert(CONS_WARNING,
"That player joined with too many "
"splitscreen players for your party.\n");
}
CONS_Printf(
"Inviting %s...\n",
VaguePartyDescription(
invitee, splitscreen_original_party_size, '\x80')
);
buffer[0] = invitee;
SendNetXCmd(XD_PARTYINVITE, buffer, sizeof buffer);
}
static void
Command_CancelInvite_f (void)
{
UINT8 buffer[1];
int invitee;
if (COM_Argc() != 2)
{
CONS_Printf("cancelinvite <player>: Rescind a party invitation.\n");
return;
}
invitee = LookupPlayer(COM_Argv(1));
if (invitee == -1)
{
CONS_Alert(CONS_WARNING, "There is no player by that name!\n");
return;
}
if (!playeringame[invitee])
{
CONS_Alert(CONS_WARNING, "There is no player using that slot!\n");
return;
}
if (splitscreen_invitations[invitee] != consoleplayer)
{
CONS_Alert(CONS_WARNING,
"You have not invited this player!\n");
}
CONS_Printf(
"Rescinding invite to %s...\n",
VaguePartyDescription(
invitee, splitscreen_original_party_size, '\x80')
);
buffer[0] = invitee;
SendNetXCmd(XD_CANCELPARTYINVITE, buffer, sizeof buffer);
}
static boolean
CheckPartyInvite (void)
{
if (splitscreen_invitations[consoleplayer] < 0)
{
CONS_Alert(CONS_WARNING, "There is no open party invitation.\n");
return false;
}
return true;
}
static void
Command_AcceptInvite_f (void)
{
if (CheckPartyInvite())
SendNetXCmd(XD_ACCEPTPARTYINVITE, NULL, 0);
}
static void
Command_RejectInvite_f (void)
{
if (CheckPartyInvite())
{
CONS_Printf("\x85Rejecting invite...\n");
SendNetXCmd(XD_LEAVEPARTY, NULL, 0);
}
}
static void
Command_LeaveParty_f (void)
{
if (r_splitscreen > splitscreen)
{
CONS_Printf("\x85Leaving party...\n");
SendNetXCmd(XD_LEAVEPARTY, NULL, 0);
}
}
// ========================================================================
// play a demo, add .lmp for external demos
@ -2427,7 +2814,7 @@ void D_ModifyClientVote(SINT8 voted, UINT8 splitplayer)
UINT8 player = consoleplayer;
if (splitplayer > 0)
player = displayplayers[splitplayer];
player = g_localplayers[splitplayer];
WRITESINT8(p, voted);
WRITEUINT8(p, player);
@ -3081,11 +3468,11 @@ static void Command_Teamchange2_f(void)
return;
}
if (players[displayplayers[1]].spectator)
error = !(NetPacket.packet.newteam || (players[displayplayers[1]].pflags & PF_WANTSTOJOIN));
if (players[g_localplayers[1]].spectator)
error = !(NetPacket.packet.newteam || (players[g_localplayers[1]].pflags & PF_WANTSTOJOIN));
else if (G_GametypeHasTeams())
error = (NetPacket.packet.newteam == (unsigned)players[displayplayers[1]].ctfteam);
else if (G_GametypeHasSpectators() && !players[displayplayers[1]].spectator)
error = (NetPacket.packet.newteam == (unsigned)players[g_localplayers[1]].ctfteam);
else if (G_GametypeHasSpectators() && !players[g_localplayers[1]].spectator)
error = (NetPacket.packet.newteam == 3);
#ifdef PARANOIA
else
@ -3172,11 +3559,11 @@ static void Command_Teamchange3_f(void)
return;
}
if (players[displayplayers[2]].spectator)
error = !(NetPacket.packet.newteam || (players[displayplayers[2]].pflags & PF_WANTSTOJOIN));
if (players[g_localplayers[2]].spectator)
error = !(NetPacket.packet.newteam || (players[g_localplayers[2]].pflags & PF_WANTSTOJOIN));
else if (G_GametypeHasTeams())
error = (NetPacket.packet.newteam == (unsigned)players[displayplayers[2]].ctfteam);
else if (G_GametypeHasSpectators() && !players[displayplayers[2]].spectator)
error = (NetPacket.packet.newteam == (unsigned)players[g_localplayers[2]].ctfteam);
else if (G_GametypeHasSpectators() && !players[g_localplayers[2]].spectator)
error = (NetPacket.packet.newteam == 3);
#ifdef PARANOIA
else
@ -3263,11 +3650,11 @@ static void Command_Teamchange4_f(void)
return;
}
if (players[displayplayers[3]].spectator)
error = !(NetPacket.packet.newteam || (players[displayplayers[3]].pflags & PF_WANTSTOJOIN));
if (players[g_localplayers[3]].spectator)
error = !(NetPacket.packet.newteam || (players[g_localplayers[3]].pflags & PF_WANTSTOJOIN));
else if (G_GametypeHasTeams())
error = (NetPacket.packet.newteam == (unsigned)players[displayplayers[3]].ctfteam);
else if (G_GametypeHasSpectators() && !players[displayplayers[3]].spectator)
error = (NetPacket.packet.newteam == (unsigned)players[g_localplayers[3]].ctfteam);
else if (G_GametypeHasSpectators() && !players[g_localplayers[3]].spectator)
error = (NetPacket.packet.newteam == 3);
#ifdef PARANOIA
else
@ -3664,8 +4051,8 @@ static void Got_Teamchange(UINT8 **cp, INT32 playernum)
HU_AddChatText(va("\x82*%s became a spectator.", player_names[playernum]), false); // "entered the game" text was moved to P_SpectatorJoinGame
//reset view if you are changed, or viewing someone who was changed.
if (playernum == consoleplayer || displayplayers[0] == playernum)
displayplayers[0] = consoleplayer;
if (playernum == consoleplayer || g_localplayers[0] == playernum)
g_localplayers[0] = consoleplayer;
if (G_GametypeHasTeams())
{
@ -5310,7 +5697,29 @@ static void Got_PickVotecmd(UINT8 **cp, INT32 playernum)
*/
static void Command_Displayplayer_f(void)
{
CONS_Printf(M_GetText("Displayplayer is %d\n"), displayplayers[0]);
int playernum;
int i;
for (i = 0; i <= splitscreen; ++i)
{
playernum = g_localplayers[i];
CONS_Printf(
"local player %d: \x84(%d) \x83%s\x80\n",
i,
playernum,
player_names[playernum]
);
}
CONS_Printf("\x83----------------------------------------\x80\n");
for (i = 0; i <= r_splitscreen; ++i)
{
playernum = displayplayers[i];
CONS_Printf(
"display player %d: \x84(%d) \x83%s\x80\n",
i,
playernum,
player_names[playernum]
);
}
}
/** Quits a game and returns to the title screen.
@ -5505,7 +5914,7 @@ static void Name2_OnChange(void)
if (cv_mute.value) //Secondary player can't be admin.
{
CONS_Alert(CONS_NOTICE, M_GetText("You may not change your name when chat is muted.\n"));
CV_StealthSet(&cv_playername2, player_names[displayplayers[1]]);
CV_StealthSet(&cv_playername2, player_names[g_localplayers[1]]);
}
else
SendNameAndColor2();
@ -5516,7 +5925,7 @@ static void Name3_OnChange(void)
if (cv_mute.value) //Third player can't be admin.
{
CONS_Alert(CONS_NOTICE, M_GetText("You may not change your name when chat is muted.\n"));
CV_StealthSet(&cv_playername3, player_names[displayplayers[2]]);
CV_StealthSet(&cv_playername3, player_names[g_localplayers[2]]);
}
else
SendNameAndColor3();
@ -5527,7 +5936,7 @@ static void Name4_OnChange(void)
if (cv_mute.value) //Secondary player can't be admin.
{
CONS_Alert(CONS_NOTICE, M_GetText("You may not change your name when chat is muted.\n"));
CV_StealthSet(&cv_playername4, player_names[displayplayers[3]]);
CV_StealthSet(&cv_playername4, player_names[g_localplayers[3]]);
}
else
SendNameAndColor4();
@ -5568,12 +5977,12 @@ static void Skin2_OnChange(void)
if (!Playing() || !splitscreen)
return; // do whatever you want
if (CanChangeSkin(displayplayers[1]) && !P_PlayerMoving(displayplayers[1]))
if (CanChangeSkin(g_localplayers[1]) && !P_PlayerMoving(g_localplayers[1]))
SendNameAndColor2();
else
{
CONS_Alert(CONS_NOTICE, M_GetText("You can't change your skin at the moment.\n"));
CV_StealthSet(&cv_skin2, skins[players[displayplayers[1]].skin].name);
CV_StealthSet(&cv_skin2, skins[players[g_localplayers[1]].skin].name);
}
}
@ -5582,12 +5991,12 @@ static void Skin3_OnChange(void)
if (!Playing() || splitscreen < 2)
return; // do whatever you want
if (CanChangeSkin(displayplayers[2]) && !P_PlayerMoving(displayplayers[2]))
if (CanChangeSkin(g_localplayers[2]) && !P_PlayerMoving(g_localplayers[2]))
SendNameAndColor3();
else
{
CONS_Alert(CONS_NOTICE, M_GetText("You can't change your skin at the moment.\n"));
CV_StealthSet(&cv_skin3, skins[players[displayplayers[2]].skin].name);
CV_StealthSet(&cv_skin3, skins[players[g_localplayers[2]].skin].name);
}
}
@ -5596,12 +6005,12 @@ static void Skin4_OnChange(void)
if (!Playing() || splitscreen < 3)
return; // do whatever you want
if (CanChangeSkin(displayplayers[3]) && !P_PlayerMoving(displayplayers[3]))
if (CanChangeSkin(g_localplayers[3]) && !P_PlayerMoving(g_localplayers[3]))
SendNameAndColor4();
else
{
CONS_Alert(CONS_NOTICE, M_GetText("You can't change your skin at the moment.\n"));
CV_StealthSet(&cv_skin4, skins[players[displayplayers[3]].skin].name);
CV_StealthSet(&cv_skin4, skins[players[g_localplayers[3]].skin].name);
}
}
@ -5642,7 +6051,7 @@ static void Color2_OnChange(void)
if (!Playing() || !splitscreen)
return; // do whatever you want
if (!P_PlayerMoving(displayplayers[1]))
if (!P_PlayerMoving(g_localplayers[1]))
{
// Color change menu scrolling fix is no longer necessary
SendNameAndColor2();
@ -5650,7 +6059,7 @@ static void Color2_OnChange(void)
else
{
CV_StealthSetValue(&cv_playercolor2,
players[displayplayers[1]].skincolor);
players[g_localplayers[1]].skincolor);
}
}
@ -5659,7 +6068,7 @@ static void Color3_OnChange(void)
if (!Playing() || splitscreen < 2)
return; // do whatever you want
if (!P_PlayerMoving(displayplayers[2]))
if (!P_PlayerMoving(g_localplayers[2]))
{
// Color change menu scrolling fix is no longer necessary
SendNameAndColor3();
@ -5667,7 +6076,7 @@ static void Color3_OnChange(void)
else
{
CV_StealthSetValue(&cv_playercolor3,
players[displayplayers[2]].skincolor);
players[g_localplayers[2]].skincolor);
}
}
@ -5676,7 +6085,7 @@ static void Color4_OnChange(void)
if (!Playing() || splitscreen < 3)
return; // do whatever you want
if (!P_PlayerMoving(displayplayers[3]))
if (!P_PlayerMoving(g_localplayers[3]))
{
// Color change menu scrolling fix is no longer necessary
SendNameAndColor4();
@ -5684,7 +6093,7 @@ static void Color4_OnChange(void)
else
{
CV_StealthSetValue(&cv_playercolor4,
players[displayplayers[3]].skincolor);
players[g_localplayers[3]].skincolor);
}
}

View file

@ -182,9 +182,13 @@ typedef enum
XD_PICKVOTE, // 24
XD_REMOVEPLAYER,// 25
XD_POWERLEVEL, // 26
XD_PARTYINVITE, // 27
XD_ACCEPTPARTYINVITE, // 28
XD_LEAVEPARTY, // 29
XD_CANCELPARTYINVITE, // 30
#ifdef HAVE_BLUA
XD_LUACMD, // 27
XD_LUAVAR, // 28
XD_LUACMD, // 31
XD_LUAVAR, // 32
#endif
MAXNETXCMD
} netxcmd_t;

View file

@ -32,8 +32,9 @@ typedef enum
BT_ATTACK = 1<<4, // Use Item
BT_FORWARD = 1<<5, // Aim Item Forward
BT_BACKWARD = 1<<6, // Aim Item Backward
BT_LOOKBACK = 1<<7, // Look Backward
// free: 1<<7 to 1<<12
// free: 1<<8 to 1<<12
// Lua garbage
BT_CUSTOM1 = 1<<13,

View file

@ -242,6 +242,7 @@ extern FILE *logstream;
// NOTE: it needs more than this to increase the number of players...
#define MAXPLAYERS 16
#define MAXSPLITSCREENPLAYERS 4 // Max number of players on a single computer
#define MAXSKINS 128
#define PLAYERSMASK (MAXPLAYERS-1)
#define MAXPLAYERNAME 21

View file

@ -98,8 +98,8 @@ extern boolean multiplayer;
extern INT16 gametype;
#define MAXSPLITSCREENPLAYERS 4 // Max number of players on a single computer
extern UINT8 splitscreen;
extern int r_splitscreen;
extern boolean circuitmap; // Does this level have 'circuit mode'?
extern boolean fromlevelselect;
@ -140,6 +140,20 @@ extern boolean gamedataloaded;
// Player taking events, and displaying.
extern INT32 consoleplayer;
extern INT32 displayplayers[MAXSPLITSCREENPLAYERS];
/* g_localplayers[0] = consoleplayer */
extern INT32 g_localplayers[MAXSPLITSCREENPLAYERS];
/* spitscreen players sync */
extern int splitscreen_original_party_size[MAXPLAYERS];
extern int splitscreen_original_party[MAXPLAYERS][MAXSPLITSCREENPLAYERS];
/* parties */
extern int splitscreen_invitations[MAXPLAYERS];
extern int splitscreen_party_size[MAXPLAYERS];
extern int splitscreen_party[MAXPLAYERS][MAXSPLITSCREENPLAYERS];
/* the only local one */
extern boolean splitscreen_partied[MAXPLAYERS];
// Maps of special importance
extern INT16 spstage_start;

View file

@ -129,6 +129,7 @@ player_t players[MAXPLAYERS];
INT32 consoleplayer; // player taking events and displaying
INT32 displayplayers[MAXSPLITSCREENPLAYERS]; // view being displayed
INT32 g_localplayers[MAXSPLITSCREENPLAYERS];
tic_t gametic;
tic_t levelstarttic; // gametic at level start
@ -1237,7 +1238,6 @@ INT32 JoyAxis(axis_input_e axissel, UINT8 p)
//
INT32 localaiming[MAXSPLITSCREENPLAYERS];
angle_t localangle[MAXSPLITSCREENPLAYERS];
boolean camspin[MAXSPLITSCREENPLAYERS];
static fixed_t forwardmove[2] = {25<<FRACBITS>>16, 50<<FRACBITS>>16};
static fixed_t sidemove[2] = {2<<FRACBITS>>16, 4<<FRACBITS>>16};
@ -1263,7 +1263,7 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
if (ssplayer == 1)
player = &players[consoleplayer];
else
player = &players[displayplayers[ssplayer-1]];
player = &players[g_localplayers[ssplayer-1]];
if (ssplayer == 2)
thiscam = (player->bot == 2 ? &camera[0] : &camera[ssplayer-1]);
@ -1462,6 +1462,11 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
if (InputDown(gc_drift, ssplayer) || (usejoystick && axis > 0))
cmd->buttons |= BT_DRIFT;
// rear view with any button/key
axis = JoyAxis(AXISLOOKBACK, ssplayer);
if (InputDown(gc_lookback, ssplayer) || (usejoystick && axis > 0))
cmd->buttons |= BT_LOOKBACK;
// Lua scriptable buttons
if (InputDown(gc_custom1, ssplayer))
cmd->buttons |= BT_CUSTOM1;
@ -1582,7 +1587,6 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
keyboard_look[ssplayer-1] = kbl;
turnheld[ssplayer-1] = th;
resetdown[ssplayer-1] = rd;
camspin[ssplayer-1] = InputDown(gc_lookback, ssplayer);
}
/* Lua: Allow this hook to overwrite ticcmd.
@ -1602,7 +1606,7 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
//Reset away view if a command is given.
if ((cmd->forwardmove || cmd->sidemove || cmd->buttons)
&& displayplayers[0] != consoleplayer && ssplayer == 1)
&& ! r_splitscreen && displayplayers[0] != consoleplayer && ssplayer == 1)
displayplayers[0] = consoleplayer;
}
@ -1755,12 +1759,12 @@ void G_DoLoadLevel(boolean resetplayer)
if (!resetplayer)
P_FindEmerald();
displayplayers[0] = consoleplayer; // view the guy you are playing
g_localplayers[0] = consoleplayer; // view the guy you are playing
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
{
if (i > 0 && !(i == 1 && botingame) && splitscreen < i)
displayplayers[i] = consoleplayer;
if (i > 0 && !(i == 1 && botingame) && r_splitscreen < i)
g_localplayers[i] = consoleplayer;
}
gameaction = ga_nothing;
@ -1768,10 +1772,10 @@ void G_DoLoadLevel(boolean resetplayer)
Z_CheckHeap(-2);
#endif
for (i = 0; i <= splitscreen; i++)
for (i = 0; i <= r_splitscreen; i++)
{
if (camera[i].chase)
P_ResetCamera(&players[displayplayers[i]], &camera[i]);
P_ResetCamera(&players[g_localplayers[i]], &camera[i]);
}
// clear cmd building stuff
@ -1883,8 +1887,8 @@ boolean G_Responder(event_t *ev)
if (gamestate == GS_LEVEL && ev->type == ev_keydown
&& (ev->data1 == KEY_F12 || ev->data1 == gamecontrol[gc_viewpoint][0] || ev->data1 == gamecontrol[gc_viewpoint][1]))
{
if (!demo.playback && (splitscreen || !netgame))
displayplayers[0] = consoleplayer;
if (!demo.playback && (r_splitscreen || !netgame))
g_localplayers[0] = consoleplayer;
else
{
G_AdjustView(1, 1, true);
@ -2148,7 +2152,7 @@ boolean G_CanView(INT32 playernum, UINT8 viewnum, boolean onlyactive)
if (!(onlyactive ? G_CouldView(playernum) : (playeringame[playernum] && !players[playernum].spectator)))
return false;
splits = splitscreen+1;
splits = r_splitscreen+1;
if (viewnum > splits)
viewnum = splits;
@ -2219,7 +2223,7 @@ void G_ResetView(UINT8 viewnum, INT32 playernum, boolean onlyactive)
INT32 olddisplayplayer;
INT32 playersviewable;
splits = splitscreen+1;
splits = r_splitscreen+1;
/* Promote splits */
if (viewnum > splits)
@ -2230,7 +2234,7 @@ void G_ResetView(UINT8 viewnum, INT32 playernum, boolean onlyactive)
if (viewnum > playersviewable)
viewnum = playersviewable;
splitscreen = viewnum-1;
r_splitscreen = viewnum-1;
/* Prepare extra views for G_FindView to pass. */
for (viewd = splits+1; viewd < viewnum; ++viewd)
@ -2303,14 +2307,14 @@ void G_ResetViews(void)
INT32 playersviewable;
splits = splitscreen+1;
splits = r_splitscreen+1;
playersviewable = G_CountPlayersPotentiallyViewable(false);
/* Demote splits */
if (playersviewable < splits)
{
splits = playersviewable;
splitscreen = max(splits-1, 0);
r_splitscreen = max(splits-1, 0);
R_ExecuteSetViewSize();
}
@ -2892,18 +2896,18 @@ void G_SpawnPlayer(INT32 playernum, boolean starpost)
if (nummapthings)
{
if (playernum == consoleplayer
|| (splitscreen && playernum == displayplayers[1])
|| (splitscreen > 1 && playernum == displayplayers[2])
|| (splitscreen > 2 && playernum == displayplayers[3]))
|| (splitscreen && playernum == g_localplayers[1])
|| (splitscreen > 1 && playernum == g_localplayers[2])
|| (splitscreen > 2 && playernum == g_localplayers[3]))
CONS_Alert(CONS_ERROR, M_GetText("No player spawns found, spawning at the first mapthing!\n"));
spawnpoint = &mapthings[0];
}
else
{
if (playernum == consoleplayer
|| (splitscreen && playernum == displayplayers[1])
|| (splitscreen > 1 && playernum == displayplayers[2])
|| (splitscreen > 2 && playernum == displayplayers[3]))
|| (splitscreen && playernum == g_localplayers[1])
|| (splitscreen > 1 && playernum == g_localplayers[2])
|| (splitscreen > 2 && playernum == g_localplayers[3]))
CONS_Alert(CONS_ERROR, M_GetText("No player spawns found, spawning at the origin!\n"));
//P_MovePlayerToSpawn handles this fine if the spawnpoint is NULL.
}
@ -2998,17 +3002,17 @@ mapthing_t *G_FindMatchStart(INT32 playernum)
return deathmatchstarts[i];
}
if (playernum == consoleplayer
|| (splitscreen && playernum == displayplayers[1])
|| (splitscreen > 1 && playernum == displayplayers[2])
|| (splitscreen > 2 && playernum == displayplayers[3]))
|| (splitscreen && playernum == g_localplayers[1])
|| (splitscreen > 1 && playernum == g_localplayers[2])
|| (splitscreen > 2 && playernum == g_localplayers[3]))
CONS_Alert(CONS_WARNING, M_GetText("Could not spawn at any Deathmatch starts!\n"));
return NULL;
}
if (playernum == consoleplayer
|| (splitscreen && playernum == displayplayers[1])
|| (splitscreen > 1 && playernum == displayplayers[2])
|| (splitscreen > 2 && playernum == displayplayers[3]))
|| (splitscreen && playernum == g_localplayers[1])
|| (splitscreen > 1 && playernum == g_localplayers[2])
|| (splitscreen > 2 && playernum == g_localplayers[3]))
CONS_Alert(CONS_WARNING, M_GetText("No Deathmatch starts in this map!\n"));
return NULL;
}
@ -3096,17 +3100,17 @@ mapthing_t *G_FindRaceStart(INT32 playernum)
//return playerstarts[0];
if (playernum == consoleplayer
|| (splitscreen && playernum == displayplayers[1])
|| (splitscreen > 1 && playernum == displayplayers[2])
|| (splitscreen > 2 && playernum == displayplayers[3]))
|| (splitscreen && playernum == g_localplayers[1])
|| (splitscreen > 1 && playernum == g_localplayers[2])
|| (splitscreen > 2 && playernum == g_localplayers[3]))
CONS_Alert(CONS_WARNING, M_GetText("Could not spawn at any Race starts!\n"));
return NULL;
}
if (playernum == consoleplayer
|| (splitscreen && playernum == displayplayers[1])
|| (splitscreen > 1 && playernum == displayplayers[2])
|| (splitscreen > 2 && playernum == displayplayers[3]))
|| (splitscreen && playernum == g_localplayers[1])
|| (splitscreen > 1 && playernum == g_localplayers[2])
|| (splitscreen > 2 && playernum == g_localplayers[3]))
CONS_Alert(CONS_WARNING, M_GetText("No Race starts in this map!\n"));
return NULL;
}
@ -3721,7 +3725,7 @@ static void G_DoCompleted(void)
}
// play some generic music if there's no win/cool/lose music going on (for exitlevel commands)
if (G_RaceGametype() && ((multiplayer && demo.playback) || j == splitscreen+1) && (cv_inttime.value > 0))
if (G_RaceGametype() && ((multiplayer && demo.playback) || j == r_splitscreen+1) && (cv_inttime.value > 0))
S_ChangeMusicInternal("racent", true);
if (automapactive)

View file

@ -129,6 +129,7 @@ typedef enum
AXISDEAD, //Axises that don't want deadzones
AXISFIRE,
AXISDRIFT,
AXISLOOKBACK,
} axis_input_e;
// mouseaiming (looking up/down with the mouse or keyboard)
@ -154,7 +155,6 @@ INT32 JoyAxis(axis_input_e axissel, UINT8 p);
extern angle_t localangle[MAXSPLITSCREENPLAYERS];
extern INT32 localaiming[MAXSPLITSCREENPLAYERS]; // should be an angle_t but signed
extern boolean camspin[MAXSPLITSCREENPLAYERS]; // SRB2Kart
//
// GAME
@ -308,6 +308,10 @@ void G_ResetViews(void);
void G_ResetView(UINT8 viewnum, INT32 playernum, boolean onlyactive);
void G_AdjustView(UINT8 viewnum, INT32 offset, boolean onlyactive);
void G_AddPartyMember (INT32 party_member, INT32 new_party_member);
void G_RemovePartyMember (INT32 party_member);
void G_ResetSplitscreen (INT32 playernum);
void G_AddPlayer(INT32 playernum);
void G_SetExitGameFlag(void);

209
src/g_splitscreen.c Normal file
View file

@ -0,0 +1,209 @@
// SONIC ROBO BLAST 2 KART
//-----------------------------------------------------------------------------
// Copyright (C) 2020 by James R.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
// See the 'LICENSE' file for more details.
//-----------------------------------------------------------------------------
/// \file g_splitscreen.c
/// \brief some splitscreen stuff
#include "doomdef.h"
#include "g_game.h"
#include "p_local.h"
#include "r_local.h"
INT32 splitscreen_original_party_size[MAXPLAYERS];
INT32 splitscreen_original_party[MAXPLAYERS][MAXSPLITSCREENPLAYERS];
INT32 splitscreen_invitations[MAXPLAYERS];
INT32 splitscreen_party_size[MAXPLAYERS];
INT32 splitscreen_party[MAXPLAYERS][MAXSPLITSCREENPLAYERS];
boolean splitscreen_partied[MAXPLAYERS];
void
G_ResetSplitscreen (INT32 playernum)
{
INT32 old_displayplayers[MAXSPLITSCREENPLAYERS];
INT32 i;
splitscreen_party_size[playernum] =
splitscreen_original_party_size[playernum];
memcpy(splitscreen_party[playernum], splitscreen_original_party[playernum],
sizeof splitscreen_party[playernum]);
if (playernum == consoleplayer)
{
memset(splitscreen_partied, 0, sizeof splitscreen_partied);
splitscreen_partied[consoleplayer] = true;
memcpy(old_displayplayers, displayplayers, sizeof old_displayplayers);
/* easier to just rebuild displayplayers with local players */
for (i = 0; i <= splitscreen; ++i)
{
displayplayers[i] = g_localplayers[i];
P_ResetCamera(&players[displayplayers[i]], &camera[i]);
}
while (i < MAXSPLITSCREENPLAYERS)
{
displayplayers[i] = consoleplayer;
i++;
}
r_splitscreen = splitscreen;
R_ExecuteSetViewSize();
}
}
void
G_RemovePartyMember (INT32 playernum)
{
INT32 old_party[MAXSPLITSCREENPLAYERS];
INT32 new_party[MAXSPLITSCREENPLAYERS];
INT32 old_party_size;
INT32 before;
INT32 after;
INT32 views;
INT32 i;
INT32 n;
old_party_size = splitscreen_party_size[playernum];
for (i = 0; i < old_party_size; ++i)
{
/* exploit that splitscreen players keep order */
if (splitscreen_party[playernum][i] == playernum)
{
before = i;
views = splitscreen_original_party_size[playernum];
after = ( before + views );
memcpy(old_party, splitscreen_party[playernum], sizeof old_party);
memcpy(new_party, old_party, before * sizeof *old_party);
memcpy(&new_party[before], &old_party[after],
( old_party_size - after ) * sizeof *new_party);
views = ( old_party_size - views );
for (i = 0; i < old_party_size; ++i)
{
n = old_party[i];
if (n != playernum && playerconsole[n] == n)
{
splitscreen_party_size[n] = views;
memcpy(splitscreen_party[n], new_party,
sizeof splitscreen_party[n]);
}
}
/* don't want to remove yourself from your own screen! */
if (playernum != consoleplayer && splitscreen_partied[playernum])
{
splitscreen_partied[playernum] = false;
for (i = 0; i < views; ++i)
{
displayplayers[i] = new_party[i];
P_ResetCamera(&players[displayplayers[i]], &camera[i]);
}
while (i < MAXSPLITSCREENPLAYERS)
{
displayplayers[i] = displayplayers[0];
i++;
}
r_splitscreen = ( views - 1 );
R_ExecuteSetViewSize();
}
break;
}
}
}
void
G_AddPartyMember (INT32 invitation, INT32 playernum)
{
INT32 * party;
INT32 *add_party;
INT32 old_party_size;
INT32 new_party_size;
INT32 views;
INT32 i;
INT32 n;
views = splitscreen_original_party_size[playernum];
old_party_size = splitscreen_party_size[invitation];
new_party_size = ( old_party_size + views );
party = splitscreen_party[invitation];
add_party = splitscreen_original_party[playernum];
for (i = 0; i < old_party_size; ++i)
{
n = party[i];
if (playerconsole[n] == n)
{
splitscreen_party_size[n] = new_party_size;
memcpy(&splitscreen_party[n][old_party_size], add_party,
views * sizeof *splitscreen_party[n]);
}
}
splitscreen_party_size[playernum] = new_party_size;
memcpy(splitscreen_party[playernum], party,
sizeof splitscreen_party[playernum]);
/* in my party or adding me? */
if (splitscreen_partied[invitation])
{
splitscreen_partied[playernum] = true;
for (i = old_party_size; i < new_party_size; ++i)
{
displayplayers[i] = party[i];
P_ResetCamera(&players[displayplayers[i]], &camera[i]);
}
r_splitscreen += views;
R_ExecuteSetViewSize();
}
else if (playernum == consoleplayer)
{
for (i = 0; i < new_party_size; ++i)
{
splitscreen_partied[playerconsole[party[i]]] = true;
displayplayers[i] = party[i];
P_ResetCamera(&players[displayplayers[i]], &camera[i]);
}
while (i < MAXSPLITSCREENPLAYERS)
{
displayplayers[i] = displayplayers[0];
i++;
}
r_splitscreen = ( new_party_size - 1 );
R_ExecuteSetViewSize();
}
}

View file

@ -5364,7 +5364,7 @@ static void HWR_AddSprites(sector_t *sec)
if (thing->sprite == SPR_NULL || thing->flags2 & MF2_DONTDRAW)
continue;
if (splitscreen)
if (r_splitscreen)
{
if (thing->eflags & MFE_DRAWONLYFORP1)
if (viewssnum != 0)
@ -5374,11 +5374,11 @@ static void HWR_AddSprites(sector_t *sec)
if (viewssnum != 1)
continue;
if (thing->eflags & MFE_DRAWONLYFORP3 && splitscreen > 1)
if (thing->eflags & MFE_DRAWONLYFORP3 && r_splitscreen > 1)
if (viewssnum != 2)
continue;
if (thing->eflags & MFE_DRAWONLYFORP4 && splitscreen > 2)
if (thing->eflags & MFE_DRAWONLYFORP4 && r_splitscreen > 2)
if (viewssnum != 3)
continue;
}
@ -5399,7 +5399,7 @@ static void HWR_AddSprites(sector_t *sec)
if (thing->sprite == SPR_NULL || thing->flags2 & MF2_DONTDRAW)
continue;
if (splitscreen)
if (r_splitscreen)
{
if (thing->eflags & MFE_DRAWONLYFORP1)
if (viewssnum != 0)
@ -5409,11 +5409,11 @@ static void HWR_AddSprites(sector_t *sec)
if (viewssnum != 1)
continue;
if (thing->eflags & MFE_DRAWONLYFORP3 && splitscreen > 1)
if (thing->eflags & MFE_DRAWONLYFORP3 && r_splitscreen > 1)
if (viewssnum != 2)
continue;
if (thing->eflags & MFE_DRAWONLYFORP4 && splitscreen > 2)
if (thing->eflags & MFE_DRAWONLYFORP4 && r_splitscreen > 2)
if (viewssnum != 3)
continue;
}
@ -5847,7 +5847,7 @@ static void HWR_DrawSkyBackground(void)
dimensionmultiply = ((float)tex->height/(128.0f*aspectratio));
if (splitscreen == 1)
if (r_splitscreen == 1)
{
dimensionmultiply *= 2;
angle *= 2;
@ -5919,10 +5919,10 @@ void HWR_SetViewSize(void)
gr_viewwidth = (float)vid.width;
gr_viewheight = (float)vid.height;
if (splitscreen)
if (r_splitscreen)
gr_viewheight /= 2;
if (splitscreen > 1)
if (r_splitscreen > 1)
gr_viewwidth /= 2;
gr_basecenterx = gr_viewwidth / 2;
@ -5978,13 +5978,13 @@ void HWR_RenderSkyboxView(INT32 viewnumber, player_t *player)
gr_viewwindowy = gr_baseviewwindowy;
gr_windowcentery = gr_basewindowcentery;
if ((splitscreen == 1 && viewnumber == 1) || (splitscreen > 1 && viewnumber > 1))
if ((r_splitscreen == 1 && viewnumber == 1) || (r_splitscreen > 1 && viewnumber > 1))
{
gr_viewwindowy += gr_viewheight;
gr_windowcentery += gr_viewheight;
}
if (splitscreen > 1 && viewnumber & 1)
if (r_splitscreen > 1 && viewnumber & 1)
{
gr_viewwindowx += gr_viewwidth;
gr_windowcenterx += gr_viewwidth;
@ -6026,7 +6026,7 @@ void HWR_RenderSkyboxView(INT32 viewnumber, player_t *player)
atransform.scalez = 1;
atransform.fovxangle = fpov; // Tails
atransform.fovyangle = fpov; // Tails
atransform.splitscreen = splitscreen;
atransform.splitscreen = r_splitscreen;
gr_fovlud = (float)(1.0l/tan((double)(fpov*M_PIl/360l)));
@ -6045,7 +6045,7 @@ if (0)
HWR_DrawSkyBackground();
//Hurdler: it doesn't work in splitscreen mode
drawsky = splitscreen;
drawsky = r_splitscreen;
HWR_ClearSprites();
@ -6078,11 +6078,11 @@ if (0)
// Make a viewangle int so we can render things based on mouselook
if (player == &players[consoleplayer])
viewangle = localaiming[0];
else if (splitscreen && player == &players[displayplayers[1]])
else if (r_splitscreen && player == &players[displayplayers[1]])
viewangle = localaiming[1];
else if (splitscreen > 1 && player == &players[displayplayers[2]])
else if (r_splitscreen > 1 && player == &players[displayplayers[2]])
viewangle = localaiming[2];
else if (splitscreen > 2 && player == &players[displayplayers[3]])
else if (r_splitscreen > 2 && player == &players[displayplayers[3]])
viewangle = localaiming[3];
// Handle stuff when you are looking farther up or down.
@ -6212,13 +6212,13 @@ void HWR_RenderPlayerView(INT32 viewnumber, player_t *player)
gr_viewwindowy = gr_baseviewwindowy;
gr_windowcentery = gr_basewindowcentery;
if ((splitscreen == 1 && viewnumber == 1) || (splitscreen > 1 && viewnumber > 1))
if ((r_splitscreen == 1 && viewnumber == 1) || (r_splitscreen > 1 && viewnumber > 1))
{
gr_viewwindowy += gr_viewheight;
gr_windowcentery += gr_viewheight;
}
if (splitscreen > 1 && viewnumber & 1)
if (r_splitscreen > 1 && viewnumber & 1)
{
gr_viewwindowx += gr_viewwidth;
gr_windowcenterx += gr_viewwidth;
@ -6260,7 +6260,7 @@ void HWR_RenderPlayerView(INT32 viewnumber, player_t *player)
atransform.scalez = 1;
atransform.fovxangle = fpov; // Tails
atransform.fovyangle = fpov; // Tails
atransform.splitscreen = splitscreen;
atransform.splitscreen = r_splitscreen;
gr_fovlud = (float)(1.0l/tan((double)(fpov*M_PIl/360l)));
@ -6279,7 +6279,7 @@ if (0)
HWR_DrawSkyBackground();
//Hurdler: it doesn't work in splitscreen mode
drawsky = splitscreen;
drawsky = r_splitscreen;
HWR_ClearSprites();
@ -6312,11 +6312,11 @@ if (0)
// Make a viewangle int so we can render things based on mouselook
if (player == &players[consoleplayer])
viewangle = localaiming[0];
else if (splitscreen && player == &players[displayplayers[1]])
else if (r_splitscreen && player == &players[displayplayers[1]])
viewangle = localaiming[1];
else if (splitscreen > 1 && player == &players[displayplayers[2]])
else if (r_splitscreen > 1 && player == &players[displayplayers[2]])
viewangle = localaiming[2];
else if (splitscreen > 2 && player == &players[displayplayers[3]])
else if (r_splitscreen > 2 && player == &players[displayplayers[3]])
viewangle = localaiming[3];
// Handle stuff when you are looking farther up or down.
@ -6796,7 +6796,7 @@ void HWR_DoPostProcessor(player_t *player)
postimg_t *type = &postimgtype[0];
UINT8 i;
for (i = splitscreen; i > 0; i--)
for (i = r_splitscreen; i > 0; i--)
{
if (player == &players[displayplayers[i]])
{
@ -6834,7 +6834,7 @@ void HWR_DoPostProcessor(player_t *player)
if(gamestate != GS_INTERMISSION)
HWD.pfnMakeScreenTexture();
if (splitscreen) // Not supported in splitscreen - someone want to add support?
if (r_splitscreen) // Not supported in splitscreen - someone want to add support?
return;
// Drunken vision! WooOOooo~

View file

@ -78,6 +78,7 @@ patch_t *cred_font[CRED_FONTSIZE];
// Note: I'd like to adress that at this point we might *REALLY* want to work towards a common drawString function that can take any font we want because this is really turning into a MESS. :V -Lat'
patch_t *pingnum[10];
patch_t *pinggfx[5]; // small ping graphic
patch_t *mping[5]; // smaller ping graphic
patch_t *framecounter;
patch_t *frameslash; // framerate stuff. Used in screen.c
@ -311,6 +312,8 @@ void HU_LoadGraphics(void)
{
sprintf(buffer, "PINGGFX%d", i+1);
pinggfx[i] = (patch_t *)W_CachePatchName(buffer, PU_HUDGFX);
sprintf(buffer, "MPING%d", i+1);
mping[i] = (patch_t *)W_CachePatchName(buffer, PU_HUDGFX);
}
// fps stuff
@ -1477,7 +1480,7 @@ static void HU_drawMiniChat(void)
if (!chat_nummsg_min)
return; // needless to say it's useless to do anything if we don't have anything to draw.
if (splitscreen > 1)
if (r_splitscreen > 1)
boxw = max(64, boxw/2);
for (; i>0; i--)
@ -1529,10 +1532,10 @@ static void HU_drawMiniChat(void)
y = chaty - charheight*(msglines+1);
#ifdef NETSPLITSCREEN
if (splitscreen)
if (r_splitscreen)
{
y -= BASEVIDHEIGHT/2;
if (splitscreen > 1)
if (r_splitscreen > 1)
y += 16;
}
else
@ -1620,10 +1623,10 @@ static void HU_drawChatLog(INT32 offset)
chat_scroll = chat_maxscroll;
#ifdef NETSPLITSCREEN
if (splitscreen)
if (r_splitscreen)
{
boxh = max(6, boxh/2);
if (splitscreen > 1)
if (r_splitscreen > 1)
boxw = max(64, boxw/2);
}
#endif
@ -1631,10 +1634,10 @@ static void HU_drawChatLog(INT32 offset)
y = chaty - offset*charheight - (chat_scroll*charheight) - boxh*charheight - 12;
#ifdef NETSPLITSCREEN
if (splitscreen)
if (r_splitscreen)
{
y -= BASEVIDHEIGHT/2;
if (splitscreen > 1)
if (r_splitscreen > 1)
y += 16;
}
else
@ -1739,10 +1742,10 @@ static void HU_DrawChat(void)
const char *mute = "Chat has been muted.";
#ifdef NETSPLITSCREEN
if (splitscreen)
if (r_splitscreen)
{
y -= BASEVIDHEIGHT/2;
if (splitscreen > 1)
if (r_splitscreen > 1)
{
y += 16;
boxw = max(64, boxw/2);
@ -1836,10 +1839,10 @@ static void HU_DrawChat(void)
INT32 count = 0;
INT32 p_dispy = chaty - charheight -1;
#ifdef NETSPLITSCREEN
if (splitscreen)
if (r_splitscreen)
{
p_dispy -= BASEVIDHEIGHT/2;
if (splitscreen > 1)
if (r_splitscreen > 1)
p_dispy += 16;
}
else
@ -2250,7 +2253,7 @@ void HU_DrawSongCredits(void)
{
char *str;
INT32 len, destx;
INT32 y = (splitscreen ? (BASEVIDHEIGHT/2)-4 : 32);
INT32 y = (r_splitscreen ? (BASEVIDHEIGHT/2)-4 : 32);
INT32 bgt;
if (!cursongcredit.def) // No def
@ -2480,22 +2483,30 @@ void HU_Erase(void)
// IN-LEVEL MULTIPLAYER RANKINGS
//======================================================================
static int
Ping_gfx_num (int ping)
{
if (ping < 76)
return 0;
else if (ping < 137)
return 1;
else if (ping < 256)
return 2;
else if (ping < 500)
return 3;
else
return 4;
}
//
// HU_drawPing
//
void HU_drawPing(INT32 x, INT32 y, UINT32 ping, INT32 flags)
{
INT32 gfxnum = 4; // gfx to draw
INT32 gfxnum; // gfx to draw
UINT8 const *colormap = R_GetTranslationColormap(TC_RAINBOW, SKINCOLOR_SALMON, GTC_CACHE);
if (ping < 76)
gfxnum = 0;
else if (ping < 137)
gfxnum = 1;
else if (ping < 256)
gfxnum = 2;
else if (ping < 500)
gfxnum = 3;
gfxnum = Ping_gfx_num(ping);
V_DrawScaledPatch(x, y, flags, pinggfx[gfxnum]);
if (servermaxping && ping > servermaxping && hu_tick < 4) // flash ping red if too high
@ -2504,6 +2515,19 @@ void HU_drawPing(INT32 x, INT32 y, UINT32 ping, INT32 flags)
V_DrawPingNum(x, y+9, flags, ping, NULL);
}
void
HU_drawMiniPing (INT32 x, INT32 y, UINT32 ping, INT32 flags)
{
patch_t *patch;
patch = mping[Ping_gfx_num(ping)];
if (( flags & V_SNAPTORIGHT ))
x += ( BASEVIDWIDTH - SHORT (patch->width) );
V_DrawScaledPatch(x, y, flags, patch);
}
//
// HU_DrawTabRankings -- moved to k_kart.c
//
@ -3022,7 +3046,7 @@ static void HU_DrawRankings(void)
// When you play, you quickly see your score because your name is displayed in white.
// When playing back a demo, you quickly see who's the view.
if (!splitscreen)
if (!r_splitscreen)
whiteplayer = demo.playback ? displayplayers[0] : consoleplayer;
scorelines = 0;

View file

@ -115,6 +115,7 @@ char HU_dequeueChatChar(void);
void HU_Erase(void);
void HU_clearChatChars(void);
void HU_drawPing(INT32 x, INT32 y, UINT32 ping, INT32 flags); // Lat': Ping drawer for scoreboard.
void HU_drawMiniPing(INT32 x, INT32 y, UINT32 ping, INT32 flags);
//void HU_DrawTeamTabRankings(playersort_t *tab, INT32 whiteplayer);
//void HU_DrawDualTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scorelines, INT32 whiteplayer);
void HU_DrawTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scorelines, INT32 whiteplayer, INT32 hilicol);

View file

@ -1054,7 +1054,7 @@ static void K_KartItemRoulette(player_t *player, ticcmd_t *cmd)
if ((player->kartstuff[k_itemroulette] % 3) == 1 && P_IsDisplayPlayer(player))
{
#define PLAYROULETTESND S_StartSound(NULL, sfx_itrol1 + ((player->kartstuff[k_itemroulette] / 3) % 8))
for (i = 0; i <= splitscreen; i++)
for (i = 0; i <= r_splitscreen; i++)
{
if (player == &players[displayplayers[i]] && players[displayplayers[i]].kartstuff[k_itemroulette])
PLAYROULETTESND;
@ -4282,7 +4282,7 @@ static void K_DoHyudoroSteal(player_t *player)
players[stealplayer].kartstuff[k_itemamount] = 0;
players[stealplayer].kartstuff[k_itemheld] = 0;
if (P_IsDisplayPlayer(&players[stealplayer]) && !splitscreen)
if (P_IsDisplayPlayer(&players[stealplayer]) && !r_splitscreen)
S_StartSound(NULL, sfx_s3k92);
}
}
@ -7415,7 +7415,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
if (player->kartstuff[k_hyudorotimer] > 0)
{
if (splitscreen)
if (r_splitscreen)
{
if (leveltime & 1)
player->mo->flags2 |= MF2_DONTDRAW;
@ -7426,9 +7426,9 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
{
if (player == &players[displayplayers[1]])
player->mo->eflags |= MFE_DRAWONLYFORP2;
else if (player == &players[displayplayers[2]] && splitscreen > 1)
else if (player == &players[displayplayers[2]] && r_splitscreen > 1)
player->mo->eflags |= MFE_DRAWONLYFORP3;
else if (player == &players[displayplayers[3]] && splitscreen > 2)
else if (player == &players[displayplayers[3]] && r_splitscreen > 2)
player->mo->eflags |= MFE_DRAWONLYFORP4;
else if (player == &players[displayplayers[0]])
player->mo->eflags |= MFE_DRAWONLYFORP1;
@ -7546,7 +7546,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
}
// Play the starting countdown sounds
if (player == &players[displayplayers[0]]) // Don't play louder in splitscreen
if (player == &players[g_localplayers[0]]) // Don't play louder in splitscreen
{
if ((leveltime == starttime-(3*TICRATE)) || (leveltime == starttime-(2*TICRATE)) || (leveltime == starttime-TICRATE))
S_StartSound(NULL, sfx_s3ka7);
@ -8284,7 +8284,7 @@ static void K_initKartHUD(void)
WANT_X = BASEVIDWIDTH - 55; // 270
WANT_Y = BASEVIDHEIGHT- 71; // 176
if (splitscreen) // Splitscreen
if (r_splitscreen) // Splitscreen
{
ITEM_X = 5;
ITEM_Y = 3;
@ -8297,7 +8297,7 @@ static void K_initKartHUD(void)
MINI_Y = (BASEVIDHEIGHT/2);
if (splitscreen > 1) // 3P/4P Small Splitscreen
if (r_splitscreen > 1) // 3P/4P Small Splitscreen
{
// 1P (top left)
ITEM_X = -9;
@ -8326,7 +8326,7 @@ static void K_initKartHUD(void)
MINI_X = (3*BASEVIDWIDTH/4);
MINI_Y = (3*BASEVIDHEIGHT/4);
if (splitscreen > 2) // 4P-only
if (r_splitscreen > 2) // 4P-only
{
MINI_X = (BASEVIDWIDTH/2);
MINI_Y = (BASEVIDHEIGHT/2);
@ -8346,20 +8346,20 @@ INT32 K_calcSplitFlags(INT32 snapflags)
{
INT32 splitflags = 0;
if (splitscreen == 0)
if (r_splitscreen == 0)
return snapflags;
if (stplyr != &players[displayplayers[0]])
{
if (splitscreen == 1 && stplyr == &players[displayplayers[1]])
if (r_splitscreen == 1 && stplyr == &players[displayplayers[1]])
{
splitflags |= V_SPLITSCREEN;
}
else if (splitscreen > 1)
else if (r_splitscreen > 1)
{
if (stplyr == &players[displayplayers[2]] || (splitscreen == 3 && stplyr == &players[displayplayers[3]]))
if (stplyr == &players[displayplayers[2]] || (r_splitscreen == 3 && stplyr == &players[displayplayers[3]]))
splitflags |= V_SPLITSCREEN;
if (stplyr == &players[displayplayers[1]] || (splitscreen == 3 && stplyr == &players[displayplayers[3]]))
if (stplyr == &players[displayplayers[1]] || (r_splitscreen == 3 && stplyr == &players[displayplayers[3]]))
splitflags |= V_HORZSCREEN;
}
}
@ -8369,7 +8369,7 @@ INT32 K_calcSplitFlags(INT32 snapflags)
else
snapflags &= ~V_SNAPTOBOTTOM;
if (splitscreen > 1)
if (r_splitscreen > 1)
{
if (splitflags & V_HORZSCREEN)
snapflags &= ~V_SNAPTOLEFT;
@ -8387,7 +8387,7 @@ static void K_drawKartItem(void)
// Why write V_DrawScaledPatch calls over and over when they're all the same?
// Set to 'no item' just in case.
const UINT8 offset = ((splitscreen > 1) ? 1 : 0);
const UINT8 offset = ((r_splitscreen > 1) ? 1 : 0);
patch_t *localpatch = kp_nodraw;
patch_t *localbg = ((offset) ? kp_itembg[2] : kp_itembg[0]);
patch_t *localinv = ((offset) ? kp_invincibility[((leveltime % (6*3)) / 3) + 7] : kp_invincibility[(leveltime % (7*3)) / 3]);
@ -8396,7 +8396,7 @@ static void K_drawKartItem(void)
const INT32 numberdisplaymin = ((!offset && stplyr->kartstuff[k_itemtype] == KITEM_ORBINAUT) ? 5 : 2);
INT32 itembar = 0;
INT32 maxl = 0; // itembar's normal highest value
const INT32 barlength = (splitscreen > 1 ? 12 : 26);
const INT32 barlength = (r_splitscreen > 1 ? 12 : 26);
UINT8 localcolor = SKINCOLOR_NONE;
SINT8 colormode = TC_RAINBOW;
UINT8 *colmap = NULL;
@ -8628,7 +8628,7 @@ static void K_drawKartItem(void)
}
// pain and suffering defined below
if (splitscreen < 2) // don't change shit for THIS splitscreen.
if (r_splitscreen < 2) // don't change shit for THIS splitscreen.
{
fx = ITEM_X;
fy = ITEM_Y;
@ -8873,19 +8873,19 @@ static void K_DrawKartPositionNum(INT32 num)
scale *= 2;
overtake = true; // this is used for splitscreen stuff in conjunction with flipdraw.
}
if (splitscreen)
if (r_splitscreen)
scale /= 2;
W = FixedMul(W<<FRACBITS, scale)>>FRACBITS;
// pain and suffering defined below
if (!splitscreen)
if (!r_splitscreen)
{
fx = POSI_X;
fy = BASEVIDHEIGHT - 8;
fflags = V_SNAPTOBOTTOM|V_SNAPTORIGHT;
}
else if (splitscreen == 1) // for this splitscreen, we'll use case by case because it's a bit different.
else if (r_splitscreen == 1) // for this splitscreen, we'll use case by case because it's a bit different.
{
fx = POSI_X;
if (stplyr == &players[displayplayers[0]]) // for player 1: display this at the top right, above the minimap.
@ -9152,7 +9152,7 @@ void HU_DrawTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scorelines, I
y2 = y;
if (tab[i].num == 0 && server_lagless)
if (playerconsole[tab[i].num] == 0 && server_lagless)
{
y2 = ( y - 4 );
@ -9276,16 +9276,16 @@ static void K_drawKartLapsAndRings(void)
{
ringflip = V_FLIP;
ringanim_realframe = RINGANIM_NUMFRAMES-stplyr->karthud[khud_ringframe];
ringx += SHORT((splitscreen > 1) ? kp_smallring[ringanim_realframe]->width : kp_ring[ringanim_realframe]->width);
ringx += SHORT((r_splitscreen > 1) ? kp_smallring[ringanim_realframe]->width : kp_ring[ringanim_realframe]->width);
}
if (splitscreen > 1)
if (r_splitscreen > 1)
{
INT32 fx = 0, fy = 0, fr = 0;
INT32 flipflag = 0;
// pain and suffering defined below
if (splitscreen < 2) // don't change shit for THIS splitscreen.
if (r_splitscreen < 2) // don't change shit for THIS splitscreen.
{
fx = LAPS_X;
fy = LAPS_Y;
@ -9468,13 +9468,13 @@ static void K_drawKartBumpersOrKarma(void)
UINT8 *colormap = R_GetTranslationColormap(TC_DEFAULT, stplyr->skincolor, GTC_CACHE);
INT32 splitflags = K_calcSplitFlags(V_SNAPTOBOTTOM|V_SNAPTOLEFT);
if (splitscreen > 1)
if (r_splitscreen > 1)
{
INT32 fx = 0, fy = 0;
INT32 flipflag = 0;
// pain and suffering defined below
if (splitscreen < 2) // don't change shit for THIS splitscreen.
if (r_splitscreen < 2) // don't change shit for THIS splitscreen.
{
fx = LAPS_X;
fy = LAPS_Y;
@ -9614,7 +9614,7 @@ static fixed_t K_FindCheckX(fixed_t px, fixed_t py, angle_t ang, fixed_t mx, fix
if (encoremode)
x = 320-x;
if (splitscreen > 1)
if (r_splitscreen > 1)
x /= 2;
return x;
@ -9640,17 +9640,17 @@ static void K_drawKartWanted(void)
return;
// set X/Y coords depending on splitscreen.
if (splitscreen < 3) // 1P and 2P use the same code.
if (r_splitscreen < 3) // 1P and 2P use the same code.
{
basex = WANT_X;
basey = WANT_Y;
if (splitscreen == 2)
if (r_splitscreen == 2)
{
basey += 16; // slight adjust for 3P
basex -= 6;
}
}
else if (splitscreen == 3) // 4P splitscreen...
else if (r_splitscreen == 3) // 4P splitscreen...
{
basex = BASEVIDWIDTH/2 - (SHORT(kp_wantedsplit->width)/2); // center on screen
basey = BASEVIDHEIGHT - 55;
@ -9659,13 +9659,13 @@ static void K_drawKartWanted(void)
if (battlewanted[0] != -1)
colormap = R_GetTranslationColormap(0, players[battlewanted[0]].skincolor, GTC_CACHE);
V_DrawFixedPatch(basex<<FRACBITS, basey<<FRACBITS, FRACUNIT, V_HUDTRANS|(splitscreen < 3 ? V_SNAPTORIGHT : 0)|V_SNAPTOBOTTOM, (splitscreen > 1 ? kp_wantedsplit : kp_wanted), colormap);
V_DrawFixedPatch(basex<<FRACBITS, basey<<FRACBITS, FRACUNIT, V_HUDTRANS|(r_splitscreen < 3 ? V_SNAPTORIGHT : 0)|V_SNAPTOBOTTOM, (r_splitscreen > 1 ? kp_wantedsplit : kp_wanted), colormap);
/*if (basey2)
V_DrawFixedPatch(basex<<FRACBITS, basey2<<FRACBITS, FRACUNIT, V_HUDTRANS|V_SNAPTOTOP, (splitscreen == 3 ? kp_wantedsplit : kp_wanted), colormap); // < used for 4p splits.*/
for (i = 0; i < numwanted; i++)
{
INT32 x = basex+(splitscreen > 1 ? 13 : 8), y = basey+(splitscreen > 1 ? 16 : 21);
INT32 x = basex+(r_splitscreen > 1 ? 13 : 8), y = basey+(r_splitscreen > 1 ? 16 : 21);
fixed_t scale = FRACUNIT/2;
player_t *p = &players[battlewanted[i]];
@ -9685,7 +9685,7 @@ static void K_drawKartWanted(void)
if (players[battlewanted[i]].skincolor)
{
colormap = R_GetTranslationColormap(TC_RAINBOW, p->skincolor, GTC_CACHE);
V_DrawFixedPatch(x<<FRACBITS, y<<FRACBITS, FRACUNIT, V_HUDTRANS|(splitscreen < 3 ? V_SNAPTORIGHT : 0)|V_SNAPTOBOTTOM, (scale == FRACUNIT ? facewantprefix[p->skin] : facerankprefix[p->skin]), colormap);
V_DrawFixedPatch(x<<FRACBITS, y<<FRACBITS, FRACUNIT, V_HUDTRANS|(r_splitscreen < 3 ? V_SNAPTORIGHT : 0)|V_SNAPTOBOTTOM, (scale == FRACUNIT ? facewantprefix[p->skin] : facerankprefix[p->skin]), colormap);
/*if (basey2) // again with 4p stuff
V_DrawFixedPatch(x<<FRACBITS, (y - (basey-basey2))<<FRACBITS, FRACUNIT, V_HUDTRANS|V_SNAPTOTOP, (scale == FRACUNIT ? facewantprefix[p->skin] : facerankprefix[p->skin]), colormap);*/
}
@ -9706,7 +9706,7 @@ static void K_drawKartPlayerCheck(void)
if (stplyr->awayviewtics)
return;
if (camspin[0])
if (( stplyr->cmd.buttons & BT_LOOKBACK ))
return;
for (i = 0; i < MAXPLAYERS; i++)
@ -9822,7 +9822,7 @@ static void K_drawKartMinimap(void)
patch_t *AutomapPic;
INT32 i = 0;
INT32 x, y;
INT32 minimaptrans, splitflags = (splitscreen == 3 ? 0 : V_SNAPTORIGHT); // flags should only be 0 when it's centered (4p split)
INT32 minimaptrans, splitflags = (r_splitscreen == 3 ? 0 : V_SNAPTORIGHT); // flags should only be 0 when it's centered (4p split)
UINT8 skin = 0;
UINT8 *colormap = NULL;
SINT8 localplayers[4];
@ -9868,7 +9868,7 @@ static void K_drawKartMinimap(void)
else
V_DrawScaledPatch(x, y, splitflags, AutomapPic);
if (!(splitscreen == 2))
if (!(r_splitscreen == 2))
{
splitflags &= ~minimaptrans;
splitflags |= V_HUDTRANSHALF;
@ -9937,7 +9937,7 @@ static void K_drawKartMinimap(void)
if (!players[i].mo || players[i].spectator)
continue;
if (i != displayplayers[0] || splitscreen)
if (i != displayplayers[0] || r_splitscreen)
{
if (G_BattleGametype() && players[i].kartstuff[k_bumper] <= 0)
continue;
@ -10047,7 +10047,7 @@ static void K_drawKartStartCountdown(void)
pnum++;
if ((leveltime % (2*5)) / 5) // blink
pnum += 4;
if (splitscreen) // splitscreen
if (r_splitscreen) // splitscreen
pnum += 8;
V_DrawScaledPatch(STCD_X - (SHORT(kp_startcountdown[pnum]->width)/2), STCD_Y - (SHORT(kp_startcountdown[pnum]->height)/2), splitflags, kp_startcountdown[pnum]);
@ -10063,7 +10063,7 @@ static void K_drawKartFinish(void)
if ((stplyr->karthud[khud_cardanimation] % (2*5)) / 5) // blink
pnum = 1;
if (splitscreen > 1) // 3/4p, stationary FIN
if (r_splitscreen > 1) // 3/4p, stationary FIN
{
pnum += 2;
V_DrawScaledPatch(STCD_X - (SHORT(kp_racefinish[pnum]->width)/2), STCD_Y - (SHORT(kp_racefinish[pnum]->height)/2), splitflags, kp_racefinish[pnum]);
@ -10074,14 +10074,14 @@ static void K_drawKartFinish(void)
{
INT32 x, xval;
if (splitscreen) // wide splitscreen
if (r_splitscreen) // wide splitscreen
pnum += 4;
x = ((vid.width<<FRACBITS)/vid.dupx);
xval = (SHORT(kp_racefinish[pnum]->width)<<FRACBITS);
x = ((TICRATE - stplyr->karthud[khud_cardanimation])*(xval > x ? xval : x))/TICRATE;
if (splitscreen && stplyr == &players[displayplayers[1]])
if (r_splitscreen && stplyr == &players[displayplayers[1]])
x = -x;
V_DrawFixedPatch(x + (STCD_X<<FRACBITS) - (xval>>1),
@ -10103,11 +10103,11 @@ static void K_drawBattleFullscreen(void)
drawcomebacktimer = false;
#endif
if (splitscreen)
if (r_splitscreen)
{
if ((splitscreen == 1 && stplyr == &players[displayplayers[1]])
|| (splitscreen > 1 && (stplyr == &players[displayplayers[2]]
|| (stplyr == &players[displayplayers[3]] && splitscreen > 2))))
if ((r_splitscreen == 1 && stplyr == &players[displayplayers[1]])
|| (r_splitscreen > 1 && (stplyr == &players[displayplayers[2]]
|| (stplyr == &players[displayplayers[3]] && r_splitscreen > 2))))
{
y = 232-(stplyr->karthud[khud_cardanimation]/2);
splitflags = V_SNAPTOBOTTOM;
@ -10115,12 +10115,12 @@ static void K_drawBattleFullscreen(void)
else
y = -32+(stplyr->karthud[khud_cardanimation]/2);
if (splitscreen > 1)
if (r_splitscreen > 1)
{
scale /= 2;
if (stplyr == &players[displayplayers[1]]
|| (stplyr == &players[displayplayers[3]] && splitscreen > 2))
|| (stplyr == &players[displayplayers[3]] && r_splitscreen > 2))
x = 3*BASEVIDWIDTH/4;
else
x = BASEVIDWIDTH/4;
@ -10160,7 +10160,7 @@ static void K_drawBattleFullscreen(void)
else if (stplyr->kartstuff[k_bumper] <= 0 && stplyr->kartstuff[k_comebacktimer] && comeback && !stplyr->spectator && drawcomebacktimer)
{
UINT16 t = stplyr->kartstuff[k_comebacktimer]/(10*TICRATE);
INT32 txoff, adjust = (splitscreen > 1) ? 4 : 6; // normal string is 8, kart string is 12, half of that for ease
INT32 txoff, adjust = (r_splitscreen > 1) ? 4 : 6; // normal string is 8, kart string is 12, half of that for ease
INT32 ty = (BASEVIDHEIGHT/2)+66;
txoff = adjust;
@ -10171,13 +10171,13 @@ static void K_drawBattleFullscreen(void)
t /= 10;
}
if (splitscreen)
if (r_splitscreen)
{
if (splitscreen > 1)
if (r_splitscreen > 1)
ty = (BASEVIDHEIGHT/4)+33;
if ((splitscreen == 1 && stplyr == &players[displayplayers[1]])
|| (stplyr == &players[displayplayers[2]] && splitscreen > 1)
|| (stplyr == &players[displayplayers[3]] && splitscreen > 2))
if ((r_splitscreen == 1 && stplyr == &players[displayplayers[1]])
|| (stplyr == &players[displayplayers[2]] && r_splitscreen > 1)
|| (stplyr == &players[displayplayers[3]] && r_splitscreen > 2))
ty += (BASEVIDHEIGHT/2);
}
else
@ -10188,7 +10188,7 @@ static void K_drawBattleFullscreen(void)
else
V_DrawFixedPatch(x<<FRACBITS, y<<FRACBITS, scale, splitflags, kp_battlewait, NULL);
if (splitscreen > 1)
if (r_splitscreen > 1)
V_DrawString(x-txoff, ty, 0, va("%d", stplyr->kartstuff[k_comebacktimer]/TICRATE));
else
{
@ -10230,24 +10230,24 @@ static void K_drawKartFirstPerson(void)
if (stplyr->spectator || !stplyr->mo || (stplyr->mo->flags2 & MF2_DONTDRAW))
return;
if (stplyr == &players[displayplayers[1]] && splitscreen)
if (stplyr == &players[displayplayers[1]] && r_splitscreen)
{ pn = pnum[1]; tn = turn[1]; dr = drift[1]; }
else if (stplyr == &players[displayplayers[2]] && splitscreen > 1)
else if (stplyr == &players[displayplayers[2]] && r_splitscreen > 1)
{ pn = pnum[2]; tn = turn[2]; dr = drift[2]; }
else if (stplyr == &players[displayplayers[3]] && splitscreen > 2)
else if (stplyr == &players[displayplayers[3]] && r_splitscreen > 2)
{ pn = pnum[3]; tn = turn[3]; dr = drift[3]; }
else
{ pn = pnum[0]; tn = turn[0]; dr = drift[0]; }
if (splitscreen)
if (r_splitscreen)
{
y >>= 1;
if (splitscreen > 1)
if (r_splitscreen > 1)
x >>= 1;
}
{
if (stplyr->speed < (20*stplyr->mo->scale) && (leveltime & 1) && !splitscreen)
if (stplyr->speed < (20*stplyr->mo->scale) && (leveltime & 1) && !r_splitscreen)
y++;
// the following isn't EXPLICITLY right, it just gets the result we want, but i'm too lazy to look up the right way to do it
if (stplyr->mo->flags2 & MF2_SHADOW)
@ -10291,12 +10291,12 @@ static void K_drawKartFirstPerson(void)
if (dr != stplyr->kartstuff[k_drift]*16)
dr -= (dr - (stplyr->kartstuff[k_drift]*16))/8;
if (splitscreen == 1)
if (r_splitscreen == 1)
{
scale = (2*FRACUNIT)/3;
y += FRACUNIT/(vid.dupx < vid.dupy ? vid.dupx : vid.dupy); // correct a one-pixel gap on the screen view (not the basevid view)
}
else if (splitscreen)
else if (r_splitscreen)
scale = FRACUNIT/2;
else
scale = FRACUNIT;
@ -10309,7 +10309,7 @@ static void K_drawKartFirstPerson(void)
fixed_t xoffs = -P_ReturnThrustY(stplyr->mo, ang, (BASEVIDWIDTH<<(FRACBITS-2))/2);
fixed_t yoffs = -(P_ReturnThrustX(stplyr->mo, ang, 4*FRACUNIT) - 4*FRACUNIT);
if (splitscreen)
if (r_splitscreen)
xoffs = FixedMul(xoffs, scale);
xoffs -= (tn)*scale;
@ -10322,7 +10322,7 @@ static void K_drawKartFirstPerson(void)
if (mag < FRACUNIT)
{
xoffs = FixedMul(xoffs, mag);
if (!splitscreen)
if (!r_splitscreen)
yoffs = FixedMul(yoffs, mag);
}
}
@ -10334,7 +10334,7 @@ static void K_drawKartFirstPerson(void)
x -= xoffs;
else
x += xoffs;
if (!splitscreen)
if (!r_splitscreen)
y += yoffs;
@ -10346,11 +10346,11 @@ static void K_drawKartFirstPerson(void)
V_DrawFixedPatch(x, y, scale, splitflags, kp_fpview[target], colmap);
if (stplyr == &players[displayplayers[1]] && splitscreen)
if (stplyr == &players[displayplayers[1]] && r_splitscreen)
{ pnum[1] = pn; turn[1] = tn; drift[1] = dr; }
else if (stplyr == &players[displayplayers[2]] && splitscreen > 1)
else if (stplyr == &players[displayplayers[2]] && r_splitscreen > 1)
{ pnum[2] = pn; turn[2] = tn; drift[2] = dr; }
else if (stplyr == &players[displayplayers[3]] && splitscreen > 2)
else if (stplyr == &players[displayplayers[3]] && r_splitscreen > 2)
{ pnum[3] = pn; turn[3] = tn; drift[3] = dr; }
else
{ pnum[0] = pn; turn[0] = tn; drift[0] = dr; }
@ -10537,6 +10537,35 @@ void K_drawKartFreePlay(UINT32 flashtime)
LAPS_Y+3, V_HUDTRANS|V_SNAPTOBOTTOM|V_SNAPTORIGHT, "FREE PLAY");
}
static void
Draw_party_ping (int ss, INT32 snap)
{
HU_drawMiniPing(0, 0, playerpingtable[displayplayers[ss]], V_HUDTRANS|snap);
}
static void
K_drawMiniPing (void)
{
if (cv_showping.value)
{
switch (r_splitscreen)
{
case 3:
Draw_party_ping(3, V_SNAPTORIGHT|V_SPLITSCREEN);
/*FALLTHRU*/
case 2:
Draw_party_ping(2, V_SPLITSCREEN);
Draw_party_ping(1, V_SNAPTORIGHT);
Draw_party_ping(0, 0);
break;
case 1:
Draw_party_ping(1, V_SNAPTORIGHT|V_SPLITSCREEN);
Draw_party_ping(0, V_SNAPTORIGHT);
break;
}
}
}
static void K_drawDistributionDebugger(void)
{
patch_t *items[NUMKARTRESULTS] = {
@ -10684,7 +10713,7 @@ void K_drawKartHUD(void)
K_initKartHUD();
// Draw that fun first person HUD! Drawn ASAP so it looks more "real".
for (i = 0; i <= splitscreen; i++)
for (i = 0; i <= r_splitscreen; i++)
{
if (stplyr == &players[displayplayers[i]] && !camera[i].chase)
K_drawKartFirstPerson();
@ -10704,10 +10733,10 @@ void K_drawKartHUD(void)
&& comeback
&& stplyr->playerstate == PST_LIVE)));
if (!demo.title && (!battlefullscreen || splitscreen))
if (!demo.title && (!battlefullscreen || r_splitscreen))
{
// Draw the CHECK indicator before the other items, so it's overlapped by everything else
if (cv_kartcheck.value && !splitscreen && !players[displayplayers[0]].exiting)
if (cv_kartcheck.value && !r_splitscreen && !players[displayplayers[0]].exiting)
K_drawKartPlayerCheck();
// Draw WANTED status
@ -10744,7 +10773,7 @@ void K_drawKartHUD(void)
K_drawKartItem();
// If not splitscreen, draw...
if (!splitscreen && !demo.title)
if (!r_splitscreen && !demo.title)
{
// Draw the timestamp
#ifdef HAVE_BLUA
@ -10765,7 +10794,7 @@ void K_drawKartHUD(void)
if (!stplyr->spectator) // Bottom of the screen elements, don't need in spectate mode
{
// Draw the speedometer
if (cv_kartspeedometer.value && !splitscreen)
if (cv_kartspeedometer.value && !r_splitscreen)
{
#ifdef HAVE_BLUA
if (LUA_HudEnabled(hud_speedometer))
@ -10777,7 +10806,7 @@ void K_drawKartHUD(void)
{
INT32 x = BASEVIDWIDTH - 32, y = 128, offs;
if (splitscreen == 3)
if (r_splitscreen == 3)
{
x = BASEVIDWIDTH/2 + 10;
y = BASEVIDHEIGHT/2 - 30;
@ -10836,11 +10865,11 @@ void K_drawKartHUD(void)
if (leveltime >= starttime-(3*TICRATE)
&& leveltime < starttime+TICRATE)
K_drawKartStartCountdown();
else if (countdown && (!splitscreen || !stplyr->exiting))
else if (countdown && (!r_splitscreen || !stplyr->exiting))
{
char *countstr = va("%d", countdown/TICRATE);
if (splitscreen > 1)
if (r_splitscreen > 1)
V_DrawCenteredString(BASEVIDWIDTH/4, LAPS_Y+1, K_calcSplitFlags(0), countstr);
else
{
@ -10854,14 +10883,14 @@ void K_drawKartHUD(void)
{
if (stplyr->exiting)
K_drawKartFinish();
else if (stplyr->karthud[khud_lapanimation] && !splitscreen)
else if (stplyr->karthud[khud_lapanimation] && !r_splitscreen)
K_drawLapStartAnim();
}
if (modeattacking) // everything after here is MP and debug only
return;
if (G_BattleGametype() && !splitscreen && (stplyr->karthud[khud_yougotem] % 2)) // * YOU GOT EM *
if (G_BattleGametype() && !r_splitscreen && (stplyr->karthud[khud_yougotem] % 2)) // * YOU GOT EM *
V_DrawScaledPatch(BASEVIDWIDTH/2 - (SHORT(kp_yougotem->width)/2), 32, V_HUDTRANS, kp_yougotem);
// Draw FREE PLAY.
@ -10873,11 +10902,16 @@ void K_drawKartHUD(void)
K_drawKartFreePlay(leveltime);
}
if (splitscreen == 0 && stplyr->kartstuff[k_wrongway] && ((leveltime / 8) & 1))
if (r_splitscreen == 0 && stplyr->kartstuff[k_wrongway] && ((leveltime / 8) & 1))
{
V_DrawCenteredString(BASEVIDWIDTH>>1, 176, V_REDMAP|V_SNAPTOBOTTOM, "WRONG WAY");
}
if (netgame && r_splitscreen)
{
K_drawMiniPing();
}
if (cv_kartdebugdistribution.value)
K_drawDistributionDebugger();

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1122,12 +1122,12 @@ boolean P_EndingMusic(player_t *player)
// Event - Level Finish
// Check for if this is valid or not
if (splitscreen)
if (r_splitscreen)
{
if (!((players[displayplayers[0]].exiting || (players[displayplayers[0]].pflags & PF_TIMEOVER))
|| (players[displayplayers[1]].exiting || (players[displayplayers[1]].pflags & PF_TIMEOVER))
|| ((splitscreen < 2) && (players[displayplayers[2]].exiting || (players[displayplayers[2]].pflags & PF_TIMEOVER)))
|| ((splitscreen < 3) && (players[displayplayers[3]].exiting || (players[displayplayers[3]].pflags & PF_TIMEOVER)))))
|| ((r_splitscreen < 2) && (players[displayplayers[2]].exiting || (players[displayplayers[2]].pflags & PF_TIMEOVER)))
|| ((r_splitscreen < 3) && (players[displayplayers[3]].exiting || (players[displayplayers[3]].pflags & PF_TIMEOVER)))))
return false;
bestlocalplayer = &players[displayplayers[0]];
@ -1139,9 +1139,9 @@ boolean P_EndingMusic(player_t *player)
bestlocalpos = ((players[p].pflags & PF_TIMEOVER) ? MAXPLAYERS+1 : players[p].kartstuff[k_position]); \
}
setbests(displayplayers[1]);
if (splitscreen > 1)
if (r_splitscreen > 1)
setbests(displayplayers[2]);
if (splitscreen > 2)
if (r_splitscreen > 2)
setbests(displayplayers[3]);
#undef setbests
}
@ -1211,7 +1211,7 @@ void P_RestoreMusic(player_t *player)
{
INT32 wantedmus = 0; // 0 is level music, 1 is invincibility, 2 is grow
if (splitscreen)
if (r_splitscreen)
{
INT32 bestlocaltimer = 1;
@ -1225,9 +1225,9 @@ void P_RestoreMusic(player_t *player)
}
setbests(displayplayers[0]);
setbests(displayplayers[1]);
if (splitscreen > 1)
if (r_splitscreen > 1)
setbests(displayplayers[2]);
if (splitscreen > 2)
if (r_splitscreen > 2)
setbests(displayplayers[3]);
#undef setbests
}
@ -1488,7 +1488,15 @@ boolean P_IsLocalPlayer(player_t *player)
{
UINT8 i;
if (player == &players[consoleplayer])
if (r_splitscreen > splitscreen)
{
for (i = 0; i <= r_splitscreen; ++i)
{
if (player == &players[displayplayers[i]])
return true;
}
}
else if (player == &players[consoleplayer])
return true;
else if (splitscreen)
{
@ -1512,7 +1520,7 @@ boolean P_IsDisplayPlayer(player_t *player)
{
UINT8 i;
for (i = 0; i <= splitscreen; i++) // DON'T skip P1
for (i = 0; i <= r_splitscreen; i++) // DON'T skip P1
{
if (player == &players[displayplayers[i]])
return true;
@ -7255,17 +7263,17 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
focusangle = localangle[0];
focusaiming = localaiming[0];
}
else if (player == &players[displayplayers[1]])
else if (player == &players[g_localplayers[1]])
{
focusangle = localangle[1];
focusaiming = localaiming[1];
}
else if (player == &players[displayplayers[2]])
else if (player == &players[g_localplayers[2]])
{
focusangle = localangle[2];
focusaiming = localaiming[2];
}
else if (player == &players[displayplayers[3]])
else if (player == &players[g_localplayers[3]])
{
focusangle = localangle[3];
focusaiming = localaiming[3];
@ -7279,6 +7287,7 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
if (P_CameraThinker(player, thiscam, resetcalled))
return true;
lookback = ( player->cmd.buttons & BT_LOOKBACK );
if (thiscam == &camera[1]) // Camera 2
{
@ -7288,7 +7297,6 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
camrotate = cv_cam2_rotate.value;
camdist = FixedMul(cv_cam2_dist.value, mapobjectscale);
camheight = FixedMul(cv_cam2_height.value, mapobjectscale);
lookback = camspin[1];
}
else if (thiscam == &camera[2]) // Camera 3
{
@ -7298,7 +7306,6 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
camrotate = cv_cam3_rotate.value;
camdist = FixedMul(cv_cam3_dist.value, mapobjectscale);
camheight = FixedMul(cv_cam3_height.value, mapobjectscale);
lookback = camspin[2];
}
else if (thiscam == &camera[3]) // Camera 4
{
@ -7308,7 +7315,6 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
camrotate = cv_cam4_rotate.value;
camdist = FixedMul(cv_cam4_dist.value, mapobjectscale);
camheight = FixedMul(cv_cam4_height.value, mapobjectscale);
lookback = camspin[3];
}
else // Camera 1
{
@ -7318,7 +7324,6 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
camrotate = cv_cam_rotate.value;
camdist = FixedMul(cv_cam_dist.value, mapobjectscale);
camheight = FixedMul(cv_cam_height.value, mapobjectscale);
lookback = camspin[0];
}
if (timeover)
@ -7428,7 +7433,7 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
else
distxy = dist;
distz = -FixedMul(dist, FINESINE((pitch>>ANGLETOFINESHIFT) & FINEMASK));
if (splitscreen == 1) // 2 player is weird, this helps keep players on screen
if (r_splitscreen == 1) // 2 player is weird, this helps keep players on screen
distz = 3*distz/5;
x = mo->x - FixedMul(FINECOSINE((angle>>ANGLETOFINESHIFT) & FINEMASK), distxy);
@ -7845,8 +7850,8 @@ boolean P_SpectatorJoinGame(player_t *player)
player->playerstate = PST_REBORN;
//Reset away view
if (P_IsLocalPlayer(player) && displayplayers[0] != consoleplayer)
displayplayers[0] = consoleplayer;
if (P_IsLocalPlayer(player) && g_localplayers[0] != consoleplayer)
g_localplayers[0] = consoleplayer;
HU_AddChatText(va(M_GetText("\x82*%s entered the game."), player_names[player-players]), false);
return true; // no more player->mo, cannot continue.
@ -7873,7 +7878,7 @@ static void P_CalcPostImg(player_t *player)
pviewheight = player->awayviewmobj->z + 20*FRACUNIT;
}
for (i = 0; i <= splitscreen; i++)
for (i = 0; i <= r_splitscreen; i++)
{
if (player == &players[displayplayers[i]])
{
@ -8038,7 +8043,7 @@ void P_PlayerThink(player_t *player)
}
#ifdef SEENAMES
if (netgame && player == &players[displayplayers[0]] && !(leveltime % (TICRATE/5)) && !splitscreen)
if (netgame && player == &players[displayplayers[0]] && !(leveltime % (TICRATE/5)) && !r_splitscreen)
{
seenplayer = NULL;
@ -8369,7 +8374,7 @@ void P_PlayerThink(player_t *player)
// Hide the mobj from our sights if we're the displayplayer and chasecam is off.
// Why not just not spawn the mobj? Well, I'd rather only flirt with
// consistency so much...
for (i = 0; i <= splitscreen; i++)
for (i = 0; i <= r_splitscreen; i++)
{
if (player == &players[displayplayers[i]] && !camera[i].chase)
{
@ -8599,7 +8604,7 @@ void P_PlayerAfterThink(player_t *player)
P_PlayerInSpecialSector(player);
#endif
for (i = 0; i <= splitscreen; i++)
for (i = 0; i <= r_splitscreen; i++)
{
if (player == &players[displayplayers[i]])
{

View file

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

View file

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

View file

@ -73,6 +73,8 @@ boolean skyVisiblePerPlayer[MAXSPLITSCREENPLAYERS]; // saved values of skyVisibl
sector_t *viewsector;
player_t *viewplayer;
int r_splitscreen;
// PORTALS!
// You can thank and/or curse JTE for these.
UINT8 portalrender;
@ -191,6 +193,12 @@ void SplitScreen_OnChange(void)
{
UINT8 i;
/*
local splitscreen is updated before you're in a game,
so this is the first value for renderer splitscreen
*/
r_splitscreen = splitscreen;
// recompute screen size
R_ExecuteSetViewSize();
@ -658,12 +666,12 @@ void R_ExecuteSetViewSize(void)
scaledviewwidth = vid.width;
viewheight = vid.height;
if (splitscreen)
if (r_splitscreen)
viewheight >>= 1;
viewwidth = scaledviewwidth;
if (splitscreen > 1)
if (r_splitscreen > 1)
{
viewwidth >>= 1;
scaledviewwidth >>= 1;
@ -676,7 +684,7 @@ void R_ExecuteSetViewSize(void)
fov = FixedAngle(cv_fov.value/2) + ANGLE_90;
fovtan = FINETANGENT(fov >> ANGLETOFINESHIFT);
if (splitscreen == 1) // Splitscreen FOV should be adjusted to maintain expected vertical view
if (r_splitscreen == 1) // Splitscreen FOV should be adjusted to maintain expected vertical view
fovtan = 17*fovtan/10;
projection = projectiony = FixedDiv(centerxfrac, fovtan);
@ -847,9 +855,9 @@ void R_SkyboxFrame(player_t *player)
camera_t *thiscam = &camera[0];
UINT8 i;
if (splitscreen)
if (r_splitscreen)
{
for (i = 1; i <= splitscreen; i++)
for (i = 1; i <= r_splitscreen; i++)
{
if (player == &players[displayplayers[i]])
{
@ -894,7 +902,7 @@ void R_SkyboxFrame(player_t *player)
{
for (i = 1; i <= splitscreen; i++)
{
if (player == &players[displayplayers[i]])
if (player == &players[g_localplayers[i]])
{
viewangle = localangle[i];
aimingangle = localaiming[i];
@ -1079,17 +1087,17 @@ void R_SetupFrame(player_t *player, boolean skybox)
camera_t *thiscam;
boolean chasecam = false;
if (splitscreen > 2 && player == &players[displayplayers[3]])
if (r_splitscreen > 2 && player == &players[displayplayers[3]])
{
thiscam = &camera[3];
chasecam = (cv_chasecam4.value != 0);
}
else if (splitscreen > 1 && player == &players[displayplayers[2]])
else if (r_splitscreen > 1 && player == &players[displayplayers[2]])
{
thiscam = &camera[2];
chasecam = (cv_chasecam3.value != 0);
}
else if (splitscreen && player == &players[displayplayers[1]])
else if (r_splitscreen && player == &players[displayplayers[1]])
{
thiscam = &camera[1];
chasecam = (cv_chasecam2.value != 0);
@ -1154,7 +1162,7 @@ void R_SetupFrame(player_t *player, boolean skybox)
UINT8 i;
for (i = 1; i <= splitscreen; i++)
{
if (player == &players[displayplayers[i]])
if (player == &players[g_localplayers[i]])
{
viewangle = localangle[i];
aimingangle = localaiming[i];
@ -1333,7 +1341,7 @@ void R_RenderPlayerView(player_t *player)
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 32+(timeinmap&15));
}
// Draw over the fourth screen so you don't have to stare at a HOM :V
else if (splitscreen == 2 && player == &players[displayplayers[2]])
else if (r_splitscreen == 2 && player == &players[displayplayers[2]])
#if 1
{
// V_DrawPatchFill, but for the fourth screen only
@ -1352,7 +1360,7 @@ void R_RenderPlayerView(player_t *player)
#endif
// load previous saved value of skyVisible for the player
for (i = 0; i <= splitscreen; i++)
for (i = 0; i <= r_splitscreen; i++)
{
if (player == &players[displayplayers[i]])
{
@ -1462,7 +1470,7 @@ void R_RenderPlayerView(player_t *player)
// save value to skyVisiblePerPlayer
// this is so that P1 can't affect whether P2 can see a skybox or not, or vice versa
for (i = 0; i <= splitscreen; i++)
for (i = 0; i <= r_splitscreen; i++)
{
if (player == &players[displayplayers[i]])
{

View file

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

View file

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

View file

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

View file

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

View file

@ -445,7 +445,7 @@ void SCR_DisplayTicRate(void)
void SCR_DisplayLocalPing(void)
{
UINT32 ping = playerpingtable[consoleplayer]; // consoleplayer's ping is everyone's ping in a splitnetgame :P
if (cv_showping.value == 1 || (cv_showping.value == 2 && ping > servermaxping)) // only show 2 (warning) if our ping is at a bad level
if (! r_splitscreen && ( cv_showping.value == 1 || (cv_showping.value == 2 && ping > servermaxping) )) // only show 2 (warning) if our ping is at a bad level
{
INT32 dispy = cv_ticrate.value ? 160 : 181;
HU_drawPing(307, dispy, ping, V_SNAPTORIGHT | V_SNAPTOBOTTOM | V_HUDTRANS);

View file

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

View file

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

View file

@ -367,7 +367,7 @@ void Y_IntermissionDrawer(void)
if (usebuffer) // Fade everything out
V_DrawFadeScreen(0xFF00, 22);
if (!splitscreen)
if (!r_splitscreen)
whiteplayer = demo.playback ? displayplayers[0] : consoleplayer;
if (cons_menuhighlight.value)
@ -496,7 +496,7 @@ void Y_IntermissionDrawer(void)
y2 = y;
if (data.match.num[i] == 0 && server_lagless)
if (playerconsole[data.match.num[i]] == 0 && server_lagless)
{
static int alagles_timer = 0;
patch_t *alagles;
@ -1316,19 +1316,19 @@ void Y_VoteDrawer(void)
{
case 1:
thiscurs = cursor2;
p = displayplayers[1];
p = g_localplayers[1];
break;
case 2:
thiscurs = cursor3;
p = displayplayers[2];
p = g_localplayers[2];
break;
case 3:
thiscurs = cursor4;
p = displayplayers[3];
p = g_localplayers[3];
break;
default:
thiscurs = cursor1;
p = displayplayers[0];
p = g_localplayers[0];
break;
}
@ -1616,13 +1616,13 @@ void Y_VoteTicker(void)
switch (i)
{
case 1:
p = displayplayers[1];
p = g_localplayers[1];
break;
case 2:
p = displayplayers[2];
p = g_localplayers[2];
break;
case 3:
p = displayplayers[3];
p = g_localplayers[3];
break;
default:
p = consoleplayer;