Minetest 5.9.0-dev
 
Loading...
Searching...
No Matches
dungeongen.h
Go to the documentation of this file.
1/*
2Minetest
3Copyright (C) 2010-2018 celeron55, Perttu Ahola <celeron55@gmail.com>
4Copyright (C) 2015-2018 paramat
5
6This program is free software; you can redistribute it and/or modify
7it under the terms of the GNU Lesser General Public License as published by
8the Free Software Foundation; either version 2.1 of the License, or
9(at your option) any later version.
10
11This program is distributed in the hope that it will be useful,
12but WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14GNU Lesser General Public License for more details.
15
16You should have received a copy of the GNU Lesser General Public License along
17with this program; if not, write to the Free Software Foundation, Inc.,
1851 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19*/
20
21#pragma once
22
23#include "voxel.h"
24#include "noise.h"
25#include "mapgen.h"
26
27#define VMANIP_FLAG_DUNGEON_INSIDE VOXELFLAG_CHECKED1
28#define VMANIP_FLAG_DUNGEON_PRESERVE VOXELFLAG_CHECKED2
29#define VMANIP_FLAG_DUNGEON_UNTOUCHABLE (\
30 VMANIP_FLAG_DUNGEON_INSIDE|VMANIP_FLAG_DUNGEON_PRESERVE)
31
32class MMVManip;
33class NodeDefManager;
34
35v3s16 rand_ortho_dir(PseudoRandom &random, bool diagonal_dirs);
36v3s16 turn_xz(v3s16 olddir, int t);
37void random_turn(PseudoRandom &random, v3s16 &dir);
39
40
42 s32 seed;
43
45 // Randomly scattered alternative wall nodes
48
49 // 3D noise that determines which c_wall nodes are converted to c_alt_wall
51
52 // Number of dungeons generated in mapchunk. All will use the same set of
53 // dungeonparams.
55 // Dungeons only generate in ground
57 // Number of rooms
59 // Room size random range. Includes walls / floor / ceilng
62 // Large room size random range. Includes walls / floor / ceilng
65 // Value 0 disables large rooms.
66 // Value 1 results in 1 large room, the first generated room.
67 // Value > 1 makes the first generated room large, all other rooms have a
68 // '1 in value' chance of being large.
70 // Dimensions of 3D 'brush' that creates corridors.
71 // Dimensions are of the empty space, not including walls / floor / ceilng.
72 // Diagonal corridors must have hole width >=2 to be passable.
73 // Currently, hole width >= 3 causes stair corridor bugs.
75 // Corridor length random range
78 // Diagonal corridors are possible, 1 in 4 corridors will be diagonal
80 // Usually 'GENNOTIFY_DUNGEON', but mapgen v6 uses 'GENNOTIFY_TEMPLE' for
81 // desert dungeons.
83};
84
86public:
87 MMVManip *vm = nullptr;
90
94
97
98 // RoomWalker
101
104
105 void generate(MMVManip *vm, u32 bseed, v3s16 full_node_min, v3s16 full_node_max);
106
107 void makeDungeon(v3s16 start_padding);
108 void makeRoom(v3s16 roomsize, v3s16 roomplace);
109 void makeCorridor(v3s16 doorplace, v3s16 doordir,
110 v3s16 &result_place, v3s16 &result_dir);
111 void makeDoor(v3s16 doorplace, v3s16 doordir);
112 void makeFill(v3s16 place, v3s16 size, u8 avoid_flags, MapNode n, u8 or_flags);
113 void makeHole(v3s16 place);
114
115 bool findPlaceForDoor(v3s16 &result_place, v3s16 &result_dir);
116 bool findPlaceForRoomDoor(v3s16 roomsize, v3s16 &result_doorplace,
117 v3s16 &result_doordir, v3s16 &result_roomplace);
118
119 inline void randomizeDir()
120 {
122 }
123};
124
static v2f dir(const v2f &pos_dist)
Definition: camera.cpp:204
Definition: dungeongen.h:85
void makeFill(v3s16 place, v3s16 size, u8 avoid_flags, MapNode n, u8 or_flags)
Definition: dungeongen.cpp:365
v3s16 m_pos
Definition: dungeongen.h:99
void randomizeDir()
Definition: dungeongen.h:119
content_t c_torch
Definition: dungeongen.h:95
MMVManip * vm
Definition: dungeongen.h:87
void makeDoor(v3s16 doorplace, v3s16 doordir)
Definition: dungeongen.cpp:390
GenerateNotifier * gennotify
Definition: dungeongen.h:89
PseudoRandom random
Definition: dungeongen.h:92
void makeHole(v3s16 place)
Definition: dungeongen.cpp:383
bool findPlaceForDoor(v3s16 &result_place, v3s16 &result_dir)
Definition: dungeongen.cpp:505
v3s16 m_dir
Definition: dungeongen.h:100
void makeRoom(v3s16 roomsize, v3s16 roomplace)
Definition: dungeongen.cpp:277
v3s16 csize
Definition: dungeongen.h:93
bool findPlaceForRoomDoor(v3s16 roomsize, v3s16 &result_doorplace, v3s16 &result_doordir, v3s16 &result_roomplace)
Definition: dungeongen.cpp:557
void makeCorridor(v3s16 doorplace, v3s16 doordir, v3s16 &result_place, v3s16 &result_dir)
Definition: dungeongen.cpp:401
u32 blockseed
Definition: dungeongen.h:91
void makeDungeon(v3s16 start_padding)
Definition: dungeongen.cpp:143
const NodeDefManager * ndef
Definition: dungeongen.h:88
DungeonParams dp
Definition: dungeongen.h:96
void generate(MMVManip *vm, u32 bseed, v3s16 full_node_min, v3s16 full_node_max)
Definition: dungeongen.cpp:80
Definition: mapgen.h:83
Definition: map.h:320
This class is for getting the actual properties of nodes from their content ID.
Definition: nodedef.h:556
Definition: noise.h:43
void random_turn(PseudoRandom &random, v3s16 &dir)
Definition: dungeongen.cpp:652
v3s16 rand_ortho_dir(PseudoRandom &random, bool diagonal_dirs)
Definition: dungeongen.cpp:609
int dir_to_facedir(v3s16 d)
Definition: dungeongen.cpp:668
v3s16 turn_xz(v3s16 olddir, int t)
Definition: dungeongen.cpp:634
NoiseParams nparams_dungeon_alt_wall
NoiseParams nparams_dungeon_density
core::vector3d< s16 > v3s16
Definition: irr_v3d.h:28
GenNotifyType
Definition: mapgen.h:71
u16 content_t
Definition: mapnode.h:37
Definition: dungeongen.h:41
s32 seed
Definition: dungeongen.h:42
u16 large_room_chance
Definition: dungeongen.h:69
u16 num_dungeons
Definition: dungeongen.h:54
v3s16 room_size_min
Definition: dungeongen.h:60
u16 corridor_len_min
Definition: dungeongen.h:76
content_t c_stair
Definition: dungeongen.h:47
content_t c_alt_wall
Definition: dungeongen.h:46
u16 num_rooms
Definition: dungeongen.h:58
bool only_in_ground
Definition: dungeongen.h:56
GenNotifyType notifytype
Definition: dungeongen.h:82
v3s16 room_size_max
Definition: dungeongen.h:61
bool diagonal_dirs
Definition: dungeongen.h:79
content_t c_wall
Definition: dungeongen.h:44
NoiseParams np_alt_wall
Definition: dungeongen.h:50
u16 corridor_len_max
Definition: dungeongen.h:77
v3s16 room_size_large_max
Definition: dungeongen.h:64
v3s16 room_size_large_min
Definition: dungeongen.h:63
v3s16 holesize
Definition: dungeongen.h:74
Definition: mapnode.h:139
Definition: noise.h:119