1
0
Fork 0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-12-22 17:49:43 +01:00

Only execute flip logic when has_control

This commit is contained in:
leo60228 2021-09-02 14:50:00 -04:00 committed by Misa Elizabeth Kai
parent 58098dc748
commit 72ade2ce49

View file

@ -2238,54 +2238,56 @@ void gameinput(void)
game.tapright = 0; game.tapright = 0;
} }
if (!game.press_action) if (has_control)
{ {
game.jumppressed = 0; if (!game.press_action)
game.jumpheld = false;
}
if (game.press_action && !game.jumpheld)
{
game.jumppressed = 5;
game.jumpheld = true;
}
if (game.jumppressed > 0)
{
game.jumppressed--;
if (any_onground && game.gravitycontrol == 0)
{ {
game.gravitycontrol = 1;
for (size_t ie = 0; ie < obj.entities.size(); ++ie)
{
if (obj.entities[ie].rule == 0 && obj.entities[ie].onground)
{
obj.entities[ie].vy = -4;
obj.entities[ie].ay = -3;
}
}
music.playef(0);
game.jumppressed = 0; game.jumppressed = 0;
game.totalflips++; game.jumpheld = false;
} }
if (any_onroof && game.gravitycontrol == 1)
if (game.press_action && !game.jumpheld)
{ {
game.gravitycontrol = 0; game.jumppressed = 5;
for (size_t ie = 0; ie < obj.entities.size(); ++ie) game.jumpheld = true;
}
if (game.jumppressed > 0)
{
game.jumppressed--;
if (any_onground && game.gravitycontrol == 0)
{ {
if (obj.entities[ie].rule == 0 && obj.entities[ie].onroof) game.gravitycontrol = 1;
for (size_t ie = 0; ie < obj.entities.size(); ++ie)
{ {
obj.entities[ie].vy = 4; if (obj.entities[ie].rule == 0 && obj.entities[ie].onground)
obj.entities[ie].ay = 3; {
obj.entities[ie].vy = -4;
obj.entities[ie].ay = -3;
}
} }
music.playef(0);
game.jumppressed = 0;
game.totalflips++;
}
if (any_onroof && game.gravitycontrol == 1)
{
game.gravitycontrol = 0;
for (size_t ie = 0; ie < obj.entities.size(); ++ie)
{
if (obj.entities[ie].rule == 0 && obj.entities[ie].onroof)
{
obj.entities[ie].vy = 4;
obj.entities[ie].ay = 3;
}
}
music.playef(1);
game.jumppressed = 0;
game.totalflips++;
} }
music.playef(1);
game.jumppressed = 0;
game.totalflips++;
} }
} }
else
if (!has_control)
{ {
//Simple detection of keypresses outside player control, will probably scrap this (expand on //Simple detection of keypresses outside player control, will probably scrap this (expand on
//advance text function) //advance text function)