From c323b821d6112a5b9bc3451df0de0f4da1c93514 Mon Sep 17 00:00:00 2001 From: Latapostrophe Date: Fri, 31 Aug 2018 13:30:40 +0200 Subject: [PATCH 1/9] Coloured names for chat --- src/hu_stuff.c | 34 ++++++++++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/src/hu_stuff.c b/src/hu_stuff.c index 36b2812e..b82ffe26 100644 --- a/src/hu_stuff.c +++ b/src/hu_stuff.c @@ -757,8 +757,37 @@ static void Got_Saycmd(UINT8 **p, INT32 playernum) } else if (target == 0) // To everyone { - fmt = "\3%s\x83<%s%s%s\x83>\x80 %s\n"; - fmt2 = "%s\x83<%s%s%s\x83>\x80 %s"; + + + /* 31/8/18: Lat': Exclusive to kart, use a CLOSE ENOUGH colour to the player's for text (we're quite limited with our options, + drawstring really should be able to remap to any palette index........*/ + + // there's a lot of fucking colors wtf + INT32 color = players[playernum].mo->color; + if (color >= SKINCOLOR_IVORY && color <= SKINCOLOR_SILVER) + prefix = "\x80"; + else if ((color >= SKINCOLOR_CLOUDY && color <= SKINCOLOR_BLACK) || color == SKINCOLOR_JET) // jet is more black than blue so it goes here. + prefix = "\x86"; + else if (color >= SKINCOLOR_SALMON && color <= SKINCOLOR_CRIMSON) + prefix = "\x85"; + else if (color >= SKINCOLOR_DAWN && color <= SKINCOLOR_CARAMEL) + prefix = "\x87"; + else if (color >= SKINCOLOR_TANGERINE && color <= SKINCOLOR_CANARY) + prefix = "\x82"; + else if (color >= SKINCOLOR_OLIVE && color <= SKINCOLOR_SWAMP) + prefix = "\x83"; + else if ((color >= SKINCOLOR_AQUA && color <= SKINCOLOR_STEEL) || color == SKINCOLOR_SAPPHIRE) // toaster wanted that specific one too shrug + prefix = "\x88"; + else if (color >= SKINCOLOR_PERIWINKLE && color <= SKINCOLOR_NAVY) + prefix = "\x84"; + else if (color >= SKINCOLOR_DUSK && color <= SKINCOLOR_LILAC) + prefix = "\x81"; + else + prefix = "\x83"; + + strcat(cstart, prefix); + fmt = "\3%s<%s%s%s>\x80 %s\n"; + fmt2 = "%s<%s%s%s>\x80 %s"; } else if (target-1 == consoleplayer) // To you { @@ -793,6 +822,7 @@ static void Got_Saycmd(UINT8 **p, INT32 playernum) } + HU_AddChatText(va(fmt2, prefix, cstart, dispname, cend, msg)); // add it reguardless, in case we decide to change our mind about our chat type. if OLDCHAT From c9303cb180977d43850cda5757bc4d79327c3aa7 Mon Sep 17 00:00:00 2001 From: Latapostrophe Date: Fri, 31 Aug 2018 13:52:53 +0200 Subject: [PATCH 2/9] Cleaned up a little, courtesy of toaster --- src/hu_stuff.c | 42 ++++++++++++++++++++---------------------- 1 file changed, 20 insertions(+), 22 deletions(-) diff --git a/src/hu_stuff.c b/src/hu_stuff.c index b82ffe26..4eeaa79c 100644 --- a/src/hu_stuff.c +++ b/src/hu_stuff.c @@ -763,28 +763,26 @@ static void Got_Saycmd(UINT8 **p, INT32 playernum) drawstring really should be able to remap to any palette index........*/ // there's a lot of fucking colors wtf - INT32 color = players[playernum].mo->color; - if (color >= SKINCOLOR_IVORY && color <= SKINCOLOR_SILVER) - prefix = "\x80"; - else if ((color >= SKINCOLOR_CLOUDY && color <= SKINCOLOR_BLACK) || color == SKINCOLOR_JET) // jet is more black than blue so it goes here. - prefix = "\x86"; - else if (color >= SKINCOLOR_SALMON && color <= SKINCOLOR_CRIMSON) - prefix = "\x85"; - else if (color >= SKINCOLOR_DAWN && color <= SKINCOLOR_CARAMEL) - prefix = "\x87"; - else if (color >= SKINCOLOR_TANGERINE && color <= SKINCOLOR_CANARY) - prefix = "\x82"; - else if (color >= SKINCOLOR_OLIVE && color <= SKINCOLOR_SWAMP) - prefix = "\x83"; - else if ((color >= SKINCOLOR_AQUA && color <= SKINCOLOR_STEEL) || color == SKINCOLOR_SAPPHIRE) // toaster wanted that specific one too shrug - prefix = "\x88"; - else if (color >= SKINCOLOR_PERIWINKLE && color <= SKINCOLOR_NAVY) - prefix = "\x84"; - else if (color >= SKINCOLOR_DUSK && color <= SKINCOLOR_LILAC) - prefix = "\x81"; - else - prefix = "\x83"; - + const UINT8 color = players[playernum].skincolor; + if (color <= SKINCOLOR_SILVER) + prefix = "\x80"; + else if (color <= SKINCOLOR_BLACK || color == SKINCOLOR_JET) // jet is more black than blue so it goes here. + prefix = "\x86"; + else if (color <= SKINCOLOR_CRIMSON) + prefix = "\x85"; + else if (color <= SKINCOLOR_CARAMEL) + prefix = "\x87"; + else if (color <= SKINCOLOR_CANARY) + prefix = "\x82"; + else if (color <= SKINCOLOR_SWAMP) + prefix = "\x83"; + else if (color <= SKINCOLOR_STEEL || color == SKINCOLOR_SAPPHIRE) // toaster wanted that specific one too shrug + prefix = "\x88"; + else if (color <= SKINCOLOR_NAVY) + prefix = "\x84"; + else + prefix = "\x81"; + strcat(cstart, prefix); fmt = "\3%s<%s%s%s>\x80 %s\n"; fmt2 = "%s<%s%s%s>\x80 %s"; From 8bb8eef99793c1082b72f8640edb5818208befd5 Mon Sep 17 00:00:00 2001 From: Latapostrophe Date: Fri, 31 Aug 2018 13:56:11 +0200 Subject: [PATCH 3/9] Removed that one empty space thing --- src/hu_stuff.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/hu_stuff.c b/src/hu_stuff.c index 4eeaa79c..e6650593 100644 --- a/src/hu_stuff.c +++ b/src/hu_stuff.c @@ -820,7 +820,6 @@ static void Got_Saycmd(UINT8 **p, INT32 playernum) } - HU_AddChatText(va(fmt2, prefix, cstart, dispname, cend, msg)); // add it reguardless, in case we decide to change our mind about our chat type. if OLDCHAT From ccc6f719808ebc8c48fe2c6b1c2fbc1ed291ccc7 Mon Sep 17 00:00:00 2001 From: Latapostrophe Date: Fri, 31 Aug 2018 15:02:48 +0200 Subject: [PATCH 4/9] Cleanup + coloured text for spectators / PMs --- src/hu_stuff.c | 99 ++++++++++++++++++++++---------------------------- 1 file changed, 44 insertions(+), 55 deletions(-) diff --git a/src/hu_stuff.c b/src/hu_stuff.c index e6650593..29303157 100644 --- a/src/hu_stuff.c +++ b/src/hu_stuff.c @@ -713,24 +713,41 @@ static void Got_Saycmd(UINT8 **p, INT32 playernum) || target == 0 // To everyone || consoleplayer == target-1) // To you { - const char *prefix = "", *cstart = "", *cend = "", *adminchar = "\x82~\x83", *remotechar = "\x82@\x83", *fmt, *fmt2; + const char *prefix = "", *cstart = "", *cend = "", *adminchar = "\x82~\x83", *remotechar = "\x82@\x83", *fmt, *fmt2, *textcolor = "\x80"; char *tempchar = NULL; - // In CTF and team match, color the player's name. - if (G_GametypeHasTeams()) - { - cend = ""; - if (players[playernum].ctfteam == 1) // red - cstart = "\x85"; - else if (players[playernum].ctfteam == 2) // blue - cstart = "\x84"; - - } - // player is a spectator? - if (players[playernum].spectator) - cstart = "\x86"; // grey name - + if (players[playernum].spectator) + { + cstart = "\x86"; // grey name + textcolor = "\x86"; + } + else + { + const UINT8 color = players[playernum].skincolor; + if (color >= SKINCOLOR_IVORY && color <= SKINCOLOR_SILVER) + cstart = "\x80"; + else if ((color >= SKINCOLOR_CLOUDY && color <= SKINCOLOR_BLACK) || color == SKINCOLOR_JET) // jet is more black than blue so it goes here. + cstart = "\x86"; + else if (color >= SKINCOLOR_SALMON && color <= SKINCOLOR_CRIMSON) + cstart = "\x85"; + else if (color >= SKINCOLOR_DAWN && color <= SKINCOLOR_CARAMEL) + cstart = "\x87"; + else if (color >= SKINCOLOR_TANGERINE && color <= SKINCOLOR_CANARY) + cstart = "\x82"; + else if (color >= SKINCOLOR_OLIVE && color <= SKINCOLOR_SWAMP) + cstart = "\x83"; + else if ((color >= SKINCOLOR_AQUA && color <= SKINCOLOR_STEEL) || color == SKINCOLOR_SAPPHIRE) // toaster wanted that specific one too shrug + cstart = "\x88"; + else if (color >= SKINCOLOR_PERIWINKLE && color <= SKINCOLOR_NAVY) + cstart = "\x84"; + else if (color >= SKINCOLOR_DUSK && color <= SKINCOLOR_LILAC) + cstart = "\x81"; + else + cstart = "\x83"; + } + prefix = cstart; + // Give admins and remote admins their symbols. if (playernum == serverplayer) tempchar = (char *)Z_Calloc(strlen(cstart) + strlen(adminchar) + 1, PU_STATIC, NULL); @@ -757,53 +774,25 @@ static void Got_Saycmd(UINT8 **p, INT32 playernum) } else if (target == 0) // To everyone { - - - /* 31/8/18: Lat': Exclusive to kart, use a CLOSE ENOUGH colour to the player's for text (we're quite limited with our options, - drawstring really should be able to remap to any palette index........*/ - - // there's a lot of fucking colors wtf - const UINT8 color = players[playernum].skincolor; - if (color <= SKINCOLOR_SILVER) - prefix = "\x80"; - else if (color <= SKINCOLOR_BLACK || color == SKINCOLOR_JET) // jet is more black than blue so it goes here. - prefix = "\x86"; - else if (color <= SKINCOLOR_CRIMSON) - prefix = "\x85"; - else if (color <= SKINCOLOR_CARAMEL) - prefix = "\x87"; - else if (color <= SKINCOLOR_CANARY) - prefix = "\x82"; - else if (color <= SKINCOLOR_SWAMP) - prefix = "\x83"; - else if (color <= SKINCOLOR_STEEL || color == SKINCOLOR_SAPPHIRE) // toaster wanted that specific one too shrug - prefix = "\x88"; - else if (color <= SKINCOLOR_NAVY) - prefix = "\x84"; - else - prefix = "\x81"; - - strcat(cstart, prefix); - fmt = "\3%s<%s%s%s>\x80 %s\n"; - fmt2 = "%s<%s%s%s>\x80 %s"; + fmt = "\3%s<%s%s%s>\x80 %s%s\n"; + fmt2 = "%s<%s%s%s>\x80 %s%s"; } else if (target-1 == consoleplayer) // To you { prefix = "\x82[PM]"; cstart = "\x82"; - fmt = "\4%s<%s%s>%s\x80 %s\n"; // make this yellow, however. - fmt2 = "%s<%s%s>%s\x80 %s"; + textcolor = "\x82"; + fmt = "\4%s<%s%s>%s\x80 %s%s\n"; // make this yellow, however. + fmt2 = "%s<%s%s>%s\x80 %s%s"; } else if (target > 0) // By you, to another player { // Use target's name. dispname = player_names[target-1]; - /*fmt = "\3\x82[TO]\x80%s%s%s* %s\n"; - fmt2 = "\x82[TO]\x80%s%s%s* %s";*/ prefix = "\x82[TO]"; cstart = "\x82"; - fmt = "\4%s<%s%s>%s\x80 %s\n"; // make this yellow, however. - fmt2 = "%s<%s%s>%s\x80 %s"; + fmt = "\4%s<%s%s>%s\x80 %s%s\n"; // make this yellow, however. + fmt2 = "%s<%s%s>%s\x80 %s%s"; } else // To your team @@ -815,17 +804,17 @@ static void Got_Saycmd(UINT8 **p, INT32 playernum) else prefix = "\x83"; // makes sure this doesn't implode if you sayteam on non-team gamemodes - fmt = "\3%s<%s%s>\x80%s %s\n"; - fmt2 = "%s<%s%s>\x80%s %s"; + fmt = "\3%s<%s%s>\x80%s %s%s\n"; + fmt2 = "%s<%s%s>\x80%s %s%s"; } - HU_AddChatText(va(fmt2, prefix, cstart, dispname, cend, msg)); // add it reguardless, in case we decide to change our mind about our chat type. + HU_AddChatText(va(fmt2, prefix, cstart, dispname, cend, textcolor, msg)); // add it reguardless, in case we decide to change our mind about our chat type. if OLDCHAT - CONS_Printf(fmt, prefix, cstart, dispname, cend, msg); + CONS_Printf(fmt, prefix, cstart, dispname, cend, textcolor, msg); else - CON_LogMessage(va(fmt, prefix, cstart, dispname, cend, msg)); // save to log.txt + CON_LogMessage(va(fmt, prefix, cstart, dispname, cend, textcolor, msg)); // save to log.txt if (tempchar) Z_Free(tempchar); From 0bb24a392eb5bb5754cb25705e3e07c336cdc83c Mon Sep 17 00:00:00 2001 From: Latapostrophe Date: Sun, 16 Sep 2018 11:01:00 +0200 Subject: [PATCH 5/9] Fixed crash when replacing first character. --- src/hu_stuff.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/hu_stuff.c b/src/hu_stuff.c index 29303157..794a89d7 100644 --- a/src/hu_stuff.c +++ b/src/hu_stuff.c @@ -856,6 +856,9 @@ static inline boolean HU_keyInChatString(char *s, char ch) { if (s[m]) s[m+1] = (s[m]); + + if (m < 1) + break; // fix the chat going ham if your replace the first character. (For whatever reason this didn't happen in vanilla????) } s[c_input] = ch; // and replace this. } From 4320e0f3a8e9edec4e8f5b94d8e78227ca282233 Mon Sep 17 00:00:00 2001 From: Latapostrophe Date: Fri, 21 Sep 2018 12:23:00 +0200 Subject: [PATCH 6/9] Fix visual error related to moving the cursor on multi-line messages. --- src/hu_stuff.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hu_stuff.c b/src/hu_stuff.c index 794a89d7..cab5937c 100644 --- a/src/hu_stuff.c +++ b/src/hu_stuff.c @@ -1565,7 +1565,7 @@ static void HU_DrawChat(void) if (hu_tick < 4) V_DrawChatCharacter(cursorx, cursory+1, '_' |V_SNAPTOBOTTOM|V_SNAPTOLEFT|t, !cv_allcaps.value, NULL); - if (cursorx == chatx+1) // a weirdo hack + if (cursorx == chatx+1 && strlen(w_chat) == i) // a weirdo hack { typelines += 1; skippedline = true; From 58a0206783a88bd1bd65c8703f814fdacdc7fb15 Mon Sep 17 00:00:00 2001 From: Latapostrophe Date: Fri, 21 Sep 2018 17:03:09 +0200 Subject: [PATCH 7/9] Moved strlen(w_chat) out of the loop. --- src/hu_stuff.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/hu_stuff.c b/src/hu_stuff.c index cab5937c..77b87328 100644 --- a/src/hu_stuff.c +++ b/src/hu_stuff.c @@ -1523,6 +1523,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! const char *ntalk = "Say: ", *ttalk = "Team: "; const char *talk = ntalk; @@ -1538,7 +1539,7 @@ static void HU_DrawChat(void) } V_DrawFillConsoleMap(chatx, y-1, cv_chatwidth.value, (typelines*charheight), 239 | V_SNAPTOBOTTOM | V_SNAPTOLEFT); - + while (talk[i]) { if (talk[i] < HU_FONTSTART) @@ -1565,7 +1566,7 @@ static void HU_DrawChat(void) if (hu_tick < 4) V_DrawChatCharacter(cursorx, cursory+1, '_' |V_SNAPTOBOTTOM|V_SNAPTOLEFT|t, !cv_allcaps.value, NULL); - if (cursorx == chatx+1 && strlen(w_chat) == i) // a weirdo hack + if (cursorx == chatx+1 && saylen == i) // a weirdo hack { typelines += 1; skippedline = true; From 3a766057722b0824dd43179ef3489da092f1ae33 Mon Sep 17 00:00:00 2001 From: toaster Date: Sat, 22 Sep 2018 18:22:04 +0100 Subject: [PATCH 8/9] * Seven new text colours! Gold, Lavender, Tea-green, Steel, Pink, Teal, and Peach, all added to the menu highlights cvar. * Revamp the saycmd colour list to take advantage of them. Peach and Purple are used the least... * In all of the string drawers, replace colormap only when charflags changes. * Add V_SKYMAP to dehacked.c alongside the above (oversight from when I added it yonks ago...) --- src/console.c | 68 +++++++++++++++++++++++++------------- src/console.h | 3 +- src/dehacked.c | 8 +++++ src/hu_stuff.c | 89 +++++++++++++++++++++----------------------------- src/v_video.c | 60 ++++++++++++++++++++++++---------- src/v_video.h | 11 +++++-- 6 files changed, 143 insertions(+), 96 deletions(-) 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); From 81c04480f91b43ddc78e761eaaeb2113b9ca9231 Mon Sep 17 00:00:00 2001 From: toaster Date: Sat, 22 Sep 2018 20:56:44 +0100 Subject: [PATCH 9/9] List update as requested by Sal --- src/hu_stuff.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/hu_stuff.c b/src/hu_stuff.c index 33d4f2aa..ab427b48 100644 --- a/src/hu_stuff.c +++ b/src/hu_stuff.c @@ -725,13 +725,13 @@ static void Got_Saycmd(UINT8 **p, INT32 playernum) else { const UINT8 color = players[playernum].skincolor; - if (color <= SKINCOLOR_SILVER) + if (color <= SKINCOLOR_SILVER || color == SKINCOLOR_SLATE) 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) + else if (color <= SKINCOLOR_ROSE || color == SKINCOLOR_LILAC) cstart = "\x8d"; // V_PINKMAP else if (color <= SKINCOLOR_KETCHUP) cstart = "\x85"; // V_REDMAP @@ -741,11 +741,11 @@ static void Got_Saycmd(UINT8 **p, INT32 playernum) cstart = "\x8f"; // V_PEACHMAP else if (color <= SKINCOLOR_BRONZE) cstart = "\x8A"; // V_GOLDMAP - else if (color <= SKINCOLOR_MUSTARD || color == SKINCOLOR_LIME) + else if (color <= SKINCOLOR_MUSTARD) cstart = "\x82"; // V_YELLOWMAP else if (color <= SKINCOLOR_PISTACHIO) cstart = "\x8b"; // V_TEAMAP - else if (color <= SKINCOLOR_SWAMP) + else if (color <= SKINCOLOR_SWAMP || color == SKINCOLOR_LIME) cstart = "\x83"; // V_GREENMAP else if (color <= SKINCOLOR_TEAL) cstart = "\x8e"; // V_TEALMAP