diff --git a/Game/Dungeon/DungeonGeneratorV2.cs b/Game/Dungeon/DungeonGeneratorV2.cs index 3d8aaf4..0fc0139 100644 --- a/Game/Dungeon/DungeonGeneratorV2.cs +++ b/Game/Dungeon/DungeonGeneratorV2.cs @@ -978,14 +978,17 @@ public class DungeonGeneratorV2 // Determine wall type based on which direction has floor TileDefinition wallTile; - // Check for corners first - if (hasFloorSouth && hasFloorEast) + // Check for corners first. + // IMPORTANT: corner_* tags indicate the quadrant where the *wall mass* lives inside this tile. + // That quadrant matches the direction of the interior (walkable) corner. + // Example: if the interior is to the NW (diagonal floor at NW), use corner_nw. + if (hasFloorNorth && hasFloorWest) wallTile = wallCornerNW; - else if (hasFloorSouth && hasFloorWest) - wallTile = wallCornerNE; else if (hasFloorNorth && hasFloorEast) + wallTile = wallCornerNE; + else if (hasFloorSouth && hasFloorWest) wallTile = wallCornerSW; - else if (hasFloorNorth && hasFloorWest) + else if (hasFloorSouth && hasFloorEast) wallTile = wallCornerSE; else if (hasFloorSouth) wallTile = wallNorth; // Wall is north of floor, so it's a north-facing wall @@ -1091,10 +1094,13 @@ public class DungeonGeneratorV2 // Only fill if there's "supporting" wall structure nearby; prevents random diagonal filling. // The diagonal walkable indicates the interior corner; the adjacent walls indicate we are on the border. - if (floorSE && (wallS || wallE)) PlaceWall(x, y, wallCornerNW); - else if (floorSW && (wallS || wallW)) PlaceWall(x, y, wallCornerNE); - else if (floorNE && (wallN || wallE)) PlaceWall(x, y, wallCornerSW); - else if (floorNW && (wallN || wallW)) PlaceWall(x, y, wallCornerSE); + // Diagonal-walkable indicates the interior corner. Choose the corner wall variant that visually + // connects the two bordering wall runs (this tileset uses the opposite naming compared to the + // earlier assumption, so NW<->SE and NE<->SW). + if (floorSE && (wallS || wallE)) PlaceWall(x, y, wallCornerSE); + else if (floorSW && (wallS || wallW)) PlaceWall(x, y, wallCornerSW); + else if (floorNE && (wallN || wallE)) PlaceWall(x, y, wallCornerNE); + else if (floorNW && (wallN || wallW)) PlaceWall(x, y, wallCornerNW); } } @@ -1126,10 +1132,10 @@ public class DungeonGeneratorV2 TileDefinition? replace = null; // Choose connected outer corners using diagonal floor hints. - if (floorSE && !floorS && !floorE) replace = wallCornerNW; - else if (floorSW && !floorS && !floorW) replace = wallCornerNE; - else if (floorNE && !floorN && !floorE) replace = wallCornerSW; - else if (floorNW && !floorN && !floorW) replace = wallCornerSE; + if (floorSE && !floorS && !floorE) replace = wallCornerSE; + else if (floorSW && !floorS && !floorW) replace = wallCornerSW; + else if (floorNE && !floorN && !floorE) replace = wallCornerNE; + else if (floorNW && !floorN && !floorW) replace = wallCornerNW; if (replace == null) continue; if (replace.Id == id) continue;