Skip to content

Commit

Permalink
Make sure bigmap isn't overdrawn by in-game UI
Browse files Browse the repository at this point in the history
The storyscreen would trigger a full redraw-cycle partially through
displaying bigmap. Due to the implementation of the storyscreen, this
would cause it to have the background overdrawn and never updated. The
fix implemented here is to remove layered-drawing functionality from
the storyscreen and trigger a full redraw manually at the end of the
story screen functionality.
  • Loading branch information
aginor committed Mar 5, 2016
1 parent 08715b4 commit b308df8
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 9 deletions.
2 changes: 0 additions & 2 deletions src/storyscreen/controller.cpp
Expand Up @@ -147,8 +147,6 @@ void controller::resolve_wml(const vconfig& cfg)
STORY_RESULT controller::show(START_POSITION startpos)
{

events::event_context story_context;

if(parts_.empty()) {
LOG_NG << "no storyscreen parts to show\n";
return NEXT;
Expand Down
5 changes: 4 additions & 1 deletion src/storyscreen/interface.cpp
Expand Up @@ -37,6 +37,8 @@ static lg::log_domain log_engine("engine");
void show_story(display &disp, const std::string &scenario_name,
const config::const_child_itors &story)
{
events::event_context story_context;

int segment_count = 0;
config::const_child_iterator itor = story.first;
storyscreen::START_POSITION startpos = storyscreen::START_BEGINNING;
Expand All @@ -62,8 +64,9 @@ void show_story(display &disp, const std::string &scenario_name,
}
break;
case storyscreen::QUIT:
return;
break;
}
}
video2::trigger_full_redraw();
return;
}
3 changes: 2 additions & 1 deletion src/storyscreen/render.cpp
Expand Up @@ -88,7 +88,7 @@ namespace storyscreen {

part_ui::part_ui(part &p, display &disp, gui::button &next_button,
gui::button &back_button, gui::button&play_button)
: video2::draw_layering(false)
: events::sdl_handler(false)
, p_(p)
, disp_(disp)
, video_(disp.video())
Expand Down Expand Up @@ -382,6 +382,7 @@ bool part_ui::render_floating_images()
const floating_image& fi = p_.get_floating_images()[fi_n];

if(!ri.image.null()) {
render_background();
sdl_blit(ri.image, NULL, video_.getSurface(), &ri.rect);
update_rect(ri.rect);
}
Expand Down
2 changes: 1 addition & 1 deletion src/storyscreen/render.hpp
Expand Up @@ -41,7 +41,7 @@ namespace storyscreen {
* assumed that the screen dimensions remain constant between the
* constructor call, and the destruction of the objects.
*/
class part_ui : public video2::draw_layering
class part_ui : public events::sdl_handler
{
public:
/** Storyscreen result. */
Expand Down
4 changes: 4 additions & 0 deletions src/video.cpp
Expand Up @@ -263,6 +263,10 @@ draw_layering::~draw_layering()
{
draw_layers.remove(this);

video2::trigger_full_redraw();
}

void trigger_full_redraw() {
#if SDL_VERSION_ATLEAST(2, 0, 0)
SDL_Event event;
event.type = SDL_WINDOWEVENT;
Expand Down
2 changes: 1 addition & 1 deletion src/video.hpp
Expand Up @@ -324,6 +324,6 @@ class draw_layering: public events::sdl_handler {
draw_layering(const bool auto_join=true);
virtual ~draw_layering();
};

void trigger_full_redraw();
}
#endif
4 changes: 2 additions & 2 deletions src/widgets/widget.cpp
Expand Up @@ -33,15 +33,15 @@ namespace gui {
bool widget::mouse_lock_ = false;

widget::widget(const widget &o)
: video2::draw_layering(), focus_(o.focus_), video_(o.video_), restorer_(o.restorer_), rect_(o.rect_),
: events::sdl_handler(), focus_(o.focus_), video_(o.video_), restorer_(o.restorer_), rect_(o.rect_),
needs_restore_(o.needs_restore_), state_(o.state_), hidden_override_(o.hidden_override_),
enabled_(o.enabled_), clip_(o.clip_), clip_rect_(o.clip_rect_), volatile_(o.volatile_),
help_text_(o.help_text_), tooltip_text_(o.tooltip_text_), help_string_(o.help_string_), id_(o.id_), mouse_lock_local_(o.mouse_lock_local_)
{
}

widget::widget(CVideo& video, const bool auto_join)
: video2::draw_layering(auto_join), focus_(true), video_(&video), rect_(EmptyRect), needs_restore_(false),
: events::sdl_handler(auto_join), focus_(true), video_(&video), rect_(EmptyRect), needs_restore_(false),
state_(UNINIT), hidden_override_(false), enabled_(true), clip_(false),
clip_rect_(EmptyRect), volatile_(false), help_string_(0), mouse_lock_local_(false)
{
Expand Down
2 changes: 1 addition & 1 deletion src/widgets/widget.hpp
Expand Up @@ -23,7 +23,7 @@ class CVideo;

namespace gui {

class widget : public video2::draw_layering
class widget : public events::sdl_handler
{
public:
SDL_Rect const &location() const;
Expand Down

0 comments on commit b308df8

Please sign in to comment.