diff --git a/src/doomdata.h b/src/doomdata.h index 38727b85c..b4142463c 100644 --- a/src/doomdata.h +++ b/src/doomdata.h @@ -210,7 +210,7 @@ typedef struct extern const UINT8 Color_Index[MAXTRANSLATIONS-1][16]; extern const char *Color_Names[MAXSKINCOLORS + NUMSUPERCOLORS]; -extern const UINT8 Color_Opposite[(MAXSKINCOLORS - 1)*2]; +extern const UINT8 Color_Opposite[MAXSKINCOLORS - 1][2]; #define NUMMAPS 1035 diff --git a/src/lua_mathlib.c b/src/lua_mathlib.c index 1f0d6e287..4c5424577 100644 --- a/src/lua_mathlib.c +++ b/src/lua_mathlib.c @@ -173,15 +173,15 @@ static int lib_all7emeralds(lua_State *L) return 1; } -// Whee, special Lua-exclusive function for making use of Color_Opposite[] without needing *2 or +1 -// Returns both color and frame numbers! +// Whee, special Lua-exclusive function for making use of Color_Opposite[] +// Returns both color and signpost shade numbers! static int lib_coloropposite(lua_State *L) { UINT8 colornum = (UINT8)luaL_checkinteger(L, 1); - if (colornum >= MAXSKINCOLORS) - return luaL_error(L, "skincolor %d out of range (0 - %d).", colornum, MAXSKINCOLORS-1); - lua_pushinteger(L, Color_Opposite[colornum*2]); // push color - lua_pushinteger(L, Color_Opposite[colornum*2+1]); // push frame + if (!colornum || colornum >= MAXSKINCOLORS) + return luaL_error(L, "skincolor %d out of range (1 - %d).", colornum, MAXSKINCOLORS-1); + lua_pushinteger(L, Color_Opposite[colornum-1][0]); // push color + lua_pushinteger(L, Color_Opposite[colornum-1][1]); // push sign shade index, 0-15 return 2; } diff --git a/src/m_menu.c b/src/m_menu.c index ca389a94d..128b15a76 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -6980,8 +6980,8 @@ static void M_DrawLoadGameData(void) col = 134; else { - col = (charskin->prefcolor - 1)*2; - col = Color_Index[Color_Opposite[col]-1][Color_Opposite[col+1]]; + col = charskin->prefcolor - 1; + col = Color_Index[Color_Opposite[col][0]-1][Color_Opposite[col][1]]; } V_DrawFill(x+6, y+64, 72, 50, col); diff --git a/src/p_enemy.c b/src/p_enemy.c index 4126d0716..7bc9c14b7 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -4898,12 +4898,12 @@ void A_SignPlayer(mobj_t *actor) of in the name. If you have a better idea, feel free to let me know. ~toast 2016/07/20 */ - actor->frame += (15 - Color_Opposite[(Color_Opposite[(skin->prefoppositecolor - 1)*2] - 1)*2 + 1]); + actor->frame += (15 - Color_Opposite[Color_Opposite[skin->prefoppositecolor - 1][0] - 1][1]); } else if (actor->target->player->skincolor) // Set the sign to be an appropriate background color for this player's skincolor. { - actor->color = Color_Opposite[(actor->target->player->skincolor - 1)*2]; - actor->frame += (15 - Color_Opposite[(actor->target->player->skincolor - 1)*2 + 1]); + actor->color = Color_Opposite[actor->target->player->skincolor - 1][0]; + actor->frame += (15 - Color_Opposite[actor->target->player->skincolor - 1][1]); } if (skin->sprites[SPR2_SIGN].numframes) diff --git a/src/r_draw.c b/src/r_draw.c index f8e435624..af82d3fa8 100644 --- a/src/r_draw.c +++ b/src/r_draw.c @@ -352,77 +352,79 @@ const char *Color_Names[MAXSKINCOLORS + NUMSUPERCOLORS] = A word of warning: If the following array is non-symmetrical, A_SignPlayer's prefoppositecolor behaviour will break. */ -const UINT8 Color_Opposite[(MAXSKINCOLORS - 1)*2] = +// [0] = opposite skin color, +// [1] = shade index used by signpost, 0-15 (actual sprite frame is 15 minus this value) +const UINT8 Color_Opposite[MAXSKINCOLORS - 1][2] = { - // SKINCOLOR_NONE,8, // SKINCOLOR_NONE + // {SKINCOLOR_NONE, 8}, // SKINCOLOR_NONE // Greyscale ranges - SKINCOLOR_BLACK,5, // SKINCOLOR_WHITE, - SKINCOLOR_JET,7, // SKINCOLOR_BONE, - SKINCOLOR_CARBON,7, // SKINCOLOR_CLOUDY, - SKINCOLOR_AETHER,12, // SKINCOLOR_GREY, - SKINCOLOR_SLATE,12, // SKINCOLOR_SILVER, - SKINCOLOR_CLOUDY,7, // SKINCOLOR_CARBON, - SKINCOLOR_BONE,7, // SKINCOLOR_JET, - SKINCOLOR_WHITE,7, // SKINCOLOR_BLACK, + {SKINCOLOR_BLACK, 5}, // SKINCOLOR_WHITE, + {SKINCOLOR_JET, 7}, // SKINCOLOR_BONE, + {SKINCOLOR_CARBON, 7}, // SKINCOLOR_CLOUDY, + {SKINCOLOR_AETHER, 12}, // SKINCOLOR_GREY, + {SKINCOLOR_SLATE, 12}, // SKINCOLOR_SILVER, + {SKINCOLOR_CLOUDY, 7}, // SKINCOLOR_CARBON, + {SKINCOLOR_BONE, 7}, // SKINCOLOR_JET, + {SKINCOLOR_WHITE, 7}, // SKINCOLOR_BLACK, // Desaturated - SKINCOLOR_GREY,15, // SKINCOLOR_AETHER, - SKINCOLOR_SILVER,12, // SKINCOLOR_SLATE, - SKINCOLOR_AZURE,9, // SKINCOLOR_PINK, - SKINCOLOR_RUST,7, // SKINCOLOR_YOGURT, - SKINCOLOR_TAN,2, // SKINCOLOR_BROWN, - SKINCOLOR_BROWN,12, // SKINCOLOR_TAN, - SKINCOLOR_MOSS,5, // SKINCOLOR_BEIGE, - SKINCOLOR_BEIGE,13, // SKINCOLOR_MOSS, - SKINCOLOR_PINK,5, // SKINCOLOR_AZURE, - SKINCOLOR_GOLD,4, // SKINCOLOR_LAVENDER, + {SKINCOLOR_GREY, 15}, // SKINCOLOR_AETHER, + {SKINCOLOR_SILVER, 12}, // SKINCOLOR_SLATE, + {SKINCOLOR_AZURE, 9}, // SKINCOLOR_PINK, + {SKINCOLOR_RUST, 7}, // SKINCOLOR_YOGURT, + {SKINCOLOR_TAN, 2}, // SKINCOLOR_BROWN, + {SKINCOLOR_BROWN, 12}, // SKINCOLOR_TAN, + {SKINCOLOR_MOSS, 5}, // SKINCOLOR_BEIGE, + {SKINCOLOR_BEIGE, 13}, // SKINCOLOR_MOSS, + {SKINCOLOR_PINK, 5}, // SKINCOLOR_AZURE, + {SKINCOLOR_GOLD, 4}, // SKINCOLOR_LAVENDER, // Viv's vivid colours (toast 21/07/17) - SKINCOLOR_EMERALD,10, // SKINCOLOR_RUBY, - SKINCOLOR_FOREST,6, // SKINCOLOR_SALMON, - SKINCOLOR_GREEN,10, // SKINCOLOR_RED, - SKINCOLOR_ICY,10, // SKINCOLOR_CRIMSON, - SKINCOLOR_PURPLE,8, // SKINCOLOR_FLAME, - SKINCOLOR_TEAL,7, // SKINCOLOR_PEACHY, - SKINCOLOR_WAVE,5, // SKINCOLOR_QUAIL, - SKINCOLOR_SAPPHIRE,5, // SKINCOLOR_SUNSET, - SKINCOLOR_CYAN,4, // SKINCOLOR_APRICOT, - SKINCOLOR_BLUE,4, // SKINCOLOR_ORANGE, - SKINCOLOR_YOGURT,8, // SKINCOLOR_RUST, - SKINCOLOR_LAVENDER,10, // SKINCOLOR_GOLD, - SKINCOLOR_SKY,8, // SKINCOLOR_SANDY, - SKINCOLOR_CORNFLOWER,8, // SKINCOLOR_YELLOW, - SKINCOLOR_DUSK,3, // SKINCOLOR_OLIVE, - SKINCOLOR_MAGENTA,9, // SKINCOLOR_LIME, - SKINCOLOR_COBALT,2, // SKINCOLOR_PERIDOT, - SKINCOLOR_RED,6, // SKINCOLOR_GREEN, - SKINCOLOR_SALMON,9, // SKINCOLOR_FOREST, - SKINCOLOR_RUBY,4, // SKINCOLOR_EMERALD, - SKINCOLOR_VIOLET,5, // SKINCOLOR_MINT, - SKINCOLOR_PLUM,6, // SKINCOLOR_SEAFOAM, - SKINCOLOR_ROSY,7, // SKINCOLOR_AQUA, - SKINCOLOR_PEACHY,7, // SKINCOLOR_TEAL, - SKINCOLOR_QUAIL,5, // SKINCOLOR_WAVE, - SKINCOLOR_APRICOT,6, // SKINCOLOR_CYAN, - SKINCOLOR_SANDY,1, // SKINCOLOR_SKY, - SKINCOLOR_NEON,4, // SKINCOLOR_CERULEAN, - SKINCOLOR_CRIMSON,0, // SKINCOLOR_ICY, - SKINCOLOR_SUNSET,5, // SKINCOLOR_SAPPHIRE, - SKINCOLOR_YELLOW,4, // SKINCOLOR_CORNFLOWER, - SKINCOLOR_ORANGE,5, // SKINCOLOR_BLUE, - SKINCOLOR_PERIDOT,5, // SKINCOLOR_COBALT, - SKINCOLOR_LILAC,4, // SKINCOLOR_VAPOR, - SKINCOLOR_OLIVE,0, // SKINCOLOR_DUSK, - SKINCOLOR_BUBBLEGUM,9, // SKINCOLOR_PASTEL, - SKINCOLOR_FLAME,7, // SKINCOLOR_PURPLE, - SKINCOLOR_PASTEL,8, // SKINCOLOR_BUBBLEGUM, - SKINCOLOR_LIME,6, // SKINCOLOR_MAGENTA, - SKINCOLOR_CERULEAN,2, // SKINCOLOR_NEON, - SKINCOLOR_MINT,6, // SKINCOLOR_VIOLET, - SKINCOLOR_VAPOR,4, // SKINCOLOR_LILAC, - SKINCOLOR_MINT,7, // SKINCOLOR_PLUM, - SKINCOLOR_AQUA,1 // SKINCOLOR_ROSY, + {SKINCOLOR_EMERALD, 10}, // SKINCOLOR_RUBY, + {SKINCOLOR_FOREST, 6}, // SKINCOLOR_SALMON, + {SKINCOLOR_GREEN, 10}, // SKINCOLOR_RED, + {SKINCOLOR_ICY, 10}, // SKINCOLOR_CRIMSON, + {SKINCOLOR_PURPLE, 8}, // SKINCOLOR_FLAME, + {SKINCOLOR_TEAL, 7}, // SKINCOLOR_PEACHY, + {SKINCOLOR_WAVE, 5}, // SKINCOLOR_QUAIL, + {SKINCOLOR_SAPPHIRE, 5}, // SKINCOLOR_SUNSET, + {SKINCOLOR_CYAN, 4}, // SKINCOLOR_APRICOT, + {SKINCOLOR_BLUE, 4}, // SKINCOLOR_ORANGE, + {SKINCOLOR_YOGURT, 8}, // SKINCOLOR_RUST, + {SKINCOLOR_LAVENDER, 10}, // SKINCOLOR_GOLD, + {SKINCOLOR_SKY, 8}, // SKINCOLOR_SANDY, + {SKINCOLOR_CORNFLOWER, 8}, // SKINCOLOR_YELLOW, + {SKINCOLOR_DUSK, 3}, // SKINCOLOR_OLIVE, + {SKINCOLOR_MAGENTA, 9}, // SKINCOLOR_LIME, + {SKINCOLOR_COBALT, 2}, // SKINCOLOR_PERIDOT, + {SKINCOLOR_RED, 6}, // SKINCOLOR_GREEN, + {SKINCOLOR_SALMON, 9}, // SKINCOLOR_FOREST, + {SKINCOLOR_RUBY, 4}, // SKINCOLOR_EMERALD, + {SKINCOLOR_VIOLET, 5}, // SKINCOLOR_MINT, + {SKINCOLOR_PLUM, 6}, // SKINCOLOR_SEAFOAM, + {SKINCOLOR_ROSY, 7}, // SKINCOLOR_AQUA, + {SKINCOLOR_PEACHY, 7}, // SKINCOLOR_TEAL, + {SKINCOLOR_QUAIL, 5}, // SKINCOLOR_WAVE, + {SKINCOLOR_APRICOT, 6}, // SKINCOLOR_CYAN, + {SKINCOLOR_SANDY, 1}, // SKINCOLOR_SKY, + {SKINCOLOR_NEON, 4}, // SKINCOLOR_CERULEAN, + {SKINCOLOR_CRIMSON, 0}, // SKINCOLOR_ICY, + {SKINCOLOR_SUNSET, 5}, // SKINCOLOR_SAPPHIRE, + {SKINCOLOR_YELLOW, 4}, // SKINCOLOR_CORNFLOWER, + {SKINCOLOR_ORANGE, 5}, // SKINCOLOR_BLUE, + {SKINCOLOR_PERIDOT, 5}, // SKINCOLOR_COBALT, + {SKINCOLOR_LILAC, 4}, // SKINCOLOR_VAPOR, + {SKINCOLOR_OLIVE, 0}, // SKINCOLOR_DUSK, + {SKINCOLOR_BUBBLEGUM, 9}, // SKINCOLOR_PASTEL, + {SKINCOLOR_FLAME, 7}, // SKINCOLOR_PURPLE, + {SKINCOLOR_PASTEL, 8}, // SKINCOLOR_BUBBLEGUM, + {SKINCOLOR_LIME, 6}, // SKINCOLOR_MAGENTA, + {SKINCOLOR_CERULEAN, 2}, // SKINCOLOR_NEON, + {SKINCOLOR_MINT, 6}, // SKINCOLOR_VIOLET, + {SKINCOLOR_VAPOR, 4}, // SKINCOLOR_LILAC, + {SKINCOLOR_MINT, 7}, // SKINCOLOR_PLUM, + {SKINCOLOR_AQUA, 1} // SKINCOLOR_ROSY, }; CV_PossibleValue_t Color_cons_t[MAXSKINCOLORS+1];