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 a3bc046..c85d075 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 d16d733..b287b14 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 1f01ef0..e3e1f52 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