-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Fix bug in teleport anim #3684
Fix bug in teleport anim #3684
Conversation
Temp_unit.set_location necessary else pre and post teleport animation played in same place(arrival). It is unuse ro place don't scrolling if this bugs not fixed.
Thanks for the ping @jyrkive. @newfrenchy83 How do I reproduce the bug? Can you give an example of a unit that has a |
src/units/udisplay.cpp
Outdated
@@ -87,6 +87,7 @@ void teleport_unit_between(const map_location& a, const map_location& b, unit& t | |||
disp.scroll_to_tiles(a, b, game_display::ONSCREEN, true, 0.0, false); | |||
else | |||
disp.scroll_to_tile(a, game_display::ONSCREEN, true, false); | |||
temp_unit.set_location(a); | |||
unit_animator animator; | |||
animator.add_animation(&temp_unit,"pre_teleport",a); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The location a
is passed to add_animation(). Is adding set_location()
the correct fix? Or should add_animation
use the location passed to it in preference to temp_unit.get_location()
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the patch. I confirm the bug and the fix (it happens with an ordinary Silver Mage when both source and destination are visible), but I have a question about the fix.
I had put set_location first in original location but when i use teleport with allow_vision=no, map scrolling in destination same if invisible. I moved this after scoll_to_tiles for scrolling was after teleport finished and don't have regression |
Unit animation use temp_unit, it must what location was edited before anim played else location was b (destnation) by default and not a fir pre teleport and b for pos teleport. This function was originally implemented before scrolling and will must be moved after and not cleared. |
src/units/udisplay.cpp
Outdated
@@ -100,6 +101,7 @@ void teleport_unit_between(const map_location& a, const map_location& b, unit& t | |||
disp.scroll_to_tiles(b, a, game_display::ONSCREEN, true, 0.0, false); | |||
else | |||
disp.scroll_to_tile(b, game_display::ONSCREEN, true, false); | |||
temp_unit.set_location(b); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@newfrenchy83 Should this set_location call happen when b_visible
is false, like it was before 2d34a75? I mean, should set_location be called both when b_visible
is true and when it is false?
Yes anmation called but if b not visible and oher side of map, map don't scrolling and player don't see post teleport anim |
Set_location must be called same if b invisible else post teleport played in a location |
Thanks. Could you push a fix please? |
i don't understood. what i must fux please. |
set_location called in both case b visible oe not, and pleced after uf visible for don't affect scrolling. i trusted already fixed regresdion problen ? |
When i use silver mage with allow _vision=no with fix map don't scroll in unit before end of teleport if b invisible. The scrolling after post teleport anim was because siver mage in my own side. A enemy in fog mustbbe can teleporting without scrolling. |
Yes, I have tested and confirmed that the patch fixes the regression: when both a and b are visible, this patch causes the Do we need to add
Sorry, I don't understand. Are you saying that there is another bug, that involves a [tunnel] with Thanks for your patience. |
In fact i done an error set_location must be push in original location. It is not affect scrolling. |
I pushed set_location in right place, now and no bug. |
Thanks. Looks good. 👍 I tested the three cases in #3578 as well as the "both source and destination" visible case and all work as expected. I'll merge this as-is if no other comments are received. |
Tkank |
temp_unit.set_location necessary else pre and post teleport animation is played at the same place(arrival). Closes #3684
@GregoryLundberg Thanks for merging. Could you fwdport to master? Or I will later. |
Sorry, I see it has been committed to both branches. My bad. |
Temp_unit.set_location necessary else pre and post teleport animation played in same place(arrival). It is unuse ro place 'don't scrolling 'if this bugs not fixed.