r4768 - trunk/data/qcsrc/server

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Thu Oct 16 09:23:10 EDT 2008


Author: div0
Date: 2008-10-16 09:23:09 -0400 (Thu, 16 Oct 2008)
New Revision: 4768

Modified:
   trunk/data/qcsrc/server/cl_player.qc
   trunk/data/qcsrc/server/constants.qh
   trunk/data/qcsrc/server/g_damage.qc
   trunk/data/qcsrc/server/w_common.qc
Log:
no change, but some helper macros fro death types


Modified: trunk/data/qcsrc/server/cl_player.qc
===================================================================
--- trunk/data/qcsrc/server/cl_player.qc	2008-10-16 13:22:11 UTC (rev 4767)
+++ trunk/data/qcsrc/server/cl_player.qc	2008-10-16 13:23:09 UTC (rev 4768)
@@ -413,7 +413,7 @@
 					else
 						player_setanim(self.anim_pain2, FALSE, TRUE, TRUE);
 
-					if(deathtype >= DEATH_SPECIAL_START || deathtype & DEATH_WEAPONMASK != WEP_LASER || attacker != self || self.health < 2 * cvar("g_balance_laser_primary_damage") * cvar("g_balance_selfdamagepercent") + 1)
+					if(!DEATH_ISWEAPON(deathtype, WEP_LASER) || attacker != self || self.health < 2 * cvar("g_balance_laser_primary_damage") * cvar("g_balance_selfdamagepercent") + 1)
 					// exclude pain sounds for laserjumps as long as you aren't REALLY low on health and would die of the next two
 					{
 						if(self.health > 75) // TODO make a "gentle" version?

Modified: trunk/data/qcsrc/server/constants.qh
===================================================================
--- trunk/data/qcsrc/server/constants.qh	2008-10-16 13:22:11 UTC (rev 4767)
+++ trunk/data/qcsrc/server/constants.qh	2008-10-16 13:23:09 UTC (rev 4768)
@@ -187,6 +187,13 @@
 float	HITTYPE_SPLASH = 0x200;
 float	HITTYPE_BOUNCE = 0x400;
 
+// macros to access these
+#define DEATH_ISSPECIAL(t)            ((t) >= DEATH_SPECIAL_START)
+#define DEATH_WEAPONOFWEAPONDEATH(t)  ((t) & DEATH_WEAPONMASK)
+#define DEATH_ISWEAPON(t,w)           (!DEATH_ISSPECIAL(t) && DEATH_WEAPONOFWEAPONDEATH(t) == (w))
+#define DEATH_WEAPONOF(t)             (DEATH_ISSPECIAL(t) ? 0 : DEATH_WEAPONOFWEAPONDEATH(t))
+#define WEP_VALID(w)                  ((w) >= WEP_FIRST && (w) <= WEP_LAST)
+
 vector	PL_VIEW_OFS				= '0 0 35';
 vector	PL_MIN					= '-16 -16 -24';
 vector	PL_MAX					= '16 16 45';

Modified: trunk/data/qcsrc/server/g_damage.qc
===================================================================
--- trunk/data/qcsrc/server/g_damage.qc	2008-10-16 13:22:11 UTC (rev 4767)
+++ trunk/data/qcsrc/server/g_damage.qc	2008-10-16 13:23:09 UTC (rev 4768)
@@ -155,7 +155,7 @@
 void Obituary (entity attacker, entity inflictor, entity targ, float deathtype)
 {
 	string	s, a;
-	float p;
+	float p, w;
 
 	if (targ.classname == "player" || targ.classname == "corpse")
 	{
@@ -215,11 +215,12 @@
 				if (targ.killcount > 2)
 					bprint ("^1",s,"^1 ended it all with a ",ftos(targ.killcount)," scoring spree\n");
 			} else {
-				if(deathtype < DEATH_SPECIAL_START && deathtype & DEATH_WEAPONMASK >= WEP_FIRST && deathtype & DEATH_WEAPONMASK <= WEP_LAST)
+				w = DEATH_WEAPONOF(deathtype);
+				if(WEP_VALID(w))
 				{
 					w_deathtypestring = "couldn't resist the urge to self-destruct";
 					w_deathtype = deathtype;
-					weapon_action(deathtype & DEATH_WEAPONMASK, WR_SUICIDEMESSAGE);
+					weapon_action(w, WR_SUICIDEMESSAGE);
 					bprint("^1", s, "^1 ", w_deathtypestring, "\n");
 				}
 				else if (deathtype == DEATH_KILL)
@@ -296,11 +297,12 @@
 				if(sv_gentle) {
 					bprint ("^1",s, "^1 needs a restart thanks to ", a, "\n");
 				} else {
-					if(deathtype < DEATH_SPECIAL_START && deathtype & DEATH_WEAPONMASK >= WEP_FIRST && deathtype & DEATH_WEAPONMASK <= WEP_LAST)
+					w = DEATH_WEAPONOF(deathtype);
+					if(WEP_VALID(w))
 					{
 						w_deathtypestring = "was blasted by";
 						w_deathtype = deathtype;
-						weapon_action(deathtype & DEATH_WEAPONMASK, WR_KILLMESSAGE);
+						weapon_action(w, WR_KILLMESSAGE);
 						p = strstrofs(w_deathtypestring, "#", 0);
 						if(p < 0)
 							bprint("^1", s, "^1 ", w_deathtypestring, " ", a, "\n");
@@ -592,7 +594,7 @@
 				damage = 0;
 				targ.hitsound += 1;
 			}
-			if (deathtype == WEP_LASER)
+			if (DEATH_ISWEAPON(deathtype, WEP_LASER))
 			{
 				damage = 0;
 				if (targ != attacker)
@@ -609,7 +611,7 @@
 		}
 
 		// apply strength multiplier
-		if (attacker.items & IT_STRENGTH && !g_minstagib)
+		if ((attacker.items & IT_STRENGTH) && !g_minstagib)
 		{
 			if(targ == attacker)
 			{

Modified: trunk/data/qcsrc/server/w_common.qc
===================================================================
--- trunk/data/qcsrc/server/w_common.qc	2008-10-16 13:22:11 UTC (rev 4767)
+++ trunk/data/qcsrc/server/w_common.qc	2008-10-16 13:23:09 UTC (rev 4768)
@@ -144,7 +144,7 @@
 	{
 		if (trace_ent.solid == SOLID_BSP && !(trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOIMPACT))
 		{
-			if (dtype < DEATH_SPECIAL_START && (dtype & DEATH_WEAPONMASK) == WEP_SHOTGUN)
+			if (DEATH_ISWEAPON(dtype, WEP_SHOTGUN))
 				pointparticles(particleeffectnum("shotgun_impact"), trace_endpos, trace_plane_normal * 1000, 1);
 			else
 				pointparticles(particleeffectnum("machinegun_impact"), trace_endpos, trace_plane_normal * 1000, 1);




More information about the nexuiz-commits mailing list