diff options
author | ennewalker <ennewalker@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-01-19 03:55:41 +0000 |
---|---|---|
committer | ennewalker <ennewalker@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-01-19 03:55:41 +0000 |
commit | b305accdee3ce085e65639f874e59f9592f234d3 (patch) | |
tree | 6aaecf6c1698b827e62fca4e026f95f9816502ce /crawl-ref/source | |
parent | 8b88fbd2166388611430cf0036e988b3e24adbd4 (diff) | |
download | crawl-ref-b305accdee3ce085e65639f874e59f9592f234d3.tar.gz crawl-ref-b305accdee3ce085e65639f874e59f9592f234d3.zip |
Tile support to show travel exclusions.
Added status graphic for poisoned monsters.
Changing tile storage type from unsigned short to unsigned int to have room for more flag bits.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@3300 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source')
-rw-r--r-- | crawl-ref/source/externs.h | 8 | ||||
-rw-r--r-- | crawl-ref/source/guic-x11.cc | 2 | ||||
-rw-r--r-- | crawl-ref/source/rltiles/dc-misc.txt | 4 | ||||
-rw-r--r-- | crawl-ref/source/rltiles/dc-misc/heart.bmp | bin | 2102 -> 2102 bytes | |||
-rw-r--r-- | crawl-ref/source/rltiles/dc-misc/poison.bmp | bin | 0 -> 2102 bytes | |||
-rw-r--r-- | crawl-ref/source/rltiles/dc-misc/travel_exclusion.bmp | bin | 0 -> 2102 bytes | |||
-rw-r--r-- | crawl-ref/source/tile1.cc | 32 | ||||
-rw-r--r-- | crawl-ref/source/tile2.cc | 172 | ||||
-rw-r--r-- | crawl-ref/source/tiles.h | 14 | ||||
-rw-r--r-- | crawl-ref/source/travel.cc | 2 | ||||
-rw-r--r-- | crawl-ref/source/travel.h | 1 | ||||
-rw-r--r-- | crawl-ref/source/view.cc | 2 |
12 files changed, 146 insertions, 91 deletions
diff --git a/crawl-ref/source/externs.h b/crawl-ref/source/externs.h index fef107e412..42faecea03 100644 --- a/crawl-ref/source/externs.h +++ b/crawl-ref/source/externs.h @@ -1360,12 +1360,12 @@ public: #ifdef USE_TILE // indexed by grid coords - FixedArray<unsigned short,GXM, GYM> tile_bk_fg; // tile fg - FixedArray<unsigned short,GXM, GYM> tile_bk_bg; // tile bg + FixedArray<unsigned int,GXM, GYM> tile_bk_fg; // tile fg + FixedArray<unsigned int,GXM, GYM> tile_bk_bg; // tile bg FixedArray<TileFlavor, GXM, GYM> tile_flavor; // indexed by (show-1) coords - FixedArray<unsigned short,ENV_SHOW_DIAMETER-2,ENV_SHOW_DIAMETER-2> tile_fg; - FixedArray<unsigned short,ENV_SHOW_DIAMETER-2,ENV_SHOW_DIAMETER-2> tile_bg; + FixedArray<unsigned int,ENV_SHOW_DIAMETER-2,ENV_SHOW_DIAMETER-2> tile_fg; + FixedArray<unsigned int,ENV_SHOW_DIAMETER-2,ENV_SHOW_DIAMETER-2> tile_bg; #endif FixedVector< cloud_struct, MAX_CLOUDS > cloud; // cloud list diff --git a/crawl-ref/source/guic-x11.cc b/crawl-ref/source/guic-x11.cc index 941ac914ad..564754e3ab 100644 --- a/crawl-ref/source/guic-x11.cc +++ b/crawl-ref/source/guic-x11.cc @@ -249,7 +249,7 @@ void WinClass::create(char *name) LeaveWindowMask | EnterWindowMask | StructureNotifyMask ); move(ox, oy); - XStoreName(display, win, CRAWL VERSION); + XStoreName(display, win, CRAWL " " VERSION); } else resize(0,0); diff --git a/crawl-ref/source/rltiles/dc-misc.txt b/crawl-ref/source/rltiles/dc-misc.txt index 5ec32a2160..ac0233d764 100644 --- a/crawl-ref/source/rltiles/dc-misc.txt +++ b/crawl-ref/source/rltiles/dc-misc.txt @@ -50,7 +50,10 @@ sink_mask SINK_MASK cursor CURSOR
cursor_red CURSOR2
cursor_green CURSOR3
+%rim 1
heart HEART
+poison POISON
+%rim 0
may_stab_brand MAY_STAB_BRAND
stab_brand STAB_BRAND
unseen PLAYER
@@ -65,6 +68,7 @@ txt3 TEXT_PARTS_E txt4 TEXT_DOLLS_E
something_under SOMETHING_UNDER
error ERROR
+travel_exclusion TRAVEL_EXCLUSION
%rim 1
todo TODO
%rim 0
diff --git a/crawl-ref/source/rltiles/dc-misc/heart.bmp b/crawl-ref/source/rltiles/dc-misc/heart.bmp Binary files differindex 4efc69da69..fa3a95fdc9 100644 --- a/crawl-ref/source/rltiles/dc-misc/heart.bmp +++ b/crawl-ref/source/rltiles/dc-misc/heart.bmp diff --git a/crawl-ref/source/rltiles/dc-misc/poison.bmp b/crawl-ref/source/rltiles/dc-misc/poison.bmp Binary files differnew file mode 100644 index 0000000000..35fbd445bb --- /dev/null +++ b/crawl-ref/source/rltiles/dc-misc/poison.bmp diff --git a/crawl-ref/source/rltiles/dc-misc/travel_exclusion.bmp b/crawl-ref/source/rltiles/dc-misc/travel_exclusion.bmp Binary files differnew file mode 100644 index 0000000000..622f07f142 --- /dev/null +++ b/crawl-ref/source/rltiles/dc-misc/travel_exclusion.bmp diff --git a/crawl-ref/source/tile1.cc b/crawl-ref/source/tile1.cc index 374ad62cde..0fe3771d50 100644 --- a/crawl-ref/source/tile1.cc +++ b/crawl-ref/source/tile1.cc @@ -18,11 +18,12 @@ #include "terrain.h" #include "tiles.h" #include "tiledef-p.h" +#include "travel.h" #include "view.h" // tile index cache to reduce tileidx() calls -static FixedArray < unsigned short, GXM, GYM > tile_dngn; -// // gv backup +static FixedArray < unsigned int, GXM, GYM > tile_dngn; +// gv backup static FixedArray < unsigned char, GXM, GYM > gv_now; bool is_bazaar() @@ -795,24 +796,28 @@ int tileidx_monster_base(int mon_idx, bool detected) int tileidx_monster(int mon_idx, bool detected) { int ch = tileidx_monster_base(mon_idx, detected); + const monsters* mons = &menv[mon_idx]; - if(mons_flies(&menv[mon_idx])) + if (mons_flies(mons)) ch |= TILE_FLAG_FLYING; - if(menv[mon_idx].has_ench(ENCH_HELD)) + if (mons->has_ench(ENCH_HELD)) ch |= TILE_FLAG_NET; + if (mons->has_ench(ENCH_POISON)) + ch |= TILE_FLAG_POISON; - if(mons_friendly(&menv[mon_idx])) + if (mons_friendly(mons)) { ch |= TILE_FLAG_PET; } - else if (mons_looks_stabbable(&menv[mon_idx])) + else if (mons_looks_stabbable(mons)) { ch |= TILE_FLAG_STAB; } - else if (mons_looks_distracted(&menv[mon_idx])) + else if (mons_looks_distracted(mons)) { ch |= TILE_FLAG_MAY_STAB; } + return ch; } @@ -2008,7 +2013,7 @@ int tileidx_zap(int color) // Plus modify wall tile index depending on // 1: floor/wall flavor in 2D mode // 2: connectivity in 3D mode -void finalize_tile(short unsigned int *tile, bool is_special, +void finalize_tile(unsigned int *tile, bool is_special, char wall_flv, char floor_flv, char special_flv) { int orig = (*tile) & TILE_FLAG_MASK; @@ -3803,7 +3808,7 @@ void tile_draw_rays(bool resetCount) tileRayCount = 0; } -void tile_finish_dngn(short unsigned int *tileb, int cx, int cy) +void tile_finish_dngn(unsigned int *tileb, int cx, int cy) { int x, y; int count = 0; @@ -3836,12 +3841,19 @@ void tile_finish_dngn(short unsigned int *tileb, int cx, int cy) wall_flv, floor_flv, special_flv); finalize_tile(&tileb[count+1], is_special, wall_flv, floor_flv, special_flv); + + const coord_def gc(gx, gy); + if (is_excluded(gc)) + { + tileb[count+1] |= TILE_FLAG_TRAVEL_EX; + } + count += 2; } } } -void tile_draw_dungeon(short unsigned int *tileb) +void tile_draw_dungeon(unsigned int *tileb) { tile_finish_dngn(tileb, you.x_pos, you.y_pos); TileDrawDungeon(tileb); diff --git a/crawl-ref/source/tile2.cc b/crawl-ref/source/tile2.cc index e5b9ebd716..23ecf4fa6a 100644 --- a/crawl-ref/source/tile2.cc +++ b/crawl-ref/source/tile2.cc @@ -75,9 +75,9 @@ void tile_set_force_redraw_inv(bool redraw) force_redraw_inv = redraw; } -static unsigned short int t1buf[TILE_DAT_XMAX+2][TILE_DAT_YMAX+2], +static unsigned int t1buf[TILE_DAT_XMAX+2][TILE_DAT_YMAX+2], t2buf[TILE_DAT_XMAX+2][TILE_DAT_YMAX+2]; -static short unsigned int tb_bk[TILE_DAT_YMAX*TILE_DAT_XMAX*2]; +static unsigned int tb_bk[TILE_DAT_YMAX*TILE_DAT_XMAX*2]; #define MAX_ITEMLIST 200 int itemlist[MAX_ITEMLIST]; @@ -424,63 +424,51 @@ void lift_tcache(int ix, int kind, int hash){ // If not found, compose and cache it static int tcache_find_id_normal(int kind, int *fg, int *bg, int *is_new) { - unsigned int id[4]; - int i; int hash = 0; // Don't use hash - int kind_n_hash = kind*tc_hash + hash; - int nlayer = tcache_nlayer_normal[kind]; + int kind_n_hash = kind * tc_hash + hash; + tile_cache *tc = tcache[kind]; tile_cache *tc0 = &tc[tcache_head[kind_n_hash]]; -#if DEBUG - int search_count =0; -#endif *is_new=0; - for(i=0;i<nlayer;i++) id[i]= (fg[i]<<16)+bg[i]+1; - while(1){ tile_cache *next = tc0->next; - if(tc0->id[0] == id[0]) break; + if ((int)tc0->id[0] == fg[0] && (int)tc0->id[1] == bg[0]) + break; - if(tc0->id[0]==0 || next == NULL) + if ((int)tc0->id[0] == 0 || next == NULL) { - //end of used cache + //end of used cache *is_new = 1; tcache_compose_normal(tc0->idx, fg, bg); - for(i=0;i<nlayer;i++) tc0->id[i] = id[i]; + tc0->id[0] = fg[0]; + tc0->id[1] = bg[0]; break; } tc0 = next; -#if DEBUG - search_count++; -#endif } lift_tcache(tc0->idx, kind, hash); -#if DEBUG -//DEBUGLOG("%d\n",search_count); -#endif - return tc0->idx; } /*** overlay a tile onto an exsisting image with transpalency operation */ void tcache_overlay(img_type img, int idx, - int tile, int region, int *copy, char *mask) + int tile, int region, int *copy, char *mask, unsigned int shift_left = 0) { int x0, y0; - int sx= region_sx_normal[region]; - int sy= region_sy_normal[region]; - int wx= region_wx_normal[region]; - int wy= region_wy_normal[region]; - int ox=0; - int oy=0; + int sx = region_sx_normal[region] + shift_left; + int sy = region_sy_normal[region]; + int wx = region_wx_normal[region] - shift_left; + int wy = region_wy_normal[region]; + int ox = 0; + int oy = 0; img_type src = TileImg; - int uy=wy; + int uy = wy; tile &= TILE_FLAG_MASK; @@ -489,26 +477,27 @@ void tcache_overlay(img_type img, int idx, if (mask != NULL) { - if(*copy ==2) + if (*copy ==2) + { ImgCopyMaskedH(src, x0 + sx, y0 + sy, wx, wy, - img, ox, oy + idx*uy, mask); + img, ox, oy + idx*uy, mask); + } else + { ImgCopyMasked(src, x0 + sx, y0 + sy, wx, wy, - img, ox, oy + idx*uy, mask); - *copy = 0; - return; + img, ox, oy + idx*uy, mask); + } } // Hack: hilite rim color - else if(*copy ==2) + else if (*copy ==2) { - *copy=0; ImgCopyH(src, x0 + sx, y0 + sy, wx, wy, - img, ox, oy + idx*uy, *copy); - return; - } else + img, ox, oy + idx*uy, *copy); + } + else { ImgCopy(src, x0 + sx, y0 + sy, wx, wy, - img, ox, oy + idx*uy, *copy); + img, ox, oy + idx*uy, *copy); } *copy = 0; } @@ -691,71 +680,116 @@ int sink_mask_tile(int bg, int fg) } //normal -void tcache_compose_normal(int ix, int *fg, int *bg){ +void tcache_compose_normal(int ix, int *fg, int *bg) +{ int bbg; int new_bg; - int c=1; - int fg0=fg[0]; - int bg0=bg[0]; + int c = 1; + int fg0 = fg[0]; + int bg0 = bg[0]; int sink; img_type tc_img = tcache_image[TCACHE0_NORMAL]; get_bbg(bg0, &new_bg, &bbg); - if(bbg) tcache_overlay(tc_img, ix, bbg, TREGION_0_NORMAL, &c, NULL); - if(new_bg) tcache_overlay(tc_img, ix, new_bg, TREGION_0_NORMAL, &c, NULL); + if (bbg) + tcache_overlay(tc_img, ix, bbg, TREGION_0_NORMAL, &c, NULL); + if(new_bg) + tcache_overlay(tc_img, ix, new_bg, TREGION_0_NORMAL, &c, NULL); - //Tile cursor - if(bg0&TILE_FLAG_CURSOR) + // Tile cursor + if (bg0 & TILE_FLAG_CURSOR) { - int type = ((bg0&TILE_FLAG_CURSOR) == TILE_FLAG_CURSOR1) ? + int type = ((bg0 & TILE_FLAG_CURSOR) == TILE_FLAG_CURSOR1) ? TILE_CURSOR : TILE_CURSOR2; - if ((bg0&TILE_FLAG_CURSOR) == TILE_FLAG_CURSOR3) type = TILE_CURSOR3; + if ((bg0 & TILE_FLAG_CURSOR) == TILE_FLAG_CURSOR3) + type = TILE_CURSOR3; tcache_overlay(tc_img, ix, type, TREGION_0_NORMAL, &c, NULL); - if (type != TILE_CURSOR3) c = 2;// Hilite + if (type != TILE_CURSOR3) + c = 2; + } + + // Apply the travel exclusion under the foreground if the cell is + // visible. It will be applied later if the cell is unseen. + if ((bg0 & TILE_FLAG_TRAVEL_EX) && !(bg0 & TILE_FLAG_UNSEEN)) + { + tcache_overlay(tc_img, ix, TILE_TRAVEL_EXCLUSION, TREGION_0_NORMAL, &c, + NULL); } if (bg0 & TILE_FLAG_RAY) tcache_overlay(tc_img, ix, TILE_RAY_MESH, TREGION_0_NORMAL, &c, NULL); - if(fg0) + if (fg0) { sink = sink_mask_tile(bg0, fg0); if (sink) { - int flag=2; + int flag = 2; register_tile_mask(sink, TREGION_0_NORMAL, &flag, sink_mask); tcache_overlay(tc_img, ix, fg0, TREGION_0_NORMAL, &c, sink_mask); } else + { tcache_overlay(tc_img, ix, fg0, TREGION_0_NORMAL, &c, NULL); + } } if (fg0 & TILE_FLAG_NET) tcache_overlay(tc_img, ix, TILE_TRAP_NET, TREGION_0_NORMAL, &c, NULL); - if(fg0 & TILE_FLAG_S_UNDER) + if (fg0 & TILE_FLAG_S_UNDER) + { tcache_overlay(tc_img, ix, TILE_SOMETHING_UNDER, - TREGION_0_NORMAL, &c, NULL); - - //Pet mark - if((fg0&TILE_FLAG_MAY_STAB) == TILE_FLAG_PET) - tcache_overlay(tc_img, ix, TILE_HEART, TREGION_0_NORMAL, &c, NULL); + TREGION_0_NORMAL, &c, NULL); + } - if((fg0&TILE_FLAG_MAY_STAB) == TILE_FLAG_STAB) + // Pet mark + int status_shift = 0; + if ((fg0 & TILE_FLAG_MAY_STAB) == TILE_FLAG_PET) + { + tcache_overlay(tc_img, ix, TILE_HEART, TREGION_0_NORMAL, &c, NULL); + status_shift += 10; + } + else if ((fg0 & TILE_FLAG_MAY_STAB) == TILE_FLAG_STAB) + { tcache_overlay(tc_img, ix, TILE_STAB_BRAND, TREGION_0_NORMAL, &c, NULL); - else if((fg0&TILE_FLAG_MAY_STAB) == TILE_FLAG_MAY_STAB) + status_shift += 8; + } + else if ((fg0 & TILE_FLAG_MAY_STAB) == TILE_FLAG_MAY_STAB) + { tcache_overlay(tc_img, ix, TILE_MAY_STAB_BRAND, TREGION_0_NORMAL, &c, NULL); + status_shift += 5; + } + + if (fg0 & TILE_FLAG_POISON) + { + tcache_overlay(tc_img, ix, TILE_POISON, TREGION_0_NORMAL, &c, NULL, + status_shift); + status_shift += 5; + } - if(bg0&TILE_FLAG_UNSEEN) + if (bg0 & TILE_FLAG_UNSEEN) + { tcache_overlay(tc_img, ix, TILE_MESH, TREGION_0_NORMAL, &c, NULL); + } + + if (bg0 & TILE_FLAG_MM_UNSEEN) + { + tcache_overlay(tc_img, ix, TILE_MAGIC_MAP_MESH, TREGION_0_NORMAL, &c, + NULL); + } + + if ((bg0 & TILE_FLAG_TRAVEL_EX) && (bg0 & TILE_FLAG_UNSEEN)) + { + tcache_overlay(tc_img, ix, TILE_TRAVEL_EXCLUSION, TREGION_0_NORMAL, &c, + NULL); + } - if(bg0&TILE_FLAG_MM_UNSEEN) - tcache_overlay(tc_img, ix, TILE_MAGIC_MAP_MESH, TREGION_0_NORMAL, &c, NULL); } // Tile cursor @@ -774,7 +808,7 @@ void TileDrawBolt(int x, int y, int fg){ update_single_grid(x, y); } -void StoreDungeonView(short unsigned int *tileb) +void StoreDungeonView(unsigned int *tileb) { int x, y; int count = 0; @@ -791,7 +825,7 @@ void StoreDungeonView(short unsigned int *tileb) }} } -void LoadDungeonView(short unsigned int *tileb) +void LoadDungeonView(unsigned int *tileb) { int x, y; int count = 0; @@ -814,7 +848,7 @@ void LoadDungeonView(short unsigned int *tileb) } //Draw the tile screen once and for all -void TileDrawDungeon(short unsigned int *tileb) +void TileDrawDungeon(unsigned int *tileb) { int x, y, kind; if(!TileImg) @@ -843,7 +877,7 @@ void TileDrawDungeon(short unsigned int *tileb) void TileDrawFarDungeon(int cx, int cy) { - short unsigned int tb[TILE_DAT_YMAX*TILE_DAT_XMAX*2]; + unsigned int tb[TILE_DAT_YMAX*TILE_DAT_XMAX*2]; int count = 0; for(int y=0; y<tile_dngn_y; y++) diff --git a/crawl-ref/source/tiles.h b/crawl-ref/source/tiles.h index dc04817f69..db647ed6bc 100644 --- a/crawl-ref/source/tiles.h +++ b/crawl-ref/source/tiles.h @@ -49,8 +49,8 @@ void tile_place_ray(const coord_def& gc); void tile_draw_rays(bool resetCount); void tile_clear_buf(); -void tile_finish_dngn(short unsigned int *tileb, int cx, int cy); -void tile_draw_dungeon(short unsigned int *tileb); +void tile_finish_dngn(unsigned int *tileb, int cx, int cy); +void tile_draw_dungeon(unsigned int *tileb); // Tile Inventry display void tile_draw_inv(int item_type = -1, int flag = -1); @@ -81,13 +81,13 @@ int TileDrawCursor(int x, int y, int flag); // display bolts void TileDrawBolt(int x, int y, int fg); // display dungeon: tileb = { fg(0,0),bg(0,0),fg(1,0),bg(1,0), .. -void TileDrawDungeon(short unsigned int *tileb); +void TileDrawDungeon(unsigned int *tileb); // display memorized dungeon void TileDrawFarDungeon(int cx, int cy); // display map centered on grid coords void TileDrawMap(int gx, int gy); -void LoadDungeonView(short unsigned int *tileb); -void StoreDungeonView(short unsigned int *tileb); +void LoadDungeonView(unsigned int *tileb); +void StoreDungeonView(unsigned int *tileb); void TileNewLevel(bool first_time); @@ -139,6 +139,7 @@ enum tile_flags TILE_FLAG_PET = 0x00004000, TILE_FLAG_STAB = 0x00008000, TILE_FLAG_MAY_STAB = 0x0000C000, + TILE_FLAG_POISON = 0x00010000, // Background flags TILE_FLAG_RAY = 0x00000800, @@ -149,6 +150,9 @@ enum tile_flags TILE_FLAG_CURSOR2 = 0x00004000, TILE_FLAG_CURSOR3 = 0x0000C000, TILE_FLAG_CURSOR = 0x0000C000, + TILE_FLAG_BLOOD = 0x00010000, + TILE_FLAG_NEW_STAIR = 0x00020000, + TILE_FLAG_TRAVEL_EX = 0x00040000, // General TILE_FLAG_MASK = 0x000007FF diff --git a/crawl-ref/source/travel.cc b/crawl-ref/source/travel.cc index e4e8a3f2e2..9401d4b510 100644 --- a/crawl-ref/source/travel.cc +++ b/crawl-ref/source/travel.cc @@ -216,7 +216,7 @@ static bool is_excluded(const coord_def &p, return (false); } -inline static bool is_excluded(const coord_def &p) +inline bool is_excluded(const coord_def &p) { return is_excluded(p, curr_excludes); } diff --git a/crawl-ref/source/travel.h b/crawl-ref/source/travel.h index d48e6ab916..9fbc1e693c 100644 --- a/crawl-ref/source/travel.h +++ b/crawl-ref/source/travel.h @@ -72,6 +72,7 @@ bool is_resting( void ); bool can_travel_interlevel(); bool is_traversable(dungeon_feature_type grid); void explore_pickup_event(int did_pickup, int tried_pickup); +bool is_excluded(const coord_def &p); void find_travel_pos(int you_x, int you_y, char *move_x, char *move_y, std::vector<coord_def>* coords = NULL); diff --git a/crawl-ref/source/view.cc b/crawl-ref/source/view.cc index d4a92bc38f..3a26d599d4 100644 --- a/crawl-ref/source/view.cc +++ b/crawl-ref/source/view.cc @@ -4377,7 +4377,7 @@ bool view_update() void viewwindow(bool draw_it, bool do_updates) { #ifdef USE_TILE - std::vector<unsigned short> tileb( + std::vector<unsigned int> tileb( crawl_view.viewsz.y * crawl_view.viewsz.x * 2); #endif screen_buffer_t *buffy(crawl_view.vbuf); |