diff options
Diffstat (limited to 'src/LivingVillage.Desktop/Game.fs')
| -rw-r--r-- | src/LivingVillage.Desktop/Game.fs | 97 |
1 files changed, 97 insertions, 0 deletions
diff --git a/src/LivingVillage.Desktop/Game.fs b/src/LivingVillage.Desktop/Game.fs index 8162351..b51c7f0 100644 --- a/src/LivingVillage.Desktop/Game.fs +++ b/src/LivingVillage.Desktop/Game.fs @@ -333,6 +333,14 @@ type LivingVillageGame() as this = let mutable p46CloudLateDone = false let mutable p46MenuADone = false let mutable p46MenuBDone = false + // P57 证据钩子:LV_P57_SHOT=1 时对同一 splash/menu 帧各拍「高光层关 / 开」两帧 + // (像素差即第二层高光贡献),并打印逐列主水带亮度/高光 alpha/相位供 analyze 计算。 + // p57HighlightDisabled 仅供取证时开关高光层,缺省 false(正常渲染始终开启)。 + let p57ShotMode = Environment.GetEnvironmentVariable("LV_P57_SHOT") = "1" + let mutable p57HighlightDisabled = false + let mutable p57Step = 0 + let mutable p57PendingName = "" + let mutable p57Pending = false // P47 证据钩子:LV_P47_SHOT=1 时在真实生成器世界里拍「白天河道 / 夜晚河道 / 近景」三帧。 let p47ShotMode = Environment.GetEnvironmentVariable("LV_P47_SHOT") = "1" let mutable p47Step = 0 @@ -1030,6 +1038,62 @@ type LivingVillageGame() as this = else p46MenuBDone <- true save p46PendingName + /// P57 取证:把当前水面帧的逐列主水带亮度/高光 alpha/两层相位打印成逗号数组。 + member private this.LogP57Columns (name: string) = + let frame = if splashActive then splashFrame else menuEntranceFrame + let columns = [ 0 .. 39 ] + let fmt (values: float32 list) = + values |> List.map (fun v -> sprintf "%.4f" v) |> String.concat "," + let main = columns |> List.map (fun c -> MenuAmbience.waterColumnBrightness frame c 0) + let hl = columns |> List.map (fun c -> float32 (MenuAmbience.highlightAlpha MenuAmbience.highlightDayLight frame c 0)) + let mainPhase = columns |> List.map (fun c -> MenuAmbience.waterPhase frame c 0) + let hlPhase = columns |> List.map (fun c -> MenuAmbience.highlightPhase frame c 0) + printfn "p57-status=%s pendingName=%s disabled=%b frame=%d main=%s hl=%s mainphase=%s hlphase=%s" + name (if String.IsNullOrEmpty p57PendingName then "-" else p57PendingName) p57HighlightDisabled frame + (fmt main) (fmt hl) (fmt mainPhase) (fmt hlPhase) + + /// P57 证据:Splash 阶段按帧表拍「高光层关 / 开」两帧。 + member private this.PrepareP57Splash () = + if not p57Pending then + match p57Step with + | 0 -> + p57HighlightDisabled <- true + p57PendingName <- P57ShotScript.splashBaseName + p57Pending <- true + | 1 -> + p57HighlightDisabled <- false + p57PendingName <- P57ShotScript.splashHighlightName + p57Pending <- true + | _ -> () + + /// P57 证据:菜单阶段拍「高光层关 / 开」两帧后收尾。 + member private this.PrepareP57Shot () = + if p57Step >= 4 then + printfn "p57-shot=done" + this.Exit() + elif not p57Pending then + match p57Step with + | 2 -> + menuEntranceFrame <- P57ShotScript.menuFrame + p57HighlightDisabled <- true + p57PendingName <- P57ShotScript.menuBaseName + p57Pending <- true + | 3 -> + menuEntranceFrame <- P57ShotScript.menuFrame + p57HighlightDisabled <- false + p57PendingName <- P57ShotScript.menuHighlightName + p57Pending <- true + | _ -> () + + /// P57 证据:Draw 末尾落盘并打印逐列数字。 + member private this.CaptureP57Shot () = + if p57Pending then + p57Pending <- false + System.IO.Directory.CreateDirectory recordDirectory |> ignore + this.SaveBackBuffer(sprintf "%s/%s.png" recordDirectory p57PendingName) + this.LogP57Columns p57PendingName + p57Step <- p57Step + 1 + /// P47 证据:真实生成器世界里拍「白天河道 / 夜晚河道 / 近景」三帧,含 P47 场景细节。 member private this.PrepareP47Shot () = let setHour (hour: float) = @@ -1829,6 +1893,9 @@ type LivingVillageGame() as this = match target with | Some t -> splashFrame <- t | None -> () + if p57ShotMode && splashFrame >= 10L && p57Step < 2 then + splashFrame <- P57ShotScript.splashFrame + this.PrepareP57Splash() let skip = LaunchScreen.skipRequested (pressed Keys.Escape) (pressed Keys.Space) if skip || LaunchScreen.isComplete splashFrame then splashActive <- false @@ -1886,6 +1953,9 @@ type LivingVillageGame() as this = elif p46ShotMode then if menu.Page = MainMenu then this.PrepareP46Shot() + elif p57ShotMode then + if menu.Page = MainMenu then + this.PrepareP57Shot() elif p47ShotMode then if menu.Page = MainMenu then this.DispatchMenuInput Confirm @@ -1940,6 +2010,9 @@ type LivingVillageGame() as this = this.UpdateMenu pressed if menu.Page <> Playing then menuEntranceFrame <- menuEntranceFrame + 1L + // P57 取证:钉住菜单水面帧,令「高光层关/开」两帧渲染同一帧号(差即高光层)。 + if p57ShotMode && menu.Page = MainMenu && p57Step <= 3 then + menuEntranceFrame <- P57ShotScript.menuFrame + 1L match pauseHelpControl with | Some original when menu.Page = Playing -> let _, restoredControl = MenuState.exitPauseHelp original menu @@ -2343,6 +2416,8 @@ type LivingVillageGame() as this = this.CaptureP45Shot() if p46ShotMode then this.CaptureP46Shot() + if p57ShotMode then + this.CaptureP57Shot() if p47ShotMode && menu.Page = Playing then this.CaptureP47Shot() if p52ShotMode && menu.Page = Playing then @@ -2406,6 +2481,17 @@ type LivingVillageGame() as this = spriteBatch.Draw(artTextures.TileAtlas, Rectangle(x, row + lift, Sim.tilePixels, Sim.tilePixels), VillageArt.atlasTileRectangle TitleScreen.waterSlot, crestColor) if MenuAmbience.waterColumnCrest splashFrame column rowIndex then spriteBatch.Draw(pixel, Rectangle(x, row + lift, Sim.tilePixels, 3), Color(225, 240, 245, waterAlpha)) + // P57 第二层高光波光:同列相位错开、更亮更窄的细高光条(昼/夜由 light 衰减)。 + if not p57HighlightDisabled && MenuAmbience.highlightVisible splashFrame column rowIndex then + let hr, hg, hb = MenuAmbience.highlightRgb + let ha = + MenuAmbience.highlightAlpha MenuAmbience.highlightDayLight splashFrame column rowIndex + * waterAlpha / 255 + let barX = x + (Sim.tilePixels - MenuAmbience.highlightBarWidth) / 2 + spriteBatch.Draw( + pixel, + Rectangle(barX, row + lift + MenuAmbience.highlightRowDelta, MenuAmbience.highlightBarWidth, MenuAmbience.highlightThickness), + Color(hr, hg, hb, ha)) // P42 屋檐灯笼呼吸光晕:复用 P14 预乘 alpha 径向路径,随帧与灯序号呼吸。 let lanternColor, _ = TitleScreen.lanternColors @@ -2516,6 +2602,17 @@ type LivingVillageGame() as this = spriteBatch.Draw(artTextures.TileAtlas, Rectangle(x, row + lift, Sim.tilePixels, Sim.tilePixels), VillageArt.atlasTileRectangle TitleScreen.waterSlot, crestColor) if MenuAmbience.waterColumnCrest menuEntranceFrame column rowIndex then spriteBatch.Draw(pixel, Rectangle(x, row + lift, Sim.tilePixels, 3), Color(225, 240, 245, waterAlpha)) + // P57 第二层高光波光(menu)。 + if not p57HighlightDisabled && MenuAmbience.highlightVisible menuEntranceFrame column rowIndex then + let hr, hg, hb = MenuAmbience.highlightRgb + let ha = + MenuAmbience.highlightAlpha MenuAmbience.highlightDayLight menuEntranceFrame column rowIndex + * waterAlpha / 255 + let barX = x + (Sim.tilePixels - MenuAmbience.highlightBarWidth) / 2 + spriteBatch.Draw( + pixel, + Rectangle(barX, row + lift + MenuAmbience.highlightRowDelta, MenuAmbience.highlightBarWidth, MenuAmbience.highlightThickness), + Color(hr, hg, hb, ha)) // P42 bank lanterns breathe through the shared P14 premultiplied-alpha radial path. let lanternColor, _ = TitleScreen.lanternColors |
