From befda0871063fcb11bac112da369699ad0fae31c Mon Sep 17 00:00:00 2001 From: Marisa Kirisame Date: Wed, 20 Apr 2022 17:22:35 +0200 Subject: [PATCH] Fix cheat input using the wrong font. --- language.version | 4 ++-- zscript/handler/swwm_handler_cheats.zsc | 19 ++++++++++--------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/language.version b/language.version index 58189a483..6a77a7324 100644 --- a/language.version +++ b/language.version @@ -1,3 +1,3 @@ [default] -SWWM_MODVER="\cyDEMOLITIONIST \cw1.3pre r43 \cu(Wed 20 Apr 17:08:19 CEST 2022)\c-"; -SWWM_SHORTVER="\cw1.3pre r43 \cu(2022-04-20 17:08:19)\c-"; +SWWM_MODVER="\cyDEMOLITIONIST \cw1.3pre r44 \cu(Wed 20 Apr 17:22:35 CEST 2022)\c-"; +SWWM_SHORTVER="\cw1.3pre r44 \cu(2022-04-20 17:22:35)\c-"; diff --git a/zscript/handler/swwm_handler_cheats.zsc b/zscript/handler/swwm_handler_cheats.zsc index 556729054..ccec1a872 100644 --- a/zscript/handler/swwm_handler_cheats.zsc +++ b/zscript/handler/swwm_handler_cheats.zsc @@ -7,6 +7,7 @@ extend Class SWWMHandler transient ui bool kfail; transient ui int rss; ui bool nostalgic; + ui Font CheatFont; transient int sewercnt; private ui void CheatUITick() @@ -511,25 +512,25 @@ extend Class SWWMHandler // cheat input if ( (kcode <= 4) && ((klinger < gametic) || (klingerstr == "")) ) return; - double hs = max(floor(Screen.GetWidth()/480.),1.); - Vector2 ss = (Screen.GetWidth(),Screen.GetHeight())/hs; + double scl = CleanXFac_1*3.; String chstr = (kcode>4)?kstr.Mid(4):klingerstr.Mid(4); double alph = clamp((klinger-(gametic+e.fractic))/20.,0.,1.); double shine = clamp((klinger-(gametic+e.fractic+40))/20.,0.,1.); int col = (kcode>4)?0:(kfail)?2:1; int tlen = chstr.CodePointCount(); - int width = (bigfont.StringWidth(chstr)+6*(tlen-1)); - int xx = int((ss.x-width)/2.); - int yy = int((ss.y-bigfont.GetHeight())/2.); + if ( !CheatFont ) CheatFont = Font.GetFont("TewiFontOutline"); + int width = (CheatFont.StringWidth(chstr)+3*(tlen-1)); + double xx = int(Screen.GetWidth()-width*scl)/2; + double yy = int(Screen.GetHeight()-CheatFont.GetHeight()*scl)/2; rss = (kcode>4)?gametic:klinger; for ( int i=0, pos=0; i