mirror of
https://github.com/ZDoom/Raze.git
synced 2024-11-16 01:11:44 +00:00
- cansee refactoring, part 2
This commit is contained in:
parent
781ffc9a43
commit
80412bdc51
6 changed files with 23 additions and 17 deletions
|
@ -152,8 +152,8 @@ static void calebThinkChase(DBloodActor* actor)
|
|||
if (nDist <= pDudeInfo->seeDist)
|
||||
{
|
||||
int nDeltaAngle = ((getangle(dx, dy) + 1024 - actor->int_ang()) & 2047) - 1024;
|
||||
int height = (pDudeInfo->eyeHeight * actor->spr.yrepeat) << 2;
|
||||
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()))
|
||||
double height = (pDudeInfo->eyeHeight * actor->spr.yrepeat) * REPEAT_SCALE;
|
||||
if (cansee(target->spr.pos, target->sector(), actor->spr.pos.plusZ(-height), actor->sector()))
|
||||
{
|
||||
if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery)
|
||||
{
|
||||
|
@ -250,10 +250,10 @@ static void calebThinkSwimChase(DBloodActor* actor)
|
|||
if (nDist <= pDudeInfo->seeDist)
|
||||
{
|
||||
int nDeltaAngle = ((getangle(dx, dy) + 1024 - actor->int_ang()) & 2047) - 1024;
|
||||
int height = pDudeInfo->eyeHeight + actor->int_pos().Z;
|
||||
double height = (pDudeInfo->eyeHeight * actor->spr.yrepeat) * REPEAT_SCALE;
|
||||
int top, bottom;
|
||||
GetActorExtents(actor, &top, &bottom);
|
||||
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()))
|
||||
if (cansee(target->spr.pos, target->sector(), actor->spr.pos.plusZ(-height), actor->sector()))
|
||||
{
|
||||
if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery)
|
||||
{
|
||||
|
|
|
@ -258,6 +258,7 @@ static void cerberusThinkTarget(DBloodActor* actor)
|
|||
PLAYER* pPlayer = &gPlayer[p];
|
||||
if (pPlayer->actor->xspr.health == 0 || powerupCheck(pPlayer, kPwUpShadowCloak) > 0)
|
||||
continue;
|
||||
auto ppos = pPlayer->actor->spr.pos;
|
||||
int x = pPlayer->actor->int_pos().X;
|
||||
int y = pPlayer->actor->int_pos().Y;
|
||||
int z = pPlayer->actor->int_pos().Z;
|
||||
|
@ -267,7 +268,8 @@ static void cerberusThinkTarget(DBloodActor* actor)
|
|||
int nDist = approxDist(dx, dy);
|
||||
if (nDist > pDudeInfo->seeDist && nDist > pDudeInfo->hearDist)
|
||||
continue;
|
||||
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()))
|
||||
double height = (pDudeInfo->eyeHeight * actor->spr.yrepeat) * REPEAT_SCALE;
|
||||
if (!cansee(ppos, pSector, actor->spr.pos.plusZ(-height), actor->sector()))
|
||||
continue;
|
||||
int nDeltaAngle = ((getangle(dx, dy) + 1024 - actor->int_ang()) & 2047) - 1024;
|
||||
if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery)
|
||||
|
@ -372,8 +374,8 @@ static void cerberusThinkChase(DBloodActor* actor)
|
|||
if (nDist <= pDudeInfo->seeDist)
|
||||
{
|
||||
int nDeltaAngle = ((getangle(dx, dy) + 1024 - actor->int_ang()) & 2047) - 1024;
|
||||
int height = (pDudeInfo->eyeHeight * actor->spr.yrepeat) << 2;
|
||||
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()))
|
||||
double height = (pDudeInfo->eyeHeight * actor->spr.yrepeat) * REPEAT_SCALE;
|
||||
if (cansee(target->spr.pos, target->sector(), actor->spr.pos.plusZ(-height), actor->sector()))
|
||||
{
|
||||
if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery) {
|
||||
aiSetTarget(actor, actor->GetTarget());
|
||||
|
|
|
@ -274,8 +274,8 @@ static void cultThinkChase(DBloodActor* actor)
|
|||
if (nDist > 0 && nDist <= pDudeInfo->seeDist)
|
||||
{
|
||||
int nDeltaAngle = ((getangle(dx, dy) + 1024 - actor->int_ang()) & 2047) - 1024;
|
||||
int height = (pDudeInfo->eyeHeight * actor->spr.yrepeat) << 2;
|
||||
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()))
|
||||
double height = (pDudeInfo->eyeHeight * actor->spr.yrepeat) * REPEAT_SCALE;
|
||||
if (cansee(target->spr.pos, target->sector(), actor->spr.pos.plusZ(-height), actor->sector()))
|
||||
{
|
||||
if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery)
|
||||
{
|
||||
|
|
|
@ -218,6 +218,7 @@ static void gargThinkTarget(DBloodActor* actor)
|
|||
PLAYER* pPlayer = &gPlayer[p];
|
||||
if (pPlayer->actor->xspr.health == 0 || powerupCheck(pPlayer, kPwUpShadowCloak) > 0)
|
||||
continue;
|
||||
auto ppos = pPlayer->actor->spr.pos;
|
||||
int x = pPlayer->actor->int_pos().X;
|
||||
int y = pPlayer->actor->int_pos().Y;
|
||||
int z = pPlayer->actor->int_pos().Z;
|
||||
|
@ -227,7 +228,8 @@ static void gargThinkTarget(DBloodActor* actor)
|
|||
int nDist = approxDist(dx, dy);
|
||||
if (nDist > pDudeInfo->seeDist && nDist > pDudeInfo->hearDist)
|
||||
continue;
|
||||
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()))
|
||||
double height = (pDudeInfo->eyeHeight * actor->spr.yrepeat) * REPEAT_SCALE;
|
||||
if (!cansee(ppos, pSector, actor->spr.pos.plusZ(-height), actor->sector()))
|
||||
continue;
|
||||
int nDeltaAngle = ((getangle(dx, dy) + 1024 - actor->int_ang()) & 2047) - 1024;
|
||||
if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery)
|
||||
|
@ -363,7 +365,7 @@ static void gargThinkChase(DBloodActor* actor)
|
|||
int height2 = (pDudeInfo->eyeHeight * target->spr.yrepeat) << 2;
|
||||
int top, bottom;
|
||||
GetActorExtents(actor, &top, &bottom);
|
||||
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()))
|
||||
if (cansee(target->spr.pos, target->sector(), actor->spr.pos.plusZ(-height * zinttoworld), actor->sector()))
|
||||
{
|
||||
if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery)
|
||||
{
|
||||
|
|
|
@ -198,6 +198,7 @@ static void ghostThinkTarget(DBloodActor* actor)
|
|||
PLAYER* pPlayer = &gPlayer[p];
|
||||
if (pPlayer->actor->xspr.health == 0 || powerupCheck(pPlayer, kPwUpShadowCloak) > 0)
|
||||
continue;
|
||||
auto ppos = pPlayer->actor->spr.pos;
|
||||
int x = pPlayer->actor->int_pos().X;
|
||||
int y = pPlayer->actor->int_pos().Y;
|
||||
int z = pPlayer->actor->int_pos().Z;
|
||||
|
@ -207,7 +208,8 @@ static void ghostThinkTarget(DBloodActor* actor)
|
|||
int nDist = approxDist(dx, dy);
|
||||
if (nDist > pDudeInfo->seeDist && nDist > pDudeInfo->hearDist)
|
||||
continue;
|
||||
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()))
|
||||
double height = (pDudeInfo->eyeHeight * actor->spr.yrepeat) * REPEAT_SCALE;
|
||||
if (!cansee(ppos, pSector, actor->spr.pos.plusZ(-height), actor->sector()))
|
||||
continue;
|
||||
int nDeltaAngle = ((getangle(dx, dy) + 1024 - actor->int_ang()) & 2047) - 1024;
|
||||
if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery)
|
||||
|
@ -342,7 +344,7 @@ static void ghostThinkChase(DBloodActor* actor)
|
|||
int height2 = (pDudeInfo->eyeHeight * target->spr.yrepeat) << 2;
|
||||
int top, bottom;
|
||||
GetActorExtents(actor, &top, &bottom);
|
||||
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()))
|
||||
if (cansee(target->spr.pos, target->sector(), actor->spr.pos.plusZ(-height * zinttoworld), actor->sector()))
|
||||
{
|
||||
if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery)
|
||||
{
|
||||
|
|
|
@ -140,8 +140,8 @@ static void gillThinkChase(DBloodActor* actor)
|
|||
if (nDist <= pDudeInfo->seeDist)
|
||||
{
|
||||
int nDeltaAngle = ((getangle(dx, dy) + 1024 - actor->int_ang()) & 2047) - 1024;
|
||||
int height = (pDudeInfo->eyeHeight * actor->spr.yrepeat) << 2;
|
||||
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()))
|
||||
double height = (pDudeInfo->eyeHeight * actor->spr.yrepeat) * REPEAT_SCALE;
|
||||
if (cansee(target->spr.pos, target->sector(), actor->spr.pos.plusZ(-height), actor->sector()))
|
||||
{
|
||||
if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery)
|
||||
{
|
||||
|
@ -237,10 +237,10 @@ static void gillThinkSwimChase(DBloodActor* actor)
|
|||
if (nDist <= pDudeInfo->seeDist)
|
||||
{
|
||||
int nDeltaAngle = ((getangle(dx, dy) + 1024 - actor->int_ang()) & 2047) - 1024;
|
||||
int height = pDudeInfo->eyeHeight + actor->int_pos().Z;
|
||||
double height = (pDudeInfo->eyeHeight * actor->spr.yrepeat) * REPEAT_SCALE;
|
||||
int top, bottom;
|
||||
GetActorExtents(actor, &top, &bottom);
|
||||
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()))
|
||||
if (cansee(target->spr.pos, target->sector(), actor->spr.pos.plusZ(-height), actor->sector()))
|
||||
{
|
||||
if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue