]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge branch 'master' into Lyberta/TeamplayFixes2 507/head
authorLyberta <lyberta@lyberta.net>
Sat, 2 Dec 2017 15:51:57 +0000 (18:51 +0300)
committerLyberta <lyberta@lyberta.net>
Sat, 2 Dec 2017 15:51:57 +0000 (18:51 +0300)
12 files changed:
qcsrc/common/mutators/mutator/overkill/sv_overkill.qc
qcsrc/common/mutators/mutator/random_items/sv_random_items.qc
qcsrc/common/physics/movetypes/movetypes.qc
qcsrc/common/weapons/weapon/shockwave.qc
qcsrc/server/antilag.qc
qcsrc/server/antilag.qh
qcsrc/server/compat/quake3.qc
qcsrc/server/g_subs.qc
qcsrc/server/g_world.qc
qcsrc/server/items.qc
qcsrc/server/items.qh
qcsrc/server/weapons/tracing.qc

index 7462de81f2a03a37cccab8794fee8e884f6fec79..5eef8f2e37b4b49c96bce413c564cf2ebcbf9b28 100644 (file)
@@ -205,7 +205,7 @@ MUTATOR_HOOKFUNCTION(ok, OnEntityPreSpawn)
                        setorigin(wep, ent.origin);
                        setmodel(wep, MDL_OK_HMG);
                        wep.ok_item = true;
-                       wep.noalign = ent.noalign;
+                       wep.noalign = Item_ShouldKeepPosition(ent);
                        wep.cnt = ent.cnt;
                        wep.team = ent.team;
                        wep.respawntime = g_pickup_respawntime_superweapon;
@@ -221,7 +221,7 @@ MUTATOR_HOOKFUNCTION(ok, OnEntityPreSpawn)
                        setorigin(wep, ent.origin);
                        setmodel(wep, MDL_OK_RPC);
                        wep.ok_item = true;
-                       wep.noalign = ent.noalign;
+                       wep.noalign = Item_ShouldKeepPosition(ent);
                        wep.cnt = ent.cnt;
                        wep.team = ent.team;
                        wep.respawntime = g_pickup_respawntime_superweapon;
index 47234be290531e7d8a4966e313ac0f2bdb1acde7..3d305746269e1a29cbfb718ceb536175d04693af 100644 (file)
@@ -299,7 +299,7 @@ entity RandomItems_ReplaceMapItem(entity item)
        if (!expr_evaluate(autocvar_g_overkill))
        {
                new_item = Item_Create(strzone(new_classname), item.origin,
-                       item.noalign);
+                       Item_ShouldKeepPosition(item));
                random_items_is_spawning = false;
                if (new_item == NULL)
                {
@@ -311,7 +311,7 @@ entity RandomItems_ReplaceMapItem(entity item)
                new_item = spawn();
                new_item.classname = strzone(new_classname);
                new_item.spawnfunc_checked = true;
-               new_item.noalign = item.noalign;
+               new_item.noalign = Item_ShouldKeepPosition(item);
                new_item.ok_item = true;
                Item_Initialize(new_item, new_classname);
                random_items_is_spawning = false;
index 995c65b4d322061a7f00d0b5f0899a4480af02a4..3fe2808583b94254d580b3c3960b2610c9192e6f 100644 (file)
@@ -544,7 +544,6 @@ void _Movetype_Physics_ClientFrame(entity this, float movedt)
                        _Movetype_CheckWater(this);
                        this.origin = this.origin + movedt * this.velocity;
                        this.angles = this.angles + movedt * this.avelocity;
-                       _Movetype_LinkEdict(this, false);
                        break;
                case MOVETYPE_STEP:
                        _Movetype_Physics_Step(this, movedt);
@@ -563,6 +562,12 @@ void _Movetype_Physics_ClientFrame(entity this, float movedt)
                case MOVETYPE_PHYSICS:
                        break;
        }
+
+       //_Movetype_CheckVelocity(this);
+
+       _Movetype_LinkEdict(this, true);
+
+       //_Movetype_CheckVelocity(this);
 }
 
 void Movetype_Physics_NoMatchTicrate(entity this, float movedt, bool isclient)  // to be run every move frame
index 990bc29ee3d0da5c55087578aad7a0160e18b604..0ca4d528fe62ea550776a9d6ee1c9ad56dc6a526 100644 (file)
@@ -316,13 +316,7 @@ void W_Shockwave_Attack(entity actor, .entity weaponentity)
        if(autocvar_g_antilag == 0 || noantilag)
                lag = 0; // only do hitscan, but no antilag
        if(lag)
