diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/LivingVillage.Desktop.Tests/PrototypeTests.fs | 31 | ||||
| -rw-r--r-- | src/LivingVillage.Desktop/Assets/jiangnan-world.png | bin | 3394 -> 3847 bytes | |||
| -rw-r--r-- | src/LivingVillage.Desktop/VillageArt.fs | 25 |
3 files changed, 49 insertions, 7 deletions
diff --git a/src/LivingVillage.Desktop.Tests/PrototypeTests.fs b/src/LivingVillage.Desktop.Tests/PrototypeTests.fs index 88f6016..25f4d02 100644 --- a/src/LivingVillage.Desktop.Tests/PrototypeTests.fs +++ b/src/LivingVillage.Desktop.Tests/PrototypeTests.fs @@ -473,8 +473,9 @@ type PrototypeTests () = Assert.IsTrue(footprint.Contains({ X = door.X + dx; Y = door.Y - 2 } : TilePosition), sprintf "missing ridge tile dx=%d" dx) Assert.IsTrue(footprint.Contains({ X = door.X + dx; Y = door.Y - 1 } : TilePosition), sprintf "missing eave tile dx=%d" dx) Assert.IsTrue(footprint.Contains({ X = door.X + dx; Y = door.Y } : TilePosition), sprintf "missing wall tile dx=%d" dx) - // 12 house + 3 bridge + 3 bamboo + 2 garden + 2x2 willow + 2 shrub + 2 flowers + 2 reeds + 1 bench + 2 lanterns. - Assert.AreEqual<int>(33, footprint.Count) + // 12 house + 3 bridge + 3 bamboo + 2 garden + 2x2 willow + 2 shrub + 2 flowers + 2 reeds + // + 1 bench + 2 lanterns + 2 stone lanterns + 1 water vat + 1 market stall (P17). + Assert.AreEqual<int>(37, footprint.Count) [<TestMethod>] member _.VegetationAndRiversidePropsDecorateTheScene () = @@ -489,13 +490,20 @@ type PrototypeTests () = Assert.AreEqual<int>(2, count VillageArt.ReedCluster) Assert.AreEqual<int>(1, count VillageArt.StoneBench) Assert.AreEqual<int>(2, count VillageArt.RiverLantern) + Assert.AreEqual<int>(2, count VillageArt.StoneLantern) + Assert.AreEqual<int>(1, count VillageArt.WaterVat) + Assert.AreEqual<int>(1, count VillageArt.MarketStall) - // Reeds must root in water; lanterns stand on the bank path. + // Reeds must root in water; lanterns and P17 street details stand on the paved bank path. for prop in plan.Props do let tile = VillageArt.worldTile plan prop.Position match prop.Kind with | VillageArt.ReedCluster -> Assert.IsTrue(grounds.Contains(prop.Position), "reeds must sit on water tiles") - | VillageArt.RiverLantern -> Assert.IsTrue(plan.Grounds |> List.contains (prop.Position, VillageArt.StonePath), "lanterns must stand on the bank path") + | VillageArt.RiverLantern + | VillageArt.StoneLantern + | VillageArt.WaterVat + | VillageArt.MarketStall -> + Assert.IsTrue(plan.Grounds |> List.contains (prop.Position, VillageArt.StonePath), "street details must stand on the bank path") | _ -> () [<TestMethod>] @@ -1019,6 +1027,21 @@ type PrototypeTests () = Assert.AreEqual<string list>([], missing, sprintf "Missing Jiangnan PNG assets: %s" (String.concat ", " missing)) + // The baked world atlas must match the 28-slot layout the renderer indexes into + // (P17 added 石灯笼/水缸/摊贩摊位 as slots 25..27). + Assert.AreEqual<int>(28, VillageArt.worldTileCount) + let worldPath = Path.Combine(AppContext.BaseDirectory, "Assets/jiangnan-world.png") + let header = File.ReadAllBytes worldPath + let be32 offset = + (int header.[offset] <<< 24) + ||| (int header.[offset + 1] <<< 16) + ||| (int header.[offset + 2] <<< 8) + ||| int header.[offset + 3] + let atlasWidth : int = be32 16 + let atlasHeight : int = be32 20 + Assert.IsTrue((atlasWidth = VillageArt.worldAtlasWidth), "world atlas width must match 28 x 32px slots") + Assert.IsTrue((atlasHeight = VillageArt.worldAtlasHeight), "world atlas height must stay 32px") + [<TestMethod>] member _.CjkGlyphManifestIsUniqueAndMatchesAtlasGrid () = // 防复发:图集用字增长时,清单必须非空、每行恰 1 个字符、字符唯一, diff --git a/src/LivingVillage.Desktop/Assets/jiangnan-world.png b/src/LivingVillage.Desktop/Assets/jiangnan-world.png Binary files differindex 9138560..6e97728 100644 --- a/src/LivingVillage.Desktop/Assets/jiangnan-world.png +++ b/src/LivingVillage.Desktop/Assets/jiangnan-world.png diff --git a/src/LivingVillage.Desktop/VillageArt.fs b/src/LivingVillage.Desktop/VillageArt.fs index 4845408..489da23 100644 --- a/src/LivingVillage.Desktop/VillageArt.fs +++ b/src/LivingVillage.Desktop/VillageArt.fs @@ -45,6 +45,9 @@ module VillageArt = | ReedCluster | StoneBench | RiverLantern + | StoneLantern + | WaterVat + | MarketStall type RenderProp = { Kind: RenderPropKind @@ -135,6 +138,9 @@ module VillageArt = | SmokeSpriteA | SmokeSpriteB | SmokeSpriteC + | StoneLanternSprite + | WaterVatSprite + | StallSprite type private XnaColor = Microsoft.Xna.Framework.Color type private XnaRectangle = Microsoft.Xna.Framework.Rectangle @@ -228,7 +234,11 @@ module VillageArt = renderProp ReedCluster 15 13 renderProp StoneBench 9 11 renderProp RiverLantern 5 11 - renderProp RiverLantern 7 14 ] + renderProp RiverLantern 7 14 + renderProp StoneLantern 4 14 + renderProp StoneLantern 16 14 + renderProp WaterVat 12 11 + renderProp MarketStall 3 11 ] Interior = { Elements = [ interiorElement Window 2 2 @@ -260,7 +270,10 @@ module VillageArt = | FlowerBush | ReedCluster | StoneBench - | RiverLantern -> [ position x y ]) + | RiverLantern + | StoneLantern + | WaterVat + | MarketStall -> [ position x y ]) |> many let private positiveModulo divisor value = @@ -445,7 +458,7 @@ module VillageArt = let characterAtlasRelativePath = "Assets/jiangnan-characters.png" let interiorAtlasRelativePath = "Assets/jiangnan-interior.png" - let worldTileCount = 25 + let worldTileCount = 28 let worldAtlasWidth = Sim.tilePixels * worldTileCount let worldAtlasHeight = Sim.tilePixels let characterAtlasWidth = 32 * 5 * 4 * 6 @@ -516,6 +529,9 @@ module VillageArt = | SmokeSpriteA -> 22 | SmokeSpriteB -> 23 | SmokeSpriteC -> 24 + | StoneLanternSprite -> 25 + | WaterVatSprite -> 26 + | StallSprite -> 27 XnaRectangle(index * Sim.tilePixels, 0, Sim.tilePixels, Sim.tilePixels) let private tilePosition x y : TilePosition = @@ -653,6 +669,9 @@ module VillageArt = | ReedCluster -> drawSingleTile prop.Position ReedSprite | StoneBench -> drawSingleTile prop.Position BenchSprite | RiverLantern -> drawSingleTile prop.Position LanternSprite + | StoneLantern -> drawSingleTile prop.Position StoneLanternSprite + | WaterVat -> drawSingleTile prop.Position WaterVatSprite + | MarketStall -> drawSingleTile prop.Position StallSprite // Chimney smoke is a late pass so it always reads above the roof, the bamboo and // any other prop sharing its tile. The puff sits one row above the ridge centre |
