From 1ec7a01403d374273c3090fe93ca2e59869802f0 Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Mon, 2 Mar 2015 13:40:34 +0100 Subject: [PATCH] updated special function to generate custom element graphics --- src/files.c | 12 ++++++------ src/files.h | 1 + src/init.c | 6 ++++++ src/main.c | 1 + 4 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/files.c b/src/files.c index d79e5f55..21b2472d 100644 --- a/src/files.c +++ b/src/files.c @@ -9772,24 +9772,24 @@ void CreateLevelSketchImages() /* create and save images for custom and group elements (raw BMP format) */ /* ------------------------------------------------------------------------- */ -void CreateCustomElementImages() +void CreateCustomElementImages(char *filename) { #if defined(TARGET_SDL) - char *filename = "graphics.classic/RocksCE.bmp"; + char *src_basename = "RocksCE.tmpl.ilbm"; Bitmap *bitmap; Bitmap *src_bitmap; - int dummy_graphic = IMG_CUSTOM_99; int yoffset_ce = 0; int yoffset_ge = (TILEY * NUM_CUSTOM_ELEMENTS / 16); - int src_x, src_y; int i; + SDLInitVideoDisplay(); + + src_bitmap = LoadCustomImage(src_basename); + bitmap = CreateBitmap(TILEX * 16 * 2, TILEY * (NUM_CUSTOM_ELEMENTS + NUM_GROUP_ELEMENTS) / 16, DEFAULT_DEPTH); - getFixedGraphicSource(dummy_graphic, 0, &src_bitmap, &src_x, &src_y); - for (i = 0; i < NUM_CUSTOM_ELEMENTS; i++) { int x = i % 16; diff --git a/src/files.h b/src/files.h index c7f72437..3041cc83 100644 --- a/src/files.h +++ b/src/files.h @@ -70,5 +70,6 @@ void LoadHelpTextInfo(); void ConvertLevels(); void CreateLevelSketchImages(); +void CreateCustomElementImages(char *); #endif /* FILES_H */ diff --git a/src/init.c b/src/init.c index e4b15279..38dd52b6 100644 --- a/src/init.c +++ b/src/init.c @@ -4734,6 +4734,12 @@ void Execute_Command(char *command) Error(ERR_EXIT, "image target directory '%s' not found or not writable", global.create_images_dir); } + else if (strPrefix(command, "create CE image ")) + { + CreateCustomElementImages(&command[16]); + + exit(0); + } #if DEBUG #if defined(TARGET_SDL2) diff --git a/src/main.c b/src/main.c index 9bcc40a8..836e0594 100644 --- a/src/main.c +++ b/src/main.c @@ -5580,6 +5580,7 @@ static void print_usage() " \"autoplay LEVELDIR [NR ...]\" play level tapes for LEVELDIR\n" " \"convert LEVELDIR [NR]\" convert levels in LEVELDIR\n" " \"create images DIRECTORY\" write BMP images to DIRECTORY\n" + " \"create CE image FILE\" write BMP image to FILE\n" "\n", program.command_basename); } -- 2.34.1