Prev: 9286 Up: Map Next: 92D8
9291: Draw Room Entities
Used by the routine at DrawRoom.
Draws every entity that is in the same room as the player and is in use. First the 8-byte entities from Player up to CreatureRecords are done, and then the 16-byte ones up to RoomItemEntities.
DrawRoomEntities 9291 LD IX,$EA90 Point IX at the player at Player.
DrawRoomEntities_Loop 9295 LD A,(IX+$00) Fetch the sprite ID of the entity.
9298 AND A Jump to DrawRoomEntities_Next if the entity is not in use.
9299 JR Z,DrawRoomEntities_Next
929B LD A,($EA91) Fetch the room of the player from PlayerRoom.
929E CP (IX+$01) Jump to DrawRoomEntities_Next if the entity is in a different room.
92A1 JR NZ,DrawRoomEntities_Next
92A3 CALL DrawEntity Call DrawEntity to draw the entity.
DrawRoomEntities_Next 92A6 LD DE,$0008 DE=0008 (the size of an 8-byte entity).
92A9 ADD IX,DE Move IX on to the next entity.
92AB PUSH IX Copy IX into HL.
92AD POP HL
92AE LD DE,$EE60 Point DE at the end of the 8-byte entities at CreatureRecords.
92B1 AND A Subtract DE from HL, to check whether all of the 8-byte entities have been done.
92B2 SBC HL,DE
92B4 JR C,DrawRoomEntities_Loop Loop back to DrawRoomEntities_Loop until all of the 8-byte entities have been drawn.
DrawRoomEntities_Large 92B6 LD A,(IX+$00) Fetch the sprite ID of the entity.
92B9 AND A Jump to DrawRoomEntities_NextLarge if the entity is not in use.
92BA JR Z,DrawRoomEntities_NextLarge
92BC LD A,($EA91) Fetch the room of the player from PlayerRoom.
92BF CP (IX+$01) Jump to DrawRoomEntities_NextLarge if the entity is in a different room.
92C2 JR NZ,DrawRoomEntities_NextLarge
92C4 CALL DrawEntity Call DrawEntity to draw the entity.
DrawRoomEntities_NextLarge 92C7 LD DE,$0010 DE=0010 (the size of a 16-byte entity).
92CA ADD IX,DE Move IX on to the next entity.
92CC PUSH IX Copy IX into HL.
92CE POP HL
92CF LD DE,$EEE0 Point DE at the end of the 16-byte entities at RoomItemEntities.
92D2 AND A Subtract DE from HL, to check whether all of the 16-byte entities have been done.
92D3 SBC HL,DE
92D5 JR C,DrawRoomEntities_Large Loop back to DrawRoomEntities_Large until all of the 16-byte entities have been drawn.
92D7 RET Return.
Prev: 9286 Up: Map Next: 92D8