]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Improve indentation consistency in weapon code
authorterencehill <piuntn@gmail.com>
Sun, 9 Aug 2020 15:16:01 +0000 (17:16 +0200)
committerterencehill <piuntn@gmail.com>
Sun, 9 Aug 2020 15:16:01 +0000 (17:16 +0200)
qcsrc/common/weapons/all.qc
qcsrc/common/weapons/weapon/arc.qc
qcsrc/common/weapons/weapon/crylink.qc
qcsrc/common/weapons/weapon/fireball.qc
qcsrc/common/weapons/weapon/hlac.qc
qcsrc/common/weapons/weapon/rifle.qc
qcsrc/common/weapons/weapon/shotgun.qc
qcsrc/common/weapons/weapon/vortex.qc

index bb4ae216a5a5d6db8a582404ec1a7779a4b39823..7c089ba70c096514f3af93df29aecd695b88ecde 100644 (file)
 #elif defined(MENUQC)
 #elif defined(SVQC)
        #include <common/items/_mod.qh>
-    #include <lib/warpzone/anglestransform.qh>
-    #include <lib/warpzone/common.qh>
-    #include <lib/warpzone/util_server.qh>
-    #include <lib/warpzone/server.qh>
-    #include "../constants.qh"
-    #include "../stats.qh"
-    #include "../teams.qh"
-    #include <common/util.qh>
-    #include "../monsters/_mod.qh"
-    #include "config.qh"
-    #include <server/weapons/common.qh>
-    #include <server/weapons/csqcprojectile.qh>
-    #include <server/weapons/tracing.qh>
-    #include <server/items/spawning.qh>
-    #include <server/autocvars.qh>
-    #include "../notifications/all.qh"
-    #include "../deathtypes/all.qh"
-    #include <server/mutators/_mod.qh>
-    #include "../mapinfo.qh"
-    #include <server/command/_mod.qh>
-    #include <lib/csqcmodel/sv_model.qh>
-    #include <server/portals.qh>
-    #include <server/hook.qh>
+       #include <lib/warpzone/anglestransform.qh>
+       #include <lib/warpzone/common.qh>
+       #include <lib/warpzone/util_server.qh>
+       #include <lib/warpzone/server.qh>
+       #include "../constants.qh"
+       #include "../stats.qh"
+       #include "../teams.qh"
+       #include <common/util.qh>
+       #include "../monsters/_mod.qh"
+       #include "config.qh"
+       #include <server/weapons/common.qh>
+       #include <server/weapons/csqcprojectile.qh>
+       #include <server/weapons/tracing.qh>
+       #include <server/items/spawning.qh>
+       #include <server/autocvars.qh>
+       #include "../notifications/all.qh"
+       #include "../deathtypes/all.qh"
+       #include <server/mutators/_mod.qh>
+       #include "../mapinfo.qh"
+       #include <server/command/_mod.qh>
+       #include <lib/csqcmodel/sv_model.qh>
+       #include <server/portals.qh>
+#include <server/hook.qh>
 #endif
 #ifdef GAMEQC
        #include "calculations.qc"
@@ -159,12 +159,9 @@ float W_FixWeaponOrder_BuildImpulseList_cmp(int i, int j, entity pass)
        Weapon e2 = REGISTRY_GET(Weapons, sj);
        int d = (e1.impulse + 9) % 10 - (e2.impulse + 9) % 10;
        if (d != 0) return -d;  // high impulse first!
