]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/weapons/weapon/hook.qc
take3: format 903 files
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / weapons / weapon / hook.qc
index 04383716addb57fa1a9de811db2557aee8a40722..ea26d8bfc9fa483a81e273495a12ce65084e8d3c 100644 (file)
@@ -2,7 +2,10 @@
 
 #ifdef SVQC
 
-spawnfunc(weapon_hook) { weapon_defaultspawnfunc(this, WEP_HOOK); }
+spawnfunc(weapon_hook)
+{
+       weapon_defaultspawnfunc(this, WEP_HOOK);
+}
 
 void W_Hook_ExplodeThink(entity this)
 {
@@ -16,12 +19,13 @@ void W_Hook_ExplodeThink(entity this)
 
        RadiusDamage(this, this.realowner, this.dmg * f, this.dmg_edge * f, this.dmg_radius, this.realowner, NULL, this.dmg_force * f, this.projectiledeathtype, NULL);
        this.projectiledeathtype |= HITTYPE_BOUNCE;
-       //RadiusDamage(this, NULL, this.dmg * f, this.dmg_edge * f, this.dmg_radius, NULL, NULL, this.dmg_force * f, this.projectiledeathtype, NULL);
+       // RadiusDamage(this, NULL, this.dmg * f, this.dmg_edge * f, this.dmg_radius, NULL, NULL, this.dmg_force * f, this.projectiledeathtype, NULL);
 
-       if(dt < this.dmg_duration)
+       if (dt < this.dmg_duration) {
                this.nextthink = time + 0.05; // soon
-       else
+       } else {
                delete(this);
+       }
 }
 
 void W_Hook_Explode2(entity this)
@@ -50,16 +54,18 @@ void W_Hook_Explode2_use(entity this, entity actor, entity trigger)
 
 void W_Hook_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
 {
-       if(this.health <= 0)
+       if (this.health <= 0) {
                return;
+       }
 
-       if(!W_CheckProjectileDamage(inflictor.realowner, this.realowner, deathtype, -1)) // no exceptions
+       if (!W_CheckProjectileDamage(inflictor.realowner, this.realowner, deathtype, -1)) { // no exceptions
                return; // g_projectiles_damage says to halt
-
+       }
        this.health = this.health - damage;
 
-       if(this.health <= 0)
+       if (this.health <= 0) {
                W_PrepareExplosionByDamage(this, this.realowner, W_Hook_Explode2);
+       }
 }
 
 void W_Hook_Touch2(entity this, entity toucher)
@@ -70,7 +76,7 @@ void W_Hook_Touch2(entity this, entity toucher)
 
 void W_Hook_Attack2(Weapon thiswep, entity actor, .entity weaponentity)
 {
-       //W_DecreaseAmmo(thiswep, actor, WEP_CVAR_SEC(hook, ammo)); // WEAPONTODO: Figure out how to handle ammo with hook secondary (gravitybomb)
+       // W_DecreaseAmmo(thiswep, actor, WEP_CVAR_SEC(hook, ammo)); // WEAPONTODO: Figure out how to handle ammo with hook secondary (gravitybomb)
        W_SetupShot(actor, weaponentity, false, 4, SND_HOOKBOMB_FIRE, CH_WEAPON_A, WEP_CVAR_SEC(hook, damage));
 
        entity gren = new(hookbomb);
@@ -97,11 +103,12 @@ void W_Hook_Attack2(Weapon thiswep, entity actor, .entity weaponentity)
        gren.missile_flags = MIF_SPLASH | MIF_ARC;
 
        gren.velocity = '0 0 1' * WEP_CVAR_SEC(hook, speed);
-       if (autocvar_g_projectiles_newton_style)
+       if (autocvar_g_projectiles_newton_style) {
                gren.velocity = gren.velocity + actor.velocity;
+       }
 
        gren.gravity = WEP_CVAR_SEC(hook, gravity);
-       //W_SetupProjVelocity_Basic(gren); // just falling down!
+       // W_SetupProjVelocity_Basic(gren); // just falling down!
 
        gren.angles = '0 0 0';
        gren.flags = FL_PROJECTILE;
@@ -115,96 +122,87 @@ void W_Hook_Attack2(Weapon thiswep, entity actor, .entity weaponentity)
 
 METHOD(Hook, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
 {
-    if (fire & 1) {
-        if(!actor.(weaponentity).hook)
-        if(!(actor.(weaponentity).hook_state & HOOK_WAITING_FOR_RELEASE))
-        if(time > actor.(weaponentity).hook_refire)
-        if(weapon_prepareattack(thiswep, actor, weaponentity, false, -1))
-        {
-            W_DecreaseAmmo(thiswep, actor, thiswep.ammo_factor * WEP_CVAR_PRI(hook, ammo), weaponentity);
-            actor.(weaponentity).hook_state |= HOOK_FIRING;
-            actor.(weaponentity).hook_state |= HOOK_WAITING_FOR_RELEASE;
-            weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(hook, animtime), w_ready);
-        }
-    } else {
-        actor.(weaponentity).hook_state |= HOOK_REMOVING;
-        actor.(weaponentity).hook_state &= ~HOOK_WAITING_FOR_RELEASE;
-    }
-
-    if(fire & 2)
-    {
-        if(weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR_SEC(hook, refire)))
-        {
-            W_Hook_Attack2(thiswep, actor, weaponentity);
-            weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(hook, animtime), w_ready);
-        }
-    }
-
-    if(actor.(weaponentity).hook)
-    {
-        // if hooked, no bombs, and increase the timer
-        actor.(weaponentity).hook_refire = max(actor.(weaponentity).hook_refire, time + WEP_CVAR_PRI(hook, refire) * W_WeaponRateFactor(actor));
-
-        // hook also inhibits health regeneration, but only for 1 second
-        if(!(actor.items & IT_UNLIMITED_WEAPON_AMMO))
-            actor.pauseregen_finished = max(actor.pauseregen_finished, time + autocvar_g_balance_pause_fuel_regen);
-    }
-
-    if(actor.(weaponentity).hook && actor.(weaponentity).hook.state == 1)
-    {
-        float hooked_time_max = WEP_CVAR_PRI(hook, hooked_time_max);
-        if(hooked_time_max > 0)
-        {
-            if( time > actor.(weaponentity).hook_time_hooked + hooked_time_max )
-                actor.(weaponentity).hook_state |= HOOK_REMOVING;
-        }
-
-        float hooked_fuel = thiswep.ammo_factor * WEP_CVAR_PRI(hook, hooked_ammo);
-        if(hooked_fuel > 0)
-        {
-            if( time > actor.(weaponentity).hook_time_fueldecrease )
-            {
-                if(!(actor.items & IT_UNLIMITED_WEAPON_AMMO))
-                {
-                    if( actor.ammo_fuel >= (time - actor.(weaponentity).hook_time_fueldecrease) * hooked_fuel )
-                    {
-                        W_DecreaseAmmo(thiswep, actor, (time - actor.(weaponentity).hook_time_fueldecrease) * hooked_fuel, weaponentity);
-                        actor.(weaponentity).hook_time_fueldecrease = time;
-                        // decrease next frame again
-                    }
-                    else
-                    {
-                        actor.ammo_fuel = 0;
-                        actor.(weaponentity).hook_state |= HOOK_REMOVING;
-                        if(actor.(weaponentity).m_weapon != WEP_Null) // offhand
-                               W_SwitchWeapon_Force(actor, w_getbestweapon(actor, weaponentity), weaponentity);
-                    }
-                }
-            }
-        }
-    }
-    else
-    {
-        actor.(weaponentity).hook_time_hooked = time;
-        actor.(weaponentity).hook_time_fueldecrease = time + WEP_CVAR_PRI(hook, hooked_time_free);
-    }
-
-    actor.(weaponentity).hook_state = BITSET(actor.(weaponentity).hook_state, HOOK_PULLING, (!PHYS_INPUT_BUTTON_CROUCH(actor) || !autocvar_g_balance_grapplehook_crouchslide));
-
-    if (actor.(weaponentity).hook_state & HOOK_FIRING)
-    {
-        if (actor.(weaponentity).hook)
-            RemoveHook(actor.(weaponentity).hook);
-        FireGrapplingHook(actor, weaponentity);
-        actor.(weaponentity).hook_state &= ~HOOK_FIRING;
-        actor.(weaponentity).hook_refire = max(actor.(weaponentity).hook_refire, time + autocvar_g_balance_grapplehook_refire * W_WeaponRateFactor(actor));
-    }
-    else if (actor.(weaponentity).hook_state & HOOK_REMOVING)
-    {
-        if (actor.(weaponentity).hook)
-            RemoveHook(actor.(weaponentity).hook);
-        actor.(weaponentity).hook_state &= ~HOOK_REMOVING;
-    }
+       if (fire & 1) {
+               if (!actor.(weaponentity).hook) {
+                       if (!(actor.(weaponentity).hook_state & HOOK_WAITING_FOR_RELEASE)) {
+                               if (time > actor.(weaponentity).hook_refire) {
+                                       if (weapon_prepareattack(thiswep, actor, weaponentity, false, -1)) {
+                                               W_DecreaseAmmo(thiswep, actor, thiswep.ammo_factor * WEP_CVAR_PRI(hook, ammo), weaponentity);
+                                               actor.(weaponentity).hook_state |= HOOK_FIRING;
+                                               actor.(weaponentity).hook_state |= HOOK_WAITING_FOR_RELEASE;
+                                               weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(hook, animtime), w_ready);
+                                       }
+                               }
+                       }
+               }
+       } else {
+               actor.(weaponentity).hook_state |= HOOK_REMOVING;
+               actor.(weaponentity).hook_state &= ~HOOK_WAITING_FOR_RELEASE;
+       }
+
+       if (fire & 2) {
+               if (weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR_SEC(hook, refire))) {
+                       W_Hook_Attack2(thiswep, actor, weaponentity);
+                       weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(hook, animtime), w_ready);
+               }
+       }
+
+       if (actor.(weaponentity).hook) {
+               // if hooked, no bombs, and increase the timer
+               actor.(weaponentity).hook_refire = max(actor.(weaponentity).hook_refire, time + WEP_CVAR_PRI(hook, refire) * W_WeaponRateFactor(actor));
+
+               // hook also inhibits health regeneration, but only for 1 second
+               if (!(actor.items & IT_UNLIMITED_WEAPON_AMMO)) {
+                       actor.pauseregen_finished = max(actor.pauseregen_finished, time + autocvar_g_balance_pause_fuel_regen);
+               }
+       }
+
+       if (actor.(weaponentity).hook && actor.(weaponentity).hook.state == 1) {
+               float hooked_time_max = WEP_CVAR_PRI(hook, hooked_time_max);
+               if (hooked_time_max > 0) {
+                       if (time > actor.(weaponentity).hook_time_hooked + hooked_time_max) {
+                               actor.(weaponentity).hook_state |= HOOK_REMOVING;
+                       }
+               }
+
+               float hooked_fuel = thiswep.ammo_factor * WEP_CVAR_PRI(hook, hooked_ammo);
+               if (hooked_fuel > 0) {
+                       if (time > actor.(weaponentity).hook_time_fueldecrease) {
+                               if (!(actor.items & IT_UNLIMITED_WEAPON_AMMO)) {
+                                       if (actor.ammo_fuel >= (time - actor.(weaponentity).hook_time_fueldecrease) * hooked_fuel) {
+                                               W_DecreaseAmmo(thiswep, actor, (time - actor.(weaponentity).hook_time_fueldecrease) * hooked_fuel, weaponentity);
+                                               actor.(weaponentity).hook_time_fueldecrease = time;
+                                               // decrease next frame again
+                                       } else {
+                                               actor.ammo_fuel = 0;
+                                               actor.(weaponentity).hook_state |= HOOK_REMOVING;
+                                               if (actor.(weaponentity).m_weapon != WEP_Null) { // offhand
+                                                       W_SwitchWeapon_Force(actor, w_getbestweapon(actor, weaponentity), weaponentity);
+                                               }
+                                       }
+                               }
+                       }
+               }
+       } else {
+               actor.(weaponentity).hook_time_hooked = time;
+               actor.(weaponentity).hook_time_fueldecrease = time + WEP_CVAR_PRI(hook, hooked_time_free);
+       }
+
+       actor.(weaponentity).hook_state = BITSET(actor.(weaponentity).hook_state, HOOK_PULLING, (!PHYS_INPUT_BUTTON_CROUCH(actor) || !autocvar_g_balance_grapplehook_crouchslide));
+
+       if (actor.(weaponentity).hook_state & HOOK_FIRING) {
+               if (actor.(weaponentity).hook) {
+                       RemoveHook(actor.(weaponentity).hook);
+               }
+               FireGrapplingHook(actor, weaponentity);
+               actor.(weaponentity).hook_state &= ~HOOK_FIRING;
+               actor.(weaponentity).hook_refire = max(actor.(weaponentity).hook_refire, time + autocvar_g_balance_grapplehook_refire * W_WeaponRateFactor(actor));
+       } else if (actor.(weaponentity).hook_state & HOOK_REMOVING) {
+               if (actor.(weaponentity).hook) {
+                       RemoveHook(actor.(weaponentity).hook);
+               }
+               actor.(weaponentity).hook_state &= ~HOOK_REMOVING;
+       }
 }
 METHOD(Hook, wr_setup, void(entity thiswep, entity actor, .entity weaponentity))
 {
@@ -212,31 +210,31 @@ METHOD(Hook, wr_setup, void(entity thiswep, entity actor, .entity weaponentity))
 }
 METHOD(Hook, wr_checkammo1, bool(Hook thiswep, entity actor, .entity weaponentity))
 {
-    if (!thiswep.ammo_factor) return true;
+       if (!thiswep.ammo_factor) { return true; }
 
-    if(actor.(weaponentity).hook)
-       return actor.ammo_fuel > 0;
+       if (actor.(weaponentity).hook) {
+               return actor.ammo_fuel > 0;
+       }
 
-    return actor.ammo_fuel >= WEP_CVAR_PRI(hook, ammo);
+       return actor.ammo_fuel >= WEP_CVAR_PRI(hook, ammo);
 }
 METHOD(Hook, wr_checkammo2, bool(Hook thiswep, entity actor, .entity weaponentity))
 {
-    // infinite ammo for now
-    return true; // actor.ammo_cells >= WEP_CVAR_SEC(hook, ammo); // WEAPONTODO: see above
+       // infinite ammo for now
+       return true; // actor.ammo_cells >= WEP_CVAR_SEC(hook, ammo); // WEAPONTODO: see above
 }
 METHOD(Hook, wr_resetplayer, void(entity thiswep, entity actor))
 {
-    RemoveGrapplingHooks(actor);
-    for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
-    {
-       .entity weaponentity = weaponentities[slot];
-       actor.(weaponentity).hook_time = 0;
-       actor.(weaponentity).hook_refire = time;
-    }
+       RemoveGrapplingHooks(actor);
+       for (int slot = 0; slot < MAX_WEAPONSLOTS; ++slot) {
+               .entity weaponentity = weaponentities[slot];
+               actor.(weaponentity).hook_time = 0;
+               actor.(weaponentity).hook_refire = time;
+       }
 }
 METHOD(Hook, wr_killmessage, Notification(entity thiswep))
 {
-    return WEAPON_HOOK_MURDER;
+       return WEAPON_HOOK_MURDER;
 }
 
 #endif
