From 95d4465e3e1c4ac4108ed779c8b8651b15c462c8 Mon Sep 17 00:00:00 2001 From: Misa Date: Sun, 2 Aug 2020 20:47:42 -0700 Subject: [PATCH] Fix bounding logic for enemies When I refactored custom level entity creation logic earlier, I forgot to account for enemy bounds, so enemies would take on the same bounds as platforms. But this is fixed now. --- desktop_version/src/Map.cpp | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/desktop_version/src/Map.cpp b/desktop_version/src/Map.cpp index ec2ea322..202197db 100644 --- a/desktop_version/src/Map.cpp +++ b/desktop_version/src/Map.cpp @@ -1723,12 +1723,24 @@ void mapclass::loadlevel(int rx, int ry) // Platform and enemy bounding boxes int bx1 = 0, by1 = 0, bx2 = 0, by2 = 0; - if (ent.t == 1 || (ent.t == 2 && ent.p1 <= 4)) + bool enemy = ent.t == 1; + bool moving_plat = ent.t == 2 && ent.p1 <= 4; + if (enemy || moving_plat) { - bx1 = room.platx1; - by1 = room.platy1; - bx2 = room.platx2; - by2 = room.platy2; + if (enemy) + { + bx1 = room.enemyx1; + by1 = room.enemyy1; + bx2 = room.enemyx2; + by2 = room.enemyy2; + } + else if (moving_plat) + { + bx1 = room.platx1; + by1 = room.platy1; + bx2 = room.platx2; + by2 = room.platy2; + } // Enlarge bounding boxes to fix warping entities if (warpx && bx1 == 0 && bx2 == 320)