-       return strstrofs(strcat(" ", W_FixWeaponOrder_BuildImpulseList_order, " "),
-               sprintf(" %d ", si), 0)
-              -
-              strstrofs(strcat(" ", W_FixWeaponOrder_BuildImpulseList_order, " "),
-               sprintf(" %d ", sj), 0)
-       ;  // low char index first!
+       string s = strcat(" ", W_FixWeaponOrder_BuildImpulseList_order, " ");
+       return strstrofs(s, sprintf(" %d ", si), 0)
+               - strstrofs(s, sprintf(" %d ", sj), 0); // low char index first!
 }
 string W_FixWeaponOrder_BuildImpulseList(string o)
 {
@@ -475,7 +472,7 @@ void CL_WeaponEntity_SetModel(entity this, string name, bool _anim)
                        int idx = 0;
                        // v_ model attached to invisible h_ model
                        if (this.weaponchild
-                           && ((idx = gettagindex(this.weaponchild, "shell")) || (idx = gettagindex(this.weaponchild, "tag_shell"))))
+                               && ((idx = gettagindex(this.weaponchild, "shell")) || (idx = gettagindex(this.weaponchild, "tag_shell"))))
                        {
                                this.spawnorigin = gettaginfo(this.weaponchild, idx);
                        }
@@ -541,12 +538,10 @@ void CL_WeaponEntity_SetModel(entity this, string name, bool _anim)
        int compressed_shotorg = compressShotOrigin(this.movedir);
        // make them match perfectly
 #ifdef SVQC
-    // null during init
-    if (this.owner) STAT(SHOTORG, this.owner) = compressed_shotorg;
-       this.movedir = decompressShotOrigin(compressed_shotorg);
-#else
-       this.movedir = decompressShotOrigin(compressed_shotorg);
+       // null during init
+       if (this.owner) STAT(SHOTORG, this.owner) = compressed_shotorg;
 #endif
+       this.movedir = decompressShotOrigin(compressed_shotorg);
 
        this.spawnorigin += this.view_ofs;  // offset the casings origin by the same amount
 
@@ -567,7 +562,7 @@ NET_HANDLE(wframe, bool isNew)
 {
        WFRAME fr = ReadByte();
        float t = ReadFloat();
-    int slot = ReadByte();
+       int slot = ReadByte();
        bool restartanim = ReadByte();
        entity wepent = viewmodels[slot];
        if(fr == WFRAME_IDLE)
@@ -596,9 +591,9 @@ NET_HANDLE(wframe, bool isNew)
                case WS_DROP:
                        wepent.weapon_switchdelay = wepent.activeweapon.switchdelay_drop;
                        break;
-        default:
-            wepent.weapon_switchdelay = 0;
-            break;
+               default:
+                       wepent.weapon_switchdelay = 0;
+                       break;
        }
        return true;
 }
@@ -776,11 +771,11 @@ NET_HANDLE(w_muzzleflash, bool isNew)
 {
        return = true;
        int weapon_id = ReadByte();
-    int slot = ReadByte();
-    vector sv_shotorg = ReadVector();
+       int slot = ReadByte();
+       vector sv_shotorg = ReadVector();
 
        Weapon thiswep = REGISTRY_GET(Weapons, weapon_id);
-    vector viewangles = getpropertyvec(VF_CL_VIEWANGLES);
+       vector viewangles = getpropertyvec(VF_CL_VIEWANGLES);
        vector forward, right, up;
        MAKE_VECTORS(viewangles, forward, right, up);
 
@@ -791,7 +786,7 @@ NET_HANDLE(w_muzzleflash, bool isNew)
                pointparticles(thiswep.m_muzzleeffect, sv_shotorg, forward * 1000, 1);
                return;
        }
-    if(!autocvar_r_drawviewmodel) return;
+       if(!autocvar_r_drawviewmodel) return;
 
        entity wepent = viewmodels[slot];
        // get the local player entity to calculate shot origin
index 5f79c8ccfa58d622c4607dc5129e73783399b103..3af9a18da5af96e9e5cac254beebc099e60d45a4 100644 (file)
@@ -931,9 +931,7 @@ void Draw_ArcBeam(entity this)
                if(!v_shot_idx || this.beam_usevieworigin != 2)
                {
                        this.beam_shotorigin = wepent.movedir;
-                       origin_offset =
-                                right * -this.beam_shotorigin.y
-                               + up * this.beam_shotorigin.z;
+                       origin_offset = right * -this.beam_shotorigin.y + up * this.beam_shotorigin.z;
                }
                else
                        this.beam_shotorigin = '0 0 0';
