size_t csqc_progsize_deflated;
unsigned char *csqc_progdata_deflated;
+ // independent server thread (when running client)
+ qboolean threaded; // true if server is running on separate thread
+ qboolean volatile threadstop;
+ void *threadmutex;
+ void *thread;
} server_static_t;
//=============================================================================
world_t world;
/// map name
- char name[64];
- /// maps/<name>.bsp, for model_precache[0]
- char modelname[64];
+ char name[64]; // %s followed by entrance name
+ // variants of map name
+ char worldmessage[40]; // map title (not related to filename)
+ char worldbasename[MAX_QPATH]; // %s
+ char worldname[MAX_QPATH]; // maps/%s.bsp
+ char worldnamenoextension[MAX_QPATH]; // maps/%s
struct model_s *worldmodel;
// NULL terminated
// LordHavoc: precaches are now MAX_QPATH rather than a pointer
int writeentitiestoclient_cliententitynumber;
int writeentitiestoclient_clientnumber;
sizebuf_t *writeentitiestoclient_msg;
- vec3_t writeentitiestoclient_testeye;
+ vec3_t writeentitiestoclient_eyes[MAX_CLIENTNETWORKEYES];
+ int writeentitiestoclient_numeyes;
int writeentitiestoclient_pvsbytes;
unsigned char writeentitiestoclient_pvs[MAX_MAP_LEAFS/8];
- entity_state_t writeentitiestoclient_sendstates[MAX_EDICTS];
+ const entity_state_t *writeentitiestoclient_sendstates[MAX_EDICTS];
unsigned short writeentitiestoclient_csqcsendstates[MAX_EDICTS];
int numsendentities;
unsigned char csqcentityversion[MAX_EDICTS]; // legacy
} server_t;
-#define NUM_CSQCENTITIES_PER_FRAME 1024
+#define NUM_CSQCENTITIES_PER_FRAME 256
typedef struct csqcentityframedb_s
{
int framenum;
netconn_t *netconnection;
int movesequence;
+ signed char movement_count[NETGRAPH_PACKETS];
+ int movement_highestsequence_seen; // not the same as movesequence if prediction is off
/// movement
usercmd_t cmd;
/// intended motion calced from cmd
float spawn_parms[NUM_SPAWN_PARMS];
// properties that are sent across the network only when changed
- char name[64], old_name[64];
+ char name[MAX_SCOREBOARDNAME], old_name[MAX_SCOREBOARDNAME];
int colors, old_colors;
int frags, old_frags;
char playermodel[MAX_QPATH], old_model[MAX_QPATH];
unsigned char csqcentityscope[MAX_EDICTS];
unsigned int csqcentitysendflags[MAX_EDICTS];
-#define NUM_CSQCENTITYDB_FRAMES 64
+#define NUM_CSQCENTITYDB_FRAMES 256
unsigned char csqcentityglobalhistory[MAX_EDICTS]; // set to 1 if the entity was ever csqc networked to the client, and never reset back to 0
csqcentityframedb_t csqcentityframehistory[NUM_CSQCENTITYDB_FRAMES];
int csqcentityframehistory_next;
+ int csqcentityframe_lastreset;
/// prevent animated names
float nametime;
#define MOVETYPE_BOUNCEMISSILE 11 ///< bounce w/o gravity
#define MOVETYPE_FOLLOW 12 ///< track movement of aiment
#define MOVETYPE_FAKEPUSH 13 ///< tenebrae's push that doesn't push
+#define MOVETYPE_PHYSICS 32 ///< indicates this object is physics controlled
+#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...
// edict->solid values
#define SOLID_NOT 0 ///< no interaction with other objects
#define SOLID_BSP 4 ///< bsp clip, touch on edge, block
// LordHavoc: corpse code
#define SOLID_CORPSE 5 ///< same as SOLID_BBOX, except it behaves as SOLID_NOT against SOLID_SLIDEBOX objects (players/monsters)
+// LordHavoc: physics
+#define SOLID_PHYSICS_BOX 32 ///< 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_CAPSULE 34 ///< 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_PHYSICS_CYLINDER 36 ///< physics object (mins, maxs, mass, origin, axis_forward, axis_left, axis_up, velocity, spinvelocity)
// edict->deadflag values
#define DEAD_NO 0
extern cvar_t sv_airstopaccelerate;
extern cvar_t sv_airstrafeaccelerate;
extern cvar_t sv_maxairstrafespeed;
+extern cvar_t sv_airstrafeaccel_qw;
extern cvar_t sv_aircontrol;
+extern cvar_t sv_aircontrol_power;
+extern cvar_t sv_aircontrol_penalty;
+extern cvar_t sv_airspeedlimit_nonqw;
extern cvar_t sv_allowdownloads;
extern cvar_t sv_allowdownloads_archive;
extern cvar_t sv_allowdownloads_config;
extern cvar_t sv_freezenonclients;
extern cvar_t sv_friction;
extern cvar_t sv_gameplayfix_blowupfallenzombies;
+extern cvar_t sv_gameplayfix_consistentplayerprethink;
extern cvar_t sv_gameplayfix_delayprojectiles;
extern cvar_t sv_gameplayfix_droptofloorstartsolid;
extern cvar_t sv_gameplayfix_droptofloorstartsolid_nudgetocorrect;
extern cvar_t sv_gameplayfix_easierwaterjump;
extern cvar_t sv_gameplayfix_findradiusdistancetobox;
+extern cvar_t sv_gameplayfix_gravityunaffectedbyticrate;
extern cvar_t sv_gameplayfix_grenadebouncedownslopes;
extern cvar_t sv_gameplayfix_multiplethinksperframe;
-extern cvar_t sv_gameplayfix_slidemoveprojectiles;
extern cvar_t sv_gameplayfix_noairborncorpse;
extern cvar_t sv_gameplayfix_noairborncorpse_allowsuspendeditems;
+extern cvar_t sv_gameplayfix_nudgeoutofsolid;
+extern cvar_t sv_gameplayfix_nudgeoutofsolid_separation;
+extern cvar_t sv_gameplayfix_q2airaccelerate;
+extern cvar_t sv_gameplayfix_nogravityonground;
extern cvar_t sv_gameplayfix_setmodelrealbox;
+extern cvar_t sv_gameplayfix_slidemoveprojectiles;
extern cvar_t sv_gameplayfix_stepdown;
extern cvar_t sv_gameplayfix_stepwhilejumping;
+extern cvar_t sv_gameplayfix_stepmultipletimes;
+extern cvar_t sv_gameplayfix_nostepmoveonsteepslopes;
extern cvar_t sv_gameplayfix_swiminbmodels;
extern cvar_t sv_gameplayfix_upwardvelocityclearsongroundflag;
-extern cvar_t sv_gameplayfix_gravityunaffectedbyticrate;
+extern cvar_t sv_gameplayfix_downtracesupportsongroundflag;
+extern cvar_t sv_gameplayfix_q1bsptracelinereportstexture;
+extern cvar_t sv_gameplayfix_unstickplayers;
+extern cvar_t sv_gameplayfix_unstickentities;
+extern cvar_t sv_gameplayfix_fixedcheckwatertransition;
extern cvar_t sv_gravity;
extern cvar_t sv_idealpitchscale;
extern cvar_t sv_jumpstep;
extern cvar_t sv_maxrate;
extern cvar_t sv_maxspeed;
extern cvar_t sv_maxvelocity;
-extern cvar_t sv_newflymove;
extern cvar_t sv_nostep;
extern cvar_t sv_playerphysicsqc;
extern cvar_t sv_progs;
extern cvar_t sv_wallfriction;
extern cvar_t sv_wateraccelerate;
extern cvar_t sv_waterfriction;
+extern cvar_t sv_areadebug;
extern cvar_t sys_ticrate;
extern cvar_t teamplay;
extern cvar_t temp1;
void SV_StartParticle (vec3_t org, vec3_t dir, int color, int count);
void SV_StartEffect (vec3_t org, int modelindex, int startframe, int framecount, int framerate);
-void SV_StartSound (prvm_edict_t *entity, int channel, const char *sample, int volume, float attenuation);
-void SV_StartPointSound (vec3_t origin, const char *sample, int volume, float attenuation);
+void SV_StartSound (prvm_edict_t *entity, int channel, const char *sample, int volume, float attenuation, qboolean reliable, float speed);
+void SV_StartPointSound (vec3_t origin, const char *sample, int volume, float attenuation, float speed);
void SV_ConnectClient (int clientnum, netconn_t *netconnection);
void SV_DropClient (qboolean crash);
-void SV_SendClientMessages (void);
+void SV_SendClientMessages(void);
void SV_ReadClientMessage(void);
int SV_ParticleEffectIndex(const char *name);
+dp_model_t *SV_GetModelByIndex(int modelindex);
+dp_model_t *SV_GetModelFromEdict(prvm_edict_t *ed);
+
void SV_SetIdealPitch (void);
void SV_AddUpdates (void);
void SV_Physics (void);
void SV_Physics_ClientMove (void);
-void SV_Physics_ClientEntity (prvm_edict_t *ent);
+//void SV_Physics_ClientEntity (prvm_edict_t *ent);
qboolean SV_PlayerCheckGround (prvm_edict_t *ent);
qboolean SV_CheckBottom (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
- * if touchtriggers, calls prog functions for the intersected triggers
+ * call TouchAreaGrid as well to fire triggers that overlap the box
*/
-void SV_LinkEdict (prvm_edict_t *ent, qboolean touch_triggers);
+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); // if we detected a touch from another source
/*! move an entity that is stuck by small amounts in various directions to try to nudge it back into the collision hull
* returns true if it found a better place
/// calculates hitsupercontentsmask for a generic qc entity
int SV_GenericHitSuperContentsMask(const prvm_edict_t *edict);
/// traces a box move against worldmodel and all entities in the specified area
-trace_t SV_Move(const vec3_t start, const vec3_t mins, const vec3_t maxs, const vec3_t end, int type, prvm_edict_t *passedict, int hitsupercontentsmask);
+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);
+trace_t SV_TraceLine(const vec3_t start, const vec3_t end, int type, prvm_edict_t *passedict, int hitsupercontentsmask);
+trace_t SV_TracePoint(const vec3_t start, int type, prvm_edict_t *passedict, int hitsupercontentsmask);
+int SV_EntitiesInBox(const vec3_t mins, const vec3_t maxs, int maxedicts, prvm_edict_t **resultedicts);
+
+qboolean SV_CanSeeBox(int numsamples, vec_t enlarge, vec3_t eye, vec3_t entboxmins, vec3_t entboxmaxs);
int SV_PointSuperContents(const vec3_t point);
void SV_FlushBroadcastMessages(void);
void SV_WriteClientdataToMessage (client_t *client, prvm_edict_t *ent, sizebuf_t *msg, int *stats);
-void SV_MoveToGoal (void);
+void VM_SV_MoveToGoal(prvm_prog_t *prog);
void SV_ApplyClientMove (void);
void SV_SaveSpawnparms (void);
void SV_SetupVM(void);
-void SV_VM_Begin(void);
-void SV_VM_End(void);
+const char *Host_TimingReport(char *buf, size_t buflen); ///< for output in Host_Status_f
+
+int SV_GetPitchSign(prvm_prog_t *prog, prvm_edict_t *ent);
+void SV_GetEntityMatrix(prvm_prog_t *prog, prvm_edict_t *ent, matrix4x4_t *out, qboolean viewmatrix);
+
+void SV_StartThread(void);
+void SV_StopThread(void);
+#define SV_LockThreadMutex() (svs.threaded ? Thread_LockMutex(svs.threadmutex),1 : 0)
+#define SV_UnlockThreadMutex() (svs.threaded ? Thread_UnlockMutex(svs.threadmutex),1 : 0)
-const char *Host_TimingReport(void); ///< for output in Host_Status_f
+void VM_CustomStats_Clear(void);
+void VM_SV_UpdateCustomStats(client_t *client, prvm_edict_t *ent, sizebuf_t *msg, int *stats);
+void Host_Savegame_to(prvm_prog_t *prog, const char *name);
+void SV_SendServerinfo(client_t *client);
#endif