本文整理汇总了C++中AActor::AproxDistance方法的典型用法代码示例。如果您正苦于以下问题:C++ AActor::AproxDistance方法的具体用法?C++ AActor::AproxDistance怎么用?C++ AActor::AproxDistance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AActor
的用法示例。
在下文中一共展示了AActor::AproxDistance方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FireRox
angle_t DBot::FireRox (AActor *enemy, ticcmd_t *cmd)
{
fixed_t dist;
angle_t ang;
AActor *actor;
int m;
bglobal.SetBodyAt (player->mo->X() + FixedMul(player->mo->velx, 5*FRACUNIT),
player->mo->Y() + FixedMul(player->mo->vely, 5*FRACUNIT),
player->mo->Z() + (player->mo->height / 2), 2);
actor = bglobal.body2;
dist = actor->AproxDistance (enemy);
if (dist < SAFE_SELF_MISDIST)
return 0;
//Predict.
m = (((dist+1)/FRACUNIT) / GetDefaultByName("Rocket")->Speed);
bglobal.SetBodyAt (enemy->X() + FixedMul(enemy->velx, (m+2*FRACUNIT)),
enemy->Y() + FixedMul(enemy->vely, (m+2*FRACUNIT)), ONFLOORZ, 1);
//try the predicted location
if (P_CheckSight (actor, bglobal.body1, SF_IGNOREVISIBILITY)) //See the predicted location, so give a test missile
{
FCheckPosition tm;
if (bglobal.SafeCheckPosition (player->mo, actor->X(), actor->Y(), tm))
{
if (bglobal.FakeFire (actor, bglobal.body1, cmd) >= SAFE_SELF_MISDIST)
{
ang = actor->AngleTo(bglobal.body1);
return ang;
}
}
}
//Try fire straight.
if (P_CheckSight (actor, enemy, 0))
{
if (bglobal.FakeFire (player->mo, enemy, cmd) >= SAFE_SELF_MISDIST)
{
ang = player->mo->AngleTo(enemy);
return ang;
}
}
return 0;
}