]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Improve server performance by making pure entities that don't have models
authorterencehill <piuntn@gmail.com>
Sat, 27 Feb 2021 16:49:07 +0000 (16:49 +0000)
committerMario <mario.mario@y7mail.com>
Sat, 27 Feb 2021 16:49:07 +0000 (16:49 +0000)
23 files changed:
qcsrc/common/ent_cs.qc
qcsrc/common/gamemodes/gamemode/keepaway/sv_keepaway.qc
qcsrc/common/gamemodes/gamemode/keyhunt/sv_keyhunt.qc
qcsrc/common/gamemodes/gamemode/nexball/sv_nexball.qc
qcsrc/common/mapobjects/func/bobbing.qc
qcsrc/common/mapobjects/func/fourier.qc
qcsrc/common/mapobjects/func/pendulum.qc
qcsrc/common/mapobjects/func/vectormamamam.qc
qcsrc/common/mapobjects/subs.qc
qcsrc/common/mapobjects/trigger/gravity.qc
qcsrc/common/mapobjects/triggers.qc
qcsrc/common/monsters/sv_monsters.qc
qcsrc/common/mutators/mutator/buffs/sv_buffs.qc
qcsrc/common/mutators/mutator/superspec/sv_superspec.qc
qcsrc/common/mutators/mutator/weaponarena_random/sv_weaponarena_random.qc
qcsrc/common/mutators/mutator/weaponarena_random/sv_weaponarena_random.qh
qcsrc/common/turrets/sv_turrets.qc
qcsrc/common/wepent.qc
qcsrc/lib/stats.qh
qcsrc/server/elimination.qc
qcsrc/server/round_handler.qc
qcsrc/server/teamplay.qc
qcsrc/server/world.qc

