2 REGISTER_NET_LINKED(ENT_CLIENT_RAINSNOW)
5 bool rainsnow_SendEntity(entity this, entity to, float sf)
7 WriteHeader(MSG_ENTITY, ENT_CLIENT_RAINSNOW);
8 WriteByte(MSG_ENTITY, this.state);
9 WriteCoord(MSG_ENTITY, this.origin_x + this.mins_x);
10 WriteCoord(MSG_ENTITY, this.origin_y + this.mins_y);
11 WriteCoord(MSG_ENTITY, this.origin_z + this.mins_z);
12 WriteCoord(MSG_ENTITY, this.maxs_x - this.mins_x);
13 WriteCoord(MSG_ENTITY, this.maxs_y - this.mins_y);
14 WriteCoord(MSG_ENTITY, this.maxs_z - this.mins_z);
15 WriteShort(MSG_ENTITY, compressShortVector(this.dest));
16 WriteShort(MSG_ENTITY, this.count);
17 WriteByte(MSG_ENTITY, this.cnt);
21 /*QUAKED spawnfunc_func_rain (0 .5 .8) ?
22 This is an invisible area like a trigger, which rain falls inside of.
26 falling direction (should be something like '0 0 -700', use the X and Y velocity for wind)
28 sets color of rain (default 12 - white)
30 adjusts density, this many particles fall every second for a 1024x1024 area, default is 2000
34 this.dest = this.velocity;
35 this.velocity = '0 0 0';
37 this.dest = '0 0 -700';
38 this.angles = '0 0 0';
39 set_movetype(this, MOVETYPE_NONE);
40 this.solid = SOLID_NOT;
41 SetBrushEntityModel(this);
46 this.count = 0.01 * this.count * (this.size_x / 1024) * (this.size_y / 1024);
49 if(this.count > 65535)
52 this.state = 1; // 1 is rain, 0 is snow
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);
84 this.count = 0.01 * this.count * (this.size_x / 1024) * (this.size_y / 1024);
87 if(this.count > 65535)
90 this.state = 0; // 1 is rain, 0 is snow
93 Net_LinkEntity(this, false, 0, rainsnow_SendEntity);
96 float autocvar_cl_rainsnow_maxdrawdist = 2048;
98 void Draw_Rain(entity this)
100 vector maxdist = '1 1 0' * autocvar_cl_rainsnow_maxdrawdist;
102 if(boxesoverlap(vec2(view_origin) - maxdist, vec2(view_origin) + maxdist, vec2(this.absmin) - '0 0 5', vec2(this.absmax) + '0 0 5'))
103 //if(autocvar_cl_rainsnow_maxdrawdist <= 0 || vdist(vec2(this.origin) - vec2(this.absmin + this.absmax * 0.5), <=, autocvar_cl_rainsnow_maxdrawdist))
104 te_particlerain(this.origin + this.mins, this.origin + this.maxs, this.velocity, floor(this.count * drawframetime + random()), this.glow_color);
107 void Draw_Snow(entity this)
109 vector maxdist = '1 1 0' * autocvar_cl_rainsnow_maxdrawdist;
111 if(boxesoverlap(vec2(view_origin) - maxdist, vec2(view_origin) + maxdist, vec2(this.absmin) - '0 0 5', vec2(this.absmax) + '0 0 5'))
112 //if(autocvar_cl_rainsnow_maxdrawdist <= 0 || vdist(vec2(this.origin) - vec2(this.absmin + this.absmax * 0.5), <=, autocvar_cl_rainsnow_maxdrawdist))
113 te_particlesnow(this.origin + this.mins, this.origin + this.maxs, this.velocity, floor(this.count * drawframetime + random()), this.glow_color);
116 NET_HANDLE(ENT_CLIENT_RAINSNOW, bool isnew)
118 this.impulse = ReadByte(); // Rain, Snow, or Whatever
119 this.origin_x = ReadCoord();
120 this.origin_y = ReadCoord();
121 this.origin_z = ReadCoord();
122 this.maxs_x = ReadCoord();
123 this.maxs_y = ReadCoord();
124 this.maxs_z = ReadCoord();
125 this.velocity = decompressShortVector(ReadShort());
126 this.count = ReadShort() * 10;
127 this.glow_color = ReadByte(); // color
131 this.mins = -0.5 * this.maxs;
132 this.maxs = 0.5 * this.maxs;
133 this.origin = this.origin - this.mins;
135 setorigin(this, this.origin);
136 setsize(this, this.mins, this.maxs);
137 this.solid = SOLID_NOT;
138 if (isnew) IL_PUSH(g_drawables, this);
140 this.draw = Draw_Rain;
142 this.draw = Draw_Snow;