mirror of
https://github.com/brues-code/ClassicAPI.git
synced 2026-11-16 16:10:36 +00:00
* feat(frame): multiply frame alpha into child frames, as 3.x does A frame now draws at its own alpha times its parent's drawn alpha, and GetAlpha returns the frame's own alpha. Vanilla keeps one alpha per frame and copies it into the children that exist when SetAlpha runs: - an XML frame with alpha="0" drew its child frames at full alpha, because the attribute is applied before its <Frames> are built; - a child's own alpha was overwritten whenever its parent's changed; - a frame created or reparented under a transparent frame drew opaque. Zygor Guides Viewer's border glow is the first case. It is an alpha="0.0" frame whose child holds the glow textures, so on vanilla the glow covered the guide frame from login until the first step flash. Co-hooks the engine's alpha setter, SetParent, the frame destructor and frame GetAlpha. Own alpha lives in a table keyed by frame. The engine's byte holds the drawn value, so region recolors and the Model family's model alpha read it unchanged. Children are recomputed through their own vtable setter, as the engine's copy-down calls it. Vanilla code that shows a child under a transparent parent (parent:SetAlpha(0); child:SetAlpha(1)) now leaves the child hidden, as 3.x does. Verified in-game (1.12.1 client via VanillaFixes, Zygor Guides Viewer 2.0): Zygor's guide frame no longer shows its border glow from login. With own alphas 0.5 / 0.8 / 1.0, a child and a grandchild draw at 0.4; the child of an XML frame with alpha="0" keeps its own 1.0 and draws at 0; a child keeps its own 0.5 while its parent goes to 0.2 and back to 1; a frame with its own 0.6 draws at 0.3 under a 0.5 parent and at 0.18 once moved under a 0.3 one. * fix(frame): match 3.3.5's effective-alpha math and read it from the byte - Multiply child alpha by truncating (a*b/255), as 3.3.5's CSimpleFrame::UpdateAlpha and GetEffectiveAlpha do, instead of rounding. - GetEffectiveAlpha reads the frame's alpha byte, which Frame::Alpha keeps at the drawn value, instead of multiplying GetAlpha up the parent chain. This is 3.3.5's Script_GetEffectiveAlpha. Drops the now-unused FUN_SCRIPT_REGION_GETPARENT. - Drop the reload cleanup of the own-alpha table. The frame destructor hook already removes each frame's entry, and a frame that outlives a /reload would have lost its own alpha. - Rewrite the API.md frame-alpha and GetEffectiveAlpha sections as user-facing behavior. --------- Co-authored-by: Brues <5278969+brues-code@users.noreply.github.com>