]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Some optimizations to client side items and spawn points
authorMario <mario@smbclan.net>
Fri, 4 Aug 2017 06:48:33 +0000 (16:48 +1000)
committerMario <mario@smbclan.net>
Fri, 4 Aug 2017 06:49:54 +0000 (16:49 +1000)
qcsrc/client/main.qc
qcsrc/client/view.qc
qcsrc/common/minigames/sv_minigames.qc
qcsrc/common/monsters/monster/mage.qc
qcsrc/common/mutators/mutator/overkill/rpc.qc
qcsrc/common/t_items.qc
qcsrc/common/triggers/subs.qc
qcsrc/common/triggers/trigger/multi.qc
qcsrc/common/triggers/trigger/secret.qc
qcsrc/common/turrets/turret/walker.qc
qcsrc/common/vehicles/sv_vehicles.qc

index c621e9fab3c9bf3f9024e2f0603aa7ac7dce5d26..2e55584eda8b0941bbe1ee78c484c879d2c02693 100644 (file)
@@ -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));
index 70de314efd34b8a8259ec77d38267feac012d234..ece38598ecc96dd42dc7792f70d974fdac5851c3 100644 (file)
@@ -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);
index 4f1cd5dc2d9975bff6419159559e7ece0f3cf2e4..415417b465f627ec1f3420e6c35e7291d08e401b 100644 (file)
@@ -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
index f6f8b803ba69276f5d4bd0964285137b218b6348..32383af5718e78fa530de6d2e44b620d0e7603ac 100644 (file)
@@ -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)
index a09a6a637c1da3306d46c6901536514ce8da2b4f..e9a5ce2c3fc01b3a39a0ab055234b5f23170b4fd 100644 (file)
@@ -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)
index d85cf7861478c33e8b4451e8e624cb5f30c7d9c5..1e5f8284cb3b2bcdd5c9da1fd841dfc5a86a90f3 100644 (file)
@@ -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;
                }
                */
index 18fab59d1c47fce70488280c7c8c93b83057e7a0..5b6182e0ab8574877e11f8432a316bcf41e94aa3 100644 (file)
@@ -41,7 +41,7 @@ void SUB_VanishOrRemove (entity ent)
        else
        {
                // remove
-               delete (ent);
+               delete(ent);
        }
 }
 
index 808d08101b120ca18ced191749a3de141f4b29d2..5e8c641be542735efe020f155f2d7ff556f7dcbc 100644 (file)
@@ -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);
        }
index 1c0a328a13a21d638fa5b4347829ecde721a4121..c3c2c7474e6983b071464d04cc59ea45bbb47c1f 100644 (file)
@@ -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);
 }
index d8c0a675d5c0b1175be5a3f6d79c6e086df88f3d..2f651589d76728a611f7325ddaf3f683345a0f30 100644 (file)
@@ -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)
index 47991b42391a902793e4cf62a4f815d8c38653a1..1fbd80210475debd33e63fc5823ca4dd114214bb 100644 (file)
@@ -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)