Prev: B83B Up: Map Next: B89C
B866: Plot sprites
This plots all vischars and items in order.
Used by the routines at setup_movable_items and main_loop.
Start (infinite) loop
This can return a vischar OR an itemstruct, but not both.
plot_sprites B866 CALL get_next_drawable Finds the next vischar or item to draw
B869 RET NZ Return if nothing remains
B86A BIT 6,A Was an item returned?
B86C JR NZ,plot_item Jump to item handling if so
plot_vischar B86E CALL setup_vischar_plotting Set up vischar plotting
B871 JR NZ,plot_sprites If not visible (Z clear) ...loop
B873 CALL render_mask_buffer Render the mask buffer
B876 LD A,($81BD) Fetch the searchlight state
B879 CP $FF Is it searchlight_STATE_SEARCHING? ($FF)
B87B CALL NZ,searchlight_mask_test If not: check the mask buffer to see if the hero is hiding behind something
B87E LD A,(IY+$1E) How wide is the vischar? (3 => 16 wide, 4 => 24 wide)
B881 CP $03 16 wide?
B883 JR Z,plot_16_wide Jump if so
plot_24_wide B885 CALL plot_masked_sprite_24px Call the sprite plotter for 24-pixel-wide sprites
B888 JR plot_sprites ...loop
It's odd to test for Z here since it's always set.
plot_16_wide B88A CALL Z,plot_masked_sprite_16px Call (if Z set) the sprite plotter for 16-pixel-wide sprites
B88D JR plot_sprites ...loop
plot_item B88F CALL setup_item_plotting Set up item plotting
B892 JR NZ,plot_sprites If not visible (Z clear) ...loop
B894 CALL render_mask_buffer Render the mask buffer
B897 CALL plot_masked_sprite_16px_x_is_zero Call the sprite plotter for 16-pixel-wide sprites
B89A JR plot_sprites ...loop
Prev: B83B Up: Map Next: B89C