added wrapper function to draw graphic at level playfield position
authorHolger Schemel <holger.schemel@virtion.de>
Thu, 10 Mar 2022 16:52:13 +0000 (17:52 +0100)
committerHolger Schemel <holger.schemel@virtion.de>
Thu, 10 Mar 2022 16:52:32 +0000 (17:52 +0100)
src/game.c
src/tools.c
src/tools.h

index 0c8184698768b0831f1c2b7dc6b8cacd25b59cad..3bfddc7fdfa0dceb3929735f2b42636e3a0f9044 100644 (file)
@@ -6080,11 +6080,11 @@ static void Explode(int ex, int ey, int phase, int mode)
     }
     else if (IS_WALKABLE_UNDER(Back[x][y]))
     {
-      DrawScreenGraphic(SCREENX(x), SCREENY(y), graphic, frame);
+      DrawLevelGraphic(x, y, graphic, frame);
       DrawLevelElementThruMask(x, y, Back[x][y]);
     }
     else if (!IS_WALKABLE_INSIDE(Back[x][y]))
-      DrawScreenGraphic(SCREENX(x), SCREENY(y), graphic, frame);
+      DrawLevelGraphic(x, y, graphic, frame);
   }
 }
 
@@ -9145,7 +9145,7 @@ static void AmoebaGrowing(int x, int y)
       int frame = getGraphicAnimationFrame(IMG_AMOEBA_GROWING,
                                           6 - MovDelay[x][y]);
 
-      DrawScreenGraphic(SCREENX(x), SCREENY(y), IMG_AMOEBA_GROWING, frame);
+      DrawLevelGraphic(x, y, IMG_AMOEBA_GROWING, frame);
     }
 
     if (!MovDelay[x][y])
@@ -9178,7 +9178,7 @@ static void AmoebaShrinking(int x, int y)
       int frame = getGraphicAnimationFrame(IMG_AMOEBA_SHRINKING,
                                           6 - MovDelay[x][y]);
 
-      DrawScreenGraphic(SCREENX(x), SCREENY(y), IMG_AMOEBA_SHRINKING, frame);
+      DrawLevelGraphic(x, y, IMG_AMOEBA_SHRINKING, frame);
     }
 
     if (!MovDelay[x][y])
@@ -9696,7 +9696,7 @@ static void MauerWaechst(int x, int y)
       int graphic = el_dir2img(Tile[x][y], GfxDir[x][y]);
       int frame = getGraphicAnimationFrame(graphic, 17 - MovDelay[x][y]);
 
-      DrawScreenGraphic(SCREENX(x), SCREENY(y), graphic, frame);
+      DrawLevelGraphic(x, y, graphic, frame);
     }
 
     if (!MovDelay[x][y])
@@ -9771,8 +9771,7 @@ static void MauerAbleger(int ax, int ay)
       Store[ax][ay-1] = element;
       GfxDir[ax][ay-1] = MovDir[ax][ay-1] = MV_UP;
       if (IN_SCR_FIELD(SCREENX(ax), SCREENY(ay-1)))
-       DrawScreenGraphic(SCREENX(ax), SCREENY(ay - 1),
-                          IMG_EXPANDABLE_WALL_GROWING_UP, 0);
+       DrawLevelGraphic(ax, ay - 1, IMG_EXPANDABLE_WALL_GROWING_UP, 0);
       new_wall = TRUE;
     }
     if (unten_frei)
@@ -9781,8 +9780,7 @@ static void MauerAbleger(int ax, int ay)
       Store[ax][ay+1] = element;
       GfxDir[ax][ay+1] = MovDir[ax][ay+1] = MV_DOWN;
       if (IN_SCR_FIELD(SCREENX(ax), SCREENY(ay+1)))
-       DrawScreenGraphic(SCREENX(ax), SCREENY(ay + 1),
-                          IMG_EXPANDABLE_WALL_GROWING_DOWN, 0);
+       DrawLevelGraphic(ax, ay + 1, IMG_EXPANDABLE_WALL_GROWING_DOWN, 0);
       new_wall = TRUE;
     }
   }
@@ -9798,8 +9796,7 @@ static void MauerAbleger(int ax, int ay)
       Store[ax-1][ay] = element;
       GfxDir[ax-1][ay] = MovDir[ax-1][ay] = MV_LEFT;
       if (IN_SCR_FIELD(SCREENX(ax-1), SCREENY(ay)))
-       DrawScreenGraphic(SCREENX(ax - 1), SCREENY(ay),
-                          IMG_EXPANDABLE_WALL_GROWING_LEFT, 0);
+       DrawLevelGraphic(ax - 1, ay, IMG_EXPANDABLE_WALL_GROWING_LEFT, 0);
       new_wall = TRUE;
     }
 
