From 2913929efaf274a0c739a2e6114f34c635265798 Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Thu, 10 Mar 2022 17:52:13 +0100 Subject: [PATCH] added wrapper function to draw graphic at level playfield position --- src/game.c | 34 +++++++++++++--------------------- src/tools.c | 5 +++++ src/tools.h | 1 + 3 files changed, 19 insertions(+), 21 deletions(-) diff --git a/src/game.c b/src/game.c index 0c818469..3bfddc7f 100644 --- a/src/game.c +++ b/src/game.c @@ -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; } } diff --git a/src/tools.c b/src/tools.c index c8070fa2..bde98790 100644 --- a/src/tools.c +++ b/src/tools.c @@ -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; diff --git a/src/tools.h b/src/tools.h index 19836531..dc5da845 100644 --- a/src/tools.h +++ b/src/tools.h @@ -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); -- 2.34.1