diff options
author | haranp <haranp@c06c8d41-db1a-0410-9941-cceddc491573> | 2009-01-27 08:46:50 +0000 |
---|---|---|
committer | haranp <haranp@c06c8d41-db1a-0410-9941-cceddc491573> | 2009-01-27 08:46:50 +0000 |
commit | a124171efd9ff0f38532b3a15a008705ad58ae38 (patch) | |
tree | 215f660375bc6f0a6624939bd8dfc0b7da645030 /crawl-ref/source/view.cc | |
parent | 1332e506af6d32843dd48acac1d663074ec86553 (diff) | |
download | crawl-ref-a124171efd9ff0f38532b3a15a008705ad58ae38.tar.gz crawl-ref-a124171efd9ff0f38532b3a15a008705ad58ae38.zip |
Various cleanups. (I can't run tiles, but it compiled fine, so I hope I didn't
introduce a subtle bug.)
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@8811 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/view.cc')
-rw-r--r-- | crawl-ref/source/view.cc | 91 |
1 files changed, 46 insertions, 45 deletions
diff --git a/crawl-ref/source/view.cc b/crawl-ref/source/view.cc index 69ca694249..6b473aa9bd 100644 --- a/crawl-ref/source/view.cc +++ b/crawl-ref/source/view.cc @@ -189,6 +189,11 @@ void set_envmap_glyph(int x, int y, int object, int col) #endif } +void set_envmap_glyph(const coord_def& c, int object, int col) +{ + set_envmap_glyph(c.x, c.y, object, col); +} + void set_envmap_obj( const coord_def& where, int obj ) { env.map(where).object = obj; @@ -5167,6 +5172,9 @@ void viewwindow(bool draw_it, bool do_updates) // in grid coords const coord_def gc(view2grid(coord_def(count_x, count_y))); const coord_def ep = view2show(grid2view(gc)); +#ifdef USE_TILE + const coord_def sep = ep - coord_def(1,1); +#endif // Print tutorial messages for features in LOS. if (Options.tutorial_left && in_bounds(gc) @@ -5192,7 +5200,7 @@ void viewwindow(bool draw_it, bool do_updates) else if (grd(gc) == DNGN_ENTER_SHOP) learned_something_new(TUT_SEEN_SHOP, gc); - if (igrd[gc.x][gc.y] != NON_ITEM + if (igrd(gc) != NON_ITEM && Options.feature_item_brand != CHATTR_NORMAL && (is_feature('>', gc) || is_feature('<', gc))) { @@ -5214,7 +5222,7 @@ void viewwindow(bool draw_it, bool do_updates) else if (!crawl_view.in_grid_los(gc)) { // Outside the env.show area. - buffy[bufcount] = get_envmap_char( gc.x, gc.y ); + buffy[bufcount] = get_envmap_char(gc); buffy[bufcount + 1] = DARKGREY; if (Options.colour_map) @@ -5224,10 +5232,10 @@ void viewwindow(bool draw_it, bool do_updates) } #ifdef USE_TILE - unsigned int bg = env.tile_bk_bg[gc.x][gc.y]; - unsigned int fg = env.tile_bk_fg[gc.x][gc.y]; + unsigned int bg = env.tile_bk_bg(gc); + unsigned int fg = env.tile_bk_fg(gc); if (bg == 0 && fg == 0) - tileidx_unseen(fg, bg, get_envmap_char(gc.x, gc.y), gc); + tileidx_unseen(fg, bg, get_envmap_char(gc), gc); tileb[bufcount] = fg; tileb[bufcount + 1] = bg | tile_unseen_flag(gc); @@ -5239,30 +5247,28 @@ void viewwindow(bool draw_it, bool do_updates) int object = env.show(ep); unsigned short colour = env.show_col(ep); unsigned ch; - _get_symbol( gc, object, &ch, &colour ); + _get_symbol(gc, object, &ch, &colour); if (map) { - set_envmap_glyph( gc.x, gc.y, object, colour ); + set_envmap_glyph(gc, object, colour); if (is_terrain_changed(gc) || !is_terrain_seen(gc)) update_excludes.push_back(gc); - set_terrain_seen( gc.x, gc.y ); - set_envmap_detected_mons(gc.x, gc.y, false); - set_envmap_detected_item(gc.x, gc.y, false); + set_terrain_seen(gc); + set_envmap_detected_mons(gc, false); + set_envmap_detected_item(gc, false); } #ifdef USE_TILE if (map) { - env.tile_bk_bg[gc.x][gc.y] = - env.tile_bg[ep.x-1][ep.y-1]; - env.tile_bk_fg[gc.x][gc.y] = - env.tile_fg[ep.x-1][ep.y-1]; + env.tile_bk_bg(gc) = env.tile_bg(sep); + env.tile_bk_fg(gc) = env.tile_fg(sep); } - tileb[bufcount] = env.tile_fg[ep.x-1][ep.y-1] = + tileb[bufcount] = env.tile_fg(sep) = tileidx_player(you.char_class); - tileb[bufcount+1] = env.tile_bg[ep.x-1][ep.y-1]; + tileb[bufcount+1] = env.tile_bg(sep); #endif // Player overrides everything in cell. @@ -5288,8 +5294,8 @@ void viewwindow(bool draw_it, bool do_updates) buffy[bufcount] = ch; buffy[bufcount + 1] = colour; #ifdef USE_TILE - tileb[bufcount] = env.tile_fg[ep.x-1][ep.y-1]; - tileb[bufcount+1] = env.tile_bg[ep.x-1][ep.y-1]; + tileb[bufcount] = env.tile_fg(sep); + tileb[bufcount+1] = env.tile_bg(sep); #endif if (map) @@ -5305,26 +5311,23 @@ void viewwindow(bool draw_it, bool do_updates) if (is_terrain_changed(gc) || !is_terrain_seen(gc)) update_excludes.push_back(gc); - set_terrain_seen( gc.x, gc.y ); - set_envmap_glyph( gc.x, gc.y, object, colour ); - set_envmap_detected_mons(gc.x, gc.y, false); - set_envmap_detected_item(gc.x, gc.y, false); + set_terrain_seen(gc); + set_envmap_glyph(gc, object, colour ); + set_envmap_detected_mons(gc, false); + set_envmap_detected_item(gc, false); #ifdef USE_TILE // We remove any references to mcache when // writing to the background. if (Options.clean_map) { - env.tile_bk_fg[gc.x][gc.y] = - get_clean_map_idx( - env.tile_fg[ep.x-1][ep.y-1]); + env.tile_bk_fg(gc) = + get_clean_map_idx(env.tile_fg(sep)); } else { - env.tile_bk_fg[gc.x][gc.y] = - env.tile_fg[ep.x-1][ep.y-1]; + env.tile_bk_fg(gc) = env.tile_fg(sep); } - env.tile_bk_bg[gc.x][gc.y] = - env.tile_bg[ep.x-1][ep.y-1]; + env.tile_bk_bg(gc) = env.tile_bg(sep); #endif } @@ -5339,12 +5342,12 @@ void viewwindow(bool draw_it, bool do_updates) // have a monster or cloud on it, and is equal // to the grid before monsters and clouds were // added otherwise. - if (Options.clean_map && Show_Backup(ep) - && is_terrain_seen( gc.x, gc.y )) + if (Options.clean_map + && Show_Backup(ep) + && is_terrain_seen(gc)) { - _get_symbol( gc, Show_Backup(ep), &ch, &colour ); - set_envmap_glyph( gc.x, gc.y, Show_Backup(ep), - colour ); + _get_symbol(gc, Show_Backup(ep), &ch, &colour); + set_envmap_glyph(gc, Show_Backup(ep), colour); } // Now we get to filling in both the unseen @@ -5360,7 +5363,7 @@ void viewwindow(bool draw_it, bool do_updates) if (buffy[bufcount] == 0) { // Show map. - buffy[bufcount] = get_envmap_char( gc.x, gc.y ); + buffy[bufcount] = get_envmap_char(gc); buffy[bufcount + 1] = DARKGREY; if (Options.colour_map) @@ -5369,21 +5372,19 @@ void viewwindow(bool draw_it, bool do_updates) colour_code_map(gc, Options.item_colour); } #ifdef USE_TILE - if (env.tile_bk_fg[gc.x][gc.y] != 0 - || env.tile_bk_bg[gc.x][gc.y] != 0) + if (env.tile_bk_fg(gc) != 0 + || env.tile_bk_bg(gc) != 0) { - tileb[bufcount] = - env.tile_bk_fg[gc.x][gc.y]; + tileb[bufcount] = env.tile_bk_fg(gc); tileb[bufcount + 1] = - env.tile_bk_bg[gc.x][gc.y] - | tile_unseen_flag(gc); + env.tile_bk_bg(gc) | tile_unseen_flag(gc); } else { tileidx_unseen(tileb[bufcount], tileb[bufcount+1], - get_envmap_char(gc.x, gc.y), + get_envmap_char(gc), gc); } #endif @@ -5395,8 +5396,8 @@ void viewwindow(bool draw_it, bool do_updates) if (flash_colour && buffy[bufcount]) { buffy[bufcount + 1] = - see_grid(gc.x, gc.y) ? real_colour(flash_colour) - : DARKGREY; + see_grid(gc) ? real_colour(flash_colour) + : DARKGREY; } bufcount += 2; @@ -5435,7 +5436,7 @@ void viewwindow(bool draw_it, bool do_updates) } _debug_pane_bounds(); -} // end viewwindow() +} ////////////////////////////////////////////////////////////////////////////// // crawl_view_buffer |