From b0ed14220ec0a63a70a41bdc65420065ef65d006 Mon Sep 17 00:00:00 2001 From: MirceaKitsune Date: Thu, 9 Sep 2010 00:09:31 +0300 Subject: [PATCH] Many fixes and adaptations to the Accuracy Stats window, and get the Grabber to properly work with it. Also comment out the splash damage code (but keep it there, since who knows what we could have in the future) --- data/qcsrc/client/sbar.qc | 16 +++++++++------- data/qcsrc/common/items.qh | 2 +- data/qcsrc/server/g_grabber.qc | 3 +++ data/qcsrc/server/w_grabber.qc | 22 +++++++++++++++++++++- 4 files changed, 34 insertions(+), 9 deletions(-) diff --git a/data/qcsrc/client/sbar.qc b/data/qcsrc/client/sbar.qc index 9b3db2e2..0c95d160 100644 --- a/data/qcsrc/client/sbar.qc +++ b/data/qcsrc/client/sbar.qc @@ -2397,17 +2397,17 @@ void Sbar_DrawAccuracyStats_Description_Hitscan(vector position) drawstring(position + '0 9 0' * sbar_fontsize_y, "Shots missed:", sbar_fontsize, '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL); } -void Sbar_DrawAccuracyStats_Description_Splash(vector position) +/*void Sbar_DrawAccuracyStats_Description_Splash(vector position) { drawstring(position + '0 3 0' * sbar_fontsize_y, "Maximum damage:", sbar_fontsize, '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL); drawstring(position + '0 5 0' * sbar_fontsize_y, "Actual damage:", sbar_fontsize, '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL); drawstring(position + '0 7 0' * sbar_fontsize_y, "Accuracy:", sbar_fontsize, '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL); drawstring(position + '0 9 0' * sbar_fontsize_y, "Damage wasted:", sbar_fontsize, '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL); -} +}*/ // we have no splash damage weapons, but keep this code just in case void Sbar_DrawAccuracyStats() { - float i, count_hitscan, count_splash, row_hitscan, row_splash; // count is the number of 'colums' + float i, count_hitscan, /*count_splash,*/ row_hitscan/*, row_splash*/; // count is the number of 'colums' float weapon_hit, weapon_damage, weapon_stats; float left_border; // position where the weapons start, the description is in the border vector fill_colour, fill_size; @@ -2451,8 +2451,8 @@ void Sbar_DrawAccuracyStats() float top_border_hitscan = cvar("sbar_scoreboard_offset") + 55; // position where the hitscan row starts: pixels down the screen Sbar_DrawAccuracyStats_Description_Hitscan('1 0 0' * col_margin + '0 1 0' * top_border_hitscan); - float top_border_splash = cvar("sbar_scoreboard_offset") + 175; // position where the splash row starts: pixels down the screen - Sbar_DrawAccuracyStats_Description_Splash('1 0 0' * col_margin + '0 1 0' * top_border_splash); +// float top_border_splash = cvar("sbar_scoreboard_offset") + 175; // position where the splash row starts: pixels down the screen +// Sbar_DrawAccuracyStats_Description_Splash('1 0 0' * col_margin + '0 1 0' * top_border_splash); for(i = WEP_FIRST; i <= WEP_LAST; ++i) { @@ -2464,7 +2464,7 @@ void Sbar_DrawAccuracyStats() border_colour = (i == activeweapon) ? '1 1 1' : '0 0 0'; // white or black border if (weapon_damage) { - if (self.spawnflags & WEP_TYPE_SPLASH) { + /*if (self.spawnflags & WEP_TYPE_SPLASH) { weapon_stats = bound(0, floor(100 * weapon_hit / weapon_damage), 100); fill_colour_x = 1 - 0.015 * weapon_stats; @@ -2514,7 +2514,9 @@ void Sbar_DrawAccuracyStats() drawstringright(pos + '4.5 0 0' * sbar_fontsize_x + '0 9 0' * sbar_fontsize_y, ftos(max(0, weapon_damage - weapon_hit)), sbar_fontsize, '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL); ++count_splash; - } else if (self.spawnflags & WEP_TYPE_HITSCAN) { + } else*/ // we have no splash damage weapons, but keep this code just in case + + if (self.spawnflags & WEP_TYPE_HITSCAN) { weapon_stats = bound(0, floor(100 * weapon_hit / weapon_damage), 100); fill_colour_x = 1 - 0.015 * weapon_stats; diff --git a/data/qcsrc/common/items.qh b/data/qcsrc/common/items.qh index 194cb1ba..26505458 100644 --- a/data/qcsrc/common/items.qh +++ b/data/qcsrc/common/items.qh @@ -2,7 +2,7 @@ float BOT_PICKUP_RATING_LOW = 2500; float BOT_PICKUP_RATING_MID = 5000; float BOT_PICKUP_RATING_HIGH = 10000; -float WEP_TYPE_OTHER = 0x00; // e.g: Grabber, Port-o-launch, etc +float WEP_TYPE_OTHER = 0x00; // e.g: Grabber, etc float WEP_TYPE_SPLASH = 0x01; float WEP_TYPE_HITSCAN = 0x02; float WEP_TYPEMASK = 0x0F; diff --git a/data/qcsrc/server/g_grabber.qc b/data/qcsrc/server/g_grabber.qc index 28b687e5..1c3361e1 100644 --- a/data/qcsrc/server/g_grabber.qc +++ b/data/qcsrc/server/g_grabber.qc @@ -266,6 +266,7 @@ void GrabberTouch (void) if(other.movetype != MOVETYPE_NONE) { SetMovetypeFollow(self, other); + W_Grabber_UpdateStats(self.owner, FALSE, TRUE); // count this as a hit WarpZone_RefSys_BeginAddingIncrementally(self, self.aiment); } @@ -294,6 +295,8 @@ void FireGrabber (void) local entity missile; local vector org; + W_Grabber_UpdateStats(self, TRUE, FALSE); + if((arena_roundbased && time < warmup) || (time < game_starttime)) return; diff --git a/data/qcsrc/server/w_grabber.qc b/data/qcsrc/server/w_grabber.qc index 30937850..0f5a818e 100644 --- a/data/qcsrc/server/w_grabber.qc +++ b/data/qcsrc/server/w_grabber.qc @@ -1,5 +1,5 @@ #ifdef REGISTER_WEAPON -REGISTER_WEAPON(GRABBER, w_grabber, IT_FUEL, 0, WEP_FLAG_CANCLIMB | WEP_TYPE_SPLASH, 0, "grabber", "grabber", "Grabber"); +REGISTER_WEAPON(GRABBER, w_grabber, IT_FUEL, 0, WEP_FLAG_CANCLIMB | WEP_TYPE_HITSCAN, 0, "grabber", "grabber", "Grabber"); #else .float dmg; .float dmg_edge; @@ -9,6 +9,22 @@ REGISTER_WEAPON(GRABBER, w_grabber, IT_FUEL, 0, WEP_FLAG_CANCLIMB | WEP_TYPE_SPL .float grabber_time_grabbered; .float grabber_time_fueldecrease; +void W_Grabber_UpdateStats(entity e, float shot, float hit) +{ + // this may not be entierly right, but for the time being we're recording the hook accuracy here + // this is likely needed for detecting if the hook has hit (linked to) another person though + if(shot) + { + e.stats_fired[e.weapon - 1] += 1; + e.stat_fired = e.weapon + 64 * floor(e.stats_fired[e.weapon - 1]); + } + if(hit) + { + e.stats_hit[e.weapon - 1] += 1; + e.stat_hit = e.weapon + 64 * floor(e.stats_hit[e.weapon - 1]); + } +} + void W_Grabber_Touch2 (void) { PROJECTILE_TOUCH; @@ -21,13 +37,17 @@ void W_Grabber_Attack2() return; W_SetupShot (self, TRUE, 0, "weapons/grabber_altfire.wav", cvar("g_balance_grabber_secondary_damage")); + W_Grabber_UpdateStats(self, TRUE, FALSE); // the hit is recorded below WarpZone_traceline_antilag(self, w_shotorg, w_shotorg + w_shotdir * cvar("g_balance_grabber_secondary_radius"), FALSE, self, ANTILAG_LATENCY(self)); pointparticles(particleeffectnum("grabber_melee"), w_shotorg + w_shotdir * cvar("g_balance_grabber_secondary_radius"), '0 0 0', 1); if (trace_fraction < 1) + { Damage(trace_ent, self, self, cvar("g_balance_grabber_secondary_damage"), WEP_GRABBER | HITTYPE_SECONDARY, trace_endpos, cvar("g_balance_grabber_secondary_force") * w_shotdir); + W_Grabber_UpdateStats(self, FALSE, TRUE); // the shot is recorded above + } if not(self.items & IT_UNLIMITED_WEAPON_AMMO) self.ammo_fuel = self.ammo_fuel - cvar("g_balance_grabber_secondary_ammo"); -- 2.39.2