1
0
Fork 0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-09-27 16:57:25 +02:00
VVVVVV/desktop_version/src
Misa 6658a46b2e Fix 1-frame render glitch with running teleport scripts
Fixes #402 (Violet appearing 1 frame after the Ship teleporter room
appears).

The root cause of this bug is due to the game loop order changes made
with the over-30-FPS patch. 2.2's game loop order was gameinput(),
gamerender(), then gamelogic(). In 2.3, gamerender() was moved to the end
as it required special code to render more than 30 frames a second. So
2.3's game loop order is gameinput(), gamelogic(), then gamerender().

In hindsight, I could have preserved the game loop order, but this would
require some more complex code in the game loop than what is there
currently. Fixing it now would fix rendering glitches such as this one
(along with being able to remove script.dontrunnextframe with the
two-frame-delay fix), but it could also introduce new rendering glitches
we don't yet know about. After discussing this in Discord DMs with
flibit, we agreed that the game loop order should be fixed in 2.4
instead.

When the game teleports you, gamelogic() runs script.teleport(). This
function will gotoroom to the teleporter destination, then it loads the
teleport script. Some teleport scripts (such as levelonecomplete, which
creates Violet) expect that their entities will be created, and more
generally that their script will be ran, on the same frame that the
gotoroom happens, i.e. by the time that the next gamerender() happens,
i.e. script.run() should be ran before the next gamerender() happens.
This would be true on the old game loop order, but with the new game
loop order, gamerender() gets ran directly after gamelogic() with no
script.run() in between.