@@ -244,11 +242,12 @@ METHOD(Hook, wr_killmessage, Notification(entity thiswep))
 
 METHOD(Hook, wr_impacteffect, void(entity thiswep, entity actor))
 {
-    vector org2;
-    org2 = w_org + w_backoff * 2;
-    pointparticles(EFFECT_HOOK_EXPLODE, org2, '0 0 0', 1);
-    if(!w_issilent)
-        sound(actor, CH_SHOTS, SND_HOOKBOMB_IMPACT, VOL_BASE, ATTN_NORM);
+       vector org2;
+       org2 = w_org + w_backoff * 2;
+       pointparticles(EFFECT_HOOK_EXPLODE, org2, '0 0 0', 1);
+       if (!w_issilent) {
+               sound(actor, CH_SHOTS, SND_HOOKBOMB_IMPACT, VOL_BASE, ATTN_NORM);
+       }
 }
 
 #endif
@@ -262,11 +261,11 @@ float autocvar_cl_grapplehook_alpha = 1;
 void Draw_CylindricLine(vector from, vector to, float thickness, string texture, float aspect, float shift, vector rgb, float theAlpha, float drawflag, vector vieworg);
 
 entityclass(Hook);
-class(Hook) .entity HookType; // ENT_CLIENT_*
-class(Hook) .vector origin;
-class(Hook) .vector velocity;
-class(Hook) .float HookSilent;
-class(Hook) .float HookRange;
+class(Hook).entity HookType; // ENT_CLIENT_*
+class(Hook).vector origin;
+class(Hook).vector velocity;
+class(Hook).float HookSilent;
+class(Hook).float HookRange;
 
 string Draw_GrapplingHook_trace_callback_tex;
 float Draw_GrapplingHook_trace_callback_rnd;
