Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drake Flare not undrawn when playing leadership animation over water #3996

Open
jostephd opened this issue Mar 22, 2019 · 3 comments

Comments

Projects
None yet
2 participants
@jostephd
Copy link
Member

commented Mar 22, 2019

Drake Flares are a flying unit that has leadership. When a Flare is on a water hex and a friendly unit next to it is attacking, the Flare isn't completely undrawn before it's drawn playing its leadership animation submerged (because of the water):

2019-03-22-124730_1920x1080_scrot

Similar to #3325

@jostephd

This comment has been minimized.

Copy link
Member Author

commented Mar 22, 2019

I took a shot in the dark:

diff --git a/src/units/animation.cpp b/src/units/animation.cpp
index 30d6be32c68..3f39c4c9277 100644
--- a/src/units/animation.cpp
+++ b/src/units/animation.cpp
@@ -1127,7 +1127,7 @@ bool unit_animation::invalidate(frame_parameters& value)
 
 	if(complete_redraw) {
 		if( need_update()) {
-			disp->invalidate(overlaped_hex_);
+			disp->invalidate_all();;
 			invalidated_ = true;
 			return true;
 		} else {
@@ -1136,7 +1136,7 @@ bool unit_animation::invalidate(frame_parameters& value)
 		}
 	} else {
 		if(need_minimal_update()) {
-			disp->invalidate(overlaped_hex_);
+			disp->invalidate_all();;
 			invalidated_ = true;
 			return true;
 		} else {

It seems to help, but I don't know if it's correct. I didn't examine the function or its callers to know if invalidate_all() will be called under the right conditions.

@AI0867

This comment has been minimized.

Copy link
Member

commented Apr 24, 2019

That will work, but it will also destroy performance, as you rerender the entire screen for every frame. You instead want to figure out which hexes are overlapped and only invalidate those. I am unsure what overlaped_hex_ means here, but it looks like a good start. Check what the parameters are and what unit_frame::get_overlaped_hex() then does with them.

@jostephd

This comment has been minimized.

Copy link
Member Author

commented May 7, 2019

Thanks for the review. src_ and dst_ are the Flare's and Spearman's hexes respectively for the leading animation, and the Spearman's and Orcish Warlord's hexes respectively for the attack animation, but I haven't been able to get to the bottom of get_overlaped_hex(). However, in second thought, I wonder if this is even the right area of the code to be looking at? Maybe the "leading" animation is played correctly, but nothing invalidates the hexes the standing/idle animation was playing over?

animator.add_animation(&*leader, "leading", ability.second,
att->get_location(), damage, true, "", {0,0,0},
hit_type, attack.shared_from_this(), secondary_attack, swing);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.