- Moved bot related variables from player_t into a new FBot class.

This commit is contained in:
ChillyDoom 2014-10-13 18:40:25 +01:00
commit 83d84eaae9
20 changed files with 325 additions and 344 deletions

View file

@ -33,19 +33,19 @@ void FCajunMaster::Roam (AActor *actor, ticcmd_t *cmd)
{
int delta;
if (Reachable(actor, actor->player->dest))
if (Reachable(actor, actor->player->Bot.dest))
{ // Straight towards it.
actor->player->angle = R_PointToAngle2(actor->x, actor->y, actor->player->dest->x, actor->player->dest->y);
actor->player->Bot.angle = R_PointToAngle2(actor->x, actor->y, actor->player->Bot.dest->x, actor->player->Bot.dest->y);
}
else if (actor->movedir < 8) // turn towards movement direction if not there yet
{
actor->player->angle &= (angle_t)(7<<29);
delta = actor->player->angle - (actor->movedir << 29);
actor->player->Bot.angle &= (angle_t)(7<<29);
delta = actor->player->Bot.angle - (actor->movedir << 29);
if (delta > 0)
actor->player->angle -= ANG45;
actor->player->Bot.angle -= ANG45;
else if (delta < 0)
actor->player->angle += ANG45;
actor->player->Bot.angle += ANG45;
}
// chase towards destination.
@ -134,7 +134,7 @@ void FCajunMaster::NewChaseDir (AActor *actor, ticcmd_t *cmd)
dirtype_t turnaround;
if (!actor->player->dest)
if (!actor->player->Bot.dest)
{
#ifndef BOT_RELEASE_COMPILE
Printf ("Bot tried move without destination\n");
@ -145,8 +145,8 @@ void FCajunMaster::NewChaseDir (AActor *actor, ticcmd_t *cmd)
olddir = (dirtype_t)actor->movedir;
turnaround = opposite[olddir];
deltax = actor->player->dest->x - actor->x;
deltay = actor->player->dest->y - actor->y;
deltax = actor->player->Bot.dest->x - actor->x;
deltay = actor->player->Bot.dest->y - actor->y;
if (deltax > 10*FRACUNIT)
d[1] = DI_EAST;
@ -315,23 +315,23 @@ void FCajunMaster::TurnToAng (AActor *actor)
{
if (actor->player->ReadyWeapon->WeaponFlags & WIF_BOT_EXPLOSIVE)
{
if (actor->player->t_roam && !actor->player->missile)
if (actor->player->Bot.t_roam && !actor->player->Bot.missile)
{ //Keep angle that where when shot where decided.
return;
}
}
if(actor->player->enemy)
if(!actor->player->dest) //happens when running after item in combat situations, or normal, prevents weak turns
if(actor->player->Bot.enemy)
if(!actor->player->Bot.dest) //happens when running after item in combat situations, or normal, prevents weak turns
if(actor->player->ReadyWeapon->ProjectileType == NULL && !(actor->player->ReadyWeapon->WeaponFlags & WIF_MELEEWEAPON))
if(Check_LOS(actor, actor->player->enemy, SHOOTFOV+5*ANGLE_1))
if(Check_LOS(actor, actor->player->Bot.enemy, SHOOTFOV+5*ANGLE_1))
maxturn = 3;
}
int distance = actor->player->angle - actor->angle;
int distance = actor->player->Bot.angle - actor->angle;
if (abs (distance) < OKAYRANGE && !actor->player->enemy)
if (abs (distance) < OKAYRANGE && !actor->player->Bot.enemy)
return;
distance /= TURNSENS;