10 KiB
Target architecture (post-analysis)
The analysis phase gate is satisfied. This ownership map now governs runtime implementation; currently implemented modules are Core/Init.lua, Core/Constants.lua, Core/Audio.lua, Core/SavedVariables.lua, Engine/Grid.lua, Engine/Matches.lua, Engine/Cascade.lua, Engine/Scoring.lua, Engine/Input.lua, Engine/Session.lua, UI/Fonts.lua, UI/Backdrops.lua, UI/GemPool.lua, UI/Animations.lua, UI/HUD.lua, UI/Summary.lua, UI/Skills.lua, UI/Options.lua, UI/About.lua, UI/Legal.lua, UI/MainWindow.lua, UI/Compartment.lua, and UI/Minimap.lua.
Load order and ownership
Core/Init.lua— addon namespace, lifecycle, and subsystem wiring.Core/Constants.lua— stable enums, dimensions, atlas data, and configuration constants.Core/Audio.lua— supported sound playback, legacy identifiers, frame-deferred cue coalescing, combo sequencing, quiet variants, and gem-click throttling. Window visibility is supplied as a predicate; audio owns no frames.Core/SavedVariables.lua— defaulting, legacy base-70 score authentication, exact nine-row Classic save/restore/terminal-clear encoding, account-wide completed-game counts, authenticated Classic/Timed personal bests, validation, and eventual proven migrations.Engine/Grid.lua— deterministic grid representation, coordinates, swaps, and legal-move state.Engine/Matches.lua— pure legacy-order match detection, axis-overlap reporting, and power/hyper-gem classification; clearing and scoring remain downstream responsibilities.Engine/Cascade.lua— transactional clears, matched power-gem expansion, target-color and double-hyper activation, spawned-special preservation, fixed-cell gravity, bounded refill, and repeated transitions to a stable board. It emits immutable award, lightning-link, movement, and refill records but owns no animation or scoring.Engine/Scoring.lua— legacy score arithmetic, combo/mode/level multipliers, wire-compatible statistics, probabilistic skill gains, one-time achievements, rank advancement, pending/explicit level transitions, completed-game achievements, and final score/points-per-second metrics. It emits presentation events and owns no frames, text, sound, or chat publishing.Engine/Input.lua— authoritative selection and move coordination, optimistic adjacent swaps, match validation, immediate engine rollback for invalid moves, legacy hyper activation, move accounting, cascade/scoring handoff, pause gating, and session/presentation locking. Cascade refills no longer force a legal result by default, preserving the legacy no-more-moves terminal path; callers may explicitly request guaranteed-legal refill fixtures.Engine/Session.lua— Classic/Timed session lifetime, pause/resume state, elapsed-time gating, stable-state autosave, authenticated restore, and coordination between input, scoring, persistence, grid projection, and animation clocks. It exclusively consumes pending scoring levels after a stable move, emits copied start/complete presentation records, retains the input lock while presentation is deferred, regenerates a legal board while preserving the counts of power/hyper gems, advances level arithmetic on completion, and only then autosaves. It also detects stable boards with no legal move and Timed expiry, permanently locks terminal input, clears Classic resume state before the wipe handoff, and persists final personal-best metrics when the summary handoff completes.UI/Fonts.lua— the shared live font boundary. It attempts the immutable legacy font first, then falls back to the locale-aware Blizzard standard font (or the built-in Friz Quadrata path) when Retail rejects the legacy TTF, preventing presentation construction from aborting.UI/Backdrops.lua— backdrop-compatible frame construction and fresh-copy presets for tooltip, window, panel, slider, and level-border chrome. Every constructed frame explicitly inheritsBackdropTemplate.UI/GemPool.lua— fixed allocation and reuse of the 64 interactive gem frames, the sixteen board-art tiles, input-handler attachment, selection projection, and change-aware projection from authoritative grid cells into normal/hyper texture layers. Power-gem overlays remainUI/Animations.luaownership.UI/Animations.lua— deterministic swap/rollback and clear/gravity/refill plans, reusable animation groups, session-controlled pause/resume, interaction locking, cancellation, and final-grid normalization. It also owns the legacy-cadence 40-frame hyper atlas, counter-rotating/cross-faded power layers, pooled 16-frame explosion atlas, and pooled 15-tick lightning lines that gate settling. Nonblocking effects share the same pausable 25 ms clock: every cleared gem emits a ten-shard burst, ambient lightwaves propagate across active boards, hints delay and bounce above a selected cell, and reusable floating text supports score and status presentation. Current fall timings are explicit modernization defaults pending in-game tuning.UI/HUD.lua— BackdropTemplate-safe Classic score/level/progress and Timed points-per-second/multiplier/countdown presentation. It consumes copied input/session callbacks, schedules idle hints, emits score and skill floating text throughUI/Animations.lua, owns temporary status/achievement and pause overlays, and retains a compact terminal fallback for standalone HUD consumers. ItsUpdatemethod only refreshes presentation and expiry clocks;Engine/Session.luaremains the sole owner of elapsed time and gameplay transitions.UI/Summary.lua— the board-sized terminal presentation for copiedEngine/Session.luagame-over records. It renders the legacy-proven primary metric, elapsed time, level, largest cascade, and largest combo plus modern moves and authenticated personal-best results. Its only actions are local Menu and New Game callbacks; score publication, chat, dropdown, friend, and guild behavior remain absent.UI/Skills.lua— the board-sized, read-only Feats of Skill presentation. It derives the six-rank progress segment, current five-category skill challenges, personal/fun statistics, existing friends/guild Classic/Timed score tables, and unlocked/completed achievement lists from proven profile/account fields. Paginated records are copied for consumers, completed achievements sort first, and the module owns no scoring, roster queries, SavedVariables mutation, chat, or score publication.UI/Options.lua— paginated controls over the proven legacy settings fields. It preserves numeric truthy toggle representation and mutually exclusive Normal/Quiet/Off sound fields, cycles the two legacy opacity values, and reports every change through an injected callback so live window/HUD behavior remainsUI/MainWindow.luaownership.UI/About.lua— local How to Play, PopCap story/project, and credits/acknowledgement tabs. It owns static presentation only and has no external navigation or gameplay state.UI/Legal.lua— first-run and menu-accessible legal/attribution presentation. Explicit acknowledgement writes only the established account-widelegalDisplayedfield before returning through an injected callback.UI/MainWindow.lua— the 448×510 movable runtime shell, 400×400 board construction, complete local Menu/New Game/Feats/Settings/About/Legal navigation, Classic Continue/New Game, and a Timed setup screen with a 2–10 minute unit-step slider defaulting to five. It owns session replacement, full-summary handoff, live setting application, first-run legal routing, and show/hide pause behavior; its frame update delegates authoritative elapsed time toEngine/Session.lua, HUD expiry toUI/HUD.lua, and queued sound flushing toCore/Audio.lua.Core/Init.luaassembles and shows this shell afterADDON_LOADEDwhen liveUIParentand player identity are available.UI/Compartment.lua— the minimal public-global boundary required by Retail TOC metadata. Its left-click callback acquires or reuses the private runtime and togglesUI/MainWindow.lua; its distinct hover callbacks own anchoredGameTooltiphelp. Right clicks and callbacks for another addon name are ignored.UI/Minimap.lua— the legacy local launcher boundary. It renders the preserved icon inside Blizzard minimap chrome, togglesUI/MainWindow.luaon left click, owns hover help, and converts right-drag cursor coordinates into persisted attached angles or detached UIParent coordinates using the established profile fields.UI/Options.luachanges visibility through the injectedUI/MainWindow.luasettings callback; the launcher owns no gameplay state.
Flight timing remains an explicit integration boundary rather than a third engine mode. UI/MainWindow.lua accepts paired flightOptionProvider(window) and onFlightTimedRequested(state, window) callbacks. The provider returns nil when inactive or a copied { seconds = nonnegativeNumber, learning = optionalBoolean, ... } state. Known routes under 60 seconds are shown as too short; learning and longer known routes may be selected. Only the paired request callback can consume that state, so the later Retail event adapter can own taxi observation and session transition without reintroducing the legacy estimator's unreachable APIs.
Data flow
SavedVariables initialization/restore → session-owned lifetime → engine-owned deterministic grid state → input/match/cascade/scoring transitions → UI rendering and animation → session-owned level/game-over gates → stable-state autosave and HUD/audio feedback
The engine owns authoritative game state. UI frames render state and report input; they do not become the source of gameplay truth. Audio and HUD reactions consume copied transition records, and deferred level/game-over presentation must explicitly complete its session handoff.
Compatibility boundary
BejeweledData and BejeweledProfile remain wire-compatible with the legacy snapshot until all analysis batches establish field meanings, invariants, defaults, and migration requirements. No migration schema exists in this phase.