Fix console back color not being correct.

This also adds support for using such colors in a text prompt
This commit is contained in:
Steel Titanium 2019-06-26 22:05:15 -04:00
parent e63e36f5e4
commit 251494c3c8
3 changed files with 57 additions and 67 deletions

View file

@ -127,8 +127,6 @@ static CV_PossibleValue_t backpic_cons_t[] = {{0, "translucent"}, {1, "picture"}
// whether to use console background picture, or translucent mode
static consvar_t cons_backpic = {"con_backpic", "translucent", CV_SAVE, backpic_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
// \todo SRB2-CHAT 2.1 colors -- pending translation to 2.2 palette indexes
#if 0
static CV_PossibleValue_t backcolor_cons_t[] = {{0, "White"}, {1, "Black"}, {2, "Sepia"},
{3, "Brown"}, {4, "Pink"}, {5, "Raspberry"},
{6, "Red"}, {7, "Creamsicle"}, {8, "Orange"},
@ -137,13 +135,7 @@ static CV_PossibleValue_t backcolor_cons_t[] = {{0, "White"}, {1, "Black"}, {
{15,"Periwinkle"}, {16,"Blue"}, {17,"Purple"},
{18,"Lavender"},
{0, NULL}};
#else
static CV_PossibleValue_t backcolor_cons_t[] = {{0, "White"}, {1, "Gray"}, {2, "Brown"},
{3, "Red"}, {4, "Orange"}, {5, "Yellow"},
{6, "Green"}, {7, "Blue"}, {8, "Purple"},
{9, "Magenta"}, {10, "Aqua"},
{0, NULL}};
#endif
consvar_t cons_backcolor = {"con_backcolor", "Green", CV_CALL|CV_SAVE, backcolor_cons_t, CONS_backcolor_Change, 0, NULL, NULL, 0, 0, NULL};
@ -256,50 +248,30 @@ void CON_SetupBackColormapEx(INT32 color, boolean prompt)
shift = 6; // 12 colors -- shift of 7 means 6 colors
// \todo SRB2-CHAT colors, pending translation to 2.2 palette indexes
#if 0
switch (color)
{
case 0: palindex = 15; break; // White
case 1: palindex = 31; break; // Gray
case 2: palindex = 47; break; // Sepia
case 3: palindex = 63; break; // Brown
case 4: palindex = 150; shift = 7; break; // Pink
case 5: palindex = 127; shift = 7; break; // Raspberry
case 6: palindex = 143; break; // Red
case 7: palindex = 86; shift = 7; break; // Creamsicle
case 8: palindex = 95; break; // Orange
case 9: palindex = 119; shift = 7; break; // Gold
case 10: palindex = 111; break; // Yellow
case 11: palindex = 191; shift = 7; break; // Emerald
case 12: palindex = 175; break; // Green
case 13: palindex = 219; break; // Cyan
case 14: palindex = 207; shift = 7; break; // Steel
case 15: palindex = 230; shift = 7; break; // Periwinkle
case 16: palindex = 239; break; // Blue
case 17: palindex = 199; shift = 7; break; // Purple
case 18: palindex = 255; shift = 7; break; // Lavender
case 1: palindex = 31; break; // Black
case 2: palindex = 251; break; // Sepia
case 3: palindex = 239; break; // Brown
case 4: palindex = 215; shift = 7; break; // Pink
case 5: palindex = 37; shift = 7; break; // Raspberry
case 6: palindex = 47; shift = 7; break; // Red
case 7: palindex = 53; shift = 7; break; // Creamsicle
case 8: palindex = 63; break; // Orange
case 9: palindex = 56; shift = 7; break; // Gold
case 10: palindex = 79; shift = 7; break; // Yellow
case 11: palindex = 119; shift = 7; break; // Emerald
case 12: palindex = 111; break; // Green
case 13: palindex = 136; shift = 7; break; // Cyan
case 14: palindex = 175; shift = 7; break; // Steel
case 15: palindex = 166; shift = 7; break; // Periwinkle
case 16: palindex = 159; break; // Blue
case 17: palindex = 187; shift = 7; break; // Purple
case 18: palindex = 199; shift = 7; break; // Lavender
// Default green
default: palindex = 175; break;
default: palindex = 111; break;
}
#else
switch (color)
{
case 0: palindex = 15; break; // White
case 1: palindex = 31; break; // Gray
case 2: palindex = 239; break; // Brown
case 3: palindex = 47; break; // Red
case 4: palindex = 63; break; // Orange
case 5: palindex = 79; shift = 7; break; // Yellow
case 6: palindex = 111; break; // Green
case 7: palindex = 159; break; // Blue
case 8: palindex = 199; shift = 7; break; // Purple
case 9: palindex = 187; break; // Magenta
case 10: palindex = 139; break; // Aqua
// Default green
default: palindex = 175; color = 11; break;
}
#endif
if (prompt)
{

View file

@ -1792,15 +1792,23 @@ static void readtextpromptpage(MYFILE *f, INT32 num, INT32 pagenum)
if (i == 0 || fastcmp(word2, "WHITE")) backcolor = 0;
else if (i == 1 || fastcmp(word2, "GRAY") || fastcmp(word2, "GREY") ||
fastcmp(word2, "BLACK")) backcolor = 1;
else if (i == 2 || fastcmp(word2, "BROWN")) backcolor = 2;
else if (i == 3 || fastcmp(word2, "RED")) backcolor = 3;
else if (i == 4 || fastcmp(word2, "ORANGE")) backcolor = 4;
else if (i == 5 || fastcmp(word2, "YELLOW")) backcolor = 5;
else if (i == 6 || fastcmp(word2, "GREEN")) backcolor = 6;
else if (i == 7 || fastcmp(word2, "BLUE")) backcolor = 7;
else if (i == 8 || fastcmp(word2, "PURPLE")) backcolor = 8;
else if (i == 9 || fastcmp(word2, "MAGENTA")) backcolor = 9;
else if (i == 10 || fastcmp(word2, "AQUA")) backcolor = 10;
else if (i == 2 || fastcmp(word2, "SEPIA")) backcolor = 2;
else if (i == 3 || fastcmp(word2, "BROWN")) backcolor = 3;
else if (i == 4 || fastcmp(word2, "PINK")) backcolor = 4;
else if (i == 5 || fastcmp(word2, "RASPBERRY")) backcolor = 5;
else if (i == 6 || fastcmp(word2, "RED")) backcolor = 6;
else if (i == 7 || fastcmp(word2, "CREAMSICLE")) backcolor = 7;
else if (i == 8 || fastcmp(word2, "ORANGE")) backcolor = 8;
else if (i == 9 || fastcmp(word2, "GOLD")) backcolor = 9;
else if (i == 10 || fastcmp(word2, "YELLOW")) backcolor = 10;
else if (i == 11 || fastcmp(word2, "EMERALD")) backcolor = 11;
else if (i == 12 || fastcmp(word2, "GREEN")) backcolor = 12;
else if (i == 13 || fastcmp(word2, "CYAN") || fastcmp(word2, "AQUA")) backcolor = 13;
else if (i == 14 || fastcmp(word2, "STEEL")) backcolor = 14;
else if (i == 15 || fastcmp(word2, "PERIWINKLE")) backcolor = 15;
else if (i == 16 || fastcmp(word2, "BLUE")) backcolor = 16;
else if (i == 17 || fastcmp(word2, "PURPLE")) backcolor = 17;
else if (i == 18 || fastcmp(word2, "LAVENDER")) backcolor = 18;
else if (i < 0) backcolor = INT32_MAX; // CONS_BACKCOLOR user-configured
else backcolor = 1; // default gray
textprompts[num]->page[pagenum].backcolor = backcolor;

View file

@ -1322,7 +1322,7 @@ static UINT32 V_GetHWConsBackColor(void)
switch (cons_backcolor.value)
{
case 0: hwcolor = 0xffffff00; break; // White
case 1: hwcolor = 0x80808000; break; // Gray
case 1: hwcolor = 0x80808000; break; // Black
case 2: hwcolor = 0xdeb88700; break; // Sepia
case 3: hwcolor = 0x40201000; break; // Brown
case 4: hwcolor = 0xfa807200; break; // Pink
@ -1633,15 +1633,25 @@ void V_DrawPromptBack(INT32 boxheight, INT32 color)
UINT32 hwcolor;
switch (color)
{
case 0: hwcolor = 0xffffff00; break; // White
case 1: hwcolor = 0x00000000; break; // Gray // Note this is different from V_DrawFadeConsBack
case 2: hwcolor = 0x40201000; break; // Brown
case 3: hwcolor = 0xff000000; break; // Red
case 4: hwcolor = 0xff800000; break; // Orange
case 5: hwcolor = 0x80800000; break; // Yellow
case 6: hwcolor = 0x00800000; break; // Green
case 7: hwcolor = 0x0000ff00; break; // Blue
case 8: hwcolor = 0x4080ff00; break; // Cyan
case 0: hwcolor = 0xffffff00; break; // White
case 1: hwcolor = 0x00000000; break; // Black // Note this is different from V_DrawFadeConsBack
case 2: hwcolor = 0xdeb88700; break; // Sepia
case 3: hwcolor = 0x40201000; break; // Brown
case 4: hwcolor = 0xfa807200; break; // Pink
case 5: hwcolor = 0xff69b400; break; // Raspberry
case 6: hwcolor = 0xff000000; break; // Red
case 7: hwcolor = 0xffd68300; break; // Creamsicle
case 8: hwcolor = 0xff800000; break; // Orange
case 9: hwcolor = 0xdaa52000; break; // Gold
case 10: hwcolor = 0x80800000; break; // Yellow
case 11: hwcolor = 0x00ff0000; break; // Emerald
case 12: hwcolor = 0x00800000; break; // Green
case 13: hwcolor = 0x4080ff00; break; // Cyan
case 14: hwcolor = 0x4682b400; break; // Steel
case 15: hwcolor = 0x1e90ff00; break; // Periwinkle
case 16: hwcolor = 0x0000ff00; break; // Blue
case 17: hwcolor = 0xff00ff00; break; // Purple
case 18: hwcolor = 0xee82ee00; break; // Lavender
// Default green
default: hwcolor = 0x00800000; break;
}