- 11x replacing the same pattern.

This commit is contained in:
Christoph Oelckers 2022-09-27 22:00:52 +02:00
parent e3cc9879eb
commit 5d78c81acb
10 changed files with 34 additions and 33 deletions

View file

@ -86,10 +86,10 @@ static void gillThinkGoto(DBloodActor* actor)
auto pXSector = pSector->hasX() ? &pSector->xs() : nullptr;
auto dvec = actor->xspr.TargetPos.XY() - actor->spr.pos.XY();
int nAngle = getangle(dvec);
DAngle nAngle = VecToAngle(dvec);
double nDist = dvec.Length();
aiChooseDirection(actor, DAngle::fromBuild(nAngle));
if (nDist < 32 && abs(actor->int_ang() - nAngle) < pDudeInfo->periphery)
aiChooseDirection(actor, nAngle);
if (nDist < 32 && absangle(actor->spr.angle, nAngle) < pDudeInfo->Periphery())
{
if (pXSector && pXSector->Underwater)
aiNewState(actor, &gillBeastSwimSearch);
@ -199,10 +199,10 @@ static void gillThinkSwimGoto(DBloodActor* actor)
assert(actor->spr.type >= kDudeBase && actor->spr.type < kDudeMax);
DUDEINFO* pDudeInfo = getDudeInfo(actor->spr.type);
auto dvec = actor->xspr.TargetPos.XY() - actor->spr.pos.XY();
int nAngle = getangle(dvec);
DAngle nAngle = VecToAngle(dvec);
double nDist = dvec.Length();
aiChooseDirection(actor, DAngle::fromBuild(nAngle));
if (nDist < 32 && abs(actor->int_ang() - nAngle) < pDudeInfo->periphery)
aiChooseDirection(actor, nAngle);
if (nDist < 32 && absangle(actor->spr.angle, nAngle) < pDudeInfo->Periphery())
aiNewState(actor, &gillBeastSwimSearch);
aiThinkTarget(actor);
}

View file

@ -67,10 +67,10 @@ static void handThinkGoto(DBloodActor* actor)
assert(actor->spr.type >= kDudeBase && actor->spr.type < kDudeMax);
DUDEINFO* pDudeInfo = getDudeInfo(actor->spr.type);
auto dvec = actor->xspr.TargetPos.XY() - actor->spr.pos.XY();
int nAngle = getangle(dvec);
DAngle nAngle = VecToAngle(dvec);
double nDist = dvec.Length();
aiChooseDirection(actor, DAngle::fromBuild(nAngle));
if (nDist < 32 && abs(actor->int_ang() - nAngle) < pDudeInfo->periphery)
aiChooseDirection(actor, nAngle);
if (nDist < 32 && absangle(actor->spr.angle, nAngle) < pDudeInfo->Periphery())
aiNewState(actor, &handSearch);
aiThinkTarget(actor);
}

View file

@ -82,10 +82,10 @@ static void houndThinkGoto(DBloodActor* actor)
DUDEINFO* pDudeInfo = getDudeInfo(actor->spr.type);
auto dvec = actor->xspr.TargetPos.XY() - actor->spr.pos.XY();
int nAngle = getangle(dvec);
DAngle nAngle = VecToAngle(dvec);
double nDist = dvec.Length();
aiChooseDirection(actor, DAngle::fromBuild(nAngle));
if (nDist < 32 && abs(actor->int_ang() - nAngle) < pDudeInfo->periphery)
aiChooseDirection(actor, nAngle);
if (nDist < 32 && absangle(actor->spr.angle, nAngle) < pDudeInfo->Periphery())
aiNewState(actor, &houndSearch);
aiThinkTarget(actor);
}

View file

@ -51,10 +51,10 @@ static void innocThinkGoto(DBloodActor* actor)
assert(actor->spr.type >= kDudeBase && actor->spr.type < kDudeMax);
DUDEINFO* pDudeInfo = getDudeInfo(actor->spr.type);
auto dvec = actor->xspr.TargetPos.XY() - actor->spr.pos.XY();
int nAngle = getangle(dvec);
DAngle nAngle = VecToAngle(dvec);
double nDist = dvec.Length();
aiChooseDirection(actor, DAngle::fromBuild(nAngle));
if (nDist < 32 && abs(actor->int_ang() - nAngle) < pDudeInfo->periphery)
aiChooseDirection(actor, nAngle);
if (nDist < 32 && absangle(actor->spr.angle, nAngle) < pDudeInfo->Periphery())
aiNewState(actor, &innocentSearch);
aiThinkTarget(actor);
}

View file

