Closed aHooder closed 2 years ago
Can confirm, this does look like it fixes #199. Great job!
Nice find Hooder. I think it's interesting to note that there was multiple bugs causing #199. Originally the flickering was mostly artifacting in the loading process. With that fixed this scene transition bug became more obvious.
This should fix #199.
The issue seems to be that the environment instantly transitions (when it shouldn't) from
OVERWORLD
toWILDERNESS_LOW
when loading under certain conditions, then a single frame is rendered before the environment again transitions instantly back toOVERWORLD
. The issue with these instant transitions is that the ambient color (among other things) changes completely to the new environment only for that single frame.The intent seems to have been to only cause new environments to apply instantly whenever the player is teleported to a new area, not when simply walking into a loading line. Because
camTarget
is stored in local scene coordinates, the coordinates are shifted by 40 tiles when the origin is reset for the newly loaded scene, thus incorrectly triggering an instant change as if the player was just teleported. If the player is running through the loading line from an odd numbered tile, the newcamTarget
can also be 41 tiles away from the previous, hence the change to 41 instead of 40.