2019-09-19 22:42:45 +00:00
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
/*
|
|
|
|
Copyright (C) 2010-2019 EDuke32 developers and contributors
|
|
|
|
Copyright (C) 2019 Nuke.YKT
|
|
|
|
|
|
|
|
This file is part of NBlood.
|
|
|
|
|
|
|
|
NBlood is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU General Public License version 2
|
|
|
|
as published by the Free Software Foundation.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
|
|
|
|
See the GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
*/
|
|
|
|
//-------------------------------------------------------------------------
|
2019-09-21 18:59:54 +00:00
|
|
|
|
|
|
|
#include "ns.h" // Must come before everything else!
|
|
|
|
|
2019-09-19 22:42:45 +00:00
|
|
|
#include "build.h"
|
|
|
|
|
|
|
|
#include "blood.h"
|
|
|
|
|
2019-09-22 06:39:22 +00:00
|
|
|
BEGIN_BLD_NS
|
|
|
|
|
2021-09-16 19:59:39 +00:00
|
|
|
static void sub_72580(DBloodActor*);
|
|
|
|
static void sub_725A4(DBloodActor*);
|
|
|
|
static void sub_72850(DBloodActor*);
|
|
|
|
static void sub_72934(DBloodActor*);
|
2019-09-19 22:42:45 +00:00
|
|
|
|
|
|
|
|
|
|
|
AISTATE tchernobogIdle = { kAiStateIdle, 0, -1, 0, NULL, NULL, sub_725A4, NULL };
|
|
|
|
AISTATE tchernobogSearch = { kAiStateSearch, 8, -1, 1800, NULL, aiMoveForward, sub_72580, &tchernobogIdle };
|
|
|
|
AISTATE tchernobogChase = { kAiStateChase, 8, -1, 0, NULL, aiMoveForward, sub_72934, NULL };
|
|
|
|
AISTATE tchernobogRecoil = { kAiStateRecoil, 5, -1, 0, NULL, NULL, NULL, &tchernobogSearch };
|
|
|
|
AISTATE tcherno13A9B8 = { kAiStateMove, 8, -1, 600, NULL, aiMoveForward, sub_72850, &tchernobogIdle };
|
|
|
|
AISTATE tcherno13A9D4 = { kAiStateMove, 6, dword_279B54, 60, NULL, NULL, NULL, &tchernobogChase };
|
|
|
|
AISTATE tcherno13A9F0 = { kAiStateChase, 6, dword_279B58, 60, NULL, NULL, NULL, &tchernobogChase };
|
|
|
|
AISTATE tcherno13AA0C = { kAiStateChase, 7, dword_279B5C, 60, NULL, NULL, NULL, &tchernobogChase };
|
|
|
|
AISTATE tcherno13AA28 = { kAiStateChase, 8, -1, 60, NULL, aiMoveTurn, NULL, &tchernobogChase };
|
|
|
|
|
2020-11-07 14:16:12 +00:00
|
|
|
void sub_71A90(int, DBloodActor* actor)
|
2019-09-19 22:42:45 +00:00
|
|
|
{
|
2021-09-16 19:59:39 +00:00
|
|
|
if (!actor->ValidateTarget(__FUNCTION__)) return;
|
2021-08-29 17:22:51 +00:00
|
|
|
auto target = actor->GetTarget();
|
2021-12-22 15:49:41 +00:00
|
|
|
if (target->xspr.burnTime == 0)
|
2021-08-29 17:22:51 +00:00
|
|
|
evPostActor(target, 0, kCallbackFXFlameLick);
|
|
|
|
actBurnSprite(actor->GetOwner(), target, 40);
|
2021-09-16 19:59:39 +00:00
|
|
|
if (Chance(0x6000))
|
|
|
|
aiNewState(actor, &tcherno13A9D4);
|
2019-09-19 22:42:45 +00:00
|
|
|
}
|
|
|
|
|
2020-11-07 14:16:12 +00:00
|
|
|
void sub_71BD4(int, DBloodActor* actor)
|
2019-09-19 22:42:45 +00:00
|
|
|
{
|
2021-12-22 19:22:35 +00:00
|
|
|
DUDEINFO* pDudeInfo = getDudeInfo(actor->spr.type);
|
|
|
|
int height = actor->spr.yrepeat * pDudeInfo->eyeHeight;
|
2021-09-16 19:59:39 +00:00
|
|
|
if (!actor->ValidateTarget(__FUNCTION__)) return;
|
2022-01-30 17:09:26 +00:00
|
|
|
int x = actor->int_pos().X;
|
|
|
|
int y = actor->int_pos().Y;
|
2021-09-16 19:59:39 +00:00
|
|
|
int z = height;
|
|
|
|
TARGETTRACK tt = { 0x10000, 0x10000, 0x100, 0x55, 0x100000 };
|
|
|
|
Aim aim;
|
2021-12-22 19:22:35 +00:00
|
|
|
aim.dx = bcos(actor->spr.ang);
|
|
|
|
aim.dy = bsin(actor->spr.ang);
|
2021-09-16 19:59:39 +00:00
|
|
|
aim.dz = actor->dudeSlope;
|
|
|
|
int nClosest = 0x7fffffff;
|
|
|
|
BloodStatIterator it(kStatDude);
|
|
|
|
while (auto actor2 = it.Next())
|
|
|
|
{
|
2021-12-22 19:13:19 +00:00
|
|
|
if (actor == actor2 || !(actor2->spr.flags & 8))
|
2021-09-16 19:59:39 +00:00
|
|
|
continue;
|
2022-01-30 17:09:26 +00:00
|
|
|
int x2 = actor2->int_pos().X;
|
|
|
|
int y2 = actor2->int_pos().Y;
|
|
|
|
int z2 = actor2->int_pos().Z;
|
2021-09-16 19:59:39 +00:00
|
|
|
int nDist = approxDist(x2 - x, y2 - y);
|
|
|
|
if (nDist == 0 || nDist > 0x2800)
|
|
|
|
continue;
|
|
|
|
if (tt.at10)
|
|
|
|
{
|
|
|
|
int t = DivScale(nDist, tt.at10, 12);
|
2021-12-30 10:15:27 +00:00
|
|
|
x2 += (actor->vel.X * t) >> 12;
|
2021-12-30 10:16:31 +00:00
|
|
|
y2 += (actor->vel.Y * t) >> 12;
|
2021-12-30 10:17:28 +00:00
|
|
|
z2 += (actor->vel.Z * t) >> 8;
|
2021-09-16 19:59:39 +00:00
|
|
|
}
|
2021-12-22 19:22:35 +00:00
|
|
|
int tx = x + MulScale(Cos(actor->spr.ang), nDist, 30);
|
|
|
|
int ty = y + MulScale(Sin(actor->spr.ang), nDist, 30);
|
2021-09-16 19:59:39 +00:00
|
|
|
int tz = z + MulScale(actor->dudeSlope, nDist, 10);
|
|
|
|
int tsr = MulScale(9460, nDist, 10);
|
|
|
|
int top, bottom;
|
2021-12-22 19:13:19 +00:00
|
|
|
GetActorExtents(actor2, &top, &bottom);
|
2021-09-16 19:59:39 +00:00
|
|
|
if (tz - tsr > bottom || tz + tsr < top)
|
|
|
|
continue;
|
|
|
|
int dx = (tx - x2) >> 4;
|
|
|
|
int dy = (ty - y2) >> 4;
|
|
|
|
int dz = (tz - z2) >> 8;
|
|
|
|
int nDist2 = ksqrt(dx * dx + dy * dy + dz * dz);
|
|
|
|
if (nDist2 < nClosest)
|
|
|
|
{
|
|
|
|
int nAngle = getangle(x2 - x, y2 - y);
|
2021-12-22 19:22:35 +00:00
|
|
|
int nDeltaAngle = ((nAngle - actor->spr.ang + 1024) & 2047) - 1024;
|
2021-09-16 19:59:39 +00:00
|
|
|
if (abs(nDeltaAngle) <= tt.at8)
|
|
|
|
{
|
2022-01-30 17:09:26 +00:00
|
|
|
int tz1 = actor2->int_pos().Z - actor->int_pos().Z;
|
2021-12-30 15:51:56 +00:00
|
|
|
if (cansee(x, y, z, actor->sector(), x2, y2, z2, actor2->sector()))
|
2021-09-16 19:59:39 +00:00
|
|
|
{
|
|
|
|
nClosest = nDist2;
|
2021-10-30 06:22:27 +00:00
|
|
|
aim.dx = bcos(nAngle);
|
2021-10-30 06:22:17 +00:00
|
|
|
aim.dy = bsin(nAngle);
|
2021-12-24 09:25:18 +00:00
|
|
|
aim.dz = DivScale(tz1, nDist, 10);
|
2021-09-16 19:59:39 +00:00
|
|
|
}
|
|
|
|
else
|
2021-12-24 09:25:18 +00:00
|
|
|
aim.dz = tz1;
|
2021-09-16 19:59:39 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2021-12-29 18:41:41 +00:00
|
|
|
actFireMissile(actor, -350, 0, aim.dx, aim.dy, aim.dz, kMissileFireballTchernobog);
|
|
|
|
actFireMissile(actor, 350, 0, aim.dx, aim.dy, aim.dz, kMissileFireballTchernobog);
|
2019-09-19 22:42:45 +00:00
|
|
|
}
|
|
|
|
|
2020-11-07 14:16:12 +00:00
|
|
|
void sub_720AC(int, DBloodActor* actor)
|
2019-09-19 22:42:45 +00:00
|
|
|
{
|
2021-09-16 19:59:39 +00:00
|
|
|
if (!actor->ValidateTarget(__FUNCTION__)) return;
|
2021-09-16 17:28:42 +00:00
|
|
|
|
2021-12-22 19:22:35 +00:00
|
|
|
DUDEINFO* pDudeInfo = getDudeInfo(actor->spr.type);
|
|
|
|
int height = actor->spr.yrepeat * pDudeInfo->eyeHeight;
|
2021-09-16 19:59:39 +00:00
|
|
|
int ax, ay, az;
|
2021-12-22 19:22:35 +00:00
|
|
|
ax = bcos(actor->spr.ang);
|
|
|
|
ay = bsin(actor->spr.ang);
|
2022-01-30 17:09:26 +00:00
|
|
|
int x = actor->int_pos().X;
|
|
|
|
int y = actor->int_pos().Y;
|
2021-09-16 19:59:39 +00:00
|
|
|
int z = height;
|
|
|
|
TARGETTRACK tt = { 0x10000, 0x10000, 0x100, 0x55, 0x100000 };
|
|
|
|
Aim aim;
|
|
|
|
aim.dx = ax;
|
|
|
|
aim.dy = ay;
|
|
|
|
aim.dz = actor->dudeSlope;
|
|
|
|
int nClosest = 0x7fffffff;
|
|
|
|
az = 0;
|
|
|
|
BloodStatIterator it(kStatDude);
|
|
|
|
while (auto actor2 = it.Next())
|
|
|
|
{
|
2021-12-22 19:13:19 +00:00
|
|
|
if (actor == actor2 || !(actor2->spr.flags & 8))
|
2021-09-16 19:59:39 +00:00
|
|
|
continue;
|
2022-01-30 17:09:26 +00:00
|
|
|
int x2 = actor2->int_pos().X;
|
|
|
|
int y2 = actor2->int_pos().Y;
|
|
|
|
int z2 = actor2->int_pos().Z;
|
2021-09-16 19:59:39 +00:00
|
|
|
int nDist = approxDist(x2 - x, y2 - y);
|
|
|
|
if (nDist == 0 || nDist > 0x2800)
|
|
|
|
continue;
|
|
|
|
if (tt.at10)
|
|
|
|
{
|
|
|
|
int t = DivScale(nDist, tt.at10, 12);
|
2021-12-30 10:15:27 +00:00
|
|
|
x2 += (actor->vel.X * t) >> 12;
|
2021-12-30 10:16:31 +00:00
|
|
|
y2 += (actor->vel.Y * t) >> 12;
|
2021-12-30 10:17:28 +00:00
|
|
|
z2 += (actor->vel.Z * t) >> 8;
|
2021-09-16 19:59:39 +00:00
|
|
|
}
|
2021-12-22 19:22:35 +00:00
|
|
|
int tx = x + MulScale(Cos(actor->spr.ang), nDist, 30);
|
|
|
|
int ty = y + MulScale(Sin(actor->spr.ang), nDist, 30);
|
2021-09-16 19:59:39 +00:00
|
|
|
int tz = z + MulScale(actor->dudeSlope, nDist, 10);
|
|
|
|
int tsr = MulScale(9460, nDist, 10);
|
|
|
|
int top, bottom;
|
2021-12-22 19:13:19 +00:00
|
|
|
GetActorExtents(actor2, &top, &bottom);
|
2021-09-16 19:59:39 +00:00
|
|
|
if (tz - tsr > bottom || tz + tsr < top)
|
|
|
|
continue;
|
|
|
|
int dx = (tx - x2) >> 4;
|
|
|
|
int dy = (ty - y2) >> 4;
|
|
|
|
int dz = (tz - z2) >> 8;
|
|
|
|
int nDist2 = ksqrt(dx * dx + dy * dy + dz * dz);
|
|
|
|
if (nDist2 < nClosest)
|
|
|
|
{
|
|
|
|
int nAngle = getangle(x2 - x, y2 - y);
|
2021-12-22 19:22:35 +00:00
|
|
|
int nDeltaAngle = ((nAngle - actor->spr.ang + 1024) & 2047) - 1024;
|
2021-09-16 19:59:39 +00:00
|
|
|
if (abs(nDeltaAngle) <= tt.at8)
|
|
|
|
{
|
2022-01-30 17:09:26 +00:00
|
|
|
int tz1 = actor2->int_pos().Z - actor->int_pos().Z;
|
2021-12-30 15:51:56 +00:00
|
|
|
if (cansee(x, y, z, actor->sector(), x2, y2, z2, actor2->sector()))
|
2021-09-16 19:59:39 +00:00
|
|
|
{
|
|
|
|
nClosest = nDist2;
|
2021-10-30 06:22:27 +00:00
|
|
|
aim.dx = bcos(nAngle);
|
2021-10-30 06:22:17 +00:00
|
|
|
aim.dy = bsin(nAngle);
|
2021-12-24 09:25:18 +00:00
|
|
|
aim.dz = DivScale(tz1, nDist, 10);
|
2021-09-16 19:59:39 +00:00
|
|
|
}
|
|
|
|
else
|
2021-12-24 09:25:18 +00:00
|
|
|
aim.dz = tz1;
|
2021-09-16 19:59:39 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2021-12-29 18:41:41 +00:00
|
|
|
actFireMissile(actor, 350, 0, aim.dx, aim.dy, -aim.dz, kMissileFireballTchernobog);
|
|
|
|
actFireMissile(actor, -350, 0, ax, ay, az, kMissileFireballTchernobog);
|
2019-09-19 22:42:45 +00:00
|
|
|
}
|
|
|
|
|
2020-11-06 21:48:22 +00:00
|
|
|
static void sub_72580(DBloodActor* actor)
|
2019-09-19 22:42:45 +00:00
|
|
|
{
|
2021-12-22 21:49:50 +00:00
|
|
|
aiChooseDirection(actor, actor->xspr.goalAng);
|
2021-09-16 19:59:39 +00:00
|
|
|
aiThinkTarget(actor);
|
2019-09-19 22:42:45 +00:00
|
|
|
}
|
|
|
|
|
2020-11-06 21:48:22 +00:00
|
|
|
static void sub_725A4(DBloodActor* actor)
|
2019-09-19 22:42:45 +00:00
|
|
|
{
|
2021-12-22 19:22:35 +00:00
|
|
|
if (!(actor->spr.type >= kDudeBase && actor->spr.type < kDudeMax)) {
|
|
|
|
Printf(PRINT_HIGH, "actor->spr.type >= kDudeBase && actor->spr.type < kDudeMax");
|
2021-09-16 19:59:39 +00:00
|
|
|
return;
|
|
|
|
}
|
2021-12-22 19:22:35 +00:00
|
|
|
DUDEINFO* pDudeInfo = getDudeInfo(actor->spr.type);
|
2021-09-16 19:59:39 +00:00
|
|
|
DUDEEXTRA_STATS* pDudeExtraE = &actor->dudeExtra.stats;
|
|
|
|
if (pDudeExtraE->active && pDudeExtraE->thinkTime < 10)
|
|
|
|
pDudeExtraE->thinkTime++;
|
|
|
|
else if (pDudeExtraE->thinkTime >= 10 && pDudeExtraE->active)
|
|
|
|
{
|
2021-12-22 21:49:50 +00:00
|
|
|
actor->xspr.goalAng += 256;
|
2021-09-04 10:23:36 +00:00
|
|
|
POINT3D* pTarget = &actor->basePoint;
|
2021-12-22 09:41:47 +00:00
|
|
|
aiSetTarget(actor, pTarget->X, pTarget->Y, pTarget->Z);
|
2021-09-16 19:59:39 +00:00
|
|
|
aiNewState(actor, &tcherno13AA28);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (Chance(pDudeInfo->alertChance))
|
|
|
|
{
|
|
|
|
for (int p = connecthead; p >= 0; p = connectpoint2[p])
|
|
|
|
{
|
|
|
|
PLAYER* pPlayer = &gPlayer[p];
|
2021-12-22 21:49:50 +00:00
|
|
|
if (pPlayer->actor->xspr.health == 0 || powerupCheck(pPlayer, kPwUpShadowCloak) > 0)
|
2021-09-16 19:59:39 +00:00
|
|
|
continue;
|
2022-01-30 17:09:26 +00:00
|
|
|
int x = pPlayer->actor->int_pos().X;
|
|
|
|
int y = pPlayer->actor->int_pos().Y;
|
|
|
|
int z = pPlayer->actor->int_pos().Z;
|
2021-12-30 15:51:56 +00:00
|
|
|
auto pSector = pPlayer->actor->sector();
|
2022-01-30 17:09:26 +00:00
|
|
|
int dx = x - actor->int_pos().X;
|
|
|
|
int dy = y - actor->int_pos().Y;
|
2021-09-16 19:59:39 +00:00
|
|
|
int nDist = approxDist(dx, dy);
|
|
|
|
if (nDist > pDudeInfo->seeDist && nDist > pDudeInfo->hearDist)
|
|
|
|
continue;
|
2022-01-30 17:09:26 +00:00
|
|
|
if (!cansee(x, y, z, pSector, actor->int_pos().X, actor->int_pos().Y, actor->int_pos().Z - ((pDudeInfo->eyeHeight * actor->spr.yrepeat) << 2), actor->sector()))
|
2021-09-16 19:59:39 +00:00
|
|
|
continue;
|
2021-12-22 19:22:35 +00:00
|
|
|
int nDeltaAngle = ((getangle(dx, dy) + 1024 - actor->spr.ang) & 2047) - 1024;
|
2021-09-16 19:59:39 +00:00
|
|
|
if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery)
|
|
|
|
{
|
|
|
|
pDudeExtraE->thinkTime = 0;
|
2021-09-05 07:53:06 +00:00
|
|
|
aiSetTarget(actor, pPlayer->actor);
|
2021-09-16 19:59:39 +00:00
|
|
|
aiActivateDude(actor);
|
|
|
|
}
|
|
|
|
else if (nDist < pDudeInfo->hearDist)
|
|
|
|
{
|
|
|
|
pDudeExtraE->thinkTime = 0;
|
|
|
|
aiSetTarget(actor, x, y, z);
|
|
|
|
aiActivateDude(actor);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
continue;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2019-09-19 22:42:45 +00:00
|
|
|
}
|
|
|
|
|
2020-11-06 21:48:22 +00:00
|
|
|
static void sub_72850(DBloodActor* actor)
|
2019-09-19 22:42:45 +00:00
|
|
|
{
|
2021-12-22 19:22:35 +00:00
|
|
|
if (!(actor->spr.type >= kDudeBase && actor->spr.type < kDudeMax)) {
|
|
|
|
Printf(PRINT_HIGH, "actor->spr.type >= kDudeBase && actor->spr.type < kDudeMax");
|
2021-09-16 19:59:39 +00:00
|
|
|
return;
|
|
|
|
}
|
2021-12-22 19:22:35 +00:00
|
|
|
DUDEINFO* pDudeInfo = getDudeInfo(actor->spr.type);
|
2022-01-30 17:09:26 +00:00
|
|
|
int dx = actor->xspr.TargetPos.X - actor->int_pos().X;
|
|
|
|
int dy = actor->xspr.TargetPos.Y - actor->int_pos().Y;
|
2021-09-16 19:59:39 +00:00
|
|
|
int nAngle = getangle(dx, dy);
|
|
|
|
int nDist = approxDist(dx, dy);
|
|
|
|
aiChooseDirection(actor, nAngle);
|
2021-12-22 19:22:35 +00:00
|
|
|
if (nDist < 512 && abs(actor->spr.ang - nAngle) < pDudeInfo->periphery)
|
2021-09-16 19:59:39 +00:00
|
|
|
aiNewState(actor, &tchernobogSearch);
|
|
|
|
aiThinkTarget(actor);
|
2019-09-19 22:42:45 +00:00
|
|
|
}
|
|
|
|
|
2020-11-06 21:48:22 +00:00
|
|
|
static void sub_72934(DBloodActor* actor)
|
2019-09-19 22:42:45 +00:00
|
|
|
{
|
2021-09-16 19:59:39 +00:00
|
|
|
if (actor->GetTarget() == nullptr)
|
|
|
|
{
|
|
|
|
aiNewState(actor, &tcherno13A9B8);
|
|
|
|
return;
|
|
|
|
}
|
2021-12-22 19:22:35 +00:00
|
|
|
if (!(actor->spr.type >= kDudeBase && actor->spr.type < kDudeMax)) {
|
|
|
|
Printf(PRINT_HIGH, "actor->spr.type >= kDudeBase && actor->spr.type < kDudeMax");
|
2021-09-16 19:59:39 +00:00
|
|
|
return;
|
|
|
|
}
|
2021-12-22 19:22:35 +00:00
|
|
|
DUDEINFO* pDudeInfo = getDudeInfo(actor->spr.type);
|
2021-09-16 19:59:39 +00:00
|
|
|
if (!actor->ValidateTarget(__FUNCTION__)) return;
|
2021-12-22 19:02:43 +00:00
|
|
|
auto target = actor->GetTarget();
|
2021-12-29 18:41:41 +00:00
|
|
|
|
2022-01-30 17:09:26 +00:00
|
|
|
int dx = target->int_pos().X - actor->int_pos().X;
|
|
|
|
int dy = target->int_pos().Y - actor->int_pos().Y;
|
2021-09-16 19:59:39 +00:00
|
|
|
aiChooseDirection(actor, getangle(dx, dy));
|
2021-12-22 19:48:11 +00:00
|
|
|
if (target->xspr.health == 0)
|
2021-09-16 19:59:39 +00:00
|
|
|
{
|
|
|
|
aiNewState(actor, &tchernobogSearch);
|
|
|
|
return;
|
|
|
|
}
|
2021-12-22 19:02:43 +00:00
|
|
|
if (target->IsPlayerActor() && powerupCheck(&gPlayer[target->spr.type - kDudePlayer1], kPwUpShadowCloak) > 0)
|
2021-09-16 19:59:39 +00:00
|
|
|
{
|
|
|
|
aiNewState(actor, &tchernobogSearch);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
int nDist = approxDist(dx, dy);
|
|
|
|
if (nDist <= pDudeInfo->seeDist)
|
|
|
|
{
|
2021-12-22 19:22:35 +00:00
|
|
|
int nDeltaAngle = ((getangle(dx, dy) + 1024 - actor->spr.ang) & 2047) - 1024;
|
|
|
|
int height = (pDudeInfo->eyeHeight * actor->spr.yrepeat) << 2;
|
2022-01-30 17:09:26 +00:00
|
|
|
if (cansee(target->int_pos().X, target->int_pos().Y, target->int_pos().Z, target->sector(), actor->int_pos().X, actor->int_pos().Y, actor->int_pos().Z - height, actor->sector()))
|
2021-09-16 19:59:39 +00:00
|
|
|
{
|
|
|
|
if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery)
|
|
|
|
{
|
|
|
|
aiSetTarget(actor, actor->GetTarget());
|
|
|
|
if (nDist < 0x1f00 && nDist > 0xd00 && abs(nDeltaAngle) < 85)
|
|
|
|
aiNewState(actor, &tcherno13AA0C);
|
|
|
|
else if (nDist < 0xd00 && nDist > 0xb00 && abs(nDeltaAngle) < 85)
|
|
|
|
aiNewState(actor, &tcherno13A9D4);
|
|
|
|
else if (nDist < 0xb00 && nDist > 0x500 && abs(nDeltaAngle) < 85)
|
|
|
|
aiNewState(actor, &tcherno13A9F0);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2019-09-19 22:42:45 +00:00
|
|
|
|
2021-09-16 19:59:39 +00:00
|
|
|
aiNewState(actor, &tcherno13A9B8);
|
|
|
|
actor->SetTarget(nullptr);
|
2019-09-19 22:42:45 +00:00
|
|
|
}
|
2019-09-22 06:39:22 +00:00
|
|
|
|
|
|
|
END_BLD_NS
|