mirror of
https://github.com/luanti-org/luanti.git
synced 2025-07-27 17:28:41 +00:00
Dungeongen: Create dungeon gen tuneables; add desert temples for Mapgen V6
This commit is contained in:
parent
a0dce51af6
commit
bbae8eb751
5 changed files with 158 additions and 110 deletions
|
@ -31,11 +31,29 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
class ManualMapVoxelManipulator;
|
||||
class INodeDefManager;
|
||||
|
||||
v3s16 rand_ortho_dir(PseudoRandom &random);
|
||||
|
||||
v3s16 rand_ortho_dir(PseudoRandom &random, bool diagonal_dirs);
|
||||
v3s16 turn_xz(v3s16 olddir, int t);
|
||||
v3s16 random_turn(PseudoRandom &random, v3s16 olddir);
|
||||
int dir_to_facedir(v3s16 d);
|
||||
|
||||
|
||||
struct DungeonParams {
|
||||
content_t c_water;
|
||||
content_t c_cobble;
|
||||
content_t c_moss;
|
||||
content_t c_stair;
|
||||
|
||||
bool diagonal_dirs;
|
||||
float mossratio;
|
||||
v3s16 holesize;
|
||||
v3s16 roomsize;
|
||||
|
||||
NoiseParams np_rarity;
|
||||
NoiseParams np_wetness;
|
||||
NoiseParams np_density;
|
||||
};
|
||||
|
||||
class DungeonGen {
|
||||
public:
|
||||
u32 blockseed;
|
||||
|
@ -45,25 +63,17 @@ public:
|
|||
PseudoRandom random;
|
||||
v3s16 csize;
|
||||
s16 water_level;
|
||||
|
||||
NoiseParams *np_rarity;
|
||||
NoiseParams *np_wetness;
|
||||
NoiseParams *np_density;
|
||||
|
||||
content_t cid_water_source;
|
||||
content_t cid_cobble;
|
||||
content_t cid_mossycobble;
|
||||
content_t cid_torch;
|
||||
content_t cid_cobblestair;
|
||||
|
||||
content_t c_torch;
|
||||
DungeonParams dp;
|
||||
|
||||
//RoomWalker
|
||||
v3s16 m_pos;
|
||||
v3s16 m_dir;
|
||||
|
||||
DungeonGen(INodeDefManager *ndef, u64 seed, s16 waterlevel);
|
||||
DungeonGen(INodeDefManager *ndef, u64 seed, s16 waterlevel, DungeonParams *dparams);
|
||||
void generate(ManualMapVoxelManipulator *vm, u32 bseed,
|
||||
v3s16 full_node_min, v3s16 full_node_max);
|
||||
//void generate(v3s16 full_node_min, v3s16 full_node_max, u32 bseed);
|
||||
v3s16 full_node_min, v3s16 full_node_max);
|
||||
|
||||
void makeDungeon(v3s16 start_padding);
|
||||
void makeRoom(v3s16 roomsize, v3s16 roomplace);
|
||||
|
@ -79,50 +89,12 @@ public:
|
|||
|
||||
void randomizeDir()
|
||||
{
|
||||
m_dir = rand_ortho_dir(random);
|
||||
m_dir = rand_ortho_dir(random, dp.diagonal_dirs);
|
||||
}
|
||||
};
|
||||
|
||||
class RoomWalker
|
||||
{
|
||||
public:
|
||||
|
||||
RoomWalker(VoxelManipulator &vmanip_, v3s16 pos, PseudoRandom &random,
|
||||
INodeDefManager *ndef):
|
||||
vmanip(vmanip_),
|
||||
m_pos(pos),
|
||||
m_random(random),
|
||||
m_ndef(ndef)
|
||||
{
|
||||
randomizeDir();
|
||||
}
|
||||
|
||||
void randomizeDir()
|
||||
{
|
||||
m_dir = rand_ortho_dir(m_random);
|
||||
}
|
||||
|
||||
void setPos(v3s16 pos)
|
||||
{
|
||||
m_pos = pos;
|
||||
}
|
||||
|
||||
void setDir(v3s16 dir)
|
||||
{
|
||||
m_dir = dir;
|
||||
}
|
||||
|
||||
//bool findPlaceForDoor(v3s16 &result_place, v3s16 &result_dir);
|
||||
//bool findPlaceForRoomDoor(v3s16 roomsize, v3s16 &result_doorplace,
|
||||
// v3s16 &result_doordir, v3s16 &result_roomplace);
|
||||
|
||||
private:
|
||||
VoxelManipulator &vmanip;
|
||||
v3s16 m_pos;
|
||||
v3s16 m_dir;
|
||||
PseudoRandom &m_random;
|
||||
INodeDefManager *m_ndef;
|
||||
};
|
||||
|
||||
extern NoiseParams nparams_dungeon_rarity;
|
||||
extern NoiseParams nparams_dungeon_wetness;
|
||||
extern NoiseParams nparams_dungeon_density;
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue