]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/weapons/all.qc
Merge branch 'master' into bones_was_here/q3compat
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / weapons / all.qc
index 631aaf11b51c2a910229cac79426cb986c98f6c1..606090db315cedf59e314fd29f411ddb1ea8b087 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)
 {
@@ -508,7 +505,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);
                        }
@@ -574,12 +571,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
 
@@ -600,7 +595,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)
@@ -629,9 +624,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;
 }
@@ -809,11 +804,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);
 
@@ -824,7 +819,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