From bf787a0b6ccccebea79971840380a07f6a0f56bf Mon Sep 17 00:00:00 2001 From: div0 Date: Wed, 3 Sep 2008 19:29:22 +0000 Subject: [PATCH] fix sbar_hudselector 0 HUD git-svn-id: svn://svn.icculus.org/nexuiz/trunk@4323 f962a42d-fe04-0410-a3ab-8c8b0445ebaa --- data/qcsrc/client/sbar.qc | 27 +++++++++++++++++++++------ data/qcsrc/server/cl_weapons.qc | 1 + data/qcsrc/server/w_minstanex.qc | 6 +++--- 3 files changed, 25 insertions(+), 9 deletions(-) diff --git a/data/qcsrc/client/sbar.qc b/data/qcsrc/client/sbar.qc index f2087e6b5..0c7b1a700 100644 --- a/data/qcsrc/client/sbar.qc +++ b/data/qcsrc/client/sbar.qc @@ -28,11 +28,23 @@ void Sbar_FinaleOverlay() } float weaponspace[10]; +float weapon_first, weapon_last; void Sbar_DrawWeapon_Clear() { float idx; + weapon_first = -2; + weapon_last = -1; for(idx = 0; idx < 10; ++idx) weaponspace[idx] = 0; + for(idx = 0; idx <= 23; ++idx) + { + if(weaponimpulse[idx] >= 0) + { + if(weapon_first < 0) + weapon_first = idx; + weapon_last = idx; + } + } } void Sbar_DrawWeapon(float nr, float fade, float active) { @@ -76,11 +88,14 @@ void Sbar_DrawWeapon(float nr, float fade, float active) const float w2_width = 300, w2_height = 100, w2_space = 10; const float w2_scale = 0.4; - pos_x = vid_conwidth - (w2_width + w2_space) * w2_scale; - pos_y = (w2_height + w2_space) * w2_scale * nr + w2_space; + float f; + f = 9 / (weapon_last + 1 - weapon_first); + + pos_x = vid_conwidth - (w2_width + w2_space) * w2_scale * f; + pos_y = (w2_height + w2_space) * w2_scale * nr * f + w2_space; pos_z = 0; - vsize_x = w2_width * w2_scale; - vsize_y = w2_height * w2_scale; + vsize_x = w2_width * w2_scale * f; + vsize_y = w2_height * w2_scale * f; vsize_z = 0; drawpic(pos, strcat("gfx/inv_weapon", ftos(nr)), vsize, color, value * fade * sbar_alpha_fg, 0); @@ -1505,7 +1520,7 @@ void Sbar_Draw (void) { stat_items = getstati(STAT_ITEMS); - stat_weapons = getstati(STAT_ITEMS); + stat_weapons = getstati(STAT_WEAPONS); sbar_x = (vid_conwidth - 640.0)*0.5; sbar_y = vid_conheight - 47; @@ -1515,7 +1530,7 @@ void Sbar_Draw (void) x = 1.0; Sbar_DrawWeapon_Clear(); - for(i = WEP_FIRST; i <= WEP_LAST; ++i) + for(i = 1; i <= 24; ++i) { if(weaponimpulse[i-1] >= 0) if(stat_weapons & x) diff --git a/data/qcsrc/server/cl_weapons.qc b/data/qcsrc/server/cl_weapons.qc index 37a455c85..684de4411 100644 --- a/data/qcsrc/server/cl_weapons.qc +++ b/data/qcsrc/server/cl_weapons.qc @@ -450,6 +450,7 @@ void Nixnex_GiveCurrentWeapon() void RegisterWeapons() { + register_dummy_weapon(); // %weaponaddpoint register_weapon(WEP_LASER, w_laser, 0, 1, 1, "laser", "laser", "Laser"); register_weapon(WEP_SHOTGUN, w_shotgun, IT_SHELLS, 2, 1, "shotgun", "shotgun", "Shotgun"); diff --git a/data/qcsrc/server/w_minstanex.qc b/data/qcsrc/server/w_minstanex.qc index af2cb86f7..72325a60a 100644 --- a/data/qcsrc/server/w_minstanex.qc +++ b/data/qcsrc/server/w_minstanex.qc @@ -139,9 +139,9 @@ float w_minstanex(float req) else if (req == WR_PRECACHE) { precache_model ("models/nexflash.md3"); - precache_model ("models/weapons/g_nex.md3"); - precache_model ("models/weapons/v_nex.md3"); - precache_model ("models/weapons/w_nex.zym"); + precache_model ("models/weapons/g_minstanex.md3"); + precache_model ("models/weapons/v_minstanex.md3"); + precache_model ("models/weapons/w_minstanex.zym"); precache_sound ("weapons/nexfire.wav"); precache_sound ("weapons/neximpact.wav"); w_laser(WR_PRECACHE); -- 2.39.2