]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Improve FPS by a lot
authorMario <mario@smbclan.net>
Sun, 24 Jul 2016 07:01:08 +0000 (17:01 +1000)
committerMario <mario@smbclan.net>
Sun, 24 Jul 2016 07:01:08 +0000 (17:01 +1000)
qcsrc/client/view.qc
qcsrc/common/mutators/mutator/itemstime.qc
qcsrc/common/turrets/sv_turrets.qc
qcsrc/lib/warpzone/server.qc
qcsrc/server/mutators/mutator/gamemode_assault.qc

index 4ca30d4a8de656478a7bc75ebf54ee4b33c9b73b..3b52de90d3c561cecc1af16b996a32d37369cc24 100644 (file)
@@ -1847,7 +1847,10 @@ void CSQC_UpdateView(entity this, float w, float h)
           mousepos = mousepos*0.5 + getmousepos();
         */
 
-       FOREACH_ENTITY(it.draw, it.draw(it));
+       FOREACH_ENTITY_FLOAT(pure_data, false,
+       {
+               if(it.draw) { it.draw(it); }
+       });
 
        addentities(MASK_NORMAL | MASK_ENGINE | MASK_ENGINEVIEWMODELS);
        renderscene();
@@ -2177,7 +2180,10 @@ void CSQC_UpdateView(entity this, float w, float h)
          } else */
 
        // draw 2D entities
-       FOREACH_ENTITY(it.draw2d, it.draw2d(it));
+       FOREACH_ENTITY_FLOAT(pure_data, false,
+       {
+               if(it.draw2d) { it.draw2d(it); }
+       });
        Draw_ShowNames_All();
        Debug_Draw();
 
index 1c4de9a4e2f5104d61cd6948c84f9452bb8ee91c..a504c9b1e950053e82cfd79e0f5ef0e87d4c9c5b 100644 (file)
@@ -136,13 +136,16 @@ void Item_ItemsTime_SetTimesForAllPlayers()
 float Item_ItemsTime_UpdateTime(entity e, float t)
 {
     bool isavailable = (t == 0);
-    FOREACH_ENTITY(it.itemdef == e.itemdef || ((e.weapons & WEPSET_SUPERWEAPONS) && (it.weapons & WEPSET_SUPERWEAPONS) && clienttype(it) == CLIENTTYPE_NOTACLIENT), LAMBDA(
+    FOREACH_ENTITY_FLOAT(pure_data, false,
+    {
+        if(!(it.itemdef == e.itemdef || ((e.weapons & WEPSET_SUPERWEAPONS) && (it.weapons & WEPSET_SUPERWEAPONS) && clienttype(it) == CLIENTTYPE_NOTACLIENT)))
+            continue;
         if (e == it) continue;
         if (it.scheduledrespawntime <= time)
             isavailable = true;
         else if (t == 0 || it.scheduledrespawntime < t)
             t = it.scheduledrespawntime;
-    ));
+    });
     if (isavailable)
         t = -t; // let know the client there's another available item
     return t;
@@ -153,9 +156,12 @@ MUTATOR_HOOKFUNCTION(itemstime, reset_map_global)
     Item_ItemsTime_ResetTimes();
     // ALL the times need to be reset before .reset()ing each item
     // since Item_Reset schedules respawn of superweapons and powerups
-    FOREACH_ENTITY(IS_NOT_A_CLIENT(it), LAMBDA(
+    FOREACH_ENTITY_FLOAT(pure_data, false,
+    {
+        if(IS_CLIENT(it))
+            continue;
         if (it.reset) Item_ItemsTime_SetTime(it, 0);
-    ));
+    });
     Item_ItemsTime_SetTimesForAllPlayers();
 }
 
index b5dde01e9f5411af41419cab76dd12a10a6da41f..71181f209eeed787652d166d2a9e0e1e345a425c 100644 (file)
@@ -1199,7 +1199,7 @@ void turrets_manager_think(entity this)
 
        if (autocvar_g_turrets_reloadcvars == 1)
        {
-               FOREACH_ENTITY(IS_TURRET(it), {
+               FOREACH_ENTITY_FLAGS(turret_flags, TUR_FLAG_ISTURRET, {
                        load_unit_settings(it, true);
                        Turret tur = get_turretinfo(it.m_id);
                        tur.tr_think(tur, it);
index 0b83f05bfa7d7436fc2664d04a39c76a2ee56659..f1bd0e524e5bbd3c6cebaa2784c0c226579fa765 100644 (file)
@@ -803,7 +803,7 @@ void WarpZone_StartFrame()
                WarpZone_PostInitialize_Callback();
        }
 
-       FOREACH_ENTITY(!is_pure(it),
+       FOREACH_ENTITY_FLOAT(pure_data, false,
        {
                if(warpzone_warpzones_exist)
                        WarpZone_StoreProjectileData(it);
@@ -835,9 +835,10 @@ void WarpZone_StartFrame()
 .float warpzone_reconnecting;
 bool visible_to_some_client(entity ent)
 {
-       FOREACH_ENTITY(!IS_NOT_A_CLIENT(it), LAMBDA(
-               if (IS_PLAYER(it) && IS_REAL_CLIENT(it) && checkpvs(it.origin + it.view_ofs, ent)) return true;
-       ));
+       FOREACH_CLIENT(IS_PLAYER(it) && IS_REAL_CLIENT(it) && checkpvs(it.origin + it.view_ofs, ent),
+       {
+               return true;
+       });
        return false;
 }
 void trigger_warpzone_reconnect_use(entity this, entity actor, entity trigger)
index 20b3b54c04bb5f4d106064c2cb6db090024ea674..cab30262a02d2c5f8d77a1cb1a9bfbec287308d0 100644 (file)
@@ -273,10 +273,14 @@ void assault_new_round(entity this)
        else
                assault_attacker_team = NUM_TEAM_1;
 
-       FOREACH_ENTITY(IS_NOT_A_CLIENT(it), LAMBDA(
+       FOREACH_ENTITY_FLOAT(pure_data, false,
+       {
+               if(IS_CLIENT(it))
+                       continue;
+
                if (it.team_saved == NUM_TEAM_1) it.team_saved = NUM_TEAM_2;
                else if (it.team_saved == NUM_TEAM_2) it.team_saved = NUM_TEAM_1;
-       ));
+       });
 
        // reset the level with a countdown
        cvar_set("timelimit", ftos(ceil(time - game_starttime) / 60));