From: Holger Schemel Date: Mon, 9 Dec 2024 18:40:35 +0000 (+0100) Subject: added function to free tile cursor (snow) textures X-Git-Tag: 4.4.0.0-test-6~20 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=f343ddb54f8b6cf3a85f046989f933edce34b547;p=rocksndiamonds.git added function to free tile cursor (snow) textures --- diff --git a/src/game_mm/export_mm.h b/src/game_mm/export_mm.h index 51b5ccec..d03ede65 100644 --- a/src/game_mm/export_mm.h +++ b/src/game_mm/export_mm.h @@ -250,6 +250,7 @@ void GameActions_MM(struct MouseActionInfo); void DrawLaser_MM(void); void DrawTileCursor_MM(int, int, boolean); +void FreeTileCursorTextures_MM(void); boolean ClickElement(int, int, int); diff --git a/src/game_mm/mm_tools.c b/src/game_mm/mm_tools.c index b07a95fc..7bb46b0c 100644 --- a/src/game_mm/mm_tools.c +++ b/src/game_mm/mm_tools.c @@ -1057,6 +1057,16 @@ static void DrawTileCursor_Xsn(int draw_target) } } +static void FreeTileCursorTextures_Xsn(void) +{ + int i; + + SDLFreeBitmapTextures(xsn.bitmap); + + for (i = 0; i < num_xsn_data; i++) + SDLFreeBitmapTextures(xsn_data[i].bitmap); +} + void DrawTileCursor_MM(int draw_target, int drawing_stage, boolean tile_cursor_active) { @@ -1124,6 +1134,11 @@ void DrawTileCursor_MM(int draw_target, int drawing_stage, dst_x, dst_y); } +void FreeTileCursorTextures_MM(void) +{ + FreeTileCursorTextures_Xsn(); +} + Pixel ReadPixel(DrawBuffer *bitmap, int x, int y) { return GetPixel(bitmap, x, y); diff --git a/src/game_mm/mm_tools.h b/src/game_mm/mm_tools.h index 28ba5c33..5ac9f49e 100644 --- a/src/game_mm/mm_tools.h +++ b/src/game_mm/mm_tools.h @@ -89,6 +89,7 @@ void DrawWalls_MM(int, int, int); void DrawWallsAnimation_MM(int, int, int, int, int); void DrawMicroLevel_MM(int, int, boolean); void DrawTileCursor_MM(int, int, boolean); +void FreeTileCursorTextures_MM(void); boolean Request(char *, unsigned int); unsigned int OpenDoor(unsigned int); diff --git a/src/init.c b/src/init.c index 04d55b8b..f68d10a9 100644 --- a/src/init.c +++ b/src/init.c @@ -452,6 +452,7 @@ void InitImageTextures(void) void FreeAllTextures(void) { FreeAllImageTextures(); + FreeTileCursorTextures(); } static int getFontSpecialSuffix(void) diff --git a/src/tools.c b/src/tools.c index 1fdc53e9..89d065c8 100644 --- a/src/tools.c +++ b/src/tools.c @@ -656,6 +656,11 @@ void DrawTileCursor(int draw_target, int drawing_stage) DrawTileCursor_MM(draw_target, drawing_stage, tile_cursor_active); } +void FreeTileCursorTextures(void) +{ + FreeTileCursorTextures_MM(); +} + void BlitScreenToBitmapExt_RND(Bitmap *target_bitmap, int fx, int fy) { BlitBitmap(drawto_field, target_bitmap, fx, fy, SXSIZE, SYSIZE, SX, SY); diff --git a/src/tools.h b/src/tools.h index fcb8aee8..a960946c 100644 --- a/src/tools.h +++ b/src/tools.h @@ -83,6 +83,7 @@ void DrawMaskedBorder_ALL(void); void DrawMaskedBorder(int); void DrawMaskedBorderToTarget(int); void DrawTileCursor(int, int); +void FreeTileCursorTextures(void); void SetDrawtoField(int); int GetDrawtoField(void);