Merge branch 'fix-followers' into 'master'

Fix followers

See merge request KartKrew/Kart!446
This commit is contained in:
SteelT 2021-12-01 03:32:08 +00:00
commit 4cf01bf549
2 changed files with 21 additions and 13 deletions

View file

@ -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;
@ -1398,7 +1404,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();

View file

@ -3867,13 +3867,12 @@ 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:
@ -3934,9 +3933,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)