]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/triggers/func/rainsnow.qc
Draw: purge SELFPARAM
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / triggers / func / rainsnow.qc
index 61922f4343690617f27910e442e887faea847c49..18c2c0a0fb91c9cb9adecb5fc5bb5a253530e93b 100644 (file)
@@ -1,5 +1,5 @@
 #ifdef SVQC
-float rainsnow_SendEntity(entity to, float sf)
+bool rainsnow_SendEntity(entity this, entity to, float sf)
 {
        WriteByte(MSG_ENTITY, ENT_CLIENT_RAINSNOW);
        WriteByte(MSG_ENTITY, self.state);
@@ -12,7 +12,7 @@ float rainsnow_SendEntity(entity to, float sf)
        WriteShort(MSG_ENTITY, compressShortVector(self.dest));
        WriteShort(MSG_ENTITY, self.count);
        WriteByte(MSG_ENTITY, self.cnt);
-       return 1;
+       return true;
 }
 
 /*QUAKED spawnfunc_func_rain (0 .5 .8) ?
@@ -26,7 +26,7 @@ Keys:
 "count"
  adjusts density, this many particles fall every second for a 1024x1024 area, default is 2000
 */
-void spawnfunc_func_rain()
+spawnfunc(func_rain)
 {
        self.dest = self.velocity;
        self.velocity = '0 0 0';
@@ -49,7 +49,7 @@ void spawnfunc_func_rain()
        self.state = 1; // 1 is rain, 0 is snow
        self.Version = 1;
 
-       Net_LinkEntity(self, FALSE, 0, rainsnow_SendEntity);
+       Net_LinkEntity(self, false, 0, rainsnow_SendEntity);
 }
 
 
@@ -64,7 +64,7 @@ Keys:
 "count"
  adjusts density, this many particles fall every second for a 1024x1024 area, default is 2000
 */
-void spawnfunc_func_snow()
+spawnfunc(func_snow)
 {
        self.dest = self.velocity;
        self.velocity = '0 0 0';
@@ -87,6 +87,42 @@ void spawnfunc_func_snow()
        self.state = 0; // 1 is rain, 0 is snow
        self.Version = 1;
 
-       Net_LinkEntity(self, FALSE, 0, rainsnow_SendEntity);
+       Net_LinkEntity(self, false, 0, rainsnow_SendEntity);
+}
+#elif defined(CSQC)
+void Draw_Rain(entity this)
+{
+    te_particlerain(self.origin + self.mins, self.origin + self.maxs, self.velocity, floor(self.count * drawframetime + random()), self.glow_color);
+}
+
+void Draw_Snow(entity this)
+{
+    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