]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Fix rotating platforms not spinning
authorMario <mario.mario@y7mail.com>
Mon, 1 Jun 2020 18:25:36 +0000 (04:25 +1000)
committerMario <mario.mario@y7mail.com>
Mon, 1 Jun 2020 18:25:36 +0000 (04:25 +1000)
qcsrc/common/physics/movetypes/movetypes.qc
qcsrc/common/physics/movetypes/push.qc
qcsrc/server/g_world.qc

index d8320cc27bad0d3ac55dc569aa2c2fac7fd96ddb..99ff92150b5683efd2753ad42474cfb5015d734b 100644 (file)
@@ -4,7 +4,7 @@
 void set_movetype(entity this, int mt)
 {
        this.move_movetype = mt;
-       if (mt == MOVETYPE_PHYSICS /*|| mt == MOVETYPE_PUSH || mt == MOVETYPE_FAKEPUSH*/) {
+       if (mt == MOVETYPE_PHYSICS) {
                this.move_qcphysics = false;
        }
        if(!IL_CONTAINS(g_moveables, this))
@@ -127,7 +127,7 @@ int _Movetype_FlyMove(entity this, float dt, bool applygravity, bool applystepno
        if(dt <= 0)
                return 0;
 
-       int blocked = 0;
+       int blockedflag = 0;
        int i, j, numplanes = 0;
        float time_left = dt, grav = 0;
        vector push;
@@ -163,7 +163,7 @@ int _Movetype_FlyMove(entity this, float dt, bool applygravity, bool applystepno
                {
                        // we got teleported by a touch function
                        // let's abort the move
-                       blocked |= 8;
+                       blockedflag |= 8;
                        break;
                }
 
@@ -186,7 +186,7 @@ int _Movetype_FlyMove(entity this, float dt, bool applygravity, bool applystepno
                        if(trace_plane_normal.z > 0.7)
                        {
                                // floor
-                               blocked |= 1;
+                               blockedflag |= 1;
 
                                if(!trace_ent)
                                {
@@ -206,19 +206,19 @@ int _Movetype_FlyMove(entity this, float dt, bool applygravity, bool applystepno
 
                        if(!_Movetype_PushEntity(this, steppush, true, false))
                        {
-                               blocked |= 8;
+                               blockedflag |= 8;
                                break;
                        }
                        if(!_Movetype_PushEntity(this, push, true, false))
                        {
-                               blocked |= 8;
+                               blockedflag |= 8;
                                break;
                        }
                        float trace2_fraction = trace_fraction;
                        steppush = vec3(0, 0, org.z - this.origin_z);
                        if(!_Movetype_PushEntity(this, steppush, true, false))
                        {
-                               blocked |= 8;
+                               blockedflag |= 8;
                                break;
                        }
 
@@ -236,7 +236,7 @@ int _Movetype_FlyMove(entity this, float dt, bool applygravity, bool applystepno
                else
                {
                        // step - return it to caller
-                       blocked |= 2;
+                       blockedflag |= 2;
                        // save the trace for player extrafriction
                        if(applystepnormal)
                                move_stepnormal = trace_plane_normal;
@@ -256,7 +256,7 @@ int _Movetype_FlyMove(entity this, float dt, bool applygravity, bool applystepno
                {
                        // this shouldn't really happen
                        this.velocity = '0 0 0';
-                       blocked = 3;
+                       blockedflag = 3;
                        break;
                }
 
@@ -292,7 +292,7 @@ int _Movetype_FlyMove(entity this, float dt, bool applygravity, bool applystepno
                        if(numplanes != 2)
                        {
                                this.velocity = '0 0 0';
-                               blocked = 7;
+                               blockedflag = 7;
                                break;
                        }
                        vector dir = cross(planes[0], planes[1]);
@@ -317,10 +317,10 @@ int _Movetype_FlyMove(entity this, float dt, bool applygravity, bool applystepno
        }
 
        // LordHavoc: this came from QW and allows you to get out of water more easily
-       if(GAMEPLAYFIX_EASIERWATERJUMP(this) && (this.flags & FL_WATERJUMP) && !(blocked & 8))
+       if(GAMEPLAYFIX_EASIERWATERJUMP(this) && (this.flags & FL_WATERJUMP) && !(blockedflag & 8))
                this.velocity = primal_velocity;
 
-       if(PHYS_WALLCLIP(this) && this.pm_time && !(this.flags & FL_WATERJUMP) && !(blocked & 8))
+       if(PHYS_WALLCLIP(this) && this.pm_time && !(this.flags & FL_WATERJUMP) && !(blockedflag & 8))
                this.velocity = primal_velocity;
 
        if(applygravity)
@@ -332,7 +332,7 @@ int _Movetype_FlyMove(entity this, float dt, bool applygravity, bool applystepno
                }
        }
 
-       return blocked;
+       return blockedflag;
 }
 
 void _Movetype_CheckVelocity(entity this)  // SV_CheckVelocity
@@ -662,10 +662,6 @@ bool _Movetype_PushEntity(entity this, vector push, bool failonstartsolid, bool
        return (this.origin == last_origin); // false if teleported by touch
 }
 
-
-.float ltime;
-.void() blocked;
-
 void _Movetype_Physics_Frame(entity this, float movedt)
 {
        this.move_didgravity = -1;
index 288524896784ecc0ca910edecb5f136da2dd16e5..1ff815174c408b21734bdc68f624cb26679a3864 100644 (file)
@@ -21,9 +21,9 @@ void _Movetype_PushMove(entity this, float dt) // SV_PushMove
                {
                        this.origin = this.origin + dt * this.velocity;
                        this.angles = this.angles + dt * this.avelocity;
-                       this.angles_x -= 360.0 * floor(this.angles_x) * (1.0 / 360.0);
-                       this.angles_y -= 360.0 * floor(this.angles_y) * (1.0 / 360.0);
-                       this.angles_z -= 360.0 * floor(this.angles_z) * (1.0 / 360.0);
+                       this.angles_x -= 360.0 * floor(this.angles_x * (1.0 / 360.0));
+                       this.angles_y -= 360.0 * floor(this.angles_y * (1.0 / 360.0));
+                       this.angles_z -= 360.0 * floor(this.angles_z * (1.0 / 360.0));
                        this.ltime += dt;
                        _Movetype_LinkEdict(this, false);
                        return;
@@ -63,9 +63,9 @@ void _Movetype_PushMove(entity this, float dt) // SV_PushMove
 
        if(this.move_movetype == MOVETYPE_FAKEPUSH) // Tenebrae's MOVETYPE_PUSH variant that doesn't push...
        {
-               this.angles_x -= 360.0 * floor(this.angles_x) * (1.0 / 360.0);
-               this.angles_y -= 360.0 * floor(this.angles_y) * (1.0 / 360.0);
-               this.angles_z -= 360.0 * floor(this.angles_z) * (1.0 / 360.0);
+               this.angles_x -= 360.0 * floor(this.angles_x * (1.0 / 360.0));
+               this.angles_y -= 360.0 * floor(this.angles_y * (1.0 / 360.0));
+               this.angles_z -= 360.0 * floor(this.angles_z * (1.0 / 360.0));
                return;
        }
 
@@ -128,18 +128,18 @@ void _Movetype_PushMove(entity this, float dt) // SV_PushMove
                }
 
                // try moving the contacted entity
-               int savesolid = it.solid;
-               it.solid = SOLID_NOT;
+               int savesolid = this.solid;
+               this.solid = SOLID_NOT;
                if(!_Movetype_PushEntity(it, move, true, false))
                {
                        // entity "check" got teleported
                        it.angles_y += trace_fraction * moveangle.y;
-                       it.solid = savesolid;
+                       this.solid = savesolid;
                        continue; // pushed enough
                }
                // FIXME: turn players specially
                it.angles_y += trace_fraction * moveangle.y;
-               it.solid = savesolid;
+               this.solid = savesolid;
 
                // this trace.fraction < 1 check causes items to fall off of pushers
                // if they pass under or through a wall
@@ -196,9 +196,9 @@ void _Movetype_PushMove(entity this, float dt) // SV_PushMove
                        break;
                }
        });
-       this.angles_x -= 360.0 * floor(this.angles_x) * (1.0 / 360.0);
-       this.angles_y -= 360.0 * floor(this.angles_y) * (1.0 / 360.0);
-       this.angles_z -= 360.0 * floor(this.angles_z) * (1.0 / 360.0);
+       this.angles_x -= 360.0 * floor(this.angles_x * (1.0 / 360.0));
+       this.angles_y -= 360.0 * floor(this.angles_y * (1.0 / 360.0));
+       this.angles_z -= 360.0 * floor(this.angles_z * (1.0 / 360.0));
        IL_CLEAR(g_pushmove_moved); // clean up
 }
 
@@ -216,7 +216,7 @@ void _Movetype_Physics_Push(entity this, float dt) // SV_Physics_Pusher
        if(movetime)
        {
                // advances this.ltime if not blocked
-               _Movetype_PushMove(this, dt);
+               _Movetype_PushMove(this, movetime);
        }
 
        if(this.nextthink > oldltime && this.nextthink <= this.ltime)
index 90e796266fb30dca4221c226f10aac410b93f5da..1d9205f023d2559860a44fd551741654ba56d96a 100644 (file)
@@ -2064,7 +2064,7 @@ void Physics_Frame()
 
        IL_EACH(g_moveables, true,
        {
-               if(IS_CLIENT(it) || it.classname == "" /*|| it.move_movetype == MOVETYPE_PUSH || it.move_movetype == MOVETYPE_FAKEPUSH*/ || it.move_movetype == MOVETYPE_PHYSICS)
+               if(IS_CLIENT(it) || it.classname == "" || it.move_movetype == MOVETYPE_PHYSICS)
                        continue;
 
                //set_movetype(it, it.move_movetype);
@@ -2092,7 +2092,7 @@ void Physics_Frame()
 
        IL_EACH(g_moveables, it.move_qcphysics,
        {
-               if(IS_CLIENT(it) || is_pure(it) || it.classname == "" || it.move_movetype == MOVETYPE_NONE)
+               if(IS_CLIENT(it) || it.classname == "" || it.move_movetype == MOVETYPE_NONE)
                        continue;
                Movetype_Physics_NoMatchTicrate(it, PHYS_INPUT_TIMELENGTH, false);
        });