Allow manually setting HUD scales (with disregard for potential overlaps).

This commit is contained in:
Mari the Deer 2023-08-21 11:17:43 +02:00
commit b8385fc480
9 changed files with 173 additions and 21 deletions

View file

@ -82,6 +82,10 @@ 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_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)
// minimap settings
nosave bool swwm_mm_enable = true; // show a minimap below the score counter

View file

@ -186,6 +186,11 @@ SWWM_BARDIST = "Healthbar Distance";
SWWM_USEWEAPONBAR = "Alternate Weapon Selection";
SWWM_PERCENTSTATS = "Percentual Stats";
SWWM_TARGETVAL = "Show Health Values";
SWWM_HUDSCALE = "HUD Scale";
SWWM_HUDSCALE0 = "Secondary HUD Scale";
SWWM_HUDSCALE1 = "Tertiary HUD Scale";
SWWM_HUDSCALE2 = "Quaternary HUD Scale";
SWWM_HS_AUTO = "Auto";
SWWM_MM_ENABLE = "Show Minimap";
SWWM_MM_MISSILES = "Projectiles In Minimap";
SWWM_MM_USECANVAS = "Fixed Scale Minimap";
@ -274,6 +279,10 @@ 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_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.";
TOOLTIP_SWWMACHIEVEMENTMENU = "View your achievements.";
TOOLTIP_SWWM_MM_ENABLE = "Displays a minimap on the top right corner of the screen.";
TOOLTIP_SWWM_MM_MISSILES = "Displays projectiles in the minimap. Can be toggled if this clutters too much.";

View file

@ -183,6 +183,10 @@ SWWM_BARDIST = "Distancia de Barras de Salud";
SWWM_USEWEAPONBAR = "Selección Alternativa de Armas";
SWWM_PERCENTSTATS = "Estadísticas Percentuales";
SWWM_TARGETVAL = "Mostrar Valores de Salud";
SWWM_HUDSCALE = "Escala de HUD";
SWWM_HUDSCALE0 = "Escala Secundaria de HUD";
SWWM_HUDSCALE1 = "Escala Terciaria de HUD";
SWWM_HUDSCALE2 = "Escala Cuaternaria de HUD";
SWWM_MM_ENABLE = "Mostrar Minimapa";
SWWM_MM_MISSILES = "Proyectiles en Minimapa";
SWWM_MM_USECANVAS = "Minimapa a Escala Fija";
@ -272,6 +276,10 @@ 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_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.";
TOOLTIP_SWWMACHIEVEMENTMENU = "Revisa tus logros.";
TOOLTIP_SWWM_MM_ENABLE = "Muestra un minimapa en la esquina superior derecha de la pantalla.";
TOOLTIP_SWWM_MM_MISSILES = "Muestra proyectiles en el minimapa. Puede ser desactivado si causa problemas de visibilidad.";

View file

@ -1,3 +1,3 @@
[default]
SWWM_MODVER="\cyDEMOLITIONIST \cw1.3pre r933 \cu(Sun 20 Aug 23:28:24 CEST 2023)\c-";
SWWM_SHORTVER="\cw1.3pre r933 \cu(2023-08-20 23:28:24)\c-";
SWWM_MODVER="\cyDEMOLITIONIST \cw1.3pre r934 \cu(Mon 21 Aug 11:17:43 CEST 2023)\c-";
SWWM_SHORTVER="\cw1.3pre r934 \cu(2023-08-21 11:17:43)\c-";

View file

@ -142,6 +142,10 @@ OptionMenu "SWWMOptionMenu"
Option "$SWWM_PERCENTSTATS", "swwm_percentstats", "YesNo"
Option "$SWWM_UNIQSTATS", "swwm_uniqstats", "YesNo"
Slider "$SWWM_HUDMARGIN", "swwm_hudmargin", 0, 20, 1, 0
SWWMScaleField "$SWWM_HUDSCALE", "swwm_hudscale", "$SWWM_HS_AUTO"
SWWMScaleField "$SWWM_HUDSCALE0", "swwm_hudscale0", "$SWWM_HS_AUTO"
SWWMScaleField "$SWWM_HUDSCALE1", "swwm_hudscale1", "$SWWM_HS_AUTO"
SWWMScaleField "$SWWM_HUDSCALE2", "swwm_hudscale2", "$SWWM_HS_AUTO"
Option "$SWWM_HUDALLAMMO", "swwm_hudallammo", "YesNo"
Option "$SWWM_MM_ENABLE", "swwm_mm_enable", "YesNo"
Option "$SWWM_MM_MISSILES", "swwm_mm_missiles", "YesNo"

