]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - sv_main.c
improved TraceLine in chase.c to be more generally useful (should move it to another...
[xonotic/darkplaces.git] / sv_main.c
index d888e5a03c2bdc7a82d2a01d0f76f812986a3833..d282bcc3398440c9a6d7df6ad331742413e1f767 100644 (file)
--- a/sv_main.c
+++ b/sv_main.c
@@ -46,6 +46,7 @@ void SV_Init (void)
        extern  cvar_t  sv_accelerate;
        extern  cvar_t  sv_idealpitchscale;
        extern  cvar_t  sv_aim;
+       extern  cvar_t  sv_predict;
 
        Cvar_RegisterVariable (&sv_maxvelocity);
        Cvar_RegisterVariable (&sv_gravity);
@@ -57,6 +58,7 @@ void SV_Init (void)
        Cvar_RegisterVariable (&sv_idealpitchscale);
        Cvar_RegisterVariable (&sv_aim);
        Cvar_RegisterVariable (&sv_nostep);
+       Cvar_RegisterVariable (&sv_predict);
 
        for (i=0 ; i<MAX_MODELS ; i++)
                sprintf (localmodels[i], "*%i", i);
@@ -192,11 +194,7 @@ void SV_SendServerinfo (client_t *client)
        char                    message[2048];
 
        MSG_WriteByte (&client->message, svc_print);
-#ifdef NEHAHRA
-       sprintf (message, "%c\nDPNEHAHRA VERSION %4.2f SERVER (%i CRC)", 2, VERSION, pr_crc);
-#else
-       sprintf (message, "%c\nDARKPLACES VERSION %4.2f SERVER (%i CRC)", 2, VERSION, pr_crc);
-#endif
+       sprintf (message, "%c\nDARKPLACES VERSION %4.2f BUILD %i SERVER (%i CRC)", 2, VERSION, buildnumber, pr_crc);
        MSG_WriteString (&client->message,message);
 
        MSG_WriteByte (&client->message, svc_serverinfo);
@@ -282,7 +280,7 @@ void SV_ConnectClient (int clientnum)
        else
        {
        // call the progs to get default spawn parms for the new client
-               PR_ExecuteProgram (pr_global_struct->SetNewParms);
+               PR_ExecuteProgram (pr_global_struct->SetNewParms, "QC function SetNewParms is missing");
                for (i=0 ; i<NUM_SPAWN_PARMS ; i++)
                        client->spawn_parms[i] = (&pr_global_struct->parm1)[i];
        }
@@ -422,7 +420,7 @@ SV_WriteEntitiesToClient
 
 =============
 */
-void SV_WriteEntitiesToClient (edict_t *clent, sizebuf_t *msg)
+void SV_WriteEntitiesToClient (client_t *client, edict_t *clent, sizebuf_t *msg)
 {
        int             e, i, clentnum, bits, alpha, glowcolor, glowsize, scale, colormod, modred, modgreen, modblue, dodelta, effects;
        byte    *pvs;
@@ -435,6 +433,7 @@ void SV_WriteEntitiesToClient (edict_t      *clent, sizebuf_t *msg)
 // find the client's PVS
        VectorAdd (clent->v.origin, clent->v.view_ofs, org);
        pvs = SV_FatPVS (org);
+       /*
        if (dpprotocol)
        {
                MSG_WriteByte(msg, svc_playerposition);
@@ -442,6 +441,7 @@ void SV_WriteEntitiesToClient (edict_t      *clent, sizebuf_t *msg)
                MSG_WriteFloat(msg, org[1]);
                MSG_WriteFloat(msg, org[2]);
        }
+       */
 
        clentnum = EDICT_TO_PROG(clent); // LordHavoc: for comparison purposes
 // send over all entities (except the client) that touch the pvs
@@ -547,7 +547,7 @@ void SV_WriteEntitiesToClient (edict_t      *clent, sizebuf_t *msg)
 
                dodelta = FALSE;
                if ((int)ent->v.effects & EF_DELTA)
-                       dodelta = cl.time < ent->nextfullupdate; // every half second a full update is forced
+                       dodelta = cl.time < client->nextfullupdate[e]; // every half second a full update is forced
 
                if (dodelta)
                {
@@ -556,7 +556,7 @@ void SV_WriteEntitiesToClient (edict_t      *clent, sizebuf_t *msg)
                }
                else
                {
-                       ent->nextfullupdate = cl.time + 0.5;
+                       client->nextfullupdate[e] = cl.time + 0.5;
                        baseline = &ent->baseline;
                }
 
@@ -600,7 +600,7 @@ void SV_WriteEntitiesToClient (edict_t      *clent, sizebuf_t *msg)
                        angles[0] = angles[0] * movelerp + ent->stepoldangles[0];
                        angles[1] = angles[1] * movelerp + ent->stepoldangles[1];
                        angles[2] = angles[2] * movelerp + ent->stepoldangles[2];
-                       VectorMA(origin, host_client->ping, ent->v.velocity, origin);
+                       VectorMA(origin, host_client->latency, ent->v.velocity, origin);
                }
                else // copy as they are
                {
@@ -878,7 +878,7 @@ qboolean SV_SendClientDatagram (client_t *client)
 // add the client specific data to the datagram
        SV_WriteClientdataToMessage (client->edict, &msg);
 
-       SV_WriteEntitiesToClient (client->edict, &msg);
+       SV_WriteEntitiesToClient (client, client->edict, &msg);
 
 // copy the server datagram if there is space
        if (msg.cursize + sv.datagram.cursize < msg.maxsize)
@@ -1017,8 +1017,7 @@ void SV_SendClientMessages (void)
                                SV_DropClient (false);  // went to another level
                        else
                        {
-                               if (NET_SendMessage (host_client->netconnection
-                               , &host_client->message) == -1)
+                               if (NET_SendMessage (host_client->netconnection, &host_client->message) == -1)
                                        SV_DropClient (true);   // if the message couldn't send, kick off
                                SZ_Clear (&host_client->message);
                                host_client->last_message = realtime;
@@ -1172,7 +1171,7 @@ void SV_SaveSpawnparms (void)
 
        // call the progs to get default spawn parms for the new client
                pr_global_struct->self = EDICT_TO_PROG(host_client->edict);
-               PR_ExecuteProgram (pr_global_struct->SetChangeParms);
+               PR_ExecuteProgram (pr_global_struct->SetChangeParms, "QC function SetChangeParms is missing");
                for (j=0 ; j<NUM_SPAWN_PARMS ; j++)
                        host_client->spawn_parms[j] = (&pr_global_struct->parm1)[j];
        }
@@ -1339,23 +1338,3 @@ void SV_SpawnServer (char *server)
        
        Con_DPrintf ("Server spawned.\n");
 }
-
-// LordHavoc: added light checking to the server
-int RecursiveLightPoint (vec3_t color, mnode_t *node, vec3_t start, vec3_t end);
-void SV_LightPoint (vec3_t color, vec3_t p)
-{
-       vec3_t          end;
-       
-       if (!sv.worldmodel->lightdata)
-       {
-               color[0] = color[1] = color[2] = 255;
-               return;
-       }
-       
-       end[0] = p[0];
-       end[1] = p[1];
-       end[2] = p[2] - 2048;
-
-       color[0] = color[1] = color[2] = 0;
-       RecursiveLightPoint (color, sv.worldmodel->nodes, p, end);
-}