]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/weapons/weapon/tuba.qc
Clean up ammo_field handling
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / weapons / weapon / tuba.qc
index 036181ca412e8d93bc855bface3facbdc7c191d6..26025a0ca334e1128736ad8536c3974992044695 100644 (file)
@@ -1,11 +1,12 @@
+#include "tuba.qh"
 #ifndef IMPLEMENTATION
 CLASS(Tuba, Weapon)
-/* impulse   */ ATTRIB(Tuba, impulse, int, 1)
+/* impulse   */ ATTRIB(Tuba, impulse, int, 1);
 /* flags     */ ATTRIB(Tuba, spawnflags, int, WEP_FLAG_HIDDEN | WEP_TYPE_SPLASH);
 /* rating    */ ATTRIB(Tuba, bot_pickupbasevalue, float, BOT_PICKUP_RATING_MID);
 /* color     */ ATTRIB(Tuba, wpcolor, vector, '0 1 0');
 /* modelname */ ATTRIB(Tuba, mdl, string, "tuba");
-#ifndef MENUQC
+#ifdef GAMEQC
 /* model     */ ATTRIB(Tuba, m_model, Model, MDL_TUBA_ITEM);
 #endif
 /* crosshair */ ATTRIB(Tuba, w_crosshair, string, "gfx/crosshairtuba");
@@ -397,7 +398,6 @@ METHOD(Tuba, wr_think, void(Tuba this, entity actor, .entity weaponentity, int f
 
 METHOD(Tuba, wr_setup, void(Tuba this, entity actor))
 {
-       actor.ammo_field = ammo_none;
        actor.tuba_instrument = 0;
 }
 #endif
@@ -411,7 +411,12 @@ NET_HANDLE(tuba_instrument, bool)
        string s = (i == 0) ? "tuba" :
                   (i == 1) ? "akordeon" :
                              "kleinbottle" ;
-       CL_WeaponEntity_SetModel(viewmodel, s, true);
+    for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
+    {
+       entity wep = viewmodels[slot];
+       if(wep.activeweapon == WEP_TUBA)
+               CL_WeaponEntity_SetModel(wep, s, true);
+    }
 }
 #endif
 #ifdef SVQC
@@ -436,15 +441,15 @@ METHOD(Tuba, wr_reload, void(Tuba this, entity actor, .entity weaponentity))
                {
                        case 0:
                                actor.tuba_instrument = 1;
-                               actor.weaponname = "akordeon";
+                               actor.(weaponentity).weaponname = "akordeon";
                                break;
                        case 1:
                                actor.tuba_instrument = 2;
-                               actor.weaponname = "kleinbottle";
+                               actor.(weaponentity).weaponname = "kleinbottle";
                                break;
                        case 2:
                                actor.tuba_instrument = 0;
-                               actor.weaponname = "tuba";
+                               actor.(weaponentity).weaponname = "tuba";
                                break;
                }
                tuba_instrument_send(actor, actor.tuba_instrument);
@@ -459,8 +464,8 @@ METHOD(Tuba, wr_reload, void(Tuba this, entity actor, .entity weaponentity))
 #ifdef SVQC
 
 // infinite ammo
-METHOD(Tuba, wr_checkammo1, bool(Tuba this, entity actor)) { return true; }
-METHOD(Tuba, wr_checkammo2, bool(Tuba this, entity actor)) { return true; }
+METHOD(Tuba, wr_checkammo1, bool(Tuba this, entity actor, .entity weaponentity)) { return true; }
+METHOD(Tuba, wr_checkammo2, bool(Tuba this, entity actor, .entity weaponentity)) { return true; }
 
 METHOD(Tuba, wr_suicidemessage, Notification(Tuba this))
 {