1
0
Fork 0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-11-13 22:49:42 +01:00

Move logical onground/onroof updates to start of gamelogic

This reintroduces 2-frame edge-flipping after the 1-frame input delay
got removed. This is because along with processing input and moving
Viridian, logical onground/onroof assignments need to processed in the
same between-render sequence as well - otherwise Viridian only gets 1
frame of edge-flipping due to frame ordering.
This commit is contained in:
Misa 2021-03-18 13:20:56 -07:00 committed by Ethan Lee
parent 63a60b11cc
commit 094209bd12
2 changed files with 30 additions and 8 deletions

View file

@ -129,6 +129,32 @@ void gamelogic(void)
obj.entities[i].lerpoldyp = obj.entities[i].yp; obj.entities[i].lerpoldyp = obj.entities[i].yp;
}} }}
if (!game.blackout && !game.completestop)
{
size_t i;
for (i = 0; i < obj.entities.size(); ++i)
{
/* Is this entity on the ground? (needed for jumping) */
if (obj.entitycollidefloor(i))
{
obj.entities[i].onground = 2;
}
else
{
--obj.entities[i].onground;
}
if (obj.entitycollideroof(i))
{
obj.entities[i].onroof = 2;
}
else
{
--obj.entities[i].onroof;
}
}
}
//Misc //Misc
if (map.towermode) if (map.towermode)
{ {

View file

@ -26,28 +26,24 @@ void gamerenderfixed(void)
{ {
for (size_t i = 0; i < obj.entities.size(); i++) for (size_t i = 0; i < obj.entities.size(); i++)
{ {
//Is this entity on the ground? (needed for jumping)
if (obj.entitycollidefloor(i)) if (obj.entitycollidefloor(i))
{ {
obj.entities[i].onground = 2; obj.entities[i].visualonground = 2;
} }
else else
{ {
obj.entities[i].onground--; --obj.entities[i].visualonground;
} }
if (obj.entitycollideroof(i)) if (obj.entitycollideroof(i))
{ {
obj.entities[i].onroof = 2; obj.entities[i].visualonroof = 2;
} }
else else
{ {
obj.entities[i].onroof--; --obj.entities[i].visualonroof;
} }
obj.entities[i].visualonground = obj.entities[i].onground;
obj.entities[i].visualonroof = obj.entities[i].onroof;
//Animate the entities //Animate the entities
obj.animateentities(i); obj.animateentities(i);
} }