From 07ad8fd41b44badb5e14d315fcc77bd0b2e3f494 Mon Sep 17 00:00:00 2001 From: Marisa the Magician Date: Sun, 19 Nov 2023 22:44:32 +0100 Subject: [PATCH] Skip attemting to strip author name from level name if already defined. --- language.version | 4 ++-- zscript/hud/swwm_hud_topstuff.zsc | 9 ++++++--- zscript/hud/swwm_hudextra.zsc | 31 +++++++++++++++++-------------- 3 files changed, 25 insertions(+), 19 deletions(-) diff --git a/language.version b/language.version index 385ce6f62..feec73b87 100644 --- a/language.version +++ b/language.version @@ -1,3 +1,3 @@ [default] -SWWM_MODVER="\cyDEMOLITIONIST \cw1.3pre r1008 \cu(Sun 19 Nov 20:10:39 CET 2023)\c-"; -SWWM_SHORTVER="\cw1.3pre r1008 \cu(2023-11-19 20:10:39)\c-"; +SWWM_MODVER="\cyDEMOLITIONIST \cw1.3pre r1009 \cu(Sun 19 Nov 22:44:32 CET 2023)\c-"; +SWWM_SHORTVER="\cw1.3pre r1009 \cu(2023-11-19 22:44:32)\c-"; diff --git a/zscript/hud/swwm_hud_topstuff.zsc b/zscript/hud/swwm_hud_topstuff.zsc index 5792d5528..9f796faa2 100644 --- a/zscript/hud/swwm_hud_topstuff.zsc +++ b/zscript/hud/swwm_hud_topstuff.zsc @@ -794,9 +794,12 @@ extend Class SWWMStatusBar if ( ln.Left(1) == "$" ) ln = StringTable.Localize(ln); // level name may contain trailing whitespace due to DEHACKED nonsense, so strip it ln.StripRight(); - int iof; - if ( ((iof = ln.RightIndexOf(" - by: ")) != -1) || ((iof = ln.RightIndexOf(" - by ")) != -1) || ((iof = ln.RightIndexOf(" - ")) != -1) ) - ln.Truncate(iof); + if ( level.authorname == "" ) // the author name might be part of the level name, try to strip it + { + int iof; + if ( ((iof = ln.RightIndexOf(" - by: ")) != -1) || ((iof = ln.RightIndexOf(" - by ")) != -1) || ((iof = ln.RightIndexOf(" - ")) != -1) ) + ln.Truncate(iof); + } // split level name into separate lines if it's too long // also, use a cache so we don't call BreakLines constantly if ( ln_bl && (ln != cached_ln) ) ln_bl.Destroy(); diff --git a/zscript/hud/swwm_hudextra.zsc b/zscript/hud/swwm_hudextra.zsc index 4c6a3c5e3..7053ced73 100644 --- a/zscript/hud/swwm_hudextra.zsc +++ b/zscript/hud/swwm_hudextra.zsc @@ -806,21 +806,24 @@ Class DSMapTitle : HUDMessageBase SWWMUtility.StripColor(txtsub); // level name may contain trailing whitespace due to DEHACKED nonsense, so strip it txt.StripRight(); - int sep; - if ( (sep = txt.RightIndexOf(" - by: ")) != -1 ) // 20 heretics, spooktober + if ( txtsub == "" ) // if we already have an author name, don't do this stuff { - txtsub = txt.Mid(sep+7); - txt.Truncate(sep); - } - else if ( (sep = txt.RightIndexOf(" - by ")) != -1 ) // variation seen in DOOMIUM - { - txtsub = txt.Mid(sep+6); - txt.Truncate(sep); - } - else if ( (sep = txt.RightIndexOf(" - ")) != -1 ) // hexmas and many others (may cause false positives?) - { - txtsub = txt.Mid(sep+3); - txt.Truncate(sep); + int sep; + if ( (sep = txt.RightIndexOf(" - by: ")) != -1 ) // 20 heretics, spooktober + { + txtsub = txt.Mid(sep+7); + txt.Truncate(sep); + } + else if ( (sep = txt.RightIndexOf(" - by ")) != -1 ) // variation seen in DOOMIUM + { + txtsub = txt.Mid(sep+6); + txt.Truncate(sep); + } + else if ( (sep = txt.RightIndexOf(" - ")) != -1 ) // hexmas and many others (may cause false positives?) + { + txtsub = txt.Mid(sep+3); + txt.Truncate(sep); + } } hasnewline = (txt.IndexOf("\n") != -1); bTxtIsSplit = false;