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) <noreply@anthropic.com>
83 lines
3.0 KiB
Rust
83 lines
3.0 KiB
Rust
//! The engine-drawn bowstring: bow M2s have no string geometry. The reference's per-frame callback
|
|
//! (`0x611ff0`) draws a two-segment line between the `$WTT`/`$WTB` limb-tip markers, its middle
|
|
//! vertex at the HandArrow attach while the nock latch (`[+0xd58] & 0x4000`) holds, else the tip
|
|
//! midpoint. Drawn here as gizmo lines; the color and width are inferred, since the reference's
|
|
//! packed vertex color is not decoded.
|
|
//!
|
|
//! The tips are posed: `$BWP` plays BowPull (160) on the prop and `$BWR` returns it to Stand (0),
|
|
//! so the markers ride limb bones that bend through the draw.
|
|
|
|
use bevy::prelude::*;
|
|
|
|
use crate::creature_anim::NockLatch;
|
|
use crate::entities::BoneAttach;
|
|
|
|
/// The HandArrow attach id (35, `0x6121b8`): the string's middle point while nocked.
|
|
const HAND_ARROW: u16 = 0x23;
|
|
|
|
/// Marks a bow prop root whose model authors the `$WTT`/`$WTB` anchors; despawned with the prop.
|
|
#[derive(Component)]
|
|
pub(crate) struct Bowstring {
|
|
/// The unit wearing the bow, which carries the HandArrow attach and the nock latch.
|
|
pub(crate) owner: Entity,
|
|
/// The `$WTT` top and `$WTB` bottom anchors as `(bone, model-local offset)`.
|
|
pub(crate) top: (u16, Vec3),
|
|
pub(crate) bottom: (u16, Vec3),
|
|
}
|
|
|
|
/// Draws every visible bow's string, tip to middle to tip, from this frame's joint frames.
|
|
fn draw_bowstrings(
|
|
bows: Query<(
|
|
&Bowstring,
|
|
&GlobalTransform,
|
|
&InheritedVisibility,
|
|
Option<&benilla_world::rig_anim::RigPose>,
|
|
)>,
|
|
owners: Query<(
|
|
&BoneAttach,
|
|
&benilla_world::rig_anim::RigPose,
|
|
Has<NockLatch>,
|
|
)>,
|
|
joints: Query<&GlobalTransform>,
|
|
mut gizmos: Gizmos,
|
|
) {
|
|
// Inferred: the reference's packed vertex color is not decoded.
|
|
const STRING_COLOR: Color = Color::srgb(0.12, 0.10, 0.08);
|
|
for (bs, prop, vis, flex) in &bows {
|
|
if !vis.get() {
|
|
continue;
|
|
}
|
|
// The prop's own pose when it flexes (`joints_root` is this entity); its rigid frame
|
|
// otherwise.
|
|
let tip = |(bone, offset): (u16, Vec3)| {
|
|
flex.and_then(|p| p.posed_point(prop, bone, offset))
|
|
.unwrap_or_else(|| prop.transform_point(offset))
|
|
};
|
|
let top = tip(bs.top);
|
|
let bottom = tip(bs.bottom);
|
|
let middle = owners
|
|
.get(bs.owner)
|
|
.ok()
|
|
.filter(|(_, _, latched)| *latched)
|
|
.and_then(|(bones, pose, _)| {
|
|
let &(bone, offset) = bones.points.get(&HAND_ARROW)?;
|
|
pose.posed_point(joints.get(pose.joints_root).ok()?, bone, offset)
|
|
})
|
|
.unwrap_or_else(|| (top + bottom) / 2.0);
|
|
gizmos.line(top, middle, STRING_COLOR);
|
|
gizmos.line(middle, bottom, STRING_COLOR);
|
|
}
|
|
}
|
|
|
|
/// Registers the string drawer after the palette pass, beside the other joint-frame readers.
|
|
pub(crate) struct BowstringPlugin;
|
|
|
|
impl Plugin for BowstringPlugin {
|
|
fn build(&self, app: &mut App) {
|
|
app.add_systems(
|
|
PostUpdate,
|
|
draw_bowstrings.in_set(benilla_world::billboard::BillboardPlace),
|
|
);
|
|
}
|
|
}
|