diff options
Diffstat (limited to 'engine/hp_bar.asm')
-rwxr-xr-x | engine/hp_bar.asm | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/engine/hp_bar.asm b/engine/hp_bar.asm index 789f1bd7..566a7b61 100755 --- a/engine/hp_bar.asm +++ b/engine/hp_bar.asm @@ -1,9 +1,9 @@ -HPBarLength: ; f86c (3:786c) +HPBarLength: call GetPredefRegisters ; calculates bc * 48 / de, the number of pixels the HP bar has ; the result is always at least 1 -GetHPBarLength: ; f86f (3:786f) +GetHPBarLength: push hl xor a ld hl, H_MULTIPLICAND @@ -45,7 +45,7 @@ GetHPBarLength: ; f86f (3:786f) ret ; predef $48 -UpdateHPBar: ; f8ad (3:78ad) +UpdateHPBar: UpdateHPBar2: push hl ld hl, wHPBarOldHP @@ -87,6 +87,7 @@ UpdateHPBar2: call UpdateHPBar_CompareNewHPToOldHP jr z, .animateHPBarDone jr nc, .HPIncrease +; HP decrease dec bc ; subtract 1 HP ld a, c ld [wHPBarNewHP], a @@ -95,7 +96,7 @@ UpdateHPBar2: call UpdateHPBar_CalcOldNewHPBarPixels ld a, e sub d ; calc pixel difference - jr .asm_f90e + jr .ok .HPIncrease inc bc ; add 1 HP ld a, c @@ -105,7 +106,7 @@ UpdateHPBar2: call UpdateHPBar_CalcOldNewHPBarPixels ld a, d sub e ; calc pixel difference -.asm_f90e +.ok call UpdateHPBar_PrintHPNumber and a jr z, .noPixelDifference @@ -136,7 +137,7 @@ UpdateHPBar2: ; animates the HP bar going up or down for (a) ticks (two waiting frames each) ; stops prematurely if bar is filled up ; e: current health (in pixels) to start with -UpdateHPBar_AnimateHPBar: ; f941 (3:7941) +UpdateHPBar_AnimateHPBar: push hl .barAnimationLoop push af @@ -162,7 +163,7 @@ UpdateHPBar_AnimateHPBar: ; f941 (3:7941) ret ; compares old HP and new HP and sets c and z flags accordingly -UpdateHPBar_CompareNewHPToOldHP: ; f961 (3:7961) +UpdateHPBar_CompareNewHPToOldHP: ld a, d sub b ret nz @@ -171,7 +172,7 @@ UpdateHPBar_CompareNewHPToOldHP: ; f961 (3:7961) ret ; calcs HP difference between bc and de (into de) -UpdateHPBar_CalcHPDifference: ; f967 (3:7967) +UpdateHPBar_CalcHPDifference: ld a, d sub b jr c, .oldHPGreater @@ -200,7 +201,7 @@ UpdateHPBar_CalcHPDifference: ; f967 (3:7967) ld de, $0 ret -UpdateHPBar_PrintHPNumber: ; f985 (3:7985) +UpdateHPBar_PrintHPNumber: push af push de ld a, [wHPBarType] @@ -238,7 +239,7 @@ UpdateHPBar_PrintHPNumber: ; f985 (3:7985) ; calcs number of HP bar pixels for old and new HP value ; d: new pixels ; e: old pixels -UpdateHPBar_CalcOldNewHPBarPixels: ; f9be (3:79be) +UpdateHPBar_CalcOldNewHPBarPixels: push hl ld hl, wHPBarMaxHP ld a, [hli] ; max HP into de |