@@ -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–10 (lines 1–5,000) are documented. The remaining batches are scheduled but not analyzed.
Batches 01–11 (lines 1–5,500) are documented. The remaining batches are scheduled but not analyzed.
@@ -14,7 +14,7 @@ Each row identifies one declaration, not merely one spelling. `chunk` means the
| `F` / chunk | 181 | Generated as 25 atlas rectangles, copied into `J`, and `F[1]` resets gem texture coordinates (199–208, 1969). | `gemAtlasRects` | working | High for gem consumer; atlas asset/other frames pending. | 01–04 | UI/GemPool, UI/Animations | Identify texture and off-by-one rationale. |
| `N` / chunk | 182 | Written as nine UV rectangles in a 3×3 loop (218–222). | `atlas3x3Rects` | working | High for shape: indices and 42.66/128 math. | 01–01 | UI/Animations | Identify texture/effect frames. |
| `J` / chunk | 183 | Receives copies of all `F` rectangles via `unpack` (204–208). | `mutableAtlas50Rects` | working | Medium: copy semantics are explicit. | 01–01 | UI/Animations | Why is a second copy required? |
| `O` / chunk | 184 | Written at 50 numeric indices using 10×5 normalized UV cells (188–198). | `atlas10x5Rects` | working | High for shape, medium for texture. | 01–01 | UI/Animations | Identify owning texture. |
| `O` / chunk | 184 | Written at 50 numeric indices using 10×5 normalized UV cells (188–198), consumed as the hyper-effect atlas (4618–4624), then shadowed by the sound factory at 5049. | `hyperFxAtlasRects` | resolved | High. | 01–11 | UI/Animator | None. |
| `ie` / chunk | 185 | Written at 16 indices using a 4×4 UV grid (211–217). | `atlas4x4Rects` | working | High for shape, medium for texture. | 01–01 | UI/Animations | Identify owning texture. |
| `t` / chunk (second binding) | 186 | Declared nil, then shadowed again at 263; no read. | — | dead | High: no assignment/read before shadow. | 01–01 | Unassigned | Minifier artifact? |
| `i` / chunk | 186 | Atlas scratch indexes `F`,`J`,`ie` (187–216); animator factory later reuses the captured binding for rotation angle radians (4939–4941). | `atlasOrAngleScratch` | resolved | High: both temporal roles explicit. | 01–10 | UI/Animations | Split roles in rewrite. |
@@ -37,7 +37,7 @@ Each row identifies one declaration, not merely one spelling. `chunk` means the
| `f` / chunk | 240 | Constant `160`; legal popup width is `f×2` and text width `f×1.8` (1658, 1676). | `legalPopupHalfWidth` | resolved | High: direct geometry use. | 01–04 | UI/HUD | Name reflects legacy arithmetic. |
| `E` / chunk | 243 | Receives `math.random`, copied to `m`, then nilled; later read as the nil reset value for`gem.fxType` (307–308, 1972). | `nilFxType` after temporary alias | resolved | High: temporal value flow is explicit. | 01–04 | UI/Animations | Preserve nil reset without retaining alias indirection. |
| `E` / chunk | 243 | Receives `math.random`, copied to `m`, then nilled; later resets`gem.fxType` (307–308, 1972) before being shadowed by the minimap factory at 5194. | `nilFxType` after temporary alias | resolved | High: temporal value flow is explicit. | 01–11 | UI/Animations | Preserve nil reset without retaining alias indirection. |
| `S` / chunk | 244 | Constant `-1`; assigned to hidden hint object's `fxType` during level-up reset (527). | `inactiveHintFxType` | working | Medium: reset/hide sequence (526–527). | 01–02 | UI/Animations | Confirm animator interpretation. |
| `y` / chunk | 245 | Constant `1`; assigned to non-hyper gems' effect type during board transition (1990–1992). | `gameOverGemFxType` | working | Medium: function incomplete. | 01–04 | UI/Animations | Complete `Ke` dispatcher evidence. |
| `V` / shadow function | 4971 | Network-frame factory remains open after 5000; shadows idle animator state captured by earlier closures/factory. | `createNetwork` | working | High for prefix. | 10–10 | Network/Transport | Complete in batch 11. |
| `o` / `V` local | 4974 | Network frame with queue, send method, throttling, and callbacks. | `network` | working | High for prefix. | 10–10 | Network/Transport | Complete in batch 11. |
| `V` / shadow function | 4971 | Constructs and installs the networkframe, send queue, one-second throttle, and receive dispatcher; closes at 5047 after shadowing idle animator state captured by earlier closures. | `createNetwork` | resolved | High. | 10–11 | Network/Transport | Factory installs globally rather than returning. |
| `o` / `V` local | 4974 | Network frame with queue, send method, throttling, receive callback, and final `Bejeweled.network` installation. | `network` | resolved | High. | 10–11 | Network/Transport | None. |
| `t`,`o` / network `OnUpdate` params | 4988 | Network frame and elapsed delta; callback continues after 5000. | `network`,`delta` | working | High for prefix. | 10–10 | Network/Transport | Complete in batch 11. |
| `t`,`o` / network `OnUpdate` params | 4988 | Network frame and elapsed delta; after a one-second accumulation the callback drains eligible queue entries until 20 sends succeed. | `network`,`delta` | resolved | High. | 10–11 | Network/Transport | Preserve successful-send rather than dequeue throttling. |
## Batch 10 resolution policy
`Se` and `A` close in this batch, so their data-flow roles and explicit method attachments are resolved. Implicit `frame2` is recorded as accidental global evidence. Network factory `V` and its open update callback remain working until batch 11.
| `e` / four network-throttle locals | 5005 | The first three duplicate declarations are hidden in the same statement; the surviving fourth is immediately hidden by line 5006 without a read. | — | shadowed | High. | 11–11 | Network/Transport | Minifier artifact. |
| `i` / network-throttle local | 5006 | Declared with parsed message fields but never assigned or read. | — | dead | High. | 11–11 | Network/Transport | None. |
| `o`,`e`,`n` / network-throttle locals | 5006 | Receive queue-head fields split on `~`: addon payload, distribution channel, and whisper target. | `payload`,`channel`,`target` | resolved | High. | 11–11 | Network/Transport | Preserve empty-target handling. |
| first `i` / network `OnEvent` params | 5023 | Hidden by the second same-spelling parameter. | — | shadowed | High. | 11–11 | Network/Transport | None. |
| second `i` / network `OnEvent` params | 5023 | Receives the event name in the callback position but is never read. | — | dead | High. | 11–11 | Network/Transport | None. |
| `o`,`n`,`t`,`e` / network `OnEvent` params | 5023 | Addon prefix, payload, distribution channel, and sender used for validation and dispatch. | `prefix`,`payload`,`channel`,`sender` | resolved | High. | 11–11 | Network/Transport | Sender comparison is not normalized. |
| `o` / network-command local | 5025 | Receives the first `+`-separated field and selects `HSPub`, `HSSync`, or `LogSync`. | `command` | resolved | High. | 11–11 | Network/Transport | None. |
| `i` / network-command local | 5025 | Declared but never assigned/read before callback close. | — | dead | High. | 11–11 | Network/Transport | None. |
| `i` / friend pre-loop local | 5029 | Hidden by the numeric-for variable at 5030 without a read. | — | dead | High. | 11–11 | Network/Transport | None. |
| `o` / friend-check local | 5029 | Holds each `C_FriendList.GetFriendInfo` result for exact comparison with sender. | `friendName` | resolved | High. | 11–11 | Network/Transport | Verify modern return contract before runtime. |
| `i` / friend loop | 5030 | Iterates friend indices from 1 through `GetNumFriends()`. | `friendIndex` | resolved | High. | 11–11 | Network/Transport | None. |
| `O` / shadow function | 5049 | Constructs and installs the sound frame, deferred flag player, click limiter, and mouse-away updater; shadows the hyper atlas captured by earlier closures. | `createSoundManager` | resolved | High. | 11–11 | UI/Sound | Factory installs globally rather than returning. |
| `n` / `O` local | 5050 | Sound frame configured with flags/timers/scripts and installed as `Bejeweled.sound`. | `soundManager` | resolved | High. | 11–11 | UI/Sound | None. |
| `t`,`n`,`o` / sound `Play` params | 5060 | Sound manager, named sound flag, and combo index capped at six. | `soundManager`,`soundName`,`comboIndex` | resolved | High. | 11–11 | UI/Sound | Non-combo callers may omit index. |
| `t`,`n` / sound `OnUpdate` params | 5079 | Sound manager and delta used for hover/click timing and flag playback. | `soundManager`,`delta` | resolved | High. | 11–11 | UI/Sound | Disabled sounds freeze both timers. |
| `e` / sound-root local | 5112 | Starts at `ut`, optionally appends `q_`, and prefixes every bundled sound filename in the pass. | `soundPath` | resolved | High. | 11–11 | UI/Sound | None. |
| `n` / combo pre-loop local | 5173 | Immediately hidden by the numeric-for variable at 5174. | — | dead | High. | 11–11 | UI/Sound | None. |
| `t`,`n` / minimap `OnMouseUp` params | 5226 | Minimap frame and mouse-button name; left release toggles the main window. | `minimapButton`,`mouseButton` | resolved | High. | 11–11 | UI/Minimap | None. |
| `t` / minimap-toggle local | 5230 | Main window whose visibility, alpha, overlay, sound, and pause state are changed. | `window` | resolved | High. | 11–11 | UI/Minimap, UI/MainWindow | None. |
| `e` / minimap `OnEnter` param | 5250 | Minimap frame used to show its highlight before the spelling is shadowed at 5253. | `minimapButton` | resolved | High. | 11–11 | UI/Minimap | None. |
| `e` / minimap-tooltip local | 5253 | Optional keybinding text wrapped in parentheses and appended to tooltip title. | `keybindingText` | resolved | High. | 11–11 | UI/Minimap | None. |
| `e` / minimap `OnLeave` param | 5261 | Minimap frame used to hide its highlight. | `minimapButton` | resolved | High. | 11–11 | UI/Minimap | None. |
| `a`,`l` / minimap-drag locals | 5268–5269 | Minimap center X/Y derived from its left/bottom and half dimensions. | `minimapCenterX`,`minimapCenterY` | resolved | High. | 11–11 | UI/Minimap | None. |
| `e`,`t` / minimap offset locals | 5270–5271 | UI-scaled cursor offsets from minimap center, then absolute cursor coordinates in the detached branch. | `x`,`y` | resolved | High. | 11–11 | UI/Minimap | Split offset/absolute roles in rewrite. |
| `e` / attached-angle local | 5280 | Shadows X offset inside the attached branch and stores degrees derived by `atan2`. | `angleDegrees` | resolved | High. | 11–11 | UI/Minimap | Preserve argument order/sign convention. |
| `g` / shadow function | 5290 | Begins the main-window constructor and shadows hyper-gem effect enum captured by earlier animator code; remains open after line 5500. | `createMainWindow` | working | High for ownership. | 11–11 | UI/MainWindow | Complete in batch 12. |
| `t` / `g` local | 5291 | Main window receiving backdrop, drag/show/hide/resize controls and child frames; factory remains open. | `window` | working | High. | 11–11 | UI/MainWindow | Complete constructor in batch 12. |
| `a` / main-window local | 5302 | Captured frame level used to place the resize handle three levels above it. | `frameLevel` | resolved | High. | 11–11 | UI/MainWindow | None. |
| `o` / backdrop local | 5303 | Descriptor from `C()` populated with window textures/dimensions and passed to `SetBackdrop`. | `backdropInfo` | resolved | High. | 11–11 | UI/MainWindow | None. |
| `t` / hide/show callback params | 5321, 5326 | Distinct window callback parameters that are never read. | — | dead | High. | 11–11 | UI/MainWindow | None. |
| `o` / close-button local | 5342 | Close button configured to hide the main window only when no popup is visible. | `closeButton` | resolved | High. | 11–11 | UI/MainWindow | None. |
| `t` / close callback param | 5347 | Callback button parameter is never read. | — | dead | High. | 11–11 | UI/MainWindow | None. |
| `t` / resize `OnMouseUp` param | 5425 | Callback handle parameter is never read. | — | dead | High. | 11–11 | UI/MainWindow | None. |
| `t` / size-change param | 5431 | Main window supplies width, menu state, and logo/icon children and receives derived height. | `window` | resolved | High. | 11–11 | UI/MainWindow | None. |
| `o`,`a`,`i`,`l`,`r` / size-change locals | 5432–5456 | Width/board scale, logo scale, icon scale, logo atlas metadata, and remaining logo width. | `scale`,`logoScale`,`iconScale`,`logoAtlas`,`availableLogoWidth` | resolved | High. | 11–11 | UI/MainWindow | Preserve quadratic threshold formulas. |
| `n` / main-window auxiliary local | 5473 | Initially the global show/hide button, then reassigned to the full-window mouse-over screen at 5485. | `auxiliaryFrame` | resolved | High. | 11–11 | UI/MainWindow | Split temporal roles in rewrite. |
| `t` / overlay `OnEnter` param | 5498 | Mouse-over screen callback remains open after its hiding guard at line 5500. | `mouseOverScreen` | working | High for frame role. | 11–11 | UI/MainWindow | Complete in batch 12. |
## Batch 11 resolution policy
Factories `V`, `O`, and `E` close and install their frames in this batch, so their bindings and callback roles are resolved. Network delimiter and throttle behavior, sound flag coalescing, minimap coordinate derivations, and completed resize arithmetic are behavior-critical evidence. Open factory `g` and its open overlay callback remain working until batch 12.
Source: `Legacy/Bejeweled_Mainline.lua` at commit `6faec1c`
Coverage: lines 5001–5500 inclusive
Blank: 5048, 5193, 5289
Status: complete; network factory `V`, sound factory `O`, and minimap factory `E` close, while main-window factory `g` and its mouse-over `OnEnter` continue into batch 12
## Line-indexed coverage audit
| Lines | Evidence represented |
| ---: | --- |
| 5001–5022 | Finishes the network `OnUpdate`. Each one-second service tick resets elapsed time and `throttleCount`, removes queued `~`-delimited entries from the head, sends eligible guild/whisper messages through `C_ChatInfo.SendAddonMessage`, and counts at most 20 successful sends. Invalid or currently ineligible entries are still discarded without consuming the quota, so a tick can drain more than 20 queue records. |
| 5023–5047 | Handles addon messages only for prefix `xe` while scores are migrated. It splits the first `+` into command/body, restricts whispered `HSPub` messages to exact friend-name matches, accepts non-whisper `HSPub` and all `HSSync` through `Ee`, and routes other-player `LogSync` through `dt`; then installs the frame as `Bejeweled.network` and closes `V`. |
| 5048 | Blank. |
| 5049–5078 | New `O` shadows the captured hyper-effect atlas and constructs `BejeweledSound`. Its `Play` method gates all requests on sound settings and window visibility, caps combo indices at six, rate-limits `GemClick` to one accepted request per 0.2 seconds, and sets named boolean flags for deferred playback. |
| 5079–5110 | Sound `OnUpdate` returns immediately while sounds are disabled; otherwise it advances hover/click timers. Every 0.5 seconds after the legal notice, leaving an unlocked/non-resizing window starts fade-out, exposes the mouse-over screen, hides the sound frame, and mouse-pauses gameplay; `waitMouseOver` reverses overlay state after reentry. |
| 5111–5171 | A pending sound pass selects normal root `ut` or its `q_` quiet variant, then independently consumes flags for invalid move, explosion, prompts, selection, power/hyper creation and destruction, click, board wipe, and electro explosion. Level-up uniquely uses the built-in `Sound\\Spells\\LevelUp.wav` path rather than the selected root. |
| 5172–5192 | Combo playback scans flags 1–6, consumes only the first active flag per update, maps level 1 to `gotset2.mp3` and higher levels to `combo(n+1)2.mp3`, and clears the aggregate `Combo` flag only after a scan reaches six with no earlier break. Installs `Bejeweled.sound` and closes `O`. |
| 5193 | Blank. |
| 5194–5219 | New `E` shadows the captured nil/reset binding and constructs the 33-pixel minimap frame, icon, tracking border, and hidden additive highlight. It starts at radius 105 and angle zero around the minimap. |
| 5220–5249 | Minimap press offsets the icon and starts right-button dragging. Release restores the offset/stops movement; left release hides the main window when no popup blocks it, or shows it at mouse-off alpha and establishes overlay, hidden sound frame, and mouse-pause state when the cursor is outside. |
| 5250–5264 | Hover shows highlight and a tooltip containing the optional configured keybinding; leave hides both. The local keybinding string shadows the consumed callback frame parameter. |
| 5265–5288 | During drag, cursor and minimap-center coordinates are normalized by UI scale. A distance greater than the minimap width detaches the icon, persists absolute X/Y, and anchors to `UIParent`; otherwise it derives/stores an angle with `atan2`, clears detached state, and reanchors on the 105-pixel circle. Installs `Bejeweled.minimap` and closes `E`. |
| 5289 | Blank. |
| 5290–5301 | New `g` shadows the captured hyper-effect enum and begins the main-window factory. It creates the initially hidden `q` by `me` top-level movable window and a mouse-bounds child expanded 20 pixels on every side. |
| 5302–5320 | Captures frame level, builds/applies the image-root-backed backdrop, enables left-button dragging unless the profile locks the window, and stops movement/sizing on drag end. |
| 5321–5341 | Hide clears global shown/activity state and resets active time. Show restores global state and game alpha, primes sound hover/wait state from cursor position, hides the overlay, shows the sound frame, and unpauses through `T(false)` when the summary is fully opaque. Callback frame parameters are unused. |
| 5342–5370 | Creates a close button that refuses to hide the game behind a visible popup. When optional `bCrowbar` exists, adds a textured control that toggles its window; its callback parameter is unused. |
| 5371–5406 | Creates the Menu button and toggles `menuWindow`, preserving its sub-screen through `keepScreen` when appropriate. Adds the 64-pixel window icon and constructs the Bejeweled logo from `largeText` dimensions and atlas coordinates; the texture local shadows its initialized container only after the RHS call. |
| 5407–5430 | Creates the bottom-right resize handle above the captured frame level. Right press restores canonical width/height; other presses begin right-edge sizing and set `resizing`. Release stops sizing. Resize bounds are half to 1.5 times the canonical dimensions. |
| 5431–5472 | `OnSizeChanged` derives board scale from width, switches the menu between `Menu`/50 pixels and `M`/26 pixels below 0.887, quadratically reduces icon scale below 0.855 with a 0.75 floor, and constrains logo width to remaining horizontal space. It scales board/summary, derives height as `(w+4)*scale+110`, refreshes the level bar according to game-over state, resizes logo/icon, and raises `resizeUpdate`. |
| 5473–5488 | Creates a one-pixel global show/hide toggle frame and attaches it to the window, then reuses the same local for the full-window mouse-over overlay and enables mouse input. |
| 5489–5500 | Overlay mouse-down cancels game-over hiding, sets fade duration to `-1`, restores hover/sound state, and hides the overlay. Its `OnEnter` begins with an early return while the window is hiding; the callback and factory continue in batch 12. |
## Findings
- Network throttling counts successful transport sends, not dequeued records. Unsupported channels, unavailable guild sends, and empty whisper targets are permanently dropped without using the 20-message quota.
- The network wire shape remains `messageType+field1~channel~target` in the queue and `command+body` on receipt; parsing stops at the first relevant delimiter assignments and must remain byte-compatible.
- Sound requests are flag-coalesced rather than queued. Multiple distinct flags may play in one update, while only one combo tier is consumed per pass; disabling sounds freezes the click and hover timers.
- Minimap detachment uses the minimap's full width as its radial threshold but the attached position uses a fixed 105-pixel radius. Detached X/Y and attached angle are distinct persisted layouts.
- Main-window resize is width-driven: height, board/summary scale, logo space, menu compactness, icon scale, and level-bar refresh all derive from the new width. The logo factor is ultimately overwritten by remaining-width arithmetic.
## API and architecture mapping
- Addon-message prefix registration/sending, guild state, friend enumeration, and the exact sender-name comparison are legacy networking contracts requiring authoritative Retail verification before implementation.
- `Network/Transport.lua`: completed queue serialization, one-second throttling, channel eligibility, receive dispatch, and global installation.
- `UI/Sound.lua`: deferred flag playback, quiet-asset selection, click throttling, and mouse-away pause/fade coordination.
- `UI/MainWindow.lua`: open factory `g`, backdrop/drag/show/hide controls, resize derivations, optional `bCrowbar` integration, and mouse-over overlay.
## Forward dependencies
Batch 12 must resume at line 5501 inside the mouse-over overlay `OnEnter`, close that callback and main-window factory `g` only when the source does, and determine the later ownership of the window children and remaining constructor locals without crossing line 6000.
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/08/09/10 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/09/10/11 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.