@@ -9809,8 +9806,7 @@ static void MauerAbleger(int ax, int ay)
       Store[ax+1][ay] = element;
       GfxDir[ax+1][ay] = MovDir[ax+1][ay] = MV_RIGHT;
       if (IN_SCR_FIELD(SCREENX(ax+1), SCREENY(ay)))
-       DrawScreenGraphic(SCREENX(ax + 1), SCREENY(ay),
-                          IMG_EXPANDABLE_WALL_GROWING_RIGHT, 0);
+       DrawLevelGraphic(ax + 1, ay, IMG_EXPANDABLE_WALL_GROWING_RIGHT, 0);
       new_wall = TRUE;
     }
   }
@@ -9879,8 +9875,7 @@ static void MauerAblegerStahl(int ax, int ay)
       Store[ax][ay-1] = element;
       GfxDir[ax][ay-1] = MovDir[ax][ay-1] = MV_UP;
       if (IN_SCR_FIELD(SCREENX(ax), SCREENY(ay-1)))
-       DrawScreenGraphic(SCREENX(ax), SCREENY(ay - 1),
-                          IMG_EXPANDABLE_STEELWALL_GROWING_UP, 0);
+       DrawLevelGraphic(ax, ay - 1, IMG_EXPANDABLE_STEELWALL_GROWING_UP, 0);
       new_wall = TRUE;
     }
     if (unten_frei)
@@ -9889,8 +9884,7 @@ static void MauerAblegerStahl(int ax, int ay)
       Store[ax][ay+1] = element;
       GfxDir[ax][ay+1] = MovDir[ax][ay+1] = MV_DOWN;
       if (IN_SCR_FIELD(SCREENX(ax), SCREENY(ay+1)))
-       DrawScreenGraphic(SCREENX(ax), SCREENY(ay + 1),
-                          IMG_EXPANDABLE_STEELWALL_GROWING_DOWN, 0);
+       DrawLevelGraphic(ax, ay + 1, IMG_EXPANDABLE_STEELWALL_GROWING_DOWN, 0);
       new_wall = TRUE;
     }
   }
@@ -9904,8 +9898,7 @@ static void MauerAblegerStahl(int ax, int ay)
       Store[ax-1][ay] = element;
       GfxDir[ax-1][ay] = MovDir[ax-1][ay] = MV_LEFT;
       if (IN_SCR_FIELD(SCREENX(ax-1), SCREENY(ay)))
-       DrawScreenGraphic(SCREENX(ax - 1), SCREENY(ay),
-                          IMG_EXPANDABLE_STEELWALL_GROWING_LEFT, 0);
+       DrawLevelGraphic(ax - 1, ay, IMG_EXPANDABLE_STEELWALL_GROWING_LEFT, 0);
       new_wall = TRUE;
     }
 
@@ -9915,8 +9908,7 @@ static void MauerAblegerStahl(int ax, int ay)
       Store[ax+1][ay] = element;
       GfxDir[ax+1][ay] = MovDir[ax+1][ay] = MV_RIGHT;
       if (IN_SCR_FIELD(SCREENX(ax+1), SCREENY(ay)))
-       DrawScreenGraphic(SCREENX(ax + 1), SCREENY(ay),
-                          IMG_EXPANDABLE_STEELWALL_GROWING_RIGHT, 0);
+       DrawLevelGraphic(ax + 1, ay, IMG_EXPANDABLE_STEELWALL_GROWING_RIGHT, 0);
       new_wall = TRUE;
     }
   }
index c8070fa2365f3349e0e68b3a9785f3c9c218f564..bde987901f8b4181c824ae673faa4cde114aea90 100644 (file)
@@ -2527,6 +2527,11 @@ void DrawScreenGraphic(int x, int y, int graphic, int frame)
   }
 }
 
+void DrawLevelGraphic(int x, int y, int graphic, int frame)
+{
+  DrawScreenGraphic(SCREENX(x), SCREENY(y), graphic, frame);
+}
+
 void DrawScreenElement(int x, int y, int element)
 {
   int mask_mode = NO_MASKING;
index 1983653110101a86f592907767c2e1c1d9bc0cfa..dc5da845c126f16f57c3cd97347e050a23adc834 100644 (file)
@@ -183,6 +183,7 @@ void DrawLevelFieldCrumbled(int, int);
 void DrawLevelFieldCrumbledDigging(int, int, int, int);
 void DrawLevelFieldCrumbledNeighbours(int, int);
 void DrawScreenGraphic(int, int, int, int);
+void DrawLevelGraphic(int, int, int, int);
 void DrawScreenElement(int, int, int);
 void DrawLevelElement(int, int, int);
 void DrawScreenField(int, int);