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

Split onground/onroof into visual and logical variables

I will need to separate these into two different variables because I
will need to move logical onground/onroof assignments to the start of
gamelogic() - if I kept them together, however, that would change the
visuals of onground/onroof, which I want to keep consistent with 2.2.
This commit is contained in:
Misa 2021-03-18 13:18:33 -07:00 committed by Ethan Lee
parent d5d9d9ba96
commit 63a60b11cc
4 changed files with 13 additions and 5 deletions

View file

@ -46,6 +46,8 @@ void entclass::clear(void)
gravity = false;
onground = 0;
onroof = 0;
visualonground = 0;
visualonroof = 0;
onentity = 0;
harmful = false;

View file

@ -49,6 +49,7 @@ public:
int onground, onroof;
//Animation
int framedelay, drawframe, walkingframe, dir, actionframe;
int visualonground, visualonroof;
int yp;int xp;
Uint32 realcol;

View file

@ -3379,7 +3379,7 @@ void entityclass::animateentities( int _i )
entities[_i].drawframe=entities[_i].tile+3;
}
if(entities[_i].onground>0 || entities[_i].onroof>0)
if(entities[_i].visualonground>0 || entities[_i].visualonroof>0)
{
if(entities[_i].vx > 0.00f || entities[_i].vx < -0.00f)
{
@ -3393,9 +3393,9 @@ void entityclass::animateentities( int _i )
entities[_i].drawframe += entities[_i].walkingframe + 1;
}
if (entities[_i].onroof > 0) entities[_i].drawframe += 6;
if (entities[_i].visualonroof > 0) entities[_i].drawframe += 6;
// Stuck in a wall? Then default to gravitycontrol
if (entities[_i].onground > 0 && entities[_i].onroof > 0
if (entities[_i].visualonground > 0 && entities[_i].visualonroof > 0
&& game.gravitycontrol == 0)
{
entities[_i].drawframe -= 6;
@ -3639,7 +3639,7 @@ void entityclass::animateentities( int _i )
entities[_i].drawframe=entities[_i].tile+3;
}
if(entities[_i].onground>0 || entities[_i].onroof>0)
if(entities[_i].visualonground>0 || entities[_i].visualonroof>0)
{
if(entities[_i].vx > 0.0000f || entities[_i].vx < -0.000f)
{
@ -3653,7 +3653,7 @@ void entityclass::animateentities( int _i )
entities[_i].drawframe += entities[_i].walkingframe + 1;
}
//if (entities[_i].onroof > 0) entities[_i].drawframe += 6;
//if (entities[_i].visualonroof > 0) entities[_i].drawframe += 6;
}
else
{
@ -4489,12 +4489,14 @@ void entityclass::movingplatformfix( int t, int j )
entities[j].yp = entities[t].yp + entities[t].h;
entities[j].vy = 0;
entities[j].onroof = 2;
entities[j].visualonroof = entities[j].onroof;
}
else
{
entities[j].yp = entities[t].yp - entities[j].h-entities[j].cy;
entities[j].vy = 0;
entities[j].onground = 2;
entities[j].visualonground = entities[j].onground;
}
}
else

View file

@ -45,6 +45,9 @@ void gamerenderfixed(void)
obj.entities[i].onroof--;
}
obj.entities[i].visualonground = obj.entities[i].onground;
obj.entities[i].visualonroof = obj.entities[i].onroof;
//Animate the entities
obj.animateentities(i);
}