- move p->wackedbyactor chase-cam code into applylook() for increased smoothness.

This commit is contained in:
Mitchell Richters 2020-07-28 12:30:09 +10:00
parent baed75ff8a
commit ea98978ae7
3 changed files with 41 additions and 44 deletions

View file

@ -483,20 +483,11 @@ void moveplayers(void) //Players
}
else
{
p->posx = s->x;
p->posy = s->y;
p->posz = s->z - (20 << 8);
p->newowner = -1;
if (p->wackedbyactor >= 0 && sprite[p->wackedbyactor].statnum < MAXSTATUS)
{
int ang = p->getang();
ang += getincangle(ang, getangle(sprite[p->wackedbyactor].x - p->posx, sprite[p->wackedbyactor].y - p->posy)) >> 1;
p->setang(ang & 2047, true);
}
}
s->ang = p->getang();
}

View file

@ -1259,12 +1259,8 @@ void GetInput()
if (!synchronized_input)
{
if (sprite[p->i].extra > 0)
{
applylook(myconnectindex, scaleAdjust);
}
// Do these in the same order as the old code.
applylook(myconnectindex, scaleAdjust);
calcviewpitch(p, scaleAdjust);
sethorizon(myconnectindex, loc.bits, scaleAdjust, true);
}

View file

@ -800,6 +800,8 @@ void applylook(int snum, double factor)
{
auto p = &ps[snum];
if (sprite[p->i].extra > 0)
{
p->addrotscrnang(factor * -0.5 * fix16_to_dbl(p->q16rotscrnang));
if (abs(p->q16rotscrnang) < FRACUNIT) p->q16rotscrnang = 0;
@ -837,6 +839,14 @@ void applylook(int snum, double factor)
}
apply_seasick(p, factor);
}
else
{
if (p->wackedbyactor >= 0 && sprite[p->wackedbyactor].statnum < MAXSTATUS)
{
p->q16ang += fix16_from_dbl(factor * (getincangle(p->getang(), getangle(sprite[p->wackedbyactor].x - p->posx, sprite[p->wackedbyactor].y - p->posy)) >> 1));
}
}
}
//---------------------------------------------------------------------------
//