Tweaked some drawing behaviors. Added note about HUD customization.

This commit is contained in:
Marisa the Magician 2018-05-30 19:24:47 +02:00
commit f55abc40fb
6 changed files with 24 additions and 16 deletions

View file

@ -46,8 +46,14 @@ In progress:
- General polishing and bugfixing.
- Trim out unused animations.
TODO:
- Scaling/Customization options for the HUD.
Known bugs:
- Sometimes the slave enforcer gets "lowered" while the main enforcer is
reloading. No idea what causes this.
- Sludge doesn't react to ceiling and wall movement.
- Pulse gun beams behave oddly when the player is on moving platforms.
This might just be a rendering interpolation glitch, as usual.

View file

@ -180,5 +180,5 @@ Sprite "EBLDH0",1,1{}
Sprite "EBLDI0",1,1{}
Sprite "EBLDJ0",1,1{}
Sprite "EBLDK0",1,1{}
Graphic "XHAIRS99",16,16{}
Graphic "XHAIRB99",16,16{}
Graphic "XHAIRS99",1,1{}
Graphic "XHAIRB99",1,1{}

View file

@ -236,21 +236,21 @@ Class UTRocketLauncher : UTWeapon
override void PostRender()
{
if ( LockedTarget ) Screen.DrawTexture(lockontex,false,(Screen.GetWidth()-16)*0.5,(Screen.GetHeight()-16)*0.5);
if ( LockedTarget ) Screen.DrawTexture(lockontex,false,Screen.GetWidth()*0.5,Screen.GetHeight()*0.5);
}
override void Tick()
{
Super.Tick();
if ( !Owner ) return;
if ( LockedOn && (!LockedTarget || (LockedTarget.Health <= 0) || LockedTarget.bKilled || LockedTarget.bCorpse || !LockedTarget.bShootable) )
if ( LockedOn && (!LockedTarget || (LockedTarget.Health <= 0) || !LockedTarget.bIsMonster || LockedTarget.bKilled || LockedTarget.bCorpse || !LockedTarget.bShootable) )
{
LockedTarget = null;
LockedOn = false;
Owner.A_PlaySound("utrl/seeklost",CHAN_6);
}
if ( LockedTarget ) A_SetCrosshair(99);
else A_SetCrosshair(0);
if ( LockedTarget ) crosshair = 99;
else crosshair = 0;
}
// consumes 1 ammo
@ -357,7 +357,7 @@ Class UTRocketLauncher : UTWeapon
invoker.LockedTarget = null;
while ( a = Actor(t.Next()) )
{
if ( !a.bSHOOTABLE || (a.Health <= 0) || a.bKilled || a.bCorpse || (a == self) || isTeammate(a) || !CheckSight(a) ) continue;
if ( !a.bSHOOTABLE || (a.Health <= 0) || a.bKilled || !a.bIsMonster || a.bCorpse || (a == self) || isTeammate(a) || !CheckSight(a) ) continue;
Vector3 viewdir = (cos(angle)*cos(pitch),sin(angle)*cos(pitch),-sin(pitch));
Vector3 reldir = level.Vec3Diff(Vec2OffsetZ(0,0,player.viewz),a.Vec2OffsetZ(0,0,a.pos.z+a.height*0.5));
double reldist = reldir.length();

View file

@ -160,8 +160,8 @@ Class Enforcer : UTWeapon replaces Pistol
override void PostRender()
{
if ( !CVar.GetCVar('flak_enforcerreload').GetBool() ) return;
if ( Amount > 1 ) Screen.DrawText(confont,Font.CR_GREEN,Screen.GetWidth()*0.01,Screen.GetHeight()*0.88,String.Format("L Clip: % 2d / 20\nR Clip: % 2d / 20",slaveclipcount,clipcount));
else Screen.DrawText(confont,Font.CR_GREEN,Screen.GetWidth()*0.01,Screen.GetHeight()*0.88,String.Format("Clip: % 2d / 20",clipcount));
if ( Amount > 1 ) Screen.DrawText(confont,Font.CR_GREEN,Screen.GetWidth()*0.01,Screen.GetHeight()*0.9-confont.GetHeight()*2,String.Format("L Clip: %2d / 20\nR Clip: %2d / 20",slaveclipcount,clipcount));
else Screen.DrawText(confont,Font.CR_GREEN,Screen.GetWidth()*0.01,Screen.GetHeight()*0.9-confont.GetHeight(),String.Format("Clip: %2d / 20",clipcount));
}
override bool HandlePickup( Inventory item )

View file

@ -416,7 +416,7 @@ Class PulseGun : UTWeapon
override void PostRender()
{
if ( !CVar.GetCVar('flak_pulsereload').GetBool() ) return;
Screen.DrawText(confont,Font.CR_GREEN,Screen.GetWidth()*0.01,Screen.GetHeight()*0.88,String.Format("Clip: % 2d / 50",clipcount));
Screen.DrawText(confont,Font.CR_GREEN,Screen.GetWidth()*0.01,Screen.GetHeight()*0.9-confont.GetHeight(),String.Format("Clip: %2d / 50",clipcount));
}
action void A_Reloading()

View file

@ -192,6 +192,7 @@ Class UTHud : BaseStatusBar
}
// UT's implementation doesn't seem to translate well to this, so I improvised a bit and made something not so ugly
// This whole function might need to be rewritten in a prettier way someday
private void UTDrawBigNum( int value, double sx = 1.0 )
{
double step = 25*HScale*sx;
@ -200,6 +201,7 @@ Class UTHud : BaseStatusBar
String digits = String.Format("%d",min(abs(value),9999));
double flen = 3*step;
double len = digits.length()*step;
for ( int i=0; i<digits.length(); i++ ) if ( digits.CharAt(i) == "1" ) len -= 0.5*step;
CurX += (flen-len)*0.5;
if ( digits.CharAt(0) == "1" ) CurX -= 0.5*step;
if ( value < 0 )
@ -210,7 +212,7 @@ Class UTHud : BaseStatusBar
for ( int i=0; i<digits.length(); i++ )
{
Screen.DrawTexture(BigNum[digits.CharCodeAt(i)-0x30],false,CurX/ss,CurY/ss,DTA_VirtualWidthF,dw,DTA_VirtualHeightF,dh,DTA_KeepRatio,true,DTA_AlphaChannel,true,DTA_FillColor,DrawColor);
CurX += step;
CurX += ((i<digits.length()-1)&&(digits.CharAt(i+1)=="1"))?step*0.5:step;
}
}
@ -407,14 +409,14 @@ Class UTHud : BaseStatusBar
cl1 = String.Format("Dark%s",cl2);
}
String tname = String.Format("\c[%s]Name:\c[%s] %s",cl1,cl2,lastseen.player.GetUserName());
CurX = (Screen.GetWidth()-confont.StringWidth(tname)*CleanXFac)*0.5;
CurY = Screen.GetHeight()*0.75;
Screen.DrawText(confont,Font.CR_UNTRANSLATED,CurX,CurY,tname,DTA_CleanNoMove,true,DTA_Alpha,lalpha/2.);
CurX = (640-confont.StringWidth(tname))*0.5;
CurY = 480*0.75;
Screen.DrawText(confont,Font.CR_UNTRANSLATED,CurX,CurY,tname,DTA_VirtualWidth,640,DTA_VirtualHeight,480,DTA_Alpha,lalpha/2.);
if ( !deathmatch || (lastseen.IsTeammate(CPlayer.mo)) )
{
CurY += 1.2*confont.GetHeight()*CleanYFac;
CurY += 1.2*confont.GetHeight();
tname = String.Format("\c[%s]Health:\c[%s] %d",cl1,cl2,lastseen.Health);
Screen.DrawText(confont,Font.CR_UNTRANSLATED,CurX,CurY,tname,DTA_CleanNoMove,true,DTA_Alpha,lalpha/2.);
Screen.DrawText(confont,Font.CR_UNTRANSLATED,CurX,CurY,tname,DTA_VirtualWidth,640,DTA_VirtualHeight,480,DTA_Alpha,lalpha/2.);
}
}