From: Rudolf Polzer Date: Tue, 23 Aug 2011 06:19:50 +0000 (+0200) Subject: Hagar: fix the case of losing the weapon due to NIX X-Git-Tag: xonotic-v0.5.0~74^2~4 X-Git-Url: https://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=commitdiff_plain;h=8837cf21fe2801afa976e86021e2d03777b07606 Hagar: fix the case of losing the weapon due to NIX --- diff --git a/qcsrc/common/constants.qh b/qcsrc/common/constants.qh index 82b306506f..9180b66832 100644 --- a/qcsrc/common/constants.qh +++ b/qcsrc/common/constants.qh @@ -669,6 +669,7 @@ float WR_RESETPLAYER = 10; // (SVQC) does not need to do anything float WR_IMPACTEFFECT = 11; // (CSQC) impact effect float WR_SWITCHABLE = 12; // (CSQC) impact effect float WR_PLAYERDEATH = 13; // (SVQC) does not need to do anything +float WR_GONETHINK = 14; // (SVQC) logic to run every frame, also if no longer having the weapon as long as the switch away has not been performed float HUD_PANEL_WEAPONS = 0; float HUD_PANEL_AMMO = 1; diff --git a/qcsrc/server/cl_weapons.qc b/qcsrc/server/cl_weapons.qc index c46a736a06..658fe54d32 100644 --- a/qcsrc/server/cl_weapons.qc +++ b/qcsrc/server/cl_weapons.qc @@ -403,13 +403,16 @@ void W_WeaponFrame() W_SwitchWeapon_Force(self, w_getbestweapon(self)); wb = 0; } + + v_forward = fo; + v_right = ri; + v_up = up; + if(wb) - { - v_forward = fo; - v_right = ri; - v_up = up; weapon_action(self.weapon, WR_THINK); - } + else + weapon_action(self.weapon, WR_GONETHINK); + if (time + self.weapon_frametime * 0.5 >= self.weapon_nextthink) { if(self.weapon_think) diff --git a/qcsrc/server/w_hagar.qc b/qcsrc/server/w_hagar.qc index a27bdac8f0..0be80db124 100644 --- a/qcsrc/server/w_hagar.qc +++ b/qcsrc/server/w_hagar.qc @@ -201,6 +201,7 @@ void W_Hagar_Attack2_Load (void) if(self.hagar_load) { // if we pressed primary fire while loading, unload all rockets and abort + self.weaponentity.state = WS_READY; W_DecreaseAmmo(ammo_rockets, autocvar_g_balance_hagar_secondary_ammo * self.hagar_load * -1, autocvar_g_balance_hagar_reload_ammo); // give back ammo self.hagar_load = 0; sound(self, CH_WEAPON_A, "weapons/hagar_beep.wav", VOL_BASE, ATTN_NORM); @@ -220,6 +221,7 @@ void W_Hagar_Attack2_Load (void) if(!self.hagar_loadblock && self.hagar_loadstep < time) { W_DecreaseAmmo(ammo_rockets, autocvar_g_balance_hagar_secondary_ammo, autocvar_g_balance_hagar_reload_ammo); + self.weaponentity.state = WS_INUSE; self.hagar_load += 1; sound(self, CH_WEAPON_B, "weapons/hagar_load.wav", VOL_BASE, ATTN_NORM); @@ -242,13 +244,14 @@ void W_Hagar_Attack2_Load (void) if(self.hagar_load) { - self.weaponentity.state = WS_INUSE; // prevents weapon switching if(!self.BUTTON_ATCK2 || ((loaded || !enough_ammo) && self.hagar_loadstep < time && !autocvar_g_balance_hagar_secondary_load_hold)) + { + self.weaponentity.state = WS_READY; W_Hagar_Attack2_Load_Release(); + } } else { - self.weaponentity.state = WS_READY; // allows weapon switching self.hagar_loadbeep = FALSE; } @@ -303,6 +306,15 @@ float w_hagar(float req) } } } + else if (req == WR_GONETHINK) + { + // we lost the weapon and want to prepare switching away + if(self.hagar_load) + { + self.weaponentity.state = WS_READY; + W_Hagar_Attack2_Load_Release(); + } + } else if (req == WR_PRECACHE) { precache_model ("models/weapons/g_hagar.md3");