]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/cl_client.qc
ent_cs: cleanup
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / cl_client.qc
index bd9c46a9b09de09f634d092f47fe4f6c3f91279f..71efa5f9d931233f32899305692f023ceaea5d96 100644 (file)
@@ -53,8 +53,8 @@ void send_CSQC_teamnagger() {
        WriteByte(MSG_BROADCAST, TE_CSQC_TEAMNAGGER);
 }
 
-float ClientData_Send(entity to, int sf)
-{SELFPARAM();
+bool ClientData_Send(entity this, entity to, int sf)
+{
        if(to != self.owner)
        {
                error("wtf");
@@ -205,6 +205,7 @@ void PutObserverInServer (void)
        }
 
        self.frags = FRAGS_SPECTATOR;
+       self.bot_attack = false;
 
        MUTATOR_CALLHOOK(MakePlayerObserver);
 
@@ -329,9 +330,8 @@ void FixPlayermodel()
        {
                if(teamplay)
                {
-                       string s;
-                       s = Static_Team_ColorName_Lower(self.team);
-                       if(s != "neutral")
+                       string s = Static_Team_ColorName_Lower(self.team);
+                       if (s != "neutral")
                        {
                                defaultmodel = cvar_string(strcat("sv_defaultplayermodel_", s));
                                defaultskin = cvar(strcat("sv_defaultplayerskin_", s));
@@ -511,10 +511,10 @@ void PutClientInServer()
                if(g_weaponarena_random) // WEAPONTODO: more stuff that should be in a mutator. also: rename those cvars
                {
                        if(g_weaponarena_random_with_blaster)
-                               self.weapons &= ~WEPSET_BLASTER;
+                               self.weapons &= ~WEPSET(BLASTER);
                        W_RandomWeapons(self, g_weaponarena_random);
                        if(g_weaponarena_random_with_blaster)
-                               self.weapons |= WEPSET_BLASTER;
+                               self.weapons |= WEPSET(BLASTER);
                }
 
                self.items = start_items;
@@ -620,7 +620,8 @@ void PutClientInServer()
                // reset fields the weapons may use
                for (int j = WEP_FIRST; j <= WEP_LAST; ++j)
                {
-                       WEP_ACTION(j, WR_RESETPLAYER);
+                       Weapon w = get_weaponinfo(j);
+                       w.wr_resetplayer(w);
 
                        // all weapons must be fully loaded when we spawn
                        entity e = get_weaponinfo(j);
@@ -666,8 +667,8 @@ void PutClientInServer()
 .float ebouncefactor, ebouncestop; // electro's values
 // TODO do we need all these fields, or should we stop autodetecting runtime
 // changes and just have a console command to update this?
-float ClientInit_SendEntity(entity to, int sf)
-{SELFPARAM();
+bool ClientInit_SendEntity(entity this, entity to, int sf)
+{
        WriteByte(MSG_ENTITY, ENT_CLIENT_INIT);
        WriteByte(MSG_ENTITY, g_nexball_meter_period * 32);
        WriteInt24_t(MSG_ENTITY, compressShotOrigin(hook_shotorigin[0]));
@@ -1215,7 +1216,7 @@ void ClientConnect (void)
        else
                stuffcmd(self, "set _teams_available 0\n");
 
-       attach_entcs();
+       attach_entcs(self);
 
        bot_relinkplayerlist();
 
@@ -1236,7 +1237,7 @@ void ClientConnect (void)
                        Send_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER, CENTER_MOTD, getwelcomemessage());
                }
 
-               if(autocvar_g_bugrigs || (g_weaponarena_weapons == WEPSET_TUBA))
+               if(autocvar_g_bugrigs || (g_weaponarena_weapons == WEPSET(TUBA)))
                        stuffcmd(self, "cl_cmd settemp chase_active 1\n");
        }
 
@@ -1301,8 +1302,7 @@ void ClientDisconnect (void)
 
        bot_clientdisconnect();
 
-       if(self.entcs)
-               detach_entcs();
+       detach_entcs(self);
 
        if(autocvar_sv_eventlog)
                GameLogEcho(strcat(":part:", ftos(self.playerid)));
@@ -1447,7 +1447,7 @@ void play_countdown(float finished, string samp)
        if(IS_REAL_CLIENT(self))
                if(floor(finished - time - frametime) != floor(finished - time))
                        if(finished - time < 6)
-                               sound (self, CH_INFO, samp, VOL_BASE, ATTEN_NORM);
+                               _sound (self, CH_INFO, samp, VOL_BASE, ATTEN_NORM);
 }
 
 void player_powerups (void)
@@ -1472,7 +1472,7 @@ void player_powerups (void)
        {
                if (self.items & ITEM_Strength.m_itemid)
                {
-                       play_countdown(self.strength_finished, "misc/poweroff.wav");
+                       play_countdown(self.strength_finished, SND(POWEROFF));
                        self.effects = self.effects | (EF_BLUE | EF_ADDITIVE | EF_FULLBRIGHT);
                        if (time > self.strength_finished)
                        {
@@ -1492,7 +1492,7 @@ void player_powerups (void)
                }
                if (self.items & ITEM_Shield.m_itemid)
                {
-                       play_countdown(self.invincible_finished, "misc/poweroff.wav");
+                       play_countdown(self.invincible_finished, SND(POWEROFF));
                        self.effects = self.effects | (EF_RED | EF_ADDITIVE | EF_FULLBRIGHT);
                        if (time > self.invincible_finished)
                        {
@@ -1525,7 +1525,7 @@ void player_powerups (void)
                        }
                        else
                        {
-                               play_countdown(self.superweapons_finished, "misc/poweroff.wav");
+                               play_countdown(self.superweapons_finished, SND(POWEROFF));
                                if (time > self.superweapons_finished)
                                {
                                        self.items = self.items - (self.items & IT_SUPERWEAPON);
@@ -2545,14 +2545,12 @@ void PlayerPreThink (void)
 
                FixPlayermodel();
 
-               GrapplingHookFrame();
-
                // LordHavoc: allow firing on move frames (sub-ticrate), this gives better timing on slow servers
                //if(frametime)
                {
                        self.items &= ~self.items_added;
 
-                       W_WeaponFrame();
+                       W_WeaponFrame(self);
 
                        self.items_added = 0;
                        if(self.items & ITEM_Jetpack.m_itemid)