To fix this, I did the same thing I did with the two-frame-delay fix
(#317), where I ran the script for that frame, but in order to prevent
running it twice I set script.dontrunnextframe to true.
2020-09-05 18:17:59 -04:00
..
BinaryBlob.cpp Use SDL stdlib funcs for free/malloc/strcmp 2020-08-14 09:51:19 -04:00
BinaryBlob.h Check index of tracks in musicclass::init() 2020-08-14 09:51:19 -04:00
BlockV.cpp Remove unnecessary string initializations from constructors 2020-07-08 19:14:21 -04:00
BlockV.h Consistently use angle brackets for SDL.h includes 2020-07-19 21:37:40 -04:00
Credits.h Adding myself as a contributor. 2020-08-12 23:07:13 -04:00
editor.cpp Move text entry start to script open instead of script list open 2020-08-17 19:30:09 -04:00
editor.h Axe manual state trackers and use SDL_IsTextInputActive() 2020-08-13 17:51:38 -04:00
Ent.cpp Remove unnecessary includes from header files 2020-07-19 21:37:40 -04:00
Ent.h Remove unnecessary includes from header files 2020-07-19 21:37:40 -04:00
Entity.cpp Fix compatibility with levels that rely on gamestate-based script boxes 2020-08-17 15:14:22 -04:00
Entity.h Separate includes into sections and alphabetize them 2020-07-19 21:37:40 -04:00
Enums.h Hello WWWWWWorld! 2020-01-08 10:37:50 -05:00
FileSystemUtils.cpp Fix other array decay too 2020-08-09 13:39:12 -04:00
FileSystemUtils.h Only re-color one-ways if assets are not mounted 2020-06-30 18:06:14 -04:00
Finalclass.cpp Separate includes into sections and alphabetize them 2020-07-19 21:37:40 -04:00
Finalclass.h Remove unnecessary includes from header files 2020-07-19 21:37:40 -04:00
Game.cpp Missed adding the option to the createmenu method. 2020-08-08 19:10:31 -04:00
Game.h Added ability to bind restart to a controller. 2020-08-08 19:02:14 -04:00
GOGNetwork.c Ifdef out network code for M&P 2020-08-02 23:43:55 -04:00
Graphics.cpp Remove allowspecial, replace with opaqueness check 2020-08-06 22:12:15 -04:00
Graphics.h Remove allowspecial, replace with opaqueness check 2020-08-06 22:12:15 -04:00
GraphicsResources.cpp Separate includes into sections and alphabetize them 2020-07-19 21:37:40 -04:00
GraphicsResources.h Consistently use angle brackets for SDL.h includes 2020-07-19 21:37:40 -04:00
GraphicsUtil.cpp Remove -1,-1 offset from ScaleSurface() 2020-08-06 22:10:47 -04:00
GraphicsUtil.h Ax ScaleSurfaceSlow() in favor of ScaleSurface() 2020-08-06 22:10:47 -04:00
Input.cpp Remove script.hardreset() when restarting Time Trial 2020-08-14 23:07:02 -04:00
Input.h Remove unnecessary includes from header files 2020-07-19 21:37:40 -04:00
KeyPoll.cpp Axe manual state trackers and use SDL_IsTextInputActive() 2020-08-13 17:51:38 -04:00
KeyPoll.h Axe manual state trackers and use SDL_IsTextInputActive() 2020-08-13 17:51:38 -04:00
Labclass.cpp Separate includes into sections and alphabetize them 2020-07-19 21:37:40 -04:00
Labclass.h Remove unnecessary includes from header files 2020-07-19 21:37:40 -04:00
Logic.cpp Move tele/activity/trophytext conds to collision detection 2020-08-03 00:12:15 -04:00
Logic.h Remove unnecessary includes from header files 2020-07-19 21:37:40 -04:00
main.cpp Axe manual state trackers and use SDL_IsTextInputActive() 2020-08-13 17:51:38 -04:00
MakeAndPlay.h Re-comment out #define MAKEANDPLAY 2020-02-09 10:42:03 -05:00
Map.cpp Add custommode check to mapclass::twoframedelayfix() 2020-08-17 15:14:22 -04:00
Map.h Separate includes into sections and alphabetize them 2020-07-19 21:37:40 -04:00
Maths.h Hello WWWWWWorld! 2020-01-08 10:37:50 -05:00
Music.cpp Check rw in musicclass::init() 2020-08-14 09:51:19 -04:00
Music.h Separate includes into sections and alphabetize them 2020-07-19 21:37:40 -04:00
Network.c Remove unnecessary externs from network func forward decls 2020-08-02 23:43:55 -04:00
Network.h Add support for multiple Network backends, stub in GOGNetwork 2020-01-13 11:15:22 -05:00
Otherlevel.cpp Change back the order of entity creation 2020-07-29 10:04:27 -04:00
Otherlevel.h Remove unnecessary includes from header files 2020-07-19 21:37:40 -04:00
preloader.cpp Separate includes into sections and alphabetize them 2020-07-19 21:37:40 -04:00
preloader.h Remove unnecessary includes from header files 2020-07-19 21:37:40 -04:00
Render.cpp De-duplicate activity zone rendering, don't ignore act_fade 2020-08-24 22:02:58 -04:00
Render.h Remove unnecessary includes from header files 2020-07-19 21:37:40 -04:00
Screen.cpp Separate includes into sections and alphabetize them 2020-07-19 21:37:40 -04:00
Screen.h Refactor startup to load config before calling Screen::init 2020-07-08 14:30:57 -04:00
Script.cpp Fix 1-frame render glitch with running teleport scripts 2020-09-05 18:17:59 -04:00
Script.h Remove unnecessary includes from header files 2020-07-19 21:37:40 -04:00
Scripts.cpp Separate includes into sections and alphabetize them 2020-07-19 21:37:40 -04:00
SoundSystem.cpp Separate includes into sections and alphabetize them 2020-07-19 21:37:40 -04:00
SoundSystem.h Revert "Add destructor for SoundTrack/MusicTrack (and explicitly define move constructor to prevent double-free)" 2020-06-07 22:40:03 -04:00
Spacestation2.cpp Separate includes into sections and alphabetize them 2020-07-19 21:37:40 -04:00
Spacestation2.h Remove unnecessary includes from header files 2020-07-19 21:37:40 -04:00
SteamNetwork.c Ifdef out network code for M&P 2020-08-02 23:43:55 -04:00
TerminalScripts.cpp Separate includes into sections and alphabetize them 2020-07-19 21:37:40 -04:00
Textbox.cpp Remove allowspecial, replace with opaqueness check 2020-08-06 22:12:15 -04:00
Textbox.h Remove allowspecial, replace with opaqueness check 2020-08-06 22:12:15 -04:00
Tower.cpp Remove zeroed arrays from tower functions in M&P 2020-08-03 00:29:15 -04:00
Tower.h Change all tilemaps to be short[1200] instead of int[1200] 2020-07-19 16:25:53 -04:00
UtilityClass.cpp Add fallback parameter to UtilityClass::Int() 2020-08-07 01:00:49 -04:00
UtilityClass.h Add fallback parameter to UtilityClass::Int() 2020-08-07 01:00:49 -04:00
WarpClass.cpp Separate includes into sections and alphabetize them 2020-07-19 21:37:40 -04:00
WarpClass.h Remove unnecessary includes from header files 2020-07-19 21:37:40 -04:00