Prev: D833 Up: Map Next: D8CE
D8B2: Set up active spell-based room event checks
Used by the routines at D7F3 and D833.
event checking while the servant spell is active event checking while a cursor aiming spell is active
Follows previous SERVANT routine - these instructions are run if the servant ISN'T moving over Maroc, and ISN'T holding an object.
In this state, the servant sprite needs to be open to room event checks (e.g. picking up/manipulating objects). So this routine creates an entry in the room's event checks data table at 7FB3.
There's also a jump here from the routine at D82D, which relates to other cast spells that involve the controllable cursor (e.g. OPEN, FIND, REVEAL) that aren't missile-related. These spells will also need an event check to be added to the room event check table, as they take effect when they're moved over specific room items.
D8B2 LD HL,($EAAD) Address pointer to room item event data at 7FB3
D8B5 LD (HL),$01 Set the first byte of the set to 1, which means the event will be checked for 1 game cycle (this is partly in case items are moving around).
D8B7 INC HL
D8B8 LD A,($EBCA) Action/event value associated with this spell (e.g. SERVANT, OPEN) is active
D8BB LD (HL),A Store as byte 2 of set
D8BC INC HL
D8BD LD A,($EB00) Servant sprite horizontal (X) co-ordinate in pixels
D8C0 LD (HL),A Store as byte 3 of set
D8C1 INC HL
D8C2 LD A,($EAFF) Servant sprite horizontal (Y) co-ordinate in pixels
D8C5 LD (HL),A Store as byte 4 of set
D8C6 INC HL Move along to the start of the next data set
D8C7 LD ($EAAD),HL Store the address pointer to the start of the next event data set at 7FB3
D8CA LD (HL),$FF Set an end-of-data marker
Jump from previous routine if there aren't any events to check. For example, the servant can't manipulate other room objects if it's already carrying an object (the event check in this case is object 1 on object 2).
D8CC JR $D901
Prev: D833 Up: Map Next: D8CE