Skip to content

CGame API

zturtleman edited this page Sep 29, 2014 · 16 revisions

In the future this page will document the CGame/UI API functions, structures, and enums. (It may primarily focus on new things and changes compared to quake3.)

For now see code/cgame/cg_public.h, code/cgame/cg_syscalls.h, bottom of code/game/bg_public.h, and code/renderercommon/tr_types.h.

Porting Notes

refEntity_t shaderTime

shaderTime in refEntity_t has been changed from a float to an int. No longer convert milliseconds to seconds when sending time to engine. This was changed to allow fixing time precision loss issues at long uptimes in the engine later. For now, it's just a different way of storing / setting the time. Also see API change commits for engine and cgame.

Old method of setting it:

ref->shaderTime = cg.time / 1000.f;

New method of setting it:

ref->shaderTime = cg.time;

Ambient Light

In Quake 3, ambient light is added to every model that is drawn. In RTCW there is refEntity_t::hilightIntensity and RF_MINLIGHT. EF, ET, JK2/JA SP and MP have different ways as well. In Spearmint it's controlled using refEntity_t::ambientLight[3], RF_CONST_AMBIENT, and RF_NO_DIRECTED_LIGHT. See Research:refEntity_t Lighting Control for more details and game specific examples.

Cinematic Drawing

trap_CIN_PlayCinematic and trap_CIN_SetExtents in Spearmint expect x, y, width, and height to be in window coords (like all other draw system calls), Q3/RTCW/ET/EF (and all other id Tech 3 games?) expect virtual 640x480 coords. Changed in commit 62f36a.

Clone this wiki locally