Initialize oldxp/oldyp in createentity()

This prevents undefined behavior because we use oldxp/oldyp to do linear
interpolation.

It's also initialized in entclass::entclass(), just to be sure. And I've
deduplicated the regular xp/yp initialization in createentity(), too.
This commit is contained in:
Misa
2020-04-28 16:17:10 -07:00
committed by Ethan Lee
parent 4f4d400ce0
commit c6659ef656
2 changed files with 13 additions and 66 deletions

View File

@@ -27,6 +27,8 @@ entclass::entclass()
cy = 0;
newxp = 0;
newyp = 0;
oldxp = 0;
oldyp = 0;
x1 = 0;
y1 = 0;
@@ -99,6 +101,7 @@ void entclass::setenemy( int t )
else if ( (para) == 1)
{
yp += 10;
oldyp += 10;
tile = 63;
animate = 100; //LIES
colour = 6;
@@ -138,7 +141,9 @@ void entclass::setenemy( int t )
else if ( (para) == 1)
{
xp += 4;
oldxp += 4;
yp -= 4;
oldyp -= 4;
tile = 76;
animate = 100; // Clouds
colour = 6;