#include "../game/q_shared.h"
#include "l_utils.h"
#include "l_libvar.h"
#include "l_memory.h"
#include "l_log.h"
#include "l_script.h"
#include "l_precomp.h"
#include "l_struct.h"
#include "aasfile.h"
#include "../game/botlib.h"
#include "../game/be_aas.h"
#include "be_aas_funcs.h"
#include "be_interface.h"
#include "be_ai_weight.h"
#include "../game/be_ai_goal.h"
#include "../game/be_ai_move.h"
Include dependency graph for be_ai_goal.c:

Go to the source code of this file.
|
|
Definition at line 57 of file be_ai_goal.c. |
|
|
Definition at line 59 of file be_ai_goal.c. |
|
|
Definition at line 55 of file be_ai_goal.c. |
|
|
Definition at line 53 of file be_ai_goal.c. |
|
|
Definition at line 1007 of file be_ai_goal.c. Referenced by Blocked_Door(), CG_AddCEntity(), CG_BuildSolidList(), CG_TouchTriggerPrediction(), G_MoverPush(), G_RunFrame(), and Svcmd_EntityList_f(). |
|
|
Definition at line 66 of file be_ai_goal.c. |
|
|
Definition at line 63 of file be_ai_goal.c. |
|
|
Definition at line 65 of file be_ai_goal.c. |
|
|
Definition at line 64 of file be_ai_goal.c. |
|
|
Definition at line 67 of file be_ai_goal.c. |
|
|
Definition at line 137 of file be_ai_goal.c. |
|
|
Definition at line 61 of file be_ai_goal.c. |
|
|
Definition at line 51 of file be_ai_goal.c. |
|
|
|
Referenced by BotFreeInfoEntities(), BotGetNextCampSpotGoal(), and BotInitInfoEntities(). |
|
|
Referenced by BotChooseLTGItem(), BotChooseNBGItem(), BotFindEntityForLevelItem(), BotInitLevelItems(), BotUpdateEntityItems(), ItemWeightIndex(), and LoadItemConfig(). |
|
|
Referenced by BotChooseLTGItem(), BotChooseNBGItem(), and LoadItemConfig(). |
|
|
|
Referenced by BotFreeInfoEntities(), BotGetMapLocationGoal(), and BotInitInfoEntities(). |
|
|
Definition at line 92 of file be_ai_goal.c. 00092 {
00093 GT_FFA, // free for all
00094 GT_TOURNAMENT, // one on one tournament
00095 GT_SINGLE_PLAYER, // single player tournament
00096
00097 //-- team games go after this --
00098
00099 GT_TEAM, // team deathmatch
00100 GT_CTF, // capture the flag
00101 #ifdef MISSIONPACK
00102 GT_1FCTF,
00103 GT_OBELISK,
00104 GT_HARVESTER,
00105 #endif
00106 GT_MAX_GAME_TYPE
00107 } gametype_t;
|
|
|
Definition at line 426 of file be_ai_goal.c. References levelitem_t, levelitems, levelitem_s::next, and levelitem_s::prev. Referenced by BotInitLevelItems(), and BotUpdateEntityItems(). 00427 {
00428 if (levelitems) levelitems->prev = li;
00429 li->prev = NULL;
00430 li->next = levelitems;
00431 levelitems = li;
00432 } //end of the function AddLevelItemToList
|
|
|
Definition at line 394 of file be_ai_goal.c. References botimport, Com_Memset(), freelevelitems, levelitem_t, levelitem_s::next, and PRT_FATAL. Referenced by BotInitLevelItems(), and BotUpdateEntityItems(). 00395 {
00396 levelitem_t *li;
00397
00398 li = freelevelitems;
00399 if (!li)
00400 {
00401 botimport.Print(PRT_FATAL, "out of level items\n");
00402 return NULL;
00403 } //end if
00404 //
00405 freelevelitems = freelevelitems->next;
00406 Com_Memset(li, 0, sizeof(levelitem_t));
00407 return li;
00408 } //end of the function AllocLevelItem
|
Here is the call graph for this function:

