Interface to the game library. More...
#include "server.h"
#include "../common/grid.h"
#include "../ports/system.h"
#include <SDL.h>
Go to the source code of this file.
Functions | |
static void | SV_dprintf (const char *fmt,...) |
Debug print to server console. | |
static void | SV_PlayerPrintf (const player_t *player, int level, const char *fmt, va_list ap) |
Print to a single client. | |
static void | SV_error (const char *fmt,...) |
Abort the server with a game error. | |
static int | SV_FindIndex (const char *name, int start, int max, qboolean create) |
static int | SV_ModelIndex (const char *name) |
static void | SV_SetModel (edict_t *ent, const char *name) |
static void | SV_Configstring (int index, const char *fmt,...) |
static void | SV_WriteChar (char c) |
static void | SV_WriteByte (byte c) |
static byte * | SV_WriteDummyByte (byte c) |
Use this if the value might change and you need the position in the buffer. | |
static void | SV_WriteShort (int c) |
static void | SV_WriteLong (int c) |
static void | SV_WriteString (const char *s) |
static void | SV_WritePos (const vec3_t pos) |
static void | SV_WriteGPos (const pos3_t pos) |
static void | SV_WriteDir (const vec3_t dir) |
static void | SV_WriteAngle (float f) |
static void | SV_WriteFormat (const char *format,...) |
static int | SV_ReadChar (void) |
static int | SV_ReadByte (void) |
static int | SV_ReadShort (void) |
static int | SV_ReadLong (void) |
static int | SV_ReadString (char *str, size_t length) |
static void | SV_ReadPos (vec3_t pos) |
static void | SV_ReadGPos (pos3_t pos) |
static void | SV_ReadDir (vec3_t vector) |
static float | SV_ReadAngle (void) |
static void | SV_ReadData (void *buffer, int size) |
static void | SV_ReadFormat (const char *format,...) |
static void | SV_AbortEvents (void) |
static void | SV_EndEvents (void) |
static void | SV_AddEvent (unsigned int mask, int eType) |
static int | SV_GetEvent (void) |
static void * | SV_TagAlloc (int size, int tagNum, const char *file, int line) |
Makes sure the game DLL does not use client, or signed tags. | |
static void | SV_MemFree (void *ptr, const char *file, int line) |
static void | SV_FreeTags (int tagNum, const char *file, int line) |
Makes sure the game DLL does not use client, or signed tags. | |
static qboolean | SV_TestLine (const vec3_t start, const vec3_t stop, const int levelmask) |
static qboolean | SV_TestLineWithEnt (const vec3_t start, const vec3_t stop, const int levelmask, const char **entlist) |
static void | SV_RecalcRouting (routing_t *map, const char *name, const char **list) |
static void | SV_SetInlineModelOrientation (const char *name, const vec3_t origin, const vec3_t angles) |
static void | SV_UnloadGame (void) |
static qboolean | SV_LoadGame (const char *path) |
static game_export_t * | SV_GetGameAPI (game_import_t *parms) |
Loads the game shared library and calls the api init function. | |
void | SV_ShutdownGameProgs (void) |
Called when either the entire server is being killed, or it is changing to a different game directory. | |
int | SV_RunGameFrameThread (void *data) |
Thread for the game frame function. | |
void | SV_RunGameFrame (void) |
Calls the G_RunFrame function from game api let everything in the world think and move. | |
void | SV_InitGameProgs (void) |
Init the game subsystem for a new map. |
Interface to the game library.
Definition in file sv_game.c.
static void SV_AbortEvents | ( | void | ) | [static] |
Definition at line 306 of file sv_game.c.
References pending_event_s::buf, free_dbuffer(), pending_event_s::pending, serverInstanceGame_t::pendingEvent, qfalse, and sv.
Referenced by SV_InitGameProgs().
static void SV_AddEvent | ( | unsigned int | mask, | |
int | eType | |||
) | [static] |
[in] | mask | The player bitmask to send the events to. Use PM_ALL to send to every connected player. |
Definition at line 339 of file sv_game.c.
References pending_event_s::buf, Com_DPrintf(), DEBUG_EVENTSYS, NET_WriteByte(), new_dbuffer(), pending_event_s::pending, serverInstanceGame_t::pendingEvent, pending_event_s::playerMask, qtrue, sv, SV_EndEvents(), svc_event, and pending_event_s::type.
Referenced by SV_InitGameProgs().
static void SV_Configstring | ( | int | index, | |
const char * | fmt, | |||
... | ||||
) | [static] |
Definition at line 146 of file sv_game.c.
References Com_Error(), Com_ServerState(), ERR_DROP, MAX_CONFIGSTRINGS, MAX_TILESTRINGS, MAX_TOKEN_CHARS, NET_WriteByte(), NET_WriteShort(), NET_WriteString(), new_dbuffer(), Q_vsnprintf(), ss_loading, SV_Multicast(), SV_SetConfigString, and svc_configstring.
Referenced by SV_InitGameProgs().
static void SV_dprintf | ( | const char * | fmt, | |
... | ||||
) | [static] |
Debug print to server console.
Definition at line 37 of file sv_game.c.
References Com_vPrintf().
Referenced by SV_InitGameProgs().
static void SV_EndEvents | ( | void | ) | [static] |
Definition at line 321 of file sv_game.c.
References pending_event_s::buf, EV_NULL, NET_WriteByte(), pending_event_s::pending, serverInstanceGame_t::pendingEvent, pending_event_s::playerMask, qfalse, sv, and SV_Multicast().
Referenced by SV_AddEvent(), and SV_InitGameProgs().
static void SV_error | ( | const char * | fmt, | |
... | ||||
) | [static] |
Abort the server with a game error.
Definition at line 71 of file sv_game.c.
References Com_Error(), ERR_DROP, and Q_vsnprintf().
Referenced by SV_InitGameProgs().
static int SV_FindIndex | ( | const char * | name, | |
int | start, | |||
int | max, | |||
qboolean | create | |||
) | [static] |
Definition at line 83 of file sv_game.c.
References Com_Error(), Com_ServerState(), ERR_DROP, i, NET_WriteByte(), NET_WriteShort(), NET_WriteString(), new_dbuffer(), ss_loading, SV_GetConfigString(), SV_Multicast(), SV_SetConfigString, and svc_configstring.
Referenced by SV_ModelIndex().
static void SV_FreeTags | ( | int | tagNum, | |
const char * | file, | |||
int | line | |||
) | [static] |
Makes sure the game DLL does not use client, or signed tags.
Definition at line 390 of file sv_game.c.
References _Mem_FreeTag(), serverInstanceGame_t::gameSysPool, and sv.
Referenced by SV_InitGameProgs().
static int SV_GetEvent | ( | void | ) | [static] |
Definition at line 362 of file sv_game.c.
References pending_event_s::pending, serverInstanceGame_t::pendingEvent, sv, and pending_event_s::type.
Referenced by SV_InitGameProgs().
static game_export_t* SV_GetGameAPI | ( | game_import_t * | parms | ) | [static] |
Loads the game shared library and calls the api init function.
Definition at line 457 of file sv_game.c.
References Com_Error(), Com_Printf(), ERR_FATAL, FS_NextPath(), serverInstanceStatic_t::gameLibrary, GetGameAPI(), SV_LoadGame(), SV_UnloadGame(), and svs.
Referenced by SV_InitGameProgs().
void SV_InitGameProgs | ( | void | ) |
Init the game subsystem for a new map.
Definition at line 563 of file sv_game.c.
References game_export_t::apiversion, Cbuf_AddText(), Cmd_Argc(), Cmd_Args(), Cmd_Argv(), Com_Error(), Com_GetCharacterValues(), Com_GetConstInt(), Com_GetConstIntFromNamespace(), Com_GetConstVariable(), Com_GrenadeTarget(), Com_RegisterConstInt(), Com_UnregisterConstVariable(), csi, Cvar_Get(), Cvar_GetString(), Cvar_Set(), ERR_DROP, FS_FreeFile(), FS_Gamedir(), FS_LoadFile(), GAME_API_VERSION, serverInstanceGame_t::gameSysPool, serverInstanceStatic_t::gameThread, serverInstanceStatic_t::ge, Grid_Fall(), Grid_Floor(), Grid_GetTUsForDirection(), Grid_MoveCalc(), Grid_MoveLength(), Grid_MoveNext(), Grid_MoveStore(), Grid_PosToVec(), cvar_s::integer, mapData_s::map, serverInstanceGame_t::mapData, Mem_CreatePool, sv, SV_AbortEvents(), SV_AddEvent(), SV_AreaEdicts(), SV_BroadcastPrintf(), SV_Configstring(), SV_dprintf(), SV_EndEvents(), SV_error(), SV_FreeTags(), SV_GetBounceFraction(), SV_GetEvent(), SV_GetFootstepSound(), SV_GetGameAPI(), SV_LinkEdict(), SV_LoadModelMinsMaxs(), SV_MemFree(), SV_ModelIndex(), SV_PlayerPrintf(), SV_PointContents(), SV_ReadAngle(), SV_ReadByte(), SV_ReadChar(), SV_ReadData(), SV_ReadDir(), SV_ReadFormat(), SV_ReadGPos(), SV_ReadLong(), SV_ReadPos(), SV_ReadShort(), SV_ReadString(), SV_RecalcRouting(), SV_RunGameFrameThread(), SV_SetInlineModelOrientation(), SV_SetModel(), SV_StartSound(), SV_TagAlloc(), SV_TestLine(), SV_TestLineWithEnt(), sv_threads, SV_TouchEdicts(), SV_Trace(), SV_UnlinkEdict(), SV_WriteAngle(), SV_WriteByte(), SV_WriteChar(), SV_WriteDir(), SV_WriteDummyByte(), SV_WriteFormat(), SV_WriteGPos(), SV_WriteLong(), SV_WritePos(), SV_WriteShort(), SV_WriteString(), svs, and Sys_Milliseconds().
Referenced by SV_InitGame().
static qboolean SV_LoadGame | ( | const char * | path | ) | [static] |
Definition at line 432 of file sv_game.c.
References Com_DPrintf(), Com_Printf(), Com_sprintf(), CPUSTRING, DEBUG_SYSTEM, serverInstanceStatic_t::gameLibrary, MAX_OSPATH, name, qfalse, qtrue, and svs.
Referenced by SV_GetGameAPI().
static void SV_MemFree | ( | void * | ptr, | |
const char * | file, | |||
int | line | |||
) | [static] |
static int SV_ModelIndex | ( | const char * | name | ) | [static] |
Definition at line 115 of file sv_game.c.
References CS_MODELS, MAX_MODELS, qtrue, and SV_FindIndex().
Referenced by SV_InitGameProgs(), and SV_SetModel().
static void SV_PlayerPrintf | ( | const player_t * | player, | |
int | level, | |||
const char * | fmt, | |||
va_list | ap | |||
) | [static] |
Print to a single client.
Definition at line 50 of file sv_game.c.
References cl, Com_Printf(), player_s::num, PRINT_NONE, Q_vsnprintf(), SV_ClientPrintf(), and SV_GetClient().
Referenced by SV_InitGameProgs().
static float SV_ReadAngle | ( | void | ) | [static] |
Definition at line 277 of file sv_game.c.
References serverInstanceGame_t::messageBuffer, NET_ReadAngle(), and sv.
Referenced by SV_InitGameProgs().
static int SV_ReadByte | ( | void | ) | [static] |
Definition at line 242 of file sv_game.c.
References serverInstanceGame_t::messageBuffer, NET_ReadByte(), and sv.
Referenced by SV_InitGameProgs().
static int SV_ReadChar | ( | void | ) | [static] |
Definition at line 237 of file sv_game.c.
References serverInstanceGame_t::messageBuffer, NET_ReadChar(), and sv.
Referenced by SV_InitGameProgs().
static void SV_ReadData | ( | void * | buffer, | |
int | size | |||
) | [static] |
Definition at line 282 of file sv_game.c.
References serverInstanceGame_t::messageBuffer, NET_ReadData(), and sv.
Referenced by SV_InitGameProgs().
static void SV_ReadDir | ( | vec3_t | vector | ) | [static] |
Definition at line 272 of file sv_game.c.
References serverInstanceGame_t::messageBuffer, NET_ReadDir(), and sv.
Referenced by SV_InitGameProgs().
static void SV_ReadFormat | ( | const char * | format, | |
... | ||||
) | [static] |
Definition at line 290 of file sv_game.c.
References serverInstanceGame_t::messageBuffer, NET_vReadFormat(), and sv.
Referenced by SV_InitGameProgs().
static void SV_ReadGPos | ( | pos3_t | pos | ) | [static] |
Definition at line 267 of file sv_game.c.
References serverInstanceGame_t::messageBuffer, NET_ReadGPos(), and sv.
Referenced by SV_InitGameProgs().
static int SV_ReadLong | ( | void | ) | [static] |
Definition at line 252 of file sv_game.c.
References serverInstanceGame_t::messageBuffer, NET_ReadLong(), and sv.
Referenced by SV_InitGameProgs().
static void SV_ReadPos | ( | vec3_t | pos | ) | [static] |
Definition at line 262 of file sv_game.c.
References serverInstanceGame_t::messageBuffer, NET_ReadPos(), and sv.
Referenced by SV_InitGameProgs().
static int SV_ReadShort | ( | void | ) | [static] |
Definition at line 247 of file sv_game.c.
References serverInstanceGame_t::messageBuffer, NET_ReadShort(), and sv.
Referenced by SV_InitGameProgs().
static int SV_ReadString | ( | char * | str, | |
size_t | length | |||
) | [static] |
Definition at line 257 of file sv_game.c.
References serverInstanceGame_t::messageBuffer, NET_ReadString(), and sv.
Referenced by SV_InitGameProgs().
static void SV_RecalcRouting | ( | routing_t * | map, | |
const char * | name, | |||
const char ** | list | |||
) | [static] |
Definition at line 410 of file sv_game.c.
References Grid_RecalcRouting(), serverInstanceGame_t::mapTiles, and sv.
Referenced by SV_InitGameProgs().
void SV_RunGameFrame | ( | void | ) |
Calls the G_RunFrame function from game api let everything in the world think and move.
Definition at line 550 of file sv_game.c.
References serverInstanceGame_t::endgame, serverInstanceStatic_t::ge, serverInstanceStatic_t::serverMutex, sv, and svs.
Referenced by SV_Frame(), and SV_RunGameFrameThread().
int SV_RunGameFrameThread | ( | void * | data | ) |
Thread for the game frame function.
Definition at line 535 of file sv_game.c.
References serverInstanceGame_t::endgame, sv, and SV_RunGameFrame().
Referenced by SV_InitGameProgs().
static void SV_SetInlineModelOrientation | ( | const char * | name, | |
const vec3_t | origin, | |||
const vec3_t | angles | |||
) | [static] |
Definition at line 415 of file sv_game.c.
References CM_SetInlineModelOrientation(), serverInstanceGame_t::mapTiles, and sv.
Referenced by SV_InitGameProgs().
static void SV_SetModel | ( | edict_t * | ent, | |
const char * | name | |||
) | [static] |
Definition at line 124 of file sv_game.c.
References edict_s::angles, CM_InlineModel(), CM_SetInlineModelOrientation(), Com_Error(), ERR_DROP, serverInstanceGame_t::mapTiles, edict_s::maxs, cBspModel_s::maxs, edict_s::mins, cBspModel_s::mins, edict_s::modelindex, edict_s::origin, sv, SV_ModelIndex(), and VectorCopy.
Referenced by SV_InitGameProgs().
void SV_ShutdownGameProgs | ( | void | ) |
Called when either the entire server is being killed, or it is changing to a different game directory.
Definition at line 501 of file sv_game.c.
References Cmd_ExecuteString(), Com_Printf(), serverInstanceGame_t::gameSysPool, serverInstanceStatic_t::gameThread, serverInstanceStatic_t::ge, Mem_DeletePool, Mem_PoolSize, memPool_s::name, sv, SV_UnloadGame(), svs, and va().
Referenced by SV_Shutdown().
static void* SV_TagAlloc | ( | int | size, | |
int | tagNum, | |||
const char * | file, | |||
int | line | |||
) | [static] |
Makes sure the game DLL does not use client, or signed tags.
Definition at line 374 of file sv_game.c.
References _Mem_Alloc(), serverInstanceGame_t::gameSysPool, qtrue, and sv.
Referenced by SV_InitGameProgs().
Definition at line 398 of file sv_game.c.
References serverInstanceGame_t::mapTiles, sv, and TR_TestLine().
Referenced by SV_InitGameProgs().
static qboolean SV_TestLineWithEnt | ( | const vec3_t | start, | |
const vec3_t | stop, | |||
const int | levelmask, | |||
const char ** | entlist | |||
) | [static] |
Definition at line 403 of file sv_game.c.
References CM_EntTestLine(), serverInstanceGame_t::mapTiles, and sv.
Referenced by SV_InitGameProgs().
static void SV_UnloadGame | ( | void | ) | [static] |
Definition at line 420 of file sv_game.c.
References Com_Printf(), serverInstanceStatic_t::gameLibrary, and svs.
Referenced by SV_GetGameAPI(), and SV_ShutdownGameProgs().
static void SV_WriteAngle | ( | float | f | ) | [static] |
Definition at line 224 of file sv_game.c.
References pending_event_s::buf, NET_WriteAngle(), serverInstanceGame_t::pendingEvent, and sv.
Referenced by SV_InitGameProgs().
static void SV_WriteByte | ( | byte | c | ) | [static] |
Definition at line 176 of file sv_game.c.
References pending_event_s::buf, NET_WriteByte(), serverInstanceGame_t::pendingEvent, and sv.
Referenced by SV_InitGameProgs().
static void SV_WriteChar | ( | char | c | ) | [static] |
Definition at line 171 of file sv_game.c.
References pending_event_s::buf, NET_WriteChar(), serverInstanceGame_t::pendingEvent, and sv.
Referenced by SV_InitGameProgs().
static void SV_WriteDir | ( | const vec3_t | dir | ) | [static] |
Definition at line 219 of file sv_game.c.
References pending_event_s::buf, NET_WriteDir(), serverInstanceGame_t::pendingEvent, and sv.
Referenced by SV_InitGameProgs().
Use this if the value might change and you need the position in the buffer.
Definition at line 185 of file sv_game.c.
References pending_event_s::buf, byte, dbuffer::end, NET_WriteByte(), serverInstanceGame_t::pendingEvent, pos, and sv.
Referenced by SV_InitGameProgs().
static void SV_WriteFormat | ( | const char * | format, | |
... | ||||
) | [static] |
Definition at line 229 of file sv_game.c.
References pending_event_s::buf, NET_vWriteFormat(), serverInstanceGame_t::pendingEvent, and sv.
Referenced by SV_InitGameProgs().
static void SV_WriteGPos | ( | const pos3_t | pos | ) | [static] |
Definition at line 214 of file sv_game.c.
References pending_event_s::buf, NET_WriteGPos(), serverInstanceGame_t::pendingEvent, and sv.
Referenced by SV_InitGameProgs().
static void SV_WriteLong | ( | int | c | ) | [static] |
Definition at line 199 of file sv_game.c.
References pending_event_s::buf, NET_WriteLong(), serverInstanceGame_t::pendingEvent, and sv.
Referenced by SV_InitGameProgs().
static void SV_WritePos | ( | const vec3_t | pos | ) | [static] |
Definition at line 209 of file sv_game.c.
References pending_event_s::buf, NET_WritePos(), serverInstanceGame_t::pendingEvent, and sv.
Referenced by SV_InitGameProgs().
static void SV_WriteShort | ( | int | c | ) | [static] |
Definition at line 194 of file sv_game.c.
References pending_event_s::buf, NET_WriteShort(), serverInstanceGame_t::pendingEvent, and sv.
Referenced by SV_InitGameProgs().
static void SV_WriteString | ( | const char * | s | ) | [static] |
Definition at line 204 of file sv_game.c.
References pending_event_s::buf, NET_WriteString(), serverInstanceGame_t::pendingEvent, and sv.
Referenced by SV_InitGameProgs().