Huge splitscreen refactor

Did not get to finish all refactoring or even compile this, I'll continue later
This commit is contained in:
TehRealSalt 2019-04-18 03:08:11 -04:00
parent c67c598df0
commit 1f61397545
39 changed files with 1144 additions and 1351 deletions

View file

@ -2369,7 +2369,7 @@ static void CL_ConnectToServer(boolean viams)
#endif
DEBFILE(va("Synchronisation Finished\n"));
displayplayer = consoleplayer;
displayplayers[0] = consoleplayer;
}
#ifndef NONET
@ -2717,8 +2717,8 @@ void CL_RemovePlayer(INT32 playernum, INT32 reason)
RemoveAdminPlayer(playernum); // don't stay admin after you're gone
}
if (playernum == displayplayer && !demo.playback)
displayplayer = consoleplayer; // don't look through someone's view who isn't there
if (playernum == displayplayers[0] && !demo.playback)
displayplayers[0] = consoleplayer; // don't look through someone's view who isn't there
#ifdef HAVE_BLUA
LUA_InvalidatePlayer(&players[playernum]);
@ -3448,6 +3448,7 @@ static void Got_AddPlayer(UINT8 **p, INT32 playernum)
{
INT16 node, newplayernum;
UINT8 splitscreenplayer = 0;
UINT8 i;
if (playernum != serverplayer && !IsPlayerAdmin(playernum))
{
@ -3481,34 +3482,19 @@ static void Got_AddPlayer(UINT8 **p, INT32 playernum)
if (node == mynode)
{
playernode[newplayernum] = 0; // for information only
if (splitscreenplayer)
{
if (splitscreenplayer == 1)
{
secondarydisplayplayer = newplayernum;
DEBFILE("spawning my brother\n");
if (botingame)
displayplayers[splitscreenplayer] = newplayernum;
DEBFILE(va("spawning one of my sister number %d\n", splitscreenplayer));
if (splitscreenplayer == 1 && botingame)
players[newplayernum].bot = 1;
// Same goes for player 2 when relevant
}
else if (splitscreenplayer == 2)
{
thirddisplayplayer = newplayernum;
DEBFILE("spawning my sister\n");
}
else if (splitscreenplayer == 3)
{
fourthdisplayplayer = newplayernum;
DEBFILE("spawning my trusty pet dog\n");
}
}
else
{
consoleplayer = newplayernum;
displayplayer = newplayernum;
secondarydisplayplayer = newplayernum;
thirddisplayplayer = newplayernum;
fourthdisplayplayer = newplayernum;
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
displayplayers[i] = newplayernum;
DEBFILE("spawning me\n");
}
D_SendPlayerConfig();

View file

@ -118,14 +118,8 @@ boolean devparm = false; // started game with -devparm
boolean singletics = false; // timedemo
boolean lastdraw = false;
postimg_t postimgtype = postimg_none;
INT32 postimgparam;
postimg_t postimgtype2 = postimg_none;
INT32 postimgparam2;
postimg_t postimgtype3 = postimg_none;
INT32 postimgparam3;
postimg_t postimgtype4 = postimg_none;
INT32 postimgparam4;
postimg_t postimgtype[MAXSPLITSCREENPLAYERS];
INT32 postimgparam[MAXSPLITSCREENPLAYERS];
// These variables are only true if
// whether the respective sound system is disabled
@ -280,6 +274,7 @@ static void D_Display(void)
boolean forcerefresh = false;
static boolean wipe = false;
INT32 wipedefindex = 0;
UINT8 i;
if (dedicated)
return;
@ -428,32 +423,31 @@ static void D_Display(void)
// draw the view directly
if (cv_renderview.value && !automapactive)
{
if (players[displayplayer].mo || players[displayplayer].playerstate == PST_DEAD)
for (i = 0; i <= splitscreen; i++)
{
if (players[displayplayers[i]].mo || players[displayplayers[i]].playerstate == PST_DEAD)
{
if (i == 0) // Initialize for P1
{
viewwindowy = 0;
viewwindowx = 0;
topleft = screens[0] + viewwindowy*vid.width + viewwindowx;
objectsdrawn = 0;
#ifdef HWRENDER
if (rendermode != render_soft)
HWR_RenderPlayerView(0, &players[displayplayer]);
else
#endif
if (rendermode != render_none)
R_RenderPlayerView(&players[displayplayer]);
}
// render the second screen
if (splitscreen && players[secondarydisplayplayer].mo)
{
#ifdef HWRENDER
if (rendermode != render_soft)
HWR_RenderPlayerView(1, &players[secondarydisplayplayer]);
HWR_RenderPlayerView(i, &players[displayplayers[i]]);
else
#endif
if (rendermode != render_none)
{
if (i > 0) // Splitscreen-specific
{
switch (i)
{
case 1:
if (splitscreen > 1)
{
viewwindowx = viewwidth;
@ -464,73 +458,40 @@ static void D_Display(void)
viewwindowx = 0;
viewwindowy = viewheight;
}
M_Memcpy(ylookup, ylookup2, viewheight*sizeof (ylookup[0]));
topleft = screens[0] + viewwindowy*vid.width + viewwindowx;
R_RenderPlayerView(&players[secondarydisplayplayer]);
viewwindowy = 0;
M_Memcpy(ylookup, ylookup1, viewheight*sizeof (ylookup[0]));
}
}
// render the third screen
if (splitscreen > 1 && players[thirddisplayplayer].mo)
{
#ifdef HWRENDER
if (rendermode != render_soft)
HWR_RenderPlayerView(2, &players[thirddisplayplayer]);
else
#endif
if (rendermode != render_none)
{
break;
case 2:
viewwindowx = 0;
viewwindowy = viewheight;
M_Memcpy(ylookup, ylookup3, viewheight*sizeof (ylookup[0]));
topleft = screens[0] + viewwindowy*vid.width + viewwindowx;
R_RenderPlayerView(&players[thirddisplayplayer]);
viewwindowy = 0;
M_Memcpy(ylookup, ylookup1, viewheight*sizeof (ylookup[0]));
}
}
if (splitscreen > 2 && players[fourthdisplayplayer].mo) // render the fourth screen
{
#ifdef HWRENDER
if (rendermode != render_soft)
HWR_RenderPlayerView(3, &players[fourthdisplayplayer]);
else
#endif
if (rendermode != render_none)
{
break;
case 3:
viewwindowx = viewwidth;
viewwindowy = viewheight;
M_Memcpy(ylookup, ylookup4, viewheight*sizeof (ylookup[0]));
default:
break;
}
topleft = screens[0] + viewwindowy*vid.width + viewwindowx;
}
R_RenderPlayerView(&players[fourthdisplayplayer]);
R_RenderPlayerView(&players[displayplayers[i]]);
viewwindowy = 0;
if (i > 0)
M_Memcpy(ylookup, ylookup1, viewheight*sizeof (ylookup[0]));
}
}
}
if (rendermode == render_soft)
{
if (postimgtype)
V_DoPostProcessor(0, postimgtype, postimgparam);
if (postimgtype2)
V_DoPostProcessor(1, postimgtype2, postimgparam2);
if (postimgtype3)
V_DoPostProcessor(2, postimgtype3, postimgparam3);
if (postimgtype4)
V_DoPostProcessor(3, postimgtype4, postimgparam4);
for (i = 0; i <= splitscreen; i++)
{
if (postimgtype[i])
V_DoPostProcessor(i, postimgtype[i], postimgparam[i]);
}
}
}
@ -750,7 +711,7 @@ void D_SRB2Loop(void)
M_DoScreenShot();
}
// consoleplayer -> displayplayer (hear sounds from viewpoint)
// consoleplayer -> displayplayers (hear sounds from viewpoint)
S_UpdateSounds(); // move positional sounds
// check for media change, loop music..
@ -829,7 +790,8 @@ void D_StartTitle(void)
maptol = 0;
gameaction = ga_nothing;
displayplayer = consoleplayer = 0;
memset(displayplayers, 0, sizeof(displayplayers));
consoleplayer = 0;
//demosequence = -1;
gametype = GT_RACE; // SRB2kart
paused = false;

View file

@ -1145,11 +1145,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 == secondarydisplayplayer || (!netgame && playernum == 1))
else if (playernum == displayplayers[1] || (!netgame && playernum == 1))
CV_StealthSet(&cv_playername2, tmpname);
else if (playernum == thirddisplayplayer || (!netgame && playernum == 2))
else if (playernum == displayplayers[2] || (!netgame && playernum == 2))
CV_StealthSet(&cv_playername3, tmpname);
else if (playernum == fourthdisplayplayer || (!netgame && playernum == 3))
else if (playernum == displayplayers[3] || (!netgame && playernum == 3))
CV_StealthSet(&cv_playername4, tmpname);
else I_Assert(((void)"CleanupPlayerName used on non-local player", 0));
@ -1257,11 +1257,11 @@ static void ForceAllSkins(INT32 forcedskin)
{
if (i == consoleplayer)
CV_StealthSet(&cv_skin, skins[forcedskin].name);
else if (i == secondarydisplayplayer)
else if (i == displayplayers[1])
CV_StealthSet(&cv_skin2, skins[forcedskin].name);
else if (i == thirddisplayplayer)
else if (i == displayplayers[2])
CV_StealthSet(&cv_skin3, skins[forcedskin].name);
else if (i == fourthdisplayplayer)
else if (i == displayplayers[3])
CV_StealthSet(&cv_skin4, skins[forcedskin].name);
}
}
@ -1396,8 +1396,8 @@ static void SendNameAndColor2(void)
if (splitscreen < 1 && !botingame)
return; // can happen if skin2/color2/name2 changed
if (secondarydisplayplayer != consoleplayer)
secondplaya = secondarydisplayplayer;
if (displayplayers[1] != consoleplayer)
secondplaya = displayplayers[1];
else if (!netgame) // HACK
secondplaya = 1;
@ -1446,7 +1446,7 @@ static void SendNameAndColor2(void)
CleanupPlayerName(secondplaya, cv_playername2.zstring);
strcpy(player_names[secondplaya], cv_playername2.zstring);
// don't use secondarydisplayplayer: the second player must be 1
// don't use displayplayers[1]: the second player must be 1
players[secondplaya].skincolor = cv_playercolor2.value;
if (players[secondplaya].mo)
players[secondplaya].mo->color = players[secondplaya].skincolor;
@ -1485,14 +1485,14 @@ static void SendNameAndColor2(void)
snac2pending++;
// Don't change name if muted
if (cv_mute.value && !(server || IsPlayerAdmin(secondarydisplayplayer)))
CV_StealthSet(&cv_playername2, player_names[secondarydisplayplayer]);
if (cv_mute.value && !(server || IsPlayerAdmin(displayplayers[1])))
CV_StealthSet(&cv_playername2, player_names[displayplayers[1]]);
else // Cleanup name if changing it
CleanupPlayerName(secondarydisplayplayer, cv_playername2.zstring);
CleanupPlayerName(displayplayers[1], cv_playername2.zstring);
// Don't change skin if the server doesn't want you to.
if (!CanChangeSkin(secondarydisplayplayer))
CV_StealthSet(&cv_skin2, skins[players[secondarydisplayplayer].skin].name);
if (!CanChangeSkin(displayplayers[1]))
CV_StealthSet(&cv_skin2, skins[players[displayplayers[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)
@ -1519,8 +1519,8 @@ static void SendNameAndColor3(void)
if (splitscreen < 2)
return; // can happen if skin3/color3/name3 changed
if (thirddisplayplayer != consoleplayer)
thirdplaya = thirddisplayplayer;
if (displayplayers[2] != consoleplayer)
thirdplaya = displayplayers[2];
else if (!netgame) // HACK
thirdplaya = 2;
@ -1561,7 +1561,7 @@ static void SendNameAndColor3(void)
CleanupPlayerName(thirdplaya, cv_playername3.zstring);
strcpy(player_names[thirdplaya], cv_playername3.zstring);
// don't use thirddisplayplayer: the third player must be 2
// don't use displayplayers[2]: the third player must be 2
players[thirdplaya].skincolor = cv_playercolor3.value;
if (players[thirdplaya].mo)
players[thirdplaya].mo->color = players[thirdplaya].skincolor;
@ -1600,14 +1600,14 @@ static void SendNameAndColor3(void)
snac3pending++;
// Don't change name if muted
if (cv_mute.value && !(server || IsPlayerAdmin(thirddisplayplayer)))
CV_StealthSet(&cv_playername3, player_names[thirddisplayplayer]);
if (cv_mute.value && !(server || IsPlayerAdmin(displayplayers[2])))
CV_StealthSet(&cv_playername3, player_names[displayplayers[2]]);
else // Cleanup name if changing it
CleanupPlayerName(thirddisplayplayer, cv_playername3.zstring);
CleanupPlayerName(displayplayers[2], cv_playername3.zstring);
// Don't change skin if the server doesn't want you to.
if (!CanChangeSkin(thirddisplayplayer))
CV_StealthSet(&cv_skin3, skins[players[thirddisplayplayer].skin].name);
if (!CanChangeSkin(displayplayers[2]))
CV_StealthSet(&cv_skin3, skins[players[displayplayers[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)
@ -1634,8 +1634,8 @@ static void SendNameAndColor4(void)
if (splitscreen < 3)
return; // can happen if skin4/color4/name4 changed
if (fourthdisplayplayer != consoleplayer)
fourthplaya = fourthdisplayplayer;
if (displayplayers[3] != consoleplayer)
fourthplaya = displayplayers[3];
else if (!netgame) // HACK
fourthplaya = 3;
@ -1684,7 +1684,7 @@ static void SendNameAndColor4(void)
CleanupPlayerName(fourthplaya, cv_playername4.zstring);
strcpy(player_names[fourthplaya], cv_playername4.zstring);
// don't use fourthdisplayplayer: the second player must be 4
// don't use displayplayers[3]: the second player must be 4
players[fourthplaya].skincolor = cv_playercolor4.value;
if (players[fourthplaya].mo)
players[fourthplaya].mo->color = players[fourthplaya].skincolor;
@ -1723,14 +1723,14 @@ static void SendNameAndColor4(void)
snac4pending++;
// Don't change name if muted
if (cv_mute.value && !(server || IsPlayerAdmin(fourthdisplayplayer)))
CV_StealthSet(&cv_playername4, player_names[fourthdisplayplayer]);
if (cv_mute.value && !(server || IsPlayerAdmin(displayplayers[3])))
CV_StealthSet(&cv_playername4, player_names[displayplayers[3]]);
else // Cleanup name if changing it
CleanupPlayerName(fourthdisplayplayer, cv_playername4.zstring);
CleanupPlayerName(displayplayers[3], cv_playername4.zstring);
// Don't change skin if the server doesn't want you to.
if (!CanChangeSkin(fourthdisplayplayer))
CV_StealthSet(&cv_skin4, skins[players[fourthdisplayplayer].skin].name);
if (!CanChangeSkin(displayplayers[3]))
CV_StealthSet(&cv_skin4, skins[players[displayplayers[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)
@ -1760,12 +1760,12 @@ static void Got_NameAndColor(UINT8 **cp, INT32 playernum)
#endif
if (playernum == consoleplayer)
snacpending--;
else if (playernum == secondarydisplayplayer)
snacpending--; // TODO: make snacpending an array instead of 4 separate vars?
else if (playernum == displayplayers[1])
snac2pending--;
else if (playernum == thirddisplayplayer)
else if (playernum == displayplayers[2])
snac3pending--;
else if (playernum == fourthdisplayplayer)
else if (playernum == displayplayers[3])
snac4pending--;
#ifdef PARANOIA
@ -1788,8 +1788,8 @@ static void Got_NameAndColor(UINT8 **cp, INT32 playernum)
demo_extradata[playernum] |= DXD_COLOR;
// normal player colors
if (server && (p != &players[consoleplayer] && p != &players[secondarydisplayplayer]
&& p != &players[thirddisplayplayer] && p != &players[fourthdisplayplayer]))
if (server && (p != &players[consoleplayer] && p != &players[displayplayers[1]]
&& p != &players[displayplayers[2]] && p != &players[displayplayers[3]]))
{
boolean kick = false;
@ -1826,11 +1826,11 @@ static void Got_NameAndColor(UINT8 **cp, INT32 playernum)
if (playernum == consoleplayer)
CV_StealthSet(&cv_skin, skins[forcedskin].name);
else if (playernum == secondarydisplayplayer)
else if (playernum == displayplayers[1])
CV_StealthSet(&cv_skin2, skins[forcedskin].name);
else if (playernum == thirddisplayplayer)
else if (playernum == displayplayers[2])
CV_StealthSet(&cv_skin3, skins[forcedskin].name);
else if (playernum == fourthdisplayplayer)
else if (playernum == displayplayers[3])
CV_StealthSet(&cv_skin4, skins[forcedskin].name);
}
else
@ -1917,7 +1917,7 @@ void D_SendPlayerConfig(void)
// Only works for displayplayer, sorry!
static void Command_ResetCamera_f(void)
{
P_ResetCamera(&players[displayplayer], &camera);
P_ResetCamera(&players[displayplayers[0]], &camera[0]);
}
/* Consider replacing nametonum with this */
@ -2014,7 +2014,7 @@ static void Command_View_f(void)
return;
}
displayplayerp = G_GetDisplayplayerPtr(viewnum);
displayplayerp = &displayplayers[viewnum];
if (COM_Argc() > 1)/* switch to player */
{
@ -2302,7 +2302,7 @@ void D_MapChange(INT32 mapnum, INT32 newgametype, boolean pencoremode, boolean r
{
//CL_AddSplitscreenPlayer();
botingame = true;
secondarydisplayplayer = 1;
displayplayers[1] = 1;
playeringame[1] = true;
players[1].bot = 1;
SendNameAndColor2();
@ -2354,12 +2354,8 @@ void D_ModifyClientVote(SINT8 voted, UINT8 splitplayer)
char *p = buf;
UINT8 player = consoleplayer;
if (splitplayer == 1)
player = secondarydisplayplayer;
else if (splitplayer == 2)
player = thirddisplayplayer;
else if (splitplayer == 3)
player = fourthdisplayplayer;
if (splitplayer > 0)
player = displayplayers[splitplayer];
WRITESINT8(p, voted);
WRITEUINT8(p, player);
@ -3006,11 +3002,11 @@ static void Command_Teamchange2_f(void)
return;
}
if (players[secondarydisplayplayer].spectator)
error = !(NetPacket.packet.newteam || (players[secondarydisplayplayer].pflags & PF_WANTSTOJOIN));
if (players[displayplayers[1]].spectator)
error = !(NetPacket.packet.newteam || (players[displayplayers[1]].pflags & PF_WANTSTOJOIN));
else if (G_GametypeHasTeams())
error = (NetPacket.packet.newteam == (unsigned)players[secondarydisplayplayer].ctfteam);
else if (G_GametypeHasSpectators() && !players[secondarydisplayplayer].spectator)
error = (NetPacket.packet.newteam == (unsigned)players[displayplayers[1]].ctfteam);
else if (G_GametypeHasSpectators() && !players[displayplayers[1]].spectator)
error = (NetPacket.packet.newteam == 3);
#ifdef PARANOIA
else
@ -3097,11 +3093,11 @@ static void Command_Teamchange3_f(void)
return;
}
if (players[thirddisplayplayer].spectator)
error = !(NetPacket.packet.newteam || (players[thirddisplayplayer].pflags & PF_WANTSTOJOIN));
if (players[displayplayers[2]].spectator)
error = !(NetPacket.packet.newteam || (players[displayplayers[2]].pflags & PF_WANTSTOJOIN));
else if (G_GametypeHasTeams())
error = (NetPacket.packet.newteam == (unsigned)players[thirddisplayplayer].ctfteam);
else if (G_GametypeHasSpectators() && !players[thirddisplayplayer].spectator)
error = (NetPacket.packet.newteam == (unsigned)players[displayplayers[2]].ctfteam);
else if (G_GametypeHasSpectators() && !players[displayplayers[2]].spectator)
error = (NetPacket.packet.newteam == 3);
#ifdef PARANOIA
else
@ -3188,11 +3184,11 @@ static void Command_Teamchange4_f(void)
return;
}
if (players[fourthdisplayplayer].spectator)
error = !(NetPacket.packet.newteam || (players[fourthdisplayplayer].pflags & PF_WANTSTOJOIN));
if (players[displayplayers[3]].spectator)
error = !(NetPacket.packet.newteam || (players[displayplayers[3]].pflags & PF_WANTSTOJOIN));
else if (G_GametypeHasTeams())
error = (NetPacket.packet.newteam == (unsigned)players[fourthdisplayplayer].ctfteam);
else if (G_GametypeHasSpectators() && !players[fourthdisplayplayer].spectator)
error = (NetPacket.packet.newteam == (unsigned)players[displayplayers[3]].ctfteam);
else if (G_GametypeHasSpectators() && !players[displayplayers[3]].spectator)
error = (NetPacket.packet.newteam == 3);
#ifdef PARANOIA
else
@ -3589,8 +3585,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 || displayplayer == playernum)
displayplayer = consoleplayer;
if (playernum == consoleplayer || displayplayers[0] == playernum)
displayplayers[0] = consoleplayer;
if (G_GametypeHasTeams())
{
@ -3598,11 +3594,11 @@ static void Got_Teamchange(UINT8 **cp, INT32 playernum)
{
if (playernum == consoleplayer) //CTF and Team Match colors.
CV_SetValue(&cv_playercolor, NetPacket.packet.newteam + 5);
else if (playernum == secondarydisplayplayer)
else if (playernum == displayplayers[1])
CV_SetValue(&cv_playercolor2, NetPacket.packet.newteam + 5);
else if (playernum == thirddisplayplayer)
else if (playernum == displayplayers[2])
CV_SetValue(&cv_playercolor3, NetPacket.packet.newteam + 5);
else if (playernum == fourthdisplayplayer)
else if (playernum == displayplayers[3])
CV_SetValue(&cv_playercolor4, NetPacket.packet.newteam + 5);
}
}
@ -5208,13 +5204,13 @@ static void Got_PickVotecmd(UINT8 **cp, INT32 playernum)
Y_SetupVoteFinish(pick, level);
}
/** Prints the number of the displayplayer.
/** Prints the number of displayplayers[0].
*
* \todo Possibly remove this; it was useful for debugging at one point.
*/
static void Command_Displayplayer_f(void)
{
CONS_Printf(M_GetText("Displayplayer is %d\n"), displayplayer);
CONS_Printf(M_GetText("Displayplayer is %d\n"), displayplayers[0]);
}
/** Quits a game and returns to the title screen.
@ -5425,7 +5421,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[secondarydisplayplayer]);
CV_StealthSet(&cv_playername2, player_names[displayplayers[1]]);
}
else
SendNameAndColor2();
@ -5436,7 +5432,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[thirddisplayplayer]);
CV_StealthSet(&cv_playername3, player_names[displayplayers[2]]);
}
else
SendNameAndColor3();
@ -5447,7 +5443,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[fourthdisplayplayer]);
CV_StealthSet(&cv_playername4, player_names[displayplayers[3]]);
}
else
SendNameAndColor4();
@ -5488,12 +5484,12 @@ static void Skin2_OnChange(void)
if (!Playing() || !splitscreen)
return; // do whatever you want
if (CanChangeSkin(secondarydisplayplayer) && !P_PlayerMoving(secondarydisplayplayer))
if (CanChangeSkin(displayplayers[1]) && !P_PlayerMoving(displayplayers[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[secondarydisplayplayer].skin].name);
CV_StealthSet(&cv_skin2, skins[players[displayplayers[1]].skin].name);
}
}
@ -5502,12 +5498,12 @@ static void Skin3_OnChange(void)
if (!Playing() || splitscreen < 2)
return; // do whatever you want
if (CanChangeSkin(thirddisplayplayer) && !P_PlayerMoving(thirddisplayplayer))
if (CanChangeSkin(displayplayers[2]) && !P_PlayerMoving(displayplayers[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[thirddisplayplayer].skin].name);
CV_StealthSet(&cv_skin3, skins[players[displayplayers[2]].skin].name);
}
}
@ -5516,12 +5512,12 @@ static void Skin4_OnChange(void)
if (!Playing() || splitscreen < 3)
return; // do whatever you want
if (CanChangeSkin(fourthdisplayplayer) && !P_PlayerMoving(fourthdisplayplayer))
if (CanChangeSkin(displayplayers[3]) && !P_PlayerMoving(displayplayers[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[fourthdisplayplayer].skin].name);
CV_StealthSet(&cv_skin4, skins[players[displayplayers[3]].skin].name);
}
}
@ -5562,7 +5558,7 @@ static void Color2_OnChange(void)
if (!Playing() || !splitscreen)
return; // do whatever you want
if (!P_PlayerMoving(secondarydisplayplayer))
if (!P_PlayerMoving(displayplayers[1]))
{
// Color change menu scrolling fix is no longer necessary
SendNameAndColor2();
@ -5570,7 +5566,7 @@ static void Color2_OnChange(void)
else
{
CV_StealthSetValue(&cv_playercolor2,
players[secondarydisplayplayer].skincolor);
players[displayplayers[1]].skincolor);
}
}
@ -5579,7 +5575,7 @@ static void Color3_OnChange(void)
if (!Playing() || splitscreen < 2)
return; // do whatever you want
if (!P_PlayerMoving(thirddisplayplayer))
if (!P_PlayerMoving(displayplayers[2]))
{
// Color change menu scrolling fix is no longer necessary
SendNameAndColor3();
@ -5587,7 +5583,7 @@ static void Color3_OnChange(void)
else
{
CV_StealthSetValue(&cv_playercolor3,
players[thirddisplayplayer].skincolor);
players[displayplayers[2]].skincolor);
}
}
@ -5596,7 +5592,7 @@ static void Color4_OnChange(void)
if (!Playing() || splitscreen < 3)
return; // do whatever you want
if (!P_PlayerMoving(fourthdisplayplayer))
if (!P_PlayerMoving(displayplayers[3]))
{
// Color change menu scrolling fix is no longer necessary
SendNameAndColor4();
@ -5604,7 +5600,7 @@ static void Color4_OnChange(void)
else
{
CV_StealthSetValue(&cv_playercolor4,
players[fourthdisplayplayer].skincolor);
players[displayplayers[3]].skincolor);
}
}

View file

@ -9799,7 +9799,7 @@ static inline int lib_getenum(lua_State *L)
// DYNAMIC variables too!!
// Try not to add anything that would break netgames or timeattack replays here.
// You know, like consoleplayer, displayplayer, secondarydisplayplayer, or gametime.
// You know, like consoleplayer, displayplayers, or gametime.
if (fastcmp(word,"gamemap")) {
lua_pushinteger(L, gamemap);
return 1;

View file

@ -106,14 +106,8 @@ extern UINT8 window_notinfocus; // are we in focus? (backend independant -- hand
extern boolean nodrawers;
extern boolean noblit;
extern boolean lastdraw;
extern postimg_t postimgtype;
extern INT32 postimgparam;
extern postimg_t postimgtype2;
extern INT32 postimgparam2;
extern postimg_t postimgtype3;
extern INT32 postimgparam3;
extern postimg_t postimgtype4;
extern INT32 postimgparam4;
extern postimg_t postimgtype[MAXSPLITSCREENPLAYERS];
extern INT32 postimgparam[MAXSPLITSCREENPLAYERS];
extern INT32 viewwindowx, viewwindowy;
extern INT32 viewwidth, scaledviewwidth;
@ -122,10 +116,7 @@ extern boolean gamedataloaded;
// Player taking events, and displaying.
extern INT32 consoleplayer;
extern INT32 displayplayer;
extern INT32 secondarydisplayplayer; // for splitscreen
extern INT32 thirddisplayplayer;
extern INT32 fourthdisplayplayer;
extern INT32 displayplayers[MAXSPLITSCREENPLAYERS];
// Maps of special importance
extern INT16 spstage_start;

View file

@ -112,10 +112,7 @@ boolean addedtogame;
player_t players[MAXPLAYERS];
INT32 consoleplayer; // player taking events and displaying
INT32 displayplayer; // view being displayed
INT32 secondarydisplayplayer; // for splitscreen
INT32 thirddisplayplayer;
INT32 fourthdisplayplayer;
INT32 displayplayers[MAXSPLITSCREENPLAYERS]; // view being displayed
tic_t gametic;
tic_t levelstarttic; // gametic at level start
@ -1220,9 +1217,9 @@ INT32 JoyAxis(axis_input_e axissel, UINT8 p)
//
// set secondaryplayer true to build player 2's ticcmd in splitscreen mode
//
INT32 localaiming, localaiming2, localaiming3, localaiming4;
angle_t localangle, localangle2, localangle3, localangle4;
boolean camspin, camspin2, camspin3, camspin4;
INT32 localaiming[MAXSPLITSCREENPLAYERS]; // TODO: convert these 3 into MAXSPLITSCREENPLAYERS arrays
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};
@ -1239,53 +1236,36 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
camera_t *thiscam;
angle_t lang;
static INT32 turnheld, turnheld2, turnheld3, turnheld4; // for accelerative turning
static boolean keyboard_look, keyboard_look2, keyboard_look3, keyboard_look4; // true if lookup/down using keyboard
static boolean resetdown, resetdown2, resetdown3, resetdown4; // don't cam reset every frame
static INT32 turnheld[MAXSPLITSCREENPLAYERS]; // for accelerative turning
static boolean keyboard_look[MAXSPLITSCREENPLAYERS]; // true if lookup/down using keyboard
static boolean resetdown[MAXSPLITSCREENPLAYERS]; // don't cam reset every frame
if (demo.playback) return;
player = &players[displayplayers[ssplayer-1]];
if (ssplayer == 2)
thiscam = (player->bot == 2 ? &camera[0] : &camera[ssplayer-1]);
else
thiscam = &camera[ssplayer-1];
lang = localangle[ssplayer-1];
laim = localaiming[ssplayer-1];
th = turnheld[ssplayer-1];
kbl = keyboard_look[ssplayer-1];
rd = resetdown[ssplayer-1];
switch (ssplayer)
{
case 2:
player = &players[secondarydisplayplayer];
thiscam = (player->bot == 2 ? &camera : &camera2);
lang = localangle2;
laim = localaiming2;
th = turnheld2;
kbl = keyboard_look2;
rd = resetdown2;
G_CopyTiccmd(cmd, I_BaseTiccmd2(), 1);
break;
case 3:
player = &players[thirddisplayplayer];
thiscam = &camera3;
lang = localangle3;
laim = localaiming3;
th = turnheld3;
kbl = keyboard_look3;
rd = resetdown3;
G_CopyTiccmd(cmd, I_BaseTiccmd3(), 1);
break;
case 4:
player = &players[fourthdisplayplayer];
thiscam = &camera4;
lang = localangle4;
laim = localaiming4;
th = turnheld4;
kbl = keyboard_look4;
rd = resetdown4;
G_CopyTiccmd(cmd, I_BaseTiccmd4(), 1);
break;
case 1:
default:
player = &players[consoleplayer];
thiscam = &camera;
lang = localangle;
laim = localaiming;
th = turnheld;
kbl = keyboard_look;
rd = resetdown;
G_CopyTiccmd(cmd, I_BaseTiccmd(), 1); // empty, or external driver
break;
}
@ -1576,42 +1556,12 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
if (!hu_stopped)
{
switch (ssplayer)
{
case 2:
localangle2 = lang;
localaiming2 = laim;
keyboard_look2 = kbl;
turnheld2 = th;
resetdown2 = rd;
camspin2 = InputDown(gc_lookback, ssplayer);
break;
case 3:
localangle3 = lang;
localaiming3 = laim;
keyboard_look3 = kbl;
turnheld3 = th;
resetdown3 = rd;
camspin3 = InputDown(gc_lookback, ssplayer);
break;
case 4:
localangle4 = lang;
localaiming4 = laim;
keyboard_look4 = kbl;
turnheld4 = th;
resetdown4 = rd;
camspin4 = InputDown(gc_lookback, ssplayer);
break;
case 1:
default:
localangle = lang;
localaiming = laim;
keyboard_look = kbl;
turnheld = th;
resetdown = rd;
camspin = InputDown(gc_lookback, ssplayer);
break;
}
localangle[ssplayer-1] = lang;
localaiming[ssplayer-1] = laim;
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.
@ -1631,8 +1581,8 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
//Reset away view if a command is given.
if ((cmd->forwardmove || cmd->sidemove || cmd->buttons)
&& displayplayer != consoleplayer && ssplayer == 1)
displayplayer = consoleplayer;
&& displayplayers[0] != consoleplayer && ssplayer == 1)
displayplayers[0] = consoleplayer;
}
@ -1784,27 +1734,24 @@ void G_DoLoadLevel(boolean resetplayer)
if (!resetplayer)
P_FindEmerald();
displayplayer = consoleplayer; // view the guy you are playing
if (!splitscreen && !botingame)
secondarydisplayplayer = consoleplayer;
if (splitscreen < 2)
thirddisplayplayer = consoleplayer;
if (splitscreen < 3)
fourthdisplayplayer = consoleplayer;
displayplayers[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;
}
gameaction = ga_nothing;
#ifdef PARANOIA
Z_CheckHeap(-2);
#endif
if (camera.chase)
P_ResetCamera(&players[displayplayer], &camera);
if (camera2.chase && splitscreen)
P_ResetCamera(&players[secondarydisplayplayer], &camera2);
if (camera3.chase && splitscreen > 1)
P_ResetCamera(&players[thirddisplayplayer], &camera3);
if (camera4.chase && splitscreen > 2)
P_ResetCamera(&players[fourthdisplayplayer], &camera4);
for (i = 0; i <= splitscreen; i++)
{
if (camera[i].chase)
P_ResetCamera(&players[displayplayers[i]], &camera[i]);
}
// clear cmd building stuff
memset(gamekeydown, 0, sizeof (gamekeydown));
@ -1914,7 +1861,7 @@ boolean G_Responder(event_t *ev)
&& (ev->data1 == KEY_F12 || ev->data1 == gamecontrol[gc_viewpoint][0] || ev->data1 == gamecontrol[gc_viewpoint][1]))
{
if (!demo.playback && (splitscreen || !netgame))
displayplayer = consoleplayer;
displayplayers[0] = consoleplayer;
else
{
G_AdjustView(1, 1, true);
@ -2184,13 +2131,13 @@ boolean G_CanView(INT32 playernum, UINT8 viewnum, boolean onlyactive)
for (viewd = 1; viewd < viewnum; ++viewd)
{
displayplayerp = (G_GetDisplayplayerPtr(viewd));
displayplayerp = (&displayplayers[viewd-1]);
if ((*displayplayerp) == playernum)
return false;
}
for (viewd = viewnum + 1; viewd <= splits; ++viewd)
{
displayplayerp = (G_GetDisplayplayerPtr(viewd));
displayplayerp = (&displayplayers[viewd-1]);
if ((*displayplayerp) == playernum)
return false;
}
@ -2232,17 +2179,6 @@ INT32 G_CountPlayersPotentiallyViewable(boolean active)
return total;
}
INT32 *G_GetDisplayplayerPtr(UINT8 viewnum)
{
switch (viewnum)
{
case 2: return &secondarydisplayplayer;
case 3: return &thirddisplayplayer;
case 4: return &fourthdisplayplayer;
}
return &displayplayer;
}
//
// G_ResetView
// Correct a viewpoint to playernum or the next available, wraps forward.
@ -2276,14 +2212,14 @@ void G_ResetView(UINT8 viewnum, INT32 playernum, boolean onlyactive)
/* Prepare extra views for G_FindView to pass. */
for (viewd = splits+1; viewd < viewnum; ++viewd)
{
displayplayerp = (G_GetDisplayplayerPtr(viewd));
displayplayerp = (&displayplayers[viewd-1]);
(*displayplayerp) = INT32_MAX;
}
R_ExecuteSetViewSize();
}
displayplayerp = (G_GetDisplayplayerPtr(viewnum));
displayplayerp = (&displayplayers[viewnum-1]);
olddisplayplayer = (*displayplayerp);
/* Check if anyone is available to view. */
@ -2294,7 +2230,7 @@ void G_ResetView(UINT8 viewnum, INT32 playernum, boolean onlyactive)
(*displayplayerp) = playernum;
if ((*displayplayerp) != olddisplayplayer)
{
camerap = (P_GetCameraPtr(viewnum));
camerap = &camera[viewnum-1];
P_ResetCamera(&players[(*displayplayerp)], camerap);
}
@ -2302,8 +2238,8 @@ void G_ResetView(UINT8 viewnum, INT32 playernum, boolean onlyactive)
{
for (viewd = splits+1; viewd < viewnum; ++viewd)
{
displayplayerp = (G_GetDisplayplayerPtr(viewd));
camerap = (P_GetCameraPtr(viewd));
displayplayerp = (&displayplayers[viewd-1]);
camerap = &camera[viewd];
(*displayplayerp) = G_FindView(0, viewd, onlyactive, false);
@ -2312,7 +2248,7 @@ void G_ResetView(UINT8 viewnum, INT32 playernum, boolean onlyactive)
}
if (viewnum == 1 && demo.playback)
consoleplayer = displayplayer;
consoleplayer = displayplayers[0];
}
//
@ -2323,7 +2259,7 @@ void G_ResetView(UINT8 viewnum, INT32 playernum, boolean onlyactive)
void G_AdjustView(UINT8 viewnum, INT32 offset, boolean onlyactive)
{
INT32 *displayplayerp, oldview;
displayplayerp = G_GetDisplayplayerPtr(viewnum);
displayplayerp = &displayplayers[viewnum-1];
oldview = (*displayplayerp);
G_ResetView(viewnum, ( (*displayplayerp) + offset ), onlyactive);
@ -2864,22 +2800,22 @@ void G_PlayerReborn(INT32 player)
{
if (p == &players[consoleplayer])
CV_SetValue(&cv_playercolor, skincolor_redteam);
else if (p == &players[secondarydisplayplayer])
else if (p == &players[displayplayers[1]])
CV_SetValue(&cv_playercolor2, skincolor_redteam);
else if (p == &players[thirddisplayplayer])
else if (p == &players[displayplayers[2]])
CV_SetValue(&cv_playercolor3, skincolor_redteam);
else if (p == &players[fourthdisplayplayer])
else if (p == &players[displayplayers[3]])
CV_SetValue(&cv_playercolor4, skincolor_redteam);
}
else if (p->ctfteam == 2 && p->skincolor != skincolor_blueteam)
{
if (p == &players[consoleplayer])
CV_SetValue(&cv_playercolor, skincolor_blueteam);
else if (p == &players[secondarydisplayplayer])
else if (p == &players[displayplayers[1]])
CV_SetValue(&cv_playercolor2, skincolor_blueteam);
else if (p == &players[thirddisplayplayer])
else if (p == &players[displayplayers[2]])
CV_SetValue(&cv_playercolor3, skincolor_blueteam);
else if (p == &players[fourthdisplayplayer])
else if (p == &players[displayplayers[3]])
CV_SetValue(&cv_playercolor4, skincolor_blueteam);
}
}*/
@ -2984,18 +2920,18 @@ void G_SpawnPlayer(INT32 playernum, boolean starpost)
if (nummapthings)
{
if (playernum == consoleplayer
|| (splitscreen && playernum == secondarydisplayplayer)
|| (splitscreen > 1 && playernum == thirddisplayplayer)
|| (splitscreen > 2 && playernum == fourthdisplayplayer))
|| (splitscreen && playernum == displayplayers[1])
|| (splitscreen > 1 && playernum == displayplayers[2])
|| (splitscreen > 2 && playernum == displayplayers[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 == secondarydisplayplayer)
|| (splitscreen > 1 && playernum == thirddisplayplayer)
|| (splitscreen > 2 && playernum == fourthdisplayplayer))
|| (splitscreen && playernum == displayplayers[1])
|| (splitscreen > 1 && playernum == displayplayers[2])
|| (splitscreen > 2 && playernum == displayplayers[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.
}
@ -3015,9 +2951,9 @@ mapthing_t *G_FindCTFStart(INT32 playernum)
if (!numredctfstarts && !numbluectfstarts) //why even bother, eh?
{
if (playernum == consoleplayer
|| (splitscreen && playernum == secondarydisplayplayer)
|| (splitscreen > 1 && playernum == thirddisplayplayer)
|| (splitscreen > 2 && playernum == fourthdisplayplayer))
|| (splitscreen && playernum == displayplayers[1])
|| (splitscreen > 1 && playernum == displayplayers[2])
|| (splitscreen > 2 && playernum == displayplayers[3]))
CONS_Alert(CONS_WARNING, M_GetText("No CTF starts in this map!\n"));
return NULL;
}
@ -3027,9 +2963,9 @@ mapthing_t *G_FindCTFStart(INT32 playernum)
if (!numredctfstarts)
{
if (playernum == consoleplayer
|| (splitscreen && playernum == secondarydisplayplayer)
|| (splitscreen > 1 && playernum == thirddisplayplayer)
|| (splitscreen > 2 && playernum == fourthdisplayplayer))
|| (splitscreen && playernum == displayplayers[1])
|| (splitscreen > 1 && playernum == displayplayers[2])
|| (splitscreen > 2 && playernum == displayplayers[3]))
CONS_Alert(CONS_WARNING, M_GetText("No Red Team starts in this map!\n"));
return NULL;
}
@ -3042,9 +2978,9 @@ mapthing_t *G_FindCTFStart(INT32 playernum)
}
if (playernum == consoleplayer
|| (splitscreen && playernum == secondarydisplayplayer)
|| (splitscreen > 1 && playernum == thirddisplayplayer)
|| (splitscreen > 2 && playernum == fourthdisplayplayer))
|| (splitscreen && playernum == displayplayers[1])
|| (splitscreen > 1 && playernum == displayplayers[2])
|| (splitscreen > 2 && playernum == displayplayers[3]))
CONS_Alert(CONS_WARNING, M_GetText("Could not spawn at any Red Team starts!\n"));
return NULL;
}
@ -3053,9 +2989,9 @@ mapthing_t *G_FindCTFStart(INT32 playernum)
if (!numbluectfstarts)
{
if (playernum == consoleplayer
|| (splitscreen && playernum == secondarydisplayplayer)
|| (splitscreen > 1 && playernum == thirddisplayplayer)
|| (splitscreen > 2 && playernum == fourthdisplayplayer))
|| (splitscreen && playernum == displayplayers[1])
|| (splitscreen > 1 && playernum == displayplayers[2])
|| (splitscreen > 2 && playernum == displayplayers[3]))
CONS_Alert(CONS_WARNING, M_GetText("No Blue Team starts in this map!\n"));
return NULL;
}
@ -3067,9 +3003,9 @@ mapthing_t *G_FindCTFStart(INT32 playernum)
return bluectfstarts[i];
}
if (playernum == consoleplayer
|| (splitscreen && playernum == secondarydisplayplayer)
|| (splitscreen > 1 && playernum == thirddisplayplayer)
|| (splitscreen > 2 && playernum == fourthdisplayplayer))
|| (splitscreen && playernum == displayplayers[1])
|| (splitscreen > 1 && playernum == displayplayers[2])
|| (splitscreen > 2 && playernum == displayplayers[3]))
CONS_Alert(CONS_WARNING, M_GetText("Could not spawn at any Blue Team starts!\n"));
return NULL;
}
@ -3090,17 +3026,17 @@ mapthing_t *G_FindMatchStart(INT32 playernum)
return deathmatchstarts[i];
}
if (playernum == consoleplayer
|| (splitscreen && playernum == secondarydisplayplayer)
|| (splitscreen > 1 && playernum == thirddisplayplayer)
|| (splitscreen > 2 && playernum == fourthdisplayplayer))
|| (splitscreen && playernum == displayplayers[1])
|| (splitscreen > 1 && playernum == displayplayers[2])
|| (splitscreen > 2 && playernum == displayplayers[3]))
CONS_Alert(CONS_WARNING, M_GetText("Could not spawn at any Deathmatch starts!\n"));
return NULL;
}
if (playernum == consoleplayer
|| (splitscreen && playernum == secondarydisplayplayer)
|| (splitscreen > 1 && playernum == thirddisplayplayer)
|| (splitscreen > 2 && playernum == fourthdisplayplayer))
|| (splitscreen && playernum == displayplayers[1])
|| (splitscreen > 1 && playernum == displayplayers[2])
|| (splitscreen > 2 && playernum == displayplayers[3]))
CONS_Alert(CONS_WARNING, M_GetText("No Deathmatch starts in this map!\n"));
return NULL;
}
@ -3166,17 +3102,17 @@ mapthing_t *G_FindRaceStart(INT32 playernum)
//return playerstarts[0];
if (playernum == consoleplayer
|| (splitscreen && playernum == secondarydisplayplayer)
|| (splitscreen > 1 && playernum == thirddisplayplayer)
|| (splitscreen > 2 && playernum == fourthdisplayplayer))
|| (splitscreen && playernum == displayplayers[1])
|| (splitscreen > 1 && playernum == displayplayers[2])
|| (splitscreen > 2 && playernum == displayplayers[3]))
CONS_Alert(CONS_WARNING, M_GetText("Could not spawn at any Race starts!\n"));
return NULL;
}
if (playernum == consoleplayer
|| (splitscreen && playernum == secondarydisplayplayer)
|| (splitscreen > 1 && playernum == thirddisplayplayer)
|| (splitscreen > 2 && playernum == fourthdisplayplayer))
|| (splitscreen && playernum == displayplayers[1])
|| (splitscreen > 1 && playernum == displayplayers[2])
|| (splitscreen > 2 && playernum == displayplayers[3]))
CONS_Alert(CONS_WARNING, M_GetText("No Race starts in this map!\n"));
return NULL;
}
@ -3268,14 +3204,11 @@ void G_DoReborn(INT32 playernum)
if (player->starpostnum) // SRB2kart
starpost = true;
if (camera.chase)
P_ResetCamera(&players[displayplayer], &camera);
if (camera2.chase && splitscreen > 0)
P_ResetCamera(&players[secondarydisplayplayer], &camera2);
if (camera3.chase && splitscreen > 1)
P_ResetCamera(&players[thirddisplayplayer], &camera3);
if (camera4.chase && splitscreen > 2)
P_ResetCamera(&players[fourthdisplayplayer], &camera4);
for (i = 0; i <= splitscreen; i++)
{
if (camera[i].chase)
P_ResetCamera(&players[displayplayers[i]], &camera[i]);
}
// clear cmd building stuff
memset(gamekeydown, 0, sizeof (gamekeydown));
@ -3297,8 +3230,8 @@ void G_DoReborn(INT32 playernum)
if (botingame)
{ // Bots respawn next to their master.
players[secondarydisplayplayer].playerstate = PST_REBORN;
G_SpawnPlayer(secondarydisplayplayer, false);
players[displayplayers[1]].playerstate = PST_REBORN;
G_SpawnPlayer(displayplayers[1], false);
}
}
else
@ -4418,7 +4351,7 @@ static void M_ForceLoadGameResponse(INT32 ch)
//set cursaveslot to -1 so nothing gets saved.
cursaveslot = -1;
displayplayer = consoleplayer;
displayplayers[0] = consoleplayer;
multiplayer = false;
splitscreen = 0;
SplitScreen_OnChange(); // not needed?
@ -4508,7 +4441,7 @@ void G_LoadGame(UINT32 slot, INT16 mapoverride)
// gameaction = ga_nothing;
// G_SetGamestate(GS_LEVEL);
displayplayer = consoleplayer;
displayplayers[0] = consoleplayer;
multiplayer = false;
splitscreen = 0;
SplitScreen_OnChange(); // not needed?
@ -4573,7 +4506,7 @@ void G_SaveGame(UINT32 savegameslot)
//
// G_DeferedInitNew
// Can be called by the startup code or the menu task,
// consoleplayer, displayplayer, playeringame[] should be set.
// consoleplayer, displayplayers[], playeringame[] should be set.
//
void G_DeferedInitNew(boolean pencoremode, const char *mapname, INT32 pickedchar, UINT8 ssplayers, boolean FLS)
{
@ -5167,12 +5100,12 @@ void G_ReadDemoTiccmd(ticcmd_t *cmd, INT32 playernum)
G_CopyTiccmd(cmd, &oldcmd[playernum], 1);
// SRB2kart: Copy-pasted from ticcmd building, removes that crappy demo cam
if (((players[displayplayer].mo && players[displayplayer].speed > 0) // Moving
if (((players[displayplayers[0]].mo && players[displayplayers[0]].speed > 0) // Moving
|| (leveltime > starttime && (cmd->buttons & BT_ACCELERATE && cmd->buttons & BT_BRAKE)) // Rubber-burn turn
|| (players[displayplayer].kartstuff[k_respawn]) // Respawning
|| (players[displayplayer].spectator || objectplacing)) // Not a physical player
&& !(players[displayplayer].kartstuff[k_spinouttimer] && players[displayplayer].kartstuff[k_sneakertimer])) // Spinning and boosting cancels out spinout
localangle += (cmd->angleturn<<16);
|| (players[displayplayers[0]].kartstuff[k_respawn]) // Respawning
|| (players[displayplayers[0]].spectator || objectplacing)) // Not a physical player
&& !(players[displayplayers[0]].kartstuff[k_spinouttimer] && players[displayplayers[0]].kartstuff[k_sneakertimer])) // Spinning and boosting cancels out spinout
localangle[0] += (cmd->angleturn<<16);
if (!(demoflags & DF_GHOST) && *demo_p == DEMOMARKER)
{
@ -6073,7 +6006,7 @@ void G_PreviewRewind(tic_t previewtime)
}
for (i = splitscreen+1; i > 0; i--)
P_ResetCamera(&players[(*G_GetDisplayplayerPtr(i))], P_GetCameraPtr(i));
P_ResetCamera(&players[displayplayers[i]], &camera[i]);
}
void G_ConfirmRewind(tic_t rewindtime)
@ -6081,7 +6014,7 @@ void G_ConfirmRewind(tic_t rewindtime)
tic_t i;
boolean oldmenuactive = menuactive, oldsounddisabled = sound_disabled;
INT32 olddp1 = displayplayer, olddp2 = secondarydisplayplayer, olddp3 = thirddisplayplayer, olddp4 = fourthdisplayplayer;
INT32 olddp1 = displayplayers[0], olddp2 = displayplayers[1], olddp3 = displayplayers[2], olddp4 = displayplayers[3];
UINT8 oldss = splitscreen;
menuactive = false; // Prevent loops
@ -6113,15 +6046,15 @@ void G_ConfirmRewind(tic_t rewindtime)
COM_BufInsertText("renderview on\n");
splitscreen = oldss;
displayplayer = olddp1;
secondarydisplayplayer = olddp2;
thirddisplayplayer = olddp3;
fourthdisplayplayer = olddp4;
displayplayers[0] = olddp1;
displayplayers[1] = olddp2;
displayplayers[2] = olddp3;
displayplayers[3] = olddp4;
R_ExecuteSetViewSize();
G_ResetViews();
for (i = splitscreen+1; i > 0; i--)
P_ResetCamera(&players[(*G_GetDisplayplayerPtr(i))], P_GetCameraPtr(i));
P_ResetCamera(&players[displayplayers[i]], &camera[i]);
}
void G_ReadMetalTic(mobj_t *metal)
@ -7407,7 +7340,8 @@ void G_DoPlayDemo(char *defdemoname)
// didn't start recording right away.
demo.deferstart = false;
displayplayer = consoleplayer = 0;
consoleplayer = 0;
memset(displayplayers, 0, sizeof(displayplayers));
memset(playeringame, 0, sizeof(playeringame));
playeringame[0] = true;
@ -7457,13 +7391,14 @@ void G_DoPlayDemo(char *defdemoname)
/*#ifdef HAVE_BLUA
LUAh_MapChange(gamemap);
#endif*/
displayplayer = consoleplayer = 0;
displayplayers[0] = consoleplayer = 0;
memset(playeringame,0,sizeof(playeringame));
// Load players that were in-game when the map started
p = READUINT8(demo_p);
secondarydisplayplayer = thirddisplayplayer = fourthdisplayplayer = INT32_MAX;
for (i = 1; i < MAXSPLITSCREENPLAYERS; i++);
displayplayers[i] = INT32_MAX;
while (p != 0xFF)
{
@ -7499,8 +7434,8 @@ void G_DoPlayDemo(char *defdemoname)
return;
}
if (!playeringame[displayplayer] || players[displayplayer].spectator)
displayplayer = consoleplayer = serverplayer = p;
if (!playeringame[displayplayers[0]] || players[displayplayers[0]].spectator)
displayplayers[0] = consoleplayer = serverplayer = p;
playeringame[p] = true;
players[p].spectator = spectator;

