diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 2054d166..1a06910c 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -648,6 +648,8 @@ static inline void resynch_write_player(resynch_pak *rsp, const size_t i) rsp->jointime = (tic_t)LONG(players[i].jointime); + rsp->splitscreenindex = players[i].splitscreenindex; + rsp->hasmo = false; //Transfer important mo information if the player has a body. //This lets us resync players even if they are dead. @@ -783,6 +785,8 @@ static void resynch_read_player(resynch_pak *rsp) players[i].jointime = (tic_t)LONG(rsp->jointime); + players[i].splitscreenindex = rsp->splitscreenindex; + //We get a packet for each player in game. if (!playeringame[i]) return; @@ -3356,6 +3360,8 @@ static void Got_AddPlayer(UINT8 **p, INT32 playernum) addedtogame = true; } + players[newplayernum].splitscreenindex = splitscreenplayer; + if (netgame) { if (server && cv_showjoinaddress.value) diff --git a/src/d_clisrv.h b/src/d_clisrv.h index 62bd8bc1..5dc48753 100644 --- a/src/d_clisrv.h +++ b/src/d_clisrv.h @@ -283,6 +283,8 @@ typedef struct tic_t jointime; + UINT8 splitscreenindex; + //player->mo stuff UINT8 hasmo; // Boolean diff --git a/src/d_player.h b/src/d_player.h index b430f20a..a5d73ec7 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -571,6 +571,8 @@ typedef struct player_s UINT8 bot; tic_t jointime; // Timer when player joins game to change skin/color + + UINT8 splitscreenindex; #ifdef HWRENDER fixed_t fovadd; // adjust FOV for hw rendering #endif diff --git a/src/g_game.c b/src/g_game.c index 28bdce4d..e2a59969 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -2357,6 +2357,7 @@ void G_PlayerReborn(INT32 player) UINT8 skincolor; INT32 skin; tic_t jointime; + UINT8 splitscreenindex; boolean spectator; INT16 bot; SINT8 pity; @@ -2380,6 +2381,7 @@ void G_PlayerReborn(INT32 player) ctfteam = players[player].ctfteam; exiting = players[player].exiting; jointime = players[player].jointime; + splitscreenindex = players[player].splitscreenindex; spectator = players[player].spectator; pflags = (players[player].pflags & (PF_TIMEOVER|PF_FLIPCAM|PF_TAGIT|PF_TAGGED|PF_ANALOGMODE|PF_WANTSTOJOIN)); @@ -2476,6 +2478,7 @@ void G_PlayerReborn(INT32 player) p->pflags = pflags; p->ctfteam = ctfteam; p->jointime = jointime; + p->splitscreenindex = splitscreenindex; p->spectator = spectator; // save player config truth reborn diff --git a/src/lua_playerlib.c b/src/lua_playerlib.c index 5f136fc1..1c37f4c4 100644 --- a/src/lua_playerlib.c +++ b/src/lua_playerlib.c @@ -325,6 +325,8 @@ static int player_get(lua_State *L) lua_pushinteger(L, plr->bot); else if (fastcmp(field,"jointime")) lua_pushinteger(L, plr->jointime); + else if (fastcmp(field,"splitscreenindex")) + lua_pushinteger(L, plr->splitscreenindex); #ifdef HWRENDER else if (fastcmp(field,"fovadd")) lua_pushfixed(L, plr->fovadd); @@ -613,6 +615,8 @@ static int player_set(lua_State *L) return NOSET; else if (fastcmp(field,"jointime")) plr->jointime = (tic_t)luaL_checkinteger(L, 3); + else if (fastcmp(field,"splitscreenindex")) + return NOSET; #ifdef HWRENDER else if (fastcmp(field,"fovadd")) plr->fovadd = luaL_checkfixed(L, 3); diff --git a/src/p_saveg.c b/src/p_saveg.c index 975a4a5d..5a43745b 100644 --- a/src/p_saveg.c +++ b/src/p_saveg.c @@ -249,6 +249,8 @@ static void P_NetArchivePlayers(void) WRITEUINT32(save_p, players[i].jointime); + WRITEUINT8(save_p, players[i].splitscreenindex); + WRITEUINT16(save_p, flags); if (flags & CAPSULE) @@ -426,6 +428,8 @@ static void P_NetUnArchivePlayers(void) players[i].jointime = READUINT32(save_p); + players[i].splitscreenindex = READUINT8(save_p); + flags = READUINT16(save_p); if (flags & CAPSULE)