solarus-games / solarus

This repository was moved to GitLab: https://gitlab.com/solarus-games/solarus
http://www.solarus-games.org
Other
710 stars 132 forks source link

Wrong display of objects drawn in screen coordinates from map:on_draw() when scrolling #989

Open christopho opened 7 years ago

christopho commented 7 years ago
function map:on_draw(dst_surface)
    my_img:draw(dst_surface, 0, 0)
end

The image scrolls with the map while scrolling to an adjacent map. No problem if we do this from game:on_draw() instead.

christopho commented 7 years ago

I don't even know how to fix it.

In the engine, only one map can be loaded at a time. To implement the scrolling transition, I take like a screenshot of the old map just before I unload it. During the scrolling, only the new map is loaded, the old one no longer exists (except that screenshot we took). and then I display it with the appropriate offset during in the transition.

The problem is that in this screenshot, things were drawn in map coordinates and others in screen coordinates. What I can do for 1.5 is at least avoid to draw menus when creating this screenshot, because menus are always drawn in screen coordinates. This would not fix the case of images directly drawn from map:on_draw() (without menus) though, like the example of the bug.

For a full fix, I think we need to have both maps loaded at the same time. Which is a feature we already want for other reasons, like to undo an illegal teletransportation like between the dark world and the light world in ALTTP.

wrightmat commented 7 years ago

I would vote against the fix to avoid drawing menus when taking the screenshot.

I (and MetalZelda) use a menu to display the tone over the map, so that would cause the tone to disappear when the map scrolls. That was the original problem I had when the tone menu was in the map context, but I've since worked around that and have it functioning (mostly) the way I want.

christopho commented 7 years ago

Only map menus would be disabled when taking the screenshot.