diff --git a/desktop_version/src/Entity.cpp b/desktop_version/src/Entity.cpp index f9c264aa..9d43985e 100644 --- a/desktop_version/src/Entity.cpp +++ b/desktop_version/src/Entity.cpp @@ -4684,7 +4684,12 @@ void entityclass::collisioncheck(int i, int j, bool scm /*= false*/) } break; case 2: //Moving platforms - if (entitycollide(i, j)) removeblockat(entities[j].xp, entities[j].yp); + if (entitycollide(i, j)) + { + //Disable collision temporarily so we don't push the person out! + //Collision will be restored at end of platform update loop in gamelogic + nocollisionat(entities[j].xp, entities[j].yp); + } break; case 3: //Entity to entity if(entities[j].onentity>0) diff --git a/desktop_version/src/Logic.cpp b/desktop_version/src/Logic.cpp index 3c409f12..3b5984db 100644 --- a/desktop_version/src/Logic.cpp +++ b/desktop_version/src/Logic.cpp @@ -894,14 +894,16 @@ void gamelogic() continue; } - obj.removeblockat(obj.entities[i].xp, obj.entities[i].yp); + int prevx = obj.entities[i].xp; + int prevy = obj.entities[i].yp; + obj.nocollisionat(prevx, prevy); bool entitygone = obj.updateentities(i); // Behavioral logic if (entitygone) continue; obj.updateentitylogic(i); // Basic Physics obj.entitymapcollision(i); // Collisions with walls - obj.createblock(0, obj.entities[i].xp, obj.entities[i].yp, obj.entities[i].w, obj.entities[i].h); + obj.moveblockto(prevx, prevy, obj.entities[i].xp, obj.entities[i].yp, obj.entities[i].w, obj.entities[i].h); obj.movingplatformfix(i, obj.getplayer()); if (game.supercrewmate) { @@ -920,14 +922,16 @@ void gamelogic() continue; } - obj.removeblockat(obj.entities[ie].xp, obj.entities[ie].yp); + int prevx = obj.entities[ie].xp; + int prevy = obj.entities[ie].yp; + obj.nocollisionat(prevx, prevy); bool entitygone = obj.updateentities(ie); // Behavioral logic if (entitygone) continue; obj.updateentitylogic(ie); // Basic Physics obj.entitymapcollision(ie); // Collisions with walls - obj.hormovingplatformfix(ie); + obj.moveblockto(prevx, prevy, obj.entities[ie].xp, obj.entities[ie].yp, obj.entities[ie].w, obj.entities[ie].h); } //is the player standing on a moving platform? int i = obj.getplayer(); @@ -1061,13 +1065,19 @@ void gamelogic() //ascii snakes if (obj.entities[i].xp <= -80) { - if (obj.entities[i].isplatform) obj.removeblockat(obj.entities[i].xp, obj.entities[i].yp); + if (obj.entities[i].isplatform) + { + obj.moveblockto(obj.entities[i].xp, obj.entities[i].yp, obj.entities[i].xp + 400, obj.entities[i].yp, obj.entities[i].w, obj.entities[i].h); + } obj.entities[i].xp += 400; obj.entities[i].oldxp += 400; } else if (obj.entities[i].xp > 320) { - if (obj.entities[i].isplatform) obj.removeblockat(obj.entities[i].xp, obj.entities[i].yp); + if (obj.entities[i].isplatform) + { + obj.moveblockto(obj.entities[i].xp, obj.entities[i].yp, obj.entities[i].xp - 400, obj.entities[i].yp, obj.entities[i].w, obj.entities[i].h); + } obj.entities[i].xp -= 400; obj.entities[i].oldxp -= 400; } @@ -1076,13 +1086,19 @@ void gamelogic() { if (obj.entities[i].xp <= -10) { - if (obj.entities[i].isplatform) obj.removeblockat(obj.entities[i].xp, obj.entities[i].yp); + if (obj.entities[i].isplatform) + { + obj.moveblockto(obj.entities[i].xp, obj.entities[i].yp, obj.entities[i].xp + 320, obj.entities[i].yp, obj.entities[i].w, obj.entities[i].h); + } obj.entities[i].xp += 320; obj.entities[i].oldxp += 320; } else if (obj.entities[i].xp > 310) { - if (obj.entities[i].isplatform) obj.removeblockat(obj.entities[i].xp, obj.entities[i].yp); + if (obj.entities[i].isplatform) + { + obj.moveblockto(obj.entities[i].xp, obj.entities[i].yp, obj.entities[i].xp - 320, obj.entities[i].yp, obj.entities[i].w, obj.entities[i].h); + } obj.entities[i].xp -= 320; obj.entities[i].oldxp -= 320; } @@ -1098,13 +1114,19 @@ void gamelogic() if(obj.entities[i].type<50){ //Don't warp warp lines if (obj.entities[i].yp <= -12) { - if (obj.entities[i].isplatform) obj.removeblockat(obj.entities[i].xp, obj.entities[i].yp); + if (obj.entities[i].isplatform) + { + obj.moveblockto(obj.entities[i].xp, obj.entities[i].yp, obj.entities[i].xp, obj.entities[i].yp + 232, obj.entities[i].w, obj.entities[i].h); + } obj.entities[i].yp += 232; obj.entities[i].oldyp += 232; } else if (obj.entities[i].yp > 226) { - if (obj.entities[i].isplatform) obj.removeblockat(obj.entities[i].xp, obj.entities[i].yp); + if (obj.entities[i].isplatform) + { + obj.moveblockto(obj.entities[i].xp, obj.entities[i].yp, obj.entities[i].xp, obj.entities[i].yp - 232, obj.entities[i].w, obj.entities[i].h); + } obj.entities[i].yp -= 232; obj.entities[i].oldyp -= 232; } @@ -1122,13 +1144,19 @@ void gamelogic() { if (obj.entities[i].xp <= -30) { - if (obj.entities[i].isplatform) obj.removeblockat(obj.entities[i].xp, obj.entities[i].yp); + if (obj.entities[i].isplatform) + { + obj.moveblockto(obj.entities[i].xp, obj.entities[i].yp, obj.entities[i].xp + 350, obj.entities[i].yp, obj.entities[i].w, obj.entities[i].h); + } obj.entities[i].xp += 350; obj.entities[i].oldxp += 350; } else if (obj.entities[i].xp > 320) { - if (obj.entities[i].isplatform) obj.removeblockat(obj.entities[i].xp, obj.entities[i].yp); + if (obj.entities[i].isplatform) + { + obj.moveblockto(obj.entities[i].xp, obj.entities[i].yp, obj.entities[i].xp - 350, obj.entities[i].yp, obj.entities[i].w, obj.entities[i].h); + } obj.entities[i].xp -= 350; obj.entities[i].oldxp -= 350; }