|
||||||||||||||||
|
Definition at line 742 of file be_ai_goal.c. References AAS_Time(), bot_goalstate_s::avoidgoals, bot_goalstate_s::avoidgoaltimes, bot_goalstate_t, and i. Referenced by BotChooseLTGItem(), BotChooseNBGItem(), and BotSetAvoidGoalTime(). 00743 {
00744 int i;
00745
00746 for (i = 0; i < MAX_AVOIDGOALS; i++)
00747 {
00748 //if the avoid goal is already stored
00749 if (gs->avoidgoals[i] == number)
00750 {
00751 gs->avoidgoals[i] = number;
00752 gs->avoidgoaltimes[i] = AAS_Time() + avoidtime;
00753 return;
00754 } //end if
00755 } //end for
00756
00757 for (i = 0; i < MAX_AVOIDGOALS; i++)
00758 {
00759 //if this avoid goal has expired
00760 if (gs->avoidgoaltimes[i] < AAS_Time())
00761 {
00762 gs->avoidgoals[i] = number;
00763 gs->avoidgoaltimes[i] = AAS_Time() + avoidtime;
00764 return;
00765 } //end if
00766 } //end for
00767 } //end of the function BotAddToAvoidGoals
|
Here is the call graph for this function:

|
|
Definition at line 1731 of file be_ai_goal.c. References bot_goalstate_t, botgoalstates, bot_goalstate_s::client, GetClearedMemory(), and i. 01732 {
01733 int i;
01734
01735 for (i = 1; i <= MAX_CLIENTS; i++)
01736 {
01737 if (!botgoalstates[i])
01738 {
01739 botgoalstates[i] = GetClearedMemory(sizeof(bot_goalstate_t));
01740 botgoalstates[i]->client = client;
01741 return i;
01742 } //end if
01743 } //end for
01744 return 0;
01745 } //end of the function BotAllocGoalState
|
Here is the call graph for this function:

|
||||||||||||
|
Definition at line 797 of file be_ai_goal.c. References AAS_Time(), bot_goalstate_s::avoidgoals, bot_goalstate_s::avoidgoaltimes, bot_goalstate_t, BotGoalStateFromHandle(), i, and number. Referenced by BotChooseLTGItem(), and BotChooseNBGItem(). 00798 {
00799 int i;
00800 bot_goalstate_t *gs;
00801
00802 gs = BotGoalStateFromHandle(goalstate);
00803 if (!gs) return 0;
00804 //don't use the goals the bot wants to avoid
00805 for (i = 0; i < MAX_AVOIDGOALS; i++)
00806 {
00807 if (gs->avoidgoals[i] == number && gs->avoidgoaltimes[i] >= AAS_Time())
00808 {
00809 return gs->avoidgoaltimes[i] - AAS_Time();
00810 } //end if
00811 } //end for
00812 return 0;
00813 } //end of the function BotAvoidGoalTime
|
Here is the call graph for this function:

|
||||||||||||||||||||
|
Definition at line 1284 of file be_ai_goal.c. References AAS_AreaReachability(), AAS_AreaTravelTimeToGoalArea(), bot_goal_s::areanum, bot_goal_t, bot_goalstate_t, BotAddToAvoidGoals(), BotAvoidGoalTime(), BotGoalStateFromHandle(), BotPushGoal(), BotReachabilityArea(), bot_goalstate_s::client, Com_Memset(), droppedweight, levelitem_s::entitynum, bot_goal_s::entitynum, levelitem_s::flags, bot_goal_s::flags, FuzzyWeight(), FuzzyWeightUndecided(), g_gametype, levelitem_s::goalareanum, levelitem_s::goalorigin, itemconfig_t, itemconfig_s::iteminfo, levelitem_s::iteminfo, bot_goal_s::iteminfo, iteminfo_t, bot_goalstate_s::itemweightconfig, bot_goalstate_s::itemweightindex, bot_goalstate_s::lastreachabilityarea, levelitem_t, iteminfo_s::maxs, bot_goal_s::maxs, iteminfo_s::mins, bot_goal_s::mins, levelitem_s::next, iteminfo_s::number, levelitem_s::number, bot_goal_s::number, bot_goal_s::origin, iteminfo_s::respawntime, t, levelitem_s::timeout, libvar_s::value, VectorCopy, and levelitem_s::weight. 01285 {
01286 int areanum, t, weightnum;
01287 float weight, bestweight, avoidtime;
01288 iteminfo_t *iteminfo;
01289 itemconfig_t *ic;
01290 levelitem_t *li, *bestitem;
01291 bot_goal_t goal;
01292 bot_goalstate_t *gs;
01293
01294 gs = BotGoalStateFromHandle(goalstate);
01295 if (!gs)
01296 return qfalse;
01297 if (!gs->itemweightconfig)
01298 return qfalse;
01299 //get the area the bot is in
01300 areanum = BotReachabilityArea(origin, gs->client);
01301 //if the bot is in solid or if the area the bot is in has no reachability links
01302 if (!areanum || !AAS_AreaReachability(areanum))
01303 {
01304 //use the last valid area the bot was in
01305 areanum = gs->lastreachabilityarea;
01306 } //end if
01307 //remember the last area with reachabilities the bot was in
01308 gs->lastreachabilityarea = areanum;
01309 //if still in solid
01310 if (!areanum)
01311 return qfalse;
01312 //the item configuration
01313 ic = itemconfig;
01314 if (!itemconfig)
01315 return qfalse;
01316 //best weight and item so far
01317 bestweight = 0;
01318 bestitem = NULL;
01319 Com_Memset(&goal, 0, sizeof(bot_goal_t));
01320 //go through the items in the level
01321 for (li = levelitems; li; li = li->next)
01322 {
01323 if (g_gametype == GT_SINGLE_PLAYER) {
01324 if (li->flags & IFL_NOTSINGLE)
01325 continue;
01326 }
01327 else if (g_gametype >= GT_TEAM) {
01328 if (li->flags & IFL_NOTTEAM)
01329 continue;
01330 }
01331 else {
01332 if (li->flags & IFL_NOTFREE)
01333 continue;
01334 }
01335 if (li->flags & IFL_NOTBOT)
01336 continue;
01337 //if the item is not in a possible goal area
01338 if (!li->goalareanum)
01339 continue;
01340 //FIXME: is this a good thing? added this for items that never spawned into the game (f.i. CTF flags in obelisk)
01341 if (!li->entitynum && !(li->flags & IFL_ROAM))
01342 continue;
01343 //get the fuzzy weight function for this item
01344 iteminfo = &ic->iteminfo[li->iteminfo];
01345 weightnum = gs->itemweightindex[iteminfo->number];
01346 if (weightnum < 0)
01347 continue;
01348
01349 #ifdef UNDECIDEDFUZZY
01350 weight = FuzzyWeightUndecided(inventory, gs->itemweightconfig, weightnum);
01351 #else
01352 weight = FuzzyWeight(inventory, gs->itemweightconfig, weightnum);
01353 #endif //UNDECIDEDFUZZY
01354 #ifdef DROPPEDWEIGHT
01355 //HACK: to make dropped items more attractive
01356 if (li->timeout)
01357 weight += droppedweight->value;
01358 #endif //DROPPEDWEIGHT
01359 //use weight scale for item_botroam
01360 if (li->flags & IFL_ROAM) weight *= li->weight;
01361 //
01362 if (weight > 0)
01363 {
01364 //get the travel time towards the goal area
01365 t = AAS_AreaTravelTimeToGoalArea(areanum, origin, li->goalareanum, travelflags);
01366 //if the goal is reachable
01367 if (t > 0)
01368 {
01369 //if this item won't respawn before we get there
01370 avoidtime = BotAvoidGoalTime(goalstate, li->number);
01371 if (avoidtime - t * 0.009 > 0)
01372 continue;
01373 //
01374 weight /= (float) t * TRAVELTIME_SCALE;
01375 //
01376 if (weight > bestweight)
01377 {
01378 bestweight = weight;
01379 bestitem = li;
01380 } //end if
01381 } //end if
01382 } //end if
01383 } //end for
01384 //if no goal item found
01385 if (!bestitem)
01386 {
01387 /*
01388 //if not in lava or slime
01389 if (!AAS_AreaLava(areanum) && !AAS_AreaSlime(areanum))
01390 {
01391 if (AAS_RandomGoalArea(areanum, travelflags, &goal.areanum, goal.origin))
01392 {
01393 VectorSet(goal.mins, -15, -15, -15);
01394 VectorSet(goal.maxs, 15, 15, 15);
01395 goal.entitynum = 0;
01396 goal.number = 0;
01397 goal.flags = GFL_ROAM;
01398 goal.iteminfo = 0;
01399 //push the goal on the stack
01400 BotPushGoal(goalstate, &goal);
01401 //
01402 #ifdef DEBUG
01403 botimport.Print(PRT_MESSAGE, "chosen roam goal area %d\n", goal.areanum);
01404 #endif //DEBUG
01405 return qtrue;
01406 } //end if
01407 } //end if
01408 */
01409 return qfalse;
01410 } //end if
01411 //create a bot goal for this item
01412 iteminfo = &ic->iteminfo[bestitem->iteminfo];
01413 VectorCopy(bestitem->goalorigin, goal.origin);
01414 VectorCopy(iteminfo->mins, goal.mins);
01415 VectorCopy(iteminfo->maxs, goal.maxs);
01416 goal.areanum = bestitem->goalareanum;
01417 goal.entitynum = bestitem->entitynum;
01418 goal.number = bestitem->number;
01419 goal.flags = GFL_ITEM;
01420 if (bestitem->timeout)
01421 goal.flags |= GFL_DROPPED;
01422 if (bestitem->flags & IFL_ROAM)
01423 goal.flags |= GFL_ROAM;
01424 goal.iteminfo = bestitem->iteminfo;
01425 //if it's a dropped item
01426 if (bestitem->timeout)
01427 {
01428 avoidtime = AVOID_DROPPED_TIME;
01429 } //end if
01430 else
01431 {
01432 avoidtime = iteminfo->respawntime;
01433 if (!avoidtime)
01434 avoidtime = AVOID_DEFAULT_TIME;
01435 if (avoidtime < AVOID_MINIMUM_TIME)
01436 avoidtime = AVOID_MINIMUM_TIME;
01437 } //end else
01438 //add the chosen goal to the goals to avoid for a while
01439 BotAddToAvoidGoals(gs, bestitem->number, avoidtime);
01440 //push the goal on the stack
01441 BotPushGoal(goalstate, &goal);
01442 //
01443 return qtrue;
01444 } //end of the function BotChooseLTGItem
|
Here is the call graph for this function:

