Prev: D116 Up: Map Next: D161
D12E: Check missile room boundary collisions and on-screen lifespan
Used by the routines at D0EC and D116.
No collision between a creature missile and Maroc (jump from D124), or the missile has been fired by Maroc (jump from D11B)
Missiles hitting a wall will bounce off like any other room objects.
bolt rebounding off a wall missile rebounding off a wall
Check for collisions with room walls:
D12E CALL $DAC8 Check that the missile isn't moving below the bottom of the room boundary. Return any adjusted vertical pixel position in the E register
D131 CALL $E039 Run collision detection routine for room walls, adjusting horizontal position if needed.
Missiles have varied lifespans. Note from the animated images how the VAPORIZE spell bolt lasts longer than the MISSILE spell.
The second byte in the missile sets at 6CDC holds this information.
Reduce this missile's timer, and make it disappear if its timer has run out.
D134 LD A,($EB4E) Item properties byte.
For missiles, the value contained in the top 4 bits of this byte tells holds the duration this missile will appear/travel for before it disappears.
D137 SUB $10 Reduce the time/distance of this value by 16 (initial values are between 144 and 240)
D139 JR C,$D141
D13B LD ($EB4E),A If the missile is still with us, jump out to the next routine
D13E JP $D27D
Jump here from D0A0 if missile is off-screen, or the missile's lifespan has finished/fizzled out
D141 LD A,($EB43) Object type
D144 CP $05 Type 5 = Missile fired by a creature/warlock
D146 JR Z,$D14D
D148 LD HL,$EB92 Missile fired by Maroc
D14B JR $D150
D14D LD HL,$EB91 Missile fired by creature/warlock
HL now contains:
  • EB91 if missile fired by creature/warlock
  • EB92 if missile fired by Maroc
D150 DEC (HL) Maroc's missile - decrement Maroc's missile count (from one to zero)
Creature missile - decrement number of creature missiles in room (from one to zero)
D151 LD A,$00
D153 LD ($EB43),A Missile has fizzled out, so set item type to 0
D156 LD A,($EB4E) Get item properties byte
D159 OR $04 Set bit 2 (4) - this indicates the graphic will need erasing
D15B LD ($EB4E),A ...and re-store.
D15E JP $D27D
Prev: D116 Up: Map Next: D161