X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=src%2Fmg_decoration.h;h=c712ce7c8e5dfb672950457dda810804c9e19c30;hb=e0b57c1140554fccbf3e57a036cc4100887ab8f1;hp=3262924b02f1e2700096fcc99400bade177a9bf2;hpb=0183c05ee0ed0c6566a860119ee93cf88ba7d9ee;p=oweals%2Fminetest.git diff --git a/src/mg_decoration.h b/src/mg_decoration.h index 3262924b0..c712ce7c8 100644 --- a/src/mg_decoration.h +++ b/src/mg_decoration.h @@ -21,11 +21,12 @@ with this program; if not, write to the Free Software Foundation, Inc., #define MG_DECORATION_HEADER #include -#include "mapgen.h" +#include "objdef.h" +#include "noise.h" +#include "nodedef.h" -struct NoiseParams; class Mapgen; -class ManualMapVoxelManipulator; +class MMVManip; class PseudoRandom; class Schematic; @@ -35,11 +36,13 @@ enum DecorationType { DECO_LSYSTEM }; -#define DECO_PLACE_CENTER_X 0x01 -#define DECO_PLACE_CENTER_Y 0x02 -#define DECO_PLACE_CENTER_Z 0x04 +#define DECO_PLACE_CENTER_X 0x01 +#define DECO_PLACE_CENTER_Y 0x02 +#define DECO_PLACE_CENTER_Z 0x04 +#define DECO_USE_NOISE 0x08 +#define DECO_FORCE_PLACEMENT 0x10 -extern FlagDesc flagdesc_deco_schematic[]; +extern FlagDesc flagdesc_deco[]; #if 0 @@ -57,56 +60,57 @@ struct CutoffData { }; #endif -class Decoration : public GenElement { +class Decoration : public ObjDef, public NodeResolver { public: - INodeDefManager *ndef; + Decoration(); + virtual ~Decoration(); + + virtual void resolveNodeNames(); + + size_t placeDeco(Mapgen *mg, u32 blockseed, v3s16 nmin, v3s16 nmax); + //size_t placeCutoffs(Mapgen *mg, u32 blockseed, v3s16 nmin, v3s16 nmax); + + virtual size_t generate(MMVManip *vm, PseudoRandom *pr, v3s16 p) = 0; + virtual int getHeight() = 0; + u32 flags; int mapseed; std::vector c_place_on; s16 sidelen; + s16 y_min; + s16 y_max; float fill_ratio; - NoiseParams *np; + NoiseParams np; std::set biomes; //std::list cutoffs; - //JMutex cutoff_mutex; - - Decoration(); - virtual ~Decoration(); - - size_t placeDeco(Mapgen *mg, u32 blockseed, v3s16 nmin, v3s16 nmax); - size_t placeCutoffs(Mapgen *mg, u32 blockseed, v3s16 nmin, v3s16 nmax); - - virtual size_t generate(Mapgen *mg, PseudoRandom *pr, s16 max_y, v3s16 p) = 0; - virtual int getHeight() = 0; + //Mutex cutoff_mutex; }; class DecoSimple : public Decoration { public: + virtual size_t generate(MMVManip *vm, PseudoRandom *pr, v3s16 p); + bool canPlaceDecoration(MMVManip *vm, v3s16 p); + virtual int getHeight(); + + virtual void resolveNodeNames(); + std::vector c_decos; std::vector c_spawnby; s16 deco_height; s16 deco_height_max; s16 nspawnby; - - ~DecoSimple() {} - - bool canPlaceDecoration(ManualMapVoxelManipulator *vm, v3s16 p); - virtual size_t generate(Mapgen *mg, PseudoRandom *pr, s16 max_y, v3s16 p); - virtual int getHeight(); }; class DecoSchematic : public Decoration { public: - u32 flags; - Rotation rotation; - Schematic *schematic; - std::string filename; - - ~DecoSchematic() {} + DecoSchematic(); - virtual size_t generate(Mapgen *mg, PseudoRandom *pr, s16 max_y, v3s16 p); + virtual size_t generate(MMVManip *vm, PseudoRandom *pr, v3s16 p); virtual int getHeight(); + + Rotation rotation; + Schematic *schematic; }; @@ -117,15 +121,17 @@ public: }; */ -class DecorationManager : public GenElementManager { +class DecorationManager : public ObjDefManager { public: - static const char *ELEMENT_TITLE; - static const size_t ELEMENT_LIMIT = 0x10000; + DecorationManager(IGameDef *gamedef); + virtual ~DecorationManager() {} - DecorationManager(IGameDef *gamedef) {} - ~DecorationManager() {} + const char *getObjectTitle() const + { + return "decoration"; + } - Decoration *create(int type) + static Decoration *create(DecorationType type) { switch (type) { case DECO_SIMPLE: @@ -139,7 +145,7 @@ public: } } - size_t placeAllDecos(Mapgen *mg, u32 seed, v3s16 nmin, v3s16 nmax); + size_t placeAllDecos(Mapgen *mg, u32 blockseed, v3s16 nmin, v3s16 nmax); }; #endif