void copy_layer(bitmap_ind16 bitmap, rectangle cliprect, copy_layer_func_t copy_layer_func, int which, int [] sprites_on, rectangle [] sprite_areas) { if (which == 0) { draw_sprites(bitmap); } else { copy_layer_func(bitmap, cliprect, which - 1, sprites_on, sprite_areas); } }
void copy_layers(bitmap_ind16 bitmap, rectangle cliprect, copy_layer_func_t copy_layer_func, int [] sprites_on, rectangle [] sprite_areas) { // fill the screen with the background color bitmap.fill((uint32_t)(8 * (m_colorbank.op[1] & 0x07)), cliprect); for (int i = 0; i < 4; i++) { int which = m_draw_order[m_video_priority.op0 & 0x1f, i]; copy_layer(bitmap, cliprect, copy_layer_func, which, sprites_on, sprite_areas); } }
int video_update_common(bitmap_ind16 bitmap, rectangle cliprect, copy_layer_func_t copy_layer_func) { int [] sprites_on = new int[0x20]; // 1 if sprite is active rectangle [] sprite_areas = new rectangle[0x20]; // areas on bitmap (sprite locations) set_pens(); draw_layers(); calculate_sprite_areas(sprites_on, sprite_areas); copy_layers(bitmap, cliprect, copy_layer_func, sprites_on, sprite_areas); //check_sprite_layer_collision() uses drawn bitmaps, so it must me called _AFTER_ draw_layers() check_collision(sprites_on, sprite_areas); return(0); }