src/main.cpp connects the stock client callbacks to GameHud, the view code and weapon behavior. The radar has additional local rules.
GameHudowns the HUD components. Keep component state with that owner and reset it through the existing HUD lifecycle instead of adding another process-wide cache.- Trace
HUD_Redraw,HUD_VidInit,HUD_Reset,HUD_InitHUDDataand shutdown separately when changing state lifetime. A round reset, video reset and map transition invalidate different data. - Keep the explicit
Sys_Errorcleanup insrc/main.cpp: this exit path skipsHost_Shutdownand thereforeHUD_Shutdown. GL resources and hook subscriptions must be released while the engine and its context are still available, including on this path. - Restore patched callbacks and remove subscriptions before destroying the state they call. C callback sinks must be null outside their owner's lifetime.
- The stock
client.dll(client.soon Linux) has its own engine function table, reached through NitroApi'sClientData::gEngfuncs. It is distinct from this module'sgEngfuncscopy. A hook intended to intercept stock HUD drawing must patch the former; changing the latter misses those calls. - When wrapping a draw callback, preserve its return value and state changes as well as its pixels. String width, final cursor position, glyph advance and ambient text color have different contracts across the engine's text entry points.
- Determine observer mode and observed player from the live client state. A local player's state, an observed entity and a server broadcast can describe different players or moments; do not substitute one for another without checking the recipient and update rules.
- Use
goldsrcconstants and NitroApi declarations for engine facts. Usencl_mathtypes inside owned calculations; convert raw engine vectors at the boundary. Keepmain.hahead of legacy SDK headers that depend on its declarations.
Build client_mini and run the affected cases in client_mini-tests, view-tests and crosshair-tests. Keep geometry, policy and buffering decisions independent of the engine so those tests can exercise them. Engine callback fakes verify arguments, return values and ordering; they do not verify the actual GL output.
For radar shader changes, also build and run radar-gl-tests. It checks production shader pixels with an offscreen GL context; context requirements and commands are in the verification procedure.
For public header or callback changes, also build their consumers, particularly gameui for the shared radar cvar table in include/next_client_mini/radar_cvars.h.