int mr_count_uniq_rooms (void) { struct mr_room_list l; int c = mr_get_room_list (&l)->nmemb; mr_destroy_room_list (&l); return c; }
void update_cache (enum em em, enum vm vm) { struct mr_room_list l; mr_get_room_list (&l); update_cache_room (0, em, vm); size_t i; for (i = 0; i < l.nmemb; i++) update_cache_room (l.room[i], em, vm); mr_destroy_room_list (&l); }
void draw_multi_rooms (void) { int x, y; mr_set_origin (mr.room, mr.x, mr.y); bool mr_view_changed = has_mr_view_changed (); if (mr_view_changed) force_full_redraw = true; if (anim_cycle == 0) { generate_wall_colors_for_room (0, room0_wall_color); } if (em == PALACE && vm == VGA && (mr_view_changed || em != mr.last.em || vm != mr.last.vm)) generate_wall_colors (); if (mr_view_changed) generate_stars (); if (mouse_pos.room != mr.last.mouse_pos.room || mouse_pos.floor != mr.last.mouse_pos.floor || mouse_pos.place != mr.last.mouse_pos.place) { if (is_valid_pos (&mouse_pos)) update_cache_pos (&mouse_pos, CHPOS_MOUSE_SELECT, em, vm); if (is_valid_pos (&mr.last.mouse_pos)) update_cache_pos (&mr.last.mouse_pos, CHPOS_MOUSE_DESELECT, em, vm); } if (anim_cycle == 0 || em != mr.last.em || vm != mr.last.vm || hgc != mr.last.hgc || hue != mr.last.hue) { update_room0_cache (em, vm); force_full_redraw = true; } if (anim_cycle == 0 || mr_view_changed || em != mr.last.em || vm != mr.last.vm || hgc != mr.last.hgc || hue != mr.last.hue || global_level.number != mr.last.level) { update_cache (em, vm); } size_t i; for (i = 0; i < changed_pos_nmemb; i++) update_cache_pos (&changed_pos[i].p, changed_pos[i].reason, em, vm); destroy_array ((void **) &changed_pos, &changed_pos_nmemb); for (i = 0; i < changed_room_nmemb; i++) update_cache_room (changed_room[i], em, vm); destroy_array ((void **) &changed_room, &changed_room_nmemb); for (y = mr.h - 1; y >= 0; y--) for (x = 0; x < mr.w; x++) { clear_bitmap (mr.cell[x][y].screen, (mr.flicker > 0 && mr.flicker % 2) ? mr.color : BLACK); if (! mr.cell[x][y].room) continue; mr.dx = x; mr.dy = y; draw_animated_background (mr.cell[x][y].screen, mr.cell[x][y].room); } if (mr.flicker > 0) mr.flicker--; struct mr_room_list l; mr_get_room_list (&l); int xm, ym; if (! no_room_drawing) for (i = 0; i < l.nmemb; i++) { mr_coord (l.room[i], -1, &xm, &ym); for (y = mr.h - 1; y >= 0; y--) for (x = 0; x < mr.w; x++) if (mr.cell[x][y].room == l.room[i]) draw_bitmap (mr.cell[xm][ym].cache, mr.cell[x][y].screen, 0, 0, 0); } mr_destroy_room_list (&l); /* if (! no_room_drawing) */ /* for (y = mr.h - 1; y >= 0; y--) */ /* for (x = 0; x < mr.w; x++) */ /* if (mr.cell[x][y].room) */ /* draw_bitmap (mr.cell[x][y].cache, mr.cell[x][y].screen, 0, 0, 0); */ for (y = mr.h - 1; y >= 0; y--) for (x = 0; x < mr.w; x++) { if (! mr.cell[x][y].room) continue; mr.dx = x; mr.dy = y; draw_animated_foreground (mr.cell[x][y].screen, mr.cell[x][y].room); } /* if (mr.select_cycles > 0) { */ /* int t = max_int (mr.w, mr.h); */ /* draw_rectangle (mr.cell[mr.x][mr.y].screen, 0, 3, */ /* ORIGINAL_WIDTH - t, */ /* 3 + ROOM_HEIGHT - t, RED, t); */ /* mr.select_cycles--; */ /* } */ mr_update_last_settings (); }
void draw_multi_rooms (void) { int x, y; mr_set_origin (mr.room, mr.x, mr.y); bool mr_full_update = has_mr_view_changed () || mr.full_update; if (mr_full_update) { mr_busy (); force_full_redraw = true; } if (anim_cycle == 0) { generate_wall_colors_for_room (0, room0_wall_color); } if (em == PALACE && vm == VGA && (mr_full_update || em != mr.last.em || vm != mr.last.vm)) generate_wall_colors (); if (mouse_pos.room != mr.last.mouse_pos.room || mouse_pos.floor != mr.last.mouse_pos.floor || mouse_pos.place != mr.last.mouse_pos.place) { if (is_valid_pos (&mouse_pos)) register_changed_pos (&mouse_pos); if (is_valid_pos (&mr.last.mouse_pos)) register_changed_pos (&mr.last.mouse_pos); } if (anim_cycle == 0 || em != mr.last.em || vm != mr.last.vm || hgc != mr.last.hgc || hue != mr.last.hue) { update_room0_cache (em, vm); force_full_redraw = true; } size_t i; if (anim_cycle == 0 || mr_full_update || em != mr.last.em || vm != mr.last.vm || hgc != mr.last.hgc || hue != mr.last.hue || global_level.n != mr.last.level) { update_cache (em, vm); } else { bool depedv = ((em == DUNGEON && vm == VGA) || (em == DUNGEON && vm == EGA) || (em == PALACE && vm == EGA)); /* optmize changed pos list */ optimize_changed_pos (); /* update cache pos */ for (i = 0; i < changed_pos_nmemb; i++) { update_cache_pos (&changed_pos[i], em, vm); struct pos pl; prel (&changed_pos[i], &pl, +0, -1); if (depedv && fake (&pl) == WALL) update_cache_pos (&pl, em, vm); } /* update cache room */ for (i = 0; i < changed_room_nmemb; i++) update_cache_room (changed_room[i], em, vm); /* kept together so update_cache_pos and update_cache_room can access each other's arrays */ destroy_array ((void **) &changed_pos, &changed_pos_nmemb); destroy_array ((void **) &changed_room, &changed_room_nmemb); } for (y = mr.h - 1; y >= 0; y--) for (x = 0; x < mr.w; x++) { clear_bitmap (mr.cell[x][y].screen, (mr.flicker > 0 && mr.flicker % 2) ? mr.color : BLACK); if (! mr.cell[x][y].room) continue; mr.dx = x; mr.dy = y; draw_animated_background (mr.cell[x][y].screen, mr.cell[x][y].room); } if (mr.flicker > 0) mr.flicker--; struct mr_room_list l; mr_get_room_list (&l); int xm, ym; if (! no_room_drawing) for (i = 0; i < l.nmemb; i++) { mr_coord (l.room[i], -1, &xm, &ym); for (y = mr.h - 1; y >= 0; y--) for (x = 0; x < mr.w; x++) if (mr.cell[x][y].room == l.room[i]) draw_bitmap (mr.cell[xm][ym].cache, mr.cell[x][y].screen, 0, 0, 0); } mr_destroy_room_list (&l); for (y = mr.h - 1; y >= 0; y--) for (x = 0; x < mr.w; x++) { if (! mr.cell[x][y].room) continue; mr.dx = x; mr.dy = y; draw_animated_foreground (mr.cell[x][y].screen, mr.cell[x][y].room); } mr_update_last_settings (); }