Prev: D59A Up: Map Next: D5B2
D59F: Redraw what changed and copy it to the display
Used by the routine at end_of_frame.
Called at the end of every frame. The list at objects_to_draw holds every object that is to be drawn this frame: those that moved or changed, which set_wipe_and_draw_flags flagged with bits 4 and 5 of byte 7, and those whose picture overlaps them, which set_draw_objs_overlapped flagged with bit 4 only. First, for each object that moved, the rectangle covering both where it was last frame and where it is now is cleared in the buffer and remembered on the stack. Then every flagged object is drawn into the buffer in depth order, and finally the remembered rectangles -- and only those -- are copied to the display.
Nothing is ever erased on the display itself, so nothing flickers; and since the background is made of objects too, a wall behind a moving knight is simply drawn again.
In the frame a room is entered the wiping is skipped altogether: the buffer has just been cleared, and end_of_frame copies all of it to the display with update_screen once the objects are drawn.
render_dynamic_objects D59F XOR A no rectangles yet: $5BA8 counts them
D5A0 LD ($5BA8),A
D5A3 PUSH IX
D5A5 LD A,($5BB7) a room just built ($5BB7 set by build_room): nothing to wipe
D5A8 AND A
D5A9 JP NZ,draw_and_copy_rects
D5AC LD HL,objects_to_draw walk the list that list_objects_to_draw made; $5BCB is the place in it
D5AF LD ($5BCB),HL
Prev: D59A Up: Map Next: D5B2