]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Move tuba's view model handling into the tuba file
authorMario <mario@smbclan.net>
Sun, 20 Nov 2016 18:07:33 +0000 (04:07 +1000)
committerMario <mario@smbclan.net>
Sun, 20 Nov 2016 18:07:33 +0000 (04:07 +1000)
qcsrc/client/view.qc
qcsrc/common/weapons/weapon.qh
qcsrc/common/weapons/weapon/tuba.qc

index a3bc0462e3ccc24970fce9a148a390db6dc8466f..c85d075a668f34bb33009d55d16ffb0cff18d7a0 100644 (file)
@@ -314,12 +314,9 @@ void viewmodel_draw(entity this)
        {
                static string name_last;
                string name = wep.mdl;
-               if(wep == WEP_TUBA)
-               {
-                       name = (this.tuba_instrument == 0) ? "tuba" :
-                          (this.tuba_instrument == 1) ? "akordeon" :
-                                                    "kleinbottle";
-               }
+               string newname = wep.wr_viewmodel(wep, this);
+               if(newname)
+                       name = newname;
                bool swap = name != name_last;
                // if (swap)
                {
index d16d733d5989a13ea7284ae0385da9f1c1d4d9f4..b287b148f3175727cebf8fa1e44a288099ae8e2b 100644 (file)
@@ -117,6 +117,8 @@ CLASS(Weapon, Object)
         // no weapon specific image for this weapon
         return false;
     }
+    /** (CLIENT) weapon specific view model */
+    METHOD(Weapon, wr_viewmodel, string(Weapon this, entity wep)) { return string_null; }
     /** (CLIENT) weapon specific glow */
     METHOD(Weapon, wr_glow, vector(Weapon this, entity actor)) { return '0 0 0'; }
     /** (SERVER) the weapon is dropped */
index 1f01ef0413c237e262752c59bd5daee816131968..e3e1f5228dc0d0839efeb1a4f9015f8d04f38ce1 100644 (file)
@@ -487,6 +487,15 @@ METHOD(Tuba, wr_killmessage, Notification(Tuba this))
                return WEAPON_TUBA_MURDER;
 }
 
+#elif defined(CSQC)
+
+METHOD(Tuba, wr_viewmodel, string(Tuba this, entity wep))
+{
+       return (wep.tuba_instrument == 0) ? "tuba" :
+              (wep.tuba_instrument == 1) ? "akordeon" :
+                                           "kleinbottle";
+}
+
 #endif
 
 #ifdef CSQC