Prev: E42A Up: Map Next: E71D
E6DB: Populate Display Buffer For Visible Entities
Used by the routine at GameStart.
Walk the simple entity table at StateData_SimpleEntities and process graphic layout data for each visible entity into the current display buffer.
Walk rooms 00–05 and draw every on-camera entity into the current display buffer.
PopulateDisplayBuffer_VisibleEntities E6DB LD C,$00 Clear the room-pass index in C to 00.
Start a room-pass over the simple entity table at StateData_SimpleEntities.
PopulateVisible_StartRoomPass E6DD LD IX,$8B69 Point IX at the simple entity table (StateData_SimpleEntities).
E6E1 LD DE,$000E Load DE with 000E.
Draw each visible entity whose room and camera-window x-band match this pass.
PopulateDisplayBuffer_VisibleEntitiesContinue E6E4 LD A,(IX+$00) Fetch the current entity's type for the type test.
E6E7 CP $FF Is A equal to FF? If so, jump to PopulateDisplayBuffer_VisibleEntitiesContinueB2.
E6E9 JR Z,PopulateDisplayBuffer_VisibleEntitiesContinueB2
E6EB OR A Is A zero? If so, jump to PopulateDisplayBuffer_VisibleEntitiesContinueB.
E6EC JR Z,PopulateDisplayBuffer_VisibleEntitiesContinueB
E6EE BIT 7,A Is bit 07 of A set? If so, jump to PopulateDisplayBuffer_VisibleEntitiesContinueB.
E6F0 JR NZ,PopulateDisplayBuffer_VisibleEntitiesContinueB
E6F2 LD A,C Copy the saved count/flag from C into A.
E6F3 CP (IX+$04) Does the candidate share this entity's room? If not, jump to PopulateDisplayBuffer_VisibleEntitiesContinueB.
E6F6 JR NZ,PopulateDisplayBuffer_VisibleEntitiesContinueB
E6F8 LD HL,($72FB) Load HL with the camera room-origin pointer (Pointer_CameraRoomOrigin).
E6FB LD A,H Copy H into A.
E6FC CP (IX+$07) Is the camera origin's high byte left of this entity's x? If so, jump to PopulateDisplayBuffer_VisibleEntitiesContinueB.
E6FF JR C,PopulateDisplayBuffer_VisibleEntitiesContinueB
E701 LD A,(IX+$08) Load A with the current entity's x-extent.
E704 CP L Is this entity's x-extent left of the camera origin's low byte in L? If so, jump to PopulateDisplayBuffer_VisibleEntitiesContinueB.
E705 JR C,PopulateDisplayBuffer_VisibleEntitiesContinueB
E707 PUSH DE Stash DE, BC and IX on the stack.
E708 PUSH BC
E709 PUSH IX
E70B CALL Process_GraphicLayoutData_Entity Call Process_GraphicLayoutData_Entity to draw the entity's graphic layout.
E70E POP IX Restore IX, BC and DE from the stack.
E710 POP BC
E711 POP DE
Advance to the next simple-entity record and keep scanning this room pass.
PopulateDisplayBuffer_VisibleEntitiesContinueB E712 ADD IX,DE IX+=DE.
E714 JR PopulateDisplayBuffer_VisibleEntitiesContinue Jump to PopulateDisplayBuffer_VisibleEntitiesContinue to continue this routine.
Bump the room-pass index; return when it passes 05, otherwise restart at PopulateVisible_StartRoomPass.
PopulateDisplayBuffer_VisibleEntitiesContinueB2 E716 LD A,$05 Load A with 05 (last room index).
E718 INC C Advance the room-pass index in C by one.
E719 CP C Return if the room-pass index is now greater than 05.
E71A RET C
E71B JR PopulateVisible_StartRoomPass Jump to PopulateVisible_StartRoomPass to continue the loop.
Prev: E42A Up: Map Next: E71D