Theme: draw plain black bg if no [main_map_border] background_image= is given

This commit is contained in:
Charles Dang 2018-02-09 21:45:02 +11:00
parent 9f22a56370
commit ff341cc8ee
3 changed files with 9 additions and 2 deletions

View File

@ -66,6 +66,8 @@ Version 1.13.11:
* Added confirmation prompt when clearing map labels. * Added confirmation prompt when clearing map labels.
* Added show_border= key to the [main_map_border] to control whether map * Added show_border= key to the [main_map_border] to control whether map
borders draw. Right now this is utilized in the cutscene themes. borders draw. Right now this is utilized in the cutscene themes.
* If [main_map_border] background_image= is empty, the game map background
will be plain black.
* WFL Engine: * WFL Engine:
* A new string insert() function has been added, similar to replace() * A new string insert() function has been added, similar to replace()
* WML Engine: * WML Engine:

View File

@ -15,7 +15,6 @@
#define CUTSCENE_THEME_BACKGROUND #define CUTSCENE_THEME_BACKGROUND
[main_map_border] [main_map_border]
border_size = 0.5 border_size = 0.5
background_image = "terrain/off-map/background.png~CS(-255,-255,-255)"
tile_image = "alphamask.png" tile_image = "alphamask.png"
show_border = no show_border = no
[/main_map_border] [/main_map_border]

View File

@ -1502,13 +1502,19 @@ void display::draw_all_panels()
render_buttons(); render_buttons();
} }
static void draw_background(surface screen, const SDL_Rect& area, const std::string& image) static void draw_background(surface screen, const SDL_Rect& area, const std::string& image)
{ {
// No background image, just fill in black.
if(image.empty()) {
sdl::fill_rectangle(area, color_t(0, 0, 0));
return;
}
const surface background(image::get_image(image)); const surface background(image::get_image(image));
if(background.null()) { if(background.null()) {
return; return;
} }
const unsigned int width = background->w; const unsigned int width = background->w;
const unsigned int height = background->h; const unsigned int height = background->h;