+ if (!pix[PIX_DB_BACK] || !pix[PIX_DB_DOOR] || !pix[PIX_DB_FIELD])
+ Error(ERR_EXIT, "cannot create additional pixmaps");
+
+#endif /* !USE_SDL_LIBRARY */
+
+#if DEBUG_TIMING
+ debug_print_timestamp(0, NULL); /* initialize timestamp function */
+#endif
+
+#ifdef DEBUG
+#if 0
+ printf("Test: Loading RocksFont2.pcx ...\n");
+ LoadGfx(PIX_SMALLFONT,&test_pic1);
+ printf("Test: Done.\n");
+ printf("Test: Loading mouse.pcx ...\n");
+ LoadGfx(PIX_SMALLFONT,&test_pic2);
+ printf("Test: Done.\n");
+#endif
+#endif
+
+ LoadGfx(PIX_SMALLFONT, &pic[PIX_SMALLFONT]);
+ DrawInitText(WINDOW_TITLE_STRING, 20, FC_YELLOW);
+ DrawInitText(WINDOW_SUBTITLE_STRING, 50, FC_RED);
+#ifdef MSDOS
+ DrawInitText(PROGRAM_DOS_PORT_STRING, 210, FC_BLUE);
+ rest(200);
+#endif /* MSDOS */
+ DrawInitText("Loading graphics:",120,FC_GREEN);
+
+ for(i=0; i<NUM_PICTURES; i++)
+ if (i != PIX_SMALLFONT)
+ LoadGfx(i,&pic[i]);
+
+#if DEBUG_TIMING
+ debug_print_timestamp(0, "SUMMARY LOADING ALL GRAPHICS:");
+#endif
+
+ /* create additional image buffers for masking of graphics */
+
+#ifdef USE_SDL_LIBRARY
+
+ /* initialize surface array to 'NULL' */
+ for(i=0; i<NUM_TILES; i++)
+ tile_masked[i] = NULL;
+
+ /* create only those masked surfaces we really need */
+ for(i=0; tile_needs_clipping[i].start>=0; i++)
+ {
+ for(j=0; j<tile_needs_clipping[i].count; j++)
+ {
+ int tile = tile_needs_clipping[i].start + j;
+ int graphic = tile;
+ int src_x, src_y;
+ int bitmap_nr;
+ Bitmap src_bitmap;
+
+ getGraphicSource(graphic, &bitmap_nr, &src_x, &src_y);
+ src_bitmap = pix_masked[bitmap_nr];
+
+ /* create surface for masked tile graphic */
+ if ((sdl_image_tmp = SDL_CreateRGBSurface(SDL_SWSURFACE, TILEX, TILEY,
+ WIN_SDL_DEPTH, 0, 0, 0, 0))
+ == NULL)
+ Error(ERR_EXIT, "SDL_CreateRGBSurface() failed: %s", SDL_GetError());
+
+ /* create native transparent surface for current image */
+ SDL_SetColorKey(sdl_image_tmp, SDL_SRCCOLORKEY,
+ SDL_MapRGB(sdl_image_tmp->format, 0x00, 0x00, 0x00));
+ if ((tile_masked[tile] = SDL_DisplayFormat(sdl_image_tmp)) == NULL)
+ Error(ERR_EXIT, "SDL_DisplayFormat() failed: %s", SDL_GetError());
+
+ SDL_FreeSurface(sdl_image_tmp);
+
+ BlitBitmap(src_bitmap, tile_masked[tile], src_x,src_y, TILEX,TILEY, 0,0);
+ }
+ }
+
+#else /* !USE_SDL_LIBRARY */
+
+ /* create graphic context structures needed for clipping */