From 7b6c0df00b4a93b52d4978aec7d235a5ebd3ed11 Mon Sep 17 00:00:00 2001 From: Marisa the Magician Date: Tue, 7 Nov 2023 14:48:33 +0100 Subject: [PATCH] Re-add "tight" hud scaling, for those who play at odd resolutions (e.g.: the dragon). --- cvarinfo.base | 2 +- language.def_menu | 4 +++- language.es_menu | 4 +++- language.version | 4 ++-- menudef.txt | 2 +- zscript/hud/swwm_hud.zsc | 3 ++- zscript/menu/swwm_menus.zsc | 15 ++++++++++----- 7 files changed, 22 insertions(+), 12 deletions(-) diff --git a/cvarinfo.base b/cvarinfo.base index d311bb211..8d6905518 100644 --- a/cvarinfo.base +++ b/cvarinfo.base @@ -79,7 +79,7 @@ nosave bool swwm_ccmessage = false; // has received the "corruption cards" dial nosave bool swwm_useweaponbar = false; // scroll through weapons using a bar, like with inventory items nosave bool swwm_percentstats = false; // show level stats as percentages, like in intermissions nosave bool swwm_targetvals = false; // show current/max health values above heathbars -nosave int swwm_hudscale = 0; // force the primary scale of the HUD (used by the HUD itself) +nosave int swwm_hudscale = 0; // force the primary scale of the HUD (used by the HUD itself) [0: auto loose fit, -1: auto tight fit] nosave int swwm_hudscale0 = 0; // force the "zero minus" scale of the HUD (used by damage numbers) nosave int swwm_hudscale1 = 0; // force the "one minus" scale of the HUD (used by healthbars, score numbers) nosave int swwm_hudscale2 = 0; // force the "two minus" scale of the HUD (used by interest points) diff --git a/language.def_menu b/language.def_menu index 1d58813ed..45a9f1404 100644 --- a/language.def_menu +++ b/language.def_menu @@ -188,6 +188,8 @@ SWWM_HUDSCALE0 = "Secondary HUD Scale"; SWWM_HUDSCALE1 = "Tertiary HUD Scale"; SWWM_HUDSCALE2 = "Quaternary HUD Scale"; SWWM_HS_AUTO = "Auto"; +SWWM_HS_AUTOL = "Auto Loose"; +SWWM_HS_AUTOT = "Auto Tight"; SWWM_MM_ENABLE = "Show Minimap"; SWWM_MM_MISSILES = "Projectiles In Minimap"; SWWM_MM_USECANVAS = "Fixed Scale Minimap"; @@ -273,7 +275,7 @@ TOOLTIP_SWWM_BARDIST = "Distance in map units at which healthbar visibility will TOOLTIP_SWWM_USEWEAPONBAR = "Enables an alternate method for scrolling through weapons akin to the inventory bar. Use Primary Fire to accept, and Alternate Fire to cancel."; TOOLTIP_SWWM_PERCENTSTATS = "Shows kills/items/secrets in the HUD as percentages, rather than counters."; TOOLTIP_SWWM_TARGETVALS = "Healthbars will show the current and maximum health values of the target."; -TOOLTIP_SWWM_HUDSCALE = "If non-zero, manually set the scale of the HUD. Keep in mind that HUD elements may overlap if set too high."; +TOOLTIP_SWWM_HUDSCALE = "If higher than zero, manually set the scale of the HUD. Keep in mind that HUD elements may overlap if set too high."; TOOLTIP_SWWM_HUDSCALE0 = "If non-zero, manually set the scale of Damage Numbers. Usually, this is equal to the primary HUD scale."; TOOLTIP_SWWM_HUDSCALE1 = "If non-zero, manually set the scale of Healthbars, Score Numbers and Item Sense. Usually, this is one less than the primary HUD scale."; TOOLTIP_SWWM_HUDSCALE2 = "If non-zero, manually set the scale of Interest Points. Usually, this is two less than the primary HUD scale."; diff --git a/language.es_menu b/language.es_menu index 7a775deea..84f21e1e3 100644 --- a/language.es_menu +++ b/language.es_menu @@ -183,6 +183,8 @@ SWWM_HUDSCALE = "Escala de HUD"; SWWM_HUDSCALE0 = "Escala Secundaria de HUD"; SWWM_HUDSCALE1 = "Escala Terciaria de HUD"; SWWM_HUDSCALE2 = "Escala Cuaternaria de HUD"; +SWWM_HS_AUTOL = "Auto. Holgado"; +SWWM_HS_AUTOT = "Auto. Ceñido"; SWWM_MM_ENABLE = "Mostrar Minimapa"; SWWM_MM_MISSILES = "Proyectiles en Minimapa"; SWWM_MM_USECANVAS = "Minimapa a Escala Fija"; @@ -269,7 +271,7 @@ TOOLTIP_SWWM_BARDIST = "Distancia en unidades de mapa a la cual la visibilidad d TOOLTIP_SWWM_USEWEAPONBAR = "Habilita un método alternativo para hacer scroll por las armas similar a la barra de inventario. Usa el Fuego Primario para aceptar, y el Fuego Secundario para cancelar."; TOOLTIP_SWWM_PERCENTSTATS = "Muestra las estadísticas de bajas/ítems/secretos en el HUD como porcentajes, en lugar de contadores."; TOOLTIP_SWWM_TARGETVALS = "Las barras de salud mostrarán los valores de salud actual y máximo del objetivo."; -TOOLTIP_SWWM_HUDSCALE = "Si no es cero, especifica manualmente la escala del HUD. Ten en cuenta que los elementos del HUD pueden solaparse si es muy alta."; +TOOLTIP_SWWM_HUDSCALE = "Si es mayor que cero, especifica manualmente la escala del HUD. Ten en cuenta que los elementos del HUD pueden solaparse si es muy alta."; TOOLTIP_SWWM_HUDSCALE0 = "Si no es cero, especifica manualmente la escala de los Números de Daño. Normalmente, es igual a la escala primaria del HUD."; TOOLTIP_SWWM_HUDSCALE1 = "Si no es cero, especifica manualmente la escala de las Barras de Salud, Números de Puntuación y Sensor de Ítems. Normalmente, es igual a dos menos que la escala primaria del HUD."; TOOLTIP_SWWM_HUDSCALE2 = "Si no es cero, especifica manualmente la escala de los Puntos de Interés. Normalmente, es igual a tres menos que la escala primaria del HUD."; diff --git a/language.version b/language.version index 8e0dbeeca..a91979e30 100644 --- a/language.version +++ b/language.version @@ -1,3 +1,3 @@ [default] -SWWM_MODVER="\cyDEMOLITIONIST \cw1.3pre r1001 \cu(Tue 7 Nov 14:24:53 CET 2023)\c-"; -SWWM_SHORTVER="\cw1.3pre r1001 \cu(2023-11-07 14:24:53)\c-"; +SWWM_MODVER="\cyDEMOLITIONIST \cw1.3pre r1002 \cu(Tue 7 Nov 14:48:33 CET 2023)\c-"; +SWWM_SHORTVER="\cw1.3pre r1002 \cu(2023-11-07 14:48:33)\c-"; diff --git a/menudef.txt b/menudef.txt index b3eb40b86..b4868725b 100644 --- a/menudef.txt +++ b/menudef.txt @@ -135,7 +135,7 @@ OptionMenu "SWWMOptionMenu" Option "$SWWM_PERCENTSTATS", "swwm_percentstats", "YesNo" Option "$SWWM_UNIQSTATS", "swwm_uniqstats", "YesNo" Slider "$SWWM_HUDMARGIN", "swwm_hudmargin", 0, 10, 1, 0 - SWWMScaleField "$SWWM_HUDSCALE", "swwm_hudscale", "$SWWM_HS_AUTO" + SWWMScaleField "$SWWM_HUDSCALE", "swwm_hudscale", "$SWWM_HS_AUTOL", "$SWWM_HS_AUTOT" SWWMScaleField "$SWWM_HUDSCALE0", "swwm_hudscale0", "$SWWM_HS_AUTO" SWWMScaleField "$SWWM_HUDSCALE1", "swwm_hudscale1", "$SWWM_HS_AUTO" SWWMScaleField "$SWWM_HUDSCALE2", "swwm_hudscale2", "$SWWM_HS_AUTO" diff --git a/zscript/hud/swwm_hud.zsc b/zscript/hud/swwm_hud.zsc index e1d1fa33d..19a830a89 100644 --- a/zscript/hud/swwm_hud.zsc +++ b/zscript/hud/swwm_hud.zsc @@ -629,7 +629,8 @@ Class SWWMStatusBar : BaseStatusBar return; } if ( !hnd ) hnd = SWWMHandler(EventHandler.Find("SWWMHandler")); - hs = max(min(floor(Screen.GetWidth()/640.),floor(Screen.GetHeight()/360.)),1.); + if ( swwm_hudscale < 0 ) hs = max(min(floor(Screen.GetWidth()/480.),floor(Screen.GetHeight()/270.)),1.); + else hs = max(min(floor(Screen.GetWidth()/640.),floor(Screen.GetHeight()/360.)),1.); ss = (Screen.GetWidth()/hs,Screen.GetHeight()/hs); margin = clamp(swwm_hudmargin,0,10); hs0 = hs; diff --git a/zscript/menu/swwm_menus.zsc b/zscript/menu/swwm_menus.zsc index c49d21f63..43a9275ab 100644 --- a/zscript/menu/swwm_menus.zsc +++ b/zscript/menu/swwm_menus.zsc @@ -1003,15 +1003,16 @@ Class OptionMenuItemScaleSliderFix : OptionMenuItemScaleSlider } } -// allows only positive numeric values, 0 optionally gets a special label in parentheses +// allows only positive integer values, plus zero and minus-one if optionally hinted Class OptionMenuItemSWWMScaleField : OptionMenuItemTextField { - String mZeroHint; + String mZeroHint, mNegOneHint; - OptionMenuItemSWWMScaleField Init( String label, Name command, String zerohint = "" ) + OptionMenuItemSWWMScaleField Init( String label, Name command, String zerohint = "", String negonehint = "" ) { Super.Init(label,command); mZeroHint = zerohint; + mNegOneHint = negonehint; return self; } @@ -1023,6 +1024,8 @@ Class OptionMenuItemSWWMScaleField : OptionMenuItemTextField int val = mCVar?mCVar.GetInt():0; if ( (val == 0) && (mZeroHint != "") ) str.AppendFormat(" (%s)",StringTable.Localize(mZeroHint)); + else if ( (val == -1) && (mNegOneHint != "") ) + str.AppendFormat(" (%s)",StringTable.Localize(mNegOneHint)); return true, str; } return false,""; @@ -1039,7 +1042,8 @@ Class OptionMenuItemSWWMScaleField : OptionMenuItemTextField if ( mkey == Menu.MKEY_Left ) { int val = mCVar?mCVar.GetInt():0; - val = max(0,val-1); + int cap = (mNegOneHint!="")?-1:(mZeroHint!="")?0:1; + val = max(cap,val-1); if ( mCVar ) mCVar.SetInt(val); Menu.MenuSound("menu/change"); return true; @@ -1058,7 +1062,8 @@ Class OptionMenuItemSWWMScaleField : OptionMenuItemTextField { if ( i == 0 ) { - int numval = max(s.ToInt(),0); + int cap = (mNegOneHint!="")?-1:(mZeroHint!="")?0:1; + int numval = max(cap,s.ToInt()); if ( mCVar ) mCVar.SetInt(numval); return true; }