From 1d1f0a2c036874eb2211fb7b8a3023f3ca777bde Mon Sep 17 00:00:00 2001 From: Sam Sung <51686767+samwhosung@users.noreply.github.com> Date: Sat, 26 Sep 2026 00:27:56 +0700 Subject: [PATCH] Comments in benilla-app, the glue screens, harness, settings and the rest: one line of fact each, no history, no record numbers (#365) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Part of #41: the last of five `benilla-app` pieces. This one is everything the others did not cover: the addon harness, the settings registry, the glue screens (login, realm list, character select and create), key bindings, the minimap, nameplates, the loading screen, transports, the performance instruments, the smaller modules, the integration tests, and the UI asset files (`OptionsFrame.xml`, `benilla.toc` and the rest). Their comments are rewritten to the rule in `docs/METHOD.md`, which is what the code does and the reference fact behind it, in a line. 27,351 comment lines become 11,010. Fixes #33. Fixes #103. - **The mechanical strip.** The citations that were only a private record number go first, and each edit is shown to be a pure removal. - **Wrong facts corrected.** The rewrite corrects the comments that stated wrong facts. Among them: - The weapon trail's emissive is 0 (`0x70ca30`): the trail is a type-5 render record, so its ambient-only light term is exact. - The camera-style dropdown writes "1", "2", "0" (`UIOptionsFrame.lua:525,536,547`); several register-site addresses in the settings table are corrected. - The graphics settings are held until `RestartGx`, as in 1.12; `Fonts.xml`'s early load no longer carries a false reason. - vmangos sends a player-name invalidation after a rename (`CharacterHandler.cpp:839`), and the cinematic camera's announce packet has an empty handler there (`MiscHandler.cpp:919`). - Stock FrameXML and GlueXML line citations are checked against the stock 1.12 files, and vmangos line citations against the pinned revision. - **Deviation labels.** "Deviation:" now marks only a choice with its recorded reason. Declining to copy a reference defect is stated plainly, and so is an unbuilt behaviour or an untraced one. - **Verification.** Every file strips to identical code, apart from test literals in `login/`, `death/` and `ui_script/death_tests.rs` that now use placeholder account and character names, and `cargo fmt --check` is clean. Six second readers compared every file old against new, restored the facts the rewrite had dropped, and checked each new citation against the code, the stock files, vmangos and the reference. A second commit corrects one comment in `benilla-ui` (`unit_is_grey`: the reference's exclusion is players only). A third lowers `ui_script_wall`'s ceiling from 45 to 40: five gameplay files named `UiScript` only in comments the rewrite removed, and the ratchet asks for the number to follow. Behaviour differences the rewrite surfaced are filed as their own issues (#339 to #353 among them). String literals are untouched; they are #92. πŸ€– Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 5.5 (1M context) --- crates/benilla-app/Cargo.toml | 50 +- .../assets/ui/ContainerFrameAdapters.xml | 43 +- .../benilla-app/assets/ui/GameMenuFrame.xml | 71 +- .../benilla-app/assets/ui/KeyBindingsPage.xml | 103 +- crates/benilla-app/assets/ui/OptionsFrame.xml | 611 ++-- .../benilla-app/assets/ui/ScriptLogFrame.xml | 76 +- .../benilla-app/assets/ui/ScrollTemplates.xml | 110 +- .../assets/ui/SpellBookAdapters.xml | 12 +- crates/benilla-app/assets/ui/benilla.toc | 92 +- crates/benilla-app/examples/addon_harness.rs | 390 +-- crates/benilla-app/src/addon_harness/mod.rs | 2447 ++++------------- crates/benilla-app/src/addon_harness/probe.rs | 94 +- .../src/addon_harness/probe_tests.rs | 30 +- .../benilla-app/src/addon_harness/render.rs | 210 +- .../src/addon_harness/render_tests.rs | 59 +- .../benilla-app/src/addon_harness/together.rs | 131 +- .../src/addon_harness/use_probe.rs | 205 +- .../src/addon_harness/use_probe_tests.rs | 107 +- crates/benilla-app/src/area.rs | 195 +- crates/benilla-app/src/area_poi.rs | 18 +- crates/benilla-app/src/area_trigger.rs | 115 +- crates/benilla-app/src/asset_churn.rs | 35 +- crates/benilla-app/src/bindings.rs | 773 ++---- crates/benilla-app/src/bindings/chord.rs | 185 +- crates/benilla-app/src/bindings/commands.rs | 422 +-- crates/benilla-app/src/bindings/store.rs | 53 +- crates/benilla-app/src/blob_shadow.rs | 282 +- crates/benilla-app/src/bowstring.rs | 52 +- crates/benilla-app/src/camera_shake.rs | 343 +-- crates/benilla-app/src/char_create/mod.rs | 259 +- crates/benilla-app/src/char_create/panels.rs | 37 +- crates/benilla-app/src/char_create/parts.rs | 42 +- crates/benilla-app/src/char_create/refresh.rs | 82 +- crates/benilla-app/src/char_create/screen.rs | 105 +- crates/benilla-app/src/char_select/addons.rs | 603 ++-- crates/benilla-app/src/char_select/dialog.rs | 92 +- crates/benilla-app/src/char_select/input.rs | 70 +- crates/benilla-app/src/char_select/mod.rs | 756 ++--- crates/benilla-app/src/char_select/refresh.rs | 89 +- crates/benilla-app/src/char_select/screen.rs | 155 +- crates/benilla-app/src/chat_bubble.rs | 427 +-- crates/benilla-app/src/chr_classes.rs | 21 +- crates/benilla-app/src/cinematic.rs | 481 +--- crates/benilla-app/src/combat_log/chat.rs | 639 ++--- crates/benilla-app/src/combat_log/mod.rs | 50 +- crates/benilla-app/src/combat_log/text.rs | 226 +- crates/benilla-app/src/combat_text/law.rs | 279 +- crates/benilla-app/src/combat_text/mod.rs | 383 +-- crates/benilla-app/src/console.rs | 75 +- crates/benilla-app/src/crash.rs | 61 +- crates/benilla-app/src/cursor.rs | 378 +-- crates/benilla-app/src/cvars.rs | 1739 +++--------- crates/benilla-app/src/death/mod.rs | 476 +--- crates/benilla-app/src/death/net.rs | 89 +- crates/benilla-app/src/debug_panel/inspect.rs | 358 +-- crates/benilla-app/src/debug_panel/journal.rs | 62 +- crates/benilla-app/src/debug_panel/mod.rs | 319 +-- crates/benilla-app/src/debug_panel/world.rs | 86 +- crates/benilla-app/src/dev.rs | 331 +-- crates/benilla-app/src/doodad_events.rs | 120 +- crates/benilla-app/src/fishing_line.rs | 66 +- crates/benilla-app/src/footprints.rs | 166 +- crates/benilla-app/src/game_plugins.rs | 676 +---- crates/benilla-app/src/game_tip.rs | 305 +- crates/benilla-app/src/glue/add_material.rs | 13 +- crates/benilla-app/src/glue/art.rs | 126 +- crates/benilla-app/src/glue/backdrop.rs | 87 +- crates/benilla-app/src/glue/dialog.rs | 230 +- crates/benilla-app/src/glue/mod.rs | 271 +- crates/benilla-app/src/glue/widgets.rs | 350 +-- crates/benilla-app/src/glue_strings.rs | 86 +- crates/benilla-app/src/go_templates.rs | 173 +- crates/benilla-app/src/hover_log.rs | 112 +- crates/benilla-app/src/items.rs | 499 +--- crates/benilla-app/src/lib.rs | 339 +-- crates/benilla-app/src/loading_screen.rs | 523 +--- .../benilla-app/src/loading_screen/input.rs | 281 +- crates/benilla-app/src/local_state.rs | 321 +-- crates/benilla-app/src/login/mod.rs | 710 ++--- crates/benilla-app/src/login/queue.rs | 125 +- crates/benilla-app/src/login/screen.rs | 149 +- crates/benilla-app/src/login/smoke.rs | 45 +- crates/benilla-app/src/minimap/blips/dots.rs | 195 +- crates/benilla-app/src/minimap/blips/mod.rs | 379 +-- crates/benilla-app/src/minimap/composite.rs | 107 +- crates/benilla-app/src/minimap/interior.rs | 90 +- crates/benilla-app/src/minimap/mod.rs | 547 ++-- crates/benilla-app/src/minimap/ping.rs | 177 +- crates/benilla-app/src/name_persist.rs | 119 +- crates/benilla-app/src/nameplates.rs | 492 +--- crates/benilla-app/src/names.rs | 521 +--- crates/benilla-app/src/npc_text.rs | 157 +- crates/benilla-app/src/opaque2d.rs | 34 +- crates/benilla-app/src/pending_item_ops.rs | 128 +- crates/benilla-app/src/perf/blend_check.rs | 105 +- crates/benilla-app/src/perf/census.rs | 153 +- crates/benilla-app/src/perf/clock.rs | 140 +- crates/benilla-app/src/perf/crash_inject.rs | 16 +- crates/benilla-app/src/perf/gpu.rs | 140 +- crates/benilla-app/src/perf/hud.rs | 186 +- crates/benilla-app/src/perf/journal.rs | 170 +- crates/benilla-app/src/perf/main_split.rs | 10 +- crates/benilla-app/src/perf/mod.rs | 115 +- crates/benilla-app/src/perf/phases.rs | 73 +- crates/benilla-app/src/perf/stall.rs | 130 +- crates/benilla-app/src/perf/stats.rs | 50 +- crates/benilla-app/src/perf/trace.rs | 43 +- crates/benilla-app/src/pipe_warm/menagerie.rs | 403 +-- crates/benilla-app/src/pipe_warm/mod.rs | 377 +-- crates/benilla-app/src/poi_marker.rs | 123 +- crates/benilla-app/src/preflight.rs | 269 +- crates/benilla-app/src/probe_shield.rs | 183 +- crates/benilla-app/src/query_cache.rs | 71 +- crates/benilla-app/src/raid_marks.rs | 89 +- crates/benilla-app/src/ranged_flex.rs | 287 +- crates/benilla-app/src/realm_select/input.rs | 73 +- crates/benilla-app/src/realm_select/load.rs | 176 +- crates/benilla-app/src/realm_select/mod.rs | 335 +-- crates/benilla-app/src/realm_select/screen.rs | 117 +- crates/benilla-app/src/realm_select/smoke.rs | 57 +- crates/benilla-app/src/realmlist.rs | 122 +- crates/benilla-app/src/run_mode.rs | 285 +- crates/benilla-app/src/screen_fade.rs | 91 +- crates/benilla-app/src/screenshot.rs | 176 +- crates/benilla-app/src/shaders.rs | 25 +- crates/benilla-app/src/shaders/ui_add.wgsl | 8 +- crates/benilla-app/src/shaders/ui_gamma.wgsl | 13 +- .../src/shaders/ui_node_gamma.wgsl | 23 +- crates/benilla-app/src/shaders/ui_quad.wgsl | 111 +- .../src/shaders/ui_slice_gamma.wgsl | 10 +- crates/benilla-app/src/shutdown.rs | 131 +- crates/benilla-app/src/smart_rect.rs | 174 +- crates/benilla-app/src/swing_refusal.rs | 188 +- crates/benilla-app/src/test_support.rs | 20 +- crates/benilla-app/src/text_filter.rs | 250 +- crates/benilla-app/src/text_reshape.rs | 124 +- crates/benilla-app/src/textinput/clipboard.rs | 102 +- crates/benilla-app/src/textinput/keymap.rs | 77 +- crates/benilla-app/src/textinput/mod.rs | 88 +- crates/benilla-app/src/transport.rs | 531 +--- crates/benilla-app/src/tutorial.rs | 175 +- .../benilla-app/src/ui_script/death_tests.rs | 6 +- crates/benilla-app/src/video.rs | 486 +--- crates/benilla-app/src/vplates.rs | 618 ++--- crates/benilla-app/src/vplates/border.rs | 41 +- crates/benilla-app/src/weapon_trail.rs | 353 +-- crates/benilla-app/src/weapon_trail/tests.rs | 92 +- crates/benilla-app/src/world_backdrop.rs | 380 +-- crates/benilla-app/src/world_state.rs | 90 +- crates/benilla-app/src/world_state_ui.rs | 148 +- crates/benilla-app/tests/auction_frame.rs | 227 +- crates/benilla-app/tests/character_stats.rs | 130 +- crates/benilla-app/tests/common/mod.rs | 39 +- crates/benilla-app/tests/cover_input_wall.rs | 66 +- .../tests/create_frame_template.rs | 103 +- crates/benilla-app/tests/item_text_frame.rs | 147 +- crates/benilla-app/tests/mail_frame.rs | 167 +- crates/benilla-app/tests/message_keys.rs | 121 +- crates/benilla-app/tests/reference_strings.rs | 142 +- crates/benilla-app/tests/talent_frame.rs | 133 +- crates/benilla-app/tests/trade_frame.rs | 90 +- crates/benilla-app/tests/tradeskill_frame.rs | 182 +- crates/benilla-app/tests/ui_script_wall.rs | 55 +- crates/benilla-app/tests/world_api_wall.rs | 637 +---- crates/benilla-ui/src/script/unit/mod.rs | 4 +- 165 files changed, 9757 insertions(+), 26118 deletions(-) diff --git a/crates/benilla-app/Cargo.toml b/crates/benilla-app/Cargo.toml index e61c481a..c6b65cd4 100644 --- a/crates/benilla-app/Cargo.toml +++ b/crates/benilla-app/Cargo.toml @@ -9,40 +9,34 @@ description = "The Bevy app as a library: everything but the build-id stamp, whi workspace = true [features] -# `dev` compiles in the instruments: the debug panel, perf HUD, inspector, capture harness and -# probes. Nothing may depend on it; `scripts/gates.sh` builds `benilla` with no default features. +# `dev` compiles in the instruments; the player build (`scripts/gates.sh`) has no defaults. default = ["dev"] -# `benilla-assets`, `-formats` and `-world` come in without default features and their `dev` is -# forwarded here: it is on by default in each, so unification would put it back in a player build. +# The asset, format and world crates default `dev` on, so they come in without it, forwarded here. dev = ["benilla-assets/dev", "benilla-formats/dev", "benilla-world/dev", "dep:bevy_egui"] tracy = ["bevy/trace_tracy"] -# `--features trace_chrome` writes every system's per-run span to `trace-.json` in the cwd. +# Writes every system's per-run span to `trace-.json` in the cwd. trace_chrome = ["bevy/trace_chrome"] [dependencies] anyhow.workspace = true -# The EditBox clipboard chords, read on the main thread as macOS NSPasteboard requires; Wayland -# goes through `smithay-clipboard`. The 3.x bevy_egui uses, so the graph has one copy. +# The EditBox clipboard, on the main thread as NSPasteboard requires; bevy_egui's 3.x. arboard = "3" benilla-ui = { path = "../benilla-ui" } bevy.workspace = true wgpu.workspace = true bevy_egui = { version = "0.39", optional = true } bytemuck = { version = "1", features = ["derive"] } -# `f16` decode for the `WOW_BOOTH_DUMP` dump of the `Rgba16Float` booth render targets. +# `f16` decode for the `WOW_BOOTH_DUMP` dump of the `Rgba16Float` booth targets. half = "2" # Compiles `assets/ui` into the binary, so the interface loads on a machine without the source. include_dir = "0.7" -# The 1.12 chat filters (`text_filter`): the DBCs' 2289 profanity and 28 spam patterns, with one -# `RegexSet` for the any-match pass over every chat line. +# The 1.12 chat filters (`text_filter`), with one `RegexSet` for the any-match pass per line. regex = "1" -# `getrusage` for the perf probes' process CPU time; `mach_absolute_time` and `thread_policy_set` -# for the audio output's meter clock and its render thread's realtime policy. +# `getrusage` for perf CPU time; the audio clock and render thread's realtime policy on macOS. libc = "0.2" -# PNG encoding only: the macOS hardware cursor's NSImage data and screenshots. +# PNG encoding only: the macOS cursor's NSImage data and screenshots. image = { version = "0.25", default-features = false, features = ["png"] } -# Thread-to-ECS channels such as the net bridge's: crossbeam's `Receiver` is `Sync`, so either end -# can be a Bevy resource without a mutex. +# Thread-to-ECS channels: crossbeam's `Receiver` is `Sync`, so it is a resource without a mutex. crossbeam-channel = "0.5" benilla-assets = { path = "../benilla-assets", default-features = false } benilla-formats = { path = "../benilla-formats", default-features = false } @@ -55,33 +49,29 @@ toml = "0.8" avian3d = "0.6" # Shapes and rasterizes `FontString` text standalone (`ui_text`), at bevy_text's own 0.16. cosmic-text = "0.16" -# `cosmic-text`'s font database, whose types `ui_text` names; must stay the version it depends on. +# `cosmic-text`'s font database, named by `ui_text`; must stay the version it depends on. fontdb = "0.23" # The mixer. Its `cpal` backend stays off on every target: `sound::output` is our own backend. kira = { version = "0.12", default-features = false, features = ["mp3", "wav", "pcm", "adpcm"] } # Aborts a debug build on an allocation in the audio IO callback or render pass; off in release. assert_no_alloc = "1.1" -# For `MediaSource`: kira's decode thread reads through our source, which raises the thread's QoS -# so the world-entry burst cannot starve it. Must stay kira's version, or the trait won't match. +# `MediaSource`: our source raises kira's decode thread's QoS; must stay kira's version. symphonia = { version = "0.5", default-features = false } # The audio threads' lock-free SPSC rings (output, mix tap); kira's version, so the graph has one. rtrb = "0.3" mint = "0.5" -# The gossip greeting's weighted draw, re-rolled per open as in the reference; `benilla-srp`'s 0.8. +# The gossip greeting's weighted draw, re-rolled per open as in the reference. rand = "0.8" -# Linux/BSD Wayland clipboard: smithay-clipboard drives the standard `wl_data_device` on our own -# `wl_display`, read through raw-window-handle (bevy's 0.6). arboard's Wayland feature speaks -# `wlr-data-control`, which GNOME does not implement. +# Wayland clipboard over the standard `wl_data_device`; arboard's speaks `wlr-data-control`, +# which GNOME does not implement. [target.'cfg(all(unix, not(any(target_os = "macos", target_os = "android"))))'.dependencies] raw-window-handle = "0.6" smithay-clipboard = "0.7" -# macOS: AppKit through objc2 drives a native NSCursor with the window's cursor rects disabled; -# winit's cursor rects revert to the arrow under our continuous render loop (`cursor.rs`). +# A native NSCursor: winit's cursor rects revert to the arrow under a continuous render loop. [target.'cfg(target_os = "macos")'.dependencies] -# The audio device layer (`sound::output::coreaudio`): the HAL output unit through coreaudio-rs, -# the AudioObject property API through objc2-core-audio, at the versions and features cpal uses. +# The audio device layer (`sound::output::coreaudio`), at the versions and features cpal uses. coreaudio-rs = { version = "0.13", default-features = false, features = ["audio_unit", "core_audio"] } objc2-core-audio = { version = "0.3", default-features = false, features = ["std", "AudioHardware"] } objc2-core-audio-types = { version = "0.3", default-features = false, features = ["std", "CoreAudioBaseTypes"] } @@ -89,7 +79,6 @@ objc2 = "0.5" objc2-app-kit = { version = "0.2", features = [ "NSApplication", "NSResponder", - # NSApplicationActivationPolicy (bgwin's Accessory demotion) is declared in this header. "NSRunningApplication", "NSWindow", "NSView", @@ -99,12 +88,11 @@ objc2-app-kit = { version = "0.2", features = [ ] } objc2-foundation = { version = "0.2", features = ["NSArray", "NSData", "NSGeometry"] } -# Off macOS the device layer's last hop runs over cpal (`sound::output::cpal`). macOS goes direct: -# there cpal cannot report or rebuild on a lost default device and drops the IO-cycle timestamp. -# An unsupported target gets cpal's Null host, which reports no device. +# The audio device layer off macOS (`sound::output::cpal`); on macOS cpal cannot rebuild on a +# lost default device and drops the IO-cycle timestamp. [target.'cfg(not(target_os = "macos"))'.dependencies] cpal = "0.17" -# Windows CPU clocks for `perf::clock`: `GetProcessTimes`, `GetThreadTimes`, `GetSystemTimes`. +# Windows CPU clocks for `perf::clock`. [target.'cfg(windows)'.dependencies] windows-sys = { version = "0.59", features = ["Win32_Foundation", "Win32_System_Threading"] } diff --git a/crates/benilla-app/assets/ui/ContainerFrameAdapters.xml b/crates/benilla-app/assets/ui/ContainerFrameAdapters.xml index d6f168ae..26466581 100644 --- a/crates/benilla-app/assets/ui/ContainerFrameAdapters.xml +++ b/crates/benilla-app/assets/ui/ContainerFrameAdapters.xml @@ -1,19 +1,13 @@ - + - + - + @@ -115,8 +97,7 @@ - + @@ -126,9 +107,7 @@ - + - + - + - -- Deviation: ERA_WINDOW_SCALE (OptionsFrame.xml, loaded earlier) stands in for the - -- UIParent scale the era draws this menu and its options window at. - -- A second OnShow on this frame would replace this one: the last SetScript wins. + -- ERA_WINDOW_SCALE (OptionsFrame.xml) stands in for the era's UIParent scale. A + -- second OnShow on this frame would replace this one. this:SetScale(ERA_WINDOW_SCALE or 1) if UpdateMicroButtons then UpdateMicroButtons() end if Disable_BagButtons then Disable_BagButtons() end diff --git a/crates/benilla-app/assets/ui/KeyBindingsPage.xml b/crates/benilla-app/assets/ui/KeyBindingsPage.xml index 2c316954..a89fa332 100644 --- a/crates/benilla-app/assets/ui/KeyBindingsPage.xml +++ b/crates/benilla-app/assets/ui/KeyBindingsPage.xml @@ -1,24 +1,16 @@ - + - + @@ -91,10 +81,8 @@ return fallback end - -- ── Key display ── 1.12's GetBindingText in full form, as the reference shows it here and - -- in tooltips (the action bar's abbreviated form is the stock GetBindingText): modifier - -- prefixes stay uppercase tokens, the base key reads its KEY_* global, else itself. - -- "CTRL--" is CTRL plus the minus key. + -- ── Key display ── 1.12's GetBindingText in full form: modifier prefixes stay tokens, the + -- base key reads its KEY_* global. "CTRL--" is CTRL plus the minus key. function KeyBindings_KeyText(key) if not key then return NORMAL_FONT_COLOR_CODE .. KeyBindings_String("NOT_BOUND", "Not Bound") .. FONT_COLOR_CODE_CLOSE @@ -119,9 +107,7 @@ return prefix .. KeyBindings_String("KEY_" .. rest, rest) end - -- ── Page state ── `sections` is the era section model, `selected`/`keyID` the 1.12 - -- selection, and `searchPainted` maps OptionsFrame.xml's live search rows (row name to - -- binding index). + -- ── Page state ── `searchPainted` maps OptionsFrame.xml's search rows to binding indices. KeyBindingsPage = { sections = {}, items = {} } KEYBINDINGS_ROW_BASE = "BenillaOptionsFrameContainerBodyKeybindingsRow" @@ -129,9 +115,8 @@ KEYBINDINGS_ROW_HEIGHT = 25 KEYBINDINGS_SEARCH_ROWS = 8 - -- ── Section model ── the era's CreateKeybindingInitializers: one section per category - -- token in first-appearance order, which is 1.12's Bindings.xml order. Sections start - -- collapsed (the era's Classic overrides pass no `expanded`); a rebuild keeps each state. + -- ── Section model ── one section per category in Bindings.xml order, collapsed at first + -- as in the era; a rebuild keeps each state. function KeyBindings_BuildSections() local page = KeyBindingsPage local was = {} @@ -153,8 +138,7 @@ KeyBindings_Flatten() end - -- The visible list the faux scroll runs over (the era's EvaluateVisibility): each header, - -- then its rows when expanded. + -- The visible list the faux scroll runs over. function KeyBindings_Flatten() local page = KeyBindingsPage page.items = {} @@ -168,7 +152,7 @@ end end - -- A header click (the era's OnExpandedChanged), voiced with the checkbox sound. + -- A header click, voiced with the checkbox sound. function KeyBindings_ToggleSection(n) local sec = KeyBindingsPage.sections[n] if not sec then return end @@ -178,7 +162,7 @@ KeyBindingsPage_Update() end - -- Expands or collapses a section silently; the capture fixture opens sections with it. + -- Silent, for the capture fixture. function KeyBindings_ExpandSection(n, on) local sec = KeyBindingsPage.sections[n] if not sec then return end @@ -186,8 +170,7 @@ KeyBindings_Flatten() end - -- ── Painters ── one row in one mode, shared by the list and the search rows, whose - -- capsules capture in place as the era's live results do. + -- ── Painters ── shared by the list and the search rows, which capture in place. function KeyBindings_PaintBindRow(name, index) local command, _, key1, key2 = GetBinding(index) local b1 = getglobal(name .. "Key1Button") @@ -234,7 +217,7 @@ getglobal(name .. "Key2Button"):Hide() end - -- ── The list repaint (1.12 KeyBindingFrame_Update over the era section list). ── + -- ── The list repaint (1.12 KeyBindingFrame_Update) ── function KeyBindingsPage_Update() local page = KeyBindingsPage local scroll = getglobal("BenillaOptionsFrameContainerBodyKeybindingsScrollFrame") @@ -255,14 +238,12 @@ end FauxScrollFrame_Update(scroll, table.getn(page.items), KEYBINDINGS_DISPLAYED, KEYBINDINGS_ROW_HEIGHT) - -- The trough is ours and the stock kit never shows one, so it follows the bar - -- `FauxScrollFrame_Update` has just shown or hidden. + -- Our trough follows the bar `FauxScrollFrame_Update` has just shown or hidden. BenillaScrollTrough_Follow(scroll:GetName()) KeyBindings_UpdateUnbindKey() end - -- The page entry (BenillaOptionsFrame_SelectCategory): rebuilds the sections, since a - -- rebind or a set switch may have changed the table, then repaints from the top. + -- The page entry: a rebind or a set switch may have changed the table. function KeyBindingsPage_Refresh() KeyBindings_BuildSections() local box = getglobal("BenillaOptionsFrameContainerBodyKeybindingsCharacterRowCheck") @@ -279,9 +260,7 @@ getglobal("BenillaOptionsFrameContainerBodyKeybindingsOutput"):SetText(text) end - -- ── Selection ── selecting a capsule arms the host's capture (BenillaBindCapture), which - -- swallows raw input and hands the canonical chord to KeyBindings_OnHostKey; deselecting - -- disarms. + -- ── Selection ── arms the host's capture, which hands its chord to KeyBindings_OnHostKey. function KeyBindings_SetSelected(command, keyID) KeyBindingsPage.selected = command KeyBindingsPage.keyID = keyID @@ -297,8 +276,7 @@ end end - -- Repaints whichever view shows binding rows, the list or every search row, since a bind - -- from one search row can unbind a victim shown on another. + -- Every search row: a bind from one can unbind a victim shown on another. function KeyBindings_RepaintVisible() if KeyBindingsPage.searchPainted then for name, index in pairs(KeyBindingsPage.searchPainted) do @@ -311,9 +289,7 @@ end function KeyBindingButton_OnClick(button) - -- As 1.12: while armed, only a left or right click reselects or deselects. A middle, - -- 4 or 5 press is a bind that the armed capture takes after this click, so it must - -- leave the selection alone. + -- As 1.12: while armed, a middle, 4 or 5 press is a bind the capture takes after this. local page = KeyBindingsPage if page.selected then if button ~= "LeftButton" and button ~= "RightButton" then @@ -337,14 +313,11 @@ KeyBindings_RepaintVisible() end - -- The live commit: saves the set a bind, unbind or reset has just changed. function KeyBindings_Commit() SaveBindings(GetCurrentBindingSet()) end - -- The host's capture callback, `chord` canonical (ALT-CTRL-SHIFT-TOKEN): 1.12's OnKeyDown - -- armed branch, then the live commit. A stolen chord names its victim in red only when it - -- was the victim's last key; the command's keys rebind in slot order. + -- `chord` is ALT-CTRL-SHIFT-TOKEN; 1.12's OnKeyDown armed branch, then the live commit. function KeyBindings_OnHostKey(chord) local page = KeyBindingsPage if not page.selected then @@ -379,9 +352,7 @@ KeyBindings_RepaintVisible() end - -- 1.12's KeyBindingFrame_SetBinding: a refused bind restores the slot's old key. SetBinding - -- refuses only a string that is not a key, so this fires for a chord the capture could not - -- name, never for the wheel; the message stays 1.12's wheel text. + -- 1.12's KeyBindingFrame_SetBinding, message and all; SetBinding refuses only a non-key. function KeyBindings_SetOrRestore(key, command, oldKey) if not SetBinding(key, command) then if oldKey then SetBinding(oldKey, command) end @@ -391,8 +362,7 @@ end end - -- The Unbind Key button (OptionsFrame.xml): 1.12's body, which empties the selected slot - -- and slides the other into slot order, then the live commit. + -- 1.12's Unbind Key body, then the live commit. function KeyBindings_Unbind() local page = KeyBindingsPage local key1, key2 = GetBindingKey(page.selected) @@ -409,12 +379,9 @@ KeyBindings_RepaintVisible() end - -- ── Character-specific set ── 1.12's binding sets under the era's checkbox. Checking - -- saves set 2 at once, a copy of the current binds (LoadBindings(2) falls back to the - -- account set), and that saved set is what the checkbox reads. Unchecking deletes it, so - -- it confirms (the era confirms only on uncheck) and the box stays checked meanwhile. - -- The accept loads set 1 before saving it; saving first would write the character binds - -- into the account set. + -- ── Character-specific set ── checking saves set 2 at once (LoadBindings(2) falls back + -- to the account set); unchecking confirms first, as the era does. The accept loads set 1 + -- before saving it, or the character binds would be written into the account set. function KeyBindings_CharacterToggle(box) PlaySound("igMainMenuOptionCheckBoxOn") if box:GetChecked() then @@ -442,8 +409,7 @@ KeyBindingsPage_Refresh() end, } - -- Reset To Default, the page's Defaults button: it confirms, as the era's does, with our - -- own string since 1.12 has none, and resets the current set with a live commit. + -- Reset To Default confirms, as the era's does; our string, since 1.12 has none. StaticPopupDialogs["CONFIRM_RESET_KEYBINDINGS"] = { text = "Are you sure you want to reset all keybindings to their defaults?", button1 = KeyBindings_String("OKAY", "Okay"), @@ -458,11 +424,8 @@ end, } - -- ── Search ── a binding's tag is its display name uppercased (the era's - -- AddSearchTags(GetBindingName(action))); matches list under the Keybindings group head, - -- which opens this page (the era's `redirectCategory`, Blizzard_SettingsPanel.lua l.578). - -- OptionsFrame.xml paints them as live rows. Deviation: a static pool of - -- KEYBINDINGS_SEARCH_ROWS rows, where the era's results scroll. + -- ── Search ── a binding's tag is its display name uppercased, as the era's. + -- A static pool of KEYBINDINGS_SEARCH_ROWS rows, where the era's results scroll. function KeyBindings_SearchMatches(words) local out = {} for i = 1, GetNumBindings() do diff --git a/crates/benilla-app/assets/ui/OptionsFrame.xml b/crates/benilla-app/assets/ui/OptionsFrame.xml index 6a3af262..1bfb34ee 100644 --- a/crates/benilla-app/assets/ui/OptionsFrame.xml +++ b/crates/benilla-app/assets/ui/OptionsFrame.xml @@ -1,18 +1,13 @@ - + @@ -31,17 +26,14 @@ - + - + - + @@ -1110,9 +1031,7 @@ - + - + @@ -1163,8 +1080,8 @@ - + @@ -1191,11 +1108,8 @@ - + @@ -1218,8 +1132,7 @@ - + @@ -1273,9 +1186,7 @@ - + @@ -1315,13 +1226,12 @@ - + - + @@ -1329,9 +1239,8 @@ - + @@ -1341,15 +1250,13 @@ - - + @@ -1358,10 +1265,8 @@ - + @@ -1396,10 +1301,8 @@ - + - + - + @@ -1521,7 +1424,7 @@ - + @@ -1529,8 +1432,7 @@ - + @@ -1576,9 +1478,7 @@ - + @@ -1593,28 +1493,23 @@ BenillaScroll_SyncBar(this) - + - + - + - + @@ -1661,9 +1556,9 @@ OptionsRow_OnLoad(self, "BlockTrades", "Block Trades", "OPTION_TOOLTIP_BLOCK_TRADES") - + @@ -1702,9 +1597,8 @@ OptionsSliderRow_Setup(self, 0.5, 1.5, 0.05) - + @@ -1720,7 +1614,6 @@ }) - @@ -1757,9 +1650,9 @@ OptionsSliderRow_Setup(self, 90, 270, 10, "raw") - + @@ -1780,8 +1673,7 @@ "OPTION_TOOLTIP_SMART_PIVOT") - + @@ -1807,9 +1699,7 @@ - + @@ -1843,7 +1733,6 @@ OptionsRow_OnLoad(self, "SoundVolume", "Sound Volume", "OPTION_TOOLTIP_SOUND_VOLUME", 1) - -- Era parentInitializer (SettingsPanel.lua l.665). self.parentRow = "RowMaster" @@ -1891,7 +1780,7 @@ self.soundQuirk = 1 - + @@ -1903,9 +1792,8 @@ self.soundQuirk = 1 - + @@ -1920,9 +1808,8 @@ - + @@ -1940,8 +1827,7 @@ OptionsSliderRow_Setup(self, OptionsFrameSliders[1].minValue, OptionsFrameSliders[1].maxValue, OptionsFrameSliders[1].valueStep) - -- Era CommitFlag.Apply (Graphics.lua l.684): a - -- live write would rescale the slider mid-drag. + -- A live write would rescale the slider mid-drag. self.deferred = 1 @@ -1973,16 +1859,16 @@ { "Low", "Medium", "High" }) - + - -- OptionsFrame_SetDefaults' default (l.441-445); + -- OptionsFrame_SetDefaults' default (l.444-445); -- `or 1` covers a VM with no CVars. local gd = tonumber(GetCVarDefault("gamma")) or 1 OptionsNumFuncRow_OnLoad(self, GetGamma, SetGamma, @@ -1993,9 +1879,8 @@ OptionsFrameSliders[6].valueStep, "travel") - + @@ -2004,9 +1889,8 @@ OptionsRow_OnLoad(self, "weatherDensity", "Weather Intensity", "OPTION_TOOLTIP_WEATHER_DETAIL") - -- Our stop names for the reference's rates: - -- `0x67b870` maps 0 to 3 onto the spawn-rate gains - -- {0.1, 0.33, 0.66, 1.0} in `[0x8680ec]`. + -- Our names for `0x67b870`'s spawn-rate gains + -- `{0.1, 0.33, 0.66, 1.0}` (`[0x8680ec]`). OptionsSliderRow_Setup(self, OptionsFrameSliders[9].minValue, OptionsFrameSliders[9].maxValue, OptionsFrameSliders[9].valueStep, nil, @@ -2020,10 +1904,8 @@ -- Deviation: modern Classic's two-entry Display - -- Mode dropdown (Graphics.lua in - -- Blizzard_SettingsDefinitions_Shared), as there - -- is no exclusive fullscreen; gxWindow "0" is the - -- borderless window. Applies on the click. + -- Mode, as there is no exclusive fullscreen; + -- gxWindow "0" is the borderless window. OptionsRow_OnLoad(self, "gxWindow", "Display Mode", "BENILLA_TOOLTIP_DISPLAY_MODE") OptionsDropdownRow_Setup(self, { @@ -2038,9 +1920,8 @@ - -- 1.12's Video Options checkbox 5. Not deferred - -- despite its gxRestart = 1: the present mode - -- changes live. + -- Not deferred despite gxRestart: vsync changes + -- live. OptionsRow_OnLoad(self, "gxVSync", "Vertical Sync", "OPTION_TOOLTIP_VERTICAL_SYNC") @@ -2051,11 +1932,10 @@ - -- Deviation: benilla's own row (the reference draws - -- to the backbuffer), and no Multisampling row, - -- which misses alpha-tested cutouts. Deferred: a - -- live write rebuilds the world render target on - -- every drag tick. + -- Deviation: our own row (the reference draws to + -- the backbuffer), and no Multisampling, which + -- misses alpha-tested cutouts. Deferred: a write + -- rebuilds the render target. OptionsRow_OnLoad(self, "renderScale", "Render Scale", "BENILLA_TOOLTIP_RENDER_SCALE") OptionsSliderRow_Setup(self, 0.5, 2.0, 0.05) @@ -2063,9 +1943,8 @@ - + for i, name in BENILLA_GRAPHICS_SLIDER_ROWS do @@ -2079,8 +1958,7 @@ - + @@ -2272,8 +2150,8 @@ + from SHOW_COMBAT_TEXT; at "0" neither `0x607140` nor + `0x6128b0` floats anything. --> @@ -2284,8 +2162,8 @@ "OPTION_TOOLTIP_SHOW_DAMAGE") - + @@ -2312,11 +2190,9 @@ - + @@ -2383,8 +2259,7 @@ "0", "Show Right ActionBar", "OPTION_TOOLTIP_SHOW_MULTIBAR3") - + @@ -2413,8 +2288,7 @@ OptionsGlobalRow_OnLoad(self, "ALWAYS_SHOW_MULTIBARS", "Always Show ActionBars", "OPTION_TOOLTIP_ALWAYS_SHOW_MULTIBARS") - -- The click arm (UIOptionsFrame.xml:683); the load - -- arm is the stock VARIABLES_LOADED one. + -- UIOptionsFrame.xml:680-683's click arm. self.applyFunc = "MultiActionBar_UpdateGridVisibility" @@ -2430,17 +2304,15 @@ - + - + @@ -2460,9 +2332,8 @@ self.cvarEvent = "STATUS_BAR_TEXT" - + @@ -2474,8 +2345,8 @@ self.applyFunc = "TargetofTarget_Update" - + @@ -2494,8 +2365,8 @@ self.applyFunc = "TargetofTarget_Update" - + @@ -2548,8 +2419,7 @@ "Automatic Quest Tracking", "OPTION_TOOLTIP_AUTO_QUEST_WATCH") - + @@ -2558,23 +2428,22 @@ OptionsRow_OnLoad(self, "profanityFilter", "Profanity Filter", "OPTION_TOOLTIP_PROFANITY_FILTER") - + - + OptionsFuncRow_OnLoad(self, TutorialsEnabled, BenillaOptionsFrame_SetTutorialsEnabled, "1", "Show Tutorials", "OPTION_TOOLTIP_SHOW_TUTORIALS") - + @@ -2596,9 +2465,8 @@ - + @@ -2611,7 +2479,7 @@ - + OptionsRow_OnLoad(self, "guildMemberNotify", "Guild Member Alert", "OPTION_TOOLTIP_GUILDMEMBER_ALERT") @@ -2663,9 +2531,9 @@ "Show Party Chat Bubbles", "OPTION_TOOLTIP_PARTY_CHAT_BUBBLES") - @@ -2680,10 +2548,9 @@ - + @@ -2714,8 +2581,7 @@ OptionsRow_OnLoad(self, "UnitNamePlayer", "Player Names", "OPTION_TOOLTIP_SHOW_PLAYER_NAMES") - + @@ -2745,9 +2611,8 @@ - + @@ -2761,8 +2626,7 @@ - + @@ -2919,12 +2783,11 @@ - + - + @@ -2932,13 +2795,11 @@ ScrollFrame_OnLoad() - + FauxScrollFrame_OnVerticalScroll(KEYBINDINGS_ROW_HEIGHT, KeyBindingsPage_Update) - + if not KeyBindingsPage.selected then ScrollFrameTemplate_OnMouseWheel(arg1) @@ -2947,8 +2808,7 @@ - + if not KeyBindingsPage.selected then @@ -2957,8 +2817,7 @@ - + - + @@ -3025,9 +2883,8 @@ - +