diff --git a/src/p_enemy.c b/src/p_enemy.c index 4e11dc494..aa38c9818 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -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 } diff --git a/src/r_draw.c b/src/r_draw.c index d6a1ee7ae..c56888e0d 100644 --- a/src/r_draw.c +++ b/src/r_draw.c @@ -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]; diff --git a/src/r_things.c b/src/r_things.c index e15bb7d38..7b63edfcb 100644 --- a/src/r_things.c +++ b/src/r_things.c @@ -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<runspeed = 28<field = atoi(value)<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) diff --git a/src/r_things.h b/src/r_things.h index 430cdd639..15f9eb774 100644 --- a/src/r_things.h +++ b/src/r_things.h @@ -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