View file

@ -152,9 +152,9 @@ INT16 G_SoftwareClipAimingPitch(INT32 *aiming);
boolean InputDown(INT32 gc, UINT8 p);
INT32 JoyAxis(axis_input_e axissel, UINT8 p);
extern angle_t localangle, localangle2, localangle3, localangle4;
extern INT32 localaiming, localaiming2, localaiming3, localaiming4; // should be an angle_t but signed
extern boolean camspin, camspin2, camspin3, camspin4; // SRB2Kart
extern angle_t localangle[MAXSPLITSCREENPLAYERS];
extern INT32 localaiming[MAXSPLITSCREENPLAYERS]; // should be an angle_t but signed
extern boolean camspin[MAXSPLITSCREENPLAYERS]; // SRB2Kart
//
// GAME
@ -297,8 +297,6 @@ void G_EndGame(void); // moved from y_inter.c/h and renamed
void G_Ticker(boolean run);
boolean G_Responder(event_t *ev);
INT32 *G_GetDisplayplayerPtr(UINT8 viewnum);
boolean G_CouldView(INT32 playernum);
boolean G_CanView(INT32 playernum, UINT8 viewnum, boolean onlyactive);

View file

@ -39,7 +39,7 @@
#include "am_map.h"
#include "d_main.h"
#include "p_local.h" // camera, camera2, camera3, camera4
#include "p_local.h" // camera[]
#include "p_tick.h"
#ifdef HWRENDER
@ -1987,7 +1987,7 @@ static void HU_DrawChat_Old(void)
if (!i)
return;
if ((netgame || multiplayer) && players[displayplayer].spectator)
if ((netgame || multiplayer) && players[displayplayers[0]].spectator)
return;
#ifdef HWRENDER
@ -2014,7 +2014,7 @@ static inline void HU_DrawCrosshair2(void)
if (!i)
return;
if ((netgame || multiplayer) && players[secondarydisplayplayer].spectator)
if ((netgame || multiplayer) && players[displayplayers[1]].spectator)
return;
#ifdef HWRENDER
@ -2061,7 +2061,7 @@ static inline void HU_DrawCrosshair3(void)
if (!i)
return;
if ((netgame || multiplayer) && players[thirddisplayplayer].spectator)
if ((netgame || multiplayer) && players[displayplayers[2]].spectator)
return;
#ifdef HWRENDER
@ -2098,7 +2098,7 @@ static inline void HU_DrawCrosshair4(void)
if (!i)
return;
if ((netgame || multiplayer) && players[fourthdisplayplayer].spectator)
if ((netgame || multiplayer) && players[displayplayers[3]].spectator)
return;
#ifdef HWRENDER
@ -2358,16 +2358,16 @@ void HU_Drawer(void)
// draw the crosshair, not when viewing demos nor with chasecam
/*if (!automapactive && !demo.playback)
{
if (cv_crosshair.value && !camera.chase && !players[displayplayer].spectator)
if (cv_crosshair.value && !camera[0].chase && !players[displayplayers[0]].spectator)
HU_DrawCrosshair();
if (cv_crosshair2.value && !camera2.chase && !players[secondarydisplayplayer].spectator)
if (cv_crosshair2.value && !camera[1].chase && !players[displayplayers[1]].spectator)
HU_DrawCrosshair2();
if (cv_crosshair3.value && !camera3.chase && !players[thirddisplayplayer].spectator)
if (cv_crosshair3.value && !camera[2].chase && !players[displayplayers[2]].spectator)
HU_DrawCrosshair3();
if (cv_crosshair4.value && !camera4.chase && !players[fourthdisplayplayer].spectator)
if (cv_crosshair4.value && !camera[3].chase && !players[displayplayers[3]].spectator)
HU_DrawCrosshair4();
}*/
@ -3009,7 +3009,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)
whiteplayer = demo.playback ? displayplayer : consoleplayer;
whiteplayer = demo.playback ? displayplayers[0] : consoleplayer;
scorelines = 0;
memset(completed, 0, sizeof (completed));