index d5815c01ef07ebaacba4a3cb91a563c8562279d6..93c87104309bae528667f3b3d1637d833ecef68c 100644 (file)
@@ -240,7 +240,7 @@ ENTCS_PROP(SOLID, true, sv_solid, solid, ENTCS_SET_NORMAL,
 
        void entcs_attach(entity player)
        {
-               entity e = CS(player).entcs = new(entcs_sender);
+               entity e = CS(player).entcs = new_pure(entcs_sender);
                e.owner = player;
                setthink(e, entcs_think);
                e.nextthink = time;
index 0dfd1091d55b7bea701a731754c0856adba0b400..7239f9e7a4a9c23656d5e4369d9b0f928fd80c05 100644 (file)
@@ -267,7 +267,7 @@ void ka_Handler_CheckBall(entity this)
 
 void ka_Initialize() // run at the start of a match, initiates game mode
 {
-       ka_Handler = new(ka_Handler);
+       ka_Handler = new_pure(ka_Handler);
        setthink(ka_Handler, ka_Handler_CheckBall);
        ka_Handler.nextthink = time;
 }
index 1c2eacffd4e4974932096d27c07c8cd5b2de3a4e..379eb2ee91aeadee414e43b29e23657c5473358e 100644 (file)
@@ -981,7 +981,7 @@ void kh_Initialize()  // sets up th KH environment
        kh_teams = BITS(bound(2, kh_teams, 4));
 
        // make a KH entity for controlling the game
-       kh_controller = new(kh_controller);
+       kh_controller = new_pure(kh_controller);
        setthink(kh_controller, kh_Controller_Think);
        kh_Controller_SetThink(0, kh_WaitForPlayers);
 
index b98a8a917303ef263031d8cf91f150787a15d8d4..ca5f1a32d59f953cc3131307d3f9454cfafced11 100644 (file)
@@ -461,7 +461,7 @@ spawnfunc(nexball_team)
 void nb_spawnteam(string teamname, float teamcolor)
 {
        LOG_TRACE("^2spawned team ", teamname);
-       entity e = new(nexball_team);
+       entity e = new_pure(nexball_team);
        e.netname = teamname;
        e.cnt = teamcolor;
        e.team = e.cnt + 1;
index 3c4229a098da8dd69eda7fe1549fd4a0b4f03ca4..d010a87583fa9925e5a9c55229739eb97d2e748f 100644 (file)
@@ -54,7 +54,7 @@ spawnfunc(func_bobbing)
        setblocked(this, generic_plat_blocked);
        if(this.dmg && (this.message == ""))
                this.message = " was squished";
-    if(this.dmg && (this.message2 == ""))
+       if(this.dmg && (this.message2 == ""))
                this.message2 = "was squished by";
        if(this.dmg && (!this.dmgtime))
                this.dmgtime = 0.25;
@@ -72,7 +72,7 @@ spawnfunc(func_bobbing)
                return;
 
        // wait for targets to spawn
-       controller = new(func_bobbing_controller);
+       controller = new_pure(func_bobbing_controller);
        controller.owner = this;
        controller.nextthink = time + 1;
        setthink(controller, func_bobbing_controller_think);
index 73bb60536c110058e20360b1f8d63cfe508e0a34..2aad3f3bff832748b72220f136cca69c120b94d2 100644 (file)
@@ -59,7 +59,7 @@ spawnfunc(func_fourier)
        setblocked(this, generic_plat_blocked);
        if(this.dmg && (this.message == ""))
                this.message = " was squished";
-    if(this.dmg && (this.message2 == ""))
+       if(this.dmg && (this.message2 == ""))
                this.message2 = "was squished by";
        if(this.dmg && (!this.dmgtime))
                this.dmgtime = 0.25;
@@ -74,7 +74,7 @@ spawnfunc(func_fourier)
        this.active = ACTIVE_ACTIVE;
 
        // wait for targets to spawn
-       controller = new(func_fourier_controller);
+       controller = new_pure(func_fourier_controller);
        controller.owner = this;
        controller.nextthink = time + 1;
        setthink(controller, func_fourier_controller_think);
index c582f47f626f55d1ec528c35893775553d6a0c75..b470640006a9f6d72b24f4faf049516b2c808827 100644 (file)
@@ -63,7 +63,7 @@ spawnfunc(func_pendulum)
        this.cnt = this.angles_z;
 
        // wait for targets to spawn
-       controller = new(func_pendulum_controller);
+       controller = new_pure(func_pendulum_controller);
        controller.owner = this;
        controller.nextthink = time + 1;
        setthink(controller, func_pendulum_controller_think);
index bd1e14fb1671a3e307bd0e93ee0b3ae5d58d4c5b..53226a3c628cf2ef9c1679589fbd627e77add0a0 100644 (file)
@@ -89,7 +89,7 @@ void func_vectormamamam_findtarget(entity this)
 
        this.destvec = this.origin - func_vectormamamam_origin(this, 0);
 
-       entity controller = new(func_vectormamamam_controller);
+       entity controller = new_pure(func_vectormamamam_controller);
        controller.owner = this;
        controller.nextthink = time + 1;
        setthink(controller, func_vectormamamam_controller_think);
index 847deca6e0e4c20578f48404022959ec4ecdde7b..c0b137404c55956d1fa509f697a23e1452c6676e 100644 (file)
@@ -232,7 +232,7 @@ void SUB_CalcMove_Bezier (entity this, vector tcontrol, vector tdest, float tspe
        {
                delete(this.move_controller);
        }
-       controller = new(SUB_CalcMove_controller);
+       controller = new_pure(SUB_CalcMove_controller);
        controller.owner = this;
        this.move_controller = controller;
        controller.platmovetype = this.platmovetype;
index ea63c9a748ca54149ff3701439a6df785a1b0ba0..33e10ea09ecc86b106835995f036e8fde0a07e58 100644 (file)
@@ -68,7 +68,7 @@ void trigger_gravity_touch(entity this, entity toucher)
                        else
                                return;
                }
-               toucher.trigger_gravity_check = new(trigger_gravity_checker);
+               toucher.trigger_gravity_check = new_pure(trigger_gravity_checker);
                toucher.trigger_gravity_check.enemy = this;
                toucher.trigger_gravity_check.owner = toucher;
                toucher.trigger_gravity_check.gravity = toucher.gravity;
index 54550dcb263e33b66e520b5434246e5600474335..39fa89c42fc6236a1d1b471908d2da86e52c6e5f 100644 (file)
@@ -274,8 +274,8 @@ void SUB_UseTargets_Ex(entity this, entity actor, entity trigger, bool preventRe
 //
        if (this.delay)
        {
-       // create a temp object to fire at a later time
-               entity t = new(DelayedUse);
+               // create a temp object to fire at a later time
+               entity t = new_pure(DelayedUse);
                t.nextthink = time + this.delay;
                setthink(t, DelayThink);
                t.enemy = actor;
index 0ce51f21aca47354cfdaf45d5ddda9d557c13a9b..b7e4d20a38c1f943087f88e1339bf1049556b2b4 100644 (file)
@@ -218,7 +218,7 @@ void Monster_Delay_Action(entity this)
 void Monster_Delay(entity this, int repeat_count, float defer_amnt, void(entity) func)
 {
        // deferred attacking, checks if monster is still alive and target is still valid before attacking
-       entity e = new(Monster_Delay);
+       entity e = new_pure(Monster_Delay);
 
        setthink(e, Monster_Delay_Action);
        e.nextthink = time + defer_amnt;
index 38345efcf3eb621ceee85f45ffdd0da40069ac02..6fa6e8d054c50785a5971e02e685d6e98bacabcc 100644 (file)
@@ -473,7 +473,7 @@ MUTATOR_HOOKFUNCTION(buffs, Damage_Calculate)
        if(frag_attacker != frag_target)
        if(!ITEM_DAMAGE_NEEDKILL(frag_deathtype))
        {
-               entity dmgent = new(dmgent);
+               entity dmgent = new_pure(dmgent);
 
                dmgent.dmg = frag_damage * autocvar_g_buffs_vengeance_damage_multiplier;
                dmgent.enemy = frag_attacker;
index add4bec010fc90f09f6372232d023e098b3f4edd..5328be79c1cddf1eea677096c4c5623bb9df6002 100644 (file)
@@ -401,7 +401,7 @@ MUTATOR_HOOKFUNCTION(superspec, ClientConnect)
        player.superspec_flags = SSF_VERBOSE;
        player.superspec_itemfilter = "";
 
-       entity _hello = new(superspec_delayed_hello);
+       entity _hello = new_pure(superspec_delayed_hello);
        _hello.enemy = player;
        setthink(_hello, superspec_hello);
        _hello.nextthink = time + 5;
index 32b6f3930595ec6376b56e204b39bf46c5fc3db9..3932734d0475853145395e27686854ce73fe0531 100644 (file)
@@ -45,9 +45,11 @@ MUTATOR_HOOKFUNCTION(weaponarena_random, GiveFragsForKill)
        }
        else
        {
+
+               static entity GiveFrags_randomweapons;
                if(!GiveFrags_randomweapons)
                {
-                       GiveFrags_randomweapons = new(GiveFrags_randomweapons);
+                       GiveFrags_randomweapons = new_pure(GiveFrags_randomweapons);
                }
 
                if(warmup_stage)
index 4af3cf03622565bbb5e9a45f1481222dec37c230..7fb9581bb73379872a8c51ea7dccb5ddf8a38a65 100644 (file)
@@ -1,5 +1,3 @@
 #pragma once
 
 float g_weaponarena_random_with_blaster;
-
-entity GiveFrags_randomweapons;
index 180981d8c2df48ab37e5e980801af5f5e7000e40..1b5e7cdb84ed9e098cd0f0dfff71931bbbb48ec0 100644 (file)
@@ -1256,7 +1256,7 @@ void turret_findtarget(entity this)
        entity e = find(NULL, classname, "turret_manager");
        if(!e)
        {
-               e = new(turret_manager);
+               e = new_pure(turret_manager);
                setthink(e, turrets_manager_think);
                e.nextthink = time + 2;
        }
index da2b0539d05cf410ee743ff0e26003a2d5b37761..c673b0980781e3b700a549c35936c4c067edfb62 100644 (file)
@@ -158,7 +158,7 @@ MACRO_END
 
        void wepent_link(entity wep)
        {
-               entity e = new(wepent_sender);
+               entity e = new_pure(wepent_sender);
                e.owner = wep;
                setthink(e, wepent_think);
                e.nextthink = time;
index 9bd4a3af94802718fcbd51e0e27046c5b366b6db..f0ea92d6345e347c12d40116ed63fac1c8390c68 100644 (file)
@@ -125,8 +125,8 @@ int g_magic_stats_hole = 0;
        .int __stat_null;
        STATIC_INIT(stats)
        {
-           STATS = new(stats);
-           // Prevent engine stats being sent
+               STATS = new_pure(stats);
+               // Prevent engine stats being sent
                int r = STATS_ENGINE_RESERVE;
                for (int i = 0, n = 256 - r; i < n; ++i) {
                        #define X(_, name, id) if (i == id) continue;
index 8024c9a5c32f93578f52de9332b3ab97c48acbec..b081c91a719ca2fceccb26613258731c482f6598 100644 (file)
@@ -31,6 +31,6 @@ void EliminatedPlayers_Init(float(entity) isEliminated_func)
                backtrace("Can't spawn eliminatedPlayers again!");
                return;
        }
-       Net_LinkEntity(eliminatedPlayers = spawn(), false, 0, EliminatedPlayers_SendEntity);
+       Net_LinkEntity(eliminatedPlayers = new_pure(), false, 0, EliminatedPlayers_SendEntity);
        eliminatedPlayers.isEliminated = isEliminated_func;
 }
index 369e75708991f5a6e4d88f578986c245d638b4ce..93c3835271a049b796eaab6a2ff4911ebfe7b6fd 100644 (file)
@@ -93,7 +93,7 @@ void round_handler_Spawn(bool() canRoundStart_func, bool() canRoundEnd_func, voi
                backtrace("Can't spawn round_handler again!");
                return;
        }
-       entity this = round_handler = new(round_handler);
+       entity this = round_handler = new_pure(round_handler);
 
        setthink(this, round_handler_FirstThink);
        this.canRoundStart = canRoundStart_func;
index 59fa95afacf4ca97224f9cf8bb8dab5e8e4dc575..7b2027589cca326d0a13f53561678e0fba770e39 100644 (file)
@@ -50,7 +50,7 @@ STATIC_INIT(g_team_entities)
 {
        for (int i = 0; i < NUM_TEAMS; ++i)
        {
-               g_team_entities[i] = spawn();
+               g_team_entities[i] = new_pure();
        }
 }
 
index 2cacbac1aad073eab420b2ce9ed10fbeecf4be87..93845d8a2fdb943dd775121f8da9a9b249ab5685 100644 (file)
@@ -1833,7 +1833,7 @@ void readplayerstartcvars()
        start_ammo_plasma = 0;
        if (random_start_ammo == NULL)
        {
-               random_start_ammo = new(random_start_ammo);
+               random_start_ammo = new_pure(random_start_ammo);
        }
        start_health = cvar("g_balance_health_start");
        start_armorvalue = cvar("g_balance_armor_start");