-       {
-               FOREACH_CLIENT(IS_PLAYER(it) && it != actor, antilag_takeback(it, CS(it), time - lag));
-               IL_EACH(g_monsters, it != actor,
-               {
-                       antilag_takeback(it, it, time - lag);
-               });
-       }
+               antilag_takeback_all(actor, lag);
 
        while(head)
        {
@@ -596,13 +590,7 @@ void W_Shockwave_Attack(entity actor, .entity weaponentity)
        }
 
        if(lag)
-       {
-               FOREACH_CLIENT(IS_PLAYER(it) && it != actor, antilag_restore(it, CS(it)));
-               IL_EACH(g_monsters, it != actor,
-               {
-                       antilag_restore(it, it);
-               });
-       }
+               antilag_restore_all(actor);
 }
 
 METHOD(Shockwave, wr_aim, void(entity thiswep, entity actor, .entity weaponentity))
index 46c871876108005a0a69978681454bf1a9446f09..4062f7f660df2d15dfb01ea48bdf822a81599995 100644 (file)
@@ -119,3 +119,30 @@ void antilag_clear(entity e, entity store)
        }
        store.antilag_index = ANTILAG_MAX_ORIGINS - 1; // next one is 0
 }
+
+// TODO: use a single intrusive list across all antilagged entities
+void antilag_takeback_all(entity ignore, float lag)
+{
+       FOREACH_CLIENT(IS_PLAYER(it) && it != ignore, antilag_takeback(it, CS(it), time - lag));
+       IL_EACH(g_monsters, it != ignore,
+       {
+               antilag_takeback(it, it, time - lag);
+       });
+       IL_EACH(g_projectiles, it != ignore && it.classname == "nade",
+       {
+               antilag_takeback(it, it, time - lag);
+       });
+}
+
+void antilag_restore_all(entity ignore)
+{
+       FOREACH_CLIENT(IS_PLAYER(it) && it != ignore, antilag_restore(it, CS(it)));
+       IL_EACH(g_monsters, it != ignore,
+       {
+               antilag_restore(it, it);
+       });
+       IL_EACH(g_projectiles, it != ignore && it.classname == "nade",
+       {
+               antilag_restore(it, it);
+       });
+}
index 6cf392eed5ae1e8bd2bc125b3a19aa5b9e70d6dd..d57762ccd3899ef8588a560229b39e25ac89210e 100644 (file)
@@ -6,6 +6,9 @@ void antilag_takeback(entity e, entity store, float t);
 void antilag_restore(entity e, entity store);
 void antilag_clear(entity e, entity store);
 
+void antilag_takeback_all(entity ignore, float lag);
+void antilag_restore_all(entity ignore);
+
 .float antilag_debug;
 
 #define ANTILAG_LATENCY(e) min(0.4, CS(e).ping * 0.001)
