From be2d2e1e2a6328900dee11527f8a54d05139485f Mon Sep 17 00:00:00 2001 From: Misa Date: Wed, 13 May 2020 01:15:34 -0700 Subject: [PATCH] Fix 1x1 quicksand collision optimization not working We need to replace an "or" with an "and". My best guess for this oversight happening was because of the weird ordering. The code originally did "temp < 30" first and "temp > -30" second instead of the other way around. With the weird ordering, it becomes more natural to insert an "or" instead of an "and". So I swapped around the ordering just for good measure. This is also fixed in the mobile version. --- desktop_version/src/Entity.cpp | 4 ++-- mobile_version/src/entityclass.as | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/desktop_version/src/Entity.cpp b/desktop_version/src/Entity.cpp index b0979ede..1a9023ec 100644 --- a/desktop_version/src/Entity.cpp +++ b/desktop_version/src/Entity.cpp @@ -4685,10 +4685,10 @@ void entityclass::entitycollisioncheck() { //ok; only check the actual collision if they're in a close proximity temp = entities[i].yp - entities[j].yp; - if (temp < 30 || temp > -30) + if (temp > -30 && temp < 30) { temp = entities[i].xp - entities[j].xp; - if (temp < 30 || temp > -30) + if (temp > -30 && temp < 30) { if (entitycollide(i, j)) entities[j].state = entities[j].onentity; } diff --git a/mobile_version/src/entityclass.as b/mobile_version/src/entityclass.as index a3ce8188..d1deaed8 100644 --- a/mobile_version/src/entityclass.as +++ b/mobile_version/src/entityclass.as @@ -3851,9 +3851,9 @@ if (entities[j].onentity > 0) { //ok; only check the actual collision if they're in a close proximity temp = entities[i].yp - entities[j].yp; - if (temp < 30 || temp > -30) { + if (temp > -30 && temp < 30) { temp = entities[i].xp - entities[j].xp; - if (temp < 30 || temp > -30) { + if (temp > -30 && temp < 30) { if (entitycollide(i, j)) entities[j].state = entities[j].onentity; } }