From: Mario Date: Thu, 3 Mar 2016 11:40:03 +0000 (+1000) Subject: Don't draw distant spawn points, improves FPS on larger maps X-Git-Tag: xonotic-v0.8.2~1160 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=729d0cd9594fafce8a44a4b2ce131645cf51883f;p=xonotic%2Fxonotic-data.pk3dir.git Don't draw distant spawn points, improves FPS on larger maps --- diff --git a/qcsrc/client/autocvars.qh b/qcsrc/client/autocvars.qh index 49cafb896..cbee59e90 100644 --- a/qcsrc/client/autocvars.qh +++ b/qcsrc/client/autocvars.qh @@ -72,6 +72,8 @@ bool autocvar_cl_spawn_event_particles; bool autocvar_cl_spawn_event_sound = 1; // float autocvar_cl_spawn_point_model; bool autocvar_cl_spawn_point_particles; +float autocvar_cl_spawn_point_dist_min = 1200; +float autocvar_cl_spawn_point_dist_max = 1600; bool autocvar_cl_spawnzoom = 1; float autocvar_cl_spawnzoom_speed = 1; float autocvar_cl_spawnzoom_factor = 2; diff --git a/qcsrc/client/main.qc b/qcsrc/client/main.qc index 14279816e..5984aba93 100644 --- a/qcsrc/client/main.qc +++ b/qcsrc/client/main.qc @@ -676,6 +676,22 @@ void Spawn_Draw(entity this) __pointparticles(this.cnt, this.origin + '0 0 28', '0 0 2', bound(0, frametime, 0.1)); } +void Spawn_PreDraw(entity this) +{ + float alph; + vector org = getpropertyvec(VF_ORIGIN); + if(this.fade_start) + alph = bound(0, (this.fade_end - vlen(org - this.origin - 0.5 * (this.mins + this.maxs))) / (this.fade_end - this.fade_start), 1); + else + alph = 1; + //printf("%v <-> %v\n", view_origin, this.origin + 0.5 * (this.mins + this.maxs)); + this.alpha = alph; + if(alph <= 0) + this.drawmask = 0; + else + this.drawmask = MASK_NORMAL; +} + NET_HANDLE(ENT_CLIENT_SPAWNPOINT, bool is_new) { float teamnum = (ReadByte() - 1); @@ -716,6 +732,9 @@ NET_HANDLE(ENT_CLIENT_SPAWNPOINT, bool is_new) else { this.cnt = particleeffectnum(EFFECT_SPAWNPOINT_NEUTRAL); } this.draw = Spawn_Draw; + setpredraw(this, Spawn_PreDraw); + this.fade_start = autocvar_cl_spawn_point_dist_min; + this.fade_end = autocvar_cl_spawn_point_dist_max; } //}