summaryrefslogtreecommitdiff
path: root/src/mg_decoration.h
diff options
context:
space:
mode:
authorkwolekr <kwolekr@minetest.net>2014-11-12 23:01:13 -0500
committerkwolekr <kwolekr@minetest.net>2014-11-12 23:02:41 -0500
commit7616537bc071bc93f8d36c84b94603528be1efb0 (patch)
tree487185069e4f39f1f828a831b1d1ba9c88ed4298 /src/mg_decoration.h
parentf25cc0dbae0209f2647ac5eec9fe6ddb08174f55 (diff)
downloadminetest-7616537bc071bc93f8d36c84b94603528be1efb0.tar.gz
minetest-7616537bc071bc93f8d36c84b94603528be1efb0.tar.bz2
minetest-7616537bc071bc93f8d36c84b94603528be1efb0.zip
Add Generator Element Management framework
Add BiomeManager, OreManager, DecorationManager, and SchematicManager
Diffstat (limited to 'src/mg_decoration.h')
-rw-r--r--src/mg_decoration.h57
1 files changed, 50 insertions, 7 deletions
diff --git a/src/mg_decoration.h b/src/mg_decoration.h
index 78ff9dc2e..d5c9f0165 100644
--- a/src/mg_decoration.h
+++ b/src/mg_decoration.h
@@ -21,12 +21,13 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#define MG_DECORATION_HEADER
#include <set>
-#include "mapnode.h"
+#include "mapgen.h"
class NoiseParams;
class Mapgen;
class ManualMapVoxelManipulator;
class PseudoRandom;
+class Schematic;
enum DecorationType {
DECO_SIMPLE,
@@ -34,6 +35,13 @@ enum DecorationType {
DECO_LSYSTEM
};
+#define DECO_PLACE_CENTER_X 0x01
+#define DECO_PLACE_CENTER_Y 0x02
+#define DECO_PLACE_CENTER_Z 0x04
+
+extern FlagDesc flagdesc_deco_schematic[];
+
+
#if 0
struct CutoffData {
VoxelArea a;
@@ -49,7 +57,7 @@ struct CutoffData {
};
#endif
-class Decoration {
+class Decoration : public GenElement {
public:
INodeDefManager *ndef;
@@ -66,12 +74,11 @@ public:
Decoration();
virtual ~Decoration();
- void placeDeco(Mapgen *mg, u32 blockseed, v3s16 nmin, v3s16 nmax);
- void placeCutoffs(Mapgen *mg, u32 blockseed, v3s16 nmin, v3s16 nmax);
+ size_t placeDeco(Mapgen *mg, u32 blockseed, v3s16 nmin, v3s16 nmax);
+ size_t 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 {
@@ -87,9 +94,22 @@ public:
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 DecoSchematic : public Decoration {
+public:
+ u32 flags;
+ Rotation rotation;
+ Schematic *schematic;
+ std::string filename;
+
+ ~DecoSchematic() {}
+
+ void generate(Mapgen *mg, PseudoRandom *pr, s16 max_y, v3s16 p);
+ virtual int getHeight();
+};
+
+
/*
class DecoLSystem : public Decoration {
public:
@@ -97,6 +117,29 @@ public:
};
*/
-Decoration *createDecoration(DecorationType type);
+class DecorationManager : public GenElementManager {
+public:
+ static const char *ELEMENT_TITLE;
+ static const size_t ELEMENT_LIMIT = 0x10000;
+
+ DecorationManager(IGameDef *gamedef) {}
+ ~DecorationManager() {}
+
+ Decoration *create(int type)
+ {
+ switch (type) {
+ case DECO_SIMPLE:
+ return new DecoSimple;
+ case DECO_SCHEMATIC:
+ return new DecoSchematic;
+ //case DECO_LSYSTEM:
+ // return new DecoLSystem;
+ default:
+ return NULL;
+ }
+ }
+
+ size_t placeAllDecos(Mapgen *mg, u32 seed, v3s16 nmin, v3s16 nmax);
+};
#endif