Prev: 7E7E Up: Map Next: 7EB2
7E93: Process Room Item
Used by the routine at DrawRoom.
Runs the handler of one of the items in a room's list (see DrawRoom). The list entry is the address of the item in the initial entity data; subtracting 757D converts it to the address of the live record. Door records are two 8-byte halves (one for each of the two rooms they join), so the second half is used if the first is not for the current room. The handler is looked up in HandlerTable2 and returns to Decor_Loop.
Input
HL The list entry
ProcessRoomItem 7E93 LD BC,$7E35 Stash Decor_Loop on the stack as the address for the handler to return to.
7E96 PUSH BC
7E97 LD BC,$757D Subtract 757D from the address of the item to get the address of the live record.
7E9A AND A
7E9B SBC HL,BC
7E9D PUSH HL Copy HL to IX (using the stack).
7E9E POP IX
7EA0 LD A,($EA91) Fetch the room of the player.
7EA3 CP (IX+$01) Jump to ProcessRoomItem_Dispatch if the item is in the same room as the player.
7EA6 JR Z,ProcessRoomItem_Dispatch
7EA8 LD BC,$0008 Move IX on to the second half of the record (08 bytes on).
7EAB ADD IX,BC
ProcessRoomItem_Dispatch 7EAD LD HL,$802A Point HL at the handler table 2 at HandlerTable2.
7EB0 JR ProcessAction_Lookup Jump to ProcessAction_Lookup to turn the first byte of the entity into an offset.
Prev: 7E7E Up: Map Next: 7EB2