Prev: 53372 Up: Map Next: 53484
53403: Missile fired by Maroc or a creature - check for active shield/barrier spells
Used by the routine at 51359.
...There's a missile/bolt flying around in the room..!
creature missile rebounding of Maroc's shield
This routine copies the missile's data from the table at 27868 into a working (missile) buffer at 60317.
It also checks if Maroc has a counter defence spell active (SHIELD, DEFENCE etc.)
  • Each missile type (at 27868) has up to THREE counter defensive barrier-type spells that will negate/repel it
  • These are stored in bytes 5, 7 and 8 of the missile's 8-byte data set (AMULET spell repels all missiles)
  • The following instructions check if each of these values in a missile's data set (stored in the current missile data buffer at 60321, 60323 and 60324) match the currently active defensive barrier spell type
  • If there's a match, a special missile/barrier collision routine (57990) is CALLed
53403 LD A,(60238) Missile properties byte
53406 AND 1 Check if it's is on-screen (bit 1 is set)
53408 JP Z,53569 ...if not, skip out to a later instruction
53411 LD HL,(60228) Get address pointer to missile type (in table at 27868)
53414 LD BC,8 Copy the 8 bytes of missile data into missile working buffer table at 60317
53417 LD DE,60317
53420 LDIR
53422 LD A,(60319) Missile attribute (INK) colour
53425 LD (60072),A Copy into item data buffer
53428 LD A,(60320) Missile's event/collision type to check (stored as the 4th byte in the missile/bolt table at 27868)
53431 CP 0
53433 JR Z,53438 If it's zero (no event), don't copy any event data (shouldn't happen as there's a value for each missile)
53435 CALL 58032 ...If it's not zero, copy item event data into working buffer
COUNTER SPELL #1 CHECK
53438 LD A,(60137) Get currently active 'effect' spell (value = 0 if none currently in effect)
53441 LD C,A Copy to C register
53442 LD A,(60321) Defence counter spell #1 (the spell in this slot is always AMULET)
53445 CP 0
53447 JR Z,53452 Check for zero - if no counter spell in this slot (shouldn't happen as there's a value for every counter slot)
53449 CP C Check counter spell vs current active spell number
53450 JR Z,53472 If there's a match, can skip the next two checks straight to 53472
COUNTER SPELL #2 CHECK
53452 LD A,(60323) Defence counter spell #2
53455 CP 0 Check for zero - if no counter spell in this slot (shouldn't happen as there's a value for every counter slot)
53457 JR Z,53462
53459 CP C Check counter spell vs current active spell number
53460 JR Z,53472 If there's a match, can skip the final check and jump straight to 53472
COUNTER SPELL #2 CHECK
53462 LD A,(60324) Defence counter spell #3
53465 CP 0 heck for zero - if no counter spell in this slot (shouldn't happen as there's a value for every counter slot)
53467 JR Z,53526
53469 CP C Check counter spell vs current active spell number
53470 JR NZ,53526 If there's NO match, jump out of the routine here
The following instructions are redundant (possibly duplicated), as CP C has already happened in a previous check
53472 CP C -
53473 JR NZ,53526 -
There's a match between the missile/bolt fired and an active shielding spell around Maroc that will negate/deflect it
The following instructions check for a collision against Maroc's flickering shielding/protective spell
53475 LD C,1 For the usual collision/event detection routine (57293) the C register is set an event/collision type. On this occasion loading the C register is unnecessary as it's not actually needed/used for this (special) missile routine.
53477 CALL 57990 Check for a collision between the fired bolt/missile and the shield/barrier around Maroc
53480 CP 0 The A register is returned with 0 if no collision, or 8 (this byte is used elsewhere for the accompanying sound effect) if there's a collision
53482 JR Z,53526 If no collision, jump out of this routine/check
Prev: 53372 Up: Map Next: 53484