[nexuiz-commits] r8519 - in trunk/data/qcsrc: client server
DONOTREPLY at icculus.org
DONOTREPLY at icculus.org
Wed Jan 20 02:49:01 EST 2010
Author: div0
Date: 2010-01-20 02:49:01 -0500 (Wed, 20 Jan 2010)
New Revision: 8519
Modified:
trunk/data/qcsrc/client/projectile.qc
trunk/data/qcsrc/server/csqcprojectile.qc
Log:
crylink fading
Modified: trunk/data/qcsrc/client/projectile.qc
===================================================================
--- trunk/data/qcsrc/client/projectile.qc 2010-01-19 07:38:43 UTC (rev 8518)
+++ trunk/data/qcsrc/client/projectile.qc 2010-01-20 07:49:01 UTC (rev 8519)
@@ -1,6 +1,7 @@
.float spawntime;
.vector trail_oldorigin;
.float trail_oldtime;
+.float fade_time, fade_rate;
void SUB_Null()
{
@@ -12,6 +13,7 @@
self.move_movetype = MOVETYPE_NONE;
}
+.float alphamod;
.float count; // set if clientside projectile
.float cnt; // sound index
.float gravity;
@@ -39,6 +41,7 @@
float f;
float drawn;
float t;
+ float a;
f = self.move_flags;
@@ -89,6 +92,10 @@
fixedmakevectors(self.angles);
+ a = 1 - (time - self.fade_time) * self.fade_rate;
+ if(a <= 0)
+ drawn = 0;
+
trailorigin = self.origin;
switch(self.cnt)
{
@@ -114,12 +121,13 @@
{
case PROJECTILE_BULLET_GLOWING:
case PROJECTILE_BULLET_GLOWING_TRACER:
- R_AddDynamicLight(self.origin, 50, '1 1 0');
+ R_AddDynamicLight(self.origin, 50 * a, '1 1 0');
break;
default:
break;
}
+ self.alpha = self.alphamod * a;
self.renderflags = 0;
R_AddEntity(self);
@@ -209,6 +217,17 @@
if(time == self.spawntime || (self.count & 0x80) || (f & 0x20))
self.trail_oldorigin = self.origin;
+
+ if(f & 0x20)
+ {
+ self.fade_time = time + ReadByte() * ticrate;
+ self.fade_rate = 1 / (ReadByte() * ticrate);
+ }
+ else
+ {
+ self.fade_time = 0;
+ self.fade_rate = 0;
+ }
}
if(f & 2)
@@ -251,6 +270,7 @@
self.colormod = '0 0 0';
self.move_touch = SUB_Stop;
self.move_movetype = MOVETYPE_TOSS;
+ self.alphamod = 1;
switch(self.cnt)
{
@@ -279,13 +299,13 @@
break;
case PROJECTILE_PORTO_RED:
self.colormod = '2 1 1';
- self.alpha = 0.5;
+ self.alphamod = 0.5;
self.move_movetype = MOVETYPE_BOUNCE;
self.move_touch = SUB_Null;
break;
case PROJECTILE_PORTO_BLUE:
self.colormod = '1 1 2';
- self.alpha = 0.5;
+ self.alphamod = 0.5;
self.move_movetype = MOVETYPE_BOUNCE;
self.move_touch = SUB_Null;
break;
Modified: trunk/data/qcsrc/server/csqcprojectile.qc
===================================================================
--- trunk/data/qcsrc/server/csqcprojectile.qc 2010-01-19 07:38:43 UTC (rev 8518)
+++ trunk/data/qcsrc/server/csqcprojectile.qc 2010-01-20 07:49:01 UTC (rev 8519)
@@ -2,8 +2,10 @@
float CSQCProjectile_SendEntity(entity to, float sf)
{
+ float ft, fr;
+
// note: flag 0x20 = no trail please
- sf = sf & 0x3F;
+ sf = sf & 0x1F;
if(self.csqcprojectile_clientanimate)
sf |= 0x80; // client animated, not interpolated
@@ -11,6 +13,14 @@
if(self.flags & FL_ONGROUND)
sf |= 0x40;
+ if(self.fade_time != 0 && self.fade_rate != 0)
+ {
+ ft = (self.fade_time - time) / sys_frametime;
+ fr = (1 / self.fade_rate) / sys_frametime;
+ if(ft <= 255 && fr <= 255 && fr >= 1)
+ sf |= 0x20;
+ }
+
WriteByte(MSG_ENTITY, ENT_CLIENT_PROJECTILE);
WriteByte(MSG_ENTITY, sf);
@@ -27,11 +37,17 @@
WriteCoord(MSG_ENTITY, self.velocity_z);
WriteCoord(MSG_ENTITY, self.gravity);
}
+
+ if(sf & 0x20)
+ {
+ WriteByte(MSG_ENTITY, ft);
+ WriteByte(MSG_ENTITY, fr);
+ }
}
if(sf & 2)
WriteByte(MSG_ENTITY, self.csqcprojectile_type); // TODO maybe put this into sf?
-
+
return 1;
}
More information about the nexuiz-commits
mailing list