aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorparamat <mat.gregory@virginmedia.com>2017-01-21 06:30:33 +0000
committerparamat <mat.gregory@virginmedia.com>2017-01-23 07:39:50 +0000
commitd413dfe87c326385be4259afc2830e3e1638bf3c (patch)
treeb26cc83e3253a6b32eef1161b51c88baceaef8dd /src
parent7fc67199683d3c60fe0b3ddcb2a9594b4804cc38 (diff)
downloadminetest-d413dfe87c326385be4259afc2830e3e1638bf3c.tar.gz
minetest-d413dfe87c326385be4259afc2830e3e1638bf3c.tar.bz2
minetest-d413dfe87c326385be4259afc2830e3e1638bf3c.zip
Dungeons: Support nodebox stairs wider than 1 node
Previously, code did not support stair nodeboxes in corridors wider than 1 node. Make stair nodeboxes full width even in corridors with different widths in X and Z directions.
Diffstat (limited to 'src')
-rw-r--r--src/dungeongen.cpp24
1 files changed, 16 insertions, 8 deletions
diff --git a/src/dungeongen.cpp b/src/dungeongen.cpp
index 78573da04..5dc87f8b0 100644
--- a/src/dungeongen.cpp
+++ b/src/dungeongen.cpp
@@ -437,14 +437,22 @@ void DungeonGen::makeCorridor(v3s16 doorplace, v3s16 doordir,
// rotate face 180 deg if
// making stairs backwards
int facedir = dir_to_facedir(dir * make_stairs);
-
- u32 vi = vm->m_area.index(p.X - dir.X, p.Y - 1, p.Z - dir.Z);
- if (vm->m_data[vi].getContent() == dp.c_wall)
- vm->m_data[vi] = MapNode(dp.c_stair, 0, facedir);
-
- vi = vm->m_area.index(p.X, p.Y, p.Z);
- if (vm->m_data[vi].getContent() == dp.c_wall)
- vm->m_data[vi] = MapNode(dp.c_stair, 0, facedir);
+ v3s16 ps = p;
+ u16 stair_width = (dir.Z != 0) ? dp.holesize.X : dp.holesize.Z;
+ // Stair width direction vector
+ v3s16 swv = (dir.Z != 0) ? v3s16(1, 0, 0) : v3s16(0, 0, 1);
+
+ for (u16 st = 0; st < stair_width; st++) {
+ u32 vi = vm->m_area.index(ps.X - dir.X, ps.Y - 1, ps.Z - dir.Z);
+ if (vm->m_data[vi].getContent() == dp.c_wall)
+ vm->m_data[vi] = MapNode(dp.c_stair, 0, facedir);
+
+ vi = vm->m_area.index(ps.X, ps.Y, ps.Z);
+ if (vm->m_data[vi].getContent() == dp.c_wall)
+ vm->m_data[vi] = MapNode(dp.c_stair, 0, facedir);
+
+ ps += swv;
+ }
}
} else {
makeFill(p + v3s16(-1, -1, -1),