1 REGISTER_NET_LINKED(ENT_CLIENT_RAINSNOW)
4 bool rainsnow_SendEntity(entity this, entity to, float sf)
6 WriteHeader(MSG_ENTITY, ENT_CLIENT_RAINSNOW);
7 WriteByte(MSG_ENTITY, this.state);
8 WriteCoord(MSG_ENTITY, this.origin_x + this.mins_x);
9 WriteCoord(MSG_ENTITY, this.origin_y + this.mins_y);
10 WriteCoord(MSG_ENTITY, this.origin_z + this.mins_z);
11 WriteCoord(MSG_ENTITY, this.maxs_x - this.mins_x);
12 WriteCoord(MSG_ENTITY, this.maxs_y - this.mins_y);
13 WriteCoord(MSG_ENTITY, this.maxs_z - this.mins_z);
14 WriteShort(MSG_ENTITY, compressShortVector(this.dest));
15 WriteShort(MSG_ENTITY, this.count);
16 WriteByte(MSG_ENTITY, this.cnt);
20 /*QUAKED spawnfunc_func_rain (0 .5 .8) ?
21 This is an invisible area like a trigger, which rain falls inside of.
25 falling direction (should be something like '0 0 -700', use the X and Y velocity for wind)
27 sets color of rain (default 12 - white)
29 adjusts density, this many particles fall every second for a 1024x1024 area, default is 2000
33 this.dest = this.velocity;
34 this.velocity = '0 0 0';
36 this.dest = '0 0 -700';
37 this.angles = '0 0 0';
38 set_movetype(this, MOVETYPE_NONE);
39 this.solid = SOLID_NOT;
40 SetBrushEntityModel(this);
45 this.count = 0.01 * this.count * (this.size_x / 1024) * (this.size_y / 1024);
48 if(this.count > 65535)
51 this.state = 1; // 1 is rain, 0 is snow
54 Net_LinkEntity(this, false, 0, rainsnow_SendEntity);
58 /*QUAKED spawnfunc_func_snow (0 .5 .8) ?
59 This is an invisible area like a trigger, which snow falls inside of.
63 falling direction (should be something like '0 0 -300', use the X and Y velocity for wind)
65 sets color of rain (default 12 - white)
67 adjusts density, this many particles fall every second for a 1024x1024 area, default is 2000
71 this.dest = this.velocity;
72 this.velocity = '0 0 0';
74 this.dest = '0 0 -300';
75 this.angles = '0 0 0';
76 set_movetype(this, MOVETYPE_NONE);
77 this.solid = SOLID_NOT;
78 SetBrushEntityModel(this);
83 this.count = 0.01 * this.count * (this.size_x / 1024) * (this.size_y / 1024);
86 if(this.count > 65535)
89 this.state = 0; // 1 is rain, 0 is snow
92 Net_LinkEntity(this, false, 0, rainsnow_SendEntity);
95 float autocvar_cl_rainsnow_maxdrawdist = 2048;
97 void Draw_Rain(entity this)
99 vector maxdist = '1 1 0' * autocvar_cl_rainsnow_maxdrawdist;
101 if(boxesoverlap(vec2(view_origin) - maxdist, vec2(view_origin) + maxdist, vec2(this.absmin) - '0 0 5', vec2(this.absmax) + '0 0 5'))
102 //if(autocvar_cl_rainsnow_maxdrawdist <= 0 || vdist(vec2(this.origin) - vec2(this.absmin + this.absmax * 0.5), <=, autocvar_cl_rainsnow_maxdrawdist))
103 te_particlerain(this.origin + this.mins, this.origin + this.maxs, this.velocity, floor(this.count * drawframetime + random()), this.glow_color);
106 void Draw_Snow(entity this)
108 vector maxdist = '1 1 0' * autocvar_cl_rainsnow_maxdrawdist;
110 if(boxesoverlap(vec2(view_origin) - maxdist, vec2(view_origin) + maxdist, vec2(this.absmin) - '0 0 5', vec2(this.absmax) + '0 0 5'))
111 //if(autocvar_cl_rainsnow_maxdrawdist <= 0 || vdist(vec2(this.origin) - vec2(this.absmin + this.absmax * 0.5), <=, autocvar_cl_rainsnow_maxdrawdist))
112 te_particlesnow(this.origin + this.mins, this.origin + this.maxs, this.velocity, floor(this.count * drawframetime + random()), this.glow_color);
115 NET_HANDLE(ENT_CLIENT_RAINSNOW, bool isnew)
117 this.impulse = ReadByte(); // Rain, Snow, or Whatever
118 this.origin_x = ReadCoord();
119 this.origin_y = ReadCoord();
120 this.origin_z = ReadCoord();
121 this.maxs_x = ReadCoord();
122 this.maxs_y = ReadCoord();
123 this.maxs_z = ReadCoord();
124 this.velocity = decompressShortVector(ReadShort());
125 this.count = ReadShort() * 10;
126 this.glow_color = ReadByte(); // color
130 this.mins = -0.5 * this.maxs;
131 this.maxs = 0.5 * this.maxs;
132 this.origin = this.origin - this.mins;
134 setorigin(this, this.origin);
135 setsize(this, this.mins, this.maxs);
136 this.solid = SOLID_NOT;
138 this.draw = Draw_Rain;
140 this.draw = Draw_Snow;