Fix splitscreen, offline and death

This commit is contained in:
Latapostrophe 2019-03-02 22:39:42 +01:00
parent ab95b45e38
commit 1967ee2dd5
3 changed files with 27 additions and 8 deletions

View file

@ -1317,6 +1317,10 @@ static void SendNameAndColor(void)
if (players[consoleplayer].mo)
players[consoleplayer].mo->color = players[consoleplayer].skincolor;
// Update follower for local games:
if (cv_follower.value >= 0 && cv_follower.value != players[consoleplayer].followerskin)
SetFollower(consoleplayer, cv_follower.value);
if (metalrecording)
{ // Metal Sonic is Sonic, obviously.
SetPlayerSkinByNum(consoleplayer, 0);
@ -1453,6 +1457,10 @@ static void SendNameAndColor2(void)
if (players[secondplaya].mo)
players[secondplaya].mo->color = players[secondplaya].skincolor;
// Update follower for local games:
if (cv_follower2.value >= 0 && cv_follower2.value != players[secondplaya].followerskin)
SetFollower(secondplaya, cv_follower2.value);
if ((foundskin = R_SkinAvailable(cv_skin2.string)) != -1)
{
//boolean notsame;
@ -1573,6 +1581,10 @@ static void SendNameAndColor3(void)
if (players[thirdplaya].mo)
players[thirdplaya].mo->color = players[thirdplaya].skincolor;
// Update follower for local games:
if (cv_follower3.value >= 0 && cv_follower3.value != players[thirdplaya].followerskin)
SetFollower(thirdplaya, cv_follower3.value);
if ((foundskin = R_SkinAvailable(cv_skin3.string)) != -1)
{
//boolean notsame;
@ -1701,6 +1713,10 @@ static void SendNameAndColor4(void)
if (players[fourthplaya].mo)
players[fourthplaya].mo->color = players[fourthplaya].skincolor;
// Update follower for local games:
if (cv_follower4.value >= 0 && cv_follower4.value != players[fourthplaya].followerskin)
SetFollower(fourthplaya, cv_follower4.value);
if ((foundskin = R_SkinAvailable(cv_skin4.string)) != -1)
{
//boolean notsame;
@ -2129,6 +2145,9 @@ void D_MapChange(INT32 mapnum, INT32 newgametype, boolean pencoremode, boolean r
}
chmappending++;
// send infos. This seems very dumb but we use this for offline games and followers as some kind of band aid
if (netgame)
WRITEUINT32(buf_p, M_RandomizedSeed()); // random seed
SendNetXCmd(XD_MAP, buf, buf_p - buf);

View file

@ -8576,7 +8576,7 @@ static void M_SetupMultiPlayer2(INT32 choice)
setupm_cvskin = &cv_skin2;
setupm_cvcolor = &cv_playercolor2;
setupm_cvname = &cv_playername2;
setupm_cvfollower = &cv_follower;
setupm_cvfollower = &cv_follower2;
setupm_fakefollower = atoi(setupm_cvfollower->string); // update fake follower value
@ -8616,7 +8616,7 @@ static void M_SetupMultiPlayer3(INT32 choice)
setupm_cvskin = &cv_skin3;
setupm_cvcolor = &cv_playercolor3;
setupm_cvname = &cv_playername3;
setupm_cvfollower = &cv_follower;
setupm_cvfollower = &cv_follower3;
setupm_fakefollower = atoi(setupm_cvfollower->string); // update fake follower value
@ -8656,7 +8656,7 @@ static void M_SetupMultiPlayer4(INT32 choice)
setupm_cvskin = &cv_skin4;
setupm_cvcolor = &cv_playercolor4;
setupm_cvname = &cv_playername4;
setupm_cvfollower = &cv_follower;
setupm_cvfollower = &cv_follower4;
setupm_fakefollower = atoi(setupm_cvfollower->string); // update fake follower value

View file

@ -9044,8 +9044,8 @@ static void P_HandleFollower(player_t *player)
player->follower->extravalue1 = 2;
P_SetFollowerState(player->follower, fl.hurtstate);
}
if (player->mo->health <= 0) // if dead, snap to z pos
player->follower->z = sz;
if (player->mo->health <= 0) // if dead, follow the player's z momentum exactly so they both look like they die at the same speed.
player->follower->momz = player->mo->momz;
}
else if (player->speed > 10*player->mo->scale)
{
@ -9151,6 +9151,9 @@ void P_PlayerThink(player_t *player)
player->awayviewtics = 0; // reset to zero
}
// Run followes here. We need them to run even when we're dead to follow through what we're doing.
P_HandleFollower(player);
/*
if (player->pflags & PF_GLIDING)
{
@ -9622,9 +9625,6 @@ void P_PlayerThink(player_t *player)
K_KartPlayerThink(player, cmd); // SRB2kart
// we're done doing all of this, now take care of followers...
P_HandleFollower(player);
/*
// Colormap verification
{