Prev: 8ABF Up: Map Next: 8BB6
8AC9: Enter
Used by the routine at _87c9.
_8ac9_Enter 8AC9 LD A,(Stage_Compass) See if the door is within range of player.
8ACC BIT 0,A
8ACE JR NZ,_8ac9_Enter_0
8AD0 LD DE,(Position_EW)
8AD4 JR _8ac9_Enter_1
_8ac9_Enter_0 8AD6 LD DE,(Position_NS)
_8ac9_Enter_1 8ADA LD HL,(Door_CurrentPos)
8ADD CALL abs_hl_de
8AE0 LD BC,$0004
8AE3 AND A
8AE4 SBC HL,BC
8AE6 RET NC Return if not.
8AE7 LD HL,Door_CurrentPos Make a copy of the door info.
8AEA LD DE,_bd7e
8AED LDIR
8AEF LD IX,Room_Data
8AF3 LD A,($BD81) Get index
8AF6 AND A
8AF7 JR Z,_8ac9_Enter_3
8AF9 LD B,A
8AFA LD D,$00
_8ac9_Enter_2 8AFC LD E,(IX+$00) Get length of next data block.
8AFF ADD IX,DE Skip by amount to next block.
8B01 DJNZ _8ac9_Enter_2 Repeat until we hit the index required.
_8ac9_Enter_3 8B03 LD A,(IX+$00) If length of data is only 1, stop.
8B06 CP $01
8B08 RET Z
8B09 LD ($BD87),IX Store address of data.
8B0D LD C,(IX+$01) Get type of data.
8B10 LD A,C
8B11 RRA
8B12 RRA
8B13 RRA
8B14 RRA
8B15 AND $0F
8B17 LD L,A Get size of data in bytes from table.
8B18 LD H,$00
8B1A LD DE,Door_DataSizes
8B1D ADD HL,DE
8B1E LD E,(HL)
8B1F LD D,$00 Skip over info using size.
8B21 ADD IX,DE
8B23 LD ($BD8D),IX
8B27 CP $02 Check type of data again.
8B29 JR C,_8ac9_Enter_5
Type 2 or greater
8B2B LD B,$02 Skip the next two data blocks.
_8ac9_Enter_4 8B2D LD A,(IX+$00)
8B30 RLCA
8B31 RLCA
8B32 RLCA
8B33 OR $01
8B35 AND $07
8B37 LD E,A
8B38 ADD IX,DE
8B3A DJNZ _8ac9_Enter_4
_8ac9_Enter_5 8B3C LD A,C
8B3D AND $0F
8B3F JR NZ,_8ac9_Enter_6
8B41 LD IX,$8AC7
_8ac9_Enter_6 8B45 LD ($BD89),IX
8B49 LD A,(Stage_Compass)
8B4C XOR $02
8B4E JR Z,_8ac9_Enter_10
8B50 LD B,A
_8ac9_Enter_7 8B51 RRC C
8B53 JR NC,_8ac9_Enter_9
8B55 LD DE,$0007
8B58 LD A,(IX+$00)
8B5B AND $0F
8B5D JR Z,_8ac9_Enter_8
8B5F LD DE,$0003
8B62 CP $01
8B64 JR Z,_8ac9_Enter_8
8B66 LD DE,$0002
_8ac9_Enter_8 8B69 ADD IX,DE
_8ac9_Enter_9 8B6B DJNZ _8ac9_Enter_7
_8ac9_Enter_10 8B6D BIT 7,(IX+$00) Check if door does not have a lock.
8B71 JR Z,_8ac9_Enter_11
8B73 LD E,(IX+$01) Get index of related key lockers from data.
8B76 LD D,$00
8B78 LD HL,(Handle_Lockers) Calculate address of locker.
8B7B ADD HL,DE
8B7C LD A,(HL) Compare item in locker with expect key.
8B7D INC HL
8B7E CP (HL)
8B7F JR Z,_8ac9_Enter_11 Allow entery if they are the same.
8B81 CALL Print_WarningCentered If not, tell user and end.
Str_Secured 8B84 DEFM "secured",$5E
8B8C RET
_8ac9_Enter_11 8B8D LD (_bd8b),IX
8B91 LD HL,(Door_EntryCallback)
8B94 CALL Vector_Jump Call extra function relating to door.
8B97 RET NZ Function has stopped entry, stop.
8B98 CALL _8f6e Create .????
8B9B RET Z If the return is FALSE, do nothing else.
8B9C LD A,$01 Set flag for door entry.
8B9E LD (Hero_ThroughDoor),A
8BA1 LD HL,Str_Empty See if we can clear the messages.
8BA4 CALL Message_ClearIfNoPlans
8BA7 LD A,(Stage_Compass)
8BAA LD (Hero_ThroughCompass),A
8BAD LD A,$12
8BAF LD (Hero_ThroughN),A
8BB2 POP HL
8BB3 JP $AFFD
Prev: 8ABF Up: Map Next: 8BB6