1
0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-06-28 23:48:30 +02:00
Go to file
Misa 88d49547d4 Evaluate flipping eligibility per-entity
This fixes a regression where the behavior of duplicate player entities
is different, causing a gameplay section in Vespera Scientifica to be
impossible, as described in #903.

In the level, you are allowed to flip in mid-air. Vespera accomplishes
this by having two duplicate player entities stuck in a platform. One of
them is responsible for letting the player flip in one direction, and
one of them is responsible for letting them flip in the other.

In 2.3, this works because in order for a player entity to flip,
`game.jumppressed` is checked, and the entity will flip if
`game.jumppressed` is greater than 0, then `game.jumppressed` will be
set to 0. In this way, whenever a player entity flips, it will set
`game.jumppressed` to 0, so whenever the next player entity is
evaluated, `game.jumppressed` is 0 and thus _that_ entity will not flip.

This is because the for-loop surrounds both the `game.jumppressed` check
and flipping the entity. In 2.4 after #609 and subsequent patches,
however, this is not the case. Here, the for-loop only surrounds
flipping the entity. Therefore, the `game.jumppressed` check is
evaluated only once. So, it will end up flipping every player entity if
the entities are eligible. In this case, one of them is eligible twice,
resulting in the game flipping gravitycontrol four times, which is
essentially the same as not flipping at all (except for all the sound
effects).

Hence, the fix here is to make it so the for-loop surrounds the
`game.jumppressed` check.

Now, this doesn't mean that the intent of #609 - that duplicate player
entities have the same initial velocity applied to them when flipping -
has to be removed. We can just put the for-loops back in. But I
carefully implemented them in such a way that the overall function is
not quadratic, i.e. O(n²). Instead, there's a pass done over the
`obj.entities` vector beforehand to store all indexes of a player entity
in a temporary vector, and then that vector is used to update all the
player entities. In this manner, the function is still linear - O(n) -
over the number of entities in the room.

I tested this to make sure that no previous regressions popped up again,
including #839, #855, and #887. And #484 is still resolved.

Fixes #903.
2023-03-18 21:30:23 -07:00
.github Update SDL to 2.24.0 in Windows CI 2022-08-22 23:47:49 -07:00
desktop_version Evaluate flipping eligibility per-entity 2023-03-18 21:30:23 -07:00
mobile_version Update mobile version to mobile v2.2.1 2022-12-02 18:19:58 +01:00
third_party Update c-hashmap submodule [2023-03-05] 2023-03-05 13:21:43 -08:00
tools Adding original mapping tools for the sake of completeness 2020-01-12 19:49:24 +01:00
.gitattributes fix actionscript misclassified as angelscript 2020-01-12 15:18:45 -05:00
.gitmodules Remove utfcpp submodule 2023-02-27 23:00:41 -08:00
License exceptions.md Update license exceptions last updated date 2021-08-24 09:10:23 -07:00
LICENSE.md Updated link to Make and Play edition 2020-01-13 19:37:50 +01:00
README.md Update README.md 2020-01-10 17:45:29 +01:00

This is the source code to VVVVVV, version 2.0+. For more context about this release, see the announcement on Terry's blog!

License

VVVVVV's source code is made available under a custom license. See LICENSE.md for more details.

In general, if you're interested in creating something that falls outside the license terms, get in touch with Terry and we'll talk about it!

Authors

Versions

There are two versions of the VVVVVV source code available - the desktop version (based on the C++ port, and currently live on Steam), and the mobile version (based on a fork of the original flash source code, and currently live on iOS and Android).