index a85f4cca6429d8a84af6f287d50366009832aedc..6a7f21aa674d319bad7ece6abeb908b28b764d60 100644 (file)
@@ -95,31 +95,31 @@ void target_give_init(entity this)
 {
        IL_EACH(g_items, it.targetname == this.target,
        {
-               if (it.classname == "weapon_rocketlauncher" || it.classname == "weapon_devastator") {
+               if (it.classname == "weapon_devastator") {
                        this.ammo_rockets += it.count * WEP_CVAR(devastator, ammo);
                        this.netname = cons(this.netname, "devastator");
                }
-               else if (it.classname == "weapon_railgun") {
+               else if (it.classname == "weapon_vortex") {
                        this.ammo_cells += it.count * WEP_CVAR_PRI(vortex, ammo); // WEAPONTODO
                        this.netname = cons(this.netname, "vortex");
                }
-               else if (it.classname == "weapon_lightning") {
+               else if (it.classname == "weapon_electro") {
                        this.ammo_cells += it.count * WEP_CVAR_PRI(electro, ammo); // WEAPONTODO
                        this.netname = cons(this.netname, "electro");
                }
-               else if (it.classname == "weapon_plasmagun") {
+               else if (it.classname == "weapon_hagar") {
                        this.ammo_rockets += it.count * WEP_CVAR_PRI(hagar, ammo); // WEAPONTODO
                        this.netname = cons(this.netname, "hagar");
                }
-               else if (it.classname == "weapon_bfg") {
+               else if (it.classname == "weapon_crylink") {
                        this.ammo_cells += it.count * WEP_CVAR_PRI(crylink, ammo);
                        this.netname = cons(this.netname, "crylink");
                }
-               else if (it.classname == "weapon_grenadelauncher" || it.classname == "weapon_mortar") {
+               else if (it.classname == "weapon_mortar") {
                        this.ammo_rockets += it.count * WEP_CVAR_PRI(mortar, ammo); // WEAPONTODO
                        this.netname = cons(this.netname, "mortar");
                }
-               else if (it.classname == "item_armor_body")
+               else if (it.classname == "item_armor_mega")
                        this.armorvalue = 100;
                else if (it.classname == "item_health_mega")
                        this.health = 200;
index 713577fad17beb0c5d46932b7d845cea4b18cd7e..d9372e0aa561ea44f4d57850db09a656ef18e070 100644 (file)
@@ -50,14 +50,7 @@ void tracebox_antilag_force_wz (entity source, vector v1, vector mi, vector ma,
                source.dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_BODY | DPCONTENTS_CORPSE;
 
        if (lag)
-       {
-               // take players back into the past
-               FOREACH_CLIENT(IS_PLAYER(it) && it != forent, antilag_takeback(it, CS(it), time - lag));
-               IL_EACH(g_monsters, it != forent,
-               {
-                       antilag_takeback(it, it, time - lag);
-               });
-       }
+               antilag_takeback_all(forent, lag);
 
        // do the trace
        if(wz)
@@ -67,13 +60,7 @@ void tracebox_antilag_force_wz (entity source, vector v1, vector mi, vector ma,
 
        // restore players to current positions
        if (lag)
-       {
-               FOREACH_CLIENT(IS_PLAYER(it) && it != forent, antilag_restore(it, CS(it)));
-               IL_EACH(g_monsters, it != forent,
-               {
-                       antilag_restore(it, it);
-               });
-       }
+               antilag_restore_all(forent);
 
        // restore shooter solid type
        if(source)
index ce25dfa522772b08e3f1dfb41dcc2a536a2f4902..2eda8584ef5d82eeb9f346cb131aa9a049a58488 100644 (file)
@@ -2093,6 +2093,10 @@ void EndFrame()
        {
                antilag_record(it, it, altime);
        });
+       IL_EACH(g_projectiles, it.classname == "nade",
+       {
+               antilag_record(it, it, altime);
+       });
        systems_update();
        IL_ENDFRAME();
 }
index 29a8609bc628530049fb3b11677599529d320b5b..7d248834f72566af97313317a42a3a50c226f637 100644 (file)
@@ -84,6 +84,11 @@ void Item_SetLoot(entity item, bool loot)
        item.m_isloot = loot;
 }
 
+bool Item_ShouldKeepPosition(entity item)
+{
+       return item.noalign || (item.spawnflags & 1);
+}
+
 bool Item_IsExpiring(entity item)
 {
        return item.m_isexpiring;
index af55eebd4d60e42c34505515b42d3fd85dd1b689..1abcf64e0879442a3b8ade446bc724ca8250e503 100644 (file)
@@ -51,6 +51,13 @@ bool Item_IsLoot(entity item);
 /// \return No return.
 void Item_SetLoot(entity item, bool loot);
 
+/// \brief Returns whether item should keep its position or be dropped to the
+/// ground.
+/// \param[in] item Item to check.
+/// \return True if item should keep its position or false if it should be
+/// dropped to the ground.
+bool Item_ShouldKeepPosition(entity item);
+
 /// \brief Returns whether the item is expiring (i.e. its strength, shield and
 /// superweapon timers expire while it is on the ground).
 /// \param[in] item Item to check.
index bf272a01a94e02d75041436a36b2c7ce1846ddad..157adb5d399c976dca3da949c257c272c3b182d3 100644 (file)
@@ -357,13 +357,7 @@ void fireBullet(entity this, .entity weaponentity, vector start, vector dir, flo
        if(autocvar_g_antilag == 0 || noantilag)
                lag = 0; // only do hitscan, but no antilag
        if(lag)
-       {
-               FOREACH_CLIENT(IS_PLAYER(it) && it != this, antilag_takeback(it, CS(it), time - lag));
-               IL_EACH(g_monsters, it != this,
-               {
-                       antilag_takeback(it, it, time - lag);
-               });
-       }
+               antilag_takeback_all(this, lag);
 
        // change shooter to SOLID_BBOX so the shot can hit corpses
        int oldsolid = this.dphitcontentsmask;
@@ -480,13 +474,7 @@ void fireBullet(entity this, .entity weaponentity, vector start, vector dir, flo
        }
 
        if(lag)
-       {
-               FOREACH_CLIENT(IS_PLAYER(it) && it != this, antilag_restore(it, CS(it)));
-               IL_EACH(g_monsters, it != this,
-               {
-                       antilag_restore(it, it);
-               });
-       }
+               antilag_restore_all(this);
 
        // restore shooter solid type
        if(this)