Prev: 38362 Up: Map Next: 38465
38427: Handle A.C.G. Door
The handler for the A.C.G. door (sprite ID 36 in HandlerTable2). When the three slots of the inventory hold the three A.C.G. key pieces (sprite IDs 140 141 and 142 in that order) the doorway is opened and the door is used as an exit with HandlerDoorExit_Check, with a bigger range than other doors. Otherwise the doorway is closed and the door is just shown by HandlerRoomItem.
Input
IX The door entity
HandlerDoorACGExit 38427 LD HL,24114 Point HL at the sprite ID in the first slot of the inventory at Inventory_Slot1_Sprite_Id.
38430 LD DE,4 DE=0004 (the size of a slot).
38433 LD A,(HL) Fetch the sprite ID in the slot.
38434 CP 140 Jump to HandlerDoorACGExit_Locked if it is not 140.
38436 JR NZ,HandlerDoorACGExit_Locked
38438 ADD HL,DE Move HL on to the second slot.
38439 LD A,(HL) Fetch the sprite ID in the slot.
38440 CP 141 Jump to HandlerDoorACGExit_Locked if it is not 141.
38442 JR NZ,HandlerDoorACGExit_Locked
38444 ADD HL,DE Move HL on to the third slot.
38445 LD A,(HL) Fetch the sprite ID in the slot.
38446 CP 142 Jump to HandlerDoorACGExit_Locked if it is not 142.
38448 JR NZ,HandlerDoorACGExit_Locked
38450 CALL OpenDoorway Call OpenDoorway to open the doorway.
38453 LD BC,12320 BC=12320 (the range of the door).
38456 JP HandlerDoorExit_Check Jump to HandlerDoorExit_Check to check whether the player is in range of the door.
HandlerDoorACGExit_Locked 38459 CALL CloseDoorway Call CloseDoorway to close the doorway.
38462 JP HandlerRoomItem Jump to HandlerRoomItem to handle a room item that does nothing.
Prev: 38362 Up: Map Next: 38465