Prev: B3DC Up: Map Next: B460
B3E8: Handler: Jetman Death
Flash the dying actor from the frame timer, then convert the slot to type 85.
Input
IX Actor slot
Flash the dying actor from the frame timer.
Handler_JetmanDeath B3E8 LD A,($5E42) Fetch GameTimer.
B3EB CPL Invert the bits.
B3EC AND %00000001 Keep only bit 0.
B3EE JR Z,Handler_JetmanDeath_TripleTimer Jump to Handler_JetmanDeath_TripleTimer if this is an odd frame.
B3F0 DEC (IX+$08) Jump to Handler_JetmanDeath_NoLives if the death timer is now zero.
B3F3 JR Z,Handler_JetmanDeath_NoLives
Pick a death-frame triplet and apply its X/Y offsets.
Handler_JetmanDeath_TripleTimer B3F5 LD A,(IX+$08) Fetch the death timer.
B3F8 LD C,A Stash it in C.
B3F9 ADD A,A Double it.
B3FA ADD A,C Add the original.
B3FB LD L,A Create an offset in HL.
B3FC LD H,$00
B3FE LD BC,$B451 Point HL at that triplet, offset from Handler_JetmanDeath_Offsets.
B401 ADD HL,BC
Fetch the frame byte and write it as the actor type.
B402 EX DE,HL Switch the table pointer into DE.
B403 LD A,(DE) Copy the next table byte.
B404 INC DE
Sprite IDs begin at E0 ("Explosion: Frame 1").
B405 ADD A,$E0 Add E0 for the dying frames.
B407 LD (IX+$00),A Write it to the actor type.
Offset the actor world X by the table value.
B40A LD L,(IX+$02) Fetch the actor world X.
B40D LD H,(IX+$03) Fetch the high byte.
B410 PUSH HL Stash the world X on the stack.
Fetch the X offset and sign-extend it.
B411 LD A,(DE) Copy the next table byte.
B412 INC DE
B413 LD C,A Copy the X offset into C.
B414 LD B,$00 Clear B.
B416 AND A Jump to Handler_JetmanDeath_WriteX if the offset is positive.
B417 JP P,Handler_JetmanDeath_WriteX
B41A DEC B Sign-extend into B.
Handler_JetmanDeath_WriteX B41B CALL MaskWorldX Call MaskWorldX.
B41E LD (IX+$02),L Write the low byte as the actor world X.
B421 LD (IX+$03),H Write the high byte.
Offset the actor Y by the table value.
B424 LD A,(IX+$04) Fetch the actor Y.
B427 PUSH AF Stash it on the stack.
B428 LD A,(DE) Fetch the Y offset.
B429 ADD A,(IX+$04) Add the actor Y.
B42C LD (IX+$04),A Write it back.
Draw the dying frame, then restore the stored position.
B42F CALL DrawActorSprite Call DrawActorSprite.
B432 CALL ColouriseSprite Call ColouriseSprite.
B435 POP AF Restore the actor Y from the stack.
B436 LD (IX+$04),A Write it back.
B439 POP HL Restore the world X from the stack.
B43A LD (IX+$02),L Write the low byte back.
B43D LD (IX+$03),H Write the high byte back.
B440 RET Return.
Clear the lives count and become type 85.
Handler_JetmanDeath_NoLives B441 CALL ClearSpriteScratch Call ClearSpriteScratch.
B444 XOR A Write 00 to ActivePlayer_Lives.
B445 LD ($5EA1),A
B448 LD (IX+$00),$85 Write 85 to the actor type.
B44C LD (IX+$05),$40 Write 40 to the actor speed.
B450 RET Return.
Handler_JetmanDeath_Offsets B451 DEFB $00,$00,$00,$00,$18,$FC,$01,$10 Death-frame offsets.
B459 DEFB $FA,$02,$08,$FE,$03,$00,$00
Prev: B3DC Up: Map Next: B460