From: Mario Date: Fri, 4 Aug 2017 06:48:33 +0000 (+1000) Subject: Some optimizations to client side items and spawn points X-Git-Tag: xonotic-v0.8.5~2546 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=0071121b663dc3d841a2c28d27c1015899f0f402;p=xonotic%2Fxonotic-data.pk3dir.git Some optimizations to client side items and spawn points --- diff --git a/qcsrc/client/main.qc b/qcsrc/client/main.qc index c621e9fab..2e55584ed 100644 --- a/qcsrc/client/main.qc +++ b/qcsrc/client/main.qc @@ -657,6 +657,9 @@ NET_HANDLE(ENT_CLIENT_ACCURACY, bool isnew) void Spawn_Draw(entity this) { + if(this.alpha <= 0) + return; + __pointparticles(this.cnt, this.origin + '0 0 28', '0 0 2', bound(0, frametime, 0.1)); } @@ -665,7 +668,14 @@ 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); + { + if(vdist(org - this.origin, >, this.fade_end)) + alph = 0; // save on some processing + else if(vdist(org - this.origin, <, this.fade_start)) + alph = 1; // more processing saved + else + 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)); diff --git a/qcsrc/client/view.qc b/qcsrc/client/view.qc index 70de314ef..ece38598e 100644 --- a/qcsrc/client/view.qc +++ b/qcsrc/client/view.qc @@ -311,6 +311,7 @@ void viewmodel_draw(entity this) e.csqcmodel_effects = fx; CSQCModel_Effects_Apply(e); } + if(a >= 0) { string name = wep.mdl; string newname = wep.wr_viewmodel(wep, this); diff --git a/qcsrc/common/minigames/sv_minigames.qc b/qcsrc/common/minigames/sv_minigames.qc index 4f1cd5dc2..415417b46 100644 --- a/qcsrc/common/minigames/sv_minigames.qc +++ b/qcsrc/common/minigames/sv_minigames.qc @@ -28,7 +28,7 @@ void minigame_rmplayer(entity minigame_session, entity player) GameLogEcho(strcat(":minigame:part:",minigame_session.netname,":", ftos(etof(player)),":",player.netname)); minigame_session.minigame_players = p.list_next; - delete ( p ); + delete( p ); player_clear_minigame(player); } else diff --git a/qcsrc/common/monsters/monster/mage.qc b/qcsrc/common/monsters/monster/mage.qc index f6f8b803b..32383af57 100644 --- a/qcsrc/common/monsters/monster/mage.qc +++ b/qcsrc/common/monsters/monster/mage.qc @@ -120,7 +120,7 @@ void M_Mage_Attack_Spike_Explode(entity this, entity directhitentity) Send_Effect(EFFECT_EXPLOSION_SMALL, this.origin, '0 0 0', 1); RadiusDamage (this, this.realowner, (autocvar_g_monster_mage_attack_spike_damage), (autocvar_g_monster_mage_attack_spike_damage) * 0.5, (autocvar_g_monster_mage_attack_spike_radius), NULL, NULL, 0, DEATH_MONSTER_MAGE.m_id, directhitentity); - delete (this); + delete(this); } void M_Mage_Attack_Spike_Touch(entity this, entity toucher) diff --git a/qcsrc/common/mutators/mutator/overkill/rpc.qc b/qcsrc/common/mutators/mutator/overkill/rpc.qc index a09a6a637..e9a5ce2c3 100644 --- a/qcsrc/common/mutators/mutator/overkill/rpc.qc +++ b/qcsrc/common/mutators/mutator/overkill/rpc.qc @@ -10,7 +10,7 @@ void W_RocketPropelledChainsaw_Explode(entity this, entity directhitentity) RadiusDamage (this, this.realowner, WEP_CVAR(rpc, damage), WEP_CVAR(rpc, edgedamage), WEP_CVAR(rpc, radius), NULL, NULL, WEP_CVAR(rpc, force), this.projectiledeathtype, directhitentity); - delete (this); + delete(this); } void W_RocketPropelledChainsaw_Explode_think(entity this) diff --git a/qcsrc/common/t_items.qc b/qcsrc/common/t_items.qc index d85cf7861..1e5f8284c 100644 --- a/qcsrc/common/t_items.qc +++ b/qcsrc/common/t_items.qc @@ -134,10 +134,17 @@ void Item_PreDraw(entity this) } float alph; vector org = getpropertyvec(VF_ORIGIN); - if(!checkpvs(org, this)) // this makes sense as long as we don't support recursive warpzones - alph = 0; - else 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); + //if(!checkpvs(org, this)) // this makes sense as long as we don't support recursive warpzones + //alph = 0; // this shouldn't be needed, since items behind walls are culled anyway + if(this.fade_start) + { + if(vdist(org - this.origin, >, this.fade_end)) + alph = 0; // save on some processing + else if(vdist(org - this.origin, <, this.fade_start)) + alph = 1; // more processing saved + else + 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)); @@ -868,7 +875,7 @@ LABEL(pickup) _sound (toucher, (this.itemdef.instanceOfPowerup ? CH_TRIGGER_SINGLE : CH_TRIGGER), (this.item_pickupsound ? this.item_pickupsound : Sound_fixpath(this.item_pickupsound_ent)), VOL_BASE, ATTEN_NORM); if (this.classname == "droppedweapon") - delete (this); + delete(this); else if (this.spawnshieldtime) { entity e; @@ -1172,7 +1179,7 @@ void _StartItem(entity this, entity def, float defaultrespawntime, float default if(!have_pickup_item(this)) { startitem_failed = true; - delete (this); + delete(this); return; } @@ -1210,7 +1217,7 @@ void _StartItem(entity this, entity def, float defaultrespawntime, float default // target_give not yet supported; maybe later print("removed targeted ", this.classname, "\n"); startitem_failed = true; - remove (this); + delete(this); return; } */ diff --git a/qcsrc/common/triggers/subs.qc b/qcsrc/common/triggers/subs.qc index 18fab59d1..5b6182e0a 100644 --- a/qcsrc/common/triggers/subs.qc +++ b/qcsrc/common/triggers/subs.qc @@ -41,7 +41,7 @@ void SUB_VanishOrRemove (entity ent) else { // remove - delete (ent); + delete(ent); } } diff --git a/qcsrc/common/triggers/trigger/multi.qc b/qcsrc/common/triggers/trigger/multi.qc index 808d08101..5e8c641be 100644 --- a/qcsrc/common/triggers/trigger/multi.qc +++ b/qcsrc/common/triggers/trigger/multi.qc @@ -54,7 +54,7 @@ void multi_trigger(entity this) multi_wait(this); // waiting finished } else - { // we can't just remove (this) here, because this is a touch function + { // we can't just delete(this) here, because this is a touch function // called while C code is looping through area links... settouch(this, func_null); } diff --git a/qcsrc/common/triggers/trigger/secret.qc b/qcsrc/common/triggers/trigger/secret.qc index 1c0a328a1..c3c2c7474 100644 --- a/qcsrc/common/triggers/trigger/secret.qc +++ b/qcsrc/common/triggers/trigger/secret.qc @@ -34,7 +34,7 @@ void trigger_secret_touch(entity this, entity toucher) // handle normal trigger features multi_touch(this, toucher); - // we can't just remove (this) here, because this is a touch function + // we can't just delete(this) here, because this is a touch function // called while C code is looping through area links... //delete(this); } diff --git a/qcsrc/common/turrets/turret/walker.qc b/qcsrc/common/turrets/turret/walker.qc index d8c0a675d..2f651589d 100644 --- a/qcsrc/common/turrets/turret/walker.qc +++ b/qcsrc/common/turrets/turret/walker.qc @@ -78,7 +78,7 @@ void walker_setnoanim(entity this) void walker_rocket_explode(entity this) { RadiusDamage (this, this.owner, (autocvar_g_turrets_unit_walker_rocket_damage), 0, (autocvar_g_turrets_unit_walker_rocket_radius), this, NULL, (autocvar_g_turrets_unit_walker_rocket_force), DEATH_TURRET_WALK_ROCKET.m_id, NULL); - delete (this); + delete(this); } void walker_rocket_touch(entity this, entity toucher) diff --git a/qcsrc/common/vehicles/sv_vehicles.qc b/qcsrc/common/vehicles/sv_vehicles.qc index 47991b423..1fbd80210 100644 --- a/qcsrc/common/vehicles/sv_vehicles.qc +++ b/qcsrc/common/vehicles/sv_vehicles.qc @@ -234,7 +234,7 @@ void vehicles_projectile_explode(entity this, entity toucher) this.event_damage = func_null; RadiusDamage (this, this.realowner, this.shot_dmg, 0, this.shot_radius, this, NULL, this.shot_force, this.totalfrags, toucher); - delete (this); + delete(this); } void vehicles_projectile_explode_think(entity this)