summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/mapdef.h
diff options
context:
space:
mode:
authorennewalker <ennewalker@c06c8d41-db1a-0410-9941-cceddc491573>2009-01-20 04:13:07 +0000
committerennewalker <ennewalker@c06c8d41-db1a-0410-9941-cceddc491573>2009-01-20 04:13:07 +0000
commit7ac9f20ef352f7de53a1ab7b68ec371b03857966 (patch)
tree5b68af15eb0fd7be0529b041422f78e7ed229bf6 /crawl-ref/source/mapdef.h
parentaaa2d20241212ca17b388011ca3d0aba29f13d6f (diff)
downloadcrawl-ref-7ac9f20ef352f7de53a1ab7b68ec371b03857966.tar.gz
crawl-ref-7ac9f20ef352f7de53a1ab7b68ec371b03857966.zip
Adding FTILE/RTILE vault commands for setting per-glyph floor and rock tiles. Most vaults with COLOUR tags now also use FTILE/RTILE.
FLOORCOL, ROCKCOL, FLOORTILE, and ROCKTILE have been renamed to LFLOORCOL, LROCKCOL, LFLOORTILE, and LROCKTILE to emphasize the fact that they are a per-level setting (similar to LFLAGS) and to disambiguate them from COLOUR/FTILE/RTILE. This change also fixes green water not appearing green outside of the sewers and vaults (like the ice cave) not getting their default tiles set appropriately due to a recent change. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@8615 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/mapdef.h')
-rw-r--r--crawl-ref/source/mapdef.h72
1 files changed, 66 insertions, 6 deletions
diff --git a/crawl-ref/source/mapdef.h b/crawl-ref/source/mapdef.h
index faca8b7c0a..ecc27cb47f 100644
--- a/crawl-ref/source/mapdef.h
+++ b/crawl-ref/source/mapdef.h
@@ -111,7 +111,9 @@ public:
TT_SUBST,
TT_NSUBST,
TT_MARKER,
- TT_COLOUR
+ TT_COLOUR,
+ TT_ROCKTILE,
+ TT_FLOORTILE
};
public:
@@ -162,7 +164,11 @@ public:
};
typedef std::pair<int, int> map_weighted_colour;
-typedef std::vector<map_weighted_colour> map_colour_list;
+class map_colour_list : public std::vector<map_weighted_colour>
+{
+public:
+ bool parse(const std::string &s, int weight);
+};
class colour_spec : public map_transformer
{
public:
@@ -183,6 +189,38 @@ public:
map_colour_list colours;
};
+#ifdef USE_TILE
+typedef std::pair<int, int> map_weighted_tile;
+class map_tile_list : public std::vector<map_weighted_colour>
+{
+public:
+ bool parse(const std::string &s, int weight);
+};
+class tile_spec : public map_transformer
+{
+public:
+ tile_spec(int _key, bool _fix, bool _floor, const map_tile_list &_tiles)
+ : key(_key), fix(_fix), chose_fixed(false), floor(_floor),
+ fixed_tile(0), tiles(_tiles)
+ {
+ }
+
+ std::string apply_transform(map_lines &map);
+ transform_type type() const { return (floor ? TT_FLOORTILE : TT_ROCKTILE); }
+ std::string describe() const;
+
+ int get_tile();
+
+public:
+ int key;
+ bool fix;
+ bool chose_fixed;
+ bool floor;
+ int fixed_tile;
+ map_tile_list tiles;
+};
+#endif
+
class shuffle_spec : public map_transformer
{
public:
@@ -250,6 +288,13 @@ public:
void clear_markers();
void clear_colours();
+#ifdef USE_TILE
+ std::string add_floortile(const std::string &s);
+ std::string add_rocktile(const std::string &s);
+ void clear_rocktiles();
+ void clear_floortiles();
+#endif
+
std::vector<coord_def> find_glyph(int glyph) const;
coord_def find_first_glyph(int glyph) const;
coord_def find_first_glyph(const std::string &glyphs) const;
@@ -284,7 +329,7 @@ public:
const lua_datum &fn);
void apply_markers(const coord_def &pos);
- void apply_colours(const coord_def &pos);
+ void apply_grid_overlay(const coord_def &pos);
void apply_overlays(const coord_def &pos);
const std::vector<std::string> &get_lines() const;
@@ -312,6 +357,9 @@ private:
void subst(subst_spec &);
void nsubst(nsubst_spec &);
void overlay_colours(colour_spec &);
+#ifdef USE_TILE
+ void overlay_tiles(tile_spec &);
+#endif
void check_borders();
void clear_transforms(map_transformer::transform_type);
std::string shuffle(std::string s);
@@ -326,20 +374,32 @@ private:
subst_spec &spec);
std::string parse_glyph_replacements(std::string s,
glyph_replacements_t &gly);
- std::string parse_weighted_colours(const std::string &cspec,
- map_colour_list &colours) const;
+ template<class T>
+ std::string parse_weighted_str(const std::string &cspec, T &list);
+#ifdef USE_TILE
+ std::string add_tile(const std::string &sub, bool is_floor);
+#endif
friend class subst_spec;
friend class nsubst_spec;
friend class shuffle_spec;
friend class map_marker_spec;
friend class colour_spec;
+ friend class tile_spec;
private:
std::vector<map_transformer *> transforms;
std::vector<map_marker *> markers;
std::vector<std::string> lines;
- std::auto_ptr< Matrix<int> > colour_overlay;
+ struct overlay_def
+ {
+ overlay_def() : colour(0), rocktile(0), floortile(0) {}
+ int colour;
+ int rocktile;
+ int floortile;
+ };
+ typedef Matrix<overlay_def> overlay_matrix;
+ std::auto_ptr<overlay_matrix> overlay;
int map_width;
bool solid_north, solid_east, solid_south, solid_west;