From: Mario Date: Sun, 19 Jan 2020 00:07:53 +0000 (+1000) Subject: Fix rainsnow logic, thanks to Player_2 X-Git-Tag: xonotic-v0.8.5~1161^2~4^2~3 X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=commitdiff_plain;h=2257bd2055320e2c495a96dc518d59dd1f8d00ae Fix rainsnow logic, thanks to Player_2 --- diff --git a/qcsrc/common/mapobjects/func/rainsnow.qc b/qcsrc/common/mapobjects/func/rainsnow.qc index 12dd6d28c3..4e8df8c757 100644 --- a/qcsrc/common/mapobjects/func/rainsnow.qc +++ b/qcsrc/common/mapobjects/func/rainsnow.qc @@ -95,38 +95,25 @@ spawnfunc(func_snow) Net_LinkEntity(this, false, 0, rainsnow_SendEntity); } #elif defined(CSQC) -float autocvar_cl_rainsnow_maxdrawdist = 2048; +float autocvar_cl_rainsnow_maxdrawdist = 500; -void Draw_Rain(entity this) +void Draw_RainSnow(entity this) { vector maxdist = '1 1 1' * autocvar_cl_rainsnow_maxdrawdist; vector effbox_min = vec_to_max(view_origin - maxdist, this.origin + this.mins); vector effbox_max = vec_to_min(view_origin + maxdist, this.origin + this.maxs); - vector mysize = effbox_min + effbox_max; + vector mysize = effbox_max - effbox_min; float mycount = bound(1, 0.1 * this.count * (mysize.x / 1024) * (mysize.y / 1024), 65535); - //LOG_INFO(ftos(mycount)); if(boxesoverlap(view_origin - maxdist, view_origin + maxdist, this.absmin, this.absmax)) // optimisation: don't render any rain if the player is outside the view distance - //if(autocvar_cl_rainsnow_maxdrawdist <= 0 || vdist(vec2(this.origin) - vec2(this.absmin + this.absmax * 0.5), <=, autocvar_cl_rainsnow_maxdrawdist)) - te_particlerain(effbox_min, effbox_max, this.velocity, floor(mycount * drawframetime + random()), this.glow_color); -} - -void Draw_Snow(entity this) -{ - vector maxdist = '1 1 1' * autocvar_cl_rainsnow_maxdrawdist; - - vector effbox_min = vec_to_max(view_origin - maxdist, this.origin + this.mins); - vector effbox_max = vec_to_min(view_origin + maxdist, this.origin + this.maxs); - - vector mysize = effbox_min + effbox_max; - float mycount = bound(1, 0.1 * this.count * (mysize.x / 1024) * (mysize.y / 1024), 65535); - //LOG_INFO(ftos(mycount)); - - if(boxesoverlap(view_origin - maxdist, view_origin + maxdist, this.absmin, this.absmax)) - //if(autocvar_cl_rainsnow_maxdrawdist <= 0 || vdist(vec2(this.origin) - vec2(this.absmin + this.absmax * 0.5), <=, autocvar_cl_rainsnow_maxdrawdist)) - te_particlesnow(effbox_min, effbox_max, this.velocity, floor(mycount * drawframetime + random()), this.glow_color); + { + if(this.state == RAINSNOW_RAIN) + te_particlerain(effbox_min, effbox_max, this.velocity, floor(mycount * drawframetime + random()), this.glow_color); + else + te_particlesnow(effbox_min, effbox_max, this.velocity, floor(mycount * drawframetime + random()), this.glow_color); + } } NET_HANDLE(ENT_CLIENT_RAINSNOW, bool isnew) @@ -148,9 +135,6 @@ NET_HANDLE(ENT_CLIENT_RAINSNOW, bool isnew) setsize(this, this.mins, this.maxs); this.solid = SOLID_NOT; if (isnew) IL_PUSH(g_drawables, this); - if(this.state == RAINSNOW_RAIN) - this.draw = Draw_Rain; - else - this.draw = Draw_Snow; + this.draw = Draw_RainSnow; } #endif diff --git a/xonotic-client.cfg b/xonotic-client.cfg index 786a69a28b..59bb37229e 100644 --- a/xonotic-client.cfg +++ b/xonotic-client.cfg @@ -801,7 +801,7 @@ r_fullbright_directed 1 r_water_hideplayer 1 // hide your own feet/player model in refraction views, this way you don't see half of your body under water r_water_refractdistort 0.003 -set cl_rainsnow_maxdrawdist 2048 +set cl_rainsnow_maxdrawdist 500 // safe font defaults r_font_hinting 1