How units are drawn
A unit type leads to its picture through four tables:
units.dat[id].flingy ─▶ flingy.dat.sprite ─▶ sprites.dat.image ─▶ images.dat.grp
─▶ images.tbl ─▶ unit\…\*.grp
A GRP is a sprite sheet: a set of frames in the tileset's palette, with one frame per facing for anything that turns. The extraction walks this chain from all 228 unit types and from all 517 entries of the sprite table, so pure sprites and doodad overlays have graphics as well. Sprite sheets are fetched the first time something needs them, so a melee map pulls minerals, geysers and start locations and nothing else.
Team colour is palette indices 8 to 15 of a GRP, remapped through the row of
tunit.pcx for the owning player's colour and painted through the tileset's palette.
Sprites therefore need the tileset loaded as well. Pink and the custom RGB colours a
Remastered map can set have no row to remap to, so the editor synthesises a ramp for
them.
Animation#
Placed units run their idle animations when View ▸ Animate Units is on. Every unit's script is stepped once per game frame, 42 ms at Fastest, on the same clock as the water, and Preferences ▸ View scales the rate on its own.
Each unit is a stack of images, shadow, body and overlays, each with its own script. Buildings play their Built animation; tanks and Goliaths play StarEditInit, StarEdit's own hook, which adds the turret. That is what gives turning turrets, pulsing Hatcheries, marines looking around, the Nexus glow, Starport lights and refinery smoke.
Damage overlays follow hit points: a building below two thirds burns (Terran), sparks
(Protoss) or bleeds (Zerg) at the positions its .lo file gives, with more of them the
lower the hit points and the large effect below one third. Fire draws through the
tileset's own remap tables, extracted beside its graphics. Cloaked units draw half
transparent. Anything that needs the running game, attacks, sounds, projectiles and
condition jumps, is skipped.