summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/cloud.cc
diff options
context:
space:
mode:
authorzelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573>2007-11-12 06:09:15 +0000
committerzelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573>2007-11-12 06:09:15 +0000
commit3a38986e4358d3a989cef881386ecc654b36fa1c (patch)
treec0590eb69702ab13c945dfc9444a83117cb72ad6 /crawl-ref/source/cloud.cc
parent53ad48697e85f87bb7686d2e030fc3716994406d (diff)
downloadcrawl-ref-3a38986e4358d3a989cef881386ecc654b36fa1c.tar.gz
crawl-ref-3a38986e4358d3a989cef881386ecc654b36fa1c.zip
Lua map markers can now be generated in C code from
map_lua_marker::parse_marker() by prefixing the Lua string with "lua_mapless:" rather than "lua:". Fog machines can be created and placed from within C code via place_fog_machine(). git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@2843 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/cloud.cc')
-rw-r--r--crawl-ref/source/cloud.cc38
1 files changed, 38 insertions, 0 deletions
diff --git a/crawl-ref/source/cloud.cc b/crawl-ref/source/cloud.cc
index 8306c95766..ae7b614045 100644
--- a/crawl-ref/source/cloud.cc
+++ b/crawl-ref/source/cloud.cc
@@ -16,6 +16,8 @@
#include "externs.h"
#include "cloud.h"
+#include "mapmark.h"
+#include "misc.h"
#include "stuff.h"
#include "terrain.h"
@@ -305,6 +307,42 @@ cloud_type random_smoke_type()
return CLOUD_DEBUGGING;
}
+void place_fog_machine(fog_machine_type fm_type, cloud_type cl_type,
+ int x, int y, int size, int power)
+{
+ const char* fog_types[] = {
+ "geyser",
+ "spread",
+ "brownian"
+ };
+
+ try
+ {
+ char buf [160];
+ sprintf(buf, "lua_mapless:fog_machine_%s(\"%s\", %d, %d)",
+ fog_types[fm_type], cloud_name(cl_type).c_str(),
+ size, power);
+
+ map_marker *mark = map_lua_marker::parse_marker(buf, "");
+
+ if (mark == NULL)
+ {
+ mprf(MSGCH_DIAGNOSTICS, "Unable to parse fog machine from '%s'",
+ buf);
+ return;
+ }
+
+ mark->pos = coord_def(x, y);
+ env.markers.add(mark);
+ }
+ catch (const std::string &err)
+ {
+ mprf(MSGCH_DIAGNOSTICS, "Error while making fog machine: %s",
+ err.c_str());
+ }
+}
+
+
////////////////////////////////////////////////////////////////////////
// cloud_struct