DarkPlaces
Game engine based on the Quake 1 engine by id Software, developed by LadyHavoc
 
server.h File Reference
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  client_t
 
struct  csqcentityframedb_t
 
struct  server_floodaddress_t
 
struct  server_static_t
 
struct  server_t
 

Macros

#define DAMAGE_AIM   2
 
#define DAMAGE_NO   0
 
#define DAMAGE_YES   1
 
#define DEAD_DEAD   2
 
#define DEAD_DYING   1
 
#define DEAD_NO   0
 
#define FL_CLIENT   8
 
#define FL_CONVEYOR   4
 
#define FL_FLY   1
 
#define FL_GODMODE   64
 
#define FL_INWATER   16
 
#define FL_ITEM   256
 
#define FL_JUMPRELEASED   4096
 for jump debouncing
 
#define FL_MONSTER   32
 movement is smoothed on the client side by step based interpolation
 
#define FL_NOTARGET   128
 
#define FL_ONGROUND   512
 
#define FL_PARTIALGROUND   1024
 not all corners are valid
 
#define FL_SWIM   2
 
#define FL_WATERJUMP   2048
 player jumping out of water
 
#define MAX_CONNECTFLOODADDRESSES   16
 
#define MAX_GETSTATUSFLOODADDRESSES   128
 
#define MOVETYPE_ANGLECLIP   2
 
#define MOVETYPE_ANGLENOCLIP   1
 
#define MOVETYPE_BOUNCE   10
 
#define MOVETYPE_BOUNCEMISSILE   11
 bounce w/o gravity
 
#define MOVETYPE_FAKEPUSH   13
 tenebrae's push that doesn't push
 
#define MOVETYPE_FLY   5
 
#define MOVETYPE_FLY_WORLDONLY   33
 like MOVETYPE_FLY, but uses MOVE_WORLDONLY for all its traces; objects of this movetype better be SOLID_NOT or SOLID_TRIGGER please, or else...
 
#define MOVETYPE_FLYMISSILE   9
 extra size to monsters
 
#define MOVETYPE_FOLLOW   12
 track movement of aiment
 
#define MOVETYPE_NOCLIP   8
 
#define MOVETYPE_NONE   0
 never moves
 
#define MOVETYPE_PHYSICS   32
 indicates this object is physics controlled
 
#define MOVETYPE_PUSH   7
 no clip to world, push and crush
 
#define MOVETYPE_STEP   4
 gravity, special edge handling, special step based client side interpolation
 
#define MOVETYPE_TOSS   6
 gravity
 
#define MOVETYPE_USER_FIRST   128
 user defined movetypes
 
#define MOVETYPE_USER_LAST   191
 
#define MOVETYPE_WALK   3
 gravity
 
#define NUM_CSQCENTITIES_PER_FRAME   256
 
#define NUM_CSQCENTITYDB_FRAMES   256
 
#define NUM_SPAWN_PARMS   16
 
#define SOLID_BBOX   2
 touch on edge, block
 
#define SOLID_BSP   4
 bsp clip, touch on edge, block
 
#define SOLID_CORPSE   5
 same as SOLID_BBOX, except it behaves as SOLID_NOT against SOLID_SLIDEBOX objects (players/monsters)
 
#define SOLID_NOT   0
 no interaction with other objects
 
#define SOLID_PHYSICS_BOX   32
 physics object (mins, maxs, mass, origin, axis_forward, axis_left, axis_up, velocity, spinvelocity)
 
#define SOLID_PHYSICS_CAPSULE   34
 physics object (mins, maxs, mass, origin, axis_forward, axis_left, axis_up, velocity, spinvelocity)
 
#define SOLID_PHYSICS_CYLINDER   36
 physics object (mins, maxs, mass, origin, axis_forward, axis_left, axis_up, velocity, spinvelocity)
 
#define SOLID_PHYSICS_SPHERE   33
 physics object (mins, maxs, mass, origin, axis_forward, axis_left, axis_up, velocity, spinvelocity)
 
#define SOLID_PHYSICS_TRIMESH   35
 physics object (mins, maxs, mass, origin, axis_forward, axis_left, axis_up, velocity, spinvelocity)
 
#define SOLID_SLIDEBOX   3
 touch on edge, but not an onground
 
#define SOLID_TRIGGER   1
 touch on edge, but not blocking
 
#define SPAWNFLAG_NOT_DEATHMATCH   2048
 
#define SPAWNFLAG_NOT_EASY   256
 
#define SPAWNFLAG_NOT_HARD   1024
 
#define SPAWNFLAG_NOT_MEDIUM   512
 
#define SV_LockThreadMutex()
 
#define SV_UnlockThreadMutex()
 

Enumerations

enum  server_state_t { ss_loading , ss_active }
 

Functions

void SV_AddCameraEyes (void)
 
void SV_AddUpdates (void)
 
void SV_ApplyClientMove (void)
 
void SV_Begin_f (cmd_state_t *cmd)
 
void SV_BroadcastPrint (const char *msg)
 
void SV_BroadcastPrintf (const char *fmt,...) DP_FUNC_PRINTF(1)
 
qbool SV_CanSeeBox (int numsamples, vec_t eyejitter, vec_t enlarge, vec_t entboxexpand, vec3_t eye, vec3_t entboxmins, vec3_t entboxmaxs)
 
qbool SV_CheckBottom (prvm_edict_t *ent)
 
void SV_CheckVelocity (prvm_edict_t *ent)
 
void SV_ClientCommands (const char *fmt,...) DP_FUNC_PRINTF(1)
 
void SV_ClientPrint (const char *msg)
 
void SV_ClientPrintf (const char *fmt,...) DP_FUNC_PRINTF(1)
 
void SV_ConnectClient (int clientnum, netconn_t *netconnection)
 
void SV_DropClient (qbool leaving, const char *reason,...)
 
int SV_EntitiesInBox (const vec3_t mins, const vec3_t maxs, int maxedicts, prvm_edict_t **resultedicts)
 
void SV_FlushBroadcastMessages (void)
 
double SV_Frame (double time)
 
int SV_GenericHitSuperContentsMask (const prvm_edict_t *edict)
 calculates hitsupercontentsmask for a generic qc entity
 
void SV_GetEntityMatrix (prvm_prog_t *prog, prvm_edict_t *ent, matrix4x4_t *out, qbool viewmatrix)
 
model_tSV_GetModelByIndex (int modelindex)
 
model_tSV_GetModelFromEdict (prvm_edict_t *ed)
 
int SV_GetPitchSign (prvm_prog_t *prog, prvm_edict_t *ent)
 
void SV_Init (void)
 
void SV_InitOperatorCommands (void)
 
int SV_IsLocalServer (void)
 
void SV_LinkEdict (prvm_edict_t *ent)
 
void SV_LinkEdict_TouchAreaGrid (prvm_edict_t *ent)
 
void SV_LinkEdict_TouchAreaGrid_Call (prvm_edict_t *touch, prvm_edict_t *ent)
 
void SV_Loadgame_f (cmd_state_t *cmd)
 
void SV_MarkWriteEntityStateToClient (entity_state_t *s, client_t *client)
 
int SV_ModelIndex (const char *s, int precachemode)
 
qbool SV_movestep (prvm_edict_t *ent, vec3_t move, qbool relink, qbool noenemy, qbool settrace)
 
void SV_Name (int clientnum)
 
int SV_ParticleEffectIndex (const char *name)
 
void SV_Physics (void)
 
void SV_Physics_ClientMove (void)
 
qbool SV_PlayerCheckGround (prvm_edict_t *ent)
 
void SV_PlayerPhysics (void)
 
int SV_PointSuperContents (const vec3_t point)
 
void SV_PreSpawn_f (cmd_state_t *cmd)
 
void SV_ReadClientMessage (void)
 
void SV_Savegame_f (cmd_state_t *cmd)
 
void SV_Savegame_to (prvm_prog_t *prog, const char *name)
 
void SV_SaveSpawnparms (void)
 
void SV_SendClientMessages (void)
 
void SV_SendServerinfo (client_t *client)
 
void SV_SetIdealPitch (void)
 
void SV_SetupVM (void)
 
void SV_Shutdown (void)
 
int SV_SoundIndex (const char *s, int precachemode)
 
void SV_Spawn_f (cmd_state_t *cmd)
 
void SV_SpawnServer (const char *map)
 
void SV_StartEffect (vec3_t org, int modelindex, int startframe, int framecount, int framerate)
 
void SV_StartParticle (vec3_t org, vec3_t dir, int color, int count)
 
void SV_StartPointSound (vec3_t origin, const char *sample, int volume, float attenuation, float speed)
 
void SV_StartSound (prvm_edict_t *entity, int channel, const char *sample, int volume, float attenuation, qbool reliable, float speed)
 
void SV_StartThread (void)
 
void SV_StopThread (void)
 
const char * SV_TimingReport (char *buf, size_t buflen)
 for output in SV_Status_f
 
trace_t SV_TraceBox (const vec3_t start, const vec3_t mins, const vec3_t maxs, const vec3_t end, int type, prvm_edict_t *passedict, int hitsupercontentsmask, int skipsupercontentsmask, int skipmaterialflagsmask, float extend)
 traces a box move against worldmodel and all entities in the specified area
 
trace_t SV_TraceLine (const vec3_t start, const vec3_t end, int type, prvm_edict_t *passedict, int hitsupercontentsmask, int skipsupercontentsmask, int skipmaterialflagsmask, float extend)
 
trace_t SV_TracePoint (const vec3_t start, int type, prvm_edict_t *passedict, int hitsupercontentsmask, int skipsupercontentsmask, int skipmaterialflagsmask)
 
qbool SV_VM_ConsoleCommand (const char *text, size_t textlen)
 
void SV_WriteClientdataToMessage (client_t *client, prvm_edict_t *ent, sizebuf_t *msg, int *stats)
 
void SV_WriteEntitiesToClient (client_t *client, prvm_edict_t *clent, sizebuf_t *msg, int maxsize)
 
void VM_CustomStats_Clear (void)
 
void VM_SV_MoveToGoal (prvm_prog_t *prog)
 
void VM_SV_UpdateCustomStats (client_t *client, prvm_edict_t *ent, sizebuf_t *msg, int *stats)
 

Variables

cvar_t coop
 
cvar_t deathmatch
 
cvar_t fraglimit
 
cvar_t gamecfg
 
client_thost_client
 
cvar_t host_limitlocal
 
cvar_t host_timescale
 
cvar_t noexit
 
cvar_t nomonsters
 
cvar_t pausable
 
cvar_t pr_checkextension
 
cvar_t samelevel
 
cvar_t saved1
 
cvar_t saved2
 
cvar_t saved3
 
cvar_t saved4
 
cvar_t savedgamecfg
 
cvar_t scratch1
 
cvar_t scratch2
 
cvar_t scratch3
 
cvar_t scratch4
 
cvar_t skill
 
server_t sv
 local server
 
cvar_t sv_accelerate
 
cvar_t sv_aim
 
cvar_t sv_airaccel_qw
 
cvar_t sv_airaccel_sideways_friction
 
cvar_t sv_airaccelerate
 
cvar_t sv_aircontrol
 
cvar_t sv_aircontrol_penalty
 
cvar_t sv_aircontrol_power
 
cvar_t sv_airspeedlimit_nonqw
 
cvar_t sv_airstopaccelerate
 
cvar_t sv_airstrafeaccel_qw
 
cvar_t sv_airstrafeaccelerate
 
cvar_t sv_allowdownloads
 
cvar_t sv_allowdownloads_archive
 
cvar_t sv_allowdownloads_config
 
cvar_t sv_allowdownloads_dlcache
 
cvar_t sv_allowdownloads_inarchive
 
cvar_t sv_areadebug
 
cvar_t sv_areagrid_link_SOLID_NOT
 
cvar_t sv_areagrid_mingridsize
 
cvar_t sv_checkforpacketsduringsleep
 
cvar_t sv_clmovement_enable
 
cvar_t sv_clmovement_inputtimeout
 
cvar_t sv_clmovement_maxnetfps
 
cvar_t sv_clmovement_minping
 
cvar_t sv_clmovement_minping_disabletime
 
cvar_t sv_cullentities_nevercullbmodels
 
cvar_t sv_cullentities_pvs
 
cvar_t sv_cullentities_stats
 
cvar_t sv_cullentities_trace
 
cvar_t sv_cullentities_trace_delay
 
cvar_t sv_cullentities_trace_enlarge
 
cvar_t sv_cullentities_trace_prediction
 
cvar_t sv_cullentities_trace_samples
 
cvar_t sv_cullentities_trace_samples_extra
 
cvar_t sv_debugmove
 
cvar_t sv_echobprint
 
cvar_t sv_edgefriction
 
cvar_t sv_entpatch
 
cvar_t sv_freezenonclients
 
cvar_t sv_friction
 
cvar_t sv_gameplayfix_blowupfallenzombies
 
cvar_t sv_gameplayfix_consistentplayerprethink
 
cvar_t sv_gameplayfix_delayprojectiles
 
cvar_t sv_gameplayfix_downtracesupportsongroundflag
 
cvar_t sv_gameplayfix_droptofloorstartsolid
 
cvar_t sv_gameplayfix_droptofloorstartsolid_nudgetocorrect
 
cvar_t sv_gameplayfix_easierwaterjump
 
cvar_t sv_gameplayfix_findradiusdistancetobox
 
cvar_t sv_gameplayfix_fixedcheckwatertransition
 
cvar_t sv_gameplayfix_gravityunaffectedbyticrate
 
cvar_t sv_gameplayfix_grenadebouncedownslopes
 
cvar_t sv_gameplayfix_impactbeforeonground
 
cvar_t sv_gameplayfix_multiplethinksperframe
 
cvar_t sv_gameplayfix_noairborncorpse
 
cvar_t sv_gameplayfix_noairborncorpse_allowsuspendeditems
 
cvar_t sv_gameplayfix_nogravityonground
 
cvar_t sv_gameplayfix_nosquashentities
 
cvar_t sv_gameplayfix_nostepmoveonsteepslopes
 
cvar_t sv_gameplayfix_nudgeoutofsolid
 
cvar_t sv_gameplayfix_nudgeoutofsolid_separation
 
cvar_t sv_gameplayfix_q1bsptracelinereportstexture
 
cvar_t sv_gameplayfix_q2airaccelerate
 
cvar_t sv_gameplayfix_setmodelrealbox
 
cvar_t sv_gameplayfix_slidemoveprojectiles
 
cvar_t sv_gameplayfix_stepdown
 
cvar_t sv_gameplayfix_stepmultipletimes
 
cvar_t sv_gameplayfix_swiminbmodels
 
cvar_t sv_gameplayfix_unstickentities
 
cvar_t sv_gameplayfix_unstickplayers
 
cvar_t sv_gameplayfix_upwardvelocityclearsongroundflag
 
cvar_t sv_gravity
 
cvar_t sv_idealpitchscale
 
cvar_t sv_jumpstep
 
cvar_t sv_jumpvelocity
 
cvar_t sv_legacy_bbox_expand
 
cvar_t sv_maxairspeed
 
cvar_t sv_maxairstrafespeed
 
cvar_t sv_maxrate
 
cvar_t sv_maxspeed
 
cvar_t sv_maxvelocity
 
mempool_tsv_mempool
 
cvar_t sv_nostep
 
cvar_t sv_playerphysicsqc
 
cvar_t sv_progs
 
cvar_t sv_protocolname
 
cvar_t sv_random_seed
 
cvar_t sv_sound_land
 
cvar_t sv_sound_watersplash
 
cvar_t sv_stepheight
 
cvar_t sv_stopspeed
 
cvar_t sv_wallfriction
 
cvar_t sv_wateraccelerate
 
cvar_t sv_waterfriction
 
server_static_t svs
 persistant server info
 
cvar_t sys_ticrate
 
cvar_t teamplay
 
cvar_t temp1
 
cvar_t timelimit
 

Macro Definition Documentation

◆ DAMAGE_AIM

#define DAMAGE_AIM   2

Definition at line 354 of file server.h.

Referenced by VM_SV_aim().

◆ DAMAGE_NO

#define DAMAGE_NO   0

Definition at line 352 of file server.h.

◆ DAMAGE_YES

#define DAMAGE_YES   1

Definition at line 353 of file server.h.

◆ DEAD_DEAD

#define DEAD_DEAD   2

Definition at line 350 of file server.h.

◆ DEAD_DYING

#define DEAD_DYING   1

Definition at line 349 of file server.h.

◆ DEAD_NO

#define DEAD_NO   0

Definition at line 348 of file server.h.

◆ FL_CLIENT

#define FL_CLIENT   8

Definition at line 360 of file server.h.

◆ FL_CONVEYOR

#define FL_CONVEYOR   4

Definition at line 359 of file server.h.

◆ FL_FLY

#define FL_FLY   1

◆ FL_GODMODE

#define FL_GODMODE   64

Definition at line 363 of file server.h.

Referenced by SV_DisableCheats_c(), and SV_God_f().

◆ FL_INWATER

#define FL_INWATER   16

Definition at line 361 of file server.h.

◆ FL_ITEM

#define FL_ITEM   256

Definition at line 365 of file server.h.

Referenced by SV_LinkEdict().

◆ FL_JUMPRELEASED

#define FL_JUMPRELEASED   4096

for jump debouncing

Definition at line 369 of file server.h.

◆ FL_MONSTER

#define FL_MONSTER   32

movement is smoothed on the client side by step based interpolation

Definition at line 362 of file server.h.

Referenced by CL_GenericHitSuperContentsMask(), CL_TraceBox(), CL_TraceLine(), CL_TracePoint(), SV_GenericHitSuperContentsMask(), SV_PrepareEntityForSending(), SV_TraceBox(), SV_TraceLine(), and SV_TracePoint().

◆ FL_NOTARGET

#define FL_NOTARGET   128

Definition at line 364 of file server.h.

Referenced by SV_DisableCheats_c(), SV_Notarget_f(), and VM_SV_newcheckclient().

◆ FL_ONGROUND

◆ FL_PARTIALGROUND

#define FL_PARTIALGROUND   1024

not all corners are valid

Definition at line 367 of file server.h.

Referenced by CL_movestep(), SV_FixCheckBottom(), and SV_movestep().

◆ FL_SWIM

#define FL_SWIM   2

◆ FL_WATERJUMP

#define FL_WATERJUMP   2048

player jumping out of water

Definition at line 368 of file server.h.

Referenced by SV_FlyMove(), SV_PlayerPhysics(), and SV_WalkMove().

◆ MAX_CONNECTFLOODADDRESSES

#define MAX_CONNECTFLOODADDRESSES   16

Definition at line 54 of file server.h.

◆ MAX_GETSTATUSFLOODADDRESSES

#define MAX_GETSTATUSFLOODADDRESSES   128

Definition at line 55 of file server.h.

◆ MOVETYPE_ANGLECLIP

#define MOVETYPE_ANGLECLIP   2

Definition at line 314 of file server.h.

◆ MOVETYPE_ANGLENOCLIP

#define MOVETYPE_ANGLENOCLIP   1

Definition at line 313 of file server.h.

◆ MOVETYPE_BOUNCE

#define MOVETYPE_BOUNCE   10

◆ MOVETYPE_BOUNCEMISSILE

#define MOVETYPE_BOUNCEMISSILE   11

bounce w/o gravity

Definition at line 323 of file server.h.

Referenced by SV_Physics_ClientEntity(), SV_Physics_ClientEntity_NoThink(), SV_Physics_Entity(), and SV_Physics_Toss().

◆ MOVETYPE_FAKEPUSH

#define MOVETYPE_FAKEPUSH   13

tenebrae's push that doesn't push

Definition at line 325 of file server.h.

Referenced by SV_Physics_ClientEntity(), SV_Physics_ClientEntity_NoThink(), SV_Physics_Entity(), and SV_PushMove().

◆ MOVETYPE_FLY

◆ MOVETYPE_FLY_WORLDONLY

#define MOVETYPE_FLY_WORLDONLY   33

like MOVETYPE_FLY, but uses MOVE_WORLDONLY for all its traces; objects of this movetype better be SOLID_NOT or SOLID_TRIGGER please, or else...

Definition at line 327 of file server.h.

Referenced by PHYS_TestEntityPosition(), SV_Physics_ClientEntity(), SV_Physics_ClientEntity_NoThink(), SV_Physics_Entity(), SV_PushEntity(), SV_PushMove(), and SV_WalkMove().

◆ MOVETYPE_FLYMISSILE

#define MOVETYPE_FLYMISSILE   9

extra size to monsters

Definition at line 321 of file server.h.

Referenced by SV_Physics_ClientEntity(), SV_Physics_ClientEntity_NoThink(), SV_Physics_Entity(), SV_PushEntity(), and SV_WalkMove().

◆ MOVETYPE_FOLLOW

#define MOVETYPE_FOLLOW   12

track movement of aiment

Definition at line 324 of file server.h.

Referenced by SV_Physics_ClientEntity(), SV_Physics_ClientEntity_NoThink(), SV_Physics_Entity(), and SV_PushMove().

◆ MOVETYPE_NOCLIP

◆ MOVETYPE_NONE

#define MOVETYPE_NONE   0

◆ MOVETYPE_PHYSICS

#define MOVETYPE_PHYSICS   32

◆ MOVETYPE_PUSH

#define MOVETYPE_PUSH   7

no clip to world, push and crush

Definition at line 319 of file server.h.

Referenced by SV_Physics_ClientEntity(), SV_Physics_ClientEntity_NoThink(), SV_Physics_Entity(), SV_PushMove(), and SV_SpawnServer().

◆ MOVETYPE_STEP

#define MOVETYPE_STEP   4

gravity, special edge handling, special step based client side interpolation

Definition at line 316 of file server.h.

Referenced by SV_Physics_ClientEntity(), SV_Physics_ClientEntity_NoThink(), SV_Physics_Entity(), SV_PrepareEntityForSending(), and SVVM_count_edicts().

◆ MOVETYPE_TOSS

#define MOVETYPE_TOSS   6

◆ MOVETYPE_USER_FIRST

#define MOVETYPE_USER_FIRST   128

user defined movetypes

Definition at line 328 of file server.h.

Referenced by SV_Physics_ClientEntity(), SV_Physics_ClientEntity_NoThink(), and SV_Physics_Entity().

◆ MOVETYPE_USER_LAST

#define MOVETYPE_USER_LAST   191

◆ MOVETYPE_WALK

◆ NUM_CSQCENTITIES_PER_FRAME

#define NUM_CSQCENTITIES_PER_FRAME   256

Definition at line 171 of file server.h.

Referenced by EntityFrameCSQC_WriteFrame().

◆ NUM_CSQCENTITYDB_FRAMES

#define NUM_CSQCENTITYDB_FRAMES   256

◆ NUM_SPAWN_PARMS

#define NUM_SPAWN_PARMS   16

◆ SOLID_BBOX

#define SOLID_BBOX   2

◆ SOLID_BSP

◆ SOLID_CORPSE

#define SOLID_CORPSE   5

same as SOLID_BBOX, except it behaves as SOLID_NOT against SOLID_SLIDEBOX objects (players/monsters)

Definition at line 338 of file server.h.

Referenced by CL_GenericHitSuperContentsMask(), CL_TraceBox(), CL_TraceLine(), CL_TracePoint(), R_DrawEntityBBoxes_Callback(), SV_GenericHitSuperContentsMask(), SV_PushMove(), SV_TraceBox(), SV_TraceLine(), and SV_TracePoint().

◆ SOLID_NOT

#define SOLID_NOT   0

◆ SOLID_PHYSICS_BOX

#define SOLID_PHYSICS_BOX   32

physics object (mins, maxs, mass, origin, axis_forward, axis_left, axis_up, velocity, spinvelocity)

Definition at line 341 of file server.h.

◆ SOLID_PHYSICS_CAPSULE

#define SOLID_PHYSICS_CAPSULE   34

physics object (mins, maxs, mass, origin, axis_forward, axis_left, axis_up, velocity, spinvelocity)

Definition at line 343 of file server.h.

◆ SOLID_PHYSICS_CYLINDER

#define SOLID_PHYSICS_CYLINDER   36

physics object (mins, maxs, mass, origin, axis_forward, axis_left, axis_up, velocity, spinvelocity)

Definition at line 345 of file server.h.

◆ SOLID_PHYSICS_SPHERE

#define SOLID_PHYSICS_SPHERE   33

physics object (mins, maxs, mass, origin, axis_forward, axis_left, axis_up, velocity, spinvelocity)

Definition at line 342 of file server.h.

◆ SOLID_PHYSICS_TRIMESH

#define SOLID_PHYSICS_TRIMESH   35

physics object (mins, maxs, mass, origin, axis_forward, axis_left, axis_up, velocity, spinvelocity)

Definition at line 344 of file server.h.

◆ SOLID_SLIDEBOX

#define SOLID_SLIDEBOX   3

touch on edge, but not an onground

Definition at line 335 of file server.h.

Referenced by CL_GenericHitSuperContentsMask(), R_DrawEntityBBoxes_Callback(), SV_GenericHitSuperContentsMask(), and SV_PushMove().

◆ SOLID_TRIGGER

#define SOLID_TRIGGER   1

◆ SPAWNFLAG_NOT_DEATHMATCH

#define SPAWNFLAG_NOT_DEATHMATCH   2048

Definition at line 374 of file server.h.

Referenced by SVVM_load_edict().

◆ SPAWNFLAG_NOT_EASY

#define SPAWNFLAG_NOT_EASY   256

Definition at line 371 of file server.h.

Referenced by SVVM_load_edict().

◆ SPAWNFLAG_NOT_HARD

#define SPAWNFLAG_NOT_HARD   1024

Definition at line 373 of file server.h.

Referenced by SVVM_load_edict().

◆ SPAWNFLAG_NOT_MEDIUM

#define SPAWNFLAG_NOT_MEDIUM   512

Definition at line 372 of file server.h.

Referenced by SVVM_load_edict().

◆ SV_LockThreadMutex

#define SV_LockThreadMutex ( )
Value:
void() predraw
server_static_t svs
persistant server info
Definition sv_main.c:224
void * threadmutex
Definition server.h:46
qbool threaded
Definition server.h:44
#define Thread_LockMutex(m)
Definition thread.h:17

Definition at line 606 of file server.h.

Referenced by Cbuf_Frame(), Crypto_KeyGen_f(), Crypto_KeyGen_Finished(), NetConn_OpenClientPorts(), NetConn_OpenServerPorts(), SV_Shutdown(), and SV_ThreadFunc().

◆ SV_UnlockThreadMutex

#define SV_UnlockThreadMutex ( )

Enumeration Type Documentation

◆ server_state_t

Enumerator
ss_loading 
ss_active 

Definition at line 52 of file server.h.

server_state_t
Definition server.h:52
@ ss_active
Definition server.h:52
@ ss_loading
Definition server.h:52

Function Documentation

◆ SV_AddCameraEyes()

void SV_AddCameraEyes ( void )

Definition at line 1063 of file sv_send.c.

1064{
1065}

Referenced by SV_WriteEntitiesToClient().

◆ SV_AddUpdates()

void SV_AddUpdates ( void )

◆ SV_ApplyClientMove()

void SV_ApplyClientMove ( void )

Definition at line 893 of file sv_user.c.

894{
895 prvm_prog_t *prog = SVVM_prog;
896 usercmd_t *move = &host_client->cmd;
897 int j, movementloss, packetloss;
898
899 if (!move->receivetime)
900 return;
901
902 // note: a move can be applied multiple times if the client packets are
903 // not coming as often as the physics is executed, and the move must be
904 // applied before running qc each time because the id1 qc had a bug where
905 // it clears self.button2 in PlayerJump, causing pogostick behavior if
906 // moves are not applied every time before calling qc
907 move->applied = true;
908
909 // set the edict fields
912 if (move->impulse)
914 // only send the impulse to qc once
915 move->impulse = 0;
916
917 movementloss = packetloss = 0;
919 {
920 for (j = 0;j < NETGRAPH_PACKETS;j++)
922 packetloss++;
923 for (j = 0;j < NETGRAPH_PACKETS;j++)
924 if (host_client->movement_count[j] < 0)
925 movementloss++;
926 }
927
929 PRVM_serveredictfloat(host_client->edict, button3) = ((move->buttons >> 2) & 1);
930 PRVM_serveredictfloat(host_client->edict, button4) = ((move->buttons >> 3) & 1);
931 PRVM_serveredictfloat(host_client->edict, button5) = ((move->buttons >> 4) & 1);
932 PRVM_serveredictfloat(host_client->edict, button6) = ((move->buttons >> 5) & 1);
933 PRVM_serveredictfloat(host_client->edict, button7) = ((move->buttons >> 6) & 1);
934 PRVM_serveredictfloat(host_client->edict, button8) = ((move->buttons >> 7) & 1);
935 PRVM_serveredictfloat(host_client->edict, button9) = ((move->buttons >> 11) & 1);
936 PRVM_serveredictfloat(host_client->edict, button10) = ((move->buttons >> 12) & 1);
937 PRVM_serveredictfloat(host_client->edict, button11) = ((move->buttons >> 13) & 1);
938 PRVM_serveredictfloat(host_client->edict, button12) = ((move->buttons >> 14) & 1);
939 PRVM_serveredictfloat(host_client->edict, button13) = ((move->buttons >> 15) & 1);
940 PRVM_serveredictfloat(host_client->edict, button14) = ((move->buttons >> 16) & 1);
941 PRVM_serveredictfloat(host_client->edict, button15) = ((move->buttons >> 17) & 1);
942 PRVM_serveredictfloat(host_client->edict, button16) = ((move->buttons >> 18) & 1);
954}
float button10
float button12
float button3
float button7
float button11
float ping
float button16
float ping_movementloss
vector movement
float ping_packetloss
float button4
vector cursor_screen
float button6
entity cursor_trace_ent
float button8
float cursor_active
float buttonchat
float buttonuse
float button9
float button15
float button13
float button14
vector cursor_trace_start
float button5
vector cursor_trace_endpos
#define VectorSet(vec, x, y, z)
Definition mathlib.h:96
#define VectorCopy(in, out)
Definition mathlib.h:101
#define NETGRAPH_PACKETS
Definition netconn.h:222
#define NETGRAPH_LOSTPACKET
Definition netconn.h:224
float button2
Definition progsdefs.qc:156
float button0
Definition progsdefs.qc:154
vector v_angle
Definition progsdefs.qc:161
float impulse
Definition progsdefs.qc:158
#define PRVM_serveredictvector(ed, fieldname)
Definition progsvm.h:173
#define PRVM_serveredictedict(ed, fieldname)
Definition progsvm.h:175
#define PRVM_EDICT_TO_PROG(e)
Definition progsvm.h:875
#define PRVM_EDICT_NUM(n)
Definition progsvm.h:867
#define PRVM_serveredictfloat(ed, fieldname)
Definition progsvm.h:172
#define SVVM_prog
Definition progsvm.h:766
client_t * host_client
Definition sv_main.c:29
precision highp float
Definition shader_glsl.h:53
signed char movement_count[NETGRAPH_PACKETS]
Definition server.h:213
netconn_t * netconnection
communications handle
Definition server.h:210
prvm_edict_t * edict
PRVM_EDICT_NUM(clientnum+1)
Definition server.h:221
float ping
LadyHavoc: can be used for prediction or whatever...
Definition server.h:224
usercmd_t cmd
movement
Definition server.h:216
netgraphitem_t incoming_netgraph[NETGRAPH_PACKETS]
Definition netconn.h:227
int unreliablebytes
Definition netconn.h:136
int impulse
Definition protocol.h:396
float receivetime
Definition protocol.h:393
vec3_t cursor_start
Definition protocol.h:385
qbool applied
Definition protocol.h:398
vec3_t viewangles
Definition protocol.h:377
vec3_t cursor_screen
Definition protocol.h:384
int cursor_entitynumber
Definition protocol.h:390
vec3_t cursor_impact
Definition protocol.h:387
float forwardmove
Definition protocol.h:380
int buttons
Definition protocol.h:395
float upmove
Definition protocol.h:382
float sidemove
Definition protocol.h:381

References usercmd_t::applied, button0, button10, button11, button12, button13, button14, button15, button16, button2, button3, button4, button5, button6, button7, button8, button9, buttonchat, usercmd_t::buttons, buttonuse, client_t::cmd, cursor_active, usercmd_t::cursor_entitynumber, usercmd_t::cursor_impact, cursor_screen, usercmd_t::cursor_screen, usercmd_t::cursor_start, cursor_trace_endpos, cursor_trace_ent, cursor_trace_start, client_t::edict, float, usercmd_t::forwardmove, host_client, impulse, usercmd_t::impulse, netconn_t::incoming_netgraph, movement, client_t::movement_count, client_t::netconnection, NETGRAPH_LOSTPACKET, NETGRAPH_PACKETS, client_t::ping, ping, ping_movementloss, ping_packetloss, PRVM_EDICT_NUM, PRVM_EDICT_TO_PROG, PRVM_serveredictedict, PRVM_serveredictfloat, PRVM_serveredictvector, usercmd_t::receivetime, usercmd_t::sidemove, SVVM_prog, netgraphitem_t::unreliablebytes, usercmd_t::upmove, v_angle, VectorCopy, VectorSet, and usercmd_t::viewangles.

Referenced by SV_PlayerPhysics().

◆ SV_Begin_f()

void SV_Begin_f ( cmd_state_t * cmd)

Definition at line 204 of file sv_user.c.

205{
206 if (!host_client->spawned)
207 {
208 Con_Print("Begin not valid -- not yet spawned\n");
209 return;
210 }
211 if (host_client->begun)
212 {
213 Con_Print("Begin not valid -- already begun\n");
214 return;
215 }
216 host_client->begun = true;
217
218 // LadyHavoc: note: this code also exists in SV_DropClient
219 if (sv.loadgame)
220 {
221 int i;
222 for (i = 0;i < svs.maxclients;i++)
223 if (svs.clients[i].active && !svs.clients[i].spawned)
224 break;
225 if (i == svs.maxclients)
226 {
227 Con_Printf("Loaded game, everyone rejoined - unpausing\n");
228 sv.paused = sv.loadgame = false; // we're basically done with loading now
229 }
230 }
231}
void Con_Print(const char *msg)
Prints to all appropriate console targets, and adds timestamps.
Definition console.c:1504
void Con_Printf(const char *fmt,...)
Prints to all appropriate console targets.
Definition console.c:1514
int i
server_t sv
local server
Definition sv_main.c:223
qbool begun
false = don't send datagrams
Definition server.h:193
qbool spawned
false = don't allow begin
Definition server.h:191
struct client_s * clients
client slots
Definition server.h:30
int maxclients
number of svs.clients slots (updated by maxplayers command)
Definition server.h:28
qbool paused
Definition server.h:68
qbool loadgame
handle connections specially
Definition server.h:71

References client_t::begun, server_static_t::clients, Con_Print(), Con_Printf(), host_client, i, server_t::loadgame, server_static_t::maxclients, server_t::paused, client_t::spawned, sv, and svs.

Referenced by SV_InitOperatorCommands().

◆ SV_BroadcastPrint()

void SV_BroadcastPrint ( const char * msg)

Definition at line 91 of file sv_send.c.

92{
93 int i;
94 client_t *client;
95
96 for (i = 0, client = svs.clients;i < svs.maxclients;i++, client++)
97 {
98 if (client->active && client->netconnection)
99 {
101 MSG_WriteString(&client->netconnection->message, msg);
102 }
103 }
104
106 Con_Print(msg);
107}
void MSG_WriteString(sizebuf_t *sb, const char *s)
Definition com_msg.c:173
void MSG_WriteByte(sizebuf_t *sb, int c)
Definition com_msg.c:130
cvar_t host_isclient
Definition host.c:61
#define svc_print
Definition protocol.h:222
cvar_t sv_echobprint
Definition sv_main.c:99
qbool active
false = empty client slot
Definition server.h:185
int integer
Definition cvar.h:73
sizebuf_t message
writing buffer to send to peer as the next reliable message can be added to at any time,...
Definition netconn.h:161

References client_t::active, server_static_t::clients, Con_Print(), host_isclient, i, cvar_t::integer, server_static_t::maxclients, netconn_t::message, MSG_WriteByte(), MSG_WriteString(), client_t::netconnection, sv_echobprint, svc_print, and svs.

Referenced by SV_BroadcastPrintf(), and VM_bprint().

◆ SV_BroadcastPrintf()

void SV_BroadcastPrintf ( const char * fmt,
... )

Definition at line 116 of file sv_send.c.

117{
118 va_list argptr;
119 char msg[MAX_INPUTLINE];
120
121 va_start(argptr,fmt);
122 dpvsnprintf(msg,sizeof(msg),fmt,argptr);
123 va_end(argptr);
124
126}
int dpvsnprintf(char *buffer, size_t buffersize, const char *format, va_list args)
Returns the number of printed characters, excluding the final '\0' or returns -1 if the buffer isn't ...
Definition common.c:1010
#define MAX_INPUTLINE
maximum size of console commandline, QuakeC strings, and many other text processing buffers
Definition qdefs.h:94
void SV_BroadcastPrint(const char *msg)
Definition sv_send.c:91

References dpvsnprintf(), MAX_INPUTLINE, and SV_BroadcastPrint().

Referenced by Cvar_SetQuick_Internal(), SV_DropClient(), SV_Frame(), SV_Name(), and SV_Pause_f().

◆ SV_CanSeeBox()

qbool SV_CanSeeBox ( int numsamples,
vec_t eyejitter,
vec_t enlarge,
vec_t entboxexpand,
vec3_t eye,
vec3_t entboxmins,
vec3_t entboxmaxs )

Definition at line 723 of file sv_send.c.

724{
725 prvm_prog_t *prog = SVVM_prog;
726 float pitchsign;
727 float alpha;
728 float starttransformed[3], endtransformed[3];
729 float boxminstransformed[3], boxmaxstransformed[3];
730 float localboxcenter[3], localboxextents[3], localboxmins[3], localboxmaxs[3];
731 int blocked = 0;
732 int traceindex;
733 int originalnumtouchedicts;
734 int numtouchedicts = 0;
735 int touchindex;
736 matrix4x4_t matrix, imatrix;
737 model_t *model;
738 prvm_edict_t *touch;
739 static prvm_edict_t *touchedicts[MAX_EDICTS];
740 vec3_t eyemins, eyemaxs, start;
741 vec3_t boxmins, boxmaxs;
742 vec3_t clipboxmins, clipboxmaxs;
743 vec3_t endpoints[MAX_LINEOFSIGHTTRACES];
744
745 numtraces = min(numtraces, MAX_LINEOFSIGHTTRACES);
746
747 // jitter the eye location within this box
748 eyemins[0] = eye[0] - eyejitter;
749 eyemaxs[0] = eye[0] + eyejitter;
750 eyemins[1] = eye[1] - eyejitter;
751 eyemaxs[1] = eye[1] + eyejitter;
752 eyemins[2] = eye[2] - eyejitter;
753 eyemaxs[2] = eye[2] + eyejitter;
754 // expand the box a little
755 boxmins[0] = (enlarge+1) * entboxmins[0] - enlarge * entboxmaxs[0] - entboxexpand;
756 boxmaxs[0] = (enlarge+1) * entboxmaxs[0] - enlarge * entboxmins[0] + entboxexpand;
757 boxmins[1] = (enlarge+1) * entboxmins[1] - enlarge * entboxmaxs[1] - entboxexpand;
758 boxmaxs[1] = (enlarge+1) * entboxmaxs[1] - enlarge * entboxmins[1] + entboxexpand;
759 boxmins[2] = (enlarge+1) * entboxmins[2] - enlarge * entboxmaxs[2] - entboxexpand;
760 boxmaxs[2] = (enlarge+1) * entboxmaxs[2] - enlarge * entboxmins[2] + entboxexpand;
761
762 VectorMAM(0.5f, boxmins, 0.5f, boxmaxs, endpoints[0]);
763 for (traceindex = 1;traceindex < numtraces;traceindex++)
764 VectorSet(endpoints[traceindex], lhrandom(boxmins[0], boxmaxs[0]), lhrandom(boxmins[1], boxmaxs[1]), lhrandom(boxmins[2], boxmaxs[2]));
765
766 // calculate sweep box for the entire swarm of traces
767 VectorCopy(eyemins, clipboxmins);
768 VectorCopy(eyemaxs, clipboxmaxs);
769 for (traceindex = 0;traceindex < numtraces;traceindex++)
770 {
771 clipboxmins[0] = min(clipboxmins[0], endpoints[traceindex][0]);
772 clipboxmins[1] = min(clipboxmins[1], endpoints[traceindex][1]);
773 clipboxmins[2] = min(clipboxmins[2], endpoints[traceindex][2]);
774 clipboxmaxs[0] = max(clipboxmaxs[0], endpoints[traceindex][0]);
775 clipboxmaxs[1] = max(clipboxmaxs[1], endpoints[traceindex][1]);
776 clipboxmaxs[2] = max(clipboxmaxs[2], endpoints[traceindex][2]);
777 }
778
779 // get the list of entities in the sweep box
781 numtouchedicts = SV_EntitiesInBox(clipboxmins, clipboxmaxs, MAX_EDICTS, touchedicts);
782 if (numtouchedicts > MAX_EDICTS)
783 {
784 // this never happens
785 Con_Printf("SV_EntitiesInBox returned %i edicts, max was %i\n", numtouchedicts, MAX_EDICTS);
786 numtouchedicts = MAX_EDICTS;
787 }
788 // iterate the entities found in the sweep box and filter them
789 originalnumtouchedicts = numtouchedicts;
790 numtouchedicts = 0;
791 for (touchindex = 0;touchindex < originalnumtouchedicts;touchindex++)
792 {
793 touch = touchedicts[touchindex];
795 continue;
797 if (!model || !model->brush.TraceLineOfSight)
798 continue;
799 // skip obviously transparent entities
801 if (alpha && alpha < 1)
802 continue;
803 if ((int)PRVM_serveredictfloat(touch, effects) & EF_ADDITIVE)
804 continue;
805 touchedicts[numtouchedicts++] = touch;
806 }
807
808 // now that we have a filtered list of "interesting" entities, fire each
809 // ray against all of them, this gives us an early-out case when something
810 // is visible (which it often is)
811
812 for (traceindex = 0;traceindex < numtraces;traceindex++)
813 {
814 VectorSet(start, lhrandom(eyemins[0], eyemaxs[0]), lhrandom(eyemins[1], eyemaxs[1]), lhrandom(eyemins[2], eyemaxs[2]));
815 // check world occlusion
816 if (sv.worldmodel && sv.worldmodel->brush.TraceLineOfSight)
817 if (!sv.worldmodel->brush.TraceLineOfSight(sv.worldmodel, start, endpoints[traceindex], boxmins, boxmaxs))
818 continue;
819 for (touchindex = 0;touchindex < numtouchedicts;touchindex++)
820 {
821 touch = touchedicts[touchindex];
823 if(model && model->brush.TraceLineOfSight)
824 {
825 // get the entity matrix
826 pitchsign = SV_GetPitchSign(prog, touch);
828 Matrix4x4_Invert_Simple(&imatrix, &matrix);
829 // see if the ray hits this entity
830 Matrix4x4_Transform(&imatrix, start, starttransformed);
831 Matrix4x4_Transform(&imatrix, endpoints[traceindex], endtransformed);
832 Matrix4x4_Transform(&imatrix, boxmins, boxminstransformed);
833 Matrix4x4_Transform(&imatrix, boxmaxs, boxmaxstransformed);
834 // transform the AABB to local space
835 VectorMAM(0.5f, boxminstransformed, 0.5f, boxmaxstransformed, localboxcenter);
836 localboxextents[0] = fabs(boxmaxstransformed[0] - localboxcenter[0]);
837 localboxextents[1] = fabs(boxmaxstransformed[1] - localboxcenter[1]);
838 localboxextents[2] = fabs(boxmaxstransformed[2] - localboxcenter[2]);
839 localboxmins[0] = localboxcenter[0] - localboxextents[0];
840 localboxmins[1] = localboxcenter[1] - localboxextents[1];
841 localboxmins[2] = localboxcenter[2] - localboxextents[2];
842 localboxmaxs[0] = localboxcenter[0] + localboxextents[0];
843 localboxmaxs[1] = localboxcenter[1] + localboxextents[1];
844 localboxmaxs[2] = localboxcenter[2] + localboxextents[2];
845 if (!model->brush.TraceLineOfSight(model, starttransformed, endtransformed, localboxmins, localboxmaxs))
846 {
847 blocked++;
848 break;
849 }
850 }
851 }
852 // check if the ray was blocked
853 if (touchindex < numtouchedicts)
854 continue;
855 // return if the ray was not blocked
856 return true;
857 }
858
859 // no rays survived
860 return false;
861}
float effects
vector angles
vector origin
string model
float solid
float alpha
#define max(A, B)
Definition mathlib.h:38
#define min(A, B)
Definition mathlib.h:37
#define lhrandom(MIN, MAX)
LadyHavoc: this function never returns exactly MIN or exactly MAX, because of a QuakeC bug in id1 whe...
Definition mathlib.h:48
#define VectorMAM(scale1, b1, scale2, b2, out)
Definition mathlib.h:116
void Matrix4x4_Transform(const matrix4x4_t *in, const float v[3], float out[3])
Definition matrixlib.c:1657
void Matrix4x4_CreateFromQuakeEntity(matrix4x4_t *out, double x, double y, double z, double pitch, double yaw, double roll, double scale)
Definition matrixlib.c:715
void Matrix4x4_Invert_Simple(matrix4x4_t *out, const matrix4x4_t *in1)
Definition matrixlib.c:422
float fabs(float f)
#define EF_ADDITIVE
Definition protocol.h:73
#define MAX_EDICTS
max number of objects in game world at once (32768 protocol limit)
Definition qdefs.h:105
vec_t vec3_t[3]
Definition qtypes.h:71
int SV_EntitiesInBox(const vec3_t mins, const vec3_t maxs, int maxedicts, prvm_edict_t **resultedicts)
Definition sv_phys.c:673
int SV_GetPitchSign(prvm_prog_t *prog, prvm_edict_t *ent)
Definition sv_phys.c:47
model_t * SV_GetModelFromEdict(prvm_edict_t *ed)
Definition sv_main.c:1612
#define SOLID_BSP
bsp clip, touch on edge, block
Definition server.h:336
struct model_s * worldmodel
Definition server.h:112
#define MAX_LINEOFSIGHTTRACES
Definition sv_send.c:721
cvar_t sv_cullentities_trace_entityocclusion
Definition sv_main.c:92

References alpha, angles, Con_Printf(), EF_ADDITIVE, effects, fabs(), cvar_t::integer, lhrandom, Matrix4x4_CreateFromQuakeEntity(), Matrix4x4_Invert_Simple(), Matrix4x4_Transform(), max, MAX_EDICTS, MAX_LINEOFSIGHTTRACES, min, model, origin, PRVM_serveredictfloat, PRVM_serveredictvector, solid, SOLID_BSP, sv, sv_cullentities_trace_entityocclusion, SV_EntitiesInBox(), SV_GetModelFromEdict(), SV_GetPitchSign(), SVVM_prog, VectorCopy, VectorMAM, VectorSet, and server_t::worldmodel.

Referenced by SV_MarkWriteEntityStateToClient(), and SV_WriteEntitiesToClient().

◆ SV_CheckBottom()

qbool SV_CheckBottom ( prvm_edict_t * ent)

Definition at line 36 of file sv_move.c.

37{
38 prvm_prog_t *prog = SVVM_prog;
39 vec3_t mins, maxs, start, stop;
40 trace_t trace;
41 int x, y;
42 float mid, bottom;
43
46
47// if all of the points under the corners are solid world, don't bother
48// with the tougher checks
49// the corners must be within 16 of the midpoint
50 start[2] = mins[2] - 1;
51 for (x=0 ; x<=1 ; x++)
52 for (y=0 ; y<=1 ; y++)
53 {
54 start[0] = x ? maxs[0] : mins[0];
55 start[1] = y ? maxs[1] : mins[1];
57 goto realcheck;
58 }
59
60 c_yes++;
61 return true; // we got out easy
62
63realcheck:
64 c_no++;
65//
66// check it for real...
67//
68 start[2] = mins[2];
69
70// the midpoint must be within 16 of the bottom
71 start[0] = stop[0] = (mins[0] + maxs[0])*0.5;
72 start[1] = stop[1] = (mins[1] + maxs[1])*0.5;
73 stop[2] = start[2] - 2*sv_stepheight.value;
75
76 if (trace.fraction == 1.0)
77 return false;
78 mid = bottom = trace.endpos[2];
79
80// the corners must be within 16 of the midpoint
81 for (x=0 ; x<=1 ; x++)
82 for (y=0 ; y<=1 ; y++)
83 {
84 start[0] = stop[0] = x ? maxs[0] : mins[0];
85 start[1] = stop[1] = y ? maxs[1] : mins[1];
86
88
89 if (trace.fraction != 1.0 && trace.endpos[2] > bottom)
90 bottom = trace.endpos[2];
91 if (trace.fraction == 1.0 || mid - trace.endpos[2] > sv_stepheight.value)
92 return false;
93 }
94
95 c_yes++;
96 return true;
97}
#define SUPERCONTENTS_BODY
Definition bspfile.h:201
#define SUPERCONTENTS_SOLID
Definition bspfile.h:196
cvar_t collision_extendmovelength
Definition collision.c:14
vector mins
vector maxs
GLint GLenum GLint GLint y
Definition glquake.h:651
GLint GLenum GLint x
Definition glquake.h:651
#define VectorAdd(a, b, out)
Definition mathlib.h:100
trace_t SV_TraceLine(const vec3_t start, const vec3_t end, int type, prvm_edict_t *passedict, int hitsupercontentsmask, int skipsupercontentsmask, int skipmaterialflagsmask, float extend)
Definition sv_phys.c:256
int SV_GenericHitSuperContentsMask(const prvm_edict_t *edict)
calculates hitsupercontentsmask for a generic qc entity
Definition sv_phys.c:73
cvar_t sv_stepheight
Definition sv_main.c:153
int SV_PointSuperContents(const vec3_t point)
Definition sv_phys.c:611
float value
Definition cvar.h:74
double fraction
Definition collision.h:40
double endpos[3]
Definition collision.h:42
int c_yes
Definition sv_move.c:34
int c_no
Definition sv_move.c:34
#define MOVE_NOMONSTERS
Definition world.h:29

References c_no, c_yes, collision_extendmovelength, trace_t::endpos, trace_t::fraction, maxs, mins, MOVE_NOMONSTERS, origin, PRVM_serveredictvector, SUPERCONTENTS_BODY, SUPERCONTENTS_SOLID, SV_GenericHitSuperContentsMask(), SV_PointSuperContents(), sv_stepheight, SV_TraceLine(), SVVM_prog, cvar_t::value, VectorAdd, x, and y.

Referenced by SV_movestep(), SV_NewChaseDir(), and VM_SV_checkbottom().

◆ SV_CheckVelocity()

void SV_CheckVelocity ( prvm_edict_t * ent)

Definition at line 965 of file sv_phys.c.

966{
967 prvm_prog_t *prog = SVVM_prog;
968 int i;
969 float wishspeed;
970
971//
972// bound velocity
973//
974 for (i=0 ; i<3 ; i++)
975 {
976 if (isnan(PRVM_serveredictvector(ent, velocity)[i]))
977 {
978 Con_Printf("Got a NaN velocity on entity #%i (%s)\n", PRVM_NUM_FOR_EDICT(ent), PRVM_GetString(prog, PRVM_serveredictstring(ent, classname)));
980 }
981 if (isnan(PRVM_serveredictvector(ent, origin)[i]))
982 {
983 Con_Printf("Got a NaN origin on entity #%i (%s)\n", PRVM_NUM_FOR_EDICT(ent), PRVM_GetString(prog, PRVM_serveredictstring(ent, classname)));
985 }
986 }
987
988 // LadyHavoc: a hack to ensure that the (rather silly) id1 quakec
989 // player_run/player_stand1 does not horribly malfunction if the
990 // velocity becomes a denormalized float
991 if (VectorLength2(PRVM_serveredictvector(ent, velocity)) < 0.0000001)
993
994 // LadyHavoc: max velocity fix, inspired by Maddes's source fixes, but this is faster
997 {
1002 }
1003}
string classname
vector velocity
#define VectorClear(a)
Definition mathlib.h:97
#define VectorLength2(a)
Definition mathlib.h:110
#define DotProduct(a, b)
Definition mathlib.h:98
float sqrt(float f)
const char * PRVM_GetString(prvm_prog_t *prog, int num)
#define PRVM_NUM_FOR_EDICT(e)
Definition progsvm.h:870
#define PRVM_serveredictstring(ed, fieldname)
Definition progsvm.h:174
cvar_t sv_maxvelocity
Definition sv_main.c:143
static float wishspeed
Definition sv_user.c:306

References classname, Con_Printf(), DotProduct, i, origin, PRVM_GetString(), PRVM_NUM_FOR_EDICT, PRVM_serveredictstring, PRVM_serveredictvector, sqrt(), sv_maxvelocity, SVVM_prog, cvar_t::value, VectorClear, VectorLength2, velocity, and wishspeed.

Referenced by SV_Physics_ClientEntity(), SV_Physics_ClientEntity_PostThink(), SV_Physics_ClientEntity_PreThink(), SV_Physics_ClientMove(), SV_Physics_Step(), SV_Physics_Toss(), SV_PlayerPhysics(), SV_Trace_Toss(), and SV_WalkMove().

◆ SV_ClientCommands()

void SV_ClientCommands ( const char * fmt,
... )

Definition at line 135 of file sv_send.c.

136{
137 va_list argptr;
138 char string[MAX_INPUTLINE];
139
141 return;
142
143 va_start(argptr,fmt);
144 dpvsnprintf(string, sizeof(string), fmt, argptr);
145 va_end(argptr);
146
149}
#define svc_stufftext
Definition protocol.h:223

References dpvsnprintf(), host_client, MAX_INPUTLINE, netconn_t::message, MSG_WriteByte(), MSG_WriteString(), client_t::netconnection, and svc_stufftext.

Referenced by Curl_SendRequirements(), SV_Download_f(), SV_ReadClientMessage(), SV_SendCvar_f(), and VM_SV_stuffcmd().

◆ SV_ClientPrint()

◆ SV_ClientPrintf()

void SV_ClientPrintf ( const char * fmt,
... )

Definition at line 72 of file sv_send.c.

73{
74 va_list argptr;
75 char msg[MAX_INPUTLINE];
76
77 va_start(argptr,fmt);
78 dpvsnprintf(msg,sizeof(msg),fmt,argptr);
79 va_end(argptr);
80
81 SV_ClientPrint(msg);
82}
void SV_ClientPrint(const char *msg)
Definition sv_send.c:55

References dpvsnprintf(), MAX_INPUTLINE, and SV_ClientPrint().

Referenced by Cmd_SV_Callback(), SV_Download_f(), SV_DropClient(), SV_Ent_Create_f(), SV_Ent_Remove_All_f(), SV_Ent_Remove_f(), SV_Name_f(), SV_Pause_f(), SV_Ping_f(), and SV_Status_f().

◆ SV_ConnectClient()

void SV_ConnectClient ( int clientnum,
netconn_t * netconnection )

Definition at line 936 of file sv_main.c.

937{
938 prvm_prog_t *prog = SVVM_prog;
939 client_t *client;
940 int i;
941
942 client = svs.clients + clientnum;
943
944// set up the client_t
945 if (sv.loadgame)
946 {
947 float backupparms[NUM_SPAWN_PARMS];
948 memcpy(backupparms, client->spawn_parms, sizeof(backupparms));
949 memset(client, 0, sizeof(*client));
950 memcpy(client->spawn_parms, backupparms, sizeof(backupparms));
951 }
952 else
953 memset(client, 0, sizeof(*client));
954 client->active = true;
955 client->netconnection = netconnection;
956
957 Con_DPrintf("Client %s connected\n", client->netconnection ? client->netconnection->address : "botclient");
958
959 if(client->netconnection && client->netconnection->crypto.authenticated)
960 {
961 Con_Printf("%s connection to %s has been established: client is %s@%s%.*s, I am %.*s@%s%.*s\n",
962 client->netconnection->crypto.use_aes ? "Encrypted" : "Authenticated",
963 client->netconnection->address,
964 client->netconnection->crypto.client_idfp[0] ? client->netconnection->crypto.client_idfp : "-",
965 (client->netconnection->crypto.client_issigned || !client->netconnection->crypto.client_keyfp[0]) ? "" : "~",
968 (client->netconnection->crypto.server_issigned || !client->netconnection->crypto.server_keyfp[0]) ? "" : "~",
970 );
971 }
972
973 dp_strlcpy(client->name, "unconnected", sizeof(client->name));
974 dp_strlcpy(client->old_name, "unconnected", sizeof(client->old_name));
975 client->prespawned = false;
976 client->spawned = false;
977 client->begun = false;
978 client->edict = PRVM_EDICT_NUM(clientnum+1);
979 if (client->netconnection)
980 client->netconnection->message.allowoverflow = true; // we can catch it
981 // prepare the unreliable message buffer
982 client->unreliablemsg.data = client->unreliablemsg_data;
983 client->unreliablemsg.maxsize = sizeof(client->unreliablemsg_data);
984 // updated by receiving "rate" command from client, this is also the default if not using a DP client
985 client->rate = 1000000000;
986 client->connecttime = host.realtime;
987
988 if (!sv.loadgame)
989 {
990 // call the progs to get default spawn parms for the new client
991 // set self to world to intentionally cause errors with broken SetNewParms code in some mods
994 prog->ExecuteProgram(prog, PRVM_serverfunction(SetNewParms), "QC function SetNewParms is missing");
995 for (i=0 ; i<NUM_SPAWN_PARMS ; i++)
997
998 // set up the entity for this client (including .colormap, .team, etc)
999 PRVM_ED_ClearEdict(prog, client->edict);
1000 }
1001
1002 // don't call SendServerinfo for a fresh botclient because its fields have
1003 // not been set up by the qc yet
1004 if (client->netconnection)
1005 SV_SendServerinfo (client);
1006 else
1007 client->prespawned = client->spawned = client->begun = true;
1008}
#define dp_strlcpy(dst, src, dsize)
Definition common.h:303
void Con_DPrintf(const char *fmt,...)
A Con_Printf that only shows up if the "developer" cvar is set.
Definition console.c:1544
int crypto_keyfp_recommended_length
Definition crypto.c:41
entity self
float time
host_static_t host
Definition host.c:41
float parm1
Definition progsdefs.qc:45
void PRVM_ED_ClearEdict(prvm_prog_t *prog, prvm_edict_t *e)
Definition prvm_edict.c:210
#define PRVM_serverglobaledict(fieldname)
Definition progsvm.h:180
#define PRVM_serverglobalfloat(fieldname)
Definition progsvm.h:177
#define PRVM_serverfunction(funcname)
Definition progsvm.h:182
#define NUM_SPAWN_PARMS
Definition server.h:180
prvm_vec_t spawn_parms[NUM_SPAWN_PARMS]
spawn parms are carried from level to level
Definition server.h:232
int rate
requested rate in bytes per second
Definition server.h:198
char old_name[MAX_SCOREBOARDNAME]
Definition server.h:235
qbool prespawned
false = don't allow spawn
Definition server.h:189
char name[MAX_SCOREBOARDNAME]
Definition server.h:235
sizebuf_t unreliablemsg
Definition server.h:281
unsigned char unreliablemsg_data[NET_MAXMESSAGE]
Definition server.h:280
double connecttime
realtime this client connected
Definition server.h:204
char server_keyfp[FP64_SIZE+1]
Definition crypto.h:48
qbool server_issigned
Definition crypto.h:49
char client_idfp[FP64_SIZE+1]
Definition crypto.h:44
char client_keyfp[FP64_SIZE+1]
Definition crypto.h:45
qbool authenticated
Definition crypto.h:50
qbool client_issigned
Definition crypto.h:46
char server_idfp[FP64_SIZE+1]
Definition crypto.h:47
qbool use_aes
Definition crypto.h:51
double realtime
the accumulated mainloop time since application started (with filtering), without any slowmo or clamp...
Definition host.h:46
char address[128]
Definition netconn.h:231
crypto_t crypto
Definition netconn.h:232
void(* ExecuteProgram)(struct prvm_prog_s *prog, func_t fnum, const char *errormessage)
pointer to one of the *VM_ExecuteProgram functions
Definition progsvm.h:749
double time
Definition server.h:76
unsigned char * data
Definition common.h:52
qbool allowoverflow
if false, do a Sys_Error
Definition common.h:50
int maxsize
Definition common.h:53
server_t sv
local server
Definition sv_main.c:223
void SV_SendServerinfo(client_t *client)
Definition sv_main.c:749
server_static_t svs
persistant server info
Definition sv_main.c:224

References client_t::active, netconn_t::address, sizebuf_t::allowoverflow, crypto_t::authenticated, client_t::begun, crypto_t::client_idfp, crypto_t::client_issigned, crypto_t::client_keyfp, server_static_t::clients, Con_DPrintf(), Con_Printf(), client_t::connecttime, netconn_t::crypto, crypto_keyfp_recommended_length, sizebuf_t::data, dp_strlcpy, client_t::edict, prvm_prog_t::ExecuteProgram, host, i, server_t::loadgame, sizebuf_t::maxsize, netconn_t::message, client_t::name, client_t::netconnection, NUM_SPAWN_PARMS, client_t::old_name, parm1, client_t::prespawned, PRVM_ED_ClearEdict(), PRVM_EDICT_NUM, PRVM_serverfunction, PRVM_serverglobaledict, PRVM_serverglobalfloat, client_t::rate, host_static_t::realtime, self, crypto_t::server_idfp, crypto_t::server_issigned, crypto_t::server_keyfp, client_t::spawn_parms, client_t::spawned, sv, SV_SendServerinfo(), svs, SVVM_prog, server_t::time, time, client_t::unreliablemsg, client_t::unreliablemsg_data, and crypto_t::use_aes.

Referenced by NetConn_ServerParsePacket(), and VM_SV_spawnclient().

◆ SV_DropClient()

void SV_DropClient ( qbool leaving,
const char * reason,
... )

Definition at line 1018 of file sv_main.c.

1019{
1020 prvm_prog_t *prog = SVVM_prog;
1021 int i;
1022
1023 va_list argptr;
1024 char reason[512] = "";
1025
1026 Con_Printf("Client \"%s\" dropped", host_client->name);
1027
1028 if(fmt)
1029 {
1030 va_start(argptr, fmt);
1031 dpvsnprintf(reason, sizeof(reason), fmt, argptr);
1032 va_end(argptr);
1033
1034 Con_Printf(" (%s)\n", reason);
1035 }
1036 else
1037 {
1038 Con_Printf(" \n");
1039 }
1040
1042
1043 // make sure edict is not corrupt (from a level change for example)
1045
1047 {
1048 // tell the client to be gone
1049 if (!leaving)
1050 {
1051 // LadyHavoc: no opportunity for resending, so use unreliable 3 times
1052 unsigned char bufdata[520]; // Disconnect reason string can be 512 characters
1053 sizebuf_t buf;
1054 memset(&buf, 0, sizeof(buf));
1055 buf.data = bufdata;
1056 buf.maxsize = sizeof(bufdata);
1058 if(fmt)
1059 {
1061 MSG_WriteString(&buf, reason);
1062 else
1063 SV_ClientPrintf("%s\n", reason);
1064 }
1068 }
1069 }
1070
1071 // call qc ClientDisconnect function
1072 // LadyHavoc: don't call QC if server is dead (avoids recursive
1073 // Host_Error in some mods when they run out of edicts)
1075 {
1076 // call the prog function for removing a client
1077 // this will set the body to a dead frame, among other things
1078 int saveSelf = PRVM_serverglobaledict(self);
1082 prog->ExecuteProgram(prog, PRVM_serverfunction(ClientDisconnect), "QC function ClientDisconnect is missing");
1083 PRVM_serverglobaledict(self) = saveSelf;
1084 }
1085
1087 {
1088 // break the net connection
1091
1092 if(fmt)
1093 SV_BroadcastPrintf("\003^3%s left the game (%s)\n", host_client->name, reason);
1094 else
1095 SV_BroadcastPrintf("\003^3%s left the game\n", host_client->name);
1096 }
1097
1098 // if a download is active, close it
1100 {
1101 Con_DPrintf("Download of %s aborted when %s dropped\n", host_client->download_name, host_client->name);
1104 host_client->download_name[0] = 0;
1107 }
1108
1109 // remove leaving player from scoreboard
1110 host_client->name[0] = 0;
1111 host_client->colors = 0;
1112 host_client->frags = 0;
1113 // send notification to all clients
1114 // get number of client manually just to make sure we get it right...
1125
1126 // free the client now
1133
1134 if (sv.active)
1135 {
1136 // clear a fields that matter to DP_SV_CLIENTNAME and DP_SV_CLIENTCOLORS, and also frags
1138 }
1139
1140 // clear the client struct (this sets active to false)
1141 memset(host_client, 0, sizeof(*host_client));
1142
1143 // update server listing on the master because player count changed
1144 // (which the master uses for filtering empty/full servers)
1146
1147 if (sv.loadgame)
1148 {
1149 for (i = 0;i < svs.maxclients;i++)
1150 if (svs.clients[i].active && !svs.clients[i].spawned)
1151 break;
1152 if (i == svs.maxclients)
1153 {
1154 Con_Printf("Loaded game, everyone rejoined - unpausing\n");
1155 sv.paused = sv.loadgame = false; // we're basically done with loading now
1156 }
1157 }
1158}
void EntityFrame4_FreeDatabase(entityframe4_database_t *d)
Definition com_ents4.c:13
void EntityFrame_FreeDatabase(entityframe_database_t *d)
Definition com_ents.c:11
void MSG_WriteShort(sizebuf_t *sb, int c)
Definition com_msg.c:138
@ PROTOCOL_DARKPLACES8
added parting messages. WIP
Definition common.h:134
int FS_Close(qfile_t *file)
Definition fs.c:2970
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition glquake.h:657
void NetConn_Heartbeat(int priority)
Definition netconn.c:3984
void NetConn_Close(netconn_t *conn)
Definition netconn.c:1240
int NetConn_SendUnreliableMessage(netconn_t *conn, sizebuf_t *data, protocolversion_t protocol, int rate, int burstsize, qbool quakesignon_suppressreliables)
Definition netconn.c:844
#define svc_disconnect
Definition protocol.h:216
#define svc_updatefrags
Definition protocol.h:233
void EntityFrame5_FreeDatabase(entityframe5_database_t *d)
Definition sv_ents5.c:29
#define svc_updatecolors
Definition protocol.h:236
#define svc_updatename
Definition protocol.h:232
#define NULL
Definition qtypes.h:12
void SV_BroadcastPrintf(const char *fmt,...) DP_FUNC_PRINTF(1)
Definition sv_send.c:116
void SV_ClientPrintf(const char *fmt,...) DP_FUNC_PRINTF(1)
Definition sv_send.c:72
int colors
Definition server.h:236
char download_name[MAX_QPATH]
Definition server.h:289
entityframe_database_t * entitydatabase
Definition server.h:272
qbool clientconnectcalled
false = don't do ClientDisconnect on drop
Definition server.h:187
int frags
Definition server.h:237
entityframe5_database_t * entitydatabase5
Definition server.h:274
entityframe4_database_t * entitydatabase4
Definition server.h:273
qfile_t * download_file
Definition server.h:286
int download_expectedposition
next position the client should ack
Definition server.h:287
qbool download_started
Definition server.h:288
qbool active
false if only a net client
Definition server.h:66
sizebuf_t reliable_datagram
Definition server.h:130
protocolversion_t protocol
one of the PROTOCOL_ values
Definition server.h:74
void SV_StopDemoRecording(client_t *client)
Definition sv_demo.c:55
client_t * host_client
Definition sv_main.c:29

References server_t::active, buf, client_t::clientconnectcalled, server_static_t::clients, client_t::colors, Con_DPrintf(), Con_Printf(), client_t::download_expectedposition, client_t::download_file, client_t::download_name, client_t::download_started, dpvsnprintf(), client_t::edict, client_t::entitydatabase, client_t::entitydatabase4, client_t::entitydatabase5, EntityFrame4_FreeDatabase(), EntityFrame5_FreeDatabase(), EntityFrame_FreeDatabase(), prvm_prog_t::ExecuteProgram, client_t::frags, FS_Close(), host_client, i, server_t::loadgame, server_static_t::maxclients, MSG_WriteByte(), MSG_WriteShort(), MSG_WriteString(), client_t::name, NetConn_Close(), NetConn_Heartbeat(), NetConn_SendUnreliableMessage(), client_t::netconnection, NULL, server_t::paused, server_t::protocol, PROTOCOL_DARKPLACES8, PRVM_ED_ClearEdict(), PRVM_EDICT_NUM, PRVM_EDICT_TO_PROG, PRVM_serverfunction, PRVM_serverglobaledict, PRVM_serverglobalfloat, server_t::reliable_datagram, self, sv, SV_BroadcastPrintf(), SV_ClientPrintf(), SV_StopDemoRecording(), svc_disconnect, svc_updatecolors, svc_updatefrags, svc_updatename, svs, SVVM_prog, server_t::time, and time.

Referenced by SV_CheckTimeouts(), SV_Kick_f(), SV_ReadClientMessage(), SV_SendClientMessages(), SV_Shutdown(), Sys_Error(), and VM_SV_dropclient().

◆ SV_EntitiesInBox()

int SV_EntitiesInBox ( const vec3_t mins,
const vec3_t maxs,
int maxedicts,
prvm_edict_t ** resultedicts )

Definition at line 673 of file sv_phys.c.

674{
675 prvm_prog_t *prog = SVVM_prog;
676 vec3_t paddedmins, paddedmaxs;
677 if (maxedicts < 1 || resultedicts == NULL)
678 return 0;
679 // LadyHavoc: discovered this actually causes its own bugs (dm6 teleporters being too close to info_teleport_destination)
680 //VectorSet(paddedmins, mins[0] - 10, mins[1] - 10, mins[2] - 1);
681 //VectorSet(paddedmaxs, maxs[0] + 10, maxs[1] + 10, maxs[2] + 1);
682 VectorCopy(mins, paddedmins);
683 VectorCopy(maxs, paddedmaxs);
685 {
686 int numresultedicts = 0;
687 int edictindex;
688 prvm_edict_t *ed;
689 for (edictindex = 1;edictindex < prog->num_edicts;edictindex++)
690 {
691 ed = PRVM_EDICT_NUM(edictindex);
692 if (!ed->free && BoxesOverlap(PRVM_serveredictvector(ed, absmin), PRVM_serveredictvector(ed, absmax), paddedmins, paddedmaxs))
693 {
694 resultedicts[numresultedicts++] = ed;
695 if (numresultedicts == maxedicts)
696 break;
697 }
698 }
699 return numresultedicts;
700 }
701 else
702 return World_EntitiesInBox(&sv.world, paddedmins, paddedmaxs, maxedicts, resultedicts);
703}
vector absmax
vector absmin
#define BoxesOverlap(a, b, c, d)
Definition mathlib.h:122
cvar_t sv_areadebug
Definition sv_main.c:164
qbool free
true if this edict is unused
Definition progsvm.h:93
int num_edicts
copies of some vars that were former read from sv
Definition progsvm.h:671
world_t world
collision culling data
Definition server.h:106
int World_EntitiesInBox(world_t *world, const vec3_t requestmins, const vec3_t requestmaxs, int maxlist, prvm_edict_t **list)
Definition world.c:188

References absmax, absmin, BoxesOverlap, prvm_edict_t::free, cvar_t::integer, maxs, mins, NULL, prvm_prog_t::num_edicts, PRVM_EDICT_NUM, PRVM_serveredictvector, sv, sv_areadebug, SVVM_prog, VectorCopy, server_t::world, and World_EntitiesInBox().

Referenced by SV_CanSeeBox(), SV_LinkEdict_TouchAreaGrid(), SV_PointSuperContents(), SV_PushMove(), SV_TraceBox(), SV_TraceLine(), SV_TracePoint(), VM_SV_findbox(), and VM_SV_findradius().

◆ SV_FlushBroadcastMessages()

void SV_FlushBroadcastMessages ( void )

Definition at line 1371 of file sv_send.c.

1372{
1373 int i;
1374 client_t *client;
1375 if (sv.datagram.cursize <= 0)
1376 return;
1377 for (i = 0, client = svs.clients;i < svs.maxclients;i++, client++)
1378 {
1379 if (!client->begun || !client->netconnection || client->unreliablemsg.cursize + sv.datagram.cursize > client->unreliablemsg.maxsize || client->unreliablemsg_splitpoints >= (int)(sizeof(client->unreliablemsg_splitpoint)/sizeof(client->unreliablemsg_splitpoint[0])))
1380 continue;
1383 }
1385}
void SZ_Clear(sizebuf_t *buf)
Definition common.c:44
void SZ_Write(sizebuf_t *buf, const unsigned char *data, int length)
Definition common.c:72
int unreliablemsg_splitpoint[NET_MAXMESSAGE/16]
Definition server.h:283
int unreliablemsg_splitpoints
Definition server.h:282
sizebuf_t datagram
Definition server.h:126
int cursize
Definition common.h:54

References client_t::begun, server_static_t::clients, sizebuf_t::cursize, sizebuf_t::data, server_t::datagram, i, server_static_t::maxclients, sizebuf_t::maxsize, client_t::netconnection, sv, svs, SZ_Clear(), SZ_Write(), client_t::unreliablemsg, client_t::unreliablemsg_splitpoint, and client_t::unreliablemsg_splitpoints.

Referenced by CLVM_ExecuteProgram(), SV_SendClientMessages(), SV_StartEffect(), SV_StartParticle(), SV_StartPointSound(), SV_StartSound(), SVVM_ExecuteProgram(), VM_SV_pointparticles(), VM_SV_te_beam(), VM_SV_te_blood(), VM_SV_te_bloodshower(), VM_SV_te_customflash(), VM_SV_te_explosion(), VM_SV_te_explosion2(), VM_SV_te_explosionquad(), VM_SV_te_explosionrgb(), VM_SV_te_flamejet(), VM_SV_te_gunshot(), VM_SV_te_gunshotquad(), VM_SV_te_knightspike(), VM_SV_te_lavasplash(), VM_SV_te_lightning1(), VM_SV_te_lightning2(), VM_SV_te_lightning3(), VM_SV_te_particlecube(), VM_SV_te_particlerain(), VM_SV_te_particlesnow(), VM_SV_te_plasmaburn(), VM_SV_te_smallflash(), VM_SV_te_spark(), VM_SV_te_spike(), VM_SV_te_spikequad(), VM_SV_te_superspike(), VM_SV_te_superspikequad(), VM_SV_te_tarexplosion(), VM_SV_te_teleport(), VM_SV_te_wizspike(), and VM_SV_trailparticles().

◆ SV_Frame()

double SV_Frame ( double time)

Definition at line 2527 of file sv_main.c.

2528{
2529 static double sv_timer;
2530 int i;
2531 char vabuf[1024];
2532 qbool reporting = false;
2533
2534 // reset timer after level change
2536 sv_timer = time = host.sleeptime = 0;
2537
2538 if (!svs.threaded)
2539 {
2540 prvm_prog_t *prog = SVVM_prog;
2541
2544
2546 reporting = true;
2547 // bones_was_here: intermission_running isn't declared in dpdefs, but it's used by
2548 // id1 Quake, all Quake mods (afaict), Nexuiz and Xonotic.
2549 else if (cls.state == ca_dedicated && !PRVM_serverglobalfloat(intermission_running))
2550 {
2551 // Report lag if there's players, so they know it wasn't the network or their machine
2552 for (i = 0; i < svs.maxclients; ++i)
2553 {
2554 if (svs.clients[i].begun && svs.clients[i].netconnection)
2555 {
2556 reporting = true;
2557 break;
2558 }
2559 }
2560 }
2561
2562 if(sv.perf_acc_realtime > 5)
2563 {
2566
2568 {
2573 }
2574
2575 if (sv.perf_lost > 0 && reporting)
2576 SV_BroadcastPrintf(CON_WARN "Server lag report: %s\n", SV_TimingReport(vabuf, sizeof(vabuf)));
2577
2582 }
2583
2584 /*
2585 * Receive packets on each main loop iteration, as the main loop may
2586 * be undersleeping due to select() detecting a new packet
2587 */
2588 if (sv.active)
2589 {
2592 }
2593 }
2594
2595 /*
2596 * If the accumulator hasn't become positive, don't
2597 * run the frame. Everything that happens before this
2598 * point will happen even if we're sleeping this frame.
2599 */
2600 if((sv_timer += time) < 0)
2601 return sv_timer;
2602
2603 // limit the frametime steps to no more than 100ms each
2604 if (sv_timer > 0.1)
2605 {
2606 if (!svs.threaded)
2607 sv.perf_acc_lost += (sv_timer - 0.1);
2608 sv_timer = 0.1;
2609 }
2610
2611 if (sv.active && sv_timer > 0 && !svs.threaded)
2612 {
2613 /*
2614 * Execute one or more server frames, with an upper limit on how much
2615 * execution time to spend on server frames to avoid freezing the game if
2616 * the server is overloaded. This execution time limit means the game will
2617 * slow down if the server is taking too long.
2618 */
2619 int framecount, framelimit = 1;
2620 double advancetime, aborttime = 0;
2621 float offset;
2622 prvm_prog_t *prog = SVVM_prog;
2623
2624 // run the world state
2625 // don't allow simulation to run too fast or too slow or logic glitches can occur
2626
2627 // stop running server frames if the wall time reaches this value
2628 if (sys_ticrate.value <= 0)
2629 advancetime = sv_timer;
2630 else
2631 {
2632 advancetime = sys_ticrate.value;
2633 // listen servers can run multiple server frames per client frame
2636 aborttime = Sys_DirtyTime() + 0.1;
2637 }
2638
2640 advancetime = min(advancetime, 0.1 / host_timescale.value);
2641 else
2642 advancetime = min(advancetime, 0.1);
2643
2644 if(advancetime > 0)
2645 {
2647 if (offset < 0 || offset >= 1800)
2648 offset = 0;
2649
2650 offset += sv_timer;
2654
2657 }
2658
2659 // only advance time if not paused
2660 // the game also pauses in singleplayer when menu or console is used
2661 sv.frametime = advancetime * host_timescale.value;
2664 if (sv.paused || host.paused)
2665 sv.frametime = 0;
2666
2667 for (framecount = 0; framecount < framelimit && sv_timer > 0; framecount++)
2668 {
2669 sv_timer -= advancetime;
2670
2671 // move things around and think unless paused
2672 if (sv.frametime)
2673 SV_Physics();
2674
2675 // if this server frame took too long, break out of the loop
2676 if (framelimit > 1 && Sys_DirtyTime() >= aborttime)
2677 break;
2678 }
2679
2680 if (framecount > 1 && sv_lagreporting_strict.integer && reporting)
2681 SV_BroadcastPrintf(CON_WARN "Server lag report: caught up %.1fms by running %d extra frames\n", advancetime * (framecount - 1) * 1000, framecount - 1);
2682
2683 R_TimeReport("serverphysics");
2684
2685 // send all messages to the clients
2687
2688 if (sv.paused == 1 && host.realtime > sv.pausedstart && sv.pausedstart > 0) {
2691 prog->ExecuteProgram(prog, PRVM_serverfunction(SV_PausedTic), "QC function SV_PausedTic is missing");
2692 }
2693
2694 // send an heartbeat if enough time has passed since the last one
2696 R_TimeReport("servernetwork");
2697 }
2698 else
2699 {
2700 // don't let r_speeds display jump around
2701 R_TimeReport("serverphysics");
2702 R_TimeReport("servernetwork");
2703 }
2704
2705 // if there is some time remaining from this frame, reset the timer
2706 if (sv_timer >= 0)
2707 {
2708 if (!svs.threaded)
2709 sv.perf_acc_lost += sv_timer;
2710 sv_timer = 0;
2711 }
2712
2713 return sv_timer;
2714}
client_static_t cls
Definition cl_main.c:116
@ ca_dedicated
Definition client.h:530
#define CON_WARN
Definition console.h:101
GLuint GLuint GLintptr offset
Definition glquake.h:632
void NetConn_ServerFrame(void)
Definition netconn.c:3861
#define OFS_PARM0
Definition pr_comp.h:34
bool qbool
Definition qtypes.h:9
void R_TimeReport(const char *desc)
Definition r_stats.c:193
void SV_SendClientMessages(void)
Definition sv_send.c:1697
void SV_Physics(void)
Definition sv_phys.c:3013
cactive_t state
Definition client.h:568
double sleeptime
time spent sleeping after the last frame
Definition host.h:48
double dirtytime
the main loop wall time for this frame, equal to Sys_DirtyTime() at the start of this host frame
Definition host.h:47
unsigned int framecount
incremented every frame, never reset, >0 means Host_AbortCurrentFrame() is possible
Definition host.h:45
qbool paused
global paused state, pauses both client and server
Definition host.h:50
prvm_vec_t * fp
Definition progsvm.h:580
union prvm_prog_t::@31 globals
double pausedstart
Definition server.h:69
float perf_offset_sdev
Definition server.h:86
float perf_acc_realtime
Definition server.h:88
double frametime
Definition server.h:77
float perf_acc_offset_max
Definition server.h:93
int perf_acc_offset_samples
Definition server.h:94
float perf_acc_lost
Definition server.h:90
float perf_lost
Definition server.h:83
unsigned int spawnframe
Definition server.h:79
float perf_acc_sleeptime
Definition server.h:89
float perf_acc_offset_squared
Definition server.h:92
float perf_offset_avg
Definition server.h:84
float perf_cpuload
Definition server.h:82
float perf_acc_offset
Definition server.h:91
float perf_offset_max
Definition server.h:85
cvar_t host_framerate
Definition host.c:44
cvar_t sv_lagreporting_strict
Definition sv_main.c:169
cvar_t sv_maxphysicsframesperserverframe
Definition sv_main.c:167
cvar_t sys_ticrate
Definition sv_main.c:166
const char * SV_TimingReport(char *buf, size_t buflen)
for output in SV_Status_f
Definition sv_main.c:2521
static void SV_CheckTimeouts(void)
Definition sv_main.c:2504
cvar_t host_timescale
Definition sv_main.c:53
cvar_t sv_lagreporting_always
Definition sv_main.c:168
double Sys_DirtyTime(void)
Definition sys_shared.c:417

References server_t::active, ca_dedicated, server_static_t::clients, cls, CON_WARN, host_static_t::dirtytime, prvm_prog_t::ExecuteProgram, prvm_prog_t::fp, host_static_t::framecount, server_t::frametime, prvm_prog_t::globals, host, host_framerate, host_timescale, i, cvar_t::integer, server_static_t::maxclients, min, NetConn_Heartbeat(), NetConn_ServerFrame(), offset, OFS_PARM0, host_static_t::paused, server_t::paused, server_t::pausedstart, server_t::perf_acc_lost, server_t::perf_acc_offset, server_t::perf_acc_offset_max, server_t::perf_acc_offset_samples, server_t::perf_acc_offset_squared, server_t::perf_acc_realtime, server_t::perf_acc_sleeptime, server_t::perf_cpuload, server_t::perf_lost, server_t::perf_offset_avg, server_t::perf_offset_max, server_t::perf_offset_sdev, PRVM_serverfunction, PRVM_serverglobalfloat, R_TimeReport(), host_static_t::realtime, host_static_t::sleeptime, server_t::spawnframe, sqrt(), client_static_t::state, sv, SV_BroadcastPrintf(), SV_CheckTimeouts(), sv_lagreporting_always, sv_lagreporting_strict, sv_maxphysicsframesperserverframe, SV_Physics(), SV_SendClientMessages(), SV_TimingReport(), svs, SVVM_prog, Sys_DirtyTime(), sys_ticrate, server_static_t::threaded, server_t::time, time, and cvar_t::value.

Referenced by Host_Frame().

◆ SV_GenericHitSuperContentsMask()

int SV_GenericHitSuperContentsMask ( const prvm_edict_t * edict)

calculates hitsupercontentsmask for a generic qc entity

Definition at line 73 of file sv_phys.c.

74{
75 prvm_prog_t *prog = SVVM_prog;
76 if (passedict)
77 {
80 return dphitcontentsmask;
81 else if (PRVM_serveredictfloat(passedict, solid) == SOLID_SLIDEBOX)
82 {
83 if ((int)PRVM_serveredictfloat(passedict, flags) & FL_MONSTER)
85 else
87 }
88 else if (PRVM_serveredictfloat(passedict, solid) == SOLID_CORPSE)
90 else if (PRVM_serveredictfloat(passedict, solid) == SOLID_TRIGGER)
92 else
94 }
95 else
97}
#define SUPERCONTENTS_MONSTERCLIP
Definition bspfile.h:205
#define SUPERCONTENTS_CORPSE
Definition bspfile.h:202
#define SUPERCONTENTS_PLAYERCLIP
Definition bspfile.h:204
float flags
float dphitcontentsmask
static int(ZEXPORT *qz_inflate)(z_stream *strm
#define FL_MONSTER
movement is smoothed on the client side by step based interpolation
Definition server.h:362
#define SOLID_SLIDEBOX
touch on edge, but not an onground
Definition server.h:335
#define SOLID_CORPSE
same as SOLID_BBOX, except it behaves as SOLID_NOT against SOLID_SLIDEBOX objects (players/monsters)
Definition server.h:338
#define SOLID_TRIGGER
touch on edge, but not blocking
Definition server.h:333

References dphitcontentsmask, FL_MONSTER, flags, int(), PRVM_serveredictfloat, solid, SOLID_CORPSE, SOLID_SLIDEBOX, SOLID_TRIGGER, SUPERCONTENTS_BODY, SUPERCONTENTS_CORPSE, SUPERCONTENTS_MONSTERCLIP, SUPERCONTENTS_PLAYERCLIP, SUPERCONTENTS_SOLID, and SVVM_prog.

Referenced by PHYS_NudgeOutOfSolid(), PHYS_TestEntityPosition(), SV_CheckBottom(), SV_movestep(), SV_NudgeOutOfSolid_PivotIsKnownGood(), SV_Physics_Step(), SV_PushEntity(), SV_PushMove(), SV_Trace_Toss(), SV_UserFriction(), SV_WalkMove(), VM_SV_tracebox(), and VM_SV_traceline().

◆ SV_GetEntityMatrix()

void SV_GetEntityMatrix ( prvm_prog_t * prog,
prvm_edict_t * ent,
matrix4x4_t * out,
qbool viewmatrix )

Definition at line 2518 of file svvm_cmds.c.

2519{
2520 float scale;
2521 float pitchsign = 1;
2522
2524 if (!scale)
2525 scale = 1.0f;
2526
2527 if (viewmatrix)
2529 else
2530 {
2531 pitchsign = SV_GetPitchSign(prog, ent);
2533 }
2534}
float scale
vector view_ofs
Definition progsdefs.qc:151
cvar_t cl_viewmodel_scale
Definition view.c:82

References angles, cl_viewmodel_scale, Matrix4x4_CreateFromQuakeEntity(), origin, PRVM_serveredictfloat, PRVM_serveredictvector, scale, SV_GetPitchSign(), v_angle, cvar_t::value, and view_ofs.

Referenced by getmatrix(), SV_Ent_Create_f(), SV_Ent_Remove_f(), and SV_GetTagMatrix().

◆ SV_GetModelByIndex()

model_t * SV_GetModelByIndex ( int modelindex)

Definition at line 1607 of file sv_main.c.

1608{
1609 return (modelindex > 0 && modelindex < MAX_MODELS) ? sv.models[modelindex] : NULL;
1610}
float modelindex
#define MAX_MODELS
max number of models loaded at once (including during level transitions)
Definition qdefs.h:106
struct model_s * models[MAX_MODELS]
Definition server.h:117

References MAX_MODELS, modelindex, server_t::models, NULL, and sv.

Referenced by EntityState5_WriteUpdate(), SV_GetTagIndex(), SV_GetTagMatrix(), SV_LinkEdict(), SV_MarkWriteEntityStateToClient(), SV_PrepareEntityForSending(), SV_PushMove(), VM_SV_frameduration(), VM_SV_frameforname(), VM_SV_setmodel(), VM_SV_setmodelindex(), VM_SV_skel_build(), and VM_SV_skel_create().

◆ SV_GetModelFromEdict()

◆ SV_GetPitchSign()

int SV_GetPitchSign ( prvm_prog_t * prog,
prvm_edict_t * ent )

Definition at line 47 of file sv_phys.c.

48{
50 if (
52 ?
53 model->type == mod_alias
54 :
55 (
56 (((unsigned char)PRVM_serveredictfloat(ent, pflags)) & PFLAGS_FULLDYNAMIC)
57 ||
58 ((gamemode == GAME_TENEBRAE) && ((unsigned int)PRVM_serveredictfloat(ent, effects) & (16 | 32)))
59 )
60 )
61 return -1;
62 return 1;
63}
gamemode_t gamemode
Definition com_game.c:26
@ GAME_TENEBRAE
full of evil hackery
Definition com_game.h:41
float pflags
@ mod_alias
#define PFLAGS_FULLDYNAMIC
Definition protocol.h:108

References effects, GAME_TENEBRAE, gamemode, mod_alias, model, pflags, PFLAGS_FULLDYNAMIC, PRVM_serveredictfloat, and SV_GetModelFromEdict().

Referenced by SV_CanSeeBox(), SV_GetEntityMatrix(), SV_TraceBox(), SV_TraceLine(), and SV_TracePoint().

◆ SV_Init()

void SV_Init ( void )

Definition at line 504 of file sv_main.c.

505{
506 // init the csqc progs cvars, since they are updated/used by the server code
507 // TODO: fix this since this is a quick hack to make some of [515]'s broken code run ;) [9/13/2006 Black]
508 extern cvar_t csqc_progname; //[515]: csqc crc check and right csprogs name according to progs.dat
509 extern cvar_t csqc_progcrc;
510 extern cvar_t csqc_progsize;
512
517
522
523 Cmd_AddCommand(CF_SHARED, "sv_saveentfile", SV_SaveEntFile_f, "save map entities to .ent file (to allow external editing)");
524 Cmd_AddCommand(CF_SHARED, "sv_areastats", SV_AreaStats_f, "prints statistics on entity culling during collision traces");
525 Cmd_AddCommand(CF_CLIENT | CF_SERVER_FROM_CLIENT, "sv_startdownload", SV_StartDownload_f, "begins sending a file to the client (network protocol use only)");
526 Cmd_AddCommand(CF_CLIENT | CF_SERVER_FROM_CLIENT, "download", SV_Download_f, "downloads a specified file from the server");
527
542 Cvar_RegisterVirtual (&host_timescale, "timescale");
639 Cvar_RegisterVirtual(&host_limitlocal, "sv_ratelimitlocalplayer");
654
660
663
666
677
678 // LadyHavoc: Nehahra uses these to pass data around cutscene demos
699 Cvar_RegisterVariable (&cutscene); // for Nehahra but useful to other mods as well
700
704
708
710
712
715
716 sv_mempool = Mem_AllocPool("server", 0, NULL);
717
720}
cvar_t csqc_progcrc
Definition cl_main.c:36
cvar_t csqc_usedemoprogs
Definition cl_main.c:38
cvar_t csqc_progsize
Definition cl_main.c:37
cvar_t csqc_progname
Definition cl_main.c:35
void Cmd_AddCommand(unsigned flags, const char *cmd_name, xcommand_t function, const char *description)
called by the init functions of other parts of the program to register commands and functions to call...
Definition cmd.c:1661
#define CF_SHARED
Definition cmd.h:67
#define CF_SERVER_FROM_CLIENT
command the client is allowed to execute on the server as a stringcmd
Definition cmd.h:51
#define CF_CLIENT
cvar/command that only the client can change/execute
Definition cmd.h:48
void Cvar_RegisterVariable(cvar_t *variable)
registers a cvar that already has the name, string, and optionally the archive elements set.
Definition cvar.c:599
void Cvar_RegisterVirtual(cvar_t *variable, const char *name)
Definition cvar.c:513
void Cvar_RegisterCallback(cvar_t *variable, void(*callback)(cvar_t *))
Definition cvar.c:495
void Cvar_Callback(cvar_t *var)
Definition cvar.c:372
cvar_t sv_netport
Definition netconn.c:156
void SV_InitOperatorCommands(void)
Definition sv_ccmds.c:1640
Definition cvar.h:66
void(* SV_Shutdown)(void)
Definition host.h:60
struct host_static_t::@12 hook
cvar_t sv_autodemo_perclient_discardable
Definition sv_main.c:213
cvar_t sv_progs
Definition sv_main.c:146
cvar_t saved2
Definition sv_main.c:179
static void SV_AreaStats_f(cmd_state_t *cmd)
Definition sv_main.c:444
static void Host_Timescale_c(cvar_t *var)
Definition sv_main.c:436
cvar_t nehx11
Definition sv_main.c:200
cvar_t sv_cullentities_stats
Definition sv_main.c:83
cvar_t sv_gameplayfix_swiminbmodels
Definition sv_main.c:126
cvar_t sv_waterfriction
Definition sv_main.c:157
cvar_t noexit
Definition sv_main.c:47
cvar_t sv_airaccel_qw
Definition sv_main.c:57
cvar_t sv_gameplayfix_nudgeoutofsolid_separation
Definition sv_main.c:118
cvar_t nehx05
Definition sv_main.c:194
cvar_t sv_rollangle
Definition sv_main.c:176
cvar_t sv_gameplayfix_delayprojectiles
Definition sv_main.c:106
cvar_t sv_gameplayfix_noairborncorpse_allowsuspendeditems
Definition sv_main.c:116
cvar_t sv_gameplayfix_droptofloorstartsolid_nudgetocorrect
Definition sv_main.c:108
cvar_t sv_allowdownloads_archive
Definition sv_main.c:70
cvar_t sv_gameplayfix_consistentplayerprethink
Definition sv_main.c:105
cvar_t nehx12
Definition sv_main.c:201
cvar_t deathmatch
Definition sv_main.c:44
cvar_t sv_maxairstrafespeed
Definition sv_main.c:64
cvar_t nehx00
Definition sv_main.c:189
cvar_t sv_areadebug
Definition sv_main.c:164
cvar_t sv_random_seed
Definition sv_main.c:149
cvar_t scratch3
Definition sv_main.c:185
cvar_t coop
Definition sv_main.c:43
cvar_t nehx08
Definition sv_main.c:197
cvar_t pr_checkextension
Definition sv_main.c:50
cvar_t sv_gameplayfix_easierwaterjump
Definition sv_main.c:109
cvar_t sv_airstopaccelerate
Definition sv_main.c:61
cvar_t sv_cullentities_trace_enlarge
Definition sv_main.c:87
cvar_t sv_maxairspeed
Definition sv_main.c:140
cvar_t saved4
Definition sv_main.c:181
cvar_t nehx16
Definition sv_main.c:205
cvar_t timelimit
Definition sv_main.c:173
cvar_t sv_debugmove
Definition sv_main.c:97
cvar_t gamecfg
Definition sv_main.c:46
cvar_t sv_clmovement_enable
Definition sv_main.c:77
cvar_t sv_areagrid_link_SOLID_NOT
Definition sv_main.c:74
cvar_t sv_gameplayfix_impactbeforeonground
Definition sv_main.c:113
static void SV_ServerOptions(void)
Definition sv_main.c:449
cvar_t sv_gameplayfix_unstickplayers
Definition sv_main.c:130
cvar_t nomonsters
Definition sv_main.c:48
cvar_t sv_sound_land
Definition sv_main.c:151
static void SV_Download_f(cmd_state_t *cmd)
Definition sv_main.c:1209
cvar_t sv_cullentities_pvs
Definition sv_main.c:82
cvar_t sv_gameplayfix_nudgeoutofsolid
Definition sv_main.c:117
cvar_t sv_cullentities_trace_prediction
Definition sv_main.c:90
cvar_t sv_freezenonclients
Definition sv_main.c:102
cvar_t sv_jumpvelocity
Definition sv_main.c:138
cvar_t sv_airspeedlimit_nonqw
Definition sv_main.c:62
cvar_t sv_airaccel_qw_stretchfactor
Definition sv_main.c:58
cvar_t sv_aircontrol
Definition sv_main.c:66
cvar_t sv_aim
Definition sv_main.c:56
cvar_t sv_warsowbunny_turnaccel
Definition sv_main.c:161
cvar_t sv_maxrate
Definition sv_main.c:141
cvar_t halflifebsp
Definition sv_main.c:215
cvar_t sv_gameplayfix_nogravityonground
Definition sv_main.c:120
cvar_t sv_wateraccelerate
Definition sv_main.c:156
cvar_t sv_init_frame_count
Definition sv_main.c:135
cvar_t sv_gameplayfix_findradiusdistancetobox
Definition sv_main.c:110
cvar_t sv_mapformat_is_quake2
Definition sv_main.c:216
cvar_t nehx13
Definition sv_main.c:202
cvar_t sv_jumpstep
Definition sv_main.c:137
mempool_t * sv_mempool
Definition sv_main.c:226
cvar_t sv_sendentities_csqc_randomize_order
Definition sv_main.c:221
cvar_t sv_aircontrol_penalty
Definition sv_main.c:68
cvar_t sv_wallfriction
Definition sv_main.c:155
cvar_t sv_threaded
Definition sv_main.c:170
cvar_t sv_cullentities_trace_expand
Definition sv_main.c:88
cvar_t sv_cullentities_trace_eyejitter
Definition sv_main.c:89
cvar_t sv_allowdownloads_dlcache
Definition sv_main.c:72
cvar_t sv_cullentities_nevercullbmodels
Definition sv_main.c:81
cvar_t sv_legacy_bbox_expand
Definition sv_main.c:139
cvar_t savedgamecfg
Definition sv_main.c:182
cvar_t sv_maxspeed
Definition sv_main.c:142
cvar_t nehx02
Definition sv_main.c:191
cvar_t sv_sound_watersplash
Definition sv_main.c:152
cvar_t sv_worldmessage
Definition sv_main.c:37
cvar_t nehx01
Definition sv_main.c:190
cvar_t sv_gameplayfix_noairborncorpse
Definition sv_main.c:115
cvar_t sv_airstrafeaccelerate
Definition sv_main.c:63
cvar_t sv_nostep
Definition sv_main.c:144
cvar_t sv_gameplayfix_nosquashentities
Definition sv_main.c:133
cvar_t sv_gameplayfix_gravityunaffectedbyticrate
Definition sv_main.c:111
cvar_t sv_autodemo_perclient_nameformat
Definition sv_main.c:212
cvar_t sv_gameplayfix_q2airaccelerate
Definition sv_main.c:119
cvar_t sv_aircontrol_power
Definition sv_main.c:67
cvar_t sv_qcstats
Definition sv_main.c:148
cvar_t sv_warsowbunny_airforwardaccel
Definition sv_main.c:158
cvar_t sv_areagrid_mingridsize
Definition sv_main.c:75
cvar_t sv_gameplayfix_fixedcheckwatertransition
Definition sv_main.c:132
cvar_t sv_idealpitchscale
Definition sv_main.c:136
cvar_t nehx07
Definition sv_main.c:196
cvar_t sv_rollspeed
Definition sv_main.c:175
cvar_t scratch4
Definition sv_main.c:186
cvar_t nehx04
Definition sv_main.c:193
cvar_t nehx19
Definition sv_main.c:208
cvar_t sv_gameplayfix_slidemoveprojectiles
Definition sv_main.c:122
cvar_t temp1
Definition sv_main.c:187
cvar_t pausable
Definition sv_main.c:49
cvar_t nehx17
Definition sv_main.c:206
cvar_t sv_airstrafeaccel_qw
Definition sv_main.c:65
cvar_t sv_edgefriction
Definition sv_main.c:100
cvar_t sv_gameplayfix_upwardvelocityclearsongroundflag
Definition sv_main.c:127
cvar_t sv_stepheight
Definition sv_main.c:153
cvar_t sv_disablenotify
Definition sv_main.c:42
cvar_t host_limitlocal
Definition sv_main.c:150
cvar_t fraglimit
Definition sv_main.c:45
cvar_t sv_writepicture_quality
Definition sv_main.c:219
cvar_t nehx10
Definition sv_main.c:199
cvar_t sv_cullentities_trace_samples
Definition sv_main.c:93
cvar_t sv_worldname
Definition sv_main.c:38
cvar_t sv_gravity
Definition sv_main.c:134
cvar_t nehx18
Definition sv_main.c:207
cvar_t sv_gameplayfix_unstickentities
Definition sv_main.c:131
cvar_t sv_cullentities_trace
Definition sv_main.c:84
cvar_t sv_maxvelocity
Definition sv_main.c:143
cvar_t sv_entpatch
Definition sv_main.c:101
cvar_t sv_dedicated
Definition sv_main.c:98
cvar_t sv_gameplayfix_droptofloorstartsolid
Definition sv_main.c:107
cvar_t sv_clmovement_inputtimeout
Definition sv_main.c:80
cvar_t sv_friction
Definition sv_main.c:103
cvar_t sv_worldnamenoextension
Definition sv_main.c:39
cvar_t sv_cullentities_trace_samples_extra
Definition sv_main.c:94
cvar_t cutscene
Definition sv_main.c:209
cvar_t scratch2
Definition sv_main.c:184
cvar_t samelevel
Definition sv_main.c:51
cvar_t scratch1
Definition sv_main.c:183
cvar_t sv_allowdownloads_config
Definition sv_main.c:71
cvar_t nehx09
Definition sv_main.c:198
static void SV_SaveEntFile_f(cmd_state_t *cmd)
Definition sv_main.c:722
cvar_t sv_checkforpacketsduringsleep
Definition sv_main.c:76
cvar_t nehx06
Definition sv_main.c:195
cvar_t sv_clmovement_minping
Definition sv_main.c:78
cvar_t sv_protocolname
Definition sv_main.c:147
cvar_t sv_allowdownloads_inarchive
Definition sv_main.c:73
cvar_t sv_mapformat_is_quake3
Definition sv_main.c:217
cvar_t nehx14
Definition sv_main.c:203
cvar_t sv_gameplayfix_downtracesupportsongroundflag
Definition sv_main.c:128
void SV_Shutdown(void)
Definition sv_main.c:2128
cvar_t sv_gameplayfix_q1bsptracelinereportstexture
Definition sv_main.c:129
cvar_t sv_stopspeed
Definition sv_main.c:154
cvar_t sv_warsowbunny_accel
Definition sv_main.c:159
cvar_t sv_clmovement_minping_disabletime
Definition sv_main.c:79
cvar_t sv_worldbasename
Definition sv_main.c:40
cvar_t sv_airaccel_sideways_friction
Definition sv_main.c:59
cvar_t sv_cullentities_trace_entityocclusion
Definition sv_main.c:92
cvar_t sv_gameplayfix_nostepmoveonsteepslopes
Definition sv_main.c:125
cvar_t skill
Definition sv_main.c:52
cvar_t sv_airaccelerate
Definition sv_main.c:60
cvar_t nehx03
Definition sv_main.c:192
cvar_t sv_warsowbunny_backtosideratio
Definition sv_main.c:162
cvar_t sv_accelerate
Definition sv_main.c:55
cvar_t sv_gameplayfix_stepmultipletimes
Definition sv_main.c:124
cvar_t sv_autodemo_perclient
Definition sv_main.c:211
cvar_t sv_allowdownloads
Definition sv_main.c:69
cvar_t saved1
Definition sv_main.c:178
static void SV_StartDownload_f(cmd_state_t *cmd)
Definition sv_main.c:1160
cvar_t sv_cullentities_trace_delay
Definition sv_main.c:85
cvar_t sv_playerphysicsqc
Definition sv_main.c:145
cvar_t sv_cullentities_trace_delay_players
Definition sv_main.c:86
cvar_t sv_cullentities_trace_samples_players
Definition sv_main.c:95
cvar_t sv_cullentities_trace_prediction_time
Definition sv_main.c:91
cvar_t sv_cullentities_trace_spectators
Definition sv_main.c:96
cvar_t sv_onlycsqcnetworking
Definition sv_main.c:163
cvar_t sv_warsowbunny_topspeed
Definition sv_main.c:160
cvar_t sv_gameplayfix_blowupfallenzombies
Definition sv_main.c:104
cvar_t teamplay
Definition sv_main.c:172
cvar_t sv_gameplayfix_grenadebouncedownslopes
Definition sv_main.c:112
cvar_t sv_gameplayfix_setmodelrealbox
Definition sv_main.c:121
cvar_t saved3
Definition sv_main.c:180
cvar_t sv_echobprint
Definition sv_main.c:99
cvar_t sv_gameplayfix_stepdown
Definition sv_main.c:123
cvar_t sv_gameplayfix_multiplethinksperframe
Definition sv_main.c:114
cvar_t nehx15
Definition sv_main.c:204
#define Mem_AllocPool(name, flags, parent)
Definition zone.h:104

References CF_CLIENT, CF_SERVER_FROM_CLIENT, CF_SHARED, Cmd_AddCommand(), coop, csqc_progcrc, csqc_progname, csqc_progsize, csqc_usedemoprogs, cutscene, Cvar_Callback(), Cvar_RegisterCallback(), Cvar_RegisterVariable(), Cvar_RegisterVirtual(), deathmatch, fraglimit, gamecfg, halflifebsp, host_static_t::hook, host, host_limitlocal, host_timescale, Host_Timescale_c(), Mem_AllocPool, nehx00, nehx01, nehx02, nehx03, nehx04, nehx05, nehx06, nehx07, nehx08, nehx09, nehx10, nehx11, nehx12, nehx13, nehx14, nehx15, nehx16, nehx17, nehx18, nehx19, noexit, nomonsters, NULL, pausable, pr_checkextension, samelevel, saved1, saved2, saved3, saved4, savedgamecfg, scratch1, scratch2, scratch3, scratch4, skill, sv_accelerate, sv_aim, sv_airaccel_qw, sv_airaccel_qw_stretchfactor, sv_airaccel_sideways_friction, sv_airaccelerate, sv_aircontrol, sv_aircontrol_penalty, sv_aircontrol_power, sv_airspeedlimit_nonqw, sv_airstopaccelerate, sv_airstrafeaccel_qw, sv_airstrafeaccelerate, sv_allowdownloads, sv_allowdownloads_archive, sv_allowdownloads_config, sv_allowdownloads_dlcache, sv_allowdownloads_inarchive, sv_areadebug, sv_areagrid_link_SOLID_NOT, sv_areagrid_mingridsize, SV_AreaStats_f(), sv_autodemo_perclient, sv_autodemo_perclient_discardable, sv_autodemo_perclient_nameformat, sv_checkforpacketsduringsleep, sv_clmovement_enable, sv_clmovement_inputtimeout, sv_clmovement_minping, sv_clmovement_minping_disabletime, sv_cullentities_nevercullbmodels, sv_cullentities_pvs, sv_cullentities_stats, sv_cullentities_trace, sv_cullentities_trace_delay, sv_cullentities_trace_delay_players, sv_cullentities_trace_enlarge, sv_cullentities_trace_entityocclusion, sv_cullentities_trace_expand, sv_cullentities_trace_eyejitter, sv_cullentities_trace_prediction, sv_cullentities_trace_prediction_time, sv_cullentities_trace_samples, sv_cullentities_trace_samples_extra, sv_cullentities_trace_samples_players, sv_cullentities_trace_spectators, sv_debugmove, sv_dedicated, sv_disablenotify, SV_Download_f(), sv_echobprint, sv_edgefriction, sv_entpatch, sv_freezenonclients, sv_friction, sv_gameplayfix_blowupfallenzombies, sv_gameplayfix_consistentplayerprethink, sv_gameplayfix_delayprojectiles, sv_gameplayfix_downtracesupportsongroundflag, sv_gameplayfix_droptofloorstartsolid, sv_gameplayfix_droptofloorstartsolid_nudgetocorrect, sv_gameplayfix_easierwaterjump, sv_gameplayfix_findradiusdistancetobox, sv_gameplayfix_fixedcheckwatertransition, sv_gameplayfix_gravityunaffectedbyticrate, sv_gameplayfix_grenadebouncedownslopes, sv_gameplayfix_impactbeforeonground, sv_gameplayfix_multiplethinksperframe, sv_gameplayfix_noairborncorpse, sv_gameplayfix_noairborncorpse_allowsuspendeditems, sv_gameplayfix_nogravityonground, sv_gameplayfix_nosquashentities, sv_gameplayfix_nostepmoveonsteepslopes, sv_gameplayfix_nudgeoutofsolid, sv_gameplayfix_nudgeoutofsolid_separation, sv_gameplayfix_q1bsptracelinereportstexture, sv_gameplayfix_q2airaccelerate, sv_gameplayfix_setmodelrealbox, sv_gameplayfix_slidemoveprojectiles, sv_gameplayfix_stepdown, sv_gameplayfix_stepmultipletimes, sv_gameplayfix_swiminbmodels, sv_gameplayfix_unstickentities, sv_gameplayfix_unstickplayers, sv_gameplayfix_upwardvelocityclearsongroundflag, sv_gravity, sv_idealpitchscale, sv_init_frame_count, SV_InitOperatorCommands(), sv_jumpstep, sv_jumpvelocity, sv_lagreporting_always, sv_lagreporting_strict, sv_legacy_bbox_expand, sv_mapformat_is_quake2, sv_mapformat_is_quake3, sv_maxairspeed, sv_maxairstrafespeed, sv_maxphysicsframesperserverframe, sv_maxrate, sv_maxspeed, sv_maxvelocity, sv_mempool, sv_netport, sv_nostep, sv_onlycsqcnetworking, sv_playerphysicsqc, sv_progs, sv_protocolname, sv_qcstats, sv_random_seed, sv_rollangle, sv_rollspeed, SV_SaveEntFile_f(), sv_sendentities_csqc_randomize_order, SV_ServerOptions(), host_static_t::SV_Shutdown, SV_Shutdown(), sv_sound_land, sv_sound_watersplash, SV_StartDownload_f(), sv_stepheight, sv_stopspeed, sv_threaded, sv_wallfriction, sv_warsowbunny_accel, sv_warsowbunny_airforwardaccel, sv_warsowbunny_backtosideratio, sv_warsowbunny_topspeed, sv_warsowbunny_turnaccel, sv_wateraccelerate, sv_waterfriction, sv_worldbasename, sv_worldmessage, sv_worldname, sv_worldnamenoextension, sv_writepicture_quality, sys_ticrate, teamplay, temp1, and timelimit.

Referenced by Host_Init().

◆ SV_InitOperatorCommands()

void SV_InitOperatorCommands ( void )

Definition at line 1640 of file sv_ccmds.c.

1641{
1648
1649 Cmd_AddCommand(CF_SERVER | CF_SERVER_FROM_CLIENT, "status", SV_Status_f, "print server status information");
1650 Cmd_AddCommand(CF_SHARED, "map", SV_Map_f, "kick everyone off the server and start a new level");
1651 Cmd_AddCommand(CF_SHARED, "restart", SV_Restart_f, "restart current level");
1652 Cmd_AddCommand(CF_SHARED, "changelevel", SV_Changelevel_f, "change to another level, bringing along all connected clients (or start a new level if none is loaded)");
1653 Cmd_AddCommand(CF_SHARED | CF_SERVER_FROM_CLIENT, "say", SV_Say_f, "send a chat message to everyone on the server");
1654 Cmd_AddCommand(CF_SERVER_FROM_CLIENT, "say_team", SV_Say_Team_f, "send a chat message to your team on the server");
1655 Cmd_AddCommand(CF_SHARED | CF_SERVER_FROM_CLIENT, "tell", SV_Tell_f, "send a chat message to only one person on the server");
1656 Cmd_AddCommand(CF_SERVER | CF_SERVER_FROM_CLIENT, "pause", SV_Pause_f, "pause the game (if the server allows pausing)");
1657 Cmd_AddCommand(CF_SHARED, "kick", SV_Kick_f, "kick a player off the server by number or name");
1658 Cmd_AddCommand(CF_SHARED | CF_SERVER_FROM_CLIENT, "ping", SV_Ping_f, "print ping times of all players on the server");
1659 Cmd_AddCommand(CF_SERVER, "load", SV_Loadgame_f, "load a saved game file");
1660 Cmd_AddCommand(CF_SERVER, "save", SV_Savegame_f, "save the game to a file");
1661 Cmd_AddCommand(CF_SHARED, "viewmodel", SV_Viewmodel_f, "change model of viewthing entity in current level");
1662 Cmd_AddCommand(CF_SHARED, "viewframe", SV_Viewframe_f, "change animation frame of viewthing entity in current level");
1663 Cmd_AddCommand(CF_SHARED, "viewnext", SV_Viewnext_f, "change to next animation frame of viewthing entity in current level");
1664 Cmd_AddCommand(CF_SHARED, "viewprev", SV_Viewprev_f, "change to previous animation frame of viewthing entity in current level");
1665 Cmd_AddCommand(CF_SHARED, "maxplayers", SV_MaxPlayers_f, "sets limit on how many players (or bots) may be connected to the server at once");
1667
1668 // commands that do not have automatic forwarding from cmd_local, these are internal details of the network protocol and not of interest to users (if they know what they are doing they can still use a generic "cmd prespawn" or similar)
1669 Cmd_AddCommand(CF_SERVER_FROM_CLIENT, "prespawn", SV_PreSpawn_f, "internal use - signon 1 (client acknowledges that server information has been received)");
1670 Cmd_AddCommand(CF_SERVER_FROM_CLIENT, "spawn", SV_Spawn_f, "internal use - signon 2 (client has sent player information, and is asking server to send scoreboard rankings)");
1671 Cmd_AddCommand(CF_SERVER_FROM_CLIENT, "begin", SV_Begin_f, "internal use - signon 3 (client asks server to start sending entities, and will go to signon 4 (playing) when the first entity update is received)");
1672 Cmd_AddCommand(CF_SERVER_FROM_CLIENT, "pings", SV_Pings_f, "internal use - command sent by clients to request updated ping and packetloss of players on scoreboard (originally from QW, but also used on NQ servers)");
1673
1674 Cmd_AddCommand(CF_CHEAT | CF_SERVER_FROM_CLIENT, "god", SV_God_f, "god mode (invulnerability)");
1675 Cmd_AddCommand(CF_CHEAT | CF_SERVER_FROM_CLIENT, "notarget", SV_Notarget_f, "notarget mode (monsters do not see you)");
1676 Cmd_AddCommand(CF_CHEAT | CF_SERVER_FROM_CLIENT, "fly", SV_Fly_f, "fly mode (flight)");
1677 Cmd_AddCommand(CF_CHEAT | CF_SERVER_FROM_CLIENT, "noclip", SV_Noclip_f, "noclip mode (flight without collisions, move through walls)");
1678 Cmd_AddCommand(CF_CHEAT | CF_SERVER_FROM_CLIENT, "give", SV_Give_f, "alter inventory");
1679 Cmd_AddCommand(CF_SERVER_FROM_CLIENT, "kill", SV_Kill_f, "die instantly");
1680
1681 Cmd_AddCommand(CF_USERINFO, "color", SV_Color_f, "change your player shirt and pants colors");
1682 Cmd_AddCommand(CF_USERINFO, "name", SV_Name_f, "change your player name");
1683 Cmd_AddCommand(CF_USERINFO, "rate", SV_Rate_f, "change your network connection speed");
1684 Cmd_AddCommand(CF_USERINFO, "rate_burstsize", SV_Rate_BurstSize_f, "change your network connection speed");
1685 Cmd_AddCommand(CF_USERINFO, "pmodel", SV_PModel_f, "(Nehahra-only) change your player model choice");
1686 Cmd_AddCommand(CF_USERINFO, "playermodel", SV_Playermodel_f, "change your player model");
1687 Cmd_AddCommand(CF_USERINFO, "playerskin", SV_Playerskin_f, "change your player skin number");
1688
1689 Cmd_AddCommand(CF_CHEAT | CF_SERVER_FROM_CLIENT, "ent_create", SV_Ent_Create_f, "Creates an entity at the specified coordinate, of the specified classname. If executed from a server, origin has to be specified manually.");
1690 Cmd_AddCommand(CF_CHEAT | CF_SERVER_FROM_CLIENT, "ent_remove_all", SV_Ent_Remove_All_f, "Removes all entities of the specified classname");
1691 Cmd_AddCommand(CF_CHEAT | CF_SERVER_FROM_CLIENT, "ent_remove", SV_Ent_Remove_f, "Removes an entity by number, or the entity you're aiming at");
1692}
#define CF_USERINFO
command or cvar used to communicate userinfo to the server
Definition cmd.h:57
#define CF_SERVER
cvar/command that only the server can change/execute
Definition cmd.h:49
#define CF_CHEAT
command or cvar that gives an unfair advantage over other players and is blocked unless sv_cheats is ...
Definition cmd.h:52
void SV_Begin_f(cmd_state_t *cmd)
Definition sv_user.c:204
void SV_Spawn_f(cmd_state_t *cmd)
Definition sv_user.c:62
void SV_Loadgame_f(cmd_state_t *cmd)
Definition sv_save.c:240
void SV_Savegame_f(cmd_state_t *cmd)
Definition sv_save.c:188
void SV_PreSpawn_f(cmd_state_t *cmd)
Definition sv_user.c:36
void(* SV_SendCvar)(struct cmd_state_s *)
Definition host.h:59
static void SV_Viewframe_f(cmd_state_t *cmd)
Definition sv_ccmds.c:1331
static void SV_SendCvar_f(cmd_state_t *cmd)
Definition sv_ccmds.c:1416
static void SV_Notarget_f(cmd_state_t *cmd)
Definition sv_ccmds.c:399
cvar_t sv_status_show_qcstatus
Definition sv_ccmds.c:31
static void SV_Ping_f(cmd_state_t *cmd)
Definition sv_ccmds.c:656
static void SV_Viewmodel_f(cmd_state_t *cmd)
Definition sv_ccmds.c:1303
cvar_t sv_namechangetimer
Definition sv_ccmds.c:32
static void SV_Map_f(cmd_state_t *cmd)
Definition sv_ccmds.c:51
static void SV_Color_f(cmd_state_t *cmd)
Definition sv_ccmds.c:1013
static void SV_Ent_Remove_f(cmd_state_t *cmd)
Definition sv_ccmds.c:1538
static void SV_PModel_f(cmd_state_t *cmd)
Definition sv_ccmds.c:1265
static void SV_Say_Team_f(cmd_state_t *cmd)
Definition sv_ccmds.c:525
static void SV_Status_f(cmd_state_t *cmd)
Definition sv_ccmds.c:743
static void SV_Changelevel_f(cmd_state_t *cmd)
Definition sv_ccmds.c:93
static void SV_Pings_f(cmd_state_t *cmd)
Definition sv_ccmds.c:686
static void SV_Playerskin_f(cmd_state_t *cmd)
Definition sv_ccmds.c:1214
static void SV_Kill_f(cmd_state_t *cmd)
Definition sv_ccmds.c:415
static void SV_Restart_f(cmd_state_t *cmd)
Definition sv_ccmds.c:124
static void SV_Give_f(cmd_state_t *cmd)
Definition sv_ccmds.c:215
static void SV_Ent_Remove_All_f(cmd_state_t *cmd)
Definition sv_ccmds.c:1612
static void SV_Rate_BurstSize_f(cmd_state_t *cmd)
Definition sv_ccmds.c:1001
static void SV_Viewnext_f(cmd_state_t *cmd)
Definition sv_ccmds.c:1367
static void SV_Noclip_f(cmd_state_t *cmd)
Definition sv_ccmds.c:192
static void SV_Viewprev_f(cmd_state_t *cmd)
Definition sv_ccmds.c:1394
static void SV_Playermodel_f(cmd_state_t *cmd)
Definition sv_ccmds.c:1167
static void SV_Kick_f(cmd_state_t *cmd)
Definition sv_ccmds.c:1061
static void SV_DisableCheats_c(cvar_t *var)
Definition sv_ccmds.c:149
static void SV_Rate_f(cmd_state_t *cmd)
Definition sv_ccmds.c:989
cvar_t sv_status_privacy
Definition sv_ccmds.c:30
static void SV_Name_f(cmd_state_t *cmd)
Definition sv_ccmds.c:890
static void SV_Pause_f(cmd_state_t *cmd)
Definition sv_ccmds.c:434
cvar_t sv_cheats
Definition sv_ccmds.c:28
static void SV_God_f(cmd_state_t *cmd)
Definition sv_ccmds.c:179
static void SV_MaxPlayers_f(cmd_state_t *cmd)
Definition sv_ccmds.c:1134
static void SV_Say_f(cmd_state_t *cmd)
Definition sv_ccmds.c:520
cvar_t sv_adminnick
Definition sv_ccmds.c:29
static void SV_Fly_f(cmd_state_t *cmd)
Definition sv_ccmds.c:383
static void SV_Ent_Create_f(cmd_state_t *cmd)
Definition sv_ccmds.c:1444
static void SV_Tell_f(cmd_state_t *cmd)
Definition sv_ccmds.c:530

References CF_CHEAT, CF_SERVER, CF_SERVER_FROM_CLIENT, CF_SHARED, CF_USERINFO, Cmd_AddCommand(), Cvar_RegisterCallback(), Cvar_RegisterVariable(), host_static_t::hook, host, sv_adminnick, SV_Begin_f(), SV_Changelevel_f(), sv_cheats, SV_Color_f(), SV_DisableCheats_c(), SV_Ent_Create_f(), SV_Ent_Remove_All_f(), SV_Ent_Remove_f(), SV_Fly_f(), SV_Give_f(), SV_God_f(), SV_Kick_f(), SV_Kill_f(), SV_Loadgame_f(), SV_Map_f(), SV_MaxPlayers_f(), SV_Name_f(), sv_namechangetimer, SV_Noclip_f(), SV_Notarget_f(), SV_Pause_f(), SV_Ping_f(), SV_Pings_f(), SV_Playermodel_f(), SV_Playerskin_f(), SV_PModel_f(), SV_PreSpawn_f(), SV_Rate_BurstSize_f(), SV_Rate_f(), SV_Restart_f(), SV_Savegame_f(), SV_Say_f(), SV_Say_Team_f(), host_static_t::SV_SendCvar, SV_SendCvar_f(), SV_Spawn_f(), SV_Status_f(), sv_status_privacy, sv_status_show_qcstatus, SV_Tell_f(), SV_Viewframe_f(), SV_Viewmodel_f(), SV_Viewnext_f(), and SV_Viewprev_f().

Referenced by SV_Init().

◆ SV_IsLocalServer()

int SV_IsLocalServer ( void )

Definition at line 1783 of file sv_main.c.

1784{
1785 return (host_isclient.integer && sv.active ? svs.maxclients : 0);
1786}

References server_t::active, host_isclient, cvar_t::integer, server_static_t::maxclients, sv, and svs.

Referenced by SV_Savegame_f().

◆ SV_LinkEdict()

void SV_LinkEdict ( prvm_edict_t * ent)

Needs to be called any time an entity changes origin, mins, maxs, or solid sets ent->v.absmin and ent->v.absmax call TouchAreaGrid as well to fire triggers that overlap the box

Definition at line 804 of file sv_phys.c.

805{
806 prvm_prog_t *prog = SVVM_prog;
807 model_t *model;
808 vec3_t mins, maxs, entmins, entmaxs, entangles;
809 int modelindex;
810
811 if (ent == prog->edicts)
812 return; // don't add the world
813
814 if (ent->free)
815 return;
816
819 {
820 Con_Printf("edict %i: SOLID_BSP with invalid modelindex!\n", PRVM_NUM_FOR_EDICT(ent));
821 modelindex = 0;
822 }
824
825 VM_GenerateFrameGroupBlend(prog, ent->priv.server->framegroupblend, ent);
826 VM_FrameBlendFromFrameGroupBlend(ent->priv.server->frameblend, ent->priv.server->framegroupblend, model, sv.time);
827 VM_UpdateEdictSkeleton(prog, ent, model, ent->priv.server->frameblend);
828
829// set the abs box
830
832 {
833 // TODO maybe should do this for rotating SOLID_BSP too? Would behave better with rotating doors
834 // TODO special handling for spheres?
835 VectorCopy(PRVM_serveredictvector(ent, mins), entmins);
836 VectorCopy(PRVM_serveredictvector(ent, maxs), entmaxs);
837 VectorCopy(PRVM_serveredictvector(ent, angles), entangles);
838 RotateBBox(entmins, entmaxs, entangles, mins, maxs);
841 }
842 else if (PRVM_serveredictfloat(ent, solid) == SOLID_BSP)
843 {
844 if (model != NULL)
845 {
846 if (!model->TraceBox)
847 Con_DPrintf("edict %i: SOLID_BSP with non-collidable model\n", PRVM_NUM_FOR_EDICT(ent));
848
850 {
851 VectorAdd(PRVM_serveredictvector(ent, origin), model->rotatedmins, mins);
852 VectorAdd(PRVM_serveredictvector(ent, origin), model->rotatedmaxs, maxs);
853 }
855 {
858 }
859 else
860 {
861 VectorAdd(PRVM_serveredictvector(ent, origin), model->normalmins, mins);
862 VectorAdd(PRVM_serveredictvector(ent, origin), model->normalmaxs, maxs);
863 }
864 }
865 else
866 {
867 // SOLID_BSP with no model is valid, mainly because some QC setup code does so temporarily
870 }
871 }
872 else
873 {
876 }
877
879 {
880 if ((int)PRVM_serveredictfloat(ent, flags) & FL_ITEM)
881 {
882 // to make items easier to pick up and allow them to be grabbed off
883 // of shelves, the abs sizes are expanded
884 mins[0] -= 15;
885 mins[1] -= 15;
886 mins[2] -= 1;
887 maxs[0] += 15;
888 maxs[1] += 15;
889 maxs[2] += 1;
890 }
891 else
892 {
893 // because movement is clipped an epsilon away from an actual edge,
894 // we must fully check even when bounding boxes don't quite touch
895 mins[0] -= 1;
896 mins[1] -= 1;
897 mins[2] -= 1;
898 maxs[0] += 1;
899 maxs[1] += 1;
900 maxs[2] += 1;
901 }
902 }
903
906
908}
float movetype
vector avelocity
void VM_UpdateEdictSkeleton(prvm_prog_t *prog, prvm_edict_t *ed, const struct model_s *edmodel, const struct frameblend_s *frameblend)
void VM_GenerateFrameGroupBlend(prvm_prog_t *prog, struct framegroupblend_s *framegroupblend, const prvm_edict_t *ed)
void VM_FrameBlendFromFrameGroupBlend(struct frameblend_s *frameblend, const struct framegroupblend_s *framegroupblend, const struct model_s *model, double curtime)
#define MOVETYPE_PHYSICS
indicates this object is physics controlled
Definition server.h:326
cvar_t sv_areagrid_link_SOLID_NOT
Definition sv_main.c:74
model_t * SV_GetModelByIndex(int modelindex)
Definition sv_main.c:1607
cvar_t sv_legacy_bbox_expand
Definition sv_main.c:139
#define FL_ITEM
Definition server.h:365
union prvm_edict_t::@29 priv
struct edict_engineprivate_s * server
FIXME: this server pointer really means world, not server (it is used by both server qc and client qc...
Definition progsvm.h:106
prvm_edict_t * edicts
Definition progsvm.h:680
static void RotateBBox(const vec3_t mins, const vec3_t maxs, const vec3_t angles, vec3_t rotatedmins, vec3_t rotatedmaxs)
Definition sv_phys.c:767
void World_LinkEdict(world_t *world, prvm_edict_t *ent, const vec3_t mins, const vec3_t maxs, qbool link_solid_not)
Definition world.c:320

References absmax, absmin, angles, avelocity, Con_DPrintf(), Con_Printf(), prvm_prog_t::edicts, FL_ITEM, flags, prvm_edict_t::free, int(), cvar_t::integer, MAX_MODELS, maxs, mins, model, modelindex, movetype, MOVETYPE_PHYSICS, NULL, origin, prvm_edict_t::priv, PRVM_NUM_FOR_EDICT, PRVM_serveredictfloat, PRVM_serveredictvector, RotateBBox(), prvm_edict_t::server, solid, SOLID_BSP, sv, sv_areagrid_link_SOLID_NOT, SV_GetModelByIndex(), sv_legacy_bbox_expand, SVVM_prog, server_t::time, VectorAdd, VectorCopy, VM_FrameBlendFromFrameGroupBlend(), VM_GenerateFrameGroupBlend(), VM_UpdateEdictSkeleton(), server_t::world, and World_LinkEdict().

Referenced by PRVM_ED_LoadFromFile(), SetMinMaxSize(), SV_Ent_Create_f(), SV_Loadgame_f(), SV_movestep(), SV_Physics_ClientEntity(), SV_Physics_Entity(), SV_Physics_Follow(), SV_Physics_Step(), SV_PushEntity(), SV_PushMove(), SV_StepDirection(), SV_WalkMove(), SVVM_end_increase_edicts(), VM_nudgeoutofsolid(), VM_SV_copyentity(), VM_SV_droptofloor(), and VM_SV_setorigin().

◆ SV_LinkEdict_TouchAreaGrid()

void SV_LinkEdict_TouchAreaGrid ( prvm_edict_t * ent)

Definition at line 727 of file sv_phys.c.

728{
729 prvm_prog_t *prog = SVVM_prog;
730 int i, numtouchedicts, old_self, old_other;
731 prvm_edict_t *touch;
732 static prvm_edict_t *touchedicts[MAX_EDICTS];
733
734 if (ent == prog->edicts)
735 return; // don't add the world
736
737 if (ent->free)
738 return;
739
741 return;
742
743 // build a list of edicts to touch, because the link loop can be corrupted
744 // by IncreaseEdicts called during touch functions
745 numtouchedicts = SV_EntitiesInBox(ent->priv.server->areamins, ent->priv.server->areamaxs, MAX_EDICTS, touchedicts);
746 if (numtouchedicts > MAX_EDICTS)
747 {
748 // this never happens
749 Con_Printf("SV_EntitiesInBox returned %i edicts, max was %i\n", numtouchedicts, MAX_EDICTS);
750 numtouchedicts = MAX_EDICTS;
751 }
752
753 old_self = PRVM_serverglobaledict(self);
754 old_other = PRVM_serverglobaledict(other);
755 for (i = 0;i < numtouchedicts;i++)
756 {
757 touch = touchedicts[i];
758 if (touch != ent && (int)PRVM_serveredictfloat(touch, solid) == SOLID_TRIGGER && PRVM_serveredictfunction(touch, touch))
759 {
761 }
762 }
763 PRVM_serverglobaledict(self) = old_self;
764 PRVM_serverglobaledict(other) = old_other;
765}
entity other
#define PRVM_serveredictfunction(ed, fieldname)
Definition progsvm.h:176
#define SOLID_NOT
no interaction with other objects
Definition server.h:332
void SV_LinkEdict_TouchAreaGrid_Call(prvm_edict_t *touch, prvm_edict_t *ent)
Definition sv_phys.c:705
int SV_EntitiesInBox(const vec3_t mins, const vec3_t maxs, int maxedicts, prvm_edict_t **resultedicts)
Definition sv_phys.c:673

References Con_Printf(), prvm_prog_t::edicts, prvm_edict_t::free, i, MAX_EDICTS, other, prvm_edict_t::priv, PRVM_serveredictfloat, PRVM_serveredictfunction, PRVM_serverglobaledict, self, prvm_edict_t::server, solid, SOLID_NOT, SOLID_TRIGGER, SV_EntitiesInBox(), SV_LinkEdict_TouchAreaGrid_Call(), and SVVM_prog.

Referenced by SV_movestep(), SV_Physics(), SV_Physics_ClientEntity(), SV_Physics_Entity(), SV_Physics_Step(), SV_PushEntity(), SV_PushMove(), SV_StepDirection(), and SV_WalkMove().

◆ SV_LinkEdict_TouchAreaGrid_Call()

void SV_LinkEdict_TouchAreaGrid_Call ( prvm_edict_t * touch,
prvm_edict_t * ent )

Definition at line 705 of file sv_phys.c.

706{
707 prvm_prog_t *prog = SVVM_prog;
724 prog->ExecuteProgram(prog, PRVM_serveredictfunction(touch, touch), "QC function self.touch is missing");
725}
float trace_dphitcontents
entity trace_ent
float trace_dpstartcontents
string trace_dphittexturename
vector trace_endpos
float trace_startsolid
float trace_inopen
float trace_dphitq3surfaceflags
float trace_fraction
float trace_allsolid
vector trace_plane_normal
float trace_plane_dist
float trace_inwater
#define PRVM_serverglobalstring(fieldname)
Definition progsvm.h:179
#define PRVM_serverglobalvector(fieldname)
Definition progsvm.h:178

References prvm_prog_t::ExecuteProgram, origin, other, PRVM_EDICT_TO_PROG, PRVM_serveredictfunction, PRVM_serveredictvector, PRVM_serverglobaledict, PRVM_serverglobalfloat, PRVM_serverglobalstring, PRVM_serverglobalvector, self, sv, SVVM_prog, server_t::time, time, trace_allsolid, trace_dphitcontents, trace_dphitq3surfaceflags, trace_dphittexturename, trace_dpstartcontents, trace_endpos, trace_ent, trace_fraction, trace_inopen, trace_inwater, trace_plane_dist, trace_plane_normal, trace_startsolid, VectorCopy, and VectorSet.

Referenced by SV_LinkEdict_TouchAreaGrid().

◆ SV_Loadgame_f()

void SV_Loadgame_f ( cmd_state_t * cmd)

Definition at line 240 of file sv_save.c.

241{
242 prvm_prog_t *prog = SVVM_prog;
243 char filename[MAX_QPATH];
244 char mapname[MAX_QPATH];
245 float time;
246 const char *start;
247 const char *end;
248 const char *t;
249 char *text;
250 prvm_edict_t *ent;
251 int i, k, numbuffers;
252 int entnum;
253 int version;
254 float spawn_parms[NUM_SPAWN_PARMS];
255 prvm_stringbuffer_t *stringbuffer;
256
257 if (Cmd_Argc(cmd) != 2)
258 {
259 Con_Print("load <savename> : load a game\n");
260 return;
261 }
262
263 dp_strlcpy (filename, Cmd_Argv(cmd, 1), sizeof(filename));
264 FS_DefaultExtension (filename, ".sav", sizeof (filename));
265
266 Con_Printf("Loading game from %s...\n", filename);
267
269 host.hook.Disconnect(false, NULL);
270
273
274 cls.demonum = -1; // stop demo loop in case this fails
275
276 t = text = (char *)FS_LoadFile (filename, tempmempool, false, NULL);
277 if (!text)
278 {
279 Con_Print(CON_ERROR "ERROR: couldn't open.\n");
280 return;
281 }
282
284 Con_Printf("SV_Loadgame_f: loading version\n");
285
286 // version
287 COM_ParseToken_Simple(&t, false, false, true);
288 version = atoi(com_token);
290 {
291 Mem_Free(text);
292 Con_Printf(CON_ERROR "Savegame is version %i, not %i\n", version, SAVEGAME_VERSION);
293 return;
294 }
295
297 Con_Printf("SV_Loadgame_f: loading description\n");
298
299 // description
300 COM_ParseToken_Simple(&t, false, false, true);
301
302 for (i = 0;i < NUM_SPAWN_PARMS;i++)
303 {
304 COM_ParseToken_Simple(&t, false, false, true);
305 spawn_parms[i] = atof(com_token);
306 }
307 // skill
308 COM_ParseToken_Simple(&t, false, false, true);
309// this silliness is so we can load 1.06 save files, which have float skill values
310 current_skill = (int)(atof(com_token) + 0.5);
312
314 Con_Printf("SV_Loadgame_f: loading mapname\n");
315
316 // mapname
317 COM_ParseToken_Simple(&t, false, false, true);
319
321 Con_Printf("SV_Loadgame_f: loading time\n");
322
323 // time
324 COM_ParseToken_Simple(&t, false, false, true);
325 time = atof(com_token);
326
328 Con_Printf("SV_Loadgame_f: spawning server\n");
329
331 if (!sv.active)
332 {
333 Mem_Free(text);
334 Con_Printf(CON_ERROR "Couldn't load map \"%s\"\n", mapname);
335 return;
336 }
337 sv.paused = true; // pause until all clients connect
338 sv.loadgame = true;
339
341 Con_Printf("SV_Loadgame_f: loading light styles\n");
342
343// load the light styles
344
345 // -1 is the globals
346 entnum = -1;
347
348 for (i = 0;i < MAX_LIGHTSTYLES;i++)
349 {
350 // light style
351 start = t;
352 COM_ParseToken_Simple(&t, false, false, true);
353 // if this is a 64 lightstyle savegame produced by Quake, stop now
354 // we have to check this because darkplaces may save more than 64
355 if (com_token[0] == '{')
356 {
357 t = start;
358 break;
359 }
361 }
362
364 Con_Printf("SV_Loadgame_f: skipping until globals\n");
365
366 // now skip everything before the first opening brace
367 // (this is for forward compatibility, so that older versions (at
368 // least ones with this fix) can load savegames with extra data before the
369 // first brace, as might be produced by a later engine version)
370 for (;;)
371 {
372 start = t;
373 if (!COM_ParseToken_Simple(&t, false, false, true))
374 break;
375 if (com_token[0] == '{')
376 {
377 t = start;
378 break;
379 }
380 }
381
382 // unlink all entities
384
385// load the edicts out of the savegame file
386 end = t;
387 for (;;)
388 {
389 start = t;
390 while (COM_ParseToken_Simple(&t, false, false, true))
391 if (!strcmp(com_token, "}"))
392 break;
393 if (!COM_ParseToken_Simple(&start, false, false, true))
394 {
395 // end of file
396 break;
397 }
398 if (strcmp(com_token,"{"))
399 {
400 Mem_Free(text);
401 Host_Error ("%s: first token isn't a brace", __func__);
402 }
403
404 if (entnum == -1)
405 {
407 Con_Printf("SV_Loadgame_f: loading globals\n");
408
409 // parse the global vars
410 PRVM_ED_ParseGlobals (prog, start);
411
412 // restore the autocvar globals
414 }
415 else
416 {
417 // parse an edict
418 if (entnum >= MAX_EDICTS)
419 {
420 Mem_Free(text);
421 Host_Error("%s: too many edicts in save file (reached MAX_EDICTS %i)", __func__, MAX_EDICTS);
422 }
423 while (entnum >= prog->max_edicts)
425 ent = PRVM_EDICT_NUM(entnum);
426 memset(ent->fields.fp, 0, prog->entityfields * sizeof(prvm_vec_t));
427 ent->free = false;
428
430 Con_Printf("SV_Loadgame_f: loading edict %d\n", entnum);
431
432 PRVM_ED_ParseEdict (prog, start, ent, true);
433
434 // link it into the bsp tree
435 if (!ent->free)
436 SV_LinkEdict(ent);
437 }
438
439 end = t;
440 entnum++;
441 }
442
443 prog->num_edicts = entnum;
444 sv.time = time;
445
446 for (i = 0;i < NUM_SPAWN_PARMS;i++)
447 svs.clients[0].spawn_parms[i] = spawn_parms[i];
448
450 Con_Printf("SV_Loadgame_f: skipping until extended data\n");
451
452 // read extended data if present
453 // the extended data is stored inside a /* */ comment block, which the
454 // parser intentionally skips, so we have to check for it manually here
455 if(end)
456 {
457 while (*end == '\r' || *end == '\n')
458 end++;
459 if (end[0] == '/' && end[1] == '*' && (end[2] == '\r' || end[2] == '\n'))
460 {
462 Con_Printf("SV_Loadgame_f: loading extended data\n");
463
464 Con_Printf("Loading extended DarkPlaces savegame\n");
465 t = end + 2;
466 memset(sv.lightstyles[0], 0, sizeof(sv.lightstyles));
467 memset(sv.model_precache[0], 0, sizeof(sv.model_precache));
468 memset(sv.sound_precache[0], 0, sizeof(sv.sound_precache));
469 BufStr_Flush(prog);
470
471 while (COM_ParseToken_Simple(&t, false, false, true))
472 {
473 if (!strcmp(com_token, "sv.lightstyles"))
474 {
475 COM_ParseToken_Simple(&t, false, false, true);
476 i = atoi(com_token);
477 COM_ParseToken_Simple(&t, false, false, true);
478 if (i >= 0 && i < MAX_LIGHTSTYLES)
480 else
481 Con_Printf(CON_WARN "unsupported lightstyle %i \"%s\"\n", i, com_token);
482 }
483 else if (!strcmp(com_token, "sv.model_precache"))
484 {
485 COM_ParseToken_Simple(&t, false, false, true);
486 i = atoi(com_token);
487 COM_ParseToken_Simple(&t, false, false, true);
488 if (i >= 0 && i < MAX_MODELS)
489 {
491 sv.models[i] = Mod_ForName (sv.model_precache[i], true, false, sv.model_precache[i][0] == '*' ? sv.worldname : NULL);
492 }
493 else
494 Con_Printf(CON_WARN "unsupported model %i \"%s\"\n", i, com_token);
495 }
496 else if (!strcmp(com_token, "sv.sound_precache"))
497 {
498 COM_ParseToken_Simple(&t, false, false, true);
499 i = atoi(com_token);
500 COM_ParseToken_Simple(&t, false, false, true);
501 if (i >= 0 && i < MAX_SOUNDS)
503 else
504 Con_Printf(CON_WARN "unsupported sound %i \"%s\"\n", i, com_token);
505 }
506 else if (!strcmp(com_token, "sv.buffer"))
507 {
508 if (COM_ParseToken_Simple(&t, false, false, true))
509 {
510 i = atoi(com_token);
511 if (i >= 0)
512 {
514 if (COM_ParseToken_Simple(&t, false, false, true))
515 k |= atoi(com_token);
516 if (!BufStr_FindCreateReplace(prog, i, k, "string"))
517 Con_Printf(CON_ERROR "failed to create stringbuffer %i\n", i);
518 }
519 else
520 Con_Printf(CON_WARN "unsupported stringbuffer index %i \"%s\"\n", i, com_token);
521 }
522 else
523 Con_Printf(CON_WARN "unexpected end of line when parsing sv.buffer (expected buffer index)\n");
524 }
525 else if (!strcmp(com_token, "sv.bufstr"))
526 {
527 if (!COM_ParseToken_Simple(&t, false, false, true))
528 Con_Printf(CON_WARN "unexpected end of line when parsing sv.bufstr\n");
529 else
530 {
531 i = atoi(com_token);
532 stringbuffer = BufStr_FindCreateReplace(prog, i, STRINGBUFFER_SAVED, "string");
533 if (stringbuffer)
534 {
535 if (COM_ParseToken_Simple(&t, false, false, true))
536 {
537 k = atoi(com_token);
538 if (COM_ParseToken_Simple(&t, false, false, true))
539 BufStr_Set(prog, stringbuffer, k, com_token);
540 else
541 Con_Printf(CON_WARN "unexpected end of line when parsing sv.bufstr (expected string)\n");
542 }
543 else
544 Con_Printf(CON_WARN "unexpected end of line when parsing sv.bufstr (expected strindex)\n");
545 }
546 else
547 Con_Printf(CON_ERROR "failed to create stringbuffer %i \"%s\"\n", i, com_token);
548 }
549 }
550 // skip any trailing text or unrecognized commands
551 while (COM_ParseToken_Simple(&t, true, false, true) && strcmp(com_token, "\n"))
552 ;
553 }
554 }
555 }
556 Mem_Free(text);
557
558 // remove all temporary flagged string buffers (ones created with BufStr_FindCreateReplace)
560 for (i = 0; i < numbuffers; i++)
561 {
563 if (stringbuffer->flags & STRINGBUFFER_TEMP)
564 BufStr_Del(prog, stringbuffer);
565 }
566
568 Con_Printf("SV_Loadgame_f: finished\n");
569
570 // make sure we're connected to loopback
573}
static int Cmd_Argc(cmd_state_t *cmd)
Definition cmd.h:249
static const char * Cmd_Argv(cmd_state_t *cmd, int arg)
Cmd_Argv(cmd, ) will return an empty string (not a NULL) if arg > argc, so string operations are alwa...
Definition cmd.h:254
char com_token[MAX_INPUTLINE]
Definition common.c:39
qbool COM_ParseToken_Simple(const char **datapointer, qbool returnnewline, qbool parsebackslash, qbool parsecomments)
Definition common.c:463
#define CON_ERROR
Definition console.h:102
string mapname
float entnum
void Cvar_SetValueQuick(cvar_t *var, float value)
Definition cvar.c:473
void Cvar_UpdateAllAutoCvars(cvar_state_t *cvars)
called after loading a savegame
Definition cvar.c:365
void FS_DefaultExtension(char *path, const char *extension, size_t size_path)
Definition fs.c:3641
unsigned char * FS_LoadFile(const char *path, mempool_t *pool, qbool quiet, fs_offset_t *filesizepointer)
Definition fs.c:3540
static int const char * version
Definition fs.c:479
void Host_Error(const char *error,...)
Definition host.c:85
cvar_t developer_entityparsing
Definition host.c:53
void cmd(string command,...)
model_t * Mod_ForName(const char *name, qbool crash, qbool checkdisk, const char *parentname)
#define STRINGBUFFER_SAVED
Definition progsvm.h:496
#define STRINGBUFFER_TEMP
Definition progsvm.h:498
const char * PRVM_ED_ParseEdict(prvm_prog_t *prog, const char *data, prvm_edict_t *ent, qbool saveload)
void PRVM_ED_ParseGlobals(prvm_prog_t *prog, const char *data)
Definition prvm_edict.c:940
void PRVM_MEM_IncreaseEdicts(prvm_prog_t *prog)
Definition prvm_edict.c:105
void BufStr_Set(prvm_prog_t *prog, prvm_stringbuffer_t *stringbuffer, int strindex, const char *str)
Definition prvm_cmds.c:3902
void BufStr_Flush(prvm_prog_t *prog)
Definition prvm_cmds.c:3943
void BufStr_Del(prvm_prog_t *prog, prvm_stringbuffer_t *stringbuffer)
Definition prvm_cmds.c:3926
prvm_stringbuffer_t * BufStr_FindCreateReplace(prvm_prog_t *prog, int bufindex, unsigned flags, const char *format)
Definition prvm_cmds.c:3867
#define MAX_LIGHTSTYLES
max flickering light styles in level (note: affects savegame format)
Definition qdefs.h:108
#define MAX_SOUNDS
max number of sounds loaded at once
Definition qdefs.h:107
#define MAX_QPATH
max length of a quake game pathname
Definition qdefs.h:169
float prvm_vec_t
Definition qtypes.h:55
int current_skill
skill level for currently loaded level (in case the user changes the cvar while the level is running,...
Definition sv_ccmds.c:27
void SV_SpawnServer(const char *map)
Definition sv_main.c:1811
void SV_LinkEdict(prvm_edict_t *ent)
Definition sv_phys.c:804
cvar_t skill
Definition sv_main.c:52
void(* ConnectLocal)(void)
Definition host.h:55
void(* ToggleMenu)(void)
Definition host.h:57
void(* Disconnect)(qbool, const char *,...)
Definition host.h:56
prvm_vec_t * fp
Definition progsvm.h:102
union prvm_edict_t::@30 fields
int entityfields
number of vec_t fields in progs (some variables are 3)
Definition progsvm.h:548
memexpandablearray_t stringbuffersarray
Definition progsvm.h:596
struct cmd_state_s * console_cmd
points to the relevant console command interpreter for this vm (cmd_local or &cmd_server),...
Definition progsvm.h:641
int max_edicts
number of edicts for which space has been (should be) allocated
Definition progsvm.h:673
unsigned char flags
Definition progsvm.h:505
char lightstyles[MAX_LIGHTSTYLES][64]
Definition server.h:122
char sound_precache[MAX_SOUNDS][MAX_QPATH]
Definition server.h:121
char model_precache[MAX_MODELS][MAX_QPATH]
Definition server.h:116
char worldname[MAX_QPATH]
Definition server.h:110
#define SAVEGAME_VERSION
Definition sv_save.c:33
void World_UnlinkAll(world_t *world)
unlinks all entities (used before reallocation of edicts)
Definition world.c:159
size_t Mem_ExpandableArray_IndexRange(const memexpandablearray_t *l)
Definition zone.c:763
void * Mem_ExpandableArray_RecordAtIndex(const memexpandablearray_t *l, size_t index)
Definition zone.c:780
mempool_t * tempmempool
Definition zone.c:794
#define Mem_Free(mem)
Definition zone.h:96

References server_t::active, BufStr_Del(), BufStr_FindCreateReplace(), BufStr_Flush(), BufStr_Set(), server_static_t::clients, cls, cmd(), Cmd_Argc(), Cmd_Argv(), COM_ParseToken_Simple(), com_token, CON_ERROR, Con_Print(), Con_Printf(), CON_WARN, host_static_t::ConnectLocal, prvm_prog_t::console_cmd, current_skill, Cvar_SetValueQuick(), Cvar_UpdateAllAutoCvars(), client_static_t::demonum, developer_entityparsing, host_static_t::Disconnect, dp_strlcpy, prvm_prog_t::entityfields, entnum, prvm_edict_t::fields, prvm_stringbuffer_t::flags, prvm_edict_t::fp, prvm_edict_t::free, FS_DefaultExtension(), FS_LoadFile(), host_static_t::hook, host, Host_Error(), i, int(), cvar_t::integer, server_t::lightstyles, server_t::loadgame, mapname, MAX_EDICTS, prvm_prog_t::max_edicts, MAX_LIGHTSTYLES, MAX_MODELS, MAX_QPATH, MAX_SOUNDS, Mem_ExpandableArray_IndexRange(), Mem_ExpandableArray_RecordAtIndex(), Mem_Free, Mod_ForName(), server_t::model_precache, server_t::models, NULL, prvm_prog_t::num_edicts, NUM_SPAWN_PARMS, server_t::paused, PRVM_ED_ParseEdict(), PRVM_ED_ParseGlobals(), PRVM_EDICT_NUM, PRVM_MEM_IncreaseEdicts(), SAVEGAME_VERSION, skill, server_t::sound_precache, STRINGBUFFER_SAVED, STRINGBUFFER_TEMP, prvm_prog_t::stringbuffersarray, sv, SV_LinkEdict(), SV_SpawnServer(), svs, SVVM_prog, tempmempool, server_t::time, time, host_static_t::ToggleMenu, version, server_t::world, World_UnlinkAll(), and server_t::worldname.

Referenced by SV_InitOperatorCommands().

◆ SV_MarkWriteEntityStateToClient()

void SV_MarkWriteEntityStateToClient ( entity_state_t * s,
client_t * client )

Definition at line 863 of file sv_send.c.

864{
865 prvm_prog_t *prog = SVVM_prog;
866 int isbmodel;
867 model_t *model;
868 prvm_edict_t *ed;
870 return;
873
875 {
879 prog->ExecuteProgram(prog, s->customizeentityforclient, "customizeentityforclient: NULL function");
881 return;
882 }
883
884 // never reject player
886 {
887 // check various rejection conditions
889 return;
891 return;
892 if (s->effects & EF_NODRAW)
893 return;
894 // LadyHavoc: only send entities with a model or important effects
895 if (!s->modelindex && s->specialvisibilityradius == 0)
896 return;
897
898 isbmodel = (model = SV_GetModelByIndex(s->modelindex)) != NULL && model->name[0] == '*';
899 // viewmodels don't have visibility checking
900 if (s->viewmodelforclient)
901 {
903 return;
904 }
905 else if (s->tagentity)
906 {
907 // tag attached entities simply check their parent
909 return;
912 return;
913 }
914 // always send world submodels in newer protocols because they don't
915 // generate much traffic (in old protocols they hog bandwidth)
916 // but only if sv_cullentities_nevercullbmodels is off
918 {
919 // entity has survived every check so far, check if visible
920 ed = PRVM_EDICT_NUM(s->number);
921
922 // if not touching a visible leaf
924 {
925 if (ed->priv.server->pvs_numclusters < 0)
926 {
927 // entity too big for clusters list
928 if (sv.worldmodel && sv.worldmodel->brush.BoxTouchingPVS && !sv.worldmodel->brush.BoxTouchingPVS(sv.worldmodel, sv.writeentitiestoclient_pvs, ed->priv.server->cullmins, ed->priv.server->cullmaxs))
929 {
931 return;
932 }
933 }
934 else
935 {
936 int i;
937 // check cached clusters list
938 for (i = 0;i < ed->priv.server->pvs_numclusters;i++)
939 if (CHECKPVSBIT(sv.writeentitiestoclient_pvs, ed->priv.server->pvs_clusterlist[i]))
940 break;
941 if (i == ed->priv.server->pvs_numclusters)
942 {
944 return;
945 }
946 }
947 }
948
949 // or not seen by random tracelines
950 if (sv_cullentities_trace.integer && !isbmodel && sv.worldmodel && sv.worldmodel->brush.TraceLineOfSight && !r_trippy.integer && (client->frags != -666 || sv_cullentities_trace_spectators.integer))
951 {
952 int samples =
953 s->number <= svs.maxclients
955 :
959
960 if(samples > 0)
961 {
962 int eyeindex;
963 for (eyeindex = 0;eyeindex < sv.writeentitiestoclient_numeyes;eyeindex++)
965 break;
966 if(eyeindex < sv.writeentitiestoclient_numeyes)
968 host.realtime + (
969 s->number <= svs.maxclients
972 );
973 else if ((float)host.realtime > svs.clients[sv.writeentitiestoclient_clientnumber].visibletime[s->number])
974 {
976 return;
977 }
978 }
979 }
980 }
981 }
982
983 // this just marks it for sending
984 // FIXME: it would be more efficient to send here, but the entity
985 // compressor isn't that flexible
988}
@ PROTOCOL_QUAKEDP
darkplaces extended quake protocol (used by TomazQuake and others), backwards compatible as long as n...
Definition common.h:142
@ PROTOCOL_QUAKE
quake (aka netquake/normalquake/nq) protocol
Definition common.h:144
@ PROTOCOL_NEHAHRAMOVIE
Nehahra movie protocol, a big nasty hack dating back to early days of the Quake Standards Group (but ...
Definition common.h:143
GLsizei samples
Definition glquake.h:623
cvar_t r_novis
Definition model_brush.c:31
cvar_t r_trippy
Definition model_brush.c:29
#define CHECKPVSBIT(pvs, b)
#define OFS_RETURN
Definition pr_comp.h:33
#define PRVM_G_FLOAT(o)
Definition progsvm.h:882
#define EF_NODEPTHTEST
Definition protocol.h:81
#define EF_NODRAW
Definition protocol.h:72
cvar_t sv_cullentities_trace_enlarge
Definition sv_main.c:87
cvar_t sv_cullentities_pvs
Definition sv_main.c:82
cvar_t sv_cullentities_nevercullbmodels
Definition sv_main.c:81
cvar_t sv_cullentities_trace_samples
Definition sv_main.c:93
cvar_t sv_cullentities_trace
Definition sv_main.c:84
cvar_t sv_cullentities_trace_samples_extra
Definition sv_main.c:94
cvar_t sv_cullentities_trace_delay
Definition sv_main.c:85
unsigned short specialvisibilityradius
Definition protocol.h:452
unsigned short tagentity
Definition protocol.h:451
unsigned short viewmodelforclient
Definition protocol.h:453
unsigned short modelindex
Definition protocol.h:449
unsigned short drawonlytoclient
Definition protocol.h:456
unsigned short nodrawtoclient
Definition protocol.h:455
unsigned short number
Definition protocol.h:448
unsigned int customizeentityforclient
Definition protocol.h:447
unsigned char * writeentitiestoclient_pvs
Definition server.h:155
vec3_t writeentitiestoclient_eyes[MAX_CLIENTNETWORKEYES]
Definition server.h:153
int sententitiesconsideration[MAX_EDICTS]
Definition server.h:165
int writeentitiestoclient_stats_culled_pvs
Definition server.h:146
int sententitiesmark
Definition server.h:163
int writeentitiestoclient_stats_totalentities
Definition server.h:149
entity_state_t * sendentitiesindex[MAX_EDICTS]
Definition server.h:161
int sententities[MAX_EDICTS]
Definition server.h:164
int writeentitiestoclient_cliententitynumber
Definition server.h:150
int writeentitiestoclient_numeyes
Definition server.h:154
int writeentitiestoclient_stats_visibleentities
Definition server.h:148
int writeentitiestoclient_stats_culled_trace
Definition server.h:147
int writeentitiestoclient_clientnumber
Definition server.h:151
qbool SV_CanSeeBox(int numtraces, vec_t eyejitter, vec_t enlarge, vec_t entboxexpand, vec3_t eye, vec3_t entboxmins, vec3_t entboxmaxs)
Definition sv_send.c:723
cvar_t sv_cullentities_trace_expand
Definition sv_main.c:88
cvar_t sv_cullentities_trace_eyejitter
Definition sv_main.c:89
void SV_MarkWriteEntityStateToClient(entity_state_t *s, client_t *client)
Definition sv_send.c:863
static qbool SV_PrepareEntityForSending(prvm_edict_t *ent, entity_state_t *cs, int enumber)
Definition sv_send.c:394
cvar_t sv_cullentities_trace_delay_players
Definition sv_main.c:86
cvar_t sv_cullentities_trace_samples_players
Definition sv_main.c:95
cvar_t sv_cullentities_trace_spectators
Definition sv_main.c:96

References CHECKPVSBIT, server_static_t::clients, entity_state_t::customizeentityforclient, entity_state_t::drawonlytoclient, EF_NODEPTHTEST, EF_NODRAW, entity_state_t::effects, prvm_prog_t::ExecuteProgram, client_t::frags, host, i, cvar_t::integer, server_static_t::maxclients, model, entity_state_t::modelindex, entity_state_t::nodrawtoclient, NULL, entity_state_t::number, OFS_RETURN, other, prvm_edict_t::priv, server_t::protocol, PROTOCOL_NEHAHRAMOVIE, PROTOCOL_QUAKE, PROTOCOL_QUAKEDP, PRVM_EDICT_NUM, PRVM_G_FLOAT, PRVM_serverglobaledict, PRVM_serverglobalfloat, r_novis, r_trippy, host_static_t::realtime, samples, self, server_t::sendentitiesindex, server_t::sententities, server_t::sententitiesconsideration, server_t::sententitiesmark, prvm_edict_t::server, entity_state_t::specialvisibilityradius, sv, SV_CanSeeBox(), sv_cullentities_nevercullbmodels, sv_cullentities_pvs, sv_cullentities_trace, sv_cullentities_trace_delay, sv_cullentities_trace_delay_players, sv_cullentities_trace_enlarge, sv_cullentities_trace_expand, sv_cullentities_trace_eyejitter, sv_cullentities_trace_samples, sv_cullentities_trace_samples_extra, sv_cullentities_trace_samples_players, sv_cullentities_trace_spectators, SV_GetModelByIndex(), SV_MarkWriteEntityStateToClient(), SV_PrepareEntityForSending(), svs, SVVM_prog, entity_state_t::tagentity, server_t::time, time, cvar_t::value, entity_state_t::viewmodelforclient, server_t::worldmodel, server_t::writeentitiestoclient_cliententitynumber, server_t::writeentitiestoclient_clientnumber, server_t::writeentitiestoclient_eyes, server_t::writeentitiestoclient_numeyes, server_t::writeentitiestoclient_pvs, server_t::writeentitiestoclient_stats_culled_pvs, server_t::writeentitiestoclient_stats_culled_trace, server_t::writeentitiestoclient_stats_totalentities, and server_t::writeentitiestoclient_stats_visibleentities.

Referenced by SV_MarkWriteEntityStateToClient(), and SV_WriteEntitiesToClient().

◆ SV_ModelIndex()

int SV_ModelIndex ( const char * s,
int precachemode )

Definition at line 1411 of file sv_main.c.

1412{
1414 char filename[MAX_QPATH];
1415 if (!s || !*s)
1416 return 0;
1417 // testing
1418 //if (precachemode == 2)
1419 // return 0;
1420 dp_strlcpy(filename, s, sizeof(filename));
1421 for (i = 2;i < limit;i++)
1422 {
1423 if (!sv.model_precache[i][0])
1424 {
1425 if (precachemode)
1426 {
1428 {
1429 Con_Printf("SV_ModelIndex(\"%s\"): precache_model can only be done in spawn functions\n", filename);
1430 return 0;
1431 }
1432 if (precachemode == 1)
1433 Con_Printf("SV_ModelIndex(\"%s\"): not precached (fix your code), precaching anyway\n", filename);
1434 dp_strlcpy(sv.model_precache[i], filename, sizeof(sv.model_precache[i]));
1435 if (sv.state == ss_loading)
1436 {
1437 // running from SV_SpawnServer which is launched from the client console command interpreter
1438 sv.models[i] = Mod_ForName (sv.model_precache[i], true, false, s[0] == '*' ? sv.worldname : NULL);
1439 }
1440 else
1441 {
1442 if (svs.threaded)
1443 {
1444 // this is running on the server thread, we can't load a model here (it would crash on renderer calls), so only look it up, the svc_precache will cause it to be loaded when it reaches the client
1445 sv.models[i] = Mod_FindName (sv.model_precache[i], s[0] == '*' ? sv.worldname : NULL);
1446 }
1447 else
1448 {
1449 // running single threaded, so we can load the model here
1450 sv.models[i] = Mod_ForName (sv.model_precache[i], true, false, s[0] == '*' ? sv.worldname : NULL);
1451 }
1455 }
1456 return i;
1457 }
1458 Con_Printf("SV_ModelIndex(\"%s\"): not precached\n", filename);
1459 return 0;
1460 }
1461 if (!strcmp(sv.model_precache[i], filename))
1462 return i;
1463 }
1464 Con_Printf("SV_ModelIndex(\"%s\"): i (%i) == MAX_MODELS (%i)\n", filename, i, MAX_MODELS);
1465 return 0;
1466}
@ PROTOCOL_DARKPLACES2
various changes
Definition common.h:140
@ PROTOCOL_DARKPLACES4
various changes
Definition common.h:138
@ PROTOCOL_NEHAHRABJP2
same as NEHAHRABJP but with 16bit soundindex
Definition common.h:147
@ PROTOCOL_DARKPLACES3
uses EntityFrame4 entity snapshot encoder/decoder which is broken, this attempted to do partial snaps...
Definition common.h:139
@ PROTOCOL_NEHAHRABJP
same as QUAKEDP but with 16bit modelindex
Definition common.h:146
@ PROTOCOL_DARKPLACES5
uses EntityFrame5 entity snapshot encoder/decoder which is based on a Tribes networking article at ht...
Definition common.h:137
@ PROTOCOL_NEHAHRABJP3
same as NEHAHRABJP2 but with some changes
Definition common.h:148
@ PROTOCOL_DARKPLACES1
uses EntityFrame entity snapshot encoder/decoder which is a QuakeWorld-like entity snapshot delta com...
Definition common.h:141
model_t * Mod_FindName(const char *name, const char *parentname)
#define svc_precache
Definition protocol.h:274
server_state_t state
some actions are only valid during load
Definition server.h:124

References Con_Printf(), dp_strlcpy, i, MAX_MODELS, MAX_QPATH, Mod_FindName(), Mod_ForName(), server_t::model_precache, server_t::models, MSG_WriteByte(), MSG_WriteShort(), MSG_WriteString(), NULL, server_t::protocol, PROTOCOL_DARKPLACES1, PROTOCOL_DARKPLACES2, PROTOCOL_DARKPLACES3, PROTOCOL_DARKPLACES4, PROTOCOL_DARKPLACES5, PROTOCOL_NEHAHRABJP, PROTOCOL_NEHAHRABJP2, PROTOCOL_NEHAHRABJP3, PROTOCOL_NEHAHRAMOVIE, PROTOCOL_QUAKE, PROTOCOL_QUAKEDP, server_t::reliable_datagram, ss_loading, server_t::state, sv, svc_precache, svs, server_static_t::threaded, and server_t::worldname.

Referenced by SV_CreateBaseline(), SV_WriteClientdataToMessage(), VM_SV_effect(), VM_SV_precache_model(), and VM_SV_setmodel().

◆ SV_movestep()

qbool SV_movestep ( prvm_edict_t * ent,
vec3_t move,
qbool relink,
qbool noenemy,
qbool settrace )

Definition at line 109 of file sv_move.c.

110{
111 prvm_prog_t *prog = SVVM_prog;
112 float dz;
113 vec3_t oldorg, neworg, end, traceendpos, entorigin, entmins, entmaxs;
114 trace_t trace;
115 int i;
117
118// try the move
120 VectorAdd (PRVM_serveredictvector(ent, origin), move, neworg);
121 VectorCopy(PRVM_serveredictvector(ent, mins), entmins);
122 VectorCopy(PRVM_serveredictvector(ent, maxs), entmaxs);
123
124// flying monsters don't step up
125 if ( (int)PRVM_serveredictfloat(ent, flags) & (FL_SWIM | FL_FLY) )
126 {
127 // try one move with vertical motion, then one without
128 for (i=0 ; i<2 ; i++)
129 {
130 VectorAdd (PRVM_serveredictvector(ent, origin), move, neworg);
131 if (noenemy)
132 enemy = prog->edicts;
133 else
134 {
136 if (i == 0 && enemy != prog->edicts)
137 {
139 if (dz > 40)
140 neworg[2] -= 8;
141 if (dz < 30)
142 neworg[2] += 8;
143 }
144 }
145 VectorCopy(PRVM_serveredictvector(ent, origin), entorigin);
146 trace = SV_TraceBox(entorigin, entmins, entmaxs, neworg, MOVE_NORMAL, ent, SV_GenericHitSuperContentsMask(ent), 0, 0, collision_extendmovelength.value);
147
148 if (trace.fraction == 1)
149 {
150 VectorCopy(trace.endpos, traceendpos);
152 return false; // swim monster left water
153
154 VectorCopy (traceendpos, PRVM_serveredictvector(ent, origin));
155 if (relink)
156 {
157 SV_LinkEdict(ent);
159 }
160 return true;
161 }
162
163 if (enemy == prog->edicts)
164 break;
165 }
166
167 return false;
168 }
169
170// push down from a step height above the wished position
171 neworg[2] += sv_stepheight.value;
172 VectorCopy (neworg, end);
173 end[2] -= sv_stepheight.value*2;
174
175 trace = SV_TraceBox(neworg, entmins, entmaxs, end, MOVE_NORMAL, ent, SV_GenericHitSuperContentsMask(ent), 0, 0, collision_extendmovelength.value);
176
177 if (trace.startsolid)
178 {
179 neworg[2] -= sv_stepheight.value;
180 trace = SV_TraceBox(neworg, entmins, entmaxs, end, MOVE_NORMAL, ent, SV_GenericHitSuperContentsMask(ent), 0, 0, collision_extendmovelength.value);
181 if (trace.startsolid)
182 return false;
183 }
184 if (trace.fraction == 1)
185 {
186 // if monster had the ground pulled out, go ahead and fall
188 {
190 if (relink)
191 {
192 SV_LinkEdict(ent);
194 }
195 PRVM_serveredictfloat(ent, flags) = (int)PRVM_serveredictfloat(ent, flags) & ~FL_ONGROUND;
196 return true;
197 }
198
199 return false; // walked off an edge
200 }
201
202// check point traces down for dangling corners
204
205 if (!SV_CheckBottom (ent))
206 {
208 { // entity had floor mostly pulled out from underneath it
209 // and is trying to correct
210 if (relink)
211 {
212 SV_LinkEdict(ent);
214 }
215 return true;
216 }
218 return false;
219 }
220
222 PRVM_serveredictfloat(ent, flags) = (int)PRVM_serveredictfloat(ent, flags) & ~FL_PARTIALGROUND;
223
224// gameplayfix: check if reached pretty steep plane and bail
226 {
227 if (trace.plane.normal[ 2 ] < 0.5)
228 {
230 return false;
231 }
232 }
233
235
236// the move is ok
237 if (relink)
238 {
239 SV_LinkEdict(ent);
241 }
242 return true;
243}
#define SUPERCONTENTS_LIQUIDSMASK
Definition bspfile.h:218
entity enemy
entity groundentity
Definition progsdefs.qc:134
#define PRVM_PROG_TO_EDICT(n)
Definition progsvm.h:877
#define FL_FLY
Definition server.h:357
#define FL_PARTIALGROUND
not all corners are valid
Definition server.h:367
cvar_t sv_gameplayfix_nostepmoveonsteepslopes
Definition sv_main.c:125
trace_t SV_TraceBox(const vec3_t start, const vec3_t mins, const vec3_t maxs, const vec3_t end, int type, prvm_edict_t *passedict, int hitsupercontentsmask, int skipsupercontentsmask, int skipmaterialflagsmask, float extend)
traces a box move against worldmodel and all entities in the specified area
Definition sv_phys.c:414
#define FL_SWIM
Definition server.h:358
void SV_LinkEdict_TouchAreaGrid(prvm_edict_t *ent)
Definition sv_phys.c:727
void * ent
Definition collision.h:47
plane_t plane
Definition collision.h:44
qbool startsolid
Definition collision.h:26
qbool SV_CheckBottom(prvm_edict_t *ent)
Definition sv_move.c:36
vec3_t normal
Definition collision.h:13
#define MOVE_NORMAL
Definition world.h:28

References collision_extendmovelength, prvm_prog_t::edicts, trace_t::endpos, enemy, trace_t::ent, FL_FLY, FL_PARTIALGROUND, FL_SWIM, flags, trace_t::fraction, groundentity, i, int(), cvar_t::integer, maxs, mins, MOVE_NORMAL, plane_t::normal, origin, trace_t::plane, PRVM_EDICT_TO_PROG, PRVM_PROG_TO_EDICT, PRVM_serveredictedict, PRVM_serveredictfloat, PRVM_serveredictvector, trace_t::startsolid, SUPERCONTENTS_LIQUIDSMASK, SV_CheckBottom(), sv_gameplayfix_nostepmoveonsteepslopes, SV_GenericHitSuperContentsMask(), SV_LinkEdict(), SV_LinkEdict_TouchAreaGrid(), SV_PointSuperContents(), sv_stepheight, SV_TraceBox(), SVVM_prog, cvar_t::value, VectorAdd, and VectorCopy.

Referenced by SV_StepDirection(), and VM_SV_walkmove().

◆ SV_Name()

◆ SV_ParticleEffectIndex()

int SV_ParticleEffectIndex ( const char * name)

Definition at line 1522 of file sv_main.c.

1523{
1524 int i, argc, linenumber, effectnameindex;
1525 int filepass;
1526 fs_offset_t filesize;
1527 unsigned char *filedata;
1528 const char *text;
1529 const char *textstart;
1530 //const char *textend;
1531 char argv[16][1024];
1532 char filename[MAX_QPATH];
1534 {
1536 memset(sv.particleeffectname, 0, sizeof(sv.particleeffectname));
1537 for (i = 0;i < EFFECT_TOTAL;i++)
1539 for (filepass = 0;;filepass++)
1540 {
1541 if (filepass == 0)
1542 dpsnprintf(filename, sizeof(filename), "effectinfo.txt");
1543 else if (filepass == 1)
1544 dpsnprintf(filename, sizeof(filename), "%s_effectinfo.txt", sv.worldnamenoextension);
1545 else
1546 break;
1547 filedata = FS_LoadFile(filename, tempmempool, true, &filesize);
1548 if (!filedata)
1549 continue;
1550 textstart = (const char *)filedata;
1551 //textend = (const char *)filedata + filesize;
1552 text = textstart;
1553 for (linenumber = 1;;linenumber++)
1554 {
1555 argc = 0;
1556 for (;;)
1557 {
1558 if (!COM_ParseToken_Simple(&text, true, false, true) || !strcmp(com_token, "\n"))
1559 break;
1560 if (argc < 16)
1561 {
1562 dp_strlcpy(argv[argc], com_token, sizeof(argv[argc]));
1563 argc++;
1564 }
1565 }
1566 if (com_token[0] == 0)
1567 break; // if the loop exited and it's not a \n, it's EOF
1568 if (argc < 1)
1569 continue;
1570 if (!strcmp(argv[0], "effect"))
1571 {
1572 if (argc == 2)
1573 {
1574 for (effectnameindex = 1;effectnameindex < MAX_PARTICLEEFFECTNAME;effectnameindex++)
1575 {
1576 if (sv.particleeffectname[effectnameindex][0])
1577 {
1578 if (!strcmp(sv.particleeffectname[effectnameindex], argv[1]))
1579 break;
1580 }
1581 else
1582 {
1583 dp_strlcpy(sv.particleeffectname[effectnameindex], argv[1], sizeof(sv.particleeffectname[effectnameindex]));
1584 break;
1585 }
1586 }
1587 // if we run out of names, abort
1588 if (effectnameindex == MAX_PARTICLEEFFECTNAME)
1589 {
1590 Con_Printf("%s:%i: too many effects!\n", filename, linenumber);
1591 break;
1592 }
1593 }
1594 }
1595 }
1596 Mem_Free(filedata);
1597 }
1598 }
1599 // search for the name
1600 for (effectnameindex = 1;effectnameindex < MAX_PARTICLEEFFECTNAME && sv.particleeffectname[effectnameindex][0];effectnameindex++)
1601 if (!strcmp(sv.particleeffectname[effectnameindex], name))
1602 return effectnameindex;
1603 // return 0 if we couldn't find it
1604 return 0;
1605}
@ EFFECT_TOTAL
int dpsnprintf(char *buffer, size_t buffersize, const char *format,...)
Returns the number of printed characters, excluding the final '\0' or returns -1 if the buffer isn't ...
Definition common.c:997
int64_t fs_offset_t
Definition fs.h:37
const GLchar * name
Definition glquake.h:601
string argv(float n)
#define MAX_PARTICLEEFFECTNAME
maximum number of unique names of particle effects (for particleeffectnum)
Definition qdefs.h:135
char particleeffectname[MAX_PARTICLEEFFECTNAME][MAX_QPATH]
Definition server.h:144
char worldnamenoextension[MAX_QPATH]
Definition server.h:111
qbool particleeffectnamesloaded
Definition server.h:143
static const char * standardeffectnames[EFFECT_TOTAL]
Definition sv_main.c:232

References argv(), COM_ParseToken_Simple(), com_token, Con_Printf(), dp_strlcpy, dpsnprintf(), EFFECT_TOTAL, FS_LoadFile(), i, MAX_PARTICLEEFFECTNAME, MAX_QPATH, Mem_Free, name, server_t::particleeffectname, server_t::particleeffectnamesloaded, standardeffectnames, sv, tempmempool, and server_t::worldnamenoextension.

Referenced by VM_SV_particleeffectnum().

◆ SV_Physics()

void SV_Physics ( void )

Definition at line 3013 of file sv_phys.c.

3014{
3015 prvm_prog_t *prog = SVVM_prog;
3016 int i;
3017 prvm_edict_t *ent;
3018
3019 // free memory for resources that are no longer referenced
3021
3022// let the progs know that a new frame has started
3027 prog->ExecuteProgram(prog, PRVM_serverfunction(StartFrame), "QC function StartFrame is missing");
3028
3029#ifdef USEODE
3030 // run physics engine
3032#endif
3033
3034//
3035// treat each object in turn
3036//
3037
3038 // if force_retouch, relink all the entities
3040 for (i = 1, ent = PRVM_EDICT_NUM(i);i < prog->num_edicts;i++, ent = PRVM_NEXT_EDICT(ent))
3041 if (!ent->free)
3042 SV_LinkEdict_TouchAreaGrid(ent); // force retouch even for stationary
3043
3045 {
3046 // run physics on the client entities in 3 stages
3047 for (i = 1, ent = PRVM_EDICT_NUM(i), host_client = svs.clients;i <= svs.maxclients;i++, ent = PRVM_NEXT_EDICT(ent), host_client++)
3048 if (!ent->free)
3050
3051 for (i = 1, ent = PRVM_EDICT_NUM(i), host_client = svs.clients;i <= svs.maxclients;i++, ent = PRVM_NEXT_EDICT(ent), host_client++)
3052 if (!ent->free)
3054
3055 for (i = 1, ent = PRVM_EDICT_NUM(i), host_client = svs.clients;i <= svs.maxclients;i++, ent = PRVM_NEXT_EDICT(ent), host_client++)
3056 if (!ent->free)
3058 }
3059 else
3060 {
3061 // run physics on the client entities
3062 for (i = 1, ent = PRVM_EDICT_NUM(i), host_client = svs.clients;i <= svs.maxclients;i++, ent = PRVM_NEXT_EDICT(ent), host_client++)
3063 {
3064 if (!ent->free)
3065 {
3069 }
3070 }
3071 }
3072
3073 // run physics on all the non-client entities
3075 {
3076 for (;i < prog->num_edicts;i++, ent = PRVM_NEXT_EDICT(ent))
3077 if (!ent->free)
3078 SV_Physics_Entity(ent);
3079 // make a second pass to see if any ents spawned this frame and make
3080 // sure they run their move/think
3082 for (i = svs.maxclients + 1, ent = PRVM_EDICT_NUM(i);i < prog->num_edicts;i++, ent = PRVM_NEXT_EDICT(ent))
3083 if (!ent->priv.server->move && !ent->free)
3084 SV_Physics_Entity(ent);
3085 }
3086
3089
3090 // LadyHavoc: endframe support
3091 if (PRVM_serverfunction(EndFrame))
3092 {
3096 prog->ExecuteProgram(prog, PRVM_serverfunction(EndFrame), "QC function EndFrame is missing");
3097 }
3098
3099 // decrement prog->num_edicts if the highest number entities died
3100 for (;PRVM_ED_CanAlloc(prog, PRVM_EDICT_NUM(prog->num_edicts - 1));prog->num_edicts--);
3101
3103 sv.time += sv.frametime;
3104}
float frametime
float force_retouch
Definition progsdefs.qc:19
#define PRVM_NEXT_EDICT(e)
Definition progsvm.h:873
void PRVM_GarbageCollection(prvm_prog_t *prog)
qbool PRVM_ED_CanAlloc(prvm_prog_t *prog, prvm_edict_t *e)
Definition prvm_edict.c:243
cvar_t sv_gameplayfix_delayprojectiles
Definition sv_main.c:106
cvar_t sv_gameplayfix_consistentplayerprethink
Definition sv_main.c:105
cvar_t sv_freezenonclients
Definition sv_main.c:102
cvar_t sv_gravity
Definition sv_main.c:134
static void SV_Physics_ClientEntity_PreThink(prvm_edict_t *ent)
Definition sv_phys.c:2853
static void SV_Physics_ClientEntity_PostThink(prvm_edict_t *ent)
Definition sv_phys.c:2882
static void SV_Physics_ClientEntity(prvm_edict_t *ent)
Definition sv_phys.c:2919
static void SV_Physics_Entity(prvm_edict_t *ent)
Definition sv_phys.c:2682
void SV_LinkEdict_TouchAreaGrid(prvm_edict_t *ent)
Definition sv_phys.c:727
void World_Physics_Frame(world_t *world, double frametime, double gravity)

References server_static_t::clients, prvm_prog_t::edicts, prvm_prog_t::ExecuteProgram, force_retouch, frametime, server_t::frametime, prvm_edict_t::free, host_client, i, cvar_t::integer, max, server_static_t::maxclients, prvm_prog_t::num_edicts, other, PRVM_ED_CanAlloc(), PRVM_EDICT_NUM, PRVM_EDICT_TO_PROG, PRVM_GarbageCollection(), PRVM_NEXT_EDICT, PRVM_serverfunction, PRVM_serverglobaledict, PRVM_serverglobalfloat, self, sv, sv_freezenonclients, sv_gameplayfix_consistentplayerprethink, sv_gameplayfix_delayprojectiles, sv_gravity, SV_LinkEdict_TouchAreaGrid(), SV_Physics_ClientEntity(), SV_Physics_ClientEntity_PostThink(), SV_Physics_ClientEntity_PreThink(), SV_Physics_Entity(), svs, SVVM_prog, server_t::time, time, cvar_t::value, server_t::world, and World_Physics_Frame().

Referenced by SV_Frame(), SV_SpawnServer(), and SV_ThreadFunc().

◆ SV_Physics_ClientMove()

void SV_Physics_ClientMove ( void )

Definition at line 2810 of file sv_phys.c.

2811{
2812 prvm_prog_t *prog = SVVM_prog;
2813 prvm_edict_t *ent;
2814 ent = host_client->edict;
2815
2816 // call player physics, this needs the proper frametime
2819
2820 // call standard client pre-think, with frametime = 0
2824 prog->ExecuteProgram(prog, PRVM_serverfunction(PlayerPreThink), "QC function PlayerPreThink is missing");
2826
2827 // make sure the velocity is sane (not a NaN)
2828 SV_CheckVelocity(ent);
2829
2830 // perform movetype behaviour
2831 // note: will always be MOVETYPE_WALK if disableclientprediction = 0
2833
2834 // call standard player post-think, with frametime = 0
2838 prog->ExecuteProgram(prog, PRVM_serverfunction(PlayerPostThink), "QC function PlayerPostThink is missing");
2840
2842 {
2843 // angle fixing was requested by physics code...
2844 // so store the current angles for later use
2847
2848 // and clear fixangle for the next frame
2850 }
2851}
float fixangle
Definition progsdefs.qc:160
void SV_PlayerPhysics(void)
Definition sv_user.c:571
qbool fixangle_angles_set
Definition server.h:293
vec3_t fixangle_angles
Definition server.h:294
static void SV_Physics_ClientEntity_NoThink(prvm_edict_t *ent)
Definition sv_phys.c:2759
void SV_CheckVelocity(prvm_edict_t *ent)
Definition sv_phys.c:965

References angles, client_t::edict, prvm_prog_t::ExecuteProgram, fixangle, client_t::fixangle_angles, client_t::fixangle_angles_set, frametime, server_t::frametime, host_client, PRVM_EDICT_TO_PROG, PRVM_serveredictfloat, PRVM_serveredictvector, PRVM_serverfunction, PRVM_serverglobaledict, PRVM_serverglobalfloat, self, sv, SV_CheckVelocity(), SV_Physics_ClientEntity_NoThink(), SV_PlayerPhysics(), SVVM_prog, server_t::time, time, and VectorCopy.

Referenced by SV_ExecuteClientMoves().

◆ SV_PlayerCheckGround()

qbool SV_PlayerCheckGround ( prvm_edict_t * ent)

◆ SV_PlayerPhysics()

void SV_PlayerPhysics ( void )

Definition at line 571 of file sv_user.c.

572{
573 prvm_prog_t *prog = SVVM_prog;
575
576 //Con_Printf("clientthink for %ims\n", (int) (sv.frametime * 1000));
577
579 // make sure the velocity is sane (not a NaN)
581
582 // LadyHavoc: QuakeC replacement for SV_PlayerPhysics (player movement)
584 {
587 prog->ExecuteProgram(prog, PRVM_serverfunction(SV_PlayerPhysics), "QC function SV_PlayerPhysics is missing");
589 return;
590 }
591
593 return;
594
596
598
599 // if dead, behave differently
601 return;
602
604
605 // angles
606 // show 1/3 the pitch angle and all the roll angle
612 {
615 }
616
618 {
619 SV_WaterJump ();
621 return;
622 }
623
624 // walk
626 {
627 SV_WaterMove ();
629 return;
630 }
631
632 SV_AirMove ();
634}
float Com_CalcRoll(const vec3_t angles, const vec3_t velocity, const vec_t angleval, const vec_t velocityval)
Definition common.c:890
vector punchangle
Definition progsdefs.qc:117
float health
Definition progsdefs.qc:137
float waterlevel
Definition progsdefs.qc:181
#define YAW
Definition qtypes.h:19
#define PITCH
Definition qtypes.h:16
#define ROLL
Definition qtypes.h:22
#define FL_WATERJUMP
player jumping out of water
Definition server.h:368
#define MOVETYPE_NOCLIP
Definition server.h:320
#define MOVETYPE_NONE
never moves
Definition server.h:312
void SV_CheckVelocity(prvm_edict_t *ent)
Definition sv_phys.c:965
#define FL_ONGROUND
Definition server.h:366
cvar_t sv_playerphysicsqc
Definition sv_main.c:145
static void DropPunchAngle(void)
Definition sv_user.c:398
void SV_PlayerPhysics(void)
Definition sv_user.c:571
cvar_t sv_rollangle
Definition sv_main.c:176
void SV_ApplyClientMove(void)
Definition sv_user.c:893
static void SV_WaterJump(void)
Definition sv_user.c:493
static usercmd_t usercmd
Definition sv_user.c:26
static qbool onground
Definition sv_user.c:308
cvar_t sv_rollspeed
Definition sv_main.c:175
static void SV_WaterMove(void)
Definition sv_user.c:435
static void SV_AirMove(void)
Definition sv_user.c:512

References angles, client_t::cmd, Com_CalcRoll(), DropPunchAngle(), client_t::edict, prvm_prog_t::ExecuteProgram, fixangle, FL_ONGROUND, FL_WATERJUMP, flags, health, host_client, int(), cvar_t::integer, movetype, MOVETYPE_NOCLIP, MOVETYPE_NONE, onground, PITCH, PRVM_EDICT_TO_PROG, PRVM_serveredictfloat, PRVM_serveredictvector, PRVM_serverfunction, PRVM_serverglobaledict, PRVM_serverglobalfloat, punchangle, ROLL, self, sv, SV_AirMove(), SV_ApplyClientMove(), SV_CheckVelocity(), SV_PlayerPhysics(), sv_playerphysicsqc, sv_rollangle, sv_rollspeed, SV_WaterJump(), SV_WaterMove(), SVVM_prog, server_t::time, time, usercmd, v_angle, cvar_t::value, VectorAdd, VectorCopy, velocity, waterlevel, and YAW.

Referenced by SV_Physics_ClientEntity_PreThink(), SV_Physics_ClientMove(), and SV_PlayerPhysics().

◆ SV_PointSuperContents()

int SV_PointSuperContents ( const vec3_t point)

Definition at line 611 of file sv_phys.c.

612{
613 prvm_prog_t *prog = SVVM_prog;
614 int supercontents = 0;
615 int i;
616 prvm_edict_t *touch;
617 vec3_t transformed;
618 // matrices to transform into/out of other entity's space
619 matrix4x4_t matrix, imatrix;
620 // model of other entity
621 model_t *model;
622 int frame;
623 // list of entities to test for collisions
624 int numtouchedicts;
625 static prvm_edict_t *touchedicts[MAX_EDICTS];
626
627 // get world supercontents at this point
628 if (sv.worldmodel && sv.worldmodel->PointSuperContents)
629 supercontents = sv.worldmodel->PointSuperContents(sv.worldmodel, 0, point);
630
631 // if sv_gameplayfix_swiminbmodels is off we're done
633 return supercontents;
634
635 // get list of entities at this point
636 numtouchedicts = SV_EntitiesInBox(point, point, MAX_EDICTS, touchedicts);
637 if (numtouchedicts > MAX_EDICTS)
638 {
639 // this never happens
640 Con_Printf("SV_EntitiesInBox returned %i edicts, max was %i\n", numtouchedicts, MAX_EDICTS);
641 numtouchedicts = MAX_EDICTS;
642 }
643 for (i = 0;i < numtouchedicts;i++)
644 {
645 touch = touchedicts[i];
646
647 // we only care about SOLID_BSP for pointcontents
649 continue;
650
651 // might interact, so do an exact clip
653 if (!model || !model->PointSuperContents)
654 continue;
656 Matrix4x4_Invert_Simple(&imatrix, &matrix);
657 Matrix4x4_Transform(&imatrix, point, transformed);
659 supercontents |= model->PointSuperContents(model, bound(0, frame, (model->numframes - 1)), transformed);
660 }
661
662 return supercontents;
663}
float frame
#define bound(min, num, max)
Definition mathlib.h:34
cvar_t sv_gameplayfix_swiminbmodels
Definition sv_main.c:126

References angles, bound, Con_Printf(), frame, i, int(), cvar_t::integer, Matrix4x4_CreateFromQuakeEntity(), Matrix4x4_Invert_Simple(), Matrix4x4_Transform(), MAX_EDICTS, model, origin, PRVM_serveredictfloat, PRVM_serveredictvector, solid, SOLID_BSP, sv, SV_EntitiesInBox(), sv_gameplayfix_swiminbmodels, SV_GetModelFromEdict(), SVVM_prog, and server_t::worldmodel.

Referenced by PHYS_TestEntityPosition(), SV_CheckBottom(), SV_CheckWater(), SV_CheckWaterTransition(), SV_movestep(), and VM_SV_pointcontents().

◆ SV_PreSpawn_f()

void SV_PreSpawn_f ( cmd_state_t * cmd)

Definition at line 36 of file sv_user.c.

37{
39 {
40 Con_Print("prespawn not valid -- already prespawned\n");
41 return;
42 }
43 host_client->prespawned = true;
44
46 {
50 host_client->sendsignon = 0; // enable unlimited sends again
51 }
52
53 // reset the name change timer because the client will send name soon
55}
#define svc_signonnum
Definition protocol.h:247
float nametime
prevent animated names
Definition server.h:260
int sendsignon
1 = send svc_serverinfo and advance to 2, 2 doesn't send, then advances to 0 (allowing unlimited send...
Definition server.h:195
sizebuf_t signon
Definition server.h:133

References Con_Print(), sizebuf_t::cursize, sizebuf_t::data, host_client, netconn_t::message, MSG_WriteByte(), client_t::nametime, client_t::netconnection, client_t::prespawned, client_t::sendsignon, server_t::signon, sv, svc_signonnum, and SZ_Write().

Referenced by SV_InitOperatorCommands().

◆ SV_ReadClientMessage()

void SV_ReadClientMessage ( void )

Definition at line 985 of file sv_user.c.

986{
987 prvm_prog_t *prog = SVVM_prog;
988 int netcmd, num, start;
989 char *s, *p, *q;
990 size_t slen;
991
994
995 //MSG_BeginReading ();
996 sv_numreadmoves = 0;
997
998 for(;;)
999 {
1000 if (!host_client->active)
1001 {
1002 // a command caused an error
1003 SV_DropClient (false, "Connection closing");
1004 return;
1005 }
1006
1007 if (sv_message.badread)
1008 {
1009 Con_Print("SV_ReadClientMessage: badread\n");
1010 SV_DropClient (false, "An internal server error occurred");
1011 return;
1012 }
1013
1014 netcmd = MSG_ReadByte(&sv_message);
1015 if (netcmd == -1)
1016 {
1017 // end of message
1018 // apply the moves that were read this frame
1020 break;
1021 }
1022
1023 switch (netcmd)
1024 {
1025 default:
1026 Con_Printf("SV_ReadClientMessage: unknown command char %i (at offset 0x%x)\n", netcmd, sv_message.readcount);
1029 SV_DropClient (false, "Unknown message sent to the server");
1030 return;
1031
1032 case clc_nop:
1033 break;
1034
1035 case clc_stringcmd:
1036 // allow reliable messages now as the client is done with initial loading
1037 if (host_client->sendsignon == 2)
1040 s = sv_readstring;
1041 q = NULL;
1042 for(p = s; *p; ++p) switch(*p)
1043 {
1044 case 10:
1045 case 13:
1046 if(!q)
1047 q = p;
1048 break;
1049 default:
1050 if(q)
1051 goto clc_stringcmd_invalid; // newline seen, THEN something else -> possible exploit
1052 break;
1053 }
1054 if(q)
1055 *q = 0;
1056 if (strncasecmp(s, "spawn", 5) == 0
1057 || strncasecmp(s, "begin", 5) == 0
1058 || strncasecmp(s, "prespawn", 8) == 0)
1060 else if (PRVM_serverfunction(SV_ParseClientCommand))
1061 {
1062 int restorevm_tempstringsbuf_cursize;
1063 restorevm_tempstringsbuf_cursize = prog->tempstringsbuf.cursize;
1064 PRVM_G_INT(OFS_PARM0) = PRVM_SetTempString(prog, s, slen);
1067 prog->ExecuteProgram(prog, PRVM_serverfunction(SV_ParseClientCommand), "QC function SV_ParseClientCommand is missing");
1068 prog->tempstringsbuf.cursize = restorevm_tempstringsbuf_cursize;
1069 }
1070 else
1072 break;
1073
1074clc_stringcmd_invalid:
1075 Con_Printf("Received invalid stringcmd from %s\n", host_client->name);
1076 if(developer.integer > 0)
1077 Com_HexDumpToConsole((unsigned char *) s, (int)strlen(s));
1078 break;
1079
1080 case clc_disconnect:
1083 : "Disconnect by user"); // client wants to disconnect
1084 return;
1085
1086 case clc_move:
1088 break;
1089
1091 start = MSG_ReadLong(&sv_message);
1092 num = MSG_ReadShort(&sv_message);
1094 {
1096 {
1098 // a data block was successfully received by the client,
1099 // update the expected position on the next data block
1101 // if this was the last data block of the file, it's done
1103 {
1104 // tell the client that the download finished
1105 // we need to calculate the crc now
1106 //
1107 // note: at this point the OS probably has the file
1108 // entirely in memory, so this is a faster operation
1109 // now than it was when the download started.
1110 //
1111 // it is also preferable to do this at the end of the
1112 // download rather than the start because it reduces
1113 // potential for Denial Of Service attacks against the
1114 // server.
1115 int crc;
1116 unsigned char *temp;
1117 FS_Seek(host_client->download_file, 0, SEEK_SET);
1118 temp = (unsigned char *) Mem_Alloc(tempmempool, size);
1120 crc = CRC_Block(temp, size);
1121 Mem_Free(temp);
1122 // calculated crc, send the file info to the client
1123 // (so that it can verify the data)
1124 SV_ClientCommands("\ncl_downloadfinished %i %i %s\n", size, crc, host_client->download_name);
1125 Con_DPrintf("Download of %s by %s has finished\n", host_client->download_name, host_client->name);
1128 host_client->download_name[0] = 0;
1131 }
1132 }
1133 else
1134 {
1135 // a data block was lost, reset to the expected position
1136 // and resume sending from there
1138 }
1139 }
1140 break;
1141
1142 case clc_ackframe:
1143 if (sv_message.badread) Con_Printf("SV_ReadClientMessage: badread at %s:%i\n", __FILE__, __LINE__);
1144 num = MSG_ReadLong(&sv_message);
1145 if (sv_message.badread) Con_Printf("SV_ReadClientMessage: badread at %s:%i\n", __FILE__, __LINE__);
1147 Con_Printf("recv clc_ackframe %i\n", num);
1148 // if the client hasn't progressed through signons yet,
1149 // ignore any clc_ackframes we get (they're probably from the
1150 // previous level)
1152 {
1153 int i;
1154 for (i = host_client->latestframenum + 1;i < num;i++)
1155 if (!SV_FrameLost(i))
1156 break;
1157 SV_FrameAck(num);
1159 }
1160 break;
1161 }
1162 }
1163}
cvar_t developer_networkentities
Definition cl_parse.c:173
void Cmd_ExecuteString(cmd_state_t *cmd, const char *text, size_t textlen, cmd_source_t src, qbool lockmutex)
Parses a single line of text into arguments and tries to execute it.
Definition cmd.c:2068
cmd_state_t * cmd_serverfromclient
command interpreter for server commands received over network from clients uses cmddefs_null
Definition cmd.c:26
@ src_client
came in over a net connection as a clc_stringcmd host_client will be valid during this state.
Definition cmd.h:73
unsigned short CRC_Block(const unsigned char *data, size_t size)
Definition com_crc16.c:75
char * MSG_ReadString(sizebuf_t *sb, char *string, size_t maxstring)
Definition com_msg.c:341
size_t MSG_ReadString_len(sizebuf_t *sb, char *string, size_t maxstring)
Same as MSG_ReadString except it returns the number of bytes written to *string excluding the \0 term...
Definition com_msg.c:352
void Com_HexDumpToConsole(const unsigned char *data, int size)
Definition common.c:82
#define MSG_ReadShort
Definition common.h:191
#define MSG_ReadLong
Definition common.h:192
#define MSG_ReadByte(sb)
Definition common.h:188
vector size
fs_offset_t FS_Read(qfile_t *file, void *buffer, size_t buffersize)
Definition fs.c:3066
int FS_Seek(qfile_t *file, fs_offset_t offset, int whence)
Definition fs.c:3359
fs_offset_t FS_FileSize(qfile_t *file)
Definition fs.c:3474
cvar_t developer
Definition host.c:48
float strlen(string s)
char sv_readstring[MAX_INPUTLINE]
Definition netconn.c:76
cvar_t developer_networking
Definition netconn.c:89
sizebuf_t sv_message
Definition netconn.c:72
int PRVM_SetTempString(prvm_prog_t *prog, const char *s, size_t slen)
Takes an strlen (not a buffer size).
#define PRVM_G_INT(o)
Definition progsvm.h:883
#define clc_nop
Definition protocol.h:288
#define clc_move
Definition protocol.h:290
#define clc_ackdownloaddata
Definition protocol.h:295
#define clc_ackframe
Definition protocol.h:294
#define clc_stringcmd
Definition protocol.h:291
#define clc_disconnect
Definition protocol.h:289
void SV_DropClient(qbool leaving, const char *reason,...)
Definition sv_main.c:1018
void SV_ClientCommands(const char *fmt,...) DP_FUNC_PRINTF(1)
Definition sv_send.c:135
int latestframenum
latest received clc_ackframe (used to detect packet loss)
Definition server.h:263
sizebuf_t tempstringsbuf
buffer for storing all tempstrings created during one invocation of ExecuteProgram
Definition progsvm.h:644
qbool badread
Definition common.h:56
int readcount
Definition common.h:55
void SV_WriteDemoMessage(client_t *client, sizebuf_t *sendbuffer, qbool clienttoserver)
Definition sv_demo.c:32
int sv_numreadmoves
Definition sv_user.c:641
static void SV_ExecuteClientMoves(void)
Definition sv_user.c:775
static void SV_ReadClientMove(void)
Definition sv_user.c:643
static void SV_FrameAck(int framenum)
Definition sv_user.c:970
static qbool SV_FrameLost(int framenum)
Definition sv_user.c:956
cvar_t sv_autodemo_perclient
Definition sv_main.c:211
#define Mem_Alloc(pool, size)
Definition zone.h:92

References client_t::active, sizebuf_t::badread, client_t::begun, clc_ackdownloaddata, clc_ackframe, clc_disconnect, clc_move, clc_nop, clc_stringcmd, Cmd_ExecuteString(), cmd_serverfromclient, Com_HexDumpToConsole(), Con_DPrintf(), Con_Print(), Con_Printf(), CRC_Block(), sizebuf_t::cursize, sizebuf_t::data, developer, developer_networkentities, developer_networking, client_t::download_expectedposition, client_t::download_file, client_t::download_name, client_t::download_started, client_t::edict, prvm_prog_t::ExecuteProgram, FS_Close(), FS_FileSize(), FS_Read(), FS_Seek(), host_client, i, int(), cvar_t::integer, client_t::latestframenum, Mem_Alloc, Mem_Free, netconn_t::message, MSG_ReadByte, MSG_ReadLong, MSG_ReadShort, MSG_ReadString(), MSG_ReadString_len(), client_t::name, client_t::netconnection, NULL, OFS_PARM0, server_t::protocol, PROTOCOL_DARKPLACES8, PRVM_EDICT_TO_PROG, PRVM_G_INT, PRVM_serverfunction, PRVM_serverglobaledict, PRVM_serverglobalfloat, PRVM_SetTempString(), sizebuf_t::readcount, self, client_t::sendsignon, size, src_client, strlen(), sv, sv_autodemo_perclient, SV_ClientCommands(), SV_DropClient(), SV_ExecuteClientMoves(), SV_FrameAck(), SV_FrameLost(), sv_message, sv_numreadmoves, SV_ReadClientMove(), sv_readstring, SV_WriteDemoMessage(), SVVM_prog, tempmempool, prvm_prog_t::tempstringsbuf, server_t::time, and time.

Referenced by NetConn_ServerParsePacket().

◆ SV_Savegame_f()

void SV_Savegame_f ( cmd_state_t * cmd)

Definition at line 188 of file sv_save.c.

189{
190 prvm_prog_t *prog = SVVM_prog;
191 char name[MAX_QPATH];
192
193 if (!sv.active)
194 {
195 Con_Print(CON_ERROR "Can't save - no server running.\n");
196 return;
197 }
198
199 if (Cmd_Argc(cmd) != 2)
200 {
201 Con_Print("save <savename> : save a game\n");
202 return;
203 }
204
205 if (strstr(Cmd_Argv(cmd, 1), ".."))
206 {
207 Con_Print(CON_ERROR "Relative pathnames are not allowed.\n");
208 return;
209 }
210
211 for (int i = 0; i < svs.maxclients; ++i)
212 if (svs.clients[i].active && PRVM_serveredictfloat(svs.clients[i].edict, deadflag))
213 {
214 Con_Print(CON_ERROR "Can't savegame with a dead player\n");
215 return;
216 }
217
218 // bones_was_here: intermission_running isn't declared in dpdefs, but it's used by
219 // id1 Quake, all Quake mods (afaict), Nexuiz and Xonotic.
220 if (PRVM_serverglobalfloat(intermission_running))
221 {
222 Con_Print(CON_ERROR "Can't save in intermission.\n");
223 return;
224 }
225
226 if (SV_IsLocalServer() != 1)
227 Con_Print(CON_WARN "Warning: saving a multiplayer game may have strange results when restored (to properly resume, all players must join in the same player slots and then the game can be reloaded).\n");
228
229 dp_strlcpy (name, Cmd_Argv(cmd, 1), sizeof (name));
230 FS_DefaultExtension (name, ".sav", sizeof (name));
231
232 SV_Savegame_to(prog, name);
233}
float deadflag
Definition progsdefs.qc:149
int SV_IsLocalServer(void)
Definition sv_main.c:1783
void SV_Savegame_to(prvm_prog_t *prog, const char *name)
Definition sv_save.c:35

References server_t::active, server_static_t::clients, cmd(), Cmd_Argc(), Cmd_Argv(), CON_ERROR, Con_Print(), CON_WARN, deadflag, dp_strlcpy, FS_DefaultExtension(), i, MAX_QPATH, server_static_t::maxclients, name, PRVM_serveredictfloat, PRVM_serverglobalfloat, sv, SV_IsLocalServer(), SV_Savegame_to(), svs, and SVVM_prog.

Referenced by SV_InitOperatorCommands().

◆ SV_Savegame_to()

void SV_Savegame_to ( prvm_prog_t * prog,
const char * name )

Definition at line 35 of file sv_save.c.

36{
37 qfile_t *f;
38 int i, k, l, numbuffers, lightstyles = 64;
39 char comment[SAVEGAME_COMMENT_LENGTH+1];
40 char line[MAX_INPUTLINE];
42 char *s;
43
44 // first we have to figure out if this can be saved in 64 lightstyles
45 // (for Quake compatibility)
46 for (i=64 ; i<MAX_LIGHTSTYLES ; i++)
47 if (sv.lightstyles[i][0])
48 lightstyles = i+1;
49
50 isserver = prog == SVVM_prog;
51
52 Con_Printf("Saving game to %s...\n", name);
53 f = FS_OpenRealFile(name, "wb", false);
54 if (!f)
55 {
56 Con_Print(CON_ERROR "ERROR: couldn't open.\n");
57 return;
58 }
59
61
62 memset(comment, 0, sizeof(comment));
63 if(isserver)
64 dpsnprintf(comment, sizeof(comment), "%-21.21s kills:%3i/%3i", PRVM_GetString(prog, PRVM_serveredictstring(prog->edicts, message)), (int)PRVM_serverglobalfloat(killed_monsters), (int)PRVM_serverglobalfloat(total_monsters));
65 else
66 dpsnprintf(comment, sizeof(comment), "(crash dump of %s progs)", prog->name);
67 // convert space to _ to make stdio happy
68 // LadyHavoc: convert control characters to _ as well
69 for (i=0 ; i<SAVEGAME_COMMENT_LENGTH ; i++)
70 if (ISWHITESPACEORCONTROL(comment[i]))
71 comment[i] = '_';
72 comment[SAVEGAME_COMMENT_LENGTH] = '\0';
73
74 FS_Printf(f, "%s\n", comment);
75 if(isserver)
76 {
77 for (i=0 ; i<NUM_SPAWN_PARMS ; i++)
78 FS_Printf(f, "%f\n", svs.clients[0].spawn_parms[i]);
79 FS_Printf(f, "%d\n", current_skill);
80 FS_Printf(f, "%s\n", sv.worldbasename);
81 FS_Printf(f, "%f\n",sv.time);
82 }
83 else
84 {
85 for (i=0 ; i<NUM_SPAWN_PARMS ; i++)
86 FS_Printf(f, "(dummy)\n");
87 FS_Printf(f, "%d\n", 0);
88 FS_Printf(f, "%s\n", "(dummy)");
89 FS_Printf(f, "%f\n", host.realtime);
90 }
91
92 // write the light styles
93 for (i=0 ; i<lightstyles ; i++)
94 {
95 if (isserver && sv.lightstyles[i][0])
96 FS_Printf(f, "%s\n", sv.lightstyles[i]);
97 else
98 FS_Print(f,"m\n");
99 }
100
101 PRVM_ED_WriteGlobals (prog, f);
102 for (i=0 ; i<prog->num_edicts ; i++)
103 {
104 FS_Printf(f,"// edict %d\n", i);
105 //Con_Printf("edict %d...\n", i);
107 }
108
109#if 1
110 FS_Printf(f,"/*\n");
111 FS_Printf(f,"// DarkPlaces extended savegame\n");
112 // darkplaces extension - extra lightstyles, support for color lightstyles
113 for (i=0 ; i<MAX_LIGHTSTYLES ; i++)
114 if (isserver && sv.lightstyles[i][0])
115 FS_Printf(f, "sv.lightstyles %i %s\n", i, sv.lightstyles[i]);
116
117 // darkplaces extension - model precaches
118 for (i=1 ; i<MAX_MODELS ; i++)
119 if (sv.model_precache[i][0])
120 FS_Printf(f,"sv.model_precache %i %s\n", i, sv.model_precache[i]);
121
122 // darkplaces extension - sound precaches
123 for (i=1 ; i<MAX_SOUNDS ; i++)
124 if (sv.sound_precache[i][0])
125 FS_Printf(f,"sv.sound_precache %i %s\n", i, sv.sound_precache[i]);
126
127 // darkplaces extension - save buffers
129 for (i = 0; i < numbuffers; i++)
130 {
132 if(stringbuffer && (stringbuffer->flags & STRINGBUFFER_SAVED))
133 {
134 FS_Printf(f,"sv.buffer %i %i \"string\"\n", i, stringbuffer->flags & STRINGBUFFER_QCFLAGS);
135 for(k = 0; k < stringbuffer->num_strings; k++)
136 {
137 if (!stringbuffer->strings[k])
138 continue;
139 // Parse the string a bit to turn special characters
140 // (like newline, specifically) into escape codes
141 s = stringbuffer->strings[k];
142 for (l = 0;l < (int)sizeof(line) - 2 && *s;)
143 {
144 if (*s == '\n')
145 {
146 line[l++] = '\\';
147 line[l++] = 'n';
148 }
149 else if (*s == '\r')
150 {
151 line[l++] = '\\';
152 line[l++] = 'r';
153 }
154 else if (*s == '\\')
155 {
156 line[l++] = '\\';
157 line[l++] = '\\';
158 }
159 else if (*s == '"')
160 {
161 line[l++] = '\\';
162 line[l++] = '"';
163 }
164 else
165 line[l++] = *s;
166 s++;
167 }
168 line[l] = '\0';
169 FS_Printf(f,"sv.bufstr %i %i \"%s\"\n", i, k, line);
170 }
171 }
172 }
173 FS_Printf(f,"*/\n");
174#endif
175
176 FS_Close (f);
177#ifdef __EMSCRIPTEN__
178 js_syncFS(false);
179#endif
180 Con_Print("done.\n");
181}
qfile_t * FS_OpenRealFile(const char *filepath, const char *mode, qbool quiet)
Definition fs.c:2901
int FS_Printf(qfile_t *file, const char *format,...)
Definition fs.c:3273
int FS_Print(qfile_t *file, const char *msg)
Definition fs.c:3261
float isserver(void)
float killed_monsters
Definition progsdefs.qc:40
float total_monsters
Definition progsdefs.qc:37
string message
Definition progsdefs.qc:205
#define STRINGBUFFER_QCFLAGS
Definition progsvm.h:497
void PRVM_ED_Write(prvm_prog_t *prog, struct qfile_s *f, prvm_edict_t *ed)
void PRVM_ED_WriteGlobals(prvm_prog_t *prog, struct qfile_s *f)
#define ISWHITESPACEORCONTROL(ch)
Definition qdefs.h:187
#define SAVEGAME_COMMENT_LENGTH
max comment length of savegame in menu
Definition qdefs.h:121
float f
const char * name
name of the prog, e.g. "Server", "Client" or "Menu" (used for text output)
Definition progsvm.h:700
char worldbasename[MAX_QPATH]
Definition server.h:109

References server_static_t::clients, CON_ERROR, Con_Print(), Con_Printf(), current_skill, dpsnprintf(), prvm_prog_t::edicts, f, prvm_stringbuffer_t::flags, FS_Close(), FS_OpenRealFile(), FS_Print(), FS_Printf(), host, i, int(), isserver(), ISWHITESPACEORCONTROL, killed_monsters, server_t::lightstyles, MAX_INPUTLINE, MAX_LIGHTSTYLES, MAX_MODELS, MAX_SOUNDS, Mem_ExpandableArray_IndexRange(), Mem_ExpandableArray_RecordAtIndex(), message, server_t::model_precache, name, prvm_prog_t::name, prvm_prog_t::num_edicts, NUM_SPAWN_PARMS, prvm_stringbuffer_t::num_strings, PRVM_ED_Write(), PRVM_ED_WriteGlobals(), PRVM_EDICT_NUM, PRVM_GetString(), PRVM_serveredictstring, PRVM_serverglobalfloat, host_static_t::realtime, SAVEGAME_COMMENT_LENGTH, SAVEGAME_VERSION, server_t::sound_precache, STRINGBUFFER_QCFLAGS, STRINGBUFFER_SAVED, prvm_prog_t::stringbuffersarray, prvm_stringbuffer_t::strings, sv, svs, SVVM_prog, server_t::time, total_monsters, and server_t::worldbasename.

Referenced by PRVM_Breakpoint(), PRVM_Crash(), and SV_Savegame_f().

◆ SV_SaveSpawnparms()

void SV_SaveSpawnparms ( void )

Definition at line 1761 of file sv_main.c.

1762{
1763 prvm_prog_t *prog = SVVM_prog;
1764 int i, j;
1765
1767
1768 for (i = 0, host_client = svs.clients;i < svs.maxclients;i++, host_client++)
1769 {
1770 if (!host_client->active)
1771 continue;
1772
1773 // call the progs to get default spawn parms for the new client
1776 prog->ExecuteProgram(prog, PRVM_serverfunction(SetChangeParms), "QC function SetChangeParms is missing");
1777 for (j=0 ; j<NUM_SPAWN_PARMS ; j++)
1779 }
1780}
float serverflags
Definition progsdefs.qc:33
int serverflags
episode completion information
Definition server.h:32

References client_t::active, server_static_t::clients, client_t::edict, prvm_prog_t::ExecuteProgram, host_client, i, int(), server_static_t::maxclients, NUM_SPAWN_PARMS, parm1, PRVM_EDICT_TO_PROG, PRVM_serverfunction, PRVM_serverglobaledict, PRVM_serverglobalfloat, self, server_static_t::serverflags, serverflags, client_t::spawn_parms, sv, svs, SVVM_prog, server_t::time, and time.

Referenced by SV_Changelevel_f().

◆ SV_SendClientMessages()

void SV_SendClientMessages ( void )

Definition at line 1697 of file sv_send.c.

1698{
1699 int i, prepared = false;
1700
1702 Sys_Error("SV_SendClientMessages: no quakeworld support\n");
1703
1705
1706// update frags, names, etc
1708
1709// build individual updates
1710 for (i = 0, host_client = svs.clients;i < svs.maxclients;i++, host_client++)
1711 {
1712 if (!host_client->active)
1713 continue;
1715 continue;
1716
1718 {
1719 SV_DropClient (true, "Buffer overflow in net message"); // if the message couldn't send, kick off
1720 continue;
1721 }
1722
1723 if (!prepared)
1724 {
1725 prepared = true;
1726 // only prepare entities once per frame
1728 }
1730 }
1731
1732// clear muzzle flashes
1734}
@ PROTOCOL_QUAKEWORLD
quakeworld protocol
Definition common.h:145
qbool overflowed
set to true if the buffer size failed
Definition common.h:51
static void SV_UpdateToReliableMessages(void)
Definition sv_send.c:1596
static void SV_CleanupEnts(void)
Definition sv_send.c:1074
void SV_FlushBroadcastMessages(void)
Definition sv_send.c:1371
static void SV_SendClientDatagram(client_t *client)
Definition sv_send.c:1425
static void SV_PrepareEntitiesForSending(void)
Definition sv_send.c:702
void Sys_Error(const char *error,...) DP_FUNC_PRINTF(1) DP_FUNC_NORETURN
Causes the entire program to exit ASAP.
Definition sys_shared.c:724

References client_t::active, server_static_t::clients, host_client, i, server_static_t::maxclients, netconn_t::message, client_t::netconnection, sizebuf_t::overflowed, server_t::protocol, PROTOCOL_QUAKEWORLD, sv, SV_CleanupEnts(), SV_DropClient(), SV_FlushBroadcastMessages(), SV_PrepareEntitiesForSending(), SV_SendClientDatagram(), SV_UpdateToReliableMessages(), svs, and Sys_Error().

Referenced by SV_Frame(), and SV_ThreadFunc().

◆ SV_SendServerinfo()

void SV_SendServerinfo ( client_t * client)

Definition at line 749 of file sv_main.c.

750{
751 prvm_prog_t *prog = SVVM_prog;
752 int i;
753 char message[128];
754 char vabuf[1024];
755
756 // we know that this client has a netconnection and thus is not a bot
757
758 // edicts get reallocated on level changes, so we need to update it here
759 client->edict = PRVM_EDICT_NUM((client - svs.clients) + 1);
760
761 // clear cached stuff that depends on the level
762 client->weaponmodel[0] = 0;
763 client->weaponmodelindex = 0;
764
765 // LadyHavoc: clear entityframe tracking
766 client->latestframenum = 0;
767
768 // initialize the movetime, so a speedhack can't make use of the time before this client joined
769 client->cmd.time = sv.time;
770
771 if (client->entitydatabase)
773 if (client->entitydatabase4)
775 if (client->entitydatabase5)
777
778 memset(client->stats, 0, sizeof(client->stats));
779 memset(client->statsdeltabits, 0, sizeof(client->statsdeltabits));
780
782 {
785 else if (sv.protocol == PROTOCOL_DARKPLACES4)
787 else
789 }
790
791 // reset csqc entity versions
792 for (i = 0;i < prog->max_edicts;i++)
793 {
794 client->csqcentityscope[i] = 0;
795 client->csqcentitysendflags[i] = 0xFFFFFF;
796 }
797 for (i = 0;i < NUM_CSQCENTITYDB_FRAMES;i++)
798 {
799 client->csqcentityframehistory[i].num = 0;
800 client->csqcentityframehistory[i].framenum = -1;
801 }
802 client->csqcnumedicts = 0;
803 client->csqcentityframehistory_next = 0;
804
805 SZ_Clear (&client->netconnection->message);
807 dpsnprintf (message, sizeof (message), "\nServer: %s (progs %i crc)\n", engineversion, prog->filecrc);
809
810 SV_StopDemoRecording(client); // to split up demos into different files
812 {
813 char demofile[MAX_OSPATH];
814 char ipaddress[MAX_QPATH];
815 char timestring[128];
816 size_t j;
817
818 // start a new demo file
819 LHNETADDRESS_ToString(&(client->netconnection->peeraddress), ipaddress, sizeof(ipaddress), true);
820 for(j = 0; ipaddress[j]; ++j)
821 if(!isalnum(ipaddress[j]))
822 ipaddress[j] = '-';
823 Sys_TimeString(timestring, sizeof(timestring), sv_autodemo_perclient_nameformat.string);
824 dpsnprintf(demofile, sizeof(demofile), "%s_%s_%d_%s.dem", timestring,
825 sv.worldbasename, PRVM_NUM_FOR_EDICT(client->edict), ipaddress);
826
827 SV_StartDemoRecording(client, demofile, -1);
828 }
829
830 //[515]: init csprogs according to version of svprogs, check the crc, etc.
831 if (sv.csqc_progname[0])
832 {
833 Con_DPrintf("sending csqc info to client (\"%s\" with size %i and crc %i)\n", sv.csqc_progname, sv.csqc_progsize, sv.csqc_progcrc);
835 MSG_WriteString (&client->netconnection->message, va(vabuf, sizeof(vabuf), "csqc_progname %s\n", sv.csqc_progname));
837 MSG_WriteString (&client->netconnection->message, va(vabuf, sizeof(vabuf), "csqc_progsize %i\n", sv.csqc_progsize));
839 MSG_WriteString (&client->netconnection->message, va(vabuf, sizeof(vabuf), "csqc_progcrc %i\n", sv.csqc_progcrc));
840
841 if(client->sv_demo_file != NULL)
842 {
843 int k;
844 static char buf[NET_MAXMESSAGE];
845 sizebuf_t sb;
846
847 sb.data = (unsigned char *) buf;
848 sb.maxsize = sizeof(buf);
849 k = 0;
851 SV_WriteDemoMessage(client, &sb, false);
852 }
853
854 //[515]: init stufftext string (it is sent before svc_serverinfo)
855 if (PRVM_GetString(prog, PRVM_serverglobalstring(SV_InitCmd)))
856 {
858 MSG_WriteString (&client->netconnection->message, va(vabuf, sizeof(vabuf), "%s\n", PRVM_GetString(prog, PRVM_serverglobalstring(SV_InitCmd))));
859 }
860 }
861
862 //if (sv_allowdownloads.integer)
863 // always send the info that the server supports the protocol, even if downloads are forbidden
864 // only because of that, the CSQC exception can work
865 {
867 MSG_WriteString (&client->netconnection->message, "cl_serverextension_download 2\n");
868 }
869
870 // send at this time so it's guaranteed to get executed at the right time
871 {
872 client_t *save;
873 save = host_client;
874 host_client = client;
876 host_client = save;
877 }
878
882
885 else
887
889
890 for (i = 1;i < MAX_MODELS && sv.model_precache[i][0];i++)
892 MSG_WriteByte (&client->netconnection->message, 0);
893
894 for (i = 1;i < MAX_SOUNDS && sv.sound_precache[i][0];i++)
896 MSG_WriteByte (&client->netconnection->message, 0);
897
898// send music
902
903// set view
904// store this in clientcamera, too
905 client->clientcamera = PRVM_NUM_FOR_EDICT(client->edict);
908
910 MSG_WriteByte (&client->netconnection->message, 1);
911
912 client->prespawned = false; // need prespawn, spawn, etc
913 client->spawned = false; // need prespawn, spawn, etc
914 client->begun = false; // need prespawn, spawn, etc
915 client->sendsignon = 1; // send this message, and increment to 2, 2 will be set to 0 by the prespawn command
916
917 // clear movement info until client enters the new level properly
918 memset(&client->cmd, 0, sizeof(client->cmd));
919 client->movesequence = 0;
921 memset(&client->movement_count, 0, sizeof(client->movement_count));
922 client->ping = 0;
923
924 // allow the client some time to send his keepalives, even if map loading took ages
926}
entityframe4_database_t * EntityFrame4_AllocDatabase(mempool_t *pool)
Definition com_ents4.c:4
entityframe_database_t * EntityFrame_AllocDatabase(mempool_t *mempool)
Definition com_ents.c:5
void MSG_WriteLong(sizebuf_t *sb, int c)
Definition com_msg.c:147
char * va(char *buf, size_t buflen, const char *format,...)
Definition common.c:972
qbool MakeDownloadPacket(const char *filename, unsigned char *data, size_t len, int crc, int cnt, sizebuf_t *buf, int protocol)
Definition csprogs.c:940
char engineversion[128]
version string for the corner of the console, crash messages, status command, etc
Definition host.c:304
int LHNETADDRESS_ToString(const lhnetaddress_t *vaddress, char *string, int stringbuffersize, int includeport)
Returns the number of bytes written to *string excluding the \0 terminator.
Definition lhnet.c:540
void Curl_SendRequirements(void)
Definition libcurl.c:1853
float sounds
Definition progsdefs.qc:207
int Protocol_NumberForEnum(protocolversion_t p)
Definition protocol.c:95
#define GAME_COOP
Definition protocol.h:203
#define svc_setview
Definition protocol.h:219
#define GAME_DEATHMATCH
Definition protocol.h:204
entityframe5_database_t * EntityFrame5_AllocDatabase(struct mempool_s *pool)
#define svc_serverinfo
Definition protocol.h:227
#define svc_cdtrack
Definition protocol.h:259
#define MAX_OSPATH
max length of a filesystem pathname
Definition qdefs.h:175
#define NET_MAXMESSAGE
max reliable packet size (sent as multiple fragments of MAX_PACKETFRAGMENT)
Definition qdefs.h:103
#define NUM_CSQCENTITYDB_FRAMES
Definition server.h:254
char weaponmodel[MAX_QPATH]
cache weaponmodel name lookups
Definition server.h:266
csqcentityframedb_t csqcentityframehistory[NUM_CSQCENTITYDB_FRAMES]
Definition server.h:255
unsigned int movesequence
Definition server.h:212
unsigned char csqcentityscope[MAX_EDICTS]
Definition server.h:251
int csqcnumedicts
Definition server.h:250
unsigned int csqcentitysendflags[MAX_EDICTS]
Definition server.h:252
int weaponmodelindex
Definition server.h:267
int csqcentityframehistory_next
Definition server.h:256
int clientcamera
clientcamera (entity to use as camera)
Definition server.h:270
int stats[MAX_CL_STATS]
Definition server.h:278
qfile_t * sv_demo_file
demo recording
Definition server.h:297
unsigned int movement_highestsequence_seen
Definition server.h:214
unsigned char statsdeltabits[(MAX_CL_STATS+7)/8]
Definition server.h:277
const char * string
Definition cvar.h:71
double timeout
Definition netconn.h:153
lhnetaddress_t peeraddress
Definition netconn.h:147
unsigned short filecrc
Definition progsvm.h:631
unsigned char * csqc_progdata
Definition server.h:39
int csqc_progsize
Definition server.h:102
int csqc_progcrc
Definition server.h:101
char csqc_progname[MAX_QPATH]
Definition server.h:103
double time
Definition protocol.h:392
void SV_StartDemoRecording(client_t *client, const char *filename, int forcetrack)
Definition sv_demo.c:6
cvar_t net_connecttimeout
Definition netconn.c:82
size_t Sys_TimeString(char buf[], size_t bufsize, const char *timeformat)
Definition sys_shared.c:45

References client_t::begun, buf, client_t::clientcamera, server_static_t::clients, client_t::cmd, Con_DPrintf(), coop, server_t::csqc_progcrc, server_static_t::csqc_progdata, server_t::csqc_progname, server_t::csqc_progsize, client_t::csqcentityframehistory, client_t::csqcentityframehistory_next, client_t::csqcentityscope, client_t::csqcentitysendflags, client_t::csqcnumedicts, Curl_SendRequirements(), sizebuf_t::data, deathmatch, dpsnprintf(), client_t::edict, prvm_prog_t::edicts, engineversion, client_t::entitydatabase, client_t::entitydatabase4, client_t::entitydatabase5, EntityFrame4_AllocDatabase(), EntityFrame4_FreeDatabase(), EntityFrame5_AllocDatabase(), EntityFrame5_FreeDatabase(), EntityFrame_AllocDatabase(), EntityFrame_FreeDatabase(), prvm_prog_t::filecrc, csqcentityframedb_t::framenum, GAME_COOP, GAME_DEATHMATCH, host, host_client, i, cvar_t::integer, client_t::latestframenum, LHNETADDRESS_ToString(), MakeDownloadPacket(), prvm_prog_t::max_edicts, MAX_MODELS, MAX_OSPATH, MAX_QPATH, MAX_SOUNDS, server_static_t::maxclients, sizebuf_t::maxsize, message, netconn_t::message, server_t::model_precache, client_t::movement_count, client_t::movement_highestsequence_seen, client_t::movesequence, MSG_WriteByte(), MSG_WriteLong(), MSG_WriteShort(), MSG_WriteString(), net_connecttimeout, NET_MAXMESSAGE, client_t::netconnection, NULL, csqcentityframedb_t::num, NUM_CSQCENTITYDB_FRAMES, netconn_t::peeraddress, client_t::ping, client_t::prespawned, server_t::protocol, PROTOCOL_DARKPLACES1, PROTOCOL_DARKPLACES2, PROTOCOL_DARKPLACES3, PROTOCOL_DARKPLACES4, PROTOCOL_NEHAHRABJP, PROTOCOL_NEHAHRABJP2, PROTOCOL_NEHAHRABJP3, PROTOCOL_NEHAHRAMOVIE, Protocol_NumberForEnum(), PROTOCOL_QUAKE, PROTOCOL_QUAKEDP, PRVM_EDICT_NUM, PRVM_GetString(), PRVM_NUM_FOR_EDICT, PRVM_serveredictfloat, PRVM_serveredictstring, PRVM_serverglobalstring, host_static_t::realtime, client_t::sendsignon, server_t::sound_precache, sounds, client_t::spawned, client_t::stats, client_t::statsdeltabits, cvar_t::string, sv, sv_autodemo_perclient, sv_autodemo_perclient_nameformat, client_t::sv_demo_file, sv_mempool, SV_StartDemoRecording(), SV_StopDemoRecording(), SV_WriteDemoMessage(), svc_cdtrack, svc_print, svc_serverinfo, svc_setview, svc_signonnum, svc_stufftext, svs, SVVM_prog, Sys_TimeString(), SZ_Clear(), server_t::time, usercmd_t::time, netconn_t::timeout, va(), cvar_t::value, client_t::weaponmodel, client_t::weaponmodelindex, and server_t::worldbasename.

Referenced by NetConn_ServerParsePacket(), SV_ConnectClient(), and SV_SpawnServer().

◆ SV_SetIdealPitch()

void SV_SetIdealPitch ( void )

Definition at line 239 of file sv_user.c.

240{
241 prvm_prog_t *prog = SVVM_prog;
242 float angleval, sinval, cosval, step, dir;
243 trace_t tr;
244 vec3_t top, bottom;
245 float z[MAX_FORWARD];
246 int i, j;
247 int steps;
248
250 return;
251
252 angleval = PRVM_serveredictvector(host_client->edict, angles)[YAW] * M_PI*2 / 360;
253 sinval = sin(angleval);
254 cosval = cos(angleval);
255
256 for (i=0 ; i<MAX_FORWARD ; i++)
257 {
258 top[0] = PRVM_serveredictvector(host_client->edict, origin)[0] + cosval*(i+3)*12;
259 top[1] = PRVM_serveredictvector(host_client->edict, origin)[1] + sinval*(i+3)*12;
261
262 bottom[0] = top[0];
263 bottom[1] = top[1];
264 bottom[2] = top[2] - 160;
265
267 // if looking at a wall, leave ideal the way is was
268 if (tr.startsolid)
269 return;
270
271 // near a dropoff
272 if (tr.fraction == 1)
273 return;
274
275 z[i] = top[2] + tr.fraction*(bottom[2]-top[2]);
276 }
277
278 dir = 0;
279 steps = 0;
280 for (j=1 ; j<i ; j++)
281 {
282 step = z[j] - z[j-1];
283 if (step > -ON_EPSILON && step < ON_EPSILON)
284 continue;
285
286 // mixed changes
287 if (dir && ( step-dir > ON_EPSILON || step-dir < -ON_EPSILON ) )
288 return;
289
290 steps++;
291 dir = step;
292 }
293
294 if (!dir)
295 {
297 return;
298 }
299
300 if (steps < 2)
301 return;
303}
float idealpitch
GLubyte GLubyte GLubyte z
Definition glquake.h:782
#define M_PI
Definition mathlib.h:28
float cos(float f)
float sin(float f)
#define ON_EPSILON
point on plane side epsilon
Definition qdefs.h:178
cvar_t sv_idealpitchscale
Definition sv_main.c:136
vec2 dir
#define MAX_FORWARD
Definition sv_user.c:238

References angles, collision_extendmovelength, cos(), dir, client_t::edict, FL_ONGROUND, flags, trace_t::fraction, host_client, i, idealpitch, M_PI, MAX_FORWARD, MOVE_NOMONSTERS, ON_EPSILON, origin, PRVM_serveredictfloat, PRVM_serveredictvector, sin(), trace_t::startsolid, SUPERCONTENTS_SOLID, sv_idealpitchscale, SV_TraceLine(), SVVM_prog, cvar_t::value, view_ofs, YAW, and z.

Referenced by SV_WriteClientdataToMessage().

◆ SV_SetupVM()

void SV_SetupVM ( void )

◆ SV_Shutdown()

void SV_Shutdown ( void )

Definition at line 2128 of file sv_main.c.

2129{
2130 int i;
2131
2133
2134 if (!sv.active)
2135 goto end;
2136
2137 Con_DPrintf("SV_Shutdown\n");
2138
2141
2142 // make sure all the clients know we're disconnecting
2143 for (i = 0, host_client = svs.clients;i < svs.maxclients;i++, host_client++)
2144 if (host_client->active)
2145 SV_DropClient(false, "Server shutting down"); // server shutdown
2146
2147 SV_VM_Shutdown(true);
2148
2150
2151 sv.active = false;
2152//
2153// clear structures
2154//
2155 memset(&sv, 0, sizeof(sv));
2156 memset(svs.clients, 0, svs.maxclients*sizeof(client_t));
2157end:
2159}
void NetConn_CloseServerPorts(void)
Definition netconn.c:1121
#define SV_LockThreadMutex()
Definition server.h:606
#define SV_UnlockThreadMutex()
Definition server.h:607
static void SV_VM_Shutdown(qbool prog_reset)
Definition sv_main.c:1788
void SV_DropClient(qbool leaving, const char *fmt,...)
Definition sv_main.c:1018

References client_t::active, server_t::active, server_static_t::clients, Con_DPrintf(), host_client, i, server_static_t::maxclients, NetConn_CloseServerPorts(), NetConn_Heartbeat(), sv, SV_DropClient(), SV_LockThreadMutex, SV_UnlockThreadMutex, SV_VM_Shutdown(), and svs.

Referenced by PRVM_Crash(), SV_Init(), SV_Map_f(), and SV_VM_Shutdown().

◆ SV_SoundIndex()

int SV_SoundIndex ( const char * s,
int precachemode )

Definition at line 1474 of file sv_main.c.

1475{
1477 char filename[MAX_QPATH];
1478 if (!s || !*s)
1479 return 0;
1480 // testing
1481 //if (precachemode == 2)
1482 // return 0;
1483 dp_strlcpy(filename, s, sizeof(filename));
1484 for (i = 1;i < limit;i++)
1485 {
1486 if (!sv.sound_precache[i][0])
1487 {
1488 if (precachemode)
1489 {
1491 {
1492 Con_Printf("SV_SoundIndex(\"%s\"): precache_sound can only be done in spawn functions\n", filename);
1493 return 0;
1494 }
1495 if (precachemode == 1)
1496 Con_Printf("SV_SoundIndex(\"%s\"): not precached (fix your code), precaching anyway\n", filename);
1497 dp_strlcpy(sv.sound_precache[i], filename, sizeof(sv.sound_precache[i]));
1498 if (sv.state != ss_loading)
1499 {
1503 }
1504 return i;
1505 }
1506 Con_Printf("SV_SoundIndex(\"%s\"): not precached\n", filename);
1507 return 0;
1508 }
1509 if (!strcmp(sv.sound_precache[i], filename))
1510 return i;
1511 }
1512 Con_Printf("SV_SoundIndex(\"%s\"): i (%i) == MAX_SOUNDS (%i)\n", filename, i, MAX_SOUNDS);
1513 return 0;
1514}

References Con_Printf(), dp_strlcpy, i, MAX_QPATH, MAX_SOUNDS, MSG_WriteByte(), MSG_WriteShort(), MSG_WriteString(), server_t::protocol, PROTOCOL_DARKPLACES1, PROTOCOL_DARKPLACES2, PROTOCOL_DARKPLACES3, PROTOCOL_DARKPLACES4, PROTOCOL_DARKPLACES5, PROTOCOL_NEHAHRABJP, PROTOCOL_NEHAHRABJP2, PROTOCOL_NEHAHRABJP3, PROTOCOL_NEHAHRAMOVIE, PROTOCOL_QUAKE, PROTOCOL_QUAKEDP, server_t::reliable_datagram, server_t::sound_precache, ss_loading, server_t::state, sv, and svc_precache.

Referenced by SV_StartPointSound(), SV_StartSound(), VM_SV_ambientsound(), and VM_SV_precache_sound().

◆ SV_Spawn_f()

void SV_Spawn_f ( cmd_state_t * cmd)

Definition at line 62 of file sv_user.c.

63{
64 prvm_prog_t *prog = SVVM_prog;
65 int i;
66 client_t *client;
67 int stats[MAX_CL_STATS];
68
70 {
71 Con_Print("Spawn not valid -- not yet prespawned\n");
72 return;
73 }
75 {
76 Con_Print("Spawn not valid -- already spawned\n");
77 return;
78 }
79 host_client->spawned = true;
80
81 // reset name change timer again because they might want to change name
82 // again in the first 5 seconds after connecting
84
85 // LadyHavoc: moved this above the QC calls at FrikaC's request
86 // LadyHavoc: commented this out
87 //if (host_client->netconnection)
88 // SZ_Clear (&host_client->netconnection->message);
89
90 // run the entrance script
91 if (sv.loadgame)
92 {
93 // loaded games are fully initialized already
94 if (PRVM_serverfunction(RestoreGame))
95 {
96 Con_DPrint("Calling RestoreGame\n");
99 prog->ExecuteProgram(prog, PRVM_serverfunction(RestoreGame), "QC function RestoreGame is missing");
100 }
101 }
102 else
103 {
104 //Con_Printf("SV_Spawn_f: host_client->edict->netname = %s, host_client->edict->netname = %s, host_client->name = %s\n", PRVM_GetString(PRVM_serveredictstring(host_client->edict, netname)), PRVM_GetString(PRVM_serveredictstring(host_client->edict, netname)), host_client->name);
105
106 // copy spawn parms out of the client_t
107 for (i=0 ; i< NUM_SPAWN_PARMS ; i++)
109
110 // call the spawn function
114 prog->ExecuteProgram(prog, PRVM_serverfunction(ClientConnect), "QC function ClientConnect is missing");
115
116 Con_Printf("%s connected\n", host_client->name);
117
119 prog->ExecuteProgram(prog, PRVM_serverfunction(PutClientInServer), "QC function PutClientInServer is missing");
120 }
121
123 return;
124
125 // send time of update
128
129 // send all current names, colors, and frag counts
130 for (i = 0, client = svs.clients;i < svs.maxclients;i++, client++)
131 {
132 if (!client->active)
133 continue;
143 }
144
145 // send all current light styles
146 for (i=0 ; i<MAX_LIGHTSTYLES ; i++)
147 {
148 if (sv.lightstyles[i][0])
149 {
153 }
154 }
155
156 // send some stats
160
164
168
172
173 // send a fixangle
174 // Never send a roll angle, because savegames can catch the server
175 // in a state where it is expecting the client to correct the angle
176 // and it won't happen if the game was just loaded, so you wind up
177 // with a permanent head tilt
178 if (sv.loadgame)
179 {
184 }
185 else
186 {
191 }
192
194
197}
void MSG_WriteFloat(sizebuf_t *sb, float f)
Definition com_msg.c:158
void MSG_WriteAngle(sizebuf_t *sb, float f, protocolversion_t protocol)
Definition com_msg.c:237
void Con_DPrint(const char *msg)
A Con_Print that only shows up if the "developer" cvar is set.
Definition console.c:1531
float total_secrets
Definition progsdefs.qc:36
float found_secrets
Definition progsdefs.qc:39
#define svc_setangle
Definition protocol.h:225
#define svc_updatestat
Definition protocol.h:217
#define svc_time
Definition protocol.h:221
#define svc_lightstyle
Definition protocol.h:231
#define STAT_TOTALMONSTERS
Definition qstats.h:20
#define STAT_MONSTERS
bumped by svc_killedmonster
Definition qstats.h:22
#define STAT_SECRETS
bumped on client side by svc_foundsecret
Definition qstats.h:21
#define STAT_TOTALSECRETS
Definition qstats.h:19
#define MAX_CL_STATS
Definition qstats.h:7
void SV_WriteClientdataToMessage(client_t *client, prvm_edict_t *ent, sizebuf_t *msg, int *stats)
Definition sv_send.c:1091

References client_t::active, angles, client_t::clientconnectcalled, server_static_t::clients, client_t::colors, Con_DPrint(), Con_Print(), Con_Printf(), client_t::edict, prvm_prog_t::ExecuteProgram, found_secrets, client_t::frags, host_client, i, killed_monsters, server_t::lightstyles, server_t::loadgame, MAX_CL_STATS, MAX_LIGHTSTYLES, server_static_t::maxclients, netconn_t::message, MSG_WriteAngle(), MSG_WriteByte(), MSG_WriteFloat(), MSG_WriteLong(), MSG_WriteShort(), MSG_WriteString(), client_t::name, client_t::nametime, client_t::netconnection, NUM_SPAWN_PARMS, parm1, client_t::prespawned, server_t::protocol, PRVM_EDICT_TO_PROG, PRVM_serveredictvector, PRVM_serverfunction, PRVM_serverglobaledict, PRVM_serverglobalfloat, self, client_t::spawn_parms, client_t::spawned, STAT_MONSTERS, STAT_SECRETS, STAT_TOTALMONSTERS, STAT_TOTALSECRETS, sv, SV_WriteClientdataToMessage(), svc_lightstyle, svc_setangle, svc_signonnum, svc_time, svc_updatecolors, svc_updatefrags, svc_updatename, svc_updatestat, svs, SVVM_prog, server_t::time, time, total_monsters, total_secrets, and v_angle.

Referenced by SV_InitOperatorCommands().

◆ SV_SpawnServer()

void SV_SpawnServer ( const char * map)

Definition at line 1811 of file sv_main.c.

1812{
1813 prvm_prog_t *prog = SVVM_prog;
1814 prvm_edict_t *ent;
1815 int i;
1816 char *entities;
1817 model_t *worldmodel;
1818 char modelname[sizeof(sv.worldname)];
1819 const char *canonicalname;
1820 char vabuf[1024];
1821
1822 Con_Printf("SpawnServer: %s\n", map);
1823
1824 dpsnprintf (modelname, sizeof(modelname), "maps/%s.bsp", map);
1825
1826 if (!(canonicalname = FS_FileExists(modelname)))
1827 {
1828 dpsnprintf (modelname, sizeof(modelname), "maps/%s", map);
1829 if (!(canonicalname = FS_FileExists(modelname)))
1830 {
1831 Con_Printf(CON_ERROR "SpawnServer: no map file named %s.bsp\n", modelname);
1832 return;
1833 }
1834 }
1835 // if it's not in a pak canonicalname will be the same pointer as modelname
1836 // if it's in a pak canonicalname may differ by case
1837 if (modelname != canonicalname)
1838 dp_strlcpy(modelname, canonicalname, sizeof(modelname));
1839
1840// SV_LockThreadMutex();
1841
1844 else
1845 {
1848 }
1849
1850 if(sv.active)
1851 SV_VM_Shutdown(false);
1852
1853 // free q3 shaders so that any newly downloaded shaders will be active
1855
1856 worldmodel = Mod_ForName(modelname, false, developer.integer > 0, NULL);
1857 if (!worldmodel || !worldmodel->TraceBox)
1858 {
1859 Con_Printf(CON_ERROR "Couldn't load map %s\n", modelname);
1860
1863
1864// SV_UnlockThreadMutex();
1865
1866 return;
1867 }
1868
1870
1871 // let's not have any servers with no name
1872 if (hostname.string[0] == 0)
1873 Cvar_SetQuick(&hostname, "UNNAMED");
1875
1876 svs.changelevel_issued = false; // now safe to issue another
1877
1878 // make the map a required file for clients
1880 Curl_RequireFile(modelname);
1881
1882//
1883// tell all connected clients that we are going to a new level
1884//
1885 if (sv.active)
1886 {
1887 client_t *client;
1888 for (i = 0, client = svs.clients;i < svs.maxclients;i++, client++)
1889 {
1890 if (client->netconnection)
1891 {
1893 MSG_WriteString(&client->netconnection->message, "reconnect\n");
1894 }
1895 }
1896 }
1897 else
1898 {
1899 // open server port
1901 }
1902
1903//
1904// make cvars consistant
1905//
1906 if (coop.integer)
1908 // LadyHavoc: it can be useful to have skills outside the range 0-3...
1909 //current_skill = bound(0, (int)(skill.value + 0.5), 3);
1910 //Cvar_SetValue ("skill", (float)current_skill);
1911 current_skill = (int)(skill.value + 0.5);
1912
1913//
1914// set up the new server
1915//
1916 memset (&sv, 0, sizeof(sv));
1917
1918 // tell SV_Frame() to reset its timers
1920
1921 // if running a local client, make sure it doesn't try to access the last
1922 // level's data which is no longer valiud
1923 cls.signon = 0;
1924
1928
1930 {
1931 srand(sv_random_seed.integer);
1932 Con_Printf(CON_WARN "NOTE: random seed is %d; use for debugging/benchmarking only!\nUnset sv_random_seed to get real random numbers again.\n", sv_random_seed.integer);
1933 }
1934
1935 SV_VM_Setup();
1936
1937 sv.active = true;
1938
1939 // set level base name variables for later use
1940 dp_strlcpy(sv.worldname, modelname, sizeof(sv.worldname));
1943// dp_strlcpy(sv.name, sv.worldbasename, sizeof (sv.name)); // TODO can we just remove this now?
1944 //Cvar_SetQuick(&sv_worldmessage, sv.worldmessage); // set later after QC is spawned
1948
1951 {
1952 char buffer[1024];
1953 Protocol_Names(buffer, sizeof(buffer));
1954 Con_Printf(CON_ERROR "Unknown sv_protocolname \"%s\", valid values are:\n%s\n", sv_protocolname.string, buffer);
1956 }
1957
1958// load progs to get entity field count
1959 //PR_LoadProgs ( sv_progs.string );
1960
1961 sv.datagram.maxsize = sizeof(sv.datagram_buf);
1962 sv.datagram.cursize = 0;
1964
1968
1969 sv.signon.maxsize = sizeof(sv.signon_buf);
1970 sv.signon.cursize = 0;
1972
1973// leave slots at start for clients only
1974 //prog->num_edicts = svs.maxclients+1;
1975
1977 prog->allowworldwrites = true;
1978 sv.paused = false;
1979
1980 sv.time = 1.0;
1981
1982 Mod_ClearUsed();
1983 worldmodel->used = true;
1984
1985 sv.worldmodel = worldmodel;
1986 sv.models[1] = sv.worldmodel;
1987
1988//
1989// clear world interaction links
1990//
1991 World_SetSize(&sv.world, sv.worldname, sv.worldmodel->normalmins, sv.worldmodel->normalmaxs, prog);
1993
1994 dp_strlcpy(sv.sound_precache[0], "", sizeof(sv.sound_precache[0]));
1995
1996 dp_strlcpy(sv.model_precache[0], "", sizeof(sv.model_precache[0]));
1998 for (i = 1;i < sv.worldmodel->brush.numsubmodels && i+1 < MAX_MODELS;i++)
1999 {
2000 dpsnprintf(sv.model_precache[i+1], sizeof(sv.model_precache[i+1]), "*%i", i);
2001 sv.models[i+1] = Mod_ForName (sv.model_precache[i+1], false, false, sv.worldname);
2002 }
2003 if(i < sv.worldmodel->brush.numsubmodels)
2004 Con_Printf(CON_WARN "Too many submodels (MAX_MODELS is %i)\n", MAX_MODELS);
2005
2006//
2007// load the rest of the entities
2008//
2009 // AK possible hack since num_edicts is still 0
2010 ent = PRVM_EDICT_NUM(0);
2011 memset (ent->fields.fp, 0, prog->entityfields * sizeof(prvm_vec_t));
2012 ent->free = false;
2014 PRVM_serveredictfloat(ent, modelindex) = 1; // world model
2021
2022 if (coop.value)
2024 else
2026
2028
2029// serverflags are for cross level information (sigils)
2031
2032 // we need to reset the spawned flag on all connected clients here so that
2033 // their thinks don't run during startup (before PutClientInServer)
2034 // we also need to set up the client entities now
2035 // and we need to set the ->edict pointers to point into the progs edicts
2036 for (i = 0, host_client = svs.clients;i < svs.maxclients;i++, host_client++)
2037 {
2038 host_client->begun = false;
2041 }
2042
2043 // load replacement entity file if found
2044 if (sv_entpatch.integer && (entities = (char *)FS_LoadFile(va(vabuf, sizeof(vabuf), "%s.ent", sv.worldnamenoextension), tempmempool, true, NULL)))
2045 {
2046 Con_Printf("Loaded %s.ent\n", sv.worldnamenoextension);
2047 PRVM_ED_LoadFromFile(prog, entities);
2048 Mem_Free(entities);
2049 }
2050 else
2051 PRVM_ED_LoadFromFile(prog, sv.worldmodel->brush.entities);
2052
2053
2054 // LadyHavoc: clear world angles (to fix e3m3.bsp)
2056
2057// all setup is completed, any further precache statements are errors
2058// sv.state = ss_active; // LadyHavoc: workaround for svc_precache bug
2059 prog->allowworldwrites = false;
2060
2061// run two frames to allow everything to settle
2062 sv.time = 1.0001;
2063 for (i = 0;i < sv_init_frame_count.integer;i++)
2064 {
2065 sv.frametime = 0.1;
2066 SV_Physics ();
2067 }
2068
2069 // Once all init frames have been run, we consider svqc code fully initialized.
2070 prog->inittime = host.realtime;
2071
2074
2075// create a baseline for more efficient communications
2078
2079 sv.state = ss_active; // LadyHavoc: workaround for svc_precache bug
2080
2081// send serverinfo to all connected clients, and set up botclients coming back from a level change
2082 for (i = 0, host_client = svs.clients;i < svs.maxclients;i++, host_client++)
2083 {
2084 host_client->clientconnectcalled = false; // do NOT call ClientDisconnect if he drops before ClientConnect!
2085 if (!host_client->active)
2086 continue;
2089 else
2090 {
2091 int j;
2092 // if client is a botclient coming from a level change, we need to
2093 // set up client info that normally requires networking
2094
2095 // copy spawn parms out of the client_t
2096 for (j=0 ; j< NUM_SPAWN_PARMS ; j++)
2098
2099 // call the spawn function
2103 prog->ExecuteProgram(prog, PRVM_serverfunction(ClientConnect), "QC function ClientConnect is missing");
2104 prog->ExecuteProgram(prog, PRVM_serverfunction(PutClientInServer), "QC function PutClientInServer is missing");
2105 host_client->begun = true;
2106 }
2107 }
2108
2109 // update the map title cvar (not related to filename)
2111
2112 Con_Printf("Server spawned.\n");
2114
2117
2118// SV_UnlockThreadMutex();
2119}
void SCR_BeginLoadingPlaque(qbool startup)
Definition cl_screen.c:1838
void Collision_Cache_Reset(qbool resetlimits)
Definition collision.c:1480
@ PROTOCOL_UNKNOWN
Definition common.h:133
void Cvar_SetQuick(cvar_t *var, const char *value)
Definition cvar.c:436
void FS_StripExtension(const char *in, char *out, size_t size_out)
Definition fs.c:3611
const char * FS_FileExists(const char *filename)
Look for a file in the packages and in the filesystem Returns its canonical name (same case as used i...
Definition fs.c:3693
GLuint buffer
Definition glquake.h:630
void Curl_ClearRequirements(void)
Definition libcurl.c:1795
void Curl_RequireFile(const char *filename)
Definition libcurl.c:1779
void Mod_ClearUsed(void)
void Mod_PurgeUnused(void)
void Mod_FreeQ3Shaders(void)
void NetConn_OpenServerPorts(int opennetports)
Definition netconn.c:1168
cvar_t hostname
Definition netconn.c:88
void PRVM_ED_LoadFromFile(prvm_prog_t *prog, const char *data)
protocolversion_t Protocol_EnumForName(const char *s)
Definition protocol.c:68
void Protocol_Names(char *buffer, size_t buffersize)
Definition protocol.c:104
#define MOVETYPE_PUSH
no clip to world, push and crush
Definition server.h:319
void S_StopAllSounds(void)
Definition snd_main.c:1710
model_brush_t brush
void(* TraceBox)(struct model_s *model, const struct frameblend_s *frameblend, const struct skeleton_s *skeleton, struct trace_s *trace, const vec3_t start, const vec3_t boxmins, const vec3_t boxmaxs, const vec3_t end, int hitsupercontentsmask, int skipsupercontentsmask, int skipmaterialflagsmask)
qbool used
double inittime
system time when QC initialization code finished (any entity created before is not a leak)
Definition progsvm.h:539
qbool allowworldwrites
allow writing to world entity fields, this is set by server init and cleared before first server fram...
Definition progsvm.h:697
qbool changelevel_issued
cleared when at SV_SpawnServer
Definition server.h:34
unsigned char reliable_datagram_buf[NET_MAXMESSAGE]
Definition server.h:131
unsigned char signon_buf[NET_MAXMESSAGE]
LadyHavoc: increased signon message buffer from 8192.
Definition server.h:135
unsigned char datagram_buf[NET_MAXMESSAGE]
Definition server.h:127
vec3_t maxs
Definition world.h:72
vec3_t mins
Definition world.h:71
static void SV_VM_Setup(void)
Definition sv_main.c:2314
static void SV_CreateBaseline(void)
Definition sv_main.c:1628
float scr_centertime_off
Definition cl_screen.c:129
void Sys_MakeProcessNice(void)
Definition sys_shared.c:958
void Sys_MakeProcessMean(void)
Definition sys_shared.c:961
void World_SetSize(world_t *world, const char *filename, const vec3_t mins, const vec3_t maxs, prvm_prog_t *prog)
Definition world.c:118
void World_Start(world_t *world)
Definition world.c:59

References absmax, absmin, client_t::active, server_t::active, prvm_prog_t::allowworldwrites, angles, client_t::begun, model_t::brush, buffer, server_static_t::changelevel_issued, client_t::clientconnectcalled, server_static_t::clients, cls, Collision_Cache_Reset(), CON_ERROR, Con_Printf(), CON_WARN, coop, Curl_ClearRequirements(), Curl_RequireFile(), current_skill, sizebuf_t::cursize, Cvar_SetQuick(), Cvar_SetValueQuick(), sizebuf_t::data, server_t::datagram, server_t::datagram_buf, deathmatch, developer, dp_strlcpy, dpsnprintf(), client_t::edict, prvm_prog_t::edicts, prvm_prog_t::entityfields, prvm_prog_t::ExecuteProgram, prvm_edict_t::fields, prvm_edict_t::fp, host_static_t::framecount, server_t::frametime, prvm_edict_t::free, FS_FileExists(), FS_LoadFile(), FS_StripExtension(), halflifebsp, host, host_client, host_isclient, hostname, i, prvm_prog_t::inittime, int(), cvar_t::integer, model_brush_t::ishlbsp, model_brush_t::isq2bsp, model_brush_t::isq3bsp, mapname, MAX_MODELS, server_static_t::maxclients, maxs, world_t::maxs, sizebuf_t::maxsize, Mem_Free, message, netconn_t::message, mins, world_t::mins, Mod_ClearUsed(), Mod_ForName(), Mod_FreeQ3Shaders(), Mod_PurgeUnused(), model, server_t::model_precache, modelindex, server_t::models, movetype, MOVETYPE_PUSH, MSG_WriteByte(), MSG_WriteString(), NetConn_Heartbeat(), NetConn_OpenServerPorts(), client_t::netconnection, NULL, NUM_SPAWN_PARMS, parm1, server_t::paused, server_t::protocol, Protocol_EnumForName(), Protocol_Names(), PROTOCOL_NEHAHRABJP, PROTOCOL_NEHAHRABJP2, PROTOCOL_NEHAHRABJP3, PROTOCOL_NEHAHRAMOVIE, PROTOCOL_QUAKE, PROTOCOL_QUAKEDP, PROTOCOL_UNKNOWN, PRVM_ED_ClearEdict(), PRVM_ED_LoadFromFile(), PRVM_EDICT_NUM, PRVM_EDICT_TO_PROG, PRVM_GetString(), PRVM_serveredictfloat, PRVM_serveredictstring, PRVM_serveredictvector, PRVM_serverfunction, PRVM_serverglobaledict, PRVM_serverglobalfloat, PRVM_serverglobalstring, PRVM_SetEngineString(), host_static_t::realtime, server_t::reliable_datagram, server_t::reliable_datagram_buf, S_StopAllSounds(), SCR_BeginLoadingPlaque(), scr_centertime_off, self, server_static_t::serverflags, serverflags, client_static_t::signon, server_t::signon, server_t::signon_buf, skill, solid, SOLID_BSP, server_t::sound_precache, client_t::spawn_parms, server_t::spawnframe, ss_active, ss_loading, server_t::state, cvar_t::string, sv, SV_CreateBaseline(), sv_entpatch, sv_init_frame_count, sv_mapformat_is_quake2, sv_mapformat_is_quake3, SV_Physics(), sv_protocolname, sv_random_seed, SV_SendServerinfo(), SV_VM_Setup(), SV_VM_Shutdown(), sv_worldbasename, sv_worldmessage, sv_worldname, sv_worldnamenoextension, svc_stufftext, svs, SVVM_prog, Sys_MakeProcessMean(), Sys_MakeProcessNice(), tempmempool, server_t::time, time, model_t::TraceBox, model_t::used, va(), cvar_t::value, VectorClear, VectorCopy, server_t::world, World_SetSize(), World_Start(), server_t::worldbasename, server_t::worldmodel, server_t::worldname, and server_t::worldnamenoextension.

Referenced by SV_Changelevel_f(), SV_Loadgame_f(), SV_Map_f(), and SV_Restart_f().

◆ SV_StartEffect()

void SV_StartEffect ( vec3_t org,
int modelindex,
int startframe,
int framecount,
int framerate )

Definition at line 182 of file sv_send.c.

183{
184 if (modelindex >= 256 || startframe >= 256)
185 {
187 return;
193 MSG_WriteShort (&sv.datagram, startframe);
194 MSG_WriteByte (&sv.datagram, framecount);
195 MSG_WriteByte (&sv.datagram, framerate);
196 }
197 else
198 {
200 return;
206 MSG_WriteByte (&sv.datagram, startframe);
207 MSG_WriteByte (&sv.datagram, framecount);
208 MSG_WriteByte (&sv.datagram, framerate);
209 }
211}
void MSG_WriteCoord(sizebuf_t *sb, float f, protocolversion_t protocol)
Definition com_msg.c:202
#define svc_effect
Definition protocol.h:271
#define svc_effect2
Definition protocol.h:272
#define MAX_PACKETFRAGMENT
max length of packet fragment
Definition qdefs.h:104

References sizebuf_t::cursize, server_t::datagram, MAX_PACKETFRAGMENT, modelindex, MSG_WriteByte(), MSG_WriteCoord(), MSG_WriteShort(), server_t::protocol, sv, SV_FlushBroadcastMessages(), svc_effect, and svc_effect2.

Referenced by VM_SV_effect().

◆ SV_StartParticle()

void SV_StartParticle ( vec3_t org,
vec3_t dir,
int color,
int count )

Definition at line 158 of file sv_send.c.

159{
160 int i;
161
163 return;
168 for (i=0 ; i<3 ; i++)
169 MSG_WriteChar (&sv.datagram, (int)bound(-128, dir[i]*16, 127));
173}
void MSG_WriteChar(sizebuf_t *sb, int c)
Definition com_msg.c:122
vector color
GLenum GLenum GLsizei count
Definition glquake.h:656
#define svc_particle
Definition protocol.h:237

References bound, color, count, sizebuf_t::cursize, server_t::datagram, dir, i, MAX_PACKETFRAGMENT, MSG_WriteByte(), MSG_WriteChar(), MSG_WriteCoord(), server_t::protocol, sv, SV_FlushBroadcastMessages(), and svc_particle.

Referenced by VM_SV_particle().

◆ SV_StartPointSound()

void SV_StartPointSound ( vec3_t origin,
const char * sample,
int volume,
float attenuation,
float speed )

Definition at line 320 of file sv_send.c.

321{
322 int sound_num, field_mask, i, speed4000;
323
324 if (nvolume < 0 || nvolume > 255)
325 {
326 Con_Printf ("SV_StartPointSound: volume = %i\n", nvolume);
327 return;
328 }
329
330 if (attenuation < 0 || attenuation > 4)
331 {
332 Con_Printf ("SV_StartPointSound: attenuation = %f\n", attenuation);
333 return;
334 }
335
337 return;
338
339 // find precache number for sound
340 sound_num = SV_SoundIndex(sample, 1);
341 if (!sound_num)
342 return;
343
344 speed4000 = (int)(speed * 40.0f);
345 field_mask = 0;
346 if (nvolume != DEFAULT_SOUND_PACKET_VOLUME)
347 field_mask |= SND_VOLUME;
348 if (attenuation != DEFAULT_SOUND_PACKET_ATTENUATION)
349 field_mask |= SND_ATTENUATION;
350 if (sound_num >= 256)
351 field_mask |= SND_LARGESOUND;
352 if (speed4000 && speed4000 != 4000)
353 field_mask |= SND_SPEEDUSHORT4000;
354
355// directed messages go only to the entity they are targeted on
357 MSG_WriteByte (&sv.datagram, field_mask);
358 if (field_mask & SND_VOLUME)
359 MSG_WriteByte (&sv.datagram, nvolume);
360 if (field_mask & SND_ATTENUATION)
361 MSG_WriteByte (&sv.datagram, (int)(attenuation*64));
362 if (field_mask & SND_SPEEDUSHORT4000)
363 MSG_WriteShort (&sv.datagram, speed4000);
364 // Always write entnum 0 for the world entity
365 MSG_WriteShort (&sv.datagram, (0<<3) | 0);
366 if (field_mask & SND_LARGESOUND)
367 MSG_WriteShort (&sv.datagram, sound_num);
368 else
369 MSG_WriteByte (&sv.datagram, sound_num);
370 for (i = 0;i < 3;i++)
373}
#define SND_ATTENUATION
Definition protocol.h:190
#define svc_sound
Definition protocol.h:220
#define SND_VOLUME
Definition protocol.h:189
#define SND_SPEEDUSHORT4000
Definition protocol.h:194
#define SND_LARGESOUND
Definition protocol.h:193
int SV_SoundIndex(const char *s, int precachemode)
Definition sv_main.c:1474
#define DEFAULT_SOUND_PACKET_ATTENUATION
Definition sound.h:33
#define DEFAULT_SOUND_PACKET_VOLUME
Definition sound.h:32

References Con_Printf(), sizebuf_t::cursize, server_t::datagram, DEFAULT_SOUND_PACKET_ATTENUATION, DEFAULT_SOUND_PACKET_VOLUME, i, int(), MAX_PACKETFRAGMENT, MSG_WriteByte(), MSG_WriteCoord(), MSG_WriteShort(), origin, server_t::protocol, SND_ATTENUATION, SND_LARGESOUND, SND_SPEEDUSHORT4000, SND_VOLUME, sv, SV_FlushBroadcastMessages(), SV_SoundIndex(), and svc_sound.

Referenced by VM_SV_pointsound().

◆ SV_StartSound()

void SV_StartSound ( prvm_edict_t * entity,
int channel,
const char * sample,
int volume,
float attenuation,
qbool reliable,
float speed )

Definition at line 228 of file sv_send.c.

229{
230 prvm_prog_t *prog = SVVM_prog;
231 sizebuf_t *dest;
232 int sound_num, field_mask, i, ent, speed4000;
233
234 dest = (reliable ? &sv.reliable_datagram : &sv.datagram);
235
236 if (nvolume < 0 || nvolume > 255)
237 {
238 Con_Printf ("SV_StartSound: volume = %i\n", nvolume);
239 return;
240 }
241
242 if (attenuation < 0 || attenuation > 4)
243 {
244 Con_Printf ("SV_StartSound: attenuation = %f\n", attenuation);
245 return;
246 }
247
248 if (!IS_CHAN(channel))
249 {
250 Con_Printf ("SV_StartSound: channel = %i\n", channel);
251 return;
252 }
253
254 channel = CHAN_ENGINE2NET(channel);
255
257 return;
258
259// find precache number for sound
260 sound_num = SV_SoundIndex(sample, 1);
261 if (!sound_num)
262 return;
263
265
266 speed4000 = (int)floor(speed * 4000.0f + 0.5f);
267 field_mask = 0;
268 if (nvolume != DEFAULT_SOUND_PACKET_VOLUME)
269 field_mask |= SND_VOLUME;
270 if (attenuation != DEFAULT_SOUND_PACKET_ATTENUATION)
271 field_mask |= SND_ATTENUATION;
272 if (speed4000 && speed4000 != 4000)
273 field_mask |= SND_SPEEDUSHORT4000;
274 if (ent >= 8192 || channel < 0 || channel > 7)
275 field_mask |= SND_LARGEENTITY;
276 if (sound_num >= 256)
277 field_mask |= SND_LARGESOUND;
278
279// directed messages go only to the entity they are targeted on
280 MSG_WriteByte (dest, svc_sound);
281 MSG_WriteByte (dest, field_mask);
282 if (field_mask & SND_VOLUME)
283 MSG_WriteByte (dest, nvolume);
284 if (field_mask & SND_ATTENUATION)
285 MSG_WriteByte (dest, (int)(attenuation*64));
286 if (field_mask & SND_SPEEDUSHORT4000)
287 MSG_WriteShort (dest, speed4000);
288 if (field_mask & SND_LARGEENTITY)
289 {
290 MSG_WriteShort (dest, ent);
291 MSG_WriteChar (dest, channel);
292 }
293 else
294 MSG_WriteShort (dest, (ent<<3) | channel);
296 MSG_WriteShort (dest, sound_num);
297 else
298 MSG_WriteByte (dest, sound_num);
299 for (i = 0;i < 3;i++)
301
302 // TODO do we have to do anything here when dest is &sv.reliable_datagram?
303 if(!reliable)
305}
entity() spawn
float floor(float f)
#define SND_LARGEENTITY
Definition protocol.h:192
#define CHAN_ENGINE2NET(c)
Definition sound.h:85
#define IS_CHAN(n)
Definition sound.h:82

References CHAN_ENGINE2NET, Con_Printf(), sizebuf_t::cursize, server_t::datagram, DEFAULT_SOUND_PACKET_ATTENUATION, DEFAULT_SOUND_PACKET_VOLUME, entity(), floor(), i, int(), IS_CHAN, MAX_PACKETFRAGMENT, maxs, mins, MSG_WriteByte(), MSG_WriteChar(), MSG_WriteCoord(), MSG_WriteShort(), origin, server_t::protocol, PROTOCOL_NEHAHRABJP2, PROTOCOL_NEHAHRABJP3, PRVM_NUM_FOR_EDICT, PRVM_serveredictvector, server_t::reliable_datagram, SND_ATTENUATION, SND_LARGEENTITY, SND_LARGESOUND, SND_SPEEDUSHORT4000, SND_VOLUME, sv, SV_FlushBroadcastMessages(), SV_SoundIndex(), svc_sound, and SVVM_prog.

Referenced by SV_CheckWaterTransition(), SV_Physics_Step(), and VM_SV_sound().

◆ SV_StartThread()

void SV_StartThread ( void )

Definition at line 2850 of file sv_main.c.

2851{
2853 return;
2854 svs.threaded = true;
2855 svs.threadstop = false;
2858}
void * thread
Definition server.h:47
qbool volatile threadstop
Definition server.h:45
static int SV_ThreadFunc(void *voiddata)
Definition sv_main.c:2716
qbool Thread_HasThreads(void)
Definition thread_null.c:13
#define Thread_CreateMutex()
Definition thread.h:15
#define Thread_CreateThread(fn, data)
Definition thread.h:24

References cvar_t::integer, NULL, sv_threaded, SV_ThreadFunc(), svs, server_static_t::thread, Thread_CreateMutex, Thread_CreateThread, Thread_HasThreads(), server_static_t::threaded, server_static_t::threadmutex, and server_static_t::threadstop.

Referenced by Host_Init().

◆ SV_StopThread()

void SV_StopThread ( void )

Definition at line 2860 of file sv_main.c.

2861{
2862 if (!svs.threaded)
2863 return;
2864 svs.threadstop = true;
2867 svs.threaded = false;
2868}
#define Thread_DestroyMutex(m)
Definition thread.h:16
#define Thread_WaitThread(thread, retval)
Definition thread.h:25

References svs, server_static_t::thread, Thread_DestroyMutex, Thread_WaitThread, server_static_t::threaded, server_static_t::threadmutex, and server_static_t::threadstop.

Referenced by Host_Shutdown().

◆ SV_TimingReport()

const char * SV_TimingReport ( char * buf,
size_t buflen )

for output in SV_Status_f

Definition at line 2521 of file sv_main.c.

2522{
2523 return va(buf, buflen, "%.1f%% CPU, %.2f%% lost, offset avg %.1fms, max %.1fms, sdev %.1fms", sv.perf_cpuload * 100, sv.perf_lost * 100, sv.perf_offset_avg * 1000, sv.perf_offset_max * 1000, sv.perf_offset_sdev * 1000);
2524}

References buf, server_t::perf_cpuload, server_t::perf_lost, server_t::perf_offset_avg, server_t::perf_offset_max, server_t::perf_offset_sdev, sv, and va().

Referenced by SV_Frame(), SV_Status_f(), and SV_ThreadFunc().

◆ SV_TraceBox()

trace_t SV_TraceBox ( const vec3_t start,
const vec3_t mins,
const vec3_t maxs,
const vec3_t end,
int type,
prvm_edict_t * passedict,
int hitsupercontentsmask,
int skipsupercontentsmask,
int skipmaterialflagsmask,
float extend )

traces a box move against worldmodel and all entities in the specified area

Definition at line 414 of file sv_phys.c.

416{
417 prvm_prog_t *prog = SVVM_prog;
418 vec3_t hullmins, hullmaxs;
419 int i, bodysupercontents;
420 int passedictprog;
421 float pitchsign = 1;
422 qbool pointtrace;
423 prvm_edict_t *traceowner, *touch;
424 trace_t trace;
425 // temporary storage because prvm_vec_t may differ from vec_t
426 vec3_t touchmins, touchmaxs;
427 // bounding box of entire move area
428 vec3_t clipboxmins, clipboxmaxs;
429 // size of the moving object
430 vec3_t clipmins, clipmaxs;
431 // size when clipping against monsters
432 vec3_t clipmins2, clipmaxs2;
433 // start and end origin of move
434 vec3_t clipstart, clipend;
435 // trace results
436 trace_t cliptrace;
437 // matrices to transform into/out of other entity's space
438 matrix4x4_t matrix, imatrix;
439 // model of other entity
440 model_t *model;
441 // list of entities to test for collisions
442 int numtouchedicts;
443 static prvm_edict_t *touchedicts[MAX_EDICTS];
444 int clipgroup;
445 if (VectorCompare(mins, maxs))
446 {
447 vec3_t shiftstart, shiftend;
448 VectorAdd(start, mins, shiftstart);
449 VectorAdd(end, mins, shiftend);
450 if (VectorCompare(start, end))
451 trace = SV_TracePoint(shiftstart, type, passedict, hitsupercontentsmask, skipsupercontentsmask, skipmaterialflagsmask);
452 else
453 trace = SV_TraceLine(shiftstart, shiftend, type, passedict, hitsupercontentsmask, skipsupercontentsmask, skipmaterialflagsmask, extend);
454 VectorSubtract(trace.endpos, mins, trace.endpos);
455 return trace;
456 }
457
458 VectorCopy(start, clipstart);
459 VectorCopy(end, clipend);
460 VectorCopy(mins, clipmins);
461 VectorCopy(maxs, clipmaxs);
462 VectorCopy(mins, clipmins2);
463 VectorCopy(maxs, clipmaxs2);
464#if COLLISIONPARANOID >= 3
465 Con_Printf("move(%f %f %f,%f %f %f)", clipstart[0], clipstart[1], clipstart[2], clipend[0], clipend[1], clipend[2]);
466#endif
467
468 // clip to world
469 Collision_ClipToWorld(&cliptrace, sv.worldmodel, clipstart, clipmins, clipmaxs, clipend, hitsupercontentsmask, skipsupercontentsmask, skipmaterialflagsmask, extend);
470 cliptrace.worldstartsolid = cliptrace.bmodelstartsolid = cliptrace.startsolid;
471 if (cliptrace.startsolid || cliptrace.fraction < 1)
472 cliptrace.ent = prog->edicts;
473 if (type == MOVE_WORLDONLY)
474 goto finished;
475
476 if (type == MOVE_MISSILE)
477 {
478 // LadyHavoc: modified this, was = -15, now -= 15
479 for (i = 0;i < 3;i++)
480 {
481 clipmins2[i] -= 15;
482 clipmaxs2[i] += 15;
483 }
484 }
485
486 // get adjusted box for bmodel collisions if the world is q1bsp or hlbsp
487 if (sv.worldmodel && sv.worldmodel->brush.RoundUpToHullSize)
488 sv.worldmodel->brush.RoundUpToHullSize(sv.worldmodel, clipmins, clipmaxs, hullmins, hullmaxs);
489 else
490 {
491 VectorCopy(clipmins, hullmins);
492 VectorCopy(clipmaxs, hullmaxs);
493 }
494
495 // create the bounding box of the entire move
496 for (i = 0;i < 3;i++)
497 {
498 clipboxmins[i] = min(clipstart[i], cliptrace.endpos[i]) + min(hullmins[i], clipmins2[i]) - 1;
499 clipboxmaxs[i] = max(clipstart[i], cliptrace.endpos[i]) + max(hullmaxs[i], clipmaxs2[i]) + 1;
500 }
501
502 // debug override to test against everything
504 {
505 clipboxmins[0] = clipboxmins[1] = clipboxmins[2] = (vec_t)-999999999;
506 clipboxmaxs[0] = clipboxmaxs[1] = clipboxmaxs[2] = (vec_t)999999999;
507 }
508
509 // if the passedict is world, make it NULL (to avoid two checks each time)
510 if (passedict == prog->edicts)
511 passedict = NULL;
512 // precalculate prog value for passedict for comparisons
513 passedictprog = PRVM_EDICT_TO_PROG(passedict);
514 // figure out whether this is a point trace for comparisons
515 pointtrace = VectorCompare(clipmins, clipmaxs);
516 // precalculate passedict's owner edict pointer for comparisons
517 traceowner = passedict ? PRVM_PROG_TO_EDICT(PRVM_serveredictedict(passedict, owner)) : 0;
518
519 clipgroup = passedict ? (int)PRVM_serveredictfloat(passedict, clipgroup) : 0;
520
521 // clip to entities
522 // because this uses World_EntitiestoBox, we know all entity boxes overlap
523 // the clip region, so we can skip culling checks in the loop below
524 numtouchedicts = SV_EntitiesInBox(clipboxmins, clipboxmaxs, MAX_EDICTS, touchedicts);
525 if (numtouchedicts > MAX_EDICTS)
526 {
527 // this never happens
528 Con_Printf("SV_EntitiesInBox returned %i edicts, max was %i\n", numtouchedicts, MAX_EDICTS);
529 numtouchedicts = MAX_EDICTS;
530 }
531 for (i = 0;i < numtouchedicts;i++)
532 {
533 touch = touchedicts[i];
534
536 continue;
538 continue;
539
540 if (passedict)
541 {
542 // don't clip against self
543 if (passedict == touch)
544 continue;
545 // don't clip owned entities against owner
546 if (traceowner == touch)
547 continue;
548 // don't clip owner against owned entities
549 if (passedictprog == PRVM_serveredictedict(touch, owner))
550 continue;
551 // don't clip against any entities in the same clipgroup (DP_RM_CLIPGROUP)
552 if (clipgroup && clipgroup == (int)PRVM_serveredictfloat(touch, clipgroup))
553 continue;
554 // don't clip points against points (they can't collide)
555 if (pointtrace && VectorCompare(PRVM_serveredictvector(touch, mins), PRVM_serveredictvector(touch, maxs)) && (type != MOVE_MISSILE || !((int)PRVM_serveredictfloat(touch, flags) & FL_MONSTER)))
556 continue;
557 }
558
560
561 // might interact, so do an exact clip
562 model = NULL;
563 if ((int) PRVM_serveredictfloat(touch, solid) == SOLID_BSP || type == MOVE_HITMODEL)
564 {
566 pitchsign = SV_GetPitchSign(prog, touch);
567 }
568 if (model)
570 else
572 Matrix4x4_Invert_Simple(&imatrix, &matrix);
573 VM_GenerateFrameGroupBlend(prog, touch->priv.server->framegroupblend, touch);
574 VM_FrameBlendFromFrameGroupBlend(touch->priv.server->frameblend, touch->priv.server->framegroupblend, model, sv.time);
575 VM_UpdateEdictSkeleton(prog, touch, model, touch->priv.server->frameblend);
576 VectorCopy(PRVM_serveredictvector(touch, mins), touchmins);
577 VectorCopy(PRVM_serveredictvector(touch, maxs), touchmaxs);
578 if (type == MOVE_MISSILE && (int)PRVM_serveredictfloat(touch, flags) & FL_MONSTER)
579 Collision_ClipToGenericEntity(&trace, model, touch->priv.server->frameblend, &touch->priv.server->skeleton, touchmins, touchmaxs, bodysupercontents, &matrix, &imatrix, clipstart, clipmins2, clipmaxs2, clipend, hitsupercontentsmask, skipsupercontentsmask, skipmaterialflagsmask, extend);
580 else
581 Collision_ClipToGenericEntity(&trace, model, touch->priv.server->frameblend, &touch->priv.server->skeleton, touchmins, touchmaxs, bodysupercontents, &matrix, &imatrix, clipstart, clipmins, clipmaxs, clipend, hitsupercontentsmask, skipsupercontentsmask, skipmaterialflagsmask, extend);
582
583 Collision_CombineTraces(&cliptrace, &trace, (void *)touch, PRVM_serveredictfloat(touch, solid) == SOLID_BSP);
584 }
585
586finished:
587 return cliptrace;
588}
void Collision_ClipToWorld(trace_t *trace, model_t *model, const vec3_t tstart, const vec3_t mins, const vec3_t maxs, const vec3_t tend, int hitsupercontentsmask, int skipsupercontentsmask, int skipmaterialflagsmask, float extend)
Definition collision.c:1834
void Collision_CombineTraces(trace_t *cliptrace, const trace_t *trace, void *touch, qbool isbmodel)
Definition collision.c:1914
void Collision_ClipToGenericEntity(trace_t *trace, model_t *model, const frameblend_t *frameblend, const skeleton_t *skeleton, const vec3_t bodymins, const vec3_t bodymaxs, int bodysupercontents, matrix4x4_t *matrix, matrix4x4_t *inversematrix, const vec3_t tstart, const vec3_t mins, const vec3_t maxs, const vec3_t tend, int hitsupercontentsmask, int skipsupercontentsmask, int skipmaterialflagsmask, float extend)
Definition collision.c:1791
entity owner
float clipgroup
GLenum type
Definition glquake.h:656
#define VectorSubtract(a, b, out)
Definition mathlib.h:99
#define VectorCompare(a, b)
Definition mathlib.h:113
void Matrix4x4_CreateTranslate(matrix4x4_t *out, double x, double y, double z)
Definition matrixlib.c:584
float vec_t
Definition qtypes.h:68
#define SOLID_BBOX
touch on edge, block
Definition server.h:334
cvar_t sv_debugmove
Definition sv_main.c:97
qbool bmodelstartsolid
Definition collision.h:30
qbool worldstartsolid
Definition collision.h:28
trace_t SV_TracePoint(const vec3_t start, int type, prvm_edict_t *passedict, int hitsupercontentsmask, int skipsupercontentsmask, int skipmaterialflagsmask)
Definition sv_phys.c:104
trace_t SV_TraceLine(const vec3_t start, const vec3_t end, int type, prvm_edict_t *passedict, int hitsupercontentsmask, int skipsupercontentsmask, int skipmaterialflagsmask, float extend)
Definition sv_phys.c:256
int SV_GetPitchSign(prvm_prog_t *prog, prvm_edict_t *ent)
Definition sv_phys.c:47
#define MOVE_MISSILE
Definition world.h:30
#define MOVE_HITMODEL
Definition world.h:32
#define MOVE_WORLDONLY
Definition world.h:31

References angles, trace_t::bmodelstartsolid, clipgroup, Collision_ClipToGenericEntity(), Collision_ClipToWorld(), Collision_CombineTraces(), Con_Printf(), prvm_prog_t::edicts, trace_t::endpos, trace_t::ent, FL_MONSTER, flags, trace_t::fraction, i, int(), cvar_t::integer, Matrix4x4_CreateFromQuakeEntity(), Matrix4x4_CreateTranslate(), Matrix4x4_Invert_Simple(), max, MAX_EDICTS, maxs, min, mins, model, MOVE_HITMODEL, MOVE_MISSILE, MOVE_NOMONSTERS, MOVE_WORLDONLY, NULL, origin, owner, prvm_edict_t::priv, PRVM_EDICT_TO_PROG, PRVM_PROG_TO_EDICT, PRVM_serveredictedict, PRVM_serveredictfloat, PRVM_serveredictvector, prvm_edict_t::server, solid, SOLID_BBOX, SOLID_BSP, SOLID_CORPSE, trace_t::startsolid, SUPERCONTENTS_BODY, SUPERCONTENTS_CORPSE, sv, sv_debugmove, SV_EntitiesInBox(), SV_GetModelFromEdict(), SV_GetPitchSign(), SV_TraceLine(), SV_TracePoint(), SVVM_prog, server_t::time, type, VectorAdd, VectorCompare, VectorCopy, VectorSubtract, VM_FrameBlendFromFrameGroupBlend(), VM_GenerateFrameGroupBlend(), VM_UpdateEdictSkeleton(), server_t::worldmodel, and trace_t::worldstartsolid.

Referenced by PHYS_TraceBox(), SV_movestep(), SV_NudgeOutOfSolid_PivotIsKnownGood(), SV_PushEntity(), SV_Trace_Toss(), SV_WalkMove(), VM_SV_droptofloor(), and VM_SV_tracebox().

◆ SV_TraceLine()

trace_t SV_TraceLine ( const vec3_t start,
const vec3_t end,
int type,
prvm_edict_t * passedict,
int hitsupercontentsmask,
int skipsupercontentsmask,
int skipmaterialflagsmask,
float extend )

Definition at line 256 of file sv_phys.c.

257{
258 prvm_prog_t *prog = SVVM_prog;
259 int i, bodysupercontents;
260 int passedictprog;
261 float pitchsign = 1;
262 prvm_edict_t *traceowner, *touch;
263 trace_t trace;
264 // temporary storage because prvm_vec_t may differ from vec_t
265 vec3_t touchmins, touchmaxs;
266 // bounding box of entire move area
267 vec3_t clipboxmins, clipboxmaxs;
268 // size when clipping against monsters
269 vec3_t clipmins2, clipmaxs2;
270 // start and end origin of move
271 vec3_t clipstart, clipend;
272 // trace results
273 trace_t cliptrace;
274 // matrices to transform into/out of other entity's space
275 matrix4x4_t matrix, imatrix;
276 // model of other entity
277 model_t *model;
278 // list of entities to test for collisions
279 int numtouchedicts;
280 static prvm_edict_t *touchedicts[MAX_EDICTS];
281 int clipgroup;
282 if (VectorCompare(start, end))
283 return SV_TracePoint(start, type, passedict, hitsupercontentsmask, skipsupercontentsmask, skipmaterialflagsmask);
284
285 //return SV_TraceBox(start, vec3_origin, vec3_origin, end, type, passedict, hitsupercontentsmask);
286
287 VectorCopy(start, clipstart);
288 VectorCopy(end, clipend);
289 VectorClear(clipmins2);
290 VectorClear(clipmaxs2);
291#if COLLISIONPARANOID >= 3
292 Con_Printf("move(%f %f %f,%f %f %f)", clipstart[0], clipstart[1], clipstart[2], clipend[0], clipend[1], clipend[2]);
293#endif
294
295 // clip to world
296 Collision_ClipLineToWorld(&cliptrace, sv.worldmodel, clipstart, clipend, hitsupercontentsmask, skipsupercontentsmask, skipmaterialflagsmask, extend, false);
297 cliptrace.worldstartsolid = cliptrace.bmodelstartsolid = cliptrace.startsolid;
298 if (cliptrace.startsolid || cliptrace.fraction < 1)
299 cliptrace.ent = prog->edicts;
300 if (type == MOVE_WORLDONLY)
301 goto finished;
302
303 if (type == MOVE_MISSILE)
304 {
305 // LadyHavoc: modified this, was = -15, now -= 15
306 for (i = 0;i < 3;i++)
307 {
308 clipmins2[i] -= 15;
309 clipmaxs2[i] += 15;
310 }
311 }
312
313 // create the bounding box of the entire move
314 for (i = 0;i < 3;i++)
315 {
316 clipboxmins[i] = min(clipstart[i], cliptrace.endpos[i]) + clipmins2[i] - 1;
317 clipboxmaxs[i] = max(clipstart[i], cliptrace.endpos[i]) + clipmaxs2[i] + 1;
318 }
319
320 // debug override to test against everything
322 {
323 clipboxmins[0] = clipboxmins[1] = clipboxmins[2] = (vec_t)-999999999;
324 clipboxmaxs[0] = clipboxmaxs[1] = clipboxmaxs[2] = (vec_t)999999999;
325 }
326
327 // if the passedict is world, make it NULL (to avoid two checks each time)
328 if (passedict == prog->edicts)
329 passedict = NULL;
330 // precalculate prog value for passedict for comparisons
331 passedictprog = PRVM_EDICT_TO_PROG(passedict);
332 // precalculate passedict's owner edict pointer for comparisons
333 traceowner = passedict ? PRVM_PROG_TO_EDICT(PRVM_serveredictedict(passedict, owner)) : 0;
334
335 clipgroup = passedict ? (int)PRVM_serveredictfloat(passedict, clipgroup) : 0;
336
337 // clip to entities
338 // because this uses World_EntitiestoBox, we know all entity boxes overlap
339 // the clip region, so we can skip culling checks in the loop below
340 numtouchedicts = SV_EntitiesInBox(clipboxmins, clipboxmaxs, MAX_EDICTS, touchedicts);
341 if (numtouchedicts > MAX_EDICTS)
342 {
343 // this never happens
344 Con_Printf("SV_EntitiesInBox returned %i edicts, max was %i\n", numtouchedicts, MAX_EDICTS);
345 numtouchedicts = MAX_EDICTS;
346 }
347 for (i = 0;i < numtouchedicts;i++)
348 {
349 touch = touchedicts[i];
350
352 continue;
354 continue;
355
356 if (passedict)
357 {
358 // don't clip against self
359 if (passedict == touch)
360 continue;
361 // don't clip owned entities against owner
362 if (traceowner == touch)
363 continue;
364 // don't clip owner against owned entities
365 if (passedictprog == PRVM_serveredictedict(touch, owner))
366 continue;
367 // don't clip against any entities in the same clipgroup (DP_RM_CLIPGROUP)
368 if (clipgroup && clipgroup == (int)PRVM_serveredictfloat(touch, clipgroup))
369 continue;
370 // don't clip points against points (they can't collide)
372 continue;
373 }
374
376
377 // might interact, so do an exact clip
378 model = NULL;
379 if ((int) PRVM_serveredictfloat(touch, solid) == SOLID_BSP || type == MOVE_HITMODEL)
380 {
382 pitchsign = SV_GetPitchSign(prog, touch);
383 }
384 if (model)
386 else
388 Matrix4x4_Invert_Simple(&imatrix, &matrix);
389 VM_GenerateFrameGroupBlend(prog, touch->priv.server->framegroupblend, touch);
390 VM_FrameBlendFromFrameGroupBlend(touch->priv.server->frameblend, touch->priv.server->framegroupblend, model, sv.time);
391 VM_UpdateEdictSkeleton(prog, touch, model, touch->priv.server->frameblend);
392 VectorCopy(PRVM_serveredictvector(touch, mins), touchmins);
393 VectorCopy(PRVM_serveredictvector(touch, maxs), touchmaxs);
394 if (type == MOVE_MISSILE && (int)PRVM_serveredictfloat(touch, flags) & FL_MONSTER)
395 Collision_ClipToGenericEntity(&trace, model, touch->priv.server->frameblend, &touch->priv.server->skeleton, touchmins, touchmaxs, bodysupercontents, &matrix, &imatrix, clipstart, clipmins2, clipmaxs2, clipend, hitsupercontentsmask, skipsupercontentsmask, skipmaterialflagsmask, extend);
396 else
397 Collision_ClipLineToGenericEntity(&trace, model, touch->priv.server->frameblend, &touch->priv.server->skeleton, touchmins, touchmaxs, bodysupercontents, &matrix, &imatrix, clipstart, clipend, hitsupercontentsmask, skipsupercontentsmask, skipmaterialflagsmask, extend, false);
398
399 Collision_CombineTraces(&cliptrace, &trace, (void *)touch, PRVM_serveredictfloat(touch, solid) == SOLID_BSP);
400 }
401
402finished:
403 return cliptrace;
404}
void Collision_ClipLineToWorld(trace_t *trace, model_t *model, const vec3_t tstart, const vec3_t tend, int hitsupercontentsmask, int skipsupercontentsmask, int skipmaterialflagsmask, float extend, qbool hitsurfaces)
Definition collision.c:1870
void Collision_ClipLineToGenericEntity(trace_t *trace, model_t *model, const frameblend_t *frameblend, const skeleton_t *skeleton, const vec3_t bodymins, const vec3_t bodymaxs, int bodysupercontents, matrix4x4_t *matrix, matrix4x4_t *inversematrix, const vec3_t tstart, const vec3_t tend, int hitsupercontentsmask, int skipsupercontentsmask, int skipmaterialflagsmask, float extend, qbool hitsurfaces)
Definition collision.c:1844

References angles, trace_t::bmodelstartsolid, clipgroup, Collision_ClipLineToGenericEntity(), Collision_ClipLineToWorld(), Collision_ClipToGenericEntity(), Collision_CombineTraces(), Con_Printf(), prvm_prog_t::edicts, trace_t::endpos, trace_t::ent, FL_MONSTER, flags, trace_t::fraction, i, int(), cvar_t::integer, Matrix4x4_CreateFromQuakeEntity(), Matrix4x4_CreateTranslate(), Matrix4x4_Invert_Simple(), max, MAX_EDICTS, maxs, min, mins, model, MOVE_HITMODEL, MOVE_MISSILE, MOVE_NOMONSTERS, MOVE_WORLDONLY, NULL, origin, owner, prvm_edict_t::priv, PRVM_EDICT_TO_PROG, PRVM_PROG_TO_EDICT, PRVM_serveredictedict, PRVM_serveredictfloat, PRVM_serveredictvector, prvm_edict_t::server, solid, SOLID_BBOX, SOLID_BSP, SOLID_CORPSE, trace_t::startsolid, SUPERCONTENTS_BODY, SUPERCONTENTS_CORPSE, sv, sv_debugmove, SV_EntitiesInBox(), SV_GetModelFromEdict(), SV_GetPitchSign(), SV_TracePoint(), SVVM_prog, server_t::time, type, VectorClear, VectorCompare, VectorCopy, VM_FrameBlendFromFrameGroupBlend(), VM_GenerateFrameGroupBlend(), VM_UpdateEdictSkeleton(), server_t::worldmodel, and trace_t::worldstartsolid.

Referenced by Sbar_ShowFPS(), SV_CheckBottom(), SV_Ent_Create_f(), SV_Ent_Remove_f(), SV_SetIdealPitch(), SV_TraceBox(), SV_UserFriction(), VM_SV_aim(), VM_SV_droptofloor(), and VM_SV_traceline().

◆ SV_TracePoint()

trace_t SV_TracePoint ( const vec3_t start,
int type,
prvm_edict_t * passedict,
int hitsupercontentsmask,
int skipsupercontentsmask,
int skipmaterialflagsmask )

Definition at line 104 of file sv_phys.c.

105{
106 prvm_prog_t *prog = SVVM_prog;
107 int i, bodysupercontents;
108 int passedictprog;
109 float pitchsign = 1;
110 prvm_edict_t *traceowner, *touch;
111 trace_t trace;
112 // temporary storage because prvm_vec_t may differ from vec_t
113 vec3_t touchmins, touchmaxs;
114 // bounding box of entire move area
115 vec3_t clipboxmins, clipboxmaxs;
116 // size when clipping against monsters
117 vec3_t clipmins2, clipmaxs2;
118 // start and end origin of move
119 vec3_t clipstart;
120 // trace results
121 trace_t cliptrace;
122 // matrices to transform into/out of other entity's space
123 matrix4x4_t matrix, imatrix;
124 // model of other entity
125 model_t *model;
126 // list of entities to test for collisions
127 int numtouchedicts;
128 static prvm_edict_t *touchedicts[MAX_EDICTS];
129 int clipgroup;
130
131 //return SV_TraceBox(start, vec3_origin, vec3_origin, end, type, passedict, hitsupercontentsmask, skipsupercontentsmask, skipmaterialflagsmask);
132
133 VectorCopy(start, clipstart);
134 VectorClear(clipmins2);
135 VectorClear(clipmaxs2);
136#if COLLISIONPARANOID >= 3
137 Con_Printf("move(%f %f %f)", clipstart[0], clipstart[1], clipstart[2]);
138#endif
139
140 // clip to world
141 Collision_ClipPointToWorld(&cliptrace, sv.worldmodel, clipstart, hitsupercontentsmask, skipsupercontentsmask, skipmaterialflagsmask);
142 cliptrace.worldstartsolid = cliptrace.bmodelstartsolid = cliptrace.startsolid;
143 if (cliptrace.startsolid || cliptrace.fraction < 1)
144 cliptrace.ent = prog->edicts;
145 if (type == MOVE_WORLDONLY)
146 goto finished;
147
148 if (type == MOVE_MISSILE)
149 {
150 // LadyHavoc: modified this, was = -15, now -= 15
151 for (i = 0;i < 3;i++)
152 {
153 clipmins2[i] -= 15;
154 clipmaxs2[i] += 15;
155 }
156 }
157
158 // create the bounding box of the entire move
159 for (i = 0;i < 3;i++)
160 {
161 clipboxmins[i] = min(clipstart[i], cliptrace.endpos[i]) + clipmins2[i] - 1;
162 clipboxmaxs[i] = max(clipstart[i], cliptrace.endpos[i]) + clipmaxs2[i] + 1;
163 }
164
165 // debug override to test against everything
167 {
168 clipboxmins[0] = clipboxmins[1] = clipboxmins[2] = (vec_t)-999999999;
169 clipboxmaxs[0] = clipboxmaxs[1] = clipboxmaxs[2] = (vec_t)999999999;
170 }
171
172 // if the passedict is world, make it NULL (to avoid two checks each time)
173 if (passedict == prog->edicts)
174 passedict = NULL;
175 // precalculate prog value for passedict for comparisons
176 passedictprog = PRVM_EDICT_TO_PROG(passedict);
177 // precalculate passedict's owner edict pointer for comparisons
178 traceowner = passedict ? PRVM_PROG_TO_EDICT(PRVM_serveredictedict(passedict, owner)) : 0;
179
180 clipgroup = passedict ? (int)PRVM_serveredictfloat(passedict, clipgroup) : 0;
181
182 // clip to entities
183 // because this uses World_EntitiestoBox, we know all entity boxes overlap
184 // the clip region, so we can skip culling checks in the loop below
185 numtouchedicts = SV_EntitiesInBox(clipboxmins, clipboxmaxs, MAX_EDICTS, touchedicts);
186 if (numtouchedicts > MAX_EDICTS)
187 {
188 // this never happens
189 Con_Printf("SV_EntitiesInBox returned %i edicts, max was %i\n", numtouchedicts, MAX_EDICTS);
190 numtouchedicts = MAX_EDICTS;
191 }
192 for (i = 0;i < numtouchedicts;i++)
193 {
194 touch = touchedicts[i];
195
197 continue;
199 continue;
200
201 if (passedict)
202 {
203 // don't clip against self
204 if (passedict == touch)
205 continue;
206 // don't clip owned entities against owner
207 if (traceowner == touch)
208 continue;
209 // don't clip owner against owned entities
210 if (passedictprog == PRVM_serveredictedict(touch, owner))
211 continue;
212 // don't clip against any entities in the same clipgroup (DP_RM_CLIPGROUP)
213 if (clipgroup && clipgroup == (int)PRVM_serveredictfloat(touch, clipgroup))
214 continue;
215 // don't clip points against points (they can't collide)
217 continue;
218 }
219
221
222 // might interact, so do an exact clip
223 model = NULL;
224 if ((int) PRVM_serveredictfloat(touch, solid) == SOLID_BSP || type == MOVE_HITMODEL)
225 {
227 pitchsign = SV_GetPitchSign(prog, touch);
228 }
229 if (model)
231 else
233 Matrix4x4_Invert_Simple(&imatrix, &matrix);
234 VM_GenerateFrameGroupBlend(prog, touch->priv.server->framegroupblend, touch);
235 VM_FrameBlendFromFrameGroupBlend(touch->priv.server->frameblend, touch->priv.server->framegroupblend, model, sv.time);
236 VM_UpdateEdictSkeleton(prog, touch, model, touch->priv.server->frameblend);
237 VectorCopy(PRVM_serveredictvector(touch, mins), touchmins);
238 VectorCopy(PRVM_serveredictvector(touch, maxs), touchmaxs);
239 if (type == MOVE_MISSILE && (int)PRVM_serveredictfloat(touch, flags) & FL_MONSTER)
240 Collision_ClipToGenericEntity(&trace, model, touch->priv.server->frameblend, &touch->priv.server->skeleton, touchmins, touchmaxs, bodysupercontents, &matrix, &imatrix, clipstart, clipmins2, clipmaxs2, clipstart, hitsupercontentsmask, skipsupercontentsmask, skipmaterialflagsmask, 0.0f);
241 else
242 Collision_ClipPointToGenericEntity(&trace, model, touch->priv.server->frameblend, &touch->priv.server->skeleton, touchmins, touchmaxs, bodysupercontents, &matrix, &imatrix, clipstart, hitsupercontentsmask, skipsupercontentsmask, skipmaterialflagsmask);
243
244 Collision_CombineTraces(&cliptrace, &trace, (void *)touch, PRVM_serveredictfloat(touch, solid) == SOLID_BSP);
245 }
246
247finished:
248 return cliptrace;
249}
void Collision_ClipPointToWorld(trace_t *trace, model_t *model, const vec3_t start, int hitsupercontentsmask, int skipsupercontentsmask, int skipmaterialflagsmask)
Definition collision.c:1905
void Collision_ClipPointToGenericEntity(trace_t *trace, model_t *model, const frameblend_t *frameblend, const skeleton_t *skeleton, const vec3_t bodymins, const vec3_t bodymaxs, int bodysupercontents, matrix4x4_t *matrix, matrix4x4_t *inversematrix, const vec3_t start, int hitsupercontentsmask, int skipsupercontentsmask, int skipmaterialflagsmask)
Definition collision.c:1883

References angles, trace_t::bmodelstartsolid, clipgroup, Collision_ClipPointToGenericEntity(), Collision_ClipPointToWorld(), Collision_ClipToGenericEntity(), Collision_CombineTraces(), Con_Printf(), prvm_prog_t::edicts, trace_t::endpos, trace_t::ent, FL_MONSTER, flags, trace_t::fraction, i, int(), cvar_t::integer, Matrix4x4_CreateFromQuakeEntity(), Matrix4x4_CreateTranslate(), Matrix4x4_Invert_Simple(), max, MAX_EDICTS, maxs, min, mins, model, MOVE_HITMODEL, MOVE_MISSILE, MOVE_NOMONSTERS, MOVE_WORLDONLY, NULL, origin, owner, prvm_edict_t::priv, PRVM_EDICT_TO_PROG, PRVM_PROG_TO_EDICT, PRVM_serveredictedict, PRVM_serveredictfloat, PRVM_serveredictvector, prvm_edict_t::server, solid, SOLID_BBOX, SOLID_BSP, SOLID_CORPSE, trace_t::startsolid, SUPERCONTENTS_BODY, SUPERCONTENTS_CORPSE, sv, sv_debugmove, SV_EntitiesInBox(), SV_GetModelFromEdict(), SV_GetPitchSign(), SVVM_prog, server_t::time, type, VectorClear, VectorCompare, VectorCopy, VM_FrameBlendFromFrameGroupBlend(), VM_GenerateFrameGroupBlend(), VM_UpdateEdictSkeleton(), server_t::worldmodel, and trace_t::worldstartsolid.

Referenced by SV_TraceBox(), and SV_TraceLine().

◆ SV_VM_ConsoleCommand()

qbool SV_VM_ConsoleCommand ( const char * text,
size_t textlen )

Definition at line 2927 of file svvm_cmds.c.

2928{
2929 prvm_prog_t *prog = SVVM_prog;
2930 return PRVM_ConsoleCommand(prog, text, textlen, &prog->funcoffsets.ConsoleCmd, true, PRVM_EDICT_TO_PROG(sv.world.prog->edicts), sv.time, "QC function ConsoleCmd is missing");
2931}
qbool PRVM_ConsoleCommand(prvm_prog_t *prog, const char *text, size_t textlen, int *func, qbool preserve_self, int curself, double ptime, const char *error_message)
Definition prvm_cmds.c:68
prvm_prog_funcoffsets_t funcoffsets
Definition progsvm.h:693
struct prvm_prog_s * prog
Definition world.h:73

References prvm_prog_t::funcoffsets, world_t::prog, PRVM_ConsoleCommand(), PRVM_EDICT_TO_PROG, sv, SVVM_prog, server_t::time, and server_t::world.

Referenced by Cmd_CL_Callback(), and Cmd_SV_Callback().

◆ SV_WriteClientdataToMessage()

void SV_WriteClientdataToMessage ( client_t * client,
prvm_edict_t * ent,
sizebuf_t * msg,
int * stats )

Definition at line 1091 of file sv_send.c.

1092{
1093 prvm_prog_t *prog = SVVM_prog;
1094 int bits;
1095 int i;
1097 int items;
1099 int viewzoom;
1100 const char *s;
1101 float *statsf = (float *)stats;
1102 float gravity;
1103
1104//
1105// send a damage message
1106//
1108 {
1113 for (i=0 ; i<3 ; i++)
1115
1118 }
1119
1120//
1121// send the current viewpos offset from the view entity
1122//
1123 SV_SetIdealPitch (); // how much to look up / down ideally
1124
1125// a fixangle might get lost in a dropped packet. Oh well.
1127 {
1128 // angle fixing was requested by global thinking code...
1129 // so store the current angles for later use
1132
1133 // and clear fixangle for the next frame
1135 }
1136
1138 {
1140 for (i=0 ; i < 3 ; i++)
1143 }
1144
1145 // the runes are in serverflags, pack them into the items value, also pack
1146 // in the items2 value for mission pack huds
1147 // (used only in the mission packs, which do not use serverflags)
1149 | (((int)PRVM_serveredictfloat(ent, items2) & ((1<<9)-1)) << 23)
1150 | (((int)PRVM_serverglobalfloat(serverflags) & ((1<<4)-1)) << 28);
1151
1153
1154 // cache weapon model name and index in client struct to save time
1155 // (this search can be almost 1% of cpu time!)
1157 if (strcmp(s, client->weaponmodel))
1158 {
1159 dp_strlcpy(client->weaponmodel, s, sizeof(client->weaponmodel));
1160 client->weaponmodelindex = SV_ModelIndex(s, 1);
1161 }
1162
1163 viewzoom = (int)(PRVM_serveredictfloat(ent, viewzoom) * 255.0f);
1164 if (viewzoom == 0)
1165 viewzoom = 255;
1166
1167 bits = 0;
1168
1169 if ((int)PRVM_serveredictfloat(ent, flags) & FL_ONGROUND)
1170 bits |= SU_ONGROUND;
1171 if (PRVM_serveredictfloat(ent, waterlevel) >= 2)
1172 bits |= SU_INWATER;
1174 bits |= SU_IDEALPITCH;
1175
1176 for (i=0 ; i<3 ; i++)
1177 {
1179 bits |= (SU_PUNCH1<<i);
1181 if (punchvector[i])
1182 bits |= (SU_PUNCHVEC1<<i);
1184 bits |= (SU_VELOCITY1<<i);
1185 }
1186
1187 gravity = PRVM_serveredictfloat(ent, gravity);if (!gravity) gravity = 1.0f;
1188
1189 memset(stats, 0, sizeof(int[MAX_CL_STATS]));
1191 stats[STAT_ITEMS] = items;
1194 stats[STAT_WEAPON] = client->weaponmodelindex;
1202 stats[STAT_VIEWZOOM] = viewzoom;
1205 // the QC bumps these itself by sending svc_'s, so we have to keep them
1206 // zero or they'll be corrected by the engine
1207 //stats[STAT_SECRETS] = PRVM_serverglobalfloat(found_secrets);
1208 //stats[STAT_MONSTERS] = PRVM_serverglobalfloat(killed_monsters);
1209
1210 if(!sv_qcstats.integer)
1211 {
1217 // movement settings for prediction
1218 // note: these are not sent in protocols with lower MAX_CL_STATS limits
1223 ;
1233 statsf[STAT_FRAGLIMIT] = fraglimit.value;
1234 statsf[STAT_TIMELIMIT] = timelimit.value;
1242 statsf[STAT_MOVEVARS_SPECTATORMAXSPEED] = sv_maxspeed.value; // FIXME: QW has a separate cvar for this
1246 statsf[STAT_MOVEVARS_ENTGRAVITY] = gravity;
1253 }
1254
1256 {
1257 if (stats[STAT_VIEWHEIGHT] != DEFAULT_VIEWHEIGHT) bits |= SU_VIEWHEIGHT;
1258 bits |= SU_ITEMS;
1259 if (stats[STAT_WEAPONFRAME]) bits |= SU_WEAPONFRAME;
1260 if (stats[STAT_ARMOR]) bits |= SU_ARMOR;
1261 bits |= SU_WEAPON;
1262 // FIXME: which protocols support this? does PROTOCOL_DARKPLACES3 support viewzoom?
1264 if (viewzoom != 255)
1265 bits |= SU_VIEWZOOM;
1266 }
1267
1268 if (bits >= 65536)
1269 bits |= SU_EXTEND1;
1270 if (bits >= 16777216)
1271 bits |= SU_EXTEND2;
1272
1273 // send the data
1275 MSG_WriteShort (msg, bits);
1276 if (bits & SU_EXTEND1)
1277 MSG_WriteByte(msg, bits >> 16);
1278 if (bits & SU_EXTEND2)
1279 MSG_WriteByte(msg, bits >> 24);
1280
1281 if (bits & SU_VIEWHEIGHT)
1282 MSG_WriteChar (msg, stats[STAT_VIEWHEIGHT]);
1283
1284 if (bits & SU_IDEALPITCH)
1286
1287 for (i=0 ; i<3 ; i++)
1288 {
1289 if (bits & (SU_PUNCH1<<i))
1290 {
1293 else
1295 }
1296 if (bits & (SU_PUNCHVEC1<<i))
1297 {
1300 else
1302 }
1303 if (bits & (SU_VELOCITY1<<i))
1304 {
1306 MSG_WriteChar(msg, (int)(PRVM_serveredictvector(ent, velocity)[i] * (1.0f / 16.0f)));
1307 else
1309 }
1310 }
1311
1312 if (bits & SU_ITEMS)
1313 MSG_WriteLong (msg, stats[STAT_ITEMS]);
1314
1316 {
1317 if (bits & SU_WEAPONFRAME)
1318 MSG_WriteShort (msg, stats[STAT_WEAPONFRAME]);
1319 if (bits & SU_ARMOR)
1320 MSG_WriteShort (msg, stats[STAT_ARMOR]);
1321 if (bits & SU_WEAPON)
1322 MSG_WriteShort (msg, stats[STAT_WEAPON]);
1323 MSG_WriteShort (msg, stats[STAT_HEALTH]);
1324 MSG_WriteShort (msg, stats[STAT_AMMO]);
1325 MSG_WriteShort (msg, stats[STAT_SHELLS]);
1326 MSG_WriteShort (msg, stats[STAT_NAILS]);
1327 MSG_WriteShort (msg, stats[STAT_ROCKETS]);
1328 MSG_WriteShort (msg, stats[STAT_CELLS]);
1329 MSG_WriteShort (msg, stats[STAT_ACTIVEWEAPON]);
1330 if (bits & SU_VIEWZOOM)
1331 MSG_WriteShort (msg, bound(0, stats[STAT_VIEWZOOM], 65535));
1332 }
1334 {
1335 if (bits & SU_WEAPONFRAME)
1336 MSG_WriteByte (msg, stats[STAT_WEAPONFRAME]);
1337 if (bits & SU_ARMOR)
1338 MSG_WriteByte (msg, stats[STAT_ARMOR]);
1339 if (bits & SU_WEAPON)
1340 {
1342 MSG_WriteShort (msg, stats[STAT_WEAPON]);
1343 else
1344 MSG_WriteByte (msg, stats[STAT_WEAPON]);
1345 }
1346 MSG_WriteShort (msg, stats[STAT_HEALTH]);
1347 MSG_WriteByte (msg, stats[STAT_AMMO]);
1348 MSG_WriteByte (msg, stats[STAT_SHELLS]);
1349 MSG_WriteByte (msg, stats[STAT_NAILS]);
1350 MSG_WriteByte (msg, stats[STAT_ROCKETS]);
1351 MSG_WriteByte (msg, stats[STAT_CELLS]);
1353 {
1354 for (i = 0;i < 32;i++)
1355 if (stats[STAT_ACTIVEWEAPON] & (1<<i))
1356 break;
1357 MSG_WriteByte (msg, i);
1358 }
1359 else
1360 MSG_WriteByte (msg, stats[STAT_ACTIVEWEAPON]);
1361 if (bits & SU_VIEWZOOM)
1362 {
1364 MSG_WriteByte (msg, bound(0, stats[STAT_VIEWZOOM], 255));
1365 else
1366 MSG_WriteShort (msg, bound(0, stats[STAT_VIEWZOOM], 65535));
1367 }
1368 }
1369}
cvar_t host_timescale
Definition sv_main.c:228
#define IS_OLDNEXUIZ_DERIVED(g)
Definition com_game.h:73
@ GAME_QUOTH
Definition com_game.h:31
@ GAME_ROGUE
Definition com_game.h:30
@ GAME_HIPNOTIC
Definition com_game.h:29
void MSG_WriteCoord32f(sizebuf_t *sb, float f)
Definition com_msg.c:197
void MSG_WriteAngle16i(sizebuf_t *sb, float f)
Definition com_msg.c:227
void MSG_WriteCoord16i(sizebuf_t *sb, float f)
Definition com_msg.c:192
float viewzoom
vector punchvector
float ammo_rockets
Definition progsdefs.qc:143
float weapon
Definition progsdefs.qc:139
float ammo_shells
Definition progsdefs.qc:143
float dmg_take
Definition progsdefs.qc:198
float weaponframe
Definition progsdefs.qc:141
float items
Definition progsdefs.qc:145
float armorvalue
Definition progsdefs.qc:179
float ammo_nails
Definition progsdefs.qc:143
float currentammo
Definition progsdefs.qc:142
float ammo_cells
Definition progsdefs.qc:143
string weaponmodel
Definition progsdefs.qc:140
float dmg_save
Definition progsdefs.qc:199
entity dmg_inflictor
Definition progsdefs.qc:200
#define SU_VELOCITY1
Definition protocol.h:157
#define SU_VIEWHEIGHT
Definition protocol.h:152
#define SU_WEAPON
Definition protocol.h:166
#define SU_WEAPONFRAME
Definition protocol.h:164
#define SU_EXTEND1
Definition protocol.h:167
#define SU_IDEALPITCH
Definition protocol.h:153
#define SU_PUNCH1
Definition protocol.h:154
#define SU_PUNCHVEC1
Definition protocol.h:169
#define SU_ITEMS
Definition protocol.h:161
#define DEFAULT_VIEWHEIGHT
Definition protocol.h:198
#define SU_INWATER
no data follows, the bit is it
Definition protocol.h:163
#define svc_damage
Definition protocol.h:238
#define SU_EXTEND2
another byte to follow, future expansion
Definition protocol.h:176
#define SU_VIEWZOOM
byte factor (0 = 0.0 (not valid), 255 = 1.0)
Definition protocol.h:172
#define SU_ONGROUND
no data follows, the bit is it
Definition protocol.h:162
#define svc_clientdata
Definition protocol.h:234
#define SU_ARMOR
Definition protocol.h:165
#define STAT_MOVEVARS_WARSOWBUNNY_ACCEL
DP.
Definition qstats.h:37
#define STAT_WEAPONFRAME
Definition qstats.h:13
#define STAT_MOVEFLAGS
DP.
Definition qstats.h:35
#define STAT_MOVEVARS_MAXAIRSPEED
DP.
Definition qstats.h:62
#define STAT_HEALTH
Definition qstats.h:8
#define STAT_MOVEVARS_AIRACCELERATE
DP.
Definition qstats.h:57
#define STAT_MOVEVARS_WATERACCELERATE
DP.
Definition qstats.h:58
#define STAT_SHELLS
Definition qstats.h:14
#define STAT_MOVEVARS_AIRACCEL_QW
DP.
Definition qstats.h:64
#define STAT_MOVEVARS_AIRSTOPACCELERATE
DP.
Definition qstats.h:41
#define STAT_MOVEVARS_TIMESCALE
DP.
Definition qstats.h:51
#define STAT_NAILS
Definition qstats.h:15
#define STAT_MOVEVARS_AIRSTRAFEACCEL_QW
DP.
Definition qstats.h:33
#define STAT_MOVEVARS_AIRCONTROL
DP.
Definition qstats.h:44
#define STAT_MOVEVARS_WARSOWBUNNY_BACKTOSIDERATIO
DP.
Definition qstats.h:40
#define STAT_MOVEVARS_GRAVITY
DP.
Definition qstats.h:52
#define STAT_MOVEVARS_AIRSTRAFEACCELERATE
DP.
Definition qstats.h:42
#define STAT_MOVEVARS_AIRACCEL_QW_STRETCHFACTOR
DP.
Definition qstats.h:30
#define STAT_MOVEVARS_TICRATE
DP.
Definition qstats.h:50
#define STAT_FRAGLIMIT
DP.
Definition qstats.h:45
#define STAT_ACTIVEWEAPON
Definition qstats.h:18
#define STAT_MOVEVARS_SPECTATORMAXSPEED
DP.
Definition qstats.h:55
#define STAT_MOVEVARS_MAXSPEED
DP.
Definition qstats.h:54
#define STAT_CELLS
Definition qstats.h:17
#define STAT_MOVEVARS_STEPHEIGHT
DP.
Definition qstats.h:63
#define STAT_MOVEVARS_AIRSPEEDLIMIT_NONQW
DP.
Definition qstats.h:32
#define STAT_MOVEVARS_AIRCONTROL_PENALTY
DP.
Definition qstats.h:31
#define STAT_MOVEVARS_AIRACCEL_SIDEWAYS_FRICTION
DP.
Definition qstats.h:65
#define STAT_MOVEVARS_WARSOWBUNNY_AIRFORWARDACCEL
DP.
Definition qstats.h:36
#define STAT_MOVEVARS_MAXAIRSTRAFESPEED
DP.
Definition qstats.h:43
#define STAT_MOVEVARS_STOPSPEED
DP.
Definition qstats.h:53
#define STAT_MOVEVARS_ACCELERATE
DP.
Definition qstats.h:56
#define STAT_ARMOR
Definition qstats.h:12
#define STAT_MOVEVARS_ENTGRAVITY
DP.
Definition qstats.h:59
#define STAT_AMMO
Definition qstats.h:11
#define STAT_MOVEVARS_WATERFRICTION
DP.
Definition qstats.h:49
#define STAT_MOVEVARS_EDGEFRICTION
DP.
Definition qstats.h:61
#define STAT_TIMELIMIT
DP.
Definition qstats.h:46
#define STAT_MOVEVARS_AIRCONTROL_POWER
DP.
Definition qstats.h:34
#define STAT_ITEMS
FTE, DP.
Definition qstats.h:23
#define STAT_MOVEVARS_WARSOWBUNNY_TURNACCEL
DP.
Definition qstats.h:39
#define STAT_WEAPON
Definition qstats.h:10
#define STAT_MOVEVARS_JUMPVELOCITY
DP.
Definition qstats.h:60
#define STAT_MOVEVARS_WARSOWBUNNY_TOPSPEED
DP.
Definition qstats.h:38
#define STAT_ROCKETS
Definition qstats.h:16
#define STAT_MOVEVARS_FRICTION
DP.
Definition qstats.h:48
#define STAT_VIEWZOOM
DP.
Definition qstats.h:27
#define STAT_VIEWHEIGHT
FTE, DP.
Definition qstats.h:24
#define MOVEFLAG_Q2AIRACCELERATE
Definition quakedef.h:33
#define MOVEFLAG_NOGRAVITYONGROUND
Definition quakedef.h:34
#define MOVEFLAG_GRAVITYUNAFFECTEDBYTICRATE
Definition quakedef.h:35
#define MOVEFLAG_VALID
Definition quakedef.h:32
cvar_t sv_waterfriction
Definition sv_main.c:157
cvar_t sv_airaccel_qw
Definition sv_main.c:57
cvar_t sv_maxairstrafespeed
Definition sv_main.c:64
cvar_t sv_airstopaccelerate
Definition sv_main.c:61
cvar_t sv_maxairspeed
Definition sv_main.c:140
cvar_t timelimit
Definition sv_main.c:173
void SV_SetIdealPitch(void)
Definition sv_user.c:239
cvar_t sv_jumpvelocity
Definition sv_main.c:138
cvar_t sv_airspeedlimit_nonqw
Definition sv_main.c:62
cvar_t sv_aircontrol
Definition sv_main.c:66
int SV_ModelIndex(const char *s, int precachemode)
Definition sv_main.c:1411
cvar_t sv_gameplayfix_nogravityonground
Definition sv_main.c:120
cvar_t sv_wateraccelerate
Definition sv_main.c:156
cvar_t sv_aircontrol_penalty
Definition sv_main.c:68
cvar_t sys_ticrate
Definition sv_main.c:166
cvar_t sv_maxspeed
Definition sv_main.c:142
cvar_t sv_airstrafeaccelerate
Definition sv_main.c:63
cvar_t sv_gameplayfix_gravityunaffectedbyticrate
Definition sv_main.c:111
cvar_t sv_gameplayfix_q2airaccelerate
Definition sv_main.c:119
cvar_t sv_aircontrol_power
Definition sv_main.c:67
cvar_t sv_airstrafeaccel_qw
Definition sv_main.c:65
cvar_t sv_edgefriction
Definition sv_main.c:100
cvar_t fraglimit
Definition sv_main.c:45
cvar_t sv_friction
Definition sv_main.c:103
cvar_t sv_stopspeed
Definition sv_main.c:154
cvar_t sv_airaccel_sideways_friction
Definition sv_main.c:59
cvar_t sv_airaccelerate
Definition sv_main.c:60
cvar_t sv_accelerate
Definition sv_main.c:55
cvar_t sv_airaccel_qw_stretchfactor
Definition sv_main.c:58
cvar_t sv_warsowbunny_turnaccel
Definition sv_main.c:161
cvar_t sv_qcstats
Definition sv_main.c:148
cvar_t sv_warsowbunny_airforwardaccel
Definition sv_main.c:158
cvar_t sv_warsowbunny_accel
Definition sv_main.c:159
cvar_t sv_warsowbunny_backtosideratio
Definition sv_main.c:162
cvar_t sv_warsowbunny_topspeed
Definition sv_main.c:160

References ammo_cells, ammo_nails, ammo_rockets, ammo_shells, angles, armorvalue, bound, currentammo, DEFAULT_VIEWHEIGHT, dmg_inflictor, dmg_save, dmg_take, dp_strlcpy, fixangle, client_t::fixangle_angles, client_t::fixangle_angles_set, FL_ONGROUND, flags, fraglimit, GAME_HIPNOTIC, GAME_QUOTH, GAME_ROGUE, gamemode, health, host_client, host_timescale, i, idealpitch, int(), cvar_t::integer, IS_OLDNEXUIZ_DERIVED, items, MAX_CL_STATS, maxs, mins, MOVEFLAG_GRAVITYUNAFFECTEDBYTICRATE, MOVEFLAG_NOGRAVITYONGROUND, MOVEFLAG_Q2AIRACCELERATE, MOVEFLAG_VALID, MSG_WriteAngle(), MSG_WriteAngle16i(), MSG_WriteByte(), MSG_WriteChar(), MSG_WriteCoord(), MSG_WriteCoord16i(), MSG_WriteCoord32f(), MSG_WriteLong(), MSG_WriteShort(), origin, other, server_t::protocol, PROTOCOL_DARKPLACES1, PROTOCOL_DARKPLACES2, PROTOCOL_DARKPLACES3, PROTOCOL_DARKPLACES4, PROTOCOL_DARKPLACES5, PROTOCOL_NEHAHRABJP, PROTOCOL_NEHAHRABJP2, PROTOCOL_NEHAHRABJP3, PROTOCOL_NEHAHRAMOVIE, PROTOCOL_QUAKE, PROTOCOL_QUAKEDP, PRVM_GetString(), PRVM_PROG_TO_EDICT, PRVM_serveredictedict, PRVM_serveredictfloat, PRVM_serveredictstring, PRVM_serveredictvector, PRVM_serverglobalfloat, punchangle, punchvector, serverflags, STAT_ACTIVEWEAPON, STAT_AMMO, STAT_ARMOR, STAT_CELLS, STAT_FRAGLIMIT, STAT_HEALTH, STAT_ITEMS, STAT_MOVEFLAGS, STAT_MOVEVARS_ACCELERATE, STAT_MOVEVARS_AIRACCEL_QW, STAT_MOVEVARS_AIRACCEL_QW_STRETCHFACTOR, STAT_MOVEVARS_AIRACCEL_SIDEWAYS_FRICTION, STAT_MOVEVARS_AIRACCELERATE, STAT_MOVEVARS_AIRCONTROL, STAT_MOVEVARS_AIRCONTROL_PENALTY, STAT_MOVEVARS_AIRCONTROL_POWER, STAT_MOVEVARS_AIRSPEEDLIMIT_NONQW, STAT_MOVEVARS_AIRSTOPACCELERATE, STAT_MOVEVARS_AIRSTRAFEACCEL_QW, STAT_MOVEVARS_AIRSTRAFEACCELERATE, STAT_MOVEVARS_EDGEFRICTION, STAT_MOVEVARS_ENTGRAVITY, STAT_MOVEVARS_FRICTION, STAT_MOVEVARS_GRAVITY, STAT_MOVEVARS_JUMPVELOCITY, STAT_MOVEVARS_MAXAIRSPEED, STAT_MOVEVARS_MAXAIRSTRAFESPEED, STAT_MOVEVARS_MAXSPEED, STAT_MOVEVARS_SPECTATORMAXSPEED, STAT_MOVEVARS_STEPHEIGHT, STAT_MOVEVARS_STOPSPEED, STAT_MOVEVARS_TICRATE, STAT_MOVEVARS_TIMESCALE, STAT_MOVEVARS_WARSOWBUNNY_ACCEL, STAT_MOVEVARS_WARSOWBUNNY_AIRFORWARDACCEL, STAT_MOVEVARS_WARSOWBUNNY_BACKTOSIDERATIO, STAT_MOVEVARS_WARSOWBUNNY_TOPSPEED, STAT_MOVEVARS_WARSOWBUNNY_TURNACCEL, STAT_MOVEVARS_WATERACCELERATE, STAT_MOVEVARS_WATERFRICTION, STAT_NAILS, STAT_ROCKETS, STAT_SHELLS, STAT_TIMELIMIT, STAT_TOTALMONSTERS, STAT_TOTALSECRETS, STAT_VIEWHEIGHT, STAT_VIEWZOOM, STAT_WEAPON, STAT_WEAPONFRAME, SU_ARMOR, SU_EXTEND1, SU_EXTEND2, SU_IDEALPITCH, SU_INWATER, SU_ITEMS, SU_ONGROUND, SU_PUNCH1, SU_PUNCHVEC1, SU_VELOCITY1, SU_VIEWHEIGHT, SU_VIEWZOOM, SU_WEAPON, SU_WEAPONFRAME, sv, sv_accelerate, sv_airaccel_qw, sv_airaccel_qw_stretchfactor, sv_airaccel_sideways_friction, sv_airaccelerate, sv_aircontrol, sv_aircontrol_penalty, sv_aircontrol_power, sv_airspeedlimit_nonqw, sv_airstopaccelerate, sv_airstrafeaccel_qw, sv_airstrafeaccelerate, sv_edgefriction, sv_friction, sv_gameplayfix_gravityunaffectedbyticrate, sv_gameplayfix_nogravityonground, sv_gameplayfix_q2airaccelerate, sv_gravity, sv_jumpvelocity, sv_maxairspeed, sv_maxairstrafespeed, sv_maxspeed, SV_ModelIndex(), sv_qcstats, SV_SetIdealPitch(), sv_stepheight, sv_stopspeed, sv_warsowbunny_accel, sv_warsowbunny_airforwardaccel, sv_warsowbunny_backtosideratio, sv_warsowbunny_topspeed, sv_warsowbunny_turnaccel, sv_wateraccelerate, sv_waterfriction, svc_clientdata, svc_damage, svc_setangle, SVVM_prog, sys_ticrate, timelimit, total_monsters, total_secrets, cvar_t::value, VectorCopy, velocity, view_ofs, viewzoom, waterlevel, weapon, weaponframe, client_t::weaponmodel, weaponmodel, and client_t::weaponmodelindex.

Referenced by SV_SendClientDatagram(), and SV_Spawn_f().

◆ SV_WriteEntitiesToClient()

void SV_WriteEntitiesToClient ( client_t * client,
prvm_edict_t * clent,
sizebuf_t * msg,
int maxsize )

Definition at line 337 of file sv_ents.c.

338{
339 prvm_prog_t *prog = SVVM_prog;
340 qbool need_empty = false;
341 int i, numsendstates, numcsqcsendstates;
343 prvm_edict_t *camera;
344 qbool success;
345 vec3_t eye;
346
347 // if there isn't enough space to accomplish anything, skip it
348 if (msg->cursize + 25 > maxsize)
349 return;
350
353
359
360 // get eye location
361 sv.writeentitiestoclient_cliententitynumber = PRVM_EDICT_TO_PROG(clent); // LadyHavoc: for comparison purposes
362 camera = PRVM_EDICT_NUM( client->clientcamera );
364 // get the PVS values for the eye location, later FatPVS calls will merge
365 if (sv.worldmodel && sv.worldmodel->brush.FatPVS)
366 sv.worldmodel->brush.FatPVS(sv.worldmodel, eye, 8, &sv.writeentitiestoclient_pvs, sv_mempool, false);
367 else
369
370 // add the eye to a list for SV_CanSeeBox tests
373
374 // calculate predicted eye origin for SV_CanSeeBox tests
376 {
378 vec3_t predeye;
379 VectorMA(eye, predtime, PRVM_serveredictvector(camera, velocity), predeye);
380 if (SV_CanSeeBox(1, 0, 0, 0, eye, predeye, predeye))
381 {
384 }
385 //if (!sv.writeentitiestoclient_useprediction)
386 // Con_DPrintf("Trying to walk into solid in a pingtime... not predicting for culling\n");
387 }
388
390
391 // build PVS from the new eyes
392 if (sv.worldmodel && sv.worldmodel->brush.FatPVS)
393 for(i = 1; i < sv.writeentitiestoclient_numeyes; ++i)
395
397
398 for (i = 0;i < sv.numsendentities;i++)
400
401 numsendstates = 0;
402 numcsqcsendstates = 0;
403 for (i = 0;i < sv.numsendentities;i++)
404 {
405 s = &sv.sendentities[i];
407 {
408 if(s->active == ACTIVE_NETWORK)
409 {
411 {
414 else
415 s->flags &= ~RENDER_EXTERIORMODEL;
416 }
417 sv.writeentitiestoclient_sendstates[numsendstates++] = s;
418 }
420 sv.writeentitiestoclient_csqcsendstates[numcsqcsendstates++] = s->number;
421 else
422 Con_Printf("entity %d is in sv.sendentities and marked, but not active, please breakpoint me\n", s->number);
423 }
424 }
425
428
429 if(client->entitydatabase5)
430 need_empty = EntityFrameCSQC_WriteFrame(msg, maxsize, numcsqcsendstates, sv.writeentitiestoclient_csqcsendstates, client->entitydatabase5->latestframenum + 1);
431 else
432 EntityFrameCSQC_WriteFrame(msg, maxsize, numcsqcsendstates, sv.writeentitiestoclient_csqcsendstates, 0);
433
434 // force every 16th frame to be not empty (or cl_movement replay takes
435 // too long)
436 // BTW, this should normally not kick in any more due to the check
437 // below, except if the client stopped sending movement frames
438 if(client->num_skippedentityframes >= 16)
439 need_empty = true;
440
441 // help cl_movement a bit more
442 if(client->movesequence != client->lastmovesequence)
443 need_empty = true;
444 client->lastmovesequence = client->movesequence;
445
446 if (client->entitydatabase5)
447 success = EntityFrame5_WriteFrame(msg, maxsize, client->entitydatabase5, numsendstates, sv.writeentitiestoclient_sendstates, client - svs.clients + 1, client->movesequence, need_empty);
448 else if (client->entitydatabase4)
449 {
450 success = EntityFrame4_WriteFrame(msg, maxsize, client->entitydatabase4, numsendstates, sv.writeentitiestoclient_sendstates);
452 }
453 else if (client->entitydatabase)
454 {
455 success = EntityFrame_WriteFrame(msg, maxsize, client->entitydatabase, numsendstates, sv.writeentitiestoclient_sendstates, client - svs.clients + 1);
457 }
458 else
459 {
460 success = EntityFrameQuake_WriteFrame(msg, maxsize, numsendstates, sv.writeentitiestoclient_sendstates);
462 }
463
464 if(success)
465 client->num_skippedentityframes = 0;
466 else
467 ++client->num_skippedentityframes;
468}
#define VectorMA(a, scale, b, out)
Definition mathlib.h:114
void Protocol_WriteStatsReliable(void)
Definition protocol.c:151
#define RENDER_EXTERIORMODEL
Definition protocol.h:359
qbool EntityFrameQuake_WriteFrame(struct sizebuf_s *msg, int maxsize, int numstates, const entity_state_t **states)
qbool EntityFrameCSQC_WriteFrame(struct sizebuf_s *msg, int maxsize, int numnumbers, const unsigned short *numbers, int framenum)
qbool EntityFrame4_WriteFrame(struct sizebuf_s *msg, int maxsize, entityframe4_database_t *d, int numstates, const entity_state_t **states)
qbool EntityFrame5_WriteFrame(struct sizebuf_s *msg, int maxsize, entityframe5_database_t *d, int numstates, const entity_state_t **states, int viewentnum, unsigned int movesequence, qbool need_empty)
@ ACTIVE_SHARED
Definition protocol.h:434
@ ACTIVE_NETWORK
Definition protocol.h:433
cvar_t sv_cullentities_stats
Definition sv_main.c:83
void SV_AddCameraEyes(void)
Definition sv_send.c:1063
cvar_t sv_cullentities_trace_prediction
Definition sv_main.c:90
mempool_t * sv_mempool
Definition sv_main.c:226
qbool SV_CanSeeBox(int numsamples, vec_t eyejitter, vec_t enlarge, vec_t entboxexpand, vec3_t eye, vec3_t entboxmins, vec3_t entboxmaxs)
Definition sv_send.c:723
void SV_MarkWriteEntityStateToClient(entity_state_t *s, client_t *client)
Definition sv_send.c:863
unsigned int lastmovesequence
Definition server.h:305
int num_skippedentityframes
Definition server.h:301
unsigned char flags
Definition protocol.h:468
unsigned short exteriormodelforclient
Definition protocol.h:454
unsigned char active
Definition protocol.h:459
int numsendentities
Definition server.h:159
sizebuf_t * writeentitiestoclient_msg
Definition server.h:152
const entity_state_t * writeentitiestoclient_sendstates[MAX_EDICTS]
Definition server.h:156
unsigned short writeentitiestoclient_csqcsendstates[MAX_EDICTS]
Definition server.h:157
entity_state_t sendentities[MAX_EDICTS]
Definition server.h:160
qbool EntityFrame_WriteFrame(sizebuf_t *msg, int maxsize, entityframe_database_t *d, int numstates, const entity_state_t **states, int viewentnum)
Definition sv_ents.c:268
cvar_t sv_cullentities_trace_prediction_time
Definition sv_main.c:91

References entity_state_t::active, ACTIVE_NETWORK, ACTIVE_SHARED, bound, client_t::clientcamera, server_static_t::clients, Con_Printf(), sizebuf_t::cursize, client_t::entitydatabase, client_t::entitydatabase4, client_t::entitydatabase5, EntityFrame4_WriteFrame(), EntityFrame5_WriteFrame(), EntityFrame_WriteFrame(), EntityFrameCSQC_WriteFrame(), EntityFrameQuake_WriteFrame(), entity_state_t::exteriormodelforclient, entity_state_t::flags, host_client, i, cvar_t::integer, client_t::lastmovesequence, entityframe5_database_t::latestframenum, client_t::movesequence, client_t::name, NULL, client_t::num_skippedentityframes, entity_state_t::number, server_t::numsendentities, origin, client_t::ping, Protocol_WriteStatsReliable(), PRVM_EDICT_NUM, PRVM_EDICT_TO_PROG, PRVM_serveredictvector, RENDER_EXTERIORMODEL, server_t::sendentities, server_t::sententities, server_t::sententitiesmark, sv, SV_AddCameraEyes(), SV_CanSeeBox(), sv_cullentities_stats, sv_cullentities_trace_prediction, sv_cullentities_trace_prediction_time, SV_MarkWriteEntityStateToClient(), sv_mempool, svs, SVVM_prog, cvar_t::value, VectorAdd, VectorCopy, VectorMA, velocity, view_ofs, server_t::worldmodel, server_t::writeentitiestoclient_cliententitynumber, server_t::writeentitiestoclient_clientnumber, server_t::writeentitiestoclient_csqcsendstates, server_t::writeentitiestoclient_eyes, server_t::writeentitiestoclient_msg, server_t::writeentitiestoclient_numeyes, server_t::writeentitiestoclient_pvs, server_t::writeentitiestoclient_sendstates, server_t::writeentitiestoclient_stats_culled_pvs, server_t::writeentitiestoclient_stats_culled_trace, server_t::writeentitiestoclient_stats_totalentities, and server_t::writeentitiestoclient_stats_visibleentities.

Referenced by SV_SendClientDatagram().

◆ VM_CustomStats_Clear()

void VM_CustomStats_Clear ( void )

Definition at line 1717 of file svvm_cmds.c.

1718{
1719 memset(vm_customstats, 0, sizeof(vm_customstats));
1721}
static int vm_customstats_last
Definition svvm_cmds.c:1715
static customstat_t vm_customstats[MAX_CL_STATS]
Definition svvm_cmds.c:1714

References vm_customstats, and vm_customstats_last.

Referenced by SV_VM_Setup().

◆ VM_SV_MoveToGoal()

void VM_SV_MoveToGoal ( prvm_prog_t * prog)

Definition at line 420 of file sv_move.c.

421{
422 prvm_edict_t *ent, *goal;
423 float dist;
424
426
429 dist = PRVM_G_FLOAT(OFS_PARM0);
430
431 if ( !( (int)PRVM_serveredictfloat(ent, flags) & (FL_ONGROUND|FL_FLY|FL_SWIM) ) )
432 {
434 return;
435 }
436
437// if the next step hits the enemy, return immediately
438 if ( PRVM_PROG_TO_EDICT(PRVM_serveredictedict(ent, enemy)) != prog->edicts && SV_CloseEnough (ent, goal, dist) )
439 return;
440
441// bump around...
442 if ( (rand()&3)==1 ||
444 {
445 SV_NewChaseDir (ent, goal, dist);
446 }
447}
float ideal_yaw
Definition progsdefs.qc:184
entity goalentity
Definition progsdefs.qc:189
#define VM_SAFEPARMCOUNT(p, f)
Definition prvm_cmds.h:207
static void SV_NewChaseDir(prvm_edict_t *actor, prvm_edict_t *enemy, float dist)
Definition sv_move.c:310
void VM_SV_MoveToGoal(prvm_prog_t *prog)
Definition sv_move.c:420
static qbool SV_CloseEnough(prvm_edict_t *ent, prvm_edict_t *goal, float dist)
Definition sv_move.c:400
static qbool SV_StepDirection(prvm_edict_t *ent, float yaw, float dist)
Definition sv_move.c:257

References prvm_prog_t::edicts, enemy, FL_FLY, FL_ONGROUND, FL_SWIM, flags, goalentity, ideal_yaw, OFS_PARM0, OFS_RETURN, PRVM_G_FLOAT, PRVM_PROG_TO_EDICT, PRVM_serveredictedict, PRVM_serveredictfloat, PRVM_serverglobaledict, self, SV_CloseEnough(), SV_NewChaseDir(), SV_StepDirection(), VM_SAFEPARMCOUNT, and VM_SV_MoveToGoal().

Referenced by VM_SV_MoveToGoal().

◆ VM_SV_UpdateCustomStats()

void VM_SV_UpdateCustomStats ( client_t * client,
prvm_edict_t * ent,
sizebuf_t * msg,
int * stats )

Definition at line 1723 of file svvm_cmds.c.

1724{
1725 prvm_prog_t *prog = SVVM_prog;
1726 int i;
1727 char s[17];
1728 union {
1729 int i;
1730 float f;
1731 } u;
1732
1734 {
1735 if(!vm_customstats[i].type)
1736 continue;
1737 switch(vm_customstats[i].type)
1738 {
1739 //string as 16 bytes
1740 case 1:
1741 memset(s, 0, 17);
1742 dp_strlcpy(s, PRVM_E_STRING(ent, vm_customstats[i].fieldoffset), 16);
1743 stats[i] = s[ 0] + s[ 1] * 256 + s[ 2] * 65536 + s[ 3] * 16777216;
1744 stats[i+1] = s[ 4] + s[ 5] * 256 + s[ 6] * 65536 + s[ 7] * 16777216;
1745 stats[i+2] = s[ 8] + s[ 9] * 256 + s[10] * 65536 + s[11] * 16777216;
1746 stats[i+3] = s[12] + s[13] * 256 + s[14] * 65536 + s[15] * 16777216;
1747 break;
1748 //float field sent as-is
1749 case 8:
1750 // can't directly use PRVM_E_INT on the field because it may be PRVM_64 and a double is not the representation we want to send
1751 u.f = PRVM_E_FLOAT(ent, vm_customstats[i].fieldoffset);
1752 stats[i] = u.i;
1753 break;
1754 //integer value of float field
1755 case 2:
1756 stats[i] = (int)PRVM_E_FLOAT(ent, vm_customstats[i].fieldoffset);
1757 break;
1758 default:
1759 break;
1760 }
1761 }
1762}
#define PRVM_E_FLOAT(e, o)
Definition progsvm.h:891
#define PRVM_E_STRING(e, o)
Definition progsvm.h:894
#define MIN_VM_STAT
stat range available to VM_SV_AddStat
Definition qstats.h:28

References dp_strlcpy, f, i, int(), MIN_VM_STAT, PRVM_E_FLOAT, PRVM_E_STRING, SVVM_prog, type, vm_customstats, and vm_customstats_last.

Referenced by SV_SendClientDatagram().

Variable Documentation

◆ coop

◆ deathmatch

◆ fraglimit

cvar_t fraglimit
extern

Definition at line 45 of file sv_main.c.

45{CF_SERVER | CF_NOTIFY, "fraglimit","0", "ends level if this many frags is reached by any player"};
#define CF_NOTIFY
cvar should trigger a chat notification to all connected clients when changed
Definition cmd.h:55

Referenced by M_GameOptions_Draw(), M_NetStart_Change(), SV_Init(), and SV_WriteClientdataToMessage().

◆ gamecfg

cvar_t gamecfg
extern

Definition at line 46 of file sv_main.c.

46{CF_SERVER, "gamecfg", "0", "unused cvar in quake, can be used by mods"};

Referenced by SV_Init().

◆ host_client

client_t* host_client
extern

◆ host_limitlocal

cvar_t host_limitlocal
extern

Definition at line 150 of file sv_main.c.

150{CF_SERVER, "host_limitlocal", "0", "whether to apply rate limiting to the local player in a listen server (only useful for testing)"};

Referenced by SV_Init(), and SV_SendClientDatagram().

◆ host_timescale

cvar_t host_timescale
extern

Definition at line 53 of file sv_main.c.

53{CF_CLIENT | CF_SERVER, "host_timescale", "1.0", "controls game speed, 0.5 is half speed, 2 is double speed"};

Referenced by SV_Frame(), SV_Init(), and SV_ThreadFunc().

◆ noexit

cvar_t noexit
extern

Definition at line 47 of file sv_main.c.

47{CF_SERVER | CF_NOTIFY, "noexit","0", "kills anyone attempting to use an exit"};

Referenced by SV_Init().

◆ nomonsters

cvar_t nomonsters
extern

Definition at line 48 of file sv_main.c.

48{CF_SERVER, "nomonsters", "0", "unused cvar in quake, can be used by mods"};

Referenced by SV_Init().

◆ pausable

cvar_t pausable
extern

Definition at line 49 of file sv_main.c.

49{CF_SERVER, "pausable","1", "allow players to pause or not (otherwise, only the server admin can)"};

Referenced by SV_Init(), and SV_Pause_f().

◆ pr_checkextension

cvar_t pr_checkextension
extern

Definition at line 50 of file sv_main.c.

50{CF_SERVER | CF_READONLY, "pr_checkextension", "1", "indicates to QuakeC that the standard quakec extensions system is available (if 0, quakec should not attempt to use extensions)"};
#define CF_READONLY
cvar cannot be changed from the console or the command buffer, and is considered CF_PERSISTENT
Definition cmd.h:54

Referenced by SV_Init().

◆ samelevel

cvar_t samelevel
extern

Definition at line 51 of file sv_main.c.

51{CF_SERVER | CF_NOTIFY, "samelevel","0", "repeats same level if level ends (due to timelimit or someone hitting an exit)"};

Referenced by SV_Init().

◆ saved1

cvar_t saved1
extern

Definition at line 178 of file sv_main.c.

178{CF_SERVER | CF_ARCHIVE, "saved1", "0", "unused cvar in quake that is saved to config.cfg on exit, can be used by mods"};
#define CF_ARCHIVE
cvar should have its set value saved to config.cfg and persist across sessions
Definition cmd.h:53

Referenced by SV_Init().

◆ saved2

cvar_t saved2
extern

Definition at line 179 of file sv_main.c.

179{CF_SERVER | CF_ARCHIVE, "saved2", "0", "unused cvar in quake that is saved to config.cfg on exit, can be used by mods"};

Referenced by SV_Init().

◆ saved3

cvar_t saved3
extern

Definition at line 180 of file sv_main.c.

180{CF_SERVER | CF_ARCHIVE, "saved3", "0", "unused cvar in quake that is saved to config.cfg on exit, can be used by mods"};

Referenced by SV_Init().

◆ saved4

cvar_t saved4
extern

Definition at line 181 of file sv_main.c.

181{CF_SERVER | CF_ARCHIVE, "saved4", "0", "unused cvar in quake that is saved to config.cfg on exit, can be used by mods"};

Referenced by SV_Init().

◆ savedgamecfg

cvar_t savedgamecfg
extern

Definition at line 182 of file sv_main.c.

182{CF_SERVER | CF_ARCHIVE, "savedgamecfg", "0", "unused cvar in quake that is saved to config.cfg on exit, can be used by mods"};

Referenced by SV_Init().

◆ scratch1

cvar_t scratch1
extern

Definition at line 183 of file sv_main.c.

183{CF_SERVER, "scratch1", "0", "unused cvar in quake, can be used by mods"};

Referenced by SV_Init().

◆ scratch2

cvar_t scratch2
extern

Definition at line 184 of file sv_main.c.

184{CF_SERVER,"scratch2", "0", "unused cvar in quake, can be used by mods"};

Referenced by SV_Init().

◆ scratch3

cvar_t scratch3
extern

Definition at line 185 of file sv_main.c.

185{CF_SERVER, "scratch3", "0", "unused cvar in quake, can be used by mods"};

Referenced by SV_Init().

◆ scratch4

cvar_t scratch4
extern

Definition at line 186 of file sv_main.c.

186{CF_SERVER, "scratch4", "0", "unused cvar in quake, can be used by mods"};

Referenced by SV_Init().

◆ skill

cvar_t skill
extern

Definition at line 52 of file sv_main.c.

52{CF_SERVER, "skill","1", "difficulty level of game, affects monster layouts in levels, 0 = easy, 1 = normal, 2 = hard, 3 = nightmare (same layout as hard but monsters fire twice)"};

Referenced by M_GameOptions_Draw(), M_NetStart_Change(), SV_Init(), SV_Loadgame_f(), and SV_SpawnServer().

◆ sv

server_t sv
extern

local server

Definition at line 223 of file sv_main.c.

Referenced by CL_BeginDownloads(), CL_KeepaliveMessage(), CL_ParseServerInfo(), CL_Startdemos_f(), Cvar_SetQuick_Internal(), DropPunchAngle(), droptofloor_bsp_failcond(), EntityFrame5_WriteFrame(), EntityFrameCSQC_WriteFrame(), EntityFrameQuake_WriteFrame(), EntityState5_WriteUpdate(), EntityState_WriteFields(), FS_GameDir_f(), Host_Frame(), Host_Init(), M_GameOptions_Key(), M_Main_Key(), M_Menu_Main_f(), M_Menu_Save_f(), M_SinglePlayer_Key(), M_Transfusion_Skill_Key(), ModList_Enable(), Net_Heartbeat_f(), NetConn_BuildStatusResponse(), NetConn_ClientFrame(), NetConn_Close(), NetConn_Heartbeat(), NetConn_IsLocalGame(), NetConn_ServerParsePacket(), NetConn_sv_netport_Callback(), PHYS_NudgeOutOfSolid(), PHYS_TestEntityPosition(), PrintStats(), Protocol_WriteStatsReliable(), PRVM_ED_CallPostspawnFunction(), PRVM_ED_CallPrespawnFunction(), PRVM_ED_CallSpawnFunction(), PRVM_GarbageCollection(), QW_CL_RequestNextDownload(), R_DrawDebugModel(), Sbar_ShowFPS(), SCR_DrawNetGraph(), SCR_SetUpToDrawConsole(), SV_Accelerate(), SV_AirAccelerate(), SV_AirMove(), SV_AreaStats_f(), SV_Begin_f(), SV_CanSeeBox(), SV_Changelevel_f(), SV_CheckContentsTransition(), SV_Color_f(), SV_ConnectClient(), SV_CreateBaseline(), SV_Download_f(), SV_DropClient(), SV_EntitiesInBox(), SV_ExecuteClientMoves(), SV_FlushBroadcastMessages(), SV_Frame(), SV_GetEntityLocalTagMatrix(), SV_GetModelByIndex(), SV_GetModelFromEdict(), SV_GetTagMatrix(), SV_Gravity(), SV_Impact(), SV_IsLocalServer(), SV_Kick_f(), SV_Kill_f(), SV_LinkEdict(), SV_LinkEdict_TouchAreaGrid_Call(), SV_Loadgame_f(), SV_Map_f(), SV_MarkWriteEntityStateToClient(), SV_MaxPlayers_f(), SV_ModelIndex(), SV_Name(), SV_ParticleEffectIndex(), SV_Pause_f(), SV_Physics(), SV_Physics_ClientEntity(), SV_Physics_ClientEntity_NoThink(), SV_Physics_ClientEntity_PostThink(), SV_Physics_ClientEntity_PreThink(), SV_Physics_ClientMove(), SV_Physics_Entity(), SV_Physics_Pusher(), SV_Physics_Step(), SV_Physics_Toss(), SV_Ping_f(), SV_Pings_f(), SV_PlayerPhysics(), SV_PointSuperContents(), SV_Prepare_CSQC(), SV_PrepareEntitiesForSending(), SV_PrepareEntityForSending(), SV_PreSpawn_f(), SV_PushMove(), SV_ReadClientMessage(), SV_ReadClientMove(), SV_Restart_f(), SV_RunThink(), SV_SaveEntFile_f(), SV_Savegame_f(), SV_Savegame_to(), SV_SaveSpawnparms(), SV_SendClientDatagram(), SV_SendClientMessages(), SV_SendCvar_f(), SV_SendServerinfo(), SV_Shutdown(), SV_SoundIndex(), SV_Spawn_f(), SV_SpawnServer(), SV_StartEffect(), SV_StartParticle(), SV_StartPointSound(), SV_StartSound(), SV_Status_f(), SV_ThreadFunc(), SV_TimingReport(), SV_TraceBox(), SV_TraceLine(), SV_TracePoint(), SV_UpdateToReliableMessages(), SV_UserFriction(), SV_Viewframe_f(), SV_Viewmodel_f(), SV_Viewnext_f(), SV_Viewprev_f(), SV_VM_ConsoleCommand(), SV_VM_Setup(), SV_VM_Shutdown(), SV_WalkMove(), SV_WaterJump(), SV_WaterMove(), SV_WriteClientdataToMessage(), SV_WriteEntitiesToClient(), SVVM_begin_increase_edicts(), SVVM_free_edict(), SVVM_reset_cmd(), Sys_Error(), VM_bprint(), VM_changelevel(), VM_isserver(), VM_M_WriteAngle(), VM_M_WriteCoord(), VM_M_WriteDest(), VM_sprint(), VM_SV_ambientsound(), VM_SV_checkclient(), VM_SV_checkpvs(), VM_SV_droptofloor(), VM_SV_getlight(), VM_SV_gettaginfo(), VM_SV_lightstyle(), VM_SV_makestatic(), VM_SV_modelnameforindex(), VM_SV_newcheckclient(), VM_SV_pointparticles(), VM_SV_setcolor(), VM_SV_setmodel(), VM_SV_setmodelindex(), VM_SV_setpause(), VM_SV_skel_build(), VM_SV_te_beam(), VM_SV_te_blood(), VM_SV_te_bloodshower(), VM_SV_te_customflash(), VM_SV_te_explosion(), VM_SV_te_explosion2(), VM_SV_te_explosionquad(), VM_SV_te_explosionrgb(), VM_SV_te_flamejet(), VM_SV_te_gunshot(), VM_SV_te_gunshotquad(), VM_SV_te_knightspike(), VM_SV_te_lavasplash(), VM_SV_te_lightning1(), VM_SV_te_lightning2(), VM_SV_te_lightning3(), VM_SV_te_particlecube(), VM_SV_te_particlerain(), VM_SV_te_particlesnow(), VM_SV_te_plasmaburn(), VM_SV_te_smallflash(), VM_SV_te_spark(), VM_SV_te_spike(), VM_SV_te_spikequad(), VM_SV_te_superspike(), VM_SV_te_superspikequad(), VM_SV_te_tarexplosion(), VM_SV_te_teleport(), VM_SV_te_wizspike(), VM_SV_trailparticles(), VM_SV_WriteAngle(), VM_SV_WriteCoord(), and WriteDest().

◆ sv_accelerate

cvar_t sv_accelerate
extern

Definition at line 55 of file sv_main.c.

55{CF_SERVER, "sv_accelerate", "10", "rate at which a player accelerates to sv_maxspeed"};

Referenced by SV_Accelerate(), SV_AirAccelerate(), SV_Init(), SV_WaterMove(), and SV_WriteClientdataToMessage().

◆ sv_aim

cvar_t sv_aim
extern

Definition at line 56 of file sv_main.c.

56{CF_SERVER | CF_ARCHIVE, "sv_aim", "2", "maximum cosine angle for quake's vertical autoaim, a value above 1 completely disables the autoaim, quake used 0.93"};

Referenced by SV_Init(), and VM_SV_aim().

◆ sv_airaccel_qw

cvar_t sv_airaccel_qw
extern

Definition at line 57 of file sv_main.c.

57{CF_SERVER, "sv_airaccel_qw", "1", "ratio of QW-style air control as opposed to simple acceleration; when < 0, the speed is clamped against the maximum allowed forward speed after the move"};

Referenced by SV_Init(), and SV_WriteClientdataToMessage().

◆ sv_airaccel_sideways_friction

cvar_t sv_airaccel_sideways_friction
extern

Definition at line 59 of file sv_main.c.

59{CF_SERVER, "sv_airaccel_sideways_friction", "", "anti-sideways movement stabilization (reduces speed gain when zigzagging); when < 0, only so much friction is applied that braking (by accelerating backwards) cannot be stronger"};

Referenced by SV_Init(), and SV_WriteClientdataToMessage().

◆ sv_airaccelerate

cvar_t sv_airaccelerate
extern

Definition at line 60 of file sv_main.c.

60{CF_SERVER, "sv_airaccelerate", "-1", "rate at which a player accelerates to sv_maxairspeed while in the air, if less than 0 the sv_accelerate variable is used instead"};

Referenced by SV_AirAccelerate(), SV_Init(), and SV_WriteClientdataToMessage().

◆ sv_aircontrol

cvar_t sv_aircontrol
extern

Definition at line 66 of file sv_main.c.

66{CF_SERVER, "sv_aircontrol", "0", "CPMA-style air control"};

Referenced by SV_Init(), and SV_WriteClientdataToMessage().

◆ sv_aircontrol_penalty

cvar_t sv_aircontrol_penalty
extern

Definition at line 68 of file sv_main.c.

68{CF_SERVER, "sv_aircontrol_penalty", "0", "deceleration while using CPMA-style air control"};

Referenced by SV_Init(), and SV_WriteClientdataToMessage().

◆ sv_aircontrol_power

cvar_t sv_aircontrol_power
extern

Definition at line 67 of file sv_main.c.

67{CF_SERVER, "sv_aircontrol_power", "2", "CPMA-style air control exponent"};

Referenced by SV_Init(), and SV_WriteClientdataToMessage().

◆ sv_airspeedlimit_nonqw

cvar_t sv_airspeedlimit_nonqw
extern

Definition at line 62 of file sv_main.c.

62{CF_SERVER, "sv_airspeedlimit_nonqw", "0", "when set, this is a soft speed limit while in air when using airaccel_qw not equal to 1"};

Referenced by SV_Init(), and SV_WriteClientdataToMessage().

◆ sv_airstopaccelerate

cvar_t sv_airstopaccelerate
extern

Definition at line 61 of file sv_main.c.

61{CF_SERVER, "sv_airstopaccelerate", "0", "when set, replacement for sv_airaccelerate when moving backwards"};

Referenced by SV_Init(), and SV_WriteClientdataToMessage().

◆ sv_airstrafeaccel_qw

cvar_t sv_airstrafeaccel_qw
extern

Definition at line 65 of file sv_main.c.

65{CF_SERVER, "sv_airstrafeaccel_qw", "0", "when set, replacement for sv_airaccel_qw when just strafing"};

Referenced by SV_Init(), and SV_WriteClientdataToMessage().

◆ sv_airstrafeaccelerate

cvar_t sv_airstrafeaccelerate
extern

Definition at line 63 of file sv_main.c.

63{CF_SERVER, "sv_airstrafeaccelerate", "0", "when set, replacement for sv_airaccelerate when just strafing"};

Referenced by SV_Init(), and SV_WriteClientdataToMessage().

◆ sv_allowdownloads

cvar_t sv_allowdownloads
extern

Definition at line 69 of file sv_main.c.

69{CF_SERVER, "sv_allowdownloads", "1", "whether to allow clients to download files from the server (does not affect http downloads)"};

Referenced by SV_Download_f(), and SV_Init().

◆ sv_allowdownloads_archive

cvar_t sv_allowdownloads_archive
extern

Definition at line 70 of file sv_main.c.

70{CF_SERVER, "sv_allowdownloads_archive", "0", "whether to allow downloads of archives (pak/pk3)"};

Referenced by SV_Download_f(), and SV_Init().

◆ sv_allowdownloads_config

cvar_t sv_allowdownloads_config
extern

Definition at line 71 of file sv_main.c.

71{CF_SERVER, "sv_allowdownloads_config", "0", "whether to allow downloads of config files (cfg)"};

Referenced by SV_Download_f(), and SV_Init().

◆ sv_allowdownloads_dlcache

cvar_t sv_allowdownloads_dlcache
extern

Definition at line 72 of file sv_main.c.

72{CF_SERVER, "sv_allowdownloads_dlcache", "0", "whether to allow downloads of dlcache files (dlcache/)"};

Referenced by SV_Download_f(), and SV_Init().

◆ sv_allowdownloads_inarchive

cvar_t sv_allowdownloads_inarchive
extern

Definition at line 73 of file sv_main.c.

73{CF_SERVER, "sv_allowdownloads_inarchive", "0", "whether to allow downloads from archives (pak/pk3)"};

Referenced by SV_Download_f(), and SV_Init().

◆ sv_areadebug

cvar_t sv_areadebug
extern

Definition at line 164 of file sv_main.c.

164{CF_SERVER, "sv_areadebug", "0", "disables physics culling for debugging purposes (only for development)"};

Referenced by SV_EntitiesInBox(), and SV_Init().

◆ sv_areagrid_link_SOLID_NOT

cvar_t sv_areagrid_link_SOLID_NOT
extern

Definition at line 74 of file sv_main.c.

74{CF_SERVER | CF_NOTIFY, "sv_areagrid_link_SOLID_NOT", "1", "set to 0 to prevent SOLID_NOT entities from being linked to the area grid, and unlink any that are already linked (in the code paths that would otherwise link them), for better performance"};

Referenced by SV_Init(), and SV_LinkEdict().

◆ sv_areagrid_mingridsize

cvar_t sv_areagrid_mingridsize
extern

Definition at line 75 of file sv_main.c.

75{CF_SERVER | CF_NOTIFY, "sv_areagrid_mingridsize", "128", "minimum areagrid cell size, smaller values work better for lots of small objects, higher values for large objects"};

Referenced by SV_Init(), and World_SetSize().

◆ sv_checkforpacketsduringsleep

cvar_t sv_checkforpacketsduringsleep
extern

Definition at line 76 of file sv_main.c.

76{CF_SERVER, "sv_checkforpacketsduringsleep", "0", "uses select() function to wait between frames which can be interrupted by packets being received, instead of Sleep()/usleep()/SDL_Sleep() functions which do not check for packets"};

Referenced by SV_Init(), and Sys_Sleep().

◆ sv_clmovement_enable

cvar_t sv_clmovement_enable
extern

Definition at line 77 of file sv_main.c.

77{CF_SERVER, "sv_clmovement_enable", "1", "whether to allow clients to use cl_movement prediction, which can cause choppy movement on the server which may annoy other players"};

Referenced by SV_ExecuteClientMoves(), and SV_Init().

◆ sv_clmovement_inputtimeout

cvar_t sv_clmovement_inputtimeout
extern

Definition at line 80 of file sv_main.c.

80{CF_SERVER, "sv_clmovement_inputtimeout", "0.1", "when a client does not send input for this many seconds (max 0.1), force them to move anyway (unlike QuakeWorld)"};

Referenced by SV_ExecuteClientMoves(), and SV_Init().

◆ sv_clmovement_maxnetfps

cvar_t sv_clmovement_maxnetfps
extern

◆ sv_clmovement_minping

cvar_t sv_clmovement_minping
extern

Definition at line 78 of file sv_main.c.

78{CF_SERVER, "sv_clmovement_minping", "0", "if client ping is below this time in milliseconds, then their ability to use cl_movement prediction is disabled for a while (as they don't need it)"};

Referenced by SV_ExecuteClientMoves(), and SV_Init().

◆ sv_clmovement_minping_disabletime

cvar_t sv_clmovement_minping_disabletime
extern

Definition at line 79 of file sv_main.c.

79{CF_SERVER, "sv_clmovement_minping_disabletime", "1000", "when client falls below minping, disable their prediction for this many milliseconds (should be at least 1000 or else their prediction may turn on/off frequently)"};

Referenced by SV_ExecuteClientMoves(), and SV_Init().

◆ sv_cullentities_nevercullbmodels

cvar_t sv_cullentities_nevercullbmodels
extern

Definition at line 81 of file sv_main.c.

81{CF_SERVER, "sv_cullentities_nevercullbmodels", "0", "if enabled the clients are always notified of moving doors and lifts and other submodels of world (warning: eats a lot of network bandwidth on some levels!)"};

Referenced by SV_Init(), and SV_MarkWriteEntityStateToClient().

◆ sv_cullentities_pvs

cvar_t sv_cullentities_pvs
extern

Definition at line 82 of file sv_main.c.

82{CF_SERVER, "sv_cullentities_pvs", "1", "fast but loose culling of hidden entities"};

Referenced by SV_Init(), and SV_MarkWriteEntityStateToClient().

◆ sv_cullentities_stats

cvar_t sv_cullentities_stats
extern

Definition at line 83 of file sv_main.c.

83{CF_SERVER, "sv_cullentities_stats", "0", "displays stats on network entities culled by various methods for each client"};

Referenced by SV_Init(), and SV_WriteEntitiesToClient().

◆ sv_cullentities_trace

cvar_t sv_cullentities_trace
extern

Definition at line 84 of file sv_main.c.

84{CF_SERVER, "sv_cullentities_trace", "0", "somewhat slow but very tight culling of hidden entities, minimizes network traffic and makes wallhack cheats useless"};

Referenced by SV_Init(), and SV_MarkWriteEntityStateToClient().

◆ sv_cullentities_trace_delay

cvar_t sv_cullentities_trace_delay
extern

Definition at line 85 of file sv_main.c.

85{CF_SERVER, "sv_cullentities_trace_delay", "1", "number of seconds until the entity gets actually culled (also applies to portal camera eyes even if sv_cullentities_trace is 0)"};

Referenced by SV_Init(), and SV_MarkWriteEntityStateToClient().

◆ sv_cullentities_trace_enlarge

cvar_t sv_cullentities_trace_enlarge
extern

Definition at line 87 of file sv_main.c.

87{CF_SERVER, "sv_cullentities_trace_enlarge", "0", "box enlargement for entity culling (also applies to portal camera eyes even if sv_cullentities_trace is 0)"};

Referenced by SV_Init(), and SV_MarkWriteEntityStateToClient().

◆ sv_cullentities_trace_prediction

cvar_t sv_cullentities_trace_prediction
extern

Definition at line 90 of file sv_main.c.

90{CF_SERVER, "sv_cullentities_trace_prediction", "1", "also trace from the predicted player position"};

Referenced by SV_Init(), and SV_WriteEntitiesToClient().

◆ sv_cullentities_trace_samples

cvar_t sv_cullentities_trace_samples
extern

Definition at line 93 of file sv_main.c.

93{CF_SERVER, "sv_cullentities_trace_samples", "2", "number of samples to test for entity culling"};

Referenced by SV_Init(), and SV_MarkWriteEntityStateToClient().

◆ sv_cullentities_trace_samples_extra

cvar_t sv_cullentities_trace_samples_extra
extern

Definition at line 94 of file sv_main.c.

94{CF_SERVER, "sv_cullentities_trace_samples_extra", "2", "number of samples to test for entity culling when the entity affects its surroundings by e.g. dlight (also applies to portal camera eyes even if sv_cullentities_trace is 0)"};

Referenced by SV_Init(), and SV_MarkWriteEntityStateToClient().

◆ sv_debugmove

cvar_t sv_debugmove
extern

Definition at line 97 of file sv_main.c.

97{CF_SERVER | CF_NOTIFY, "sv_debugmove", "0", "disables collision detection optimizations for debugging purposes"};

Referenced by CL_TraceBox(), CL_TraceLine(), CL_TracePoint(), SV_Init(), SV_TraceBox(), SV_TraceLine(), and SV_TracePoint().

◆ sv_echobprint

cvar_t sv_echobprint
extern

Definition at line 99 of file sv_main.c.

99{CF_SERVER | CF_ARCHIVE, "sv_echobprint", "1", "prints gamecode bprint() calls to server console"};

Referenced by SV_BroadcastPrint(), and SV_Init().

◆ sv_edgefriction

cvar_t sv_edgefriction
extern

Definition at line 100 of file sv_main.c.

100{CF_SERVER, "edgefriction", "1", "how much you slow down when nearing a ledge you might fall off, multiplier of sv_friction (Quake used 2, QuakeWorld used 1 due to a bug in physics code)"};

Referenced by SV_Init(), SV_UserFriction(), and SV_WriteClientdataToMessage().

◆ sv_entpatch

cvar_t sv_entpatch
extern

Definition at line 101 of file sv_main.c.

101{CF_SERVER, "sv_entpatch", "1", "enables loading of .ent files to override entities in the bsp (for example Threewave CTF server pack contains .ent patch files enabling play of CTF on id1 maps)"};

Referenced by SV_Init(), and SV_SpawnServer().

◆ sv_freezenonclients

cvar_t sv_freezenonclients
extern

Definition at line 102 of file sv_main.c.

102{CF_SERVER | CF_NOTIFY, "sv_freezenonclients", "0", "freezes time, except for players, allowing you to walk around and take screenshots of explosions"};

Referenced by SV_Init(), and SV_Physics().

◆ sv_friction

cvar_t sv_friction
extern

Definition at line 103 of file sv_main.c.

103{CF_SERVER | CF_NOTIFY, "sv_friction","4", "how fast you slow down"};

Referenced by SV_Init(), SV_UserFriction(), SV_WaterMove(), and SV_WriteClientdataToMessage().

◆ sv_gameplayfix_blowupfallenzombies

cvar_t sv_gameplayfix_blowupfallenzombies
extern

Definition at line 104 of file sv_main.c.

104{CF_SERVER, "sv_gameplayfix_blowupfallenzombies", "1", "causes findradius to detect SOLID_NOT entities such as zombies and corpses on the floor, allowing splash damage to apply to them"};

Referenced by SV_Init(), VM_CL_findradius(), and VM_SV_findradius().

◆ sv_gameplayfix_consistentplayerprethink

cvar_t sv_gameplayfix_consistentplayerprethink
extern

Definition at line 105 of file sv_main.c.

105{CF_SERVER, "sv_gameplayfix_consistentplayerprethink", "0", "improves fairness in multiplayer by running all PlayerPreThink functions (which fire weapons) before performing physics, then running all PlayerPostThink functions"};

Referenced by SV_Init(), and SV_Physics().

◆ sv_gameplayfix_delayprojectiles

cvar_t sv_gameplayfix_delayprojectiles
extern

Definition at line 106 of file sv_main.c.

106{CF_SERVER, "sv_gameplayfix_delayprojectiles", "1", "causes entities to not move on the same frame they are spawned, meaning that projectiles wait until the next frame to perform their first move, giving proper interpolation and rocket trails, but making weapons harder to use at low framerates"};

Referenced by SV_Init(), SV_Physics(), and SV_Physics_Entity().

◆ sv_gameplayfix_downtracesupportsongroundflag

cvar_t sv_gameplayfix_downtracesupportsongroundflag
extern

Definition at line 128 of file sv_main.c.

128{CF_SERVER, "sv_gameplayfix_downtracesupportsongroundflag", "1", "prevents very short moves from clearing onground (which may make the player stick to the floor at high netfps), fixes groundentity not being set when walking onto a mover with sv_gameplayfix_nogravityonground"};

Referenced by SV_Init(), and SV_WalkMove().

◆ sv_gameplayfix_droptofloorstartsolid

cvar_t sv_gameplayfix_droptofloorstartsolid
extern

Definition at line 107 of file sv_main.c.

107{CF_SERVER, "sv_gameplayfix_droptofloorstartsolid", "1", "prevents items and monsters that start in a solid area from falling out of the level (makes droptofloor treat trace_startsolid as an acceptable outcome)"};

Referenced by SV_Init(), and VM_SV_droptofloor().

◆ sv_gameplayfix_droptofloorstartsolid_nudgetocorrect

cvar_t sv_gameplayfix_droptofloorstartsolid_nudgetocorrect
extern

Definition at line 108 of file sv_main.c.

108{CF_SERVER, "sv_gameplayfix_droptofloorstartsolid_nudgetocorrect", "1", "tries to nudge stuck items and monsters out of walls before droptofloor is performed"};

Referenced by SV_Init(), and VM_SV_droptofloor().

◆ sv_gameplayfix_easierwaterjump

cvar_t sv_gameplayfix_easierwaterjump
extern

Definition at line 109 of file sv_main.c.

109{CF_SERVER, "sv_gameplayfix_easierwaterjump", "1", "changes water jumping to make it easier to get out of water (exactly like in QuakeWorld)"};

Referenced by SV_FlyMove(), and SV_Init().

◆ sv_gameplayfix_findradiusdistancetobox

cvar_t sv_gameplayfix_findradiusdistancetobox
extern

Definition at line 110 of file sv_main.c.

110{CF_SERVER, "sv_gameplayfix_findradiusdistancetobox", "1", "causes findradius to check the distance to the corner of a box rather than the center of the box, makes findradius detect bmodels such as very large doors that would otherwise be unaffected by splash damage"};

Referenced by SV_Init(), VM_CL_findradius(), and VM_SV_findradius().

◆ sv_gameplayfix_fixedcheckwatertransition

cvar_t sv_gameplayfix_fixedcheckwatertransition
extern

Definition at line 132 of file sv_main.c.

132{CF_SERVER, "sv_gameplayfix_fixedcheckwatertransition", "1", "fix two very stupid bugs in SV_CheckWaterTransition when watertype is CONTENTS_EMPTY (the bugs causes waterlevel to be 1 on first frame, -1 on second frame - the fix makes it 0 on both frames)"};

Referenced by SV_CheckWaterTransition(), and SV_Init().

◆ sv_gameplayfix_gravityunaffectedbyticrate

cvar_t sv_gameplayfix_gravityunaffectedbyticrate
extern

Definition at line 111 of file sv_main.c.

111{CF_SERVER, "sv_gameplayfix_gravityunaffectedbyticrate", "0", "fix some ticrate issues in physics."};

Referenced by SV_FlyMove(), SV_Init(), and SV_WriteClientdataToMessage().

◆ sv_gameplayfix_grenadebouncedownslopes

cvar_t sv_gameplayfix_grenadebouncedownslopes
extern

Definition at line 112 of file sv_main.c.

112{CF_SERVER, "sv_gameplayfix_grenadebouncedownslopes", "1", "prevents MOVETYPE_BOUNCE (grenades) from getting stuck when fired down a downward sloping surface"};

Referenced by SV_Init(), and SV_Physics_Toss().

◆ sv_gameplayfix_impactbeforeonground

cvar_t sv_gameplayfix_impactbeforeonground
extern

Definition at line 113 of file sv_main.c.

113{CF_SERVER, "sv_gameplayfix_impactbeforeonground", "0", "enables a bug from old DP versions in which entity .touch functions are called before FL_ONGROUND is set when a collision is detected in SV_FlyMove() (used by MOVETYPE_WALK and MOVETYPE_STEP), Quake 1.5 and Combat+ mods require this, it breaks id1 fiends"};

Referenced by SV_FlyMove(), and SV_Init().

◆ sv_gameplayfix_multiplethinksperframe

cvar_t sv_gameplayfix_multiplethinksperframe
extern

Definition at line 114 of file sv_main.c.

114{CF_SERVER, "sv_gameplayfix_multiplethinksperframe", "1", "allows entities to think more often than the server framerate, primarily useful for very high fire rate weapons"};

Referenced by SV_Init(), and SV_RunThink().

◆ sv_gameplayfix_noairborncorpse

cvar_t sv_gameplayfix_noairborncorpse
extern

Definition at line 115 of file sv_main.c.

115{CF_SERVER, "sv_gameplayfix_noairborncorpse", "1", "causes entities (corpses, items, etc) sitting ontop of moving entities (players) to fall when the moving entity (player) is no longer supporting them"};

Referenced by SV_Init(), and SV_Physics_Toss().

◆ sv_gameplayfix_noairborncorpse_allowsuspendeditems

cvar_t sv_gameplayfix_noairborncorpse_allowsuspendeditems
extern

Definition at line 116 of file sv_main.c.

116{CF_SERVER, "sv_gameplayfix_noairborncorpse_allowsuspendeditems", "1", "causes entities sitting ontop of objects that are instantaneously remove to float in midair (special hack to allow a common level design trick for floating items)"};

Referenced by SV_Init(), and SV_Physics_Toss().

◆ sv_gameplayfix_nogravityonground

cvar_t sv_gameplayfix_nogravityonground
extern

Definition at line 120 of file sv_main.c.

120{CF_SERVER, "sv_gameplayfix_nogravityonground", "0", "turn off gravity when on ground (to get rid of sliding)"};

Referenced by SV_FlyMove(), SV_Init(), and SV_WriteClientdataToMessage().

◆ sv_gameplayfix_nosquashentities

cvar_t sv_gameplayfix_nosquashentities
extern

Definition at line 133 of file sv_main.c.

133{CF_SERVER, "sv_gameplayfix_nosquashentities", "0", "Entity hitboxes will not be resized or disabled when they are crushed by movers, and will continue to be affected by movers."};

Referenced by SV_Init(), and SV_PushMove().

◆ sv_gameplayfix_nostepmoveonsteepslopes

cvar_t sv_gameplayfix_nostepmoveonsteepslopes
extern

Definition at line 125 of file sv_main.c.

125{CF_SERVER, "sv_gameplayfix_nostepmoveonsteepslopes", "0", "crude fix which prevents MOVETYPE_STEP (not swimming or flying) to move on slopes whose angle is bigger than 45 degree"};

Referenced by SV_Init(), and SV_movestep().

◆ sv_gameplayfix_nudgeoutofsolid

cvar_t sv_gameplayfix_nudgeoutofsolid
extern

Definition at line 117 of file sv_main.c.

117{CF_SERVER, "sv_gameplayfix_nudgeoutofsolid", "0", "attempts to fix physics errors where an object ended up in solid for some reason, smarter than sv_gameplayfix_unstick* except on Q1BSP with mod_q1bsp_polygoncollisions disabled (there it falls back to the unsticking method)"};

Referenced by SV_Init(), and SV_UnstickEntity().

◆ sv_gameplayfix_nudgeoutofsolid_separation

cvar_t sv_gameplayfix_nudgeoutofsolid_separation
extern

Definition at line 118 of file sv_main.c.

118{CF_SERVER, "sv_gameplayfix_nudgeoutofsolid_separation", "0.03125", "keep objects this distance apart to prevent collision issues on seams"};

Referenced by PHYS_NudgeOutOfSolid(), SV_Init(), and SV_UnstickEntity().

◆ sv_gameplayfix_q1bsptracelinereportstexture

cvar_t sv_gameplayfix_q1bsptracelinereportstexture
extern

Definition at line 129 of file sv_main.c.

129{CF_SERVER, "sv_gameplayfix_q1bsptracelinereportstexture", "1", "enables mods to get accurate trace_texture results on q1bsp by using a surface-hitting traceline implementation rather than the standard solidbsp method, q3bsp always reports texture accurately"};

Referenced by Mod_Q1BSP_TraceLine(), and SV_Init().

◆ sv_gameplayfix_q2airaccelerate

cvar_t sv_gameplayfix_q2airaccelerate
extern

Definition at line 119 of file sv_main.c.

119{CF_SERVER, "sv_gameplayfix_q2airaccelerate", "0", "Quake2-style air acceleration"};

Referenced by SV_WriteClientdataToMessage().

◆ sv_gameplayfix_setmodelrealbox

cvar_t sv_gameplayfix_setmodelrealbox
extern

Definition at line 121 of file sv_main.c.

121{CF_SERVER, "sv_gameplayfix_setmodelrealbox", "1", "fixes a bug in Quake that made setmodel always set the entity box to ('-16 -16 -16', '16 16 16') rather than properly checking the model box, breaks some poorly coded mods"};

Referenced by SV_Init(), VM_SV_setmodel(), and VM_SV_setmodelindex().

◆ sv_gameplayfix_slidemoveprojectiles

cvar_t sv_gameplayfix_slidemoveprojectiles
extern

Definition at line 122 of file sv_main.c.

122{CF_SERVER, "sv_gameplayfix_slidemoveprojectiles", "1", "allows MOVETYPE_FLY/FLYMISSILE/TOSS/BOUNCE/BOUNCEMISSILE entities to finish their move in a frame even if they hit something, fixes 'gravity accumulation' bug for grenades on steep slopes"};

Referenced by SV_Init(), and SV_Physics_Toss().

◆ sv_gameplayfix_stepdown

cvar_t sv_gameplayfix_stepdown
extern

Definition at line 123 of file sv_main.c.

123{CF_SERVER, "sv_gameplayfix_stepdown", "0", "attempts to step down stairs, not just up them (prevents the familiar thud..thud..thud.. when running down stairs and slopes)"};

Referenced by SV_Init(), and SV_WalkMove().

◆ sv_gameplayfix_stepmultipletimes

cvar_t sv_gameplayfix_stepmultipletimes
extern

Definition at line 124 of file sv_main.c.

124{CF_SERVER, "sv_gameplayfix_stepmultipletimes", "0", "applies step-up onto a ledge more than once in a single frame, when running quickly up stairs"};

Referenced by SV_Init(), and SV_WalkMove().

◆ sv_gameplayfix_swiminbmodels

cvar_t sv_gameplayfix_swiminbmodels
extern

Definition at line 126 of file sv_main.c.

126{CF_SERVER, "sv_gameplayfix_swiminbmodels", "1", "causes pointcontents (used to determine if you are in a liquid) to check bmodel entities as well as the world model, so you can swim around in (possibly moving) water bmodel entities"};

Referenced by SV_Init(), and SV_PointSuperContents().

◆ sv_gameplayfix_unstickentities

cvar_t sv_gameplayfix_unstickentities
extern

Definition at line 131 of file sv_main.c.

131{CF_SERVER, "sv_gameplayfix_unstickentities", "0", "hack to check if entities are crossing world collision hull and try to move them to the right position. Quake didn't do this so maps shouldn't depend on it."};

Referenced by SV_Init(), and SV_UnstickEntity().

◆ sv_gameplayfix_unstickplayers

cvar_t sv_gameplayfix_unstickplayers
extern

Definition at line 130 of file sv_main.c.

130{CF_SERVER, "sv_gameplayfix_unstickplayers", "1", "big hack to try and fix the rare case of MOVETYPE_WALK entities getting stuck in the world clipping hull. Quake did something similar."};

Referenced by SV_Init(), and SV_UnstickEntity().

◆ sv_gameplayfix_upwardvelocityclearsongroundflag

cvar_t sv_gameplayfix_upwardvelocityclearsongroundflag
extern

Definition at line 127 of file sv_main.c.

127{CF_SERVER, "sv_gameplayfix_upwardvelocityclearsongroundflag", "1", "prevents monsters, items, and most other objects from being stuck to the floor when pushed around by damage, and other situations in mods"};

Referenced by SV_Init(), SV_Physics_Step(), and SV_Physics_Toss().

◆ sv_gravity

cvar_t sv_gravity
extern

Definition at line 134 of file sv_main.c.

134{CF_SERVER | CF_NOTIFY, "sv_gravity","800", "how fast you fall (512 = roughly earth gravity)"};

Referenced by CL_UpdateMoveVars(), SV_Gravity(), SV_Init(), SV_Physics(), SV_Physics_Step(), SV_Physics_Toss(), SV_Trace_Toss(), and SV_WriteClientdataToMessage().

◆ sv_idealpitchscale

cvar_t sv_idealpitchscale
extern

Definition at line 136 of file sv_main.c.

136{CF_SERVER, "sv_idealpitchscale","0.8", "how much to look up/down slopes and stairs when not using freelook"};

Referenced by SV_Init(), and SV_SetIdealPitch().

◆ sv_jumpstep

cvar_t sv_jumpstep
extern

Definition at line 137 of file sv_main.c.

137{CF_SERVER | CF_NOTIFY, "sv_jumpstep", "0", "whether you can step up while jumping"};

Referenced by SV_Init(), and SV_WalkMove().

◆ sv_jumpvelocity

cvar_t sv_jumpvelocity
extern

Definition at line 138 of file sv_main.c.

138{CF_SERVER, "sv_jumpvelocity", "270", "cvar that can be used by QuakeC code for jump velocity"};

Referenced by SV_Init(), and SV_WriteClientdataToMessage().

◆ sv_legacy_bbox_expand

cvar_t sv_legacy_bbox_expand
extern

Definition at line 139 of file sv_main.c.

139{CF_SERVER, "sv_legacy_bbox_expand", "1", "before linking an entity to the area grid, decrease its mins and increase its maxs by '1 1 1', or '15 15 1' if it has flag FL_ITEM (this is the Quake/QuakeWorld behaviour); disable to make SVQC bboxes consistent with CSQC which never does this expansion"};

Referenced by SV_Init(), and SV_LinkEdict().

◆ sv_maxairspeed

cvar_t sv_maxairspeed
extern

Definition at line 140 of file sv_main.c.

140{CF_SERVER, "sv_maxairspeed", "30", "maximum speed a player can accelerate to when airborn (note that it is possible to completely stop by moving the opposite direction)"};

Referenced by SV_AirAccelerate(), SV_Init(), and SV_WriteClientdataToMessage().

◆ sv_maxairstrafespeed

cvar_t sv_maxairstrafespeed
extern

Definition at line 64 of file sv_main.c.

64{CF_SERVER, "sv_maxairstrafespeed", "0", "when set, replacement for sv_maxairspeed when just strafing"};

Referenced by SV_Init(), and SV_WriteClientdataToMessage().

◆ sv_maxrate

cvar_t sv_maxrate
extern

Definition at line 141 of file sv_main.c.

141{CF_SERVER | CF_ARCHIVE | CF_NOTIFY, "sv_maxrate", "1000000", "upper limit on client rate cvar, should reflect your network connection quality"};

Referenced by M_GameOptions_Draw(), M_NetStart_Change(), SV_Init(), and SV_SendClientDatagram().

◆ sv_maxspeed

cvar_t sv_maxspeed
extern

Definition at line 142 of file sv_main.c.

142{CF_SERVER | CF_NOTIFY, "sv_maxspeed", "320", "maximum speed a player can accelerate to when on ground (can be exceeded by tricks)"};

Referenced by SV_AirMove(), SV_Init(), SV_WaterMove(), and SV_WriteClientdataToMessage().

◆ sv_maxvelocity

cvar_t sv_maxvelocity
extern

Definition at line 143 of file sv_main.c.

143{CF_SERVER | CF_NOTIFY, "sv_maxvelocity","2000", "universal speed limit on all entities"};

Referenced by SV_CheckVelocity(), and SV_Init().

◆ sv_mempool

◆ sv_nostep

cvar_t sv_nostep
extern

Definition at line 144 of file sv_main.c.

144{CF_SERVER | CF_NOTIFY, "sv_nostep","0", "prevents MOVETYPE_STEP entities (monsters) from moving"};

Referenced by SV_Init(), and SV_WalkMove().

◆ sv_playerphysicsqc

cvar_t sv_playerphysicsqc
extern

Definition at line 145 of file sv_main.c.

145{CF_SERVER | CF_NOTIFY, "sv_playerphysicsqc", "1", "enables QuakeC function to override player physics"};

Referenced by SV_Init(), and SV_PlayerPhysics().

◆ sv_progs

cvar_t sv_progs
extern

Definition at line 146 of file sv_main.c.

146{CF_SERVER, "sv_progs", "progs.dat", "selects which quakec progs.dat file to run" };

Referenced by SV_Init(), and SV_VM_Setup().

◆ sv_protocolname

cvar_t sv_protocolname
extern

Definition at line 147 of file sv_main.c.

147{CF_SERVER, "sv_protocolname", "DP7", "selects network protocol to host for (values include QUAKE, QUAKEDP, NEHAHRAMOVIE, DP1 and up)"};

Referenced by SV_Init(), and SV_SpawnServer().

◆ sv_random_seed

cvar_t sv_random_seed
extern

Definition at line 149 of file sv_main.c.

149{CF_SERVER, "sv_random_seed", "", "random seed; when set, on every map start this random seed is used to initialize the random number generator. Don't touch it unless for benchmarking or debugging"};

Referenced by Host_Frame(), SV_Init(), and SV_SpawnServer().

◆ sv_sound_land

cvar_t sv_sound_land
extern

Definition at line 151 of file sv_main.c.

151{CF_SERVER, "sv_sound_land", "demon/dland2.wav", "sound to play when MOVETYPE_STEP entity hits the ground at high speed (empty cvar disables the sound)"};

Referenced by SV_Init(), and SV_Physics_Step().

◆ sv_sound_watersplash

cvar_t sv_sound_watersplash
extern

Definition at line 152 of file sv_main.c.

152{CF_SERVER, "sv_sound_watersplash", "misc/h2ohit1.wav", "sound to play when MOVETYPE_FLY/TOSS/BOUNCE/STEP entity enters or leaves water (empty cvar disables the sound)"};

Referenced by SV_CheckWaterTransition(), and SV_Init().

◆ sv_stepheight

cvar_t sv_stepheight
extern

Definition at line 153 of file sv_main.c.

153{CF_SERVER | CF_NOTIFY, "sv_stepheight", "18", "how high you can step up (TW_SV_STEPCONTROL extension)"};

Referenced by CL_CheckBottom(), CL_movestep(), SV_CheckBottom(), SV_Init(), SV_movestep(), SV_WalkMove(), SV_WriteClientdataToMessage(), and VM_CL_checkbottom().

◆ sv_stopspeed

cvar_t sv_stopspeed
extern

Definition at line 154 of file sv_main.c.

154{CF_SERVER | CF_NOTIFY, "sv_stopspeed","100", "how fast you come to a complete stop"};

Referenced by SV_Init(), SV_UserFriction(), and SV_WriteClientdataToMessage().

◆ sv_wallfriction

cvar_t sv_wallfriction
extern

Definition at line 155 of file sv_main.c.

155{CF_SERVER | CF_NOTIFY, "sv_wallfriction", "1", "how much you slow down when sliding along a wall"};

Referenced by SV_Init(), and SV_WalkMove().

◆ sv_wateraccelerate

cvar_t sv_wateraccelerate
extern

Definition at line 156 of file sv_main.c.

156{CF_SERVER, "sv_wateraccelerate", "-1", "rate at which a player accelerates to sv_maxspeed while in water, if less than 0 the sv_accelerate variable is used instead"};

Referenced by SV_Init(), SV_WaterMove(), and SV_WriteClientdataToMessage().

◆ sv_waterfriction

cvar_t sv_waterfriction
extern

Definition at line 157 of file sv_main.c.

157{CF_SERVER | CF_NOTIFY, "sv_waterfriction","-1", "how fast you slow down in water, if less than 0 the sv_friction variable is used instead"};

Referenced by SV_Init(), SV_WaterMove(), and SV_WriteClientdataToMessage().

◆ svs

server_static_t svs
extern

persistant server info

Definition at line 224 of file sv_main.c.

Referenced by Cvar_SetQuick_Internal(), EntityFrameCSQC_WriteFrame(), EntityState5_Priority(), EntityState5_WriteUpdate(), Host_Frame(), Host_Shutdown(), M_Menu_GameOptions_f(), NetConn_BuildStatusResponse(), NetConn_Heartbeat(), NetConn_ServerParsePacket(), SCR_DrawNetGraph(), SV_Begin_f(), SV_BroadcastPrint(), SV_CheckTimeouts(), SV_Color_f(), SV_ConnectClient(), SV_CreateBaseline(), SV_DisableCheats_c(), SV_Download_f(), SV_DropClient(), SV_Ent_Remove_f(), SV_FlushBroadcastMessages(), SV_Frame(), SV_IsLocalServer(), SV_Kick_f(), SV_Loadgame_f(), SV_Map_f(), SV_MarkWriteEntityStateToClient(), SV_MaxPlayers_f(), SV_ModelIndex(), SV_Name_f(), SV_Physics(), SV_Ping_f(), SV_Pings_f(), SV_Prepare_CSQC(), SV_PrepareEntityForSending(), SV_Savegame_f(), SV_Savegame_to(), SV_SaveSpawnparms(), SV_Say(), SV_SendClientMessages(), SV_SendCvar_f(), SV_SendServerinfo(), SV_ServerOptions(), SV_Shutdown(), SV_Spawn_f(), SV_SpawnServer(), SV_StartThread(), SV_Status_f(), SV_StopThread(), SV_Tell_f(), SV_ThreadFunc(), SV_UnstickEntity(), SV_UpdateToReliableMessages(), SV_VM_Setup(), SV_WriteEntitiesToClient(), SVVM_free_edict(), SVVM_init_edict(), Sys_Error(), VM_changelevel(), VM_clientcount(), VM_M_WriteDest(), VM_sprint(), VM_SV_centerprint(), VM_SV_clientcommand(), VM_SV_clienttype(), VM_SV_dropclient(), VM_SV_lightstyle(), VM_SV_newcheckclient(), VM_SV_serverkey(), VM_SV_setcolor(), VM_SV_setspawnparms(), VM_SV_spawnclient(), VM_SV_sprint(), VM_SV_stuffcmd(), and WriteDest().

◆ sys_ticrate

cvar_t sys_ticrate
extern

Definition at line 166 of file sv_main.c.

166{CF_SERVER | CF_ARCHIVE, "sys_ticrate","0.01388889", "how long a server frame is in seconds, 0.05 is 20fps server rate, 0.1 is 10fps (can not be set higher than 0.1), 0 runs as many server frames as possible (makes games against bots a little smoother, overwhelms network players), 1/72 matches QuakeWorld physics"};

Referenced by SV_ExecuteClientMoves(), SV_Frame(), SV_Init(), SV_SendClientDatagram(), SV_ThreadFunc(), and SV_WriteClientdataToMessage().

◆ teamplay

◆ temp1

cvar_t temp1
extern

Definition at line 187 of file sv_main.c.

187{CF_SERVER, "temp1","0", "general cvar for mods to use, in stock id1 this selects which death animation to use on players (0 = random death, other values select specific death scenes)"};

Referenced by SV_Init().

◆ timelimit

cvar_t timelimit
extern

Definition at line 173 of file sv_main.c.

173{CF_SERVER | CF_NOTIFY, "timelimit","0", "ends level at this time (in minutes)"};

Referenced by M_GameOptions_Draw(), M_NetStart_Change(), SV_Init(), and SV_WriteClientdataToMessage().