Prev: 32382 Up: Map Next: 32434
32403: 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 30077 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 32403 LD BC,32309 Stash Decor_Loop on the stack as the address for the handler to return to.
32406 PUSH BC
32407 LD BC,30077 Subtract 30077 from the address of the item to get the address of the live record.
32410 AND A
32411 SBC HL,BC
32413 PUSH HL Copy HL to IX (using the stack).
32414 POP IX
32416 LD A,(60049) Fetch the room of the player.
32419 CP (IX+1) Jump to ProcessRoomItem_Dispatch if the item is in the same room as the player.
32422 JR Z,ProcessRoomItem_Dispatch
32424 LD BC,8 Move IX on to the second half of the record (8 bytes on).
32427 ADD IX,BC
ProcessRoomItem_Dispatch 32429 LD HL,32810 Point HL at the handler table 2 at HandlerTable2.
32432 JR ProcessAction_Lookup Jump to ProcessAction_Lookup to turn the first byte of the entity into an offset.
Prev: 32382 Up: Map Next: 32434