- Duke: Always use tsprite pos/angle when used in conjunction with viewvec or viewang.

* This solves the issue of jittery picnum changes when circle-strafing actors at high speeds.
This commit is contained in:
Mitchell Richters 2022-12-10 09:41:21 +11:00 committed by Christoph Oelckers
parent bea6834f8e
commit 5d3710d677
6 changed files with 16 additions and 27 deletions

View file

@ -98,12 +98,12 @@ void applyanimations(tspritetype* t, DDukeActor* h, const DVector2& viewVec, DAn
else switch (l)
{
case 2:
k = angletorotation1(h->spr.Angles.Yaw, viewang, 8, 1);
k = angletorotation1(t->Angles.Yaw, viewang, 8, 1);
break;
case 3:
case 4:
k = angletorotation1(h->spr.Angles.Yaw, viewang, 7);
k = angletorotation1(t->Angles.Yaw, viewang, 7);
if (k > 3)
{
t->cstat |= CSTAT_SPRITE_XFLIP;
@ -113,8 +113,8 @@ void applyanimations(tspritetype* t, DDukeActor* h, const DVector2& viewVec, DAn
break;
case 5:
kang = (h->spr.pos - viewVec).Angle();
k = angletorotation1(h->spr.Angles.Yaw, kang);
kang = (t->pos.XY() - viewVec).Angle();
k = angletorotation1(t->Angles.Yaw, kang);
if (k > 4)
{
k = 8 - k;
@ -123,8 +123,8 @@ void applyanimations(tspritetype* t, DDukeActor* h, const DVector2& viewVec, DAn
else t->cstat &= ~CSTAT_SPRITE_XFLIP;
break;
case 7:
kang = (h->spr.pos - viewVec).Angle();
k = angletorotation2(h->spr.Angles.Yaw, kang);
kang = (t->pos.XY() - viewVec).Angle();
k = angletorotation2(t->Angles.Yaw, kang);
if (k > 6)
{
k = 12 - k;
@ -133,7 +133,7 @@ void applyanimations(tspritetype* t, DDukeActor* h, const DVector2& viewVec, DAn
else t->cstat &= ~CSTAT_SPRITE_XFLIP;
break;
case 8:
k = angletorotation1(h->spr.Angles.Yaw, viewang);
k = angletorotation1(t->Angles.Yaw, viewang);
t->cstat &= ~CSTAT_SPRITE_XFLIP;
break;
default:
@ -142,8 +142,8 @@ void applyanimations(tspritetype* t, DDukeActor* h, const DVector2& viewVec, DAn
bool bg = badguy(h);
if (bg && h->spr.statnum == 2 && h->spr.extra > 0)
{
kang = (h->spr.pos - viewVec).Angle();
k = angletorotation1(h->spr.Angles.Yaw, kang);
kang = (t->pos.XY() - viewVec).Angle();
k = angletorotation1(t->Angles.Yaw, kang);
if (k > 4)
{
k = 8 - k;

View file

@ -93,17 +93,9 @@ void animatesprites_d(tspriteArray& tsprites, const DVector2& viewVec, DAngle vi
if (t->statnum == STAT_TEMP) continue;
auto pp = &ps[h->PlayerIndex()];
if (h->spr.statnum != STAT_ACTOR && h->isPlayer() && pp->newOwner == nullptr && h->GetOwner())
if ((h->spr.statnum != STAT_ACTOR && h->isPlayer() && pp->newOwner == nullptr && h->GetOwner()) || !actorflag(h, SFLAG_NOINTERPOLATE))
{
t->pos = h->interpolatedpos(interpfrac);
}
else if (!actorflag(h, SFLAG_NOINTERPOLATE))
{
t->pos = h->interpolatedpos(interpfrac);
}
if (actorflag(h, SFLAG2_INTERPOLATEANGLE))
{
t->Angles.Yaw = h->interpolatedyaw(interpfrac);
}
@ -229,7 +221,7 @@ void animatesprites_d(tspriteArray& tsprites, const DVector2& viewVec, DAngle vi
}
else
{
k = angletorotation1(h->spr.Angles.Yaw, viewang);
k = angletorotation1(t->Angles.Yaw, viewang);
if (k > 4)
{
k = 8 - k;

View file

@ -88,15 +88,12 @@ void animatesprites_r(tspriteArray& tsprites, const DVector2& viewVec, DAngle vi
if (h->spr.statnum != STAT_ACTOR && h->isPlayer() && pp->newOwner == nullptr && h->GetOwner())
{
t->pos = h->interpolatedpos(interpfrac);
t->Angles.Yaw = h->interpolatedyaw(interpfrac);
h->spr.scale = DVector2(0.375, 0.265625);
}
else if (!actorflag(h, SFLAG_NOINTERPOLATE))
{
t->pos = h->interpolatedpos(interpfrac);
}
if (actorflag(h, SFLAG2_INTERPOLATEANGLE))
{
t->Angles.Yaw = h->interpolatedyaw(interpfrac);
}
@ -223,7 +220,7 @@ void animatesprites_r(tspriteArray& tsprites, const DVector2& viewVec, DAngle vi
t->cstat &= ~CSTAT_SPRITE_XFLIP;
} else
{
k = angletorotation1(h->spr.Angles.Yaw, viewang);
k = angletorotation1(t->Angles.Yaw, viewang);
if (k > 4)
{
k = 8 - k;

View file

@ -366,7 +366,7 @@ enum sflags2_t
SFLAG2_BREAKMIRRORS = 0x00000080,
SFLAG2_CAMERA = 0x00000100,
SFLAG2_DONTANIMATE = 0x00000200,
SFLAG2_INTERPOLATEANGLE = 0x00000400,
//SFLAG2_INTERPOLATEANGLE = 0x00000400,
SFLAG2_GREENBLOOD = 0x00000800,
SFLAG2_ALWAYSROTATE1 = 0x00001000,
SFLAG2_DIENOW = 0x00002000,

View file

@ -154,7 +154,7 @@ void initactorflags_d()
setflag(SFLAG2_BREAKMIRRORS, { DTILE_RADIUSEXPLOSION, DTILE_RPG, DTILE_HYDRENT, DTILE_HEAVYHBOMB, DTILE_SEENINE, DTILE_OOZFILTER, DTILE_EXPLODINGBARREL });
setflag(SFLAG2_CAMERA, { DTILE_CAMERA1 });
setflag(SFLAG2_DONTANIMATE, { DTILE_TRIPBOMB, DTILE_LASERLINE });
setflag(SFLAG2_INTERPOLATEANGLE, { DTILE_BEARINGPLATE });
//setflag(SFLAG2_INTERPOLATEANGLE, { DTILE_BEARINGPLATE });
setflag(SFLAG2_GREENBLOOD, { DTILE_OOZFILTER, DTILE_NEWBEAST, DTILE_NUKEBARREL });
setflag(SFLAG2_ALWAYSROTATE1, { DTILE_RAT, DTILE_CAMERA1, DTILE_CHAIR3 });
setflag(SFLAG2_ALWAYSROTATE2, { DTILE_RPG });

View file

@ -388,7 +388,7 @@ enum sflags2_t
SFLAG2_BREAKMIRRORS = 0x00000080,
SFLAG2_CAMERA = 0x00000100,
SFLAG2_DONTANIMATE = 0x00000200,
SFLAG2_INTERPOLATEANGLE = 0x00000400,
//SFLAG2_INTERPOLATEANGLE = 0x00000400,
SFLAG2_GREENBLOOD = 0x00000800,
SFLAG2_ALWAYSROTATE1 = 0x00001000,
SFLAG2_DIENOW = 0x00002000,