diff --git a/src/console.c b/src/console.c index 212e6c8d..bd19cdf3 100644 --- a/src/console.c +++ b/src/console.c @@ -150,6 +150,13 @@ static CV_PossibleValue_t menuhighlight_cons_t[] = {V_GRAYMAP, "Always gray"}, {V_ORANGEMAP, "Always orange"}, {V_SKYMAP, "Always sky-blue"}, + {V_GOLDMAP, "Always gold"}, + {V_LAVENDERMAP, "Always lavender"}, + {V_TEAMAP, "Always tea-green"}, + {V_STEELMAP, "Always steel"}, + {V_PINKMAP, "Always pink"}, + {V_TEALMAP, "Always teal"}, + {V_PEACHMAP, "Always peach"}, {0, NULL} }; consvar_t cons_menuhighlight = {"menuhighlight", "Game type", CV_SAVE, menuhighlight_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; @@ -239,11 +246,6 @@ static void CONS_Bind_f(void) // CONSOLE SETUP //====================================================================== -// Font colormap colors -// TODO: This could probably be improved somehow... -// These colormaps are 99% identical, with just a few changed bytes -UINT8 *yellowmap, *purplemap, *greenmap, *bluemap, *graymap, *redmap, *orangemap, *skymap; - // Console BG color UINT8 *consolebgmap = NULL; @@ -284,37 +286,57 @@ static void CONS_backcolor_Change(void) CON_SetupBackColormap(); } +// Font colormap colors +// TODO: This could probably be improved somehow... +// These colormaps are 99% identical, with just a few changed bytes +UINT8 *yellowmap, *purplemap, *greenmap, *bluemap, *graymap, *redmap, *orangemap,\ + *skymap, *goldmap, *lavendermap, *teamap, *steelmap, *pinkmap, *tealmap, *peachmap; + static void CON_SetupColormaps(void) { INT32 i; - UINT8 *memorysrc = (UINT8 *)Z_Malloc((256*8), PU_STATIC, NULL); + UINT8 *memorysrc = (UINT8 *)Z_Malloc((256*15), PU_STATIC, NULL); - purplemap = memorysrc; - yellowmap = (purplemap+256); - greenmap = (yellowmap+256); - bluemap = (greenmap+256); - redmap = (bluemap+256); - graymap = (redmap+256); - orangemap = (graymap+256); - skymap = (orangemap+256); + purplemap = memorysrc; + yellowmap = (purplemap+256); + greenmap = (yellowmap+256); + bluemap = (greenmap+256); + redmap = (bluemap+256); + graymap = (redmap+256); + orangemap = (graymap+256); + skymap = (orangemap+256); + lavendermap = (skymap+256); + goldmap = (lavendermap+256); + teamap = (goldmap+256); + steelmap = (teamap+256); + pinkmap = (steelmap+256); + tealmap = (pinkmap+256); + peachmap = (tealmap+256); // setup the other colormaps, for console text // these don't need to be aligned, unless you convert the // V_DrawMappedPatch() into optimised asm. - for (i = 0; i < (256*8); i++, ++memorysrc) + for (i = 0; i < (256*15); i++, ++memorysrc) *memorysrc = (UINT8)(i & 0xFF); // remap each color to itself... // SRB2Kart: Different console font, new colors - purplemap[120] = (UINT8)194; - yellowmap[120] = (UINT8)103; - greenmap[120] = (UINT8)162; - bluemap[120] = (UINT8)228; - graymap[120] = (UINT8)10; - redmap[120] = (UINT8)126; // battle - orangemap[120] = (UINT8)85; // record attack - skymap[120] = (UINT8)214; // race + purplemap[120] = (UINT8)194; + yellowmap[120] = (UINT8)103; + greenmap[120] = (UINT8)162; + bluemap[120] = (UINT8)228; + redmap[120] = (UINT8)126; // battle + graymap[120] = (UINT8)10; + orangemap[120] = (UINT8)85; // record attack + skymap[120] = (UINT8)214; // race + lavendermap[120] = (UINT8)248; + goldmap[120] = (UINT8)114; + teamap[120] = (UINT8)177; + steelmap[120] = (UINT8)201; + pinkmap[120] = (UINT8)124; + tealmap[120] = (UINT8)220; + peachmap[120] = (UINT8)69; // nice // Init back colormap CON_SetupBackColormap(); diff --git a/src/console.h b/src/console.h index 896214c9..b15ccb6f 100644 --- a/src/console.h +++ b/src/console.h @@ -38,7 +38,8 @@ extern UINT32 con_scalefactor; // console text scale factor extern consvar_t cons_backcolor, cons_menuhighlight; -extern UINT8 *yellowmap, *purplemap, *greenmap, *bluemap, *graymap, *redmap, *orangemap, *skymap; +extern UINT8 *yellowmap, *purplemap, *greenmap, *bluemap, *graymap, *redmap, *orangemap,\ + *skymap, *goldmap, *lavendermap, *teamap, *steelmap, *pinkmap, *tealmap, *peachmap; // Console bg color (auto updated to match) extern UINT8 *consolebgmap; diff --git a/src/dehacked.c b/src/dehacked.c index 1c18e003..8c11cb8f 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -8206,6 +8206,14 @@ struct { {"V_REDMAP",V_REDMAP}, {"V_GRAYMAP",V_GRAYMAP}, {"V_ORANGEMAP",V_ORANGEMAP}, + {"V_SKYMAP",V_SKYMAP}, + {"V_LAVENDERMAP",V_LAVENDERMAP}, + {"V_GOLDMAP",V_GOLDMAP}, + {"V_TEAMAP",V_TEAMAP}, + {"V_STEELMAP",V_STEELMAP}, + {"V_PINKMAP",V_PINKMAP}, + {"V_TEALMAP",V_TEALMAP}, + {"V_PEACHMAP",V_PEACHMAP}, {"V_TRANSLUCENT",V_TRANSLUCENT}, {"V_10TRANS",V_10TRANS}, {"V_20TRANS",V_20TRANS}, diff --git a/src/hu_stuff.c b/src/hu_stuff.c index 8ff23e4d..33d4f2aa 100644 --- a/src/hu_stuff.c +++ b/src/hu_stuff.c @@ -726,25 +726,39 @@ static void Got_Saycmd(UINT8 **p, INT32 playernum) { const UINT8 color = players[playernum].skincolor; if (color <= SKINCOLOR_SILVER) - cstart = "\x80"; - else if (color <= SKINCOLOR_BLACK || color == SKINCOLOR_JET) // jet is more black than blue so it goes here. - cstart = "\x86"; + cstart = "\x80"; // white + else if (color <= SKINCOLOR_BEIGE || color == SKINCOLOR_JET) + cstart = "\x86"; // V_GRAYMAP + else if (color <= SKINCOLOR_LEATHER) + cstart = "\x8A"; // V_GOLDMAP + else if (color <= SKINCOLOR_ROSE || color == SKINCOLOR_RUBY || color == SKINCOLOR_DAWN || color == SKINCOLOR_LILAC) + cstart = "\x8d"; // V_PINKMAP else if (color <= SKINCOLOR_KETCHUP) - cstart = "\x85"; + cstart = "\x85"; // V_REDMAP + else if (color <= SKINCOLOR_TANGERINE) + cstart = "\x87"; // V_ORANGEMAP else if (color <= SKINCOLOR_CARAMEL) - cstart = "\x87"; - else if (color <= SKINCOLOR_MUSTARD) - cstart = "\x82"; - else if (SKINCOLOR_SWAMP) - cstart = "\x83"; - else if (color <= SKINCOLOR_STEEL || color == SKINCOLOR_SAPPHIRE) // toaster wanted that specific one too shrug - cstart = "\x88"; - else if (color <= SKINCOLOR_NAVY) - cstart = "\x84"; - else if (color <= SKINCOLOR_LILAC) - cstart = "\x81"; - else - cstart = "\x83"; + cstart = "\x8f"; // V_PEACHMAP + else if (color <= SKINCOLOR_BRONZE) + cstart = "\x8A"; // V_GOLDMAP + else if (color <= SKINCOLOR_MUSTARD || color == SKINCOLOR_LIME) + cstart = "\x82"; // V_YELLOWMAP + else if (color <= SKINCOLOR_PISTACHIO) + cstart = "\x8b"; // V_TEAMAP + else if (color <= SKINCOLOR_SWAMP) + cstart = "\x83"; // V_GREENMAP + else if (color <= SKINCOLOR_TEAL) + cstart = "\x8e"; // V_TEALMAP + else if (color <= SKINCOLOR_NAVY || color == SKINCOLOR_SAPPHIRE) + cstart = "\x88"; // V_SKYMAP + else if (color <= SKINCOLOR_STEEL) + cstart = "\x8c"; // V_STEELMAP + else if (color <= SKINCOLOR_BLUEBERRY) + cstart = "\x84"; // V_BLUEMAP + else if (color == SKINCOLOR_PURPLE) + cstart = "\x81"; // V_PURPLEMAP + else //if (color <= SKINCOLOR_POMEGRANATE) + cstart = "\x89"; // V_LAVENDERMAP } prefix = cstart; @@ -1171,33 +1185,6 @@ boolean HU_Responder(event_t *ev) // HEADS UP DRAWING //====================================================================== -// Gets string colormap, used for 0x80 color codes -// -static UINT8 *CHAT_GetStringColormap(INT32 colorflags) // pasted from video.c, sorry for the mess. -{ - switch ((colorflags & V_CHARCOLORMASK) >> V_CHARCOLORSHIFT) - { - case 1: // 0x81, purple - return purplemap; - case 2: // 0x82, yellow - return yellowmap; - case 3: // 0x83, lgreen - return greenmap; - case 4: // 0x84, blue - return bluemap; - case 5: // 0x85, red - return redmap; - case 6: // 0x86, gray - return graymap; - case 7: // 0x87, orange - return orangemap; - case 8: // 0x88, sky - return skymap; - default: // reset - return NULL; - } -} - // Precompile a wordwrapped string to any given width. // This is a muuuch better method than V_WORDWRAP. // again stolen and modified a bit from video.c, don't mind me, will need to rearrange this one day. @@ -1216,7 +1203,7 @@ static char *CHAT_WordWrap(INT32 x, INT32 w, INT32 option, const char *string) for (i = 0; i < slen; ++i) { c = newstring[i]; - if ((UINT8)c >= 0x80 && (UINT8)c <= 0x89) //color parsing! -Inuyasha 2.16.09 + if ((UINT8)c >= 0x80 && (UINT8)c <= 0x8F) //color parsing! -Inuyasha 2.16.09 continue; if (c == '\n') @@ -1333,6 +1320,7 @@ static void HU_drawMiniChat(void) INT32 transflag = (timer >= 0 && timer <= 9) ? (timer*V_10TRANS) : 0; // you can make bad jokes out of this one. size_t j = 0; const char *msg = CHAT_WordWrap(x+2, cv_chatwidth.value-(charwidth*2), V_SNAPTOBOTTOM|V_SNAPTOLEFT|V_ALLOWLOWERCASE, chat_mini[i]); // get the current message, and word wrap it. + UINT8 *colormap = NULL; while(msg[j]) // iterate through msg { @@ -1352,6 +1340,7 @@ static void HU_drawMiniChat(void) else if (msg[j] & 0x80) // stolen from video.c, nice. { clrflag = ((msg[j] & 0x7f) << V_CHARCOLORSHIFT) & V_CHARCOLORMASK; + colormap = V_GetStringColormap(clrflag); ++j; continue; } @@ -1360,8 +1349,6 @@ static void HU_drawMiniChat(void) } else { - UINT8 *colormap = CHAT_GetStringColormap(clrflag); - if (cv_chatbacktint.value) // on request of wolfy V_DrawFillConsoleMap(x + dx + 2, y+dy, charwidth, charheight, 239|V_SNAPTOBOTTOM|V_SNAPTOLEFT); @@ -1411,6 +1398,7 @@ static void HU_drawChatLog(INT32 offset) INT32 clrflag = 0; INT32 j = 0; const char *msg = CHAT_WordWrap(x+2, cv_chatwidth.value-(charwidth*2), V_SNAPTOBOTTOM|V_SNAPTOLEFT|V_ALLOWLOWERCASE, chat_log[i]); // get the current message, and word wrap it. + UINT8 *colormap = NULL; while(msg[j]) // iterate through msg { if (msg[j] < HU_FONTSTART) // don't draw @@ -1425,6 +1413,7 @@ static void HU_drawChatLog(INT32 offset) else if (msg[j] & 0x80) // stolen from video.c, nice. { clrflag = ((msg[j] & 0x7f) << V_CHARCOLORSHIFT) & V_CHARCOLORMASK; + colormap = V_GetStringColormap(clrflag); ++j; continue; } @@ -1434,10 +1423,7 @@ static void HU_drawChatLog(INT32 offset) else { if ((y+dy+2 >= chat_topy) && (y+dy < (chat_bottomy))) - { - UINT8 *colormap = CHAT_GetStringColormap(clrflag); V_DrawChatCharacter(x + dx + 2, y+dy+2, msg[j++] |V_SNAPTOBOTTOM|V_SNAPTOLEFT, !cv_allcaps.value, colormap); - } else j++; // don't forget to increment this or we'll get stuck in the limbo. } @@ -1498,8 +1484,7 @@ static void HU_DrawChat(void) { INT32 charwidth = 4, charheight = 6; INT32 t = 0, c = 0, y = chaty - (typelines*charheight) - (cv_kartspeedometer.value ? 16 : 0); - UINT32 i = 0; - INT32 saylen = strlen(w_chat); // You learn new things everyday! + UINT32 i = 0, saylen = strlen(w_chat); // You learn new things everyday! const char *ntalk = "Say: ", *ttalk = "Team: "; const char *talk = ntalk; diff --git a/src/v_video.c b/src/v_video.c index 58115e02..a56a5cfc 100644 --- a/src/v_video.c +++ b/src/v_video.c @@ -1248,26 +1248,40 @@ void V_DrawFadeConsBack(INT32 plines) // Gets string colormap, used for 0x80 color codes // -const UINT8 *V_GetStringColormap(INT32 colorflags) +UINT8 *V_GetStringColormap(INT32 colorflags) { switch ((colorflags & V_CHARCOLORMASK) >> V_CHARCOLORSHIFT) { - case 1: // 0x81, purple + case 1: // 0x81, purple return purplemap; - case 2: // 0x82, yellow + case 2: // 0x82, yellow return yellowmap; - case 3: // 0x83, lgreen + case 3: // 0x83, green return greenmap; - case 4: // 0x84, blue + case 4: // 0x84, blue return bluemap; - case 5: // 0x85, red + case 5: // 0x85, red return redmap; - case 6: // 0x86, gray + case 6: // 0x86, gray return graymap; - case 7: // 0x87, orange + case 7: // 0x87, orange return orangemap; - case 8: // 0x88, sky + case 8: // 0x88, sky return skymap; + case 9: // 0x89, lavender + return lavendermap; + case 10: // 0x8A, gold + return goldmap; + case 11: // 0x8B, tea-green + return teamap; + case 12: // 0x8C, steel + return steelmap; + case 13: // 0x8D, pink + return pinkmap; + case 14: // 0x8E, teal + return tealmap; + case 15: // 0x8F, peach + return peachmap; default: // reset return NULL; } @@ -1359,7 +1373,7 @@ char *V_WordWrap(INT32 x, INT32 w, INT32 option, const char *string) for (i = 0; i < slen; ++i) { c = newstring[i]; - if ((UINT8)c >= 0x80 && (UINT8)c <= 0x89) //color parsing! -Inuyasha 2.16.09 + if ((UINT8)c >= 0x80 && (UINT8)c <= 0x8F) //color parsing! -Inuyasha 2.16.09 continue; if (c == '\n') @@ -1424,6 +1438,7 @@ void V_DrawString(INT32 x, INT32 y, INT32 option, const char *string) } charflags = (option & V_CHARCOLORMASK); + colormap = V_GetStringColormap(charflags); switch (option & V_SPACINGMASK) { @@ -1447,7 +1462,10 @@ void V_DrawString(INT32 x, INT32 y, INT32 option, const char *string) { // manually set flags override color codes if (!(option & V_CHARCOLORMASK)) + { charflags = ((*ch & 0x7f) << V_CHARCOLORSHIFT) & V_CHARCOLORMASK; + colormap = V_GetStringColormap(charflags); + } continue; } if (*ch == '\n') @@ -1490,7 +1508,6 @@ void V_DrawString(INT32 x, INT32 y, INT32 option, const char *string) continue; } - colormap = V_GetStringColormap(charflags); V_DrawFixedPatch((cx + center)<= 0x80 && (UINT8)c <= 0x89) //color parsing! -Inuyasha 2.16.09 + if ((UINT8)c >= 0x80 && (UINT8)c <= 0x8F) //color parsing! -Inuyasha 2.16.09 continue; c = toupper(c) - HU_FONTSTART; @@ -2192,7 +2218,7 @@ INT32 V_SmallStringWidth(const char *string, INT32 option) for (i = 0; i < strlen(string); i++) { c = string[i]; - if ((UINT8)c >= 0x80 && (UINT8)c <= 0x89) //color parsing! -Inuyasha 2.16.09 + if ((UINT8)c >= 0x80 && (UINT8)c <= 0x8F) //color parsing! -Inuyasha 2.16.09 continue; c = toupper(c) - HU_FONTSTART; @@ -2232,7 +2258,7 @@ INT32 V_ThinStringWidth(const char *string, INT32 option) for (i = 0; i < strlen(string); i++) { c = string[i]; - if ((UINT8)c >= 0x80 && (UINT8)c <= 0x89) //color parsing! -Inuyasha 2.16.09 + if ((UINT8)c >= 0x80 && (UINT8)c <= 0x8F) //color parsing! -Inuyasha 2.16.09 continue; c = toupper(c) - HU_FONTSTART; diff --git a/src/v_video.h b/src/v_video.h index e118d5cf..f6826cf7 100644 --- a/src/v_video.h +++ b/src/v_video.h @@ -66,8 +66,6 @@ extern UINT8 hudtrans; #define V_MONOSPACE 0x00000C00 // Don't do width checks on characters, all characters 8 width // use bits 13-16 for colors -// though we only have 7 colors now, perhaps we can introduce -// more as needed later #define V_CHARCOLORSHIFT 12 #define V_CHARCOLORMASK 0x0000F000 // for simplicity's sake, shortcuts to specific colors @@ -79,6 +77,13 @@ extern UINT8 hudtrans; #define V_GRAYMAP 0x00006000 #define V_ORANGEMAP 0x00007000 #define V_SKYMAP 0x00008000 +#define V_LAVENDERMAP 0x00009000 +#define V_GOLDMAP 0x0000A000 +#define V_TEAMAP 0x0000B000 +#define V_STEELMAP 0x0000C000 +#define V_PINKMAP 0x0000D000 +#define V_TEALMAP 0x0000E000 +#define V_PEACHMAP 0x0000F000 // use bits 17-20 for alpha transparency #define V_ALPHASHIFT 16 @@ -157,7 +162,7 @@ void V_DrawFadeConsBack(INT32 plines); void V_DrawCharacter(INT32 x, INT32 y, INT32 c, boolean lowercaseallowed); // draw a single character, but for the chat void V_DrawChatCharacter(INT32 x, INT32 y, INT32 c, boolean lowercaseallowed, UINT8 *colormap); -const UINT8 *V_GetStringColormap(INT32 colorflags); +UINT8 *V_GetStringColormap(INT32 colorflags); void V_DrawLevelTitle(INT32 x, INT32 y, INT32 option, const char *string);