View file

@ -100,11 +100,9 @@ Class SWWMStatusBar : BaseStatusBar
// shared stuff
double hs;
double hs1;
double hs2;
double hs0, hs1, hs2;
Vector2 ss;
Vector2 ss1;
Vector2 ss2;
Vector2 ss0, ss1, ss2;
int margin;
double FracTic;
double FrameTime;
@ -605,10 +603,32 @@ Class SWWMStatusBar : BaseStatusBar
hs = max(min(floor(Screen.GetWidth()/640.),floor(Screen.GetHeight()/360.)),1.);
ss = (Screen.GetWidth()/hs,Screen.GetHeight()/hs);
margin = clamp(swwm_hudmargin,0,20);
hs0 = hs;
hs1 = max(hs-1.,1.);
hs2 = max(hs-2.,1.);
ss0 = ss;
ss1 = (Screen.GetWidth()/hs1,Screen.GetHeight()/hs1);
ss2 = (Screen.GetWidth()/hs2,Screen.GetHeight()/hs2);
if ( swwm_hudscale > 0 )
{
hs = swwm_hudscale;
ss = (Screen.GetWidth()/hs,Screen.GetHeight()/hs);
}
if ( swwm_hudscale0 > 0 )
{
hs0 = swwm_hudscale0;
ss0 = (Screen.GetWidth()/hs0,Screen.GetHeight()/hs0);
}
if ( swwm_hudscale1 > 0 )
{
hs1 = swwm_hudscale1;
ss1 = (Screen.GetWidth()/hs1,Screen.GetHeight()/hs1);
}
if ( swwm_hudscale2 > 0 )
{
hs2 = swwm_hudscale2;
ss2 = (Screen.GetWidth()/hs2,Screen.GetHeight()/hs2);
}
FracTic = TicFrac;
if ( (players[consoleplayer].Camera is 'Demolitionist') && (state <= HUD_Fullscreen) )
{

View file

@ -328,7 +328,7 @@ extend Class SWWMStatusBar
if ( viewvec dot tdir < 0 ) continue;
Vector3 ndc = SWWMUtility.ProjectPoint(projdata,ViewPos+tdir);
if ( ndc.z >= 1. ) continue;
Vector2 vpos = SWWMUtility.NDCToViewport(projdata,ndc)/hs;
Vector2 vpos = SWWMUtility.NDCToViewport(projdata,ndc)/hs0;
String tag = abs(snum.damage>=Actor.TELEFRAG_DAMAGE)?(snum.damage>0)?"-∞":"+∞":String.Format("%+d",-snum.damage);
double alph = clamp((snum.lifespan+fractic)/35.,0.,1.);
Vector2 fo;
@ -336,7 +336,7 @@ extend Class SWWMStatusBar
int boostup = 64+snum.seed2;
fo.x = (.05*initspd)*((snum.initialspan-(snum.lifespan-fractic))**.8);
fo.y = -((snum.initialspan-(snum.lifespan-fractic))**1.5)+boostup*sin((90./snum.initialspan)*(level.maptime+fractic-snum.starttic));
Screen.DrawText(MiniHUDFontOutline,snum.tcolor,(vpos.x-fo.x)-(MiniHUDFontOutline.StringWidth(tag))/2,(vpos.y-fo.y)-(MiniHUDFontOutline.GetHeight())/2,tag,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_Alpha,alph);
Screen.DrawText(MiniHUDFontOutline,snum.tcolor,(vpos.x-fo.x)-(MiniHUDFontOutline.StringWidth(tag))/2,(vpos.y-fo.y)-(MiniHUDFontOutline.GetHeight())/2,tag,DTA_VirtualWidthF,ss0.x,DTA_VirtualHeightF,ss0.y,DTA_KeepRatio,true,DTA_Alpha,alph);
}
while ( snum = snum.next );
}

View file

