- Moved bot thinking logic into DBot.

This commit is contained in:
ChillyDoom 2014-11-14 16:54:56 +00:00
commit ee977f94d7
12 changed files with 153 additions and 135 deletions

View file

@ -272,10 +272,12 @@ shootmissile:
bool FCajunMaster::IsLeader (player_t *player)
{
for (int count = 0; count < MAXPLAYERS; count++)
DBot *Bot;
TThinkerIterator<DBot> it;
while ((Bot = it.Next ()) != NULL)
{
if (players[count].Bot != NULL
&& players[count].Bot->mate == player->mo)
if (Bot->mate == player->mo)
{
return true;
}
@ -402,7 +404,7 @@ AActor *FCajunMaster::Find_enemy (AActor *bot)
&& bot != client->mo)
{
if (Check_LOS (bot, client->mo, vangle)) //Here's a strange one, when bot is standing still, the P_CheckSight within Check_LOS almost always returns false. tought it should be the same checksight as below but.. (below works) something must be fuckin wierd screded up.
//if(P_CheckSight( bot, players[count].mo))
//if(P_CheckSight(bot, players[count].mo))
{
temp = P_AproxDistance (client->mo->x - bot->x,
client->mo->y - bot->y);
@ -552,3 +554,25 @@ bool FCajunMaster::SafeCheckPosition (AActor *actor, fixed_t x, fixed_t y, FChec
actor->flags = savedFlags;
return res;
}
void FCajunMaster::StartTravel ()
{
DBot *Bot;
TThinkerIterator<DBot> it;
while ((Bot = it.Next ()) != NULL)
{
Bot->ChangeStatNum (STAT_TRAVELLING);
}
}
void FCajunMaster::FinishTravel ()
{
DBot *Bot;
TThinkerIterator<DBot> it(STAT_TRAVELLING);
while ((Bot = it.Next ()) != NULL)
{
Bot->ChangeStatNum (STAT_DEFAULT);
}
}