From 8c399dae34cfee1034b7ed74caab95589ca8646c Mon Sep 17 00:00:00 2001 From: ennewalker Date: Fri, 25 Jul 2008 02:42:50 +0000 Subject: [2021061] Fixing Tiles exclusion issues. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@6677 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/tilepick.cc | 6 +++++- crawl-ref/source/tilereg.cc | 2 +- crawl-ref/source/tilesdl.cc | 17 +++++++++++++++++ crawl-ref/source/tilesdl.h | 1 + crawl-ref/source/travel.cc | 2 +- crawl-ref/source/view.cc | 27 ++------------------------- crawl-ref/source/view.h | 4 ---- 7 files changed, 27 insertions(+), 32 deletions(-) (limited to 'crawl-ref/source') diff --git a/crawl-ref/source/tilepick.cc b/crawl-ref/source/tilepick.cc index 8868b954f6..6366363969 100644 --- a/crawl-ref/source/tilepick.cc +++ b/crawl-ref/source/tilepick.cc @@ -98,7 +98,11 @@ static inline unsigned short _get_bazaar_special_colour() void TileNewLevel(bool first_time) { - init_minimap(); + tiles.clear_minimap(); + for (int y = 0; y < GYM; y++) + for (int x = 0; x < GXM; x++) + tiles.update_minimap(x, y); + TileLoadWall(false); tile_clear_buf(); if (first_time) diff --git a/crawl-ref/source/tilereg.cc b/crawl-ref/source/tilereg.cc index 8338c64f81..6c27a06055 100644 --- a/crawl-ref/source/tilereg.cc +++ b/crawl-ref/source/tilereg.cc @@ -218,7 +218,7 @@ void DungeonRegion::load_dungeon(unsigned int* tileb, int cx_to_gx, int cy_to_gy unsigned int len = 2 * crawl_view.viewsz.x * crawl_view.viewsz.y; m_tileb.resize(len); // TODO enne - move this function into dungeonregion - tile_finish_dngn(tileb, you.pos().x, you.pos().y); + tile_finish_dngn(tileb, cx_to_gx + mx/2, cy_to_gy + my/2); memcpy(&m_tileb[0], tileb, sizeof(unsigned int) * len); m_cx_to_gx = cx_to_gx; diff --git a/crawl-ref/source/tilesdl.cc b/crawl-ref/source/tilesdl.cc index 5b97e4d4b5..e7bb559c34 100644 --- a/crawl-ref/source/tilesdl.cc +++ b/crawl-ref/source/tilesdl.cc @@ -9,6 +9,7 @@ #include "tilesdl.h" #include "travel.h" #include "version.h" +#include "view.h" #include "tiledef-dngn.h" #include "tilefont.h" @@ -743,6 +744,22 @@ void TilesFramework::redraw() SDL_GL_SwapBuffers(); } +void TilesFramework::update_minimap(int gx, int gy) +{ + if (!player_in_mappable_area()) + return; + + int object = env.map[gx][gy].object; + map_feature f = (object >= DNGN_START_OF_MONSTERS) ? MF_MONS_HOSTILE : + get_feature_def((dungeon_feature_type)object).minimap; + + if (f == MF_SKIP) + f = get_feature_def(grd[gx][gy]).minimap; + ASSERT(f < MF_MAX); + + tiles.update_minimap(gx, gy, f); +} + void TilesFramework::update_minimap(int gx, int gy, map_feature f) { if (!player_in_mappable_area()) diff --git a/crawl-ref/source/tilesdl.h b/crawl-ref/source/tilesdl.h index 9653db6968..0d43c16990 100644 --- a/crawl-ref/source/tilesdl.h +++ b/crawl-ref/source/tilesdl.h @@ -100,6 +100,7 @@ public: void cgotoxy(int x, int y, int region = GOTO_CRT); void clear_message_window(); + void update_minimap(int gx, int gy); void update_minimap(int gx, int gy, map_feature f); void clear_minimap(); void update_inventory(); diff --git a/crawl-ref/source/travel.cc b/crawl-ref/source/travel.cc index 83048d6868..1d2c6d577a 100644 --- a/crawl-ref/source/travel.cc +++ b/crawl-ref/source/travel.cc @@ -256,7 +256,7 @@ static void _tile_exclude_gmap_update(const coord_def p) int px = p.x+x, py = p.y+y; if (in_bounds(coord_def(px,py))) { - tiles.update_minimap(px, py, MF_EXCL); + tiles.update_minimap(px, py); } } } diff --git a/crawl-ref/source/view.cc b/crawl-ref/source/view.cc index e4eab010a1..6106fde3e3 100644 --- a/crawl-ref/source/view.cc +++ b/crawl-ref/source/view.cc @@ -193,36 +193,13 @@ bool is_envmap_detected_mons(int x, int y) return (env.map[x][y].flags & MAP_DETECTED_MONSTER); } -#ifdef USE_TILE -static void _update_minimap(int x, int y) -{ - int object = env.map[x][y].object; - map_feature f = (object >= DNGN_START_OF_MONSTERS) ? MF_MONS_HOSTILE : - Feature[object].minimap; - - if (f == MF_SKIP) - f = Feature[grd[x][y]].minimap; - ASSERT(f < MF_MAX); - - tiles.update_minimap(x, y, f); -} - -void init_minimap() -{ - tiles.clear_minimap(); - for (int y = 0; y < GYM; y++) - for (int x = 0; x < GXM; x++) - _update_minimap(x, y); -} -#endif - void set_envmap_glyph(int x, int y, int object, int col) { map_cell &c = env.map[x][y]; c.object = object; c.colour = col; #ifdef USE_TILE - _update_minimap(x, y); + tiles.update_minimap(x, y); #endif } @@ -230,7 +207,7 @@ void set_envmap_obj( int x, int y, int obj ) { env.map[x][y].object = obj; #ifdef USE_TILE - _update_minimap(x, y); + tiles.update_minimap(x, y); #endif } diff --git a/crawl-ref/source/view.h b/crawl-ref/source/view.h index 59a7fe9379..da934d372a 100644 --- a/crawl-ref/source/view.h +++ b/crawl-ref/source/view.h @@ -227,10 +227,6 @@ void view_update_at(const coord_def &pos); void viewwindow(bool draw_it, bool do_updates); void fire_monster_alerts(); -#ifdef USE_TILE -void init_minimap(); -#endif - struct ray_def; bool find_ray( const coord_def& source, const coord_def& target, bool allow_fallback, ray_def& ray, int cycle_dir = 0, -- cgit v1.2.3-54-g00ecf