r5546 - in trunk/data/qcsrc: client server
DONOTREPLY at icculus.org
DONOTREPLY at icculus.org
Thu Jan 15 08:56:10 EST 2009
Author: div0
Date: 2009-01-15 08:56:09 -0500 (Thu, 15 Jan 2009)
New Revision: 5546
Added:
trunk/data/qcsrc/client/projectile.qc
trunk/data/qcsrc/server/csqcprojectile.qc
trunk/data/qcsrc/server/csqcprojectile.qh
Modified:
trunk/data/qcsrc/server/t_jumppads.qc
trunk/data/qcsrc/server/w_rocketlauncher.qc
Log:
add the missing files
Added: trunk/data/qcsrc/client/projectile.qc
===================================================================
--- trunk/data/qcsrc/client/projectile.qc (rev 0)
+++ trunk/data/qcsrc/client/projectile.qc 2009-01-15 13:56:09 UTC (rev 5546)
@@ -0,0 +1,143 @@
+.float itime;
+.float count; // set if clientside projectile
+.float cnt; // sound index
+.float gravity;
+
+void Projectile_Draw()
+{
+ float dt;
+ vector oldorg, org;
+
+ oldorg = self.origin;
+
+ if(self.count & 0x80)
+ {
+ dt = time - self.itime;
+ self.velocity_z -= dt * self.gravity * getstatf(242); // STAT_MOVEVARS_GRAVITY
+ org = self.origin + dt * self.velocity;
+ self.itime = time;
+ tracebox(self.origin, self.mins, self.maxs, org, MOVE_NORMAL, self);
+ self.origin = trace_endpos;
+ self.angles = vectoangles(self.velocity);
+ }
+ else
+ {
+ InterpolateOrigin_Do();
+ }
+
+ switch(self.cnt)
+ {
+ default:
+ case 0:
+ break;
+ case 1:
+ break; // electro uses no trail
+ case 2:
+ trailparticles(self, particleeffectnum("TR_ROCKET"), oldorg, self.origin); // rocket
+ break;
+ case 3:
+ trailparticles(self, particleeffectnum("TR_VORESPIKE"), oldorg, self.origin); // seeker
+ break;
+ }
+
+ self.renderflags = 0;
+
+ if(self.count & 0x80 || self.iflags & IFLAG_VALID)
+ R_AddEntity(self);
+}
+
+void Ent_RemoveProjectile()
+{
+ if(self.cnt)
+ sound(self, CHAN_PAIN, "misc/null.wav", VOL_BASE, ATTN_NORM);
+}
+
+void Ent_Projectile()
+{
+ float f;
+ float sz;
+
+ InterpolateOrigin_Undo();
+
+ // projectile properties:
+ // kind (interpolated, or clientside)
+ //
+ // modelindex
+ // origin
+ // scale
+ // if clientside:
+ // velocity
+ // gravity
+ // soundindex (hardcoded list)
+ // effects
+ //
+ // projectiles don't send angles, because they always follow the velocity
+
+ f = ReadByte();
+ self.count = (f & 0xC0);
+ self.iflags = IFLAG_AUTOANGLES | IFLAG_ANGLES;
+
+ if(self.count & 0x80)
+ InterpolateOrigin_Undo();
+
+ if(f & 1)
+ {
+ self.origin_x = ReadCoord();
+ self.origin_y = ReadCoord();
+ self.origin_z = ReadCoord();
+ if(self.count & 0x80)
+ {
+ self.itime = time;
+ self.velocity_x = ReadCoord();
+ self.velocity_y = ReadCoord();
+ self.velocity_z = ReadCoord();
+ self.gravity = ReadCoord();
+ }
+ }
+
+ if(f & 2)
+ {
+ self.modelindex = ReadShort();
+ if(f & 0x40)
+ {
+ self.scale = ReadByte() / 16.0;
+ self.effects = ReadShort();
+ self.effects |= 65536 * ReadByte();
+ }
+ else
+ {
+ self.scale = 1;
+ self.effects = 0;
+ }
+
+ self.cnt = ReadShort();
+ switch(self.cnt)
+ {
+ case 1:
+ sound(self, CHAN_PAIN, "weapons/electro_fly.wav", VOL_BASE, ATTN_NORM);
+ break;
+ case 2:
+ sound(self, CHAN_PAIN, "weapons/rocket_fly.wav", VOL_BASE, ATTN_NORM);
+ break;
+ case 3:
+ sound(self, CHAN_PAIN, "weapons/tag_rocket_fly.wav", VOL_BASE, ATTN_NORM);
+ break;
+ default:
+ break;
+ }
+
+ sz = ReadByte();
+ switch(sz)
+ {
+ case 0:
+ default:
+ self.mins = self.maxs = '0 0 0';
+ break;
+ }
+ }
+
+ if(self.count)
+ InterpolateOrigin_Note();
+
+ self.draw = Projectile_Draw;
+}
Added: trunk/data/qcsrc/server/csqcprojectile.qc
===================================================================
--- trunk/data/qcsrc/server/csqcprojectile.qc (rev 0)
+++ trunk/data/qcsrc/server/csqcprojectile.qc 2009-01-15 13:56:09 UTC (rev 5546)
@@ -0,0 +1,54 @@
+float CSQCProjectile_SendEntity(entity to, float sf)
+{
+ sf = sf & 0x3F;
+
+ if(self.csqcprojectile_clientanimate)
+ sf |= 0x80; // client animated, not interpolated
+
+ if((self.scale != 0 && self.scale != 1) || self.effects != 0)
+ sf |= 0x40; // scale used
+
+ WriteByte(MSG_ENTITY, ENT_CLIENT_PROJECTILE);
+ WriteByte(MSG_ENTITY, sf);
+
+ if(sf & 1)
+ {
+ WriteCoord(MSG_ENTITY, self.origin_x);
+ WriteCoord(MSG_ENTITY, self.origin_y);
+ WriteCoord(MSG_ENTITY, self.origin_z);
+
+ if(sf & 0x80)
+ {
+ WriteCoord(MSG_ENTITY, self.velocity_x);
+ WriteCoord(MSG_ENTITY, self.velocity_y);
+ WriteCoord(MSG_ENTITY, self.velocity_z);
+ WriteCoord(MSG_ENTITY, self.gravity);
+ }
+ }
+
+ if(sf & 2)
+ {
+ WriteShort(MSG_ENTITY, self.modelindex);
+ if(sf & 0x40)
+ {
+ WriteByte(MSG_ENTITY, bound(0, self.scale / 16.0, 255));
+ WriteShort(MSG_ENTITY, self.effects & 65535);
+ WriteByte(MSG_ENTITY, floor(self.effects / 65536));
+ }
+ WriteShort(MSG_ENTITY, self.csqcprojectile_flysound);
+ WriteByte(MSG_ENTITY, 0); // size category
+ }
+
+ return 1;
+}
+
+void CSQCProjectile(entity e)
+{
+ e.SendEntity = CSQCProjectile_SendEntity;
+}
+
+void UpdateCSQCProjectile(entity e)
+{
+ if(e.SendEntity == CSQCProjectile_SendEntity)
+ e.SendFlags |= 1; // send new origin data
+}
Added: trunk/data/qcsrc/server/csqcprojectile.qh
===================================================================
--- trunk/data/qcsrc/server/csqcprojectile.qh (rev 0)
+++ trunk/data/qcsrc/server/csqcprojectile.qh 2009-01-15 13:56:09 UTC (rev 5546)
@@ -0,0 +1,5 @@
+.float csqcprojectile_flysound;
+.float csqcprojectile_clientanimate;
+
+void CSQCProjectile(entity e);
+void UpdateCSQCProjectile(entity e);
Modified: trunk/data/qcsrc/server/t_jumppads.qc
===================================================================
--- trunk/data/qcsrc/server/t_jumppads.qc 2009-01-15 13:46:30 UTC (rev 5545)
+++ trunk/data/qcsrc/server/t_jumppads.qc 2009-01-15 13:56:09 UTC (rev 5546)
@@ -125,6 +125,8 @@
// reset tracking of oldvelocity for impact damage (sudden velocity changes)
other.oldvelocity = other.velocity = self.movedir;
+ UpdateCSQCProjectile(other);
+
if (other.classname == "player")
{
if(self.pushltime < time) // prevent "snorring" sound when a player hits the jumppad more than once
Modified: trunk/data/qcsrc/server/w_rocketlauncher.qc
===================================================================
--- trunk/data/qcsrc/server/w_rocketlauncher.qc 2009-01-15 13:46:30 UTC (rev 5545)
+++ trunk/data/qcsrc/server/w_rocketlauncher.qc 2009-01-15 13:56:09 UTC (rev 5546)
@@ -248,10 +248,12 @@
missile.flags = FL_PROJECTILE;
CSQCProjectile(missile);
+
if(cvar("g_balance_rocketlauncher_speedaccel") == 0 && cvar("g_laserguided_missiles") == 0)
missile.csqcprojectile_clientanimate = 1;
else
missile.csqcprojectile_clientanimate = 0; // we won't client animate if the missiles may behave weird
+
missile.gravity = 0;
missile.csqcprojectile_flysound = 2;
More information about the nexuiz-commits
mailing list