]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/g_hook.qc
Merge branch 'terencehill/menu_optimization' into 'master'
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / g_hook.qc
index f95115a2ca465a8f8fbe01679da18eed973229a6..4a32779289d12c54f10da05bb6e357b4c8266a89 100644 (file)
@@ -80,12 +80,12 @@ void RemoveGrapplingHook(entity pl)
        //pl.disableclientprediction = false;
 }
 
-void GrapplingHookReset(void)
-{SELFPARAM();
-       if(self.realowner.hook == self)
-               RemoveGrapplingHook(self.owner);
+void GrapplingHookReset(entity this)
+{
+       if(this.realowner.hook == this)
+               RemoveGrapplingHook(this.owner);
        else // in any case:
-               remove(self);
+               remove(this);
 }
 
 void GrapplingHookThink();
@@ -106,14 +106,14 @@ void GrapplingHook_Stop()
 .vector hook_start, hook_end;
 bool GrapplingHookSend(entity this, entity to, int sf)
 {
-       WriteByte(MSG_ENTITY, ENT_CLIENT_HOOK);
+       WriteHeader(MSG_ENTITY, ENT_CLIENT_HOOK);
        sf = sf & 0x7F;
        if(sound_allowed(MSG_BROADCAST, self.realowner))
                sf |= 0x80;
        WriteByte(MSG_ENTITY, sf);
        if(sf & 1)
        {
-               WriteByte(MSG_ENTITY, num_for_edict(self.realowner));
+               WriteByte(MSG_ENTITY, etof(self.realowner));
        }
        if(sf & 2)
        {
@@ -240,10 +240,10 @@ void GrapplingHookThink()
                                        {
                                                entity aim_ent = ((IS_VEHICLE(self.aiment) && self.aiment.owner) ? self.aiment.owner : self.aiment);
                                                v = v - dv * 0.5;
-                                               if((frozen_pulling && self.aiment.frozen) || !frozen_pulling)
+                                               if((frozen_pulling && STAT(FROZEN, self.aiment)) || !frozen_pulling)
                                                {
                                                        self.aiment.velocity = self.aiment.velocity - dv * 0.5;
-                                                       self.aiment.flags &= ~FL_ONGROUND;
+                                                       UNSET_ONGROUND(self.aiment);
                                                        if(self.aiment.flags & FL_PROJECTILE)
                                                                UpdateCSQCProjectile(self.aiment);
                                                }
@@ -255,13 +255,13 @@ void GrapplingHookThink()
                                        }
                                }
 
-                               pull_entity.flags &= ~FL_ONGROUND;
+                               UNSET_ONGROUND(pull_entity);
                        }
 
                        if(!frozen_pulling && !(self.aiment.flags & FL_PROJECTILE))
                                pull_entity.velocity = WarpZone_RefSys_TransformVelocity(self, pull_entity, v * velocity_multiplier);
 
-                       if(frozen_pulling && autocvar_g_balance_grapplehook_pull_frozen == 2 && !self.aiment.frozen)
+                       if(frozen_pulling && autocvar_g_balance_grapplehook_pull_frozen == 2 && !STAT(FROZEN, self.aiment))
                        {
                                RemoveGrapplingHook(self.realowner);
                                return;
@@ -280,7 +280,7 @@ void GrapplingHookThink()
                        self.realowner.velocity = dir*spd;
                        self.realowner.movetype = MOVETYPE_FLY;
 
-                       self.realowner.flags &= ~FL_ONGROUND;
+                       UNSET_ONGROUND(self.realowner);
                }
        }
 
@@ -299,7 +299,7 @@ void GrapplingHookThink()
        }
 }
 
-void GrapplingHookTouch (void)
+void GrapplingHookTouch ()
 {SELFPARAM();
        if(other.movetype == MOVETYPE_FOLLOW)
                return;
@@ -317,29 +317,29 @@ void GrapplingHookTouch (void)
        //self.realowner.disableclientprediction = true;
 }
 
-void GrapplingHook_Damage (entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
-{SELFPARAM();
-       if(self.health <= 0)
+void GrapplingHook_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
+{
+       if(this.health <= 0)
                return;
 
-       if (!W_CheckProjectileDamage(inflictor.realowner, self.realowner, deathtype, -1)) // no exceptions
+       if (!W_CheckProjectileDamage(inflictor.realowner, this.realowner, deathtype, -1)) // no exceptions
                return; // g_balance_projectiledamage says to halt
 
-       self.health = self.health - damage;
+       this.health = this.health - damage;
 
-       if (self.health <= 0)
+       if (this.health <= 0)
        {
-               if(attacker != self.realowner)
+               if(attacker != this.realowner)
                {
-                       self.realowner.pusher = attacker;
-                       self.realowner.pushltime = time + autocvar_g_maxpushtime;
-                       self.realowner.istypefrag = self.realowner.BUTTON_CHAT;
+                       this.realowner.pusher = attacker;
+                       this.realowner.pushltime = time + autocvar_g_maxpushtime;
+                       this.realowner.istypefrag = this.realowner.BUTTON_CHAT;
                }
-               RemoveGrapplingHook(self.realowner);
+               RemoveGrapplingHook(this.realowner);
        }
 }
 
-void FireGrapplingHook (void)
+void FireGrapplingHook ()
 {SELFPARAM();
        entity missile;
        vector org;
@@ -419,11 +419,3 @@ void GrappleHookInit()
                hook_shotorigin[3] = shotorg_adjust_values(CL_Weapon_GetShotOrg(WEP_HOOK.m_id), false, false, 4);
        }
 }
-
-void SetGrappleHookBindings()
-{SELFPARAM();
-       // this function has been modified for Xonotic
-       // don't remove these lines! old server or demos coud overwrite the new aliases
-       stuffcmd(self, "alias +hook +button6\n");
-       stuffcmd(self, "alias -hook -button6\n");
-}