From 815bed323dd27ab656e0b42b1310648c6e1d5e4a Mon Sep 17 00:00:00 2001 From: terencehill Date: Mon, 18 Feb 2013 12:32:18 +0100 Subject: [PATCH] Fix weapons panel in onlyowned mode showing an empty weapon if player joins the game within 5 seconds after server connection. Code to detect complain weapon is now less dispersive --- qcsrc/client/hud.qc | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/qcsrc/client/hud.qc b/qcsrc/client/hud.qc index 4ae44ba21..49beadb1e 100644 --- a/qcsrc/client/hud.qc +++ b/qcsrc/client/hud.qc @@ -454,8 +454,8 @@ void HUD_Weapons(void) vector ammo_color = '1 0 1'; float ammo_alpha = 1; - float when = autocvar_hud_panel_weapons_complainbubble_time; - float fadetime = autocvar_hud_panel_weapons_complainbubble_fadetime; + float when = max(1, autocvar_hud_panel_weapons_complainbubble_time); + float fadetime = max(0, autocvar_hud_panel_weapons_complainbubble_fadetime); vector weapon_pos, weapon_size = '0 0 0'; local noref vector old_panel_size; // fteqcc sucks @@ -514,6 +514,10 @@ void HUD_Weapons(void) weaponorder_cmp_str = string_null; } + if(autocvar_hud_panel_weapons_complainbubble) + if(autocvar__hud_configure || time - complain_weapon_time >= when + fadetime) + complain_weapon = 0; + // determine which weapons are going to be shown if (autocvar_hud_panel_weapons_onlyowned) { @@ -534,10 +538,8 @@ void HUD_Weapons(void) ++weapon_count; // add it anyway if weaponcomplain is shown - if((!autocvar__hud_configure) - && (autocvar_hud_panel_weapons_complainbubble - && time - complain_weapon_time < when + fadetime)) - ++weapon_count; + if(complain_weapon) + ++weapon_count; // might as well commit suicide now, no reason to live ;) if (weapon_count == 0) { return; } @@ -716,12 +718,9 @@ void HUD_Weapons(void) if (!self || self.impulse < 0) { continue; } // skip this weapon if we don't own it (and onlyowned is enabled)-- or if weapons_complainbubble is showing for this weapon - if (autocvar_hud_panel_weapons_onlyowned - && !(WEPSET_CONTAINS_AW(weapons_stat, self.weapon) - || (self.weapon == complain_weapon - && time - complain_weapon_time < when + fadetime - && autocvar_hud_panel_weapons_complainbubble))) - continue; + if(autocvar_hud_panel_weapons_onlyowned) + if not(WEPSET_CONTAINS_AW(weapons_stat, self.weapon) || (self.weapon == complain_weapon)) + continue; // figure out the drawing position of weapon weapon_pos = (panel_pos @@ -803,14 +802,13 @@ void HUD_Weapons(void) } // draw the complain message - if(time - complain_weapon_time < when + fadetime && self.weapon == complain_weapon && autocvar_hud_panel_weapons_complainbubble) + if(self.weapon == complain_weapon) { if(fadetime) a = ((complain_weapon_time + when > time) ? 1 : bound(0, (complain_weapon_time + when + fadetime - time) / fadetime, 1)); else a = ((complain_weapon_time + when > time) ? 1 : 0); - string s; if(complain_weapon_type == 0) { s = _("Out of ammo"); -- 2.39.2