@@ -277,12 +276,13 @@ void Draw_GrapplingHook_trace_callback(vector start, vector hit, vector end)
        float i;
        vector vorg;
        vorg = WarpZone_TransformOrigin(WarpZone_trace_transform, view_origin);
-       for(i = 0; i < Draw_GrapplingHook_trace_callback_a; ++i)
+       for (i = 0; i < Draw_GrapplingHook_trace_callback_a; ++i) {
                Draw_CylindricLine(hit, start, 8, Draw_GrapplingHook_trace_callback_tex, 0.25, Draw_GrapplingHook_trace_callback_rnd, Draw_GrapplingHook_trace_callback_rgb, min(1, Draw_GrapplingHook_trace_callback_a - i), DRAWFLAG_NORMAL, vorg);
+       }
        Draw_GrapplingHook_trace_callback_rnd += 0.25 * vlen(hit - start) / 8;
 }
 
-class(Hook) .float teleport_time;
+class(Hook).float teleport_time;
 void Draw_GrapplingHook(entity this)
 {
        vector a, b, atrans;
@@ -292,19 +292,18 @@ void Draw_GrapplingHook(entity this)
        vector vs;
        float intensity, offset;
 
-       if(this.teleport_time)
-       if(time > this.teleport_time)
-       {
-               sound (this, CH_SHOTS_SINGLE, SND_Null, VOL_BASE, ATTEN_NORM); // safeguard
-               this.teleport_time = 0;
+       if (this.teleport_time) {
+               if (time > this.teleport_time) {
+                       sound(this, CH_SHOTS_SINGLE, SND_Null, VOL_BASE, ATTEN_NORM); // safeguard
+                       this.teleport_time = 0;
+               }
        }
 
        InterpolateOrigin_Do(this);
 
        int s = W_GunAlign(viewmodels[this.cnt], STAT(GUNALIGN)) - 1;
 
-       switch(this.HookType)
-       {
+       switch (this.HookType) {
                default:
                case NET_ENT_CLIENT_HOOK:
                        vs = hook_shotorigin[s];
@@ -314,33 +313,30 @@ void Draw_GrapplingHook(entity this)
                        break;
        }
 
-       if((this.owner.sv_entnum == player_localentnum - 1))
-       {
-               switch(this.HookType)
-               {
+       if ((this.owner.sv_entnum == player_localentnum - 1)) {
+               switch (this.HookType) {
                        default:
                        case NET_ENT_CLIENT_HOOK:
-                               if(autocvar_chase_active > 0)
+                               if (autocvar_chase_active > 0) {
                                        a = csqcplayer.origin;
-                               else
+                               } else {
                                        a = view_origin + view_forward * vs.x + view_right * -vs.y + view_up * vs.z;
+                               }
                                b = this.origin;
                                break;
                        case NET_ENT_CLIENT_ARC_BEAM:
-                               if(this.HookRange)
+                               if (this.HookRange) {
                                        b = view_origin + view_forward * this.HookRange;
-                               else
+                               } else {
                                        b = view_origin + view_forward * vlen(this.velocity - this.origin); // honor original length of beam!
+                               }
                                WarpZone_TraceLine(view_origin, b, MOVE_NORMAL, NULL);
                                b = WarpZone_UnTransformOrigin(WarpZone_trace_transform, trace_endpos);
                                a = view_origin + view_forward * vs.x + view_right * -vs.y + view_up * vs.z;
                                break;
                }
-       }
-       else
-       {
-               switch(this.HookType)
-               {
+       } else {
+               switch (this.HookType) {
                        default:
                        case NET_ENT_CLIENT_HOOK:
                                a = this.velocity;
@@ -355,19 +351,27 @@ void Draw_GrapplingHook(entity this)
 
        t = entcs_GetTeamColor(this.owner.sv_entnum);
 
-       switch(this.HookType)
-       {
+       switch (this.HookType) {
                default:
                case NET_ENT_CLIENT_HOOK:
                        intensity = autocvar_cl_grapplehook_alpha;
                        offset = 0;
-                       switch(t)
-                       {
-                               case NUM_TEAM_1: tex = "particles/hook_red"; rgb = '1 0.3 0.3'; break;
-                               case NUM_TEAM_2: tex = "particles/hook_blue"; rgb = '0.3 0.3 1'; break;
-                               case NUM_TEAM_3: tex = "particles/hook_yellow"; rgb = '1 1 0.3'; break;
-                               case NUM_TEAM_4: tex = "particles/hook_pink"; rgb = '1 0.3 1'; break;
-                               default: tex = "particles/hook_white"; rgb = entcs_GetColor(this.sv_entnum - 1); break;
+                       switch (t) {
+                               case NUM_TEAM_1: tex = "particles/hook_red";
+                                       rgb = '1 0.3 0.3';
+                                       break;
+                               case NUM_TEAM_2: tex = "particles/hook_blue";
+                                       rgb = '0.3 0.3 1';
+                                       break;
+                               case NUM_TEAM_3: tex = "particles/hook_yellow";
+                                       rgb = '1 1 0.3';
+                                       break;
+                               case NUM_TEAM_4: tex = "particles/hook_pink";
+                                       rgb = '1 0.3 1';
+                                       break;
+                               default: tex = "particles/hook_white";
+                                       rgb = entcs_GetColor(this.sv_entnum - 1);
+                                       break;
                        }
                        break;
                case NET_ENT_CLIENT_ARC_BEAM: // todo
@@ -391,18 +395,14 @@ void Draw_GrapplingHook(entity this)
 
        atrans = WarpZone_TransformOrigin(WarpZone_trace_transform, a);
 
-       switch(this.HookType)
-       {
+       switch (this.HookType) {
                default:
                case NET_ENT_CLIENT_HOOK:
-                       if(vdist(trace_endpos - atrans, >, 0.5))
-                       {
+                       if (vdist(trace_endpos - atrans, >, 0.5)) {
                                setorigin(this, trace_endpos); // hook endpoint!
                                this.angles = vectoangles(trace_endpos - atrans);
                                this.drawmask = MASK_NORMAL;
-                       }
-                       else
-                       {
+                       } else {
                                this.drawmask = 0;
                        }
                        break;
@@ -411,8 +411,7 @@ void Draw_GrapplingHook(entity this)
                        break;
        }
 
-       switch(this.HookType)
-       {
+       switch (this.HookType) {
                default:
                case NET_ENT_CLIENT_HOOK:
                        break;
@@ -424,13 +423,13 @@ void Draw_GrapplingHook(entity this)
 
 void Remove_GrapplingHook(entity this)
 {
-       sound (this, CH_SHOTS_SINGLE, SND_Null, VOL_BASE, ATTEN_NORM);
+       sound(this, CH_SHOTS_SINGLE, SND_Null, VOL_BASE, ATTEN_NORM);
 
-       for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
-       {
+       for (int slot = 0; slot < MAX_WEAPONSLOTS; ++slot) {
                entity wep = viewmodels[slot];
-               if(wep.hook == this)
+               if (wep.hook == this) {
                        wep.hook = NULL;
+               }
        }
 }
 
@@ -445,17 +444,16 @@ NET_HANDLE(ENT_CLIENT_HOOK, bool bIsNew)
 
        InterpolateOrigin_Undo(this);
 
-       if(sf & 1)
-       {
+       if (sf & 1) {
                int myowner = ReadByte();
                int slot = ReadByte();
                this.owner = playerslots[myowner - 1];
                this.sv_entnum = myowner;
-               if(myowner == player_localentnum)
+               if (myowner == player_localentnum) {
                        viewmodels[slot].hook = this;
+               }
                this.cnt = slot;
-               switch(this.HookType)
-               {
+               switch (this.HookType) {
                        default:
                        case NET_ENT_CLIENT_HOOK:
                                this.HookRange = 0;
@@ -465,15 +463,13 @@ NET_HANDLE(ENT_CLIENT_HOOK, bool bIsNew)
                                break;
                }
        }
-       if(sf & 2)
-       {
+       if (sf & 2) {
                this.origin_x = ReadCoord();
                this.origin_y = ReadCoord();
                this.origin_z = ReadCoord();
                setorigin(this, this.origin);
        }
-       if(sf & 4)
-       {
+       if (sf & 4) {
                this.velocity_x = ReadCoord();
                this.velocity_y = ReadCoord();
                this.velocity_z = ReadCoord();
@@ -481,14 +477,12 @@ NET_HANDLE(ENT_CLIENT_HOOK, bool bIsNew)
 
        InterpolateOrigin_Note(this);
 
-       if(bIsNew || !this.teleport_time)
-       {
+       if (bIsNew || !this.teleport_time) {
                this.draw = Draw_GrapplingHook;
                IL_PUSH(g_drawables, this);
                this.entremove = Remove_GrapplingHook;
 
-               switch(this.HookType)
-               {
+               switch (this.HookType) {
                        default:
                        case NET_ENT_CLIENT_HOOK:
                                // for the model
@@ -496,7 +490,7 @@ NET_HANDLE(ENT_CLIENT_HOOK, bool bIsNew)
                                this.drawmask = MASK_NORMAL;
                                break;
                        case NET_ENT_CLIENT_ARC_BEAM:
-                               sound (this, CH_SHOTS_SINGLE, SND_LGBEAM_FLY, VOL_BASE, ATTEN_NORM);
+                               sound(this, CH_SHOTS_SINGLE, SND_LGBEAM_FLY, VOL_BASE, ATTEN_NORM);
                                break;
                }
        }