2 REGISTER_NET_LINKED(ENT_CLIENT_RAINSNOW)
5 bool rainsnow_SendEntity(entity this, entity to, float sf)
7 vector myorg = this.origin + this.mins;
8 vector mysize = this.maxs - this.mins;
9 WriteHeader(MSG_ENTITY, ENT_CLIENT_RAINSNOW);
10 WriteByte(MSG_ENTITY, this.state);
11 WriteVector(MSG_ENTITY, myorg);
12 WriteVector(MSG_ENTITY, mysize);
13 WriteShort(MSG_ENTITY, compressShortVector(this.dest));
14 WriteShort(MSG_ENTITY, this.count);
15 WriteByte(MSG_ENTITY, this.cnt);
19 /*QUAKED spawnfunc_func_rain (0 .5 .8) ?
20 This is an invisible area like a trigger, which rain falls inside of.
24 falling direction (should be something like '0 0 -700', use the X and Y velocity for wind)
26 sets color of rain (default 12 - white)
28 adjusts density, this many particles fall every second for a 1024x1024 area, default is 2000
32 this.dest = this.velocity;
33 this.velocity = '0 0 0';
35 this.dest = '0 0 -700';
36 this.angles = '0 0 0';
37 set_movetype(this, MOVETYPE_NONE);
38 this.solid = SOLID_NOT;
39 SetBrushEntityModel(this);
46 // relative to absolute particle count
47 this.count = this.count * (this.size_x / 1024) * (this.size_y / 1024);
50 if(this.count > 65535)
53 this.state = RAINSNOW_RAIN;
55 Net_LinkEntity(this, false, 0, rainsnow_SendEntity);
59 /*QUAKED spawnfunc_func_snow (0 .5 .8) ?
60 This is an invisible area like a trigger, which snow falls inside of.
64 falling direction (should be something like '0 0 -300', use the X and Y velocity for wind)
66 sets color of rain (default 12 - white)
68 adjusts density, this many particles fall every second for a 1024x1024 area, default is 2000
72 this.dest = this.velocity;
73 this.velocity = '0 0 0';
75 this.dest = '0 0 -300';
76 this.angles = '0 0 0';
77 set_movetype(this, MOVETYPE_NONE);
78 this.solid = SOLID_NOT;
79 SetBrushEntityModel(this);
86 // relative to absolute particle count
87 this.count = this.count * (this.size_x / 1024) * (this.size_y / 1024);
90 if(this.count > 65535)
93 this.state = RAINSNOW_SNOW;
95 Net_LinkEntity(this, false, 0, rainsnow_SendEntity);
98 float autocvar_cl_rainsnow_maxdrawdist = 2048;
100 void Draw_Rain(entity this)
102 vector maxdist = '1 1 0' * autocvar_cl_rainsnow_maxdrawdist;
104 if(boxesoverlap(vec2(view_origin) - maxdist, vec2(view_origin) + maxdist, vec2(this.absmin) - '0 0 5', vec2(this.absmax) + '0 0 5'))
105 //if(autocvar_cl_rainsnow_maxdrawdist <= 0 || vdist(vec2(this.origin) - vec2(this.absmin + this.absmax * 0.5), <=, autocvar_cl_rainsnow_maxdrawdist))
106 te_particlerain(this.origin + this.mins, this.origin + this.maxs, this.velocity, floor(this.count * drawframetime + random()), this.glow_color);
109 void Draw_Snow(entity this)
111 vector maxdist = '1 1 0' * autocvar_cl_rainsnow_maxdrawdist;
113 if(boxesoverlap(vec2(view_origin) - maxdist, vec2(view_origin) + maxdist, vec2(this.absmin) - '0 0 5', vec2(this.absmax) + '0 0 5'))
114 //if(autocvar_cl_rainsnow_maxdrawdist <= 0 || vdist(vec2(this.origin) - vec2(this.absmin + this.absmax * 0.5), <=, autocvar_cl_rainsnow_maxdrawdist))
115 te_particlesnow(this.origin + this.mins, this.origin + this.maxs, this.velocity, floor(this.count * drawframetime + random()), this.glow_color);
118 NET_HANDLE(ENT_CLIENT_RAINSNOW, bool isnew)
120 this.state = ReadByte(); // Rain, Snow, or Whatever
121 this.origin = ReadVector();
122 this.maxs = ReadVector();
123 this.velocity = decompressShortVector(ReadShort());
124 this.count = ReadShort();
125 this.glow_color = ReadByte(); // color
129 this.mins = -0.5 * this.maxs;
130 this.maxs = 0.5 * this.maxs;
131 this.origin = this.origin - this.mins;
133 setorigin(this, this.origin);
134 setsize(this, this.mins, this.maxs);
135 this.solid = SOLID_NOT;
136 if (isnew) IL_PUSH(g_drawables, this);
137 if(this.state == RAINSNOW_RAIN)
138 this.draw = Draw_Rain;
140 this.draw = Draw_Snow;