summaryrefslogtreecommitdiffstats
path: root/crawl-ref
diff options
context:
space:
mode:
authorennewalker <ennewalker@c06c8d41-db1a-0410-9941-cceddc491573>2008-10-05 03:15:39 +0000
committerennewalker <ennewalker@c06c8d41-db1a-0410-9941-cceddc491573>2008-10-05 03:15:39 +0000
commita4216190921d3a0912924df441f7cad3752de02a (patch)
tree9c2ab43e3aef4c80ab57ef7501afa7204f416989 /crawl-ref
parent34e3ce6b9b4514f567a10429ffb83bc32547fd17 (diff)
downloadcrawl-ref-a4216190921d3a0912924df441f7cad3752de02a.tar.gz
crawl-ref-a4216190921d3a0912924df441f7cad3752de02a.zip
Graphical support for range restrictions of spells in tiles mode. Clicking past the max range will now fire as far as it can, rather than just giving an error.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@7135 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref')
-rw-r--r--crawl-ref/docs/options_guide.txt3
-rw-r--r--crawl-ref/source/directn.cc24
-rw-r--r--crawl-ref/source/initfile.cc2
-rw-r--r--crawl-ref/source/rltiles/dc-dngn.txt3
-rw-r--r--crawl-ref/source/rltiles/dc-misc/ray.pngbin123 -> 177 bytes
-rw-r--r--crawl-ref/source/rltiles/dc-misc/ray_out_of_range.pngbin0 -> 140 bytes
-rw-r--r--crawl-ref/source/tilepick.cc29
-rw-r--r--crawl-ref/source/tilereg.cc4
-rw-r--r--crawl-ref/source/tiles.h3
9 files changed, 50 insertions, 18 deletions
diff --git a/crawl-ref/docs/options_guide.txt b/crawl-ref/docs/options_guide.txt
index 3e41f02daf..370367b136 100644
--- a/crawl-ref/docs/options_guide.txt
+++ b/crawl-ref/docs/options_guide.txt
@@ -1159,7 +1159,8 @@ show_beam = true
When performing actions such as throwing or zapping, you can
toggle whether to show the beam path or not. This option
controls the initial status of this toggle. When set to true,
- the path will be shown.
+ the path will be shown. This is always true for the tile
+ version.
item_stack_summary_minimum = 5
If you step over a stack with this number or more of items in
diff --git a/crawl-ref/source/directn.cc b/crawl-ref/source/directn.cc
index 6f3429bab5..1e6eac5fec 100644
--- a/crawl-ref/source/directn.cc
+++ b/crawl-ref/source/directn.cc
@@ -254,10 +254,10 @@ static const char *target_mode_help_text(int mode)
}
static void draw_ray_glyph(const coord_def &pos, int colour,
- int glych, int mcol)
+ int glych, int mcol, bool in_range)
{
#ifdef USE_TILE
- tile_place_ray(pos);
+ tile_place_ray(pos, in_range);
#else
int mid = mgrd(pos);
if (mid != NON_MONSTER)
@@ -944,7 +944,21 @@ void direction(dist& moves, targeting_type restricts,
moves.target = gc;
if (key_command == CMD_TARGET_MOUSE_SELECT)
+ {
key_command = CMD_TARGET_SELECT;
+
+ if (range > 0)
+ {
+ ray_def raycopy = ray;
+ int l = 0;
+ while (raycopy.pos() != moves.target && l < range)
+ {
+ l++;
+ raycopy.advance_through(moves.target);
+ }
+ moves.target = raycopy.pos();
+ }
+ }
}
else
{
@@ -1477,14 +1491,16 @@ void direction(dist& moves, targeting_type restricts,
const int bcol = in_range ? MAGENTA : DARKGREY;
draw_ray_glyph(raycopy.pos(), bcol, '*',
- bcol | COLFLAG_REVERSE);
+ bcol | COLFLAG_REVERSE, in_range);
}
raycopy.advance_through(moves.target);
}
textcolor(LIGHTGREY);
#ifdef USE_TILE
+ const bool in_range = (range < 0)
+ || grid_distance(raycopy.pos(), you.pos()) <= range;
draw_ray_glyph(moves.target, MAGENTA, '*',
- MAGENTA | COLFLAG_REVERSE);
+ MAGENTA | COLFLAG_REVERSE, in_range);
}
viewwindow(true, false);
#else
diff --git a/crawl-ref/source/initfile.cc b/crawl-ref/source/initfile.cc
index 4dfaf1ac3e..a08ff7d80e 100644
--- a/crawl-ref/source/initfile.cc
+++ b/crawl-ref/source/initfile.cc
@@ -2210,7 +2210,9 @@ void game_options::read_option_line(const std::string &str, bool runscript)
}
#endif
else BOOL_OPTION(show_gold_turns);
+#ifndef USE_TILE
else BOOL_OPTION(show_beam);
+#endif
#ifndef SAVE_DIR_PATH
else if (key == "morgue_dir")
{
diff --git a/crawl-ref/source/rltiles/dc-dngn.txt b/crawl-ref/source/rltiles/dc-dngn.txt
index 053cbed0bd..7a7519e12f 100644
--- a/crawl-ref/source/rltiles/dc-dngn.txt
+++ b/crawl-ref/source/rltiles/dc-dngn.txt
@@ -414,7 +414,8 @@ dc-misc/blood_red2
dc-misc/blood_red3
dc-misc/blood_red4
dc-misc/halo HALO
-dc-misc/ray RAY_MESH
+dc-misc/ray RAY
+dc-misc/ray_out_of_range RAY_OUT_OF_RANGE
dc-misc/travel_exclusion TRAVEL_EXCLUSION_BG
dc-misc/travel_exclusion_centre TRAVEL_EXCLUSION_CENTRE_BG
dc-misc/slot ITEM_SLOT
diff --git a/crawl-ref/source/rltiles/dc-misc/ray.png b/crawl-ref/source/rltiles/dc-misc/ray.png
index 110af0900e..581c2cf106 100644
--- a/crawl-ref/source/rltiles/dc-misc/ray.png
+++ b/crawl-ref/source/rltiles/dc-misc/ray.png
Binary files differ
diff --git a/crawl-ref/source/rltiles/dc-misc/ray_out_of_range.png b/crawl-ref/source/rltiles/dc-misc/ray_out_of_range.png
new file mode 100644
index 0000000000..1cf6f86cc1
--- /dev/null
+++ b/crawl-ref/source/rltiles/dc-misc/ray_out_of_range.png
Binary files differ
diff --git a/crawl-ref/source/tilepick.cc b/crawl-ref/source/tilepick.cc
index a0b54c8bfd..997ba83d5d 100644
--- a/crawl-ref/source/tilepick.cc
+++ b/crawl-ref/source/tilepick.cc
@@ -4140,28 +4140,37 @@ void tile_place_cloud(int x, int y, int type, int decay)
env.tile_fg[x-1][y-1] = _tileidx_cloud(type, decay);
}
-unsigned int tileRayCount = 0;
-FixedVector<coord_def, 30> tileRays;
+unsigned int num_tile_rays = 0;
+struct tile_ray
+{
+ coord_def ep;
+ bool in_range;
+};
+FixedVector<tile_ray, 30> tile_ray_vec;
-void tile_place_ray(const coord_def& gc)
+void tile_place_ray(const coord_def& gc, bool in_range)
{
// Record rays for later. The curses version just applies
// rays directly to the screen. The tiles version doesn't have
// (nor want) such direct access. So, it batches up all of the
// rays and applies them in viewwindow(...).
- if (tileRayCount < tileRays.size() - 1)
+ if (num_tile_rays < tile_ray_vec.size() - 1)
{
- tileRays[tileRayCount++] = view2show(grid2view(gc));
+ tile_ray_vec[num_tile_rays].in_range = in_range;
+ tile_ray_vec[num_tile_rays++].ep = view2show(grid2view(gc));
}
}
-void tile_draw_rays(bool resetCount)
+void tile_draw_rays(bool reset_count)
{
- for (unsigned int i = 0; i < tileRayCount; i++)
- env.tile_bg[tileRays[i].x-1][tileRays[i].y-1] |= TILE_FLAG_RAY;
+ for (unsigned int i = 0; i < num_tile_rays; i++)
+ {
+ int flag = tile_ray_vec[i].in_range ? TILE_FLAG_RAY : TILE_FLAG_RAY_OOR;
+ env.tile_bg[tile_ray_vec[i].ep.x-1][tile_ray_vec[i].ep.y-1] |= flag;
+ }
- if (resetCount)
- tileRayCount = 0;
+ if (reset_count)
+ num_tile_rays = 0;
}
void tile_finish_dngn(unsigned int *tileb, int cx, int cy)
diff --git a/crawl-ref/source/tilereg.cc b/crawl-ref/source/tilereg.cc
index 0adc45b8b4..7c42150300 100644
--- a/crawl-ref/source/tilereg.cc
+++ b/crawl-ref/source/tilereg.cc
@@ -303,7 +303,9 @@ void DungeonRegion::draw_background(unsigned int bg, unsigned int x, unsigned in
add_quad(TEX_DUNGEON, TILE_TRAVEL_EXCLUSION_BG, x, y);
if (bg & TILE_FLAG_RAY)
- add_quad(TEX_DUNGEON, TILE_RAY_MESH, x, y);
+ add_quad(TEX_DUNGEON, TILE_RAY, x, y);
+ else if (bg & TILE_FLAG_RAY_OOR)
+ add_quad(TEX_DUNGEON, TILE_RAY_OUT_OF_RANGE, x, y);
}
void DungeonRegion::draw_player(unsigned int x, unsigned int y)
diff --git a/crawl-ref/source/tiles.h b/crawl-ref/source/tiles.h
index e2252641d0..faf6dbd3d4 100644
--- a/crawl-ref/source/tiles.h
+++ b/crawl-ref/source/tiles.h
@@ -81,7 +81,7 @@ void tile_place_item(int x, int y, int idx);
void tile_place_item_bk(int gx, int gy, int idx);
void tile_place_item_marker(int x, int y, int idx);
void tile_place_cloud(int x, int y, int type, int decay);
-void tile_place_ray(const coord_def& gc);
+void tile_place_ray(const coord_def& gc, bool in_range);
void tile_draw_rays(bool resetCount);
void tile_clear_buf();
@@ -164,6 +164,7 @@ enum tile_flags
TILE_FLAG_EXCL_CTR = 0x00100000,
TILE_FLAG_SANCTUARY = 0x00200000,
TILE_FLAG_TUT_CURSOR= 0x00400000,
+ TILE_FLAG_RAY_OOR = 0x00800000,
// General
TILE_FLAG_MASK = 0x000007FF