|
||||||||||||||||||||||||||||
|
Definition at line 1451 of file be_ai_goal.c. References AAS_AreaReachability(), AAS_AreaTravelTimeToGoalArea(), bot_goal_s::areanum, bot_goal_t, bot_goalstate_t, BotAddToAvoidGoals(), BotAvoidGoalTime(), BotGoalStateFromHandle(), BotPushGoal(), BotReachabilityArea(), bot_goalstate_s::client, Com_Memset(), droppedweight, levelitem_s::entitynum, bot_goal_s::entitynum, levelitem_s::flags, bot_goal_s::flags, FuzzyWeight(), FuzzyWeightUndecided(), g_gametype, levelitem_s::goalareanum, levelitem_s::goalorigin, itemconfig_t, itemconfig_s::iteminfo, levelitem_s::iteminfo, bot_goal_s::iteminfo, iteminfo_t, bot_goalstate_s::itemweightconfig, bot_goalstate_s::itemweightindex, bot_goalstate_s::lastreachabilityarea, levelitem_t, iteminfo_s::maxs, bot_goal_s::maxs, iteminfo_s::mins, bot_goal_s::mins, levelitem_s::next, iteminfo_s::number, levelitem_s::number, bot_goal_s::number, bot_goal_s::origin, iteminfo_s::respawntime, t, levelitem_s::timeout, libvar_s::value, VectorCopy, and levelitem_s::weight. 01453 {
01454 int areanum, t, weightnum, ltg_time;
01455 float weight, bestweight, avoidtime;
01456 iteminfo_t *iteminfo;
01457 itemconfig_t *ic;
01458 levelitem_t *li, *bestitem;
01459 bot_goal_t goal;
01460 bot_goalstate_t *gs;
01461
01462 gs = BotGoalStateFromHandle(goalstate);
01463 if (!gs)
01464 return qfalse;
01465 if (!gs->itemweightconfig)
01466 return qfalse;
01467 //get the area the bot is in
01468 areanum = BotReachabilityArea(origin, gs->client);
01469 //if the bot is in solid or if the area the bot is in has no reachability links
01470 if (!areanum || !AAS_AreaReachability(areanum))
01471 {
01472 //use the last valid area the bot was in
01473 areanum = gs->lastreachabilityarea;
01474 } //end if
01475 //remember the last area with reachabilities the bot was in
01476 gs->lastreachabilityarea = areanum;
01477 //if still in solid
01478 if (!areanum)
01479 return qfalse;
01480 //
01481 if (ltg) ltg_time = AAS_AreaTravelTimeToGoalArea(areanum, origin, ltg->areanum, travelflags);
01482 else ltg_time = 99999;
01483 //the item configuration
01484 ic = itemconfig;
01485 if (!itemconfig)
01486 return qfalse;
01487 //best weight and item so far
01488 bestweight = 0;
01489 bestitem = NULL;
01490 Com_Memset(&goal, 0, sizeof(bot_goal_t));
01491 //go through the items in the level
01492 for (li = levelitems; li; li = li->next)
01493 {
01494 if (g_gametype == GT_SINGLE_PLAYER) {
01495 if (li->flags & IFL_NOTSINGLE)
01496 continue;
01497 }
01498 else if (g_gametype >= GT_TEAM) {
01499 if (li->flags & IFL_NOTTEAM)
01500 continue;
01501 }
01502 else {
01503 if (li->flags & IFL_NOTFREE)
01504 continue;
01505 }
01506 if (li->flags & IFL_NOTBOT)
01507 continue;
01508 //if the item is in a possible goal area
01509 if (!li->goalareanum)
01510 continue;
01511 //FIXME: is this a good thing? added this for items that never spawned into the game (f.i. CTF flags in obelisk)
01512 if (!li->entitynum && !(li->flags & IFL_ROAM))
01513 continue;
01514 //get the fuzzy weight function for this item
01515 iteminfo = &ic->iteminfo[li->iteminfo];
01516 weightnum = gs->itemweightindex[iteminfo->number];
01517 if (weightnum < 0)
01518 continue;
01519 //
01520 #ifdef UNDECIDEDFUZZY
01521 weight = FuzzyWeightUndecided(inventory, gs->itemweightconfig, weightnum);
01522 #else
01523 weight = FuzzyWeight(inventory, gs->itemweightconfig, weightnum);
01524 #endif //UNDECIDEDFUZZY
01525 #ifdef DROPPEDWEIGHT
01526 //HACK: to make dropped items more attractive
01527 if (li->timeout)
01528 weight += droppedweight->value;
01529 #endif //DROPPEDWEIGHT
01530 //use weight scale for item_botroam
01531 if (li->flags & IFL_ROAM) weight *= li->weight;
01532 //
01533 if (weight > 0)
01534 {
01535 //get the travel time towards the goal area
01536 t = AAS_AreaTravelTimeToGoalArea(areanum, origin, li->goalareanum, travelflags);
01537 //if the goal is reachable
01538 if (t > 0 && t < maxtime)
01539 {
01540 //if this item won't respawn before we get there
01541 avoidtime = BotAvoidGoalTime(goalstate, li->number);
01542 if (avoidtime - t * 0.009 > 0)
01543 continue;
01544 //
01545 weight /= (float) t * TRAVELTIME_SCALE;
01546 //
01547 if (weight > bestweight)
01548 {
01549 t = 0;
01550 if (ltg && !li->timeout)
01551 {
01552 //get the travel time from the goal to the long term goal
01553 t = AAS_AreaTravelTimeToGoalArea(li->goalareanum, li->goalorigin, ltg->areanum, travelflags);
01554 } //end if
01555 //if the travel back is possible and doesn't take too long
01556 if (t <= ltg_time)
01557 {
01558 bestweight = weight;
01559 bestitem = li;
01560 } //end if
01561 } //end if
01562 } //end if
01563 } //end if
01564 } //end for
01565 //if no goal item found
01566 if (!bestitem)
01567 return qfalse;
01568 //create a bot goal for this item
01569 iteminfo = &ic->iteminfo[bestitem->iteminfo];
01570 VectorCopy(bestitem->goalorigin, goal.origin);
01571 VectorCopy(iteminfo->mins, goal.mins);
01572 VectorCopy(iteminfo->maxs, goal.maxs);
01573 goal.areanum = bestitem->goalareanum;
01574 goal.entitynum = bestitem->entitynum;
01575 goal.number = bestitem->number;
01576 goal.flags = GFL_ITEM;
01577 if (bestitem->timeout)
01578 goal.flags |= GFL_DROPPED;
01579 if (bestitem->flags & IFL_ROAM)
01580 goal.flags |= GFL_ROAM;
01581 goal.iteminfo = bestitem->iteminfo;
01582 //if it's a dropped item
01583 if (bestitem->timeout)
01584 {
01585 avoidtime = AVOID_DROPPED_TIME;
01586 } //end if
01587 else
01588 {
01589 avoidtime = iteminfo->respawntime;
01590 if (!avoidtime)
01591 avoidtime = AVOID_DEFAULT_TIME;
01592 if (avoidtime < AVOID_MINIMUM_TIME)
01593 avoidtime = AVOID_MINIMUM_TIME;
01594 } //end else
01595 //add the chosen goal to the goals to avoid for a while
01596 BotAddToAvoidGoals(gs, bestitem->number, avoidtime);
01597 //push the goal on the stack
01598 BotPushGoal(goalstate, &goal);
01599 //
01600 return qtrue;
01601 } //end of the function BotChooseNBGItem
|
Here is the call graph for this function:

