VVVVVV/desktop_version/src
Misa 3ca7b09012 Fix regression: quick stopping changing drawframe
This fixes a regression that desyncs my Nova TAS after re-removing the
1-frame input delay.

Quick stopping is simply holding left/right but for less than 5 frames.
Viridian doesn't decelerate when you let go and they immediately stop in
place. (The code calls this tapping, but "quick stopping" is a better
name because you can immediately counter-strafe to stop yourself from
decelrating in the first place, and that works because of this same
code.)

So, the sequence of events in 2.2 and previous looks like this:

- gameinput()
  - If quick stopping, set vx to 0
- gamerender()
  - Change drawframe depending on vx
- gamelogic()
  - Use drawframe for collision (whyyyyyyyyyyyyyyyyyyyyyyyyyyy)

And now (ignoring the intermediate period where the whole loop order was
wrong), the sequence of events in 2.3 looks like this:

- gamerenderfixed()
  - Change drawframe depending on vx
- gamerender()
- gameinput()
  - If quick stopping, set vx to 0
- gamelogic()
  - Use drawframe for collision (my mind has become numb to pain)

So, this means that all the player movement stuff is completely the
same. Except their drawframe is going to be different.

Unfortunately, I had overlooked that gameinput() sets vx and that
animateentities() (in gamerenderfixed()) checks vx. Although, to be
fair, it's a pretty dumb decision to make collision detection be based
on the actual sprites' pixels themselves, instead of a hitbox, in the
first place, so you'd expect THAT to be the end of the dumb parade. Or
maybe you shouldn't, I don't know.

So, what's the solution?

What I've done here is added duplicates of framedelay, drawframe, and
walkingframe, for collision use only. They get updated in gamelogic(),
after gameinput(), which is after when vx could be set to 0.

I've kept the original framedelay, drawframe, and walkingframe around,
to keep the same visuals as closely as possible.

However, due to the removal of the input delay, whenever you quick stop,
your sprite will be wrong for just 1 frame - because when you let go of
the direction key, the game will set your vx to 0 and the logical
drawframe will update to reflect that, but the previous frame cannot
know in advance that you'll release the key on the next frame, and so
the visual drawframe will assume that you keep holding the key.

Whereas in 2.2 and below, when you release a direction key, the player's
position will only update to reflect that on the next frame, but the
current frame can immediately recognize that and update the drawframe
now, instead of retconning it later.

Basically the visual drawframe assumes that you keep holding the key,
and if you don't, then it takes on the value of the collision drawframe
anyway, so it's okay. And it's only visual, anyway - the collision
drawframe of the next frame (when you release the key) will be the same
as the drawframe of the frame you release the key in 2.2 and below.

