Luanti 5.10.0-dev
 
Loading...
Searching...
No Matches
dungeongen.h
Go to the documentation of this file.
1// Luanti
2// SPDX-License-Identifier: LGPL-2.1-or-later
3// Copyright (C) 2010-2018 celeron55, Perttu Ahola <celeron55@gmail.com>
4// Copyright (C) 2015-2018 paramat
5
6#pragma once
7
8#include "voxel.h"
9#include "noise.h"
10#include "mapgen.h"
11
12#define VMANIP_FLAG_DUNGEON_INSIDE VOXELFLAG_CHECKED1
13#define VMANIP_FLAG_DUNGEON_PRESERVE VOXELFLAG_CHECKED2
14#define VMANIP_FLAG_DUNGEON_UNTOUCHABLE (\
15 VMANIP_FLAG_DUNGEON_INSIDE|VMANIP_FLAG_DUNGEON_PRESERVE)
16
17class MMVManip;
18class NodeDefManager;
19
20v3s16 rand_ortho_dir(PseudoRandom &random, bool diagonal_dirs);
21v3s16 turn_xz(v3s16 olddir, int t);
22void random_turn(PseudoRandom &random, v3s16 &dir);
24
25
27 s32 seed;
28
30 // Randomly scattered alternative wall nodes
33
34 // 3D noise that determines which c_wall nodes are converted to c_alt_wall
36
37 // Number of dungeons generated in mapchunk. All will use the same set of
38 // dungeonparams.
40 // Dungeons only generate in ground
42 // Number of rooms
44 // Room size random range. Includes walls / floor / ceilng
47 // Large room size random range. Includes walls / floor / ceilng
50 // Value 0 disables large rooms.
51 // Value 1 results in 1 large room, the first generated room.
52 // Value > 1 makes the first generated room large, all other rooms have a
53 // '1 in value' chance of being large.
55 // Dimensions of 3D 'brush' that creates corridors.
56 // Dimensions are of the empty space, not including walls / floor / ceilng.
57 // Diagonal corridors must have hole width >=2 to be passable.
58 // Currently, hole width >= 3 causes stair corridor bugs.
60 // Corridor length random range
63 // Diagonal corridors are possible, 1 in 4 corridors will be diagonal
65 // Usually 'GENNOTIFY_DUNGEON', but mapgen v6 uses 'GENNOTIFY_TEMPLE' for
66 // desert dungeons.
68};
69
71public:
72 MMVManip *vm = nullptr;
75
79
82
83 // RoomWalker
86
89
90 void generate(MMVManip *vm, u32 bseed, v3s16 full_node_min, v3s16 full_node_max);
91
92 void makeDungeon(v3s16 start_padding);
93 void makeRoom(v3s16 roomsize, v3s16 roomplace);
94 void makeCorridor(v3s16 doorplace, v3s16 doordir,
95 v3s16 &result_place, v3s16 &result_dir);
96 void makeDoor(v3s16 doorplace, v3s16 doordir);
97 void makeFill(v3s16 place, v3s16 size, u8 avoid_flags, MapNode n, u8 or_flags);
98 void makeHole(v3s16 place);
99
100 bool findPlaceForDoor(v3s16 &result_place, v3s16 &result_dir);
101 bool findPlaceForRoomDoor(v3s16 roomsize, v3s16 &result_doorplace,
102 v3s16 &result_doordir, v3s16 &result_roomplace);
103
104 inline void randomizeDir()
105 {
107 }
108};
109
static v2f dir(const v2f &pos_dist)
Definition camera.cpp:191
Definition dungeongen.h:70
void makeFill(v3s16 place, v3s16 size, u8 avoid_flags, MapNode n, u8 or_flags)
Definition dungeongen.cpp:350
v3s16 m_pos
Definition dungeongen.h:84
void randomizeDir()
Definition dungeongen.h:104
content_t c_torch
Definition dungeongen.h:80
MMVManip * vm
Definition dungeongen.h:72
void makeDoor(v3s16 doorplace, v3s16 doordir)
Definition dungeongen.cpp:375
DungeonGen(const NodeDefManager *ndef, GenerateNotifier *gennotify, DungeonParams *dparams)
Definition dungeongen.cpp:23
GenerateNotifier * gennotify
Definition dungeongen.h:74
PseudoRandom random
Definition dungeongen.h:77
void makeHole(v3s16 place)
Definition dungeongen.cpp:368
bool findPlaceForDoor(v3s16 &result_place, v3s16 &result_dir)
Definition dungeongen.cpp:490
v3s16 m_dir
Definition dungeongen.h:85
void makeRoom(v3s16 roomsize, v3s16 roomplace)
Definition dungeongen.cpp:262
v3s16 csize
Definition dungeongen.h:78
bool findPlaceForRoomDoor(v3s16 roomsize, v3s16 &result_doorplace, v3s16 &result_doordir, v3s16 &result_roomplace)
Definition dungeongen.cpp:542
void makeCorridor(v3s16 doorplace, v3s16 doordir, v3s16 &result_place, v3s16 &result_dir)
Definition dungeongen.cpp:386
u32 blockseed
Definition dungeongen.h:76
void makeDungeon(v3s16 start_padding)
Definition dungeongen.cpp:128
const NodeDefManager * ndef
Definition dungeongen.h:73
DungeonParams dp
Definition dungeongen.h:81
void generate(MMVManip *vm, u32 bseed, v3s16 full_node_min, v3s16 full_node_max)
Definition dungeongen.cpp:65
Definition mapgen.h:68
Definition map.h:305
This class is for getting the actual properties of nodes from their content ID.
Definition nodedef.h:541
Definition noise.h:43
void random_turn(PseudoRandom &random, v3s16 &dir)
Definition dungeongen.cpp:637
v3s16 rand_ortho_dir(PseudoRandom &random, bool diagonal_dirs)
Definition dungeongen.cpp:594
int dir_to_facedir(v3s16 d)
Definition dungeongen.cpp:653
v3s16 turn_xz(v3s16 olddir, int t)
Definition dungeongen.cpp:619
NoiseParams nparams_dungeon_alt_wall
NoiseParams nparams_dungeon_density
core::vector3d< s16 > v3s16
Definition irr_v3d.h:13
GenNotifyType
Definition mapgen.h:56
u16 content_t
Definition mapnode.h:22
Definition dungeongen.h:26
s32 seed
Definition dungeongen.h:27
u16 large_room_chance
Definition dungeongen.h:54
u16 num_dungeons
Definition dungeongen.h:39
v3s16 room_size_min
Definition dungeongen.h:45
u16 corridor_len_min
Definition dungeongen.h:61
content_t c_stair
Definition dungeongen.h:32
content_t c_alt_wall
Definition dungeongen.h:31
u16 num_rooms
Definition dungeongen.h:43
bool only_in_ground
Definition dungeongen.h:41
GenNotifyType notifytype
Definition dungeongen.h:67
v3s16 room_size_max
Definition dungeongen.h:46
bool diagonal_dirs
Definition dungeongen.h:64
content_t c_wall
Definition dungeongen.h:29
NoiseParams np_alt_wall
Definition dungeongen.h:35
u16 corridor_len_max
Definition dungeongen.h:62
v3s16 room_size_large_max
Definition dungeongen.h:49
v3s16 room_size_large_min
Definition dungeongen.h:48
v3s16 holesize
Definition dungeongen.h:59
Definition mapnode.h:124
Definition noise.h:119