Prev: B03B Up: Map Next: B0D1
B065: Handler: Sideways Missile Flame
Keep the flame (types A6/A7 here, A2/A3 via Handler_SidewaysMissileFlame_HangRight) attached to the missile held in the slot at Object_Slot_1. The flame is cleared if that slot no longer holds the missile.
Input
IX Actor slot
Hang this actor off the A4 slot at Object_Slot_1.
Handler_SidewaysMissileFlame B065 LD A,($6108) Fetch Object_Slot_1.
B068 CP $A4 Jump to Handler_Missile_HideActor if the type is not A4.
B06A JR NZ,Handler_Missile_HideActor
Alternate the flame frame and colour.
B06C LD A,(IX+$00) Fetch the actor type.
B06F XOR %00000001 Flip bit 0.
B071 LD (IX+$00),A Write it back.
B074 LD A,(IX+$07) Fetch the actor colour.
B077 XOR %00000100 Flip bit 2.
B079 LD (IX+$07),A Write it back.
Match the flame Y to the missile Y.
B07C LD A,($610C) Fetch 610C.
B07F LD (IX+$04),A Write it as the actor Y.
Place the flame to the left of the missile's world X.
B082 LD HL,($610A) Fetch 610A.
B085 LD BC,$0018 Set the offset in BC to 0018.
B088 AND A Clear the carry flag.
B089 SBC HL,BC Subtract the offset.
B08B LD A,H Fetch the high byte.
B08C AND %00011111 Keep only bits 0-4.
B08E LD H,A Write it back.
B08F LD (IX+$02),L Write the low byte as the actor world X.
B092 LD (IX+$03),H Write the high byte.
B095 JP DrawCurrentActor_Draw Jump to DrawCurrentActor_Draw.
The same hang, offset right, for type A0.
Handler_SidewaysMissileFlame_HangRight B098 LD A,($6108) Fetch Object_Slot_1.
B09B CP $A0 Jump to Handler_Missile_HideActor if the type is not A0.
B09D JR NZ,Handler_Missile_HideActor
Alternate the flame frame and colour.
B09F LD A,(IX+$00) Fetch the actor type.
B0A2 XOR %00000001 Flip bit 0.
B0A4 LD (IX+$00),A Write it back.
B0A7 LD A,(IX+$07) Fetch the actor colour.
B0AA XOR %00000100 Flip bit 2.
B0AC LD (IX+$07),A Write it back.
Match the flame Y to the missile Y.
B0AF LD A,($610C) Fetch 610C.
B0B2 LD (IX+$04),A Write it as the actor Y.
Place the flame to the right of the missile's world X.
B0B5 LD HL,($610A) Fetch 610A.
B0B8 LD BC,$0014 Add a 14 offset.
B0BB ADD HL,BC
B0BC LD A,H Fetch the high byte.
B0BD AND %00011111 Keep only bits 0-4.
B0BF LD H,A Write it back.
B0C0 LD (IX+$02),L Write the low byte as the actor world X.
B0C3 LD (IX+$03),H Write the high byte.
B0C6 JP DrawCurrentActor_Draw Jump to DrawCurrentActor_Draw.
Free this flame's slot because the missile is gone.
Handler_Missile_HideActor B0C9 CALL DrawCachedSprite Call DrawCachedSprite.
B0CC LD (IX+$00),$00 Write 00 to the actor type.
B0D0 RET Return.
Prev: B03B Up: Map Next: B0D1