FIX PARTIES

This commit is contained in:
Sally Coolatta 2021-04-23 03:53:35 -04:00
parent 42420eabc2
commit e5d899412c
6 changed files with 10 additions and 13 deletions

View file

@ -1338,7 +1338,7 @@ static void CL_ReloadReceivedSavegame(void)
neededtic = gametic;
maketic = neededtic;
for (i = 0; i <= splitscreen; i++)
for (i = 0; i <= r_splitscreen; i++)
{
P_ForceLocalAngle(&players[displayplayers[i]], players[displayplayers[i]].angleturn);
}
@ -2375,7 +2375,7 @@ void CL_RemovePlayer(INT32 playernum, kickreason_t reason)
LUAh_PlayerQuit(&players[playernum], reason); // Lua hook for player quitting
// don't look through someone's view who isn't there
if (playernum == displayplayers[0])
if (playernum == displayplayers[0] && !demo.playback)
{
// Call ViewpointSwitch hooks here.
// The viewpoint was forcibly changed.
@ -2404,9 +2404,6 @@ void CL_RemovePlayer(INT32 playernum, kickreason_t reason)
RemoveAdminPlayer(playernum); // don't stay admin after you're gone
}
if (playernum == displayplayers[0] && !demo.playback)
displayplayers[0] = consoleplayer; // don't look through someone's view who isn't there
LUA_InvalidatePlayer(&players[playernum]);
K_CheckBumpers();

View file

@ -1263,7 +1263,7 @@ void G_DoLoadLevel(boolean resetplayer)
for (i = 0; i <= r_splitscreen; i++)
{
if (camera[i].chase)
P_ResetCamera(&players[g_localplayers[i]], &camera[i]);
P_ResetCamera(&players[displayplayers[i]], &camera[i]);
}
// clear cmd building stuff

View file

@ -50,10 +50,10 @@ G_ResetSplitscreen (INT32 playernum)
displayplayers[i] = g_localplayers[i];
P_ResetCamera(&players[displayplayers[i]], &camera[i]);
}
while (i < MAXSPLITSCREENPLAYERS)
{
displayplayers[i] = consoleplayer;
i++;
}

View file

@ -128,7 +128,7 @@ static int lib_iterateDisplayplayers(lua_State *L)
for (i++; i < MAXSPLITSCREENPLAYERS; i++)
{
if (i > splitscreen || !playeringame[displayplayers[i]])
if (i > r_splitscreen || !playeringame[displayplayers[i]])
return 0; // Stop! There are no more players for us to go through. There will never be a player gap in displayplayers.
LUA_PushUserdata(L, &players[displayplayers[i]], META_PLAYER);
@ -147,7 +147,7 @@ static int lib_getDisplayplayers(lua_State *L)
lua_Integer i = luaL_checkinteger(L, 2);
if (i < 0 || i >= MAXSPLITSCREENPLAYERS)
return luaL_error(L, "displayplayers[] index %d out of range (0 - %d)", i, MAXSPLITSCREENPLAYERS-1);
if (i > splitscreen)
if (i > r_splitscreen)
return 0;
if (!playeringame[displayplayers[i]])
return 0;

View file

@ -178,7 +178,7 @@ int LUA_PushGlobals(lua_State *L, const char *word)
lua_pushboolean(L, modeattacking);
return 1;
} else if (fastcmp(word,"splitscreen")) {
lua_pushboolean(L, splitscreen);
lua_pushinteger(L, splitscreen);
return 1;
} else if (fastcmp(word,"gamecomplete")) {
lua_pushboolean(L, (gamecomplete != 0));

View file

@ -3729,10 +3729,10 @@ static void P_InitCamera(void)
{
UINT8 i;
for (i = 0; i <= splitscreen; i++)
for (i = 0; i <= r_splitscreen; i++)
{
P_SetupCamera(i, &camera[i]);
displayplayers[i] = g_localplayers[i]; // Start with your OWN view, please!
//displayplayers[i] = g_localplayers[i]; // Start with your OWN view, please!
P_SetupCamera(displayplayers[i], &camera[i]);
}
}
}