Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Teleports using input key as Cancel open the menu staying blocked #1457
Name of the game: Test case
Windows 7 64bits
Attach files (as a .zip archive or link them)
Describe the issue in detail and how to reproduce it:
Trying my old project I've seen that the Go to memorized map create a situation that open the menu first, staying as blocked. There's must be something that explain that different behavior that usually seems not happen with 2k3 and break custom menus.
Just open the menu with any key, referenced by 6 internally.
I did some testing of this in rm2k and this is a very subtle timing issue.
You can simplify the test case down to this code in a parallel event:
In Player it will open the Menu first and then teleport you.
In rm2k3, it will teleport and never open the menu.
No, something was fishy here. menu_calling is cleared on teleport.
I see what it is now:
The game scene change is not instantaneous. During the main loop, the game decides which scene's code to execute. But a change of the scene of course takes place only next frame. Furthermore, the map scene automatically does a fade-out when it detects that the scene was changing during execution.
So what happens during the strange wait 0.0 case is that menu_calling is set, and in the next frame, menu_calling is executed, which changes the scene to menu. However, we are still in the map code - and it then executes the pending teleport and waits for it. Only afterwards, the frame is over and during the next frame, the menu pops up.