r5208 - trunk/data/qcsrc/server
DONOTREPLY at icculus.org
DONOTREPLY at icculus.org
Sat Dec 13 14:20:35 EST 2008
Author: div0
Date: 2008-12-13 14:20:34 -0500 (Sat, 13 Dec 2008)
New Revision: 5208
Modified:
trunk/data/qcsrc/server/constants.qh
trunk/data/qcsrc/server/g_damage.qc
Log:
make head shot a hit type too
Modified: trunk/data/qcsrc/server/constants.qh
===================================================================
--- trunk/data/qcsrc/server/constants.qh 2008-12-13 18:41:02 UTC (rev 5207)
+++ trunk/data/qcsrc/server/constants.qh 2008-12-13 19:20:34 UTC (rev 5208)
@@ -187,10 +187,12 @@
float DEATH_TURRET = 10100;
float DEATH_WEAPONMASK = 0xFF;
-float DEATH_HITTYPEMASK = 0xF00; // which is WAY below 10000 used for normal deaths
+float DEATH_HITTYPEMASK = 0x1F00; // which is WAY below 10000 used for normal deaths
float HITTYPE_SECONDARY = 0x100;
float HITTYPE_SPLASH = 0x200;
float HITTYPE_BOUNCE = 0x400;
+float HITTYPE_HEADSHOT = 0x800;
+float HITTYPE_RESERVED = 0x1000; // unused yet
// macros to access these
#define DEATH_ISSPECIAL(t) ((t) >= DEATH_SPECIAL_START)
Modified: trunk/data/qcsrc/server/g_damage.qc
===================================================================
--- trunk/data/qcsrc/server/g_damage.qc 2008-12-13 18:41:02 UTC (rev 5207)
+++ trunk/data/qcsrc/server/g_damage.qc 2008-12-13 19:20:34 UTC (rev 5208)
@@ -4,6 +4,7 @@
float damage_goodhits;
float damage_gooddamage;
float headshot;
+float damage_headshotbonus; // bonus multiplier for head shots, set to 0 after use
.float teamkill_complain;
.float teamkill_soundtime;
@@ -717,23 +718,30 @@
damage_goodhits += 1;
damage_gooddamage += damage;
- if(!g_minstagib)
- if(IsFlying(targ))
- yoda = 1;
+ if not(DEATH_ISSPECIAL(deathtype))
+ {
+ if(!g_minstagib)
+ if(IsFlying(targ))
+ yoda = 1;
- if(g_minstagib)
- if(targ.items & IT_STRENGTH)
- yoda = 1;
+ if(g_minstagib)
+ if(targ.items & IT_STRENGTH)
+ yoda = 1;
- // HEAD SHOT:
- // find height of hit on player axis
- // if above view_ofs and below maxs, and also in the middle half of the bbox, it is head shot
- vector headmins, headmaxs, org;
- org = antilag_takebackorigin(targ, time - ANTILAG_LATENCY(attacker));
- headmins = org + '0.5 0 0' * targ.mins_x + '0 0.5 0' * targ.mins_y + '0 0 1' * targ.view_ofs_z;
- headmaxs = org + '0.5 0 0' * targ.maxs_x + '0 0.5 0' * targ.maxs_y + '0 0 1' * targ.maxs_z;
- if(trace_hits_box(railgun_start, railgun_end, headmins, headmaxs))
- headshot = 1;
+ // HEAD SHOT:
+ // find height of hit on player axis
+ // if above view_ofs and below maxs, and also in the middle half of the bbox, it is head shot
+ vector headmins, headmaxs, org;
+ org = antilag_takebackorigin(targ, time - ANTILAG_LATENCY(attacker));
+ headmins = org + '0.5 0 0' * targ.mins_x + '0 0.5 0' * targ.mins_y + '0 0 1' * targ.view_ofs_z;
+ headmaxs = org + '0.5 0 0' * targ.maxs_x + '0 0.5 0' * targ.maxs_y + '0 0 1' * targ.maxs_z;
+ if(trace_hits_box(railgun_start, railgun_end, headmins, headmaxs))
+ {
+ damage *= 1 + damage_headshotbonus;
+ headshot = 1;
+ deathtype |= HITTYPE_HEADSHOT;
+ }
+ }
}
}
else
More information about the nexuiz-commits
mailing list