BASEQ3 Runthrough, Client-side
Synopsis
Illustration of an execution path through a Q3 cgame module (baseq3), from startup through gameplay though shutdown, for client-side mode, in outline form.
Motivation:
Enhanced understanding of Q3A to assist in modding and total conversions.
Caveats:
This document certainly is not a thorough understanding nor explanation of Q3.
Information was gleaned by poring through the cgame source text, with minimal testing.
Most of the statements made in this document are based on source comments and gut feelings
.
See outline1.html regarding vmMain().
Many descriptions of game's vmMain() also applies to cgame module.
A quick overview of the vmMain commands (major cgame functions) in baseq3:
- CG_INIT
-
When cgame starts (on a new map, level, connect, reconnect, etc.).
- CG_SHUTDOWN
-
Upon cgame shutdown (disconnecting, kicked, crash).
- CG_CONSOLE_COMMAND
-
A console command that the engine does not recognize.
- CG_DRAW_ACTIVE_FRAME
-
To draw stuff on the screen.
- CG_CROSSHAIR_PLAYER
-
XXX: ???
- CG_LAST_ATTACKER
-
XXX: ???
- CG_KEY_EVENT
-
When key-trapping is enabled, on a key event (press or release).
- CG_MOUSE_EVENT
-
When mouse-trapping is enabled, on a mouse event (movement, button press/release).
- CG_EVENT_HANDLING
-
XXX: ???
The Q3 engine marshalls the necessary cgame function values and arguments, then makes the call to vmMain().
Any additions or changes to these major cgame functions must be implemented in the engine and reflected in the cgame module (client-side mod).
Only developers with access to the Q3 engine (not just mod) source may make such aditions or changes.
Currently (2002 Aug) this consists of Id Software itself and its direct licensees (proprietary license).
Called when cgame module is initialized, upon connecting to a server (single-player game is a special case of a local server).
The cgame is reloaded and reinitialized every time a new map is loaded.
Three arguments:
- serverMessageNum
-
XXX: ???
- serverCommandSequence
-
XXX: ???
- clientNum
-
The cgame's client number as assigned by the server.
In baseq3, immediate branch to CG_Init().
- Zero out (clear) the structures cgs, cg, cg_entities, cg_weapons, cg_items
- Record clientNum to cg.clientNum
- Record serverMessageNum to cgs.processedSnapshotNum
- Record serverCommandSequence to cgs.serverCommandSequence
- Load some fonts and the plain-white shader
- Register some cvars -- CG_RegisterCvars().
- For all elements of cvarTable[], register the location of the vmCvar_t instance, the cvar name, the default value, and the cvar flags -- trap_Cvar_Register()
- If also running a local server (non-dedicated host, single-player), record the fact into cgs.localServer
- Register cvar
modeL
, headmodel
, team_model
, team_headmodel
- Initialize cgame console commands -- CG_InitConsoleCommands().
- For all elements of commands[], register the command string/name with the Q3 client engine for tab-completion -- trap_AddCommand()
- Register a set of commands that can be tab-completed, but are interpreted on the server-side (e.g.
kill
or say
)
- Switch/set weapon to machine gun
- CTF flags hackage for old-server compatibility (wtf?)
- Retrieve rendering configuration into cgs.glconfig -- trap_GetGlconfig()
- Set screen scale factors from cgs.glconfig: cgs.screenXScale, cgs.screenYScale
- Retrieve gamestate from client system into cgs.gameState -- trap_GetGameState()
- Get game (mod) version and compare -- CG_ConfigString(CS_GAME_VERSIOn)
- Retrieve level start time into cgs.levelStartTime -- CG_ConfigString(CS_LEVEL_START_TIME)
- Parse server info -- CG_ParseServerinfo().
- Retrieve ConfigString CS_SERVERINFO into info -- CG_ConfigString(CS_SERVERINFO)
- Retrieve values for keys
g_gametype
, dmflags
, teamflags
, fraglimit
, capturelimit
, timelimit
, sv_maxclients
, mapname
, g_redTeam
, g_blueTeam
- Indicate cgame is loading the map -- CG_LoadingString().
- Copy the message string to cg.infoScreenText
- update screen -- trap_UpdateScreen()
- Load map collision (and models?) -- trap_CM_LoadMap()
- Load sounds -- CG_RegisterSounds()
- Register a whole gank of sound files with trap_S_RegisterSound() and store the returned handle into various cgs.media.* fields
- Load graphics -- CG_RegisterGraphics()
- Clear references to any old media
- Display the mapname as the loading string
- Load map (models and textures?) -- trap_R_LoadWorldMap()
- Display
game media
as loading string
- Register numerals font faces
- Register a whole gank of media files, saving the returned handles into various cgs.media.* fields: trap_R_RegisterShader(), trap_R_RegisterShaderNoMip(), trap_R_RegisterModel(), trap_R_RegisterSkin()
- Register inline models
- Register server-specified models
- Clear particles -- CG_ClearParticles()
- Load clients and player models -- CG_RegisterClients()
- Report loading client information (our own) -- CG_LoadingClient().
- Get indicated client ConfigString -- CG_ConfigString()
- If displayed less than MAX_LOADING_PLAYER_ICONS player icons, figure out the player icon to display, display it, save player icon into loadingPlayerIcons[] increment the icons counter
- Get client name from ConfigString
- Clean up the name, stripping out invalid, dangerous, or otherwise illicit characters -- Q_CleanStr()
- If single-player game, load the announcer voice saying the player's (bot's) name
- Display client name as loading string
- Update clientinfo (cgs.clientinfo[...]) -- CG_NewClientInfo().
- Extract various fields from ConfigString, populate newInfo, then copy into cgs.clientinfo[clientNum]
- XXX: CG_ScanForExistingClientInfo()
- For all clients (0 through MAX_CLIENTS):
- Skip to next client if this is our client number
- Get clientinfo from ConfigString -- CG_ConfigString(CS_PLAYERS+...)
- If clientinfo is empty, skip to next client
- Report on loading client information (others) -- CG_LoadingClient()
- Update clientinfo -- CG_NewClientInfo()
- Build the list of names of spectators -- CG_BuildSpectatorString().
- Set deferred models loading (load up model on death, instead of during play)
- Initialize local entities array -- CG_InitLocalEntities()
- Zero out (clear) array cg_localEntities[]
- Set cg_activeLocalEntities.next and cg_activeLocalEntities.prev to cg_activeLocalEntities (itself?)
- Set cg_freeLocalEntities to the first element (offset 0) of cg_localEntities[]
- Chain up the elements of cg_localEntities[] by setting cg_localEntities[i].next to cg_localEntities[i+1], except the last element, which points next back to the first element (cg_localEntities[] as a circular list)
- Initialized marked polygons -- CG_InitMarkPolys()
- Zero out (clear) array cg_markPolys[]
- Set cg_activeMarkPolys.nextMark and cg_activeMarkPolys.prevMark to cg_activeMarkPolys (itself?)
- Set cg_freeMarkPolys to the first element of cg_markPolys[]
- Chain up elements of cg_markPolys as a circular list
- Clear/erase the loading string/message
- Update values -- CG_SetConfigValues()
- Retrieve ConfigString CS_SCORES1 into cgs.scores1
- Retrieve ConfigString CS_SCORES2 into cgs.scores2
- Retrieve ConfigString CS_LEVEL_START_TIME into cgs.levelStartTime
- If a CTF gametype, retrieve ConfigString CS_FLAGSTATUS for the status of CTF flags, and store into cgs.redflag and cgs.blueflag
- Retrieve ConfigString CS_WARMUP into cg.warmup
- Start background music -- CG_StartMusic().
- Retrieve ConfigString CS_MUSIC into s
- Parse into two words
- Start playing background music based on this parsing -- trap_S_StartBackgroundTrack()
- Clear
"loading..."
message
- Change shader states as needed -- CG_ShaderStateChanged()
- Stop any looping sound -- trap_S_ClearLoopingSounds()
Called when Q3 is shutting down the cgame module, as when ending a map or quitting entirely.
No arguments.
Immediate branch to CG_Shutdown().
- (nothing. Space reserved for mods that may need some explicit cleaning up, such as closing files, special commands, last desperate attempt to write some file, etc.)
Console commands are any textual commands not recognized by the Q3 engine itself.
Such commands may be entered by the drop-down console, or by key bindings (e.g. /bind k kill).
No arguments.
Immediate branch to CG_ConsoleCommand().
- Go through the array of cgame console commands commands[], trying to match names (case-insensitive).
- If a match is found, call the associated function [pointer].
XXX: blahblah.
Three arguments:
- serverTime
- The timestamp of the packet (XXX: what packet?) from the server.
- stereoView
- Whether to render as stereo view.
- demoPlayback
- True if playing back a demo, false otherwise (online game).
Immediate branch to CG_DrawActiveFrame().
- Record serverTime into cg.time
- Record demoPlayback into cg.demoPlayerback
- Update cvars -- CG_UpdateCvars()
- For all entries in cvarTable[], update the vmCvar_t member with trap_Cvar_Update().
- Do any checking of changed cvars, and actions to such changes, as needed.
- Checking team overlay (cvar
teamoverlay
).
- Something about cvar
cg_forceModel
having changed... -- CG_ForceModelChange()
- Um... something about loading screen vs. playing? -- CG_DrawInformation()
- Retrieve ConfigString CS_SERVERINFO into info.
- Retrieve ConfigString CS_SYSTEMINFO into sysInfo.
- Retrieve value for
mapinfo
from info, mangle to get a levelshot name, display on screen -- CG_DrawPic()
- Figure out scaled positions and sizes -- CG_AdjustFrom640()
- Multiply x and w by cgs.screenXScale
- Multiply y and h by cgs.screenYScale
- Blt image with recalculated positions and sizes -- trap_R_DrawStretchPic()
- Retrieve shader named
levelShotDetail
, draw it on top of the levelshot image -- trap_R_DrawStretchPic()
- draw icons indicating the data loaded -- CG_DrawLoadingIcon()
- Draw the player icons representing the player information already loaded so far
- Draw the item icons representing the item information already loaded thus far
- Clear looping sounds -- trap_S_ClearLoopingSounds()
- Clear render list -- trap_R_ClearScene()
- Set up cg.snap and cg.nextSnap -- CG_ProcessSnapshot()
- Retrieve latest snapshot time from Q3 client engine into n
- If the latest snapshot number is less than what we had before, something very very bad happened.
- Update cg.latestSnapshotNum accordingly.
- If cg.snap is empty:
- Retrieve next snapshot into snap -- CG_ReadNextSnapshot()
- If latest snapshot and processed snapshot are off by 1000, complain
- Loop while cg.processedSnapshotNum is less than cg.latestSnapshotNum:
- Figure which slot, cg.activeSnapshots[0] or cg.activeSnapshots[1] to use.
- Increment cg_processedSnapshotNum, retrieve snapshot into r -- trap_GetSnapshot()
- um... something about snapshot server time?
- If retrieval succeeded, record in lagometer info and return -- CG_AddLagometerSnapshotInfo()
- If snap is NULL, record -1 into lagometer.snapshotSamples[] and increment lagometer.snapshotCount, and return
- Otherwise, record snap's ping into lagometer.snapshotSamples[], record snap's flags into lagometer.snapshotFlags[], and increment lagometer.snapshotCount, and return
- Record as dropped packet in lagometer info -- CG_AddLagometerInfo()
- If nothing left to read, return NULL (failure)
- If no snap found, bad.
- ??? -- CG_SetInitialSnapshot()
- Record snap into cg.snap (initial snapshot).
- Retrieve entityState_t info from snap's playerState_t info.
- Build the list of solid and trigger entities -- CG_BuildSolidList()
- If nextsnap is available and not currently teleporting, use cg.nextsnap, otherwise use cg.snap
- For all entities in snap:
- Get entity's state slot
- If an item, or a teleport trigger, or a push trigger, record in cg_triggerEntities[] and update cg_numTriggerEntities
- If a solid entity, record in cg_solidEntities[] and update cg_numSolidEntities
- um.... -- CG_ExecuteNewServerCommands()
- Keep looping while cgs.serverCommandSequence < latestSequence (???):
- Get server command -- trap_GetServerCommand()
- Process server command -- CG_ServerCommand()
- (XXX: EEK!)
- Change weapon to what the server says -- CG_Respawn()
- Disable error decay (??)
- Set weapon time?
- Set weapon according to snap information (cg.snap->ps.weapon)
- For all entities in snap:
- Get entity's snap state information.
- Get appropriate cent pointer.
- Clear current state information.
- ??? -- CG_ResetEntity()
- Clear event.
- Record cg.snap->serverTime into cent->trailTime (XXX: what's this for?)
- Copy currentOrigin and currentAngles into lerpOrigin and lerpAngles
- If a player entity, call CG_ResetPlayerEntity()
- Eliminate error decays (???)
- Reset a bunch of animation information.
- ??? -- CG_CheckEvents()
- If centity's eType is an event:
- Do nothing (return) if event already fired (occured)
- Mark as already now being fired
- Record event type into cent->currentState.event
- otherwise:
- Do nothing (return) if event is attached to (riding on) another entity
- Copy current event into cent->previousEvent
- Do nothing if event is not supposed to occur (bitmask flag)?
- Calculate new position -- BG_EvaluateTrajectory()
- ??? -- CG_SetEntitySoundPosition()
- If an inline model, place entity sound position at model's midpoint -- trap_S_UpdateEntityPosition()
- Otherwise, place entity sound position at calculated location -- trap_S_UpdateEntityPosition()
- ??? -- CG_EntityEvent()
- (XXX: EEK!)
- Loop ceaselessly:
- If cg.nextSnap is empty:
- Retrieve next snapshot into snap -- CG_ReadNextSnapshot()
- If no snap is available, break loop any (extrapolate)
- ??? -- CG_SetNextSnap()
- Set cg.nextSnap to the new snap
- Extract entityState_t information from playerState_t information in snap
- Allow position interpolation
- For each entity listed in snap:
- Clear cent->nextState
- If teleporting, or otherwise doesn't have a prior position to sensibly interpolate from, turn off interpolation; otherwise turn it on.
- If client number in current and next snap don't match, act as if teleporting (?)
- Something about server restart and not interpolating???
- Build the list of solid and trigger entities -- CG_BuildSolidList()
- If server time jumped backwards, interpret as level restart.
- If cg.time is between cg.snap->serverTime and cg.nextSnap->serverTime, end the loop (interpolate)
- Make the transition to the next snapshot -- CG_TransitionSnapshot()
- Complain if cg.snap or cg.nextSnap is/are null
- ??? -- CG_ExecuteNewServerCommands()
- Invalidate all entities in existing snap
- Temporarily save cg.snap, move cg.nextSnap into cg.snap
- Update clients entity information
- For all entities in (new) snap:
- ??? -- CG_TransitionEntity()
- If centity position is not to be interpolated (popped into view, teleported in, respawned), reset the entity -- CG_ResetEntity()
- Turn off interpolation (clear next state?)
- Check for events -- CG_CheckEvents()
- Update recorded server time
- Check if client is teleporting
- If not doing client-side prediction, ??? -- CG_TransitionPlayerState()
- Assert various conditions (trigger fatal error if any check is false)
- Draw loading screen and return if no snapshots received?
- Notify Q3 engine of weapon and zoom (mouse) sensitivity -- trap_SetUserCmdValue()
- Keep track of how many frames have been rendered so far in cg.clientFrame
- Update cg.predictedPlayerState -- CG_PredictPlayerState()
- Set cg.hyperspace to qfalse (why???)
- If no valid predicted player state data yet, fill it in as needed
- If playing back a demo, interpolation movements and return -- CG_InterpolatePlayerState()
- if allowing local input (disabled in spectating or demo playback), short-circuit the view angles (change it despite what server says) -- PM_UpdateViewAngles()
- If teleporting, return (no point in interpolating)
- Check for inconsistencies(?)
- Into f goes the fraction between prev->serverTime and next->serverTime that cg.time resides
- Set bobbing accordingly.
- Move entity by the calculated fractional amount
- Change entity fractionally as well if local input allowed
- Set up for call to Pmove()
- Saved old player state info.
- Retrieve current command number into current -- trap_GetCurrentCmdNumber()
- If can't get a good command (?), just return (effect is freezing in place) -- trap_GetUserCmd()
- Get latest commands -- trap_GetUserCmd()
- Use cg.snap or cg.nextSnap depending on next snap being available and teleporting
- Retrict cvar
pmove_msec
within a certain range
- Set cg_pmove.pmove_fixed to
pmove_fixed
- Set cg_pmove.pmove_msec to
pmove_msec
- Go into third-person view (cg.renderingThirdPerson) if cvar cg_thirdPerson is non-zero, or if dead
- Calculate the stuff related to the viewing camera (client's eye(s)) -- CG_CalcViewValues()
- Clear cg.refdef
- Calculate the portions of the screen to draw camera view within (view rectangle, how much black border around the screen edge) -- CG_CalcVrect()
- If intermission, fill up the entire screen (size = 100)
- Otherwise, clip cvar
cg_viewsize
within 30 and 100.
- Ensure cg.refdef.width and cg.refdef.height are even numbers.
- Center the view rectangle.
- If intermission view:
- Copy server-reported location into refdef's view origin
- Copy server-reported view angles into redef's view angles
- Calculate FOV and return -- CG_CalcFov()
- Set bobbing.
- Something about speed on X-Y plane...
- Update camera orbiting data
- If errordecay:
- Calculate decay fraction.
- Shift refdef's view origin accordingly.
- Check if drawing in third-person view -- CG_OffsetThirdPersonView()
- Otherwise draw in first-person view -- CG_OffsetFirstPersonView()
- Position the eyes properly
- If not in hyperspace... XXX: ???
- Calculate field of view/vision (FOV) -- CG_CalcFov()
- If in intermission, fix FOV at 90 degrees
- Otherwise, calculate FOV based on
cg_fov
, clipping within range as needed, and alter based on zoom state; or keep at 90 if server set DF_FIXED_FOV bit in dmflags
- Convert FOV degrees to radians.
- If inside liquid:
- Munge X and Y components of FOV by a sinusoidal function, each component phase-shifted by a half-cycle (widest when shortest, tallest when narrowest)
- Set cg.refdef.fov_x and cg.refdef.fov_y
- Set cg.zoomSensitivity according to zoomed state.
- Show damage blob (the screen-reddening effect when damaged) -- CG_DamageBlendBlob()
- If no damage received, return
- If detected RagePro vidcard, return
- If beyond display time, return
- Clear blob entity
- Set blob entity parameters (sprite, shown only in first-person view)
- Place blob entity right in front of camera
- Set full color, set transparency proportional to blob display time (fade away)
- Add blob entity to rendering scene -- trap_R_AddRefEntityToScene()
- If not in hyperspace, build render list:
- Add entities specified in packet from server -- CG_AddPacketEntities()
- Calculate interpolation amount
- Calculate (all) rotation phase
- Calculate (all) fast-rotation phase
- Extract entityState_t from playerState_t of cg.predictedPlayerState
- Add player entity to rendering -- CG_AddCEntity()
- (XXX: EEK!)
- Lerp (linearly interpolate) lightning gun position -- CG_CalcEntityLerpPositions()
- If cvar
cg_smoothClients
is 0, client doesn't want extrapolated positions, force TR_INTERPOLATE trajectory type on clients' positions
- If TR_INTERPOLATE trajectory type, lerp entity's position -- CG_InterpolateEntityPosition()
- Complain if insufficient interpolation data (second position)
- Calculate the predicted entity position
- Lerp position according to interpolation fraction
- Calculate the predicted entity angles
- Lerp angles according to interpolation fraction -- Lerp_Angle()
- Use current frame and extrapolate position and angle
- Adjust for mover's movement if necessary -- CG_AdjustPositionForMover()
- Check that entity is valid
- Check entity is a mover
- Evaluate mover trajectory effect
- For each entities listed in the snapshot:
- Add the entity to rendering -- CG_AddCEntity()
- Add various marks to surfaces (burn marks, blood splatters, etc.) -- CG_AddMarks()
- If cvar
cg_addMarks
is 0, return
- For all recorded marks:
- Some linked list doohickerymajiggy?
- If mark's time expired, free the mark, move on to next mark -- CG_FreeMarkPoly()
- Remove from doubly-linked list of active marks
- Also update free list (a singly-linked list)
- For energy bursts (e.g. plasma-hit-wall, rail-hit-wall), fade out colors based on its age (mp->time)
- Fade out the mark based on age.
- Add mark entity to render scene -- trap_AddPolyToScene()
- Add entities that are implied by game entities, or explicitly generated locally -- CG_AddLocalEntities()
- Traverse through the list cg_activeLocalEntities backwards:
- grab pointer to next in case of early freeing.
- if local entity lifespan exceeded, remove -- CG_FreeLocalEntity()
- Based on entity type, call approriate function:
- LE_MARK -- (handled elsewhere)
- LE_SPRITE_EXPLOSION -- CG_AddSpriteExplosion()
- LE_EXPLOSION -- CG_AddExplosion()
- LE_FRAGMENT (gibs, brass) -- CG_AddFragment()
- LE_MOVE_SCALE_FADE (water bubble) -- CG_AddMoveScaleFade()
- LE_FADE_RGB (teleporter, railtrail) -- CG_AddFadeRGB()
- LE_FALL_SCALE_FADE (gibs blood trail) -- CG_AddFallScaleFade()
- LE_SCALE_FADE (rocket trail) -- CG_AddScaleFade()
- LE_SCOREPLUM (floating score) -- CG_AddScorePlum()
- (XXX: EEK!)
- Draw the gun/weapon -- CG_AddViewWeapon()
- If spectator, return
- If in intermission, return
- If in third person view, don't draw weapon view (it gets rendered in whole, anyway)
- If cvar
cg_drawGun
is 0, don't draw the gun, while doing some special position-shifting hack for lightning gun
- If testing a gun model, return
- Position the gun lower at higher FOV values
- ??? -- CG_RegisterWeapon()
- ??? -- CG_PlayBufferedSounds()
- (play next sound stored in sound ring buffer)
- Play voice chat sounds -- CG_PlayBufferedVoiceChats()
- (Q3 Team Arena only, skipping)
- Add test model specified by "testmodel" client console command -- CG_AddTestModel()
- Record cg.time into cg.refdef.time
- Copy cg.snap->areamask into cg.refdef.areamask
- Play any sounds associated with powerups wearing out (expiring) -- CG_PowerupTimerSounds()
- update audio positions -- trap_S_Respatialize().
- Draw lag-o-meter, but make sure it isn't done twice in stereoscopic view -- CG_AddLagometerFrameInfo()
- Record lagometer sample offset number info lagometer.frameSamples[], update lagometer.frameCount
- um... something about cvar
timescale
?...
- Make rendering calls -- CG_DrawActive()
- If no baseline snapshot (cg.snap) still, draw the info/loading screen -- CG_DrawInformation()
- If a spectator and looking at scoreboard, display tournament scoreboard -- CG_DrawTourneyScoreboard()
- Adjust separation based on stereoscopic view
- Add filler graphic around sized-down refresh window (sizeup/sizedown) -- CG_TileClear()
- Get video dimensions.
- If full-screen rendering, don't bother (return).
- Get the edges of the refresh screen.
- Clear the top edge of view screen -- CG_TileClearBox()
- Calculate how many repeats needed vertically and horizontally
- Tile the image -- trap_R_DrawStretchPic()
- Clear the bottom edge of view screen -- CG_TileClearBox()
- Clear the left edge of view screen -- CG_TileClearBox()
- Clear the right edge of view screen -- CG_TileClearBox()
- Shift cg.refdef.vieworg based on stereoscopic seperation
- Render the scene -- trap_R_RenderScene()
- Restore original viewpoint as needed
- Draw HUD and other 2D elements -- CG_Draw2D()
- If taking levelshot (
levelshot
is non-zero), don't bother (return)
- If
draw2D
is zero, don't bother (return)
- If at intermission, do intermission stuff -- CG_DrawIntermission()
- If single player mode, draw something... -- CG_DrawCenterString()
- otherwise, draw scoreboard -- CG_DrawScoreboard()
- If a spectator, do spectator things:
- ??? -- CG_DrawSpectator()
- ??? -- CG_DrawCrosshair()
- ??? -- CG_DrawCrosshairNames()
- Otherwise, non-spectator stuff:
- if alive and not looking at scores:
- Draw status bar -- CG_DrawStatusBar()
- Draw any ammo warning -- CG_DrawAmmoWarning()
- Draw crosshairs -- CG_DrawCrosshair()
- Draw crosshair names -- CG_DrawCrosshairNames()
- Draw weapon selection (the icons along bottom on weapon switch) -- CG_DrawWeaponSelect()
- Draw reward icons -- CG_DrawReward()
- in either case, then draw vote status -- CG_DrawVote()
- and any team votes -- CG_DrawTeamVote()
- Draw the lagometer -- CG_DrawLagometer()
- Draw uppper right stuff (fps, time) -- CG_DrawUpperRight()
- Draw lower right stuff (powerups, scores) -- CG_DrawLowerRight()
- Draw lower left stuff -- CG_DrawLowerLeft()
- Determine if spectating and following another client -- CG_DrawFollow
- Draw any warmup info if not following -- CG_DrawWarmup()
- Try to draw scoreboard -- CG_DrawScoreboard)
- If not showing scoreboard, try to draw any center strings -- CG_DrawCenterString()
- Print cg.clientFrame (frame number) if cvar
cg_stats
is non-zero.
WTF?
Immediate branch to CG_CrosshairPlayer().
- If still within 1 second of crosshair time (XXX: what's that?), return cg.crosshairClientNum, otherwise return -1.
WTF?
Immediate branch to CG_LastAttacker().
- If client was ever attacked (damaged), return last attacker (cg.snap->ps.persistant[PERS_ATTACKER])
Called when key-trapping is on (trap_Key_SetCatcher(KEYCATCH_CGAME)) and a key is pressed or released.
Two arguments:
- key
-
Keycode of the key event.
Every key generates a keycode (not necessarily unique).
For the alphanumeric keys, the keycode corresponds to the key's ASCII code.
For other keys, the values are something else... (XXX: list keycodes).
- down
-
Whether the event is generated by a key being pressed (qtrue) or being released (qfalse).
Immediate branch to CG_KeyEvent().
- (Empty in baseq3.
Mods may use this space for something useful.
Q3TA defines a CG_KeyEvent() with real meat; not covered here.)
Called when key-catching is enabled (trap_Set_KeyCatcher(KEYCATCH_CGAME)) and the mouse moves.
No mouse event if the mouse is not moving.
Button clicks count as key events (keycodes MOUSE1...MOUSE5, MWHEELUP, MWHEELDOWN).
Two arguments:
- x
- Relative x (horizontal, left/right) motion.
Positive values are towards the right, negative values towards the left.
- y
- Relative y (vertical, up/down) motion.
Positive values are towards the bottom, negative values are towards the top.
Immediate branch to CG_MouseEvent.
- (Empty in baseq3.
Mods may use this space for something useful.
Q3TA defines a CG_MouseEvent() with real meat; not covered here.)
(I'd like to know!)
type - 0 = no event handling, 1 = team menu, 2 = hud editor (what hud editor???)
Immediate branch to CG_EventHandling.
- (Empty in baseq3.
Q3TA defines a CG_EventHandling() with real meat; not covered here.)
Created 2002.09.28
Updated 2011.07.11 - change of contact e-mail
PhaethonH
< PhaethonH@gmail.com >