X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Ffiles.c;h=1d7af7cdf7e410bd7e3c5a98df65c8c339bca537;hb=77956845bf8d1656eb487ce728c610f4383ec15d;hp=be481d0d5eac7ca1331a6bbe032aaffac79d2c0c;hpb=0059c96784766d97fc5fa0958ef298ac905af292;p=rocksndiamonds.git
diff --git a/src/files.c b/src/files.c
index be481d0d..1d7af7cd 100644
--- a/src/files.c
+++ b/src/files.c
@@ -11535,30 +11535,26 @@ void CreateLevelSketchImages(void)
for (i = 0; i < NUM_FILE_ELEMENTS; i++)
{
- Bitmap *src_bitmap;
- int src_x, src_y;
int element = getMappedElement(i);
- int graphic = el2edimg(element);
char basename1[16];
char basename2[16];
char *filename1;
char *filename2;
- sprintf(basename1, "%03d.bmp", i);
- sprintf(basename2, "%03ds.bmp", i);
+ sprintf(basename1, "%04d.bmp", i);
+ sprintf(basename2, "%04ds.bmp", i);
filename1 = getPath2(global.create_images_dir, basename1);
filename2 = getPath2(global.create_images_dir, basename2);
- getFixedGraphicSource(graphic, 0, &src_bitmap, &src_x, &src_y);
- BlitBitmap(src_bitmap, bitmap1, src_x, src_y, TILEX, TILEY,
- 0, 0);
+ DrawSizedElement(0, 0, element, TILESIZE);
+ BlitBitmap(drawto, bitmap1, SX, SY, TILEX, TILEY, 0, 0);
if (SDL_SaveBMP(bitmap1->surface, filename1) != 0)
Error(ERR_EXIT, "cannot save level sketch image file '%s'", filename1);
- getMiniGraphicSource(graphic, &src_bitmap, &src_x, &src_y);
- BlitBitmap(src_bitmap, bitmap2, src_x, src_y, MINI_TILEX, MINI_TILEY, 0, 0);
+ DrawSizedElement(0, 0, element, MINI_TILESIZE);
+ BlitBitmap(drawto, bitmap2, SX, SY, MINI_TILEX, MINI_TILEY, 0, 0);
if (SDL_SaveBMP(bitmap2->surface, filename2) != 0)
Error(ERR_EXIT, "cannot save level sketch image file '%s'", filename2);
@@ -11566,15 +11562,26 @@ void CreateLevelSketchImages(void)
free(filename1);
free(filename2);
+ // create corresponding SQL statements (for normal and small images)
+ if (i < 1000)
+ {
+ printf("insert into phpbb_words values (NULL, '`%03d', '');\n", i, i);
+ printf("insert into phpbb_words values (NULL, '¸%03d', '');\n", i, i);
+ }
+
+ printf("insert into phpbb_words values (NULL, '`%04d', '');\n", i, i);
+ printf("insert into phpbb_words values (NULL, '¸%04d', '');\n", i, i);
+
+ // optional: create content for forum level sketch demonstration post
if (options.debug)
- printf("%03d `%03d%c", i, i, (i % 10 < 9 ? ' ' : '\n'));
+ fprintf(stderr, "%03d `%03d%c", i, i, (i % 10 < 9 ? ' ' : '\n'));
}
FreeBitmap(bitmap1);
FreeBitmap(bitmap2);
if (options.debug)
- printf("\n");
+ fprintf(stderr, "\n");
Error(ERR_INFO, "%d normal and small images created", NUM_FILE_ELEMENTS);
@@ -11598,7 +11605,7 @@ void CreateCustomElementImages(char *directory)
int yoffset_ge = (TILEY * NUM_CUSTOM_ELEMENTS / 16);
int i;
- SDLInitVideoDisplay();
+ InitVideoDefaults();
ReCreateBitmap(&backbuffer, video.width, video.height);