]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/cl_client.qc
Fix some SVQC and CSQC string leaks.
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / cl_client.qc
index a604055b8d8ce1a11dd66f3c2246f434fde7aa93..fbe028eaffec5518efa0828cf09cc88428c80d6c 100644 (file)
@@ -3,7 +3,6 @@
 #include "anticheat.qh"
 #include "cl_impulse.qh"
 #include "cl_player.qh"
-#include "ent_cs.qh"
 #include "ipban.qh"
 #include "miscfunctions.qh"
 #include "portals.qh"
@@ -23,6 +22,7 @@
 #include "bot/bot.qh"
 #include "bot/navigation.qh"
 
+#include "../common/ent_cs.qh"
 #include "../common/vehicles/all.qh"
 #include "../common/triggers/teleporters.qh"
 
@@ -175,7 +175,6 @@ void setplayermodel(entity e, string modelname)
        precache_model(modelname);
        _setmodel(e, modelname);
        player_setupanimsformodel();
-       UpdatePlayerSounds();
 }
 
 /*
@@ -319,6 +318,15 @@ void PutObserverInServer()
        self.event_damage = func_null;
 }
 
+int player_getspecies(entity this)
+{
+       get_model_parameters(this.model, this.skin);
+       int s = get_model_parameters_species;
+       get_model_parameters(string_null, 0);
+       if (s < 0) return SPECIES_HUMAN;
+       return s;
+}
+
 .float model_randomizer;
 void FixPlayermodel(entity player)
 {
@@ -395,8 +403,7 @@ void FixPlayermodel(entity player)
 
        if(chmdl || oldskin != player.skin) // model or skin has changed
        {
-               player.species = player_getspecies(); // update species
-               UpdatePlayerSounds(); // update skin sounds
+               player.species = player_getspecies(player); // update species
        }
 
        if(!teamplay)
@@ -563,8 +570,6 @@ void PutClientInServer()
                this.bot_attack = true;
                this.monster_attack = true;
 
-               this.spider_slowness = 0;
-
                this.BUTTON_ATCK = this.BUTTON_JUMP = this.BUTTON_ATCK2 = false;
 
                if (this.killcount == FRAGS_SPECTATOR) {
@@ -630,36 +635,40 @@ void PutClientInServer()
 // changes and just have a console command to update this?
 bool ClientInit_SendEntity(entity this, entity to, int sf)
 {
-       WriteHeader(MSG_ENTITY, ENT_CLIENT_INIT);
-       WriteByte(MSG_ENTITY, g_nexball_meter_period * 32);
-       WriteInt24_t(MSG_ENTITY, compressShotOrigin(hook_shotorigin[0]));
-       WriteInt24_t(MSG_ENTITY, compressShotOrigin(hook_shotorigin[1]));
-       WriteInt24_t(MSG_ENTITY, compressShotOrigin(hook_shotorigin[2]));
-       WriteInt24_t(MSG_ENTITY, compressShotOrigin(hook_shotorigin[3]));
-       WriteInt24_t(MSG_ENTITY, compressShotOrigin(arc_shotorigin[0]));
-       WriteInt24_t(MSG_ENTITY, compressShotOrigin(arc_shotorigin[1]));
-       WriteInt24_t(MSG_ENTITY, compressShotOrigin(arc_shotorigin[2]));
-       WriteInt24_t(MSG_ENTITY, compressShotOrigin(arc_shotorigin[3]));
+       WriteHeader(MSG_ENTITY, _ENT_CLIENT_INIT);
+       return = true;
+       msg_entity = to;
+       Registry_send_all();
+       int channel = MSG_ONE;
+       WriteHeader(channel, ENT_CLIENT_INIT);
+       WriteByte(channel, g_nexball_meter_period * 32);
+       WriteInt24_t(channel, compressShotOrigin(hook_shotorigin[0]));
+       WriteInt24_t(channel, compressShotOrigin(hook_shotorigin[1]));
+       WriteInt24_t(channel, compressShotOrigin(hook_shotorigin[2]));
+       WriteInt24_t(channel, compressShotOrigin(hook_shotorigin[3]));
+       WriteInt24_t(channel, compressShotOrigin(arc_shotorigin[0]));
+       WriteInt24_t(channel, compressShotOrigin(arc_shotorigin[1]));
+       WriteInt24_t(channel, compressShotOrigin(arc_shotorigin[2]));
+       WriteInt24_t(channel, compressShotOrigin(arc_shotorigin[3]));
 
        if(sv_foginterval && world.fog != "")
-               WriteString(MSG_ENTITY, world.fog);
+               WriteString(channel, world.fog);
        else
-               WriteString(MSG_ENTITY, "");
-       WriteByte(MSG_ENTITY, self.count * 255.0); // g_balance_armor_blockpercent
-       WriteCoord(MSG_ENTITY, self.bouncefactor); // g_balance_mortar_bouncefactor // WEAPONTODO
-       WriteCoord(MSG_ENTITY, self.bouncestop); // g_balance_mortar_bouncestop
-       WriteCoord(MSG_ENTITY, self.ebouncefactor); // g_balance_mortar_bouncefactor
-       WriteCoord(MSG_ENTITY, self.ebouncestop); // g_balance_mortar_bouncestop
-       WriteByte(MSG_ENTITY, WEP_CVAR(vortex, secondary)); // client has to know if it should zoom or not // WEAPONTODO
-       WriteByte(MSG_ENTITY, WEP_CVAR(rifle, secondary)); // client has to know if it should zoom or not // WEAPONTODO
-       WriteByte(MSG_ENTITY, serverflags); // client has to know if it should zoom or not
-       WriteByte(MSG_ENTITY, WEP_CVAR(minelayer, limit)); // minelayer max mines // WEAPONTODO
-       WriteByte(MSG_ENTITY, WEP_CVAR_SEC(hagar, load_max)); // hagar max loadable rockets // WEAPONTODO
-       WriteCoord(MSG_ENTITY, autocvar_g_trueaim_minrange);
-       WriteByte(MSG_ENTITY, WEP_CVAR(porto, secondary)); // WEAPONTODO
+               WriteString(channel, "");
+       WriteByte(channel, self.count * 255.0); // g_balance_armor_blockpercent
+       WriteCoord(channel, self.bouncefactor); // g_balance_mortar_bouncefactor // WEAPONTODO
+       WriteCoord(channel, self.bouncestop); // g_balance_mortar_bouncestop
+       WriteCoord(channel, self.ebouncefactor); // g_balance_mortar_bouncefactor
+       WriteCoord(channel, self.ebouncestop); // g_balance_mortar_bouncestop
+       WriteByte(channel, WEP_CVAR(vortex, secondary)); // client has to know if it should zoom or not // WEAPONTODO
+       WriteByte(channel, WEP_CVAR(rifle, secondary)); // client has to know if it should zoom or not // WEAPONTODO
+       WriteByte(channel, serverflags); // client has to know if it should zoom or not
+       WriteByte(channel, WEP_CVAR(minelayer, limit)); // minelayer max mines // WEAPONTODO
+       WriteByte(channel, WEP_CVAR_SEC(hagar, load_max)); // hagar max loadable rockets // WEAPONTODO
+       WriteCoord(channel, autocvar_g_trueaim_minrange);
+       WriteByte(channel, WEP_CVAR(porto, secondary)); // WEAPONTODO
 
        MUTATOR_CALLHOOK(Ent_Init);
-       return true;
 }
 
 void ClientInit_CheckUpdate()
@@ -1167,7 +1176,7 @@ void ClientConnect ()
        else
                stuffcmd(self, "set _teams_available 0\n");
 
-       attach_entcs(self);
+       entcs_attach(self);
 
        bot_relinkplayerlist();
 
@@ -1188,7 +1197,7 @@ void ClientConnect ()
                        Send_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER, CENTER_MOTD, getwelcomemessage());
                }
 
-               if(autocvar_g_bugrigs || (g_weaponarena_weapons == WEPSET(TUBA)))
+               if(g_weaponarena_weapons == WEPSET(TUBA))
                        stuffcmd(self, "cl_cmd settemp chase_active 1\n");
        }
 
@@ -1207,7 +1216,7 @@ void ClientConnect ()
        self.model_randomizer = random();
 
        if(IS_REAL_CLIENT(self))
-               sv_notice_join();
+               sv_notice_join(self);
 
        for (entity e = world; (e = findfloat(e, init_for_player_needed, 1)); ) {
                WITH(entity, self, e, e.init_for_player(this));
@@ -1253,7 +1262,7 @@ void ClientDisconnect ()
 
        bot_clientdisconnect();
 
-       detach_entcs(self);
+       entcs_detach(self);
 
        if(autocvar_sv_eventlog)
                GameLogEcho(strcat(":part:", ftos(self.playerid)));
@@ -1294,8 +1303,6 @@ void ClientDisconnect ()
        if(self.weaponorder_byimpulse)
                strunzone(self.weaponorder_byimpulse);
 
-       ClearPlayerSounds();
-
        if(self.personal)
                remove(self.personal);