mirror of
https://github.com/brues-code/ClassicAPI.git
synced 2026-11-16 16:10:36 +00:00
actor:SetNameText(text [, r, g, b]) / ClearNameText / GetNameText show a name over the head. It is drawn the way the 1.12.1 world draws a unit's name (PLAYERNAMEDESC::UpdatePlate, 0x6C6E90): - It runs from the body model's draw callback, installed with SetDrawCallback (0x710DB0, list0 0) as the unit's is at 0x6C7756. It draws only when CM2Model::IsReady (0x710450), as PlayerNameDrawCallback (0x6C7780) checks. - The plate scale is 0.2, or d / 4 * 1.5 * 0.2 above 4 yards, where d is the name height over the feet (0x6C6F10..0x6C6F3C, reading the constants at 0x8112A8, 0x8112AC and 0x80679C). - The text is made with GxuFontCreateString (0x5C1C30) on the world's name font (0xCE8738), with the grammar pass (0x7716F0), a 100000 box, justification 2/1, flags 0xC8 and the colour. The block height is the extra lines times the scale. - Each draw adds the string to the world's name batch (0xCE8734, 0x5C1E60), places it at the name position raised by the block height (0x5C2770) and draws the batch (0x5C1EF0). A colour change alone goes to GxuStringSetColor (0x5C2750), as the colour refetch does. A custom draw runs under the scene's rebased view with a zero offset (0x70D96D). The paint gives the scene its eye as the origin, so the callback places the name at its absolute scene position, as the world does. actor:GetNamePosition() mirrors CGUnit_C::GetNamePosition (0x608640). It uses attachment 18 on the model. A seated rider counts as mounted, so it uses attachment 29 on its mount's model. Without the attachment, the point is 1.25 times the scaled box height above the feet. The name font and batch exist only in the world: world entry makes them (0x6C7470), and PlayerNameShutdown (0x6C7630) frees them in ClientDestroyGame (0x40202F), before CGGameUI::ShutdownGame. Each actor therefore keeps the font its string was made with, and frees the string only while that font still exists. At the glue screens no name draws.