- some refactoring of P_AproxDistance calls into newly defined AActor method AproxDistance.
The main reason here is to reduce the number of instances where AActor::x and AActor::y are being referenced.
This commit is contained in:
parent
1f34372abc
commit
1e2ce9a622
25 changed files with 1293 additions and 1286 deletions
|
|
@ -81,7 +81,7 @@ void DBot::ThinkForMove (ticcmd_t *cmd)
|
|||
int r;
|
||||
|
||||
stuck = false;
|
||||
dist = dest ? P_AproxDistance(player->mo->x-dest->x, player->mo->y-dest->y) : 0;
|
||||
dist = dest ? player->mo->AproxDistance(dest) : 0;
|
||||
|
||||
if (missile &&
|
||||
((!missile->velx || !missile->vely) || !Check_LOS(missile, SHOOTFOV*3/2)))
|
||||
|
|
@ -96,14 +96,14 @@ void DBot::ThinkForMove (ticcmd_t *cmd)
|
|||
player->mo->pitch += 80;
|
||||
|
||||
//HOW TO MOVE:
|
||||
if (missile && (P_AproxDistance(player->mo->x-missile->x, player->mo->y-missile->y)<AVOID_DIST)) //try avoid missile got from P_Mobj.c thinking part.
|
||||
if (missile && (player->mo->AproxDistance(missile)<AVOID_DIST)) //try avoid missile got from P_Mobj.c thinking part.
|
||||
{
|
||||
Pitch (missile);
|
||||
angle = R_PointToAngle2(player->mo->x, player->mo->y, missile->x, missile->y);
|
||||
cmd->ucmd.sidemove = sleft ? -SIDERUN : SIDERUN;
|
||||
cmd->ucmd.forwardmove = -FORWARDRUN; //Back IS best.
|
||||
|
||||
if ((P_AproxDistance(player->mo->x-oldx, player->mo->y-oldy)<50000)
|
||||
if ((player->mo->AproxDistance(oldx, oldy)<50000)
|
||||
&& t_strafe<=0)
|
||||
{
|
||||
t_strafe = 5;
|
||||
|
|
@ -156,7 +156,7 @@ void DBot::ThinkForMove (ticcmd_t *cmd)
|
|||
t_fight = AFTERTICS;
|
||||
|
||||
if (t_strafe <= 0 &&
|
||||
(P_AproxDistance(player->mo->x-oldx, player->mo->y-oldy)<50000
|
||||
(player->mo->AproxDistance(oldx, oldy)<50000
|
||||
|| ((pr_botmove()%30)==10))
|
||||
)
|
||||
{
|
||||
|
|
@ -168,7 +168,7 @@ void DBot::ThinkForMove (ticcmd_t *cmd)
|
|||
angle = R_PointToAngle2(player->mo->x, player->mo->y, enemy->x, enemy->y);
|
||||
|
||||
if (player->ReadyWeapon == NULL ||
|
||||
P_AproxDistance(player->mo->x-enemy->x, player->mo->y-enemy->y) >
|
||||
player->mo->AproxDistance(enemy) >
|
||||
player->ReadyWeapon->MoveCombatDist)
|
||||
{
|
||||
// If a monster, use lower speed (just for cooler apperance while strafing down doomed monster)
|
||||
|
|
@ -208,7 +208,7 @@ void DBot::ThinkForMove (ticcmd_t *cmd)
|
|||
|
||||
angle = R_PointToAngle2(player->mo->x, player->mo->y, mate->x, mate->y);
|
||||
|
||||
matedist = P_AproxDistance(player->mo->x - mate->x, player->mo->y - mate->y);
|
||||
matedist = player->mo->AproxDistance(mate);
|
||||
if (matedist > (FRIEND_DIST*2))
|
||||
cmd->ucmd.forwardmove = FORWARDRUN;
|
||||
else if (matedist > FRIEND_DIST)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue