- floatified return value of hits()

This commit is contained in:
Christoph Oelckers 2022-09-14 00:05:32 +02:00
parent 1111251887
commit 9591325876
8 changed files with 12 additions and 12 deletions

View file

@ -5029,7 +5029,7 @@ void alterang(int ang, DDukeActor* actor, int playernum)
{
DAngle add = DAngle22_5 * ((krand() & 256)? 1 : -1);
actor->spr.angle += add;
if (hits(actor) < 844)
if (hits(actor) < 51.25)
actor->spr.angle -= add;
}
}

View file

@ -167,7 +167,7 @@ int setanimation(sectortype* animsect, int animtype, sectortype* animtarget, dou
void dofurniture(walltype* wallNum, sectortype* sectnum, int playerNum);
void dotorch();
int hitawall(player_struct* pl, walltype** hitWall);
int hits(DDukeActor* snum);
double hits(DDukeActor* snum);
DDukeActor* LocateTheLocator(int n, sectortype* sectnum);
void clearcamera(player_struct* ps);

View file

@ -159,7 +159,7 @@ void tracers(const DVector3& start, const DVector3& dest, int n)
//
//---------------------------------------------------------------------------
int hits(DDukeActor* actor)
double hits(DDukeActor* actor)
{
int zoff;
HitInfo hit{};
@ -169,7 +169,7 @@ int hits(DDukeActor* actor)
auto pos = actor->int_pos();
hitscan(pos.withZOffset(-zoff), actor->sector(), { bcos(actor->int_ang()), bsin(actor->int_ang()), 0 }, hit, CLIPMASK1);
return (FindDistance2D(hit.int_hitpos().vec2 - actor->int_pos().vec2));
return (FindDistance2D(hit.int_hitpos().vec2 - actor->int_pos().vec2)) * inttoworld;
}
//---------------------------------------------------------------------------

View file

@ -2261,8 +2261,8 @@ static void operateweapon(int snum, ESyncBits actions)
spawned->spr.pos.Z += 8;
}
k = hits(pact);
if (k < 512)
double hd = hits(pact);
if (hd < 32)
{
spawned->spr.angle += DAngle180;
spawned->vel *= 1./3.;

View file

@ -2764,8 +2764,8 @@ static void operateweapon(int snum, ESyncBits actions, sectortype* psectp)
spawned->spr.pos.Z += 8;
}
k = hits(p->GetActor());
if (k < 512)
int hd = hits(p->GetActor());
if (hd < 32)
{
spawned->spr.angle += DAngle180;
spawned->vel *= 1./3.;

View file

@ -360,8 +360,8 @@ void operateweapon_ww(int snum, ESyncBits actions)
j->spr.pos.Z += 8;
}
k = hits(p->GetActor());
if (k < 512)
int hd = hits(p->GetActor());
if (hd < 32)
{
j->spr.angle += DAngle180;
j->vel *= 1./3.;

View file

@ -1733,7 +1733,7 @@ void checksectors_d(int snum)
}
if (near.hitWall == nullptr && near.hitSector == nullptr && near.actor() == nullptr)
if (abs(hits(p->GetActor())) < 512)
if (hits(p->GetActor()) < 32)
{
if ((krand() & 255) < 16)
S_PlayActorSound(DUKE_SEARCH2, pact);

View file

@ -2671,7 +2671,7 @@ void checksectors_r(int snum)
if (!PlayerInput(snum, SB_OPEN)) return;
if (near.hitWall == nullptr && near.hitSector == nullptr && near.actor() == nullptr)
if (abs(hits(p->GetActor())) < 512)
if (hits(p->GetActor()) < 32)
{
if ((krand() & 255) < 16)
S_PlayActorSound(DUKE_SEARCH2, pact);