Fix color escapes of dialogue text on console.

This commit is contained in:
Mari the Deer 2023-06-21 11:38:26 +02:00
commit 90a593a6d5
4 changed files with 15 additions and 4 deletions

View file

@ -1,3 +1,3 @@
[default]
SWWM_MODVER="\cyDEMOLITIONIST \cw1.3pre r811 \cu(Thu 15 Jun 22:25:44 CEST 2023)\c-";
SWWM_SHORTVER="\cw1.3pre r811 \cu(2023-06-15 22:25:44)\c-";
SWWM_MODVER="\cyDEMOLITIONIST \cw1.3pre r811 \cu(Wed 21 Jun 11:38:26 CEST 2023)\c-";
SWWM_SHORTVER="\cw1.3pre r811 \cu(2023-06-21 11:38:26)\c-";

View file

@ -150,7 +150,12 @@ extend Class SWWMHandler
{
let l = SWWMOneLiner.Make(oneliner,onelinerspan);
StatusBar.AttachMessage(l,-3473);
if ( swwm_voicelog ) Console.PrintfEx(PRINT_CHAT|PRINT_NONOTIFY,"\cd"..(multiplayer?players[consoleplayer].GetUserName():"Demo").."\c*: "..StringTable.Localize(oneliner).."\c*");
if ( swwm_voicelog )
{
String txt = StringTable.Localize(oneliner);
txt.Replace("\c-","\c*"); // fix color reset escapes
Console.PrintfEx(PRINT_CHAT|PRINT_NONOTIFY,"\cd"..(multiplayer?players[consoleplayer].GetUserName():"Demo").."\c*: "..txt.."\c*");
}
}
SendNetworkEvent("swwmremotelinertxt."..oneliner,consoleplayer,onelinerlevel);
}

View file

@ -461,7 +461,11 @@ extend Class SWWMHandler
if ( swwm_mutevoice >= e.Args[1] ) return;
double dist = players[consoleplayer].Camera.Distance3D(players[e.Args[0]].mo);
if ( dist < 2000 )
Console.PrintfEx(PRINT_CHAT,"\cx%s\cx: %s\c-",players[e.Args[0]].GetUserName(),StringTable.Localize(e.Name.Mid(19)));
{
String txt = StringTable.Localize(e.Name.Mid(19));
txt.Replace("\c-","\c*"); // fix color reset escapes
Console.PrintfEx(PRINT_CHAT,"\cx%s\cx: %s\c-",players[e.Args[0]].GetUserName(),txt);
}
}
else if ( e.Name ~== "swwmcleartransaction" )
{

View file

@ -337,6 +337,8 @@ Class SWWMDirectMessage : HUDMessageBase
l = mSmallFont.BreakLines(txt,220);
// if valid, append to the console so the player may re-read this if they want
if ( (seqnum < 1) || (seqnum > seqcnt) ) return;
// replace "normal" color reset escapes with chat color escapes
txt.Replace("\c-","\c*");
// some messages may have newlines in them, split them
Array<String> storemsg;
txt.Split(storemsg,"\n");