@ -87,8 +87,18 @@ Class SWWMOneLiner : HUDMessageBase
override void Draw( int bottom, int visibility )
{
int margin = swwm_hudmargin;
double hs = max(min(floor(Screen.GetWidth()/640.),floor(Screen.GetHeight()/360.)),1.);
Vector2 ss = (Screen.GetWidth()/hs,Screen.GetHeight()/hs);
double hs;
Vector2 ss;
if ( SWWMStatusBar(StatusBar) )
{
hs = SWWMStatusBar(StatusBar).hs;
ss = SWWMStatusBar(StatusBar).ss;
}
else
{
hs = max(min(floor(Screen.GetWidth()/640.),floor(Screen.GetHeight()/360.)),1.);
ss = (Screen.GetWidth()/hs,Screen.GetHeight()/hs);
}
if ( whichline == "" ) return; // don't draw empty strings
// split so it can fit
if ( !l ) l = mSmallFont.BreakLines(whichline,int(ss.x*.5));
@ -187,8 +197,18 @@ Class SWWMAchievementNotification : HUDMessageBase
override void Draw( int bottom, int visibility )
{
double margin = swwm_hudmargin;
double hs = max(min(floor(Screen.GetWidth()/640.),floor(Screen.GetHeight()/360.)),1.);
Vector2 ss = (Screen.GetWidth()/hs,Screen.GetHeight()/hs);
double hs;
Vector2 ss;
if ( SWWMStatusBar(StatusBar) )
{
hs = SWWMStatusBar(StatusBar).hs;
ss = SWWMStatusBar(StatusBar).ss;
}
else
{
hs = max(min(floor(Screen.GetWidth()/640.),floor(Screen.GetHeight()/360.)),1.);
ss = (Screen.GetWidth()/hs,Screen.GetHeight()/hs);
}
double fractic = System.GetTimeFrac();
double ftics = tics+fractic;
double alpha = (ftics<fadeintics)?(ftics/fadeintics):(ftics<(fadeintics+holdtics))?1.:(1.-(ftics-(fadeintics+holdtics))/fadeouttics);
@ -241,8 +261,18 @@ Class SWWMWeaponTooltip : HUDMessageBase
override void Draw( int bottom, int visibility )
{
if ( tics <= 0 ) return;
double hs = max(min(floor(Screen.GetWidth()/640.),floor(Screen.GetHeight()/360.)),1.);
Vector2 ss = (Screen.GetWidth()/hs,Screen.GetHeight()/hs);
double hs;
Vector2 ss;
if ( SWWMStatusBar(StatusBar) )
{
hs = SWWMStatusBar(StatusBar).hs;
ss = SWWMStatusBar(StatusBar).ss;
}
else
{
hs = max(min(floor(Screen.GetWidth()/640.),floor(Screen.GetHeight()/360.)),1.);
ss = (Screen.GetWidth()/hs,Screen.GetHeight()/hs);
}
double fractic = System.GetTimeFrac();
double ftics = tics+fractic;
double alpha = (ftics<fadeintics)?(ftics/fadeintics):(ftics<(fadeintics+holdtics))?1.:(1.-(ftics-(fadeintics+holdtics))/fadeouttics);
@ -525,8 +555,16 @@ Class SWWMDirectMessage : HUDMessageBase
double fractic = System.GetTimeFrac();
if ( seqnum == 0 ) alph = (fadein+fractic)/15.;
else if ( seqnum == (seqcnt+1) ) alph = 1.-(fadeout+fractic)/30.;
double hs = max(min(floor(Screen.GetWidth()/640.),floor(Screen.GetHeight()/360.)),1.);
ss = (Screen.GetWidth()/hs,Screen.GetHeight()/hs);
if ( SWWMStatusBar(StatusBar) )
{
hs = SWWMStatusBar(StatusBar).hs;
ss = SWWMStatusBar(StatusBar).ss;
}
else
{
hs = max(min(floor(Screen.GetWidth()/640.),floor(Screen.GetHeight()/360.)),1.);
ss = (Screen.GetWidth()/hs,Screen.GetHeight()/hs);
}
origin = (int(ss.x-270)/2,swwm_hudmargin+70);
Screen.DrawTexture(MessageBox,false,origin.x,origin.y,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_Alpha,alph);
if ( (seqnum < 1) || (seqnum > seqcnt) ) return;
@ -804,8 +842,18 @@ Class DSMapTitle : HUDMessageBase
override void Draw( int bottom, int visibility )
{
if ( tics <= 0 ) return;
double hs = max(min(floor(Screen.GetWidth()/640.),floor(Screen.GetHeight()/360.)),1.);
Vector2 ss = (Screen.GetWidth(),Screen.GetHeight())/hs;
double hs;
Vector2 ss;
if ( SWWMStatusBar(StatusBar) )
{
hs = SWWMStatusBar(StatusBar).hs;
ss = SWWMStatusBar(StatusBar).ss;
}
else
{
hs = max(min(floor(Screen.GetWidth()/640.),floor(Screen.GetHeight()/360.)),1.);
ss = (Screen.GetWidth()/hs,Screen.GetHeight()/hs);
}
double fractic = System.GetTimeFrac();
double ftics = tics+fractic;
double alpha = (ftics<fadeintics)?(ftics/fadeintics):(ftics<(fadeintics+holdtics))?1.:(1.-(ftics-(fadeintics+holdtics))/fadeouttics);
@ -1085,7 +1133,9 @@ Class SWWMWeaponSelect : HUDMessageBase
// smooth scroll
olsmoothY = smoothY;
smoothY = smoothY*.8+curY*.2;
double hs = max(min(floor(Screen.GetWidth()/640.),floor(Screen.GetHeight()/360.)),1.);
double hs;
if ( SWWMStatusBar(StatusBar) ) hs = SWWMStatusBar(StatusBar).hs;
else hs = max(min(floor(Screen.GetWidth()/640.),floor(Screen.GetHeight()/360.)),1.);
if ( abs(smoothY-curY) < (1./hs) ) smoothY = curY;
return false;
}
@ -1101,8 +1151,18 @@ Class SWWMWeaponSelect : HUDMessageBase
PPShader.SetUniform1f("BokehSel","strength",salph);
}
Screen.Dim("Black",.4*salph,0,0,Screen.GetWidth(),Screen.GetHeight());
double hs = max(min(floor(Screen.GetWidth()/640.),floor(Screen.GetHeight()/360.)),1.);
Vector2 ss = (Screen.GetWidth(),Screen.GetHeight())/hs;
double hs;
Vector2 ss;
if ( SWWMStatusBar(StatusBar) )
{
hs = SWWMStatusBar(StatusBar).hs;
ss = SWWMStatusBar(StatusBar).ss;
}
else
{
hs = max(min(floor(Screen.GetWidth()/640.),floor(Screen.GetHeight()/360.)),1.);
ss = (Screen.GetWidth()/hs,Screen.GetHeight()/hs);
}
Vector2 hss = ss*.5;
double x = Screen.GetWidth()*.5;
double y = hss.y-ssmoothY;

View file

@ -984,6 +984,53 @@ Class OptionMenuItemScaleSliderFix : OptionMenuItemScaleSlider
}
}
// allows only positive numeric values, 0 optionally gets a special label in parentheses
Class OptionMenuItemSWWMScaleField : OptionMenuItemTextField
{
String mZeroHint;
OptionMenuItemSWWMScaleField Init( String label, Name command, String zerohint = "" )
{
Super.Init(label,command);
mZeroHint = zerohint;
return self;
}
override bool, String GetString( int i )
{
if ( i == 0 )
{
String str = mCVar?mCVar.GetString():"";
int val = mCVar?mCVar.GetInt():0;
if ( (val == 0) && (mZeroHint != "") )
str.AppendFormat(" (%s)",StringTable.Localize(mZeroHint));
return true, str;
}
return false,"";
}
override bool MenuEvent (int mkey, bool fromcontroller)
{
if ( mkey == Menu.MKEY_Enter )
{
Menu.MenuSound("menu/choose");
mEnter = TextEnterMenu.OpenTextEnter(Menu.GetCurrentMenu(),Menu.OptionFont(),"",-1,fromcontroller);
mEnter.ActivateMenu();
return true;
}
return Super.MenuEvent(mkey,fromcontroller);
}
override bool SetString( int i, String s )
{
if ( i == 0 )
{
int numval = max(s.ToInt(),0);
if ( mCVar ) mCVar.SetInt(numval);
return true;
}
return false;
}
}
// draw captions using our own font
Class SWWMMenuDelegate : DoomMenuDelegate
{