{ "graphic_7", UNDEFINED_FILENAME },
{ "graphic_8", UNDEFINED_FILENAME },
- // game graphics template for level-specific colors for native BD levels
- { "bdx_game_graphics_color_template", UNDEFINED_FILENAME },
-
#include "conf_chr.c" // include auto-generated data structure definitions
#include "conf_cus.c" // include auto-generated data structure definitions
#include "conf_grp.c" // include auto-generated data structure definitions
#define GD_KEY_CHAR 12
#define GD_COMMENT_CHAR 13
-// pointer to tile bitmap (which may be prepared with level-specific colors)
-static Bitmap *gd_tile_bitmap = NULL;
-// pointer to reference tile bitmap (without level-specific colors)
-static Bitmap *gd_tile_bitmap_reference = NULL;
-
// optional title screen bitmaps (foreground and background)
static Bitmap *gd_title_screen_bitmaps[2] = { NULL, NULL };
// graphic info for game objects/frames and players/actions/frames
struct GraphicInfo_BD graphic_info_bd_object[O_MAX_ALL][8];
-// graphic info for game graphics template for level-specific colors
-struct GraphicInfo_BD graphic_info_bd_color_template;
static inline int c64_png_colors(int r, int g, int b, int a)
{
return has_c64_colors;
}
-boolean gd_bitmap_has_c64_colors(Bitmap *bitmap)
-{
- return surface_has_c64_colors(bitmap->surface);
-}
-
// sets one of the colors in the indexed palette of an sdl surface to a GdColor.
static void set_surface_palette_color(SDL_Surface *surface, int index, GdColor col)
{
return tile_bitmap_c64;
}
-void gd_prepare_tile_bitmap(GdCave *cave, Bitmap *bitmap, int scale_down_factor)
-{
- static SDL_Surface *tile_surface_c64 = NULL;
- static Bitmap *gd_tile_bitmap_original = NULL;
- static int scale_down_factor_last = -1;
-
- if (program.headless)
- return;
-
- // check if tile bitmap has changed (different artwork or tile size selected)
- if (bitmap != gd_tile_bitmap_original || scale_down_factor != scale_down_factor_last)
- {
- // check if tile bitmap has limited C64 style colors
- tile_surface_c64 = get_tile_surface_c64(bitmap->surface, scale_down_factor);
-
- // store original tile bitmap from current artwork set and scaling factor
- gd_tile_bitmap_original = bitmap;
- scale_down_factor_last = scale_down_factor;
-
- // store reference tile bitmap from current artwork set (may be changed later)
- gd_tile_bitmap_reference = bitmap;
- }
-
- // check if tile bitmap should be colored for next game
- if (tile_surface_c64 != NULL)
- {
- // set tile bitmap to bitmap with level-specific colors
- gd_tile_bitmap = get_tile_bitmap_c64(cave, tile_surface_c64);
- }
- else
- {
- // no special tile bitmap available for this artwork set
- gd_tile_bitmap = NULL;
- }
-}
-
-void gd_set_tile_bitmap_reference(Bitmap *bitmap)
-{
- gd_tile_bitmap_reference = bitmap;
-}
-
-Bitmap *gd_get_tile_bitmap(Bitmap *bitmap)
-{
- // if no special tile bitmap available, keep using default tile bitmap
- if (gd_tile_bitmap == NULL)
- return bitmap;
-
- // if default bitmap refers to tile bitmap, use special tile bitmap
- if (bitmap == gd_tile_bitmap_reference)
- return gd_tile_bitmap;
-
- return bitmap;
-}
-
Bitmap *gd_get_colored_bitmap_from_template(Bitmap *template_bitmap)
{
SDL_Surface *template_surface = get_tile_surface_c64(template_bitmap->surface, 1);
if (!is_moving || !use_smooth_movements)
{
struct GraphicInfo_BD *g = &graphic_info_bd_object[draw][frame];
- Bitmap *tile_bitmap = gd_get_tile_bitmap(g->bitmap);
- blit_bitmap(tile_bitmap, dest, g->src_x, g->src_y, cell_size, cell_size, sx, sy);
+ blit_bitmap(g->bitmap, dest, g->src_x, g->src_y, cell_size, cell_size, sx, sy);
return;
}
boolean digging_tile = ((el_can_dig(tile) || tile == O_SPACE) && el_diggable(tile_last));
int draw_back = (!is_moving_to ? draw : digging_tile ? draw_last : O_SPACE);
struct GraphicInfo_BD *g = &graphic_info_bd_object[draw_back][frame];
- Bitmap *tile_bitmap = gd_get_tile_bitmap(g->bitmap);
- blit_bitmap(tile_bitmap, dest, g->src_x, g->src_y, cell_size, cell_size, sx, sy);
+ blit_bitmap(g->bitmap, dest, g->src_x, g->src_y, cell_size, cell_size, sx, sy);
}
// get shifted position between cave fields the game element is moving from/to
if (is_moving_from && !is_diagonal_movement_from) // skip if source moving diagonally
{
struct GraphicInfo_BD *g = &graphic_info_bd_object[draw_from][frame];
- Bitmap *tile_bitmap = gd_get_tile_bitmap(g->bitmap);
int xsize = (dx_from != 0 ? shift : cell_size);
int ysize = (dy_from != 0 ? shift : cell_size);
int gx = g->src_x + (dx_from < 0 ? cell_size - shift : 0);
if (!el_diggable(tile))
blit_bitmap = BlitBitmapMasked;
- blit_bitmap(tile_bitmap, dest, gx, gy, xsize, ysize, tx, ty);
+ blit_bitmap(g->bitmap, dest, gx, gy, xsize, ysize, tx, ty);
// when using dynamic scheduling (mainly BD1 levels), redraw tile in next frame
game->gfx_buffer[y][x] |= GD_REDRAW;
dx_to = dy_to = 0;
struct GraphicInfo_BD *g = &graphic_info_bd_object[draw_to][frame];
- Bitmap *tile_bitmap = gd_get_tile_bitmap(g->bitmap);
int xsize = (dx_to != 0 ? cell_size - shift : cell_size);
int ysize = (dy_to != 0 ? cell_size - shift : cell_size);
int gx = g->src_x + (dx_to > 0 ? shift : 0);
gy = (dy_to != 0 ? shift - gy : gy);
}
- blit_bitmap(tile_bitmap, dest, gx, gy, xsize, ysize, tx, ty);
+ blit_bitmap(g->bitmap, dest, gx, gy, xsize, ysize, tx, ty);
// when using dynamic scheduling (mainly BD1 levels), redraw tile in next frame
game->gfx_buffer[y][x] |= GD_REDRAW;
void gd_init_play_area(void);
-boolean gd_bitmap_has_c64_colors(Bitmap *bitmap);
-void gd_prepare_tile_bitmap(GdCave *cave, Bitmap *bitmap, int scale_down_factor);
-void gd_set_tile_bitmap_reference(Bitmap *bitmap);
-Bitmap *gd_get_tile_bitmap(Bitmap *bitmap);
Bitmap *gd_get_colored_bitmap_from_template(Bitmap *template_bitmap);
int gd_drawcave(Bitmap *dest, GdGame *gameplay, boolean);
extern struct GameInfo_BD game_bd;
extern struct LevelInfo_BD native_bd_level;
extern struct GraphicInfo_BD graphic_info_bd_object[O_MAX_ALL][8];
-extern struct GraphicInfo_BD graphic_info_bd_color_template;
extern struct EngineSnapshotInfo_BD engine_snapshot_bd;
void bd_open_all(void);
boolean SaveNativeLevel_BD(char *);
void DumpLevelset_BD(void);
-void PreparePreviewTileBitmap_BD(Bitmap *, int);
-void SetPreviewTileBitmapReference_BD(Bitmap *);
-Bitmap *GetPreviewTileBitmap_BD(Bitmap *);
Bitmap *GetColoredBitmapFromTemplate_BD(Bitmap *);
unsigned int InitEngineRandom_BD(int);
boolean use_bd_up_down_graphics(void);
boolean use_bd_falling_sounds(void);
-boolean hasColorTemplate_BD(void);
-
Bitmap **GetTitleScreenBitmaps_BD(void);
void CoverScreen_BD(void);
}
}
-static void PrepareGameTileBitmap_BD(void)
-{
- struct GraphicInfo_BD *g_template = &graphic_info_bd_color_template;
- struct GraphicInfo_BD *g_default = &graphic_info_bd_object[O_STONE][0];
-
- // prepare bitmap using cave ready for playing (may have changed colors)
- gd_prepare_tile_bitmap(game_bd.game->cave, g_template->bitmap, 1);
-
- // set reference bitmap which should be replaced with prepared bitmap
- gd_set_tile_bitmap_reference(g_default->bitmap);
-}
-
-void PreparePreviewTileBitmap_BD(Bitmap *bitmap, int scale_down_factor)
-{
- // prepare bitmap using cave from file (with originally defined colors)
- 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);
-}
-
Bitmap *GetColoredBitmapFromTemplate_BD(Bitmap *bitmap)
{
return gd_get_colored_bitmap_from_template(bitmap);
// first iteration loads and prepares the cave (may change colors)
play_game_func(game_bd.game, 0);
- // prepare tile bitmap with level-specific colors, if available
- PrepareGameTileBitmap_BD();
-
// fast-forward game engine to selected state (covered or uncovered)
while (game_bd.game->state_counter < next_state)
play_game_func(game_bd.game, 0);
(setup.bd_falling_sounds == STATE_AUTO && game.use_native_bd_sound_engine));
}
-boolean hasColorTemplate_BD(void)
-{
- return gd_bitmap_has_c64_colors(graphic_info_bd_color_template.bitmap);
-}
-
Bitmap **GetTitleScreenBitmaps_BD(void)
{
Bitmap **title_screen_bitmaps = gd_get_title_screen_bitmaps();
"graphic",
"-"
},
- {
- "bdx_game_graphics_color_template",
- "-",
- "-"
- },
{
"internal_clipboard_custom",
"internal",
#define EL_GRAPHIC_6 (EL_FIRST_DUMMY + 35)
#define EL_GRAPHIC_7 (EL_FIRST_DUMMY + 36)
#define EL_GRAPHIC_8 (EL_FIRST_DUMMY + 37)
-#define EL_BDX_GAME_GRAPHICS_COLOR_TEMPLATE (EL_FIRST_DUMMY + 38)
// internal elements (only used for internal purposes like copying)
-#define EL_FIRST_INTERNAL (EL_FIRST_DUMMY + 39)
+#define EL_FIRST_INTERNAL (EL_FIRST_DUMMY + 38)
#define EL_INTERNAL_CLIPBOARD_CUSTOM (EL_FIRST_INTERNAL + 0)
#define EL_INTERNAL_CLIPBOARD_CHANGE (EL_FIRST_INTERNAL + 1)
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))
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_template = EL_BDX_GAME_GRAPHICS_COLOR_TEMPLATE;
- int graphic_template = el2preimg(element_template);
- int element_default = EL_BDX_ROCK;
- int graphic_default = el2preimg(element_default);
-
- // create special preview bitmap and scale it down to preview tile size
- getSizedGraphicSource(graphic_template, 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_default, 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();
}
g_bd->frame = frame;
}
}
-
- // game graphics template for level-specific colors for native BD levels
- int graphic = IMG_BDX_GAME_GRAPHICS_COLOR_TEMPLATE;
- struct GraphicInfo_BD *g_bd = &graphic_info_bd_color_template;
- Bitmap *src_bitmap;
- int src_x, src_y;
-
- getGraphicSourceExt(graphic, 0, &src_bitmap, &src_x, &src_y, FALSE);
-
- g_bd->bitmap = src_bitmap;
- g_bd->src_x = src_x;
- g_bd->src_y = src_y;
- g_bd->width = TILEX;
- g_bd->height = TILEY;
-
- g_bd->graphic = graphic;
- g_bd->frame = 0;
}
void InitGraphicInfo_EM(void)