From 90a593a6d5b6ba83e5114d0ad14ef770d0fce8e6 Mon Sep 17 00:00:00 2001 From: Marisa the Magician Date: Wed, 21 Jun 2023 11:38:26 +0200 Subject: [PATCH] Fix color escapes of dialogue text on console. --- language.version | 4 ++-- zscript/handler/swwm_handler_oneliners.zsc | 7 ++++++- zscript/handler/swwm_handler_process.zsc | 6 +++++- zscript/hud/swwm_hudextra.zsc | 2 ++ 4 files changed, 15 insertions(+), 4 deletions(-) diff --git a/language.version b/language.version index 7fa479e89..8277d4d25 100644 --- a/language.version +++ b/language.version @@ -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-"; diff --git a/zscript/handler/swwm_handler_oneliners.zsc b/zscript/handler/swwm_handler_oneliners.zsc index d3560d8da..659eeb6ee 100644 --- a/zscript/handler/swwm_handler_oneliners.zsc +++ b/zscript/handler/swwm_handler_oneliners.zsc @@ -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); } diff --git a/zscript/handler/swwm_handler_process.zsc b/zscript/handler/swwm_handler_process.zsc index ea1f4862a..5bc114ce0 100644 --- a/zscript/handler/swwm_handler_process.zsc +++ b/zscript/handler/swwm_handler_process.zsc @@ -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" ) { diff --git a/zscript/hud/swwm_hudextra.zsc b/zscript/hud/swwm_hudextra.zsc index c77fad0b9..f09713421 100644 --- a/zscript/hud/swwm_hudextra.zsc +++ b/zscript/hud/swwm_hudextra.zsc @@ -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 storemsg; txt.Split(storemsg,"\n");