@@ -6,7 +6,7 @@ This branch is an analysis-only bootstrap for a Mainline-first modernization of
The preserved 8,401-line Mainline source must be analyzed sequentially, in evidence-backed batches, before runtime work begins. All behavior-critical shortened symbols must be resolved and all batches must be complete before any public Lua API, runtime module, modern TOC, packaging, or release work is added.
Batches 01–07 (lines 1–3,500) are documented. The remaining batches are scheduled but not analyzed.
Batches 01–08 (lines 1–4,000) are documented. The remaining batches are scheduled but not analyzed.
@@ -7,7 +7,7 @@ Each row identifies one declaration, not merely one spelling. `chunk` means the
| `t` / chunk (first binding) | 4 | String initializer only before shadow at 186. | `addonRootPath` | dead | High: path literal at 4; no read before 186. | 01–01 | Core/Constants | Was elimination intentional? |
| `l` / chunk | 5 | Image/font root used for bundled fonts and attempted legal-popup background path (5, 618, 633, 1664). | `imageRootPath` | resolved | High: literal and direct asset-path consumers. | 01–04 | Core/Constants | Other consumers remain to inventory. |
| `xe` / chunk | 7 | Starts as `BEJEWELED2`; migration completion changes it to `BEJ2a` at 3563. | `addonMessagePrefix` | working | High for role. | 01–08 | Core/Init, Persistence/Migration | Confirm registration/send sites and version routing. |
| `ft` / chunk | 8 | Seven-entry colored/name table; no batch-01 read. | `gemDisplayNames` | working | Medium: ordered color names (8). | 01–01 | UI/HUD | Confirm indices and markup purpose. |
| `he` / chunk | 169 | Nine RGB triples; initialized only in batch 01. | `gemColors` | working | Medium: values mirror seven gem colors plus two white entries (169–179). | 01–01 | Core/Constants | Determine meanings of indices 8–9. |
| `U` / chunk | 180 | Numeric keys 1–7 map to lowercase color names. | `gemColorNames` | working | High: complete table at 180. | 01–01 | Core/Constants | Confirm use in asset filenames. |
@@ -23,7 +23,7 @@ Each row identifies one declaration, not merely one spelling. `chunk` means the
| `v` / chunk | 327 | Forward declaration; used as key for authenticated personal-best payload in `n.statDB` (887, 900) and signed zero payloads in classic/timed profile stats (3490–3491). | `statEncodedScoreKey` | working | Medium: value type is proven; concrete selected key is not. | 01–07 | Core/SavedVariables | Find assignments for mode-specific key. |
| `I` / chunk | 327 | Forward declaration; used as key for numeric personal-best metric in `n.statDB` (885–886, 898–899). | `statNumericScoreKey` | working | Medium: value type is proven; concrete selected key is not. | 01–02 | Core/SavedVariables | Find assignments for mode-specific key. |
| `v` / chunk | 327 | Key for authenticated personal-best payloads in current-game/profile classic/timed stats (887, 900, 3490–3491, 3601–3613). | `statEncodedScoreKey` | working | High for role; concrete selected key pending. | 01–08 | Core/SavedVariables | Find mode-specific assignments. |
| `I` / chunk | 327 | Key for decoded numeric personal-best metrics in current-game/profile classic/timed stats (885–886, 898–899, 3603–3612). | `statNumericScoreKey` | working | High for role; concrete selected key pending. | 01–08 | Core/SavedVariables | Find mode-specific assignments. |
| `we` / chunk | 327 | Set when max-score level-up begins (529); during level spawning it counts/removes carried hyper and big-star state for later restoration (3890–3906). | `levelSpawnSpecialRecovery` | working | Medium-high. | 01–08 | Engine/Scoring, Engine/BoardSpawn | Find reset and full restoration completion. |
| `r` / chunk | 333 | Six-entry array of four-number direction/offset tuples. | neighbor/offset patterns | working | Medium: signed coordinate-like tuples. | 01–01 | Engine/Matches | Establish tuple field semantics. |
| `C` / chunk function | 444 | Returns a fresh backdrop descriptor; called by legal popup before mutation/application (445–452, 1663–1668). | `createBackdropInfo` | resolved | High: factory and consumer observed. | 01–04 | UI/Backdrops | Additional style consumers may refine name. |
| `C` / chunk function | 444 | Returns a fresh backdrop descriptor; consumers mutate/apply it to legal and score-migration popups (445–452, 1663–1668, 3501–3508). | `createBackdropInfo` | resolved | High. | 01–08 | UI/Backdrops | None. |
| `st` / chunk function | 455 | Reads `e.animated`; appends `e` to `t.animationStack`; writes flag true (456–459). | `queueAnimationOnce` | working | High: full function body. | 01–01 | UI/Animations | Identify owner and element types at call sites. |
@@ -189,7 +189,7 @@ Only direct standard-library aliases, loop counters with complete local bodies,
| `e`,`t` / `P` parameters | 735 | Payload and optional checksum seed; parameter `t` is shadowed at 736 after initializer access. | `payload`, `seed` | resolved | High. | 02–02 | Core/SavedVariables | None. |
| `t` / `P` defaulted seed | 736 | Defaults parameter seed, then is consumed by `H` initializer at 737 and shadowed by returned digit. | `seed` | shadowed | High. | 02–02 | Core/SavedVariables | None. |
| `l`,`o`,`t`,`i`,`n` / `P` checksum outputs | 737 | Five checksum digits returned by first `H`, packed in reverse variable order into decimal positions at 738. | `d1`, `d2`, `d3`, `d4`, `d5` | resolved | High for positional role; descriptive checksum names intentionally neutral. | 02–02 | Core/SavedVariables | Semantic digit ordering is legacy-specific. |
| `fe` / chunk function | 741 | Validates checksum prefix and returns authenticated payload or nil; migration uses it for leaderboard/personal-best repair before it is shadowed at 3829 (742–759, 3569–3613). | `verifyScore` | resolved | High. | 02–08 | Core/SavedVariables | None. |
| `Ne` / shadow function; `t`,`n` params | 3369 | Throttled timer `OnUpdate`; delta parameter `n` is consumed before a later local shadows it. Shadows direction constant for later code. | `updateTimer`; `frame`,`delta` | resolved | High. | 07–07 | UI/Timer | None. |
| `n` / `Ne` timed-window local | 3378 | Timed-window object used after delta accumulation. | `timedWindow` | resolved | High. | 07–07 | UI/Timer | None. |
| `i`,`a`,`t`,`o` / `UpdateSavedVariablesDatabase` locals | 3463–3466 | Classic stats, timed stats, saved state, and player identity/checksum; `o` changes role after upgrade checks. | `classicStats`,`timedStats`,`savedState`,`playerNameOrChecksum` | working | Medium-high. | 07–07 | Persistence/Migration | Continue method in batch 08. |
| `n` / score-migration popup scope | 3494 | Popup frame constructed for incomplete score migration; construction continues after 3500. | `migrationPopup` | working | High for object role. | 07–07 | UI/Migration | Complete in batch 08. |
| `i`,`a`,`t`,`o` / `UpdateSavedVariablesDatabase` locals | 3463–3466 | Classic stats, timed stats, saved state, and player identity then checksum seed through completed migration (3463–3614). | `classicStats`,`timedStats`,`savedState`,`playerNameOrChecksum` | resolved | High. | 07–08 | Persistence/Migration | Split `o` roles in rewrite. |
| `n` / score-migration popup scope | 3494 | Popup frame fully constructed, stored as `Bejeweled.updatePopup`, and shown by upgrade controls (3494–3560). | `migrationPopup` | resolved | High. | 07–08 | UI/Migration | Duplicate global No button is preserved defect evidence. |
## Batch 07 resolution policy
Bindings are resolved only where complete control/data flow closes within this batch or the completed cross-batch `he` body. Locals in the open saved-variable method and ambiguous animator/row temporaries remain working; unused declarations are marked dead without yet authorizing removal.
| `t` / migration action-control local | 3524 | Yes button, then reassigned to two No buttons and upgrade launcher (3524–3561). | `actionControl` | resolved | High. | 08–08 | UI/Migration | Preserve duplicate named No construction. |
| `i`,`o` / repair-helper locals | 3565 | PopCap fallback name and decoded signed payload. | `fallbackName`,`decodedPayload` | resolved | High. | 08–08 | Persistence/Migration | None. |
| `t` / first repair local | 3565 | First duplicate binding is hidden by the second same-statement `t`. | — | shadowed | High. | 08–08 | Persistence/Migration | None. |
| `t` / second repair local | 3565 | Survives the declaration but has no read outside the nested numeric-loop scopes. | — | dead | High. | 08–08 | Persistence/Migration | None. |
| `l` / repair-helper local | 3566 | Counts invalid rows but is never read. | — | dead | High. | 08–08 | Persistence/Migration | None. |
| `e` / `fe` flight-sync local | 3854 | Flight timer used to reconcile elapsed/remaining values. | `flightTimer` | resolved | High. | 08–08 | Engine/Timer | None. |
| `Le` / shadow function; `i` param | 3874 | Spawn/refill controller remains open after 4000; shadows earlier `markGemForClear`. | `spawnAndRefillBoard` | working | High for prefix. | 08–08 | Engine/BoardSpawn | Complete in batch 09. |
| `s` / first two `Le` declarations | 3878 | First and second duplicate bindings are hidden by later same-statement `s` declarations. | — | shadowed | High. | 08–08 | Engine/BoardSpawn | None. |
| `s` / final `Le` declaration | 3878 | Accessible same-spelling nil binding; no resolved role before boundary. | unknown temporary | unresolved | Low. | 08–08 | Engine/BoardSpawn | Trace after 4000. |
| `t`,`d`,`l`,`r` / `Le` initial locals | 3878 | Current gem, randomized vertical spacing, column, and row. | `gem`,`verticalGap`,`column`,`row` | working | High for observed prefix. | 08–08 | Engine/BoardSpawn | Confirm reuse after 4000. |
| `e` / `Le` refill loops | 3941, 3944 | Distinct indices over `newJewel` for clear then refill. | `index` | resolved | High. | 08–08 | Engine/BoardSpawn | None. |
| `e` / `Le` big-star loops | 3963, 3964, 3975 | Count, six random attempts, and cyclic scan in nested declaration-specific scopes. | `starIndex`,`attempt`,`scanIndex` | resolved | High. | 08–08 | Engine/BoardSpawn | None. |
| `e` / `Le` hyper loops | 3998, 3999 | Hyper count and six-attempt loop both continue after boundary. | working loop roles | working | Medium-high. | 08–08 | Engine/BoardSpawn | Complete in batch 09. |
## Batch 08 resolution policy
The completed migration, command, settings, and timer bodies support resolved roles. Duplicate calls/control construction and truthy-only writes are recorded as evidence without correction. All bindings belonging to open `Le` remain working or unresolved unless their individual loop scope closes within this batch.
Source: `Legacy/Bejeweled_Mainline.lua` at commit `6faec1c`
Coverage: lines 3501–4000 inclusive
Blank: 3618, 3739, 3743, 3757, 3797, 3828, 3873
Status: complete; `Bejeweled:UpdateSavedVariablesDatabase` closes at 3617 and shadowing `Le` continues into batch 09
## Line-indexed coverage audit
| Lines | Evidence represented |
| ---: | --- |
| 3501–3508 | Continues score-migration popup construction: obtains a fresh backdrop descriptor from `C`, assigns bundled border/background textures and dimensions, changes the right inset, and applies backdrop/color to popup `n`. |
| 3509–3523 | Reuses spelling `t` for a close button and then a font string. The close callback hides its parent; the text explains that opting into the new score-storage system wipes existing scores and is required for score exchange. |
| 3524–3552 | Reuses `t` for Yes/No buttons. Yes sets `scoresUpdated`, removes `scoreList`, and calls `ReloadUI`; No sets `scoresPopup` and hides the popup. Lines 3542–3549 construct a second `BejeweledUpdateNo` button with the same behavior and global name. The popup is shown unless previously dismissed. |
| 3553–3562 | Hides friends/guild leaderboard panes and adds an “Upgrade Score System” button that reopens the popup. The incomplete-migration branch then ends. |
| 3563–3596 | Completed-migration branch changes addon-message prefix `xe` to `BEJ2a` and defines local leaderboard repair helper `e`. For records descending from index 10 to 1, it verifies the signed payload with the earlier `fe`, decodes it, rescales timed scores, or removes invalid entries by shifting later rows and inserting a signed PopCap fallback. Counter `l` is incremented for invalid records but never read. |
| 3597–3617 | Calls the helper on friends-classic twice and guild-timed twice, leaving friends-timed and guild-classic unpassed in this source. It then verifies classic/timed personal-best payloads at key `v`, writes decoded numeric values at key `I` (timed divided by 100), or replaces invalid values with signed zero. Finally it nils `Bejeweled.UpdateSavedVariablesDatabase` and closes the method. |
| 3618 | Blank. |
| 3619–3629 | New `Ze` shadows the earlier dimension constant and parses the first space-delimited, lowercased command token from parameter `t`. Local `n` retains/slices the remainder, but that remainder has no observable use in the completed function. |
| 3630–3671 | For command `reset`, replaces `BejeweledProfile` with default aggregate/classic/timed stats, skill progress, and gameplay/publishing settings. This reset schema is direct wire-format evidence and differs from the beta-reset and migration-created shapes. |
| 3672–3726 | Completes the reset profile with friends/guild classic and timed leaderboards, each containing ten unsigned three-field PopCap fallback records. |
| 3727–3738 | If the main window was visible after reset, hide/show refreshes it. Any non-reset command instead toggles global `BejeweledWindow` through `getglobal`. Function `Ze` closes. |
| 3739 | Blank. |
| 3740–3742 | `Bejeweled.CreateCheckbox_OnClick` derives a setting key from the checkbox global name and writes `GetChecked()` into `BejeweledProfile.settings`. |
| 3743 | Blank. |
| 3744–3756 | `Bejeweled.CreateSlider_OnValueChanged` updates the bound setting only when its existing value is truthy, formats the caption as percentage or integer, and invokes optional `updateFunc` with method-call syntax. |
| 3757 | Blank. |
| 3758–3774 | `Bejeweled:CreateSlider` creates a globally named `OptionsSliderTemplate`, styles legacy named child regions via `getglobal`, creates its value caption, and applies min/max/step. Local result `t` shadows parent parameter `t` only after the initializer has consumed the parameter. |
| 3775–3796 | Initializes the slider from a truthy profile setting or default/minimum `o`, formats its caption, anchors it, installs the value-change handler, stores update/setting/percentage metadata, and returns the slider. |
| 3797 | Blank. |
| 3798–3816 | `Bejeweled:CreateCheckbox` creates a globally named check button and styles its named text region. Optional radio mode resizes it and selects atlas quarters for normal/highlight/checked/pushed textures. Local result `t` likewise shadows parent parameter `t` after initialization. |
| 3817–3827 | Anchors the control, checks it when saved setting `o` equals requested value `l`, installs supplied callback `n` or the default checkbox handler, returns the control, and closes the method. |
| 3828 | Blank. |
| 3829–3844 | New `fe` shadows the earlier signed-score verifier and serves as a throttled gameplay-timer update. It pauses during new-game spawning, caps deltas above one second to 0.1, accumulates to 0.1-second ticks, updates mode/global played time and elapsed/remaining counters, then resets the accumulator. |
| 3845–3872 | For non-classic modes, flight mode either enters learning/timer state at expiry or synchronizes against the flight timer when drift exceeds 0.6 seconds. Other timed modes clamp at zero, hide the timer, and call `Me`; the level bar is then updated. Function `fe` closes. |
| 3873 | Blank. |
| 3874–3878 | New `Le` shadows the earlier directional-clear helper and begins jewel spawning/refill for animator `i`. A one-shot `spawnedJewels` guard initializes cleared count and declares reused gem/spacing/coordinate temporaries plus three same-spelling `s` bindings whose final role remains beyond this batch. |
| 3879–3936 | Walks columns and rows bottom-up. Empty cells are queued as new jewels, level-spawn remnants update hyper/big-star counters and queues, `de` assigns new contents, randomized vertical gaps place gems above the board, and movement/effect/render/frame state is initialized before anchoring each gem. |
| 3937–3960 | In non-classic mode or level one, retries up to 200 times until `Q` finds a legal move. Each failure clears/refills all new jewels; attempt 50 forces a big-star explosion on the first new jewel and sets animator `forceBlow`. Local `d` is declared before this block but remains unresolved at the boundary. |
| 3961–3996 | During level spawning, restores the recorded number of big stars: each tries six random cells, then falls back to a cyclic full-board scan if needed. Created stars are hidden, added to the animator, and the pending count is reset. |
| 3997–4000 | Begins analogous restoration for recorded hyper gems, opening count and six-attempt random-cell loops. Both loops and function `Le` continue into batch 09. |
## Findings
- `UpdateSavedVariablesDatabase` is now complete. Its opt-in path deliberately clears `scoreList` and reloads UI; its completed path validates signed leaderboards and personal bests, then deletes the migration method itself.
- The source repeats two migration-helper calls instead of covering all four leaderboard lists and constructs the same globally named No button twice. These are preserved behavioral/defect candidates requiring equivalence tests, not inferred corrections.
- Profile construction has at least three shapes so far: beta reset, command reset, and migration initialization. The command-reset leaderboards use unsigned three-field entries, while migration defaults use signed four-field entries.
- New `fe` is a gameplay-timer updater and shadows the earlier score verifier only after migration finishes using the verifier. New `Le` is a spawn/refill controller and shadows the earlier directional-clear helper.
- Refill geometry derives each gem's off-board start and `maxYOffset` from column accumulation, row distance, constant `ne`, and randomized 30–50 spacing doubled during level spawning.
## API and architecture mapping
- `CreateFrame`, `SetBackdrop`, `ReloadUI`, `getglobal`, template names, named template children, texture coordinates, and frame scripts are legacy UI/API contracts requiring current authoritative Retail verification before implementation.
- `UI/Settings.lua`: checkbox/slider factories and callbacks; `Commands.lua`: `Ze` reset/toggle command.
- `Engine/Timer.lua`: shadowing `fe`; `Engine/BoardSpawn.lua`: open `Le` refill/legal-board/special-gem restoration flow.
## Forward dependencies
Batch 09 must continue at line 4001 inside the nested hyper-restoration loops of `Le`, resolve the final accessible `s` binding and local `d` only from the completed body, and trace how spawning finishes before assigning a definitive full function name or changing any reset/migration schema.
Assert-True($lineCount-eq8401)"Legacy source has $lineCount lines, expected 8401"
Write-Output"Verified: forbidden files absent; legacy and $($assetPaths.Count) asset hashes match $SourceCommit."
Write-Output"Verified: strict UTF-8 text, exact 8,401-line schedule, and complete batch-01/02/03/04/05/06/07 line coverage."
Write-Output"Verified: strict UTF-8 text, exact 8,401-line schedule, and complete batch-01/02/03/04/05/06/07/08 line coverage."
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.