mirror of
https://github.com/ZDoom/Raze.git
synced 2024-11-15 08:51:24 +00:00
- Tidy up nested branch in calcChaseCamPos()
.
This commit is contained in:
parent
6c2717fcde
commit
892dde030f
1 changed files with 13 additions and 16 deletions
|
@ -61,7 +61,7 @@ bool calcChaseCamPos(DVector3& ppos, DCoreActor* act, sectortype** psect, const
|
|||
// If something is in the way, make cameradist lower if necessary
|
||||
if (npos.XY().Sum() > hpos.XY().Sum())
|
||||
{
|
||||
double DVector3::* c = fabs(npos.X) > fabs(npos.Y) ? &DVector3::X : &DVector3::Y;
|
||||
const auto c = fabs(npos.X) > fabs(npos.Y) ? &DVector3::X : &DVector3::Y;
|
||||
|
||||
if (hitinfo.hitWall != nullptr)
|
||||
{
|
||||
|
@ -75,25 +75,22 @@ bool calcChaseCamPos(DVector3& ppos, DCoreActor* act, sectortype** psect, const
|
|||
*psect = hitinfo.hitSector;
|
||||
hpos.*c -= npos.*c * (1. / 32.);
|
||||
}
|
||||
else
|
||||
else if (!(hitinfo.hitActor->spr.cstat & CSTAT_SPRITE_ALIGNMENT_WALL))
|
||||
{
|
||||
// If you hit a sprite that's not a wall sprite - try again.
|
||||
if (!(hitinfo.hitActor->spr.cstat & CSTAT_SPRITE_ALIGNMENT_WALL))
|
||||
{
|
||||
bakcstat = hitinfo.hitActor->spr.cstat;
|
||||
hitinfo.hitActor->spr.cstat &= ~(CSTAT_SPRITE_BLOCK | CSTAT_SPRITE_BLOCK_HITSCAN);
|
||||
calcChaseCamPos(ppos, act, psect, angles, interpfrac, backamp);
|
||||
hitinfo.hitActor->spr.cstat = bakcstat;
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
// same as wall calculation.
|
||||
hpos.*c -= npos.*c * npos.XY().dot((act->spr.Angles.Yaw - DAngle90).ToVector().Rotated90CW()) * (1. / 1024.);
|
||||
}
|
||||
bakcstat = hitinfo.hitActor->spr.cstat;
|
||||
hitinfo.hitActor->spr.cstat &= ~(CSTAT_SPRITE_BLOCK | CSTAT_SPRITE_BLOCK_HITSCAN);
|
||||
calcChaseCamPos(ppos, act, psect, angles, interpfrac, backamp);
|
||||
hitinfo.hitActor->spr.cstat = bakcstat;
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
// same as wall calculation.
|
||||
hpos.*c -= npos.*c * npos.XY().dot((act->spr.Angles.Yaw - DAngle90).ToVector().Rotated90CW()) * (1. / 1024.);
|
||||
}
|
||||
|
||||
double newdist = hpos.*c / npos.*c;
|
||||
const double newdist = hpos.*c / npos.*c;
|
||||
if (newdist < cameradist) cameradist = newdist;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue