More stuuuuff

This commit is contained in:
TehRealSalt 2017-12-17 01:21:24 -05:00
parent 0393e24fa6
commit fc9d426660
20 changed files with 314 additions and 82 deletions

View File

@ -1228,6 +1228,7 @@ static boolean CL_SendJoin(void)
localplayers++; localplayers++;
if (splitscreen4) if (splitscreen4)
localplayers++; localplayers++;
netbuffer->u.clientcfg.localplayers = localplayers; netbuffer->u.clientcfg.localplayers = localplayers;
netbuffer->u.clientcfg.version = VERSION; netbuffer->u.clientcfg.version = VERSION;
netbuffer->u.clientcfg.subversion = SUBVERSION; netbuffer->u.clientcfg.subversion = SUBVERSION;
@ -2324,9 +2325,7 @@ static void Command_connect(void)
CONS_Alert(CONS_ERROR, M_GetText("There is no network driver\n")); CONS_Alert(CONS_ERROR, M_GetText("There is no network driver\n"));
} }
splitscreen = false; splitscreen = splitscreen3 = splitscreen4 = false;
splitscreen3 = false;
splitscreen4 = false;
SplitScreen_OnChange(); SplitScreen_OnChange();
botingame = false; botingame = false;
botskin = 0; botskin = 0;
@ -2708,7 +2707,7 @@ static void Got_KickCmd(UINT8 **p, INT32 playernum)
// Is playernum authorized to make this kick? // Is playernum authorized to make this kick?
if (playernum != serverplayer && !IsPlayerAdmin(playernum) if (playernum != serverplayer && !IsPlayerAdmin(playernum)
&& !(playerpernode[playernode[playernum]] == 2 && !(playerpernode[playernode[playernum]] >= 2
&& nodetoplayer2[playernode[playernum]] == pnum && nodetoplayer2[playernode[playernum]] == pnum
&& nodetoplayer3[playernode[playernum]] == pnum && nodetoplayer3[playernode[playernum]] == pnum
&& nodetoplayer4[playernode[playernum]] == pnum)) && nodetoplayer4[playernode[playernum]] == pnum))
@ -3078,7 +3077,7 @@ static inline void SV_AddNode(INT32 node)
static void Got_AddPlayer(UINT8 **p, INT32 playernum) static void Got_AddPlayer(UINT8 **p, INT32 playernum)
{ {
INT16 node, newplayernum; INT16 node, newplayernum;
boolean splitscreenplayer; UINT8 splitscreenplayer = 0;
if (playernum != serverplayer && !IsPlayerAdmin(playernum)) if (playernum != serverplayer && !IsPlayerAdmin(playernum))
{ {
@ -3097,8 +3096,8 @@ static void Got_AddPlayer(UINT8 **p, INT32 playernum)
node = READUINT8(*p); node = READUINT8(*p);
newplayernum = READUINT8(*p); newplayernum = READUINT8(*p);
splitscreenplayer = newplayernum & 0x80; splitscreenplayer = newplayernum/MAXPLAYERS;
newplayernum &= ~0x80; newplayernum %= MAXPLAYERS;
// Clear player before joining, lest some things get set incorrectly // Clear player before joining, lest some things get set incorrectly
// HACK: don't do this for splitscreen, it relies on preset values // HACK: don't do this for splitscreen, it relies on preset values
@ -3116,11 +3115,13 @@ static void Got_AddPlayer(UINT8 **p, INT32 playernum)
if (node == mynode) if (node == mynode)
{ {
playernode[newplayernum] = 0; // for information only playernode[newplayernum] = 0; // for information only
if (!splitscreenplayer) if (splitscreenplayer == 0)
{ {
consoleplayer = newplayernum; consoleplayer = newplayernum;
displayplayer = newplayernum; displayplayer = newplayernum;
secondarydisplayplayer = newplayernum; secondarydisplayplayer = newplayernum;
thirddisplayplayer = newplayernum;
fourthdisplayplayer = newplayernum;
DEBFILE("spawning me\n"); DEBFILE("spawning me\n");
// Apply player flags as soon as possible! // Apply player flags as soon as possible!
players[newplayernum].pflags &= ~(PF_FLIPCAM|PF_ANALOGMODE); players[newplayernum].pflags &= ~(PF_FLIPCAM|PF_ANALOGMODE);
@ -3131,16 +3132,39 @@ static void Got_AddPlayer(UINT8 **p, INT32 playernum)
} }
else else
{ {
secondarydisplayplayer = newplayernum; if (splitscreenplayer == 2)
DEBFILE("spawning my brother\n"); {
if (botingame) thirddisplayplayer = newplayernum;
players[newplayernum].bot = 1; DEBFILE("spawning my sister\n");
// Same goes for player 2 when relevant players[newplayernum].pflags &= ~(PF_FLIPCAM|PF_ANALOGMODE);
players[newplayernum].pflags &= ~(PF_FLIPCAM|PF_ANALOGMODE); if (cv_flipcam3.value)
if (cv_flipcam2.value) players[newplayernum].pflags |= PF_FLIPCAM;
players[newplayernum].pflags |= PF_FLIPCAM; if (cv_analog3.value)
if (cv_analog2.value) players[newplayernum].pflags |= PF_ANALOGMODE;
players[newplayernum].pflags |= PF_ANALOGMODE; }
else if (splitscreenplayer == 3)
{
fourthdisplayplayer = newplayernum;
DEBFILE("spawning my trusty pet dog\n");
players[newplayernum].pflags &= ~(PF_FLIPCAM|PF_ANALOGMODE);
if (cv_flipcam4.value)
players[newplayernum].pflags |= PF_FLIPCAM;
if (cv_analog4.value)
players[newplayernum].pflags |= PF_ANALOGMODE;
}
else
{
secondarydisplayplayer = newplayernum;
DEBFILE("spawning my brother\n");
if (botingame)
players[newplayernum].bot = 1;
// Same goes for player 2 when relevant
players[newplayernum].pflags &= ~(PF_FLIPCAM|PF_ANALOGMODE);
if (cv_flipcam2.value)
players[newplayernum].pflags |= PF_FLIPCAM;
if (cv_analog2.value)
players[newplayernum].pflags |= PF_ANALOGMODE;
}
} }
D_SendPlayerConfig(); D_SendPlayerConfig();
addedtogame = true; addedtogame = true;
@ -3182,7 +3206,8 @@ static boolean SV_AddWaitingPlayers(void)
for (; newplayernum < MAXPLAYERS; newplayernum++) for (; newplayernum < MAXPLAYERS; newplayernum++)
{ {
for (n = 0; n < MAXNETNODES; n++) for (n = 0; n < MAXNETNODES; n++)
if (nodetoplayer[n] == newplayernum || nodetoplayer2[n] == newplayernum) if (nodetoplayer[n] == newplayernum || nodetoplayer2[n] == newplayernum
|| nodetoplayer3[n] == newplayernum || nodetoplayer4[n] == newplayernum)
break; break;
if (n == MAXNETNODES) if (n == MAXNETNODES)
break; break;
@ -3201,7 +3226,17 @@ static boolean SV_AddWaitingPlayers(void)
else if (playerpernode[node] < 2) else if (playerpernode[node] < 2)
{ {
nodetoplayer2[node] = newplayernum; nodetoplayer2[node] = newplayernum;
buf[1] |= 0x80; buf[1] += MAXPLAYERS;
}
else if (playerpernode[node] < 3)
{
nodetoplayer3[node] = newplayernum;
buf[1] += MAXPLAYERS*2;
}
else if (playerpernode[node] < 4)
{
nodetoplayer4[node] = newplayernum;
buf[1] += MAXPLAYERS*3;
} }
playerpernode[node]++; playerpernode[node]++;
@ -3804,10 +3839,17 @@ FILESTAMP
else if (resynch_score[node]) else if (resynch_score[node])
--resynch_score[node]; --resynch_score[node];
break; break;
case PT_TEXTCMD2: // splitscreen special
netconsole = nodetoplayer2[node];
/* FALLTHRU */
case PT_TEXTCMD: case PT_TEXTCMD:
case PT_TEXTCMD2: // splitscreen special
case PT_TEXTCMD3:
case PT_TEXTCMD4:
if (netbuffer->packettype == PT_TEXTCMD2)
netconsole = nodetoplayer2[node];
else if (netbuffer->packettype == PT_TEXTCMD3)
netconsole = nodetoplayer3[node];
else if (netbuffer->packettype == PT_TEXTCMD4)
netconsole = nodetoplayer4[node];
if (client) if (client)
break; break;
@ -3896,6 +3938,20 @@ FILESTAMP
SendNetXCmd(XD_KICK, &buf, 2); SendNetXCmd(XD_KICK, &buf, 2);
nodetoplayer2[node] = -1; nodetoplayer2[node] = -1;
} }
if (nodetoplayer3[node] != -1 && nodetoplayer3[node] >= 0
&& playeringame[(UINT8)nodetoplayer3[node]])
{
buf[0] = nodetoplayer3[node];
SendNetXCmd(XD_KICK, &buf, 2);
nodetoplayer3[node] = -1;
}
if (nodetoplayer4[node] != -1 && nodetoplayer4[node] >= 0
&& playeringame[(UINT8)nodetoplayer4[node]])
{
buf[0] = nodetoplayer4[node];
SendNetXCmd(XD_KICK, &buf, 2);
nodetoplayer4[node] = -1;
}
} }
Net_CloseConnection(node); Net_CloseConnection(node);
nodeingame[node] = false; nodeingame[node] = false;

View File

@ -66,6 +66,8 @@ typedef enum
PT_TEXTCMD, // Extra text commands from the client. PT_TEXTCMD, // Extra text commands from the client.
PT_TEXTCMD2, // Splitscreen text commands. PT_TEXTCMD2, // Splitscreen text commands.
PT_TEXTCMD3,
PT_TEXTCMD4,
PT_CLIENTJOIN, // Client wants to join; used in start game. PT_CLIENTJOIN, // Client wants to join; used in start game.
PT_NODETIMEOUT, // Packet sent to self if the connection times out. PT_NODETIMEOUT, // Packet sent to self if the connection times out.
PT_RESYNCHING, // Packet sent to resync players. PT_RESYNCHING, // Packet sent to resync players.
@ -107,6 +109,7 @@ typedef struct
ticcmd_t cmd, cmd2; ticcmd_t cmd, cmd2;
} ATTRPACK client2cmd_pak; } ATTRPACK client2cmd_pak;
/*
// Splitscreen3 packet // Splitscreen3 packet
// WARNING: must have the same format of clientcmd_pak, for more easy use // WARNING: must have the same format of clientcmd_pak, for more easy use
typedef struct typedef struct
@ -126,6 +129,7 @@ typedef struct
INT16 consistancy; INT16 consistancy;
ticcmd_t cmd, cmd2, cmd3, cmd4; ticcmd_t cmd, cmd2, cmd3, cmd4;
} ATTRPACK client4cmd_pak; } ATTRPACK client4cmd_pak;
*/
#ifdef _MSC_VER #ifdef _MSC_VER
#pragma warning(disable : 4200) #pragma warning(disable : 4200)
@ -417,8 +421,8 @@ typedef struct
{ {
clientcmd_pak clientpak; // 144 bytes clientcmd_pak clientpak; // 144 bytes
client2cmd_pak client2pak; // 200 bytes client2cmd_pak client2pak; // 200 bytes
client3cmd_pak client3pak; // 256 bytes(?) //client3cmd_pak client3pak; // 256 bytes(?)
client4cmd_pak client4pak; // 312 bytes(?) //client4cmd_pak client4pak; // 312 bytes(?)
servertics_pak serverpak; // 132495 bytes (more around 360, no?) servertics_pak serverpak; // 132495 bytes (more around 360, no?)
serverconfig_pak servercfg; // 773 bytes serverconfig_pak servercfg; // 773 bytes
resynchend_pak resynchend; // resynchend_pak resynchend; //

View File

@ -892,6 +892,8 @@ static void DebugPrintpacket(const char *header)
break; break;
case PT_TEXTCMD: case PT_TEXTCMD:
case PT_TEXTCMD2: case PT_TEXTCMD2:
case PT_TEXTCMD3:
case PT_TEXTCMD4:
fprintf(debugfile, " length %d\n ", netbuffer->u.textcmd[0]); fprintf(debugfile, " length %d\n ", netbuffer->u.textcmd[0]);
fprintf(debugfile, "[%s]", netxcmdnames[netbuffer->u.textcmd[1] - 1]); fprintf(debugfile, "[%s]", netxcmdnames[netbuffer->u.textcmd[1] - 1]);
fprintfstringnewline((char *)netbuffer->u.textcmd + 2, netbuffer->u.textcmd[0] - 1); fprintfstringnewline((char *)netbuffer->u.textcmd + 2, netbuffer->u.textcmd[0] - 1);

View File

@ -1045,11 +1045,12 @@ static void CleanupPlayerName(INT32 playernum, const char *newname)
// spaces may have been removed // spaces may have been removed
if (playernum == consoleplayer) if (playernum == consoleplayer)
CV_StealthSet(&cv_playername, tmpname); CV_StealthSet(&cv_playername, tmpname);
else if (playernum == secondarydisplayplayer else if (playernum == secondarydisplayplayer || (!netgame && playernum == 1))
|| (!netgame && playernum == 1))
{
CV_StealthSet(&cv_playername2, tmpname); CV_StealthSet(&cv_playername2, tmpname);
} else if (playernum == thirddisplayplayer || (!netgame && playernum == 2))
CV_StealthSet(&cv_playername3, tmpname);
else if (playernum == fourthdisplayplayer || (!netgame && playernum == 3))
CV_StealthSet(&cv_playername4, tmpname);
else I_Assert(((void)"CleanupPlayerName used on non-local player", 0)); else I_Assert(((void)"CleanupPlayerName used on non-local player", 0));
Z_Free(buf); Z_Free(buf);
@ -1157,11 +1158,15 @@ static void ForceAllSkins(INT32 forcedskin)
CV_StealthSet(&cv_skin, skins[forcedskin].name); CV_StealthSet(&cv_skin, skins[forcedskin].name);
else if (i == secondarydisplayplayer) else if (i == secondarydisplayplayer)
CV_StealthSet(&cv_skin2, skins[forcedskin].name); CV_StealthSet(&cv_skin2, skins[forcedskin].name);
else if (i == thirddisplayplayer)
CV_StealthSet(&cv_skin3, skins[forcedskin].name);
else if (i == fourthdisplayplayer)
CV_StealthSet(&cv_skin4, skins[forcedskin].name);
} }
} }
} }
static INT32 snacpending = 0, snac2pending = 0, chmappending = 0; static INT32 snacpending = 0, snac2pending = 0, snac3pending = 0, snac4pending = 0, chmappending = 0;
// name, color, or skin has changed // name, color, or skin has changed
// //
@ -1284,7 +1289,7 @@ static void SendNameAndColor2(void)
{ {
INT32 secondplaya; INT32 secondplaya;
if ((!splitscreen || !splitscreen3 || !splitscreen4) && !botingame) if (!(splitscreen || splitscreen3 || splitscreen4) && !botingame)
return; // can happen if skin2/color2/name2 changed return; // can happen if skin2/color2/name2 changed
if (secondarydisplayplayer != consoleplayer) if (secondarydisplayplayer != consoleplayer)
@ -1381,8 +1386,8 @@ static void SendNameAndColor3(void)
{ {
INT32 thirdplaya; INT32 thirdplaya;
if ((!splitscreen3 || !splitscreen4) && !botingame) if (!(splitscreen3 || splitscreen4))
return; // can happen if skin2/color2/name2 changed return; // can happen if skin3/color3/name3 changed
if (thirddisplayplayer != consoleplayer) if (thirddisplayplayer != consoleplayer)
thirdplaya = thirddisplayplayer; thirdplaya = thirddisplayplayer;
@ -1414,15 +1419,7 @@ static void SendNameAndColor3(void)
return; return;
// If you're not in a netgame, merely update the skin, color, and name. // If you're not in a netgame, merely update the skin, color, and name.
if (botingame) if (!netgame && !modeattacking)
{
players[thirdplaya].skincolor = botcolor;
if (players[thirdplaya].mo)
players[thirdplaya].mo->color = players[thirdplaya].skincolor;
SetPlayerSkinByNum(thirdplaya, botskin-1);
return;
}
else if (!netgame && !modeattacking)
{ {
INT32 foundskin; INT32 foundskin;
@ -1445,7 +1442,7 @@ static void SendNameAndColor3(void)
{ {
boolean notsame; boolean notsame;
cv_skin2.value = foundskin; cv_skin3.value = foundskin;
notsame = (cv_skin3.value != players[thirdplaya].skin); notsame = (cv_skin3.value != players[thirdplaya].skin);
@ -1478,7 +1475,7 @@ static void SendNameAndColor4(void)
{ {
INT32 fourthplaya; INT32 fourthplaya;
if (!splitscreen4 && !botingame) if (!splitscreen4)
return; // can happen if skin4/color4/name4 changed return; // can happen if skin4/color4/name4 changed
if (fourthdisplayplayer != consoleplayer) if (fourthdisplayplayer != consoleplayer)
@ -1586,9 +1583,13 @@ static void Got_NameAndColor(UINT8 **cp, INT32 playernum)
snacpending--; snacpending--;
else if (playernum == secondarydisplayplayer) else if (playernum == secondarydisplayplayer)
snac2pending--; snac2pending--;
else if (playernum == thirddisplayplayer)
snac3pending--;
else if (playernum == fourthdisplayplayer)
snac4pending--;
#ifdef PARANOIA #ifdef PARANOIA
if (snacpending < 0 || snac2pending < 0) if (snacpending < 0 || snac2pending < 0 || snac3pending < 0 || snac4pending < 0)
I_Error("snacpending negative!"); I_Error("snacpending negative!");
#endif #endif
@ -1606,7 +1607,8 @@ static void Got_NameAndColor(UINT8 **cp, INT32 playernum)
p->mo->color = (UINT8)p->skincolor; p->mo->color = (UINT8)p->skincolor;
// normal player colors // normal player colors
if (server && (p != &players[consoleplayer] && p != &players[secondarydisplayplayer])) if (server && (p != &players[consoleplayer] && p != &players[secondarydisplayplayer]
&& p != &players[thirddisplayplayer] && p != &players[fourthdisplayplayer]))
{ {
boolean kick = false; boolean kick = false;
@ -1645,6 +1647,10 @@ static void Got_NameAndColor(UINT8 **cp, INT32 playernum)
CV_StealthSet(&cv_skin, skins[forcedskin].name); CV_StealthSet(&cv_skin, skins[forcedskin].name);
else if (playernum == secondarydisplayplayer) else if (playernum == secondarydisplayplayer)
CV_StealthSet(&cv_skin2, skins[forcedskin].name); CV_StealthSet(&cv_skin2, skins[forcedskin].name);
else if (playernum == thirddisplayplayer)
CV_StealthSet(&cv_skin3, skins[forcedskin].name);
else if (playernum == fourthdisplayplayer)
CV_StealthSet(&cv_skin4, skins[forcedskin].name);
} }
else else
SetPlayerSkinByNum(playernum, skin); SetPlayerSkinByNum(playernum, skin);
@ -2934,6 +2940,10 @@ static void Got_Teamchange(UINT8 **cp, INT32 playernum)
CV_SetValue(&cv_playercolor, NetPacket.packet.newteam + 5); CV_SetValue(&cv_playercolor, NetPacket.packet.newteam + 5);
else if (playernum == secondarydisplayplayer) else if (playernum == secondarydisplayplayer)
CV_SetValue(&cv_playercolor2, NetPacket.packet.newteam + 5); CV_SetValue(&cv_playercolor2, NetPacket.packet.newteam + 5);
else if (playernum == thirddisplayplayer)
CV_SetValue(&cv_playercolor3, NetPacket.packet.newteam + 5);
else if (playernum == fourthdisplayplayer)
CV_SetValue(&cv_playercolor4, NetPacket.packet.newteam + 5);
} }
} }
@ -4607,7 +4617,7 @@ static void Skin_OnChange(void)
*/ */
static void Skin2_OnChange(void) static void Skin2_OnChange(void)
{ {
if (!Playing() || (!splitscreen || !splitscreen3 || !splitscreen4)) if (!Playing() || !(splitscreen || splitscreen3 || splitscreen4))
return; // do whatever you want return; // do whatever you want
if (CanChangeSkin(secondarydisplayplayer) && !P_PlayerMoving(secondarydisplayplayer)) if (CanChangeSkin(secondarydisplayplayer) && !P_PlayerMoving(secondarydisplayplayer))
@ -4621,7 +4631,7 @@ static void Skin2_OnChange(void)
static void Skin3_OnChange(void) static void Skin3_OnChange(void)
{ {
if (!Playing() || (!splitscreen3 || !splitscreen4)) if (!Playing() || !(splitscreen3 || splitscreen4))
return; // do whatever you want return; // do whatever you want
if (CanChangeSkin(thirddisplayplayer) && !P_PlayerMoving(thirddisplayplayer)) if (CanChangeSkin(thirddisplayplayer) && !P_PlayerMoving(thirddisplayplayer))
@ -4681,7 +4691,7 @@ static void Color_OnChange(void)
*/ */
static void Color2_OnChange(void) static void Color2_OnChange(void)
{ {
if (!Playing() || (!splitscreen || !splitscreen3 || !splitscreen4)) if (!Playing() || !(splitscreen || splitscreen3 || splitscreen4))
return; // do whatever you want return; // do whatever you want
if (!P_PlayerMoving(secondarydisplayplayer)) if (!P_PlayerMoving(secondarydisplayplayer))
@ -4698,7 +4708,7 @@ static void Color2_OnChange(void)
static void Color3_OnChange(void) static void Color3_OnChange(void)
{ {
if (!Playing() || (!splitscreen3 || !splitscreen4)) if (!Playing() || !(splitscreen3 || splitscreen4))
return; // do whatever you want return; // do whatever you want
if (!P_PlayerMoving(thirddisplayplayer)) if (!P_PlayerMoving(thirddisplayplayer))

View File

@ -8743,6 +8743,12 @@ static inline int lib_getenum(lua_State *L)
} else if (fastcmp(word,"splitscreen")) { } else if (fastcmp(word,"splitscreen")) {
lua_pushboolean(L, splitscreen); lua_pushboolean(L, splitscreen);
return 1; return 1;
} else if (fastcmp(word,"splitscreen3")) {
lua_pushboolean(L, splitscreen3);
return 1;
} else if (fastcmp(word,"splitscreen4")) {
lua_pushboolean(L, splitscreen4);
return 1;
} else if (fastcmp(word,"gamecomplete")) { } else if (fastcmp(word,"gamecomplete")) {
lua_pushboolean(L, gamecomplete); lua_pushboolean(L, gamecomplete);
return 1; return 1;

View File

@ -1709,7 +1709,7 @@ static void Analog2_OnChange(void)
static void Analog3_OnChange(void) static void Analog3_OnChange(void)
{ {
if (!((splitscreen3 || splitscreen4) || botingame) || !cv_cam3_dist.string) if (!(splitscreen3 || splitscreen4) || !cv_cam3_dist.string)
return; return;
// cameras are not initialized at this point // cameras are not initialized at this point
@ -1729,7 +1729,7 @@ static void Analog3_OnChange(void)
static void Analog4_OnChange(void) static void Analog4_OnChange(void)
{ {
if (!(splitscreen4 || botingame) || !cv_cam4_dist.string) if (!(splitscreen4) || !cv_cam4_dist.string)
return; return;
// cameras are not initialized at this point // cameras are not initialized at this point
@ -2459,6 +2459,10 @@ void G_PlayerReborn(INT32 player)
CV_SetValue(&cv_playercolor, skincolor_redteam); CV_SetValue(&cv_playercolor, skincolor_redteam);
else if (p == &players[secondarydisplayplayer]) else if (p == &players[secondarydisplayplayer])
CV_SetValue(&cv_playercolor2, skincolor_redteam); CV_SetValue(&cv_playercolor2, skincolor_redteam);
else if (p == &players[thirddisplayplayer])
CV_SetValue(&cv_playercolor3, skincolor_redteam);
else if (p == &players[fourthdisplayplayer])
CV_SetValue(&cv_playercolor4, skincolor_redteam);
} }
else if (p->ctfteam == 2 && p->skincolor != skincolor_blueteam) else if (p->ctfteam == 2 && p->skincolor != skincolor_blueteam)
{ {
@ -2466,6 +2470,10 @@ void G_PlayerReborn(INT32 player)
CV_SetValue(&cv_playercolor, skincolor_blueteam); CV_SetValue(&cv_playercolor, skincolor_blueteam);
else if (p == &players[secondarydisplayplayer]) else if (p == &players[secondarydisplayplayer])
CV_SetValue(&cv_playercolor2, skincolor_blueteam); CV_SetValue(&cv_playercolor2, skincolor_blueteam);
else if (p == &players[thirddisplayplayer])
CV_SetValue(&cv_playercolor3, skincolor_blueteam);
else if (p == &players[fourthdisplayplayer])
CV_SetValue(&cv_playercolor4, skincolor_blueteam);
} }
} }
} }

View File

@ -3589,8 +3589,14 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
if (player->kartstuff[k_bootimer] > 0) if (player->kartstuff[k_bootimer] > 0)
{ {
if ((player == &players[displayplayer] || (splitscreen && player == &players[secondarydisplayplayer])) if ((player == &players[displayplayer]
|| (!(player == &players[displayplayer] || (splitscreen && player == &players[secondarydisplayplayer])) || ((splitscreen || splitscreen3 || splitscreen4) && player == &players[secondarydisplayplayer])
|| ((splitscreen3 || splitscreen4) && player == &players[thirddisplayplayer])
|| (splitscreen4 && player == &players[fourthdisplayplayer]))
|| (!(player == &players[displayplayer]
|| ((splitscreen || splitscreen3 || splitscreen4) && player == &players[secondarydisplayplayer])
|| ((splitscreen3 || splitscreen4) && player == &players[thirddisplayplayer])
|| (splitscreen4 && player == &players[fourthdisplayplayer]))
&& (player->kartstuff[k_bootimer] < 1*TICRATE/2 || player->kartstuff[k_bootimer] > bootime-(1*TICRATE/2)))) && (player->kartstuff[k_bootimer] < 1*TICRATE/2 || player->kartstuff[k_bootimer] > bootime-(1*TICRATE/2))))
{ {
if (leveltime & 1) if (leveltime & 1)

View File

@ -381,6 +381,10 @@ static int player_set(lua_State *L)
localaiming = plr->aiming; localaiming = plr->aiming;
else if (plr == &players[secondarydisplayplayer]) else if (plr == &players[secondarydisplayplayer])
localaiming2 = plr->aiming; localaiming2 = plr->aiming;
else if (plr == &players[thirddisplayplayer])
localaiming3 = plr->aiming;
else if (plr == &players[fourthdisplayplayer])
localaiming4 = plr->aiming;
} }
else if (fastcmp(field,"health")) else if (fastcmp(field,"health"))
plr->health = (INT32)luaL_checkinteger(L, 3); plr->health = (INT32)luaL_checkinteger(L, 3);

View File

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

View File

@ -62,8 +62,12 @@ void P_ForceConstant(const BasicFF_t *FFInfo)
ConstantQuake.Magnitude = FFInfo->Magnitude; ConstantQuake.Magnitude = FFInfo->Magnitude;
if (FFInfo->player == &players[consoleplayer]) if (FFInfo->player == &players[consoleplayer])
I_Tactile(ConstantForce, &ConstantQuake); I_Tactile(ConstantForce, &ConstantQuake);
else if (splitscreen && FFInfo->player == &players[secondarydisplayplayer]) else if ((splitscreen || splitscreen3 || splitscreen4) && FFInfo->player == &players[secondarydisplayplayer])
I_Tactile2(ConstantForce, &ConstantQuake); I_Tactile2(ConstantForce, &ConstantQuake);
else if ((splitscreen3 || splitscreen4) && FFInfo->player == &players[thirddisplayplayer])
I_Tactile3(ConstantForce, &ConstantQuake);
else if (splitscreen4 && FFInfo->player == &players[fourthdisplayplayer])
I_Tactile4(ConstantForce, &ConstantQuake);
} }
void P_RampConstant(const BasicFF_t *FFInfo, INT32 Start, INT32 End) void P_RampConstant(const BasicFF_t *FFInfo, INT32 Start, INT32 End)
{ {
@ -79,8 +83,12 @@ void P_RampConstant(const BasicFF_t *FFInfo, INT32 Start, INT32 End)
RampQuake.End = End; RampQuake.End = End;
if (FFInfo->player == &players[consoleplayer]) if (FFInfo->player == &players[consoleplayer])
I_Tactile(ConstantForce, &RampQuake); I_Tactile(ConstantForce, &RampQuake);
else if (splitscreen && FFInfo->player == &players[secondarydisplayplayer]) else if ((splitscreen || splitscreen3 || splitscreen4) && FFInfo->player == &players[secondarydisplayplayer])
I_Tactile2(ConstantForce, &RampQuake); I_Tactile2(ConstantForce, &RampQuake);
else if ((splitscreen3 || splitscreen4) && FFInfo->player == &players[thirddisplayplayer])
I_Tactile3(ConstantForce, &RampQuake);
else if (splitscreen4 && FFInfo->player == &players[fourthdisplayplayer])
I_Tactile4(ConstantForce, &RampQuake);
} }
@ -2245,6 +2253,10 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source)
// added : 22-02-98: recenter view for next life... // added : 22-02-98: recenter view for next life...
localaiming2 = 0; localaiming2 = 0;
} }
if (target->player == &players[thirddisplayplayer])
localaiming3 = 0;
if (target->player == &players[fourthdisplayplayer])
localaiming4 = 0;
//tag deaths handled differently in suicide cases. Don't count spectators! //tag deaths handled differently in suicide cases. Don't count spectators!
if (G_TagGametype() if (G_TagGametype()

View File

@ -1351,6 +1351,10 @@ static boolean PIT_CheckThing(mobj_t *thing)
localangle = thing->angle; localangle = thing->angle;
else if (thing->player == &players[secondarydisplayplayer]) else if (thing->player == &players[secondarydisplayplayer])
localangle2 = thing->angle; localangle2 = thing->angle;
else if (thing->player == &players[thirddisplayplayer])
localangle3 = thing->angle;
else if (thing->player == &players[fourthdisplayplayer])
localangle4 = thing->angle;
} }
return true; return true;

View File

@ -3630,8 +3630,12 @@ boolean P_CameraThinker(player_t *player, camera_t *thiscam, boolean resetcalled
if (postimg != postimg_none) if (postimg != postimg_none)
{ {
if (splitscreen && player == &players[secondarydisplayplayer]) if ((splitscreen || splitscreen3 || splitscreen4) && player == &players[secondarydisplayplayer])
postimgtype2 = postimg; postimgtype2 = postimg;
else if ((splitscreen3 || splitscreen4) && player == &players[thirddisplayplayer])
postimgtype3 = postimg;
else if (splitscreen4 && player == &players[fourthdisplayplayer])
postimgtype4 = postimg;
else else
postimgtype = postimg; postimgtype = postimg;
} }
@ -3678,6 +3682,10 @@ boolean P_CameraThinker(player_t *player, camera_t *thiscam, boolean resetcalled
if (player == &players[secondarydisplayplayer]) if (player == &players[secondarydisplayplayer])
cam_height = cv_cam2_height.value; cam_height = cv_cam2_height.value;
if (player == &players[thirddisplayplayer])
cam_height = cv_cam3_height.value;
if (player == &players[fourthdisplayplayer])
cam_height = cv_cam4_height.value;
if (thiscam->z > player->mo->z + player->mo->height + FixedMul(cam_height*FRACUNIT + 16*FRACUNIT, player->mo->scale)) if (thiscam->z > player->mo->z + player->mo->height + FixedMul(cam_height*FRACUNIT + 16*FRACUNIT, player->mo->scale))
{ {
if (!resetcalled) if (!resetcalled)
@ -6502,8 +6510,14 @@ void P_MobjThinker(mobj_t *mobj)
if (mobj->target->player->kartstuff[k_bootimer] > 0) if (mobj->target->player->kartstuff[k_bootimer] > 0)
{ {
if ((mobj->target->player == &players[displayplayer] || (splitscreen && mobj->target->player == &players[secondarydisplayplayer])) if ((mobj->target->player == &players[displayplayer]
|| (!(mobj->target->player == &players[displayplayer] || (splitscreen && mobj->target->player == &players[secondarydisplayplayer])) || ((splitscreen || splitscreen3 || splitscreen4) && mobj->target->player == &players[secondarydisplayplayer])
|| ((splitscreen3 || splitscreen4) && mobj->target->player == &players[thirddisplayplayer])
|| (splitscreen4 && mobj->target->player == &players[fourthdisplayplayer]))
|| (!(mobj->target->player == &players[displayplayer]
|| ((splitscreen || splitscreen3 || splitscreen4) && mobj->target->player == &players[secondarydisplayplayer])
|| ((splitscreen3 || splitscreen4) && mobj->target->player == &players[thirddisplayplayer])
|| (splitscreen4 && mobj->target->player == &players[fourthdisplayplayer]))
&& (mobj->target->player->kartstuff[k_bootimer] < 1*TICRATE/2 || mobj->target->player->kartstuff[k_bootimer] > bootime-(1*TICRATE/2)))) && (mobj->target->player->kartstuff[k_bootimer] < 1*TICRATE/2 || mobj->target->player->kartstuff[k_bootimer] > bootime-(1*TICRATE/2))))
{ {
if (leveltime & 1) if (leveltime & 1)

View File

@ -2365,7 +2365,7 @@ static void P_ForceCharacter(const char *forcecharskin)
} }
else else
{ {
if (splitscreen) if (splitscreen || splitscreen3 || splitscreen4)
{ {
SetPlayerSkin(secondarydisplayplayer, forcecharskin); SetPlayerSkin(secondarydisplayplayer, forcecharskin);
if ((unsigned)cv_playercolor2.value != skins[players[secondarydisplayplayer].skin].prefcolor && !modeattacking) if ((unsigned)cv_playercolor2.value != skins[players[secondarydisplayplayer].skin].prefcolor && !modeattacking)
@ -2375,6 +2375,26 @@ static void P_ForceCharacter(const char *forcecharskin)
} }
} }
if (splitscreen3 || splitscreen4)
{
SetPlayerSkin(thirddisplayplayer, forcecharskin);
if ((unsigned)cv_playercolor3.value != skins[players[thirddisplayplayer].skin].prefcolor && !modeattacking)
{
CV_StealthSetValue(&cv_playercolor3, skins[players[thirddisplayplayer].skin].prefcolor);
players[thirddisplayplayer].skincolor = skins[players[thirddisplayplayer].skin].prefcolor;
}
}
if (splitscreen4)
{
SetPlayerSkin(fourthdisplayplayer, forcecharskin);
if ((unsigned)cv_playercolor4.value != skins[players[fourthdisplayplayer].skin].prefcolor && !modeattacking)
{
CV_StealthSetValue(&cv_playercolor4, skins[players[fourthdisplayplayer].skin].prefcolor);
players[fourthdisplayplayer].skincolor = skins[players[fourthdisplayplayer].skin].prefcolor;
}
}
SetPlayerSkin(consoleplayer, forcecharskin); SetPlayerSkin(consoleplayer, forcecharskin);
// normal player colors in single player // normal player colors in single player
if ((unsigned)cv_playercolor.value != skins[players[consoleplayer].skin].prefcolor && !modeattacking) if ((unsigned)cv_playercolor.value != skins[players[consoleplayer].skin].prefcolor && !modeattacking)

View File

@ -2511,7 +2511,8 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
if (line->flags & ML_NOCLIMB) if (line->flags & ML_NOCLIMB)
{ {
// play the sound from nowhere, but only if display player triggered it // play the sound from nowhere, but only if display player triggered it
if (mo && mo->player && (mo->player == &players[displayplayer] || mo->player == &players[secondarydisplayplayer])) if (mo && mo->player && (mo->player == &players[displayplayer] || mo->player == &players[secondarydisplayplayer]
|| mo->player == &players[thirddisplayplayer] || mo->player == &players[fourthdisplayplayer]))
S_StartSound(NULL, sfxnum); S_StartSound(NULL, sfxnum);
} }
else if (line->flags & ML_EFFECT4) else if (line->flags & ML_EFFECT4)

View File

@ -601,6 +601,10 @@ static void P_DeNightserizePlayer(player_t *player)
localaiming = 0; localaiming = 0;
else if (player == &players[secondarydisplayplayer]) else if (player == &players[secondarydisplayplayer])
localaiming2 = 0; localaiming2 = 0;
else if (player == &players[thirddisplayplayer])
localaiming3 = 0;
else if (player == &players[fourthdisplayplayer])
localaiming4 = 0;
// If you screwed up, kiss your score goodbye. // If you screwed up, kiss your score goodbye.
player->marescore = 0; player->marescore = 0;
@ -1392,7 +1396,10 @@ fixed_t P_GetPlayerSpinHeight(player_t *player)
// //
boolean P_IsLocalPlayer(player_t *player) boolean P_IsLocalPlayer(player_t *player)
{ {
return ((splitscreen && player == &players[secondarydisplayplayer]) || player == &players[consoleplayer]); return ((splitscreen4 && player == &players[fourthdisplayplayer])
|| ((splitscreen3 || splitscreen4) && player == &players[thirddisplayplayer])
|| ((splitscreen || splitscreen3 || splitscreen4) && player == &players[secondarydisplayplayer])
|| player == &players[consoleplayer]);
} }
// //
@ -2365,7 +2372,8 @@ static void P_DoPlayerHeadSigns(player_t *player)
// If you're "IT", show a big "IT" over your head for others to see. // If you're "IT", show a big "IT" over your head for others to see.
if (player->pflags & PF_TAGIT) if (player->pflags & PF_TAGIT)
{ {
if (!(player == &players[consoleplayer] || player == &players[secondarydisplayplayer] || player == &players[displayplayer])) // Don't display it on your own view. if (!(player == &players[consoleplayer] || player == &players[displayplayer] || player == &players[secondarydisplayplayer]
|| player == &players[thirddisplayplayer] || player == &players[fourthdisplayplayer])) // Don't display it on your own view.
{ {
if (!(player->mo->eflags & MFE_VERTICALFLIP)) if (!(player->mo->eflags & MFE_VERTICALFLIP))
P_SpawnMobj(player->mo->x, player->mo->y, player->mo->z + player->mo->height, MT_TAG); P_SpawnMobj(player->mo->x, player->mo->y, player->mo->z + player->mo->height, MT_TAG);
@ -6300,6 +6308,10 @@ static void P_NiGHTSMovement(player_t *player)
localaiming = movingangle; localaiming = movingangle;
else if (player == &players[secondarydisplayplayer]) else if (player == &players[secondarydisplayplayer])
localaiming2 = movingangle; localaiming2 = movingangle;
else if (player == &players[thirddisplayplayer])
localaiming3 = movingangle;
else if (player == &players[fourthdisplayplayer])
localaiming4 = movingangle;
player->mo->tracer->angle = player->mo->angle; player->mo->tracer->angle = player->mo->angle;
@ -6791,7 +6803,10 @@ static void P_MovePlayer(player_t *player)
S_StartSound(player->mo, sfx_mkdrft); S_StartSound(player->mo, sfx_mkdrft);
// Ok, we'll stop now. // Ok, we'll stop now.
else if ((player->kartstuff[k_drift] == 0) else if ((player->kartstuff[k_drift] == 0)
&& (player == &players[consoleplayer] || (splitscreen && player == &players[secondarydisplayplayer]))) && (player == &players[consoleplayer]
|| ((splitscreen || splitscreen3 || splitscreen4) && player == &players[secondarydisplayplayer])
|| ((splitscreen3 || splitscreen4) && player == &players[thirddisplayplayer])
|| (splitscreen4 && player == &players[fourthdisplayplayer])))
S_StopSoundByID(player->mo, sfx_mkdrft); S_StopSoundByID(player->mo, sfx_mkdrft);
} }
} }
@ -8491,21 +8506,11 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
{ {
dist = camdist; dist = camdist;
if (splitscreen) // x1.5 dist for splitscreen if (splitscreen || splitscreen3 || splitscreen4) // x1.5 dist for splitscreen
{ {
dist = FixedMul(dist, 3*FRACUNIT/2); dist = FixedMul(dist, 3*FRACUNIT/2);
height = FixedMul(height, 3*FRACUNIT/2); height = FixedMul(height, 3*FRACUNIT/2);
} }
else if (splitscreen3) // x1.75 dist for 3p
{
dist = FixedMul(dist, 7*FRACUNIT/4);
height = FixedMul(height, 7*FRACUNIT/4);
}
else if (splitscreen4) // x2 dist for 4p
{
dist = FixedMul(dist, 2*FRACUNIT);
height = FixedMul(height, 2*FRACUNIT);
}
// x1.2 dist for analog // x1.2 dist for analog
if (P_AnalogMove(player)) if (P_AnalogMove(player))
@ -9010,7 +9015,17 @@ static void P_CalcPostImg(player_t *player)
pviewheight = player->awayviewmobj->z + 20*FRACUNIT; pviewheight = player->awayviewmobj->z + 20*FRACUNIT;
} }
if (splitscreen && player == &players[secondarydisplayplayer]) if (splitscreen4 && player == &players[fourthdisplayplayer])
{
type = &postimgtype4;
param = &postimgparam4;
}
else if ((splitscreen3 || splitscreen4) && player == &players[thirddisplayplayer])
{
type = &postimgtype3;
param = &postimgparam3;
}
else if ((splitscreen || splitscreen3 || splitscreen4) && player == &players[secondarydisplayplayer])
{ {
type = &postimgtype2; type = &postimgtype2;
param = &postimgparam2; param = &postimgparam2;

View File

@ -660,11 +660,11 @@ void R_ExecuteSetViewSize(void)
if (splitscreen || splitscreen3 || splitscreen4) if (splitscreen || splitscreen3 || splitscreen4)
viewheight >>= 1; viewheight >>= 1;
viewwidth = scaledviewwidth;
if (splitscreen3 || splitscreen4) if (splitscreen3 || splitscreen4)
viewwidth >>= 1; viewwidth >>= 1;
viewwidth = scaledviewwidth;
centerx = viewwidth/2; centerx = viewwidth/2;
centery = viewheight/2; centery = viewheight/2;
centerxfrac = centerx<<FRACBITS; centerxfrac = centerx<<FRACBITS;
@ -1349,7 +1349,11 @@ void R_RenderPlayerView(player_t *player)
} }
// load previous saved value of skyVisible for the player // load previous saved value of skyVisible for the player
if (splitscreen && player == &players[secondarydisplayplayer]) if (splitscreen4 && player == &players[fourthdisplayplayer])
skyVisible = skyVisible4;
else if ((splitscreen3 || splitscreen4) && player == &players[thirddisplayplayer])
skyVisible = skyVisible3;
else if ((splitscreen || splitscreen3 || splitscreen4) && player == &players[secondarydisplayplayer])
skyVisible = skyVisible2; skyVisible = skyVisible2;
else else
skyVisible = skyVisible1; skyVisible = skyVisible1;
@ -1455,7 +1459,11 @@ void R_RenderPlayerView(player_t *player)
// save value to skyVisible1 or skyVisible2 // save value to skyVisible1 or skyVisible2
// this is so that P1 can't affect whether P2 can see a skybox or not, or vice versa // this is so that P1 can't affect whether P2 can see a skybox or not, or vice versa
if (splitscreen && player == &players[secondarydisplayplayer]) if (splitscreen4 && player == &players[fourthdisplayplayer])
skyVisible4 = skyVisible;
else if ((splitscreen3 || splitscreen4) && player == &players[thirddisplayplayer])
skyVisible3 = skyVisible;
else if ((splitscreen || splitscreen3 || splitscreen4) && player == &players[secondarydisplayplayer])
skyVisible2 = skyVisible; skyVisible2 = skyVisible;
else else
skyVisible1 = skyVisible; skyVisible1 = skyVisible;

View File

@ -2639,6 +2639,10 @@ void SetPlayerSkinByNum(INT32 playernum, INT32 skinnum)
CV_StealthSetValue(&cv_playercolor, skin->prefcolor); CV_StealthSetValue(&cv_playercolor, skin->prefcolor);
else if (playernum == secondarydisplayplayer) else if (playernum == secondarydisplayplayer)
CV_StealthSetValue(&cv_playercolor2, skin->prefcolor); CV_StealthSetValue(&cv_playercolor2, skin->prefcolor);
else if (playernum == thirddisplayplayer)
CV_StealthSetValue(&cv_playercolor3, skin->prefcolor);
else if (playernum == fourthdisplayplayer)
CV_StealthSetValue(&cv_playercolor4, skin->prefcolor);
player->skincolor = skin->prefcolor; player->skincolor = skin->prefcolor;
if (player->mo) if (player->mo)
player->mo->color = player->skincolor; player->mo->color = player->skincolor;

View File

@ -2566,6 +2566,20 @@ FUNCMATH void I_Tactile2(FFType pFFType, const JoyFF_t *FFEffect)
(void)FFEffect; (void)FFEffect;
} }
FUNCMATH void I_Tactile3(FFType pFFType, const JoyFF_t *FFEffect)
{
// UNUSED.
(void)pFFType;
(void)FFEffect;
}
FUNCMATH void I_Tactile4(FFType pFFType, const JoyFF_t *FFEffect)
{
// UNUSED.
(void)pFFType;
(void)FFEffect;
}
/** \brief empty ticcmd for player 1 /** \brief empty ticcmd for player 1
*/ */
static ticcmd_t emptycmd; static ticcmd_t emptycmd;

View File

@ -2727,6 +2727,20 @@ void I_Tactile2(FFType pFFType, const JoyFF_t *FFEffect)
(void)FFEffect; (void)FFEffect;
} }
void I_Tactile3(FFType pFFType, const JoyFF_t *FFEffect)
{
// UNUSED.
(void)pFFType;
(void)FFEffect;
}
void I_Tactile4(FFType pFFType, const JoyFF_t *FFEffect)
{
// UNUSED.
(void)pFFType;
(void)FFEffect;
}
/** \brief empty ticcmd for player 1 /** \brief empty ticcmd for player 1
*/ */
static ticcmd_t emptycmd; static ticcmd_t emptycmd;
@ -2745,6 +2759,24 @@ ticcmd_t *I_BaseTiccmd2(void)
return &emptycmd2; return &emptycmd2;
} }
/** \brief empty ticcmd for player 3
*/
static ticcmd_t emptycmd3;
ticcmd_t *I_BaseTiccmd3(void)
{
return &emptycmd3;
}
/** \brief empty ticcmd for player 4
*/
static ticcmd_t emptycmd4;
ticcmd_t *I_BaseTiccmd4(void)
{
return &emptycmd4;
}
#if (defined (_WIN32) && !defined (_WIN32_WCE)) && !defined (_XBOX) #if (defined (_WIN32) && !defined (_WIN32_WCE)) && !defined (_XBOX)
static HMODULE winmm = NULL; static HMODULE winmm = NULL;
static DWORD starttickcount = 0; // hack for win2k time bug static DWORD starttickcount = 0; // hack for win2k time bug

View File

@ -1993,10 +1993,22 @@ void ST_Drawer(void)
stplyr = &players[displayplayer]; stplyr = &players[displayplayer];
ST_overlayDrawer(); ST_overlayDrawer();
if (splitscreen) if (splitscreen || splitscreen3 || splitscreen4)
{ {
stplyr = &players[secondarydisplayplayer]; stplyr = &players[secondarydisplayplayer];
ST_overlayDrawer(); ST_overlayDrawer();
} }
if (splitscreen3 || splitscreen4)
{
stplyr = &players[thirddisplayplayer];
ST_overlayDrawer();
}
if (splitscreen4)
{
stplyr = &players[fourthdisplayplayer];
ST_overlayDrawer();
}
} }
} }