]> git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - server.h
physics: fix and refactor unsticking
[xonotic/darkplaces.git] / server.h
index 52592b4bac37902545e235123290bce39b842c56..20637517eaf873563fbb8d27cd6ce652717e9628 100644 (file)
--- a/server.h
+++ b/server.h
@@ -34,20 +34,6 @@ typedef struct server_static_s
        qbool changelevel_issued;
        /// server infostring
        char serverinfo[MAX_SERVERINFO_STRING];
-       // performance data
-       float perf_cpuload;
-       float perf_lost;
-       float perf_offset_avg;
-       float perf_offset_max;
-       float perf_offset_sdev;
-       // temporary performance data accumulators
-       float perf_acc_realtime;
-       float perf_acc_sleeptime;
-       float perf_acc_lost;
-       float perf_acc_offset;
-       float perf_acc_offset_squared;
-       float perf_acc_offset_max;
-       int perf_acc_offset_samples;
 
        // csqc stuff
        unsigned char *csqc_progdata;
@@ -88,9 +74,25 @@ typedef struct server_s
        protocolversion_t protocol;
 
        double time;
-
        double frametime;
 
+       unsigned int spawnframe; // signals SV_Frame() to reset its timers
+
+       // performance data
+       float perf_cpuload;
+       float perf_lost;
+       float perf_offset_avg;
+       float perf_offset_max;
+       float perf_offset_sdev;
+       // temporary performance data accumulators
+       float perf_acc_realtime;
+       float perf_acc_sleeptime;
+       float perf_acc_lost;
+       float perf_acc_offset;
+       float perf_acc_offset_squared;
+       float perf_acc_offset_max;
+       int perf_acc_offset_samples;
+
        // used by PF_checkclient
        int lastcheck;
        double lastchecktime;
@@ -103,10 +105,7 @@ typedef struct server_s
        /// collision culling data
        world_t world;
 
-       /// map name
-       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
@@ -179,9 +178,6 @@ typedef struct csqcentityframedb_s
        int sendflags[NUM_CSQCENTITIES_PER_FRAME];
 } csqcentityframedb_t;
 
-// if defined this does ping smoothing, otherwise it does not
-//#define NUM_PING_TIMES 16
-
 #define NUM_SPAWN_PARMS 16
 
 typedef struct client_s
@@ -225,11 +221,6 @@ typedef struct client_s
        /// PRVM_EDICT_NUM(clientnum+1)
        prvm_edict_t *edict;
 
-#ifdef NUM_PING_TIMES
-       float ping_times[NUM_PING_TIMES];
-       /// ping_times[num_pings%NUM_PING_TIMES]
-       int num_pings;
-#endif
        /// LadyHavoc: can be used for prediction or whatever...
        float ping;
 
@@ -423,6 +414,7 @@ extern cvar_t sv_allowdownloads_archive;
 extern cvar_t sv_allowdownloads_config;
 extern cvar_t sv_allowdownloads_dlcache;
 extern cvar_t sv_allowdownloads_inarchive;
+extern cvar_t sv_areagrid_link_SOLID_NOT;
 extern cvar_t sv_areagrid_mingridsize;
 extern cvar_t sv_checkforpacketsduringsleep;
 extern cvar_t sv_clmovement_enable;
@@ -477,6 +469,7 @@ extern cvar_t sv_gravity;
 extern cvar_t sv_idealpitchscale;
 extern cvar_t sv_jumpstep;
 extern cvar_t sv_jumpvelocity;
+extern cvar_t sv_legacy_bbox_expand;
 extern cvar_t sv_maxairspeed;
 extern cvar_t sv_maxrate;
 extern cvar_t sv_maxspeed;
@@ -512,6 +505,10 @@ extern client_t *host_client;
 //===========================================================
 
 void SV_Init (void);
+double SV_Frame(double time);
+void SV_Shutdown(void);
+
+int SV_IsLocalServer(void);
 
 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);
@@ -519,7 +516,9 @@ void SV_StartSound (prvm_edict_t *entity, int channel, const char *sample, int v
 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 (qbool crash);
+void SV_DropClient (qbool leaving, const char *reason, ... );
+
+void SV_ClientCommands(const char *fmt, ...) DP_FUNC_PRINTF(1);
 
 void SV_SendClientMessages(void);
 
@@ -534,14 +533,14 @@ int SV_SoundIndex(const char *s, int precachemode);
 
 int SV_ParticleEffectIndex(const char *name);
 
-dp_model_t *SV_GetModelByIndex(int modelindex);
-dp_model_t *SV_GetModelFromEdict(prvm_edict_t *ed);
+model_t *SV_GetModelByIndex(int modelindex);
+model_t *SV_GetModelFromEdict(prvm_edict_t *ed);
 
 void SV_SetIdealPitch (void);
 
 void SV_AddUpdates (void);
 
-void SV_ClientThink (void);
+void SV_PlayerPhysics (void);
 
 void SV_ClientPrint(const char *msg);
 void SV_ClientPrintf(const char *fmt, ...) DP_FUNC_PRINTF(1);
@@ -566,12 +565,9 @@ void SV_LinkEdict_TouchAreaGrid_Call(prvm_edict_t *touch, prvm_edict_t *ent); //
 
 /*! 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
+ * Replaces SV_TryUnstick() and SV_CheckStuck() which in Quake applied to players only.
  */
 qbool SV_UnstickEntity (prvm_edict_t *ent);
-/*! move an entity that is stuck out of the surface it is stuck in (can move large amounts)
- * returns true if it found a better place
- */
-qbool SV_NudgeOutOfSolid(prvm_edict_t *ent);
 
 /// calculates hitsupercontentsmask for a generic qc entity
 int SV_GenericHitSuperContentsMask(const prvm_edict_t *edict);
@@ -583,7 +579,7 @@ int SV_EntitiesInBox(const vec3_t mins, const vec3_t maxs, int maxedicts, prvm_e
 
 qbool SV_CanSeeBox(int numsamples, vec_t eyejitter, vec_t enlarge, vec_t entboxexpand, vec3_t eye, vec3_t entboxmins, vec3_t entboxmaxs);
 
-void SV_MarkWriteEntityStateToClient(entity_state_t *s);
+void SV_MarkWriteEntityStateToClient(entity_state_t *s, client_t *client);
 
 void SV_SendServerinfo(client_t *client);
 void SV_WriteEntitiesToClient(client_t *client, prvm_edict_t *clent, sizebuf_t *msg, int maxsize);
@@ -598,13 +594,14 @@ void VM_SV_MoveToGoal(prvm_prog_t *prog);
 
 void SV_ApplyClientMove (void);
 void SV_SaveSpawnparms (void);
+
 void SV_SpawnServer (const char *map);
 
 void SV_CheckVelocity (prvm_edict_t *ent);
 
 void SV_SetupVM(void);
 
-const char *Host_TimingReport(char *buf, size_t buflen); ///< for output in SV_Status_f
+const char *SV_TimingReport(char *buf, size_t buflen); ///< for output in SV_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, qbool viewmatrix);
@@ -627,4 +624,6 @@ void SV_PreSpawn_f(cmd_state_t *cmd);
 void SV_Spawn_f(cmd_state_t *cmd);
 void SV_Begin_f(cmd_state_t *cmd);
 
+qbool SV_VM_ConsoleCommand(const char *text, size_t textlen);
+
 #endif