mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-25 05:31:00 +00:00
- moved the bot support code from AActor::Tick to a subfunction in the bot sources. No need to pollute a main game file with this stuff.
This commit is contained in:
parent
c2e7858e05
commit
696fde69b8
4 changed files with 45 additions and 39 deletions
|
@ -106,6 +106,7 @@ public:
|
|||
void SetBodyAt (const DVector3 &pos, int hostnum);
|
||||
double FakeFire (AActor *source, AActor *dest, ticcmd_t *cmd);
|
||||
bool SafeCheckPosition (AActor *actor, double x, double y, FCheckPosition &tm);
|
||||
void BotTick(AActor *mo);
|
||||
|
||||
//(b_move.cpp)
|
||||
bool CleanAhead (AActor *thing, double x, double y, ticcmd_t *cmd);
|
||||
|
|
|
@ -284,6 +284,48 @@ bool FCajunMaster::IsLeader (player_t *player)
|
|||
return false;
|
||||
}
|
||||
|
||||
extern int BotWTG;
|
||||
|
||||
void FCajunMaster::BotTick(AActor *mo)
|
||||
{
|
||||
BotSupportCycles.Clock();
|
||||
bglobal.m_Thinking = true;
|
||||
for (int i = 0; i < MAXPLAYERS; i++)
|
||||
{
|
||||
if (!playeringame[i] || players[i].Bot == NULL)
|
||||
continue;
|
||||
|
||||
if (mo->flags3 & MF3_ISMONSTER)
|
||||
{
|
||||
if (mo->health > 0
|
||||
&& !players[i].Bot->enemy
|
||||
&& mo->player ? !mo->IsTeammate(players[i].mo) : true
|
||||
&& mo->Distance2D(players[i].mo) < MAX_MONSTER_TARGET_DIST
|
||||
&& P_CheckSight(players[i].mo, mo, SF_SEEPASTBLOCKEVERYTHING))
|
||||
{ //Probably a monster, so go kill it.
|
||||
players[i].Bot->enemy = mo;
|
||||
}
|
||||
}
|
||||
else if (mo->flags & MF_SPECIAL)
|
||||
{ //Item pickup time
|
||||
//clock (BotWTG);
|
||||
players[i].Bot->WhatToGet(mo);
|
||||
//unclock (BotWTG);
|
||||
BotWTG++;
|
||||
}
|
||||
else if (mo->flags & MF_MISSILE)
|
||||
{
|
||||
if (!players[i].Bot->missile && (mo->flags3 & MF3_WARNBOT))
|
||||
{ //warn for incoming missiles.
|
||||
if (mo->target != players[i].mo && players[i].Bot->Check_LOS(mo, 90.))
|
||||
players[i].Bot->missile = mo;
|
||||
}
|
||||
}
|
||||
}
|
||||
bglobal.m_Thinking = false;
|
||||
BotSupportCycles.Unclock();
|
||||
}
|
||||
|
||||
//This function is called every
|
||||
//tick (for each bot) to set
|
||||
//the mate (teammate coop mate).
|
||||
|
|
|
@ -3532,46 +3532,9 @@ void AActor::Tick ()
|
|||
if (bglobal.botnum && !demoplayback &&
|
||||
((flags & (MF_SPECIAL|MF_MISSILE)) || (flags3 & MF3_ISMONSTER)))
|
||||
{
|
||||
BotSupportCycles.Clock();
|
||||
bglobal.m_Thinking = true;
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
{
|
||||
if (!playeringame[i] || players[i].Bot == NULL)
|
||||
continue;
|
||||
|
||||
if (flags3 & MF3_ISMONSTER)
|
||||
{
|
||||
if (health > 0
|
||||
&& !players[i].Bot->enemy
|
||||
&& player ? !IsTeammate (players[i].mo) : true
|
||||
&& AproxDistance (players[i].mo) < MAX_MONSTER_TARGET_DIST
|
||||
&& P_CheckSight (players[i].mo, this, SF_SEEPASTBLOCKEVERYTHING))
|
||||
{ //Probably a monster, so go kill it.
|
||||
players[i].Bot->enemy = this;
|
||||
}
|
||||
}
|
||||
else if (flags & MF_SPECIAL)
|
||||
{ //Item pickup time
|
||||
//clock (BotWTG);
|
||||
players[i].Bot->WhatToGet (this);
|
||||
//unclock (BotWTG);
|
||||
BotWTG++;
|
||||
}
|
||||
else if (flags & MF_MISSILE)
|
||||
{
|
||||
if (!players[i].Bot->missile && (flags3 & MF3_WARNBOT))
|
||||
{ //warn for incoming missiles.
|
||||
if (target != players[i].mo && players[i].Bot->Check_LOS (this, 90.))
|
||||
players[i].Bot->missile = this;
|
||||
}
|
||||
}
|
||||
}
|
||||
bglobal.m_Thinking = false;
|
||||
BotSupportCycles.Unclock();
|
||||
bglobal.BotTick(this);
|
||||
}
|
||||
|
||||
//End of MC
|
||||
|
||||
// [RH] Consider carrying sectors here
|
||||
fixed_t cummx = 0, cummy = 0;
|
||||
if ((level.Scrolls != NULL || player != NULL) && !(flags & MF_NOCLIP) && !(flags & MF_NOSECTOR))
|
||||
|
|
|
@ -6505,7 +6505,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CheckProximity)
|
|||
|
||||
if (ptrWillChange)
|
||||
{
|
||||
current = ref->AproxDistance(mo);
|
||||
current = ref->Distance2D(mo);
|
||||
|
||||
if ((flags & CPXF_CLOSEST) && (current < closer))
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue