Fix follower colours 'Match' and 'Opposite' not working

This commit is contained in:
SinnamonLat 2021-09-02 13:34:17 +02:00
parent 2df8aa69b7
commit f96f7c6ba3
2 changed files with 16 additions and 11 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;

View file

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