Prev: 89DC Up: Map Next: 8A8D
89E0: Checks for an exit when hero walks off a path edge / end.
Used by the routine at 891F.
Input
A Hero's direction.
ExitCheck 89E0 LD (Routine_DataDirection),A
89E3 LD A,(CamDirection_DFD2)
89E6 LD HL,(AreaDataCurrent_CompassOffset)
89E9 ADD A,L
89EA AND $03
89EC LD (Routine_DataCompass),A
89EF LD HL,(ManData_PosSecondary_dfc5)
89F2 LD BC,$000C
89F5 LD A,(CamDirection_DFD2)
89F8 BIT 0,A
89FA JR Z,ExitCheck_0
89FC LD HL,(ManData_PosPrimary_dfc3)
ExitCheck_0 89FF BIT 1,A
8A01 JR Z,ExitCheck_1
8A03 LD BC,$FFF4
ExitCheck_1 8A06 LD E,L
8A07 LD D,H
8A08 LD A,(Routine_DataDirection)
8A0B CP $02
8A0D JR Z,ExitCheck_2
8A0F ADD HL,BC
8A10 JR ExitCheck_3
ExitCheck_2 8A12 AND A
8A13 SBC HL,BC
ExitCheck_3 8A15 AND A
8A16 SBC HL,DE
8A18 JR C,ExitCheck_4
8A1A ADD HL,DE
8A1B EX DE,HL
8A1C JR ExitCheck_5
ExitCheck_4 8A1E ADD HL,DE
ExitCheck_5 8A1F LD C,L
8A20 LD B,H
8A21 EXX
8A22 LD HL,Exits
8A25 LD B,$02
ExitCheck_6 8A27 LD E,(HL)
8A28 INC HL
8A29 LD D,(HL)
8A2A INC HL
8A2B LD A,E
8A2C OR D
8A2D RET Z
8A2E PUSH DE
8A2F POP IX
8A31 EXX
8A32 LD A,(CamDirection_DFD2)
8A35 BIT 0,A
8A37 JR NZ,ExitCheck_7
8A39 LD L,(IX+$01)
8A3C LD H,$00
8A3E JR ExitCheck_8
ExitCheck_7 8A40 LD L,(IX+$00)
8A43 LD H,$00
ExitCheck_8 8A45 ADD HL,HL
8A46 AND A
8A47 SBC HL,BC
8A49 JR C,ExitCheck_9
8A4B ADD HL,BC
8A4C AND A
8A4D SBC HL,DE
8A4F JR C,ExitCheck_10
ExitCheck_9 8A51 EXX
8A52 DJNZ ExitCheck_6
8A54 RET
ExitCheck_10 8A55 LD (Routine_Data2),IX
8A59 DEFB $DD,$7E,$05 See if door is locked.
8A5C DEFB $A7,$28,$28 Zero means not.
Try match an object to unlock door.
8A5F DEFB $47 Lock number.
8A60 DEFB $DD,$21,$C3,$DF Point to mand data for object carried.
8A64 DEFB $DD,$6E,$04,$DD,$66,$05 Get object point next in list.
8A6A DEFB $7D,$B4,$20,$10 0000 = End of list.
8A6E DEFB $3A,$06,$E0,$A7,$C0,$CD,$AF,$89 So just display warning.
8A76 DEFM "locked"
8A7C DEFB $5E
8A7D RET
8A7E DEFB $E5,$DD,$E1,$DD,$7E,$02 Does object's lock number match?
8A84 DEFB $B8,$20,$DD No, try next object.
Go through door.
8A87 LD A,$01
8A89 LD (ThruDoorCounter_E004),A
8A8C RET
Prev: 89DC Up: Map Next: 8A8D