- 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 8a5501480e
commit 6fd0827d24

View file

@ -4224,17 +4224,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.angle += add;
if (hits(actor) < 51.25)
if (hits(actor) < 52.75)
actor->spr.angle -= add;
}
}
else if (ticselapsed > 18 && ticselapsed < 26) // choose
{
if (angdif < DAngle90) actor->spr.angle = goalang;
if (abs(angdif) < DAngle90) actor->spr.angle = goalang;
else actor->spr.angle += angdif * 0.25;
}
}