- floatified hitasprite's callers.

This commit is contained in:
Christoph Oelckers 2022-09-14 00:11:16 +02:00
parent d4aaee6274
commit 062e533b81
6 changed files with 29 additions and 33 deletions

View file

@ -884,7 +884,7 @@ static void movetripbomb(DDukeActor *actor)
ChangeActorSect(actor, curSect);
DDukeActor* hit;
x = hitasprite(actor, &hit) * inttoworld;
x = hitasprite(actor, &hit);
actor->ovel.X = x;
@ -944,7 +944,7 @@ static void movetripbomb(DDukeActor *actor)
actor->spr.pos.Z -= 3;
SetActor(actor, actor->spr.pos);
x = hitasprite(actor, nullptr) * inttoworld;
x = hitasprite(actor, nullptr);
actor->spr.pos.XY() = actor->temp_pos.XY();
actor->spr.pos.Z += 3;

View file

@ -139,7 +139,7 @@ void shootbloodsplat(DDukeActor* i, int p, const DVector3& pos, DAngle ang, int
void breakwall(int newpn, DDukeActor* spr, walltype* dawallnum);
int callsound(sectortype* sectnum,DDukeActor* snum, bool endstate = false);
int hitasprite(DDukeActor* snum,DDukeActor **hitSprite);
double hitasprite(DDukeActor* snum,DDukeActor **hitSprite);
int findplayer(const DDukeActor* s, double* dist);
inline int findplayer(const DDukeActor* s, int* dist)

View file

@ -1381,63 +1381,61 @@ void ParseState::parseifelse(int condition)
static int ifcanshoottarget(DDukeActor *actor, int g_p, int g_x)
{
int j;
if (g_x > 1024)
{
int sclip;
double sclip;
DAngle angdif;
if (badguy(actor) && actor->spr.xrepeat > 56)
{
sclip = 3084;
sclip = 3084 / 16.;
angdif = DAngle22_5 * 3 / 8;
}
else
{
sclip = 768;
sclip = 48;
angdif = DAngle22_5 / 8;
}
DDukeActor* hit;
j = hitasprite(actor, &hit);
if (j == (1 << 30))
double hs = hitasprite(actor, &hit);
if (hs == INT_MAX)
{
return 1;
}
if (j > sclip)
if (hs > sclip)
{
if (hit != nullptr && hit->spr.picnum == actor->spr.picnum)
j = 0;
return 0;
else
{
actor->spr.angle += angdif;
j = hitasprite(actor, &hit);
hs = hitasprite(actor, &hit);
actor->spr.angle -= angdif;
if (j > sclip)
if (hs > sclip)
{
if (hit != nullptr && hit->spr.picnum == actor->spr.picnum)
j = 0;
return 0;
else
{
actor->spr.angle += angdif;
j = hitasprite(actor, &hit);
hs = hitasprite(actor, &hit);
actor->spr.angle -= angdif;
if (j > 768)
if (hs > 48)
{
if (hit != nullptr && hit->spr.picnum == actor->spr.picnum)
j = 0;
else j = 1;
return 0;
return 1;
}
else j = 0;
else return 0;
}
}
else j = 0;
else return 0;
}
}
else j = 0;
return 0;
}
else j = 1;
return j;
return 1;
}
//---------------------------------------------------------------------------

View file

@ -178,7 +178,7 @@ double hits(DDukeActor* actor)
//
//---------------------------------------------------------------------------
int hitasprite(DDukeActor* actor, DDukeActor** hitsp)
double hitasprite(DDukeActor* actor, DDukeActor** hitsp)
{
int zoff;
HitInfo hit{};
@ -193,9 +193,9 @@ int hitasprite(DDukeActor* actor, DDukeActor** hitsp)
if (hitsp) *hitsp = hit.actor();
if (hit.hitWall != nullptr && (hit.hitWall->cstat & CSTAT_WALL_MASKED) && badguy(actor))
return((1 << 30));
return INT_MAX;
return (FindDistance2D(hit.int_hitpos().vec2 - actor->int_pos().vec2));
return (FindDistance2D(hit.int_hitpos().vec2 - actor->int_pos().vec2)) * inttoworld;
}
//---------------------------------------------------------------------------

View file

@ -1489,7 +1489,7 @@ void clearcameras(int i, player_struct* p)
void checksectors_d(int snum)
{
int i = -1, oldz;
int i = -1;
player_struct* p;
walltype* hitscanwall;
HitInfo near;
@ -1626,9 +1626,9 @@ void checksectors_d(int snum)
if (p->cursector->lotag == 2)
{
DDukeActor* hit;
oldz = hitasprite(p->GetActor(), &hit);
double dist = hitasprite(p->GetActor(), &hit);
if (hit) near.hitActor = hit;
if (oldz > 1280) near.hitActor = nullptr;
if (dist > 80) near.hitActor = nullptr;
}

View file

@ -2390,7 +2390,6 @@ void checkhitsprite_r(DDukeActor* targ, DDukeActor* proj)
void checksectors_r(int snum)
{
int oldz;
player_struct* p;
walltype* hitscanwall;
HitInfo near;
@ -2557,10 +2556,9 @@ void checksectors_r(int snum)
if (p->cursector->lotag == 2)
{
DDukeActor* hit;
oldz = hitasprite(p->GetActor(), &hit);
double dist = hitasprite(p->GetActor(), &hit);
if (hit) near.hitActor = hit;
if (oldz > 1280) near.hitActor = nullptr;
if (dist > 80) near.hitActor = nullptr;
}
auto const neartagsprite = near.actor();