mirror of
https://github.com/brues-code/ClassicAPI.git
synced 2026-11-16 08:00:42 +00:00
A ClassicAPI extension: scene:GetActorAtCursor() returns the shown actor under the cursor, and the scene scripts OnActorEnter / OnActorLeave (self, actor) run when that actor changes while the scene is the mouse focus. The pick is the world's own object pick (0x00480A50) on the scene's M2 scene, not a bounding-box test: EnableRayHits (0x007089B0), then CM2Model::SetHitTestMode(model, 1, 0, actor) (0x00713CB0, ret 0xC) on each shown actor's model and its children (held items, kit effects), as 0x00480D90 does for a unit; a child that is another actor's model (a seated rider) is left to that actor. M2SceneRayHit (0x007089C0, ret 0x10, retry 1 as the world passes) skins each instance animated in the latest collect on the CPU and returns the value of the nearest triangle. The ray empties the hit list on every call. The ray is in view space, where the collect leaves the instance matrices: the cursor (UI context +0x1118, NDC) in the paint's viewport (the frame's rect clamped to the screen), unprojected through the paint's own projection at view depth near and far. The paint's camera leg is now CameraTransforms, shared with the pick, so view insets and translation move the pick with the picture. CCamera::SetDeviceTransforms (0x007AC640) reads only the rect's aspect, so the clamped viewport is the space the cursor maps into. The hover runs from the scene's update walk, only while one of the two scripts is set (Frame::ExtraScripts cells) and the scene is the mouse focus (UI context +0x7C).