Healthbar / Damnum backport from sidemods.

This commit is contained in:
Mari the Deer 2022-08-22 17:36:57 +02:00
commit b40d8d0633
1743 changed files with 683 additions and 869 deletions

View file

@ -92,7 +92,8 @@ extend Class SWWMHandler
ui bool ui_initialized;
ui TextureID bbar_f, bbar_r, bbar_d;
ui double bossalpha;
ui DynamicValueInterpolator ihealth, ihealthr;
ui SmoothLinearValueInterpolator ihealth;
ui SmoothDynamicValueInterpolator ihealthr;
ui int thealth, hmax;
ui int oldhealth[30];
ui int cummdamage, lastcummtic; // please do not misread
@ -184,7 +185,7 @@ extend Class SWWMHandler
return MAP_EVMAP30;
return MAP_NONE;
}
private void VanillaBossSpawn( WorldEvent e, SWWMCombatTracker trk )
private void VanillaBossSpawn( WorldEvent e )
{
if ( bossmap == -1 ) bossmap = WhichVanillaBossMap();
if ( bossmap == MAP_DE1M8 )
@ -193,7 +194,6 @@ extend Class SWWMHandler
{
bossactors.Push(e.Thing);
e.Thing.StartHealth = e.Thing.Health *= 3;
if ( trk ) trk.bBOSS = true;
e.Thing.GiveInventory('BossMarker',1);
}
bosstag = "$BT_BRUISERS";
@ -204,7 +204,6 @@ extend Class SWWMHandler
{
bossactors.Push(e.Thing);
e.Thing.StartHealth = e.Thing.Health *= 5;
if ( trk ) trk.bBOSS = true;
e.Thing.GiveInventory('BossMarker',1);
}
bosstag = "$BT_CYBIE";
@ -215,7 +214,6 @@ extend Class SWWMHandler
{
bossactors.Push(e.Thing);
e.Thing.StartHealth = e.Thing.Health *= 6;
if ( trk ) trk.bBOSS = true;
e.Thing.GiveInventory('BossMarker',1);
e.Thing.GiveInventory('EndgameBossMarker',1);
}
@ -227,7 +225,6 @@ extend Class SWWMHandler
{
bossactors.Push(e.Thing);
e.Thing.StartHealth = e.Thing.Health *= 4;
if ( trk ) trk.bBOSS = true;
e.Thing.GiveInventory('BossMarker',1);
}
bosstag = "$BT_SPIDER2";
@ -238,7 +235,6 @@ extend Class SWWMHandler
{
bossactors.Push(e.Thing);
e.Thing.StartHealth = e.Thing.Health *= 2;
if ( trk ) trk.bBOSS = true;
e.Thing.GiveInventory('BossMarker',1);
}
bosstag = "$BT_DIMPLE";
@ -250,7 +246,6 @@ extend Class SWWMHandler
bossbrainactor = e.Thing;
bossactors.Push(e.Thing);
e.Thing.StartHealth = e.Thing.Health *= 40; // goodbye, instakills
if ( trk ) trk.bBOSS = true;
e.Thing.GiveInventory('BossMarker',1);
e.Thing.GiveInventory('EndgameBossMarker',1);
}
@ -267,7 +262,6 @@ extend Class SWWMHandler
{
bossactors.Push(e.Thing);
e.Thing.StartHealth = e.Thing.Health *= 4;
if ( trk ) trk.bBOSS = true;
e.Thing.GiveInventory('BossMarker',1);
}
bosstag = "$BT_CYBIE2";
@ -278,7 +272,6 @@ extend Class SWWMHandler
{
bossactors.Push(e.Thing);
e.Thing.StartHealth = e.Thing.Health *= 4;
if ( trk ) trk.bBOSS = true;
e.Thing.GiveInventory('BossMarker',1);
}
bosstag = "$BT_LICHES";
@ -289,7 +282,6 @@ extend Class SWWMHandler
{
bossactors.Push(e.Thing);
e.Thing.StartHealth = e.Thing.Health *= 3;
if ( trk ) trk.bBOSS = true;
e.Thing.GiveInventory('BossMarker',1);
}
bosstag = "$BT_MINOTAUR";
@ -300,7 +292,6 @@ extend Class SWWMHandler
{
bossactors.Push(e.Thing);
e.Thing.StartHealth = e.Thing.Health *= 2;
if ( trk ) trk.bBOSS = true;
bosstag = "$BT_DSPARIL";
e.Thing.GiveInventory('BossMarker',1);
e.Thing.GiveInventory('EndgameBossMarker',1);
@ -312,7 +303,6 @@ extend Class SWWMHandler
initialized = false;
bossactors.Push(e.Thing);
e.Thing.StartHealth = e.Thing.Health *= 8;
if ( trk ) trk.bBOSS = true;
bosstag = "$BT_DSPARIL2";
e.Thing.GiveInventory('BossMarker',1);
e.Thing.GiveInventory('EndgameBossMarker',1);
@ -325,7 +315,6 @@ extend Class SWWMHandler
{
bossactors.Push(e.Thing);
e.Thing.StartHealth = e.Thing.Health *= 2;
if ( trk ) trk.bBOSS = true;
bosstag = "$BT_CLERIC";
e.Thing.GiveInventory('BossMarker',1);
}
@ -336,7 +325,6 @@ extend Class SWWMHandler
{
bossactors.Push(e.Thing);
e.Thing.StartHealth = e.Thing.Health *= 2;
if ( trk ) trk.bBOSS = true;
bosstag = "$BT_FIGHTER";
e.Thing.GiveInventory('BossMarker',1);
}
@ -347,7 +335,6 @@ extend Class SWWMHandler
{
bossactors.Push(e.Thing);
e.Thing.StartHealth = e.Thing.Health *= 2;
if ( trk ) trk.bBOSS = true;
bosstag = "$BT_MAGE";
e.Thing.GiveInventory('BossMarker',1);
}
@ -358,7 +345,6 @@ extend Class SWWMHandler
{
bossactors.Push(e.Thing);
e.Thing.StartHealth = e.Thing.Health *= 4;
if ( trk ) trk.bBOSS = true;
bosstag = "$BT_DRAGON";
e.Thing.GiveInventory('BossMarker',1);
}
@ -369,7 +355,6 @@ extend Class SWWMHandler
{
bossactors.Push(e.Thing);
e.Thing.StartHealth = e.Thing.Health *= 8;
if ( trk ) trk.bBOSS = true;
bosstag = "$BT_HERESIARCH";
e.Thing.GiveInventory('BossMarker',1);
}
@ -380,7 +365,6 @@ extend Class SWWMHandler
{
bossactors.Push(e.Thing);
e.Thing.StartHealth = e.Thing.Health *= 10;
if ( trk ) trk.bBOSS = true;
bosstag = "$BT_KORAX";
e.Thing.GiveInventory('BossMarker',1);
e.Thing.GiveInventory('EndgameBossMarker',1);
@ -392,7 +376,6 @@ extend Class SWWMHandler
{
bossactors.Push(e.Thing);
e.Thing.StartHealth = e.Thing.Health *= 4;
if ( trk ) trk.bBOSS = true;
bosstag = "$BT_DEATHKINGS";
initialized = true; // healthbar shows from the start
e.Thing.GiveInventory('BossMarker',1);
@ -416,7 +399,6 @@ extend Class SWWMHandler
initialized = false;
bossactors.Push(e.Thing);
e.Thing.StartHealth = e.Thing.Health *= 5;
if ( trk ) trk.bBOSS = true;
bosstag = "$BT_ARCHANGELUS";
e.Thing.GiveInventory('BossMarker',1);
e.Thing.GiveInventory('EndgameBossMarker',1);
@ -429,7 +411,6 @@ extend Class SWWMHandler
initialized = false;
bossactors.Push(e.Thing);
e.Thing.StartHealth = e.Thing.Health *= 5;
if ( trk ) trk.bBOSS = true;
bosstag = "$BT_ARCHANGELUS";
e.Thing.GiveInventory('BossMarker',1);
e.Thing.GiveInventory('EndgameBossMarker',1);
@ -440,7 +421,6 @@ extend Class SWWMHandler
{
bossactors.Push(e.Thing);
e.Thing.StartHealth = e.Thing.Health *= 10;
if ( trk ) trk.bBOSS = true;
bosstag = "ROM3R-0.666";
e.Thing.GiveInventory('BossMarker',1);
e.Thing.GiveInventory('EndgameBossMarker',1);
@ -497,9 +477,9 @@ extend Class SWWMHandler
hmax = thealth;
for ( int i=0; i<30; i++ ) oldhealth[i] = thealth;
cummdamage = 0;
if ( !ihealth ) ihealth = DynamicValueInterpolator.Create(thealth,.1,1,1000);
if ( !ihealth ) ihealth = SmoothLinearValueInterpolator.Create(thealth,max(1,hmax/120));
else ihealth.Reset(thealth);
if ( !ihealthr ) ihealthr = DynamicValueInterpolator.Create(thealth,.5,1,1000);
if ( !ihealthr ) ihealthr = SmoothDynamicValueInterpolator.Create(thealth,.5,1,100);
else ihealthr.Reset(thealth);
return;
}
@ -534,7 +514,7 @@ extend Class SWWMHandler
ui void DrawBossBar( SWWMStatusBar bar )
{
if ( !ui_initialized || (bossalpha <= 0.) ) return;
if ( !mSmallFont ) mSmallFont = Font.GetFont('TewiFont');
if ( !mSmallFont ) mSmallFont = Font.GetFont('TewiFontOutline');
if ( !bbar_f ) bbar_f = TexMan.CheckForTexture("graphics/HUD/BossHealthBarBox.png",TexMan.Type_Any);
if ( !bbar_r ) bbar_r = TexMan.CheckForTexture("graphics/HUD/BossHealthBar.png",TexMan.Type_Any);
if ( !bbar_d ) bbar_d = TexMan.CheckForTexture("graphics/HUD/BossHealthBarDecay.png",TexMan.Type_Any);
@ -542,10 +522,10 @@ extend Class SWWMHandler
Screen.DrawTexture(bbar_f,false,vpos.x-2,vpos.y-2,DTA_VirtualWidthF,bar.ss.x,DTA_VirtualHeightF,bar.ss.y,DTA_KeepRatio,true,DTA_Alpha,bossalpha);
if ( hmax )
{
int rw = int(clamp((ihealthr.GetValue()*300.)/hmax,0.,300.));
int dw = int(clamp((ihealth.GetValue()*300.)/hmax,0.,300.));
Screen.DrawTexture(bbar_d,false,vpos.x,vpos.y,DTA_VirtualWidthF,bar.ss.x,DTA_VirtualHeightF,bar.ss.y,DTA_KeepRatio,true,DTA_Alpha,bossalpha,DTA_WindowRight,dw);
Screen.DrawTexture(bbar_r,false,vpos.x,vpos.y,DTA_VirtualWidthF,bar.ss.x,DTA_VirtualHeightF,bar.ss.y,DTA_KeepRatio,true,DTA_Alpha,bossalpha,DTA_WindowRight,rw);
double rw = clamp((ihealthr.GetValue(bar.FracTic)*300.)/hmax,0.,300.);
double dw = clamp((ihealth.GetValue(bar.FracTic)*300.)/hmax,0.,300.);
Screen.DrawTexture(bbar_d,false,vpos.x,vpos.y,DTA_VirtualWidthF,bar.ss.x,DTA_VirtualHeightF,bar.ss.y,DTA_KeepRatio,true,DTA_Alpha,bossalpha,DTA_WindowRightF,dw);
Screen.DrawTexture(bbar_r,false,vpos.x,vpos.y,DTA_VirtualWidthF,bar.ss.x,DTA_VirtualHeightF,bar.ss.y,DTA_KeepRatio,true,DTA_Alpha,bossalpha,DTA_WindowRightF,rw);
}
if ( (cummdamage > 0) && (gametic < lastcummtic+150) )
{