View file

@ -1027,34 +1027,14 @@ static void K_KartItemRoulette(player_t *player, ticcmd_t *cmd)
}
// This makes the roulette produce the random noises.
if ((player->kartstuff[k_itemroulette] % 3) == 1 && P_IsLocalPlayer(player))
if ((player->kartstuff[k_itemroulette] % 3) == 1 && P_IsDisplayPlayer(player))
{
#define PLAYROULETTESND S_StartSound(NULL, sfx_itrol1 + ((player->kartstuff[k_itemroulette] / 3) % 8));
if (splitscreen)
#define PLAYROULETTESND S_StartSound(NULL, sfx_itrol1 + ((player->kartstuff[k_itemroulette] / 3) % 8))
for (i = 0; i <= splitscreen; i++)
{
if (players[displayplayer].kartstuff[k_itemroulette])
{
if (player == &players[displayplayer])
if (player == &players[displayplayers[i]] && players[displayplayers[i]].kartstuff[k_itemroulette])
PLAYROULETTESND;
}
else if (players[secondarydisplayplayer].kartstuff[k_itemroulette])
{
if (player == &players[secondarydisplayplayer])
PLAYROULETTESND;
}
else if (players[thirddisplayplayer].kartstuff[k_itemroulette] && splitscreen > 1)
{
if (player == &players[thirddisplayplayer])
PLAYROULETTESND;
}
else if (players[fourthdisplayplayer].kartstuff[k_itemroulette] && splitscreen > 2)
{
if (player == &players[fourthdisplayplayer])
PLAYROULETTESND;
}
}
else
PLAYROULETTESND;
#undef PLAYROULETTESND
}
@ -1081,7 +1061,7 @@ static void K_KartItemRoulette(player_t *player, ticcmd_t *cmd)
//player->kartstuff[k_itemblinkmode] = 1;
player->kartstuff[k_itemroulette] = 0;
player->kartstuff[k_roulettetype] = 0;
if (P_IsLocalPlayer(player))
if (P_IsDisplayPlayer(player))
S_StartSound(NULL, sfx_itrole);
return;
}
@ -1094,7 +1074,7 @@ static void K_KartItemRoulette(player_t *player, ticcmd_t *cmd)
player->kartstuff[k_itemblinkmode] = 2;
player->kartstuff[k_itemroulette] = 0;
player->kartstuff[k_roulettetype] = 0;
if (P_IsLocalPlayer(player))
if (P_IsDisplayPlayer(player))
S_StartSound(NULL, sfx_dbgsal);
return;
}
@ -1126,7 +1106,7 @@ static void K_KartItemRoulette(player_t *player, ticcmd_t *cmd)
player->kartstuff[k_itemamount] = 1;
}
if (P_IsLocalPlayer(player))
if (P_IsDisplayPlayer(player))
S_StartSound(NULL, ((player->kartstuff[k_roulettetype] == 1) ? sfx_itrolk : (mashed ? sfx_itrolm : sfx_itrolf)));
player->kartstuff[k_itemblink] = TICRATE;
@ -4331,10 +4311,7 @@ static void K_UpdateEngineSounds(player_t *player, ticcmd_t *cmd)
if (!playeringame[i] || !players[i].mo || players[i].spectator || players[i].exiting)
continue;
if ((i == displayplayer)
|| (i == secondarydisplayplayer && splitscreen)
|| (i == thirddisplayplayer && splitscreen > 1)
|| (i == fourthdisplayplayer && splitscreen > 2))
if (P_IsDisplayPlayer(&players[i]))
{
volumedampen += FRACUNIT; // We already know what this is gonna be, let's not waste our time.
continue;
@ -5691,13 +5668,13 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
if (player->kartstuff[k_hyudorotimer] >= (1*TICRATE/2) && player->kartstuff[k_hyudorotimer] <= hyudorotime-(1*TICRATE/2))
{
if (player == &players[secondarydisplayplayer])
if (player == &players[displayplayers[1]])
player->mo->eflags |= MFE_DRAWONLYFORP2;
else if (player == &players[thirddisplayplayer] && splitscreen > 1)
else if (player == &players[displayplayers[2]] && splitscreen > 1)
player->mo->eflags |= MFE_DRAWONLYFORP3;
else if (player == &players[fourthdisplayplayer] && splitscreen > 2)
else if (player == &players[displayplayers[3]] && splitscreen > 2)
player->mo->eflags |= MFE_DRAWONLYFORP4;
else if (player == &players[consoleplayer])
else if (player == &players[displayplayers[0]])
player->mo->eflags |= MFE_DRAWONLYFORP1;
else
player->mo->flags2 |= MF2_DONTDRAW;
@ -5707,8 +5684,8 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
}
else
{
if (player == &players[displayplayer]
|| (player != &players[displayplayer] && (player->kartstuff[k_hyudorotimer] < (1*TICRATE/2) || player->kartstuff[k_hyudorotimer] > hyudorotime-(1*TICRATE/2))))
if (P_IsDisplayPlayer(player)
|| (!P_IsDisplayPlayer(player) && (player->kartstuff[k_hyudorotimer] < (1*TICRATE/2) || player->kartstuff[k_hyudorotimer] > hyudorotime-(1*TICRATE/2))))
{
if (leveltime & 1)
player->mo->flags2 |= MF2_DONTDRAW;
@ -5808,7 +5785,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
}
// Play the starting countdown sounds
if (player == &players[displayplayer]) // Don't play louder in splitscreen
if (player == &players[displayplayers[0]]) // Don't play louder in splitscreen
{
if ((leveltime == starttime-(3*TICRATE)) || (leveltime == starttime-(2*TICRATE)) || (leveltime == starttime-TICRATE))
S_StartSound(NULL, sfx_s3ka7);
@ -6693,17 +6670,17 @@ INT32 K_calcSplitFlags(INT32 snapflags)
if (splitscreen == 0)
return snapflags;
if (stplyr != &players[displayplayer])
if (stplyr != &players[displayplayers[0]])
{
if (splitscreen == 1 && stplyr == &players[secondarydisplayplayer])
if (splitscreen == 1 && stplyr == &players[displayplayers[1]])
{
splitflags |= V_SPLITSCREEN;
}
else if (splitscreen > 1)
{
if (stplyr == &players[thirddisplayplayer] || (splitscreen == 3 && stplyr == &players[fourthdisplayplayer]))
if (stplyr == &players[displayplayers[2]] || (splitscreen == 3 && stplyr == &players[displayplayers[3]]))
splitflags |= V_SPLITSCREEN;
if (stplyr == &players[secondarydisplayplayer] || (splitscreen == 3 && stplyr == &players[fourthdisplayplayer]))
if (stplyr == &players[displayplayers[1]] || (splitscreen == 3 && stplyr == &players[displayplayers[3]]))
splitflags |= V_HORZSCREEN;
}
}
@ -6973,17 +6950,17 @@ static void K_drawKartItem(void)
}
else // now we're having a fun game.
{
if (stplyr == &players[displayplayer] || stplyr == &players[thirddisplayplayer]) // If we are P1 or P3...
if (stplyr == &players[displayplayers[0]] || stplyr == &players[displayplayers[2]]) // If we are P1 or P3...
{
fx = ITEM_X;
fy = ITEM_Y;
fflags = V_SNAPTOLEFT|((stplyr == &players[thirddisplayplayer]) ? V_SPLITSCREEN : V_SNAPTOTOP); // flip P3 to the bottom.
fflags = V_SNAPTOLEFT|((stplyr == &players[displayplayers[2]]) ? V_SPLITSCREEN : V_SNAPTOTOP); // flip P3 to the bottom.
}
else // else, that means we're P2 or P4.
{
fx = ITEM2_X;
fy = ITEM2_Y;
fflags = V_SNAPTORIGHT|((stplyr == &players[fourthdisplayplayer]) ? V_SPLITSCREEN : V_SNAPTOTOP); // flip P4 to the bottom
fflags = V_SNAPTORIGHT|((stplyr == &players[displayplayers[3]]) ? V_SPLITSCREEN : V_SNAPTOTOP); // flip P4 to the bottom
flipamount = true;
}
}
@ -7226,7 +7203,7 @@ static void K_DrawKartPositionNum(INT32 num)
else if (splitscreen == 1) // for this splitscreen, we'll use case by case because it's a bit different.
{
fx = POSI_X;
if (stplyr == &players[displayplayer]) // for player 1: display this at the top right, above the minimap.
if (stplyr == &players[displayplayers[0]]) // for player 1: display this at the top right, above the minimap.
{
fy = 30;
fflags = V_SNAPTOTOP|V_SNAPTORIGHT;
@ -7241,11 +7218,11 @@ static void K_DrawKartPositionNum(INT32 num)
}
else
{
if (stplyr == &players[displayplayer] || stplyr == &players[thirddisplayplayer]) // If we are P1 or P3...
if (stplyr == &players[displayplayers[0]] || stplyr == &players[displayplayers[2]]) // If we are P1 or P3...
{
fx = POSI_X;
fy = POSI_Y;
fflags = V_SNAPTOLEFT|((stplyr == &players[thirddisplayplayer]) ? V_SPLITSCREEN|V_SNAPTOBOTTOM : 0); // flip P3 to the bottom.
fflags = V_SNAPTOLEFT|((stplyr == &players[displayplayers[2]]) ? V_SPLITSCREEN|V_SNAPTOBOTTOM : 0); // flip P3 to the bottom.
flipdraw = true;
if (num && num >= 10)
fx += W; // this seems dumb, but we need to do this in order for positions above 10 going off screen.
@ -7254,7 +7231,7 @@ static void K_DrawKartPositionNum(INT32 num)
{
fx = POSI2_X;
fy = POSI2_Y;
fflags = V_SNAPTORIGHT|((stplyr == &players[fourthdisplayplayer]) ? V_SPLITSCREEN|V_SNAPTOBOTTOM : 0); // flip P4 to the bottom
fflags = V_SNAPTORIGHT|((stplyr == &players[displayplayers[3]]) ? V_SPLITSCREEN|V_SNAPTOBOTTOM : 0); // flip P4 to the bottom
}
}
@ -7580,17 +7557,17 @@ static void K_drawKartLaps(void)
}
else
{
if (stplyr == &players[displayplayer] || stplyr == &players[thirddisplayplayer]) // If we are P1 or P3...
if (stplyr == &players[displayplayers[0]] || stplyr == &players[displayplayers[2]]) // If we are P1 or P3...
{
fx = LAPS_X;
fy = LAPS_Y;
fflags = V_SNAPTOLEFT|((stplyr == &players[thirddisplayplayer]) ? V_SPLITSCREEN|V_SNAPTOBOTTOM : 0); // flip P3 to the bottom.
fflags = V_SNAPTOLEFT|((stplyr == &players[displayplayers[2]]) ? V_SPLITSCREEN|V_SNAPTOBOTTOM : 0); // flip P3 to the bottom.
}
else // else, that means we're P2 or P4.
{
fx = LAPS2_X;
fy = LAPS2_Y;
fflags = V_SNAPTORIGHT|((stplyr == &players[fourthdisplayplayer]) ? V_SPLITSCREEN|V_SNAPTOBOTTOM : 0); // flip P4 to the bottom
fflags = V_SNAPTORIGHT|((stplyr == &players[displayplayers[3]]) ? V_SPLITSCREEN|V_SNAPTOBOTTOM : 0); // flip P4 to the bottom
flipstring = true; // make the string right aligned and other shit
}
}
@ -7662,17 +7639,17 @@ static void K_drawKartBumpersOrKarma(void)
// we will reuse lap coords here since it's essentially the same shit.
if (stplyr == &players[displayplayer] || stplyr == &players[thirddisplayplayer]) // If we are P1 or P3...
if (stplyr == &players[displayplayers[0]] || stplyr == &players[displayplayers[2]]) // If we are P1 or P3...
{
fx = LAPS_X;
fy = LAPS_Y;
fflags = V_SNAPTOLEFT|((stplyr == &players[thirddisplayplayer]) ? V_SPLITSCREEN|V_SNAPTOBOTTOM : 0); // flip P3 to the bottom.
fflags = V_SNAPTOLEFT|((stplyr == &players[displayplayers[2]]) ? V_SPLITSCREEN|V_SNAPTOBOTTOM : 0); // flip P3 to the bottom.
}
else // else, that means we're P2 or P4.
{
fx = LAPS2_X;
fy = LAPS2_Y;
fflags = V_SNAPTORIGHT|((stplyr == &players[fourthdisplayplayer]) ? V_SPLITSCREEN|V_SNAPTOBOTTOM : 0); // flip P4 to the bottom
fflags = V_SNAPTORIGHT|((stplyr == &players[displayplayers[3]]) ? V_SPLITSCREEN|V_SNAPTOBOTTOM : 0); // flip P4 to the bottom
flipstring = true;
}
@ -7749,7 +7726,7 @@ static void K_drawKartWanted(void)
UINT8 *colormap = NULL;
INT32 basex = 0, basey = 0;
if (stplyr != &players[displayplayer])
if (stplyr != &players[displayplayers[0]])
return;
for (i = 0; i < 4; i++)
@ -7829,7 +7806,7 @@ static void K_drawKartPlayerCheck(void)
if (stplyr->awayviewtics)
return;
if (camspin)
if (camspin[0])
return;
for (i = 0; i < MAXPLAYERS; i++)
@ -7975,7 +7952,7 @@ static void K_drawKartMinimap(void)
if (gamestate != GS_LEVEL)
return;
if (stplyr != &players[displayplayer])
if (stplyr != &players[displayplayers[0]])
return;
lumpnum = W_CheckNumForName(va("%sR", G_BuildMapName(gamemap)));
@ -8049,7 +8026,7 @@ static void K_drawKartMinimap(void)
if (!players[i].mo || players[i].spectator)
continue;
if (i != displayplayer || splitscreen)
if (i != displayplayers[0] || splitscreen)
{
if (G_BattleGametype() && players[i].kartstuff[k_bumper] <= 0)
continue;
@ -8063,7 +8040,7 @@ static void K_drawKartMinimap(void)
}
}
if (i == displayplayer || i == secondarydisplayplayer || i == thirddisplayplayer || i == fourthdisplayplayer)
if (P_IsDisplayPlayer(&players[i]))
{
// Draw display players on top of everything else
localplayers[numlocalplayers] = i;
@ -8133,7 +8110,7 @@ static void K_drawKartFinish(void)
xval = (SHORT(kp_racefinish[pnum]->width)<<FRACBITS);
x = ((TICRATE - stplyr->kartstuff[k_cardanimation])*(xval > x ? xval : x))/TICRATE;
if (splitscreen && stplyr == &players[secondarydisplayplayer])
if (splitscreen && stplyr == &players[displayplayers[1]])
x = -x;
V_DrawFixedPatch(x + (STCD_X<<FRACBITS) - (xval>>1),
@ -8152,9 +8129,9 @@ static void K_drawBattleFullscreen(void)
if (splitscreen)
{
if ((splitscreen == 1 && stplyr == &players[secondarydisplayplayer])
|| (splitscreen > 1 && (stplyr == &players[thirddisplayplayer]
|| (stplyr == &players[fourthdisplayplayer] && splitscreen > 2))))
if ((splitscreen == 1 && stplyr == &players[displayplayers[1]])
|| (splitscreen > 1 && (stplyr == &players[displayplayers[2]]
|| (stplyr == &players[displayplayers[3]] && splitscreen > 2))))
{
y = 232-(stplyr->kartstuff[k_cardanimation]/2);
splitflags = V_SNAPTOBOTTOM;
@ -8166,8 +8143,8 @@ static void K_drawBattleFullscreen(void)
{
scale /= 2;
if (stplyr == &players[secondarydisplayplayer]
|| (stplyr == &players[fourthdisplayplayer] && splitscreen > 2))
if (stplyr == &players[displayplayers[1]]
|| (stplyr == &players[displayplayers[3]] && splitscreen > 2))
x = 3*BASEVIDWIDTH/4;
else
x = BASEVIDWIDTH/4;
@ -8176,7 +8153,7 @@ static void K_drawBattleFullscreen(void)
{
if (stplyr->exiting)
{
if (stplyr == &players[secondarydisplayplayer])
if (stplyr == &players[displayplayers[1]])
x = BASEVIDWIDTH-96;
else
x = 96;
@ -8188,7 +8165,7 @@ static void K_drawBattleFullscreen(void)
if (stplyr->exiting)
{
if (stplyr == &players[displayplayer])
if (stplyr == &players[displayplayers[0]])
V_DrawFadeScreen(0xFF00, 16);
if (stplyr->exiting < 6*TICRATE && !stplyr->spectator)
{
@ -8218,9 +8195,9 @@ static void K_drawBattleFullscreen(void)
{
if (splitscreen > 1)
ty = (BASEVIDHEIGHT/4)+33;
if ((splitscreen == 1 && stplyr == &players[secondarydisplayplayer])
|| (stplyr == &players[thirddisplayplayer] && splitscreen > 1)
|| (stplyr == &players[fourthdisplayplayer] && splitscreen > 2))
if ((splitscreen == 1 && stplyr == &players[displayplayers[1]])
|| (stplyr == &players[displayplayers[2]] && splitscreen > 1)
|| (stplyr == &players[displayplayers[3]] && splitscreen > 2))
ty += (BASEVIDHEIGHT/2);
}
else
@ -8273,11 +8250,11 @@ static void K_drawKartFirstPerson(void)
if (stplyr->spectator || !stplyr->mo || (stplyr->mo->flags2 & MF2_DONTDRAW))
return;
if (stplyr == &players[secondarydisplayplayer] && splitscreen)
if (stplyr == &players[displayplayers[1]] && splitscreen)
{ pn = pnum[1]; tn = turn[1]; dr = drift[1]; }
else if (stplyr == &players[thirddisplayplayer] && splitscreen > 1)
else if (stplyr == &players[displayplayers[2]] && splitscreen > 1)
{ pn = pnum[2]; tn = turn[2]; dr = drift[2]; }
else if (stplyr == &players[fourthdisplayplayer] && splitscreen > 2)
else if (stplyr == &players[displayplayers[3]] && splitscreen > 2)
{ pn = pnum[3]; tn = turn[3]; dr = drift[3]; }
else
{ pn = pnum[0]; tn = turn[0]; dr = drift[0]; }
@ -8402,11 +8379,11 @@ static void K_drawKartFirstPerson(void)
V_DrawFixedPatch(x, y, scale, splitflags, kp_fpview[target], colmap);
if (stplyr == &players[secondarydisplayplayer] && splitscreen)
if (stplyr == &players[displayplayers[1]] && splitscreen)
{ pnum[1] = pn; turn[1] = tn; drift[1] = dr; }
else if (stplyr == &players[thirddisplayplayer] && splitscreen > 1)
else if (stplyr == &players[displayplayers[2]] && splitscreen > 1)
{ pnum[2] = pn; turn[2] = tn; drift[2] = dr; }
else if (stplyr == &players[fourthdisplayplayer] && splitscreen > 2)
else if (stplyr == &players[displayplayers[3]] && splitscreen > 2)
{ pnum[3] = pn; turn[3] = tn; drift[3] = dr; }
else
{ pnum[0] = pn; turn[0] = tn; drift[0] = dr; }
@ -8627,7 +8604,7 @@ static void K_drawDistributionDebugger(void)
boolean dontforcespb = false;
boolean spbrush = false;
if (stplyr != &players[displayplayer]) // only for p1
if (stplyr != &players[displayplayers[0]]) // only for p1
return;
// The only code duplication from the Kart, just to avoid the actual item function from calculating pingame twice
@ -8691,7 +8668,7 @@ static void K_drawDistributionDebugger(void)
static void K_drawCheckpointDebugger(void)
{
if (stplyr != &players[displayplayer]) // only for p1
if (stplyr != &players[displayplayers[0]]) // only for p1
return;
if (stplyr->starpostnum >= (numstarposts - (numstarposts/2)))
@ -8705,20 +8682,21 @@ void K_drawKartHUD(void)
{
boolean isfreeplay = false;
boolean battlefullscreen = false;
UINT8 i;
// Define the X and Y for each drawn object
// This is handled by console/menu values
K_initKartHUD();
// Draw that fun first person HUD! Drawn ASAP so it looks more "real".
if ((stplyr == &players[displayplayer] && !camera.chase)
|| ((splitscreen && stplyr == &players[secondarydisplayplayer]) && !camera2.chase)
|| ((splitscreen > 1 && stplyr == &players[thirddisplayplayer]) && !camera3.chase)
|| ((splitscreen > 2 && stplyr == &players[fourthdisplayplayer]) && !camera4.chase))
for (i = 0; i <= splitscreen; i++)
{
if (stplyr == &players[displayplayers[i]] && !camera[i].chase)
K_drawKartFirstPerson();
}
// Draw full screen stuff that turns off the rest of the HUD
if (mapreset && stplyr == &players[displayplayer])
if (mapreset && stplyr == &players[displayplayers[0]])
{
K_drawChallengerScreen();
return;
@ -8734,7 +8712,7 @@ void K_drawKartHUD(void)
if (!demo.title && (!battlefullscreen || splitscreen))
{
// Draw the CHECK indicator before the other items, so it's overlapped by everything else
if (cv_kartcheck.value && !splitscreen && !players[displayplayer].exiting)
if (cv_kartcheck.value && !splitscreen && !players[displayplayers[0]].exiting)
K_drawKartPlayerCheck();
// Draw WANTED status

View file

@ -118,14 +118,14 @@ void COM_Lua_f(void)
flags = (UINT8)lua_tointeger(gL, -1);
lua_pop(gL, 1); // pop flags
if (flags & 2) // flag 2: splitscreen player command.
if (flags & 2) // flag 2: splitscreen player command. TODO: support 4P
{
if (!splitscreen)
{
lua_pop(gL, 1); // pop command info table
return; // can't execute splitscreen command without player 2!
}
playernum = secondarydisplayplayer;
playernum = displayplayers[1];
}
if (netgame)

View file

@ -797,24 +797,24 @@ void LUAh_GameHUD(player_t *stplayr)
lua_remove(gL, -3); // pop HUD
LUA_PushUserdata(gL, stplayr, META_PLAYER);
if (splitscreen > 2 && stplayr == &players[fourthdisplayplayer])
if (splitscreen > 2 && stplayr == &players[displayplayers[3]])
{
LUA_PushUserdata(gL, &camera4, META_CAMERA);
LUA_PushUserdata(gL, &camera[3], META_CAMERA);
camnum = 4;
}
else if (splitscreen > 1 && stplayr == &players[thirddisplayplayer])
else if (splitscreen > 1 && stplayr == &players[displayplayers[2]])
{
LUA_PushUserdata(gL, &camera3, META_CAMERA);
LUA_PushUserdata(gL, &camera[2], META_CAMERA);
camnum = 3;
}
else if (splitscreen && stplayr == &players[secondarydisplayplayer])
else if (splitscreen && stplayr == &players[displayplayers[1]])
{
LUA_PushUserdata(gL, &camera2, META_CAMERA);
LUA_PushUserdata(gL, &camera[1], META_CAMERA);
camnum = 2;
}
else
{
LUA_PushUserdata(gL, &camera, META_CAMERA);
LUA_PushUserdata(gL, &camera[0], META_CAMERA);
camnum = 1;
}

View file

@ -421,13 +421,13 @@ static int mobj_set(lua_State *L)
case mobj_angle:
mo->angle = luaL_checkangle(L, 3);
if (mo->player == &players[consoleplayer])
localangle = mo->angle;
else if (mo->player == &players[secondarydisplayplayer])
localangle2 = mo->angle;
else if (mo->player == &players[thirddisplayplayer])
localangle3 = mo->angle;
else if (mo->player == &players[fourthdisplayplayer])
localangle4 = mo->angle;
localangle[0] = mo->angle;
else if (mo->player == &players[displayplayers[1]])
localangle[1] = mo->angle;
else if (mo->player == &players[displayplayers[2]])
localangle[2] = mo->angle;
else if (mo->player == &players[displayplayers[3]])
localangle[3] = mo->angle;
break;
case mobj_sprite:
mo->sprite = luaL_checkinteger(L, 3);

View file

@ -382,13 +382,13 @@ static int player_set(lua_State *L)
else if (fastcmp(field,"aiming")) {
plr->aiming = luaL_checkangle(L, 3);
if (plr == &players[consoleplayer])
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;
localaiming[0] = plr->aiming;
else if (plr == &players[displayplayers[1]])
localaiming[1] = plr->aiming;
else if (plr == &players[displayplayers[2]])
localaiming[2] = plr->aiming;
else if (plr == &players[displayplayers[3]])
localaiming[3] = plr->aiming;
}
else if (fastcmp(field,"health"))
plr->health = (INT32)luaL_checkinteger(L, 3);

View file

@ -5787,7 +5787,7 @@ static void M_DrawPlaybackMenu(void)
if (splitscreen >= i - playback_view1)
{
INT32 ply = *G_GetDisplayplayerPtr(i - playback_view1 + 1);
INT32 ply = displayplayers[i - playback_view1 + 1];
icon = facerankprefix[players[ply].skin];
if (i != itemOn)
@ -5836,19 +5836,10 @@ static void M_DrawPlaybackMenu(void)
break;
case playback_view1:
str = player_names[displayplayer];
break;
case playback_view2:
str = player_names[secondarydisplayplayer];
break;
case playback_view3:
str = player_names[thirddisplayplayer];
break;
case playback_view4:
str = player_names[fourthdisplayplayer];
str = player_names[displayplayers[i - playback_view1]]; // 0 to 3
break;
default: // shouldn't ever be reached but whatever
@ -9472,7 +9463,7 @@ static void M_SetupMultiPlayer2(INT32 choice)
strcpy (setupm_name, cv_playername2.string);
// set for splitscreen secondary player
setupm_player = &players[secondarydisplayplayer];
setupm_player = &players[displayplayers[1]];
setupm_cvskin = &cv_skin2;
setupm_cvcolor = &cv_playercolor2;
setupm_cvname = &cv_playername2;
@ -9484,7 +9475,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(secondarydisplayplayer))
if (splitscreen && !CanChangeSkin(displayplayers[1]))
MP_PlayerSetupMenu[2].status = (IT_GRAYEDOUT);
else
MP_PlayerSetupMenu[2].status = (IT_KEYHANDLER | IT_STRING);
@ -9503,7 +9494,7 @@ static void M_SetupMultiPlayer3(INT32 choice)
strcpy(setupm_name, cv_playername3.string);
// set for splitscreen third player
setupm_player = &players[thirddisplayplayer];
setupm_player = &players[displayplayers[2]];
setupm_cvskin = &cv_skin3;
setupm_cvcolor = &cv_playercolor3;
setupm_cvname = &cv_playername3;
@ -9515,7 +9506,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(thirddisplayplayer))
if (splitscreen > 1 && !CanChangeSkin(displayplayers[2]))
MP_PlayerSetupMenu[2].status = (IT_GRAYEDOUT);
else
MP_PlayerSetupMenu[2].status = (IT_KEYHANDLER | IT_STRING);
@ -9534,7 +9525,7 @@ static void M_SetupMultiPlayer4(INT32 choice)
strcpy(setupm_name, cv_playername4.string);
// set for splitscreen fourth player
setupm_player = &players[fourthdisplayplayer];
setupm_player = &players[displayplayers[3]];
setupm_cvskin = &cv_skin4;
setupm_cvcolor = &cv_playercolor4;
setupm_cvname = &cv_playername4;
@ -9546,7 +9537,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(fourthdisplayplayer))
if (splitscreen > 2 && !CanChangeSkin(displayplayers[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[displayplayer] && players[displayplayer].mo)
if (gamestate == GS_LEVEL && &players[displayplayers[0]] && players[displayplayers[0]].mo)
snprintf(locationtxt, 40, "X:%d Y:%d Z:%d A:%d",
players[displayplayer].mo->x>>FRACBITS,
players[displayplayer].mo->y>>FRACBITS,
players[displayplayer].mo->z>>FRACBITS,
FixedInt(AngleFixed(players[displayplayer].mo->angle)));
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)));
else
snprintf(locationtxt, 40, "Unknown");

View file

@ -4174,12 +4174,12 @@ void A_OverlayThink(mobj_t *actor)
{
angle_t viewingangle;
if (players[displayplayer].awayviewtics)
viewingangle = R_PointToAngle2(actor->target->x, actor->target->y, players[displayplayer].awayviewmobj->x, players[displayplayer].awayviewmobj->y);
else if (!camera.chase && players[displayplayer].mo)
viewingangle = R_PointToAngle2(actor->target->x, actor->target->y, players[displayplayer].mo->x, players[displayplayer].mo->y);
if (players[displayplayers[0]].awayviewtics)
viewingangle = R_PointToAngle2(actor->target->x, actor->target->y, players[displayplayers[0]].awayviewmobj->x, players[displayplayers[0]].awayviewmobj->y);
else if (!camera[0].chase && players[displayplayers[0]].mo)
viewingangle = R_PointToAngle2(actor->target->x, actor->target->y, players[displayplayers[0]].mo->x, players[displayplayers[0]].mo->y);
else
viewingangle = R_PointToAngle2(actor->target->x, actor->target->y, camera.x, camera.y);
viewingangle = R_PointToAngle2(actor->target->x, actor->target->y, camera[0].x, camera[0].y);
destx = actor->target->x + P_ReturnThrustX(actor->target, viewingangle, FixedMul(FRACUNIT, actor->scale));
desty = actor->target->y + P_ReturnThrustY(actor->target, viewingangle, FixedMul(FRACUNIT, actor->scale));

View file

@ -2536,9 +2536,9 @@ void T_CameraScanner(elevator_t *elevator)
lastleveltime = leveltime;
}
if (players[displayplayer].mo)
if (players[displayplayers[0]].mo)
{
if (players[displayplayer].mo->subsector->sector == elevator->actionsector)
if (players[displayplayers[0]].mo->subsector->sector == elevator->actionsector)
{
if (t_cam_dist == -42)
t_cam_dist = cv_cam_dist.value;
@ -2564,9 +2564,9 @@ void T_CameraScanner(elevator_t *elevator)
}
}
if (splitscreen && players[secondarydisplayplayer].mo)
if (splitscreen && players[displayplayers[1]].mo)
{
if (players[secondarydisplayplayer].mo->subsector->sector == elevator->actionsector)
if (players[displayplayers[1]].mo->subsector->sector == elevator->actionsector)
{
if (t_cam2_rotate == -42)
t_cam2_dist = cv_cam2_dist.value;
@ -2592,9 +2592,9 @@ void T_CameraScanner(elevator_t *elevator)
}
}
if (splitscreen > 1 && players[thirddisplayplayer].mo)
if (splitscreen > 1 && players[displayplayers[2]].mo)
{
if (players[thirddisplayplayer].mo->subsector->sector == elevator->actionsector)
if (players[displayplayers[2]].mo->subsector->sector == elevator->actionsector)
{
if (t_cam3_rotate == -42)
t_cam3_dist = cv_cam3_dist.value;
@ -2620,9 +2620,9 @@ void T_CameraScanner(elevator_t *elevator)
}
}
if (splitscreen > 2 && players[fourthdisplayplayer].mo)
if (splitscreen > 2 && players[displayplayers[3]].mo)
{
if (players[fourthdisplayplayer].mo->subsector->sector == elevator->actionsector)
if (players[displayplayers[3]].mo->subsector->sector == elevator->actionsector)
{
if (t_cam4_rotate == -42)
t_cam4_dist = cv_cam4_dist.value;

View file

@ -62,11 +62,11 @@ void P_ForceConstant(const BasicFF_t *FFInfo)
ConstantQuake.Magnitude = FFInfo->Magnitude;
if (FFInfo->player == &players[consoleplayer])
I_Tactile(ConstantForce, &ConstantQuake);
else if (splitscreen && FFInfo->player == &players[secondarydisplayplayer])
else if (splitscreen && FFInfo->player == &players[displayplayers[1]])
I_Tactile2(ConstantForce, &ConstantQuake);
else if (splitscreen > 1 && FFInfo->player == &players[thirddisplayplayer])
else if (splitscreen > 1 && FFInfo->player == &players[displayplayers[2]])
I_Tactile3(ConstantForce, &ConstantQuake);
else if (splitscreen > 2 && FFInfo->player == &players[fourthdisplayplayer])
else if (splitscreen > 2 && FFInfo->player == &players[displayplayers[3]])
I_Tactile4(ConstantForce, &ConstantQuake);
}
void P_RampConstant(const BasicFF_t *FFInfo, INT32 Start, INT32 End)
@ -83,11 +83,11 @@ void P_RampConstant(const BasicFF_t *FFInfo, INT32 Start, INT32 End)
RampQuake.End = End;
if (FFInfo->player == &players[consoleplayer])
I_Tactile(ConstantForce, &RampQuake);
else if (splitscreen && FFInfo->player == &players[secondarydisplayplayer])
else if (splitscreen && FFInfo->player == &players[displayplayers[1]])
I_Tactile2(ConstantForce, &RampQuake);
else if (splitscreen > 1 && FFInfo->player == &players[thirddisplayplayer])
else if (splitscreen > 1 && FFInfo->player == &players[displayplayers[2]])
I_Tactile3(ConstantForce, &RampQuake);
else if (splitscreen > 2 && FFInfo->player == &players[fourthdisplayplayer])
else if (splitscreen > 2 && FFInfo->player == &players[displayplayers[3]])
I_Tactile4(ConstantForce, &RampQuake);
}
@ -218,7 +218,7 @@ void P_DoNightsScore(player_t *player)
dummymo->fuse = 3*TICRATE;
// What?! NO, don't use the camera! Scale up instead!
//P_InstaThrust(dummymo, R_PointToAngle2(dummymo->x, dummymo->y, camera.x, camera.y), 3*FRACUNIT);
//P_InstaThrust(dummymo, R_PointToAngle2(dummymo->x, dummymo->y, camera[0].x, camera[0].y), 3*FRACUNIT);
dummymo->scalespeed = FRACUNIT/25;
dummymo->destscale = 2*FRACUNIT;
}
@ -1180,13 +1180,13 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
toucher->angle = special->angle;
if (player == &players[consoleplayer])
localangle = toucher->angle;
else if (player == &players[secondarydisplayplayer])
localangle2 = toucher->angle;
else if (player == &players[thirddisplayplayer])
localangle3 = toucher->angle;
else if (player == &players[fourthdisplayplayer])
localangle4 = toucher->angle;
localangle[0] = toucher->angle;
else if (player == &players[displayplayers[1]])
localangle[1] = toucher->angle;
else if (player == &players[displayplayers[2]])
localangle[2] = toucher->angle;
else if (player == &players[displayplayers[3]])
localangle[3] = toucher->angle;
P_ResetPlayer(player);
@ -1209,7 +1209,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
}
// CECHO showing you what this item is
if (player == &players[displayplayer] || G_IsSpecialStage(gamemap))
if (player == &players[displayplayers[0]] || G_IsSpecialStage(gamemap))
{
HU_SetCEchoFlags(V_AUTOFADEOUT);
HU_SetCEchoDuration(4);
@ -1231,7 +1231,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
}
// CECHO showing you what this item is
if (player == &players[displayplayer] || G_IsSpecialStage(gamemap))
if (player == &players[displayplayers[0]] || G_IsSpecialStage(gamemap))
{
HU_SetCEchoFlags(V_AUTOFADEOUT);
HU_SetCEchoDuration(4);
@ -1263,7 +1263,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
}
// CECHO showing you what this item is
if (player == &players[displayplayer] || G_IsSpecialStage(gamemap))
if (player == &players[displayplayers[0]] || G_IsSpecialStage(gamemap))
{
HU_SetCEchoFlags(V_AUTOFADEOUT);
HU_SetCEchoDuration(4);
@ -1293,7 +1293,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
}
// CECHO showing you what this item is
if (player == &players[displayplayer] || G_IsSpecialStage(gamemap))
if (player == &players[displayplayers[0]] || G_IsSpecialStage(gamemap))
{
HU_SetCEchoFlags(V_AUTOFADEOUT);
HU_SetCEchoDuration(4);
@ -1321,7 +1321,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
}
// CECHO showing you what this item is
if (player == &players[displayplayer] || G_IsSpecialStage(gamemap))
if (player == &players[displayplayers[0]] || G_IsSpecialStage(gamemap))
{
HU_SetCEchoFlags(V_AUTOFADEOUT);
HU_SetCEchoDuration(4);
@ -2324,17 +2324,17 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source)
AM_Stop();
//added : 22-02-98: recenter view for next life...
localaiming = 0;
localaiming[0] = 0;
}
if (target->player == &players[secondarydisplayplayer])
if (target->player == &players[displayplayers[1]])
{
// added : 22-02-98: recenter view for next life...
localaiming2 = 0;
localaiming[1] = 0;
}
if (target->player == &players[thirddisplayplayer])
localaiming3 = 0;
if (target->player == &players[fourthdisplayplayer])
localaiming4 = 0;
if (target->player == &players[displayplayers[2]])
localaiming[2] = 0;
if (target->player == &players[displayplayers[3]])
localaiming[3] = 0;
//tag deaths handled differently in suicide cases. Don't count spectators!
/*if (G_TagGametype()

View file

@ -108,7 +108,7 @@ typedef struct camera_s
fixed_t pan;
} camera_t;
extern camera_t camera, camera2, camera3, camera4;
extern camera_t camera[MAXSPLITSCREENPLAYERS];
extern consvar_t cv_cam_dist, cv_cam_still, cv_cam_height;
extern consvar_t cv_cam_speed, cv_cam_rotate, cv_cam_rotspeed;
@ -126,8 +126,6 @@ extern fixed_t t_cam2_dist, t_cam2_height, t_cam2_rotate;
extern fixed_t t_cam3_dist, t_cam3_height, t_cam3_rotate;
extern fixed_t t_cam4_dist, t_cam4_height, t_cam4_rotate;
camera_t *P_GetCameraPtr(UINT8 viewnum);
fixed_t P_GetPlayerHeight(player_t *player);
fixed_t P_GetPlayerSpinHeight(player_t *player);
void P_AddPlayerScore(player_t *player, UINT32 amount);

View file

@ -215,13 +215,13 @@ boolean P_DoSpring(mobj_t *spring, mobj_t *object)
if (!demo.playback || P_AnalogMove(object->player))
{
if (object->player == &players[consoleplayer])
localangle = spring->angle;
else if (object->player == &players[secondarydisplayplayer])
localangle2 = spring->angle;
else if (object->player == &players[thirddisplayplayer])
localangle3 = spring->angle;
else if (object->player == &players[fourthdisplayplayer])
localangle4 = spring->angle;
localangle[0] = spring->angle;
else if (object->player == &players[displayplayers[1]])
localangle[1] = spring->angle;
else if (object->player == &players[displayplayers[2]])
localangle[2] = spring->angle;
else if (object->player == &players[displayplayers[3]])
localangle[3] = spring->angle;
}
}
@ -1267,13 +1267,13 @@ static boolean PIT_CheckThing(mobj_t *thing)
if (!demo.playback || P_AnalogMove(thing->player))
{
if (thing->player == &players[consoleplayer])
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;
localangle[0] = thing->angle;
else if (thing->player == &players[displayplayers[1]])
localangle[1] = thing->angle;
else if (thing->player == &players[displayplayers[2]])
localangle[2] = thing->angle;
else if (thing->player == &players[displayplayers[3]])
localangle[3] = thing->angle;
}
return true;
@ -2504,34 +2504,38 @@ boolean P_TryCameraMove(fixed_t x, fixed_t y, camera_t *thiscam)
subsector_t *s = R_PointInSubsector(x, y);
boolean retval = true;
boolean itsatwodlevel = false;
UINT8 i;
floatok = false;
if (twodlevel
|| (thiscam == &camera && players[displayplayer].mo && (players[displayplayer].mo->flags2 & MF2_TWOD))
|| (thiscam == &camera2 && players[secondarydisplayplayer].mo && (players[secondarydisplayplayer].mo->flags2 & MF2_TWOD))
|| (thiscam == &camera3 && players[thirddisplayplayer].mo && (players[thirddisplayplayer].mo->flags2 & MF2_TWOD))
|| (thiscam == &camera4 && players[fourthdisplayplayer].mo && (players[fourthdisplayplayer].mo->flags2 & MF2_TWOD)))
if (twodlevel)
itsatwodlevel = true;
else
{
for (i = 0; i <= splitscreen; i++)
{
if (thiscam == &camera[i] && players[displayplayers[i]].mo
&& (players[displayplayers[i]].mo->flags2 & MF2_TWOD))
{
itsatwodlevel = true;
break;
}
}
}
if (!itsatwodlevel && players[displayplayer].mo)
if (!itsatwodlevel && players[displayplayers[0]].mo)
{
fixed_t tryx = thiscam->x;
fixed_t tryy = thiscam->y;
for (i = 0; i <= splitscreen; i++)
{
#ifndef NOCLIPCAM
if ((thiscam == &camera && (players[displayplayer].pflags & PF_NOCLIP))
|| (thiscam == &camera2 && (players[secondarydisplayplayer].pflags & PF_NOCLIP))
|| (thiscam == &camera3 && (players[thirddisplayplayer].pflags & PF_NOCLIP))
|| (thiscam == &camera4 && (players[fourthdisplayplayer].pflags & PF_NOCLIP))
|| (leveltime < introtime))
if ((thiscam == &camera[i] && (players[displayplayers[i]].pflags & PF_NOCLIP)) || (leveltime < introtime)) // Noclipping player camera noclips too!!
#else
if ((thiscam == &camera && !(players[displayplayer].pflags & PF_TIMEOVER))
|| (thiscam == &camera2 && !(players[secondarydisplayplayer].pflags & PF_TIMEOVER))
|| (thiscam == &camera3 && !(players[thirddisplayplayer].pflags & PF_TIMEOVER))
|| (thiscam == &camera4 && !(players[fourthdisplayplayer].pflags & PF_TIMEOVER)))
if (thiscam == &camera[i] && !(players[displayplayers[i]].pflags & PF_TIMEOVER)) // Time Over should not clip through walls
#endif
{ // Noclipping player camera noclips too!!
{
floatok = true;
thiscam->floorz = thiscam->z;
thiscam->ceilingz = thiscam->z + thiscam->height;
@ -2540,6 +2544,7 @@ boolean P_TryCameraMove(fixed_t x, fixed_t y, camera_t *thiscam)
thiscam->subsector = s;
return true;
}
}
do {
if (x-tryx > MAXRADIUS)

View file

@ -339,9 +339,9 @@ void P_CameraLineOpening(line_t *linedef)
frontceiling = sectors[front->camsec].ceilingheight;
#ifdef ESLOPE
if (sectors[front->camsec].f_slope) // SRB2CBTODO: ESLOPE (sectors[front->heightsec].f_slope)
frontfloor = P_GetZAt(sectors[front->camsec].f_slope, camera.x, camera.y);
frontfloor = P_GetZAt(sectors[front->camsec].f_slope, camera[0].x, camera[0].y);
if (sectors[front->camsec].c_slope)
frontceiling = P_GetZAt(sectors[front->camsec].c_slope, camera.x, camera.y);
frontceiling = P_GetZAt(sectors[front->camsec].c_slope, camera[0].x, camera[0].y);
#endif
}
@ -351,9 +351,9 @@ void P_CameraLineOpening(line_t *linedef)
frontceiling = sectors[front->heightsec].ceilingheight;
#ifdef ESLOPE
if (sectors[front->heightsec].f_slope) // SRB2CBTODO: ESLOPE (sectors[front->heightsec].f_slope)
frontfloor = P_GetZAt(sectors[front->heightsec].f_slope, camera.x, camera.y);
frontfloor = P_GetZAt(sectors[front->heightsec].f_slope, camera[0].x, camera[0].y);
if (sectors[front->heightsec].c_slope)
frontceiling = P_GetZAt(sectors[front->heightsec].c_slope, camera.x, camera.y);
frontceiling = P_GetZAt(sectors[front->heightsec].c_slope, camera[0].x, camera[0].y);
#endif
}
else
@ -367,9 +367,9 @@ void P_CameraLineOpening(line_t *linedef)
backceiling = sectors[back->camsec].ceilingheight;
#ifdef ESLOPE
if (sectors[back->camsec].f_slope) // SRB2CBTODO: ESLOPE (sectors[front->heightsec].f_slope)
frontfloor = P_GetZAt(sectors[back->camsec].f_slope, camera.x, camera.y);
frontfloor = P_GetZAt(sectors[back->camsec].f_slope, camera[0].x, camera[0].y);
if (sectors[back->camsec].c_slope)
frontceiling = P_GetZAt(sectors[back->camsec].c_slope, camera.x, camera.y);
frontceiling = P_GetZAt(sectors[back->camsec].c_slope, camera[0].x, camera[0].y);
#endif
}
else if (back->heightsec >= 0)
@ -378,9 +378,9 @@ void P_CameraLineOpening(line_t *linedef)
backceiling = sectors[back->heightsec].ceilingheight;
#ifdef ESLOPE
if (sectors[back->heightsec].f_slope) // SRB2CBTODO: ESLOPE (sectors[front->heightsec].f_slope)
frontfloor = P_GetZAt(sectors[back->heightsec].f_slope, camera.x, camera.y);
frontfloor = P_GetZAt(sectors[back->heightsec].f_slope, camera[0].x, camera[0].y);
if (sectors[back->heightsec].c_slope)
frontceiling = P_GetZAt(sectors[back->heightsec].c_slope, camera.x, camera.y);
frontceiling = P_GetZAt(sectors[back->heightsec].c_slope, camera[0].x, camera[0].y);
#endif
}
else

View file

@ -1136,45 +1136,19 @@ static void P_PlayerFlip(mobj_t *mo)
else if (mo->player->pflags & PF_FLIPCAM)
{
mo->player->aiming = InvAngle(mo->player->aiming);
if (mo->player-players == displayplayer)
for (i = 0; i <= splitscreen; i++)
{
localaiming = mo->player->aiming;
if (camera.chase) {
camera.aiming = InvAngle(camera.aiming);
camera.z = mo->z - camera.z + mo->z;
if (mo->eflags & MFE_VERTICALFLIP)
camera.z += FixedMul(20*FRACUNIT, mo->scale);
}
}
else if (mo->player-players == secondarydisplayplayer)
if (mo->player-players == displayplayers[i])
{
localaiming2 = mo->player->aiming;
if (camera2.chase) {
camera2.aiming = InvAngle(camera2.aiming);
camera2.z = mo->z - camera2.z + mo->z;
localaiming[i] = mo->player->aiming;
if (camera[i].chase) {
camera[i].aiming = InvAngle(camera[i].aiming);
camera[i].z = mo->z - camera[i].z + mo->z;
if (mo->eflags & MFE_VERTICALFLIP)
camera2.z += FixedMul(20*FRACUNIT, mo->scale);
camera[i].z += FixedMul(20*FRACUNIT, mo->scale);
}
}
else if (mo->player-players == thirddisplayplayer)
{
localaiming3 = mo->player->aiming;
if (camera3.chase) {
camera3.aiming = InvAngle(camera3.aiming);
camera3.z = mo->z - camera3.z + mo->z;
if (mo->eflags & MFE_VERTICALFLIP)
camera3.z += FixedMul(20*FRACUNIT, mo->scale);
}
}
else if (mo->player-players == fourthdisplayplayer)
{
localaiming4 = mo->player->aiming;
if (camera4.chase) {
camera4.aiming = InvAngle(camera4.aiming);
camera4.z = mo->z - camera4.z + mo->z;
if (mo->eflags & MFE_VERTICALFLIP)
camera4.z += FixedMul(20*FRACUNIT, mo->scale);
}
}
}
}
@ -3546,17 +3520,26 @@ boolean P_CameraThinker(player_t *player, camera_t *thiscam, boolean resetcalled
{
boolean itsatwodlevel = false;
postimg_t postimg = postimg_none;
UINT8 i;
// This can happen when joining
if (thiscam->subsector == NULL || thiscam->subsector->sector == NULL)
return true;
if (twodlevel
|| (thiscam == &camera && players[displayplayer].mo && (players[displayplayer].mo->flags2 & MF2_TWOD))
|| (thiscam == &camera2 && players[secondarydisplayplayer].mo && (players[secondarydisplayplayer].mo->flags2 & MF2_TWOD))
|| (thiscam == &camera3 && players[thirddisplayplayer].mo && (players[thirddisplayplayer].mo->flags2 & MF2_TWOD))
|| (thiscam == &camera4 && players[fourthdisplayplayer].mo && (players[fourthdisplayplayer].mo->flags2 & MF2_TWOD)))
if (twodlevel)
itsatwodlevel = true;
else
{
for (i = 0; i <= splitscreen; i++)
{
if (thiscam == &camera[i] && players[displayplayers[i]].mo
&& (players[displayplayers[i]].mo->flags2 & MF2_TWOD))
{
itsatwodlevel = true;
break;
}
}
}
if (encoremode)
postimg = postimg_mirror;
@ -3588,14 +3571,11 @@ boolean P_CameraThinker(player_t *player, camera_t *thiscam, boolean resetcalled
if (postimg != postimg_none)
{
if (splitscreen && player == &players[secondarydisplayplayer])
postimgtype2 = postimg;
else if (splitscreen > 1 && player == &players[thirddisplayplayer])
postimgtype3 = postimg;
else if (splitscreen > 2 && player == &players[fourthdisplayplayer])
postimgtype4 = postimg;
else
postimgtype = postimg;
for (i = 0; i <= splitscreen; i++)
{
if (player == &players[displayplayers[i]])
postimgtype[i] = postimg;
}
}
if (thiscam->momx || thiscam->momy)
@ -3641,11 +3621,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[secondarydisplayplayer])
if (player == &players[displayplayers[1]])
cam_height = cv_cam2_height.value;
if (player == &players[thirddisplayplayer])
if (player == &players[displayplayers[2]])
cam_height = cv_cam3_height.value;
if (player == &players[fourthdisplayplayer])
if (player == &players[displayplayers[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))
{
@ -6101,12 +6081,12 @@ void P_RunOverlays(void)
{
angle_t viewingangle;
if (players[displayplayer].awayviewtics)
viewingangle = R_PointToAngle2(mo->target->x, mo->target->y, players[displayplayer].awayviewmobj->x, players[displayplayer].awayviewmobj->y);
else if (!camera.chase && players[displayplayer].mo)
viewingangle = R_PointToAngle2(mo->target->x, mo->target->y, players[displayplayer].mo->x, players[displayplayer].mo->y);
if (players[displayplayers[0]].awayviewtics)
viewingangle = R_PointToAngle2(mo->target->x, mo->target->y, players[displayplayers[0]].awayviewmobj->x, players[displayplayers[0]].awayviewmobj->y);
else if (!camera[0].chase && players[displayplayers[0]].mo)
viewingangle = R_PointToAngle2(mo->target->x, mo->target->y, players[displayplayers[0]].mo->x, players[displayplayers[0]].mo->y);
else
viewingangle = R_PointToAngle2(mo->target->x, mo->target->y, camera.x, camera.y);
viewingangle = R_PointToAngle2(mo->target->x, mo->target->y, camera[0].x, camera[0].y);
if (!(mo->state->frame & FF_ANIMATE) && mo->state->var1)
viewingangle += ANGLE_180;
@ -6680,7 +6660,7 @@ void P_MobjThinker(mobj_t *mobj)
if (mobj->target && mobj->target->health
&& mobj->target->player && !mobj->target->player->spectator
&& mobj->target->player->health && mobj->target->player->playerstate != PST_DEAD
/*&& players[displayplayer].mo && !players[displayplayer].spectator*/)
/*&& players[displayplayers[0]].mo && !players[displayplayers[0]].spectator*/)
{
fixed_t scale = 3*mobj->target->scale;
mobj->color = mobj->target->color;
@ -6688,7 +6668,7 @@ void P_MobjThinker(mobj_t *mobj)
if ((G_RaceGametype() || mobj->target->player->kartstuff[k_bumper] <= 0)
#if 1 // Set to 0 to test without needing to host
|| ((mobj->target->player == &players[displayplayer]) || P_IsLocalPlayer(mobj->target->player))
|| ((mobj->target->player == &players[displayplayers[0]]) || P_IsLocalPlayer(mobj->target->player))
#endif
)
mobj->flags2 |= MF2_DONTDRAW;
@ -6699,10 +6679,10 @@ 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[displayplayer].mo)
if (!splitscreen && players[displayplayers[0]].mo)
{
scale = mobj->target->scale + FixedMul(FixedDiv(abs(P_AproxDistance(players[displayplayer].mo->x-mobj->target->x,
players[displayplayer].mo->y-mobj->target->y)), RING_DIST), mobj->target->scale);
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);
if (scale > 16*mobj->target->scale)
scale = 16*mobj->target->scale;
}
@ -6887,7 +6867,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[displayplayer].mo && !players[displayplayer].spectator)
&& players[displayplayers[0]].mo && !players[displayplayers[0]].spectator)
{
fixed_t scale = 3*mobj->target->scale;
@ -6909,8 +6889,8 @@ void P_MobjThinker(mobj_t *mobj)
if (!splitscreen)
{
scale = mobj->target->scale + FixedMul(FixedDiv(abs(P_AproxDistance(players[displayplayer].mo->x-mobj->target->x,
players[displayplayer].mo->y-mobj->target->y)), RING_DIST), mobj->target->scale);
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);
if (scale > 16*mobj->target->scale)
scale = 16*mobj->target->scale;
}
@ -8296,12 +8276,12 @@ void P_MobjThinker(mobj_t *mobj)
angle_t viewingangle;
statenum_t curstate = ((mobj->tics == 1) ? (mobj->state->nextstate) : ((statenum_t)(mobj->state-states)));
if (players[displayplayer].awayviewtics)
viewingangle = R_PointToAngle2(mobj->target->x, mobj->target->y, players[displayplayer].awayviewmobj->x, players[displayplayer].awayviewmobj->y);
else if (!camera.chase && players[displayplayer].mo)
viewingangle = R_PointToAngle2(mobj->target->x, mobj->target->y, players[displayplayer].mo->x, players[displayplayer].mo->y);
if (players[displayplayers[0]].awayviewtics)
viewingangle = R_PointToAngle2(mobj->target->x, mobj->target->y, players[displayplayers[0]].awayviewmobj->x, players[displayplayers[0]].awayviewmobj->y);
else if (!camera[0].chase && players[displayplayers[0]].mo)
viewingangle = R_PointToAngle2(mobj->target->x, mobj->target->y, players[displayplayers[0]].mo->x, players[displayplayers[0]].mo->y);
else
viewingangle = R_PointToAngle2(mobj->target->x, mobj->target->y, camera.x, camera.y);
viewingangle = R_PointToAngle2(mobj->target->x, mobj->target->y, camera[0].x, camera[0].y);
if (curstate > S_THUNDERSHIELD15)
viewingangle += ANGLE_180;
@ -10562,13 +10542,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[displayplayer] || !players[displayplayer].mo)
if (!playeringame[displayplayers[0]] || !players[displayplayers[0]].mo)
return;
if (sound_disabled)
return; // Sound off? D'aw, no fun.
if (players[displayplayer].mo->subsector->sector->ceilingpic == skyflatnum)
if (players[displayplayers[0]].mo->subsector->sector->ceilingpic == skyflatnum)
volume = 255; // Sky above? We get it full blast.
else
{
@ -10576,17 +10556,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[displayplayer].mo->y - 1024*FRACUNIT;
yh = players[displayplayer].mo->y + 1024*FRACUNIT;
xl = players[displayplayer].mo->x - 1024*FRACUNIT;
xh = players[displayplayer].mo->x + 1024*FRACUNIT;
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;
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[displayplayer].mo->x, players[displayplayer].mo->y, 0, x, y, 0);
newdist = S_CalculateSoundDistance(players[displayplayers[0]].mo->x, players[displayplayers[0]].mo->y, 0, x, y, 0);
if (newdist < closedist)
closedist = newdist;
}
@ -10601,7 +10581,7 @@ void P_PrecipitationEffects(void)
volume = 255;
if (sounds_rain && (!leveltime || leveltime % 80 == 1))
S_StartSoundAtVolume(players[displayplayer].mo, sfx_rainin, volume);
S_StartSoundAtVolume(players[displayplayers[0]].mo, sfx_rainin, volume);
if (!sounds_thunder)
return;
@ -10609,7 +10589,7 @@ void P_PrecipitationEffects(void)
if (effects_lightning && lightningStrike && volume)
{
// Large, close thunder sounds to go with our lightning.
S_StartSoundAtVolume(players[displayplayer].mo, sfx_litng1 + M_RandomKey(4), volume);
S_StartSoundAtVolume(players[displayplayers[0]].mo, sfx_litng1 + M_RandomKey(4), volume);
}
else if (thunderchance < 20)
{
@ -10617,7 +10597,7 @@ void P_PrecipitationEffects(void)
if (volume < 80)
volume = 80;
S_StartSoundAtVolume(players[displayplayer].mo, sfx_athun1 + M_RandomKey(2), volume);
S_StartSoundAtVolume(players[displayplayers[0]].mo, sfx_athun1 + M_RandomKey(2), volume);
}
}
@ -10924,15 +10904,21 @@ void P_AfterPlayerSpawn(INT32 playernum)
{
player_t *p = &players[playernum];
mobj_t *mobj = p->mo;
UINT8 i;
if (playernum == consoleplayer)
localangle = mobj->angle;
else if (playernum == secondarydisplayplayer)
localangle2 = mobj->angle;
else if (playernum == thirddisplayplayer)
localangle3 = mobj->angle;
else if (playernum == fourthdisplayplayer)
localangle4 = mobj->angle;
localangle[0] = mobj->angle;
else if (splitscreen)
{
for (i = 1; i <= splitscreen; i++)
{
if (playernum == displayplayers[i])
{
localangle[i] = mobj->angle;
break;
}
}
}
p->viewheight = 32<<FRACBITS;
@ -10954,25 +10940,13 @@ void P_AfterPlayerSpawn(INT32 playernum)
SV_SpawnPlayer(playernum, mobj->x, mobj->y, mobj->angle);
if (camera.chase)
for (i = 0; i <= splitscreen; i++)
{
if (displayplayer == playernum)
P_ResetCamera(p, &camera);
if (camera[i].chase)
{
if (displayplayers[i] == playernum)
P_ResetCamera(p, &camera[i]);
}
if (camera2.chase && splitscreen)
{
if (secondarydisplayplayer == playernum)
P_ResetCamera(p, &camera2);
}
if (camera3.chase && splitscreen > 1)
{
if (thirddisplayplayer == playernum)
P_ResetCamera(p, &camera3);
}
if (camera4.chase && splitscreen > 2)
{
if (fourthdisplayplayer == playernum)
P_ResetCamera(p, &camera4);
}
if (CheckForReverseGravity)

View file

@ -1336,13 +1336,13 @@ static void Polyobj_rotateThings(polyobj_t *po, vertex_t origin, angle_t delta,
if (turnthings == 2 || (turnthings == 1 && !mo->player)) {
mo->angle += delta;
if (mo->player == &players[consoleplayer])
localangle = mo->angle;
else if (mo->player == &players[secondarydisplayplayer])
localangle2 = mo->angle;
else if (mo->player == &players[thirddisplayplayer])
localangle3 = mo->angle;
else if (mo->player == &players[fourthdisplayplayer])
localangle4 = mo->angle;
localangle[0] = mo->angle;
else if (mo->player == &players[displayplayers[1]])
localangle[1] = mo->angle;
else if (mo->player == &players[displayplayers[2]])
localangle[2] = mo->angle;
else if (mo->player == &players[displayplayers[3]])
localangle[3] = mo->angle;
}
}
}

View file

@ -2106,13 +2106,13 @@ static void LoadMobjThinker(actionf_p1 thinker)
mobj->player->mo = mobj;
// added for angle prediction
if (consoleplayer == i)
localangle = mobj->angle;
if (secondarydisplayplayer == i)
localangle2 = mobj->angle;
if (thirddisplayplayer == i)
localangle3 = mobj->angle;
if (fourthdisplayplayer == i)
localangle4 = mobj->angle;
localangle[0] = mobj->angle;
if (displayplayers[1] == i)
localangle[1] = mobj->angle;
if (displayplayers[2] == i)
localangle[2] = mobj->angle;
if (displayplayers[3] == i)
localangle[3] = mobj->angle;
}
if (diff & MD_MOVEDIR)
mobj->movedir = READANGLE(save_p);

View file

@ -2269,7 +2269,7 @@ static void P_LevelInitStuff(void)
leveltime = 0;
localaiming = localaiming2 = localaiming3 = localaiming4 = 0;
memset(localaiming, 0, sizeof(localaiming));
// map object scale
mapobjectscale = mapheaderinfo[gamemap-1]->mobj_scale;
@ -2536,29 +2536,29 @@ static void P_ForceCharacter(const char *forcecharskin)
{
if (splitscreen)
{
SetPlayerSkin(secondarydisplayplayer, forcecharskin);
if ((unsigned)cv_playercolor2.value != skins[players[secondarydisplayplayer].skin].prefcolor && !modeattacking)
SetPlayerSkin(displayplayers[1], forcecharskin);
if ((unsigned)cv_playercolor2.value != skins[players[displayplayers[1]].skin].prefcolor && !modeattacking)
{
CV_StealthSetValue(&cv_playercolor2, skins[players[secondarydisplayplayer].skin].prefcolor);
players[secondarydisplayplayer].skincolor = skins[players[secondarydisplayplayer].skin].prefcolor;
CV_StealthSetValue(&cv_playercolor2, skins[players[displayplayers[1]].skin].prefcolor);
players[displayplayers[1]].skincolor = skins[players[displayplayers[1]].skin].prefcolor;
}
if (splitscreen > 1)
{
SetPlayerSkin(thirddisplayplayer, forcecharskin);
if ((unsigned)cv_playercolor3.value != skins[players[thirddisplayplayer].skin].prefcolor && !modeattacking)
SetPlayerSkin(displayplayers[2], forcecharskin);
if ((unsigned)cv_playercolor3.value != skins[players[displayplayers[2]].skin].prefcolor && !modeattacking)
{
CV_StealthSetValue(&cv_playercolor3, skins[players[thirddisplayplayer].skin].prefcolor);
players[thirddisplayplayer].skincolor = skins[players[thirddisplayplayer].skin].prefcolor;
CV_StealthSetValue(&cv_playercolor3, skins[players[displayplayers[2]].skin].prefcolor);
players[displayplayers[2]].skincolor = skins[players[displayplayers[2]].skin].prefcolor;
}
if (splitscreen > 2)
{
SetPlayerSkin(fourthdisplayplayer, forcecharskin);
if ((unsigned)cv_playercolor4.value != skins[players[fourthdisplayplayer].skin].prefcolor && !modeattacking)
SetPlayerSkin(displayplayers[3], forcecharskin);
if ((unsigned)cv_playercolor4.value != skins[players[displayplayers[3]].skin].prefcolor && !modeattacking)
{
CV_StealthSetValue(&cv_playercolor4, skins[players[fourthdisplayplayer].skin].prefcolor);
players[fourthdisplayplayer].skincolor = skins[players[fourthdisplayplayer].skin].prefcolor;
CV_StealthSetValue(&cv_playercolor4, skins[players[displayplayers[3]].skin].prefcolor);
players[displayplayers[3]].skincolor = skins[players[displayplayers[3]].skin].prefcolor;
}
}
}
@ -2793,7 +2793,8 @@ boolean P_SetupLevel(boolean skipprecip)
P_LevelInitStuff();
postimgtype = postimgtype2 = postimgtype3 = postimgtype4 = postimg_none;
for (i = 0; i <= splitscreen; i++)
postimgtype[i] = postimg_none;
if (mapheaderinfo[gamemap-1]->forcecharacter[0] != '\0'
&& atoi(mapheaderinfo[gamemap-1]->forcecharacter) != 255)
@ -3180,19 +3181,8 @@ boolean P_SetupLevel(boolean skipprecip)
if (!dedicated)
{
P_SetupCamera(displayplayer, &camera);
if (splitscreen)
{
P_SetupCamera(secondarydisplayplayer, &camera2);
if (splitscreen > 1)
{
P_SetupCamera(thirddisplayplayer, &camera3);
if (splitscreen > 2)
{
P_SetupCamera(fourthdisplayplayer, &camera4);
}
}
}
for (i = 0; i <= splitscreen; i++)
P_SetupCamera(displayplayers[i], &camera[i]);
// Salt: CV_ClearChangedFlags() messes with your settings :(
/*if (!cv_cam_height.changed)
@ -3233,7 +3223,7 @@ boolean P_SetupLevel(boolean skipprecip)
/*if (rendermode != render_none)
CV_Set(&cv_fov, cv_fov.defaultvalue);*/
displayplayer = consoleplayer; // Start with your OWN view, please!
displayplayers[0] = consoleplayer; // Start with your OWN view, please!
}
/*if (cv_useranalog.value)
@ -3312,7 +3302,10 @@ boolean P_SetupLevel(boolean skipprecip)
savedata.lives = 0;
}
skyVisible = skyVisible1 = skyVisible2 = skyVisible3 = skyVisible4 = true; // assume the skybox is visible on level load.
// assume the skybox is visible on level load.
skyVisible = true;
memset(skyVisiblePerPlayer, true, sizeof(skyVisiblePerPlayer));
if (loadprecip) // uglier hack
{ // to make a newly loaded level start on the second frame.
INT32 buf = gametic % BACKUPTICS;

View file

@ -2243,7 +2243,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
I_Assert(!mo || !P_MobjWasRemoved(mo)); // If mo is there, mo must be valid!
if (mo && mo->player && botingame)
bot = players[secondarydisplayplayer].mo;
bot = players[displayplayers[1]].mo;
// note: only commands with linedef types >= 400 && < 500 can be used
switch (line->special)
@ -2383,33 +2383,17 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
{
if (bot) // This might put poor Tails in a wall if he's too far behind! D: But okay, whatever! >:3
P_TeleportMove(bot, bot->x + x, bot->y + y, bot->z + z);
if (splitscreen > 2 && mo->player == &players[fourthdisplayplayer] && camera4.chase)
for (i = 0; i <= splitscreen; i++)
{
camera4.x += x;
camera4.y += y;
camera4.z += z;
camera4.subsector = R_PointInSubsector(camera4.x, camera4.y);
if (mo->player == &players[displayplayers[i]] && camera[i].chase)
{
camera[i].x += x;
camera[i].y += y;
camera[i].z += z;
camera[i].subsector = R_PointInSubsector(camera[i].x, camera[i].y);
break;
}
else if (splitscreen > 1 && mo->player == &players[thirddisplayplayer] && camera3.chase)
{
camera3.x += x;
camera3.y += y;
camera3.z += z;
camera3.subsector = R_PointInSubsector(camera3.x, camera3.y);
}
else if (splitscreen && mo->player == &players[secondarydisplayplayer] && camera2.chase)
{
camera2.x += x;
camera2.y += y;
camera2.z += z;
camera2.subsector = R_PointInSubsector(camera2.x, camera2.y);
}
else if (camera.chase && mo->player == &players[displayplayer])
{
camera.x += x;
camera.y += y;
camera.z += z;
camera.subsector = R_PointInSubsector(camera.x, camera.y);
}
}
}
@ -2515,8 +2499,7 @@ 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]
|| mo->player == &players[thirddisplayplayer] || mo->player == &players[fourthdisplayplayer]))
if (mo && mo->player && P_IsDisplayPlayer(mo->player))
S_StartSound(NULL, sfxnum);
}
else if (line->flags & ML_EFFECT4)
@ -3837,13 +3820,13 @@ DoneSection2:
if (!demo.playback || P_AnalogMove(player))
{
if (player == &players[consoleplayer])
localangle = player->mo->angle;
else if (player == &players[secondarydisplayplayer])
localangle2 = player->mo->angle;
else if (player == &players[thirddisplayplayer])
localangle3 = player->mo->angle;
else if (player == &players[fourthdisplayplayer])
localangle4 = player->mo->angle;
localangle[0] = player->mo->angle;
else if (player == &players[displayplayers[1]])
localangle[1] = player->mo->angle;
else if (player == &players[displayplayers[2]])
localangle[2] = player->mo->angle;
else if (player == &players[displayplayers[3]])
localangle[3] = player->mo->angle;
}
if (!(lines[i].flags & ML_EFFECT4))
@ -7845,40 +7828,40 @@ void T_Pusher(pusher_t *p)
{
if (thing->player == &players[consoleplayer])
{
if (thing->angle - localangle > ANGLE_180)
localangle -= (localangle - thing->angle) / 8;
if (thing->angle - localangle[0] > ANGLE_180)
localangle[0] -= (localangle[0] - thing->angle) / 8;
else
localangle += (thing->angle - localangle) / 8;
localangle[0] += (thing->angle - localangle[0]) / 8;
}
else if (thing->player == &players[secondarydisplayplayer])
else if (thing->player == &players[displayplayers[1]])
{
if (thing->angle - localangle2 > ANGLE_180)
localangle2 -= (localangle2 - thing->angle) / 8;
if (thing->angle - localangle[1] > ANGLE_180)
localangle[1] -= (localangle[1] - thing->angle) / 8;
else
localangle2 += (thing->angle - localangle2) / 8;
localangle[1] += (thing->angle - localangle[1]) / 8;
}
else if (thing->player == &players[thirddisplayplayer])
else if (thing->player == &players[displayplayers[2]])
{
if (thing->angle - localangle3 > ANGLE_180)
localangle3 -= (localangle3 - thing->angle) / 8;
if (thing->angle - localangle[2] > ANGLE_180)
localangle[2] -= (localangle[2] - thing->angle) / 8;
else
localangle3 += (thing->angle - localangle3) / 8;
localangle[2] += (thing->angle - localangle[2]) / 8;
}
else if (thing->player == &players[fourthdisplayplayer])
else if (thing->player == &players[displayplayers[3]])
{
if (thing->angle - localangle4 > ANGLE_180)
localangle4 -= (localangle4 - thing->angle) / 8;
if (thing->angle - localangle[3] > ANGLE_180)
localangle[3] -= (localangle[3] - thing->angle) / 8;
else
localangle4 += (thing->angle - localangle4) / 8;
localangle[3] += (thing->angle - localangle[3]) / 8;
}
/*if (thing->player == &players[consoleplayer])
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;*/
localangle[0] = thing->angle;
else if (thing->player == &players[displayplayers[1]])
localangle[1] = thing->angle;
else if (thing->player == &players[displayplayers[2]])
localangle[2] = thing->angle;
else if (thing->player == &players[displayplayers[3]])
localangle[3] = thing->angle;*/
}
}

View file

@ -36,6 +36,7 @@ void P_MixUp(mobj_t *thing, fixed_t x, fixed_t y, fixed_t z, angle_t angle,
INT32 flags2)
{
const INT32 takeflags2 = MF2_TWOD|MF2_OBJECTFLIP;
UINT8 i;
// the move is ok,
// so link the thing into its new position
@ -64,23 +65,25 @@ 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 = angle;
if (thing == players[secondarydisplayplayer].mo)
localangle2 = angle;
if (thing == players[thirddisplayplayer].mo)
localangle3 = angle;
if (thing == players[fourthdisplayplayer].mo)
localangle4 = angle;
localangle[0] = angle;
else if (splitscreen)
{
for (i = 1; i <= splitscreen; i++)
{
if (thing == players[displayplayers[i]].mo)
{
localangle[i] = angle;
break;
}
}
}
// move chasecam at new player location
if (splitscreen > 2 && camera4.chase && thing->player == &players[fourthdisplayplayer])
P_ResetCamera(thing->player, &camera4);
else if (splitscreen > 1 && camera3.chase && thing->player == &players[thirddisplayplayer])
P_ResetCamera(thing->player, &camera3);
else if (splitscreen && camera2.chase && thing->player == &players[secondarydisplayplayer])
P_ResetCamera(thing->player, &camera2);
else if (camera.chase && thing->player == &players[displayplayer])
P_ResetCamera(thing->player, &camera);
for (i = 0; i <= splitscreen; i++)
{
if (thing->player == &players[displayplayers[i]] && camera[i].chase)
P_ResetCamera(thing->player, &camera[i]);
}
// don't run in place after a teleport
thing->player->cmomx = thing->player->cmomy = 0;
@ -123,6 +126,8 @@ void P_MixUp(mobj_t *thing, fixed_t x, fixed_t y, fixed_t z, angle_t angle,
*/
boolean P_Teleport(mobj_t *thing, fixed_t x, fixed_t y, fixed_t z, angle_t angle, boolean flash, boolean dontstopmove)
{
UINT8 i;
if (!P_TeleportMove(thing, x, y, z))
return false;
@ -144,24 +149,26 @@ boolean P_Teleport(mobj_t *thing, fixed_t x, fixed_t y, fixed_t z, angle_t angle
thing->reactiontime = TICRATE/2; // don't move for about half a second
// absolute angle position
if (thing->player == &players[consoleplayer])
localangle = angle;
if (thing->player == &players[secondarydisplayplayer])
localangle2 = angle;
if (thing->player == &players[thirddisplayplayer])
localangle3 = angle;
if (thing->player == &players[fourthdisplayplayer])
localangle4 = angle;
if (thing == players[consoleplayer].mo)
localangle[0] = angle;
else if (splitscreen)
{
for (i = 1; i <= splitscreen; i++)
{
if (thing == players[displayplayers[i]].mo)
{
localangle[i] = angle;
break;
}
}
}
// move chasecam at new player location
if (splitscreen > 2 && camera4.chase && thing->player == &players[fourthdisplayplayer])
P_ResetCamera(thing->player, &camera4);
else if (splitscreen > 1 && camera3.chase && thing->player == &players[thirddisplayplayer])
P_ResetCamera(thing->player, &camera3);
else if (splitscreen && camera2.chase && thing->player == &players[secondarydisplayplayer])
P_ResetCamera(thing->player, &camera2);
else if (camera.chase && thing->player == &players[displayplayer])
P_ResetCamera(thing->player, &camera);
for (i = 0; i <= splitscreen; i++)
{
if (thing->player == &players[displayplayers[i]] && camera[i].chase)
P_ResetCamera(thing->player, &camera[i]);
}
// don't run in place after a teleport
if (!dontstopmove)

View file

@ -583,7 +583,7 @@ void P_Ticker(boolean run)
{
P_MapStart();
OP_ObjectplaceMovement(&players[0]);
P_MoveChaseCamera(&players[0], &camera, false);
P_MoveChaseCamera(&players[0], &camera[0], false);
P_MapEnd();
return;
}
@ -601,7 +601,8 @@ void P_Ticker(boolean run)
return;
}
postimgtype = postimgtype2 = postimgtype3 = postimgtype4 = postimg_none;
for (i = 0; i <= splitscreen; i++)
postimgtype[i] = postimg_none;
P_MapStart();
@ -776,14 +777,11 @@ void P_Ticker(boolean run)
}
// Always move the camera.
if (camera.chase)
P_MoveChaseCamera(&players[displayplayer], &camera, false);
if (splitscreen && camera2.chase)
P_MoveChaseCamera(&players[secondarydisplayplayer], &camera2, false);
if (splitscreen > 1 && camera3.chase)
P_MoveChaseCamera(&players[thirddisplayplayer], &camera3, false);
if (splitscreen > 2 && camera4.chase)
P_MoveChaseCamera(&players[fourthdisplayplayer], &camera4, false);
for (i = 0; i <= splitscreen; i++)
{
if (camera[i].chase)
P_MoveChaseCamera(&players[displayplayers[i]], &camera[i], false);
}
P_MapEnd();
@ -799,7 +797,8 @@ void P_PreTicker(INT32 frames)
INT32 i,framecnt;
ticcmd_t temptic;
postimgtype = postimgtype2 = postimgtype3 = postimgtype4 = postimg_none;
for (i = 0; i <= splitscreen; i++)
postimgtype[i] = postimg_none;
for (framecnt = 0; framecnt < frames; ++framecnt)
{

View file

@ -654,13 +654,13 @@ static void P_DeNightserizePlayer(player_t *player)
// Restore aiming angle
if (player == &players[consoleplayer])
localaiming = 0;
else if (player == &players[secondarydisplayplayer])
localaiming2 = 0;
else if (player == &players[thirddisplayplayer])
localaiming3 = 0;
else if (player == &players[fourthdisplayplayer])
localaiming4 = 0;
localaiming[0] = 0;
else if (player == &players[displayplayers[1]])
localaiming[1] = 0;
else if (player == &players[displayplayers[2]])
localaiming[2] = 0;
else if (player == &players[displayplayers[3]])
localaiming[3] = 0;
if (player->mo->tracer)
P_RemoveMobj(player->mo->tracer);
@ -1154,25 +1154,25 @@ boolean P_EndingMusic(player_t *player)
// Check for if this is valid or not
if (splitscreen)
{
if (!((players[displayplayer].exiting || (players[displayplayer].pflags & PF_TIMEOVER))
|| (players[secondarydisplayplayer].exiting || (players[secondarydisplayplayer].pflags & PF_TIMEOVER))
|| ((splitscreen < 2) && (players[thirddisplayplayer].exiting || (players[thirddisplayplayer].pflags & PF_TIMEOVER)))
|| ((splitscreen < 3) && (players[fourthdisplayplayer].exiting || (players[fourthdisplayplayer].pflags & PF_TIMEOVER)))))
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)))))
return false;
bestlocalplayer = &players[displayplayer];
bestlocalpos = ((players[displayplayer].pflags & PF_TIMEOVER) ? MAXPLAYERS+1 : players[displayplayer].kartstuff[k_position]);
bestlocalplayer = &players[displayplayers[0]];
bestlocalpos = ((players[displayplayers[0]].pflags & PF_TIMEOVER) ? MAXPLAYERS+1 : players[displayplayers[0]].kartstuff[k_position]);
#define setbests(p) \
if (((players[p].pflags & PF_TIMEOVER) ? MAXPLAYERS+1 : players[p].kartstuff[k_position]) < bestlocalpos) \
{ \
bestlocalplayer = &players[p]; \
bestlocalpos = ((players[p].pflags & PF_TIMEOVER) ? MAXPLAYERS+1 : players[p].kartstuff[k_position]); \
}
setbests(secondarydisplayplayer);
setbests(displayplayers[1]);
if (splitscreen > 1)
setbests(thirddisplayplayer);
setbests(displayplayers[2]);
if (splitscreen > 2)
setbests(fourthdisplayplayer);
setbests(displayplayers[3]);
#undef setbests
}
else
@ -1253,12 +1253,12 @@ void P_RestoreMusic(player_t *player)
else if (players[p].kartstuff[k_invincibilitytimer] > bestlocaltimer) \
{ wantedmus = 1; bestlocaltimer = players[p].kartstuff[k_invincibilitytimer]; } \
}
setbests(displayplayer);
setbests(secondarydisplayplayer);
setbests(displayplayers[0]);
setbests(displayplayers[1]);
if (splitscreen > 1)
setbests(thirddisplayplayer);
setbests(displayplayers[2]);
if (splitscreen > 2)
setbests(fourthdisplayplayer);
setbests(displayplayers[3]);
#undef setbests
}
else
@ -1516,10 +1516,39 @@ fixed_t P_GetPlayerSpinHeight(player_t *player)
//
boolean P_IsLocalPlayer(player_t *player)
{
return ((splitscreen > 2 && player == &players[fourthdisplayplayer])
|| (splitscreen > 1 && player == &players[thirddisplayplayer])
|| (splitscreen && player == &players[secondarydisplayplayer])
|| player == &players[consoleplayer]);
UINT8 i;
if (player == &players[consoleplayer])
return true;
else if (splitscreen)
{
for (i = 1; i <= splitscreen; i++) // Skip P1
{
if (player == &players[displayplayers[i]])
return true;
}
}
return false;
}
//
// P_IsDisplayPlayer
//
// Returns true if player is
// currently being watched.
//
boolean P_IsDisplayPlayer(player_t *player)
{
UINT8 i;
for (i = 0; i <= splitscreen; i++) // DON'T skip P1
{
if (player == &players[displayplayers[i]])
return true;
}
return false;
}
//
@ -1772,11 +1801,7 @@ void P_DoPlayerExit(player_t *player)
if (player->exiting || mapreset)
return;
if ((player == &players[consoleplayer]
|| (splitscreen && player == &players[secondarydisplayplayer])
|| (splitscreen > 1 && player == &players[thirddisplayplayer])
|| (splitscreen > 2 && player == &players[fourthdisplayplayer]))
&& (!player->spectator && !demo.playback))
if (P_IsLocalPlayer(player) && (!player->spectator && !demo.playback))
legitimateexit = true;
if (G_RaceGametype()) // If in Race Mode, allow
@ -2515,8 +2540,7 @@ 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[displayplayer] || player == &players[secondarydisplayplayer]
|| player == &players[thirddisplayplayer] || player == &players[fourthdisplayplayer])) // Don't display it on your own view.
if (!P_IsDisplayPlayer(player)) // 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);
@ -3004,13 +3028,13 @@ static void P_DoClimbing(player_t *player) // SRB2kart - unused
}
if (player == &players[consoleplayer])
localangle = player->mo->angle;
else if (player == &players[secondarydisplayplayer])
localangle2 = player->mo->angle;
else if (player == &players[thirddisplayplayer])
localangle3 = player->mo->angle;
else if (player == &players[fourthdisplayplayer])
localangle4 = player->mo->angle;
localangle[0] = player->mo->angle;
else if (player == &players[displayplayers[1]])
localangle[1] = player->mo->angle;
else if (player == &players[displayplayers[2]])
localangle[2] = player->mo->angle;
else if (player == &players[displayplayers[3]])
localangle[3] = player->mo->angle;
if (player->climbing == 0)
P_SetPlayerMobjState(player->mo, S_PLAY_ATK1);
@ -3675,13 +3699,13 @@ void P_DoJump(player_t *player, boolean soundandstate)
player->mo->angle = player->mo->angle - ANGLE_180; // Turn around from the wall you were climbing.
if (player == &players[consoleplayer])
localangle = player->mo->angle; // Adjust the local control angle.
else if (player == &players[secondarydisplayplayer])
localangle2 = player->mo->angle;
else if (player == &players[thirddisplayplayer])
localangle3 = player->mo->angle;
else if (player == &players[fourthdisplayplayer])
localangle4 = player->mo->angle;
localangle[0] = player->mo->angle; // Adjust the local control angle.
else if (player == &players[displayplayers[1]])
localangle[1] = player->mo->angle;
else if (player == &players[displayplayers[2]])
localangle[2] = player->mo->angle;
else if (player == &players[displayplayers[3]])
localangle[3] = player->mo->angle;
player->climbing = 0; // Stop climbing, duh!
P_InstaThrust(player->mo, player->mo->angle, FixedMul(6*FRACUNIT, player->mo->scale)); // Jump off the wall.
@ -4365,14 +4389,14 @@ boolean P_AnalogMove(player_t *player)
fixed_t tempx = 0, tempy = 0;
angle_t tempangle, origtempangle;
if (splitscreen > 2 && player == &players[fourthdisplayplayer])
thiscam = &camera4;
else if (splitscreen > 1 && player == &players[thirddisplayplayer])
thiscam = &camera3;
else if (splitscreen && player == &players[secondarydisplayplayer])
thiscam = &camera2;
if (splitscreen > 2 && player == &players[displayplayers[3]])
thiscam = &camera[3];
else if (splitscreen > 1 && player == &players[displayplayers[2]])
thiscam = &camera[2];
else if (splitscreen && player == &players[displayplayers[1]])
thiscam = &camera[1];
else
thiscam = &camera;
thiscam = &camera[0];
if (!cmd->forwardmove && !cmd->sidemove)
return 0;
@ -4513,13 +4537,13 @@ static void P_2dMovement(player_t *player)
}
if (player == &players[consoleplayer])
localangle = player->mo->angle;
else if (player == &players[secondarydisplayplayer])
localangle2 = player->mo->angle;
else if (player == &players[thirddisplayplayer])
localangle3 = player->mo->angle;
else if (player == &players[fourthdisplayplayer])
localangle4 = player->mo->angle;
localangle[0] = player->mo->angle;
else if (player == &players[displayplayers[1]])
localangle[1] = player->mo->angle;
else if (player == &players[displayplayers[2]])
localangle[2] = player->mo->angle;
else if (player == &players[displayplayers[3]])
localangle[3] = player->mo->angle;
if (player->pflags & PF_GLIDING)
movepushangle = player->mo->angle;
@ -6049,13 +6073,13 @@ static void P_NiGHTSMovement(player_t *player)
P_SetMobjStateNF(player->mo->tracer, leveltime & 1 ? flystate : flystate+1);
if (player == &players[consoleplayer])
localangle = player->mo->angle;
else if (player == &players[secondarydisplayplayer])
localangle2 = player->mo->angle;
else if (player == &players[thirddisplayplayer])
localangle3 = player->mo->angle;
else if (player == &players[fourthdisplayplayer])
localangle4 = player->mo->angle;
localangle[0] = player->mo->angle;
else if (player == &players[displayplayers[1]])
localangle[1] = player->mo->angle;
else if (player == &players[displayplayers[2]])
localangle[2] = player->mo->angle;
else if (player == &players[displayplayers[3]])
localangle[3] = player->mo->angle;
if (still)
{
@ -6082,13 +6106,13 @@ static void P_NiGHTSMovement(player_t *player)
movingangle = InvAngle(movingangle);
if (player == &players[consoleplayer])
localaiming = movingangle;
else if (player == &players[secondarydisplayplayer])
localaiming2 = movingangle;
else if (player == &players[thirddisplayplayer])
localaiming3 = movingangle;
else if (player == &players[fourthdisplayplayer])
localaiming4 = movingangle;
localaiming[0] = movingangle;
else if (player == &players[displayplayers[1]])
localaiming[1] = movingangle;
else if (player == &players[displayplayers[2]])
localaiming[2] = movingangle;
else if (player == &players[displayplayers[3]])
localaiming[3] = movingangle;
player->mo->tracer->angle = player->mo->angle;
@ -6352,7 +6376,7 @@ static void P_MovePlayer(player_t *player)
{
if (G_IsSpecialStage(gamemap))
{
if (player == &players[displayplayer]) // only play the sound for yourself landing
if (player == &players[displayplayers[0]]) // only play the sound for yourself landing
S_StartSound(NULL, sfx_s3k6a);
for (i = 0; i < MAXPLAYERS; i++)
if (playeringame[i])
@ -6865,13 +6889,13 @@ static void P_MovePlayer(player_t *player)
// Update the local angle control.
if (player == &players[consoleplayer])
localangle = player->mo->angle;
else if (player == &players[secondarydisplayplayer])
localangle2 = player->mo->angle;
else if (player == &players[thirddisplayplayer])
localangle3 = player->mo->angle;
else if (player == &players[fourthdisplayplayer])
localangle4 = player->mo->angle;
localangle[0] = player->mo->angle;
else if (player == &players[displayplayers[1]])
localangle[1] = player->mo->angle;
else if (player == &players[displayplayers[2]])
localangle[2] = player->mo->angle;
else if (player == &players[displayplayers[3]])
localangle[3] = player->mo->angle;
}
#endif
@ -7193,13 +7217,13 @@ static void P_DoZoomTube(player_t *player)
player->mo->angle = R_PointToAngle2(player->mo->x, player->mo->y, player->mo->tracer->x, player->mo->tracer->y);
if (player == &players[consoleplayer])
localangle = player->mo->angle;
else if (player == &players[secondarydisplayplayer])
localangle2 = player->mo->angle;
else if (player == &players[thirddisplayplayer])
localangle3 = player->mo->angle;
else if (player == &players[fourthdisplayplayer])
localangle4 = player->mo->angle;
localangle[0] = player->mo->angle;
else if (player == &players[displayplayers[1]])
localangle[1] = player->mo->angle;
else if (player == &players[displayplayers[2]])
localangle[2] = player->mo->angle;
else if (player == &players[displayplayers[3]])
localangle[3] = player->mo->angle;
}
#if 0
if (player->mo->state != &states[S_KART_SPIN])
@ -7589,13 +7613,13 @@ void P_HomingAttack(mobj_t *source, mobj_t *enemy) // Home in on your target
if (source->player)
{
if (source->player == &players[consoleplayer])
localangle = source->angle;
else if (source->player == &players[secondarydisplayplayer])
localangle2 = source->angle;
else if (source->player == &players[thirddisplayplayer])
localangle3 = source->angle;
else if (source->player == &players[fourthdisplayplayer])
localangle4 = source->angle;
localangle[0] = source->angle;
else if (source->player == &players[displayplayers[1]])
localangle[1] = source->angle;
else if (source->player == &players[displayplayers[2]])
localangle[2] = source->angle;
else if (source->player == &players[displayplayers[3]])
localangle[3] = source->angle;
}
// change slope
@ -7728,7 +7752,7 @@ notrealplayer:
// P_MoveCamera: make sure the camera is not outside the world and looks at the player avatar
//
camera_t camera, camera2, camera3, camera4; // Four cameras, three for splitscreen
camera_t camera[MAXSPLITSCREENPLAYERS]; // Four cameras, three for splitscreen
static void CV_CamRotate_OnChange(void)
{
@ -7809,17 +7833,6 @@ fixed_t t_cam4_rotate = -42;
#define MAXCAMERADIST 140*FRACUNIT // Max distance the camera can be in front of the player (2D mode)
camera_t *P_GetCameraPtr(UINT8 viewnum)
{
switch (viewnum)
{
case 2: return &camera2;
case 3: return &camera3;
case 4: return &camera4;
}
return &camera;
}
void P_ResetCamera(player_t *player, camera_t *thiscam)
{
tic_t tries = 0;
@ -7844,10 +7857,10 @@ void P_ResetCamera(player_t *player, camera_t *thiscam)
thiscam->y = y;
thiscam->z = z;
if (!(thiscam == &camera && (cv_cam_still.value || cv_analog.value))
&& !(thiscam == &camera2 && (cv_cam2_still.value || cv_analog2.value))
&& !(thiscam == &camera3 && (cv_cam3_still.value || cv_analog3.value))
&& !(thiscam == &camera4 && (cv_cam4_still.value || cv_analog4.value)))
if (!(thiscam == &camera[0] && (cv_cam_still.value || cv_analog.value))
&& !(thiscam == &camera[1] && (cv_cam2_still.value || cv_analog2.value))
&& !(thiscam == &camera[2] && (cv_cam3_still.value || cv_analog3.value))
&& !(thiscam == &camera[3] && (cv_cam4_still.value || cv_analog4.value)))
{
thiscam->angle = player->mo->angle;
thiscam->aiming = 0;
@ -7905,31 +7918,32 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
if (player->spectator) // force cam off for spectators
return true;
if (!cv_chasecam.value && thiscam == &camera)
if (!cv_chasecam.value && thiscam == &camera[0])
return true;
if (!cv_chasecam2.value && thiscam == &camera2)
if (!cv_chasecam2.value && thiscam == &camera[1])
return true;
if (!cv_chasecam3.value && thiscam == &camera3)
if (!cv_chasecam3.value && thiscam == &camera[2])
return true;
if (!cv_chasecam4.value && thiscam == &camera4)
if (!cv_chasecam4.value && thiscam == &camera[3])
return true;
}
if (!thiscam->chase && !resetcalled)
{
if (player == &players[consoleplayer])
focusangle = localangle;
else if (player == &players[secondarydisplayplayer])
focusangle = localangle2;
else if (player == &players[thirddisplayplayer])
focusangle = localangle3;
else if (player == &players[fourthdisplayplayer])
focusangle = localangle4;
focusangle = localangle[0];
else if (player == &players[displayplayers[1]])
focusangle = localangle[1];
else if (player == &players[displayplayers[2]])
focusangle = localangle[2];
else if (player == &players[displayplayers[3]])
focusangle = localangle[3];
else
focusangle = mo->angle;
if (thiscam == &camera)
camrotate = cv_cam_rotate.value;
else if (thiscam == &camera2)
@ -7940,11 +7954,13 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
camrotate = cv_cam4_rotate.value;
else
camrotate = 0;
if (leveltime < introtime) // Whoooshy camera!
{
const INT32 introcam = (introtime - leveltime);
camrotate += introcam*5;
}
thiscam->angle = focusangle + FixedAngle(camrotate*FRACUNIT);
P_ResetCamera(player, thiscam);
return true;
@ -7965,23 +7981,23 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
}
else if (player == &players[consoleplayer])
{
focusangle = localangle;
focusaiming = localaiming;
focusangle = localangle[0];
focusaiming = localaiming[0];
}
else if (player == &players[secondarydisplayplayer])
else if (player == &players[displayplayers[1]])
{
focusangle = localangle2;
focusaiming = localaiming2;
focusangle = localangle[1];
focusaiming = localaiming[1];
}
else if (player == &players[thirddisplayplayer])
else if (player == &players[displayplayers[2]])
{
focusangle = localangle3;
focusaiming = localaiming3;
focusangle = localangle[2];
focusaiming = localaiming[2];
}
else if (player == &players[fourthdisplayplayer])
else if (player == &players[displayplayers[3]])
{
focusangle = localangle4;
focusaiming = localaiming4;
focusangle = localangle[3];
focusaiming = localaiming[3];
}
else
{
@ -7992,17 +8008,8 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
if (P_CameraThinker(player, thiscam, resetcalled))
return true;
if (thiscam == &camera)
{
num = 0;
camspeed = cv_cam_speed.value;
camstill = cv_cam_still.value;
camrotate = cv_cam_rotate.value;
camdist = FixedMul(cv_cam_dist.value, mapobjectscale);
camheight = FixedMul(cv_cam_height.value, mapobjectscale);
lookback = camspin;
}
else if (thiscam == &camera2) // Camera 2
if (thiscam == &camera[1]) // Camera 2
{
num = 1;
camspeed = cv_cam2_speed.value;
@ -8010,9 +8017,9 @@ 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 = camspin2;
lookback = camspin[1];
}
else if (thiscam == &camera3) // Camera 3
else if (thiscam == &camera[2]) // Camera 3
{
num = 2;
camspeed = cv_cam3_speed.value;
@ -8020,9 +8027,9 @@ 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 = camspin3;
lookback = camspin[2];
}
else // Camera 4
else if (thiscam == &camera[3]) // Camera 4
{
num = 3;
camspeed = cv_cam4_speed.value;
@ -8030,7 +8037,17 @@ 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 = camspin4;
lookback = camspin[3];
}
else // Camera 1
{
num = 0;
camspeed = cv_cam_speed.value;
camstill = cv_cam_still.value;
camrotate = cv_cam_rotate.value;
camdist = FixedMul(cv_cam_dist.value, mapobjectscale);
camheight = FixedMul(cv_cam_height.value, mapobjectscale);
lookback = camspin[0];
}
if (timeover)
@ -8091,10 +8108,10 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
}
if (!resetcalled && (leveltime > starttime && timeover != 2)
&& ((thiscam == &camera && t_cam_rotate != -42)
|| (thiscam == &camera2 && t_cam2_rotate != -42)
|| (thiscam == &camera3 && t_cam3_rotate != -42)
|| (thiscam == &camera4 && t_cam4_rotate != -42)))
&& ((thiscam == &camera[0] && t_cam_rotate != -42)
|| (thiscam == &camera[1] && t_cam2_rotate != -42)
|| (thiscam == &camera[2] && t_cam3_rotate != -42)
|| (thiscam == &camera[3] && t_cam4_rotate != -42)))
{
angle = FixedAngle(camrotate*FRACUNIT);
thiscam->angle = angle;
@ -8489,8 +8506,8 @@ boolean P_SpectatorJoinGame(player_t *player)
player->playerstate = PST_REBORN;
//Reset away view
if (P_IsLocalPlayer(player) && displayplayer != consoleplayer)
displayplayer = consoleplayer;
if (P_IsLocalPlayer(player) && displayplayers[0] != consoleplayer)
displayplayers[0] = consoleplayer;
if (changeto == 1)
CONS_Printf(M_GetText("%s switched to the %c%s%c.\n"), player_names[player-players], '\x85', M_GetText("Red team"), '\x80');
@ -8513,8 +8530,8 @@ boolean P_SpectatorJoinGame(player_t *player)
player->playerstate = PST_REBORN;
//Reset away view
if (P_IsLocalPlayer(player) && displayplayer != consoleplayer)
displayplayer = consoleplayer;
if (P_IsLocalPlayer(player) && displayplayers[0] != consoleplayer)
displayplayers[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.
@ -8528,6 +8545,7 @@ static void P_CalcPostImg(player_t *player)
postimg_t *type;
INT32 *param;
fixed_t pviewheight;
UINT8 i;
if (player->mo->eflags & MFE_VERTICALFLIP)
pviewheight = player->mo->z + player->mo->height - player->viewheight;
@ -8540,25 +8558,14 @@ static void P_CalcPostImg(player_t *player)
pviewheight = player->awayviewmobj->z + 20*FRACUNIT;
}
if (splitscreen > 2 && player == &players[fourthdisplayplayer])
for (i = 0; i <= splitscreen; i++)
{
type = &postimgtype4;
param = &postimgparam4;
if (player == &players[displayplayers[i]])
{
type = &postimgtype[i];
param = &postimgparam[i];
break;
}
else if (splitscreen > 1 && player == &players[thirddisplayplayer])
{
type = &postimgtype3;
param = &postimgparam3;
}
else if (splitscreen && player == &players[secondarydisplayplayer])
{
type = &postimgtype2;
param = &postimgparam2;
}
else
{
type = &postimgtype;
param = &postimgparam;
}
// see if we are in heat (no, not THAT kind of heat...)
@ -8666,11 +8673,7 @@ void P_DoTimeOver(player_t *player)
player->pflags |= PF_TIMEOVER;
if ((player == &players[consoleplayer]
|| (splitscreen && player == &players[secondarydisplayplayer])
|| (splitscreen > 1 && player == &players[thirddisplayplayer])
|| (splitscreen > 2 && player == &players[fourthdisplayplayer]))
&& !demo.playback)
if (P_IsLocalPlayer(player) && !demo.playback)
legitimateexit = true; // SRB2kart: losing a race is still seeing it through to the end :p
if (player->mo)
@ -8717,7 +8720,7 @@ void P_PlayerThink(player_t *player)
}
#ifdef SEENAMES
if (netgame && player == &players[displayplayer] && !(leveltime % (TICRATE/5)) && !splitscreen)
if (netgame && player == &players[displayplayers[0]] && !(leveltime % (TICRATE/5)) && !splitscreen)
{
seenplayer = NULL;
@ -9064,7 +9067,9 @@ void P_PlayerThink(player_t *player)
|| player->kartstuff[k_driftboost] || player->kartstuff[k_sneakertimer] || player->kartstuff[k_startboost]) && !player->kartstuff[k_invincibilitytimer] // SRB2kart
&& (player->speed + abs(player->mo->momz)) > FixedMul(20*FRACUNIT,player->mo->scale))
{
UINT8 i;
mobj_t *gmobj = P_SpawnGhostMobj(player->mo);
gmobj->fuse = 2;
if (leveltime & 1)
{
@ -9072,15 +9077,17 @@ void P_PlayerThink(player_t *player)
gmobj->frame |= tr_trans70<<FF_TRANSSHIFT;
}
// Hide the mobj from our sights if we're the displayplayer and chasecam is off,
// or secondarydisplayplayer and chasecam2 is off.
// 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...
if ((player == &players[displayplayer] && !camera.chase)
|| (splitscreen && player == &players[secondarydisplayplayer] && !camera2.chase)
|| (splitscreen > 1 && player == &players[thirddisplayplayer] && !camera3.chase)
|| (splitscreen > 2 && player == &players[fourthdisplayplayer] && !camera4.chase))
for (i = 0; i <= splitscreen; i++)
{
if (player == &players[displayplayers[i]] && !camera[i].chase)
{
gmobj->flags2 |= MF2_DONTDRAW;
break;
}
}
}
#endif
@ -9280,6 +9287,7 @@ void P_PlayerAfterThink(player_t *player)
ticcmd_t *cmd;
//INT32 oldweapon = player->currentweapon; // SRB2kart - unused
camera_t *thiscam = NULL; // if not one of the displayed players, just don't bother
UINT8 i;
#ifdef PARANOIA
if (!player->mo)
@ -9302,14 +9310,14 @@ void P_PlayerAfterThink(player_t *player)
P_PlayerInSpecialSector(player);
#endif
if (splitscreen > 2 && player == &players[fourthdisplayplayer])
thiscam = &camera4;
else if (splitscreen > 1 && player == &players[thirddisplayplayer])
thiscam = &camera3;
else if (splitscreen && player == &players[secondarydisplayplayer])
thiscam = &camera2;
else if (player == &players[displayplayer])
thiscam = &camera;
for (i = 0; i <= splitscreen; i++)
{
if (player == &players[displayplayers[i]])
{
thiscam = &camera[i];
break;
}
}
if (player->playerstate == PST_DEAD)
{
@ -9494,13 +9502,13 @@ void P_PlayerAfterThink(player_t *player)
player->mo->angle = player->mo->tracer->angle;
if (player == &players[consoleplayer])
localangle = player->mo->angle;
else if (player == &players[secondarydisplayplayer])
localangle2 = player->mo->angle;
else if (player == &players[thirddisplayplayer])
localangle3 = player->mo->angle;
else if (player == &players[fourthdisplayplayer])
localangle4 = player->mo->angle;
localangle[0] = player->mo->angle;
else if (player == &players[displayplayers[1]])
localangle[1] = player->mo->angle;
else if (player == &players[displayplayers[2]])
localangle[2] = player->mo->angle;
else if (player == &players[displayplayers[3]])
localangle[3] = player->mo->angle;
}
if (P_AproxDistance(player->mo->x - player->mo->tracer->x, player->mo->y - player->mo->tracer->y) > player->mo->radius)
@ -9568,13 +9576,13 @@ void P_PlayerAfterThink(player_t *player)
player->mo->angle += cmd->sidemove<<ANGLETOFINESHIFT; // 2048 --> ANGLE_MAX
if (player == &players[consoleplayer])
localangle = player->mo->angle; // Adjust the local control angle.
else if (player == &players[secondarydisplayplayer])
localangle2 = player->mo->angle;
else if (player == &players[thirddisplayplayer])
localangle3 = player->mo->angle;
else if (player == &players[fourthdisplayplayer])
localangle4 = player->mo->angle;
localangle[0] = player->mo->angle; // Adjust the local control angle.
else if (player == &players[displayplayers[1]])
localangle[1] = player->mo->angle;
else if (player == &players[displayplayers[2]])
localangle[2] = player->mo->angle;
else if (player == &players[displayplayers[3]])
localangle[3] = player->mo->angle;
}
}

