From 7b76bd5ea33c012c03660cdd46659cd703ec89c6 Mon Sep 17 00:00:00 2001 From: div0 Date: Tue, 23 Jun 2009 19:12:20 +0000 Subject: [PATCH] directhit fix; currentammo; scoring sliders fix git-svn-id: svn://svn.icculus.org/nexuiz/trunk@7082 f962a42d-fe04-0410-a3ab-8c8b0445ebaa --- data/defaultNexuiz.cfg | 1 + data/qcsrc/client/Defs.qc | 1 + data/qcsrc/client/View.qc | 1 + data/qcsrc/client/sbar.qc | 76 +++++++++++++------ .../menu/nexuiz/dialog_multiplayer_create.c | 4 +- data/qcsrc/server/w_electro.qc | 5 +- data/qcsrc/server/w_grenadelauncher.qc | 5 +- 7 files changed, 65 insertions(+), 28 deletions(-) diff --git a/data/defaultNexuiz.cfg b/data/defaultNexuiz.cfg index eac856d17..9c83e816f 100644 --- a/data/defaultNexuiz.cfg +++ b/data/defaultNexuiz.cfg @@ -212,6 +212,7 @@ vid_conwidth 800 vid_conheight 600 set sbar_hudselector 1 "0 = old style hud layout, 1 = new nexuiz hud layout, 2 = combined health and armor display" set sbar_hud_accuracy 0 "1 = weapon accuracy on HUD" +set sbar_showcurrentammo 0 "set to 1 to see only the ammo of the current ammo or 0 to see all 4 ammo counts" v_deathtilt 0 // needed for spectators (who are dead to avoid prediction) sbar_info_pos 50 diff --git a/data/qcsrc/client/Defs.qc b/data/qcsrc/client/Defs.qc index f48357bb8..eb2df76ed 100644 --- a/data/qcsrc/client/Defs.qc +++ b/data/qcsrc/client/Defs.qc @@ -151,6 +151,7 @@ void end_sys_fields; // flag for structure dumping float intermission; float sb_showscores; float sb_showaccuracy; +float sbar_currentammo; .string message; .float renderflags; // float coop; diff --git a/data/qcsrc/client/View.qc b/data/qcsrc/client/View.qc index e6925fd36..778c6ca49 100644 --- a/data/qcsrc/client/View.qc +++ b/data/qcsrc/client/View.qc @@ -361,6 +361,7 @@ void CSQC_UpdateView(float w, float h) } sbar_alpha_fg = cvar("sbar_alpha_fg" ); + sbar_currentammo = cvar("sbar_showcurrentammo"); sbar_hudselector = cvar("sbar_hudselector"); sbar_hud_accuracy = cvar("sbar_hud_accuracy"); ColorTranslateMode = cvar("cl_stripcolorcodes"); diff --git a/data/qcsrc/client/sbar.qc b/data/qcsrc/client/sbar.qc index 78b9dbc03..c70fe5cc0 100644 --- a/data/qcsrc/client/sbar.qc +++ b/data/qcsrc/client/sbar.qc @@ -2345,31 +2345,63 @@ void Sbar_Draw (void) for (i = 0; i < 4; ++i) { a = getstati(GetAmmoStat(i)); // how much ammo do we have of type i? - - if (a > 0) { + + if(sbar_currentammo) + { pos = '0 0 0'; - if (cvar("vid_conwidth") >= 800) - switch (i) { - case 0: pos_x = 114; pos_y = -48; break; // shells - case 1: pos_x = 114; pos_y = -26; break; // bullets - case 2: pos_x = 200; pos_y = -48; break; // rockets - case 3: pos_x = 200; pos_y = -26; break; // cells + if (stat_items & GetAmmoItemCode(i)) + { + if(cvar("vid_conwidth") >= 800) + { + pos_x = 170; + pos_y = -40; + drawpic(bottomleft + pos + '0 1.5 0', "gfx/hud/sb_ammobg", '107 29 0', '1 1 1', sbar_alpha_fg, 0); + drawpic(bottomleft + pos + '76 3 0', GetAmmoPicture(i), '24 24 0', '1 1 1', sbar_alpha_fg, 0); + if(a > 10) + Sbar_DrawXNum(bottomleft + pos + '5 4 0', a, 3, 24, '0.6 0.7 0.8', 0, 1, 0); + else + Sbar_DrawXNum(bottomleft + pos + '5 4 0', a, 3, 24, '0.7 0 0', 0, 1, 0); } - else // if vid_conwidth is lower than 800, ammo will overlap with weapon icons and health so we'll move it to the right - switch (i) { - case 0: pos_x = vid_conwidth - 158; pos_y = -150; break; // shells - case 1: pos_x = vid_conwidth - 158; pos_y = -128; break; // bullets - case 2: pos_x = vid_conwidth - 84; pos_y = -150; break; // rockets - case 3: pos_x = vid_conwidth - 84; pos_y = -128; break; // cells + else + { + pos_x = vid_conwidth - 110; + pos_y = -128; + drawpic(bottomleft + pos + '0 1.5 0', "gfx/hud/sb_ammobg", '107 29 0', '1 1 1', sbar_alpha_fg, 0); + drawpic(bottomleft + pos + '76 3 0', GetAmmoPicture(i), '24 24 0', '1 1 1', sbar_alpha_fg, 0); + if(a > 10) + Sbar_DrawXNum(bottomleft + pos + '5 4 0', a, 3, 24, '0.6 0.7 0.8', 0, 1, 0); + else + Sbar_DrawXNum(bottomleft + pos + '5 4 0', a, 3, 24, '0.7 0 0', 0, 1, 0); } - - if (stat_items & GetAmmoItemCode(i)) - drawpic(bottomleft + pos + '0 1.5 0', "gfx/hud/sb_ammobg", '80 22 0', '1 1 1', sbar_alpha_fg, 0); - drawpic(bottomleft + pos + '56 3 0', GetAmmoPicture(i), '18 18 0', '1 1 1', sbar_alpha_fg, 0); - if (a > 10) - Sbar_DrawXNum(bottomleft + pos + '6 4 0', a, 3, 16, '0.6 0.7 0.8', 0, 1, 0); - else - Sbar_DrawXNum(bottomleft + pos + '6 4 0', a, 3, 16, '0.7 0 0', 0, 1, 0); + } + } + else + { + if (a > 0) { + pos = '0 0 0'; + if (cvar("vid_conwidth") >= 800) + switch (i) { + case 0: pos_x = 114; pos_y = -48; break; // shells + case 1: pos_x = 114; pos_y = -26; break; // bullets + case 2: pos_x = 200; pos_y = -48; break; // rockets + case 3: pos_x = 200; pos_y = -26; break; // cells + } + else // if vid_conwidth is lower than 800, ammo will overlap with weapon icons and health so we'll move it to the right + switch (i) { + case 0: pos_x = vid_conwidth - 158; pos_y = -150; break; // shells + case 1: pos_x = vid_conwidth - 158; pos_y = -128; break; // bullets + case 2: pos_x = vid_conwidth - 84; pos_y = -150; break; // rockets + case 3: pos_x = vid_conwidth - 84; pos_y = -128; break; // cells + } + + if (stat_items & GetAmmoItemCode(i)) + drawpic(bottomleft + pos + '0 1.5 0', "gfx/hud/sb_ammobg", '80 22 0', '1 1 1', sbar_alpha_fg, 0); + drawpic(bottomleft + pos + '56 3 0', GetAmmoPicture(i), '18 18 0', '1 1 1', sbar_alpha_fg, 0); + if (a > 10) + Sbar_DrawXNum(bottomleft + pos + '6 4 0', a, 3, 16, '0.6 0.7 0.8', 0, 1, 0); + else + Sbar_DrawXNum(bottomleft + pos + '6 4 0', a, 3, 16, '0.7 0 0', 0, 1, 0); + } } } diff --git a/data/qcsrc/menu/nexuiz/dialog_multiplayer_create.c b/data/qcsrc/menu/nexuiz/dialog_multiplayer_create.c index 98dfa45ba..fee566861 100644 --- a/data/qcsrc/menu/nexuiz/dialog_multiplayer_create.c +++ b/data/qcsrc/menu/nexuiz/dialog_multiplayer_create.c @@ -200,13 +200,13 @@ void gameTypeChangeNotifyNexuizServerCreateTab(entity me) l2 = me.checkboxFraglimitMapinfo; switch(gt) { - case MAPINFO_TYPE_CTF: GameType_ConfigureSliders(e, l, l2, "Capture limit:", 2, 20, 10, "capturelimit_override"); break; + case MAPINFO_TYPE_CTF: GameType_ConfigureSliders(e, l, l2, "Capture limit:", 1, 20, 1, "capturelimit_override"); break; case MAPINFO_TYPE_DOMINATION: GameType_ConfigureSliders(e, l, l2, "Point limit:", 50, 500, 10, "g_domination_point_limit"); break; case MAPINFO_TYPE_KEYHUNT: GameType_ConfigureSliders(e, l, l2, "Point limit:", 200, 1500, 50, "g_keyhunt_point_limit"); break; case MAPINFO_TYPE_RUNEMATCH: GameType_ConfigureSliders(e, l, l2, "Point limit:", 50, 500, 10, "g_runematch_point_limit"); break; case MAPINFO_TYPE_LMS: GameType_ConfigureSliders(e, l, l2, "Lives:", 3, 50, 1, "g_lms_lives_override"); break; case MAPINFO_TYPE_RACE: GameType_ConfigureSliders(e, l, l2, "Laps:", 1, 25, 1, "g_race_laps_limit"); break; - case MAPINFO_TYPE_NEXBALL: GameType_ConfigureSliders(e, l, l2, "Goals:", 3, 50, 1, "g_nexball_goallimit"); break; + case MAPINFO_TYPE_NEXBALL: GameType_ConfigureSliders(e, l, l2, "Goals:", 1, 50, 1, "g_nexball_goallimit"); break; case MAPINFO_TYPE_ASSAULT: GameType_ConfigureSliders(e, l, l2, "Point limit:", 50, 500, 10, ""); break; case MAPINFO_TYPE_ONSLAUGHT: GameType_ConfigureSliders(e, l, l2, "Point limit:", 50, 500, 10, ""); break; default: GameType_ConfigureSliders(e, l, l2, "Frag limit:", 5, 100, 5, "fraglimit_override"); break; diff --git a/data/qcsrc/server/w_electro.qc b/data/qcsrc/server/w_electro.qc index 6a3008b4b..c6a4cf00f 100644 --- a/data/qcsrc/server/w_electro.qc +++ b/data/qcsrc/server/w_electro.qc @@ -4,8 +4,9 @@ void W_Plasma_Explode (void) if(other.takedamage == DAMAGE_AIM) if(other.classname == "player") if(IsDifferentTeam(self.owner, other)) - if(IsFlying(other)) - announce(self.owner, "announcer/male/electrobitch.wav"); + if(other.deadflag == DEAD_NO) + if(IsFlying(other)) + announce(self.owner, "announcer/male/electrobitch.wav"); self.event_damage = SUB_Null; if (self.movetype == MOVETYPE_BOUNCE) diff --git a/data/qcsrc/server/w_grenadelauncher.qc b/data/qcsrc/server/w_grenadelauncher.qc index c2d434c07..6e8a8a9a1 100644 --- a/data/qcsrc/server/w_grenadelauncher.qc +++ b/data/qcsrc/server/w_grenadelauncher.qc @@ -3,8 +3,9 @@ void W_Grenade_Explode (void) if(other.takedamage == DAMAGE_AIM) if(other.classname == "player") if(IsDifferentTeam(self.owner, other)) - if(IsFlying(other)) - announce(self.owner, "announcer/male/airshot.wav"); + if(other.deadflag == DEAD_NO) + if(IsFlying(other)) + announce(self.owner, "announcer/male/airshot.wav"); self.event_damage = SUB_Null; RadiusDamage (self, self.owner, cvar("g_balance_grenadelauncher_primary_damage"), cvar("g_balance_grenadelauncher_primary_edgedamage"), cvar("g_balance_grenadelauncher_primary_radius"), world, cvar("g_balance_grenadelauncher_primary_force"), self.projectiledeathtype, other); -- 2.39.2