Fix elbow wall corner precedence and fallback flow

- Apply elbow->corner bucket mapping before cardinal bucket selection

- Add 8-direction fallback in pass1 when cardinal candidate exists but has no definition

- Keep pass2 unresolved resolution unchanged
This commit is contained in:
dingo
2026-02-10 07:59:51 -05:00
parent a2e206daf1
commit 191f919206
+15 -5
View File
@@ -554,16 +554,26 @@ public class DungeonGeneratorVNext
continue; continue;
} }
var wallDef = SelectWallDefinitionForBucket(tileContext, bucketName); TileDefinition? wallDef = null;
if (wallDef == null)
{ // Elbow masks should prefer corner buckets before broad cardinal buckets.
// Elbow masks (two-cardinal-neighbor corners) should prefer explicit corner buckets
// before falling back to broad cardinal buckets.
string? elbowBucket = ResolveElbowBucketName(mask4); string? elbowBucket = ResolveElbowBucketName(mask4);
if (!string.IsNullOrEmpty(elbowBucket)) if (!string.IsNullOrEmpty(elbowBucket))
{ {
wallDef = SelectWallDefinitionForBucket(tileContext, elbowBucket); wallDef = SelectWallDefinitionForBucket(tileContext, elbowBucket);
} }
wallDef ??= SelectWallDefinitionForBucket(tileContext, bucketName);
if (wallDef == null)
{
// Try any 8-direction bucket before deferring to pass 2.
int fallbackMask8 = ComputeEightDirectionMask(layout, cell.X, cell.Y);
string? any8Bucket = ResolveEightDirectionBucketName(fallbackMask8);
if (!string.IsNullOrEmpty(any8Bucket))
{
wallDef = SelectWallDefinitionForBucket(tileContext, any8Bucket);
}
} }
if (wallDef == null) if (wallDef == null)