mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-25 11:10:47 +00:00
- aiChooseDirection and its subfunctions.
This commit is contained in:
parent
a79d362b40
commit
774a015e6b
23 changed files with 109 additions and 102 deletions
|
@ -96,11 +96,11 @@ void aiNewState(DBloodActor* actor, AISTATE *pAIState)
|
|||
{
|
||||
seqStartId += pAIState->seqId;
|
||||
if (getSequence(seqStartId))
|
||||
seqSpawn(seqStartId, 3, pSprite->extra, pAIState->funcId);
|
||||
seqSpawn(seqStartId, actor, pAIState->funcId);
|
||||
}
|
||||
|
||||
if (pAIState->enterFunc)
|
||||
pAIState->enterFunc(&bloodActors[pXSprite->reference]);
|
||||
pAIState->enterFunc(actor);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
@ -109,17 +109,18 @@ void aiNewState(DBloodActor* actor, AISTATE *pAIState)
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
bool isImmune(spritetype* pSprite, int dmgType, int minScale)
|
||||
static bool isImmune(DBloodActor* actor, int dmgType, int minScale)
|
||||
{
|
||||
|
||||
if (dmgType >= kDmgFall && dmgType < kDmgMax && pSprite->extra >= 0 && xsprite[pSprite->extra].locked != 1)
|
||||
if (dmgType >= kDmgFall && dmgType < kDmgMax && actor->hasX() && actor->x().locked != 1)
|
||||
{
|
||||
if (pSprite->type >= kThingBase && pSprite->type < kThingMax)
|
||||
return (thingInfo[pSprite->type - kThingBase].dmgControl[dmgType] <= minScale);
|
||||
else if (IsDudeSprite(pSprite))
|
||||
int type = actor->s().type;
|
||||
if (type >= kThingBase && type < kThingMax)
|
||||
return (thingInfo[type - kThingBase].dmgControl[dmgType] <= minScale);
|
||||
else if (actor->IsDudeActor())
|
||||
{
|
||||
if (IsPlayerSprite(pSprite)) return (gPlayer[pSprite->type - kDudePlayer1].godMode || gPlayer[pSprite->type - kDudePlayer1].damageControl[dmgType] <= minScale);
|
||||
else return (dudeInfo[pSprite->type - kDudeBase].damageVal[dmgType] <= minScale);
|
||||
if (actor->IsPlayerActor()) return (gPlayer[type - kDudePlayer1].godMode || gPlayer[type - kDudePlayer1].damageControl[dmgType] <= minScale);
|
||||
else return (dudeInfo[type - kDudeBase].damageVal[dmgType] <= minScale);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
@ -131,8 +132,9 @@ bool isImmune(spritetype* pSprite, int dmgType, int minScale)
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
bool CanMove(spritetype *pSprite, int a2, int nAngle, int nRange)
|
||||
bool CanMove(DBloodActor *actor, int a2, int nAngle, int nRange)
|
||||
{
|
||||
auto pSprite = &actor->s();
|
||||
int top, bottom;
|
||||
GetSpriteExtents(pSprite, &top, &bottom);
|
||||
int x = pSprite->x;
|
||||
|
@ -207,7 +209,7 @@ bool CanMove(spritetype *pSprite, int a2, int nAngle, int nRange)
|
|||
// It makes ignore danger if enemy immune to N damageType. As result Cerberus start acting like
|
||||
// in Blood 1.0 so it can move normally to player. It's up to you for adding rest of enemies here as
|
||||
// i don't think it will broke something in game.
|
||||
if (!cl_bloodvanillaenemies && !VanillaMode() && Crusher && isImmune(pSprite, pXSector->damageType, 16)) return true;
|
||||
if (!cl_bloodvanillaenemies && !VanillaMode() && Crusher && isImmune(actor, pXSector->damageType, 16)) return true;
|
||||
[[fallthrough]];
|
||||
case kDudeZombieButcher:
|
||||
case kDudeSpiderBrown:
|
||||
|
@ -250,8 +252,11 @@ bool CanMove(spritetype *pSprite, int a2, int nAngle, int nRange)
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void aiChooseDirection(spritetype *pSprite, XSPRITE *pXSprite, int a3)
|
||||
void aiChooseDirection(DBloodActor* actor, int a3)
|
||||
{
|
||||
auto pXSprite = &actor->x();
|
||||
auto pSprite = &actor->s();
|
||||
|
||||
int nSprite = pSprite->index;
|
||||
assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
|
||||
int vc = ((a3+1024-pSprite->ang)&2047)-1024;
|
||||
|
@ -264,17 +269,17 @@ void aiChooseDirection(spritetype *pSprite, XSPRITE *pXSprite, int a3)
|
|||
int v8 = 341;
|
||||
if (vc < 0)
|
||||
v8 = -341;
|
||||
if (CanMove(pSprite, pXSprite->target, pSprite->ang+vc, vsi))
|
||||
if (CanMove(actor, pXSprite->target, pSprite->ang+vc, vsi))
|
||||
pXSprite->goalAng = pSprite->ang+vc;
|
||||
else if (CanMove(pSprite, pXSprite->target, pSprite->ang+vc/2, vsi))
|
||||
else if (CanMove(actor, pXSprite->target, pSprite->ang+vc/2, vsi))
|
||||
pXSprite->goalAng = pSprite->ang+vc/2;
|
||||
else if (CanMove(pSprite, pXSprite->target, pSprite->ang-vc/2, vsi))
|
||||
else if (CanMove(actor, pXSprite->target, pSprite->ang-vc/2, vsi))
|
||||
pXSprite->goalAng = pSprite->ang-vc/2;
|
||||
else if (CanMove(pSprite, pXSprite->target, pSprite->ang+v8, vsi))
|
||||
else if (CanMove(actor, pXSprite->target, pSprite->ang+v8, vsi))
|
||||
pXSprite->goalAng = pSprite->ang+v8;
|
||||
else if (CanMove(pSprite, pXSprite->target, pSprite->ang, vsi))
|
||||
else if (CanMove(actor, pXSprite->target, pSprite->ang, vsi))
|
||||
pXSprite->goalAng = pSprite->ang;
|
||||
else if (CanMove(pSprite, pXSprite->target, pSprite->ang-v8, vsi))
|
||||
else if (CanMove(actor, pXSprite->target, pSprite->ang-v8, vsi))
|
||||
pXSprite->goalAng = pSprite->ang-v8;
|
||||
//else if (pSprite->flags&2)
|
||||
//pXSprite->goalAng = pSprite->ang+341;
|
||||
|
@ -284,10 +289,10 @@ void aiChooseDirection(spritetype *pSprite, XSPRITE *pXSprite, int a3)
|
|||
pXSprite->dodgeDir = 1;
|
||||
else
|
||||
pXSprite->dodgeDir = -1;
|
||||
if (!CanMove(pSprite, pXSprite->target, pSprite->ang+pXSprite->dodgeDir*512, 512))
|
||||
if (!CanMove(actor, pXSprite->target, pSprite->ang+pXSprite->dodgeDir*512, 512))
|
||||
{
|
||||
pXSprite->dodgeDir = -pXSprite->dodgeDir;
|
||||
if (!CanMove(pSprite, pXSprite->target, pSprite->ang+pXSprite->dodgeDir*512, 512))
|
||||
if (!CanMove(actor, pXSprite->target, pSprite->ang+pXSprite->dodgeDir*512, 512))
|
||||
pXSprite->dodgeDir = 0;
|
||||
}
|
||||
}
|
||||
|
@ -376,7 +381,7 @@ void aiActivateDude(DBloodActor* actor)
|
|||
assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
|
||||
if (!pXSprite->state)
|
||||
{
|
||||
aiChooseDirection(pSprite, pXSprite, getangle(pXSprite->targetX-pSprite->x, pXSprite->targetY-pSprite->y));
|
||||
aiChooseDirection(actor, getangle(pXSprite->targetX-pSprite->x, pXSprite->targetY-pSprite->y));
|
||||
pXSprite->state = 1;
|
||||
}
|
||||
switch (pSprite->type)
|
||||
|
|
|
@ -91,7 +91,7 @@ extern const int dword_138BB0[5];
|
|||
bool dudeIsPlayingSeq(DBloodActor* pSprite, int nSeq);
|
||||
void aiPlay3DSound(DBloodActor* pSprite, int a2, AI_SFX_PRIORITY a3, int a4);
|
||||
void aiNewState(DBloodActor* actor, AISTATE *pAIState);
|
||||
void aiChooseDirection(spritetype *pSprite, XSPRITE *pXSprite, int a3);
|
||||
void aiChooseDirection(DBloodActor* actor, int a3);
|
||||
void aiMoveForward(DBloodActor*pXSprite);
|
||||
void aiMoveTurn(DBloodActor*pXSprite);
|
||||
void aiMoveDodge(DBloodActor *actor);
|
||||
|
@ -104,7 +104,7 @@ void aiLookForTarget(spritetype *pSprite, XSPRITE *pXSprite);
|
|||
void aiProcessDudes(void);
|
||||
void aiInit(void);
|
||||
void aiInitSprite(spritetype *pSprite);
|
||||
bool CanMove(spritetype* pSprite, int a2, int nAngle, int nRange);
|
||||
bool CanMove(DBloodActor* pSprite, int a2, int nAngle, int nRange);
|
||||
|
||||
bool dudeIsPlayingSeq(spritetype* pSprite, int nSeq); // deprecated
|
||||
void aiPlay3DSound(spritetype* pSprite, int a2, AI_SFX_PRIORITY a3, int a4);
|
||||
|
|
|
@ -136,7 +136,7 @@ static void batThinkSearch(DBloodActor* actor)
|
|||
{
|
||||
auto pXSprite = &actor->x();
|
||||
auto pSprite = &actor->s();
|
||||
aiChooseDirection(pSprite, pXSprite, pXSprite->goalAng);
|
||||
aiChooseDirection(actor, pXSprite->goalAng);
|
||||
batThinkTarget(actor);
|
||||
}
|
||||
|
||||
|
@ -150,7 +150,7 @@ static void batThinkGoto(DBloodActor* actor)
|
|||
int dy = pXSprite->targetY-pSprite->y;
|
||||
int nAngle = getangle(dx, dy);
|
||||
int nDist = approxDist(dx, dy);
|
||||
aiChooseDirection(pSprite, pXSprite, nAngle);
|
||||
aiChooseDirection(actor, nAngle);
|
||||
if (nDist < 512 && abs(pSprite->ang - nAngle) < pDudeInfo->periphery)
|
||||
aiNewState(actor, &batSearch);
|
||||
batThinkTarget(actor);
|
||||
|
@ -172,7 +172,7 @@ static void batThinkPonder(DBloodActor* actor)
|
|||
XSPRITE *pXTarget = &xsprite[pTarget->extra];
|
||||
int dx = pTarget->x-pSprite->x;
|
||||
int dy = pTarget->y-pSprite->y;
|
||||
aiChooseDirection(pSprite, pXSprite, getangle(dx, dy));
|
||||
aiChooseDirection(actor, getangle(dx, dy));
|
||||
if (pXTarget->health == 0)
|
||||
{
|
||||
aiNewState(actor, &batSearch);
|
||||
|
@ -280,7 +280,7 @@ static void batThinkChase(DBloodActor* actor)
|
|||
XSPRITE *pXTarget = &xsprite[pTarget->extra];
|
||||
int dx = pTarget->x-pSprite->x;
|
||||
int dy = pTarget->y-pSprite->y;
|
||||
aiChooseDirection(pSprite, pXSprite, getangle(dx, dy));
|
||||
aiChooseDirection(actor, getangle(dx, dy));
|
||||
if (pXTarget->health == 0)
|
||||
{
|
||||
aiNewState(actor, &batSearch);
|
||||
|
|
|
@ -187,7 +187,7 @@ static void beastThinkSearch(DBloodActor* actor)
|
|||
{
|
||||
auto pXSprite = &actor->x();
|
||||
auto pSprite = &actor->s();
|
||||
aiChooseDirection(pSprite, pXSprite, pXSprite->goalAng);
|
||||
aiChooseDirection(actor,pXSprite->goalAng);
|
||||
aiThinkTarget(actor);
|
||||
}
|
||||
|
||||
|
@ -207,7 +207,7 @@ static void beastThinkGoto(DBloodActor* actor)
|
|||
int dy = pXSprite->targetY-pSprite->y;
|
||||
int nAngle = getangle(dx, dy);
|
||||
int nDist = approxDist(dx, dy);
|
||||
aiChooseDirection(pSprite, pXSprite, nAngle);
|
||||
aiChooseDirection(actor,nAngle);
|
||||
if (nDist < 512 && abs(pSprite->ang - nAngle) < pDudeInfo->periphery)
|
||||
{
|
||||
if (pXSector && pXSector->Underwater)
|
||||
|
@ -243,7 +243,7 @@ static void beastThinkChase(DBloodActor* actor)
|
|||
XSPRITE *pXTarget = &xsprite[pTarget->extra];
|
||||
int dx = pTarget->x-pSprite->x;
|
||||
int dy = pTarget->y-pSprite->y;
|
||||
aiChooseDirection(pSprite, pXSprite, getangle(dx, dy));
|
||||
aiChooseDirection(actor,getangle(dx, dy));
|
||||
if (pXTarget->health == 0)
|
||||
{
|
||||
XSECTOR *pXSector;
|
||||
|
@ -391,7 +391,7 @@ static void beastThinkSwimGoto(DBloodActor* actor)
|
|||
int dy = pXSprite->targetY-pSprite->y;
|
||||
int nAngle = getangle(dx, dy);
|
||||
int nDist = approxDist(dx, dy);
|
||||
aiChooseDirection(pSprite, pXSprite, nAngle);
|
||||
aiChooseDirection(actor,nAngle);
|
||||
if (nDist < 512 && abs(pSprite->ang - nAngle) < pDudeInfo->periphery)
|
||||
aiNewState(actor, &beastSwimSearch);
|
||||
aiThinkTarget(actor);
|
||||
|
@ -413,7 +413,7 @@ static void beastThinkSwimChase(DBloodActor* actor)
|
|||
XSPRITE *pXTarget = &xsprite[pTarget->extra];
|
||||
int dx = pTarget->x-pSprite->x;
|
||||
int dy = pTarget->y-pSprite->y;
|
||||
aiChooseDirection(pSprite, pXSprite, getangle(dx, dy));
|
||||
aiChooseDirection(actor,getangle(dx, dy));
|
||||
if (pXTarget->health == 0)
|
||||
{
|
||||
aiNewState(actor, &beastSwimSearch);
|
||||
|
|
|
@ -149,7 +149,7 @@ static void eelThinkSearch(DBloodActor* actor)
|
|||
{
|
||||
auto pXSprite = &actor->x();
|
||||
auto pSprite = &actor->s();
|
||||
aiChooseDirection(pSprite, pXSprite, pXSprite->goalAng);
|
||||
aiChooseDirection(actor,pXSprite->goalAng);
|
||||
eelThinkTarget(actor);
|
||||
}
|
||||
|
||||
|
@ -163,7 +163,7 @@ static void eelThinkGoto(DBloodActor* actor)
|
|||
int dy = pXSprite->targetY-pSprite->y;
|
||||
int nAngle = getangle(dx, dy);
|
||||
int nDist = approxDist(dx, dy);
|
||||
aiChooseDirection(pSprite, pXSprite, nAngle);
|
||||
aiChooseDirection(actor,nAngle);
|
||||
if (nDist < 512 && abs(pSprite->ang - nAngle) < pDudeInfo->periphery)
|
||||
aiNewState(actor, &eelSearch);
|
||||
eelThinkTarget(actor);
|
||||
|
@ -185,7 +185,7 @@ static void eelThinkPonder(DBloodActor* actor)
|
|||
XSPRITE *pXTarget = &xsprite[pTarget->extra];
|
||||
int dx = pTarget->x-pSprite->x;
|
||||
int dy = pTarget->y-pSprite->y;
|
||||
aiChooseDirection(pSprite, pXSprite, getangle(dx, dy));
|
||||
aiChooseDirection(actor,getangle(dx, dy));
|
||||
if (pXTarget->health == 0)
|
||||
{
|
||||
aiNewState(actor, &eelSearch);
|
||||
|
@ -293,7 +293,7 @@ static void eelThinkChase(DBloodActor* actor)
|
|||
XSPRITE *pXTarget = &xsprite[pTarget->extra];
|
||||
int dx = pTarget->x-pSprite->x;
|
||||
int dy = pTarget->y-pSprite->y;
|
||||
aiChooseDirection(pSprite, pXSprite, getangle(dx, dy));
|
||||
aiChooseDirection(actor,getangle(dx, dy));
|
||||
if (pXTarget->health == 0)
|
||||
{
|
||||
aiNewState(actor, &eelSearch);
|
||||
|
|
|
@ -79,7 +79,7 @@ static void burnThinkSearch(DBloodActor* actor)
|
|||
{
|
||||
auto pXSprite = &actor->x();
|
||||
auto pSprite = &actor->s();
|
||||
aiChooseDirection(pSprite, pXSprite, pXSprite->goalAng);
|
||||
aiChooseDirection(actor,pXSprite->goalAng);
|
||||
aiThinkTarget(actor);
|
||||
}
|
||||
|
||||
|
@ -93,7 +93,7 @@ static void burnThinkGoto(DBloodActor* actor)
|
|||
int dy = pXSprite->targetY-pSprite->y;
|
||||
int nAngle = getangle(dx, dy);
|
||||
int nDist = approxDist(dx, dy);
|
||||
aiChooseDirection(pSprite, pXSprite, nAngle);
|
||||
aiChooseDirection(actor,nAngle);
|
||||
if (nDist < 512 && abs(pSprite->ang - nAngle) < pDudeInfo->periphery)
|
||||
{
|
||||
switch (pSprite->type)
|
||||
|
@ -167,7 +167,7 @@ static void burnThinkChase(DBloodActor* actor)
|
|||
XSPRITE *pXTarget = &xsprite[pTarget->extra];
|
||||
int dx = pTarget->x-pSprite->x;
|
||||
int dy = pTarget->y-pSprite->y;
|
||||
aiChooseDirection(pSprite, pXSprite, getangle(dx, dy));
|
||||
aiChooseDirection(actor,getangle(dx, dy));
|
||||
if (pXTarget->health == 0)
|
||||
{
|
||||
switch (pSprite->type)
|
||||
|
|
|
@ -86,7 +86,7 @@ static void calebThinkSearch(DBloodActor* actor)
|
|||
{
|
||||
auto pXSprite = &actor->x();
|
||||
auto pSprite = &actor->s();
|
||||
aiChooseDirection(pSprite, pXSprite, pXSprite->goalAng);
|
||||
aiChooseDirection(actor,pXSprite->goalAng);
|
||||
aiThinkTarget(actor);
|
||||
}
|
||||
|
||||
|
@ -106,7 +106,7 @@ static void calebThinkGoto(DBloodActor* actor)
|
|||
int dy = pXSprite->targetY-pSprite->y;
|
||||
int nAngle = getangle(dx, dy);
|
||||
int nDist = approxDist(dx, dy);
|
||||
aiChooseDirection(pSprite, pXSprite, nAngle);
|
||||
aiChooseDirection(actor,nAngle);
|
||||
if (nDist < 512 && abs(pSprite->ang - nAngle) < pDudeInfo->periphery)
|
||||
{
|
||||
if (pXSector && pXSector->Underwater)
|
||||
|
@ -142,7 +142,7 @@ static void calebThinkChase(DBloodActor* actor)
|
|||
XSPRITE *pXTarget = &xsprite[pTarget->extra];
|
||||
int dx = pTarget->x-pSprite->x;
|
||||
int dy = pTarget->y-pSprite->y;
|
||||
aiChooseDirection(pSprite, pXSprite, getangle(dx, dy));
|
||||
aiChooseDirection(actor,getangle(dx, dy));
|
||||
if (pXTarget->health == 0)
|
||||
{
|
||||
XSECTOR *pXSector;
|
||||
|
@ -256,7 +256,7 @@ static void calebThinkSwimGoto(DBloodActor* actor)
|
|||
int dy = pXSprite->targetY-pSprite->y;
|
||||
int nAngle = getangle(dx, dy);
|
||||
int nDist = approxDist(dx, dy);
|
||||
aiChooseDirection(pSprite, pXSprite, nAngle);
|
||||
aiChooseDirection(actor,nAngle);
|
||||
if (nDist < 512 && abs(pSprite->ang - nAngle) < pDudeInfo->periphery)
|
||||
aiNewState(actor, &tinycalebSwimSearch);
|
||||
aiThinkTarget(actor);
|
||||
|
@ -278,7 +278,7 @@ static void calebThinkSwimChase(DBloodActor* actor)
|
|||
XSPRITE *pXTarget = &xsprite[pTarget->extra];
|
||||
int dx = pTarget->x-pSprite->x;
|
||||
int dy = pTarget->y-pSprite->y;
|
||||
aiChooseDirection(pSprite, pXSprite, getangle(dx, dy));
|
||||
aiChooseDirection(actor,getangle(dx, dy));
|
||||
if (pXTarget->health == 0)
|
||||
{
|
||||
aiNewState(actor, &tinycalebSwimSearch);
|
||||
|
|
|
@ -252,7 +252,7 @@ static void cerberusThinkSearch(DBloodActor* actor)
|
|||
{
|
||||
auto pXSprite = &actor->x();
|
||||
auto pSprite = &actor->s();
|
||||
aiChooseDirection(pSprite, pXSprite, pXSprite->goalAng);
|
||||
aiChooseDirection(actor,pXSprite->goalAng);
|
||||
aiThinkTarget(actor);
|
||||
}
|
||||
|
||||
|
@ -332,7 +332,7 @@ static void cerberusThinkGoto(DBloodActor* actor)
|
|||
int dy = pXSprite->targetY-pSprite->y;
|
||||
int nAngle = getangle(dx, dy);
|
||||
int nDist = approxDist(dx, dy);
|
||||
aiChooseDirection(pSprite, pXSprite, nAngle);
|
||||
aiChooseDirection(actor,nAngle);
|
||||
if (nDist < 512 && abs(pSprite->ang - nAngle) < pDudeInfo->periphery)
|
||||
{
|
||||
switch (pSprite->type) {
|
||||
|
@ -380,7 +380,7 @@ static void cerberusThinkChase(DBloodActor* actor)
|
|||
XSPRITE *pXTarget = &xsprite[pTarget->extra];
|
||||
int dx = pTarget->x-pSprite->x;
|
||||
int dy = pTarget->y-pSprite->y;
|
||||
aiChooseDirection(pSprite, pXSprite, getangle(dx, dy));
|
||||
aiChooseDirection(actor,getangle(dx, dy));
|
||||
|
||||
if (pXTarget->health == 0) {
|
||||
switch (pSprite->type) {
|
||||
|
|
|
@ -201,7 +201,7 @@ static void cultThinkSearch(DBloodActor* actor)
|
|||
{
|
||||
auto pXSprite = &actor->x();
|
||||
auto pSprite = &actor->s();
|
||||
aiChooseDirection(pSprite, pXSprite, pXSprite->goalAng);
|
||||
aiChooseDirection(actor,pXSprite->goalAng);
|
||||
aiLookForTarget(pSprite, pXSprite);
|
||||
}
|
||||
|
||||
|
@ -215,7 +215,7 @@ static void cultThinkGoto(DBloodActor* actor)
|
|||
int dy = pXSprite->targetY-pSprite->y;
|
||||
int nAngle = getangle(dx, dy);
|
||||
int nDist = approxDist(dx, dy);
|
||||
aiChooseDirection(pSprite, pXSprite, nAngle);
|
||||
aiChooseDirection(actor,nAngle);
|
||||
if (nDist < 5120 && abs(pSprite->ang - nAngle) < pDudeInfo->periphery)
|
||||
{
|
||||
switch (pXSprite->medium)
|
||||
|
@ -257,7 +257,7 @@ static void cultThinkChase(DBloodActor* actor)
|
|||
XSPRITE *pXTarget = &xsprite[pTarget->extra];
|
||||
int dx = pTarget->x-pSprite->x;
|
||||
int dy = pTarget->y-pSprite->y;
|
||||
aiChooseDirection(pSprite, pXSprite, getangle(dx, dy));
|
||||
aiChooseDirection(actor,getangle(dx, dy));
|
||||
if (pXTarget->health == 0)
|
||||
{
|
||||
switch (pXSprite->medium)
|
||||
|
|
|
@ -267,7 +267,7 @@ static void gargThinkSearch(DBloodActor* actor)
|
|||
{
|
||||
auto pXSprite = &actor->x();
|
||||
auto pSprite = &actor->s();
|
||||
aiChooseDirection(pSprite, pXSprite, pXSprite->goalAng);
|
||||
aiChooseDirection(actor,pXSprite->goalAng);
|
||||
aiLookForTarget(pSprite, pXSprite);
|
||||
}
|
||||
|
||||
|
@ -285,7 +285,7 @@ static void gargThinkGoto(DBloodActor* actor)
|
|||
int dy = pXSprite->targetY-pSprite->y;
|
||||
int nAngle = getangle(dx, dy);
|
||||
int nDist = approxDist(dx, dy);
|
||||
aiChooseDirection(pSprite, pXSprite, nAngle);
|
||||
aiChooseDirection(actor,nAngle);
|
||||
if (nDist < 512 && abs(pSprite->ang - nAngle) < pDudeInfo->periphery)
|
||||
aiNewState(actor, &gargoyleFSearch);
|
||||
aiThinkTarget(actor);
|
||||
|
@ -375,7 +375,7 @@ static void gargThinkChase(DBloodActor* actor)
|
|||
XSPRITE *pXTarget = &xsprite[pTarget->extra];
|
||||
int dx = pTarget->x-pSprite->x;
|
||||
int dy = pTarget->y-pSprite->y;
|
||||
aiChooseDirection(pSprite, pXSprite, getangle(dx, dy));
|
||||
aiChooseDirection(actor,getangle(dx, dy));
|
||||
if (pXTarget->health == 0)
|
||||
{
|
||||
aiNewState(actor, &gargoyleFSearch);
|
||||
|
|
|
@ -243,7 +243,7 @@ static void ghostThinkSearch(DBloodActor* actor)
|
|||
{
|
||||
auto pXSprite = &actor->x();
|
||||
auto pSprite = &actor->s();
|
||||
aiChooseDirection(pSprite, pXSprite, pXSprite->goalAng);
|
||||
aiChooseDirection(actor,pXSprite->goalAng);
|
||||
aiThinkTarget(actor);
|
||||
}
|
||||
|
||||
|
@ -261,7 +261,7 @@ static void ghostThinkGoto(DBloodActor* actor)
|
|||
int dy = pXSprite->targetY-pSprite->y;
|
||||
int nAngle = getangle(dx, dy);
|
||||
int nDist = approxDist(dx, dy);
|
||||
aiChooseDirection(pSprite, pXSprite, nAngle);
|
||||
aiChooseDirection(actor,nAngle);
|
||||
if (nDist < 512 && abs(pSprite->ang - nAngle) < pDudeInfo->periphery)
|
||||
aiNewState(actor, &ghostSearch);
|
||||
aiThinkTarget(actor);
|
||||
|
@ -353,7 +353,7 @@ static void ghostThinkChase(DBloodActor* actor)
|
|||
XSPRITE *pXTarget = &xsprite[pTarget->extra];
|
||||
int dx = pTarget->x-pSprite->x;
|
||||
int dy = pTarget->y-pSprite->y;
|
||||
aiChooseDirection(pSprite, pXSprite, getangle(dx, dy));
|
||||
aiChooseDirection(actor,getangle(dx, dy));
|
||||
if (pXTarget->health == 0)
|
||||
{
|
||||
aiNewState(actor, &ghostSearch);
|
||||
|
|
|
@ -77,7 +77,7 @@ static void gillThinkSearch(DBloodActor* actor)
|
|||
{
|
||||
auto pXSprite = &actor->x();
|
||||
auto pSprite = &actor->s();
|
||||
aiChooseDirection(pSprite, pXSprite, pXSprite->goalAng);
|
||||
aiChooseDirection(actor,pXSprite->goalAng);
|
||||
aiThinkTarget(actor);
|
||||
}
|
||||
|
||||
|
@ -97,7 +97,7 @@ static void gillThinkGoto(DBloodActor* actor)
|
|||
int dy = pXSprite->targetY-pSprite->y;
|
||||
int nAngle = getangle(dx, dy);
|
||||
int nDist = approxDist(dx, dy);
|
||||
aiChooseDirection(pSprite, pXSprite, nAngle);
|
||||
aiChooseDirection(actor,nAngle);
|
||||
if (nDist < 512 && abs(pSprite->ang - nAngle) < pDudeInfo->periphery)
|
||||
{
|
||||
if (pXSector && pXSector->Underwater)
|
||||
|
@ -133,7 +133,7 @@ static void gillThinkChase(DBloodActor* actor)
|
|||
XSPRITE *pXTarget = &xsprite[pTarget->extra];
|
||||
int dx = pTarget->x-pSprite->x;
|
||||
int dy = pTarget->y-pSprite->y;
|
||||
aiChooseDirection(pSprite, pXSprite, getangle(dx, dy));
|
||||
aiChooseDirection(actor,getangle(dx, dy));
|
||||
if (pXTarget->health == 0)
|
||||
{
|
||||
XSECTOR *pXSector;
|
||||
|
@ -243,7 +243,7 @@ static void gillThinkSwimGoto(DBloodActor* actor)
|
|||
int dy = pXSprite->targetY-pSprite->y;
|
||||
int nAngle = getangle(dx, dy);
|
||||
int nDist = approxDist(dx, dy);
|
||||
aiChooseDirection(pSprite, pXSprite, nAngle);
|
||||
aiChooseDirection(actor,nAngle);
|
||||
if (nDist < 512 && abs(pSprite->ang - nAngle) < pDudeInfo->periphery)
|
||||
aiNewState(actor, &gillBeastSwimSearch);
|
||||
aiThinkTarget(actor);
|
||||
|
@ -265,7 +265,7 @@ static void gillThinkSwimChase(DBloodActor* actor)
|
|||
XSPRITE *pXTarget = &xsprite[pTarget->extra];
|
||||
int dx = pTarget->x-pSprite->x;
|
||||
int dy = pTarget->y-pSprite->y;
|
||||
aiChooseDirection(pSprite, pXSprite, getangle(dx, dy));
|
||||
aiChooseDirection(actor,getangle(dx, dy));
|
||||
if (pXTarget->health == 0)
|
||||
{
|
||||
aiNewState(actor, &gillBeastSwimSearch);
|
||||
|
|
|
@ -62,7 +62,7 @@ static void handThinkSearch(DBloodActor* actor)
|
|||
{
|
||||
auto pXSprite = &actor->x();
|
||||
auto pSprite = &actor->s();
|
||||
aiChooseDirection(pSprite, pXSprite, pXSprite->goalAng);
|
||||
aiChooseDirection(actor,pXSprite->goalAng);
|
||||
aiThinkTarget(actor);
|
||||
}
|
||||
|
||||
|
@ -76,7 +76,7 @@ static void handThinkGoto(DBloodActor* actor)
|
|||
int dy = pXSprite->targetY-pSprite->y;
|
||||
int nAngle = getangle(dx, dy);
|
||||
int nDist = approxDist(dx, dy);
|
||||
aiChooseDirection(pSprite, pXSprite, nAngle);
|
||||
aiChooseDirection(actor,nAngle);
|
||||
if (nDist < 512 && abs(pSprite->ang - nAngle) < pDudeInfo->periphery)
|
||||
aiNewState(actor, &handSearch);
|
||||
aiThinkTarget(actor);
|
||||
|
@ -98,7 +98,7 @@ static void handThinkChase(DBloodActor* actor)
|
|||
XSPRITE *pXTarget = &xsprite[pTarget->extra];
|
||||
int dx = pTarget->x-pSprite->x;
|
||||
int dy = pTarget->y-pSprite->y;
|
||||
aiChooseDirection(pSprite, pXSprite, getangle(dx, dy));
|
||||
aiChooseDirection(actor,getangle(dx, dy));
|
||||
if (pXTarget->health == 0)
|
||||
{
|
||||
aiNewState(actor, &handSearch);
|
||||
|
|
|
@ -80,7 +80,7 @@ static void houndThinkSearch(DBloodActor* actor)
|
|||
{
|
||||
auto pXSprite = &actor->x();
|
||||
auto pSprite = &actor->s();
|
||||
aiChooseDirection(pSprite, pXSprite, pXSprite->goalAng);
|
||||
aiChooseDirection(actor,pXSprite->goalAng);
|
||||
aiThinkTarget(actor);
|
||||
}
|
||||
|
||||
|
@ -99,7 +99,7 @@ static void houndThinkGoto(DBloodActor* actor)
|
|||
int dy = pXSprite->targetY-pSprite->y;
|
||||
int nAngle = getangle(dx, dy);
|
||||
int nDist = approxDist(dx, dy);
|
||||
aiChooseDirection(pSprite, pXSprite, nAngle);
|
||||
aiChooseDirection(actor,nAngle);
|
||||
if (nDist < 512 && abs(pSprite->ang - nAngle) < pDudeInfo->periphery)
|
||||
aiNewState(actor, &houndSearch);
|
||||
aiThinkTarget(actor);
|
||||
|
@ -129,7 +129,7 @@ static void houndThinkChase(DBloodActor* actor)
|
|||
XSPRITE *pXTarget = &xsprite[pTarget->extra];
|
||||
int dx = pTarget->x-pSprite->x;
|
||||
int dy = pTarget->y-pSprite->y;
|
||||
aiChooseDirection(pSprite, pXSprite, getangle(dx, dy));
|
||||
aiChooseDirection(actor,getangle(dx, dy));
|
||||
if (pXTarget->health == 0)
|
||||
{
|
||||
aiNewState(actor, &houndSearch);
|
||||
|
|
|
@ -45,7 +45,7 @@ static void innocThinkSearch(DBloodActor* actor)
|
|||
{
|
||||
auto pXSprite = &actor->x();
|
||||
auto pSprite = &actor->s();
|
||||
aiChooseDirection(pSprite, pXSprite, pXSprite->goalAng);
|
||||
aiChooseDirection(actor,pXSprite->goalAng);
|
||||
aiThinkTarget(actor);
|
||||
}
|
||||
|
||||
|
@ -59,7 +59,7 @@ static void innocThinkGoto(DBloodActor* actor)
|
|||
int dy = pXSprite->targetY-pSprite->y;
|
||||
int nAngle = getangle(dx, dy);
|
||||
int nDist = approxDist(dx, dy);
|
||||
aiChooseDirection(pSprite, pXSprite, nAngle);
|
||||
aiChooseDirection(actor,nAngle);
|
||||
if (nDist < 512 && abs(pSprite->ang - nAngle) < pDudeInfo->periphery)
|
||||
aiNewState(actor, &innocentSearch);
|
||||
aiThinkTarget(actor);
|
||||
|
@ -81,7 +81,7 @@ static void innocThinkChase(DBloodActor* actor)
|
|||
XSPRITE *pXTarget = &xsprite[pTarget->extra];
|
||||
int dx = pTarget->x-pSprite->x;
|
||||
int dy = pTarget->y-pSprite->y;
|
||||
aiChooseDirection(pSprite, pXSprite, getangle(dx, dy));
|
||||
aiChooseDirection(actor,getangle(dx, dy));
|
||||
if (pXTarget->health == 0)
|
||||
{
|
||||
aiNewState(actor, &innocentSearch);
|
||||
|
|
|
@ -143,7 +143,7 @@ static void aiPodSearch(DBloodActor* actor)
|
|||
{
|
||||
auto pXSprite = &actor->x();
|
||||
auto pSprite = &actor->s();
|
||||
aiChooseDirection(pSprite, pXSprite, pXSprite->goalAng);
|
||||
aiChooseDirection(actor,pXSprite->goalAng);
|
||||
aiThinkTarget(actor);
|
||||
}
|
||||
|
||||
|
@ -162,7 +162,7 @@ static void aiPodMove(DBloodActor* actor)
|
|||
int dy = pXSprite->targetY-pSprite->y;
|
||||
int nAngle = getangle(dx, dy);
|
||||
int nDist = approxDist(dx, dy);
|
||||
aiChooseDirection(pSprite, pXSprite, nAngle);
|
||||
aiChooseDirection(actor,nAngle);
|
||||
if (nDist < 512 && abs(pSprite->ang - nAngle) < pDudeInfo->periphery) {
|
||||
switch (pSprite->type) {
|
||||
case kDudePodGreen:
|
||||
|
@ -210,7 +210,7 @@ static void aiPodChase(DBloodActor* actor)
|
|||
XSPRITE *pXTarget = &xsprite[pTarget->extra];
|
||||
int dx = pTarget->x-pSprite->x;
|
||||
int dy = pTarget->y-pSprite->y;
|
||||
aiChooseDirection(pSprite, pXSprite, getangle(dx, dy));
|
||||
aiChooseDirection(actor,getangle(dx, dy));
|
||||
if (pXTarget->health == 0) {
|
||||
|
||||
switch (pSprite->type) {
|
||||
|
|
|
@ -59,7 +59,7 @@ static void ratThinkSearch(DBloodActor* actor)
|
|||
{
|
||||
auto pXSprite = &actor->x();
|
||||
auto pSprite = &actor->s();
|
||||
aiChooseDirection(pSprite, pXSprite, pXSprite->goalAng);
|
||||
aiChooseDirection(actor,pXSprite->goalAng);
|
||||
aiThinkTarget(actor);
|
||||
}
|
||||
|
||||
|
@ -73,7 +73,7 @@ static void ratThinkGoto(DBloodActor* actor)
|
|||
int dy = pXSprite->targetY-pSprite->y;
|
||||
int nAngle = getangle(dx, dy);
|
||||
int nDist = approxDist(dx, dy);
|
||||
aiChooseDirection(pSprite, pXSprite, nAngle);
|
||||
aiChooseDirection(actor,nAngle);
|
||||
if (nDist < 512 && abs(pSprite->ang - nAngle) < pDudeInfo->periphery)
|
||||
aiNewState(actor, &ratSearch);
|
||||
aiThinkTarget(actor);
|
||||
|
@ -95,7 +95,7 @@ static void ratThinkChase(DBloodActor* actor)
|
|||
XSPRITE *pXTarget = &xsprite[pTarget->extra];
|
||||
int dx = pTarget->x-pSprite->x;
|
||||
int dy = pTarget->y-pSprite->y;
|
||||
aiChooseDirection(pSprite, pXSprite, getangle(dx, dy));
|
||||
aiChooseDirection(actor,getangle(dx, dy));
|
||||
if (pXTarget->health == 0)
|
||||
{
|
||||
aiNewState(actor, &ratSearch);
|
||||
|
|
|
@ -176,7 +176,7 @@ static void spidThinkSearch(DBloodActor* actor)
|
|||
{
|
||||
auto pXSprite = &actor->x();
|
||||
auto pSprite = &actor->s();
|
||||
aiChooseDirection(pSprite, pXSprite, pXSprite->goalAng);
|
||||
aiChooseDirection(actor,pXSprite->goalAng);
|
||||
aiThinkTarget(actor);
|
||||
}
|
||||
|
||||
|
@ -190,7 +190,7 @@ static void spidThinkGoto(DBloodActor* actor)
|
|||
int dy = pXSprite->targetY-pSprite->y;
|
||||
int nAngle = getangle(dx, dy);
|
||||
int nDist = approxDist(dx, dy);
|
||||
aiChooseDirection(pSprite, pXSprite, nAngle);
|
||||
aiChooseDirection(actor,nAngle);
|
||||
if (nDist < 512 && abs(pSprite->ang - nAngle) < pDudeInfo->periphery)
|
||||
aiNewState(actor, &spidSearch);
|
||||
aiThinkTarget(actor);
|
||||
|
@ -212,7 +212,7 @@ static void spidThinkChase(DBloodActor* actor)
|
|||
XSPRITE *pXTarget = &xsprite[pTarget->extra];
|
||||
int dx = pTarget->x-pSprite->x;
|
||||
int dy = pTarget->y-pSprite->y;
|
||||
aiChooseDirection(pSprite, pXSprite, getangle(dx, dy));
|
||||
aiChooseDirection(actor,getangle(dx, dy));
|
||||
if (pXTarget->health == 0)
|
||||
{
|
||||
aiNewState(actor, &spidSearch);
|
||||
|
|
|
@ -219,7 +219,7 @@ static void sub_72580(DBloodActor* actor)
|
|||
{
|
||||
auto pXSprite = &actor->x();
|
||||
auto pSprite = &actor->s();
|
||||
aiChooseDirection(pSprite, pXSprite, pXSprite->goalAng);
|
||||
aiChooseDirection(actor,pXSprite->goalAng);
|
||||
aiThinkTarget(actor);
|
||||
}
|
||||
|
||||
|
@ -296,7 +296,7 @@ static void sub_72850(DBloodActor* actor)
|
|||
int dy = pXSprite->targetY-pSprite->y;
|
||||
int nAngle = getangle(dx, dy);
|
||||
int nDist = approxDist(dx, dy);
|
||||
aiChooseDirection(pSprite, pXSprite, nAngle);
|
||||
aiChooseDirection(actor,nAngle);
|
||||
if (nDist < 512 && abs(pSprite->ang - nAngle) < pDudeInfo->periphery)
|
||||
aiNewState(actor, &tchernobogSearch);
|
||||
aiThinkTarget(actor);
|
||||
|
@ -326,7 +326,7 @@ static void sub_72934(DBloodActor* actor)
|
|||
XSPRITE *pXTarget = &xsprite[pTarget->extra];
|
||||
int dx = pTarget->x-pSprite->x;
|
||||
int dy = pTarget->y-pSprite->y;
|
||||
aiChooseDirection(pSprite, pXSprite, getangle(dx, dy));
|
||||
aiChooseDirection(actor,getangle(dx, dy));
|
||||
if (pXTarget->health == 0)
|
||||
{
|
||||
aiNewState(actor, &tchernobogSearch);
|
||||
|
|
|
@ -386,7 +386,7 @@ static void unicultThinkSearch(DBloodActor* actor)
|
|||
// TO DO: if can't see the target, but in fireDist range - stop moving and look around
|
||||
|
||||
//viewSetSystemMessage("IN SEARCH");
|
||||
aiChooseDirection(pSprite, pXSprite, pXSprite->goalAng);
|
||||
aiChooseDirection(actor,pXSprite->goalAng);
|
||||
aiLookForTarget(pSprite, pXSprite);
|
||||
}
|
||||
|
||||
|
@ -403,7 +403,7 @@ static void unicultThinkGoto(DBloodActor* actor)
|
|||
int dy = pXSprite->targetY - pSprite->y;
|
||||
int nAngle = getangle(dx, dy);
|
||||
|
||||
aiChooseDirection(pSprite, pXSprite, nAngle);
|
||||
aiChooseDirection(actor,nAngle);
|
||||
|
||||
// if reached target, change to search mode
|
||||
if (approxDist(dx, dy) < 5120 && abs(pSprite->ang - nAngle) < getDudeInfo(pSprite->type)->periphery) {
|
||||
|
@ -461,7 +461,7 @@ static void unicultThinkChase(DBloodActor* actor)
|
|||
if (inAttack(pXSprite->aiState))
|
||||
xvelocity = yvelocity = ClipLow(pSprite->clipdist >> 1, 1);
|
||||
|
||||
//aiChooseDirection(pSprite, pXSprite, getangle(dx, dy));
|
||||
//aiChooseDirection(actor,getangle(dx, dy));
|
||||
aiGenDudeChooseDirection(pSprite, pXSprite, getangle(dx, dy), xvelocity, yvelocity);
|
||||
|
||||
GENDUDEEXTRA* pExtra = &gGenDudeExtra[pSprite->index];
|
||||
|
@ -1040,6 +1040,7 @@ void aiGenDudeChooseDirection(spritetype* pSprite, XSPRITE* pXSprite, int a3, in
|
|||
Printf(PRINT_HIGH, "pSprite->type >= kDudeBase && pSprite->type < kDudeMax");
|
||||
return;
|
||||
}
|
||||
auto actor = &bloodActors[pSprite->index];
|
||||
|
||||
// TO-DO: Take in account if sprite is flip-x, so enemy select correct angle
|
||||
|
||||
|
@ -1047,26 +1048,26 @@ void aiGenDudeChooseDirection(spritetype* pSprite, XSPRITE* pXSprite, int a3, in
|
|||
int t1 = DMulScale(xvel, Cos(pSprite->ang), yvel, Sin(pSprite->ang), 30);
|
||||
int vsi = ((t1 * 15) >> 12) / 2; int v8 = (vc >= 0) ? 341 : -341;
|
||||
|
||||
if (CanMove(pSprite, pXSprite->target, pSprite->ang + vc, vsi))
|
||||
if (CanMove(actor, pXSprite->target, pSprite->ang + vc, vsi))
|
||||
pXSprite->goalAng = pSprite->ang + vc;
|
||||
else if (CanMove(pSprite, pXSprite->target, pSprite->ang + vc / 2, vsi))
|
||||
else if (CanMove(actor, pXSprite->target, pSprite->ang + vc / 2, vsi))
|
||||
pXSprite->goalAng = pSprite->ang + vc / 2;
|
||||
else if (CanMove(pSprite, pXSprite->target, pSprite->ang - vc / 2, vsi))
|
||||
else if (CanMove(actor, pXSprite->target, pSprite->ang - vc / 2, vsi))
|
||||
pXSprite->goalAng = pSprite->ang - vc / 2;
|
||||
else if (CanMove(pSprite, pXSprite->target, pSprite->ang + v8, vsi))
|
||||
else if (CanMove(actor, pXSprite->target, pSprite->ang + v8, vsi))
|
||||
pXSprite->goalAng = pSprite->ang + v8;
|
||||
else if (CanMove(pSprite, pXSprite->target, pSprite->ang, vsi))
|
||||
else if (CanMove(actor, pXSprite->target, pSprite->ang, vsi))
|
||||
pXSprite->goalAng = pSprite->ang;
|
||||
else if (CanMove(pSprite, pXSprite->target, pSprite->ang - v8, vsi))
|
||||
else if (CanMove(actor, pXSprite->target, pSprite->ang - v8, vsi))
|
||||
pXSprite->goalAng = pSprite->ang - v8;
|
||||
else
|
||||
pXSprite->goalAng = pSprite->ang + 341;
|
||||
|
||||
pXSprite->dodgeDir = (Chance(0x8000)) ? 1 : -1;
|
||||
|
||||
if (!CanMove(pSprite, pXSprite->target, pSprite->ang + pXSprite->dodgeDir * 512, 512)) {
|
||||
if (!CanMove(actor, pXSprite->target, pSprite->ang + pXSprite->dodgeDir * 512, 512)) {
|
||||
pXSprite->dodgeDir = -pXSprite->dodgeDir;
|
||||
if (!CanMove(pSprite, pXSprite->target, pSprite->ang + pXSprite->dodgeDir * 512, 512))
|
||||
if (!CanMove(actor, pXSprite->target, pSprite->ang + pXSprite->dodgeDir * 512, 512))
|
||||
pXSprite->dodgeDir = 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -87,7 +87,7 @@ static void zombaThinkSearch(DBloodActor* actor)
|
|||
{
|
||||
auto pXSprite = &actor->x();
|
||||
auto pSprite = &actor->s();
|
||||
aiChooseDirection(pSprite, pXSprite, pXSprite->goalAng);
|
||||
aiChooseDirection(actor,pXSprite->goalAng);
|
||||
aiLookForTarget(pSprite, pXSprite);
|
||||
}
|
||||
|
||||
|
@ -101,7 +101,7 @@ static void zombaThinkGoto(DBloodActor* actor)
|
|||
int dy = pXSprite->targetY-pSprite->y;
|
||||
int nAngle = getangle(dx, dy);
|
||||
int nDist = approxDist(dx, dy);
|
||||
aiChooseDirection(pSprite, pXSprite, nAngle);
|
||||
aiChooseDirection(actor,nAngle);
|
||||
if (nDist < 921 && abs(pSprite->ang - nAngle) < pDudeInfo->periphery)
|
||||
aiNewState(actor, &zombieASearch);
|
||||
aiThinkTarget(actor);
|
||||
|
@ -123,7 +123,7 @@ static void zombaThinkChase(DBloodActor* actor)
|
|||
XSPRITE *pXTarget = &xsprite[pTarget->extra];
|
||||
int dx = pTarget->x-pSprite->x;
|
||||
int dy = pTarget->y-pSprite->y;
|
||||
aiChooseDirection(pSprite, pXSprite, getangle(dx, dy));
|
||||
aiChooseDirection(actor,getangle(dx, dy));
|
||||
if (pXTarget->health == 0)
|
||||
{
|
||||
aiNewState(actor, &zombieASearch);
|
||||
|
@ -175,7 +175,7 @@ static void zombaThinkPonder(DBloodActor* actor)
|
|||
XSPRITE *pXTarget = &xsprite[pTarget->extra];
|
||||
int dx = pTarget->x-pSprite->x;
|
||||
int dy = pTarget->y-pSprite->y;
|
||||
aiChooseDirection(pSprite, pXSprite, getangle(dx, dy));
|
||||
aiChooseDirection(actor,getangle(dx, dy));
|
||||
if (pXTarget->health == 0)
|
||||
{
|
||||
aiNewState(actor, &zombieASearch);
|
||||
|
@ -256,7 +256,7 @@ static void myThinkSearch(DBloodActor* actor)
|
|||
{
|
||||
auto pXSprite = &actor->x();
|
||||
auto pSprite = &actor->s();
|
||||
aiChooseDirection(pSprite, pXSprite, pXSprite->goalAng);
|
||||
aiChooseDirection(actor,pXSprite->goalAng);
|
||||
myThinkTarget(actor);
|
||||
}
|
||||
|
||||
|
|
|
@ -88,7 +88,7 @@ static void zombfThinkSearch(DBloodActor* actor)
|
|||
{
|
||||
auto pXSprite = &actor->x();
|
||||
auto pSprite = &actor->s();
|
||||
aiChooseDirection(pSprite, pXSprite, pXSprite->goalAng);
|
||||
aiChooseDirection(actor,pXSprite->goalAng);
|
||||
aiThinkTarget(actor);
|
||||
}
|
||||
|
||||
|
@ -102,7 +102,7 @@ static void zombfThinkGoto(DBloodActor* actor)
|
|||
int dy = pXSprite->targetY-pSprite->y;
|
||||
int nAngle = getangle(dx, dy);
|
||||
int nDist = approxDist(dx, dy);
|
||||
aiChooseDirection(pSprite, pXSprite, nAngle);
|
||||
aiChooseDirection(actor,nAngle);
|
||||
if (nDist < 512 && abs(pSprite->ang - nAngle) < pDudeInfo->periphery)
|
||||
aiNewState(actor, &zombieFSearch);
|
||||
aiThinkTarget(actor);
|
||||
|
@ -124,7 +124,7 @@ static void zombfThinkChase(DBloodActor* actor)
|
|||
XSPRITE *pXTarget = &xsprite[pTarget->extra];
|
||||
int dx = pTarget->x-pSprite->x;
|
||||
int dy = pTarget->y-pSprite->y;
|
||||
aiChooseDirection(pSprite, pXSprite, getangle(dx, dy));
|
||||
aiChooseDirection(actor,getangle(dx, dy));
|
||||
if (pXTarget->health == 0)
|
||||
{
|
||||
aiNewState(actor, &zombieFSearch);
|
||||
|
|
|
@ -6514,6 +6514,7 @@ void nnExtAiSetDirection(spritetype* pSprite, XSPRITE* pXSprite, int a3) {
|
|||
/// patrol functions
|
||||
// ------------------------------------------------
|
||||
void aiPatrolState(spritetype* pSprite, int state) {
|
||||
auto actor = &bloodActors[pSprite->index];
|
||||
|
||||
assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
|
||||
|
||||
|
|
Loading…
Reference in a new issue