- 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);
- }
- }