]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/movetypes/movetypes.qc
Fix some issues with QC movetypes
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / movetypes / movetypes.qc
index 6cf3969e6fb168cfcb5c5f10c6e4e861387561db..07625658bff1e21869d6ac31c37242370d476e9b 100644 (file)
@@ -45,11 +45,11 @@ int _Movetype_FlyMove(entity this, float dt, bool applygravity, vector stepnorma
        if(applygravity)
        {
                this.move_didgravity = 1;
-               grav = dt * (PHYS_ENTGRAVITY(this) ? PHYS_ENTGRAVITY(this) : 1) * PHYS_GRAVITY;
+               grav = dt * (PHYS_ENTGRAVITY(this) ? PHYS_ENTGRAVITY(this) : 1) * PHYS_GRAVITY(this);
 
                if(!GAMEPLAYFIX_NOGRAVITYONGROUND || !(this.move_flags & FL_ONGROUND))
                {
-                       if(GRAVITY_UNAFFECTED_BY_TICRATE)
+                       if(GAMEPLAYFIX_GRAVITYUNAFFECTEDBYTICRATE)
                                this.move_velocity_z -= grav * 0.5;
                        else
                                this.move_velocity_z -= grav;
@@ -64,9 +64,8 @@ int _Movetype_FlyMove(entity this, float dt, bool applygravity, vector stepnorma
                        break;
 
                push = this.move_velocity * time_left;
-               vector prev_origin = this.move_origin;
                _Movetype_PushEntity(this, push, true);
-               if(trace_startsolid && this.move_origin != prev_origin)
+               if(trace_startsolid)
                {
                        // we got teleported by a touch function
                        // let's abort the move
@@ -88,9 +87,9 @@ int _Movetype_FlyMove(entity this, float dt, bool applygravity, vector stepnorma
                float my_trace_fraction = trace_fraction;
                vector my_trace_plane_normal = trace_plane_normal;
 
-               if(trace_plane_normal_z)
+               if(trace_plane_normal.z)
                {
-                       if(trace_plane_normal_z > 0.7)
+                       if(trace_plane_normal.z > 0.7)
                        {
                                // floor
                                blocked |= 1;
@@ -112,13 +111,13 @@ int _Movetype_FlyMove(entity this, float dt, bool applygravity, vector stepnorma
                        vector steppush = '0 0 1' * stepheight;
 
                        _Movetype_PushEntity(this, steppush, true);
-                       if(trace_startsolid && this.move_origin != org)
+                       if(trace_startsolid)
                        {
                                blocked |= 8;
                                break;
                        }
                        _Movetype_PushEntity(this, push, true);
-                       if(trace_startsolid && this.move_origin != org)
+                       if(trace_startsolid)
                        {
                                blocked |= 8;
                                break;
@@ -126,7 +125,7 @@ int _Movetype_FlyMove(entity this, float dt, bool applygravity, vector stepnorma
                        float trace2_fraction = trace_fraction;
                        steppush = '0 0 1' * (org_z - this.move_origin_z);
                        _Movetype_PushEntity(this, steppush, true);
-                       if(trace_startsolid && this.move_origin != org)
+                       if(trace_startsolid)
                        {
                                blocked |= 8;
                                break;
@@ -234,7 +233,7 @@ int _Movetype_FlyMove(entity this, float dt, bool applygravity, vector stepnorma
        {
                if(!GAMEPLAYFIX_NOGRAVITYONGROUND || !(this.move_flags & FL_ONGROUND))
                {
-                       if(GRAVITY_UNAFFECTED_BY_TICRATE)
+                       if(GAMEPLAYFIX_GRAVITYUNAFFECTEDBYTICRATE)
                                this.move_velocity_z -= grav * 0.5f;
                }
        }
@@ -641,10 +640,10 @@ void Movetype_Physics_MatchTicrate(entity this, float tr, bool sloppy)  // SV_Ph
 
                if(this.move_didgravity > 0)
                {
-                       this.velocity_z -= (GRAVITY_UNAFFECTED_BY_TICRATE ? 0.5 : 1)
+                       this.velocity_z -= (GAMEPLAYFIX_GRAVITYUNAFFECTEDBYTICRATE ? 0.5 : 1)
                            * dt
                            * (this.gravity ? this.gravity : 1)
-                           * PHYS_GRAVITY;
+                           * PHYS_GRAVITY(this);
                }
 
                this.angles = this.move_angles + dt * this.avelocity;
@@ -660,8 +659,8 @@ void Movetype_Physics_MatchTicrate(entity this, float tr, bool sloppy)  // SV_Ph
                                setorigin(this, trace_endpos);
                }
 
-               if(this.move_didgravity > 0 && GRAVITY_UNAFFECTED_BY_TICRATE)
-                       this.velocity_z -= 0.5 * dt * (this.gravity ? this.gravity : 1) * PHYS_GRAVITY;
+               if(this.move_didgravity > 0 && GAMEPLAYFIX_GRAVITYUNAFFECTEDBYTICRATE)
+                       this.velocity_z -= 0.5 * dt * (this.gravity ? this.gravity : 1) * PHYS_GRAVITY(this);
        }
        else
        {