3 Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as published by
7 the Free Software Foundation; either version 2.1 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public License along
16 with this program; if not, write to the Free Software Foundation, Inc.,
17 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20 #ifndef DUNGEONGEN_HEADER
21 #define DUNGEONGEN_HEADER
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)
33 class INodeDefManager
;
35 v3s16
rand_ortho_dir(PseudoRandom
&random
, bool diagonal_dirs
);
36 v3s16
turn_xz(v3s16 olddir
, int t
);
37 v3s16
random_turn(PseudoRandom
&random
, v3s16 olddir
);
38 int dir_to_facedir(v3s16 d
);
41 struct DungeonParams
{
47 GenNotifyType notifytype
;
53 NoiseParams np_rarity
;
54 NoiseParams np_wetness
;
55 NoiseParams np_density
;
73 DungeonGen(Mapgen
*mg
, DungeonParams
*dparams
);
74 void generate(u32 bseed
, v3s16 full_node_min
, v3s16 full_node_max
);
76 void makeDungeon(v3s16 start_padding
);
77 void makeRoom(v3s16 roomsize
, v3s16 roomplace
);
78 void makeCorridor(v3s16 doorplace
, v3s16 doordir
,
79 v3s16
&result_place
, v3s16
&result_dir
);
80 void makeDoor(v3s16 doorplace
, v3s16 doordir
);
81 void makeFill(v3s16 place
, v3s16 size
, u8 avoid_flags
, MapNode n
, u8 or_flags
);
82 void makeHole(v3s16 place
);
84 bool findPlaceForDoor(v3s16
&result_place
, v3s16
&result_dir
);
85 bool findPlaceForRoomDoor(v3s16 roomsize
, v3s16
&result_doorplace
,
86 v3s16
&result_doordir
, v3s16
&result_roomplace
);
90 m_dir
= rand_ortho_dir(random
, dp
.diagonal_dirs
);
94 extern NoiseParams nparams_dungeon_rarity
;
95 extern NoiseParams nparams_dungeon_wetness
;
96 extern NoiseParams nparams_dungeon_density
;