View file

@ -252,20 +252,23 @@ sector_t *R_FakeFlat(sector_t *sec, sector_t *tempsec, INT32 *floorlightlevel,
mobj_t *viewmobj = viewplayer->mo;
INT32 heightsec;
boolean underwater;
UINT8 i;
if (splitscreen > 2 && viewplayer == &players[fourthdisplayplayer] && camera4.chase)
heightsec = R_PointInSubsector(camera4.x, camera4.y)->sector->heightsec;
else if (splitscreen > 1 && viewplayer == &players[thirddisplayplayer] && camera3.chase)
heightsec = R_PointInSubsector(camera3.x, camera3.y)->sector->heightsec;
else if (splitscreen && viewplayer == &players[secondarydisplayplayer] && camera2.chase)
heightsec = R_PointInSubsector(camera2.x, camera2.y)->sector->heightsec;
else if (camera.chase && viewplayer == &players[displayplayer])
heightsec = R_PointInSubsector(camera.x, camera.y)->sector->heightsec;
else if (viewmobj)
for (i = 0; i <= splitscreen; i++)
{
if (viewplayer == &players[displayplayers[i]] && camera[i].chase)
{
heightsec = R_PointInSubsector(camera[i].x, camera[i].y)->sector->heightsec;
break;
}
}
if (i > splitscreen && viewmobj)
heightsec = R_PointInSubsector(viewmobj->x, viewmobj->y)->sector->heightsec;
else
return sec;
underwater = heightsec != -1 && viewz <= sectors[heightsec].floorheight;
underwater = (heightsec != -1 && viewz <= sectors[heightsec].floorheight);
// Replace sector being drawn, with a copy to be hacked
*tempsec = *sec;
@ -827,7 +830,7 @@ static void R_AddPolyObjects(subsector_t *sub)
drawseg_t *firstseg;
static void R_Subsector(size_t num, UINT8 viewnumber)
static void R_Subsector(size_t num)
{
INT32 count, floorlightlevel, ceilinglightlevel, light;
seg_t *line;
@ -1149,7 +1152,7 @@ static void R_Subsector(size_t num, UINT8 viewnumber)
// Either you must pass the fake sector and handle validcount here, on the
// real sector, or you must account for the lighting in some other way,
// like passing it as an argument.
R_AddSprites(sub->sector, (floorlightlevel+ceilinglightlevel)/2, viewnumber);
R_AddSprites(sub->sector, (floorlightlevel+ceilinglightlevel)/2);
firstseg = NULL;
@ -1355,7 +1358,7 @@ INT32 R_GetPlaneLight(sector_t *sector, fixed_t planeheight, boolean underside)
//
// killough 5/2/98: reformatted, removed tail recursion
void R_RenderBSPNode(INT32 bspnum, UINT8 viewnumber)
void R_RenderBSPNode(INT32 bspnum)
{
node_t *bsp;
INT32 side;
@ -1366,7 +1369,7 @@ void R_RenderBSPNode(INT32 bspnum, UINT8 viewnumber)
// Decide which side the view point is on.
side = R_PointOnSide(viewx, viewy, bsp);
// Recursively divide front space.
R_RenderBSPNode(bsp->children[side], viewnumber);
R_RenderBSPNode(bsp->children[side]);
// Possibly divide back space.
@ -1384,5 +1387,5 @@ void R_RenderBSPNode(INT32 bspnum, UINT8 viewnumber)
portalcullsector = NULL;
}
R_Subsector(bspnum == -1 ? 0 : bspnum & ~NF_SUBSECTOR, viewnumber);
R_Subsector(bspnum == -1 ? 0 : bspnum & ~NF_SUBSECTOR);
}

View file

@ -37,7 +37,7 @@ extern INT32 doorclosed;
void R_ClearClipSegs(void);
void R_PortalClearClipSegs(INT32 start, INT32 end);
void R_ClearDrawSegs(void);
void R_RenderBSPNode(INT32 bspnum, UINT8 viewnumber);
void R_RenderBSPNode(INT32 bspnum);
void R_AddPortal(INT32 line1, INT32 line2, INT32 x1, INT32 x2);
#ifdef POLYOBJECTS

View file

@ -65,9 +65,10 @@ size_t loopcount;
fixed_t viewx, viewy, viewz;
angle_t viewangle, aimingangle;
UINT8 viewnumber;
fixed_t viewcos, viewsin;
boolean viewsky, skyVisible;
boolean skyVisible1, skyVisible2, skyVisible3, skyVisible4; // saved values of skyVisible for P1/P2/P3/P4, for splitscreen
boolean skyVisiblePerPlayer[MAXSPLITSCREENPLAYERS]; // saved values of skyVisible for each splitscreen player
sector_t *viewsector;
player_t *viewplayer;
@ -195,17 +196,10 @@ void SplitScreen_OnChange(void)
if (!demo.playback && !botingame)
{
for (i = 1; i < 3; i++)
for (i = 1; i < MAXSPLITSCREENPLAYERS; i++)
{
if (i > splitscreen)
{
if (i == 1)
CL_RemoveSplitscreenPlayer(secondarydisplayplayer);
else if (i == 2)
CL_RemoveSplitscreenPlayer(thirddisplayplayer);
else if (i == 3)
CL_RemoveSplitscreenPlayer(fourthdisplayplayer);
}
CL_RemoveSplitscreenPlayer(displayplayers[i]);
else
CL_AddSplitscreenPlayer();
}
@ -215,22 +209,28 @@ void SplitScreen_OnChange(void)
}
else
{
secondarydisplayplayer = consoleplayer;
thirddisplayplayer = consoleplayer;
fourthdisplayplayer = consoleplayer;
for (i = 1; i < MAXSPLITSCREENPLAYERS; i++)
displayplayers[i] = consoleplayer;
for (i = 0; i < MAXPLAYERS; i++)
{
if (playeringame[i] && i != consoleplayer)
{
if (secondarydisplayplayer == consoleplayer)
secondarydisplayplayer = i;
else if (thirddisplayplayer == consoleplayer)
thirddisplayplayer = i;
else if (fourthdisplayplayer == consoleplayer)
fourthdisplayplayer = i;
else
UINT8 j;
for (j = 1; j < MAXSPLITSCREENPLAYERS; j++)
{
if (displayplayers[j] == consoleplayer)
{
displayplayers[j] = i;
break;
}
}
if (j == MAXSPLITSCREENPLAYERS)
break;
}
}
}
}
static void Fov_OnChange(void)
{
@ -844,16 +844,20 @@ static void R_SetupFreelook(void)
void R_SkyboxFrame(player_t *player)
{
camera_t *thiscam;
camera_t *thiscam = &camera[0];
UINT8 i;
if (splitscreen > 2 && player == &players[fourthdisplayplayer])
thiscam = &camera4;
else if (splitscreen > 1 && player == &players[thirddisplayplayer])
thiscam = &camera3;
else if (splitscreen && player == &players[secondarydisplayplayer])
thiscam = &camera2;
else
thiscam = &camera;
if (splitscreen)
{
for (i = 1; i <= splitscreen; i++)
{
if (player == &players[i])
{
thiscam = &camera[i];
break;
}
}
}
// cut-away view stuff
viewsky = true;
@ -883,23 +887,20 @@ void R_SkyboxFrame(player_t *player)
{
if (player == &players[consoleplayer])
{
viewangle = localangle; // WARNING: camera uses this
aimingangle = localaiming;
viewangle = localangle[0]; // WARNING: camera uses this
aimingangle = localaiming[0];
}
else if (player == &players[secondarydisplayplayer])
else if (splitscreen)
{
viewangle = localangle2;
aimingangle = localaiming2;
for (i = 1; i <= splitscreen; i++)
{
if (player == &players[displayplayers[i]])
{
viewangle = localangle[i];
aimingangle = localaiming[i];
break;
}
else if (player == &players[thirddisplayplayer])
{
viewangle = localangle3;
aimingangle = localaiming3;
}
else if (player == &players[fourthdisplayplayer])
{
viewangle = localangle4;
aimingangle = localaiming4;
}
}
}
@ -1078,24 +1079,24 @@ void R_SetupFrame(player_t *player, boolean skybox)
camera_t *thiscam;
boolean chasecam = false;
if (splitscreen > 2 && player == &players[fourthdisplayplayer])
if (splitscreen > 2 && player == &players[displayplayers[3]])
{
thiscam = &camera4;
thiscam = &camera[3];
chasecam = (cv_chasecam4.value != 0);
}
else if (splitscreen > 1 && player == &players[thirddisplayplayer])
else if (splitscreen > 1 && player == &players[displayplayers[2]])
{
thiscam = &camera3;
thiscam = &camera[2];
chasecam = (cv_chasecam3.value != 0);
}
else if (splitscreen && player == &players[secondarydisplayplayer])
else if (splitscreen && player == &players[displayplayers[1]])
{
thiscam = &camera2;
thiscam = &camera[1];
chasecam = (cv_chasecam2.value != 0);
}
else
{
thiscam = &camera;
thiscam = &camera[0];
chasecam = (cv_chasecam.value != 0);
}
@ -1145,23 +1146,20 @@ void R_SetupFrame(player_t *player, boolean skybox)
{
if (player == &players[consoleplayer])
{
viewangle = localangle; // WARNING: camera uses this
aimingangle = localaiming;
viewangle = localangle[0]; // WARNING: camera uses this
aimingangle = localaiming[0];
}
else if (player == &players[secondarydisplayplayer])
else if (splitscreen)
{
viewangle = localangle2;
aimingangle = localaiming2;
for (i = 1; i <= splitscreen; i++)
{
if (player == &players[displayplayers[i]])
{
viewangle = localangle[i];
aimingangle = localaiming[i];
break;
}
else if (player == &players[thirddisplayplayer])
{
viewangle = localangle3;
aimingangle = localaiming3;
}
else if (player == &players[fourthdisplayplayer])
{
viewangle = localangle4;
aimingangle = localaiming4;
}
}
}
@ -1323,19 +1321,24 @@ void R_RenderPlayerView(player_t *player)
{
portal_pair *portal;
const boolean skybox = (skyboxmo[0] && cv_skybox.value);
UINT8 viewnumber;
UINT8 i;
if (player == &players[secondarydisplayplayer] && splitscreen)
viewnumber = 1;
else if (player == &players[thirddisplayplayer] && splitscreen > 1)
viewnumber = 2;
else if (player == &players[fourthdisplayplayer] && splitscreen > 2)
viewnumber = 3;
else
viewnumber = 0;
viewnumber = 0; // default
if (splitscreen)
{
for (i = 1; i <= splitscreen; i++)
{
if (player == &players[i])
{
viewnumber = i;
break;
}
}
}
// if this is display player 1
if (cv_homremoval.value && player == &players[displayplayer])
if (cv_homremoval.value && player == &players[displayplayers[0]])
{
if (cv_homremoval.value == 1)
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 31); // No HOM effect!
@ -1343,7 +1346,7 @@ void R_RenderPlayerView(player_t *player)
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 128+(timeinmap&15));
}
// Draw over the fourth screen so you don't have to stare at a HOM :V
else if (splitscreen == 2 && player == &players[thirddisplayplayer])
else if (splitscreen == 2 && player == &players[displayplayers[2]])
#if 1
{
// V_DrawPatchFill, but for the fourth screen only
@ -1362,14 +1365,14 @@ void R_RenderPlayerView(player_t *player)
#endif
// load previous saved value of skyVisible for the player
if (splitscreen > 2 && player == &players[fourthdisplayplayer])
skyVisible = skyVisible4;
else if (splitscreen > 1 && player == &players[thirddisplayplayer])
skyVisible = skyVisible3;
else if (splitscreen && player == &players[secondarydisplayplayer])
skyVisible = skyVisible2;
else
skyVisible = skyVisible1;
for (i = 0; i <= splitscreen; i++)
{
if (player == &players[displayplayers[i]]
{
skyVisible = skyVisiblePerPlayer[i];
break;
}
}
portalrender = 0;
portal_base = portal_cap = NULL;
@ -1386,7 +1389,7 @@ void R_RenderPlayerView(player_t *player)
R_ClearVisibleFloorSplats();
#endif
R_RenderBSPNode((INT32)numnodes - 1, viewnumber);
R_RenderBSPNode((INT32)numnodes - 1);
R_ClipSprites();
R_DrawPlanes();
#ifdef FLOORSPLATS
@ -1419,7 +1422,7 @@ void R_RenderPlayerView(player_t *player)
mytotal = 0;
ProfZeroTimer();
#endif
R_RenderBSPNode((INT32)numnodes - 1, viewnumber);
R_RenderBSPNode((INT32)numnodes - 1);
R_ClipSprites();
#ifdef TIMING
RDMSR(0x10, &mycount);
@ -1444,7 +1447,7 @@ void R_RenderPlayerView(player_t *player)
validcount++;
R_RenderBSPNode((INT32)numnodes - 1, viewnumber);
R_RenderBSPNode((INT32)numnodes - 1);
R_ClipSprites();
//R_DrawPlanes();
//R_DrawMasked();
@ -1470,16 +1473,16 @@ void R_RenderPlayerView(player_t *player)
// Check for new console commands.
NetUpdate();
// save value to skyVisible1 or skyVisible2
// save value to skyVisiblePerPlayer
// this is so that P1 can't affect whether P2 can see a skybox or not, or vice versa
if (splitscreen > 2 && player == &players[fourthdisplayplayer])
skyVisible4 = skyVisible;
else if (splitscreen > 1 && player == &players[thirddisplayplayer])
skyVisible3 = skyVisible;
else if (splitscreen && player == &players[secondarydisplayplayer])
skyVisible2 = skyVisible;
else
skyVisible1 = skyVisible;
for (i = 0; i <= splitscreen; i++)
{
if (player == &players[displayplayers[i]])
{
skyVisiblePerPlayer[i] = skyVisible;
break;
}
}
}
// =========================================================================

View file

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

View file

@ -88,8 +88,9 @@ extern side_t *sides;
//
extern fixed_t viewx, viewy, viewz;
extern angle_t viewangle, aimingangle;
extern UINT8 viewnumber; // splitscreen view number
extern boolean viewsky, skyVisible;
extern boolean skyVisible1, skyVisible2, skyVisible3, skyVisible4; // saved values of skyVisible for P1 and P2, for splitscreen
extern boolean skyVisiblePerPlayer[MAXSPLITSCREENPLAYERS]; // saved values of skyVisible of each splitscreen player
extern sector_t *viewsector;
extern player_t *viewplayer;
extern UINT8 portalrender;

View file

@ -1702,7 +1702,7 @@ static void R_ProjectPrecipitationSprite(precipmobj_t *thing)
// R_AddSprites
// During BSP traversal, this adds sprites by sector.
//
void R_AddSprites(sector_t *sec, INT32 lightlevel, UINT8 viewnumber)
void R_AddSprites(sector_t *sec, INT32 lightlevel)
{
mobj_t *thing;
precipmobj_t *precipthing; // Tails 08-25-2002
@ -2664,11 +2664,11 @@ void SetPlayerSkinByNum(INT32 playernum, INT32 skinnum)
{
if (playernum == consoleplayer)
CV_StealthSetValue(&cv_playercolor, skin->prefcolor);
else if (playernum == secondarydisplayplayer)
else if (playernum == displayplayers[1])
CV_StealthSetValue(&cv_playercolor2, skin->prefcolor);
else if (playernum == thirddisplayplayer)
else if (playernum == displayplayers[2])
CV_StealthSetValue(&cv_playercolor3, skin->prefcolor);
else if (playernum == fourthdisplayplayer)
else if (playernum == displayplayers[3])
CV_StealthSetValue(&cv_playercolor4, skin->prefcolor);
player->skincolor = skin->prefcolor;
if (player->mo)

View file

@ -55,7 +55,7 @@ void R_DelSpriteDefs(UINT16 wadnum);
#endif
//SoM: 6/5/2000: Light sprites correctly!
void R_AddSprites(sector_t *sec, INT32 lightlevel, UINT8 viewnumber);
void R_AddSprites(sector_t *sec, INT32 lightlevel);
void R_InitSprites(void);
void R_ClearSprites(void);
void R_ClipSprites(void);

View file

@ -438,7 +438,7 @@ void S_StartSoundAtVolume(const void *origin_p, sfxenum_t sfx_id, INT32 volume)
listener_t listener3 = {0,0,0,0};
listener_t listener4 = {0,0,0,0};
mobj_t *listenmobj = players[displayplayer].mo;
mobj_t *listenmobj = players[displayplayers[0]].mo;
mobj_t *listenmobj2 = NULL;
mobj_t *listenmobj3 = NULL;
mobj_t *listenmobj4 = NULL;
@ -450,26 +450,26 @@ void S_StartSoundAtVolume(const void *origin_p, sfxenum_t sfx_id, INT32 volume)
if (sfx_id == sfx_None)
return;
if (players[displayplayer].awayviewtics)
listenmobj = players[displayplayer].awayviewmobj;
if (players[displayplayers[0]].awayviewtics)
listenmobj = players[displayplayers[0]].awayviewmobj;
if (splitscreen)
{
listenmobj2 = players[secondarydisplayplayer].mo;
if (players[secondarydisplayplayer].awayviewtics)
listenmobj2 = players[secondarydisplayplayer].awayviewmobj;
listenmobj2 = players[displayplayers[1]].mo;
if (players[displayplayers[1]].awayviewtics)
listenmobj2 = players[displayplayers[1]].awayviewmobj;
if (splitscreen > 1)
{
listenmobj3 = players[thirddisplayplayer].mo;
if (players[thirddisplayplayer].awayviewtics)
listenmobj3 = players[thirddisplayplayer].awayviewmobj;
listenmobj3 = players[displayplayers[2]].mo;
if (players[displayplayers[2]].awayviewtics)
listenmobj3 = players[displayplayers[2]].awayviewmobj;
if (splitscreen > 2)
{
listenmobj4 = players[fourthdisplayplayer].mo;
if (players[fourthdisplayplayer].awayviewtics)
listenmobj4 = players[fourthdisplayplayer].awayviewmobj;
listenmobj4 = players[displayplayers[3]].mo;
if (players[displayplayers[3]].awayviewtics)
listenmobj4 = players[displayplayers[3]].awayviewmobj;
}
}
}
@ -482,12 +482,12 @@ void S_StartSoundAtVolume(const void *origin_p, sfxenum_t sfx_id, INT32 volume)
};
#endif
if (camera.chase && !players[displayplayer].awayviewtics)
if (camera[0].chase && !players[displayplayers[0]].awayviewtics)
{
listener.x = camera.x;
listener.y = camera.y;
listener.z = camera.z;
listener.angle = camera.angle;
listener.x = camera[0].x;
listener.y = camera[0].y;
listener.z = camera[0].z;
listener.angle = camera[0].angle;
}
else if (listenmobj)
{
@ -501,12 +501,12 @@ void S_StartSoundAtVolume(const void *origin_p, sfxenum_t sfx_id, INT32 volume)
if (listenmobj2)
{
if (camera2.chase && !players[secondarydisplayplayer].awayviewtics)
if (camera[1].chase && !players[displayplayers[1]].awayviewtics)
{
listener2.x = camera2.x;
listener2.y = camera2.y;
listener2.z = camera2.z;
listener2.angle = camera2.angle;
listener2.x = camera[1].x;
listener2.y = camera[1].y;
listener2.z = camera[1].z;
listener2.angle = camera[1].angle;
}
else
{
@ -519,12 +519,12 @@ void S_StartSoundAtVolume(const void *origin_p, sfxenum_t sfx_id, INT32 volume)
if (listenmobj3)
{
if (camera3.chase && !players[thirddisplayplayer].awayviewtics)
if (camera[2].chase && !players[displayplayers[2]].awayviewtics)
{
listener3.x = camera3.x;
listener3.y = camera3.y;
listener3.z = camera3.z;
listener3.angle = camera3.angle;
listener3.x = camera[2].x;
listener3.y = camera[2].y;
listener3.z = camera[2].z;
listener3.angle = camera[2].angle;
}
else
{
@ -537,12 +537,12 @@ void S_StartSoundAtVolume(const void *origin_p, sfxenum_t sfx_id, INT32 volume)
if (listenmobj4)
{
if (camera4.chase && !players[fourthdisplayplayer].awayviewtics)
if (camera[3].chase && !players[displayplayers[3]].awayviewtics)
{
listener4.x = camera4.x;
listener4.y = camera4.y;
listener4.z = camera4.z;
listener4.angle = camera4.angle;
listener4.x = camera[3].x;
listener4.y = camera[3].y;
listener4.z = camera[3].z;
listener4.angle = camera[3].angle;
}
else
{
@ -899,7 +899,7 @@ void S_UpdateSounds(void)
listener_t listener3;
listener_t listener4;
mobj_t *listenmobj = players[displayplayer].mo;
mobj_t *listenmobj = players[displayplayers[0]].mo;
mobj_t *listenmobj2 = NULL;
mobj_t *listenmobj3 = NULL;
mobj_t *listenmobj4 = NULL;
@ -940,31 +940,31 @@ void S_UpdateSounds(void)
if (splitscreen)
{
listenmobj2 = players[secondarydisplayplayer].mo;
if (players[secondarydisplayplayer].awayviewtics)
listenmobj2 = players[secondarydisplayplayer].awayviewmobj;
listenmobj2 = players[displayplayers[1]].mo;
if (players[displayplayers[1]].awayviewtics)
listenmobj2 = players[displayplayers[1]].awayviewmobj;
if (splitscreen > 1)
{
listenmobj3 = players[thirddisplayplayer].mo;
if (players[thirddisplayplayer].awayviewtics)
listenmobj3 = players[thirddisplayplayer].awayviewmobj;
listenmobj3 = players[displayplayers[2]].mo;
if (players[displayplayers[2]].awayviewtics)
listenmobj3 = players[displayplayers[2]].awayviewmobj;
if (splitscreen > 2)
{
listenmobj4 = players[fourthdisplayplayer].mo;
if (players[fourthdisplayplayer].awayviewtics)
listenmobj4 = players[fourthdisplayplayer].awayviewmobj;
listenmobj4 = players[displayplayers[3]].mo;
if (players[displayplayers[3]].awayviewtics)
listenmobj4 = players[displayplayers[3]].awayviewmobj;
}
}
}
if (camera.chase && !players[displayplayer].awayviewtics)
if (camera[0].chase && !players[displayplayers[0]].awayviewtics)
{
listener.x = camera.x;
listener.y = camera.y;
listener.z = camera.z;
listener.angle = camera.angle;
listener.x = camera[0].x;
listener.y = camera[0].y;
listener.z = camera[0].z;
listener.angle = camera[0].angle;
}
else if (listenmobj)
{
@ -989,12 +989,12 @@ void S_UpdateSounds(void)
if (listenmobj2)
{
if (camera2.chase && !players[secondarydisplayplayer].awayviewtics)
if (camera[1].chase && !players[displayplayers[1]].awayviewtics)
{
listener2.x = camera2.x;
listener2.y = camera2.y;
listener2.z = camera2.z;
listener2.angle = camera2.angle;
listener2.x = camera[1].x;
listener2.y = camera[1].y;
listener2.z = camera[1].z;
listener2.angle = camera[1].angle;
}
else
{
@ -1007,12 +1007,12 @@ void S_UpdateSounds(void)
if (listenmobj3)
{
if (camera3.chase && !players[thirddisplayplayer].awayviewtics)
if (camera[2].chase && !players[displayplayers[2]].awayviewtics)
{
listener3.x = camera3.x;
listener3.y = camera3.y;
listener3.z = camera3.z;
listener3.angle = camera3.angle;
listener3.x = camera[2].x;
listener3.y = camera[2].y;
listener3.z = camera[2].z;
listener3.angle = camera[2].angle;
}
else
{
@ -1025,12 +1025,12 @@ void S_UpdateSounds(void)
if (listenmobj4)
{
if (camera4.chase && !players[fourthdisplayplayer].awayviewtics)
if (camera[3].chase && !players[displayplayers[3]].awayviewtics)
{
listener4.x = camera4.x;
listener4.y = camera4.y;
listener4.z = camera4.z;
listener4.angle = camera4.angle;
listener4.x = camera[3].x;
listener4.y = camera[3].y;
listener4.z = camera[3].z;
listener4.angle = camera[3].angle;
}
else
{
@ -1060,9 +1060,9 @@ void S_UpdateSounds(void)
// check non-local sounds for distance clipping
// or modify their params
if (c->origin && ((c->origin != players[consoleplayer].mo)
|| (splitscreen && c->origin != players[secondarydisplayplayer].mo)
|| (splitscreen > 1 && c->origin != players[thirddisplayplayer].mo)
|| (splitscreen > 2 && c->origin != players[fourthdisplayplayer].mo)))
|| (splitscreen && c->origin != players[displayplayers[1]].mo)
|| (splitscreen > 1 && c->origin != players[displayplayers[2]].mo)
|| (splitscreen > 2 && c->origin != players[displayplayers[3]].mo)))
{
// Whomever is closer gets the sound, but only in splitscreen.
if (splitscreen)
@ -1071,13 +1071,10 @@ void S_UpdateSounds(void)
fixed_t recdist = -1;
INT32 i, p = -1;
for (i = 0; i < 4; i++)
for (i = 0; i <= splitscreen; i++)
{
fixed_t thisdist = -1;
if (i > splitscreen)
break;
if (i == 0 && listenmobj)
thisdist = P_AproxDistance(listener.x-soundmobj->x, listener.y-soundmobj->y);
else if (i == 1 && listenmobj2)
@ -1250,33 +1247,33 @@ INT32 S_AdjustSoundParams(const mobj_t *listener, const mobj_t *source, INT32 *v
if (!listener)
return false;
if (listener == players[displayplayer].mo && camera.chase)
if (listener == players[displayplayers[0]].mo && camera[0].chase)
{
listensource.x = camera.x;
listensource.y = camera.y;
listensource.z = camera.z;
listensource.angle = camera.angle;
listensource.x = camera[0].x;
listensource.y = camera[0].y;
listensource.z = camera[0].z;
listensource.angle = camera[0].angle;
}
else if (splitscreen && listener == players[secondarydisplayplayer].mo && camera2.chase)
else if (splitscreen && listener == players[displayplayers[1]].mo && camera[1].chase)
{
listensource.x = camera2.x;
listensource.y = camera2.y;
listensource.z = camera2.z;
listensource.angle = camera2.angle;
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[thirddisplayplayer].mo && camera3.chase)
else if (splitscreen > 1 && listener == players[displayplayers[2]].mo && camera[2].chase)
{
listensource.x = camera3.x;
listensource.y = camera3.y;
listensource.z = camera3.z;
listensource.angle = camera3.angle;
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[fourthdisplayplayer].mo && camera4.chase)
else if (splitscreen > 2 && listener == players[displayplayers[3]].mo && camera[3].chase)
{
listensource.x = camera4.x;
listensource.y = camera4.y;
listensource.z = camera4.z;
listensource.angle = camera4.angle;
listensource.x = camera[3].x;
listensource.y = camera[3].y;
listensource.z = camera[3].z;
listensource.angle = camera[3].angle;
}
else
{

View file

@ -372,7 +372,7 @@ static inline void ST_InitData(void)
// 'link' the statusbar display to a player, which could be
// another player than consoleplayer, for example, when you
// change the view in a multiplayer demo with F12.
stplyr = &players[displayplayer];
stplyr = &players[displayplayers[0]];
st_palette = -1;
}
@ -442,7 +442,7 @@ static INT32 SCY(INT32 y)
if (splitscreen)
{
y >>= 1;
if (stplyr != &players[displayplayer])
if (stplyr != &players[displayplayers[0]])
y += vid.height / 2;
}
return y;
@ -458,7 +458,7 @@ static INT32 STRINGY(INT32 y)
if (splitscreen)
{
y >>= 1;
if (stplyr != &players[displayplayer])
if (stplyr != &players[displayplayers[0]])
y += BASEVIDHEIGHT / 2;
}
return y;
@ -471,7 +471,7 @@ static INT32 SPLITFLAGS(INT32 f)
// Pass this V_SNAPTO(TOP|BOTTOM) and it'll trim them to account for splitscreen! -Red
if (splitscreen)
{
if (stplyr != &players[displayplayer])
if (stplyr != &players[displayplayers[0]])
f &= ~V_SNAPTOTOP;
else
f &= ~V_SNAPTOBOTTOM;
@ -498,7 +498,7 @@ static INT32 SCR(INT32 r)
if (splitscreen)
{
y >>= 1;
if (stplyr != &players[displayplayer])
if (stplyr != &players[displayplayers[0]])
y += vid.height / 2;
}
return FixedInt(FixedDiv(y, vid.fdupy));
@ -701,7 +701,7 @@ static inline void ST_drawRings(void) // SRB2kart - unused.
/*
static void ST_drawLives(void) // SRB2kart - unused.
{
const INT32 v_splitflag = (splitscreen && stplyr == &players[displayplayer] ? V_SPLITSCREEN : 0);
const INT32 v_splitflag = (splitscreen && stplyr == &players[displayplayers[0]] ? V_SPLITSCREEN : 0);
if (!stplyr->skincolor)
return; // Just joined a server, skin isn't loaded yet!
@ -1019,7 +1019,7 @@ static void ST_drawNiGHTSHUD(void) // SRB2kart - unused.
if (G_IsSpecialStage(gamemap))
{ // Since special stages share score, time, rings, etc.
// disable splitscreen mode for its HUD.
if (stplyr != &players[displayplayer])
if (stplyr != &players[displayplayers[0]])
return;
nosshack = splitscreen;
splitscreen = 0;
@ -1124,7 +1124,7 @@ static void ST_drawNiGHTSHUD(void) // SRB2kart - unused.
V_DrawScaledPatch(locx, STRINGY(locy)-3, V_HUDTRANS, drillbar);
for (dfill = 0; dfill < stplyr->drillmeter/20 && dfill < 96; ++dfill)
V_DrawScaledPatch(locx + 2 + dfill, STRINGY(locy + 3), V_HUDTRANS, drillfill[fillpatch]);
stplyr = &players[secondarydisplayplayer];
stplyr = &players[displayplayers[1]];
if (stplyr->pflags & PF_DRILLING)
fillpatch = (stplyr->drillmeter & 1) + 1;
else
@ -1132,7 +1132,7 @@ static void ST_drawNiGHTSHUD(void) // SRB2kart - unused.
V_DrawScaledPatch(locx, STRINGY(locy-3), V_SNAPTOBOTTOM|V_HUDTRANS, drillbar);
for (dfill = 0; dfill < stplyr->drillmeter/20 && dfill < 96; ++dfill)
V_DrawScaledPatch(locx + 2 + dfill, STRINGY(locy + 3), V_SNAPTOBOTTOM|V_HUDTRANS, drillfill[fillpatch]);
stplyr = &players[displayplayer];
stplyr = &players[displayplayers[0]];
splitscreen = 0;
}
else
@ -1881,7 +1881,7 @@ static void ST_overlayDrawer(void)
ST_drawTeamName();
// Special Stage HUD
if (!useNightsSS && G_IsSpecialStage(gamemap) && stplyr == &players[displayplayer])
if (!useNightsSS && G_IsSpecialStage(gamemap) && stplyr == &players[displayplayers[0]])
ST_drawSpecialStageHUD();
// Emerald Hunt Indicators
@ -1919,7 +1919,7 @@ static void ST_overlayDrawer(void)
{
char name[MAXPLAYERNAME+12];
INT32 y = (stplyr == &players[displayplayer]) ? 4 : BASEVIDHEIGHT/2-12;
INT32 y = (stplyr == &players[displayplayers[0]]) ? 4 : BASEVIDHEIGHT/2-12;
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);
}
@ -1930,10 +1930,10 @@ static void ST_overlayDrawer(void)
}
// This is where we draw all the fun cheese if you have the chasecam off!
/*if ((stplyr == &players[displayplayer] && !camera.chase)
|| ((splitscreen && stplyr == &players[secondarydisplayplayer]) && !camera2.chase)
|| ((splitscreen > 1 && stplyr == &players[thirddisplayplayer]) && !camera3.chase)
|| ((splitscreen > 2 && stplyr == &players[fourthdisplayplayer]) && !camera4.chase))
/*if ((stplyr == &players[displayplayers[0]] && !camera[0].chase)
|| ((splitscreen && stplyr == &players[displayplayers[1]]) && !camera[1].chase)
|| ((splitscreen > 1 && stplyr == &players[displayplayers[2]]) && !camera[2].chase)
|| ((splitscreen > 2 && stplyr == &players[displayplayers[3]]) && !camera[3].chase))
{
ST_drawFirstPersonHUD();
}*/
@ -2086,8 +2086,10 @@ static void ST_MayonakaStatic(void)
void ST_Drawer(void)
{
UINT8 i;
#ifdef SEENAMES
if (cv_seenames.value && cv_allowseenames.value && displayplayer == consoleplayer && seenplayer && seenplayer->mo && !mapreset)
if (cv_seenames.value && cv_allowseenames.value && displayplayers[0] == consoleplayer && seenplayer && seenplayer->mo && !mapreset)
{
if (cv_seenames.value == 1)
V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT/2 + 15, V_HUDTRANSHALF, player_names[seenplayer-players]);
@ -2121,26 +2123,12 @@ void ST_Drawer(void)
if (st_overlay)
{
// No deadview!
stplyr = &players[displayplayer];
ST_overlayDrawer();
if (splitscreen)
for (i = 0; i <= splitscreen; i++)
{
stplyr = &players[secondarydisplayplayer];
ST_overlayDrawer();
if (splitscreen > 1)
{
stplyr = &players[thirddisplayplayer];
ST_overlayDrawer();
if (splitscreen > 2)
{
stplyr = &players[fourthdisplayplayer];
stplyr = &players[displayplayers[i]];
ST_overlayDrawer();
}
}
}
// draw Midnight Channel's overlay ontop
if (mapheaderinfo[gamemap-1]->typeoflevel & TOL_TV) // Very specific Midnight Channel stuff.
ST_MayonakaStatic();

View file

@ -360,7 +360,7 @@ void Y_IntermissionDrawer(void)
V_DrawFadeScreen(0xFF00, 22);
if (!splitscreen)
whiteplayer = demo.playback ? displayplayer : consoleplayer;
whiteplayer = demo.playback ? displayplayers[0] : consoleplayer;
if (cons_menuhighlight.value)
hilicol = cons_menuhighlight.value;
@ -1051,19 +1051,19 @@ void Y_VoteDrawer(void)
{
case 1:
thiscurs = cursor2;
p = secondarydisplayplayer;
p = displayplayers[1];
break;
case 2:
thiscurs = cursor3;
p = thirddisplayplayer;
p = displayplayers[2];
break;
case 3:
thiscurs = cursor4;
p = fourthdisplayplayer;
p = displayplayers[3];
break;
default:
thiscurs = cursor1;
p = displayplayer;
p = displayplayers[0];
break;
}
@ -1218,10 +1218,7 @@ static void Y_VoteStops(SINT8 pick, SINT8 level)
S_StartSound(NULL, sfx_noooo2); // gasp
else if (mapheaderinfo[nextmap] && (mapheaderinfo[nextmap]->menuflags & LF2_HIDEINMENU))
S_StartSound(NULL, sfx_noooo1); // this is bad
else if (netgame && (pick == consoleplayer
|| pick == secondarydisplayplayer
|| pick == thirddisplayplayer
|| pick == fourthdisplayplayer))
else if (netgame && P_IsLocalPlayer(&players[pick]))
S_StartSound(NULL, sfx_yeeeah); // yeeeah!
else
S_StartSound(NULL, sfx_kc48); // just a cool sound
@ -1354,13 +1351,13 @@ void Y_VoteTicker(void)
switch (i)
{
case 1:
p = secondarydisplayplayer;
p = displayplayers[1];
break;
case 2:
p = thirddisplayplayer;
p = displayplayers[2];
break;
case 3:
p = fourthdisplayplayer;
p = displayplayers[3];
break;
default:
p = consoleplayer;