mirror of
https://github.com/brues-code/ClassicAPI.git
synced 2026-11-16 08:00:42 +00:00
The 1.12.1 client draws Chain Lightning's arcs from a spell visual kit procedure of kind 0 or 12 (0x0060D7FC, through the byte table at 0x0060DC20 to 0x006ECB90). The procedure's values decode, as the area kit does (bits of value + 512.0, shifted right 14), to a SpellChainEffects id, a strand count capped at 3 (0x006ECC65) and a persistent flag. Chain Lightning's cast kit 321 has kind 12, chain 1, one strand; row 1 of SpellChainEffects.dbc is segment 2.78, width 0.5, jitter 0.04, texture period 1.0, life 1000 ms, Textures\SpellChainEffects\Lightning.blp. Each hop of the world's LightningObject gets a bolt from the client's lightning renderer (Lightning.cpp, a 32-byte __thiscall object): Init 0x007B0760, Destroy 0x007B0780, CreateBolt 0x007B07F0 (ret 0x2C), MoveBolt 0x007B0950, ShowBolt 0x007B0BD0, DestroyBolt 0x007B0AC0, Update 0x007B0A40 and Render 0x007B0A80. The hop update (0x006EC460) creates the bolt with the row's shape, then moves it between its ends each frame; the caster's end is its $CSL event point, else its position raised by 0.75 of its height (0x006EC6F0), and the target's is the attachment the spell visual's +0x24 names, else its position (0x006EC780). A scene now owns one renderer and drives it through those functions (model/SceneChain.cpp). A scene cast has one target, so a chain is one hop from the caster to the target, timed on the scene clock for the row's life, hidden while either actor is hidden. The bolts update after the actors and draw after the translucent models. The per-bolt draw (0x007AFCB0) pushes and pops its render states and restores the device view and the transforms it changes, so the frames drawn after the scene are not affected. The kit-byte decode is shared with the area emitter as Model::Scene::DecodeKitByte. The world has no pause, so a missile's flight loop ran on through a paused scene. A paused scene or caster now stops the loop at once, and the loop starts again from the spell visual's missile sound when the pause ends; a hidden scene's missiles get their sound back the same way. docs/API.md gains the scene actor methods of this branch that had no entry: actor:SetModelBySpellArea, actor:SetGroundReticle / ClearGroundReticle / GetGroundReticle and actor:SetMovementSpeed / GetMovementSpeed, with the chain bolts and the paused sounds in the PlaySpellVisual, scene:SetPaused and actor:SetPaused entries.