- initialize SOP angles to 0.

The memset to -1 turns them into NANs.
This commit is contained in:
Christoph Oelckers 2022-10-03 22:28:37 +02:00
parent 176afdc00a
commit 3bb0ee69a1
2 changed files with 10 additions and 5 deletions

View file

@ -380,6 +380,10 @@ void SectorSetup(void)
SectorObject[ndx].op_main_sector = nullptr;
SectorObject[ndx].morph_wall_point = nullptr;
SectorObject[ndx].pmid.X = MAXSO;
SectorObject[ndx].ang = SectorObject[ndx].ang_moving = SectorObject[ndx].ang_tgt =
SectorObject[ndx].ang_orig = SectorObject[ndx].last_ang = SectorObject[ndx].old_ang =
SectorObject[ndx].spin_speed = SectorObject[ndx].save_spin_speed = SectorObject[ndx].spin_ang = nullAngle;
}
memset(SineWaveFloor, 0, sizeof(SineWaveFloor));

View file

@ -1754,7 +1754,8 @@ PlayerPart:
void RefreshPoints(SECTOR_OBJECT* sop, const DVector2& move, bool dynamic)
{
short wallcount = 0, delta_ang_from_orig;
short wallcount = 0;
DAngle delta_ang_from_orig;
// do scaling
if (dynamic && sop->PreMoveAnimator)
@ -1811,23 +1812,23 @@ void RefreshPoints(SECTOR_OBJECT* sop, const DVector2& move, bool dynamic)
}
}
if (sop->int_i_spin_speed())
if (sop->spin_speed != nullAngle)
{
// same as below - ignore the objects angle
// last_ang is the last true angle before SO started spinning
delta_ang_from_orig = NORM_ANGLE(sop->int_i_last_ang() + sop->int_i_spin_ang() - sop->int_i_ang_orig());
delta_ang_from_orig = (sop->last_ang + sop->spin_ang - sop->ang_orig).Normalized360();
}
else
{
// angle traveling + the new spin angle all offset from the original
// angle
delta_ang_from_orig = NORM_ANGLE(sop->int_i_ang() + sop->int_i_spin_ang() - sop->int_i_ang_orig());
delta_ang_from_orig = (sop->ang + sop->spin_ang - sop->ang_orig).Normalized360();
}
// Note that this delta angle is from the original angle
// nx,ny are 0 so the points are not moved, just rotated
MovePoints(sop, DAngle::fromBuild(delta_ang_from_orig), move);
MovePoints(sop, delta_ang_from_orig, move);
// do morphing - angle independent
if (dynamic && sop->PostMoveAnimator)