]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/triggers/func/rainsnow.qc
Merge branch 'terencehill/obsolete_cvars_removal' into 'master'
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / triggers / func / rainsnow.qc
index e86b1568249f2a11aaa4e3510bdb6ddfd3d83814..8c00f9ce21fc2c8c828fdee03e66370fd22b1cdb 100644 (file)
@@ -1,6 +1,6 @@
 #ifdef SVQC
 float rainsnow_SendEntity(entity to, float sf)
-{
+{SELFPARAM();
        WriteByte(MSG_ENTITY, ENT_CLIENT_RAINSNOW);
        WriteByte(MSG_ENTITY, self.state);
        WriteCoord(MSG_ENTITY, self.origin_x + self.mins_x);
@@ -27,7 +27,7 @@ Keys:
  adjusts density, this many particles fall every second for a 1024x1024 area, default is 2000
 */
 void spawnfunc_func_rain()
-{
+{SELFPARAM();
        self.dest = self.velocity;
        self.velocity = '0 0 0';
        if (!self.dest)
@@ -65,7 +65,7 @@ Keys:
  adjusts density, this many particles fall every second for a 1024x1024 area, default is 2000
 */
 void spawnfunc_func_snow()
-{
+{SELFPARAM();
        self.dest = self.velocity;
        self.velocity = '0 0 0';
        if (!self.dest)
@@ -89,4 +89,40 @@ void spawnfunc_func_snow()
 
        Net_LinkEntity(self, false, 0, rainsnow_SendEntity);
 }
+#elif defined(CSQC)
+void Draw_Rain()
+{SELFPARAM();
+    te_particlerain(self.origin + self.mins, self.origin + self.maxs, self.velocity, floor(self.count * drawframetime + random()), self.glow_color);
+}
+
+void Draw_Snow()
+{SELFPARAM();
+    te_particlesnow(self.origin + self.mins, self.origin + self.maxs, self.velocity, floor(self.count * drawframetime + random()), self.glow_color);
+}
+
+void Ent_RainOrSnow()
+{SELFPARAM();
+       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;
+}
 #endif