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.
main
Misa 3 years ago committed by Ethan Lee
parent 2d07090a6b
commit be2d2e1e2a
  1. 4
      desktop_version/src/Entity.cpp
  2. 4
      mobile_version/src/entityclass.as

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

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

Loading…
Cancel
Save