From 5d443cf33c7f37377802b3263ffc21b03256ae85 Mon Sep 17 00:00:00 2001 From: Marisa the Magician Date: Mon, 26 Sep 2022 15:15:11 +0200 Subject: [PATCH] Tweak various interpolators. --- language.version | 4 ++-- zscript/dlc1/swwm_hammertime.zsc | 2 +- zscript/dlc1/swwm_heavymahsheengun.zsc | 2 +- zscript/handler/swwm_handler_vanillaboss.zsc | 4 ++-- zscript/hud/swwm_hud.zsc | 12 ++++++------ zscript/swwm_common.zsc | 8 ++++---- zscript/weapons/swwm_deathlydeathcannon.zsc | 2 +- zscript/weapons/swwm_deepdarkimpact.zsc | 2 +- zscript/weapons/swwm_thiccboolet.zsc | 2 +- 9 files changed, 19 insertions(+), 19 deletions(-) diff --git a/language.version b/language.version index 75b468cf1..78896ddf1 100644 --- a/language.version +++ b/language.version @@ -1,3 +1,3 @@ [default] -SWWM_MODVER="\cyDEMOLITIONIST \cw1.3pre r510 \cu(Mon 26 Sep 11:12:33 CEST 2022)\c-"; -SWWM_SHORTVER="\cw1.3pre r510 \cu(2022-09-26 11:12:33)\c-"; +SWWM_MODVER="\cyDEMOLITIONIST \cw1.3pre r511 \cu(Mon 26 Sep 15:15:11 CEST 2022)\c-"; +SWWM_SHORTVER="\cw1.3pre r511 \cu(2022-09-26 15:15:11)\c-"; diff --git a/zscript/dlc1/swwm_hammertime.zsc b/zscript/dlc1/swwm_hammertime.zsc index 2b331647a..d5f912f3b 100644 --- a/zscript/dlc1/swwm_hammertime.zsc +++ b/zscript/dlc1/swwm_hammertime.zsc @@ -10,7 +10,7 @@ Class ItamexHammer : SWWMWeapon override void HudTick() { Super.HudTick(); - if ( !ChargeInter ) ChargeInter = SmoothDynamicValueInterpolator.Create(charge,.5,1.,25.); + if ( !ChargeInter ) ChargeInter = SmoothDynamicValueInterpolator.Create(charge,.5); ChargeInter.Update(charge); } diff --git a/zscript/dlc1/swwm_heavymahsheengun.zsc b/zscript/dlc1/swwm_heavymahsheengun.zsc index 1391f6222..4695db83c 100644 --- a/zscript/dlc1/swwm_heavymahsheengun.zsc +++ b/zscript/dlc1/swwm_heavymahsheengun.zsc @@ -18,7 +18,7 @@ Class HeavyMahSheenGun : SWWMWeapon override void HudTick() { Super.HudTick(); - if ( !HeatInter ) HeatInter = SmoothDynamicValueInterpolator.Create(barrelheat,.5,1.,25.); + if ( !HeatInter ) HeatInter = SmoothDynamicValueInterpolator.Create(barrelheat,.5); HeatInter.Update(barrelheat); if ( lastfirespeed && (lastfirespeed != firespeed+1) && (Owner.player == players[consoleplayer]) ) { diff --git a/zscript/handler/swwm_handler_vanillaboss.zsc b/zscript/handler/swwm_handler_vanillaboss.zsc index 660280fe3..0aa78316f 100644 --- a/zscript/handler/swwm_handler_vanillaboss.zsc +++ b/zscript/handler/swwm_handler_vanillaboss.zsc @@ -523,9 +523,9 @@ extend Class SWWMHandler hmax = thealth; for ( int i=0; i<30; i++ ) oldhealth[i] = thealth; cummdamage = 0; - if ( !ihealth ) ihealth = SmoothLinearValueInterpolator.Create(thealth,max(1,hmax/120)); + if ( !ihealth ) ihealth = SmoothLinearValueInterpolator.Create(thealth,max(1,hmax/50)); else ihealth.Reset(thealth); - if ( !ihealthr ) ihealthr = SmoothDynamicValueInterpolator.Create(thealth,.5,1,100); + if ( !ihealthr ) ihealthr = SmoothDynamicValueInterpolator.Create(thealth,.5); else ihealthr.Reset(thealth); return; } diff --git a/zscript/hud/swwm_hud.zsc b/zscript/hud/swwm_hud.zsc index e5c7bb723..b12ba0cbd 100644 --- a/zscript/hud/swwm_hud.zsc +++ b/zscript/hud/swwm_hud.zsc @@ -1283,9 +1283,9 @@ Class SWWMStatusBar : BaseStatusBar minimapzoom = oldminimapzoom = 1.; LastHealth = CPlayer?CPlayer.health:100; let d = Demolitionist(CPlayer?CPlayer.mo:null); - HealthInter = SmoothDynamicValueInterpolator.Create(LastHealth,.5,1,100); - FuelInter = SmoothDynamicValueInterpolator.Create(d?(d.dashfuel/2):120,.5,1,120); - DashInter = SmoothDynamicValueInterpolator.Create(d?((40-d.dashcooldown)*3):40,.5,1,40); + HealthInter = SmoothDynamicValueInterpolator.Create(LastHealth,.5); + FuelInter = SmoothDynamicValueInterpolator.Create(d?(d.dashfuel/2):120,.5); + DashInter = SmoothDynamicValueInterpolator.Create(d?((40-d.dashcooldown)*3):40,.5); LagHealthInter = SmoothLinearValueInterpolator.Create(LastHealth,2); for ( int i=0; i<10; i++ ) LagHealth[i] = LastHealth; AmmoSlots[0] = 'RedShell'; @@ -1539,10 +1539,10 @@ Class SWWMStatusBar : BaseStatusBar Screen.DrawTexture(EnemyHTex[2],false,barpos.x+2,barpos.y+2,DTA_VirtualWidthF,ss1.x,DTA_VirtualHeightF,ss1.y,DTA_KeepRatio,true,DTA_Alpha,alph,DTA_WindowLeftF,ohw,DTA_WindowRightF,hw); if ( ct.cummdamage <= 0 ) continue; double calph = clamp(ct.cummspan-fractic,0.,20.)/20.; - Screen.DrawText(MiniHUDFontOutline,mhudfontcol[MCR_RED],barpos.x+3,barpos.y+10,String.Format("%d",ct.cummdamage),DTA_VirtualWidthF,ss1.x,DTA_VirtualHeightF,ss1.y,DTA_KeepRatio,true,DTA_Alpha,calph*alph); + Screen.DrawText(MiniHUDFontOutline,mhudfontcol[MCR_RED],barpos.x+3,barpos.y+10,(ct.cummdamage>=Actor.TELEFRAG_DAMAGE)?"∞":String.Format("%d",ct.cummdamage),DTA_VirtualWidthF,ss1.x,DTA_VirtualHeightF,ss1.y,DTA_KeepRatio,true,DTA_Alpha,calph*alph); if ( ct.cummflash <= 0 ) continue; double falph = max((ct.cummflash-FracTic)/15.,0.)**1.5; - Screen.DrawText(MiniHUDFontOutline,mhudfontcol[MCR_REDFLASH],barpos.x+3,barpos.y+10,String.Format("%d",ct.cummdamage),DTA_VirtualWidthF,ss1.x,DTA_VirtualHeightF,ss1.y,DTA_KeepRatio,true,DTA_Alpha,falph*calph*alph,DTA_LegacyRenderStyle,STYLE_Add); + Screen.DrawText(MiniHUDFontOutline,mhudfontcol[MCR_REDFLASH],barpos.x+3,barpos.y+10,(ct.cummdamage>=Actor.TELEFRAG_DAMAGE)?"∞":String.Format("%d",ct.cummdamage),DTA_VirtualWidthF,ss1.x,DTA_VirtualHeightF,ss1.y,DTA_KeepRatio,true,DTA_Alpha,falph*calph*alph,DTA_LegacyRenderStyle,STYLE_Add); } // player-owned trackers are drawn last cti.Reinit(); @@ -1627,7 +1627,7 @@ Class SWWMStatusBar : BaseStatusBar Screen.DrawText(MiniHUDFontOutline,mhudfontcol[MCR_RED],barpos.x+3,barpos.y+10,(ct.cummdamage>=Actor.TELEFRAG_DAMAGE)?"∞":String.Format("%d",ct.cummdamage),DTA_VirtualWidthF,ss1.x,DTA_VirtualHeightF,ss1.y,DTA_KeepRatio,true,DTA_Alpha,calph*alph); if ( ct.cummflash <= 0 ) continue; double falph = max((ct.cummflash-FracTic)/15.,0.)**1.5; - Screen.DrawText(MiniHUDFontOutline,mhudfontcol[MCR_REDFLASH],barpos.x+3,barpos.y+10,String.Format("%d",ct.cummdamage),DTA_VirtualWidthF,ss1.x,DTA_VirtualHeightF,ss1.y,DTA_KeepRatio,true,DTA_Alpha,falph*calph*alph,DTA_LegacyRenderStyle,STYLE_Add); + Screen.DrawText(MiniHUDFontOutline,mhudfontcol[MCR_REDFLASH],barpos.x+3,barpos.y+10,(ct.cummdamage>=Actor.TELEFRAG_DAMAGE)?"∞":String.Format("%d",ct.cummdamage),DTA_VirtualWidthF,ss1.x,DTA_VirtualHeightF,ss1.y,DTA_KeepRatio,true,DTA_Alpha,falph*calph*alph,DTA_LegacyRenderStyle,STYLE_Add); } } diff --git a/zscript/swwm_common.zsc b/zscript/swwm_common.zsc index 498f3a57c..50d857130 100644 --- a/zscript/swwm_common.zsc +++ b/zscript/swwm_common.zsc @@ -292,8 +292,8 @@ Class SWWMQuickCombatTracker : Inventory t.cummspan = target.bISMONSTER?120:30; t.cummflash = 15; } - t.intp = SmoothDynamicValueInterpolator.Create(t.lasthealth,.5,1,100); - t.intpl = SmoothLinearValueInterpolator.Create(t.laghealth[9],max(1,t.maxhealth/20)); + t.intp = SmoothDynamicValueInterpolator.Create(t.lasthealth,.5); + t.intpl = SmoothLinearValueInterpolator.Create(t.laghealth[9],max(1,t.maxhealth/50)); t.lifespan = target.bISMONSTER?((damage>0)?700:70):((damage>0)?140:35); t.fadein = 0; t.lvheight = target.Height; @@ -383,7 +383,7 @@ Class SmoothDynamicValueInterpolator { private double val, oldval, factor, mindiff, maxdiff; - static SmoothDynamicValueInterpolator Create( double val, double factor, double mindiff, double maxdiff ) + static SmoothDynamicValueInterpolator Create( double val, double factor, double mindiff = 1., double maxdiff = 0. ) { let v = new("SmoothDynamicValueInterpolator"); v.oldval = v.val = val; @@ -402,7 +402,7 @@ Class SmoothDynamicValueInterpolator if ( abs(newval-val) < mindiff ) val = newval; else { - double diff = min(abs(newval-val)*factor,maxdiff); + double diff = (maxdiff>0.)?min(abs(newval-val)*factor,maxdiff):(abs(newval-val)*factor); if ( val > newval ) val = max(newval,val-diff); else val = min(newval,val+diff); } diff --git a/zscript/weapons/swwm_deathlydeathcannon.zsc b/zscript/weapons/swwm_deathlydeathcannon.zsc index 4f044ed35..e46263f97 100644 --- a/zscript/weapons/swwm_deathlydeathcannon.zsc +++ b/zscript/weapons/swwm_deathlydeathcannon.zsc @@ -29,7 +29,7 @@ Class Ynykron : SWWMWeapon override void HudTick() { Super.HudTick(); - if ( !ChargeInter ) ChargeInter = SmoothDynamicValueInterpolator.Create(chargelevel*10,.5,1.,400.); + if ( !ChargeInter ) ChargeInter = SmoothDynamicValueInterpolator.Create(chargelevel*10,.5); ChargeInter.Update(chargelevel*10); if ( lastmode && (lastmode != inverted+1) && (Owner.player == players[consoleplayer]) ) { diff --git a/zscript/weapons/swwm_deepdarkimpact.zsc b/zscript/weapons/swwm_deepdarkimpact.zsc index 2431b0696..cb7dd5b42 100644 --- a/zscript/weapons/swwm_deepdarkimpact.zsc +++ b/zscript/weapons/swwm_deepdarkimpact.zsc @@ -57,7 +57,7 @@ Class DeepImpact : SWWMWeapon override void HudTick() { Super.HudTick(); - if ( !ChargeInter ) ChargeInter = SmoothDynamicValueInterpolator.Create(clipcount,.5,1.,25.); + if ( !ChargeInter ) ChargeInter = SmoothDynamicValueInterpolator.Create(clipcount,.5); ChargeInter.Update(clipcount); } diff --git a/zscript/weapons/swwm_thiccboolet.zsc b/zscript/weapons/swwm_thiccboolet.zsc index 55461bef2..79c60a78a 100644 --- a/zscript/weapons/swwm_thiccboolet.zsc +++ b/zscript/weapons/swwm_thiccboolet.zsc @@ -247,7 +247,7 @@ Class SilverBullet : SWWMWeapon override void HudTick() { Super.HudTick(); - if ( !ZoomInter ) ZoomInter = SmoothDynamicValueInterpolator.Create(zoomlevel*10,.5,1.,20.); + if ( !ZoomInter ) ZoomInter = SmoothDynamicValueInterpolator.Create(zoomlevel*10,.5); ZoomInter.Update(zoomlevel*10); if ( lastammo && (lastammo != fcbselected+1) && (Owner.player == players[consoleplayer]) ) {