Merge branch 'chat-changes' into 'master'
Chat changes See merge request KartKrew/Kart!10
This commit is contained in:
commit
09b30c660c
|
@ -150,6 +150,13 @@ static CV_PossibleValue_t menuhighlight_cons_t[] =
|
||||||
{V_GRAYMAP, "Always gray"},
|
{V_GRAYMAP, "Always gray"},
|
||||||
{V_ORANGEMAP, "Always orange"},
|
{V_ORANGEMAP, "Always orange"},
|
||||||
{V_SKYMAP, "Always sky-blue"},
|
{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}
|
{0, NULL}
|
||||||
};
|
};
|
||||||
consvar_t cons_menuhighlight = {"menuhighlight", "Game type", CV_SAVE, menuhighlight_cons_t, NULL, 0, NULL, NULL, 0, 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
|
// 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
|
// Console BG color
|
||||||
UINT8 *consolebgmap = NULL;
|
UINT8 *consolebgmap = NULL;
|
||||||
|
|
||||||
|
@ -284,10 +286,16 @@ static void CONS_backcolor_Change(void)
|
||||||
CON_SetupBackColormap();
|
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)
|
static void CON_SetupColormaps(void)
|
||||||
{
|
{
|
||||||
INT32 i;
|
INT32 i;
|
||||||
UINT8 *memorysrc = (UINT8 *)Z_Malloc((256*8), PU_STATIC, NULL);
|
UINT8 *memorysrc = (UINT8 *)Z_Malloc((256*15), PU_STATIC, NULL);
|
||||||
|
|
||||||
purplemap = memorysrc;
|
purplemap = memorysrc;
|
||||||
yellowmap = (purplemap+256);
|
yellowmap = (purplemap+256);
|
||||||
|
@ -297,13 +305,20 @@ static void CON_SetupColormaps(void)
|
||||||
graymap = (redmap+256);
|
graymap = (redmap+256);
|
||||||
orangemap = (graymap+256);
|
orangemap = (graymap+256);
|
||||||
skymap = (orangemap+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
|
// setup the other colormaps, for console text
|
||||||
|
|
||||||
// these don't need to be aligned, unless you convert the
|
// these don't need to be aligned, unless you convert the
|
||||||
// V_DrawMappedPatch() into optimised asm.
|
// 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...
|
*memorysrc = (UINT8)(i & 0xFF); // remap each color to itself...
|
||||||
|
|
||||||
// SRB2Kart: Different console font, new colors
|
// SRB2Kart: Different console font, new colors
|
||||||
|
@ -311,10 +326,17 @@ static void CON_SetupColormaps(void)
|
||||||
yellowmap[120] = (UINT8)103;
|
yellowmap[120] = (UINT8)103;
|
||||||
greenmap[120] = (UINT8)162;
|
greenmap[120] = (UINT8)162;
|
||||||
bluemap[120] = (UINT8)228;
|
bluemap[120] = (UINT8)228;
|
||||||
graymap[120] = (UINT8)10;
|
|
||||||
redmap[120] = (UINT8)126; // battle
|
redmap[120] = (UINT8)126; // battle
|
||||||
|
graymap[120] = (UINT8)10;
|
||||||
orangemap[120] = (UINT8)85; // record attack
|
orangemap[120] = (UINT8)85; // record attack
|
||||||
skymap[120] = (UINT8)214; // race
|
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
|
// Init back colormap
|
||||||
CON_SetupBackColormap();
|
CON_SetupBackColormap();
|
||||||
|
|
|
@ -38,7 +38,8 @@ extern UINT32 con_scalefactor; // console text scale factor
|
||||||
|
|
||||||
extern consvar_t cons_backcolor, cons_menuhighlight;
|
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)
|
// Console bg color (auto updated to match)
|
||||||
extern UINT8 *consolebgmap;
|
extern UINT8 *consolebgmap;
|
||||||
|
|
|
@ -8206,6 +8206,14 @@ struct {
|
||||||
{"V_REDMAP",V_REDMAP},
|
{"V_REDMAP",V_REDMAP},
|
||||||
{"V_GRAYMAP",V_GRAYMAP},
|
{"V_GRAYMAP",V_GRAYMAP},
|
||||||
{"V_ORANGEMAP",V_ORANGEMAP},
|
{"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_TRANSLUCENT",V_TRANSLUCENT},
|
||||||
{"V_10TRANS",V_10TRANS},
|
{"V_10TRANS",V_10TRANS},
|
||||||
{"V_20TRANS",V_20TRANS},
|
{"V_20TRANS",V_20TRANS},
|
||||||
|
|
125
src/hu_stuff.c
125
src/hu_stuff.c
|
@ -713,23 +713,54 @@ static void Got_Saycmd(UINT8 **p, INT32 playernum)
|
||||||
|| target == 0 // To everyone
|
|| target == 0 // To everyone
|
||||||
|| consoleplayer == target-1) // To you
|
|| 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;
|
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?
|
// player is a spectator?
|
||||||
if (players[playernum].spectator)
|
if (players[playernum].spectator)
|
||||||
|
{
|
||||||
cstart = "\x86"; // grey name
|
cstart = "\x86"; // grey name
|
||||||
|
textcolor = "\x86";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
const UINT8 color = players[playernum].skincolor;
|
||||||
|
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_LILAC)
|
||||||
|
cstart = "\x8d"; // V_PINKMAP
|
||||||
|
else if (color <= SKINCOLOR_KETCHUP)
|
||||||
|
cstart = "\x85"; // V_REDMAP
|
||||||
|
else if (color <= SKINCOLOR_TANGERINE)
|
||||||
|
cstart = "\x87"; // V_ORANGEMAP
|
||||||
|
else if (color <= SKINCOLOR_CARAMEL)
|
||||||
|
cstart = "\x8f"; // V_PEACHMAP
|
||||||
|
else if (color <= SKINCOLOR_BRONZE)
|
||||||
|
cstart = "\x8A"; // V_GOLDMAP
|
||||||
|
else if (color <= SKINCOLOR_MUSTARD)
|
||||||
|
cstart = "\x82"; // V_YELLOWMAP
|
||||||
|
else if (color <= SKINCOLOR_PISTACHIO)
|
||||||
|
cstart = "\x8b"; // V_TEAMAP
|
||||||
|
else if (color <= SKINCOLOR_SWAMP || color == SKINCOLOR_LIME)
|
||||||
|
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;
|
||||||
|
|
||||||
// Give admins and remote admins their symbols.
|
// Give admins and remote admins their symbols.
|
||||||
if (playernum == serverplayer)
|
if (playernum == serverplayer)
|
||||||
|
@ -757,26 +788,25 @@ static void Got_Saycmd(UINT8 **p, INT32 playernum)
|
||||||
}
|
}
|
||||||
else if (target == 0) // To everyone
|
else if (target == 0) // To everyone
|
||||||
{
|
{
|
||||||
fmt = "\3%s\x83<%s%s%s\x83>\x80 %s\n";
|
fmt = "\3%s<%s%s%s>\x80 %s%s\n";
|
||||||
fmt2 = "%s\x83<%s%s%s\x83>\x80 %s";
|
fmt2 = "%s<%s%s%s>\x80 %s%s";
|
||||||
}
|
}
|
||||||
else if (target-1 == consoleplayer) // To you
|
else if (target-1 == consoleplayer) // To you
|
||||||
{
|
{
|
||||||
prefix = "\x82[PM]";
|
prefix = "\x82[PM]";
|
||||||
cstart = "\x82";
|
cstart = "\x82";
|
||||||
fmt = "\4%s<%s%s>%s\x80 %s\n"; // make this yellow, however.
|
textcolor = "\x82";
|
||||||
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 if (target > 0) // By you, to another player
|
else if (target > 0) // By you, to another player
|
||||||
{
|
{
|
||||||
// Use target's name.
|
// Use target's name.
|
||||||
dispname = player_names[target-1];
|
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]";
|
prefix = "\x82[TO]";
|
||||||
cstart = "\x82";
|
cstart = "\x82";
|
||||||
fmt = "\4%s<%s%s>%s\x80 %s\n"; // make this yellow, however.
|
fmt = "\4%s<%s%s>%s\x80 %s%s\n"; // make this yellow, however.
|
||||||
fmt2 = "%s<%s%s>%s\x80 %s";
|
fmt2 = "%s<%s%s>%s\x80 %s%s";
|
||||||
|
|
||||||
}
|
}
|
||||||
else // To your team
|
else // To your team
|
||||||
|
@ -788,17 +818,17 @@ static void Got_Saycmd(UINT8 **p, INT32 playernum)
|
||||||
else
|
else
|
||||||
prefix = "\x83"; // makes sure this doesn't implode if you sayteam on non-team gamemodes
|
prefix = "\x83"; // makes sure this doesn't implode if you sayteam on non-team gamemodes
|
||||||
|
|
||||||
fmt = "\3%s<%s%s>\x80%s %s\n";
|
fmt = "\3%s<%s%s>\x80%s %s%s\n";
|
||||||
fmt2 = "%s<%s%s>\x80%s %s";
|
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
|
if OLDCHAT
|
||||||
CONS_Printf(fmt, prefix, cstart, dispname, cend, msg);
|
CONS_Printf(fmt, prefix, cstart, dispname, cend, textcolor, msg);
|
||||||
else
|
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)
|
if (tempchar)
|
||||||
Z_Free(tempchar);
|
Z_Free(tempchar);
|
||||||
|
@ -840,6 +870,9 @@ static inline boolean HU_keyInChatString(char *s, char ch)
|
||||||
{
|
{
|
||||||
if (s[m])
|
if (s[m])
|
||||||
s[m+1] = (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.
|
s[c_input] = ch; // and replace this.
|
||||||
}
|
}
|
||||||
|
@ -1152,33 +1185,6 @@ boolean HU_Responder(event_t *ev)
|
||||||
// HEADS UP DRAWING
|
// 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.
|
// Precompile a wordwrapped string to any given width.
|
||||||
// This is a muuuch better method than V_WORDWRAP.
|
// 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.
|
// again stolen and modified a bit from video.c, don't mind me, will need to rearrange this one day.
|
||||||
|
@ -1197,7 +1203,7 @@ static char *CHAT_WordWrap(INT32 x, INT32 w, INT32 option, const char *string)
|
||||||
for (i = 0; i < slen; ++i)
|
for (i = 0; i < slen; ++i)
|
||||||
{
|
{
|
||||||
c = newstring[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;
|
continue;
|
||||||
|
|
||||||
if (c == '\n')
|
if (c == '\n')
|
||||||
|
@ -1314,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.
|
INT32 transflag = (timer >= 0 && timer <= 9) ? (timer*V_10TRANS) : 0; // you can make bad jokes out of this one.
|
||||||
size_t j = 0;
|
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.
|
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
|
while(msg[j]) // iterate through msg
|
||||||
{
|
{
|
||||||
|
@ -1333,6 +1340,7 @@ static void HU_drawMiniChat(void)
|
||||||
else if (msg[j] & 0x80) // stolen from video.c, nice.
|
else if (msg[j] & 0x80) // stolen from video.c, nice.
|
||||||
{
|
{
|
||||||
clrflag = ((msg[j] & 0x7f) << V_CHARCOLORSHIFT) & V_CHARCOLORMASK;
|
clrflag = ((msg[j] & 0x7f) << V_CHARCOLORSHIFT) & V_CHARCOLORMASK;
|
||||||
|
colormap = V_GetStringColormap(clrflag);
|
||||||
++j;
|
++j;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -1341,8 +1349,6 @@ static void HU_drawMiniChat(void)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
UINT8 *colormap = CHAT_GetStringColormap(clrflag);
|
|
||||||
|
|
||||||
if (cv_chatbacktint.value) // on request of wolfy
|
if (cv_chatbacktint.value) // on request of wolfy
|
||||||
V_DrawFillConsoleMap(x + dx + 2, y+dy, charwidth, charheight, 239|V_SNAPTOBOTTOM|V_SNAPTOLEFT);
|
V_DrawFillConsoleMap(x + dx + 2, y+dy, charwidth, charheight, 239|V_SNAPTOBOTTOM|V_SNAPTOLEFT);
|
||||||
|
|
||||||
|
@ -1392,6 +1398,7 @@ static void HU_drawChatLog(INT32 offset)
|
||||||
INT32 clrflag = 0;
|
INT32 clrflag = 0;
|
||||||
INT32 j = 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.
|
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
|
while(msg[j]) // iterate through msg
|
||||||
{
|
{
|
||||||
if (msg[j] < HU_FONTSTART) // don't draw
|
if (msg[j] < HU_FONTSTART) // don't draw
|
||||||
|
@ -1406,6 +1413,7 @@ static void HU_drawChatLog(INT32 offset)
|
||||||
else if (msg[j] & 0x80) // stolen from video.c, nice.
|
else if (msg[j] & 0x80) // stolen from video.c, nice.
|
||||||
{
|
{
|
||||||
clrflag = ((msg[j] & 0x7f) << V_CHARCOLORSHIFT) & V_CHARCOLORMASK;
|
clrflag = ((msg[j] & 0x7f) << V_CHARCOLORSHIFT) & V_CHARCOLORMASK;
|
||||||
|
colormap = V_GetStringColormap(clrflag);
|
||||||
++j;
|
++j;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -1415,10 +1423,7 @@ static void HU_drawChatLog(INT32 offset)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ((y+dy+2 >= chat_topy) && (y+dy < (chat_bottomy)))
|
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);
|
V_DrawChatCharacter(x + dx + 2, y+dy+2, msg[j++] |V_SNAPTOBOTTOM|V_SNAPTOLEFT, !cv_allcaps.value, colormap);
|
||||||
}
|
|
||||||
else
|
else
|
||||||
j++; // don't forget to increment this or we'll get stuck in the limbo.
|
j++; // don't forget to increment this or we'll get stuck in the limbo.
|
||||||
}
|
}
|
||||||
|
@ -1479,7 +1484,7 @@ static void HU_DrawChat(void)
|
||||||
{
|
{
|
||||||
INT32 charwidth = 4, charheight = 6;
|
INT32 charwidth = 4, charheight = 6;
|
||||||
INT32 t = 0, c = 0, y = chaty - (typelines*charheight) - (cv_kartspeedometer.value ? 16 : 0);
|
INT32 t = 0, c = 0, y = chaty - (typelines*charheight) - (cv_kartspeedometer.value ? 16 : 0);
|
||||||
UINT32 i = 0;
|
UINT32 i = 0, saylen = strlen(w_chat); // You learn new things everyday!
|
||||||
const char *ntalk = "Say: ", *ttalk = "Team: ";
|
const char *ntalk = "Say: ", *ttalk = "Team: ";
|
||||||
const char *talk = ntalk;
|
const char *talk = ntalk;
|
||||||
|
|
||||||
|
@ -1522,7 +1527,7 @@ static void HU_DrawChat(void)
|
||||||
if (hu_tick < 4)
|
if (hu_tick < 4)
|
||||||
V_DrawChatCharacter(cursorx, cursory+1, '_' |V_SNAPTOBOTTOM|V_SNAPTOLEFT|t, !cv_allcaps.value, NULL);
|
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 && saylen == i) // a weirdo hack
|
||||||
{
|
{
|
||||||
typelines += 1;
|
typelines += 1;
|
||||||
skippedline = true;
|
skippedline = true;
|
||||||
|
|
|
@ -1248,7 +1248,7 @@ void V_DrawFadeConsBack(INT32 plines)
|
||||||
|
|
||||||
// Gets string colormap, used for 0x80 color codes
|
// 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)
|
switch ((colorflags & V_CHARCOLORMASK) >> V_CHARCOLORSHIFT)
|
||||||
{
|
{
|
||||||
|
@ -1256,7 +1256,7 @@ const UINT8 *V_GetStringColormap(INT32 colorflags)
|
||||||
return purplemap;
|
return purplemap;
|
||||||
case 2: // 0x82, yellow
|
case 2: // 0x82, yellow
|
||||||
return yellowmap;
|
return yellowmap;
|
||||||
case 3: // 0x83, lgreen
|
case 3: // 0x83, green
|
||||||
return greenmap;
|
return greenmap;
|
||||||
case 4: // 0x84, blue
|
case 4: // 0x84, blue
|
||||||
return bluemap;
|
return bluemap;
|
||||||
|
@ -1268,6 +1268,20 @@ const UINT8 *V_GetStringColormap(INT32 colorflags)
|
||||||
return orangemap;
|
return orangemap;
|
||||||
case 8: // 0x88, sky
|
case 8: // 0x88, sky
|
||||||
return skymap;
|
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
|
default: // reset
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -1359,7 +1373,7 @@ char *V_WordWrap(INT32 x, INT32 w, INT32 option, const char *string)
|
||||||
for (i = 0; i < slen; ++i)
|
for (i = 0; i < slen; ++i)
|
||||||
{
|
{
|
||||||
c = newstring[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;
|
continue;
|
||||||
|
|
||||||
if (c == '\n')
|
if (c == '\n')
|
||||||
|
@ -1424,6 +1438,7 @@ void V_DrawString(INT32 x, INT32 y, INT32 option, const char *string)
|
||||||
}
|
}
|
||||||
|
|
||||||
charflags = (option & V_CHARCOLORMASK);
|
charflags = (option & V_CHARCOLORMASK);
|
||||||
|
colormap = V_GetStringColormap(charflags);
|
||||||
|
|
||||||
switch (option & V_SPACINGMASK)
|
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
|
// manually set flags override color codes
|
||||||
if (!(option & V_CHARCOLORMASK))
|
if (!(option & V_CHARCOLORMASK))
|
||||||
|
{
|
||||||
charflags = ((*ch & 0x7f) << V_CHARCOLORSHIFT) & V_CHARCOLORMASK;
|
charflags = ((*ch & 0x7f) << V_CHARCOLORSHIFT) & V_CHARCOLORMASK;
|
||||||
|
colormap = V_GetStringColormap(charflags);
|
||||||
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (*ch == '\n')
|
if (*ch == '\n')
|
||||||
|
@ -1490,7 +1508,6 @@ void V_DrawString(INT32 x, INT32 y, INT32 option, const char *string)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
colormap = V_GetStringColormap(charflags);
|
|
||||||
V_DrawFixedPatch((cx + center)<<FRACBITS, cy<<FRACBITS, FRACUNIT, option, hu_font[c], colormap);
|
V_DrawFixedPatch((cx + center)<<FRACBITS, cy<<FRACBITS, FRACUNIT, option, hu_font[c], colormap);
|
||||||
|
|
||||||
cx += w;
|
cx += w;
|
||||||
|
@ -1523,6 +1540,7 @@ void V_DrawKartString(INT32 x, INT32 y, INT32 option, const char *string)
|
||||||
}
|
}
|
||||||
|
|
||||||
charflags = (option & V_CHARCOLORMASK);
|
charflags = (option & V_CHARCOLORMASK);
|
||||||
|
colormap = V_GetStringColormap(charflags);
|
||||||
|
|
||||||
switch (option & V_SPACINGMASK)
|
switch (option & V_SPACINGMASK)
|
||||||
{
|
{
|
||||||
|
@ -1546,7 +1564,10 @@ void V_DrawKartString(INT32 x, INT32 y, INT32 option, const char *string)
|
||||||
{
|
{
|
||||||
// manually set flags override color codes
|
// manually set flags override color codes
|
||||||
if (!(option & V_CHARCOLORMASK))
|
if (!(option & V_CHARCOLORMASK))
|
||||||
|
{
|
||||||
charflags = ((*ch & 0x7f) << V_CHARCOLORSHIFT) & V_CHARCOLORMASK;
|
charflags = ((*ch & 0x7f) << V_CHARCOLORSHIFT) & V_CHARCOLORMASK;
|
||||||
|
colormap = V_GetStringColormap(charflags);
|
||||||
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (*ch == '\n')
|
if (*ch == '\n')
|
||||||
|
@ -1589,7 +1610,6 @@ void V_DrawKartString(INT32 x, INT32 y, INT32 option, const char *string)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
colormap = V_GetStringColormap(charflags);
|
|
||||||
V_DrawFixedPatch((cx + center)<<FRACBITS, cy<<FRACBITS, FRACUNIT, option, kart_font[c], colormap);
|
V_DrawFixedPatch((cx + center)<<FRACBITS, cy<<FRACBITS, FRACUNIT, option, kart_font[c], colormap);
|
||||||
|
|
||||||
cx += w;
|
cx += w;
|
||||||
|
@ -1639,6 +1659,7 @@ void V_DrawSmallString(INT32 x, INT32 y, INT32 option, const char *string)
|
||||||
}
|
}
|
||||||
|
|
||||||
charflags = (option & V_CHARCOLORMASK);
|
charflags = (option & V_CHARCOLORMASK);
|
||||||
|
colormap = V_GetStringColormap(charflags);
|
||||||
|
|
||||||
switch (option & V_SPACINGMASK)
|
switch (option & V_SPACINGMASK)
|
||||||
{
|
{
|
||||||
|
@ -1662,7 +1683,10 @@ void V_DrawSmallString(INT32 x, INT32 y, INT32 option, const char *string)
|
||||||
{
|
{
|
||||||
// manually set flags override color codes
|
// manually set flags override color codes
|
||||||
if (!(option & V_CHARCOLORMASK))
|
if (!(option & V_CHARCOLORMASK))
|
||||||
|
{
|
||||||
charflags = ((*ch & 0x7f) << V_CHARCOLORSHIFT) & V_CHARCOLORMASK;
|
charflags = ((*ch & 0x7f) << V_CHARCOLORSHIFT) & V_CHARCOLORMASK;
|
||||||
|
colormap = V_GetStringColormap(charflags);
|
||||||
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (*ch == '\n')
|
if (*ch == '\n')
|
||||||
|
@ -1703,7 +1727,6 @@ void V_DrawSmallString(INT32 x, INT32 y, INT32 option, const char *string)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
colormap = V_GetStringColormap(charflags);
|
|
||||||
V_DrawFixedPatch((cx + center)<<FRACBITS, cy<<FRACBITS, FRACUNIT/2, option, hu_font[c], colormap);
|
V_DrawFixedPatch((cx + center)<<FRACBITS, cy<<FRACBITS, FRACUNIT/2, option, hu_font[c], colormap);
|
||||||
|
|
||||||
cx += w;
|
cx += w;
|
||||||
|
@ -1746,6 +1769,7 @@ void V_DrawThinString(INT32 x, INT32 y, INT32 option, const char *string)
|
||||||
}
|
}
|
||||||
|
|
||||||
charflags = (option & V_CHARCOLORMASK);
|
charflags = (option & V_CHARCOLORMASK);
|
||||||
|
colormap = V_GetStringColormap(charflags);
|
||||||
|
|
||||||
switch (option & V_SPACINGMASK)
|
switch (option & V_SPACINGMASK)
|
||||||
{
|
{
|
||||||
|
@ -1770,7 +1794,10 @@ void V_DrawThinString(INT32 x, INT32 y, INT32 option, const char *string)
|
||||||
{
|
{
|
||||||
// manually set flags override color codes
|
// manually set flags override color codes
|
||||||
if (!(option & V_CHARCOLORMASK))
|
if (!(option & V_CHARCOLORMASK))
|
||||||
|
{
|
||||||
charflags = ((*ch & 0x7f) << V_CHARCOLORSHIFT) & V_CHARCOLORMASK;
|
charflags = ((*ch & 0x7f) << V_CHARCOLORSHIFT) & V_CHARCOLORMASK;
|
||||||
|
colormap = V_GetStringColormap(charflags);
|
||||||
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (*ch == '\n')
|
if (*ch == '\n')
|
||||||
|
@ -1810,7 +1837,6 @@ void V_DrawThinString(INT32 x, INT32 y, INT32 option, const char *string)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
colormap = V_GetStringColormap(charflags);
|
|
||||||
V_DrawFixedPatch(cx<<FRACBITS, cy<<FRACBITS, FRACUNIT, option, tny_font[c], colormap);
|
V_DrawFixedPatch(cx<<FRACBITS, cy<<FRACBITS, FRACUNIT, option, tny_font[c], colormap);
|
||||||
|
|
||||||
cx += w;
|
cx += w;
|
||||||
|
@ -2153,7 +2179,7 @@ INT32 V_StringWidth(const char *string, INT32 option)
|
||||||
for (i = 0; i < strlen(string); i++)
|
for (i = 0; i < strlen(string); i++)
|
||||||
{
|
{
|
||||||
c = 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;
|
continue;
|
||||||
|
|
||||||
c = toupper(c) - HU_FONTSTART;
|
c = toupper(c) - HU_FONTSTART;
|
||||||
|
@ -2192,7 +2218,7 @@ INT32 V_SmallStringWidth(const char *string, INT32 option)
|
||||||
for (i = 0; i < strlen(string); i++)
|
for (i = 0; i < strlen(string); i++)
|
||||||
{
|
{
|
||||||
c = 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;
|
continue;
|
||||||
|
|
||||||
c = toupper(c) - HU_FONTSTART;
|
c = toupper(c) - HU_FONTSTART;
|
||||||
|
@ -2232,7 +2258,7 @@ INT32 V_ThinStringWidth(const char *string, INT32 option)
|
||||||
for (i = 0; i < strlen(string); i++)
|
for (i = 0; i < strlen(string); i++)
|
||||||
{
|
{
|
||||||
c = 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;
|
continue;
|
||||||
|
|
||||||
c = toupper(c) - HU_FONTSTART;
|
c = toupper(c) - HU_FONTSTART;
|
||||||
|
|
|
@ -66,8 +66,6 @@ extern UINT8 hudtrans;
|
||||||
#define V_MONOSPACE 0x00000C00 // Don't do width checks on characters, all characters 8 width
|
#define V_MONOSPACE 0x00000C00 // Don't do width checks on characters, all characters 8 width
|
||||||
|
|
||||||
// use bits 13-16 for colors
|
// 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_CHARCOLORSHIFT 12
|
||||||
#define V_CHARCOLORMASK 0x0000F000
|
#define V_CHARCOLORMASK 0x0000F000
|
||||||
// for simplicity's sake, shortcuts to specific colors
|
// for simplicity's sake, shortcuts to specific colors
|
||||||
|
@ -79,6 +77,13 @@ extern UINT8 hudtrans;
|
||||||
#define V_GRAYMAP 0x00006000
|
#define V_GRAYMAP 0x00006000
|
||||||
#define V_ORANGEMAP 0x00007000
|
#define V_ORANGEMAP 0x00007000
|
||||||
#define V_SKYMAP 0x00008000
|
#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
|
// use bits 17-20 for alpha transparency
|
||||||
#define V_ALPHASHIFT 16
|
#define V_ALPHASHIFT 16
|
||||||
|
@ -157,7 +162,7 @@ void V_DrawFadeConsBack(INT32 plines);
|
||||||
void V_DrawCharacter(INT32 x, INT32 y, INT32 c, boolean lowercaseallowed);
|
void V_DrawCharacter(INT32 x, INT32 y, INT32 c, boolean lowercaseallowed);
|
||||||
// draw a single character, but for the chat
|
// draw a single character, but for the chat
|
||||||
void V_DrawChatCharacter(INT32 x, INT32 y, INT32 c, boolean lowercaseallowed, UINT8 *colormap);
|
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);
|
void V_DrawLevelTitle(INT32 x, INT32 y, INT32 option, const char *string);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue