diff --git a/language.version b/language.version index c316491aa..da99eec1f 100644 --- a/language.version +++ b/language.version @@ -1,3 +1,3 @@ [default] -SWWM_MODVER="\cyDEMOLITIONIST \cw1.3pre r1137 \cu(Thu Jul 18 13:36:37 CEST 2024)\c-"; -SWWM_SHORTVER="\cw1.3pre r1137 \cu(2024-07-18 13:36:37)\c-"; +SWWM_MODVER="\cyDEMOLITIONIST \cw1.3pre r1138 \cu(Thu Jul 18 14:22:35 CEST 2024)\c-"; +SWWM_SHORTVER="\cw1.3pre r1138 \cu(2024-07-18 14:22:35)\c-"; diff --git a/zscript/handler/swwm_handler_process.zsc b/zscript/handler/swwm_handler_process.zsc index 37b809e9a..cb91b6535 100644 --- a/zscript/handler/swwm_handler_process.zsc +++ b/zscript/handler/swwm_handler_process.zsc @@ -171,6 +171,24 @@ extend Class SWWMHandler // send the post-teleport position DoPlayerStep(demo.pos.xy,true); } + else if ( e.Name ~== "swwmhudgivescore" ) + { + let bar = SWWMStatusBar(StatusBar); + if ( !bar ) return; + if ( bar.cummscoreup+e.Args[0] < bar.cummscoreup ) bar.cummscoreup = 999999999; + else bar.cummscoreup = min(999999999,bar.cummscoreup+e.Args[0]); + bar.cummspanup = 120+40*int(Log10(clamp(bar.cummscoreup,1,999999999))); + bar.cummflashup = 15; + } + else if ( e.Name ~== "swwmhudtakescore" ) + { + let bar = SWWMStatusBar(StatusBar); + if ( !bar ) return; + if ( bar.cummscoredn+e.Args[0] < bar.cummscoredn ) bar.cummscoredn = 999999999; + else bar.cummscoredn = min(999999999,bar.cummscoredn+e.Args[0]); + bar.cummspandn = 120+40*int(Log10(clamp(bar.cummscoredn,1,999999999))); + bar.cummflashdn = 15; + } } override void NetworkProcess( ConsoleEvent e ) diff --git a/zscript/hud/swwm_hud.zsc b/zscript/hud/swwm_hud.zsc index 9e4ec66ca..eac00c189 100644 --- a/zscript/hud/swwm_hud.zsc +++ b/zscript/hud/swwm_hud.zsc @@ -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 diff --git a/zscript/hud/swwm_hud_weapons.zsc b/zscript/hud/swwm_hud_weapons.zsc index 27a907bbd..fd3692bce 100644 --- a/zscript/hud/swwm_hud_weapons.zsc +++ b/zscript/hud/swwm_hud_weapons.zsc @@ -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 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); diff --git a/zscript/swwm_thinkers_player.zsc b/zscript/swwm_thinkers_player.zsc index b2f729a76..f2aa6e226 100644 --- a/zscript/swwm_thinkers_player.zsc +++ b/zscript/swwm_thinkers_player.zsc @@ -385,6 +385,13 @@ Class SWWMCredits : SWWMStaticThinker else c.credits = min(999999999,c.credits+amount); let s = SWWMStats.Find(p); if ( s && (c.credits > s.hiscore) ) s.hiscore = c.credits; + // append to hud + for ( int i=0; i 999999999) || (c.credits-amount < 0) || (c.credits-amount > c.credits) ) return false; c.credits -= amount; + // append to hud + for ( int i=0; i