summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/mapmark.h
diff options
context:
space:
mode:
authordshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2007-07-21 12:17:29 +0000
committerdshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2007-07-21 12:17:29 +0000
commit9843737e73a47ef6f1da0554b7ca73018d52d345 (patch)
tree9381ef8b914bc801386f62ce2713c59c17b6a9e8 /crawl-ref/source/mapmark.h
parentb27a757b68bf8a1dcbcb9b3a5cfea5c1278c9bb4 (diff)
downloadcrawl-ref-9843737e73a47ef6f1da0554b7ca73018d52d345.tar.gz
crawl-ref-9843737e73a47ef6f1da0554b7ca73018d52d345.zip
Updated level-design.txt.
Moved map markers to mapmark.cc. Added support for timer markers that remove a feature after a certain timeout. Need to hook up messaging to Lua. Added bazaars (need more bazaar layouts). git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@1899 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/mapmark.h')
-rw-r--r--crawl-ref/source/mapmark.h101
1 files changed, 101 insertions, 0 deletions
diff --git a/crawl-ref/source/mapmark.h b/crawl-ref/source/mapmark.h
new file mode 100644
index 0000000000..31d0b74e29
--- /dev/null
+++ b/crawl-ref/source/mapmark.h
@@ -0,0 +1,101 @@
+#ifndef __MAPMARK_H__
+#define __MAPMARK_H__
+
+#include "dungeon.h"
+#include "dgnevent.h"
+
+//////////////////////////////////////////////////////////////////////////
+// Map markers
+
+// Can't change this order without breaking saves.
+enum map_marker_type
+{
+ MAT_FEATURE, // Stock marker.
+ MAT_TIMED_FEATURE,
+ NUM_MAP_MARKER_TYPES,
+ MAT_ANY
+};
+
+class map_marker
+{
+public:
+ map_marker(map_marker_type type, const coord_def &pos);
+ virtual ~map_marker();
+
+ map_marker_type get_type() const { return type; }
+
+ virtual void activate();
+ virtual void write(tagHeader &) const;
+ virtual void read(tagHeader &);
+ virtual std::string describe() const = 0;
+
+ static map_marker *read_marker(tagHeader&);
+ static map_marker *parse_marker(const std::string &text)
+ throw (std::string);
+
+public:
+ coord_def pos;
+
+protected:
+ map_marker_type type;
+
+ typedef map_marker *(*marker_reader)(tagHeader &, map_marker_type);
+ typedef map_marker *(*marker_parser)(const std::string &);
+ static marker_reader readers[NUM_MAP_MARKER_TYPES];
+ static marker_parser parsers[NUM_MAP_MARKER_TYPES];
+};
+
+class map_feature_marker : public map_marker
+{
+public:
+ map_feature_marker(const coord_def &pos = coord_def(0, 0),
+ dungeon_feature_type feat = DNGN_UNSEEN);
+ map_feature_marker(const map_feature_marker &other);
+ void write(tagHeader &) const;
+ void read(tagHeader &);
+ std::string describe() const;
+ static map_marker *read(tagHeader &, map_marker_type);
+ static map_marker *parse(const std::string &s) throw (std::string);
+
+public:
+ dungeon_feature_type feat;
+};
+
+class map_timed_feature_marker : public map_feature_marker, dgn_event_listener
+{
+public:
+ map_timed_feature_marker(const coord_def &pos = coord_def(),
+ int duration_turns = 0,
+ dungeon_feature_type feat = DNGN_FLOOR);
+ void activate();
+ void write(tagHeader &) const;
+ void read(tagHeader &);
+ std::string describe() const;
+
+ void notify_dgn_event(const dgn_event &e);
+
+ // Expires this marker *now* and cleans it up.
+ void timeout(bool verbose);
+
+ static map_marker *read(tagHeader &, map_marker_type);
+ static map_marker *parse(const std::string &s) throw (std::string);
+
+private:
+ const char *bell_urgency(int ticks) const;
+ const char *noise_maker(int ticks) const;
+
+public:
+ // Ticks are a tenth of a turn.
+ int duration_ticks;
+ int warn_threshold;
+};
+
+void env_activate_markers();
+void env_add_marker(map_marker *);
+void env_remove_marker(map_marker *);
+void env_remove_markers_at(const coord_def &c, map_marker_type);
+map_marker *env_find_marker(const coord_def &c, map_marker_type);
+std::vector<map_marker*> env_get_markers(const coord_def &c);
+void env_clear_markers();
+
+#endif