Merge branch 'quads' of http://git.magicalgirl.moe/wolfs/Kart into quads

This commit is contained in:
Wolfy 2017-12-17 01:05:57 -06:00
commit 893dac11e1
20 changed files with 348 additions and 81 deletions

View file

@ -1228,6 +1228,7 @@ static boolean CL_SendJoin(void)
localplayers++;
if (splitscreen4)
localplayers++;
netbuffer->u.clientcfg.localplayers = localplayers;
netbuffer->u.clientcfg.version = VERSION;
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"));
}
splitscreen = false;
splitscreen3 = false;
splitscreen4 = false;
splitscreen = splitscreen3 = splitscreen4 = false;
SplitScreen_OnChange();
botingame = false;
botskin = 0;
@ -2708,7 +2707,7 @@ static void Got_KickCmd(UINT8 **p, INT32 playernum)
// Is playernum authorized to make this kick?
if (playernum != serverplayer && !IsPlayerAdmin(playernum)
&& !(playerpernode[playernode[playernum]] == 2
&& !(playerpernode[playernode[playernum]] >= 2
&& nodetoplayer2[playernode[playernum]] == pnum
&& nodetoplayer3[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)
{
INT16 node, newplayernum;
boolean splitscreenplayer;
UINT8 splitscreenplayer = 0;
if (playernum != serverplayer && !IsPlayerAdmin(playernum))
{
@ -3097,8 +3096,8 @@ static void Got_AddPlayer(UINT8 **p, INT32 playernum)
node = READUINT8(*p);
newplayernum = READUINT8(*p);
splitscreenplayer = newplayernum & 0x80;
newplayernum &= ~0x80;
splitscreenplayer = newplayernum/MAXPLAYERS;
newplayernum %= MAXPLAYERS;
// Clear player before joining, lest some things get set incorrectly
// 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)
{
playernode[newplayernum] = 0; // for information only
if (!splitscreenplayer)
if (splitscreenplayer == 0)
{
consoleplayer = newplayernum;
displayplayer = newplayernum;
secondarydisplayplayer = newplayernum;
thirddisplayplayer = newplayernum;
fourthdisplayplayer = newplayernum;
DEBFILE("spawning me\n");
// Apply player flags as soon as possible!
players[newplayernum].pflags &= ~(PF_FLIPCAM|PF_ANALOGMODE);
@ -3131,16 +3132,39 @@ static void Got_AddPlayer(UINT8 **p, INT32 playernum)
}
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;
if (splitscreenplayer == 2)
{
thirddisplayplayer = newplayernum;
DEBFILE("spawning my sister\n");
players[newplayernum].pflags &= ~(PF_FLIPCAM|PF_ANALOGMODE);
if (cv_flipcam3.value)
players[newplayernum].pflags |= PF_FLIPCAM;
if (cv_analog3.value)
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();
addedtogame = true;
@ -3182,7 +3206,8 @@ static boolean SV_AddWaitingPlayers(void)
for (; newplayernum < MAXPLAYERS; newplayernum++)
{
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;
if (n == MAXNETNODES)
break;
@ -3201,7 +3226,17 @@ static boolean SV_AddWaitingPlayers(void)
else if (playerpernode[node] < 2)
{
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]++;
@ -3696,8 +3731,12 @@ FILESTAMP
break;
case PT_CLIENTCMD:
case PT_CLIENT2CMD:
case PT_CLIENT3CMD:
case PT_CLIENT4CMD:
case PT_CLIENTMIS:
case PT_CLIENT2MIS:
case PT_CLIENT3MIS:
case PT_CLIENT4MIS:
case PT_NODEKEEPALIVE:
case PT_NODEKEEPALIVEMIS:
if (client)
@ -3758,11 +3797,24 @@ FILESTAMP
}
// Splitscreen cmd
if ((netbuffer->packettype == PT_CLIENT2CMD || netbuffer->packettype == PT_CLIENT2MIS)
if (((netbuffer->packettype == PT_CLIENT2CMD || netbuffer->packettype == PT_CLIENT2MIS)
|| (netbuffer->packettype == PT_CLIENT3CMD || netbuffer->packettype == PT_CLIENT3MIS)
|| (netbuffer->packettype == PT_CLIENT4CMD || netbuffer->packettype == PT_CLIENT4MIS))
&& nodetoplayer2[node] >= 0)
G_MoveTiccmd(&netcmds[maketic%BACKUPTICS][(UINT8)nodetoplayer2[node]],
&netbuffer->u.client2pak.cmd2, 1);
if (((netbuffer->packettype == PT_CLIENT3CMD || netbuffer->packettype == PT_CLIENT3MIS)
|| (netbuffer->packettype == PT_CLIENT4CMD || netbuffer->packettype == PT_CLIENT4MIS))
&& nodetoplayer3[node] >= 0)
G_MoveTiccmd(&netcmds[maketic%BACKUPTICS][(UINT8)nodetoplayer3[node]],
&netbuffer->u.client3pak.cmd3, 1);
if ((netbuffer->packettype == PT_CLIENT4CMD || netbuffer->packettype == PT_CLIENT4MIS)
&& nodetoplayer4[node] >= 0)
G_MoveTiccmd(&netcmds[maketic%BACKUPTICS][(UINT8)nodetoplayer4[node]],
&netbuffer->u.client4pak.cmd4, 1);
// A delay before we check resynching
// Used on join or just after a synch fail
if (resynch_delay[node])
@ -3804,10 +3856,17 @@ FILESTAMP
else if (resynch_score[node])
--resynch_score[node];
break;
case PT_TEXTCMD2: // splitscreen special
netconsole = nodetoplayer2[node];
/* FALLTHRU */
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)
break;
@ -3896,6 +3955,20 @@ FILESTAMP
SendNetXCmd(XD_KICK, &buf, 2);
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);
nodeingame[node] = false;
@ -4262,8 +4335,20 @@ static void CL_SendClientCmd(void)
G_MoveTiccmd(&netbuffer->u.clientpak.cmd, &localcmds, 1);
netbuffer->u.clientpak.consistancy = SHORT(consistancy[gametic%BACKUPTICS]);
// Send a special packet with 2 cmd for splitscreen
if (splitscreen || botingame)
if (splitscreen4)
{
netbuffer->packettype += 6;
G_MoveTiccmd(&netbuffer->u.client4pak.cmd2, &localcmds2, 1);
G_MoveTiccmd(&netbuffer->u.client4pak.cmd3, &localcmds3, 1);
G_MoveTiccmd(&netbuffer->u.client4pak.cmd4, &localcmds4, 1);
}
else if (splitscreen3)
{
netbuffer->packettype += 4;
G_MoveTiccmd(&netbuffer->u.client3pak.cmd2, &localcmds2, 1);
G_MoveTiccmd(&netbuffer->u.client3pak.cmd3, &localcmds3, 1);
}
else if (splitscreen || botingame) // Send a special packet with 2 cmd for splitscreen
{
netbuffer->packettype += 2;
G_MoveTiccmd(&netbuffer->u.client2pak.cmd2, &localcmds2, 1);

View file

@ -40,6 +40,10 @@ typedef enum
PT_CLIENTMIS, // Same as above with but saying resend from.
PT_CLIENT2CMD, // 2 cmds in the packet for splitscreen.
PT_CLIENT2MIS, // Same as above with but saying resend from
PT_CLIENT3CMD, // 3P
PT_CLIENT3MIS,
PT_CLIENT4CMD, // 4P
PT_CLIENT4MIS,
PT_NODEKEEPALIVE, // Same but without ticcmd and consistancy
PT_NODEKEEPALIVEMIS,
PT_SERVERTICS, // All cmds for the tic.
@ -66,6 +70,8 @@ typedef enum
PT_TEXTCMD, // Extra text commands from the client.
PT_TEXTCMD2, // Splitscreen text commands.
PT_TEXTCMD3,
PT_TEXTCMD4,
PT_CLIENTJOIN, // Client wants to join; used in start game.
PT_NODETIMEOUT, // Packet sent to self if the connection times out.
PT_RESYNCHING, // Packet sent to resync players.

View file

@ -882,8 +882,12 @@ static void DebugPrintpacket(const char *header)
}
case PT_CLIENTCMD:
case PT_CLIENT2CMD:
case PT_CLIENT3CMD:
case PT_CLIENT4CMD:
case PT_CLIENTMIS:
case PT_CLIENT2MIS:
case PT_CLIENT3MIS:
case PT_CLIENT4MIS:
case PT_NODEKEEPALIVE:
case PT_NODEKEEPALIVEMIS:
fprintf(debugfile, " tic %4u resendfrom %u\n",
@ -892,6 +896,8 @@ static void DebugPrintpacket(const char *header)
break;
case PT_TEXTCMD:
case PT_TEXTCMD2:
case PT_TEXTCMD3:
case PT_TEXTCMD4:
fprintf(debugfile, " length %d\n ", netbuffer->u.textcmd[0]);
fprintf(debugfile, "[%s]", netxcmdnames[netbuffer->u.textcmd[1] - 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
if (playernum == consoleplayer)
CV_StealthSet(&cv_playername, tmpname);
else if (playernum == secondarydisplayplayer
|| (!netgame && playernum == 1))
{
else if (playernum == secondarydisplayplayer || (!netgame && playernum == 1))
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));
Z_Free(buf);
@ -1157,11 +1158,15 @@ static void ForceAllSkins(INT32 forcedskin)
CV_StealthSet(&cv_skin, skins[forcedskin].name);
else if (i == secondarydisplayplayer)
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
//
@ -1284,7 +1289,7 @@ static void SendNameAndColor2(void)
{
INT32 secondplaya;
if ((!splitscreen || !splitscreen3 || !splitscreen4) && !botingame)
if (!(splitscreen || splitscreen3 || splitscreen4) && !botingame)
return; // can happen if skin2/color2/name2 changed
if (secondarydisplayplayer != consoleplayer)
@ -1381,8 +1386,8 @@ static void SendNameAndColor3(void)
{
INT32 thirdplaya;
if ((!splitscreen3 || !splitscreen4) && !botingame)
return; // can happen if skin2/color2/name2 changed
if (!(splitscreen3 || splitscreen4))
return; // can happen if skin3/color3/name3 changed
if (thirddisplayplayer != consoleplayer)
thirdplaya = thirddisplayplayer;
@ -1414,15 +1419,7 @@ static void SendNameAndColor3(void)
return;
// If you're not in a netgame, merely update the skin, color, and name.
if (botingame)
{
players[thirdplaya].skincolor = botcolor;
if (players[thirdplaya].mo)
players[thirdplaya].mo->color = players[thirdplaya].skincolor;
SetPlayerSkinByNum(thirdplaya, botskin-1);
return;
}
else if (!netgame && !modeattacking)
if (!netgame && !modeattacking)
{
INT32 foundskin;
@ -1445,7 +1442,7 @@ static void SendNameAndColor3(void)
{
boolean notsame;
cv_skin2.value = foundskin;
cv_skin3.value = foundskin;
notsame = (cv_skin3.value != players[thirdplaya].skin);
@ -1478,7 +1475,7 @@ static void SendNameAndColor4(void)
{
INT32 fourthplaya;
if (!splitscreen4 && !botingame)
if (!splitscreen4)
return; // can happen if skin4/color4/name4 changed
if (fourthdisplayplayer != consoleplayer)
@ -1586,9 +1583,13 @@ static void Got_NameAndColor(UINT8 **cp, INT32 playernum)
snacpending--;
else if (playernum == secondarydisplayplayer)
snac2pending--;
else if (playernum == thirddisplayplayer)
snac3pending--;
else if (playernum == fourthdisplayplayer)
snac4pending--;
#ifdef PARANOIA
if (snacpending < 0 || snac2pending < 0)
if (snacpending < 0 || snac2pending < 0 || snac3pending < 0 || snac4pending < 0)
I_Error("snacpending negative!");
#endif
@ -1606,7 +1607,8 @@ static void Got_NameAndColor(UINT8 **cp, INT32 playernum)
p->mo->color = (UINT8)p->skincolor;
// 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;
@ -1645,6 +1647,10 @@ static void Got_NameAndColor(UINT8 **cp, INT32 playernum)
CV_StealthSet(&cv_skin, skins[forcedskin].name);
else if (playernum == secondarydisplayplayer)
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
SetPlayerSkinByNum(playernum, skin);
@ -2934,6 +2940,10 @@ static void Got_Teamchange(UINT8 **cp, INT32 playernum)
CV_SetValue(&cv_playercolor, NetPacket.packet.newteam + 5);
else if (playernum == secondarydisplayplayer)
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)
{
if (!Playing() || (!splitscreen || !splitscreen3 || !splitscreen4))
if (!Playing() || !(splitscreen || splitscreen3 || splitscreen4))
return; // do whatever you want
if (CanChangeSkin(secondarydisplayplayer) && !P_PlayerMoving(secondarydisplayplayer))
@ -4621,7 +4631,7 @@ static void Skin2_OnChange(void)
static void Skin3_OnChange(void)
{
if (!Playing() || (!splitscreen3 || !splitscreen4))
if (!Playing() || !(splitscreen3 || splitscreen4))
return; // do whatever you want
if (CanChangeSkin(thirddisplayplayer) && !P_PlayerMoving(thirddisplayplayer))
@ -4681,7 +4691,7 @@ static void Color_OnChange(void)
*/
static void Color2_OnChange(void)
{
if (!Playing() || (!splitscreen || !splitscreen3 || !splitscreen4))
if (!Playing() || !(splitscreen || splitscreen3 || splitscreen4))
return; // do whatever you want
if (!P_PlayerMoving(secondarydisplayplayer))
@ -4698,7 +4708,7 @@ static void Color2_OnChange(void)
static void Color3_OnChange(void)
{
if (!Playing() || (!splitscreen3 || !splitscreen4))
if (!Playing() || !(splitscreen3 || splitscreen4))
return; // do whatever you want
if (!P_PlayerMoving(thirddisplayplayer))

View file

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

View file

@ -1709,7 +1709,7 @@ static void Analog2_OnChange(void)
static void Analog3_OnChange(void)
{
if (!((splitscreen3 || splitscreen4) || botingame) || !cv_cam3_dist.string)
if (!(splitscreen3 || splitscreen4) || !cv_cam3_dist.string)
return;
// cameras are not initialized at this point
@ -1729,7 +1729,7 @@ static void Analog3_OnChange(void)
static void Analog4_OnChange(void)
{
if (!(splitscreen4 || botingame) || !cv_cam4_dist.string)
if (!(splitscreen4) || !cv_cam4_dist.string)
return;
// cameras are not initialized at this point
@ -2459,6 +2459,10 @@ void G_PlayerReborn(INT32 player)
CV_SetValue(&cv_playercolor, skincolor_redteam);
else if (p == &players[secondarydisplayplayer])
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)
{
@ -2466,6 +2470,10 @@ void G_PlayerReborn(INT32 player)
CV_SetValue(&cv_playercolor, skincolor_blueteam);
else if (p == &players[secondarydisplayplayer])
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 == &players[displayplayer] || (splitscreen && player == &players[secondarydisplayplayer]))
|| (!(player == &players[displayplayer] || (splitscreen && player == &players[secondarydisplayplayer]))
if ((player == &players[displayplayer]
|| ((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))))
{
if (leveltime & 1)

View file

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

View file

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

View file

@ -62,8 +62,12 @@ 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[secondarydisplayplayer])
else if ((splitscreen || splitscreen3 || splitscreen4) && FFInfo->player == &players[secondarydisplayplayer])
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)
{
@ -79,8 +83,12 @@ 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[secondarydisplayplayer])
else if ((splitscreen || splitscreen3 || splitscreen4) && FFInfo->player == &players[secondarydisplayplayer])
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...
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!
if (G_TagGametype()

View file

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

View file

@ -3630,8 +3630,12 @@ boolean P_CameraThinker(player_t *player, camera_t *thiscam, boolean resetcalled
if (postimg != postimg_none)
{
if (splitscreen && player == &players[secondarydisplayplayer])
if ((splitscreen || splitscreen3 || splitscreen4) && player == &players[secondarydisplayplayer])
postimgtype2 = postimg;
else if ((splitscreen3 || splitscreen4) && player == &players[thirddisplayplayer])
postimgtype3 = postimg;
else if (splitscreen4 && player == &players[fourthdisplayplayer])
postimgtype4 = postimg;
else
postimgtype = postimg;
}
@ -3678,6 +3682,10 @@ boolean P_CameraThinker(player_t *player, camera_t *thiscam, boolean resetcalled
if (player == &players[secondarydisplayplayer])
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 (!resetcalled)
@ -6502,8 +6510,14 @@ void P_MobjThinker(mobj_t *mobj)
if (mobj->target->player->kartstuff[k_bootimer] > 0)
{
if ((mobj->target->player == &players[displayplayer] || (splitscreen && mobj->target->player == &players[secondarydisplayplayer]))
|| (!(mobj->target->player == &players[displayplayer] || (splitscreen && mobj->target->player == &players[secondarydisplayplayer]))
if ((mobj->target->player == &players[displayplayer]
|| ((splitscreen || splitscreen3 || splitscreen4) && mobj->target->player == &players[secondarydisplayplayer])
|| ((splitscreen3 || splitscreen4) && mobj->target->player == &players[thirddisplayplayer])
|| (splitscreen4 && mobj->target->player == &players[fourthdisplayplayer]))
|| (!(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))))
{
if (leveltime & 1)

View file

@ -2365,7 +2365,7 @@ static void P_ForceCharacter(const char *forcecharskin)
}
else
{
if (splitscreen)
if (splitscreen || splitscreen3 || splitscreen4)
{
SetPlayerSkin(secondarydisplayplayer, forcecharskin);
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);
// normal player colors in single player
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)
{
// 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);
}
else if (line->flags & ML_EFFECT4)

View file

@ -601,6 +601,10 @@ static void P_DeNightserizePlayer(player_t *player)
localaiming = 0;
else if (player == &players[secondarydisplayplayer])
localaiming2 = 0;
else if (player == &players[thirddisplayplayer])
localaiming3 = 0;
else if (player == &players[fourthdisplayplayer])
localaiming4 = 0;
// If you screwed up, kiss your score goodbye.
player->marescore = 0;
@ -1392,7 +1396,10 @@ fixed_t P_GetPlayerSpinHeight(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 (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))
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;
else if (player == &players[secondarydisplayplayer])
localaiming2 = movingangle;
else if (player == &players[thirddisplayplayer])
localaiming3 = movingangle;
else if (player == &players[fourthdisplayplayer])
localaiming4 = movingangle;
player->mo->tracer->angle = player->mo->angle;
@ -6791,7 +6803,10 @@ static void P_MovePlayer(player_t *player)
S_StartSound(player->mo, sfx_mkdrft);
// Ok, we'll stop now.
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);
}
}
@ -8491,21 +8506,11 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
{
dist = camdist;
if (splitscreen) // x1.5 dist for splitscreen
if (splitscreen || splitscreen3 || splitscreen4) // x1.5 dist for splitscreen
{
dist = FixedMul(dist, 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
if (P_AnalogMove(player))
@ -9010,7 +9015,17 @@ static void P_CalcPostImg(player_t *player)
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;
param = &postimgparam2;

View file

@ -1349,7 +1349,11 @@ void R_RenderPlayerView(player_t *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;
else
skyVisible = skyVisible1;
@ -1455,7 +1459,11 @@ void R_RenderPlayerView(player_t *player)
// save value to skyVisible1 or skyVisible2
// this is so that P1 can't affect whether P2 can see a skybox or not, or vice versa
if (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;
else
skyVisible1 = skyVisible;

View file

@ -2639,6 +2639,10 @@ void SetPlayerSkinByNum(INT32 playernum, INT32 skinnum)
CV_StealthSetValue(&cv_playercolor, skin->prefcolor);
else if (playernum == secondarydisplayplayer)
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;
if (player->mo)
player->mo->color = player->skincolor;

View file

@ -2566,6 +2566,20 @@ FUNCMATH void I_Tactile2(FFType pFFType, const JoyFF_t *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
*/
static ticcmd_t emptycmd;

View file

@ -2727,6 +2727,20 @@ void I_Tactile2(FFType pFFType, const JoyFF_t *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
*/
static ticcmd_t emptycmd;
@ -2745,6 +2759,24 @@ ticcmd_t *I_BaseTiccmd2(void)
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)
static HMODULE winmm = NULL;
static DWORD starttickcount = 0; // hack for win2k time bug

View file

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