r4190 - in trunk/data/qcsrc: client common server
DONOTREPLY at icculus.org
DONOTREPLY at icculus.org
Tue Aug 26 07:25:10 EDT 2008
Author: div0
Date: 2008-08-26 07:25:05 -0400 (Tue, 26 Aug 2008)
New Revision: 4190
Modified:
trunk/data/qcsrc/client/particles.qc
trunk/data/qcsrc/common/constants.qh
trunk/data/qcsrc/server/g_triggers.qc
Log:
(untested) make rain and snow client side entities
Modified: trunk/data/qcsrc/client/particles.qc
===================================================================
--- trunk/data/qcsrc/client/particles.qc 2008-08-26 11:05:47 UTC (rev 4189)
+++ trunk/data/qcsrc/client/particles.qc 2008-08-26 11:25:05 UTC (rev 4190)
@@ -121,3 +121,39 @@
self.solid = SOLID_NOT;
self.draw = Draw_PointParticles;
}
+
+void Draw_Rain()
+{
+ te_particlerain(self.origin + self.mins, self.origin + self.maxs, self.velocity, self.count * drawframetime, self.glow_color);
+}
+
+void Draw_Snow()
+{
+ te_particlesnow(self.origin + self.mins, self.origin + self.maxs, self.velocity, self.count * drawframetime, self.glow_color);
+}
+
+void Ent_RainOrSnow()
+{
+ self.impulse = ReadByte(); // Rain, Snow, or Whatever
+ self.origin_x = ReadCoord();
+ self.origin_y = ReadCoord();
+ self.origin_z = ReadCoord();
+ self.maxs_x = ReadCoord();
+ self.maxs_y = ReadCoord();
+ self.maxs_z = ReadCoord();
+ self.velocity = decompressShortVector(ReadShort());
+ self.count = ReadShort() * 10;
+ self.glow_color = ReadByte(); // color
+
+ self.mins = -0.5 * self.maxs;
+ self.maxs = 0.5 * self.maxs;
+ self.origin = self.origin - self.mins;
+
+ setorigin(self, self.origin);
+ setsize(self, self.mins, self.maxs);
+ self.solid = SOLID_NOT;
+ if(self.impulse)
+ self.draw = Draw_Rain;
+ else
+ self.draw = Draw_Snow;
+}
Modified: trunk/data/qcsrc/common/constants.qh
===================================================================
--- trunk/data/qcsrc/common/constants.qh 2008-08-26 11:05:47 UTC (rev 4189)
+++ trunk/data/qcsrc/common/constants.qh 2008-08-26 11:25:05 UTC (rev 4190)
@@ -40,6 +40,7 @@
const float ENT_CLIENT_SCORES = 4;
const float ENT_CLIENT_TEAMSCORES = 5;
const float ENT_CLIENT_POINTPARTICLES = 6;
+const float ENT_CLIENT_RAINSNOW = 7;
///////////////////////////
// key constants
Modified: trunk/data/qcsrc/server/g_triggers.qc
===================================================================
--- trunk/data/qcsrc/server/g_triggers.qc 2008-08-26 11:05:47 UTC (rev 4189)
+++ trunk/data/qcsrc/server/g_triggers.qc 2008-08-26 11:25:05 UTC (rev 4190)
@@ -512,7 +512,7 @@
return 1;
}
-float pointparticles_use()
+void pointparticles_use()
{
if(self.wait && time < self.nextthink)
{
@@ -526,7 +526,7 @@
self.Version += 1;
}
-float pointparticles_think()
+void pointparticles_think()
{
self.state = !self.state;
self.Version += 1;
@@ -584,18 +584,20 @@
spawnfunc_func_pointparticles();
}
-void rain_think()
+float rainsnow_SendEntity(float to)
{
- self.nextthink = time + 0.1;
- te_particlerain(self.absmin, self.absmax, self.dest, self.count, self.cnt);
-// te_particlesnow(self.absmin, self.absmax, self.dest * 0.25, self.count, self.cnt);
-// WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
-// WriteByte (MSG_BROADCAST, TE_PARTICLERAIN);
-// WriteVec (MSG_BROADCAST, self.absmin);
-// WriteVec (MSG_BROADCAST, self.absmax);
-// WriteVec (MSG_BROADCAST, self.dest);
-// WriteShort (MSG_BROADCAST, self.count);
-// WriteByte (MSG_BROADCAST, self.cnt);
+ WriteByte(MSG_ENTITY, ENT_CLIENT_RAINSNOW);
+ WriteByte(MSG_ENTITY, self.state);
+ WriteCoord(MSG_ENTITY, self.origin_x + self.mins_x);
+ WriteCoord(MSG_ENTITY, self.origin_y + self.mins_y);
+ WriteCoord(MSG_ENTITY, self.origin_z + self.mins_z);
+ WriteCoord(MSG_ENTITY, self.maxs_x - self.mins_x);
+ WriteCoord(MSG_ENTITY, self.maxs_y - self.mins_y);
+ WriteCoord(MSG_ENTITY, self.maxs_z - self.mins_z);
+ WriteShort(MSG_ENTITY, compressShortVector(self.dest));
+ WriteShort(MSG_ENTITY, self.count);
+ WriteByte(MSG_ENTITY, self.cnt);
+ return 1;
};
/*QUAKED spawnfunc_func_rain (0 .5 .8) ?
@@ -630,26 +632,18 @@
remove(self);
return;
}
- // convert from per second to per 0.1 sec,
- self.count = ceil(self.count * 0.1);
- self.think = rain_think;
- self.nextthink = time + 0.5;
-};
+ if(self.count > 65535)
+ self.count = 65535;
-
-void snow_think()
-{
- self.nextthink = time + 0.1 + random() * 0.05;
- te_particlesnow(self.absmin, self.absmax, self.dest, self.count, self.cnt);
-// WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
-// WriteByte (MSG_BROADCAST, TE_PARTICLESNOW);
-// WriteVec (MSG_BROADCAST, self.absmin);
-// WriteVec (MSG_BROADCAST, self.absmax);
-// WriteVec (MSG_BROADCAST, self.dest);
-// WriteShort (MSG_BROADCAST, self.count);
-// WriteByte (MSG_BROADCAST, self.cnt);
+ self.state = 1; // 1 is rain, 0 is snow
+ self.effects = EF_NODEPTHTEST;
+ self.SendEntity = rainsnow_SendEntity;
+ self.Version = 1;
+ self.modelindex = 1;
+ self.model = "net_entity";
};
+
/*QUAKED spawnfunc_func_snow (0 .5 .8) ?
This is an invisible area like a trigger, which snow falls inside of.
@@ -676,16 +670,21 @@
self.cnt = 12;
if (!self.count)
self.count = 2000;
- self.count = 0.1 * self.count * (self.size_x / 1024) * (self.size_y / 1024);
+ self.count = 0.01 * self.count * (self.size_x / 1024) * (self.size_y / 1024);
if (self.count < 1)
{
remove(self);
return;
}
- // convert from per second to per 0.1 sec,
- self.count = ceil(self.count * 0.1);
- self.think = snow_think;
- self.nextthink = time + 0.5;
+ if(self.count > 65535)
+ self.count = 65535;
+
+ self.state = 0; // 1 is rain, 0 is snow
+ self.effects = EF_NODEPTHTEST;
+ self.SendEntity = rainsnow_SendEntity;
+ self.Version = 1;
+ self.modelindex = 1;
+ self.model = "net_entity";
};
More information about the nexuiz-commits
mailing list