Allow manually setting HUD scales (with disregard for potential overlaps).
This commit is contained in:
parent
b833dbff70
commit
b8385fc480
9 changed files with 173 additions and 21 deletions
|
|
@ -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) )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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 );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue