mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2024-12-23 10:09:43 +01:00
Fix regression with wall stuck flipping behavior exactly reversed
The reason why the wall stuck flipping behavior happened in the first place was because the code went like this: if (jumppressed) { if (onground && gravitycontrol == 0) { gravitycontrol = 1; } if (onroof && gravitycontrol == 1) { gravitycontrol = 0; } } Basically, if you were both on ground and on a roof (i.e. stuck in a wall), you would flip, but then due to code order and the fact that the statement is not connected to the previous one, you would immediately unflip afterwards. But if you were already flipped then the only path that can be taken is to unflip you, since it's the statement that appears last.52fceb3f69
replaces the onground/onroof conditionals with any_onground/any_onroof, so any player entity would allow you to flip. But otherwise the code is the same. So is that the problem? No; tracing it through with GDB reveals that when you flip, gravitycontrol is being set to 1, but never being set to 0. And it turns out that's because any_onroof is not getting set. And that happens because of another thing that52fceb3f69
did - which was to set any_onground/any_onroof to true if indeed any player entity was on ground or on a roof. Unfortunately, the way Leo did it was to make the two statements mutually exclusive - an 'if'-'else if' instead of two separate statements. So a single entity could not mark both any_onground and any_onroof as true (and the majority of the time, you will be a single entity). Thus, the solution is to just drop that 'else'. Fixes #855.
This commit is contained in:
parent
caebde9e33
commit
8ba1325d0f
1 changed files with 1 additions and 1 deletions
|
@ -2198,7 +2198,7 @@ void gameinput(void)
|
||||||
{
|
{
|
||||||
any_onground = true;
|
any_onground = true;
|
||||||
}
|
}
|
||||||
else if (obj.entities[ie].onroof > 0)
|
if (obj.entities[ie].onroof > 0)
|
||||||
{
|
{
|
||||||
any_onroof = true;
|
any_onroof = true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue