- floatified InitRipperHang

This commit is contained in:
Christoph Oelckers 2022-08-31 19:01:57 +02:00
parent 975e08666c
commit 984dfb9889

View file

@ -916,27 +916,19 @@ int PickJumpMaxSpeed(DSWActor* actor, short max_speed)
int InitRipperHang(DSWActor* actor)
{
int dist;
HitInfo hit{};
bool Found = false;
short dang, tang;
for (dang = 0; dang < 2048; dang += 128)
for (int dang = 0; dang < 2048; dang += 128)
{
tang = NORM_ANGLE(actor->int_ang() + dang);
auto tang = actor->spr.angle + DAngle::fromBuild(dang);
FAFhitscan(actor->int_pos().X, actor->int_pos().Y, actor->int_pos().Z - int_ActorSizeZ(actor), actor->sector(), // Start position
bcos(tang), // X vector of 3D ang
bsin(tang), // Y vector of 3D ang
0, // Z vector of 3D ang
hit, CLIPMASK_MISSILE);
FAFhitscan(actor->spr.pos.plusZ(-ActorSizeZ(actor)), actor->sector(), DVector3(tang.ToVector() * 1024, 0), hit, CLIPMASK_MISSILE);
if (hit.hitSector == nullptr)
continue;
dist = DistanceI(actor->spr.pos, hit.hitpos);
int dist = DistanceI(actor->spr.pos, hit.hitpos);
if (hit.hitWall == nullptr || dist < 2000 || dist > 7000)
{
@ -944,7 +936,7 @@ int InitRipperHang(DSWActor* actor)
}
Found = true;
actor->set_int_ang(tang);
actor->spr.angle = tang;
break;
}