Expose splitscreenplayer (from Got_AddPlayer) as splitscreen in player_t

This commit is contained in:
james 2019-02-16 23:25:50 -08:00
parent 32d1f75199
commit 1785adffc2
6 changed files with 21 additions and 0 deletions

View file

@ -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->splitscreen = players[i].splitscreen;
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].splitscreen = rsp->splitscreen;
//We get a packet for each player in game.
if (!playeringame[i])
return;
@ -3316,6 +3320,8 @@ static void Got_AddPlayer(UINT8 **p, INT32 playernum)
addedtogame = true;
}
players[newplayernum].splitscreen = splitscreenplayer;
if (netgame)
{
if (server && cv_showjoinaddress.value)

View file

@ -283,6 +283,8 @@ typedef struct
tic_t jointime;
UINT8 splitscreen;
//player->mo stuff
UINT8 hasmo; // Boolean

View file

@ -571,6 +571,8 @@ typedef struct player_s
UINT8 bot;
tic_t jointime; // Timer when player joins game to change skin/color
UINT8 splitscreen;
#ifdef HWRENDER
fixed_t fovadd; // adjust FOV for hw rendering
#endif

View file

@ -2357,6 +2357,7 @@ void G_PlayerReborn(INT32 player)
UINT8 skincolor;
INT32 skin;
tic_t jointime;
UINT8 psplitscreen;
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;
psplitscreen = players[player].splitscreen;
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->splitscreen = psplitscreen;
p->spectator = spectator;
// save player config truth reborn

View file

@ -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,"splitscreen"))
lua_pushinteger(L, plr->splitscreen);
#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,"splitscreen"))
return NOSET;
#ifdef HWRENDER
else if (fastcmp(field,"fovadd"))
plr->fovadd = luaL_checkfixed(L, 3);

View file

@ -249,6 +249,8 @@ static void P_NetArchivePlayers(void)
WRITEUINT32(save_p, players[i].jointime);
WRITEUINT8(save_p, players[i].splitscreen);
WRITEUINT16(save_p, flags);
if (flags & CAPSULE)
@ -426,6 +428,8 @@ static void P_NetUnArchivePlayers(void)
players[i].jointime = READUINT32(save_p);
players[i].splitscreen = READUINT8(save_p);
flags = READUINT16(save_p);
if (flags & CAPSULE)