Prev: 45115 Up: Map Next: 45265
45157: Handler: Sideways Missile Flame
Keep the flame (types 166/167 here, 162/163 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 164 slot at Object_Slot_1.
Handler_SidewaysMissileFlame 45157 LD A,(24840) Fetch Object_Slot_1.
45160 CP 164 Jump to Handler_Missile_HideActor if the type is not 164.
45162 JR NZ,Handler_Missile_HideActor
Alternate the flame frame and colour.
45164 LD A,(IX+0) Fetch the actor type.
45167 XOR %00000001 Flip bit 0.
45169 LD (IX+0),A Write it back.
45172 LD A,(IX+7) Fetch the actor colour.
45175 XOR %00000100 Flip bit 2.
45177 LD (IX+7),A Write it back.
Match the flame Y to the missile Y.
45180 LD A,(24844) Fetch 24844.
45183 LD (IX+4),A Write it as the actor Y.
Place the flame to the left of the missile's world X.
45186 LD HL,(24842) Fetch 24842.
45189 LD BC,24 Set the offset in BC to 0024.
45192 AND A Clear the carry flag.
45193 SBC HL,BC Subtract the offset.
45195 LD A,H Fetch the high byte.
45196 AND %00011111 Keep only bits 0-4.
45198 LD H,A Write it back.
45199 LD (IX+2),L Write the low byte as the actor world X.
45202 LD (IX+3),H Write the high byte.
45205 JP DrawCurrentActor_Draw Jump to DrawCurrentActor_Draw.
The same hang, offset right, for type 160.
Handler_SidewaysMissileFlame_HangRight 45208 LD A,(24840) Fetch Object_Slot_1.
45211 CP 160 Jump to Handler_Missile_HideActor if the type is not 160.
45213 JR NZ,Handler_Missile_HideActor
Alternate the flame frame and colour.
45215 LD A,(IX+0) Fetch the actor type.
45218 XOR %00000001 Flip bit 0.
45220 LD (IX+0),A Write it back.
45223 LD A,(IX+7) Fetch the actor colour.
45226 XOR %00000100 Flip bit 2.
45228 LD (IX+7),A Write it back.
Match the flame Y to the missile Y.
45231 LD A,(24844) Fetch 24844.
45234 LD (IX+4),A Write it as the actor Y.
Place the flame to the right of the missile's world X.
45237 LD HL,(24842) Fetch 24842.
45240 LD BC,20 Add a 20 offset.
45243 ADD HL,BC
45244 LD A,H Fetch the high byte.
45245 AND %00011111 Keep only bits 0-4.
45247 LD H,A Write it back.
45248 LD (IX+2),L Write the low byte as the actor world X.
45251 LD (IX+3),H Write the high byte.
45254 JP DrawCurrentActor_Draw Jump to DrawCurrentActor_Draw.
Free this flame's slot because the missile is gone.
Handler_Missile_HideActor 45257 CALL DrawCachedSprite Call DrawCachedSprite.
45260 LD (IX+0),0 Write 0 to the actor type.
45264 RET Return.
Prev: 45115 Up: Map Next: 45265