boolean LoadNativeLevel_BD(char *, int, boolean);
boolean SaveNativeLevel_BD(char *);
+void PreparePreviewTileBitmap_BD(Bitmap *, int);
+void SetPreviewTileBitmapReference_BD(Bitmap *);
+Bitmap *GetPreviewTileBitmap_BD(Bitmap *);
+
unsigned int InitEngineRandom_BD(int);
void InitGameEngine_BD(void);
void GameActions_BD(byte[MAX_PLAYERS]);
gd_prepare_tile_bitmap(native_bd_level.cave, g->bitmap, 1);
}
+void PreparePreviewTileBitmap_BD(Bitmap *bitmap, int scale_down_factor)
+{
+ gd_prepare_tile_bitmap(native_bd_level.cave, bitmap, scale_down_factor);
+}
+
+void SetPreviewTileBitmapReference_BD(Bitmap *bitmap)
+{
+ gd_set_tile_bitmap_reference(bitmap);
+}
+
+Bitmap *GetPreviewTileBitmap_BD(Bitmap *bitmap)
+{
+ return gd_get_tile_bitmap(bitmap);
+}
+
unsigned int InitEngineRandom_BD(int seed)
{
if (seed == NEW_RANDOMIZE)
game.envelope_active = FALSE;
}
+static Bitmap *GetPreviewTileBitmap(Bitmap *bitmap)
+{
+ if (level.game_engine_type == GAME_ENGINE_TYPE_BD)
+ return GetPreviewTileBitmap_BD(bitmap);
+
+ return bitmap;
+}
+
static void DrawPreviewElement(int dst_x, int dst_y, int element, int tilesize)
{
if (IS_MM_WALL(element))
int graphic = el2preimg(element);
getSizedGraphicSource(graphic, 0, tilesize, &src_bitmap, &src_x, &src_y);
+
+ // for BD style levels, maybe use bitmap with level-specific colors
+ src_bitmap = GetPreviewTileBitmap(src_bitmap);
+
BlitBitmap(src_bitmap, drawto, src_x, src_y, tilesize, tilesize,
dst_x, dst_y);
}
}
}
+static void PreparePreviewTileBitmap(void)
+{
+ // check if special preview bitmap with level-specific colors should be created
+ if (level.game_engine_type != GAME_ENGINE_TYPE_BD)
+ return;
+
+ // use original sized bitmap (else reduced color palette is lost by downscaling)
+ int original_tilesize = MAX(MINI_TILESIZE, preview.tile_size);
+ int scale_down_factor = original_tilesize / preview.tile_size;
+ Bitmap *src_bitmap;
+ int src_x, src_y;
+ int element = EL_BD_ROCK;
+ int graphic = el2preimg(element);
+
+ // create special preview bitmap and scale it down to preview tile size
+ getSizedGraphicSource(graphic, 0, original_tilesize, &src_bitmap, &src_x, &src_y);
+ PreparePreviewTileBitmap_BD(src_bitmap, scale_down_factor);
+
+ // force using special preview bitmap to replace original preview bitmap
+ getSizedGraphicSource(graphic, 0, preview.tile_size, &src_bitmap, &src_x, &src_y);
+ SetPreviewTileBitmapReference_BD(src_bitmap);
+}
+
void DrawPreviewLevelInitial(void)
{
+ PreparePreviewTileBitmap(); // only needed for native BD style levels
+
DrawPreviewLevelExt(TRUE);
DrawPreviewPlayers();
}