Prev: ADAB Up: Map Next: AE37
ADEA: Handler: Upward Missile Flame
Keep the flame (types 82/83 or 86/87 via Handler_UpwardMissileFlame_HangLeft) attached to the missile held in the slot at Object_Slot_3. The flame is cleared if that slot no longer holds the missile.
Input
IX Actor slot
Hang this actor off the 80 slot at Object_Slot_3.
Handler_UpwardMissileFlame ADEA LD A,($6138) Fetch Object_Slot_3.
ADED CP $80 Jump to Handler_Missile_ClearType if the type is not 80.
ADEF JR NZ,Handler_Missile_ClearType
ADF1 LD HL,($613A) Fetch Object_Slot_3_Position.
ADF4 LD BC,$0014 Add a 14 offset.
ADF7 ADD HL,BC
Place this actor at the missile's position, offset for the flame.
Handler_Missile_MaskWorldX ADF8 LD A,H Fetch the high byte.
ADF9 AND %00011111 Keep only bits 0-4.
ADFB LD H,A Write it back.
ADFC LD (IX+$02),L Write the low byte as the actor world X.
ADFF LD (IX+$03),H Write the high byte.
AE02 LD A,($613C) Fetch Object_Slot_3_Y.
AE05 ADD A,$10 Add 10.
AE07 LD (IX+$04),A Write it as the actor Y.
Alternate the flame frame and colour.
AE0A LD A,(IX+$00) Fetch the actor type.
AE0D XOR %00000001 Flip bit 0.
AE0F LD (IX+$00),A Write it back.
AE12 LD A,(IX+$07) Fetch the actor colour.
AE15 XOR %00000100 Flip bit 2.
AE17 LD (IX+$07),A Write it back.
AE1A JP DrawCurrentActor_Draw Jump to DrawCurrentActor_Draw.
The same hang, offset left, for type 84.
Handler_UpwardMissileFlame_HangLeft AE1D LD A,($6138) Fetch Object_Slot_3.
AE20 CP $84 Jump to Handler_Missile_ClearType if the type is not 84.
AE22 JR NZ,Handler_Missile_ClearType
AE24 LD HL,($613A) Fetch Object_Slot_3_Position.
AE27 LD BC,$0010 Set the offset in BC to 0010.
AE2A AND A Clear the carry flag.
AE2B SBC HL,BC Subtract the offset.
AE2D JR Handler_Missile_MaskWorldX Jump to Handler_Missile_MaskWorldX.
Handler_Missile_ClearType AE2F CALL DrawCachedSprite Call DrawCachedSprite.
AE32 LD (IX+$00),$00 Write 00 to the actor type.
AE36 RET Return.
Prev: ADAB Up: Map Next: AE37