]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Make sv_gameplayfix_delayprojectiles match the engine's behaviour of only running...
authorMario <mario.mario@y7mail.com>
Mon, 3 Aug 2020 00:01:13 +0000 (10:01 +1000)
committerMario <mario.mario@y7mail.com>
Mon, 3 Aug 2020 00:01:13 +0000 (10:01 +1000)
qcsrc/common/physics/movetypes/movetypes.qc
qcsrc/common/physics/movetypes/movetypes.qh
qcsrc/common/stats.qh
qcsrc/server/world.qc

index 9de337476bd5ff505d9cbe567a86b49e2eab7312..eb57922b9d81020b76001a51474194432202035a 100644 (file)
@@ -755,12 +755,24 @@ void _Movetype_Physics_ClientFrame(entity this, float movedt)
 
 void Movetype_Physics_NoMatchTicrate(entity this, float movedt, bool isclient)  // to be run every move frame
 {
+       bool didmove = (this.move_time != 0);
        this.move_time = time;
 
        if(isclient)
                _Movetype_Physics_ClientFrame(this, movedt);
        else
+       {
+               // this doesn't apply to clients, and only applies to unmatched entities
+               // don't run think/move on newly spawned projectiles as it messes up
+               // movement interpolation and rocket trails, and is inconsistent with
+               // respect to entities spawned in the same frame
+               // (if an ent spawns a higher numbered ent, it moves in the same frame,
+               //  but if it spawns a lower numbered ent, it doesn't - this never moves
+               //  ents in the first frame regardless)
+               if(!didmove && GAMEPLAYFIX_DELAYPROJECTILES(this) > 0)
+                       return;
                _Movetype_Physics_Frame(this, movedt);
+       }
        if(wasfreed(this))
                return;
 
index 0e7cca67b284fb507659a8990f4f669c808f8f4f..444e7f4423f011fba921c61ff395aa3eeb6a578e 100644 (file)
@@ -25,6 +25,7 @@ const int WATERLEVEL_SUBMERGED = 3;
 #define GAMEPLAYFIX_NOAIRBORNCORPSE(s)                 STAT(GAMEPLAYFIX_NOAIRBORNCORPSE)
 #define NOAIRBORNCORPSE_ALLOWSUSPENDED(s)      STAT(NOAIRBORNCORPSE_ALLOWSUSPENDED)
 #define UPWARD_VELOCITY_CLEARS_ONGROUND(s)  STAT(GAMEPLAYFIX_UPVELOCITYCLEARSONGROUND)
+#define GAMEPLAYFIX_DELAYPROJECTILES(s)        STAT(GAMEPLAYFIX_DELAYPROJECTILES)
 
 
 #define PHYS_STEPHEIGHT(s)                  STAT(MOVEVARS_STEPHEIGHT)
index 37ef7d13b5d41c48aace0557e5b4b9f584a90152..cda98d54d73f75b7432ae1769ea3c738a27cf840 100644 (file)
@@ -200,6 +200,7 @@ int autocvar_sv_gameplayfix_slidemoveprojectiles = 1;
 int autocvar_sv_gameplayfix_grenadebouncedownslopes = 1;
 int autocvar_sv_gameplayfix_noairborncorpse = 1;
 int autocvar_sv_gameplayfix_noairborncorpse_allowsuspendeditems = 1;
+int autocvar_sv_gameplayfix_delayprojectiles = 0;
 #endif
 REGISTER_STAT(GAMEPLAYFIX_DOWNTRACEONGROUND, int, autocvar_sv_gameplayfix_downtracesupportsongroundflag)
 REGISTER_STAT(GAMEPLAYFIX_EASIERWATERJUMP, int, autocvar_sv_gameplayfix_easierwaterjump)
@@ -213,6 +214,7 @@ REGISTER_STAT(GAMEPLAYFIX_SLIDEMOVEPROJECTILES, int, autocvar_sv_gameplayfix_sli
 REGISTER_STAT(GAMEPLAYFIX_GRENADEBOUNCESLOPES, int, autocvar_sv_gameplayfix_grenadebouncedownslopes)
 REGISTER_STAT(GAMEPLAYFIX_NOAIRBORNCORPSE, int, autocvar_sv_gameplayfix_noairborncorpse)
 REGISTER_STAT(NOAIRBORNCORPSE_ALLOWSUSPENDED, int, autocvar_sv_gameplayfix_noairborncorpse_allowsuspendeditems)
+REGISTER_STAT(GAMEPLAYFIX_DELAYPROJECTILES, int, autocvar_sv_gameplayfix_delayprojectiles)
 
 REGISTER_STAT(MOVEVARS_JUMPSTEP, int, cvar("sv_jumpstep"))
 REGISTER_STAT(NOSTEP, int, cvar("sv_nostep"))
index c9fec23b8e3a8e313920bd6879be2454580e569f..c37998545ff8c7dabd7d87152d06dbd2ef313195 100644 (file)
@@ -2067,7 +2067,6 @@ void RunThink(entity this)
 }
 
 bool autocvar_sv_freezenonclients;
-bool autocvar_sv_gameplayfix_delayprojectiles = false;
 void Physics_Frame()
 {
        if(autocvar_sv_freezenonclients)
@@ -2075,7 +2074,7 @@ void Physics_Frame()
 
        IL_EACH(g_moveables, true,
        {
-               if(IS_CLIENT(it) || it.classname == "" || it.move_movetype == MOVETYPE_PHYSICS)
+               if(IS_CLIENT(it) || it.move_movetype == MOVETYPE_PHYSICS)
                        continue;
 
                //set_movetype(it, it.move_movetype);
@@ -2098,9 +2097,11 @@ void Physics_Frame()
        if(autocvar_sv_gameplayfix_delayprojectiles >= 0)
                return;
 
+       // make a second pass to see if any ents spawned this frame and make
+       // sure they run their move/think. this is verified by checking .move_time, which will never be 0 if the entity has moved
        IL_EACH(g_moveables, it.move_qcphysics,
        {
-               if(IS_CLIENT(it) || it.classname == "" || it.move_movetype == MOVETYPE_NONE)
+               if(IS_CLIENT(it) || it.move_time || it.move_movetype == MOVETYPE_NONE || it.move_movetype == MOVETYPE_PHYSICS)
                        continue;
                Movetype_Physics_NoMatchTicrate(it, PHYS_INPUT_TIMELENGTH, false);
        });