From 2181d7515fcdeae73c7482c3e19cc6120279b556 Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Fri, 31 Mar 2023 20:17:13 +0200 Subject: [PATCH] fixed graphical bugs with off-screen playfield movement in MM engine This changes handles graphical bugs that may occur if the playfield of levels played with the MM game engine are larger than the visible part of the playfield. (This is not supported with MM style levels, but may occur when using custom artwork with smaller playfield viewport than intended by the level designer.) The problem could be seen with levels where pacman game elements leave and re-enter the visible part of the playfield. --- src/game_mm/mm_tools.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/game_mm/mm_tools.c b/src/game_mm/mm_tools.c index 39bb2467..8d77a8c0 100644 --- a/src/game_mm/mm_tools.c +++ b/src/game_mm/mm_tools.c @@ -364,7 +364,24 @@ void DrawScreenField_MM(int x, int y) void DrawLevelField_MM(int x, int y) { - DrawScreenField_MM(x, y); + if (IN_SCR_FIELD(SCREENX(x), SCREENY(y))) + DrawScreenField_MM(SCREENX(x), SCREENY(y)); + else if (IS_MOVING(x, y)) + { + int newx,newy; + + Moving2Blocked(x, y, &newx, &newy); + if (IN_SCR_FIELD(SCREENX(newx), SCREENY(newy))) + DrawScreenField_MM(SCREENX(newx), SCREENY(newy)); + } + else if (IS_BLOCKED(x, y)) + { + int oldx, oldy; + + Blocked2Moving(x, y, &oldx, &oldy); + if (IN_SCR_FIELD(SCREENX(oldx), SCREENY(oldy))) + DrawScreenField_MM(SCREENX(oldx), SCREENY(oldy)); + } } void DrawMiniElement_MM(int x, int y, int element) -- 2.34.1