[nexuiz-commits] r7598 - in trunk/data/qcsrc: client server

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Wed Sep 2 14:36:41 EDT 2009


Author: div0
Date: 2009-09-02 14:36:41 -0400 (Wed, 02 Sep 2009)
New Revision: 7598

Modified:
   trunk/data/qcsrc/client/sbar.qc
   trunk/data/qcsrc/server/g_damage.qc
   trunk/data/qcsrc/server/w_fireball.qc
Log:
[NOT FOR 2.5.2] fireball: better damage reporting to stats


Modified: trunk/data/qcsrc/client/sbar.qc
===================================================================
--- trunk/data/qcsrc/client/sbar.qc	2009-09-02 18:36:29 UTC (rev 7597)
+++ trunk/data/qcsrc/client/sbar.qc	2009-09-02 18:36:41 UTC (rev 7598)
@@ -1998,7 +1998,7 @@
 		//if ((weapon_number != 42))  // print them all :)
  		if ((self.weapon_type == WEP_TYPE_SPLASH) && (weapon_damage))
 		{
-			weapon_stats = rint(100 * weapon_hit / weapon_damage);
+			weapon_stats = bound(0, rint(100 * weapon_hit / weapon_damage), 100);
 
 			fill_colour_x = 1 - 0.015 * weapon_stats;
 			fill_colour_y = 1 - 0.015 * (100 - weapon_stats);
@@ -2044,13 +2044,13 @@
 			drawstringright(pos + '4.5 0 0' * sbar_fontsize_x + '0 7 0' * sbar_fontsize_y, strcat(ftos(weapon_stats),"%"), sbar_fontsize, '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL);
 
 			// the amount of shots missed or damage wasted
-			drawstringright(pos + '4.5 0 0' * sbar_fontsize_x + '0 9 0' * sbar_fontsize_y, ftos(weapon_damage - weapon_hit), sbar_fontsize, '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL);
+			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.weapon_type == WEP_TYPE_HITSCAN) && (weapon_damage))
 		{
-			weapon_stats = rint(100 * weapon_hit / weapon_damage);
+			weapon_stats = bound(0, rint(100 * weapon_hit / weapon_damage), 100);
 
 			fill_colour_x = 1 - 0.015 * weapon_stats;
 			fill_colour_y = 1 - 0.015 * (100 - weapon_stats);
@@ -2096,7 +2096,7 @@
 			drawstringright(pos + '4.5 0 0' * sbar_fontsize_x + '0 7 0' * sbar_fontsize_y, strcat(ftos(weapon_stats),"%"), sbar_fontsize, '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL);
 
 			// the amount of shots missed or damage wasted
-			drawstringright(pos + '4.5 0 0' * sbar_fontsize_x + '0 9 0' * sbar_fontsize_y, ftos(weapon_damage - weapon_hit), sbar_fontsize, '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL);
+			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_hitscan;
 		}

Modified: trunk/data/qcsrc/server/g_damage.qc
===================================================================
--- trunk/data/qcsrc/server/g_damage.qc	2009-09-02 18:36:29 UTC (rev 7597)
+++ trunk/data/qcsrc/server/g_damage.qc	2009-09-02 18:36:41 UTC (rev 7598)
@@ -945,6 +945,19 @@
 FTEQCC_YOU_SUCK_THIS_IS_NOT_UNREFERENCED(actual_damage);
 FTEQCC_YOU_SUCK_THIS_IS_NOT_UNREFERENCED(max_damage);
 
+void Damage_RecordDamage(entity attacker, float deathtype, float damage)
+{
+	float weaponid;
+	weaponid = DEATH_WEAPONOF(deathtype);
+	if not(inWarmupStage)
+	if(weaponid)
+	if(clienttype(attacker) == CLIENTTYPE_REAL)
+	{
+		// Track damage done and update the stat to be sent later in g_world.qc
+		attacker.actual_damage[weaponid] += damage;
+		attacker.damage_hits = weaponid + 64 * rint(attacker.actual_damage[weaponid]);
+	}
+}
 
 float RadiusDamage_running;
 float RadiusDamage (entity inflictor, entity attacker, float coredamage, float edgedamage, float rad, entity ignore, float forceintensity, float deathtype, entity directhitentity)
@@ -960,7 +973,6 @@
 	vector  nearest;
 	float   total_damage_to_creatures;
 	entity  next;
-	float weaponid;
 
 	float stat_damagedone;
 	float stat_maxdamage;
@@ -1073,19 +1085,8 @@
 
 	RadiusDamage_running = 0;
 
-	weaponid = DEATH_WEAPONOF(deathtype);
+	Damage_RecordDamage(attacker, deathtype, min(stat_maxdamage, stat_damagedone));
 
-	// Calculates stats for all RadiusDamage weapons
-	if not(inWarmupStage)
-	if(weaponid)
-	if(clienttype(attacker) == CLIENTTYPE_REAL)
-	{
-		// Track damage done and update the stat to be sent later in g_world.qc
-		float f = min(stat_maxdamage, stat_damagedone);
-		attacker.actual_damage[weaponid] += f; // value temporarily stored in f due to a ftqecc bug
-		attacker.damage_hits = weaponid + 64 * rint(attacker.actual_damage[weaponid]);
-	}
-
 	return total_damage_to_creatures;
 }
 
@@ -1204,6 +1205,8 @@
 	}
 	e.fire_hitsound = TRUE;
 
+	Damage_RecordDamage(e.fire_owner, e.fire_deathtype, d);
+
 	if not(IS_INDEPENDENT_PLAYER(e))
 	FOR_EACH_PLAYER(other) if(e != other)
 	{

Modified: trunk/data/qcsrc/server/w_fireball.qc
===================================================================
--- trunk/data/qcsrc/server/w_fireball.qc	2009-09-02 18:36:29 UTC (rev 7597)
+++ trunk/data/qcsrc/server/w_fireball.qc	2009-09-02 18:36:41 UTC (rev 7598)
@@ -38,6 +38,8 @@
 			dir = normalize(e.origin + e.view_ofs - self.origin);
 			Damage(e, self, self.realowner, cvar("g_balance_fireball_secondary_bfgdamage") * points, self.projectiledeathtype | HITTYPE_BOUNCE | HITTYPE_SPLASH, e.origin + e.view_ofs, cvar("g_balance_fireball_secondary_bfgforce") * dir);
 			pointparticles(particleeffectnum("fireball_bfgdamage"), e.origin, -1 * dir, 1);
+
+			Damage_RecordDamage(self.owner, self.projectiledeathtype, cvar("g_balance_fireball_secondary_bfgdamage") * points);
 		}
 	}
 
@@ -113,7 +115,7 @@
 {
 	local entity proj;
 
-	W_SetupShot_ProjectileSize (self, '-16 -16 -16', '16 16 16', FALSE, 2, "weapons/fireball_fire2.wav", cvar("g_balance_fireball_secondary_damage"));
+	W_SetupShot_ProjectileSize (self, '-16 -16 -16', '16 16 16', FALSE, 2, "weapons/fireball_fire2.wav", cvar("g_balance_fireball_secondary_damage") + cvar("g_balance_fireball_secondary_bfgdamage"));
 
 	pointparticles(particleeffectnum("fireball_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
 



More information about the nexuiz-commits mailing list