Implement score increase/decrease accumulator in HUD.
This commit is contained in:
parent
a064184777
commit
68c01dbd63
5 changed files with 81 additions and 3 deletions
|
|
@ -197,6 +197,10 @@ Class SWWMStatusBar : BaseStatusBar
|
|||
SmoothDynamicValueInterpolator HealthInter, FuelInter, DashInter;
|
||||
SmoothLinearValueInterpolator LagHealthInter;
|
||||
|
||||
// please do not misread
|
||||
int cummscoreup, cummspanup, cummflashup;
|
||||
int cummscoredn, cummspandn, cummflashdn;
|
||||
|
||||
transient ui int rss;
|
||||
|
||||
// called by static handler when loading a game
|
||||
|
|
|
|||
|
|
@ -52,6 +52,19 @@ extend Class SWWMStatusBar
|
|||
if ( !(i is 'SWWMWeapon') ) continue;
|
||||
SWWMWeapon(i).HudTick();
|
||||
}
|
||||
// score accumulator
|
||||
if ( cummflashup > 0 ) cummflashup--;
|
||||
if ( cummflashdn > 0 ) cummflashdn--;
|
||||
if ( cummspanup > 0 )
|
||||
{
|
||||
cummspanup--;
|
||||
if ( cummspanup <= 0 ) cummscoreup = 0;
|
||||
}
|
||||
if ( cummspandn > 0 )
|
||||
{
|
||||
cummspandn--;
|
||||
if ( cummspandn <= 0 ) cummscoredn = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// hello??? why is this function clearscope???
|
||||
|
|
@ -256,6 +269,35 @@ extend Class SWWMStatusBar
|
|||
yy += 2;
|
||||
for ( int i=0; i<dcnt; i++ ) Screen.DrawChar(MiniHUDFont,mhudfontcol[MCR_BRASS],xx+i*4,yy,0x30,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_ColorOverlay,Color(160,0,0,0));
|
||||
Screen.DrawText(MiniHUDFont,mhudfontcol[MCR_BRASS],xx,yy,sstr,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true);
|
||||
// accumulator (for local player only)
|
||||
xx -= 4;
|
||||
yy--;
|
||||
if ( cummscoreup && (CPlayer == players[consoleplayer]) )
|
||||
{
|
||||
yy -= 8;
|
||||
double calph = clamp(cummspanup-fractic,0.,20.)/20.;
|
||||
sstr = String.Format("%+10d",min(cummscoreup,999999999));
|
||||
Screen.DrawText(MiniHUDFontOutline,mhudfontcol[MCR_BRASS],xx,yy,sstr,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_Alpha,calph);
|
||||
if ( cummflashup > 0 )
|
||||
{
|
||||
double falph = max((cummflashup-FracTic)/15.,0.)**1.5;
|
||||
Screen.DrawText(MiniHUDFontOutline,mhudfontcol[MCR_FLASH],xx,yy,sstr,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_Alpha,falph*calph,DTA_LegacyRenderStyle,STYLE_Add);
|
||||
}
|
||||
// smooth fade offset for next line
|
||||
yy += (1.-calph)*8;
|
||||
}
|
||||
if ( cummscoredn && (CPlayer == players[consoleplayer]) )
|
||||
{
|
||||
yy -= 8;
|
||||
double calph = clamp(cummspandn-fractic,0.,20.)/20.;
|
||||
sstr = String.Format("%+10d",-min(cummscoredn,999999999));
|
||||
Screen.DrawText(MiniHUDFontOutline,mhudfontcol[MCR_RED],xx,yy,sstr,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_Alpha,calph);
|
||||
if ( cummflashdn > 0 )
|
||||
{
|
||||
double falph = max((cummflashdn-FracTic)/15.,0.)**1.5;
|
||||
Screen.DrawText(MiniHUDFontOutline,mhudfontcol[MCR_REDFLASH],xx,yy,sstr,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_Alpha,falph*calph,DTA_LegacyRenderStyle,STYLE_Add);
|
||||
}
|
||||
}
|
||||
int bx = bDrewAmmo?56:50;
|
||||
// ammo display
|
||||
if ( CPlayer.ReadyWeapon is 'SWWMWeapon' ) SWWMWeapon(CPlayer.ReadyWeapon).DrawWeapon(FracTic,ss.x-(xmargin+bx),ss.y-(ymargin+12),hs,ss);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue