From: Rudolf Polzer Date: Sat, 19 Nov 2011 15:01:05 +0000 (+0100) Subject: some refactor X-Git-Tag: xonotic-v0.6.0~35^2~50 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=bd98b054f33d600a10426808dfb0d8b32384817a;p=xonotic%2Fxonotic-data.pk3dir.git some refactor --- diff --git a/qcsrc/server/w_tuba.qc b/qcsrc/server/w_tuba.qc index 2e4aa4957..c53f56978 100644 --- a/qcsrc/server/w_tuba.qc +++ b/qcsrc/server/w_tuba.qc @@ -111,8 +111,7 @@ void W_Tuba_NoteThink() entity e; if(time > self.teleport_time) { - self.realowner.tuba_note = world; - remove(self); + W_Tuba_NoteOff(); return; } self.nextthink = time; @@ -141,7 +140,13 @@ void W_Tuba_NoteThink() } } -void W_Tuba_Attack(float hittype) +void W_Tuba_NoteOff() +{ + remove(self.tuba_note); + self.tuba_note = world; +} + +void W_Tuba_NoteOn(float hittype) { vector o; float n; @@ -161,10 +166,7 @@ void W_Tuba_Attack(float hittype) if(self.tuba_note) { if(self.tuba_note.cnt != n || self.tuba_note.tuba_instrument != self.tuba_instrument) - { - remove(self.tuba_note); - self.tuba_note = world; - } + W_Tuba_NoteOff(); } if not(self.tuba_note) @@ -215,24 +217,21 @@ float w_tuba(float req) if (self.BUTTON_ATCK) if (weapon_prepareattack(0, autocvar_g_balance_tuba_refire)) { - W_Tuba_Attack(0); + W_Tuba_NoteOn(0); //weapon_thinkf(WFRAME_FIRE1, autocvar_g_balance_tuba_animtime, w_ready); weapon_thinkf(WFRAME_IDLE, autocvar_g_balance_tuba_animtime, w_ready); } if (self.BUTTON_ATCK2) if (weapon_prepareattack(1, autocvar_g_balance_tuba_refire)) { - W_Tuba_Attack(HITTYPE_SECONDARY); + W_Tuba_NoteOn(HITTYPE_SECONDARY); //weapon_thinkf(WFRAME_FIRE2, autocvar_g_balance_tuba_animtime, w_ready); weapon_thinkf(WFRAME_IDLE, autocvar_g_balance_tuba_animtime, w_ready); } if(self.tuba_note) { if(!self.BUTTON_ATCK && !self.BUTTON_ATCK2) - { - remove(self.tuba_note); - self.tuba_note = world; - } + W_Tuba_NoteOff(); } } else if (req == WR_PRECACHE)