From 5ed2fd5443093f1e4d5ad48de40bd6edd99dd2bf Mon Sep 17 00:00:00 2001 From: Lee Salzman Date: Fri, 17 Nov 2006 19:09:50 +0000 Subject: [PATCH] *** empty log message *** git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@700 e016b1c5-ed68-44aa-a2f7-31cac88cffde --- source/src/bot/ac_bot.cpp | 2 +- source/src/bot/ac_bot_ai.cpp | 3 - source/src/bot/bot.cpp | 1 - source/src/bot/bot_ai.cpp | 271 ----------------------------------- source/src/bot/bot_util.cpp | 17 --- 5 files changed, 1 insertion(+), 293 deletions(-) diff --git a/source/src/bot/ac_bot.cpp b/source/src/bot/ac_bot.cpp index 3fd47cc1..fb5bbf58 100644 --- a/source/src/bot/ac_bot.cpp +++ b/source/src/bot/ac_bot.cpp @@ -132,7 +132,7 @@ void CACBot::CheckItemPickup() if(e.type==NOTUSED) continue; if (!e.spawned) continue; - if ((i < sents.length()) && (!sents[i].spawned)) continue; + if (sents.inrange(i) && (!sents[i].spawned)) continue; if(OUTBORD(e.x, e.y)) continue; vec v(e.x, e.y, S(e.x, e.y)->floor+m_pMyEnt->eyeheight); diff --git a/source/src/bot/ac_bot_ai.cpp b/source/src/bot/ac_bot_ai.cpp index 9345e9bb..7ce0a016 100644 --- a/source/src/bot/ac_bot_ai.cpp +++ b/source/src/bot/ac_bot_ai.cpp @@ -13,9 +13,6 @@ #ifdef AC_CUBE -extern vector sents; -extern vector monsters; - // UNDONE weaponinfo_s WeaponInfoTable[MAX_WEAPONS] = { diff --git a/source/src/bot/bot.cpp b/source/src/bot/bot.cpp index f00a1c50..fc64d198 100644 --- a/source/src/bot/bot.cpp +++ b/source/src/bot/bot.cpp @@ -14,7 +14,6 @@ vector bots; -extern vector sents; extern int triggertime; extern itemstat itemstats[]; extern ENetHost *clienthost; diff --git a/source/src/bot/bot_ai.cpp b/source/src/bot/bot_ai.cpp index fadbf371..ebb073bc 100644 --- a/source/src/bot/bot_ai.cpp +++ b/source/src/bot/bot_ai.cpp @@ -12,9 +12,6 @@ #include "bot.h" -extern vector sents; -extern vector monsters; - extern weaponinfo_s WeaponInfoTable[MAX_WEAPONS]; vec CBot::GetEnemyPos(playerent *d) @@ -141,41 +138,6 @@ bool CBot::FindEnemy(void) float flDist, flNearestDist = 99999.9f; short EnemyVal, BestEnemyVal = -100; - // search for only for monsters when SP mode - /* no more sp as such -argh (sorry bout messy commenting) - if (m_sp) - { - loopv(monsters) - { - d = monsters[i]; // Handy shortcut - - if (d->state != CS_ALIVE) - continue; - - // Check if the enemy is visible - if(!IsInFOV(d) || !IsVisible(d)) - continue; - - flDist = GetDistance(d->o); - EnemyVal = 1; - - if (flDist < flNearestDist) - { - EnemyVal+=2; - flNearestDist = flDist; - } - - if (EnemyVal > BestEnemyVal) - { - pNewEnemy = d; - BestEnemyVal = EnemyVal; - } - } - } */ - - //else - //{ - // First loop through all players loopv(players) { @@ -204,38 +166,6 @@ bool CBot::FindEnemy(void) } } -#if 0 - // Then loop through all bots - loopv(bots) - { - d = bots[i]; // Handy shortcut - - if (d == m_pMyEnt) - continue; - - if (!d || isteam(d->team, m_pMyEnt->team) || (d->state != CS_ALIVE)) - continue; - - // Check if the enemy is visible - if(!IsInFOV(d) || !IsVisible(d)) - continue; - - flDist = GetDistance(d->o); - EnemyVal = 1; - - if (flDist < flNearestDist) - { - EnemyVal+=2; - flNearestDist = flDist; - } - - if (EnemyVal > BestEnemyVal) - { - pNewEnemy = d; - BestEnemyVal = EnemyVal; - } - } -#endif // Then examine the local player if (player1 && !isteam(player1->team, m_pMyEnt->team) && (player1->state == CS_ALIVE)) @@ -318,88 +248,6 @@ bool CBot::CheckHunt(void) short EnemyVal, BestEnemyVal = -100; vec BestOldPos; - // search for only for monsters when SP mode - //edit -argh - /*if (m_sp) - { - loopv(monsters) - { - d = monsters[i]; // Handy shortcut - - if (d->state != CS_ALIVE) - continue; - - flDist = GetDistance(d->o); - - if (flDist > 250.0f) continue; - - EnemyVal = 1; - - if (flDist < flNearestDist) - { - EnemyVal+=2; - flNearestDist = flDist; - } - - if (d == m_pPrevEnemy) - EnemyVal+=2; - - if (EnemyVal < BestEnemyVal) continue; - - vec bestfromenemy = g_vecZero, bestfrombot = g_vecZero; - flNearestOldPosDistToEnemy = flNearestOldPosDistToBot = 9999.9f; - - // Check previous locations of enemy - for (int j=0;jPrevLocations.prevloc[j]==m_vPrevHuntLocation) continue; - if (d->PrevLocations.prevloc[j]==g_vecZero) continue; - - vec v = d->PrevLocations.prevloc[j]; - - flDist = GetDistance(d->o, v); - - if ((flDist < flNearestOldPosDistToBot) && IsReachable(v)) - { - flNearestOldPosDistToEnemy = flDist; - bestfromenemy = v; - } - } - - // Check previous locations of bot hisself - for (int j=0;jPrevLocations.prevloc[j]==m_vPrevHuntLocation) continue; - if (m_pMyEnt->PrevLocations.prevloc[j]==g_vecZero) continue; - - vec v = m_pMyEnt->PrevLocations.prevloc[j]; - - flDist = GetDistance(v); - - if ((flDist < flNearestOldPosDistToBot) && ::IsVisible(d->o, v) && - IsReachable(v)) - { - flNearestOldPosDistToBot = flDist; - bestfrombot = v; - } - } - - if (bestfromenemy!=g_vecZero) - { - pNewEnemy = d; - BestEnemyVal = EnemyVal; - BestOldPos = bestfromenemy; - } - else if (bestfrombot!=g_vecZero) - { - pNewEnemy = d; - BestEnemyVal = EnemyVal; - BestOldPos = bestfrombot; - } - } - } */ - //else - //{ // First loop through all players loopv(players) { @@ -471,89 +319,6 @@ bool CBot::CheckHunt(void) BestEnemyVal = EnemyVal; BestOldPos = bestfrombot; } - //} - -#if 0 - // Then loop through all bots - loopv(bots) - { - d = bots[i]; // Handy shortcut - - if (d == m_pMyEnt) - continue; - - if (!d || isteam(d->team, m_pMyEnt->team) || (d->state != CS_ALIVE)) - continue; - - flDist = GetDistance(d->o); - - if (flDist > 250.0f) continue; - - EnemyVal = 1; - - if (flDist < flNearestDist) - { - EnemyVal+=2; - flNearestDist = flDist; - } - - if (d == m_pPrevEnemy) - EnemyVal+=2; - - if (EnemyVal < BestEnemyVal) continue; - - vec bestfromenemy = g_vecZero, bestfrombot = g_vecZero; - flNearestOldPosDistToEnemy = flNearestOldPosDistToBot = 9999.9f; - - // Check previous locations of enemy - for (int j=0;jPrevLocations.prevloc[j]==m_vPrevHuntLocation) continue; - if (d->PrevLocations.prevloc[j]==g_vecZero) continue; - - vec v = d->PrevLocations.prevloc[j]; - - flDist = GetDistance(d->o, v); - - if ((flDist < flNearestOldPosDistToEnemy) && IsReachable(v)) - { - flNearestOldPosDistToEnemy = flDist; - bestfromenemy = v; - } - } - - // Check previous locations of bot hisself - for (int j=0;jPrevLocations.prevloc[j]==m_vPrevHuntLocation) continue; - if (m_pMyEnt->PrevLocations.prevloc[j]==g_vecZero) continue; - - vec v = m_pMyEnt->PrevLocations.prevloc[j]; - - flDist = GetDistance(v); - - if ((flDist < flNearestOldPosDistToBot) && ::IsVisible(d->o, v) && - IsReachable(v)) - { - flNearestOldPosDistToBot = flDist; - bestfrombot = v; - } - } - - if (bestfromenemy!=g_vecZero) - { - pNewEnemy = d; - BestEnemyVal = EnemyVal; - BestOldPos = bestfromenemy; - } - else if (bestfrombot!=g_vecZero) - { - pNewEnemy = d; - BestEnemyVal = EnemyVal; - BestOldPos = bestfrombot; - } - } -#endif // Then examine the local player if (player1 && !isteam(player1->team, m_pMyEnt->team) && @@ -2203,24 +1968,6 @@ void CBot::HearSound(int n, vec *o) float flDist, flNearestDist = 3.0f; // Range of 3 units playerent *pNearest = NULL; - /* edit -argh - if (m_sp) - { - // Check all monsters - loopv(monsters) - { - if (!monsters[i] || monsters[i]->state != CS_ALIVE) continue; - - flDist = GetDistance(*o, monsters[i]->o); - if ((flDist < flNearestDist) && IsVisible(monsters[i])) - { - pNearest = monsters[i]; - flNearestDist = flDist; - } - } - } */ - //else - //{ // Check all players first loopv(players) { @@ -2238,23 +1985,6 @@ void CBot::HearSound(int n, vec *o) } } -#if 0 - // Check all bots - loopv(bots) - { - if (!bots[i] || (bots[i]->state != CS_ALIVE) || - isteam(m_pMyEnt->team, bots[i]->team) || (bots[i] == m_pMyEnt)) - continue; - - flDist = GetDistance(*o, bots[i]->o); - if ((flDist < flNearestDist) && IsVisible(bots[i])) - { - pNearest = bots[i]; - flNearestDist = flDist; - } - } -#endif - // Check local player if (player1 && (player1->state == CS_ALIVE) && !isteam(m_pMyEnt->team, player1->team)) @@ -2266,7 +1996,6 @@ void CBot::HearSound(int n, vec *o) flNearestDist = flDist; } } - //} if (pNearest) { diff --git a/source/src/bot/bot_util.cpp b/source/src/bot/bot_util.cpp index 7f15a115..27511af1 100644 --- a/source/src/bot/bot_util.cpp +++ b/source/src/bot/bot_util.cpp @@ -222,23 +222,6 @@ void TraceLine(vec from, vec to, dynent *pTracer, bool CheckPlayers, traceresult } } -#if 0 - // Check if the 'line' collides with bots - loopv(bots) - { - dynent *d = bots[i]; - if(!d || (d==pTracer) || (d->state != CS_ALIVE)) continue; // Only check valid bots - - flDist = GetDistance(from, d->o); - - if ((flDist < flNearestDist) && (intersect(d, from, to, &tr->end))) - { - flNearestDist = flDist; - tr->collided = true; - } - } -#endif - // Check if the 'line' collides with the local player(player1) dynent *d = player1; // Shortcut if (d && (d!=pTracer) && !BotManager.m_pBotToView && (d->state == CS_ALIVE))