summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source
diff options
context:
space:
mode:
authorennewalker <ennewalker@c06c8d41-db1a-0410-9941-cceddc491573>2008-09-06 14:52:40 +0000
committerennewalker <ennewalker@c06c8d41-db1a-0410-9941-cceddc491573>2008-09-06 14:52:40 +0000
commit5f7dbb1623f8ed4c8fdf2a1a5a7427d9fe78f88a (patch)
treedf05954106f82999cac6a1a08cf7cd8370cad94b /crawl-ref/source
parente47ff61f0c964c045c99cb4c36dd8070ba9c7729 (diff)
downloadcrawl-ref-5f7dbb1623f8ed4c8fdf2a1a5a7427d9fe78f88a.tar.gz
crawl-ref-5f7dbb1623f8ed4c8fdf2a1a5a7427d9fe78f88a.zip
Fixing assertions from tileidx_unseen due to separation of tiles into different textures.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@6893 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source')
-rw-r--r--crawl-ref/source/libgui.cc9
-rw-r--r--crawl-ref/source/tilepick.cc90
-rw-r--r--crawl-ref/source/tiles.h3
-rw-r--r--crawl-ref/source/view.cc18
4 files changed, 64 insertions, 56 deletions
diff --git a/crawl-ref/source/libgui.cc b/crawl-ref/source/libgui.cc
index 2c2befc188..9176d7df09 100644
--- a/crawl-ref/source/libgui.cc
+++ b/crawl-ref/source/libgui.cc
@@ -56,9 +56,12 @@ int tile_idx_unseen_terrain(int x, int y, int what)
unsigned short grid_color;
get_item_symbol(feature, &grid_symbol, &grid_color);
- int t = tileidx_feature(feature, gc.x, gc.y);
+ unsigned int t = tileidx_feature(feature, gc.x, gc.y);
if (t == TILE_ERROR || what == ' ')
- t = tileidx_unseen(what, gc);
+ {
+ unsigned int fg_dummy;
+ tileidx_unseen(fg_dummy, t, what, gc);
+ }
t |= tile_unseen_flag(gc);
@@ -146,7 +149,7 @@ void get_input_line_gui(char *const buff, int len)
len = 1;
/* Restrict the length */
- if (x + len > r->mx)
+ if (x + len > (int)r->mx)
len = r->mx - x;
if (len > 40)
len = 40;
diff --git a/crawl-ref/source/tilepick.cc b/crawl-ref/source/tilepick.cc
index 00afc11192..1691a47611 100644
--- a/crawl-ref/source/tilepick.cc
+++ b/crawl-ref/source/tilepick.cc
@@ -2253,79 +2253,85 @@ int tileidx_player(int job)
}
-int tileidx_unseen(int ch, const coord_def& gc)
+void tileidx_unseen(unsigned int &fg, unsigned int &bg, int ch,
+ const coord_def& gc)
{
- int res = TILE_ERROR;
ch &= 0xff;
if (ch < 32)
ch = 32;
+ unsigned int flag = tile_unseen_flag(gc);
+ bg = TILE_FLOOR_NORMAL | flag;
+
if (ch >= '@' && ch <= 'Z' || ch >= 'a' && ch <= 'z'
|| ch == '&' || ch >= '1' && ch <= '5' || ch == ';')
{
- return TILE_UNSEEN_MONSTER | tile_unseen_flag(gc);
+ fg = TILE_UNSEEN_MONSTER;
+ return;
}
switch (ch)
{
//blank, walls, and floors first, since they are frequent
- case ' ': res = TILE_DNGN_UNSEEN; break;
+ case ' ': bg = TILE_DNGN_UNSEEN; break;
case 127: //old
case 176:
- case 177: res = TILE_WALL_NORMAL; break;
+ case 177: bg = TILE_WALL_NORMAL; break;
case 130:
case ',':
case '.':
case 249:
- case 250: res = TILE_FLOOR_NORMAL; break;
+ case 250: bg = TILE_FLOOR_NORMAL; break;
- case 137: res = TILE_DNGN_WAX_WALL; break;
- case 138: res = TILE_DNGN_STONE_WALL; break;
- case 139: res = TILE_DNGN_METAL_WALL; break;
- case 140: res = TILE_DNGN_GREEN_CRYSTAL_WALL; 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 '!': res = TILE_POTION_OFFSET + 13; break;
- case '"': res = TILE_AMU_NORMAL_OFFSET + 2; break;
- case '#': res = TILE_CLOUD_GREY_SMOKE; break;
- case '$': res = TILE_GOLD; break;
- case '%': res = TILE_FOOD_MEAT_RATION; break;
- case 142: res = TILE_UNSEEN_CORPSE; break;
+ 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: res = TILE_DNGN_OPEN_DOOR; break;
+ case 134: bg = TILE_DNGN_OPEN_DOOR; break;
case '(':
- case ')': res = TILE_UNSEEN_WEAPON; break;
- case '*': res = TILE_WALL_NORMAL ; break;
- case '+': res = TILE_BOOK_PAPER_OFFSET + 15; break;
-
- case '/': res = TILE_WAND_OFFSET; break;
- case '8': res = TILEP_SILVER_STATUE; break;
- case '<': res = TILE_DNGN_STONE_STAIRS_UP; break;
- case '=': res = TILE_RING_NORMAL_OFFSET + 1; break;
- case '>': res = TILE_DNGN_STONE_STAIRS_DOWN; break;
- case '?': res = TILE_SCROLL; break;
+ 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_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 '?': fg = TILE_UNSEEN_ITEM; break;
case '[':
- case ']': res = TILE_UNSEEN_ARMOUR; break;
- case '\\': res = TILE_STAFF_OFFSET; break;
- case '^': res = TILE_DNGN_TRAP_ZOT; break;
+ case ']': fg = TILE_UNSEEN_ARMOUR; break;
+ case '\\': fg = TILE_STAFF_OFFSET; break;
+ case '^': bg = TILE_DNGN_TRAP_ZOT; break;
case '_':
- case 131: res = TILE_UNSEEN_ALTAR; break;
- case '~': res = TILE_UNSEEN_ITEM; break;
+ case 131: fg = TILE_UNSEEN_ALTAR; break;
+ case '~': fg = TILE_UNSEEN_ITEM; break;
case '{':
- case 135: res = TILE_DNGN_DEEP_WATER; break;
- case 133: res = TILE_DNGN_BLUE_FOUNTAIN; break;
- case '}': res = TILE_MISC_CRYSTAL_BALL_OF_SEEING; break;
+ case 135: bg = TILE_DNGN_DEEP_WATER; break;
+ case 133: bg = TILE_DNGN_BLUE_FOUNTAIN; break;
+ case '}': fg = TILE_MISC_CRYSTAL_BALL_OF_SEEING; break;
case 128: //old
- case 254: res = TILE_DNGN_CLOSED_DOOR; break;
- case 129: res = TILE_DNGN_RETURN; break;
- case 132: res = TILE_UNSEEN_ENTRANCE; break;
- case 136: res = TILE_DNGN_ENTER; break;
- case 141: res = TILE_DNGN_LAVA; break;
+ case 254: bg = TILE_DNGN_CLOSED_DOOR; break;
+ case 129: bg = TILE_DNGN_RETURN; break;
+ case 132: fg = TILE_UNSEEN_ENTRANCE; break;
+ case 136: bg = TILE_DNGN_ENTER; break;
+ case 141: bg = TILE_DNGN_LAVA; break;
+
+ default: fg = TILE_ERROR; break;
}
- //if (res == TILE_ERROR) printf("undefined mapchar %d [%c]\n",ch,ch);
- return res | tile_unseen_flag(gc);
+
+ bg |= flag;
}
int tileidx_bolt(const bolt &bolt)
diff --git a/crawl-ref/source/tiles.h b/crawl-ref/source/tiles.h
index 77978a8e3b..3c9dd7db37 100644
--- a/crawl-ref/source/tiles.h
+++ b/crawl-ref/source/tiles.h
@@ -44,7 +44,8 @@ struct demon_data
int tileidx(unsigned int object, int extra);
int tileidx_feature(int object, int gx, int gy);
int tileidx_player(int job);
-int tileidx_unseen(int ch, const coord_def& gc);
+void tileidx_unseen(unsigned int &fg, unsigned int &bg, int ch,
+ const coord_def& gc);
int tileidx_item(const item_def &item);
int tileidx_item_throw(const item_def &item, int dx, int dy);
int tileidx_bolt(const bolt &bolt);
diff --git a/crawl-ref/source/view.cc b/crawl-ref/source/view.cc
index 113b9f55f4..04a3b30684 100644
--- a/crawl-ref/source/view.cc
+++ b/crawl-ref/source/view.cc
@@ -4902,8 +4902,7 @@ void viewwindow(bool draw_it, bool do_updates)
buffy[bufcount] = 0;
buffy[bufcount + 1] = DARKGREY;
#ifdef USE_TILE
- tileb[bufcount] = 0;
- tileb[bufcount + 1] = tileidx_unseen(' ', gc);
+ tileidx_unseen(tileb[bufcount], tileb[bufcount+1], ' ', gc);
#endif
}
else if (!crawl_view.in_grid_los(gc))
@@ -4919,12 +4918,11 @@ void viewwindow(bool draw_it, bool do_updates)
}
#ifdef USE_TILE
- unsigned short bg = env.tile_bk_bg[gc.x][gc.y];
- unsigned short fg = env.tile_bk_fg[gc.x][gc.y];
+ unsigned int bg = env.tile_bk_bg[gc.x][gc.y];
+ unsigned int fg = env.tile_bk_fg[gc.x][gc.y];
if (bg == 0 && fg == 0)
{
- bg = tileidx_unseen(get_envmap_char(gc.x,gc.y), gc);
- env.tile_bk_bg[gc.x][gc.y] = bg;
+ tileidx_unseen(fg, bg, get_envmap_char(gc.x, gc.y), gc);
}
tileb[bufcount] = fg;
tileb[bufcount + 1] = bg | tile_unseen_flag(gc);
@@ -5072,10 +5070,10 @@ void viewwindow(bool draw_it, bool do_updates)
}
else
{
- tileb[bufcount] = 0;
- tileb[bufcount + 1] =
- tileidx_unseen(
- get_envmap_char( gc.x, gc.y ), gc);
+ tileidx_unseen(tileb[bufcount],
+ tileb[bufcount+1],
+ get_envmap_char(gc.x, gc.y),
+ gc);
}
#endif
}