@@ -424,13 +424,90 @@ FLAGGED_PIXVAL gebaeude_t::get_outline_colour() const
424424}
425425
426426
427- image_id gebaeude_t::get_image (int nr ) const
427+ void gebaeude_t::display (int xpos, int ypos CLIP_NUM_DEF ) const
428428{
429- if (zeige_baugrube || env_t ::hide_buildings) {
430- return IMG_EMPTY;
429+
430+ const int raster_width = get_current_tile_raster_width ();
431+ const bool is_dirty = get_flag (obj_t ::dirty);
432+ uint8 owner_n = get_owner_nr ();
433+
434+ if (env_t ::hide_buildings != 0 && env_t ::hide_with_transparency && !zeige_baugrube) {
435+ // transparent building
436+ image_id img = tile->get_background (anim_frame, 0 , season);
437+ if (img == IMG_EMPTY) {
438+ return ;
439+ }
440+ uint8 colours[] = { COL_BLACK, COL_YELLOW, COL_YELLOW, COL_PURPLE, COL_RED, COL_GREEN };
441+ FLAGGED_PIXVAL disp_colour = 0 ;
442+ if (is_city_building ()) {
443+ disp_colour = color_idx_to_rgb (colours[0 ]) | TRANSPARENT50_FLAG | OUTLINE_FLAG;
444+ }
445+ else if (env_t ::hide_buildings == env_t ::ALL_HIDDEN_BUILDING && tile->get_desc ()->get_type () < building_desc_t ::others) {
446+ // special building
447+ disp_colour = color_idx_to_rgb (colours[tile->get_desc ()->get_type ()]) | TRANSPARENT50_FLAG | OUTLINE_FLAG;
448+ }
449+
450+ if (image_id ground = get_image ()) {
451+ if (owner_n != PLAYER_UNOWNED) {
452+ if (obj_t ::show_owner) {
453+ display_blend (ground, xpos, ypos, owner_n, color_idx_to_rgb (welt->get_player (owner_n)->get_player_color1 () + 2 ) | OUTLINE_FLAG | TRANSPARENT75_FLAG, 0 , is_dirty CLIP_NUM_PAR);
454+ }
455+ else {
456+ display_color (ground, xpos, ypos, owner_n, true , is_dirty CLIP_NUM_PAR);
457+ }
458+ }
459+ else {
460+ display_normal (ground, xpos, ypos, 0 , true , is_dirty CLIP_NUM_PAR);
461+ }
462+ }
463+
464+ if (TRANSPARENT_FLAGS & disp_colour) {
465+ // only transparent outline
466+ display_blend (get_outline_image (), xpos, ypos, owner_n, disp_colour, 0 , is_dirty CLIP_NUM_PAR);
467+ }
468+ else if (obj_t::get_flag (highlight)) {
469+ // highlight this tile
470+ display_blend (get_image (), xpos, ypos, owner_n, SYSCOL_OBJECT_HIGHLIGHT | OUTLINE_FLAG | TRANSPARENT75_FLAG, 0 , is_dirty CLIP_NUM_PAR);
471+ }
472+ // finish
473+ return ;
431474 }
432- else {
433- return tile->get_background ( anim_frame, nr, season );
475+
476+ // not hidden
477+ image_id image = get_image ();
478+ if (image != IMG_EMPTY) {
479+ const int raster_width = get_current_tile_raster_width ();
480+ const bool is_dirty = get_flag (obj_t ::dirty);
481+
482+ const int start_ypos = ypos;
483+ for (int j = 0 ; image != IMG_EMPTY; ) {
484+
485+ if (owner_n != PLAYER_UNOWNED) {
486+ if (obj_t ::show_owner) {
487+ display_blend (image, xpos, ypos, owner_n, color_idx_to_rgb (welt->get_player (owner_n)->get_player_color1 () + 2 ) | OUTLINE_FLAG | TRANSPARENT75_FLAG, 0 , is_dirty CLIP_NUM_PAR);
488+ }
489+ else {
490+ display_color (image, xpos, ypos, owner_n, true , is_dirty CLIP_NUM_PAR);
491+ }
492+ }
493+ else {
494+ display_normal (image, xpos, ypos, 0 , true , is_dirty CLIP_NUM_PAR);
495+ }
496+
497+ if (obj_t::get_flag (highlight)) {
498+ // highlight this tile
499+ display_blend (image, xpos, start_ypos, owner_n, SYSCOL_OBJECT_HIGHLIGHT | OUTLINE_FLAG | TRANSPARENT75_FLAG, 0 , is_dirty CLIP_NUM_PAR);
500+ }
501+
502+ // this obj has another image on top (e.g. skyscraper)
503+ ypos -= raster_width;
504+
505+ if (zeige_baugrube || env_t ::hide_buildings) {
506+ // finish
507+ return ;
508+ }
509+ image = tile->get_background (anim_frame, ++j, season);
510+ }
434511 }
435512}
436513
@@ -1071,11 +1148,13 @@ void gebaeude_t::mark_images_dirty() const
10711148 (!env_t ::hide_with_transparency &&
10721149 env_t ::hide_buildings>(is_city_building () ? env_t ::NOT_HIDE : env_t ::SOME_HIDDEN_BUILDING)) ) {
10731150 img = skinverwaltung_t ::construction_site->get_image_id (0 );
1151+ mark_image_dirty (img, 0 );
10741152 }
10751153 else {
10761154 img = tile->get_background ( anim_frame, 0 , season ) ;
1077- }
1078- for ( int i=0 ; img!=IMG_EMPTY; img=get_image (++i) ) {
1079- mark_image_dirty ( img, -(i*get_tile_raster_width ()) );
1155+ for (int i = 0 ; img != IMG_EMPTY; ) {
1156+ mark_image_dirty (img, -(i * get_tile_raster_width ()));
1157+ img = tile->get_background (anim_frame, ++i, season);
1158+ }
10801159 }
10811160}
0 commit comments