Merge branch 'expose-splitscreen' into 'next'

Expose splitscreenplayer in player_t

See merge request KartKrew/Kart-Public!74
This commit is contained in:
Sal 2019-02-22 19:04:48 -05:00
commit 6152657885
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->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)

View file

@ -283,6 +283,8 @@ typedef struct
tic_t jointime;
UINT8 splitscreenindex;
//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 splitscreenindex;
#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 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

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,"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);

View file

@ -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)