|
|
Definition at line 718 of file be_ai_goal.c. References AAS_Time(), bot_goalstate_s::avoidgoals, bot_goalstate_s::avoidgoaltimes, bot_goalstate_t, BotGoalName(), BotGoalStateFromHandle(), i, Log_Write(), and name. 00719 {
00720 int i;
00721 bot_goalstate_t *gs;
00722 char name[32];
00723
00724 gs = BotGoalStateFromHandle(goalstate);
00725 if (!gs) return;
00726 for (i = 0; i < MAX_AVOIDGOALS; i++)
00727 {
00728 if (gs->avoidgoaltimes[i] >= AAS_Time())
00729 {
00730 BotGoalName(gs->avoidgoals[i], name, 32);
00731 Log_Write("avoid goal %s, number %d for %f seconds", name,
00732 gs->avoidgoals[i], gs->avoidgoaltimes[i] - AAS_Time());
00733 } //end if
00734 } //end for
00735 } //end of the function BotDumpAvoidGoals
|
Here is the call graph for this function:

|
|
Definition at line 1182 of file be_ai_goal.c. References bot_goalstate_t, BotGoalName(), BotGoalStateFromHandle(), bot_goalstate_s::goalstack, bot_goalstate_s::goalstacktop, i, Log_Write(), name, and bot_goal_s::number. Referenced by BotPushGoal(). 01183 {
01184 int i;
01185 bot_goalstate_t *gs;
01186 char name[32];
01187
01188 gs = BotGoalStateFromHandle(goalstate);
01189 if (!gs) return;
01190 for (i = 1; i <= gs->goalstacktop; i++)
01191 {
01192 BotGoalName(gs->goalstack[i].number, name, 32);
01193 Log_Write("%d: %s", i, name);
01194 } //end for
01195 } //end of the function BotDumpGoalStack
|
Here is the call graph for this function:

