mirror of
https://github.com/DrBeef/Raze.git
synced 2024-11-15 08:52:00 +00:00
- Use getincangle()
in more places so it can be refactored easier later on.
This commit is contained in:
parent
2e25ccaa4d
commit
92b16907d2
23 changed files with 44 additions and 44 deletions
|
@ -246,9 +246,9 @@ inline int getangle(const vec2_t& vec)
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
inline constexpr int getincangle(int a, int na)
|
||||
inline constexpr int getincangle(unsigned a, unsigned na)
|
||||
{
|
||||
return int(unsigned(na << 21) - unsigned(a << 21)) >> 21;
|
||||
return int((na - a) << 21) >> 21;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -250,7 +250,7 @@ bool CanMove(DBloodActor* actor, DBloodActor* target, int nAngle, int nRange)
|
|||
void aiChooseDirection(DBloodActor* actor, int a3)
|
||||
{
|
||||
assert(actor->spr.type >= kDudeBase && actor->spr.type < kDudeMax);
|
||||
int vc = ((a3 + 1024 - actor->int_ang()) & 2047) - 1024;
|
||||
int vc = getincangle(actor->int_ang(), a3);
|
||||
int nCos = Cos(actor->int_ang());
|
||||
int nSin = Sin(actor->int_ang());
|
||||
int dx = actor->vel.X;
|
||||
|
@ -1516,7 +1516,7 @@ void aiThinkTarget(DBloodActor* actor)
|
|||
if (!cansee(ppos, pSector, actor->spr.pos.plusZ(-height), actor->sector()))
|
||||
continue;
|
||||
|
||||
int nDeltaAngle = ((getangle(dvec) + 1024 - actor->int_ang()) & 2047) - 1024;
|
||||
int nDeltaAngle = getincangle(actor->int_ang(), getangle(dvec));
|
||||
if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery)
|
||||
{
|
||||
aiSetTarget(actor, pPlayer->actor);
|
||||
|
@ -1560,7 +1560,7 @@ void aiLookForTarget(DBloodActor* actor)
|
|||
double height = (pDudeInfo->eyeHeight * actor->spr.yrepeat) * REPEAT_SCALE;
|
||||
if (!cansee(ppos, pSector, actor->spr.pos.plusZ(-height), actor->sector()))
|
||||
continue;
|
||||
int nDeltaAngle = ((getangle(dvec) + 1024 - actor->int_ang()) & 2047) - 1024;
|
||||
int nDeltaAngle = getincangle(actor->int_ang(), getangle(dvec));
|
||||
if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery)
|
||||
{
|
||||
aiSetTarget(actor, pPlayer->actor);
|
||||
|
|
|
@ -107,7 +107,7 @@ static void batThinkTarget(DBloodActor* actor)
|
|||
double height = (pDudeInfo->eyeHeight * actor->spr.yrepeat) * REPEAT_SCALE;
|
||||
if (!cansee(ppos, pSector, actor->spr.pos.plusZ(-height), actor->sector()))
|
||||
continue;
|
||||
int nDeltaAngle = ((getangle(dvec) + 1024 - actor->int_ang()) & 2047) - 1024;
|
||||
int nDeltaAngle = getincangle(actor->int_ang(), getangle(dvec));
|
||||
if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery)
|
||||
{
|
||||
aiSetTarget(actor, pPlayer->actor);
|
||||
|
@ -165,7 +165,7 @@ static void batThinkPonder(DBloodActor* actor)
|
|||
int nDist = approxDist(dvec);
|
||||
if (nDist <= pDudeInfo->seeDist)
|
||||
{
|
||||
int nDeltaAngle = ((getangle(dvec) + 1024 - actor->int_ang()) & 2047) - 1024;
|
||||
int nDeltaAngle = getincangle(actor->int_ang(), getangle(dvec));
|
||||
int height = (pDudeInfo->eyeHeight * actor->spr.yrepeat) << 2;
|
||||
int height2 = (getDudeInfo(pTarget->spr.type)->eyeHeight * pTarget->spr.yrepeat) << 2;
|
||||
int top, bottom;
|
||||
|
@ -271,7 +271,7 @@ static void batThinkChase(DBloodActor* actor)
|
|||
int nDist = approxDist(dvec);
|
||||
if (nDist <= pDudeInfo->seeDist)
|
||||
{
|
||||
int nDeltaAngle = ((getangle(dvec) + 1024 - actor->int_ang()) & 2047) - 1024;
|
||||
int nDeltaAngle = getincangle(actor->int_ang(), getangle(dvec));
|
||||
int height = (pDudeInfo->eyeHeight * actor->spr.yrepeat) << 2;
|
||||
// Should be dudeInfo[pTarget->spr.type-kDudeBase]
|
||||
int height2 = (pDudeInfo->eyeHeight * pTarget->spr.yrepeat) << 2;
|
||||
|
|
|
@ -232,7 +232,7 @@ static void beastThinkChase(DBloodActor* actor)
|
|||
int nDist = approxDist(dx, dy);
|
||||
if (nDist <= pDudeInfo->seeDist)
|
||||
{
|
||||
int nDeltaAngle = ((getangle(dx, dy) + 1024 - actor->int_ang()) & 2047) - 1024;
|
||||
int nDeltaAngle = getincangle(actor->int_ang(), getangle(dx, dy));
|
||||
double height = (pDudeInfo->eyeHeight * actor->spr.yrepeat) * REPEAT_SCALE;
|
||||
if (cansee(target->spr.pos, target->sector(), actor->spr.pos.plusZ(-height), actor->sector()))
|
||||
{
|
||||
|
@ -363,7 +363,7 @@ static void beastThinkSwimChase(DBloodActor* actor)
|
|||
|
||||
if (nDist <= pDudeInfo->seeDist)
|
||||
{
|
||||
int nDeltaAngle = ((nAngle + 1024 - actor->int_ang()) & 2047) - 1024;
|
||||
int nDeltaAngle = getincangle(actor->int_ang(), nAngle);
|
||||
double height = (pDudeInfo->eyeHeight * actor->spr.yrepeat) * REPEAT_SCALE;
|
||||
int top, bottom;
|
||||
GetActorExtents(actor, &top, &bottom);
|
||||
|
|
|
@ -118,7 +118,7 @@ static void eelThinkTarget(DBloodActor* actor)
|
|||
double height = (pDudeInfo->eyeHeight * actor->spr.yrepeat) * REPEAT_SCALE;
|
||||
if (!cansee(ppos, pSector, actor->spr.pos.plusZ(-height), actor->sector()))
|
||||
continue;
|
||||
int nDeltaAngle = ((getangle(dvect) + 1024 - actor->int_ang()) & 2047) - 1024;
|
||||
int nDeltaAngle = getincangle(actor->int_ang(), getangle(dvect));
|
||||
if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery)
|
||||
{
|
||||
pDudeExtraE->thinkTime = 0;
|
||||
|
@ -180,7 +180,7 @@ static void eelThinkPonder(DBloodActor* actor)
|
|||
|
||||
if (nDist <= pDudeInfo->seeDist)
|
||||
{
|
||||
int nDeltaAngle = ((nAngle + 1024 - actor->int_ang()) & 2047) - 1024;
|
||||
int nDeltaAngle = getincangle(actor->int_ang(), nAngle);
|
||||
int height = (pDudeInfo->eyeHeight * actor->spr.yrepeat) << 2;
|
||||
int height2 = (getDudeInfo(target->spr.type)->eyeHeight * target->spr.yrepeat) << 2;
|
||||
int top, bottom;
|
||||
|
@ -287,7 +287,7 @@ static void eelThinkChase(DBloodActor* actor)
|
|||
|
||||
if (nDist <= pDudeInfo->seeDist)
|
||||
{
|
||||
int nDeltaAngle = ((nAngle + 1024 - actor->int_ang()) & 2047) - 1024;
|
||||
int nDeltaAngle = getincangle(actor->int_ang(), nAngle);
|
||||
double height = (pDudeInfo->eyeHeight * actor->spr.yrepeat) * REPEAT_SCALE;
|
||||
int top, bottom;
|
||||
GetActorExtents(actor, &top, &bottom);
|
||||
|
|
|
@ -194,7 +194,7 @@ static void burnThinkChase(DBloodActor* actor)
|
|||
|
||||
if (nDist <= pDudeInfo->seeDist)
|
||||
{
|
||||
int nDeltaAngle = ((nAngle + 1024 - actor->int_ang()) & 2047) - 1024;
|
||||
int nDeltaAngle = getincangle(actor->int_ang(), nAngle);
|
||||
double height = (pDudeInfo->eyeHeight * actor->spr.yrepeat) * REPEAT_SCALE;
|
||||
if (cansee(target->spr.pos, target->sector(), actor->spr.pos.plusZ(-height), actor->sector()))
|
||||
{
|
||||
|
|
|
@ -151,7 +151,7 @@ static void calebThinkChase(DBloodActor* actor)
|
|||
|
||||
if (nDist <= pDudeInfo->seeDist)
|
||||
{
|
||||
int nDeltaAngle = ((nAngle + 1024 - actor->int_ang()) & 2047) - 1024;
|
||||
int nDeltaAngle = getincangle(actor->int_ang(), nAngle);
|
||||
double height = (pDudeInfo->eyeHeight * actor->spr.yrepeat) * REPEAT_SCALE;
|
||||
if (cansee(target->spr.pos, target->sector(), actor->spr.pos.plusZ(-height), actor->sector()))
|
||||
{
|
||||
|
@ -251,7 +251,7 @@ static void calebThinkSwimChase(DBloodActor* actor)
|
|||
|
||||
if (nDist <= pDudeInfo->seeDist)
|
||||
{
|
||||
int nDeltaAngle = ((nAngle + 1024 - actor->int_ang()) & 2047) - 1024;
|
||||
int nDeltaAngle = getincangle(actor->int_ang(), nAngle);
|
||||
double height = (pDudeInfo->eyeHeight * actor->spr.yrepeat) * REPEAT_SCALE;
|
||||
int top, bottom;
|
||||
GetActorExtents(actor, &top, &bottom);
|
||||
|
|
|
@ -267,7 +267,7 @@ static void cerberusThinkTarget(DBloodActor* actor)
|
|||
double height = (pDudeInfo->eyeHeight * actor->spr.yrepeat) * REPEAT_SCALE;
|
||||
if (!cansee(ppos, pSector, actor->spr.pos.plusZ(-height), actor->sector()))
|
||||
continue;
|
||||
int nDeltaAngle = ((getangle(dvect) + 1024 - actor->int_ang()) & 2047) - 1024;
|
||||
int nDeltaAngle = getincangle(actor->int_ang(), getangle(dvect));
|
||||
if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery)
|
||||
{
|
||||
pDudeExtraE->thinkTime = 0;
|
||||
|
@ -369,7 +369,7 @@ static void cerberusThinkChase(DBloodActor* actor)
|
|||
|
||||
if (nDist <= pDudeInfo->seeDist)
|
||||
{
|
||||
int nDeltaAngle = ((nAngle + 1024 - actor->int_ang()) & 2047) - 1024;
|
||||
int nDeltaAngle = getincangle(actor->int_ang(), nAngle);
|
||||
double height = (pDudeInfo->eyeHeight * actor->spr.yrepeat) * REPEAT_SCALE;
|
||||
if (cansee(target->spr.pos, target->sector(), actor->spr.pos.plusZ(-height), actor->sector()))
|
||||
{
|
||||
|
|
|
@ -272,7 +272,7 @@ static void cultThinkChase(DBloodActor* actor)
|
|||
int nDist = approxDist(dx, dy);
|
||||
if (nDist > 0 && nDist <= pDudeInfo->seeDist)
|
||||
{
|
||||
int nDeltaAngle = ((getangle(dx, dy) + 1024 - actor->int_ang()) & 2047) - 1024;
|
||||
int nDeltaAngle = getincangle(actor->int_ang(), getangle(dx, dy));
|
||||
double height = (pDudeInfo->eyeHeight * actor->spr.yrepeat) * REPEAT_SCALE;
|
||||
if (cansee(target->spr.pos, target->sector(), actor->spr.pos.plusZ(-height), actor->sector()))
|
||||
{
|
||||
|
|
|
@ -227,7 +227,7 @@ static void gargThinkTarget(DBloodActor* actor)
|
|||
double height = (pDudeInfo->eyeHeight * actor->spr.yrepeat) * REPEAT_SCALE;
|
||||
if (!cansee(ppos, pSector, actor->spr.pos.plusZ(-height), actor->sector()))
|
||||
continue;
|
||||
int nDeltaAngle = ((getangle(dvect) + 1024 - actor->int_ang()) & 2047) - 1024;
|
||||
int nDeltaAngle = getincangle(actor->int_ang(), getangle(dvect));
|
||||
if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery)
|
||||
{
|
||||
pDudeExtraE->thinkTime = 0;
|
||||
|
@ -354,7 +354,7 @@ static void gargThinkChase(DBloodActor* actor)
|
|||
int nDist = approxDist(dx, dy);
|
||||
if (nDist <= pDudeInfo->seeDist)
|
||||
{
|
||||
int nDeltaAngle = ((getangle(dx, dy) + 1024 - actor->int_ang()) & 2047) - 1024;
|
||||
int nDeltaAngle = getincangle(actor->int_ang(), getangle(dx, dy));
|
||||
int height = (pDudeInfo->eyeHeight * actor->spr.yrepeat) << 2;
|
||||
// Should be dudeInfo[target->spr.type-kDudeBase]
|
||||
int height2 = (pDudeInfo->eyeHeight * target->spr.yrepeat) << 2;
|
||||
|
|
|
@ -207,7 +207,7 @@ static void ghostThinkTarget(DBloodActor* actor)
|
|||
double height = (pDudeInfo->eyeHeight * actor->spr.yrepeat) * REPEAT_SCALE;
|
||||
if (!cansee(ppos, pSector, actor->spr.pos.plusZ(-height), actor->sector()))
|
||||
continue;
|
||||
int nDeltaAngle = ((getangle(dvect) + 1024 - actor->int_ang()) & 2047) - 1024;
|
||||
int nDeltaAngle = getincangle(actor->int_ang(), getangle(dvect));
|
||||
if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery)
|
||||
{
|
||||
pDudeExtraE->thinkTime = 0;
|
||||
|
@ -333,7 +333,7 @@ static void ghostThinkChase(DBloodActor* actor)
|
|||
int nDist = approxDist(dx, dy);
|
||||
if (nDist <= pDudeInfo->seeDist)
|
||||
{
|
||||
int nDeltaAngle = ((getangle(dx, dy) + 1024 - actor->int_ang()) & 2047) - 1024;
|
||||
int nDeltaAngle = getincangle(actor->int_ang(), getangle(dx, dy));
|
||||
int height = (pDudeInfo->eyeHeight * actor->spr.yrepeat) << 2;
|
||||
// Should be dudeInfo[target->spr.type-kDudeBase]
|
||||
int height2 = (pDudeInfo->eyeHeight * target->spr.yrepeat) << 2;
|
||||
|
|
|
@ -138,7 +138,7 @@ static void gillThinkChase(DBloodActor* actor)
|
|||
int nDist = approxDist(dx, dy);
|
||||
if (nDist <= pDudeInfo->seeDist)
|
||||
{
|
||||
int nDeltaAngle = ((getangle(dx, dy) + 1024 - actor->int_ang()) & 2047) - 1024;
|
||||
int nDeltaAngle = getincangle(actor->int_ang(), getangle(dx, dy));
|
||||
double height = (pDudeInfo->eyeHeight * actor->spr.yrepeat) * REPEAT_SCALE;
|
||||
if (cansee(target->spr.pos, target->sector(), actor->spr.pos.plusZ(-height), actor->sector()))
|
||||
{
|
||||
|
@ -235,7 +235,7 @@ static void gillThinkSwimChase(DBloodActor* actor)
|
|||
|
||||
if (nDist <= pDudeInfo->seeDist)
|
||||
{
|
||||
int nDeltaAngle = ((nAngle + 1024 - actor->int_ang()) & 2047) - 1024;
|
||||
int nDeltaAngle = getincangle(actor->int_ang(), nAngle);
|
||||
double height = (pDudeInfo->eyeHeight * actor->spr.yrepeat) * REPEAT_SCALE;
|
||||
int top, bottom;
|
||||
GetActorExtents(actor, &top, &bottom);
|
||||
|
|
|
@ -103,7 +103,7 @@ static void handThinkChase(DBloodActor* actor)
|
|||
}
|
||||
if (nDist <= pDudeInfo->seeDist)
|
||||
{
|
||||
int nDeltaAngle = ((nAngle + 1024 - actor->int_ang()) & 2047) - 1024;
|
||||
int nDeltaAngle = getincangle(actor->int_ang(), nAngle);
|
||||
double height = (pDudeInfo->eyeHeight * actor->spr.yrepeat) * REPEAT_SCALE;
|
||||
if (cansee(target->spr.pos, target->sector(), actor->spr.pos.plusZ(-height), actor->sector()))
|
||||
{
|
||||
|
|
|
@ -121,7 +121,7 @@ static void houndThinkChase(DBloodActor* actor)
|
|||
|
||||
if (nDist <= pDudeInfo->seeDist)
|
||||
{
|
||||
int nDeltaAngle = ((nAngle + 1024 - actor->int_ang()) & 2047) - 1024;
|
||||
int nDeltaAngle = getincangle(actor->int_ang(), nAngle);
|
||||
double height = (pDudeInfo->eyeHeight * actor->spr.yrepeat) * REPEAT_SCALE;
|
||||
if (cansee(target->spr.pos, target->sector(), actor->spr.pos.plusZ(-height), actor->sector()))
|
||||
{
|
||||
|
|
|
@ -88,7 +88,7 @@ static void innocThinkChase(DBloodActor* actor)
|
|||
|
||||
if (nDist <= pDudeInfo->seeDist)
|
||||
{
|
||||
int nDeltaAngle = ((nAngle + 1024 - actor->int_ang()) & 2047) - 1024;
|
||||
int nDeltaAngle = getincangle(actor->int_ang(), nAngle);
|
||||
double height = (pDudeInfo->eyeHeight * actor->spr.yrepeat) * REPEAT_SCALE;
|
||||
if (cansee(target->spr.pos, target->sector(), actor->spr.pos.plusZ(-height), actor->sector()))
|
||||
{
|
||||
|
|
|
@ -200,7 +200,7 @@ static void aiPodChase(DBloodActor* actor)
|
|||
}
|
||||
if (nDist <= pDudeInfo->seeDist)
|
||||
{
|
||||
int nDeltaAngle = ((nAngle + 1024 - actor->int_ang()) & 2047) - 1024;
|
||||
int nDeltaAngle = getincangle(actor->int_ang(), nAngle);
|
||||
double height = (pDudeInfo->eyeHeight * actor->spr.yrepeat) * REPEAT_SCALE;
|
||||
if (cansee(target->spr.pos, target->sector(), actor->spr.pos.plusZ(-height), actor->sector()))
|
||||
{
|
||||
|
|
|
@ -99,7 +99,7 @@ static void ratThinkChase(DBloodActor* actor)
|
|||
|
||||
if (nDist <= pDudeInfo->seeDist)
|
||||
{
|
||||
int nDeltaAngle = ((nAngle + 1024 - actor->int_ang()) & 2047) - 1024;
|
||||
int nDeltaAngle = getincangle(actor->int_ang(), nAngle);
|
||||
double height = (pDudeInfo->eyeHeight * actor->spr.yrepeat) * REPEAT_SCALE;
|
||||
if (cansee(target->spr.pos, target->sector(), actor->spr.pos.plusZ(-height), actor->sector()))
|
||||
{
|
||||
|
|
|
@ -206,7 +206,7 @@ static void spidThinkChase(DBloodActor* actor)
|
|||
}
|
||||
|
||||
if (nDist <= pDudeInfo->seeDist) {
|
||||
int nDeltaAngle = ((nAngle + 1024 - actor->int_ang()) & 2047) - 1024;
|
||||
int nDeltaAngle = getincangle(actor->int_ang(), nAngle);
|
||||
double height = (pDudeInfo->eyeHeight * actor->spr.yrepeat) * REPEAT_SCALE;
|
||||
if (cansee(target->spr.pos, target->sector(), actor->spr.pos.plusZ(-height), actor->sector()))
|
||||
{
|
||||
|
|
|
@ -234,7 +234,7 @@ static void sub_725A4(DBloodActor* actor)
|
|||
double height = (pDudeInfo->eyeHeight * actor->spr.yrepeat) * REPEAT_SCALE;
|
||||
if (cansee(ppos, pSector, actor->spr.pos.plusZ(-height), actor->sector()))
|
||||
continue;
|
||||
int nDeltaAngle = ((getangle(dvect) + 1024 - actor->int_ang()) & 2047) - 1024;
|
||||
int nDeltaAngle = getincangle(actor->int_ang(), getangle(dvect));
|
||||
if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery)
|
||||
{
|
||||
pDudeExtraE->thinkTime = 0;
|
||||
|
@ -302,7 +302,7 @@ static void sub_72934(DBloodActor* actor)
|
|||
|
||||
if (nDist <= pDudeInfo->seeDist)
|
||||
{
|
||||
int nDeltaAngle = ((nAngle + 1024 - actor->int_ang()) & 2047) - 1024;
|
||||
int nDeltaAngle = getincangle(actor->int_ang(), nAngle);
|
||||
double height = (pDudeInfo->eyeHeight * actor->spr.yrepeat) * REPEAT_SCALE;
|
||||
if (cansee(target->spr.pos, target->sector(), actor->spr.pos.plusZ(-height), actor->sector()))
|
||||
{
|
||||
|
|
|
@ -516,7 +516,7 @@ static void unicultThinkChase(DBloodActor* actor)
|
|||
}
|
||||
|
||||
DUDEINFO* pDudeInfo = getDudeInfo(actor->spr.type);
|
||||
int losAngle = ((getangle(dx, dy) + 1024 - actor->int_ang()) & 2047) - 1024;
|
||||
int losAngle = getincangle(actor->int_ang(), getangle(dx, dy));
|
||||
double height = (pDudeInfo->eyeHeight * actor->spr.yrepeat) * REPEAT_SCALE;
|
||||
|
||||
if (dist > pDudeInfo->seeDist || !cansee(target->spr.pos, target->sector(),
|
||||
|
@ -1173,7 +1173,7 @@ void aiGenDudeChooseDirection(DBloodActor* actor, int a3, int xvel, int yvel)
|
|||
|
||||
// TO-DO: Take in account if sprite is flip-x, so enemy select correct angle
|
||||
|
||||
int vc = ((a3 + 1024 - actor->int_ang()) & 2047) - 1024;
|
||||
int vc = getincangle(actor->int_ang(), a3);
|
||||
int t1 = DMulScale(xvel, Cos(actor->int_ang()), yvel, Sin(actor->int_ang()), 30);
|
||||
int vsi = ((t1 * 15) >> 12) / 2; int v8 = (vc >= 0) ? 341 : -341;
|
||||
|
||||
|
|
|
@ -134,7 +134,7 @@ static void zombaThinkChase(DBloodActor* actor)
|
|||
|
||||
if (nDist <= pDudeInfo->seeDist)
|
||||
{
|
||||
int nDeltaAngle = ((nAngle + 1024 - actor->int_ang()) & 2047) - 1024;
|
||||
int nDeltaAngle = getincangle(actor->int_ang(), nAngle);
|
||||
double height = (pDudeInfo->eyeHeight * actor->spr.yrepeat) * REPEAT_SCALE;
|
||||
if (cansee(target->spr.pos, target->sector(), actor->spr.pos.plusZ(-height), actor->sector()))
|
||||
{
|
||||
|
@ -181,7 +181,7 @@ static void zombaThinkPonder(DBloodActor* actor)
|
|||
|
||||
if (nDist <= pDudeInfo->seeDist)
|
||||
{
|
||||
int nDeltaAngle = ((nAngle + 1024 - actor->int_ang()) & 2047) - 1024;
|
||||
int nDeltaAngle = getincangle(actor->int_ang(), nAngle);
|
||||
double height = (pDudeInfo->eyeHeight * actor->spr.yrepeat) * REPEAT_SCALE;
|
||||
if (cansee(target->spr.pos, target->sector(), actor->spr.pos.plusZ(-height), actor->sector()))
|
||||
{
|
||||
|
@ -223,7 +223,7 @@ static void myThinkTarget(DBloodActor* actor)
|
|||
double height = (pDudeInfo->eyeHeight * actor->spr.yrepeat) * REPEAT_SCALE;
|
||||
if (!cansee(ppos, pSector, actor->spr.pos.plusZ(-height), actor->sector()))
|
||||
continue;
|
||||
int nDeltaAngle = ((getangle(dvect) + 1024 - actor->int_ang()) & 2047) - 1024;
|
||||
int nDeltaAngle = getincangle(actor->int_ang(), getangle(dvect));
|
||||
if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery)
|
||||
{
|
||||
aiSetTarget(actor, pPlayer->actor);
|
||||
|
|
|
@ -127,7 +127,7 @@ static void zombfThinkChase(DBloodActor* actor)
|
|||
int nDist = approxDist(dx, dy);
|
||||
if (nDist <= pDudeInfo->seeDist)
|
||||
{
|
||||
int nDeltaAngle = ((getangle(dx, dy) + 1024 - actor->int_ang()) & 2047) - 1024;
|
||||
int nDeltaAngle = getincangle(actor->int_ang(), getangle(dx, dy));
|
||||
double height = (pDudeInfo->eyeHeight * actor->spr.yrepeat) * REPEAT_SCALE;
|
||||
if (cansee(target->spr.pos, target->sector(), actor->spr.pos.plusZ(-height), actor->sector()))
|
||||
{
|
||||
|
|
|
@ -7724,7 +7724,7 @@ void nnExtAiSetDirection(DBloodActor* actor, int a3)
|
|||
{
|
||||
assert(actor->spr.type >= kDudeBase && actor->spr.type < kDudeMax);
|
||||
|
||||
int vc = ((a3 + 1024 - actor->int_ang()) & 2047) - 1024;
|
||||
int vc = getincangle(actor->int_ang(), a3);
|
||||
int t1 = DMulScale(actor->vel.X, Cos(actor->int_ang()), actor->vel.Y, Sin(actor->int_ang()), 30);
|
||||
int vsi = ((t1 * 15) >> 12) / 2;
|
||||
int v8 = 341;
|
||||
|
@ -8139,7 +8139,7 @@ void aiPatrolRandGoalAng(DBloodActor* actor)
|
|||
void aiPatrolTurn(DBloodActor* actor)
|
||||
{
|
||||
int nTurnRange = (getDudeInfo(actor->spr.type)->angSpeed << 1) >> 4;
|
||||
int nAng = ((actor->xspr.goalAng + 1024 - actor->int_ang()) & 2047) - 1024;
|
||||
int nAng = getincangle(actor->int_ang(), actor->xspr.goalAng);
|
||||
actor->set_int_ang((actor->int_ang() + ClipRange(nAng, -nTurnRange, nTurnRange)) & 2047);
|
||||
|
||||
}
|
||||
|
@ -8187,7 +8187,7 @@ void aiPatrolMove(DBloodActor* actor)
|
|||
}
|
||||
|
||||
int nTurnRange = (pDudeInfo->angSpeed << 2) >> 4;
|
||||
int nAng = ((actor->xspr.goalAng + 1024 - actor->int_ang()) & 2047) - 1024;
|
||||
int nAng = getincangle(actor->int_ang(), actor->xspr.goalAng);
|
||||
actor->set_int_ang((actor->int_ang() + ClipRange(nAng, -nTurnRange, nTurnRange)) & 2047);
|
||||
|
||||
if (abs(nAng) > goalAng || ((targetactor->xspr.waitTime > 0 || targetactor->xspr.data1 == targetactor->xspr.data2) && aiPatrolMarkerReached(actor)))
|
||||
|
@ -8392,7 +8392,7 @@ bool readyForCrit(DBloodActor* hunter, DBloodActor* victim)
|
|||
if (approxDist(dvect) >= (7000 / ClipLow(gGameOptions.nDifficulty >> 1, 1)))
|
||||
return false;
|
||||
|
||||
return (abs(((getangle(dvect) + 1024 - victim->int_ang()) & 2047) - 1024) <= kAng45);
|
||||
return abs(getincangle(victim->int_ang(), getangle(dvect))) <= kAng45;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
@ -8583,7 +8583,7 @@ DBloodActor* aiPatrolSearchTargets(DBloodActor* actor)
|
|||
if (seeDist)
|
||||
{
|
||||
int periphery = ClipLow(pDudeInfo->periphery, kAng60);
|
||||
int nDeltaAngle = abs(((getangle(dx, dy) + 1024 - actor->int_ang()) & 2047) - 1024);
|
||||
int nDeltaAngle = abs(getincangle(actor->int_ang(), getangle(dx, dy)));
|
||||
if ((itCanSee = (!blind && nDist < seeDist && nDeltaAngle < periphery)) == true)
|
||||
{
|
||||
int base = 100 + ((20 * gGameOptions.nDifficulty) - (nDeltaAngle / 5));
|
||||
|
|
Loading…
Reference in a new issue