Quake II RTX doxygen
1.0 dev
|
|
Go to the documentation of this file.
37 if (!name || !name[0])
40 for (i = 1; i < max; i++) {
45 if (!strcmp(
string, name)) {
51 Com_Error(ERR_DROP,
"PF_FindIndex: overflow");
84 int cmd, flags, clientNum;
92 Com_WPrintf(
"%s to a non-client %d\n", __func__, clientNum);
98 Com_WPrintf(
"%s to a free/zombie client %d\n", __func__, clientNum);
103 Com_DPrintf(
"%s with empty data\n", __func__);
121 if (cmd == svc_disconnect) {
143 char string[MAX_STRING_CHARS];
148 va_start(argptr, fmt);
149 len =
Q_vsnprintf(
string,
sizeof(
string), fmt, argptr);
152 if (len >=
sizeof(
string)) {
153 Com_WPrintf(
"%s: overflow\n", __func__);
161 MSG_WriteData(
string, len + 1);
166 for (i = 0; i < len; i++)
168 Com_Printf(
"%s",
string);
192 char msg[MAXPRINTMSG];
195 va_start(argptr, fmt);
199 Com_Printf(
"%s",
msg);
213 char msg[MAX_STRING_CHARS];
219 va_start(argptr, fmt);
223 if (len >=
sizeof(
msg)) {
224 Com_WPrintf(
"%s: overflow\n", __func__);
235 Com_Error(ERR_DROP,
"%s to a non-client %d", __func__, clientNum);
240 Com_WPrintf(
"%s to a free/zombie client %d\n", __func__, clientNum);
246 MSG_WriteData(
msg, len + 1);
268 char msg[MAX_STRING_CHARS];
279 Com_WPrintf(
"%s to a non-client %d\n", __func__, n - 1);
283 va_start(argptr, fmt);
287 if (len >=
sizeof(
msg)) {
288 Com_WPrintf(
"%s: overflow\n", __func__);
293 MSG_WriteData(
msg, len + 1);
306 static q_noreturn
void PF_error(
const char *fmt, ...)
308 char msg[MAXERRORMSG];
311 va_start(argptr, fmt);
332 Com_Error(ERR_DROP,
"PF_setmodel: NULL");
336 ent->s.modelindex = i;
339 if (name[0] ==
'*') {
340 mod = CM_InlineModel(&
sv.
cm, name);
341 VectorCopy(mod->mins, ent->mins);
342 VectorCopy(mod->maxs, ent->maxs);
362 if (index < 0 || index >= MAX_CONFIGSTRINGS)
363 Com_Error(ERR_DROP,
"%s: bad index: %d", __func__, index);
366 Com_WPrintf(
"%s: not yet initialized\n", __func__);
375 maxlen = (MAX_CONFIGSTRINGS - index) * MAX_QPATH;
378 "%s: index %d overflowed: %"PRIz
" > %"PRIz,
379 __func__, index, len, maxlen - 1);
383 maxlen = CS_SIZE(index);
386 "%s: index %d overflowed: %"PRIz
" > %"PRIz
"\n",
387 __func__, index, len, maxlen - 1);
392 if (!strncmp(dst, val, len)) {
397 memcpy(dst, val, len);
409 MSG_WriteData(val, len);
424 Com_Error(ERR_DROP,
"PF_WriteFloat not implemented");
427 static qboolean
PF_inVIS(vec3_t p1, vec3_t p2,
int vis)
429 mleaf_t *leaf1, *leaf2;
430 byte mask[VIS_MAX_BYTES];
431 bsp_t *bsp =
sv.
cm.cache;
434 Com_Error(ERR_DROP,
"%s: no map loaded", __func__);
441 if (leaf2->cluster == -1)
443 if (!Q_IsBitSet(mask, leaf2->cluster))
501 #define CHECK_PARAMS \
502 if (volume < 0 || volume > 1.0) \
503 Com_Error(ERR_DROP, "%s: volume = %f", __func__, volume); \
504 if (attenuation < 0 || attenuation > 4) \
505 Com_Error(ERR_DROP, "%s: attenuation = %f", __func__, attenuation); \
506 if (timeofs < 0 || timeofs > 0.255) \
507 Com_Error(ERR_DROP, "%s: timeofs = %f", __func__, timeofs); \
508 if (soundindex < 0 || soundindex >= MAX_SOUNDS) \
509 Com_Error(ERR_DROP, "%s: soundindex = %d", __func__, soundindex);
512 int soundindex,
float volume,
513 float attenuation,
float timeofs)
520 byte mask[VIS_MAX_BYTES];
534 if ((
g_features->integer & GMF_PROPERINUSE) && !edict->inuse) {
535 Com_DPrintf(
"%s: entnum not in use: %d\n", __func__, ent);
539 sendchan = (ent << 3) | (channel & 7);
543 if (volume != DEFAULT_SOUND_PACKET_VOLUME)
545 if (attenuation != DEFAULT_SOUND_PACKET_ATTENUATION)
546 flags |= SND_ATTENUATION;
552 if (attenuation == ATTN_NONE) {
553 channel |= CHAN_NO_PHS_ADD;
563 if (!(channel & CHAN_NO_PHS_ADD)) {
565 ps = &client->
edict->client->ps;
566 VectorMA(ps->viewoffset, 0.125f, ps->pmove.origin,
origin);
568 area = CM_LeafArea(leaf);
583 if (edict->solid == SOLID_BSP) {
584 VectorAvg(edict->mins, edict->maxs,
origin);
587 VectorCopy(edict->s.origin,
origin);
592 if (channel & CHAN_RELIABLE) {
597 if (flags & SND_VOLUME)
599 if (flags & SND_ATTENUATION)
601 if (flags & SND_OFFSET)
612 Com_WPrintf(
"%s: %s: out of message slots\n",
613 __func__, client->
name);
618 if (edict->svflags & SVF_NOCLIENT) {
623 if (edict->solid == SOLID_BSP && client->
protocol == PROTOCOL_VERSION_DEFAULT) {
631 msg->index = soundindex;
632 msg->volume = volume * 255;
633 msg->attenuation = attenuation * 64;
634 msg->timeofs = timeofs * 1000;
635 msg->sendchan = sendchan;
636 for (i = 0; i < 3; i++) {
640 List_Remove(&
msg->entry);
648 volume * 255, attenuation * 64, timeofs * 1000);
652 int soundindex,
float volume,
653 float attenuation,
float timeofs)
660 Com_Error(ERR_DROP,
"%s: NULL origin", __func__);
665 sendchan = (ent << 3) | (channel & 7);
668 flags = SND_ENT | SND_POS;
669 if (volume != DEFAULT_SOUND_PACKET_VOLUME)
671 if (attenuation != DEFAULT_SOUND_PACKET_ATTENUATION)
672 flags |= SND_ATTENUATION;
680 if (flags & SND_VOLUME)
682 if (flags & SND_ATTENUATION)
684 if (flags & SND_OFFSET)
692 if (attenuation == ATTN_NONE || (channel & CHAN_NO_PHS_ADD)) {
693 if (channel & CHAN_RELIABLE) {
699 if (channel & CHAN_RELIABLE) {
717 static cvar_t *
PF_cvar(
const char *name,
const char *value,
int flags)
719 if (flags & CVAR_EXTENDED_MASK) {
720 Com_WPrintf(
"Game attemped to set extended flags on '%s', masked out.\n", name);
721 flags &= ~CVAR_EXTENDED_MASK;
724 return Cvar_Get(name, value, flags | CVAR_GAME);
735 Com_Error(ERR_DROP,
"%s: no map loaded", __func__);
743 Com_Error(ERR_DROP,
"%s: no map loaded", __func__);
750 if (tag + TAG_MAX < tag) {
751 Com_Error(ERR_FATAL,
"%s: bad tag", __func__);
756 return memset(
Z_TagMalloc(size, tag + TAG_MAX), 0, size);
761 if (tag + TAG_MAX < tag) {
762 Com_Error(ERR_FATAL,
"%s: bad tag", __func__);
769 #if (defined _DEBUG) && USE_CLIENT
807 Com_Printf(
"Loaded game library from %s\n", path);
814 char path[MAX_OSPATH];
818 PATH_SEP_STRING,
game, PATH_SEP_STRING,
819 prefix,
"game" CPUSTRING LIBSUFFIX, NULL);
820 if (len >=
sizeof(path)) {
821 Com_EPrintf(
"Game library path length exceeded\n");
825 if (os_access(path, F_OK)) {
827 Com_Printf(
"Can't access %s: %s\n", path, strerror(errno));
843 game_import_t
import;
844 game_export_t *(*entry)(game_import_t *) = NULL;
854 if (!entry &&
fs_game->string[0]) {
869 Com_Error(ERR_DROP,
"Failed to load game library");
928 Com_Error(ERR_DROP,
"Game DLL returned NULL exports");
931 if (
ge->apiversion != GAME_API_VERSION) {
932 Com_Error(ERR_DROP,
"Game DLL is version %d, expected %d",
933 ge->apiversion, GAME_API_VERSION);
940 if (
ge->edict_size <
sizeof(edict_t) ||
ge->edict_size > SIZE_MAX / MAX_EDICTS) {
941 Com_Error(ERR_DROP,
"Game DLL returned bad size of edict_t");
946 Com_Error(ERR_DROP,
"Game DLL returned bad number of max_edicts");
static qboolean PF_inPVS(vec3_t p1, vec3_t p2)
cvar_t * Cvar_Set(const char *var_name, const char *value)
void SV_MvdStartSound(int entnum, int channel, int flags, int soundindex, int volume, int attenuation, int timeofs)
static qboolean PF_inVIS(vec3_t p1, vec3_t p2, int vis)
static void PF_AddCommandString(const char *string)
cvar_t * Cvar_Get(const char *var_name, const char *var_value, int flags)
byte * BSP_ClusterVis(bsp_t *bsp, byte *mask, int cluster, int vis)
static void PF_bprintf(int level, const char *fmt,...)
static cvar_t * PF_cvar(const char *name, const char *value, int flags)
static void * _SV_LoadGameLibrary(const char *path)
void SV_MvdUnicast(edict_t *ent, int clientNum, qboolean reliable)
static void PF_PositionedSound(vec3_t origin, edict_t *entity, int channel, int soundindex, float volume, float attenuation, float timeofs)
size_t Q_vsnprintf(char *dest, size_t size, const char *fmt, va_list argptr)
static int PF_ImageIndex(const char *name)
void MSG_WriteByte(int c)
void SCR_DebugGraph(float value, int color)
void SV_Multicast(vec3_t origin, multicast_t to)
static void PF_setmodel(edict_t *ent, const char *name)
mleaf_t * BSP_PointLeaf(mnode_t *node, vec3_t p)
void PF_LinkEdict(edict_t *ent)
void SV_ClientAddMessage(client_t *client, int flags)
#define FOR_EACH_CLIENT(client)
int SV_AreaEdicts(vec3_t mins, vec3_t maxs, edict_t **list, int maxcount, int areatype)
qboolean CM_AreasConnected(cm_t *cm, int area1, int area2)
static void PF_SetAreaPortalState(int portalnum, qboolean open)
void MSG_WritePos(const vec3_t pos)
void * Z_TagMalloc(size_t size, memtag_t tag)
void Com_Error(error_type_t type, const char *fmt,...)
static q_noreturn void PF_error(const char *fmt,...)
void PF_Pmove(pmove_t *pm)
void Cbuf_AddText(cmdbuf_t *buf, const char *text)
void Pmove(pmove_t *pmove, pmoveParams_t *params)
void PF_UnlinkEdict(edict_t *ent)
static int PF_ModelIndex(const char *name)
static void PF_centerprintf(edict_t *ent, const char *fmt,...)
static void PF_DebugGraph(float value, int color)
void SV_InitGameProgs(void)
void Com_LPrintf(print_type_t type, const char *fmt,...)
char * Com_GetLastError(void)
void MSG_WriteShort(int c)
cvar_t * Cvar_UserSet(const char *var_name, const char *value)
static void PF_dprintf(const char *fmt,...)
static void PF_WriteFloat(float f)
void * Sys_LoadLibrary(const char *path, const char *sym, void **handle)
void MSG_WriteString(const char *string)
void MSG_WriteLong(int c)
static qboolean PF_inPHS(vec3_t p1, vec3_t p2)
cvar_t * sys_forcegamelib
mleaf_t * CM_PointLeaf(cm_t *cm, vec3_t p)
int SV_PointContents(vec3_t p)
static int PF_SoundIndex(const char *name)
static int PF_FindIndex(const char *name, int start, int max)
void SV_ShutdownGameProgs(void)
static void PF_Unicast(edict_t *ent, qboolean reliable)
void Z_FreeTags(memtag_t tag)
void MSG_WriteChar(int c)
size_t msg_unreliable_bytes
list_t msg_unreliable_list
void SV_MvdConfigstring(int index, const char *string, size_t len)
static void * PF_TagMalloc(size_t size, unsigned tag)
size_t Q_concat(char *dest, size_t size,...)
static void * SV_LoadGameLibrary(const char *game, const char *prefix)
void Sys_FreeLibrary(void *handle)
static void PF_cprintf(edict_t *ent, int level, const char *fmt,...)
char configstrings[MAX_CONFIGSTRINGS][MAX_QPATH]
qboolean SV_EdictIsVisible(cm_t *cm, edict_t *ent, byte *mask)
trace_t q_gameabi SV_Trace(vec3_t start, vec3_t mins, vec3_t maxs, vec3_t end, edict_t *passedict, int contentmask)
static void PF_StartSound(edict_t *edict, int channel, int soundindex, float volume, float attenuation, float timeofs)
void MSG_WriteDir(const vec3_t dir)
void MSG_WriteAngle(float f)
void CM_SetAreaPortalState(cm_t *cm, int portalnum, qboolean open)
static void PF_configstring(int index, const char *val)
void SZ_Clear(sizebuf_t *buf)
static qboolean PF_AreasConnected(int area1, int area2)
static void * game_library
static void PF_FreeTags(unsigned tag)
void SV_MvdBroadcastPrint(int level, const char *string)
char name[MAX_CLIENT_NAME]