- floatified hitawall

This commit is contained in:
Christoph Oelckers 2022-09-14 00:20:58 +02:00
parent b176d94ede
commit ebb7442370
2 changed files with 7 additions and 5 deletions

View file

@ -204,14 +204,14 @@ double hitasprite(DDukeActor* actor, DDukeActor** hitsp)
//
//---------------------------------------------------------------------------
int hitawall(player_struct* p, walltype** hitw)
double hitawall(player_struct* p, walltype** hitw)
{
HitInfo hit{};
hitscan(p->player_int_pos(), p->cursector, { int(p->angle.ang.Cos() * (1 << 14)), int(p->angle.ang.Sin() * (1 << 14)), 0 }, hit, CLIPMASK0);
hitscan(p->pos, p->cursector, DVector3(p->angle.ang.ToVector() * 1024, 0), hit, CLIPMASK0);
if (hitw) *hitw = hit.hitWall;
return (FindDistance2D(hit.int_hitpos().vec2 - p->player_int_pos().vec2));
return (hit.hitpos.XY() - p->pos.XY()).Length();
}

View file

@ -1563,10 +1563,11 @@ void checksectors_d(int snum)
p->toggle_key_flag = 1;
hitscanwall = nullptr;
i = hitawall(p, &hitscanwall);
double dist = hitawall(p, &hitscanwall);
if (hitscanwall != nullptr)
{
if (i < 1280 && hitscanwall->overpicnum == MIRROR)
if (dist < 80 && hitscanwall->overpicnum == MIRROR)
if (hitscanwall->lotag > 0 && S_CheckSoundPlaying(hitscanwall->lotag) == 0 && snum == screenpeek)
{
S_PlayActorSound(hitscanwall->lotag, pact);
@ -1701,6 +1702,7 @@ void checksectors_d(int snum)
case VIEWSCREEN:
case VIEWSCREEN2:
{
i = 0;
DukeStatIterator it(STAT_ACTOR);
while (auto acti = it.Next())
{