index abed4209f7241959ea5fc82aeafbdd4844f078e1..51d17575074cfe405ca1afe5896de162655c517b 100644 (file)
@@ -505,7 +505,7 @@ void W_Crylink_Attack2(Weapon thiswep, entity actor, .entity weaponentity)
                proj.flags = FL_PROJECTILE;
                IL_PUSH(g_projectiles, proj);
                IL_PUSH(g_bot_dodge, proj);
-        proj.missile_flags = MIF_SPLASH;
+               proj.missile_flags = MIF_SPLASH;
 
                CSQCProjectile(proj, true, (proj.cnt ? PROJECTILE_CRYLINK_BOUNCING : PROJECTILE_CRYLINK), true);
 
index edbdecf0f0d00619c39057f449b330dbabb2e0ca..2796438378d94ad6c26813be2efcb5e5ad5c89e6 100644 (file)
@@ -165,7 +165,7 @@ void W_Fireball_Attack1(entity actor, .entity weaponentity)
        proj.flags = FL_PROJECTILE;
        IL_PUSH(g_projectiles, proj);
        IL_PUSH(g_bot_dodge, proj);
-    proj.missile_flags = MIF_SPLASH | MIF_PROXY;
+       proj.missile_flags = MIF_SPLASH | MIF_PROXY;
 
        CSQCProjectile(proj, true, PROJECTILE_FIREBALL, true);
 
@@ -297,7 +297,7 @@ void W_Fireball_Attack2(entity actor, .entity weaponentity)
        proj.flags = FL_PROJECTILE;
        IL_PUSH(g_projectiles, proj);
        IL_PUSH(g_bot_dodge, proj);
-    proj.missile_flags = MIF_SPLASH | MIF_PROXY | MIF_ARC;
+       proj.missile_flags = MIF_SPLASH | MIF_PROXY | MIF_ARC;
 
        CSQCProjectile(proj, true, PROJECTILE_FIREMINE, true);
 
