From: Mario Date: Mon, 1 Jun 2020 18:25:36 +0000 (+1000) Subject: Fix rotating platforms not spinning X-Git-Tag: xonotic-v0.8.5~881^2~6 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=e785b4842859ba8e4946c80c3bf329284b0230be;p=xonotic%2Fxonotic-data.pk3dir.git Fix rotating platforms not spinning --- diff --git a/qcsrc/common/physics/movetypes/movetypes.qc b/qcsrc/common/physics/movetypes/movetypes.qc index d8320cc27..99ff92150 100644 --- a/qcsrc/common/physics/movetypes/movetypes.qc +++ b/qcsrc/common/physics/movetypes/movetypes.qc @@ -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; diff --git a/qcsrc/common/physics/movetypes/push.qc b/qcsrc/common/physics/movetypes/push.qc index 288524896..1ff815174 100644 --- a/qcsrc/common/physics/movetypes/push.qc +++ b/qcsrc/common/physics/movetypes/push.qc @@ -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) diff --git a/qcsrc/server/g_world.qc b/qcsrc/server/g_world.qc index 90e796266..1d9205f02 100644 --- a/qcsrc/server/g_world.qc +++ b/qcsrc/server/g_world.qc @@ -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); });