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 "compat.h"
|
|
|
|
#include "build.h"
|
|
|
|
#include "pragmas.h"
|
|
|
|
#include "mmulti.h"
|
|
|
|
#include "common_game.h"
|
|
|
|
|
2019-10-19 19:11:39 +00:00
|
|
|
|
2019-09-19 22:42:45 +00:00
|
|
|
#include "actor.h"
|
|
|
|
#include "ai.h"
|
|
|
|
#include "aitchern.h"
|
|
|
|
#include "blood.h"
|
|
|
|
#include "db.h"
|
|
|
|
#include "dude.h"
|
|
|
|
#include "eventq.h"
|
|
|
|
#include "levels.h"
|
|
|
|
#include "player.h"
|
|
|
|
#include "seq.h"
|
|
|
|
#include "sfx.h"
|
|
|
|
#include "trig.h"
|
|
|
|
|
2019-09-22 06:39:22 +00:00
|
|
|
BEGIN_BLD_NS
|
|
|
|
|
2019-09-19 22:42:45 +00:00
|
|
|
static void sub_71A90(int, int);
|
|
|
|
static void sub_71BD4(int, int);
|
|
|
|
static void sub_720AC(int, int);
|
|
|
|
static void sub_72580(spritetype *, XSPRITE *);
|
|
|
|
static void sub_725A4(spritetype *, XSPRITE *);
|
|
|
|
static void sub_72850(spritetype *, XSPRITE *);
|
|
|
|
static void sub_72934(spritetype *, XSPRITE *);
|
|
|
|
|
|
|
|
static int dword_279B54 = seqRegisterClient(sub_71BD4);
|
|
|
|
static int dword_279B58 = seqRegisterClient(sub_720AC);
|
|
|
|
static int dword_279B5C = seqRegisterClient(sub_71A90);
|
|
|
|
|
|
|
|
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 };
|
|
|
|
|
|
|
|
static void sub_71A90(int, int nXSprite)
|
|
|
|
{
|
|
|
|
XSPRITE *pXSprite = &xsprite[nXSprite];
|
|
|
|
int nSprite = pXSprite->reference;
|
|
|
|
spritetype *pSprite = &sprite[nSprite];
|
|
|
|
spritetype *pTarget = &sprite[pXSprite->target];
|
|
|
|
XSPRITE *pXTarget = &xsprite[pTarget->extra];
|
|
|
|
int nTarget = pTarget->index;
|
|
|
|
int nOwner = actSpriteIdToOwnerId(nSprite);
|
|
|
|
if (pXTarget->burnTime == 0)
|
2019-10-11 21:59:39 +00:00
|
|
|
evPost(nTarget, 3, 0, kCallbackFXFlameLick);
|
2019-09-19 22:42:45 +00:00
|
|
|
actBurnSprite(nOwner, pXTarget, 40);
|
|
|
|
if (Chance(0x6000))
|
|
|
|
aiNewState(pSprite, pXSprite, &tcherno13A9D4);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void sub_71BD4(int, int nXSprite)
|
|
|
|
{
|
|
|
|
XSPRITE *pXSprite = &xsprite[nXSprite];
|
|
|
|
int nSprite = pXSprite->reference;
|
|
|
|
spritetype *pSprite = &sprite[nSprite];
|
|
|
|
DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type-kDudeBase];
|
|
|
|
int height = pSprite->yrepeat*pDudeInfo->eyeHeight;
|
2019-10-19 19:11:39 +00:00
|
|
|
///dassert(pXSprite->target >= 0 && pXSprite->target < kMaxSprites);
|
|
|
|
if (!(pXSprite->target >= 0 && pXSprite->target < kMaxSprites)) {
|
|
|
|
consoleSysMsg("pXSprite->target >= 0 && pXSprite->target < kMaxSprites");
|
2019-09-19 22:42:45 +00:00
|
|
|
return;
|
2019-10-19 19:11:39 +00:00
|
|
|
}
|
2019-09-19 22:42:45 +00:00
|
|
|
int x = pSprite->x;
|
|
|
|
int y = pSprite->y;
|
|
|
|
int z = height;
|
|
|
|
TARGETTRACK tt = { 0x10000, 0x10000, 0x100, 0x55, 0x100000 };
|
|
|
|
Aim aim;
|
|
|
|
aim.dx = Cos(pSprite->ang)>>16;
|
|
|
|
aim.dy = Sin(pSprite->ang)>>16;
|
|
|
|
aim.dz = gDudeSlope[nXSprite];
|
|
|
|
int nClosest = 0x7fffffff;
|
2019-10-07 19:29:52 +00:00
|
|
|
for (short nSprite2 = headspritestat[kStatDude]; nSprite2 >= 0; nSprite2 = nextspritestat[nSprite2])
|
2019-09-19 22:42:45 +00:00
|
|
|
{
|
|
|
|
spritetype *pSprite2 = &sprite[nSprite2];
|
2019-09-30 07:18:01 +00:00
|
|
|
if (pSprite == pSprite2 || !(pSprite2->flags&8))
|
2019-09-19 22:42:45 +00:00
|
|
|
continue;
|
|
|
|
int x2 = pSprite2->x;
|
|
|
|
int y2 = pSprite2->y;
|
|
|
|
int z2 = pSprite2->z;
|
|
|
|
int nDist = approxDist(x2-x, y2-y);
|
|
|
|
if (nDist == 0 || nDist > 0x2800)
|
|
|
|
continue;
|
|
|
|
if (tt.at10)
|
|
|
|
{
|
|
|
|
int t = divscale(nDist, tt.at10, 12);
|
|
|
|
x2 += (xvel[nSprite2]*t)>>12;
|
|
|
|
y2 += (yvel[nSprite2]*t)>>12;
|
|
|
|
z2 += (zvel[nSprite2]*t)>>8;
|
|
|
|
}
|
|
|
|
int tx = x+mulscale30(Cos(pSprite->ang), nDist);
|
|
|
|
int ty = y+mulscale30(Sin(pSprite->ang), nDist);
|
|
|
|
int tz = z+mulscale(gDudeSlope[nXSprite], nDist, 10);
|
|
|
|
int tsr = mulscale(9460, nDist, 10);
|
|
|
|
int top, bottom;
|
|
|
|
GetSpriteExtents(pSprite2, &top, &bottom);
|
|
|
|
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);
|
|
|
|
int nDeltaAngle = ((nAngle-pSprite->ang+1024)&2047)-1024;
|
|
|
|
if (klabs(nDeltaAngle) <= tt.at8)
|
|
|
|
{
|
|
|
|
int tz = pSprite2->z-pSprite->z;
|
|
|
|
if (cansee(x, y, z, pSprite->sectnum, x2, y2, z2, pSprite2->sectnum))
|
|
|
|
{
|
|
|
|
nClosest = nDist2;
|
|
|
|
aim.dx = Cos(nAngle)>>16;
|
|
|
|
aim.dy = Sin(nAngle)>>16;
|
|
|
|
aim.dz = divscale(tz, nDist, 10);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
aim.dz = tz;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2019-10-11 21:59:39 +00:00
|
|
|
actFireMissile(pSprite, -350, 0, aim.dx, aim.dy, aim.dz, kMissileFireballTchernobog);
|
|
|
|
actFireMissile(pSprite, 350, 0, aim.dx, aim.dy, aim.dz, kMissileFireballTchernobog);
|
2019-09-19 22:42:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void sub_720AC(int, int nXSprite)
|
|
|
|
{
|
|
|
|
XSPRITE *pXSprite = &xsprite[nXSprite];
|
|
|
|
int nSprite = pXSprite->reference;
|
|
|
|
spritetype *pSprite = &sprite[nSprite];
|
2019-10-19 19:11:39 +00:00
|
|
|
///dassert(pXSprite->target >= 0 && pXSprite->target < kMaxSprites);
|
|
|
|
if (!(pXSprite->target >= 0 && pXSprite->target < kMaxSprites)) {
|
|
|
|
consoleSysMsg("pXSprite->target >= 0 && pXSprite->target < kMaxSprites");
|
2019-09-19 22:42:45 +00:00
|
|
|
return;
|
2019-10-19 19:11:39 +00:00
|
|
|
}
|
2019-09-19 22:42:45 +00:00
|
|
|
DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type-kDudeBase];
|
|
|
|
int height = pSprite->yrepeat*pDudeInfo->eyeHeight;
|
|
|
|
int ax, ay, az;
|
|
|
|
ax = Cos(pSprite->ang)>>16;
|
|
|
|
ay = Sin(pSprite->ang)>>16;
|
|
|
|
int x = pSprite->x;
|
|
|
|
int y = pSprite->y;
|
|
|
|
int z = height;
|
|
|
|
TARGETTRACK tt = { 0x10000, 0x10000, 0x100, 0x55, 0x100000 };
|
|
|
|
Aim aim;
|
|
|
|
aim.dx = ax;
|
|
|
|
aim.dy = ay;
|
|
|
|
aim.dz = gDudeSlope[nXSprite];
|
|
|
|
int nClosest = 0x7fffffff;
|
|
|
|
az = 0;
|
2019-10-07 19:29:52 +00:00
|
|
|
for (short nSprite2 = headspritestat[kStatDude]; nSprite2 >= 0; nSprite2 = nextspritestat[nSprite2])
|
2019-09-19 22:42:45 +00:00
|
|
|
{
|
|
|
|
spritetype *pSprite2 = &sprite[nSprite2];
|
2019-09-30 07:18:01 +00:00
|
|
|
if (pSprite == pSprite2 || !(pSprite2->flags&8))
|
2019-09-19 22:42:45 +00:00
|
|
|
continue;
|
|
|
|
int x2 = pSprite2->x;
|
|
|
|
int y2 = pSprite2->y;
|
|
|
|
int z2 = pSprite2->z;
|
|
|
|
int nDist = approxDist(x2-x, y2-y);
|
|
|
|
if (nDist == 0 || nDist > 0x2800)
|
|
|
|
continue;
|
|
|
|
if (tt.at10)
|
|
|
|
{
|
|
|
|
int t = divscale(nDist, tt.at10, 12);
|
|
|
|
x2 += (xvel[nSprite2]*t)>>12;
|
|
|
|
y2 += (yvel[nSprite2]*t)>>12;
|
|
|
|
z2 += (zvel[nSprite2]*t)>>8;
|
|
|
|
}
|
|
|
|
int tx = x+mulscale30(Cos(pSprite->ang), nDist);
|
|
|
|
int ty = y+mulscale30(Sin(pSprite->ang), nDist);
|
|
|
|
int tz = z+mulscale(gDudeSlope[nXSprite], nDist, 10);
|
|
|
|
int tsr = mulscale(9460, nDist, 10);
|
|
|
|
int top, bottom;
|
|
|
|
GetSpriteExtents(pSprite2, &top, &bottom);
|
|
|
|
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);
|
|
|
|
int nDeltaAngle = ((nAngle-pSprite->ang+1024)&2047)-1024;
|
|
|
|
if (klabs(nDeltaAngle) <= tt.at8)
|
|
|
|
{
|
|
|
|
int tz = pSprite2->z-pSprite->z;
|
|
|
|
if (cansee(x, y, z, pSprite->sectnum, x2, y2, z2, pSprite2->sectnum))
|
|
|
|
{
|
|
|
|
nClosest = nDist2;
|
|
|
|
aim.dx = Cos(nAngle)>>16;
|
|
|
|
aim.dy = Sin(nAngle)>>16;
|
|
|
|
aim.dz = divscale(tz, nDist, 10);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
aim.dz = tz;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2019-10-11 21:59:39 +00:00
|
|
|
actFireMissile(pSprite, 350, 0, aim.dx, aim.dy, -aim.dz, kMissileFireballTchernobog);
|
|
|
|
actFireMissile(pSprite, -350, 0, ax, ay, az, kMissileFireballTchernobog);
|
2019-09-19 22:42:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void sub_72580(spritetype *pSprite, XSPRITE *pXSprite)
|
|
|
|
{
|
|
|
|
aiChooseDirection(pSprite, pXSprite, pXSprite->goalAng);
|
|
|
|
aiThinkTarget(pSprite, pXSprite);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void sub_725A4(spritetype *pSprite, XSPRITE *pXSprite)
|
|
|
|
{
|
2019-10-19 19:11:39 +00:00
|
|
|
///dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
|
|
|
|
if (!(pSprite->type >= kDudeBase && pSprite->type < kDudeMax)) {
|
|
|
|
consoleSysMsg("pSprite->type >= kDudeBase && pSprite->type < kDudeMax");
|
2019-09-19 22:42:45 +00:00
|
|
|
return;
|
2019-10-19 19:11:39 +00:00
|
|
|
}
|
2019-09-19 22:42:45 +00:00
|
|
|
DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type-kDudeBase];
|
|
|
|
DUDEEXTRA_at6_u2 *pDudeExtraE = &gDudeExtra[pSprite->extra].at6.u2;
|
|
|
|
if (pDudeExtraE->at4 && pDudeExtraE->at0 < 10)
|
|
|
|
pDudeExtraE->at0++;
|
|
|
|
else if (pDudeExtraE->at0 >= 10 && pDudeExtraE->at4)
|
|
|
|
{
|
|
|
|
pXSprite->goalAng += 256;
|
|
|
|
POINT3D *pTarget = &baseSprite[pSprite->index];
|
|
|
|
aiSetTarget(pXSprite, pTarget->x, pTarget->y, pTarget->z);
|
|
|
|
aiNewState(pSprite, pXSprite, &tcherno13AA28);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (Chance(pDudeInfo->alertChance))
|
|
|
|
{
|
|
|
|
for (int p = connecthead; p >= 0; p = connectpoint2[p])
|
|
|
|
{
|
|
|
|
PLAYER *pPlayer = &gPlayer[p];
|
2019-10-19 19:11:39 +00:00
|
|
|
if (pPlayer->pXSprite->health == 0 || powerupCheck(pPlayer, kPwUpShadowCloak) > 0)
|
2019-09-19 22:42:45 +00:00
|
|
|
continue;
|
|
|
|
int x = pPlayer->pSprite->x;
|
|
|
|
int y = pPlayer->pSprite->y;
|
|
|
|
int z = pPlayer->pSprite->z;
|
|
|
|
int nSector = pPlayer->pSprite->sectnum;
|
|
|
|
int dx = x-pSprite->x;
|
|
|
|
int dy = y-pSprite->y;
|
|
|
|
int nDist = approxDist(dx, dy);
|
|
|
|
if (nDist > pDudeInfo->seeDist && nDist > pDudeInfo->hearDist)
|
|
|
|
continue;
|
|
|
|
if (!cansee(x, y, z, nSector, pSprite->x, pSprite->y, pSprite->z-((pDudeInfo->eyeHeight*pSprite->yrepeat)<<2), pSprite->sectnum))
|
|
|
|
continue;
|
|
|
|
int nDeltaAngle = ((getangle(dx,dy)+1024-pSprite->ang)&2047)-1024;
|
|
|
|
if (nDist < pDudeInfo->seeDist && klabs(nDeltaAngle) <= pDudeInfo->periphery)
|
|
|
|
{
|
|
|
|
pDudeExtraE->at0 = 0;
|
2019-10-21 19:46:41 +00:00
|
|
|
aiSetTarget(pXSprite, pPlayer->nSprite);
|
2019-09-19 22:42:45 +00:00
|
|
|
aiActivateDude(pSprite, pXSprite);
|
|
|
|
}
|
|
|
|
else if (nDist < pDudeInfo->hearDist)
|
|
|
|
{
|
|
|
|
pDudeExtraE->at0 = 0;
|
|
|
|
aiSetTarget(pXSprite, x, y, z);
|
|
|
|
aiActivateDude(pSprite, pXSprite);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
continue;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void sub_72850(spritetype *pSprite, XSPRITE *pXSprite)
|
|
|
|
{
|
2019-10-19 19:11:39 +00:00
|
|
|
///dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
|
|
|
|
if (!(pSprite->type >= kDudeBase && pSprite->type < kDudeMax)) {
|
|
|
|
consoleSysMsg("pSprite->type >= kDudeBase && pSprite->type < kDudeMax");
|
2019-09-19 22:42:45 +00:00
|
|
|
return;
|
2019-10-19 19:11:39 +00:00
|
|
|
}
|
2019-09-19 22:42:45 +00:00
|
|
|
DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase];
|
|
|
|
int dx = pXSprite->targetX-pSprite->x;
|
|
|
|
int dy = pXSprite->targetY-pSprite->y;
|
|
|
|
int nAngle = getangle(dx, dy);
|
|
|
|
int nDist = approxDist(dx, dy);
|
|
|
|
aiChooseDirection(pSprite, pXSprite, nAngle);
|
|
|
|
if (nDist < 512 && klabs(pSprite->ang - nAngle) < pDudeInfo->periphery)
|
|
|
|
aiNewState(pSprite, pXSprite, &tchernobogSearch);
|
|
|
|
aiThinkTarget(pSprite, pXSprite);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void sub_72934(spritetype *pSprite, XSPRITE *pXSprite)
|
|
|
|
{
|
|
|
|
if (pXSprite->target == -1)
|
|
|
|
{
|
|
|
|
aiNewState(pSprite, pXSprite, &tcherno13A9B8);
|
|
|
|
return;
|
|
|
|
}
|
2019-10-19 19:11:39 +00:00
|
|
|
///dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
|
|
|
|
if (!(pSprite->type >= kDudeBase && pSprite->type < kDudeMax)) {
|
|
|
|
consoleSysMsg("pSprite->type >= kDudeBase && pSprite->type < kDudeMax");
|
2019-09-19 22:42:45 +00:00
|
|
|
return;
|
2019-10-19 19:11:39 +00:00
|
|
|
}
|
2019-09-19 22:42:45 +00:00
|
|
|
DUDEINFO *pDudeInfo = &dudeInfo[pSprite->type - kDudeBase];
|
2019-10-19 19:11:39 +00:00
|
|
|
///dassert(pXSprite->target >= 0 && pXSprite->target < kMaxSprites);
|
|
|
|
if (!(pXSprite->target >= 0 && pXSprite->target < kMaxSprites)) {
|
|
|
|
consoleSysMsg("pXSprite->target >= 0 && pXSprite->target < kMaxSprites");
|
2019-09-19 22:42:45 +00:00
|
|
|
return;
|
2019-10-19 19:11:39 +00:00
|
|
|
}
|
2019-09-19 22:42:45 +00:00
|
|
|
spritetype *pTarget = &sprite[pXSprite->target];
|
|
|
|
XSPRITE *pXTarget = &xsprite[pTarget->extra];
|
|
|
|
int dx = pTarget->x-pSprite->x;
|
|
|
|
int dy = pTarget->y-pSprite->y;
|
|
|
|
aiChooseDirection(pSprite, pXSprite, getangle(dx, dy));
|
|
|
|
if (pXTarget->health == 0)
|
|
|
|
{
|
|
|
|
aiNewState(pSprite, pXSprite, &tchernobogSearch);
|
|
|
|
return;
|
|
|
|
}
|
2019-10-19 19:11:39 +00:00
|
|
|
if (IsPlayerSprite(pTarget) && powerupCheck(&gPlayer[pTarget->type-kDudePlayer1], kPwUpShadowCloak) > 0)
|
2019-09-19 22:42:45 +00:00
|
|
|
{
|
|
|
|
aiNewState(pSprite, pXSprite, &tchernobogSearch);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
int nDist = approxDist(dx, dy);
|
|
|
|
if (nDist <= pDudeInfo->seeDist)
|
|
|
|
{
|
|
|
|
int nDeltaAngle = ((getangle(dx,dy)+1024-pSprite->ang)&2047)-1024;
|
|
|
|
int height = (pDudeInfo->eyeHeight*pSprite->yrepeat)<<2;
|
|
|
|
if (cansee(pTarget->x, pTarget->y, pTarget->z, pTarget->sectnum, pSprite->x, pSprite->y, pSprite->z - height, pSprite->sectnum))
|
|
|
|
{
|
|
|
|
if (nDist < pDudeInfo->seeDist && klabs(nDeltaAngle) <= pDudeInfo->periphery)
|
|
|
|
{
|
|
|
|
aiSetTarget(pXSprite, pXSprite->target);
|
|
|
|
if (nDist < 0x1f00 && nDist > 0xd00 && klabs(nDeltaAngle) < 85)
|
|
|
|
aiNewState(pSprite, pXSprite, &tcherno13AA0C);
|
|
|
|
else if (nDist < 0xd00 && nDist > 0xb00 && klabs(nDeltaAngle) < 85)
|
|
|
|
aiNewState(pSprite, pXSprite, &tcherno13A9D4);
|
|
|
|
else if (nDist < 0xb00 && nDist > 0x500 && klabs(nDeltaAngle) < 85)
|
|
|
|
aiNewState(pSprite, pXSprite, &tcherno13A9F0);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
aiNewState(pSprite, pXSprite, &tcherno13A9B8);
|
|
|
|
pXSprite->target = -1;
|
|
|
|
}
|
2019-09-22 06:39:22 +00:00
|
|
|
|
|
|
|
END_BLD_NS
|