From 1b82e52f350784a7c58a4b7eb2ac730ae259383b Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Mon, 22 Sep 2025 12:01:53 -0400 Subject: [PATCH] v3.2.5: added a new larger boss HP bar for full size UI --- core/src/main/assets/interfaces/boss_hp.png | Bin 402 -> 871 bytes .../scenes/GameScene.java | 2 +- .../ui/BossHealthBar.java | 80 ++++++++++++------ 3 files changed, 57 insertions(+), 25 deletions(-) diff --git a/core/src/main/assets/interfaces/boss_hp.png b/core/src/main/assets/interfaces/boss_hp.png index b664ac59211f9dd5239391d0d2f9f0be187e2aa5..50e4f2dca33745a0b1aa9fa8c1d47351d95015de 100644 GIT binary patch literal 871 zcmV-t1DO1YP)pIisePpr)1O+QZDkt(h(^dw_FQSx|$BdH?_bii35AC@&=^A#!bDv#OYLA}}N- zASWp!Dl8=tJvTQwGdesrHaIdpKR7ivF+4suG&V3h zJvK8nFFHImGBhqZJ2WvfEjT(eFfuGRIWjLXD>gVWE-)%JH!v+PDKs`OEG{TBH7+YH zCo(iGDl8^3Gb|}9B``88C@Lf`F)A)FDJ?H3EG{Q2Eheo(G>|JVeI+nyA1q-VDZ;|S zot>S8goJBrYhPbqfPx4%00001bW%=J06^y0W&i*J0ZBwbRCodG)=6hQ1PHMzF+dhWqRa`5 z!U=)w2~kQI2)<;neE{MJehgf6fGqjCRM3cE+jg zj*Um`P|rUGM@p9-V{loh=jVg5kkaeAHq(;NZ6ih~Oq1OOO{g0G|#;xZpDG2GpD zLN;jhr*{REzQnL1S`%VEBbSxX8WZz1xvY%Vh?wulWfioB#EdFR1Bf|iQdteHJ~6+L x%j#(Li1~wD)W1Rb z$bjaKDphqw6*UEQO=T?|Rb^FqH4PY7S+4wmwY z(rOxtatcza>I$;*k}`4<|3BY+dh76+Lu>a3SON|2YA&6rr&pAlxOvr#HVyq^C4(C` zZme9nvcJE-qN2iGfKL;sh^ZvVFPK59`=f~ykhjm%#WAFU@$LmvrVvK~mJ8vRd$apm z@BFt&u~2;Xx;y>M@yf#N)(v;IJ<(R){AD4xgPCD!@`R5!wUYUISvK_Y2%GVQJYCT> z%X#s=c`Wb!0@Fl#mpDACnfD_vagFretbn!ir$}n|u3`$E7cq0=RS8Lj=BwA{9D7l| zpuMtp&bFA{e;x@oBt|V^)ah{GVA%FAGW@%aP=V=**gFPK``EO$Noy3>U2FIq&R(uK uZRfGldbgU_%QUxd$v?Wp-u{9824>$E$_^Jr%%y-nVeoYIb6Mw<&;$Usb(T5+ diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/GameScene.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/GameScene.java index 201963180..fbe76f024 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/GameScene.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/GameScene.java @@ -459,7 +459,7 @@ public class GameScene extends PixelScene { boss = new BossHealthBar(); boss.camera = uiCamera; - boss.setPos( (uiCamera.width - boss.width())/2, screentop + 26); + boss.setPos( (uiCamera.width - boss.width())/2, screentop + uiSize == 0 ? 26 : 7); add(boss); resume = new ResumeIndicator(); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/BossHealthBar.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/BossHealthBar.java index 2995f626b..61a02ab5d 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/BossHealthBar.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/BossHealthBar.java @@ -23,6 +23,8 @@ package com.shatteredpixel.shatteredpixeldungeon.ui; import com.shatteredpixel.shatteredpixeldungeon.Assets; import com.shatteredpixel.shatteredpixeldungeon.Dungeon; +import com.shatteredpixel.shatteredpixeldungeon.SPDSettings; +import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon; import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob; import com.shatteredpixel.shatteredpixeldungeon.effects.particles.BloodParticle; import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene; @@ -32,6 +34,7 @@ import com.watabou.noosa.BitmapText; import com.watabou.noosa.Image; import com.watabou.noosa.particles.Emitter; import com.watabou.noosa.ui.Component; +import com.watabou.utils.Callback; public class BossHealthBar extends Component { @@ -55,6 +58,8 @@ public class BossHealthBar extends Component { private static BossHealthBar instance; private static boolean bleeding; + private boolean large; + public BossHealthBar() { super(); visible = active = (boss != null); @@ -70,20 +75,22 @@ public class BossHealthBar extends Component { @Override protected void createChildren() { - bar = new Image(asset, 0, 0, 64, 16); + this.large = SPDSettings.interfaceSize() != 0; + + bar = large ? new Image(asset, 0, 16, 128, 30) : new Image(asset, 0, 0, 64, 16); add(bar); width = bar.width; height = bar.height; - rawShielding = new Image(asset, 15, 25, 47, 4); + rawShielding = large ? new Image(asset, 0, 55, 96, 9) : new Image(asset, 71, 5, 47, 4); rawShielding.alpha(0.5f); add(rawShielding); - shieldedHP = new Image(asset, 15, 25, 47, 4); + shieldedHP = large ? new Image(asset, 0, 55, 96, 9) : new Image(asset, 71, 5, 47, 4); add(shieldedHP); - hp = new Image(asset, 15, 19, 47, 4); + hp = large ? new Image(asset, 0, 46, 96, 9) : new Image(asset, 71, 0, 47, 4); add(hp); hpText = new BitmapText(PixelScene.pixelFont); @@ -110,12 +117,16 @@ public class BossHealthBar extends Component { add(bossInfo); if (boss != null) { - buffs = new BuffIndicator(boss, false); + buffs = new BuffIndicator(boss, large); BuffIndicator.setBossInstance(buffs); add(buffs); } - skull = new Image(asset, 5, 18, 6, 6); + if (boss != null && large) { + skull = boss.sprite(); + } else { + skull = new Image(asset, 64, 0, 6, 6); + } add(skull); blood = new Emitter(); @@ -131,11 +142,11 @@ public class BossHealthBar extends Component { bar.x = x; bar.y = y; - hp.x = shieldedHP.x = rawShielding.x = bar.x+15; - hp.y = shieldedHP.y = rawShielding.y = bar.y+3; + hp.x = shieldedHP.x = rawShielding.x = bar.x+(large ? 30 : 15); + hp.y = shieldedHP.y = rawShielding.y = bar.y+(large ? 2 : 3); - hpText.scale.set(PixelScene.align(0.5f)); - hpText.x = hp.x + 1; + if (!large) hpText.scale.set(PixelScene.align(0.5f)); + hpText.x = hp.x + (large ? (96-hpText.width())/2f : 1); hpText.y = hp.y + (hp.height - (hpText.baseLine()+hpText.scale.y))/2f; hpText.y -= 0.001f; //prefer to be slightly higher PixelScene.align(hpText); @@ -143,11 +154,16 @@ public class BossHealthBar extends Component { bossInfo.setRect(x, y, bar.width, bar.height); if (buffs != null) { - buffs.setRect(hp.x, hp.y + 5, 47, 8); + if (large) { + buffs.setRect(hp.x+1, hp.y + 12, 80, 16); + } else { + buffs.setRect(hp.x, hp.y + 5, 40, 7); + } } - skull.x = bar.x+5; - skull.y = bar.y+5; + int paneSize = large ? 30 : 16; + skull.x = bar.x + (paneSize - skull.width())/2f; + skull.y = bar.y + (paneSize - skull.height())/2f; } @Override @@ -174,8 +190,10 @@ public class BossHealthBar extends Component { rawShielding.scale.x = shield/(float)max; if (bleeding != blood.on){ - if (bleeding) skull.tint( 0xcc0000, 0.6f ); + if (bleeding) skull.tint( 0xcc0000, large ? 0.3f : 0.6f ); else skull.resetColor(); + bringToFront(blood); + blood.pos(skull); blood.on = bleeding; } @@ -184,6 +202,7 @@ public class BossHealthBar extends Component { } else { hpText.text(health + "+" + shield + "/" + max); } + hpText.x = hp.x + (large ? (96-hpText.width())/2f : 1); } } @@ -196,17 +215,30 @@ public class BossHealthBar extends Component { BossHealthBar.boss = boss; bleed(false); if (instance != null) { - instance.visible = instance.active = true; - if (boss != null){ - if (instance.buffs != null){ - instance.remove(instance.buffs); - instance.buffs.destroy(); + ShatteredPixelDungeon.runOnRenderThread(new Callback() { + @Override + public void call() { + instance.visible = instance.active = true; + if (boss != null){ + if (instance.large){ + if (instance.skull != null){ + instance.remove(instance.skull); + instance.skull.destroy(); + } + instance.skull = boss.sprite(); + instance.add(instance.skull); + } + if (instance.buffs != null){ + instance.remove(instance.buffs); + instance.buffs.destroy(); + } + instance.buffs = new BuffIndicator(boss, instance.large); + BuffIndicator.setBossInstance(instance.buffs); + instance.add(instance.buffs); + instance.layout(); + } } - instance.buffs = new BuffIndicator(boss, false); - BuffIndicator.setBossInstance(instance.buffs); - instance.add(instance.buffs); - instance.layout(); - } + }); } }