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.
This commit is contained in:
Misa 2020-05-13 01:15:34 -07:00 committed by Ethan Lee
parent 2d07090a6b
commit be2d2e1e2a
2 changed files with 4 additions and 4 deletions

View File

@ -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;
}

View File

@ -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;
}
}