|
|
Definition at line 1237 of file be_ai_goal.c. References bot_goalstate_t, BotGoalStateFromHandle(), and bot_goalstate_s::goalstacktop. 01238 {
01239 bot_goalstate_t *gs;
01240
01241 gs = BotGoalStateFromHandle(goalstate);
01242 if (!gs) return;
01243 gs->goalstacktop = 0;
01244 } //end of the function BotEmptyGoalStack
|
Here is the call graph for this function:

|
|
Definition at line 965 of file be_ai_goal.c. References AAS_EntityInfo(), aas_entityinfo_t, AAS_EntityModelindex(), AAS_NextEntity(), levelitem_s::entitynum, itemconfig_t, levelitem_s::iteminfo, itemconfig_s::iteminfo, aas_entityinfo_s::lastvisorigin, levelitem_t, iteminfo_s::modelindex, levelitem_s::origin, aas_entityinfo_s::origin, vec3_t, VectorLength(), and VectorSubtract. 00966 {
00967 int ent, modelindex;
00968 itemconfig_t *ic;
00969 aas_entityinfo_t entinfo;
00970 vec3_t dir;
00971
00972 ic = itemconfig;
00973 if (!itemconfig) return;
00974 for (ent = AAS_NextEntity(0); ent; ent = AAS_NextEntity(ent))
00975 {
00976 //get the model index of the entity
00977 modelindex = AAS_EntityModelindex(ent);
00978 //
00979 if (!modelindex) continue;
00980 //get info about the entity
00981 AAS_EntityInfo(ent, &entinfo);
00982 //if the entity is still moving
00983 if (entinfo.origin[0] != entinfo.lastvisorigin[0] ||
00984 entinfo.origin[1] != entinfo.lastvisorigin[1] ||
00985 entinfo.origin[2] != entinfo.lastvisorigin[2]) continue;
00986 //
00987 if (ic->iteminfo[li->iteminfo].modelindex == modelindex)
00988 {
00989 //check if the entity is very close
00990 VectorSubtract(li->origin, entinfo.origin, dir);
00991 if (VectorLength(dir) < 30)
00992 {
00993 //found an entity for this level item
00994 li->entitynum = ent;
00995 } //end if
00996 } //end if
00997 } //end for
00998 } //end of the function BotFindEntityForLevelItem
|
Here is the call graph for this function:

|
|
Definition at line 1752 of file be_ai_goal.c. References BotFreeItemWeights(), botgoalstates, botimport, FreeMemory(), and PRT_FATAL. Referenced by BotShutdownGoalAI(). 01753 {
01754 if (handle <= 0 || handle > MAX_CLIENTS)
01755 {
01756 botimport.Print(PRT_FATAL, "goal state handle %d out of range\n", handle);
01757 return;
01758 } //end if
01759 if (!botgoalstates[handle])
01760 {
01761 botimport.Print(PRT_FATAL, "invalid goal state handle %d\n", handle);
01762 return;
01763 } //end if
01764 BotFreeItemWeights(handle);
01765 FreeMemory(botgoalstates[handle]);
01766 botgoalstates[handle] = NULL;
01767 } //end of the function BotFreeGoalState
|
Here is the call graph for this function:

|