From 0e365abf7504607ae0fd74381f83f2398e383d36 Mon Sep 17 00:00:00 2001 From: Mario Date: Tue, 2 Jun 2020 06:00:15 +1000 Subject: [PATCH] Fix falling through world when crushed by platforms --- qcsrc/common/physics/movetypes/movetypes.qc | 5 ++--- qcsrc/common/physics/movetypes/push.qc | 11 +++-------- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/qcsrc/common/physics/movetypes/movetypes.qc b/qcsrc/common/physics/movetypes/movetypes.qc index 7e7945e1c..5b7bb11b8 100644 --- a/qcsrc/common/physics/movetypes/movetypes.qc +++ b/qcsrc/common/physics/movetypes/movetypes.qc @@ -25,7 +25,7 @@ bool _Movetype_NudgeOutOfSolid_PivotIsKnownGood(entity this, vector pivot) // SV for(int bump = 0; bump < 6; bump++) { int coord = 2 - (bump >> 1); - bool dir = (bump & 1); + int dir = (bump & 1); for(int subbump = 0; ; ++subbump) { @@ -54,7 +54,6 @@ bool _Movetype_NudgeOutOfSolid_PivotIsKnownGood(entity this, vector pivot) // SV tracebox(stuckorigin, goodmins, goodmaxs, testorigin, MOVE_NOMONSTERS, this); if(trace_startsolid && trace_ent.solid == SOLID_BSP) // NOTE: this checks for bmodelstartsolid in the engine { - // BAD BAD, can't fix that return false; } @@ -70,7 +69,7 @@ bool _Movetype_NudgeOutOfSolid_PivotIsKnownGood(entity this, vector pivot) // SV // we hit something... let's move out of it vector move = trace_endpos - testorigin; - float nudge = (trace_plane_normal * move) + 0.03125f; // FIXME cvar this constant + float nudge = (trace_plane_normal * move) + 0.03125; // FIXME cvar this constant stuckorigin = stuckorigin + nudge * trace_plane_normal; } diff --git a/qcsrc/common/physics/movetypes/push.qc b/qcsrc/common/physics/movetypes/push.qc index 9179ec4a2..66ff42a69 100644 --- a/qcsrc/common/physics/movetypes/push.qc +++ b/qcsrc/common/physics/movetypes/push.qc @@ -97,7 +97,7 @@ void _Movetype_PushMove(entity this, float dt) // SV_PushMove if(!trace_startsolid) continue; } - vector pivot = check.mins + 0.5 * check.maxs; + vector pivot = check.mins + 0.5 * (check.maxs - check.mins); vector move; if(rotated) @@ -154,13 +154,8 @@ void _Movetype_PushMove(entity this, float dt) // SV_PushMove if(_Movetype_NudgeOutOfSolid_PivotIsKnownGood(check, pivot)) { // hack to invoke all necessary movement triggers - vector move2 = '0 0 0'; - if(!_Movetype_PushEntity(check, move2, true, true)) - { - // entity "check" got teleported - continue; - } - // we could fix it + _Movetype_PushEntity(check, '0 0 0', true, true); + // we could fix it or entity "check" was telported continue; } -- 2.39.2