fixed graphical bugs with off-screen playfield movement in MM engine
authorHolger Schemel <info@artsoft.org>
Fri, 31 Mar 2023 18:17:13 +0000 (20:17 +0200)
committerHolger Schemel <info@artsoft.org>
Fri, 31 Mar 2023 18:17:13 +0000 (20:17 +0200)
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

index 39bb24671273009ff21270cc47acb651e879e626..8d77a8c01908e112897b24ca36803572bbe5992e 100644 (file)
@@ -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)