summaryrefslogtreecommitdiff
path: root/src/LivingVillage.Desktop/Game.fs
diff options
context:
space:
mode:
Diffstat (limited to 'src/LivingVillage.Desktop/Game.fs')
-rw-r--r--src/LivingVillage.Desktop/Game.fs30
1 files changed, 25 insertions, 5 deletions
diff --git a/src/LivingVillage.Desktop/Game.fs b/src/LivingVillage.Desktop/Game.fs
index 8c0b8a1..94cc451 100644
--- a/src/LivingVillage.Desktop/Game.fs
+++ b/src/LivingVillage.Desktop/Game.fs
@@ -413,6 +413,17 @@ type LivingVillageGame() as this =
let y = MathHelper.Clamp(world.Avatar.Pos.Y + half - vh / 2.0f, 0.0f, max 0.0f (worldH - vh))
camera <- Vector2(x, y)
+ member private this.CenterCameraOnTile (tileX: int) (tileY: int) =
+ let viewport = this.GraphicsDevice.Viewport
+ let vw = float32 viewport.Width
+ let vh = float32 viewport.Height
+ let worldW = float32 (Sim.mapWidthTiles * Sim.tilePixels)
+ let worldH = float32 (Sim.mapHeightTiles * Sim.tilePixels)
+ let half = float32 Sim.tilePixels / 2.0f
+ let x = MathHelper.Clamp(float32 (tileX * Sim.tilePixels) + half - vw / 2.0f, 0.0f, max 0.0f (worldW - vw))
+ let y = MathHelper.Clamp(float32 (tileY * Sim.tilePixels) + half - vh / 2.0f, 0.0f, max 0.0f (worldH - vh))
+ camera <- Vector2(x, y)
+
member private this.ResetWorldView() =
relationView <- false
relationSnapshot <- None
@@ -700,8 +711,10 @@ type LivingVillageGame() as this =
/// P40 证据:真实生成器世界里拍昼 / 夜整帧与乌篷船近景。位置取自确定性摆放纯函数,
/// 含真实 tint 与 P14 光晕;相机贴近船体便于 2x NEAREST 特写。
member private this.PrepareP40Shot () =
- let placeCameraOn (tileX: int) (tileY: int) =
+ let placeAvatarOnLand (tileX: int) (tileY: int) =
world <- { world with Avatar = { world.Avatar with Pos = { X = float32 (tileX * Sim.tilePixels); Y = float32 (tileY * Sim.tilePixels) } } }
+ let placeCameraOn (tileX: int) (tileY: int) =
+ placeAvatarOnLand tileX tileY
this.CenterCamera()
let setHour (hour: float) =
let tick = M6Presentation.resolveStartTick (Some hour) false
@@ -719,21 +732,23 @@ type LivingVillageGame() as this =
match map.Bridges |> List.sortBy (fun (x, y) -> (x, y)) |> List.tryHead with
| Some (bx, by) -> (bx, by)
| None -> (map.Core.MinX, map.Core.MinY)
- let boatShot = (fst boat + 1, snd boat)
match p40Step with
| 0 ->
setHour dayHour
- placeCameraOn (fst boat) (snd boat)
+ placeAvatarOnLand 232 51
+ this.CenterCameraOnTile (fst boat) (snd boat)
p40PendingName <- "p40-day"
p40Pending <- true
| 1 ->
setHour nightHour
- placeCameraOn (fst boat) (snd boat)
+ placeAvatarOnLand 232 51
+ this.CenterCameraOnTile (fst boat) (snd boat)
p40PendingName <- "p40-night"
p40Pending <- true
| 2 ->
setHour dayHour
- placeCameraOn (fst boatShot) (snd boatShot)
+ placeAvatarOnLand 240 51
+ this.CenterCameraOnTile (fst boat + 1) (snd boat)
p40PendingName <- "p40-boat"
p40Pending <- true
| _ ->
@@ -1684,6 +1699,11 @@ type LivingVillageGame() as this =
spriteBatch.Draw(pixel, rect, color)
| _ -> ()
+ match riverscapeMap, profile.LanternGlow > 0.3f with
+ | Some map, true ->
+ VillageArt.drawCc0BoatOverlay spriteBatch artTextures camera map profile.WorldTint
+ | _ -> ()
+
VillageArt.drawGroundShadow spriteBatch pixel camera world.Avatar.Pos
let avatarSpec = VillageArt.avatarSpriteSpec avatarFacing avatarMoving world.Tick
VillageArt.drawCharacter spriteBatch artTextures camera world.Avatar.Pos avatarSpec profile.WorldTint