summaryrefslogtreecommitdiffstats
path: root/crawl-ref
diff options
context:
space:
mode:
authorJude Brown <bookofjude@users.sourceforge.net>2009-12-09 21:52:44 +1000
committerJude Brown <bookofjude@users.sourceforge.net>2009-12-09 21:52:44 +1000
commitb03ae0bd75db95fd72cf484da6caec7eb47ad21c (patch)
tree7ef2787815630f4b273524ced5424be070e96236 /crawl-ref
parentb186dbd518d138ee1d9c228d801ad0f3607ea76d (diff)
downloadcrawl-ref-b03ae0bd75db95fd72cf484da6caec7eb47ad21c.tar.gz
crawl-ref-b03ae0bd75db95fd72cf484da6caec7eb47ad21c.zip
Massively expand tile functionality in vault definitions.
This commit creates a new specifier for vaults: "TILE". Used much in the same way as COLOUR, it can apply any specific tile to a feature. Example syntax is specified in the syntax file, but copied here for clarity: TILE: x = wall_flesh Identical to FTILE and RTILE in syntax, but closer to COLOUR in functionality. Instead of replacing the floor or relevant rock tiles, this can be used to replace the tile used for any specific feature. This can be used in combination with FTILE and RTILE to change the appearance of features. It can only be used with previously specified tiles, however. Like COLOUR and FTILE, this should be used sparingly and to good effect. Please, feel free to update vaults to use this! We want to ensure that tiles players get the same experience as ASCII players do. This is only the first stage in a push for greater flexibiltiy through tiles, but hopefully it'll have a good impact.
Diffstat (limited to 'crawl-ref')
-rw-r--r--crawl-ref/docs/develop/levels/syntax.txt12
-rw-r--r--crawl-ref/source/dat/levdes.vim2
-rw-r--r--crawl-ref/source/externs.h3
-rw-r--r--crawl-ref/source/l_dgntil.cc10
-rw-r--r--crawl-ref/source/mapdef.cc21
-rw-r--r--crawl-ref/source/mapdef.h12
-rw-r--r--crawl-ref/source/tags.cc2
-rw-r--r--crawl-ref/source/tags.h2
-rw-r--r--crawl-ref/source/tilepick.cc4
-rw-r--r--crawl-ref/source/util/levcomp.lpp1
-rw-r--r--crawl-ref/source/util/levcomp.ypp20
11 files changed, 78 insertions, 11 deletions
diff --git a/crawl-ref/docs/develop/levels/syntax.txt b/crawl-ref/docs/develop/levels/syntax.txt
index cc6de15206..1598f04719 100644
--- a/crawl-ref/docs/develop/levels/syntax.txt
+++ b/crawl-ref/docs/develop/levels/syntax.txt
@@ -825,6 +825,18 @@ RTILE: x = wall_hive:15 / wall_lair / none
Identical to FTILE, but for rock walls. Not useful for anything
but the rock wall feature.
+TILE: x = wall_flesh
+ Identical to FTILE and RTILE in syntax, but closer to COLOUR in
+ functionality. Instead of replacing the floor or relevant rock tiles,
+ this can be used to replace the tile used for any specific feature.
+
+ This can be used in combination with FTILE and RTILE to change the
+ appearance of features. It can only be used with previously specified
+ tiles, however.
+
+ Like COLOUR and FTILE, this should be used sparingly and to good
+ effect.
+
SHUFFLE: def, 12/3?
This allows you to randomly permute glyphs on the map. There are
two ways:
diff --git a/crawl-ref/source/dat/levdes.vim b/crawl-ref/source/dat/levdes.vim
index d506c76982..f94294f740 100644
--- a/crawl-ref/source/dat/levdes.vim
+++ b/crawl-ref/source/dat/levdes.vim
@@ -51,7 +51,7 @@ syn region desNsubst start=/^NSUBST:\s*/ end=/$/ contains=desNsubstDec,desSubstA
syn region desShuffle start=/^SHUFFLE:\s*/ end=/$/ contains=desShuffleDec,desMapFrag keepend
-syn keyword desDeclarator NAME: ORIENT: DEPTH: PLACE: MONS: FLAGS: default-depth: TAGS: CHANCE: WEIGHT: ITEM: KFEAT: KMONS: KITEM: COLOUR: KMASK: KPROP: MARKER: LFLAGS: BFLAGS: LROCKCOL: LFLOORCOL: LFLOORTILE: LROCKTILE: FTILE: RTILE: SUBVAULT:
+syn keyword desDeclarator NAME: ORIENT: DEPTH: PLACE: MONS: FLAGS: default-depth: TAGS: CHANCE: WEIGHT: ITEM: KFEAT: KMONS: KITEM: COLOUR: KMASK: KPROP: MARKER: LFLAGS: BFLAGS: LROCKCOL: LFLOORCOL: LFLOORTILE: LROCKTILE: FTILE: RTILE: TILE: SUBVAULT:
syn keyword desOrientation encompass north south east west northeast northwest southeast southwest float
syn keyword desOrientation no_hmirror no_vmirror no_rotate
syn keyword desOrientation entry pan lab bazaar allow_dup dummy mini_float minotaur
diff --git a/crawl-ref/source/externs.h b/crawl-ref/source/externs.h
index 629fee3735..80386f0658 100644
--- a/crawl-ref/source/externs.h
+++ b/crawl-ref/source/externs.h
@@ -34,6 +34,9 @@ struct tile_flavour
unsigned short wall;
// Used as a random value or for special cases e.g. (bazaars, gates).
unsigned short special;
+ // Used by the vault 'TILE' overlay. Called ftile as it was originally
+ // to be for features and 'tile' is obtuse.
+ unsigned short ftile;
};
// A glorified unsigned int that assists with ref-counting the mcache.
diff --git a/crawl-ref/source/l_dgntil.cc b/crawl-ref/source/l_dgntil.cc
index 25995f683a..6939b98aea 100644
--- a/crawl-ref/source/l_dgntil.cc
+++ b/crawl-ref/source/l_dgntil.cc
@@ -147,12 +147,22 @@ LUAFN(dgn_rtile)
#endif
}
+LUAFN(dgn_tile)
+{
+#ifdef USE_TILE
+ return dgn_map_add_transform(ls, &map_lines::add_spec_tile);
+#else
+ return 0;
+#endif
+}
+
const struct luaL_reg dgn_tile_dlib[] =
{
{ "lrocktile", dgn_lrocktile },
{ "lfloortile", dgn_lfloortile },
{ "rtile", dgn_rtile },
{ "ftile", dgn_ftile },
+{ "tile", dgn_tile },
{ "change_rock_tile", dgn_change_rock_tile },
{ "change_floor_tile", dgn_change_floor_tile },
{ "lev_floortile", dgn_lev_floortile },
diff --git a/crawl-ref/source/mapdef.cc b/crawl-ref/source/mapdef.cc
index 628b3f39c6..066848536a 100644
--- a/crawl-ref/source/mapdef.cc
+++ b/crawl-ref/source/mapdef.cc
@@ -509,6 +509,12 @@ void map_lines::apply_grid_overlay(const coord_def &c)
int offset = random2(tile_dngn_count(rock));
env.tile_flv(gc).wall = rock + offset;
}
+ const int tile = (*overlay)(x, y).tile;
+ if (tile)
+ {
+ int offset = random2(tile_dngn_count(tile));
+ env.tile_flv(gc).ftile = tile + offset;
+ }
#endif
}
}
@@ -1193,6 +1199,8 @@ void map_lines::overlay_tiles(tile_spec &spec)
{
if (spec.floor)
(*overlay)(pos, y).floortile = spec.get_tile();
+ else if (spec.feat)
+ (*overlay)(pos, y).tile = spec.get_tile();
else
(*overlay)(pos, y).rocktile = spec.get_tile();
++pos;
@@ -1715,7 +1723,7 @@ bool map_tile_list::parse(const std::string &s, int weight)
return true;
}
-std::string map_lines::add_tile(const std::string &sub, bool is_floor)
+std::string map_lines::add_tile(const std::string &sub, bool is_floor, bool is_feat)
{
std::string s = trimmed_string(sub);
@@ -1735,7 +1743,7 @@ std::string map_lines::add_tile(const std::string &sub, bool is_floor)
if (!err.empty())
return (err);
- tile_spec spec(key, sep == ':', is_floor, list);
+ tile_spec spec(key, sep == ':', is_floor, is_feat, list);
overlay_tiles(spec);
return ("");
@@ -1743,12 +1751,17 @@ std::string map_lines::add_tile(const std::string &sub, bool is_floor)
std::string map_lines::add_rocktile(const std::string &sub)
{
- return add_tile(sub, false);
+ return add_tile(sub, false, false);
}
std::string map_lines::add_floortile(const std::string &sub)
{
- return add_tile(sub, true);
+ return add_tile(sub, true, false);
+}
+
+std::string map_lines::add_spec_tile(const std::string &sub)
+{
+ return add_tile(sub, false, true);
}
//////////////////////////////////////////////////////////////////////////
diff --git a/crawl-ref/source/mapdef.h b/crawl-ref/source/mapdef.h
index 7b3f2518c1..d24ad4a2da 100644
--- a/crawl-ref/source/mapdef.h
+++ b/crawl-ref/source/mapdef.h
@@ -189,8 +189,8 @@ public:
class tile_spec
{
public:
- tile_spec(const std::string &_key, bool _fix, bool _floor, const map_tile_list &_tiles)
- : key(_key), fix(_fix), chose_fixed(false), floor(_floor),
+ tile_spec(const std::string &_key, bool _fix, bool _floor, bool _feat, const map_tile_list &_tiles)
+ : key(_key), fix(_fix), chose_fixed(false), floor(_floor), feat(_feat),
fixed_tile(0), tiles(_tiles)
{
}
@@ -202,6 +202,7 @@ public:
bool fix;
bool chose_fixed;
bool floor;
+ bool feat;
int fixed_tile;
map_tile_list tiles;
};
@@ -279,6 +280,7 @@ public:
#ifdef USE_TILE
std::string add_floortile(const std::string &s);
std::string add_rocktile(const std::string &s);
+ std::string add_spec_tile(const std::string &s);
#endif
std::vector<coord_def> find_glyph(const std::string &glyphs) const;
@@ -400,7 +402,7 @@ private:
glyph_replacements_t &gly);
#ifdef USE_TILE
- std::string add_tile(const std::string &sub, bool is_floor);
+ std::string add_tile(const std::string &sub, bool is_floor, bool is_feat);
#endif
std::string add_key_field(
@@ -425,10 +427,12 @@ private:
struct overlay_def
{
- overlay_def() : colour(0), rocktile(0), floortile(0), property(0), keyspec_idx(0) {}
+ overlay_def() : colour(0), rocktile(0), floortile(0), tile(0),
+ property(0), keyspec_idx(0) {}
int colour;
int rocktile;
int floortile;
+ int tile;
int property;
int keyspec_idx;
};
diff --git a/crawl-ref/source/tags.cc b/crawl-ref/source/tags.cc
index 79af67c505..ca54391a56 100644
--- a/crawl-ref/source/tags.cc
+++ b/crawl-ref/source/tags.cc
@@ -2165,6 +2165,7 @@ void tag_construct_level_tiles(writer &th)
marshallShort(th, env.tile_flv[count_x][count_y].wall);
marshallShort(th, env.tile_flv[count_x][count_y].floor);
marshallShort(th, env.tile_flv[count_x][count_y].special);
+ marshallShort(th, env.tile_flv[count_x][count_y].ftile);
}
mcache.construct(th);
@@ -2522,6 +2523,7 @@ void tag_read_level_tiles(struct reader &th)
env.tile_flv[x][y].wall = unmarshallShort(th);
env.tile_flv[x][y].floor = unmarshallShort(th);
env.tile_flv[x][y].special = unmarshallShort(th);
+ env.tile_flv[x][y].ftile = unmarshallShort(th);
}
if (ver > TILETAG_PRE_MCACHE)
diff --git a/crawl-ref/source/tags.h b/crawl-ref/source/tags.h
index e3ec18f659..a700eb50ac 100644
--- a/crawl-ref/source/tags.h
+++ b/crawl-ref/source/tags.h
@@ -40,7 +40,7 @@ enum tag_file_type // file types supported by tag system
enum tag_major_version
{
TAG_MAJOR_START = 5,
- TAG_MAJOR_VERSION = 8
+ TAG_MAJOR_VERSION = 9
};
// Minor version will be reset to zero when major version changes.
diff --git a/crawl-ref/source/tilepick.cc b/crawl-ref/source/tilepick.cc
index 5645237bde..f76e162aa2 100644
--- a/crawl-ref/source/tilepick.cc
+++ b/crawl-ref/source/tilepick.cc
@@ -2365,6 +2365,10 @@ static int _tileidx_shop(coord_def where)
int tileidx_feature(dungeon_feature_type feat, int gx, int gy)
{
+ int override = env.tile_flv[gx][gy].ftile;
+ if (override)
+ return override;
+
switch (feat)
{
case DNGN_UNSEEN:
diff --git a/crawl-ref/source/util/levcomp.lpp b/crawl-ref/source/util/levcomp.lpp
index 151ef1418e..0de769b58a 100644
--- a/crawl-ref/source/util/levcomp.lpp
+++ b/crawl-ref/source/util/levcomp.lpp
@@ -251,6 +251,7 @@ LFLOORTILE: { CBEGIN(ARGUMENT); return LFLOORTILE; }
LROCKTILE: { CBEGIN(ARGUMENT); return LROCKTILE; }
FTILE: { CBEGIN(ITEM_LIST); return FTILE; }
RTILE: { CBEGIN(ITEM_LIST); return RTILE; }
+TILE: { CBEGIN(ITEM_LIST); return TILE; }
MONS: { CBEGIN(MNAME); return MONS; }
ITEM: { CBEGIN(ITEM_LIST); return ITEM; }
MARKER: { CBEGIN(ARGUMENT); return MARKER; }
diff --git a/crawl-ref/source/util/levcomp.ypp b/crawl-ref/source/util/levcomp.ypp
index f13f102da0..2a5bf231df 100644
--- a/crawl-ref/source/util/levcomp.ypp
+++ b/crawl-ref/source/util/levcomp.ypp
@@ -54,7 +54,7 @@ level_range set_range(const char *s, int start, int end)
%token <i> DEFAULT_DEPTH SHUFFLE SUBST TAGS KFEAT KITEM KMONS KMASK KPROP
%token <i> NAME DEPTH ORIENT PLACE CHANCE WEIGHT MONS ITEM MARKER COLOUR
%token <i> PRELUDE MAIN VALIDATE VETO NSUBST WELCOME LFLAGS BFLAGS
-%token <i> LFLOORCOL LROCKCOL LFLOORTILE LROCKTILE FTILE RTILE SUBVAULT
+%token <i> LFLOORCOL LROCKCOL LFLOORTILE LROCKTILE FTILE RTILE TILE SUBVAULT
%token <i> COMMA COLON PERC INTEGER CHARACTER
@@ -166,6 +166,7 @@ metaline : place
| lrocktile
| ftile
| rtile
+ | tile
| shuffle
| tags
| lflags
@@ -437,6 +438,23 @@ rtile_specifier : ITEM_INFO
}
;
+tile : TILE tile_specifiers
+ ;
+
+tile_specifiers : tile_specifier
+ | tile_specifiers COMMA tile_specifier
+ ;
+
+tile_specifier : ITEM_INFO
+ {
+ lc_map.main.add(
+ yylineno,
+ make_stringf("tile(\"%s\")",
+ quote_lua_string($1).c_str()));
+ }
+ ;
+
+
colour_specifiers : colour_specifier { }
| colour_specifiers COMMA colour_specifier { }
;