summaryrefslogtreecommitdiff
path: root/src/LivingVillage.Desktop/Game.fs
diff options
context:
space:
mode:
authorSomhairle H. Marisol <[email protected]>2026-09-28 19:46:21 +0800
committerSomhairle H. Marisol <[email protected]>2026-09-28 19:46:21 +0800
commit997d2ae917a04baf77f99349ed00ea5df8892cfc (patch)
tree95ff5cc13cd4f1425d06782d4ef4bd2795511a72 /src/LivingVillage.Desktop/Game.fs
parentf8ef6b68167b122eaeaa400db41c5d8481c9baa9 (diff)
downloadliving-village-997d2ae917a04baf77f99349ed00ea5df8892cfc.tar.gz
p45: 角色动画帧升级 — 四向x(走4+待机2)原创点阵内嵌图集, 行走/停止/idle 接入渲染
Diffstat (limited to 'src/LivingVillage.Desktop/Game.fs')
-rw-r--r--src/LivingVillage.Desktop/Game.fs70
1 files changed, 70 insertions, 0 deletions
diff --git a/src/LivingVillage.Desktop/Game.fs b/src/LivingVillage.Desktop/Game.fs
index 00ae04b..3e39b09 100644
--- a/src/LivingVillage.Desktop/Game.fs
+++ b/src/LivingVillage.Desktop/Game.fs
@@ -316,6 +316,11 @@ type LivingVillageGame() as this =
let mutable p44Step = 0
let mutable p44PendingName = ""
let mutable p44Pending = false
+ // P45 证据钩子:LV_P45_SHOT=1 时拍角色 idle / 行走朝下 / 行走朝右 三帧(真实游戏截图)。
+ let p45ShotMode = Environment.GetEnvironmentVariable("LV_P45_SHOT") = "1"
+ let mutable p45Step = 0
+ let mutable p45PendingName = ""
+ let mutable p45Pending = false
let mutable autoplayFrames = 0
let mutable flowStep = 0
let mutable flowHold = 0
@@ -894,6 +899,61 @@ type LivingVillageGame() as this =
(m5View.Prompt |> Option.defaultValue "<none>")
p44Step <- p44Step + 1
+ member private this.PrepareP45Shot () =
+ let baseTick = M6Presentation.resolveStartTick (Some 12.0) false
+ let setTick (tick: int64) =
+ world <- { world with Tick = tick; Time = float tick * Sim.dtSeconds }
+ if not p45Pending then
+ match p45Step with
+ | 0 ->
+ setTick baseTick
+ world <-
+ { world with
+ Avatar = { world.Avatar with Pos = { X = float32 (100 * Sim.tilePixels); Y = float32 (100 * Sim.tilePixels) } } }
+ avatarFacing <- VillageArt.SouthFacing
+ avatarMoving <- false
+ this.CenterCamera()
+ p45PendingName <- "p45-char-a"
+ p45Pending <- true
+ | 1 ->
+ setTick (baseTick + 4L)
+ avatarFacing <- VillageArt.SouthFacing
+ avatarMoving <- true
+ this.CenterCamera()
+ p45PendingName <- "p45-char-b"
+ p45Pending <- true
+ | 2 ->
+ setTick (baseTick + 8L)
+ avatarFacing <- VillageArt.EastFacing
+ avatarMoving <- true
+ this.CenterCamera()
+ p45PendingName <- "p45-char-c"
+ p45Pending <- true
+ | _ ->
+ printfn "p45-shot=done"
+ this.Exit()
+
+ /// P45 证据:在 `Draw` 末尾落盘,并打印角色目标矩形 / 朝向 / 帧,供裁剪与帧差分析。
+ member private this.CaptureP45Shot () =
+ if p45Pending then
+ p45Pending <- false
+ System.IO.Directory.CreateDirectory recordDirectory |> ignore
+ this.SaveBackBuffer(sprintf "%s/%s.png" recordDirectory p45PendingName)
+ let dest = VillageArt.characterDestination world.Avatar.Pos camera
+ let spec = VillageArt.avatarSpriteSpec avatarFacing avatarMoving world.Tick
+ printfn
+ "p45-shot=%s tick=%d facing=%s moving=%b dest=%d,%d,%d,%d frame=%s"
+ p45PendingName
+ world.Tick
+ (sprintf "%A" avatarFacing)
+ avatarMoving
+ dest.X
+ dest.Y
+ dest.Width
+ dest.Height
+ (sprintf "%A" spec.Frame)
+ p45Step <- p45Step + 1
+
/// P20 第三步取证:真走位巡游(Sim.step 驱动)沿桥/路/民居门移动,用于桥面行走帧与昼夜录制。
member private this.RunRiverscapeTour () =
if not riverscapeTourWatchStarted then
@@ -1254,6 +1314,14 @@ type LivingVillageGame() as this =
else this.DispatchMenuInput Confirm
elif menu.Page = Playing then
this.PrepareP44Shot()
+ elif p45ShotMode then
+ if menu.Page = MainMenu then
+ this.DispatchMenuInput Confirm
+ elif menu.Page = OccupationSelect then
+ if menu.Selected <> 0 then this.DispatchMenuInput Down
+ else this.DispatchMenuInput Confirm
+ elif menu.Page = Playing then
+ this.PrepareP45Shot()
elif menu.Page = Playing then
this.UpdatePlaying gameTime kb pressed pressedAny
elif menuShotMode then
@@ -1661,6 +1729,8 @@ type LivingVillageGame() as this =
this.CaptureP43Shot()
if p44ShotMode && menu.Page = Playing then
this.CaptureP44Shot()
+ if p45ShotMode && menu.Page = Playing then
+ this.CaptureP45Shot()
/// 启动画面:分层天色 + 屋脊/水面剪影 + 标题淡入上浮 + 跳过提示,全部为帧计数纯函数。
member private this.DrawSplash() =