forked from TeJota1337/DramaticShapeVoxelMod
-
Notifications
You must be signed in to change notification settings - Fork 32
Expand file tree
/
Copy pathmain.lua
More file actions
2222 lines (2120 loc) · 105 KB
/
Copy pathmain.lua
File metadata and controls
2222 lines (2120 loc) · 105 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
-- DRAMATIC SHAPE VOXEL MOD BATTLE ART: a full 3D diorama overworld, shipped as a
-- rendering pipeline mod.
--
-- The engine's render_pipelines registry (src/mods/Schemas.lua) lets a mod
-- own part of the frame. This mod registers two:
--
-- voxel a drawWorld pipeline. Instead of the flat tile blit, the
-- overworld's terrain is extruded into real geometry, walked
-- by a depth-buffered 3D camera, with characters as leaning
-- sprite slabs and a shadow map throwing real cast shadows
-- across whatever they land on. Occlusion is the depth
-- buffer, not a y-sort: walk behind a building and the
-- building is simply in front.
--
-- tiltshift a worldPresent pipeline -- the stage that post-processes
-- the finished world BEFORE the UI composites over it. A
-- tilt-shift blur that sells the miniature-model look, on the
-- diorama only, leaving text boxes and menus crisp.
--
-- Everything a display mode needs beyond the two draw functions -- the
-- OFF/15/35/50 ladder, the options rows, the hotkeys, persistence in
-- save.options.pipelines, the free-roam gate, the mutual exclusion with
-- the engine's TILT mode -- is engine plumbing driven by the records
-- below. This file declares; lib/ draws.
--
-- Voxel mode is presentational: it changes what the world LOOKS like and
-- nothing about what it IS. ONE rung is the deliberate exception. 1ST --
-- the first-person camera -- replaces the grid WALK with a free,
-- camera-relative one while it is selected (lib/FreeMove.lua), because a
-- head you can steer with a mouse demands feet that go where it looks.
-- Even there the game is untouched: the walk asks the engine's own
-- collision the same questions a grid step asks, keeps the player's
-- logical cell synced, and fires the engine's own landing pipeline per
-- cell crossed -- warps, encounters, ledges, gates and scripts all run
-- exactly as themselves. Step off the rung and the grid walk is back.
local mod = ...
-- ------- the mod namespace
--
-- lib/ modules require each other through V rather than package.path: a
-- mod directory is not on it, and may live inside a mounted .love archive
-- that plain require cannot reach. Each module is loaded once, with V
-- passed in as its vararg (`local V = ...`).
local V = { mod = mod, path = mod.path }
local function chunkFor(rel)
local source = mod:read(rel)
if not source then
error(("BATTLE_ART_VOXEL_FORK: %s is missing -- reinstall the mod"):format(rel), 0)
end
local chunk, err = load(source, "@" .. mod.path .. "/" .. rel)
if not chunk then
error(("BATTLE_ART_VOXEL_FORK: %s did not compile: %s"):format(rel, tostring(err)), 0)
end
return chunk
end
local modules = {}
function V.require(name)
local hit = modules[name]
if hit ~= nil then return hit end
local value = chunkFor("lib/" .. name .. ".lua")(V)
modules[name] = value
return value
end
local dataFiles = {}
function V.data(name)
local hit = dataFiles[name]
if hit ~= nil then return hit end
local value = chunkFor("data/" .. name .. ".lua")(V)
dataFiles[name] = value
return value
end
-- ------- pipelines
local Voxel = V.require("VoxelState")
local Voxel3D = V.require("Voxel3D")
local VoxelScene = V.require("VoxelScene")
local TiltShift = V.require("TiltShift")
local ChunkMesher = V.require("ChunkMesher")
local VoxelPrecache = V.require("VoxelPrecache")
local VoxelLoadingVeil = V.require("VoxelLoadingVeil")
local VoxelTransitionGate = V.require("VoxelTransitionGate")
local VoxelPrecacheScreen = V.require("VoxelPrecacheScreen")
local VoxelCacheRamScreen = V.require("VoxelCacheRamScreen")
local VoxelMeshDisk = V.require("VoxelMeshDisk")
local ModSetting = V.require("ModSetting")
local RamPrecache = V.require("RamPrecache")
local StaticGeometry = V.require("StaticGeometry")
local VoxelGrid = V.require("VoxelGrid")
local WorldCurve = V.require("WorldCurve")
local WorldUnderlay = V.require("WorldUnderlay")
local RenderDistance = V.require("RenderDistance")
local OverworldBattle = V.require("OverworldBattle")
local PokeballSettings = V.require("PokeballSettings")
local LegendaryPokeballs = V.require("LegendaryPokeballs")
local BattlePresentation = V.require("BattlePresentation")
local BattleStage = V.require("BattleStage")
local BattleArt = V.require("BattleArt")
local StadiumModels = V.require("StadiumModels")
local StadiumBackground = V.require("StadiumBackground")
local InterfaceSprites = V.require("InterfaceSprites")
local UiBackplates = V.require("UiBackplates")
local BattleExit = V.require("BattleExit")
local DayNight = V.require("DayNight")
local DayTint = V.require("DayTint")
local Water = V.require("Water")
local Shadows = V.require("Shadows")
local AntiAlias = V.require("AntiAlias")
local FirstPerson = V.require("FirstPerson")
local FreeMove = V.require("FreeMove")
local PoisonFlash = V.require("PoisonFlash")
local MomHealFlash = V.require("MomHealFlash")
local HealOverlay = V.require("HealOverlay")
local TransformCompat = V.require("TransformCompat")
local VoxelCompanion = V.require("VoxelCompanion")
local CompanionLifecycle = V.require("CompanionLifecycle")
local CharacterRenderers = V.require("CharacterRenderers")
local CommunityVisuals = V.require("CommunityVisuals")
local ForestAtmos = V.require("ForestAtmos")
local TowerFogSettings = V.require("TowerFogSettings")
local LegendaryVisualsPreset = V.require("LegendaryVisualsPreset")
-- The public provider is created while this mod loads, before consumers resolve
-- optional dependencies. The dispatcher starts at mods.loaded; a consumer that
-- registers later in that event joins the running dispatcher automatically.
local Companion = VoxelCompanion.new({ mod = mod })
V.companion = Companion
-- mods.loaded runs before Game.overworld necessarily has a live map. Use the
-- engine's public per-frame hook to retry after the real overworld update and
-- to observe later map/revision changes. This must not depend on a render
-- pipeline being active: KFP can attach while Battle Art's voxel mode is off.
local uninstallCompanion = CompanionLifecycle.install(mod, Companion)
V.require("CeladonParkAudio").install(mod)
V.require("ForestLifeAudio").install(mod)
V.require("KantoLifeAudio").install(mod)
local uninstallOptionsMenu
-- `core.quit_to_launcher` is the engine's native mod-unload boundary. Retain
-- the exact disposer returned above and run it before this loader is replaced,
-- so claims, adapter GPU resources, and the update hook cannot survive unload.
mod.hooks:wrap("core.quit_to_launcher", function(next)
if uninstallOptionsMenu then uninstallOptionsMenu() end
V.require("CeladonParkAudio").dispose()
V.require("ForestLifeAudio").dispose()
V.require("KantoLifeAudio").dispose()
V.require("KantoLife").invalidate()
V.require("ForestLife").invalidate()
uninstallCompanion()
return next()
end)
-- `mods.loaded` is the first point at which every content mod has finished
-- patching the registries and the last point before a save can mutate live map
-- blocks. Persistent voxel meshes are keyed exclusively from this snapshot.
mod.events:on("mods.loaded", function(payload)
StaticGeometry.capture(payload and payload.data)
-- Sprite providers commonly wrap BattleState.update from their main chunk.
-- Reassert BATTLE ART ownership outside the completed chain so ordinary and
-- shiny opponent fronts cannot alternate after those providers advance.
OverworldBattle.refreshSpriteOwnershipHook()
local started, err = Companion:start()
if not started and mod.log and mod.log.error then
mod.log:error("Voxel Companion host did not start: %s", tostring(err))
end
end)
-- Forward declaration: the voxel pipeline's update hook (registered below)
-- calls this, and it is defined further down with the settings it drives.
-- Declared rather than left global -- a mod writing to _G would leak into
-- every other mod's namespace.
local applyFull
-- WORLD depends on the engine's flat battle compositing the frozen overworld
-- behind its UI. A staged 3D battle owns that space instead, so WORLD cannot
-- be represented and falls back to WHITE. BLACK is an ordinary opaque
-- letterbox and remains a valid explicit choice.
local function ensureBattleBgCompatible(opts)
if opts and opts.battleBg == "world" then
opts.battleBg = "white"
return true
end
return false
end
-- The last VOID FILL the terrain was meshed under; see the update hook.
-- The scene canvas's size, in FRAMEBUFFER PIXELS.
--
-- `ctx.width/height` are the window measured in LOVE UNITS
-- (love.graphics.getDimensions), but the engine composites a pipeline's
-- returned canvas with `draw(canvas, 0, 0, 0, 1/dpiX, 1/dpiY)` -- a scale
-- that only covers the window when the canvas is at PIXEL resolution.
-- Sizing it in units costs the DPI scale TWICE: the canvas is that much
-- smaller, then it is drawn that much smaller again, so the diorama lands
-- in the top-left corner at 1/dpi of the screen. Desktop never sees it --
-- units and pixels are the same thing there -- but on Android the DPI scale
-- is the display density (2.625 on a 420dpi panel), and the world came out
-- a third of the size in each direction.
--
-- So ask for the pixel dimensions rather than trusting the ctx. That is
-- the number a fixed engine would hand over, so this keeps working either
-- way instead of double-correcting. It also squares the FX pass: ctx.scale
-- is ALREADY in pixels per world pixel (Zoom.scale over Renderer:fitScale,
-- which measures the drawable), so the closures ctx.drawFx runs were being
-- scaled for a canvas 2.6x bigger than the one they drew into.
local function sceneSize(ctx)
if love.graphics and love.graphics.getPixelDimensions then
local pw, ph = love.graphics.getPixelDimensions()
if pw and ph and pw > 0 and ph > 0 then return pw, ph end
end
return ctx.width, ctx.height
end
-- A naming screen is a foreground state, but render-pipeline drawWorld calls
-- still receive the live OverworldState as ctx.state. Checking only that
-- object therefore misses caught-Pokemon naming: the overworld is complete,
-- so the voxel pass clears and redraws the frame behind (and, with some UI
-- renderers, after) the native naming canvas. Colosseum's replacement flow
-- happens to draw at the final HUD stage, which is why that one mode survives.
--
-- Resolve ownership from the authoritative screen stack instead. Native and
-- third-party Gen I naming screens do not consistently expose screenId, so the
-- grid/confirm/update contract is the stable fallback. Colosseum-tagged flows
-- are deliberately exempt: that renderer already owns the final overlay and
-- its approved live voxel background must remain unchanged.
local function colosseumNamingState(state)
return type(state) == "table" and (
state.__colosseumFlowKind == "naming"
or state.__colosseumCaughtNaming == true
or state.__colosseumGiftNaming == true
or state.__colosseumIntroSafe == true
or state.__colosseumNicknamePrompt == true
or state.__colosseumNicknameChoice == true
)
end
local function nativeNamingState(state)
if type(state) ~= "table" or colosseumNamingState(state) then return false end
local id = tostring(state.screenId or state.id or ""):lower()
if id == "naming" or id == "namingscreen"
or id:find("naming", 1, true) then
return true
end
local namingContract = type(state.grid) == "function"
and type(state.confirm) == "function"
and type(state.update) == "function"
local namingData = type(state.glyphs) == "table"
or state.maxLen ~= nil or state.maxLength ~= nil
or type(state.onDone) == "function"
return namingContract and namingData
end
local function nativeNamingOwnsFrame(ctxState)
local okGame, Game = pcall(require, "src.core.Game")
if not okGame or type(Game) ~= "table" then
return nativeNamingState(ctxState)
end
local stack = Game.stack
local states = stack and stack.states
local top
if stack and type(stack.top) == "function" then
local okTop, value = pcall(stack.top, stack)
if okTop then top = value end
end
if not top and type(states) == "table" then top = states[#states] end
-- Preserve the already-working Colosseum flow exactly, including the live
-- voxel field visible behind its translucent naming deck.
if colosseumNamingState(top) then return false end
if nativeNamingState(top) then return true end
if type(states) == "table" then
-- Preset/choice menus may temporarily sit above NamingScreen. Inspect the
-- complete active stack rather than assuming the naming object is on top.
for i = #states, 1, -1 do
local state = states[i]
if colosseumNamingState(state) then return false end
if nativeNamingState(state) then return true end
-- BattleState deliberately raises this while its stock nickname prompt
-- and native naming flow own the canvas. It remains the reliable bridge
-- on engine builds whose NamingScreen exposes neither ID nor metadata.
if type(state) == "table" and state.blankForAskName == true then
return true
end
end
end
return nativeNamingState(ctxState)
end
V.nativeNamingOwnsFrame = nativeNamingOwnsFrame
local voidFill = { last = nil }
function voidFill.check()
local TileRenderer = require("src.render.TileRenderer")
local now = TileRenderer.voidFill
if voidFill.last ~= nil and now ~= voidFill.last then
-- Only the FULL-slot apron ring depends on void fill (see
-- Disk.fingerprint and ChunkMesher.invalidateVoidRings); body/aux stay
-- drawn while just the ring rebuilds, so toggling never stutters every map.
ChunkMesher.invalidateVoidRings()
end
voidFill.last = now
end
mod.content.render_pipelines:register("voxel", {
label = "VOXEL",
levels = Voxel.ANGLE_LABELS,
-- 3 is the engine's TILT key, which this mode supersedes -- see the
-- hotkey block near the bottom of this file for how it is claimed
hotkey = "3",
-- above tiltshift, so the two sort together in the options list with the
-- mode first and its post-process under it
priority = 20,
-- Headless runs and drivers without a depth canvas or shader support
-- answer false here, and the engine keeps the vanilla 2D path -- which
-- is why no caller ever has to guard for a missing 3D pass.
available = function()
return Voxel3D.available()
end,
-- the engine hands over the live level; we ease the camera toward it.
-- pump() advances queued mesh builds inside a few-millisecond budget,
-- so entering voxel mode (and streaming neighbours while walking)
-- costs frames nothing visible -- the old synchronous build froze the
-- first frame for seconds. prefetch() runs here as well as in the
-- draw, because update ticks even while a warp's Transition covers
-- the screen: the destination's meshes start building the moment the
-- map swaps behind the fade, and the fade-covered frames get a wider
-- pump slice -- so stepping out of a door lands on terrain that is
-- already there instead of a flat flash.
update = function(dt, level)
-- WORLD is only valid for the engine's flat 2D battle and composites as
-- broken bars with the 3D diorama (there is no frozen overworld to show
-- through). Correct that incompatible mode at the top of every update
-- tick -- not gated on FULL -- while preserving the valid BLACK option.
-- Persists on change only, never every frame.
local Game = require("src.core.Game")
local o = Game.save and Game.save.options
if ensureBattleBgCompatible(o) then
if Game.writeOptions then pcall(Game.writeOptions, Game) end
end
-- FULL is a preset, so it is applied ON THE PRESS rather than held every
-- frame: it SETS the other rows and then leaves them alone. Holding them
-- would make the zoom keys and the wheel dead while the mode was on, and
-- would fight anyone who changed one deliberately.
applyFull(level)
Voxel.update(dt, level)
local transitionGame = require("src.core.Game")
local transitionWorld = transitionGame and transitionGame.overworld
VoxelTransitionGate.update(dt, Voxel.active() and Voxel3D.available(),
transitionWorld and transitionWorld.map)
-- the first-person head, on the same tick: its blend in and out of the
-- orbit, the mouse capture lifecycle, and the frame's stick-rate look.
-- Unconditional like Voxel.update, because the blend has to keep easing
-- OUT after the rung is left
FirstPerson.update(dt)
-- the day/night clock, on the same always-running tick: Pipelines.update
-- runs whatever the level, so time passes with the mode off, through
-- battles and menus, and a CYCLE evening falls mid-fight exactly as it
-- would mid-walk
DayNight.update(dt)
-- Viridian's leaf shimmer, haze and optional volumetric pass use their
-- own clock so animations continue smoothly through dialogue and battles.
ForestAtmos.update(dt)
-- The overworld battle rides this hook rather than owning a pipeline of
-- its own, because it owns no pass of the FRAME: it draws under a battle
-- screen the engine composites, which is not a stage the registry has.
-- What it needs is a tick that keeps running once the overworld stops
-- being the top state, and this is one -- Game:update calls
-- Pipelines.update unconditionally, so it survives the transition wipe
-- and the whole battle. Ahead of the active() gate below, because a 3D
-- battle does not require the free-roam mode to be switched on.
OverworldBattle.update(dt)
-- VOID FILL picks the block the border ring is made of, and in this
-- mode that ring is BAKED INTO THE MESH rather than drawn each frame.
-- So the option has to reach the cache or nothing happens on screen
-- until the meshes are dropped for some other reason -- which reads
-- exactly like the option doing nothing at all. Polled rather than
-- hooked because the engine changes it from three places (the options
-- row, applyOptions on load, TileRenderer.setVoidFill) and none of
-- them announces it. Ahead of the active() gate, so switching it
-- while voxel mode is OFF still invalidates what is cached.
voidFill.check()
local ramOnly = RamPrecache.off()
local policyChanged = VoxelMeshDisk.setSessionOnly(ramOnly, RamPrecache.retainGenerated())
if ramOnly then VoxelPrecache.reset() end
local Game = require("src.core.Game")
if policyChanged and not ramOnly then VoxelMeshDisk.bind(Game, false) end
if not Voxel.active() then return end
local ow = Game and Game.overworld
if ow and ow.map and ow.camera then
-- Also covers enabling/reloading the mod after the title menu.
VoxelMeshDisk.beginSession(ramOnly, RamPrecache.retainGenerated())
pcall(V.require("LoadTimings").call, "prefetch", VoxelScene.prefetch, ow)
-- Once the visible neighbourhood is ready, cooperatively prepare the
-- current map's real warp/connection destinations. This is automatic:
-- no prebuild button, startup pause or whole-world resident cache.
pcall(V.require("LoadTimings").call, "prefetch", VoxelPrecache.update, Game)
end
ChunkMesher.pump(Game and Game.stack
and Game.stack:top() ~= ow)
end,
drawWorld = function(ctx)
-- Naming screens can be pushed before Oak has finished constructing a
-- save, an overworld, or even a live player. The render-pipeline registry
-- still asks every enabled world pipeline for a frame during that early UI
-- state. VoxelScene requires the complete OverworldState contract, so
-- decline the pass until all of its authoritative pieces exist. Returning
-- nil is the registry's documented fail-open path: the engine keeps its
-- native intro/name-entry canvas and resumes 3D automatically on the first
-- real overworld frame.
local state = ctx and ctx.state
if nativeNamingOwnsFrame(state) then return nil end
if type(state) ~= "table" or not (state.map and state.camera and state.player) then
return nil
end
-- Terrain and characters are geometry; the field FX stay ordinary 2D
-- draws composited on top, anchored through the same camera the 3D
-- pass used (ctx.drawFx below). The scene renders at the window's
-- PIXEL resolution (see sceneSize) so the 3D pass is crisp rather than
-- a magnified low-res image, while the FX closures keep drawing in
-- world-pixel units.
local sw, sh = sceneSize(ctx)
-- With AA on, the whole pass runs into a canvas BIGGER than the window
-- and is folded back down at the end (see AntiAlias). Nothing between
-- these two lines knows: every pass in the frame measures itself in the
-- canvas it was handed, so the sky's dither, the water's march and the
-- camera itself all come out the same picture at a higher sample rate.
local rw, rh = AntiAlias.expand(sw, sh)
-- TEST435's protected handoff is intentional compatibility, not merely a
-- diagnostic wrapper. If a future engine introduces another incomplete
-- world-like state, fail open to its native renderer instead of aborting
-- the remainder of the frame (which otherwise leaves only the naming
-- canvas's green clear colour visible).
local okRender, canvas, waiting = pcall(V.require("LoadTimings").call,
"world_other", VoxelScene.render, state, rw, rh,
ctx.vw, ctx.vh, ctx.paletteFor)
local map = state.map
if not okRender then
VoxelTransitionGate.cancel(map)
if not V.worldStateCompatWarned and mod.log and mod.log.error then
V.worldStateCompatWarned = true
mod.log:error("Voxel world pass failed open: %s", tostring(canvas))
end
return nil
end
if not canvas then
local generating = map and not ChunkMesher.slotKnown(map, false)
if waiting or generating then
VoxelTransitionGate.observe(map, false)
-- Only an explicitly qualified Continue/travel gate may cover the
-- world. Ordinary doors and first-time route loads fail open to the
-- engine renderer while their voxels build instead of inventing an
-- unrelated black transition. The gate itself also has a hard ceiling,
-- so a failed neighbour/cache record cannot soft-lock a save here.
if VoxelTransitionGate.blocking(map) then
return VoxelLoadingVeil.get(sw, sh)
end
return nil
end
-- A genuine renderer failure must fail open instead of trapping the
-- player behind an eternal modal cover.
VoxelTransitionGate.cancel(map)
return nil -- genuine build/driver failure: safe 2D
end
if waiting then
-- The canvas is the last wholly rendered neighbourhood. Do not composite
-- the new area's field FX over that old camera; reveal both together once
-- all connected BODY meshes are ready.
VoxelTransitionGate.observe(map, false)
if VoxelTransitionGate.blocking(map) then
return VoxelLoadingVeil.get(sw, sh)
end
-- Seamless route/city connections are intentionally not modal: retain
-- their last complete voxel frame instead of flashing a black cover.
return AntiAlias.resolve(canvas, sw, sh, "world")
end
VoxelTransitionGate.observe(map, true)
if VoxelTransitionGate.blocking(map) then
return VoxelLoadingVeil.get(sw, sh)
end
if Voxel3D.beginOverlay() then
-- the FX closures are ordinary 2D draws sized in DISPLAY pixels, and
-- they are drawing into the supersampled canvas alongside everything
-- else -- so the scale goes up with it, or the "!" bubble lands the
-- right place at half the size. project() already answers in canvas
-- pixels, so only the scale needs saying.
local scale = ctx.scale * AntiAlias.factor()
-- Every field FX but one is anchored to the ground point of the thing
-- it belongs to -- the character wearing the "!", the cell the dust
-- puffs on -- so its flat closure lands unchanged through this. The
-- heal machine's is not: it is anchored to the PLAYER, three tiles from
-- the art it paints, and slid rigidly onto that one point. A camera
-- with any pitch foreshortens that lever arm, so the balls and the
-- monitor float off the cabinet. Hide it from drawFx -- both the
-- dispatch and fxHeal itself read state.healAnim -- and put its pieces
-- on the machine's own surfaces instead.
--
-- healAnim goes back whatever drawFx does with the frame: the heal
-- script is waiting on that record to count its jingle out, and losing
-- it would strand the player at the counter.
local state = ctx.state
local healAnim = state and state.healAnim
if healAnim then state.healAnim = nil end
local drawn, err = pcall(ctx.drawFx,
function(wx, wy) return Voxel3D.project(wx, 0, wy) end,
scale)
if healAnim then
state.healAnim = healAnim
-- cosmetic, and last: a fault here must not retire the pipeline and
-- drop the whole world back to 2D mid-heal
if not pcall(HealOverlay.draw, healAnim, Voxel3D.project, scale, ctx) then
love.graphics.setShader()
end
end
Voxel3D.endOverlay()
if not drawn then error(err, 0) end
end
-- and back to the window's own size, which is what the engine composites
-- one canvas pixel to one display pixel. A pass-through when AA is off.
return AntiAlias.resolve(canvas, sw, sh, "world")
end,
invalidate = function()
VoxelScene.invalidate()
Voxel3D.invalidate()
V.require("Pokeball").invalidate()
V.require("SuccessStars").invalidate()
V.require("EmberLegacyAudio").clear()
OverworldBattle.invalidate()
AntiAlias.invalidate()
VoxelLoadingVeil.invalidate()
ChunkMesher.invalidate() -- no map id = every cached mesh
pcall(Companion.invalidate, Companion, "render_pipeline")
end,
})
mod.content.render_pipelines:register("tiltshift", {
label = "T-SHIFT",
levels = TiltShift.LABELS,
-- 6 is free: no engine branch claims it, so this one alone reaches the
-- registry by the documented route
hotkey = "6",
priority = 10,
update = function(dt, level)
TiltShift.update(dt, level)
end,
-- worldPresent, not present: the blur belongs on the diorama, not on the
-- dialog box in front of it. A pass-through when the level is 0 or the
-- shader is unavailable, so the frame is untouched in every other case.
worldPresent = function(canvas)
return TiltShift.apply(canvas)
end,
invalidate = function()
TiltShift.invalidate()
end,
})
-- ------- this mod's own settings
--
-- Neither of these is a pipeline: they own no pass of the frame, they
-- PARAMETERISE the voxel one, so they have nothing to put in drawWorld or
-- present and the registry would rightly reject them. Plain mod settings
-- instead -- see ModSetting for where they persist and how the two rows
-- each ends up on stay in step.
-- ------- the FULL preset
--
-- Everything the mode wants switched to at once. Applied when the VOXEL row
-- ARRIVES at FULL and not again, so the player can still move the camera or
-- the zoom afterwards -- it is a starting point, not a lock.
--
-- Leaving FULL deliberately does NOT undo any of it. A preset that reverted
-- would throw away whatever the player had changed since, and "put it back
-- how it was" is not a thing this can know.
local fullWas = nil
applyFull = function(level)
local isFull = Voxel.isFull(level)
local was = fullWas
fullWas = isFull
if not isFull or was == true or was == nil then return end
local Game = require("src.core.Game")
local Pipelines = require("src.render.Pipelines")
local Zoom = require("src.render.Zoom")
local opts = Game.save and Game.save.options
if not opts then return end
-- the miniature blur at its strongest: FULL is the diorama look, and the
-- tilt-shift is most of what makes it read as a model
Pipelines.setLevel("tiltshift", Pipelines.maxLevel("tiltshift"))
Pipelines.syncOptions(opts)
-- the horizon flat. The curve bends the world away from a walking player,
-- which fights a fixed diorama framing
WorldCurve.setting:setIndex(1, Game)
-- and the water reflecting everything it can: FULL is the diorama at its
-- most photographed, and a lake with the sky and the shoreline in it is
-- most of what makes the model read as being outdoors
Water.setting:setIndex(1, Game)
-- and the view fitted to the window
opts.zoom = 0
Zoom.applyOptions(opts)
-- battles on the map too: FULL means the whole mode, and a fight is where
-- half of it is spent. Set and then LET GO of -- unlike the rows above, both
-- battle rows stay on the menu under FULL (see the rows hook), so this is
-- where the preset puts them and not where they are held.
OverworldBattle.setting:setIndex(1, Game)
-- default to the classic player back view. The foe remains world-placed;
-- AUTO decides whether the selected back belongs in-world or on OG UI.
BattleArt.viewSetting:setIndex(2, Game)
-- and the battle screen the staged fight is composed for. WIDE re-lays that
-- screen out on a 304x144 surface, which moves every anchor the arena camera
-- is solved against (OverworldBattle.forceOG); FULL has just switched staged
-- fights on, so the layout follows them.
OverworldBattle.forceOG(Game)
-- BATTLE BG: WORLD leaves the frozen overworld showing through a battle and
-- is only valid for the engine's flat 2D battle; with the 3D diorama there
-- is no "old system" to show through, so WORLD composites as broken dark
-- bars. Correct WORLD to WHITE while preserving BLACK, which is already an
-- opaque field and needs no world-behind-battle path.
ensureBattleBgCompatible(opts)
-- and the sky on the clock on the wall: FULL pins DAYTIME to SYNC. Unlike
-- the rest of the preset this one IS held, not just set -- the row is off
-- the menu while FULL owns it (the rows hook below), so a value changed
-- under it could never be seen or changed back.
DayNight.forceSync(Game)
if Game.writeOptions then pcall(Game.writeOptions, Game) end
end
-- Whether a fight can be staged on the map, as far as the OPTIONS menu is
-- concerned: the 3D-BTL row, and nothing else.
--
-- It used to answer yes under FULL as well, on the grounds that FULL owned
-- that row and switched it on. FULL no longer owns it -- the row stays on the
-- menu under FULL and can be switched off there (see the rows hook) -- so that
-- clause would now claim staged battles for a preset the player had just
-- turned them off inside, pinning BATTLE LAYOUT to OG for a fight that is
-- never staged. The row is the only thing that decides, which is what every
-- other reader of this setting already believed: OverworldBattle.begin and
-- wantsFront both gate on enabled() alone.
--
-- Deliberately NOT gated on Voxel3D.available(): the engine offers a
-- pipeline's row whether or not the hardware can run it (Pipelines.rows), so
-- this mode's rows say ON on a machine without a depth buffer too, and a menu
-- that claims 3D battles are on must not also offer the layout they cannot be
-- drawn in.
local function stagedBattles()
return OverworldBattle.enabled()
end
local SETTINGS = {
{ LegendaryVisualsPreset.setting,
"One master profile for Legendary world visuals. OFF preserves Battle Art, "
.. "CUSTOM restores the exact individual choices you last made, AUTO enables "
.. "the complete Legendary presentation with balanced detail, and FULL uses "
.. "the richest supported detail tiers. Style, audio, Ember Legacy and battle "
.. "presentation choices remain independent. Presets never overwrite CUSTOM.",
full = true },
{ CommunityVisuals.casino, "Choose Battle Art or Legendary Visuals for casino. Rebuilds the room when changed.", full = true },
{ CommunityVisuals.prizeRoom, "Choose Battle Art or Legendary Visuals for prize room. Rebuilds the room when changed.", full = true },
{ CommunityVisuals.tunnels, "Choose Battle Art or Legendary Visuals for tunnels. Rebuilds the room when changed.", full = true },
{ CommunityVisuals.rocket, "Choose Battle Art or Legendary Visuals for rocket hideout. Rebuilds the room when changed.", full = true },
{ CommunityVisuals.elevator, "Choose Battle Art or Legendary Visuals for rocket elevator. Rebuilds the room when changed.", full = true },
{ CommunityVisuals.pillars,
"Choose the original Battle Art pillars or the community granite design: "
.. "standalone, joined by the approved low wall, or interlocked across "
.. "the crown. Changing this rebuilds derived map geometry in the normal "
.. "background queue; collision and map data never change.",
full = true },
{ CommunityVisuals.masonry,
"Color TEST435's synchronized retaining walls and authored ledges as "
.. "granite, red brick, sandstone or slate. Pillars stay in their locked "
.. "TEST366 granite material.",
full = true },
{ CommunityVisuals.caves,
"Choose Battle Art's authored cave presentation or the opt-in Legendary "
.. "Visuals natural cave: continuous rough rock walls and a dark granular "
.. "dirt path. This changes derived visuals only; collision, ladders, "
.. "entrances, map data and cave battle framing remain authoritative.",
full = true },
{ CommunityVisuals.caveDetails,
"Optional cave atmosphere borrowed selectively from Kanto First Person "
.. "without replacing the Legendary Visuals walls. SUBTLE adds sparse "
.. "animated wall torches, sourced cave moisture and sparse layered rock "
.. "columns; FULL also permits attached hanging formations, occasional "
.. "dark pools, slow surface ripples and low damp haze. OFF is the "
.. "zero-cost default.",
full = true },
{ CommunityVisuals.caveSound,
"Optional cave ambience and per-tile rock footsteps. LOW and MID control "
.. "the ambient bed volume while both retain clearly audible walking "
.. "effects; OFF loads and plays no added cave audio.",
full = true },
{ CommunityVisuals.tower,
"Master switch for the Pokemon Tower conversion. BATTLE ART restores the "
.. "original Lavender exterior plus Tower atlas, wall height, floor, counter, "
.. "graves and stairs, and suppresses Legendary fog/detail passes. LEGENDARY "
.. "VISUALS uses the Gothic Lavender exterior and complete approved Tower "
.. "interior while retaining the independent wall style, fog thickness and "
.. "fog speed choices below.",
full = true },
{ CommunityVisuals.towerWall,
"Choose the Pokemon Tower wall slab while Legendary Visuals is active. "
.. "SMOKE BLACK keeps the approved dark smoky granite; STORM WHITE adds "
.. "broad charcoal ribbons over cool white stone; PEARL WHITE is brighter "
.. "and calmer with restrained silver-grey movement. All three use the "
.. "same continuous 2048px wall projection.",
full = true },
{ TowerFogSettings.details,
"Choose the Pokemon Tower detail layer independently of its materials "
.. "and grave fog. SUBTLE keeps the high wall sconces with steady light. "
.. "FULL restores the living flame motion, restrained wall flicker, "
.. "embers and the reception counter's brass edge.",
full = true },
{ TowerFogSettings.enabled,
"Show or hide the connected white-grey fog banks on Pokemon Tower's "
.. "grave floors. Reception stays clear. OFF skips the fog texture, "
.. "shader and grave-zone mesh entirely when they have not been built.",
full = true },
{ TowerFogSettings.thickness,
"Set the visible body of Pokemon Tower fog. LIGHT, NORMAL, THICK and "
.. "HEAVY change its opacity and bank height without spreading it into "
.. "reception; NORMAL is TEST134's approved look.",
full = true },
{ TowerFogSettings.speed,
"Set the continuous drift, breathing and evaporation speed of Pokemon "
.. "Tower fog. Changing this live preserves the current cloud phase; "
.. "NORMAL is TEST134's approved motion.",
full = true },
{ CommunityVisuals.treeDetail,
"FULL retains the approved foliage. BALANCED and HANDHELD remove decorative "
.. "shells, keep near crossed-card silhouettes, and thin distant bunches. "
.. "The same detail setting thins the new Legendary forest leaves. "
.. "Tree positions stay fixed; R.DIST bounds neighbor work.", full = true },
{ CommunityVisuals.trees,
"Choose Battle Art's authored round trees or the finalized Legendary Visuals "
.. "small, medium, large and mature XL tree family. LEGENDARY FAST uses "
.. "a visibly lighter crown with fewer leaf clumps/cards and no decorative "
.. "diamond shells; LEGENDARY FULL preserves the dense original canopy. "
.. "Tree generation and terrain transfer are budgeted for mobile frames; "
.. "Cut saplings never enter or rebuild mature groves.",
full = true },
{ CommunityVisuals.cutTrees,
"Choose Battle Art's original cuttable bush or the super-skinny Legendary "
.. "Visuals city sapling with two support stakes and dark ties. The "
.. "original Cut action, collision, replacement "
.. "block and regrowth remain authoritative.", full = true },
{ CommunityVisuals.signs,
"Choose Battle Art's readable white sign or the Legendary Visuals low "
.. "Kanto wayfinder with live location labels, including Viridian Forest.",
full = true },
{ CommunityVisuals.cityGround,
"Choose Battle Art or Legendary Visuals city ground. Lavender Battle Art "
.. "uses green lawns, lavender-grey paths and Tower flowers. Legendary keeps "
.. "large Gothic paving matched to TOWER WALL color, Gothic lamps and its "
.. "garden treatment. Route 10's exit lawn is corrected in both modes. "
.. "Fuchsia follows CITY GROUND independently of GRASS.",
full = true },
{ CommunityVisuals.grass,
"Choose the original Overworld turf and encounter grass or TEST435's "
.. "harmonized natural-green materials.", full = true },
{ CommunityVisuals.buildings,
"Kanto architecture: LEGENDARY replaces complete buildings with "
.. "regional houses and purpose-built landmarks. INSTALLED restores the buildings "
.. "provided by your installed mods. Keep Better Buildings 1.19.0 for "
.. "the approved placements and Tower. Independent of the Legendary preset.", full = true },
{ CommunityVisuals.roads,
"Choose original route surfaces or TEST435's quiet packed-earth roads "
.. "and dark timber bridge deck.", full = true },
{ CommunityVisuals.walls,
"Choose original terrain faces or TEST435's architectural masonry walls "
.. "and authored stone ledges.", full = true },
{ CommunityVisuals.courtyards,
"Choose original courtyard/fence treatment or TEST435's timber fences, "
.. "warm flagstone courts and flush claimed-cell finish.", full = true },
{ CommunityVisuals.sky,
"Choose Battle Art's original clear horizon or Legendary Visuals' "
.. "seamless sky, deep night, emissive animated stars, low-poly painted "
.. "mountains and distant Kanto terrain. "
.. "The approved external Weather FX cloud layer remains authoritative.",
full = true },
{ CommunityVisuals.forest,
"Choose Battle Art's original Viridian presentation or the approved "
.. "Legendary broadleaf trees with joined trunks and branches, open sky and mountain "
.. "views, layered forest depth, map-authored haze, varied moss-and-litter "
.. "floor, camera-stable crossed grass and mossy fieldstone boulders. The "
.. "TREE DETAIL row controls forest leaf density; TREES controls the town family.", full = true },
{ CommunityVisuals.safari,
"Legendary Safari replaces the four reserve areas with tropical trees, layered "
.. "shrubs, natural rockwork, timber rest houses and source-aware ranger amenities. "
.. "Original encounters, signs, items and connections remain in place. "
.. "BATTLE ART restores the original reserve presentation.", full = true },
{ CommunityVisuals.kantoLife,
"Regional outdoor ambience: natural crickets and lightning bugs near greenery at night, "
.. "daytime butterflies, woodland sounds and recorded water near rivers/coasts. "
.. "Rain reduces insect activity. LOW reduces density and volume; OFF restores prior ambience. "
.. "Sound follows SFX volume and existing ambience controls.", full = true },
{ ForestAtmos.setting,
"LOW enables the approved Viridian Forest haze and guarded depth-aware "
.. "light shafts, falling leaves, evening fireflies and forest sounds. "
.. "Sound follows SFX volume. OFF removes these effects while leaving the "
.. "Legendary forest geometry and open skyline untouched.",
full = true },
{ VoxelGrid.setting,
"One-pixel wireframe along every voxel edge." },
{ WorldCurve.setting,
"Bend the world down over the horizon, Animal Crossing style." },
{ WorldUnderlay.setting,
"Choose the solid outdoor world beneath terrain holes and beyond map edges: "
.. "CYAN or BLACK. OFF/KFP leaves the underlay to Kanto First Person. "
.. "NATURE uses cyan by default and continues each biome beyond loaded "
.. "ROM cells with stable random-sized tree or rock billboards; selected "
.. "forest, Safari-house and Seafoam void maps use black and stay clear. "
.. "Indoor horizons automatically match "
.. "the room's own border/void material so the finite map ring cannot reveal "
.. "a differently coloured infinite fill behind it.",
full = true },
{ RenderDistance.setting,
"Limit connected-map terrain, water, figures and characters outside the "
.. "camera neighborhood. MEDIUM is the balanced default for the current "
.. "sandboxed engine's pure-Lua mesh path; FULL preserves the uncapped "
.. "legacy draw distance.",
full = true },
{ RamPrecache.setting,
"Maximum compressed voxel cache eagerly loaded after CONTINUE, in MiB. "
.. "FULL loads every generated cache file; OFF skips the preload and "
.. "predictive loading on every platform and retains zero compressed records. "
.. "LIVE CACHE explicitly keeps generated records in RAM without preloading.",
full = true },
{ Water.setting,
"Reflections on water. FULL adds screen-space reflections of the "
.. "shoreline, the trees and the buildings behind it; SKY is the sky, "
.. "the sun and the moon alone, which is most of the look for a "
.. "fraction of the cost." },
{ Shadows.setting,
"Enable shadows. OFF removes both the real cast-shadow map and its flat "
.. "fallback from free roam and staged battles; UNLIT battle cards also "
.. "decline shadows even while this global switch is ON.",
full = true },
{ InterfaceSprites.scalingSetting,
"BATTLE ART in Pokedex and status screens: FIT keeps artwork within "
.. "56x56. FULL draws complete frames at native size for testing; large "
.. "sprites may overlap text or extend beyond the screen. Title is unchanged.",
full = true },
{ InterfaceSprites.setting,
"INTERFACE SPRITES: show BATTLE ART's regular-form FRONT outside battle. "
.. "Title and status support timed atlas animation; other hook-aware "
.. "screens use single-image sets or retain ROM art, independent of "
.. "DUPLICATE FIX (which owns only battle pictures). "
.. "MODDED leaves the interfaces to another sprite mod or the ROM." },
-- `full` marks a row FULL does not take away. FULL owns the diorama's own
-- knobs; what a battle is drawn over, and how it is framed, are not that.
{ OverworldBattle.setting,
"Fight on the map: the battle draws over the nearest clear ground, "
.. "shot over the shoulder with a slow parallax drift.",
full = true },
{ OverworldBattle.trainerBattleSetting,
"STOCK keeps Battle Art's native trainer and player-Pokemon presentation. "
.. "LEGENDARY keeps the selected 3D trainer standing through a normal "
.. "battle and reserves the player side for the Stadium/N64 model, with "
.. "no duplicate 2D card attached to either the camera or UI box. Select "
.. "STOCK when the model provider is unavailable. Battle state and "
.. "gameplay stats are untouched.",
when = function() return stagedBattles() end, full = true },
{ PokeballSettings.enabled,
"EMBER LEGACY by Legend x Solo Dolo. "
.. "Choose Battle Art's original capture animation or Ember Legacy's "
.. "3D throws, capture effects, rebound, shakes and breakout. "
.. "Items, capture odds and outcomes remain Battle Art's.",
when = function() return stagedBattles() end, full = true },
{ PokeballSettings.audio,
"Ember Legacy by Legend x Solo Dolo. ORIGINAL keeps native audio; "
.. "EMBER LEGACY uses the supplied modern sounds; ANCIENT uses the "
.. "ancient ball variants. Music and Pokemon cries keep their own audio.",
when = function() return stagedBattles() and PokeballSettings.active() end, full = true },
{ PokeballSettings.audioVolume,
"Ember Legacy effect volume, multiplied by the game's SFX volume.",
when = function() return stagedBattles() and PokeballSettings.active() end, full = true },
{ PokeballSettings.size,
"Scale the Ember Legacy 3D capture ball without changing its trajectory.",
when = function()
return stagedBattles() and PokeballSettings.active()
end, full = true },
{ PokeballSettings.suction,
"Enable the Ember Legacy intake beam and suction presentation.",
when = function()
return stagedBattles() and PokeballSettings.active()
end, full = true },
{ PokeballSettings.preset,
"Choose a coordinated capture-effects profile. CUSTOM exposes the "
.. "individual beam and streamer controls below. The successful-capture "
.. "star burst uses Ember Legacy's fixed q58 choreography.",
when = function()
return stagedBattles() and PokeballSettings.active()
end, full = true },
{ PokeballSettings.beam,
"Set intake-beam strength for the CUSTOM capture profile.",
when = function()
return stagedBattles() and PokeballSettings.active()
and PokeballSettings.preset:get() == "CUSTOM"
end, full = true },
{ PokeballSettings.streamers,
"Set airborne trail strength for the CUSTOM capture profile.",
when = function()
return stagedBattles() and PokeballSettings.active()
and PokeballSettings.preset:get() == "CUSTOM"
end, full = true },
{ PokeballSettings.pokemonGlow,
"Control the opponent glow while it is drawn into the ball.",
when = function()
return stagedBattles() and PokeballSettings.active()
end, full = true },
{ PokeballSettings.suctionParticles,
"Control the particles pulled inward during capture.",
when = function()
return stagedBattles() and PokeballSettings.active()
end, full = true },
{ PokeballSettings.captureSpeed,
"Choose the timing of the visual intake; battle timing remains native.",
when = function()
return stagedBattles() and PokeballSettings.active()
end, full = true },
{ PokeballSettings.openTime,
"Choose how long the 3D ball visibly holds open before closing.",
when = function()
return stagedBattles() and PokeballSettings.active()
end, full = true },
{ PokeballSettings.fxScale,
"Scale the Legendary beam, trails, particles and catch effects together.",
when = function()
return stagedBattles() and PokeballSettings.active()
end, full = true },
{ FirstPerson.invertYSetting,
"Invert vertical look input in 1ST and 3RD free-camera modes only. "
.. "It does not change overhead camera movement.",
full = true },
-- HUD SCALE lives with the battle rows: SCALED is the mod's default HUD
-- (it grows with the battle zoom); OG pins it to the window-fit scale like
-- upstream gen1recomp's player HUD, so an external XP-bar mod -- which this
-- mod does NOT provide -- lines up with a window-scaling HUD.
{ OverworldBattle.hudScaleSetting,
"Size of the player and opponent HUD. SCALED grows with the battle "
.. "zoom (the mod default); OG pins it to the window-fit scale like "
.. "upstream gen1recomp's player HUD, so an external XP-bar mod -- which "
.. "this mod does not include -- lines up with a window-scaling HUD.",
full = true },
-- Only offered while a fight can actually be staged on the map.
{ BattleArt.setting,
"Use optional PNGs from assets/battle in fights. Missing art falls "
.. "back to the ROM. STATIC is the zero-configuration default.",
when = function() return stagedBattles() end, full = true },
{ BattleArt.trainerSetting,
"Choose the static opponent trainer collection. A class missing from "
.. "the selected generation falls back directly to its ROM portrait.",
when = function()
return stagedBattles() and BattleArt.setting:get() ~= "rom"
end, full = true },
{ BattleArt.playerArtSetting,
"Choose the player trainer's static battle-intro portrait. A missing "
.. "named choice tries player.png, then ROM. PNG uses player.png "
.. "directly. BATTLE ART: ROM pins this row to ROM.",
when = function()
local mode = BattleArt.setting:get()
return stagedBattles() and (mode == "static" or mode == "rom")
end, full = true },
{ BattleArt.playerAnimationSetting,
"Choose player.png as a static portrait or a five-frame player trainer "
.. "atlas under ANIMATED. Atlas playback starts with the leftward intro "
.. "slide, runs once, and never loops. Missing art and ROM retain the "
.. "engine portrait.",
when = function()
return stagedBattles() and BattleArt.setting:get() == "animated"
end, full = true },
{ BattleArt.frontAnimationSetting,
"Choose the front generation used by BATTLE ART: ANIMATED. GEN 1 reads "
.. "single-frame PNGs; GEN 2-5 read atlases. STATIC ignores this row. "
.. "Missing art falls directly back to ROM.",
when = function()
return stagedBattles() and BattleArt.setting:get() == "animated"
end, full = true },
{ BattleArt.backAnimationSetting,
"Choose the player back-art generation. STATIC reads only a PNG from "
.. "back-static/GEN for every choice. ANIMATED reads static GEN 1, 2, "
.. "and 4 PNGs, or animated GEN 3 and 5 atlases. Missing art falls "