Skip to content
Permalink
Browse files

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.
  • Loading branch information...
paramat committed Jan 21, 2017
1 parent 7fc6719 commit d413dfe87c326385be4259afc2830e3e1638bf3c
Showing with 16 additions and 8 deletions.
  1. +16 −8 src/dungeongen.cpp
@@ -437,14 +437,22 @@ void DungeonGen::makeCorridor(v3s16 doorplace, v3s16 doordir,
// rotate face 180 deg if // rotate face 180 deg if
// making stairs backwards // making stairs backwards
int facedir = dir_to_facedir(dir * make_stairs); int facedir = dir_to_facedir(dir * make_stairs);

v3s16 ps = p;
u32 vi = vm->m_area.index(p.X - dir.X, p.Y - 1, p.Z - dir.Z); u16 stair_width = (dir.Z != 0) ? dp.holesize.X : dp.holesize.Z;
if (vm->m_data[vi].getContent() == dp.c_wall) // Stair width direction vector
vm->m_data[vi] = MapNode(dp.c_stair, 0, facedir); v3s16 swv = (dir.Z != 0) ? v3s16(1, 0, 0) : v3s16(0, 0, 1);


vi = vm->m_area.index(p.X, p.Y, p.Z); for (u16 st = 0; st < stair_width; st++) {
if (vm->m_data[vi].getContent() == dp.c_wall) u32 vi = vm->m_area.index(ps.X - dir.X, ps.Y - 1, ps.Z - dir.Z);
vm->m_data[vi] = MapNode(dp.c_stair, 0, facedir); 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 { } else {
makeFill(p + v3s16(-1, -1, -1), makeFill(p + v3s16(-1, -1, -1),

0 comments on commit d413dfe

Please sign in to comment.
You can’t perform that action at this time.