r4696 - trunk/data/qcsrc/server
DONOTREPLY at icculus.org
DONOTREPLY at icculus.org
Fri Oct 10 04:36:59 EDT 2008
Author: div0
Date: 2008-10-10 04:36:48 -0400 (Fri, 10 Oct 2008)
New Revision: 4696
Modified:
trunk/data/qcsrc/server/cl_client.qc
trunk/data/qcsrc/server/defs.qh
trunk/data/qcsrc/server/g_damage.qc
trunk/data/qcsrc/server/g_triggers.qc
trunk/data/qcsrc/server/miscfunctions.qc
trunk/data/qcsrc/server/w_common.qc
trunk/data/qcsrc/server/w_minstanex.qc
trunk/data/qcsrc/server/w_nex.qc
Log:
support for announcer/male/impressive and announcer/male/headshot ;)
Modified: trunk/data/qcsrc/server/cl_client.qc
===================================================================
--- trunk/data/qcsrc/server/cl_client.qc 2008-10-10 07:23:39 UTC (rev 4695)
+++ trunk/data/qcsrc/server/cl_client.qc 2008-10-10 08:36:48 UTC (rev 4696)
@@ -2368,4 +2368,6 @@
*/
Arena_Warmup();
+
+ //pointparticles(particleeffectnum("machinegun_impact"), self.origin + self.view_ofs + '0 0 7', '0 0 0', 1);
}
Modified: trunk/data/qcsrc/server/defs.qh
===================================================================
--- trunk/data/qcsrc/server/defs.qh 2008-10-10 07:23:39 UTC (rev 4695)
+++ trunk/data/qcsrc/server/defs.qh 2008-10-10 08:36:48 UTC (rev 4696)
@@ -502,3 +502,5 @@
.float projectiledeathtype;
.string message2;
+
+vector railgun_start, railgun_end; // filled by FireRailgunBullet, used by damage code for head shot
Modified: trunk/data/qcsrc/server/g_damage.qc
===================================================================
--- trunk/data/qcsrc/server/g_damage.qc 2008-10-10 07:23:39 UTC (rev 4695)
+++ trunk/data/qcsrc/server/g_damage.qc 2008-10-10 08:36:48 UTC (rev 4696)
@@ -1,8 +1,11 @@
-
float checkrules_firstblood;
float yoda;
+float damage_goodhits;
+float damage_gooddamage;
+float headshot;
+
float IsDifferentTeam(entity a, entity b)
{
if(teams_matter)
@@ -593,12 +596,6 @@
damage = 0;
targ.hitsound += 1;
}
- else if (deathtype == WEP_MINSTANEX && targ.items & IT_STRENGTH)
- {
- if(clienttype(attacker) == CLIENTTYPE_REAL)
- if(IsDifferentTeam(targ, attacker))
- yoda = 1;
- }
if (deathtype == WEP_LASER)
{
damage = 0;
@@ -613,12 +610,6 @@
attacker = targ;
}
}
- } else {
- if (!targ.deadflag)
- if(targ.takedamage == DAMAGE_AIM)
- if(IsFlying(targ))
- if(IsDifferentTeam(targ, attacker))
- yoda = 1;
}
// apply strength multiplier
@@ -685,6 +676,33 @@
else if (targ.runes & CURSE_VULNER)
damage = damage * cvar("g_balance_curse_vulner_takedamage");
}
+
+ // count the damage
+ if(IsDifferentTeam(targ, attacker))
+ if (!targ.deadflag)
+ if(targ.takedamage == DAMAGE_AIM)
+ if(damage > 0)
+ {
+ damage_goodhits += 1;
+ damage_gooddamage += damage;
+
+ if(!g_minstagib)
+ if(IsFlying(targ))
+ 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;
+ headmins = targ.origin + '0.5 0 0' * targ.mins_x + '0 0.5 0' * targ.mins_y + '0 0 1' * targ.view_ofs_z;
+ headmaxs = targ.origin + '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;
+ }
}
// apply push
Modified: trunk/data/qcsrc/server/g_triggers.qc
===================================================================
--- trunk/data/qcsrc/server/g_triggers.qc 2008-10-10 07:23:39 UTC (rev 4695)
+++ trunk/data/qcsrc/server/g_triggers.qc 2008-10-10 08:36:48 UTC (rev 4696)
@@ -413,55 +413,6 @@
trigger_hurt_last = self;
};
-float trace_hits_box_a0, trace_hits_box_a1;
-
-float trace_hits_box_1d(float end, float thmi, float thma)
-{
- if(end == 0)
- {
- // just check if x is in range
- if(0 < thmi)
- return FALSE;
- if(0 > thma)
- return FALSE;
- }
- else
- {
- // do the trace with respect to x
- // 0 -> end has to stay in thmi -> thma
- trace_hits_box_a0 = max(trace_hits_box_a0, min(thmi / end, thma / end));
- trace_hits_box_a1 = min(trace_hits_box_a1, max(thmi / end, thma / end));
- if(trace_hits_box_a0 > trace_hits_box_a1)
- return FALSE;
- }
- return TRUE;
-}
-
-float trace_hits_box(vector start, vector end, vector thmi, vector thma)
-{
- end -= start;
- thmi -= start;
- thma -= start;
- // now it is a trace from 0 to end
-
- trace_hits_box_a0 = 0;
- trace_hits_box_a1 = 1;
-
- if(!trace_hits_box_1d(end_x, thmi_x, thma_x))
- return FALSE;
- if(!trace_hits_box_1d(end_y, thmi_y, thma_y))
- return FALSE;
- if(!trace_hits_box_1d(end_z, thmi_z, thma_z))
- return FALSE;
-
- return TRUE;
-}
-
-float tracebox_hits_box(vector start, vector mi, vector ma, vector end, vector thmi, vector thma)
-{
- return trace_hits_box(start, end, thmi - ma, thma - mi);
-}
-
float tracebox_hits_trigger_hurt(vector start, vector mi, vector ma, vector end)
{
entity th;
Modified: trunk/data/qcsrc/server/miscfunctions.qc
===================================================================
--- trunk/data/qcsrc/server/miscfunctions.qc 2008-10-10 07:23:39 UTC (rev 4695)
+++ trunk/data/qcsrc/server/miscfunctions.qc 2008-10-10 08:36:48 UTC (rev 4696)
@@ -1095,7 +1095,9 @@
precache_sound ("announcer/male/25kills.wav");
precache_sound ("announcer/male/30kills.wav");
precache_sound ("announcer/male/botlike.wav");
- precache_sound ("announcer/male/yoda.wav");
+ precache_sound ("announcer/male/yoda.ogg");
+ precache_sound ("announcer/male/headshot.ogg");
+ precache_sound ("announcer/male/impressive.ogg");
// announcer sounds - robotic
precache_sound ("announcer/robotic/prepareforbattle.wav");
@@ -1560,3 +1562,54 @@
{
InitializeEntity(self, DropToFloor_Handler, INITPRIO_DROPTOFLOOR);
}
+
+
+
+float trace_hits_box_a0, trace_hits_box_a1;
+
+float trace_hits_box_1d(float end, float thmi, float thma)
+{
+ if(end == 0)
+ {
+ // just check if x is in range
+ if(0 < thmi)
+ return FALSE;
+ if(0 > thma)
+ return FALSE;
+ }
+ else
+ {
+ // do the trace with respect to x
+ // 0 -> end has to stay in thmi -> thma
+ trace_hits_box_a0 = max(trace_hits_box_a0, min(thmi / end, thma / end));
+ trace_hits_box_a1 = min(trace_hits_box_a1, max(thmi / end, thma / end));
+ if(trace_hits_box_a0 > trace_hits_box_a1)
+ return FALSE;
+ }
+ return TRUE;
+}
+
+float trace_hits_box(vector start, vector end, vector thmi, vector thma)
+{
+ end -= start;
+ thmi -= start;
+ thma -= start;
+ // now it is a trace from 0 to end
+
+ trace_hits_box_a0 = 0;
+ trace_hits_box_a1 = 1;
+
+ if(!trace_hits_box_1d(end_x, thmi_x, thma_x))
+ return FALSE;
+ if(!trace_hits_box_1d(end_y, thmi_y, thma_y))
+ return FALSE;
+ if(!trace_hits_box_1d(end_z, thmi_z, thma_z))
+ return FALSE;
+
+ return TRUE;
+}
+
+float tracebox_hits_box(vector start, vector mi, vector ma, vector end, vector thmi, vector thma)
+{
+ return trace_hits_box(start, end, thmi - ma, thma - mi);
+}
Modified: trunk/data/qcsrc/server/w_common.qc
===================================================================
--- trunk/data/qcsrc/server/w_common.qc 2008-10-10 07:23:39 UTC (rev 4695)
+++ trunk/data/qcsrc/server/w_common.qc 2008-10-10 08:36:48 UTC (rev 4696)
@@ -28,6 +28,9 @@
local entity ent, endent;
local float endq3surfaceflags;
//local entity explosion;
+
+ railgun_start = start;
+ railgun_end = end;
dir = normalize(end - start);
force = dir * bforce;
Modified: trunk/data/qcsrc/server/w_minstanex.qc
===================================================================
--- trunk/data/qcsrc/server/w_minstanex.qc 2008-10-10 07:23:39 UTC (rev 4695)
+++ trunk/data/qcsrc/server/w_minstanex.qc 2008-10-10 08:36:48 UTC (rev 4696)
@@ -1,3 +1,5 @@
+.float minstanex_lasthit;
+
void W_MinstaNex_Attack (void)
{
float flying;
@@ -6,13 +8,30 @@
W_SetupShot (self, '25 8 -4', TRUE, 5, "weapons/nexfire.wav");
yoda = 0;
+ damage_goodhits = 0;
+ headshot = 0;
FireRailgunBullet (w_shotorg, w_shotorg + w_shotdir * MAX_SHOT_DISTANCE, 10000, 800, WEP_MINSTANEX);
- if(!g_minstagib)
- if(yoda)
- if(flying)
- announce(self, "announcer/male/yoda.ogg");
+ if(g_minstagib)
+ {
+ if(yoda)
+ announce(self, "announcer/male/yoda.ogg");
+ }
+ else
+ {
+ if(yoda && flying)
+ announce(self, "announcer/male/yoda.ogg");
+ else if(headshot)
+ announce(self, "announcer/male/headshot.ogg");
+ else if(damage_goodhits && self.minstanex_lasthit)
+ {
+ announce(self, "announcer/male/impressive.ogg");
+ damage_goodhits = 0; // only every second time
+ }
+ }
+ self.minstanex_lasthit = damage_goodhits;
+
pointparticles(particleeffectnum("nex_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
// beam effect
@@ -147,7 +166,10 @@
w_laser(WR_PRECACHE);
}
else if (req == WR_SETUP)
+ {
weapon_setup(WEP_MINSTANEX);
+ self.minstanex_lasthit = 0;
+ }
else if (req == WR_CHECKAMMO1)
{
if (g_minstagib)
Modified: trunk/data/qcsrc/server/w_nex.qc
===================================================================
--- trunk/data/qcsrc/server/w_nex.qc 2008-10-10 07:23:39 UTC (rev 4695)
+++ trunk/data/qcsrc/server/w_nex.qc 2008-10-10 08:36:48 UTC (rev 4696)
@@ -8,8 +8,7 @@
yoda = 0;
FireRailgunBullet (w_shotorg, w_shotorg + w_shotdir * MAX_SHOT_DISTANCE, cvar("g_balance_nex_damage"), cvar("g_balance_nex_force"), WEP_NEX);
- if(yoda)
- if(flying)
+ if(yoda && flying)
announce(self, "announcer/male/yoda.ogg");
pointparticles(particleeffectnum("nex_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
More information about the nexuiz-commits
mailing list