New debug command ":foreground"...
...useful to better separate background and foreground terrains and spot any error there. Currently use an half-transparent layer of snow recovering the background, but a more flashy image may be needed (edit terrain/foreground.png).
This commit is contained in:
parent
9c4375d8fd
commit
7e414ed587
4 changed files with 28 additions and 1 deletions
BIN
data/core/images/terrain/foreground.png
Normal file
BIN
data/core/images/terrain/foreground.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 8.8 KiB |
|
@ -73,6 +73,8 @@ namespace {
|
|||
size_t sunset_timer = 0;
|
||||
|
||||
bool benchmark = false;
|
||||
|
||||
bool debug_foreground = false;
|
||||
}
|
||||
|
||||
int display::last_zoom_ = SmallZoom;
|
||||
|
@ -802,6 +804,11 @@ void display::toggle_benchmark()
|
|||
benchmark = !benchmark;
|
||||
}
|
||||
|
||||
void display::toggle_debug_foreground()
|
||||
{
|
||||
debug_foreground = !debug_foreground;
|
||||
}
|
||||
|
||||
void display::flip()
|
||||
{
|
||||
if(video().faked()) {
|
||||
|
@ -1978,6 +1985,7 @@ void display::draw_hex(const map_location& loc) {
|
|||
}
|
||||
|
||||
// Apply shroud, fog and linger overlay
|
||||
|
||||
if(shrouded(loc)) {
|
||||
// We apply void also on off-map tiles
|
||||
// to shroud the half-hexes too
|
||||
|
@ -2026,6 +2034,12 @@ void display::draw_hex(const map_location& loc) {
|
|||
drawing_buffer_add(LAYER_FOG_SHROUD, loc, tblit(off_x, off_y, text));
|
||||
}
|
||||
}
|
||||
|
||||
if(debug_foreground) {
|
||||
drawing_buffer_add(LAYER_UNIT_DEFAULT, loc, tblit(xpos, ypos,
|
||||
image::get_image("terrain/foreground.png", image_type)));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
image::TYPE display::get_image_type(const map_location& /*loc*/) {
|
||||
|
|
|
@ -334,9 +334,16 @@ public:
|
|||
*/
|
||||
static void sunset(const size_t delay = 0);
|
||||
|
||||
/** Toogle to continuously redraw the screen. */
|
||||
/** Toggle to continuously redraw the screen. */
|
||||
static void toggle_benchmark();
|
||||
|
||||
/**
|
||||
* Toggle to debug foreground terrain.
|
||||
* Separate background and foreground layer
|
||||
* to better spot any error there.
|
||||
*/
|
||||
static void toggle_debug_foreground();
|
||||
|
||||
void flip();
|
||||
|
||||
/** Copy the backbuffer to the framebuffer. */
|
||||
|
|
|
@ -2361,6 +2361,7 @@ class console_handler : public map_command_handler<console_handler>, private cha
|
|||
void do_control();
|
||||
void do_clear();
|
||||
void do_sunset();
|
||||
void do_foreground();
|
||||
void do_fps();
|
||||
void do_benchmark();
|
||||
void do_save();
|
||||
|
@ -2439,6 +2440,8 @@ class console_handler : public map_command_handler<console_handler>, private cha
|
|||
_("Clear chat history."));
|
||||
register_command("sunset", &console_handler::do_sunset,
|
||||
_("Visualize the screen refresh procedure."), "", "D");
|
||||
register_command("foreground", &console_handler::do_foreground,
|
||||
_("Debug foreground terrain."), "", "D");
|
||||
register_command("fps", &console_handler::do_fps, _("Show fps."));
|
||||
register_command("benchmark", &console_handler::do_benchmark);
|
||||
register_command("save", &console_handler::do_save, _("Save game."));
|
||||
|
@ -3091,6 +3094,9 @@ void console_handler::do_sunset() {
|
|||
menu_handler_.gui_->sunset(delay);
|
||||
gui2::twindow::set_sunset(delay);
|
||||
}
|
||||
void console_handler::do_foreground() {
|
||||
menu_handler_.gui_->toggle_debug_foreground();
|
||||
}
|
||||
void console_handler::do_fps() {
|
||||
preferences::set_show_fps(!preferences::show_fps());
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue