From caf1ed37ac01714d6bbf108b276db5536d2d8b71 Mon Sep 17 00:00:00 2001 From: SinnamonLat Date: Thu, 2 Sep 2021 08:17:43 +0200 Subject: [PATCH 1/4] fix janky follower movements due to lag type being changed from int32 to uint32 in the struct --- src/p_user.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/p_user.c b/src/p_user.c index d577faab2..a8523bdf6 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -3918,9 +3918,10 @@ static void P_HandleFollower(player_t *player) P_SetFollowerState(player->follower, player->follower->state->nextstate); // move the follower next to us (yes, this is really basic maths but it looks pretty damn clean in practice)! - player->follower->momx = (sx - player->follower->x)/fl.horzlag; - player->follower->momy = (sy - player->follower->y)/fl.horzlag; - player->follower->momz = (sz - player->follower->z)/fl.vertlag; + // 02/09/2021: cast lag to int32 otherwise funny things happen since it was changed to uint32 in the struct + player->follower->momx = (sx - player->follower->x)/ (INT32)fl.horzlag; + player->follower->momy = (sy - player->follower->y)/ (INT32)fl.horzlag; + player->follower->momz = (sz - player->follower->z)/ (INT32)fl.vertlag; player->follower->angle = player->mo->angle; if (player->mo->colorized) From 2df8aa69b7653c1d328365018f658dca77f8681c Mon Sep 17 00:00:00 2001 From: SinnamonLat Date: Thu, 2 Sep 2021 08:33:49 +0200 Subject: [PATCH 2/4] missing follower check in SendNameAndColor --- src/d_netcmd.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/d_netcmd.c b/src/d_netcmd.c index 4ed110f35..cd6189e8a 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -1398,7 +1398,9 @@ static void SendNameAndColor(UINT8 n) if (!strcmp(cv_playername[n].string, player_names[playernum]) && cv_playercolor[n].value == player->skincolor - && !strcmp(cv_skin[n].string, skins[player->skin].name)) + && !strcmp(cv_skin[n].string, skins[player->skin].name) + && cv_follower[n].value == player->followerskin + && cv_followercolor[n].value == player->followercolor) return; player->availabilities = R_GetSkinAvailabilities(); From f96f7c6ba3ce0064076507deb88da47440229da6 Mon Sep 17 00:00:00 2001 From: SinnamonLat Date: Thu, 2 Sep 2021 13:34:17 +0200 Subject: [PATCH 3/4] Fix follower colours 'Match' and 'Opposite' not working --- src/d_netcmd.c | 18 ++++++++++++------ src/p_user.c | 9 ++++----- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/src/d_netcmd.c b/src/d_netcmd.c index cd6189e8a..2556ab0ac 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -768,15 +768,21 @@ void D_RegisterClientCommands(void) for (i = 0; i < MAXSKINCOLORS; i++) { - Color_cons_t[i].value = Followercolor_cons_t[i].value = i; - Color_cons_t[i].strvalue = Followercolor_cons_t[i].strvalue = skincolors[i].name; + Color_cons_t[i].value = i; + Color_cons_t[i].strvalue = skincolors[i].name; } - Followercolor_cons_t[MAXSKINCOLORS].value = MAXSKINCOLORS; - Followercolor_cons_t[MAXSKINCOLORS].strvalue = "Match"; // Add "Match" option, which will make the follower color match the player's + for (i = 2; i < MAXSKINCOLORS; i++) + { + Followercolor_cons_t[i].value = i-2; + Followercolor_cons_t[i].strvalue = skincolors[i-2].name; + } - Followercolor_cons_t[MAXSKINCOLORS+1].value = MAXSKINCOLORS+1; - Followercolor_cons_t[MAXSKINCOLORS+1].strvalue = "Opposite"; // Add "Opposite" option, ...which is like "Match", but for coloropposite. + Followercolor_cons_t[1].value = -1; + Followercolor_cons_t[1].strvalue = "Match"; // Add "Match" option, which will make the follower color match the player's + + Followercolor_cons_t[0].value = -2; + Followercolor_cons_t[0].strvalue = "Opposite"; // Add "Opposite" option, ...which is like "Match", but for coloropposite. Color_cons_t[MAXSKINCOLORS].value = Followercolor_cons_t[MAXSKINCOLORS+2].value = 0; Color_cons_t[MAXSKINCOLORS].strvalue = Followercolor_cons_t[MAXSKINCOLORS+2].strvalue = NULL; diff --git a/src/p_user.c b/src/p_user.c index a8523bdf6..bbc28a504 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -3804,7 +3804,7 @@ static void P_HandleFollower(player_t *player) angle_t an; fixed_t zoffs; fixed_t sx, sy, sz; - UINT16 color; + INT16 color; fixed_t bubble; // bubble scale (0 if no bubble) mobj_t *bmobj; // temp bubble mobj @@ -3851,19 +3851,18 @@ static void P_HandleFollower(player_t *player) } // Set follower colour - switch (player->followercolor) { - case MAXSKINCOLORS: // "Match" + case 255: // "Match" (-1) color = player->skincolor; break; - case MAXSKINCOLORS+1: // "Opposite" + case 254: // "Opposite" (-2) color = skincolors[player->skincolor].invcolor; break; default: color = player->followercolor; - if (!color || color > MAXSKINCOLORS+2) // Make sure this isn't garbage + if (color < -2 || !color || color > MAXSKINCOLORS+2) // Make sure this isn't garbage color = player->skincolor; // "Match" as fallback. break; From 647dfd98fbe78cddf6830c5e1d3c77f7c0889e11 Mon Sep 17 00:00:00 2001 From: SinnamonLat Date: Thu, 2 Sep 2021 13:40:57 +0200 Subject: [PATCH 4/4] forgot to change something back --- src/p_user.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/p_user.c b/src/p_user.c index bbc28a504..f748a04bb 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -3804,7 +3804,7 @@ static void P_HandleFollower(player_t *player) angle_t an; fixed_t zoffs; fixed_t sx, sy, sz; - INT16 color; + UINT16 color; fixed_t bubble; // bubble scale (0 if no bubble) mobj_t *bmobj; // temp bubble mobj @@ -3862,7 +3862,7 @@ static void P_HandleFollower(player_t *player) default: color = player->followercolor; - if (color < -2 || !color || color > MAXSKINCOLORS+2) // Make sure this isn't garbage + if (!color || color > MAXSKINCOLORS+2) // Make sure this isn't garbage color = player->skincolor; // "Match" as fallback. break;