summaryrefslogtreecommitdiff
path: root/src/mg_decoration.h
diff options
context:
space:
mode:
authorkwolekr <kwolekr@minetest.net>2014-11-01 13:16:23 -0400
committerkwolekr <kwolekr@minetest.net>2014-11-01 13:16:23 -0400
commit9e811a92e7846b958e4bc84aeb30bad8b51e8e1d (patch)
tree6b7b69e0364355881253395a192241932aebb952 /src/mg_decoration.h
parentdb25f753375a97c71609ec4e2a3f7f6983904a54 (diff)
downloadminetest-9e811a92e7846b958e4bc84aeb30bad8b51e8e1d.tar.gz
minetest-9e811a92e7846b958e4bc84aeb30bad8b51e8e1d.tar.bz2
minetest-9e811a92e7846b958e4bc84aeb30bad8b51e8e1d.zip
Split up mapgen.cpp
Diffstat (limited to 'src/mg_decoration.h')
-rw-r--r--src/mg_decoration.h102
1 files changed, 102 insertions, 0 deletions
diff --git a/src/mg_decoration.h b/src/mg_decoration.h
new file mode 100644
index 000000000..78ff9dc2e
--- /dev/null
+++ b/src/mg_decoration.h
@@ -0,0 +1,102 @@
+/*
+Minetest
+Copyright (C) 2010-2013 kwolekr, Ryan Kwolek <kwolekr@minetest.net>
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along
+with this program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+*/
+
+#ifndef MG_DECORATION_HEADER
+#define MG_DECORATION_HEADER
+
+#include <set>
+#include "mapnode.h"
+
+class NoiseParams;
+class Mapgen;
+class ManualMapVoxelManipulator;
+class PseudoRandom;
+
+enum DecorationType {
+ DECO_SIMPLE,
+ DECO_SCHEMATIC,
+ DECO_LSYSTEM
+};
+
+#if 0
+struct CutoffData {
+ VoxelArea a;
+ Decoration *deco;
+ //v3s16 p;
+ //v3s16 size;
+ //s16 height;
+
+ CutoffData(s16 x, s16 y, s16 z, s16 h) {
+ p = v3s16(x, y, z);
+ height = h;
+ }
+};
+#endif
+
+class Decoration {
+public:
+ INodeDefManager *ndef;
+
+ int mapseed;
+ std::vector<content_t> c_place_on;
+ s16 sidelen;
+ float fill_ratio;
+ NoiseParams *np;
+
+ std::set<u8> biomes;
+ //std::list<CutoffData> cutoffs;
+ //JMutex cutoff_mutex;
+
+ Decoration();
+ virtual ~Decoration();
+
+ void placeDeco(Mapgen *mg, u32 blockseed, v3s16 nmin, v3s16 nmax);
+ void placeCutoffs(Mapgen *mg, u32 blockseed, v3s16 nmin, v3s16 nmax);
+
+ virtual void generate(Mapgen *mg, PseudoRandom *pr, s16 max_y, v3s16 p) = 0;
+ virtual int getHeight() = 0;
+ virtual std::string getName() = 0;
+};
+
+class DecoSimple : public Decoration {
+public:
+ std::vector<content_t> c_decos;
+ std::vector<content_t> c_spawnby;
+ s16 deco_height;
+ s16 deco_height_max;
+ s16 nspawnby;
+
+ ~DecoSimple() {}
+
+ bool canPlaceDecoration(ManualMapVoxelManipulator *vm, v3s16 p);
+ virtual void generate(Mapgen *mg, PseudoRandom *pr, s16 max_y, v3s16 p);
+ virtual int getHeight();
+ virtual std::string getName();
+};
+
+/*
+class DecoLSystem : public Decoration {
+public:
+ virtual void generate(Mapgen *mg, u32 blockseed, v3s16 nmin, v3s16 nmax);
+};
+*/
+
+Decoration *createDecoration(DecorationType type);
+
+#endif