- Duke: Additional fixes for alterang().

- Initial issue started in 3c1970e9e0.
- Fix in 4f59e8a3d1 was partial and not enough.
- Ensure delta angle is absolute in if statements as required, but don't use absangle as we need to apply the true delta in the last conditional.
- Fix incorrect random angle addition as compared to older source.
- Fixes #735.
This commit is contained in:
Mitchell Richters 2023-01-06 21:39:55 +11:00
parent 1d0e9b369e
commit 5e2991acc7

View file

@ -3157,17 +3157,17 @@ void alterang(int ang, DDukeActor* actor, int playernum)
if (ticselapsed < 2)
{
if (angdif < DAngle45)
if (abs(angdif) < DAngle45)
{
DAngle add = DAngle22_5 * ((krand() & 256)? 1 : -1);
DAngle add = DAngle22_5 - randomAngle(DAngle45);
actor->spr.Angles.Yaw += add;
if (hits(actor) < 51.25)
if (hits(actor) < 52.75)
actor->spr.Angles.Yaw -= add;
}
}
else if (ticselapsed > 18 && ticselapsed < 26) // choose
{
if (angdif < DAngle90) actor->spr.Angles.Yaw = goalang;
if (abs(angdif) < DAngle90) actor->spr.Angles.Yaw = goalang;
else actor->spr.Angles.Yaw += angdif * 0.25;
}
}