Prev: DC6D Up: Map Next: DCC1
DC71: Check if Dan is standing by the lift
Used by the routines at CC89 and CFD9.
DC71 LD DE,($C87C) Put the lift's co-ordinate and room (C87C, C87D) in DE.
DC75 LD HL,($C872) Put Dan's co-ordinates (C872, C873) in HL.
DC78 LD A,($C87B) Put the lift flags (C87B) in A.
DC7B AND $01 Put bit 1 in C.
DC7D LD C,A
DC7E LD A,($CFCA) Get the current room. (CFCA)
DC81 CP D Is it the room the lift is in?
DC82 JR NZ,$DCBC No, it isn't, so jump forward.
The lift is in this room.
DC84 LD A,L Get Dan's Y co-ordinate.
DC85 ADD A,$1A Add 1A (?)
DC87 CP E Does it match the lift's Y co-ordinate?
DC88 JR NZ,$DCBC No, so jump forward.
DC8A LD A,H Get Dan's X co-ordinate.
DC8B SUB $0D Is Dan by the lift shaft?
DC8D CP $05
DC8F JR NC,$DCBC No, so jump forward.
Dan is near the lift.
DC91 SET 1,C Set bit 1 (Dan is on the lift)
DC93 LD A,H
DC94 CP $0F
DC96 JR Z,$DCB5
DC98 LD HL,$DC69 Get the list of Dan's frames that will start the lift. (DC69)
DC9B CP $0E
DC9D JR Z,$DCA8
DC9F LD HL,$DC6D Get the list of Dan's frames that will stop the lift. (DC69)
DCA2 CP $10
DCA4 JR Z,$DCA8
DCA6 JR $DCBC
DCA8 LD B,$04
DCAA LD A,($C875) Get Dan's current animation frame.
DCAD CP (HL)
DCAE JR Z,$DCB5
DCB0 INC HL
DCB1 DJNZ $DCAD
DCB3 JR $DCBC
DCB5 SET 2,C Mark the lift as moving.
DCB7 LD A,$0D
DCB9 LD ($DBED),A
DCBC LD A,C Write the lift flags back to memory.
DCBD LD ($C87B),A
DCC0 RET
Prev: DC6D Up: Map Next: DCC1