]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - sv_main.c
make sure cl_downloadbegin will be sent
[xonotic/darkplaces.git] / sv_main.c
index e24170ab436e319a84e730dac25f878b1dcd3e0c..6c4516dfedd4c9783c9433203250524db77b1326 100644 (file)
--- a/sv_main.c
+++ b/sv_main.c
@@ -91,7 +91,7 @@ cvar_t sv_idealpitchscale = {0, "sv_idealpitchscale","0.8", "how much to look up
 cvar_t sv_jumpstep = {CVAR_NOTIFY, "sv_jumpstep", "0", "whether you can step up while jumping (sv_gameplayfix_stepwhilejumping must also be 1)"};
 cvar_t sv_jumpvelocity = {0, "sv_jumpvelocity", "270", "cvar that can be used by QuakeC code for jump velocity"};
 cvar_t sv_maxairspeed = {0, "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)"};
-cvar_t sv_maxrate = {CVAR_SAVE | CVAR_NOTIFY, "sv_maxrate", "10000", "upper limit on client rate cvar, should reflect your network connection quality"};
+cvar_t sv_maxrate = {CVAR_SAVE | CVAR_NOTIFY, "sv_maxrate", "1000000", "upper limit on client rate cvar, should reflect your network connection quality"};
 cvar_t sv_maxspeed = {CVAR_NOTIFY, "sv_maxspeed", "320", "maximum speed a player can accelerate to when on ground (can be exceeded by tricks)"};
 cvar_t sv_maxvelocity = {CVAR_NOTIFY, "sv_maxvelocity","2000", "universal speed limit on all entities"};
 cvar_t sv_newflymove = {CVAR_NOTIFY, "sv_newflymove", "0", "enables simpler/buggier player physics (not recommended)"};
@@ -413,6 +413,13 @@ void SV_Init (void)
        }
        Cvar_RegisterVariable (&cutscene); // for Nehahra but useful to other mods as well
 
+       // any special defaults for gamemodes go here
+       if (gamemode == GAME_HIPNOTIC)
+       {
+               // hipnotic mission pack has issues in their 'friendly monster' ai, which seem to attempt to attack themselves for some reason when findradius() returns non-solid entities.
+               Cvar_SetValueQuick (&sv_gameplayfix_blowupfallenzombies, 0);
+       }
+
        sv_mempool = Mem_AllocPool("server", 0, NULL);
 }
 
@@ -707,6 +714,7 @@ void SV_SendServerinfo (client_t *client)
        MSG_WriteByte (&client->netconnection->message, 1);
 
        client->spawned = false;                // need prespawn, spawn, etc
+       client->sendsignon = true;              // send this message, this will be cleared later
 
        // clear movement info until client enters the new level properly
        memset(&client->cmd, 0, sizeof(client->cmd));
@@ -753,8 +761,8 @@ void SV_ConnectClient (int clientnum, netconn_t *netconnection)
        // prepare the unreliable message buffer
        client->unreliablemsg.data = client->unreliablemsg_data;
        client->unreliablemsg.maxsize = sizeof(client->unreliablemsg_data);
-       // updated by receiving "rate" command from client
-       client->rate = NET_MINRATE;
+       // updated by receiving "rate" command from client, this is also the default if not using a DP client
+       client->rate = 1000000000;
        // no limits for local player
        if (client->netconnection && LHNETADDRESS_GetAddressType(&client->netconnection->peeraddress) == LHNETADDRESSTYPE_LOOP)
                client->rate = 1000000000;
@@ -1384,6 +1392,8 @@ void SV_WriteClientdataToMessage (client_t *client, prvm_edict_t *ent, sizebuf_t
        statsf[STAT_MOVEVARS_AIRACCEL_SIDEWAYS_FRICTION] = sv_airaccel_sideways_friction.value;
        statsf[STAT_MOVEVARS_FRICTION] = sv_friction.value;
        statsf[STAT_MOVEVARS_WATERFRICTION] = sv_waterfriction.value >= 0 ? sv_waterfriction.value : sv_friction.value;
+       statsf[STAT_FRAGLIMIT] = fraglimit.value;
+       statsf[STAT_TIMELIMIT] = timelimit.value;
 
        if (sv.protocol == PROTOCOL_QUAKE || sv.protocol == PROTOCOL_QUAKEDP || sv.protocol == PROTOCOL_NEHAHRAMOVIE || sv.protocol == PROTOCOL_DARKPLACES1 || sv.protocol == PROTOCOL_DARKPLACES2 || sv.protocol == PROTOCOL_DARKPLACES3 || sv.protocol == PROTOCOL_DARKPLACES4 || sv.protocol == PROTOCOL_DARKPLACES5)
        {
@@ -1582,6 +1592,7 @@ static void SV_SendClientDatagram (client_t *client)
                // no packet size limit support on older protocols because DP1-4 kick
                // the client off if they overflow, and quake protocol shows less than
                // the full entity set if rate limited
+               clientrate = max(NET_MINRATE, client->rate);
                maxsize = 1400;
                maxsize2 = 1400;
        }
@@ -1612,7 +1623,7 @@ static void SV_SendClientDatagram (client_t *client)
        if (!NetConn_CanSend(client->netconnection))
        {
                // send the datagram
-               //NetConn_SendUnreliableMessage (client->netconnection, &msg, sv.protocol, clientrate);
+               //NetConn_SendUnreliableMessage (client->netconnection, &msg, sv.protocol, clientrate, true);
                return;
        }
        else if (host_client->spawned)
@@ -1673,7 +1684,9 @@ static void SV_SendClientDatagram (client_t *client)
        }
 
 // send the datagram
-       NetConn_SendUnreliableMessage (client->netconnection, &msg, sv.protocol, clientrate);
+       NetConn_SendUnreliableMessage (client->netconnection, &msg, sv.protocol, clientrate, !client->spawned && !client->sendsignon);
+       if (!client->netconnection->message.cursize)
+               client->sendsignon = false;
 }
 
 /*
@@ -1706,7 +1719,7 @@ static void SV_UpdateToReliableMessages (void)
                if (strcmp(host_client->old_name, host_client->name))
                {
                        if (host_client->spawned)
-                               SV_BroadcastPrintf("%s^%i changed name to %s\n", host_client->old_name, STRING_COLOR_DEFAULT, host_client->name);
+                               SV_BroadcastPrintf("%s changed name to %s\n", host_client->old_name, host_client->name);
                        strlcpy(host_client->old_name, host_client->name, sizeof(host_client->old_name));
                        // send notification to all clients
                        MSG_WriteByte (&sv.reliable_datagram, svc_updatename);
@@ -1937,6 +1950,7 @@ static void SV_Download_f(void)
 
        host_client->download_expectedposition = 0;
        host_client->download_started = false;
+       host_client->sendsignon = true; // make sure this message is sent
 
        // the rest of the download process is handled in SV_SendClientDatagram
        // and other code dealing with svc_downloaddata and clc_ackdownloaddata