From: Mario Date: Wed, 2 Nov 2016 13:57:43 +0000 (+1000) Subject: Hack to fix tuba alternative instruments X-Git-Tag: xonotic-v0.8.2~466 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=42847fddd58877c481212d07cd914d3741434ecd;p=xonotic%2Fxonotic-data.pk3dir.git Hack to fix tuba alternative instruments --- diff --git a/qcsrc/client/view.qc b/qcsrc/client/view.qc index d309f4d9a..12f4c6a1d 100644 --- a/qcsrc/client/view.qc +++ b/qcsrc/client/view.qc @@ -22,6 +22,8 @@ #include #include +#include + #include #include #include @@ -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) { diff --git a/qcsrc/common/weapons/weapon/tuba.qc b/qcsrc/common/weapons/weapon/tuba.qc index 7f1bce0ac..1f01ef041 100644 --- a/qcsrc/common/weapons/weapon/tuba.qc +++ b/qcsrc/common/weapons/weapon/tuba.qc @@ -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) diff --git a/qcsrc/common/weapons/weapon/tuba.qh b/qcsrc/common/weapons/weapon/tuba.qh index 6f70f09be..ce6b6ede7 100644 --- a/qcsrc/common/weapons/weapon/tuba.qh +++ b/qcsrc/common/weapons/weapon/tuba.qh @@ -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