Remap elbow corner bucket orientation and add robust candidates
- Invert elbow-to-corner orientation mapping to match floor-touch geometry - Try multiple corner bucket candidates (diagonal + inner-corner families) per elbow mask - Preserve existing cardinal and 8-direction fallback behavior
This commit is contained in:
@@ -557,10 +557,10 @@ public class DungeonGeneratorVNext
|
||||
TileDefinition? wallDef = null;
|
||||
|
||||
// Elbow masks should prefer corner buckets before broad cardinal buckets.
|
||||
string? elbowBucket = ResolveElbowBucketName(mask4);
|
||||
if (!string.IsNullOrEmpty(elbowBucket))
|
||||
foreach (var elbowBucket in ResolveElbowBucketCandidates(mask4))
|
||||
{
|
||||
wallDef = SelectWallDefinitionForBucket(tileContext, elbowBucket);
|
||||
if (wallDef != null) break;
|
||||
}
|
||||
|
||||
wallDef ??= SelectWallDefinitionForBucket(tileContext, bucketName);
|
||||
@@ -872,16 +872,44 @@ public class DungeonGeneratorVNext
|
||||
return null;
|
||||
}
|
||||
|
||||
private static string? ResolveElbowBucketName(int mask4)
|
||||
private static IReadOnlyList<string> ResolveElbowBucketCandidates(int mask4)
|
||||
{
|
||||
// mask4 bit order: N,E,S,W
|
||||
return mask4 switch
|
||||
{
|
||||
0b0110 => "WallDiagonalCornerUpLeft", // E + S
|
||||
0b0011 => "WallDiagonalCornerUpRight", // S + W
|
||||
0b1100 => "WallDiagonalCornerDownLeft", // N + E
|
||||
0b1001 => "WallDiagonalCornerDownRight",// N + W
|
||||
_ => null
|
||||
// For a cell touching floor on E+S, the visible cap points down-right.
|
||||
0b0110 => new[]
|
||||
{
|
||||
"WallDiagonalCornerDownRight",
|
||||
"WallInnerCornerDownRight",
|
||||
"WallDiagonalCornerUpLeft",
|
||||
"WallInnerCornerDownLeft"
|
||||
},
|
||||
// Floor on S+W -> cap points down-left.
|
||||
0b0011 => new[]
|
||||
{
|
||||
"WallDiagonalCornerDownLeft",
|
||||
"WallInnerCornerDownLeft",
|
||||
"WallDiagonalCornerUpRight",
|
||||
"WallInnerCornerDownRight"
|
||||
},
|
||||
// Floor on N+E -> cap points up-right.
|
||||
0b1100 => new[]
|
||||
{
|
||||
"WallDiagonalCornerUpRight",
|
||||
"WallInnerCornerDownRight",
|
||||
"WallDiagonalCornerDownLeft",
|
||||
"WallInnerCornerDownLeft"
|
||||
},
|
||||
// Floor on N+W -> cap points up-left.
|
||||
0b1001 => new[]
|
||||
{
|
||||
"WallDiagonalCornerUpLeft",
|
||||
"WallInnerCornerDownLeft",
|
||||
"WallDiagonalCornerDownRight",
|
||||
"WallInnerCornerDownRight"
|
||||
},
|
||||
_ => Array.Empty<string>()
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user