Merge branch 'party-fix' into 'master'

Fix parties becoming black upon map load

See merge request KartKrew/Kart!428
This commit is contained in:
Sal 2021-04-23 12:57:33 -04:00
commit 7e842735a3
6 changed files with 10 additions and 13 deletions

View file

@ -1338,7 +1338,7 @@ static void CL_ReloadReceivedSavegame(void)
neededtic = gametic; neededtic = gametic;
maketic = neededtic; maketic = neededtic;
for (i = 0; i <= splitscreen; i++) for (i = 0; i <= r_splitscreen; i++)
{ {
P_ForceLocalAngle(&players[displayplayers[i]], players[displayplayers[i]].angleturn); 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 LUAh_PlayerQuit(&players[playernum], reason); // Lua hook for player quitting
// don't look through someone's view who isn't there // 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. // Call ViewpointSwitch hooks here.
// The viewpoint was forcibly changed. // 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 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]); LUA_InvalidatePlayer(&players[playernum]);
K_CheckBumpers(); K_CheckBumpers();

View file

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

View file

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

View file

@ -128,7 +128,7 @@ static int lib_iterateDisplayplayers(lua_State *L)
for (i++; i < MAXSPLITSCREENPLAYERS; i++) 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. 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); 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); lua_Integer i = luaL_checkinteger(L, 2);
if (i < 0 || i >= MAXSPLITSCREENPLAYERS) if (i < 0 || i >= MAXSPLITSCREENPLAYERS)
return luaL_error(L, "displayplayers[] index %d out of range (0 - %d)", i, MAXSPLITSCREENPLAYERS-1); return luaL_error(L, "displayplayers[] index %d out of range (0 - %d)", i, MAXSPLITSCREENPLAYERS-1);
if (i > splitscreen) if (i > r_splitscreen)
return 0; return 0;
if (!playeringame[displayplayers[i]]) if (!playeringame[displayplayers[i]])
return 0; return 0;

View file

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

View file

@ -3729,10 +3729,10 @@ static void P_InitCamera(void)
{ {
UINT8 i; 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]);
} }
} }
} }