index 3bc2258207990046fa27fc71cc8428e45b00c709..f3a0463cc007052cf9425d3a20f2b34c5beb0a3e 100644 (file)
@@ -21,14 +21,13 @@ void W_HLAC_Touch(entity this, entity toucher)
 void W_HLAC_Attack(Weapon thiswep, entity actor, .entity weaponentity)
 {
        entity missile;
-    float spread;
 
        W_DecreaseAmmo(thiswep, actor, WEP_CVAR_PRI(hlac, ammo), weaponentity);
 
-    spread = WEP_CVAR_PRI(hlac, spread_min) + (WEP_CVAR_PRI(hlac, spread_add) * actor.(weaponentity).misc_bulletcounter);
-    spread = min(spread,WEP_CVAR_PRI(hlac, spread_max));
-    if(IS_DUCKED(actor))
-        spread = spread * WEP_CVAR_PRI(hlac, spread_crouchmod);
+       float spread = WEP_CVAR_PRI(hlac, spread_min) + (WEP_CVAR_PRI(hlac, spread_add) * actor.(weaponentity).misc_bulletcounter);
+       spread = min(spread,WEP_CVAR_PRI(hlac, spread_max));
+       if(IS_DUCKED(actor))
+               spread = spread * WEP_CVAR_PRI(hlac, spread_crouchmod);
 
        W_SetupShot(actor, weaponentity, false, 3, SND_LASERGUN_FIRE, CH_WEAPON_A, WEP_CVAR_PRI(hlac, damage), thiswep.m_id);
        W_MuzzleFlash(thiswep, actor, weaponentity, w_shotorg, w_shotdir);
@@ -42,7 +41,7 @@ void W_HLAC_Attack(Weapon thiswep, entity actor, .entity weaponentity)
        missile.owner = missile.realowner = actor;
        missile.bot_dodge = true;
 
-    missile.bot_dodgerating = WEP_CVAR_PRI(hlac, damage);
+       missile.bot_dodgerating = WEP_CVAR_PRI(hlac, damage);
 
        set_movetype(missile, MOVETYPE_FLY);
        PROJECTILE_MAKETRIGGER(missile);
@@ -56,7 +55,7 @@ void W_HLAC_Attack(Weapon thiswep, entity actor, .entity weaponentity)
        settouch(missile, W_HLAC_Touch);
        setthink(missile, SUB_Remove);
 
-    missile.nextthink = time + WEP_CVAR_PRI(hlac, lifetime);
+       missile.nextthink = time + WEP_CVAR_PRI(hlac, lifetime);
 
        missile.flags = FL_PROJECTILE;
        IL_PUSH(g_projectiles, missile);
@@ -72,13 +71,10 @@ void W_HLAC_Attack(Weapon thiswep, entity actor, .entity weaponentity)
 void W_HLAC_Attack2(Weapon thiswep, entity actor, .entity weaponentity)
 {
        entity missile;
-    float spread;
+       float spread = WEP_CVAR_SEC(hlac, spread);
 
-    spread = WEP_CVAR_SEC(hlac, spread);
-
-
-    if(IS_DUCKED(actor))
-        spread = spread * WEP_CVAR_SEC(hlac, spread_crouchmod);
+       if(IS_DUCKED(actor))
+               spread = spread * WEP_CVAR_SEC(hlac, spread_crouchmod);
 
        W_SetupShot(actor, weaponentity, false, 3, SND_LASERGUN_FIRE, CH_WEAPON_A, WEP_CVAR_SEC(hlac, damage), thiswep.m_id | HITTYPE_SECONDARY);
        W_MuzzleFlash(thiswep, actor, weaponentity, w_shotorg, w_shotdir);
@@ -87,7 +83,7 @@ void W_HLAC_Attack2(Weapon thiswep, entity actor, .entity weaponentity)
        missile.owner = missile.realowner = actor;
        missile.bot_dodge = true;
 
-    missile.bot_dodgerating = WEP_CVAR_SEC(hlac, damage);
+       missile.bot_dodgerating = WEP_CVAR_SEC(hlac, damage);
 
        set_movetype(missile, MOVETYPE_FLY);
        PROJECTILE_MAKETRIGGER(missile);
@@ -101,7 +97,7 @@ void W_HLAC_Attack2(Weapon thiswep, entity actor, .entity weaponentity)
        settouch(missile, W_HLAC_Touch);
        setthink(missile, SUB_Remove);
 
-    missile.nextthink = time + WEP_CVAR_SEC(hlac, lifetime);
+       missile.nextthink = time + WEP_CVAR_SEC(hlac, lifetime);
 
        missile.flags = FL_PROJECTILE;
        IL_PUSH(g_projectiles, missile);
@@ -137,7 +133,7 @@ void W_HLAC_Attack_Frame(Weapon thiswep, entity actor, .entity weaponentity, int
                ATTACK_FINISHED(actor, weaponentity) = time + WEP_CVAR_PRI(hlac, refire) * W_WeaponRateFactor(actor);
                W_HLAC_Attack(thiswep, actor, weaponentity);
                actor.(weaponentity).misc_bulletcounter = actor.(weaponentity).misc_bulletcounter + 1;
-        weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(hlac, refire), W_HLAC_Attack_Frame);
+               weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(hlac, refire), W_HLAC_Attack_Frame);
        }
        else
        {
@@ -147,12 +143,10 @@ void W_HLAC_Attack_Frame(Weapon thiswep, entity actor, .entity weaponentity, int
 
 void W_HLAC_Attack2_Frame(Weapon thiswep, entity actor, .entity weaponentity)
 {
-    float i;
-
        W_DecreaseAmmo(thiswep, actor, WEP_CVAR_SEC(hlac, ammo), weaponentity);
 
-    for(i=WEP_CVAR_SEC(hlac, shots);i>0;--i)
-        W_HLAC_Attack2(thiswep, actor, weaponentity);
+       for(float i = WEP_CVAR_SEC(hlac, shots); i > 0; --i)
+               W_HLAC_Attack2(thiswep, actor, weaponentity);
 
        if(!autocvar_g_norecoil)
        {
index 9f4bdc15e63d1ba3c6ef9e14177ce084952f97d7..3efa61102d76eecaaf2b29c81a239b127f54622b 100644 (file)
@@ -22,10 +22,10 @@ void W_Rifle_FireBullet(Weapon thiswep, .entity weaponentity, float pSpread, flo
                fireBullet(actor, weaponentity, w_shotorg, w_shotdir, pSpread, pSolidPenetration, pDamage, pHeadshotDamage, pForce, deathtype, (pTracer ? EFFECT_RIFLE : EFFECT_RIFLE_WEAK));
 
        if(autocvar_g_casings >= 2)
-    {
-        makevectors(actor.v_angle); // for some reason, this is lost
+       {
+               makevectors(actor.v_angle); // for some reason, this is lost
                SpawnCasing(((random() * 50 + 50) * v_right) - (v_forward * (random() * 25 + 25)) - ((random() * 5 - 70) * v_up), 2, vectoangles(v_forward),'0 250 0', 100, 3, actor, weaponentity);
-    }
+       }
 }
 
 void W_Rifle_Attack(Weapon thiswep, entity actor, .entity weaponentity)
index 3e25800cce5a69119e3073358f1822ac87d4c04c..dcde58a303554a79794e6c16fd48b0bd8295652b 100644 (file)
@@ -27,7 +27,7 @@ void W_Shotgun_Attack(Weapon thiswep, entity actor, .entity weaponentity, float
 
        for(int sc = 0;sc < bullets;sc = sc + 1)
                fireBullet_antilag(actor, weaponentity, w_shotorg, w_shotdir, spread, solidpenetration, damage, 0, force, thiswep.m_id, bullet_trail_effect, false);
-       
+
        if(lag && bullets > 0)
                antilag_restore_all(actor);
 
index 5a1cd1a9200469c801d85576596ec7bf43117761..b20f6bda375d4e31f00166e20656960402358604 100644 (file)
@@ -51,8 +51,8 @@ void SendCSQCVortexBeamParticle(float charge) {
 NET_HANDLE(TE_CSQC_VORTEXBEAMPARTICLE, bool isNew)
 {
        float charge;
-    vector shotorg = ReadVector();
-    vector endpos = ReadVector();
+       vector shotorg = ReadVector();
+       vector endpos = ReadVector();
        charge = ReadByte() / 255.0;
 
        //pointparticles(EFFECT_VORTEX_MUZZLEFLASH, shotorg, normalize(endpos - shotorg) * 1000, 1);
@@ -112,9 +112,9 @@ void W_Vortex_Attack(Weapon thiswep, entity actor, .entity weaponentity, float i
        myforcehalflife = WEP_CVAR_BOTH(vortex, !issecondary, damagefalloff_forcehalflife);
        myammo = WEP_CVAR_BOTH(vortex, !issecondary, ammo);
 
-    float dtype = thiswep.m_id;
-    if(WEP_CVAR_BOTH(vortex, !issecondary, armorpierce))
-        dtype |= HITTYPE_ARMORPIERCE;
+       float dtype = thiswep.m_id;
+       if(WEP_CVAR_BOTH(vortex, !issecondary, armorpierce))
+               dtype |= HITTYPE_ARMORPIERCE;
 
        float flying;
        flying = IsFlying(actor); // do this BEFORE to make the trace values from FireRailgunBullet last
@@ -152,7 +152,7 @@ void W_Vortex_Attack(Weapon thiswep, entity actor, .entity weaponentity, float i
        actor.vortex_lasthit = damage_goodhits;
 
        //beam done on client
-    vector v = WarpZone_UnTransformOrigin(WarpZone_trace_transform, trace_endpos);
+       vector v = WarpZone_UnTransformOrigin(WarpZone_trace_transform, trace_endpos);
        W_MuzzleFlash(thiswep, actor, weaponentity, w_shotorg, normalize(v - w_shotorg));
        SendCSQCVortexBeamParticle(charge);