Prev: B98E Up: Map Next: BA3D
B9EF: Handle weapon energy loss
Used by the routines at B372 and BA3D.
Input
A The quantity of energy to loss
B9EF LD HL,$A093 Set A093 to the energy to loss
B9F2 LD (HL),A
B9F3 LD A,($A014) Return if weapon energy level equals zero
B9F6 OR A
B9F7 RET Z
B9F8 LD A,($A018) Decrement weapon energy
B9FB SUB (HL)
B9FC LD ($A018),A
B9FF RET P Return if energy still a positive value
Weapon energy quantity has been depleated
BA00 ADD A,$32 Increment weapon energy by 50
BA02 LD ($A018),A
BA05 LD A,($A014) Decrement weapon energy level
BA08 DEC A
BA09 OR A if weapon energy level reaches zero jump forward
BA0A JP Z,$BA11
BA0D LD ($A014),A Set the new weapon energy level
BA10 RET
weapon energy level is zero
BA11 LD A,($A06E) Decrement the accumulated energy for weapons
BA14 DEC A
BA15 CP $FF Return if the accumulated energy is alredy zero
BA17 RET Z
BA18 LD ($A06E),A Set the new number of accumulated energy for weapon
BA1B LD A,$01 Set color attribute blue for weapon icon
BA1D LD HL,($A015) Set HL to point to the current weapon icon HUD in attribute file
BA20 CALL $B983 Set weapon icon in HUD to the color at A (aatribute file)
BA23 LD HL,($A015) Point HL to the weapon icon into the attribute buffer
BA26 LD DE,$8CFF
BA29 ADD HL,DE
BA2A CALL $B983 Set weapon icon in HUD to the color at A (attribute buffer)
BA2D LD HL,($A015) Set A015 to point to the previous weapon icon
BA30 DEC HL
BA31 DEC HL
BA32 LD ($A015),HL
BA35 LD A,$05 Set weapon energy level to max
BA37 LD ($A014),A
BA3A JP $B9D7 Jump to change the current weapon for Rex
Prev: B98E Up: Map Next: BA3D