summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobert Vollmert <rvollmert@gmx.net>2009-11-06 10:58:37 +0100
committerRobert Vollmert <rvollmert@gmx.net>2009-11-06 11:33:08 +0100
commita37af0a7641b0178d66e09d51ad8dcb9ec5e42c6 (patch)
tree81f0e136343b518faed64b53bdb3ebc9ba4cccd9
parent89eaa39aa96039062a4d1a0efc2e5c1fe9f54a95 (diff)
downloadcrawl-ref-a37af0a7641b0178d66e09d51ad8dcb9ec5e42c6.tar.gz
crawl-ref-a37af0a7641b0178d66e09d51ad8dcb9ec5e42c6.zip
Split get_symbol from view.cc.
-rw-r--r--crawl-ref/source/abyss.cc1
-rw-r--r--crawl-ref/source/chardump.cc1
-rw-r--r--crawl-ref/source/directn.cc1
-rw-r--r--crawl-ref/source/envmap.cc1
-rw-r--r--crawl-ref/source/format.cc1
-rw-r--r--crawl-ref/source/invent.cc1
-rw-r--r--crawl-ref/source/itemname.cc1
-rw-r--r--crawl-ref/source/items.cc1
-rw-r--r--crawl-ref/source/makefile.obj1
-rw-r--r--crawl-ref/source/mon-info.cc2
-rw-r--r--crawl-ref/source/show.cc2
-rw-r--r--crawl-ref/source/tutorial.cc1
-rw-r--r--crawl-ref/source/view.cc244
-rw-r--r--crawl-ref/source/view.h13
14 files changed, 18 insertions, 253 deletions
diff --git a/crawl-ref/source/abyss.cc b/crawl-ref/source/abyss.cc
index db0a527fec..a31fec923f 100644
--- a/crawl-ref/source/abyss.cc
+++ b/crawl-ref/source/abyss.cc
@@ -29,6 +29,7 @@
#include "los.h"
#include "random.h"
#include "religion.h"
+#include "showsymb.h"
#include "stuff.h"
#include "spells3.h"
#include "terrain.h"
diff --git a/crawl-ref/source/chardump.cc b/crawl-ref/source/chardump.cc
index 86f8a2df61..b277542512 100644
--- a/crawl-ref/source/chardump.cc
+++ b/crawl-ref/source/chardump.cc
@@ -46,6 +46,7 @@
#include "player.h"
#include "religion.h"
#include "shopping.h"
+#include "showsymb.h"
#include "skills2.h"
#include "spl-book.h"
#include "spl-cast.h"
diff --git a/crawl-ref/source/directn.cc b/crawl-ref/source/directn.cc
index cd75cf221d..0f492dcabe 100644
--- a/crawl-ref/source/directn.cc
+++ b/crawl-ref/source/directn.cc
@@ -48,6 +48,7 @@
#include "player.h"
#include "shopping.h"
#include "show.h"
+#include "showsymb.h"
#include "state.h"
#include "stuff.h"
#include "stash.h"
diff --git a/crawl-ref/source/envmap.cc b/crawl-ref/source/envmap.cc
index a6d699e31f..b52a7dfea0 100644
--- a/crawl-ref/source/envmap.cc
+++ b/crawl-ref/source/envmap.cc
@@ -14,6 +14,7 @@
#include "env.h"
#include "notes.h"
#include "overmap.h"
+#include "showsymb.h"
#include "stuff.h"
#include "terrain.h"
#include "view.h"
diff --git a/crawl-ref/source/format.cc b/crawl-ref/source/format.cc
index 265100bd26..11059cb39a 100644
--- a/crawl-ref/source/format.cc
+++ b/crawl-ref/source/format.cc
@@ -7,6 +7,7 @@
#include "colour.h"
#include "format.h"
+#include "showsymb.h"
#include "view.h"
#include "viewchar.h"
diff --git a/crawl-ref/source/invent.cc b/crawl-ref/source/invent.cc
index 8c685327a7..804210cebc 100644
--- a/crawl-ref/source/invent.cc
+++ b/crawl-ref/source/invent.cc
@@ -35,6 +35,7 @@
#include "message.h"
#include "player.h"
#include "shopping.h"
+#include "showsymb.h"
#include "stuff.h"
#include "view.h"
#include "menu.h"
diff --git a/crawl-ref/source/itemname.cc b/crawl-ref/source/itemname.cc
index 1d8f48920a..ff389bd869 100644
--- a/crawl-ref/source/itemname.cc
+++ b/crawl-ref/source/itemname.cc
@@ -39,6 +39,7 @@
#include "religion.h"
#include "quiver.h"
#include "shopping.h"
+#include "showsymb.h"
#include "skills2.h"
#include "spl-book.h"
#include "state.h"
diff --git a/crawl-ref/source/items.cc b/crawl-ref/source/items.cc
index 1a63f10c87..6c079eaae1 100644
--- a/crawl-ref/source/items.cc
+++ b/crawl-ref/source/items.cc
@@ -51,6 +51,7 @@
#include "quiver.h"
#include "religion.h"
#include "shopping.h"
+#include "showsymb.h"
#include "skills2.h"
#include "spl-book.h"
#include "state.h"
diff --git a/crawl-ref/source/makefile.obj b/crawl-ref/source/makefile.obj
index 30815c01f6..f9ba36d16b 100644
--- a/crawl-ref/source/makefile.obj
+++ b/crawl-ref/source/makefile.obj
@@ -119,6 +119,7 @@ rng.o \
sha256.o \
shopping.o \
show.o \
+showsymb.o \
skills.o \
skills2.o \
species.o \
diff --git a/crawl-ref/source/mon-info.cc b/crawl-ref/source/mon-info.cc
index 92673a586b..8aadc143b1 100644
--- a/crawl-ref/source/mon-info.cc
+++ b/crawl-ref/source/mon-info.cc
@@ -15,7 +15,7 @@
#include "monster.h"
#include "options.h"
#include "religion.h"
-#include "view.h"
+#include "showsymb.h"
#include <algorithm>
#include <sstream>
diff --git a/crawl-ref/source/show.cc b/crawl-ref/source/show.cc
index a53fd4fe4f..0545cf1b6f 100644
--- a/crawl-ref/source/show.cc
+++ b/crawl-ref/source/show.cc
@@ -11,9 +11,9 @@
#include "mon-util.h"
#include "monster.h"
#include "options.h"
+#include "showsymb.h"
#include "state.h"
#include "terrain.h"
-#include "view.h"
#include "viewgeom.h"
void get_show_symbol(show_type object, unsigned *ch,
diff --git a/crawl-ref/source/tutorial.cc b/crawl-ref/source/tutorial.cc
index e1607229cc..605c44f667 100644
--- a/crawl-ref/source/tutorial.cc
+++ b/crawl-ref/source/tutorial.cc
@@ -46,6 +46,7 @@
#include "random.h"
#include "religion.h"
#include "shopping.h"
+#include "showsymb.h"
#include "skills2.h"
#include "species.h"
#include "spl-book.h"
diff --git a/crawl-ref/source/view.cc b/crawl-ref/source/view.cc
index a17925354d..1f9155c926 100644
--- a/crawl-ref/source/view.cc
+++ b/crawl-ref/source/view.cc
@@ -25,6 +25,7 @@
#include "viewchar.h"
#include "viewgeom.h"
#include "viewmap.h"
+#include "showsymb.h"
#include "branch.h"
#include "command.h"
@@ -84,11 +85,6 @@ crawl_view_geometry crawl_view;
extern int stealth; // defined in acr.cc
-static void _get_symbol( const coord_def& where,
- show_type object, unsigned *ch,
- unsigned short *colour,
- bool magic_mapped = false );
-
bool inside_level_bounds(int x, int y)
{
return (x > 0 && x < GXM && y > 0 && y < GYM);
@@ -104,200 +100,6 @@ bool is_notable_terrain(dungeon_feature_type ftype)
return (get_feature_def(ftype).is_notable());
}
-unsigned get_symbol(show_type object, unsigned short *colour,
- bool magic_mapped)
-{
- unsigned ch;
- _get_symbol(coord_def(0,0), object, &ch, NULL, magic_mapped);
- return (ch);
-}
-
-static bool _show_bloodcovered(const coord_def& where)
-{
- if (!is_bloodcovered(where))
- return (false);
-
- dungeon_feature_type grid = grd(where);
-
- // Altars, stairs (of any kind) and traps should not be coloured red.
- return (!is_critical_feature(grid) && !feat_is_trap(grid));
-}
-
-static unsigned short _tree_colour(const coord_def& where)
-{
- uint32_t h = where.x;
- h+=h<<10; h^=h>>6;
- h += where.y;
- h+=h<<10; h^=h>>6;
- h+=h<<3; h^=h>>11; h+=h<<15;
- return (h>>30) ? GREEN : LIGHTGREEN;
-}
-
-static void _get_symbol( const coord_def& where,
- show_type object, unsigned *ch,
- unsigned short *colour,
- bool magic_mapped )
-{
- ASSERT( ch != NULL );
-
- if (object.cls < SH_MONSTER)
- {
- const feature_def &fdef = get_feature_def(object);
-
- *ch = magic_mapped? fdef.magic_symbol
- : fdef.symbol;
-
- // Don't recolor items
- if (colour && object.cls == SH_FEATURE)
- {
- dungeon_feature_type feat = object.feat;
- const int colmask = *colour & COLFLAG_MASK;
-
- // TODO: consolidate with feat_is_stair etc.
- bool excluded_stairs = (feat >= DNGN_STONE_STAIRS_DOWN_I
- && feat <= DNGN_ESCAPE_HATCH_UP
- && is_exclude_root(where));
-
- if (excluded_stairs)
- *colour = Options.tc_excluded | colmask;
- else if (feat >= DNGN_MINMOVE && you.get_beholder(where))
- {
- // Colour grids that cannot be reached due to beholders
- // dark grey.
- *colour = DARKGREY | colmask;
- }
- else if (feat >= DNGN_MINMOVE && is_sanctuary(where))
- {
- if (testbits(env.map(where).property, FPROP_SANCTUARY_1))
- *colour = YELLOW | colmask;
- else if (testbits(env.map(where).property, FPROP_SANCTUARY_2))
- {
- if (!one_chance_in(4))
- *colour = WHITE | colmask; // 3/4
- else if (!one_chance_in(3))
- *colour = LIGHTCYAN | colmask; // 1/6
- else
- *colour = LIGHTGREY | colmask; // 1/12
- }
- }
- else if (_show_bloodcovered(where))
- *colour = RED | colmask;
- else if (env.grid_colours(where))
- *colour = env.grid_colours(where) | colmask;
- else
- {
- // Don't clobber with BLACK, because the colour should be
- // already set.
- if (fdef.colour != BLACK)
- *colour = fdef.colour | colmask;
- else if (feat == DNGN_TREES)
- *colour = _tree_colour(where) | colmask;
-
- if (fdef.em_colour && fdef.em_colour != fdef.colour &&
- emphasise(where, feat))
- {
- *colour = (fdef.em_colour | colmask);
- }
- }
-
- // TODO: should be a feat_is_whatever(feat)
- if (feat >= DNGN_FLOOR_MIN && feat <= DNGN_FLOOR_MAX
- || feat == DNGN_UNDISCOVERED_TRAP)
- {
- if (inside_halo(where))
- {
- if (silenced(where))
- *colour = LIGHTCYAN | colmask;
- else
- *colour = YELLOW | colmask;
- }
- else if (silenced(where))
- *colour = CYAN | colmask;
- }
- }
-
- // Note anything we see that's notable
- if (!where.origin() && fdef.is_notable())
- {
- if (object.cls == SH_FEATURE) // other notable things?
- seen_notable_thing(object.feat, where);
- }
- }
- else
- {
- ASSERT(object.cls == SH_MONSTER);
- *ch = mons_char(object.mons);
- }
-
- if (colour)
- *colour = real_colour(*colour);
-}
-
-unsigned grid_character_at(const coord_def &c)
-{
- unsigned glych;
- unsigned short glycol = 0;
-
- _get_symbol(c, grd(c), &glych, &glycol );
- return glych;
-}
-
-dungeon_char_type get_feature_dchar(dungeon_feature_type feat)
-{
- return (get_feature_def(feat).dchar);
-}
-
-int get_mons_colour(const monsters *mons)
-{
- int col = mons->colour;
-
- if (mons->has_ench(ENCH_BERSERK))
- col = RED;
-
- if (mons_friendly_real(mons))
- {
- col |= COLFLAG_FRIENDLY_MONSTER;
- }
- else if (mons_neutral(mons))
- {
- col |= COLFLAG_NEUTRAL_MONSTER;
- }
- else if (Options.stab_brand != CHATTR_NORMAL
- && mons_looks_stabbable(mons))
- {
- col |= COLFLAG_WILLSTAB;
- }
- else if (Options.may_stab_brand != CHATTR_NORMAL
- && mons_looks_distracted(mons))
- {
- col |= COLFLAG_MAYSTAB;
- }
- else if (mons_is_stationary(mons))
- {
- if (Options.feature_item_brand != CHATTR_NORMAL
- && is_critical_feature(grd(mons->pos()))
- && feat_stair_direction(grd(mons->pos())) != CMD_NO_CMD)
- {
- col |= COLFLAG_FEATURE_ITEM;
- }
- else if (Options.heap_brand != CHATTR_NORMAL
- && igrd(mons->pos()) != NON_ITEM
- && !crawl_state.arena)
- {
- col |= COLFLAG_ITEM_HEAP;
- }
- }
-
- // Backlit monsters are fuzzy and override brands.
- if (!you.can_see_invisible() && mons->has_ench(ENCH_INVIS)
- && mons->backlit())
- {
- col = DARKGREY;
- }
-
- return (col);
-}
-
static void _good_god_follower_attitude_change(monsters *monster)
{
if (you.is_unholy() || crawl_state.arena)
@@ -875,40 +677,6 @@ bool check_awaken(monsters* monster)
return (false);
}
-void get_item_glyph(const item_def *item, unsigned *glych,
- unsigned short *glycol)
-{
- *glycol = item->colour;
- _get_symbol(coord_def(0,0), show_type(*item), glych, glycol);
-}
-
-void get_mons_glyph(const monsters *mons, unsigned *glych,
- unsigned short *glycol)
-{
- *glycol = get_mons_colour(mons);
- _get_symbol(coord_def(0,0), show_type(mons), glych, glycol);
-}
-
-unsigned get_screen_glyph( int x, int y )
-{
- return get_screen_glyph(coord_def(x,y));
-}
-
-unsigned get_screen_glyph(const coord_def& p)
-{
- const coord_def ep = view2show(grid2view(p));
-
- show_type object = env.show(ep);
- unsigned short colour = object.colour;
- unsigned ch;
-
- if (!object)
- return get_envmap_char(p.x, p.y);
-
- _get_symbol(p, object, &ch, &colour);
- return (ch);
-}
-
// Noisy now has a messenging service for giving messages to the
// player is appropriate.
//
@@ -1417,7 +1185,7 @@ std::string screenshot(bool fullscreen)
unsigned glych;
unsigned short glycol = 0;
- _get_symbol( gc, object, &glych, &glycol );
+ get_symbol( gc, object, &glych, &glycol );
ch = glych;
}
@@ -1495,7 +1263,7 @@ void view_update_at(const coord_def &pos)
unsigned short colour = object.colour;
unsigned ch = 0;
- _get_symbol( pos, object, &ch, &colour );
+ get_symbol( pos, object, &ch, &colour );
int flash_colour = you.flash_colour;
if (flash_colour == BLACK)
@@ -1700,7 +1468,7 @@ void viewwindow(bool draw_it, bool do_updates)
show_type object = env.show(ep);
unsigned short colour = object.colour;
unsigned ch;
- _get_symbol(gc, object, &ch, &colour);
+ get_symbol(gc, object, &ch, &colour);
if (map)
{
@@ -1742,7 +1510,7 @@ void viewwindow(bool draw_it, bool do_updates)
unsigned short colour = object.colour;
unsigned ch;
- _get_symbol( gc, object, &ch, &colour );
+ get_symbol( gc, object, &ch, &colour );
buffy[bufcount] = ch;
buffy[bufcount + 1] = colour;
@@ -1799,7 +1567,7 @@ void viewwindow(bool draw_it, bool do_updates)
&& env.show.get_backup(ep)
&& is_terrain_seen(gc))
{
- _get_symbol(gc, env.show.get_backup(ep), &ch, &colour);
+ get_symbol(gc, env.show.get_backup(ep), &ch, &colour);
set_envmap_glyph(gc, env.show.get_backup(ep), colour);
}
diff --git a/crawl-ref/source/view.h b/crawl-ref/source/view.h
index 774aa2adff..4df53354d8 100644
--- a/crawl-ref/source/view.h
+++ b/crawl-ref/source/view.h
@@ -38,24 +38,11 @@ class level_pos;
void show_map( level_pos &spec_place, bool travel_mode, bool allow_esc = false );
bool check_awaken(monsters* monster);
bool is_feature(int feature, const coord_def& where);
-void get_item_glyph(const item_def *item, unsigned *glych,
- unsigned short *glycol);
-void get_mons_glyph(const monsters *mons, unsigned *glych,
- unsigned short *glycol);
-unsigned get_screen_glyph( int x, int y );
-unsigned get_screen_glyph( const coord_def &p );
-
-int get_mons_colour(const monsters *mons);
-
bool inside_level_bounds(int x, int y);
bool inside_level_bounds(const coord_def &p);
void clear_feature_overrides();
void add_feature_override(const std::string &text);
-unsigned grid_character_at(const coord_def &c);
-unsigned get_symbol(show_type object, unsigned short *colour = NULL,
- bool magic_mapped = false);
-
std::string screenshot(bool fullscreen = false);
bool view_update();