Add Opposite option for followercolor

This commit is contained in:
Latapostrophe 2020-05-09 12:12:29 +02:00
parent 6e016b3f0b
commit 3f43107eea
3 changed files with 26 additions and 8 deletions

View file

@ -819,12 +819,15 @@ void D_RegisterClientCommands(void)
Color_cons_t[i].value = Followercolor_cons_t[i].value = i;
Color_cons_t[i].strvalue = Followercolor_cons_t[i].strvalue = KartColor_Names[i]; // SRB2kart
}
Color_cons_t[MAXSKINCOLORS].value = Followercolor_cons_t[MAXSKINCOLORS+1].value = 0;
Color_cons_t[MAXSKINCOLORS].strvalue = Followercolor_cons_t[MAXSKINCOLORS+1].strvalue = NULL;
Color_cons_t[MAXSKINCOLORS].value = Followercolor_cons_t[MAXSKINCOLORS+2].value = 0;
Color_cons_t[MAXSKINCOLORS].strvalue = Followercolor_cons_t[MAXSKINCOLORS+2].strvalue = NULL;
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
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.
if (dedicated)
return;

View file

@ -8121,11 +8121,26 @@ static void P_HandleFollower(player_t *player)
fixed_t sine = fl.bobamp * FINESINE((((8*pi*(fl.bobspeed)) * leveltime)>>ANGLETOFINESHIFT) & FINEMASK);
sz += FixedMul(player->mo->scale, sine)*P_MobjFlip(player->mo);
// extra step, give the follower a color !?
color = player->followercolor;
// little extra check to make sure this isn't garbage:
if (!color || color > MAXSKINCOLORS-1)
color = player->skincolor; // "Match" option. Essentially a fallback as well.
// Set follower colour
switch (player->followercolor)
{
case MAXSKINCOLORS: // "Match"
color = player->skincolor;
break;
case MAXSKINCOLORS+1: // "Opposite"
color = KartColor_Opposite[player->skincolor*2];
break;
default:
color = player->followercolor;
if (!color || color > MAXSKINCOLORS+2) // Make sure this isn't garbage
color = player->skincolor; // "Match" as fallback.
break;
}
if (!player->follower) // follower doesn't exist / isn't valid
{

View file

@ -147,7 +147,7 @@ static UINT8** translationtablecache[TT_CACHE_SIZE] = {NULL};
// SKINCOLOR DEFINITIONS HAVE BEEN MOVED TO K_KART.C
CV_PossibleValue_t Color_cons_t[MAXSKINCOLORS+1];
CV_PossibleValue_t Followercolor_cons_t[MAXSKINCOLORS+2];
CV_PossibleValue_t Followercolor_cons_t[MAXSKINCOLORS+3]; // +3 to account for "Match", "Opposite" & NULL
/** \brief The R_InitTranslationTables