@ -140,10 +140,11 @@ static void aiPodMove(DBloodActor* actor)
DUDEINFO* pDudeInfo = getDudeInfo(actor->spr.type);
auto dvec = actor->xspr.TargetPos.XY() - actor->spr.pos.XY();
int nAngle = getangle(dvec);
DAngle nAngle = VecToAngle(dvec);
double nDist = dvec.Length();
aiChooseDirection(actor, DAngle::fromBuild(nAngle));
if (nDist < 32 && abs(actor->int_ang() - nAngle) < pDudeInfo->periphery) {
aiChooseDirection(actor, nAngle);
if (nDist < 32 && absangle(actor->spr.angle, nAngle) < pDudeInfo->Periphery())
{
switch (actor->spr.type) {
case kDudePodGreen:
case kDudePodFire:

View file

@ -63,10 +63,10 @@ static void ratThinkGoto(DBloodActor* actor)
assert(actor->spr.type >= kDudeBase && actor->spr.type < kDudeMax);
DUDEINFO* pDudeInfo = getDudeInfo(actor->spr.type);
auto dvec = actor->xspr.TargetPos.XY() - actor->spr.pos.XY();
int nAngle = getangle(dvec);
DAngle nAngle = VecToAngle(dvec);
double nDist = dvec.Length();
aiChooseDirection(actor, DAngle::fromBuild(nAngle));
if (nDist < 32 && abs(actor->int_ang() - nAngle) < pDudeInfo->periphery)
aiChooseDirection(actor, nAngle);
if (nDist < 32 && absangle(actor->spr.angle, nAngle) < pDudeInfo->Periphery())
aiNewState(actor, &ratSearch);
aiThinkTarget(actor);
}

View file

@ -171,10 +171,10 @@ static void spidThinkGoto(DBloodActor* actor)
assert(actor->spr.type >= kDudeBase && actor->spr.type < kDudeMax);
DUDEINFO* pDudeInfo = getDudeInfo(actor->spr.type);
auto dvec = actor->xspr.TargetPos.XY() - actor->spr.pos.XY();
int nAngle = getangle(dvec);
DAngle nAngle = VecToAngle(dvec);
double nDist = dvec.Length();
aiChooseDirection(actor, DAngle::fromBuild(nAngle));
if (nDist < 32 && abs(actor->int_ang() - nAngle) < pDudeInfo->periphery)
aiChooseDirection(actor, nAngle);
if (nDist < 32 && absangle(actor->spr.angle, nAngle) < pDudeInfo->Periphery())
aiNewState(actor, &spidSearch);
aiThinkTarget(actor);
}

View file

@ -262,10 +262,10 @@ static void sub_72850(DBloodActor* actor)
}
DUDEINFO* pDudeInfo = getDudeInfo(actor->spr.type);
auto dvec = actor->xspr.TargetPos.XY() - actor->spr.pos.XY();
int nAngle = getangle(dvec);
DAngle nAngle = VecToAngle(dvec);
double nDist = dvec.Length();
aiChooseDirection(actor, DAngle::fromBuild(nAngle));
if (nDist < 32 && abs(actor->int_ang() - nAngle) < pDudeInfo->periphery)
aiChooseDirection(actor, nAngle);
if (nDist < 32 && absangle(actor->spr.angle, nAngle) < pDudeInfo->Periphery())
aiNewState(actor, &tchernobogSearch);
aiThinkTarget(actor);
}

View file

@ -92,10 +92,10 @@ static void zombaThinkGoto(DBloodActor* actor)
assert(actor->spr.type >= kDudeBase && actor->spr.type < kDudeMax);
DUDEINFO* pDudeInfo = getDudeInfo(actor->spr.type);
auto dvec = actor->xspr.TargetPos.XY() - actor->spr.pos.XY();
int nAngle = getangle(dvec);
DAngle nAngle = VecToAngle(dvec);
double nDist = dvec.Length();
aiChooseDirection(actor, DAngle::fromBuild(nAngle));
if (nDist < 51.3125 && abs(actor->int_ang() - nAngle) < pDudeInfo->periphery)
aiChooseDirection(actor, nAngle);
if (nDist < 51.3125 && absangle(actor->spr.angle, nAngle) < pDudeInfo->Periphery())
aiNewState(actor, &zombieASearch);
aiThinkTarget(actor);
}

View file

@ -91,10 +91,10 @@ static void zombfThinkGoto(DBloodActor* actor)
assert(actor->spr.type >= kDudeBase && actor->spr.type < kDudeMax);
DUDEINFO* pDudeInfo = getDudeInfo(actor->spr.type);
auto dvec = actor->xspr.TargetPos.XY() - actor->spr.pos.XY();
int nAngle = getangle(dvec);
DAngle nAngle = VecToAngle(dvec);
double nDist = dvec.Length();
aiChooseDirection(actor, DAngle::fromBuild(nAngle));
if (nDist < 32 && abs(actor->int_ang() - nAngle) < pDudeInfo->periphery)
aiChooseDirection(actor, nAngle);
if (nDist < 32 && absangle(actor->spr.angle, nAngle) < pDudeInfo->Periphery())
aiNewState(actor, &zombieFSearch);
aiThinkTarget(actor);
}