Files
wow_bejeweled/docs/analysis/lines-3001-3500.md
T

7.8 KiB
Raw Blame History

Batch 07: lines 30013500

Source: Legacy/Bejeweled_Mainline.lua at commit 6faec1c
Coverage: lines 30013500 inclusive
Blank: 3040, 3056, 3233, 3269, 3287, 3368, 3407
Status: complete; he closes at 3039 and Bejeweled:UpdateSavedVariablesDatabase continues into batch 08

Line-indexed coverage audit

Lines Evidence represented
30013039 Finishes the horizontal-run branch of match scanner he: creates a contents-9 hyper gem for qualifying five-or-more runs, reports the match, updates current-game and profile largest-cascade maxima, increments the per-color gemMatch counter, and returns match-found flag x. This resolves he across lines 28423039.
3040 Blank.
30413055 ce is the gem mouse-leave handler. It clears deferred hover when moves are disallowed; otherwise it ends eligible hover effects and reverses adjacent-highlight animation ke when the gem is not moving, then clears adj.
3056 Blank.
30573064 New chunk-local function Z shadows the earlier hyper-gem factory after he has captured that older binding. This function handles gem click/swap input, rejects absent-mode or paused state, and delegates jewel-edit clicks to bCrowbar when enabled.
30653087 When moves are disallowed, Z records or applies a deferred selection. In normal play it creates a hint animator from current legal-move finder Q, then starts selected-gem adjacency testing with boolean r.
30883100 Captures the current selection's grid coordinates and tests whether the clicked gem is one of its four orthogonal neighbors.
31013146 For an adjacent click, adds both gems to the animator, clears cursor/highlight state, configures hyper/color activation, and initializes reciprocal movement destinations, step vectors, partner references, movement flags, and the animator's moving-gem count. The hyper color target is derived from the non-hyper counterpart.
31473166 Captures the optional bCrowbar previous-board state. The snapshot creates or wipes each destination cell and copies every key/value from the corresponding jewelArray cell through nested numeric and generic loops.
31673212 Swaps contents and bigStar, resolves whether both participants were hyper gems, and combines hyper activation with he's match result. An invalid swap restores both fields, marks the pair invalid, and plays Invalid; a valid move increments game/profile move totals and awards move-100/move-250 skills. Locals t and e at 3208 snapshot o.fxType/o.fxFrame but are never read before their scope ends.
32133232 Completes adjacent-swap handling and the non-adjacent path: clicking the selected gem clears selection; clicking another gem transfers selection and hover/adjacent effects. Function Z then closes.
3233 Blank.
32343268 New ee shadows the earlier power-gem factory after he captured it. As the drag-release handler, it optionally creates a hint, reads cursor coordinates, chooses the dominant horizontal or vertical displacement, maps that direction to an in-bounds neighbor, and invokes click handler Z; no valid neighbor clears selection/hover state.
3269 Blank.
32703286 U is the tab-click handler and shadows the earlier gem-color-name table only for later code. Its first local e is immediately shadowed and dead; it resolves the parent, hides all four content panes, selects the requested pane, and applies selected/unselected tab textures and label colors.
3287 Blank.
32883298 nt begins leaderboard-row population for owner o and list key r, shadowing the earlier direction constant. It refreshes guild data, scrubs lists, binds the selected score list and player/friend context, and initializes cyan/green name colors. The duplicated t declarations at 3293 are superseded by the row-loop variable without an intervening read.
32993367 Iterates ten display rows, unpacks classic and timed leaderboard records, formats rank and score, and colors PopCap, player, friend, and guild entries. Two nested friend scans test membership. Rank texture coordinates use a 16-pixel cell normalized by 128.
3368 Blank.
33693378 Ne is the timer-window OnUpdate handler, shadowing an earlier direction constant for later code. It accumulates elapsed time and performs work at 0.1-second granularity; after consuming parameter n, a local n is declared for the timed window. It advances elapsed time, decrements remaining time, and updates Legendary Journey progress.
33793406 After more than four seconds it lazily registers PLAYER_MONEY, disables the flight checkbox below 60 seconds, expires the timer at zero, and updates visible timer text. The window accumulator and display are reset/updated only at the throttled interval.
3407 Blank.
34083411 Begins Bejeweled:UpdateSavedVariablesDatabase and exposes selected internals to bCrowbar: board grid, current game, gem renderer, and match scanner. This method remains open at the batch boundary.
34123462 Beta-reset branch clears selected BejeweledData flags and replaces BejeweledProfile with a compact default schema: classic/timed and aggregate statistics, skill progress, and gameplay/publishing settings. These assignments are wire-format evidence, not authorization to migrate either saved-variable table.
34633492 Binds classic/timed stat tables, saved state, and player name; upgrades an unversioned profile by setting version/migration fields and re-signing its saved score; supplies defaultPublish; then reuses o for a player checksum. When scoreList is absent it zeros both scores, seeds friend/guild leaderboards, and writes signed zero payloads at shared chunk key v in both mode tables.
34933500 If score migration has not been marked complete, creates popup frame n, sizes and centers it, enables mouse input, marks it top-level, and hides it initially. The popup construction, conditional, and UpdateSavedVariablesDatabase all continue in batch 08.

Findings

  • he resolves as findAndMarkMatches: it returns whether any match was found after updating cascade and per-color statistics.
  • The new Z is the click/swap controller, not the hyper-gem factory. The new ee is drag-release direction handling, not the power-gem factory. Lua lexical capture means he retains both earlier factory bindings.
  • Swap validation is optimistic: visual/game state is exchanged first, then he decides whether to keep the move; invalid swaps restore state and use explicit invalid-animation flags.
  • nt owns leaderboard presentation and encodes rank-atlas geometry as 16 / 128; name color is data-derived from PopCap/player/friend/guild membership.
  • UpdateSavedVariablesDatabase supplies direct evidence for both persistent wire formats. Its beta reset and unversioned-profile upgrade must remain descriptive until the method and all consumers are analyzed.

API and architecture mapping

  • GetCursorPosition, C_GuildInfo.GuildRoster, C_FriendList, IsInGuild, frame registration, texture-coordinate, and text calls are legacy API contracts requiring current authoritative Retail verification before implementation.
  • Engine/Input.lua: Z, ee, selection, adjacency, swap setup, invalid rollback.
  • Engine/Matches.lua: completed he contract and hyper activation.
  • UI/Leaderboard.lua: nt; UI/Tabs.lua: U; UI/Timer.lua: Ne.
  • Persistence/Migration.lua: UpdateSavedVariablesDatabase, pending completion and schema proof in later batches.

Forward dependencies

Batch 08 must continue at line 3501 without treating the partially constructed score-migration popup or UpdateSavedVariablesDatabase as complete. It must trace the rest of the migration, all signatures/checksums, and every mutation of BejeweledData and BejeweledProfile before any schema conclusion.