]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Hack to fix tuba alternative instruments
authorMario <mario@smbclan.net>
Wed, 2 Nov 2016 13:57:43 +0000 (23:57 +1000)
committerMario <mario@smbclan.net>
Wed, 2 Nov 2016 13:57:43 +0000 (23:57 +1000)
qcsrc/client/view.qc
qcsrc/common/weapons/weapon/tuba.qc
qcsrc/common/weapons/weapon/tuba.qh

index d309f4d9a757a44feaa13089473b52d2f1986d45..12f4c6a1d0e68e5b72ebb0a475d31c5dee265045 100644 (file)
@@ -22,6 +22,8 @@
 #include <common/triggers/target/music.qh>
 #include <common/teams.qh>
 
+#include <common/weapons/weapon/tuba.qh>
+
 #include <common/vehicles/all.qh>
 #include <common/weapons/_all.qh>
 #include <common/viewloc.qh>
@@ -312,6 +314,12 @@ 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";
+               }
                bool swap = name != name_last;
                // if (swap)
                {
index 7f1bce0ace2741c05340c025a1f49524ce4969e1..1f01ef0413c237e262752c59bd5daee816131968 100644 (file)
@@ -396,10 +396,12 @@ METHOD(Tuba, wr_think, void(Tuba this, entity actor, .entity weaponentity, int f
        }
 }
 
+void tuba_instrument_send(entity this, int instr);
 METHOD(Tuba, wr_setup, void(Tuba this, entity actor))
 {
        actor.ammo_field = ammo_none;
        actor.tuba_instrument = 0;
+       tuba_instrument_send(actor, actor.tuba_instrument);
 }
 #endif
 
@@ -412,6 +414,7 @@ NET_HANDLE(tuba_instrument, bool)
        string s = (i == 0) ? "tuba" :
                   (i == 1) ? "akordeon" :
                              "kleinbottle" ;
+    viewmodel.tuba_instrument = i;
        CL_WeaponEntity_SetModel(viewmodel, s, true);
 }
 #endif
@@ -494,13 +497,6 @@ const int TUBA_MIN = -18;
 const int TUBA_MAX = 27;
 const int TUBA_INSTRUMENTS = 3;
 
-entityclass(Tuba);
-class(Tuba) .int note;
-class(Tuba) .bool tuba_attenuate;
-class(Tuba) .float tuba_volume;
-class(Tuba) .float tuba_volume_initial;
-class(Tuba) .int tuba_instrument;
-
 int Tuba_PitchStep;
 
 void tubasound(entity e, bool restart)
index 6f70f09beec2219624baeca92e2cd7deaa104fb4..ce6b6ede739c76fd2dd2eed274912ffce10228a2 100644 (file)
@@ -1 +1,10 @@
 #pragma once
+
+#ifdef CSQC
+entityclass(Tuba);
+class(Tuba) .int note;
+class(Tuba) .bool tuba_attenuate;
+class(Tuba) .float tuba_volume;
+class(Tuba) .float tuba_volume_initial;
+class(Tuba) .int tuba_instrument;
+#endif