- mummy’s cansee and FindPlayer

This commit is contained in:
Christoph Oelckers 2022-08-22 18:40:37 +02:00
parent b804d7fe15
commit 72187a7f3b
2 changed files with 9 additions and 15 deletions

View file

@ -679,13 +679,8 @@ DExhumedActor* FindPlayer(DExhumedActor* pActor, int nDistance, bool dontengage)
if (nDistance < 0)
nDistance = 100;
int x = pActor->int_pos().X;
int y = pActor->int_pos().Y;
auto pSector =pActor->sector();
int z = pActor->int_pos().Z - GetActorHeight(pActor);
nDistance <<= 8;
auto pSector =pActor->sector();
nDistance <<= 4;
DExhumedActor* pPlayerActor = nullptr;
int i = 0;
@ -699,13 +694,13 @@ DExhumedActor* FindPlayer(DExhumedActor* pActor, int nDistance, bool dontengage)
if ((pPlayerActor->spr.cstat & CSTAT_SPRITE_BLOCK_ALL) && (!(pPlayerActor->spr.cstat & CSTAT_SPRITE_INVISIBLE)))
{
int v9 = abs(pPlayerActor->int_pos().X - x);
int v9 = abs(pPlayerActor->spr.pos.X - pActor->spr.pos.X);
if (v9 < nDistance)
{
int v10 = abs(pPlayerActor->int_pos().Y - y);
int v10 = abs(pPlayerActor->spr.pos.Y - pActor->spr.pos.Y);
if (v10 < nDistance && cansee(pPlayerActor->int_pos().X, pPlayerActor->int_pos().Y, pPlayerActor->int_pos().Z - 7680, pPlayerActor->sector(), x, y, z, pSector))
if (v10 < nDistance && cansee(pPlayerActor->spr.pos.plusZ(-30), pPlayerActor->sector(), pActor->spr.pos.plusZ(-GetActorHeightF(pActor)), pSector))
{
break;
}

View file

@ -93,13 +93,12 @@ void CheckMummyRevive(DExhumedActor* pActor)
if (pOther->nAction != 5) {
continue;
}
int x = abs(pOther->int_pos().X - pActor->int_pos().X) >> 8;
int y = abs(pOther->int_pos().Y - pActor->int_pos().Y) >> 8;
double x = abs(pOther->spr.pos.X - pActor->spr.pos.X);
double y = abs(pOther->spr.pos.Y - pActor->spr.pos.Y);
if (x <= 20 && y <= 20)
if (x <= 320 && y <= 320)
{
if (cansee(pActor->int_pos().X, pActor->int_pos().Y, pActor->int_pos().Z - 8192, pActor->sector(),
pOther->int_pos().X, pOther->int_pos().Y, pOther->int_pos().Z - 8192, pOther->sector()))
if (cansee(pActor->spr.pos.plusZ(-32), pActor->sector(), pOther->spr.pos.plusZ(-32), pOther->sector()))
{
pOther->spr.cstat = 0;
pOther->nAction = 6;