r5290 - trunk/data/qcsrc/server
DONOTREPLY at icculus.org
DONOTREPLY at icculus.org
Tue Dec 23 17:30:41 EST 2008
Author: div0
Date: 2008-12-23 17:30:41 -0500 (Tue, 23 Dec 2008)
New Revision: 5290
Modified:
trunk/data/qcsrc/server/w_common.qc
Log:
ballistics: also show bullet mark where the bullet came out
Modified: trunk/data/qcsrc/server/w_common.qc
===================================================================
--- trunk/data/qcsrc/server/w_common.qc 2008-12-23 22:24:46 UTC (rev 5289)
+++ trunk/data/qcsrc/server/w_common.qc 2008-12-23 22:30:41 UTC (rev 5290)
@@ -118,12 +118,12 @@
{
vector org2;
float f;
+
org2 = self.origin - 6 * normalize(self.oldvelocity);
-
if (DEATH_ISWEAPON(self.projectiledeathtype, WEP_SHOTGUN))
- pointparticles(particleeffectnum("shotgun_impact"), trace_endpos, trace_plane_normal * 1000, 1);
+ pointparticles(particleeffectnum("shotgun_impact"), org2, normalize(self.velocity) * 1000, 1);
else
- pointparticles(particleeffectnum("machinegun_impact"), trace_endpos, trace_plane_normal * 1000, 1);
+ pointparticles(particleeffectnum("machinegun_impact"), org2, normalize(self.velocity) * 1000, 1);
if(other && other != self.enemy)
{
@@ -151,22 +151,30 @@
}
}
-.void(void) leave_solid_think_save;
-.float leave_solid_nextthink_save;
-.vector leave_solid_origin;
-.vector leave_solid_velocity;
+.void(void) W_BallisticBullet_LeaveSolid_think_save;
+.float W_BallisticBullet_LeaveSolid_nextthink_save;
+.vector W_BallisticBullet_LeaveSolid_origin;
+.vector W_BallisticBullet_LeaveSolid_velocity;
-void leave_solid_think()
+void W_BallisticBullet_LeaveSolid_think()
{
- setorigin(self, self.leave_solid_origin);
- self.velocity = self.leave_solid_velocity;
+ vector org2;
- self.think = self.leave_solid_think_save;
- self.nextthink = max(time, self.leave_solid_nextthink_save) + 1;
- self.leave_solid_think_save = SUB_Null;
+ setorigin(self, self.W_BallisticBullet_LeaveSolid_origin);
+ self.velocity = self.W_BallisticBullet_LeaveSolid_velocity;
+ self.think = self.W_BallisticBullet_LeaveSolid_think_save;
+ self.nextthink = max(time, self.W_BallisticBullet_LeaveSolid_nextthink_save) + 1;
+ self.W_BallisticBullet_LeaveSolid_think_save = SUB_Null;
+
self.flags &~= FL_ONGROUND;
self.effects &~= EF_NODRAW;
+
+ org2 = self.origin - 6 * normalize(self.oldvelocity);
+ if (DEATH_ISWEAPON(self.projectiledeathtype, WEP_SHOTGUN))
+ pointparticles(particleeffectnum("shotgun_impact"), org2, normalize(self.velocity) * 1000, 1);
+ else
+ pointparticles(particleeffectnum("machinegun_impact"), org2, normalize(self.velocity) * 1000, 1);
}
// a fake logarithm function
@@ -179,7 +187,7 @@
return 2 * log(sqrt(x));
}
-float leave_solid(entity e, vector vel, float speedhalflife)
+float W_BallisticBullet_LeaveSolid(entity e, vector vel, float speedhalflife)
{
// move the entity along its velocity until it's out of solid, then let it resume
@@ -238,19 +246,19 @@
{
// we managed to leave solid
// so trace_endpos is good
- self.leave_solid_origin = t;
+ self.W_BallisticBullet_LeaveSolid_origin = t;
break;
}
}
else
{
// bad: skiporg is outside solid. Then imagine it's alright.
- self.leave_solid_origin = skiporg;
+ self.W_BallisticBullet_LeaveSolid_origin = skiporg;
break;
}
}
- dst = vlen(self.leave_solid_origin - org);
+ dst = vlen(self.W_BallisticBullet_LeaveSolid_origin - org);
velfactor = (speedhalflife * v0 - dst) / (speedhalflife * v0);
// t(s) = speedhalflife * log((speedhalflife * v(0)) / (speedhalflife * v(0) - s))
@@ -259,9 +267,9 @@
//print("slowdown by ", ftos(dst), " units = ", ftos(velfactor), "\n");
//print("takes time ", ftos(dt), "\n");
- self.leave_solid_think_save = self.think;
- self.leave_solid_nextthink_save = self.nextthink;
- self.think = leave_solid_think;
+ self.W_BallisticBullet_LeaveSolid_think_save = self.think;
+ self.W_BallisticBullet_LeaveSolid_nextthink_save = self.nextthink;
+ self.think = W_BallisticBullet_LeaveSolid_think;
self.nextthink = time + dt;
vel = vel * velfactor;
@@ -269,21 +277,21 @@
self.velocity = '0 0 0';
self.flags |= FL_ONGROUND; // prevent moving
self.effects |= EF_NODRAW;
- self.leave_solid_velocity = vel;
+ self.W_BallisticBullet_LeaveSolid_velocity = vel;
return 1;
}
void W_BallisticBullet_Touch (void)
{
- if(self.think == leave_solid_think) // skip this!
+ if(self.think == W_BallisticBullet_LeaveSolid_think) // skip this!
return;
PROJECTILE_TOUCH;
W_BallisticBullet_Hit ();
// go through solid!
- if(!leave_solid(self, self.velocity, self.dmg_radius))
+ if(!W_BallisticBullet_LeaveSolid(self, self.velocity, self.dmg_radius))
{
remove(self);
return;
More information about the nexuiz-commits
mailing list