summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/tilepick.cc
diff options
context:
space:
mode:
authorJude Brown <bookofjude@users.sourceforge.net>2009-12-28 00:17:23 +1000
committerJude Brown <bookofjude@users.sourceforge.net>2009-12-28 00:29:40 +1000
commit23929ee3b2452b1c3a133061eff44b31dc70fb09 (patch)
tree438759a7c65a1d57fb97ec39c7a3a0beca99ed06 /crawl-ref/source/tilepick.cc
parente42132c99bf63b213388404676a54c6610bd613c (diff)
downloadcrawl-ref-23929ee3b2452b1c3a133061eff44b31dc70fb09.tar.gz
crawl-ref-23929ee3b2452b1c3a133061eff44b31dc70fb09.zip
Customisable clouds!
cloud_struct now has members for colour, name, and tile; colour will be used instead of the default colour of the cloud type, and will be used to recolour the tile of the cloud (if it exists). Name will be used to rebrand the cloud's description, and also alter the message generate while standing in a cloud. Finally, tile can be used to completely customise the tile used for the cloud. The value is stored as a string in order to maintain save compatibility across ASCII and tiles. A random tile (found using tile_main_count) from that set will also be used, however, no duration effects will be applied. Recoloured cloud tiles using just the colour code should be possible, though aren't yet fully tested. This commit bumps TAG_MAJOR_VERSION: changing marshalling of the FogMachine Lua code causes nasty crashes on reloading saved games. Otherwise, I don't think I broke anything else. :-)
Diffstat (limited to 'crawl-ref/source/tilepick.cc')
-rw-r--r--crawl-ref/source/tilepick.cc109
1 files changed, 67 insertions, 42 deletions
diff --git a/crawl-ref/source/tilepick.cc b/crawl-ref/source/tilepick.cc
index 36b3e5014c..34cbf7eb7f 100644
--- a/crawl-ref/source/tilepick.cc
+++ b/crawl-ref/source/tilepick.cc
@@ -2649,64 +2649,89 @@ int tileidx_feature(dungeon_feature_type feat, int gx, int gy)
}
}
-static int _tileidx_cloud(int type, int decay)
+static int _tileidx_cloud(cloud_struct cl)
{
+ int type = cl.type;
+ int decay = cl.decay;
+ std::string override = cl.tile;
+ int colour = cl.colour;
+
int ch = TILE_ERROR;
int dur = decay/20;
if (dur > 2)
dur = 2;
- switch (type)
+ if (!override.empty())
{
- case CLOUD_FIRE:
- ch = TILE_CLOUD_FIRE_0 + dur;
- break;
+ unsigned int index;
+ if (!tile_main_index(override.c_str(), index))
+ {
+ mprf(MSGCH_ERROR, "Invalid tile requested for cloud: '%s'.", override.c_str());
+ }
+ else
+ {
+ int offset = tile_main_count(index);
+ ch = index + offset;
+ }
+ }
+ else
+ {
+ switch (type)
+ {
+ case CLOUD_FIRE:
+ ch = TILE_CLOUD_FIRE_0 + dur;
+ break;
- case CLOUD_COLD:
- ch = TILE_CLOUD_COLD_0 + dur;
- break;
+ case CLOUD_COLD:
+ ch = TILE_CLOUD_COLD_0 + dur;
+ break;
- case CLOUD_STINK:
- case CLOUD_POISON:
- ch = TILE_CLOUD_POISON_0 + dur;
- break;
+ case CLOUD_STINK:
+ case CLOUD_POISON:
+ ch = TILE_CLOUD_POISON_0 + dur;
+ break;
- case CLOUD_BLUE_SMOKE:
- ch = TILE_CLOUD_BLUE_SMOKE;
- break;
+ case CLOUD_BLUE_SMOKE:
+ ch = TILE_CLOUD_BLUE_SMOKE;
+ break;
- case CLOUD_PURPLE_SMOKE:
- case CLOUD_TLOC_ENERGY:
- ch = TILE_CLOUD_TLOC_ENERGY;
- break;
+ case CLOUD_PURPLE_SMOKE:
+ case CLOUD_TLOC_ENERGY:
+ ch = TILE_CLOUD_TLOC_ENERGY;
+ break;
- case CLOUD_MIASMA:
- ch = TILE_CLOUD_MIASMA;
- break;
+ case CLOUD_MIASMA:
+ ch = TILE_CLOUD_MIASMA;
+ break;
- case CLOUD_BLACK_SMOKE:
- ch = TILE_CLOUD_BLACK_SMOKE;
- break;
+ case CLOUD_BLACK_SMOKE:
+ ch = TILE_CLOUD_BLACK_SMOKE;
+ break;
- case CLOUD_MUTAGENIC:
- ch = (dur == 0 ? TILE_CLOUD_MUTAGENIC_0 :
- dur == 1 ? TILE_CLOUD_MUTAGENIC_1
- : TILE_CLOUD_MUTAGENIC_2);
- ch += random2(tile_main_count(ch));
- break;
+ case CLOUD_MUTAGENIC:
+ ch = (dur == 0 ? TILE_CLOUD_MUTAGENIC_0 :
+ dur == 1 ? TILE_CLOUD_MUTAGENIC_1
+ : TILE_CLOUD_MUTAGENIC_2);
+ ch += random2(tile_main_count(ch));
+ break;
- case CLOUD_MIST:
- ch = TILE_CLOUD_MIST;
- break;
+ case CLOUD_MIST:
+ ch = TILE_CLOUD_MIST;
+ break;
- case CLOUD_RAIN:
- ch = TILE_CLOUD_RAIN + random2(tile_main_count(TILE_CLOUD_RAIN));
- break;
+ case CLOUD_RAIN:
+ ch = TILE_CLOUD_RAIN + random2(tile_main_count(TILE_CLOUD_RAIN));
+ break;
- default:
- ch = TILE_CLOUD_GREY_SMOKE;
- break;
+ default:
+ ch = TILE_CLOUD_GREY_SMOKE;
+ break;
+ }
}
+
+ if (colour != -1)
+ ch = tile_main_coloured(ch, colour);
+
return (ch | TILE_FLAG_FLYING);
}
@@ -4852,9 +4877,9 @@ void tile_place_monster(int gx, int gy, int idx, bool foreground, bool detected)
}
}
-void tile_place_cloud(int x, int y, int type, int decay)
+void tile_place_cloud(int x, int y, cloud_struct cl)
{
- env.tile_fg[x][y] = _tileidx_cloud(type, decay);
+ env.tile_fg[x][y] = _tileidx_cloud(cl);
}
unsigned int num_tile_rays = 0;