"prefoppositecolor" - exists solely for metal so he can have his sonic 4 peridot-background end sign when using skincolor_blue. not updating player.dta yet though.

This commit is contained in:
toasterbabe 2016-07-20 15:48:24 +01:00
parent f1311c515d
commit 4435815c35
4 changed files with 41 additions and 9 deletions

View File

@ -3949,6 +3949,7 @@ void A_UnsetSolidSteam(mobj_t *actor)
void A_SignPlayer(mobj_t *actor)
{
mobj_t *ov;
skin_t *skin;
#ifdef HAVE_BLUA
if (LUA_CallAction("A_SignPlayer", actor))
return;
@ -3959,15 +3960,35 @@ void A_SignPlayer(mobj_t *actor)
if (!actor->target->player)
return;
// Set the sign to be an appropriate background color for this player's skincolor.
actor->color = Color_Opposite[actor->target->player->skincolor*2];
actor->frame += Color_Opposite[actor->target->player->skincolor*2+1];
skin = &skins[actor->target->player->skin];
if ((actor->target->player->skincolor == skin->prefcolor) && (skin->prefoppositecolor)) // Set it as the skin's preferred oppositecolor?
{
actor->color = skin->prefoppositecolor;
/*
If you're here from the comment above Color_Opposite,
the following line is the one which is dependent on the
array being symmetrical. It gets the opposite of the
opposite of your desired colour just so it can get the
brightness frame for the End Sign. It's not a great
design choice, but it's constant time array access and
the idea that the colours should be OPPOSITES is kind
of in the name. If you have a better idea, feel free
to let me know. ~toast 2016/07/20
*/
actor->frame += Color_Opposite[Color_Opposite[skin->prefoppositecolor*2]*2+1];
}
else // Set the sign to be an appropriate background color for this player's skincolor.
{
actor->color = Color_Opposite[actor->target->player->skincolor*2];
actor->frame += Color_Opposite[actor->target->player->skincolor*2+1];
}
// spawn an overlay of the player's face.
ov = P_SpawnMobj(actor->x, actor->y, actor->z, MT_OVERLAY);
P_SetTarget(&ov->target, actor);
ov->color = actor->target->player->skincolor;
ov->skin = &skins[actor->target->player->skin];
ov->skin = skin;
P_SetMobjState(ov, actor->info->seestate); // S_PLAY_SIGN
}

View File

@ -166,9 +166,13 @@ const char *Color_Names[MAXSKINCOLORS] =
"Lavender", // SKINCOLOR_LAVENDER
"Magenta", // SKINCOLOR_MAGENTA
"Pink", // SKINCOLOR_PINK
"Rosy" // SKINCOLOR_ROSY
"Rosy" // SKINCOLOR_ROSY
};
/*
A word of warning: If the following array is non-symmetrical,
A_SignPlayer's prefoppositecolor behaviour will break.
*/
const UINT8 Color_Opposite[MAXSKINCOLORS*2] =
{
SKINCOLOR_NONE,8, // SKINCOLOR_NONE
@ -183,7 +187,7 @@ const UINT8 Color_Opposite[MAXSKINCOLORS*2] =
SKINCOLOR_CYAN,8, // SKINCOLOR_CRIMSON - ditto
SKINCOLOR_BLUE,12, // SKINCOLOR_ORANGE
SKINCOLOR_TAN,8, // SKINCOLOR_RUST - ditto
SKINCOLOR_LAVENDER,8, // SKINCOLOR_GOLD - ditto
SKINCOLOR_LAVENDER,8, // SKINCOLOR_GOLD - ditto
SKINCOLOR_TEAL,8, // SKINCOLOR_YELLOW - ditto
SKINCOLOR_RUST,8, // SKINCOLOR_TAN - ditto
SKINCOLOR_MAGENTA,3, // SKINCOLOR_MOSS
@ -200,7 +204,7 @@ const UINT8 Color_Opposite[MAXSKINCOLORS*2] =
SKINCOLOR_GOLD,8, // SKINCOLOR_LAVENDER - ditto
SKINCOLOR_MOSS,8, // SKINCOLOR_MAGENTA - ditto
SKINCOLOR_AZURE,8, // SKINCOLOR_PINK - ditto
SKINCOLOR_AQUA,8 // SKINCOLOR_ROSY - ditto
SKINCOLOR_AQUA,8 // SKINCOLOR_ROSY - ditto
};
CV_PossibleValue_t Color_cons_t[MAXSKINCOLORS+1];

View File

@ -2288,6 +2288,7 @@ static void Sk_SetDefaultValue(skin_t *skin)
skin->starttranscolor = 96;
skin->prefcolor = SKINCOLOR_GREEN;
skin->prefoppositecolor = 0; // use tables
skin->normalspeed = 36<<FRACBITS;
skin->runspeed = 28<<FRACBITS;
@ -2623,9 +2624,11 @@ void R_AddSkins(UINT16 wadnum)
#define GETFRACBITS(field) else if (!stricmp(stoken, #field)) skin->field = atoi(value)<<FRACBITS;
GETFRACBITS(normalspeed)
GETFRACBITS(runspeed)
GETFRACBITS(mindash)
GETFRACBITS(maxdash)
GETFRACBITS(actionspd)
GETFRACBITS(radius)
GETFRACBITS(height)
GETFRACBITS(spinheight)
@ -2650,8 +2653,10 @@ void R_AddSkins(UINT16 wadnum)
else if (!stricmp(stoken, "startcolor"))
skin->starttranscolor = atoi(value);
else if (!stricmp(stoken, "prefcolor"))
skin->prefcolor = R_GetColorByName(value);
#define GETSKINCOLOR(field) else if (!stricmp(stoken, #field)) skin->field = R_GetColorByName(value);
GETSKINCOLOR(prefcolor)
GETSKINCOLOR(prefoppositecolor)
#undef GETSKINCOLOR
#define GETFLOAT(field) else if (!stricmp(stoken, #field)) skin->field = FLOAT_TO_FIXED(atof(value));
GETFLOAT(jumpfactor)

View File

@ -102,6 +102,8 @@ typedef struct
// Definable color translation table
UINT8 starttranscolor;
UINT8 prefcolor;
UINT8 prefoppositecolor; // if 0 use tables instead
fixed_t highresscale; // scale of highres, default is 0.5
// specific sounds per skin