summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source
diff options
context:
space:
mode:
authorEnne Walker <enne.walker@gmail.com>2010-06-06 23:19:57 -0400
committerEnne Walker <enne.walker@gmail.com>2010-06-08 21:36:24 -0400
commit2d900bb4c548f29a9308557e00ed283b654ec916 (patch)
tree5865f40a08d0ded5f56cc66897fc32dac896406b /crawl-ref/source
parentb4373cee1630e934a5b4a5a237ae6ea316477931 (diff)
downloadcrawl-ref-2d900bb4c548f29a9308557e00ed283b654ec916.tar.gz
crawl-ref-2d900bb4c548f29a9308557e00ed283b654ec916.zip
Properly init missing tile info from show_type.
This also removes the now uneeded (and entirely broken) tileidx_unseen function. Instead, when loading saves that don't have a tile tag, use show_type from the map_knowledge to determine what the player can see.
Diffstat (limited to 'crawl-ref/source')
-rw-r--r--crawl-ref/source/tags.cc7
-rw-r--r--crawl-ref/source/tilepick.cc110
-rw-r--r--crawl-ref/source/tilepick.h4
3 files changed, 32 insertions, 89 deletions
diff --git a/crawl-ref/source/tags.cc b/crawl-ref/source/tags.cc
index 1f5776ef43..72f407425e 100644
--- a/crawl-ref/source/tags.cc
+++ b/crawl-ref/source/tags.cc
@@ -2706,9 +2706,10 @@ static void tag_missing_level_tiles()
{
coord_def gc(i, j);
tileidx_t fg, bg;
- tileidx_unseen(&fg, &bg, get_map_knowledge_char(i, j), gc);
- env.tile_bk_fg[i][j] = fg;
- env.tile_bk_bg[i][j] = bg;
+ tileidx_from_show(&fg, &bg, get_map_knowledge_obj(gc));
+
+ env.tile_bk_bg(gc) = bg;
+ env.tile_bk_fg(gc) = fg;
}
mcache.clear_all();
diff --git a/crawl-ref/source/tilepick.cc b/crawl-ref/source/tilepick.cc
index 7dd75e8b49..1b51c586d5 100644
--- a/crawl-ref/source/tilepick.cc
+++ b/crawl-ref/source/tilepick.cc
@@ -364,6 +364,32 @@ tileidx_t tileidx_out_of_bounds(int branch)
return (TILE_DNGN_UNSEEN | TILE_FLAG_UNSEEN);
}
+void tileidx_from_show(tileidx_t *fg, tileidx_t *bg, const show_type &show)
+{
+ *bg = _tileidx_feature_base(show.feat);
+
+ switch (show.cls)
+ {
+ default:
+ case SH_NOTHING:
+ case SH_FEATURE:
+ *fg = 0;
+ break;
+ case SH_ITEM:
+ *fg = tileidx_show_item(show.item);
+ break;
+ case SH_CLOUD:
+ *fg = TILE_CLOUD_GREY_SMOKE;
+ break;
+ case SH_INVIS_EXPOSED:
+ *fg = TILE_UNSEEN_MONSTER;
+ break;
+ case SH_MONSTER:
+ *fg = _tileidx_monster_base(show.mons);
+ break;
+ }
+}
+
void tileidx_out_of_los(tileidx_t *fg, tileidx_t *bg, const coord_def& gc)
{
// Player memory.
@@ -3555,90 +3581,6 @@ tileidx_t tileidx_unseen_flag(const coord_def &gc)
return (TILE_FLAG_UNSEEN);
}
-void tileidx_unseen(tileidx_t *fg, tileidx_t *bg, screen_buffer_t ch,
- const coord_def &gc)
-{
- ch &= 0xff;
- if (ch < 32)
- ch = 32;
-
- tileidx_t flag = tileidx_unseen_flag(gc);
- *fg = 0;
- *bg = TILE_FLOOR_NORMAL | flag;
-
- if (ch >= '@' && ch <= 'Z' || ch >= 'a' && ch <= 'z'
- || ch == '&' || ch >= '1' && ch <= '5' || ch == ';')
- {
- *fg = TILE_UNSEEN_MONSTER;
- return;
- }
-
- switch (ch)
- {
- //blank, walls, and floors first, since they are frequent
- case ' ': *bg = TILE_DNGN_UNSEEN; break;
- case 127: //old
- case 176:
- case 177: *bg = TILE_WALL_NORMAL; break;
-
- case 130:
- case ',':
- case '.':
- case 249:
- case 250: *bg = TILE_FLOOR_NORMAL; break;
-
- case 137: *bg = TILE_DNGN_WAX_WALL; break;
- case 138: *bg = TILE_DNGN_STONE_WALL; break;
- case 139: *bg = TILE_DNGN_METAL_WALL; break;
- case 140: *bg = TILE_DNGN_GREEN_CRYSTAL_WALL; break;
-
- // others
- case '!': *fg = TILE_POTION_OFFSET + 13; break;
- case '"': *fg = TILE_AMU_NORMAL_OFFSET + 2; break;
- case '#': *fg = TILE_CLOUD_GREY_SMOKE; break;
- case '$': *fg = TILE_GOLD; break;
- case '%': *fg = TILE_FOOD_MEAT_RATION; break;
- case 142: *fg = TILE_UNSEEN_CORPSE; break;
-
- case '\'':
- case 134: *bg = TILE_DNGN_OPEN_DOOR; break;
- case '(':
- case ')': *fg = TILE_UNSEEN_WEAPON; break;
- case '*': *fg = TILE_WALL_NORMAL ; break;
- case '+': *fg = TILE_BOOK_PAPER_OFFSET + 15; break;
-
- case '/': *fg = TILE_WAND_OFFSET; break;
- case '8': *fg = TILEP_MONS_SILVER_STATUE; break;
- case '<': *bg = TILE_DNGN_STONE_STAIRS_UP; break;
- case '=': *fg = TILE_RING_NORMAL_OFFSET + 1; break;
- case '>': *bg = TILE_DNGN_STONE_STAIRS_DOWN; break;
- case '~':
- case '?': *fg = TILE_UNSEEN_ITEM; break;
- case '[':
- case ']': *fg = TILE_UNSEEN_ARMOUR; break;
- case '\\': *fg = TILE_STAFF_OFFSET; break;
- case '^': *bg = TILE_DNGN_TRAP_ARROW; break;
- case '_':
- case 220:
- case 131: *bg = TILE_DNGN_UNSEEN_ALTAR; break;
- case '{':
- case 247:
- case 135: *bg = TILE_DNGN_DEEP_WATER; break;
- case 244:
- case 133: *bg = TILE_DNGN_BLUE_FOUNTAIN; break;
- case '}': *fg = TILE_MISC_CRYSTAL_BALL_OF_SEEING; break;
- case 128: //old
- case 254: *bg = TILE_DNGN_CLOSED_DOOR; break;
- case 129: *bg = TILE_DNGN_RETURN; break;
- case 239:
- case 132: *bg = TILE_DNGN_UNSEEN_ENTRANCE; break;
- case 136: *bg = TILE_DNGN_ENTER; break;
- case 141: *bg = TILE_DNGN_LAVA; break;
- }
-
- *bg |= flag;
-}
-
int enchant_to_int(const item_def &item)
{
switch (item.flags & ISFLAG_COSMETIC_MASK)
diff --git a/crawl-ref/source/tilepick.h b/crawl-ref/source/tilepick.h
index df673d58ca..d4275f6d40 100644
--- a/crawl-ref/source/tilepick.h
+++ b/crawl-ref/source/tilepick.h
@@ -15,10 +15,12 @@ struct cloud_struct;
class coord_def;
class item_def;
class monsters;
+struct show_type;
// Tile index lookup from Crawl data.
tileidx_t tileidx_feature(const coord_def &gc);
tileidx_t tileidx_out_of_bounds(int branch);
+void tileidx_from_show(tileidx_t *fg, tileidx_t *bg, const show_type &show);
void tileidx_out_of_los(tileidx_t *fg, tileidx_t *bg, const coord_def& gc);
tileidx_t tileidx_monster(const monsters *mon);
@@ -39,8 +41,6 @@ tileidx_t tileidx_corpse_brand(const item_def &item);
tileidx_t get_clean_map_idx(tileidx_t tile_idx);
tileidx_t tileidx_unseen_flag(const coord_def &gc);
-void tileidx_unseen(tileidx_t *fg, tileidx_t *bg, screen_buffer_t ch,
- const coord_def& gc);
// Return the level of enchantment as an int. None is 0, Randart is 4.