aboutsummaryrefslogtreecommitdiff
path: root/textures/base/pack/object_marker_red.png
blob: f345d037630af101d0d1b79bbe6321119b98c644 (plain)
ofshex dumpascii
0000 89 50 4e 47 0d 0a 1a 0a 00 00 00 0d 49 48 44 52 00 00 00 10 00 00 00 10 08 06 00 00 00 1f f3 ff .PNG........IHDR................
0020 61 00 00 00 06 62 4b 47 44 00 ff 00 ff 00 ff a0 bd a7 93 00 00 00 09 70 48 59 73 00 00 0b 13 00 a....bKGD..............pHYs.....
0040 00 0b 13 01 00 9a 9c 18 00 00 00 07 74 49 4d 45 07 e0 02 1b 17 18 0a 5c ef f6 6e 00 00 00 1d 69 ............tIME.......\..n....i
0060 54 58 74 43 6f 6d 6d 65 6e 74 00 00 00 00 00 43 72 65 61 74 65 64 20 77 69 74 68 20 47 49 4d 50 TXtComment.....Created.with.GIMP
0080 64 2e 65 07 00 00 01 25 49 44 41 54 38 cb a5 d3 3d 4e c3 40 10 05 e0 cf 0e 48 49 67 89 86 8e a5 d.e....%IDAT8...=N.@.....HIg....
00a0 4b 17 1f 81 92 8e 23 90 8e 96 23 41 49 05 25 5d 28 e9 12 4e 10 73 02 42 e7 0a 53 78 ac 38 41 24 K.....#...#AI.%](..N.s.B..Sx.8A$
00c0 fc 3c 69 64 cd 7a de db d9 f9 c9 6c a2 40 89 09 52 f8 b0 42 85 17 2c 64 56 1a 5f 90 70 8d 19 de .<id.z.....l.@..R..B..,dV._.p...
00e0 d0 6c d9 5b fc bb 46 72 d0 92 06 3d f2 14 57 05 e5 98 e1 39 2e 70 86 d3 36 66 58 93 6a c6 c8 7c .l.[..Fr...=..W....9.p..6fX.j..|
0100 a8 22 33 45 a8 2e 0b 9a 29 cd 3d cd 92 a6 09 5b c6 d9 94 a6 68 b3 59 06 a7 10 97 cc 3a f2 bc 47 ."3E....).=....[....h.Y.....:..G
0120 dc b6 f9 a6 c8 0c 67 79 14 ac 4c 91 72 e9 7b 94 11 93 d6 ee 24 ef aa 5d ee 21 f7 45 ca 75 c7 52 ......gy..L.r.{.....$..].!.E.u.R
0140 de bd e3 64 ad bc 13 29 62 bb b6 e7 fe 89 bc 6b c5 6b 4c ca 3e 54 11 db 0d 58 1e 67 ab 05 16 3f ...d...)b......k.kL.>T...X.g...?
0160 10 e8 c5 ad 50 0d 30 c2 b8 26 65 f1 c6 e3 1d e4 5b 3c a3 6e 3f 77 83 50 1a d5 8c 2b 8a f7 08 1e ....P.0..&e.....[<.n?w.P...+....
0180 f6 16 a1 c2 53 90 1f 5a 42 15 ee 63 b6 35 ca 97 05 29 45 ab ba 6a bf c6 ed d5 26 f9 66 5d b6 c3 ....S..ZB..c.5...)E..j....&.f]..
01a0 df 2f d3 51 88 67 7f 5a e7 e8 1c 7c 02 25 a4 74 e7 07 6d ca 2d 00 00 00 00 49 45 4e 44 ae 42 60 ./.Q.g.Z...|.%.t..m.-....IEND.B`
01c0 82 .
118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152
/*
Minetest
Copyright (C) 2014-2018 kwolekr, Ryan Kwolek <kwolekr@minetest.net>
Copyright (C) 2015-2018 paramat

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.
*/

#pragma once

#include <unordered_set>
#include "objdef.h"
#include "noise.h"
#include "nodedef.h"

typedef u16 biome_t;  // copy from mg_biome.h to avoid an unnecessary include

class Mapgen;
class MMVManip;
class PcgRandom;
class Schematic;

enum DecorationType {
	DECO_SIMPLE,
	DECO_SCHEMATIC,
	DECO_LSYSTEM
};

#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
#define DECO_LIQUID_SURFACE  0x20
#define DECO_ALL_FLOORS      0x40
#define DECO_ALL_CEILINGS    0x80

extern FlagDesc flagdesc_deco[];


class Decoration : public ObjDef, public NodeResolver {
public:
	Decoration() = default;
	virtual ~Decoration() = default;

	virtual void resolveNodeNames();

	bool canPlaceDecoration(MMVManip *vm, v3s16 p);
	size_t placeDeco(Mapgen *mg, u32 blockseed, v3s16 nmin, v3s16 nmax);

	virtual size_t generate(MMVManip *vm, PcgRandom *pr, v3s16 p, bool ceiling) = 0;

	u32 flags = 0;
	int mapseed = 0;
	std::vector<content_t> c_place_on;
	s16 sidelen = 1;
	s16 y_min;
	s16 y_max;
	float fill_ratio = 0.0f;
	NoiseParams np;
	std::vector<content_t> c_spawnby;
	s16 nspawnby;
	s16 place_offset_y = 0;

	std::unordered_set<biome_t> biomes;

protected:
	void cloneTo(Decoration *def) const;
};


class DecoSimple : public Decoration {
public:
	ObjDef *clone() const;

	virtual void resolveNodeNames();
	virtual size_t generate(MMVManip *vm, PcgRandom *pr, v3s16 p, bool ceiling);

	std::vector<content_t> c_decos;
	s16 deco_height;
	s16 deco_height_max;
	u8 deco_param2;
	u8 deco_param2_max;
};


class DecoSchematic : public Decoration {
public:
	ObjDef *clone() const;

	DecoSchematic() = default;
	virtual ~DecoSchematic();

	virtual size_t generate(MMVManip *vm, PcgRandom *pr, v3s16 p, bool ceiling);

	Rotation rotation;
	Schematic *schematic = nullptr;
	bool was_cloned = false; // see FIXME inside DecoSchemtic::clone()
};


/*
class DecoLSystem : public Decoration {
public:
	virtual void generate(Mapgen *mg, u32 blockseed, v3s16 nmin, v3s16 nmax);
};
*/


class DecorationManager : public ObjDefManager {
public:
	DecorationManager(IGameDef *gamedef);
	virtual ~DecorationManager() = default;

	DecorationManager *clone() const;

	const char *getObjectTitle() const
	{
		return "decoration";
	}

	static Decoration *create(DecorationType 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 blockseed, v3s16 nmin, v3s16 nmax);

private:
	DecorationManager() {};
};