But I really don't care to try and fix this for if you re-enable the
input delay because it's minor and it'd be more complicated.
2021-07-28 20:11:16 -04:00
..
BinaryBlob.cpp Abstract binary blob loading to FileSystemUtils 2021-04-13 10:02:40 -04:00
BinaryBlob.h Abstract binary blob loading to FileSystemUtils 2021-04-13 10:02:40 -04:00
BlockV.cpp Remove unused x and y attributes of blockclass 2021-02-27 18:27:28 -05:00
BlockV.h Remove unused x and y attributes of blockclass 2021-02-27 18:27:28 -05:00
Credits.h Remove extra semicolon from end of Credits namespace 2021-04-17 00:50:04 -04:00
DeferCallbacks.c Add deferred callbacks to game loop 2021-03-21 02:55:42 -04:00
DeferCallbacks.h Add deferred callbacks to game loop 2021-03-21 02:55:42 -04:00
Ent.cpp Fix regression: quick stopping changing drawframe 2021-07-28 20:11:16 -04:00
Ent.h Fix regression: quick stopping changing drawframe 2021-07-28 20:11:16 -04:00
Entity.cpp Fix regression: quick stopping changing drawframe 2021-07-28 20:11:16 -04:00
Entity.h Fix regression: quick stopping changing drawframe 2021-07-28 20:11:16 -04:00
Enums.h Hello WWWWWWorld! 2020-01-08 10:37:50 -05:00
Exit.h Add VVV_exit() 2021-02-15 23:07:35 -05:00
FileSystemUtils.cpp Support for OpenBSD 2021-06-13 10:48:20 -04:00
FileSystemUtils.h Abstract binary blob loading to FileSystemUtils 2021-04-13 10:02:40 -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
GOGNetwork.c Explicitly declare void for all void parameter functions (#628) 2021-02-25 17:23:59 -05:00
Game.cpp Use hiddenname for hardestroom if roomname is empty 2021-06-11 23:58:18 -07:00
Game.h Separate pressing Enter to open map from pressing Enter to interact 2021-05-19 00:04:00 -07:00
Graphics.cpp Interpolate gravitron square indicators 2021-06-11 22:20:06 -07:00
Graphics.h Draw minimap.png if it is mounted 2021-04-19 10:08:38 -04:00
GraphicsResources.cpp Add asserts for missing images and sound effects 2021-04-18 15:01:43 -04:00
GraphicsResources.h Consistently use angle brackets for SDL.h includes 2020-07-19 21:37:40 -04:00
GraphicsUtil.cpp Remove unnecessary Sint16 casts 2021-04-18 14:55:33 -04:00
GraphicsUtil.h Add ClearSurface() 2021-02-25 19:38:25 -05:00
Input.cpp Re-add playtesting passthrough code block for non-separate interact 2021-06-18 10:59:43 -04:00
Input.h Explicitly declare void for all void parameter functions (#628) 2021-02-25 17:23:59 -05:00
KeyPoll.cpp Show and hide mouse cursor based on user input 2021-04-16 22:58:45 -07:00
KeyPoll.h Separate pressing Enter to open map from pressing Enter to interact 2021-05-19 00:04:00 -07: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 Fix regression: quick stopping changing drawframe 2021-07-28 20:11:16 -04:00
Logic.h Explicitly declare void for all void parameter functions (#628) 2021-02-25 17:23:59 -05:00
MakeAndPlay.h Use multiline comments in C files 2021-04-17 00:50:04 -04:00
Map.cpp Remove final_colorframe assignments when entering minitowers 2021-05-03 19:40:07 -07:00
Map.h Consolidate tower BG bypos and bscroll assignments 2021-04-30 05:31:47 -04:00
Maths.h Explicitly declare void for all void parameter functions (#628) 2021-02-25 17:23:59 -05:00
Music.cpp Music: Enforce the quick fade time as soon as we know it's happening. 2021-06-14 15:11:39 -04:00
Music.h Fix fade volume durations being incorrect 2021-04-27 20:33:44 -04:00
Network.c Factor out UNUSED macro to header file 2021-05-25 15:23:34 -04:00
Network.h Explicitly declare void for all void parameter functions (#628) 2021-02-25 17:23:59 -05:00
Otherlevel.cpp Bounds check all entity getters that can return 0 2020-09-25 13:51:47 -04:00
Otherlevel.h Remove unnecessary includes from header files 2020-07-19 21:37:40 -04:00
Render.cpp Outline text outline text and draw backing 2021-06-12 19:02:14 -04:00
Render.h Explicitly declare void for all void parameter functions (#628) 2021-02-25 17:23:59 -05:00
RenderFixed.cpp Remove game.gametimer in favor of game.frames 2021-03-21 20:53:11 -04:00
RenderFixed.h Remove now-unneeded deltaframe fix when going to in-game settings 2021-03-21 02:55:42 -04:00
Screen.cpp Move graphic options menu update to toggleFullScreen 2021-04-22 19:42:32 -04:00
Screen.h Explicitly declare void for all void parameter functions (#628) 2021-02-25 17:23:59 -05:00
ScreenSettings.h Explicitly declare void for all void parameter functions (#628) 2021-02-25 17:23:59 -05:00
Script.cpp Merge pull request #776 from InfoTeddy/general-bug-fixes-6 2021-06-12 22:33:37 +10:30
Script.h Remove script.dontrunnextframe kludge 2021-03-21 02:55:42 -04:00
Scripts.cpp Don't restart music in trinket cutscenes 2021-04-12 16:17:31 -04:00
SoundSystem.cpp Add asserts for missing images and sound effects 2021-04-18 15:01:43 -04:00
SoundSystem.h Explicitly declare void for all void parameter functions (#628) 2021-02-25 17:23:59 -05: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 Explicitly declare void for all void parameter functions (#628) 2021-02-25 17:23:59 -05:00
TerminalScripts.cpp Revert "Change final stretch song to Piercing the Sky" 2021-05-20 23:01:43 -04:00
Textbox.cpp Don't update crewmate colors in text boxes every deltaframe 2021-05-18 21:17:06 -04:00
Textbox.h Don't update crewmate colors in text boxes every deltaframe 2021-05-18 21:17:06 -04:00
ThirdPartyDeps.c Use multiline comments in C files 2021-04-17 00:50:04 -04:00
Tower.cpp Explicitly declare void for all void parameter functions (#628) 2021-02-25 17:23:59 -05:00
Tower.h Explicitly declare void for all void parameter functions (#628) 2021-02-25 17:23:59 -05:00
TowerBG.h Move mapclass r/g/b variables off onto TowerBG 2021-01-07 21:15:34 -05:00
Unused.h Factor out UNUSED macro to header file 2021-05-25 15:23:34 -04:00
UtilityClass.cpp Factor out "between" calculation to macro and func 2021-05-25 15:23:34 -04:00
UtilityClass.h Factor out "between" calculation to macro and func 2021-05-25 15:23:34 -04:00
Version.h Don't recompile all files when the commit hash is changed 2020-12-25 20:17:01 -05:00
Version.h.in Don't recompile all files when the commit hash is changed 2020-12-25 20:17:01 -05: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
XMLUtils.cpp Move all settings to settings.vvv 2020-11-04 12:06:57 -05:00
XMLUtils.h Move all settings to settings.vvv 2020-11-04 12:06:57 -05:00
editor.cpp Custom levels: only count inbounds trinkets/crew 2021-06-19 14:01:38 -04:00
editor.h Refactor room properties to use setter and getter funcs 2021-03-24 15:55:34 -04:00
main.cpp Consolidate tower BG bypos and bscroll assignments 2021-04-30 05:31:47 -04:00
preloader.cpp Change all surface-clearing FillRect()s to use ClearSurface() 2021-02-25 19:38:25 -05:00
preloader.h Explicitly declare void for all void parameter functions (#628) 2021-02-25 17:23:59 -05:00