Nuclide
Software Development Kit for id Tech
entry.qc File Reference

Functions

void CSQC_UpdateSeat (void)
 Updates our seat pointers. More...
 
void CSQC_Init (float apilevel, string enginename, float engineversion)
 Entry function that is required by the engine. More...
 
void CSQC_RendererRestarted (string rstr)
 Called by the engine whenever video resources need to be reloaded. More...
 
void CSQC_RenderScene (void)
 Always call this instead of renderscene(); ! We want you to avoid calling renderscene() directly because it misrepresents how much time is spent rendering otherwise. More...
 
void CSQC_Update2D (float w, float h, bool focus)
 Called on top of every 3D rendered view. More...
 
void CSQC_UpdateView (float w, float h, float focus)
 Called every single frame by the engine's renderer to construct a frame. More...
 
float CSQC_InputEvent (float fEventType, float fKey, float fCharacter, float fDeviceID)
 Called every time an input event (keys pressed, mouse moved etc.) happens. More...
 
void CSQC_Input_Frame (void)
 Intercepts and controls what input globals are being sent to the server. More...
 
void CSQC_Parse_Event (void)
 Handles every SVC_CGAMEPACKET that the engine passes onto us that the server sent. More...
 
float CSQC_ConsoleCommand (string sCMD)
 Console commands not protected by the engine get handled here. More...
 
void CSQC_Parse_Print (string sMessage, float fLevel)
 Prints to console and heads up display are handled here. More...
 
float CSQC_Parse_CenterPrint (string sMessage)
 Catches every centerprint call and allows us to tinker with it. More...
 
void CSQC_Ent_Update (float new)
 Called when an entity is being networked from the server game. More...
 
void CSQC_WorldLoaded (void)
 Called by the engine when the map has fully initialized. More...
 
void CSQC_Ent_Remove (void)
 Called when a server tells us an active entity gets removed. More...
 
void CSQC_Shutdown (void)
 The last function that the engine will ever call onto this csprogs. More...
 

Function Documentation

◆ CSQC_ConsoleCommand()

float CSQC_ConsoleCommand ( string  sCMD)

Console commands not protected by the engine get handled here.

If we return FALSE this means the engine needs to handle the command itself which can result in a 'unrecognized command' message in console.

The server-side equivalent is ConsoleCmd (src/server/entry.qc)

◆ CSQC_Ent_Remove()

void CSQC_Ent_Remove ( void  )

Called when a server tells us an active entity gets removed.

In this function 'self' refers to the entity that's scheduled for removal. We manually call remove(); on it at the end. We get the chance to remove the playback of sounds, skeletal objects and so on.

◆ CSQC_Ent_Update()

void CSQC_Ent_Update ( float  new)

Called when an entity is being networked from the server game.

ClientGame_EntityUpdate allows the sub-games to do game specific overrides. If that returns FALSE Nuclide will attempt to handle it here. If neither handles it we'll get a protocol error which will disconnect the client.

◆ CSQC_Init()

void CSQC_Init ( float  apilevel,
string  enginename,
float  engineversion 
)

Entry function that is required by the engine.

Called once when the csprogs.dat file is loaded upon loading our client. Also called when map changes happen.

◆ CSQC_Input_Frame()

void CSQC_Input_Frame ( void  )

Intercepts and controls what input globals are being sent to the server.

This is where you have the chance to suppress analog and digital movement/action values. Prediction will also avoid them.

◆ CSQC_InputEvent()

float CSQC_InputEvent ( float  fEventType,
float  fKey,
float  fCharacter,
float  fDeviceID 
)

Called every time an input event (keys pressed, mouse moved etc.) happens.

When this returns FALSE, the engine is free to interpret the input event as it wishes. If it returns TRUE the engine is not set on ignoring it.

◆ CSQC_Parse_CenterPrint()

float CSQC_Parse_CenterPrint ( string  sMessage)

Catches every centerprint call and allows us to tinker with it.

That's how we are able to add color, alpha and whatnot. Keep in mind that newlines need to be tokenized.

◆ CSQC_Parse_Event()

void CSQC_Parse_Event ( void  )

Handles every SVC_CGAMEPACKET that the engine passes onto us that the server sent.

To maintain protocol compatibility, SVC_CGAMEPACKET is the only user controlled event. You cannot intercept networked events here.

◆ CSQC_Parse_Print()

void CSQC_Parse_Print ( string  sMessage,
float  fLevel 
)

Prints to console and heads up display are handled here.

There are 4 different types currently: PRINT_LOW = low on the screen. PRINT_MEDIUM = medium level on the screen. PRINT_HIGH = top level on the screen PRINT_CHAT = chat message

Currently, everything but chat gets piped into a single printbuffer, similar to NetQuake.

FIXME: We'd like to expose this further to modification.

◆ CSQC_RendererRestarted()

void CSQC_RendererRestarted ( string  rstr)

Called by the engine whenever video resources need to be reloaded.

This is only called when something like 'vid_reload' happens. We also call it once upon init. The idea is that any resources that are meant to be loaded into video-memory need to be precached within this function. This will ensure no missing resources later.

Sub-games need to implement their own ClientGame_RendererRestart function somewhere in csprogs.dat to ensure their resources are reloaded properly.

◆ CSQC_RenderScene()

void CSQC_RenderScene ( void  )

Always call this instead of renderscene(); ! We want you to avoid calling renderscene() directly because it misrepresents how much time is spent rendering otherwise.

The profile will group engine calls to a single function. So call this tiny wrapper function instead so you have a clear overview about how much time is spent in the renderer when using profile_csqc when debugging in the game's console.

◆ CSQC_Shutdown()

void CSQC_Shutdown ( void  )

The last function that the engine will ever call onto this csprogs.

You want to close file handles and possible free memory here, as that is the last thing that will be called.

◆ CSQC_Update2D()

void CSQC_Update2D ( float  w,
float  h,
bool  focus 
)

Called on top of every 3D rendered view.

This just again ensures we box and seperate 2D plane operations from 3D ones. This is where the HUD, Chat etc. will be drawn. They don't necessarily have to be 2D but this is just a clear distinction from 3D world elements and overlays.

◆ CSQC_UpdateSeat()

void CSQC_UpdateSeat ( void  )

Updates our seat pointers.

Call this when you need to verify we're getting the current player's info and not someone elses on the same machine (splitscreen).

◆ CSQC_UpdateView()

void CSQC_UpdateView ( float  w,
float  h,
float  focus 
)

Called every single frame by the engine's renderer to construct a frame.

This is for all clients on display. So we handle splitscreen/multiple-views in here.

◆ CSQC_WorldLoaded()

void CSQC_WorldLoaded ( void  )

Called by the engine when the map has fully initialized.

Within this function we can make some safe assumptions about the world, its format and get start loading the entity lump ourselves if need be.