1
0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-06-26 06:28:30 +02: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;
}
if (!game.press_action)
if (has_control)
{
game.jumppressed = 0;
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)
if (!game.press_action)
{
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.totalflips++;
game.jumpheld = false;
}
if (any_onroof && game.gravitycontrol == 1)
if (game.press_action && !game.jumpheld)
{
game.gravitycontrol = 0;
for (size_t ie = 0; ie < obj.entities.size(); ++ie)
game.jumppressed = 5;
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;
obj.entities[ie].ay = 3;
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.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++;
}
}
if (!has_control)
else
{
//Simple detection of keypresses outside player control, will probably scrap this (expand on
//advance text function)