Handle elbow wall masks with corner-bucket preference
- Map 2-neighbor elbow cardinal masks to diagonal corner buckets before broad WallTop/WallSide fallback - Preserve existing two-pass resolver while improving bend transitions
This commit is contained in:
@@ -555,6 +555,17 @@ public class DungeonGeneratorVNext
|
|||||||
}
|
}
|
||||||
|
|
||||||
var wallDef = SelectWallDefinitionForBucket(tileContext, bucketName);
|
var wallDef = SelectWallDefinitionForBucket(tileContext, bucketName);
|
||||||
|
if (wallDef == null)
|
||||||
|
{
|
||||||
|
// Elbow masks (two-cardinal-neighbor corners) should prefer explicit corner buckets
|
||||||
|
// before falling back to broad cardinal buckets.
|
||||||
|
string? elbowBucket = ResolveElbowBucketName(mask4);
|
||||||
|
if (!string.IsNullOrEmpty(elbowBucket))
|
||||||
|
{
|
||||||
|
wallDef = SelectWallDefinitionForBucket(tileContext, elbowBucket);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (wallDef == null)
|
if (wallDef == null)
|
||||||
{
|
{
|
||||||
unresolved.Add(cell);
|
unresolved.Add(cell);
|
||||||
@@ -851,6 +862,19 @@ public class DungeonGeneratorVNext
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static string? ResolveElbowBucketName(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
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
private static string? ResolveEightDirectionBucketName(int mask8)
|
private static string? ResolveEightDirectionBucketName(int mask8)
|
||||||
{
|
{
|
||||||
foreach (var mapping in EightDirectionBucketMasks)
|
foreach (var mapping in EightDirectionBucketMasks)
|
||||||
|
|||||||
Reference in New Issue
Block a user