From 3fa87bc018874afae7bfca06c6d509411a441b09 Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Sat, 25 May 2024 19:23:35 +0200 Subject: [PATCH] added checking availability of level specific colors in level editor --- src/editor.c | 14 ++++++++++++++ src/game_bd/bd_graphics.c | 5 +++++ src/game_bd/bd_graphics.h | 1 + src/game_bd/export_bd.h | 2 ++ src/game_bd/main_bd.c | 5 +++++ 5 files changed, 27 insertions(+) diff --git a/src/editor.c b/src/editor.c index c105afcd..77f8d328 100644 --- a/src/editor.c +++ b/src/editor.c @@ -11451,6 +11451,20 @@ static void DrawEngineConfigColors(void) { int i; + if (!hasColorTemplate_BD()) + { + int font_nr = FONT_TEXT_1; + int font_height = getFontHeight(font_nr); + int yoffset_above = font_height + ED_GADGET_LINE_DISTANCE; + int xpos = ED_ENGINE_SETTINGS_X(0); + int ypos = ED_ENGINE_SETTINGS_Y(0); + + PrintInfoText("No level specific colors available.", font_nr, xpos, ypos - yoffset_above); + PrintInfoText("(Not supported by graphics set.)", font_nr, xpos, ypos); + + return; + } + if (bd_color_type_changed) { if (level.bd_color_type != GD_COLOR_TYPE_RGB && level.bd_color_type != GetCommonColorType_BD()) diff --git a/src/game_bd/bd_graphics.c b/src/game_bd/bd_graphics.c index 96e9b20c..9060aae3 100644 --- a/src/game_bd/bd_graphics.c +++ b/src/game_bd/bd_graphics.c @@ -363,6 +363,11 @@ static boolean surface_has_c64_colors(SDL_Surface *surface) 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) { diff --git a/src/game_bd/bd_graphics.h b/src/game_bd/bd_graphics.h index 6b522fcc..e52048ad 100644 --- a/src/game_bd/bd_graphics.h +++ b/src/game_bd/bd_graphics.h @@ -33,6 +33,7 @@ int get_play_area_h(void); 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); diff --git a/src/game_bd/export_bd.h b/src/game_bd/export_bd.h index 6fe2456c..23809345 100644 --- a/src/game_bd/export_bd.h +++ b/src/game_bd/export_bd.h @@ -123,6 +123,8 @@ boolean use_bd_pushing_graphics(void); 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); diff --git a/src/game_bd/main_bd.c b/src/game_bd/main_bd.c index 333bddea..3376757f 100644 --- a/src/game_bd/main_bd.c +++ b/src/game_bd/main_bd.c @@ -481,6 +481,11 @@ boolean use_bd_falling_sounds(void) (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(); -- 2.34.1