From: Mario Date: Sun, 20 Nov 2016 18:07:33 +0000 (+1000) Subject: Move tuba's view model handling into the tuba file X-Git-Tag: xonotic-v0.8.2~424 X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=commitdiff_plain;h=6386150f532a0e6d86c074d81191465ee8586b00 Move tuba's view model handling into the tuba file --- diff --git a/qcsrc/client/view.qc b/qcsrc/client/view.qc index a3bc0462e3..c85d075a66 100644 --- a/qcsrc/client/view.qc +++ b/qcsrc/client/view.qc @@ -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) { diff --git a/qcsrc/common/weapons/weapon.qh b/qcsrc/common/weapons/weapon.qh index d16d733d59..b287b148f3 100644 --- a/qcsrc/common/weapons/weapon.qh +++ b/qcsrc/common/weapons/weapon.qh @@ -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 */ diff --git a/qcsrc/common/weapons/weapon/tuba.qc b/qcsrc/common/weapons/weapon/tuba.qc index 1f01ef0413..e3e1f5228d 100644 --- a/qcsrc/common/weapons/weapon/tuba.qc +++ b/qcsrc/common/weapons/weapon/tuba.qc @@ -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