- fixed and floatified chickenarrow.

This commit is contained in:
Christoph Oelckers 2022-09-13 19:37:38 +02:00
parent 021f7062d1
commit 1a597c4e0b
2 changed files with 11 additions and 15 deletions

View file

@ -1711,6 +1711,7 @@ constexpr DAngle nullAngle = DAngle::fromDeg(0.);
constexpr DAngle minAngle = DAngle::fromDeg(1. / 65536.);
constexpr FAngle nullFAngle = FAngle::fromDeg(0.);
constexpr DAngle DAngle1 = DAngle::fromDeg(1);
constexpr DAngle DAngle22_5 = DAngle::fromDeg(22.5);
constexpr DAngle DAngle45 = DAngle::fromDeg(45);
constexpr DAngle DAngle60 = DAngle::fromDeg(60);

View file

@ -930,28 +930,23 @@ static void chickenarrow(DDukeActor* actor)
if (ts->spr.extra <= 0)
actor->seek_actor = nullptr;
if (actor->seek_actor && actor->spr.hitag > 5)
{
int ang, ang2, ang3;
ang = getangle(ts->int_pos().X - actor->int_pos().X, ts->int_pos().Y - actor->int_pos().Y);
ang2 = ang - actor->int_ang();
ang3 = abs(ang2);
if (ang2 < 100)
DAngle ang, ang2, ang3;
ang = VecToAngle(ts->spr.pos - actor->spr.pos);
ang2 = deltaangle(ang, actor->spr.angle);
// this was quite broken in the original code. Fixed so that it seeks properly
if (abs(ang2) < DAngle1 * 17.5)
{
if (ang3 > 1023)
actor->add_int_ang(51);
else
actor->add_int_ang(-51);
actor->spr.angle = ang;
}
else if (ang2 > 100)
else if (ang2 > nullAngle)
{
if (ang3 > 1023)
actor->add_int_ang(-51);
else
actor->add_int_ang(51);
actor->spr.angle -= DAngle1 * 9;
}
else
actor->set_int_ang(ang);
actor->spr.angle += DAngle1 * 9;
if (actor->spr.hitag > 180)
if (actor->vel.Z <= 0)