]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/weapons/all.qc
Merge branch 'bones_was_here/gunoffset' into 'master'
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / weapons / all.qc
index 6bf2d105f8d85c4c82299c9a216f3e20cd818062..70937716490921edcd0e01e07b889bf97ab565e0 100644 (file)
@@ -107,21 +107,6 @@ string W_NameWeaponOrder_MapFunc(string s)
        return s;
 }
 
-string W_UndeprecateName(string s)
-{
-       switch (s)
-       {
-               case "nex": return "vortex";
-               case "rocketlauncher": return "devastator";
-               case "laser": return "blaster";
-               case "minstanex": return "vaporizer";
-               case "grenadelauncher": return "mortar";
-               case "uzi": return "machinegun";
-               case "hmg": return "okhmg";
-               case "rpc": return "okrpc";
-               default: return s;
-       }
-}
 string W_NameWeaponOrder(string order)
 {
        return mapPriorityList(order, W_NameWeaponOrder_MapFunc);
@@ -129,8 +114,7 @@ string W_NameWeaponOrder(string order)
 string W_NumberWeaponOrder_MapFunc(string s)
 {
        if (s == "0" || stof(s)) return s;
-       s = W_UndeprecateName(s);
-       FOREACH(Weapons, it != WEP_Null && it.netname == s, return ftos(i));
+       FOREACH(Weapons, it != WEP_Null && (it.netname == s || it.m_deprecated_netname == s), return ftos(i));
        return s;
 }
 string W_NumberWeaponOrder(string order)
@@ -394,6 +378,7 @@ vector shotorg_adjust_values(vector vecs, bool y_is_right, bool visual, int algn
  *   this.origin, this.angles
  *   this.weaponchild
  *   this.movedir, this.view_ofs, this.movedir_aligned
+ *   this.spawnorigin (SVQC only)
  *   attachment stuff
  *   anim stuff
  * to free:
@@ -410,7 +395,9 @@ void CL_WeaponEntity_SetModel(entity this, string name, bool _anim)
                if (this.weaponchild) delete(this.weaponchild);
                this.weaponchild = NULL;
                this.movedir = '0 0 0';
+#ifdef SVQC
                this.spawnorigin = '0 0 0';
+#endif
                this.oldorigin = '0 0 0';
                this.anim_fire1  = '0 1 0.01';
                this.anim_fire2  = '0 1 0.01';
@@ -482,6 +469,7 @@ void CL_WeaponEntity_SetModel(entity this, string name, bool _anim)
                                this.movedir = '0 0 0';
                        }
                }
+#ifdef SVQC
                {
                        int idx = 0;
                        // v_ model attached to invisible h_ model
@@ -501,6 +489,7 @@ void CL_WeaponEntity_SetModel(entity this, string name, bool _anim)
                                this.spawnorigin = this.movedir;
                        }
                }
+#endif
                if (v_shot_idx)
                {
                        this.oldorigin = '0 0 0';  // use regular attachment
@@ -547,7 +536,7 @@ void CL_WeaponEntity_SetModel(entity this, string name, bool _anim)
                vector v = this.movedir;
                this.movedir = shotorg_adjust(v, false, false, algn);
                this.movedir_aligned = shotorg_adjust(v, false, true, algn);
-               this.view_ofs = shotorg_adjust(v, false, true, algn) - v;
+               this.view_ofs = this.movedir_aligned - v;
        }
        int compressed_shotorg = compressShotOrigin(this.movedir);
        // make them match perfectly
@@ -557,7 +546,9 @@ void CL_WeaponEntity_SetModel(entity this, string name, bool _anim)
 #endif
        this.movedir = decompressShotOrigin(compressed_shotorg);
 
+#ifdef SVQC
        this.spawnorigin += this.view_ofs;  // offset the casings origin by the same amount
+#endif
 
        // check if an instant weapon switch occurred
        setorigin(this, this.view_ofs);