This graph shows which files directly or indirectly include this file:

Go to the source code of this file.
Data Structures | |
| struct | bot_goal_s |
Defines | |
| #define | GFL_DROPPED 4 |
| #define | GFL_ITEM 1 |
| #define | GFL_NONE 0 |
| #define | GFL_ROAM 2 |
| #define | MAX_AVOIDGOALS 256 |
| #define | MAX_GOALSTACK 8 |
Typedefs | |
| typedef bot_goal_s | bot_goal_t |
Functions | |
| int | BotAllocGoalState (int client) |
| float | BotAvoidGoalTime (int goalstate, int number) |
| int | BotChooseLTGItem (int goalstate, vec3_t origin, int *inventory, int travelflags) |
| int | BotChooseNBGItem (int goalstate, vec3_t origin, int *inventory, int travelflags, bot_goal_t *ltg, float maxtime) |
| void | BotDumpAvoidGoals (int goalstate) |
| void | BotDumpGoalStack (int goalstate) |
| void | BotEmptyGoalStack (int goalstate) |
| void | BotFreeGoalState (int handle) |
| void | BotFreeItemWeights (int goalstate) |
| int | BotGetLevelItemGoal (int index, char *classname, bot_goal_t *goal) |
| int | BotGetMapLocationGoal (char *name, bot_goal_t *goal) |
| int | BotGetNextCampSpotGoal (int num, bot_goal_t *goal) |
| int | BotGetSecondGoal (int goalstate, bot_goal_t *goal) |
| int | BotGetTopGoal (int goalstate, bot_goal_t *goal) |
| void | BotGoalName (int number, char *name, int size) |
| void | BotInitLevelItems (void) |
| void | BotInterbreedGoalFuzzyLogic (int parent1, int parent2, int child) |
| int | BotItemGoalInVisButNotVisible (int viewer, vec3_t eye, vec3_t viewangles, bot_goal_t *goal) |
| int | BotLoadItemWeights (int goalstate, char *filename) |
| void | BotMutateGoalFuzzyLogic (int goalstate, float range) |
| void | BotPopGoal (int goalstate) |
| void | BotPushGoal (int goalstate, bot_goal_t *goal) |
| void | BotRemoveFromAvoidGoals (int goalstate, int number) |
| void | BotResetAvoidGoals (int goalstate) |
| void | BotResetGoalState (int goalstate) |
| void | BotSaveGoalFuzzyLogic (int goalstate, char *filename) |
| void | BotSetAvoidGoalTime (int goalstate, int number, float avoidtime) |
| int | BotSetupGoalAI (void) |
| void | BotShutdownGoalAI (void) |
| int | BotTouchingGoal (vec3_t origin, bot_goal_t *goal) |
| void | BotUpdateEntityItems (void) |
|
|
Definition at line 38 of file be_ai_goal.h. |
|
|
Definition at line 36 of file be_ai_goal.h. |
|
|
Definition at line 35 of file be_ai_goal.h. |
|
|
Definition at line 37 of file be_ai_goal.h. |
|
|
Definition at line 32 of file be_ai_goal.h. Referenced by BotResetAvoidGoals(). |
|
|
Definition at line 33 of file be_ai_goal.h. Referenced by BotPushGoal(), and BotResetGoalState(). |
|
|
|
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, bot_goal_s::entitynum, levelitem_s::entitynum, bot_goal_s::flags, levelitem_s::flags, FuzzyWeight(), FuzzyWeightUndecided(), g_gametype, levelitem_s::goalareanum, levelitem_s::goalorigin, itemconfig_t, bot_goal_s::iteminfo, levelitem_s::iteminfo, itemconfig_s::iteminfo, iteminfo_t, bot_goalstate_s::itemweightconfig, bot_goalstate_s::itemweightindex, bot_goalstate_s::lastreachabilityarea, levelitem_t, bot_goal_s::maxs, iteminfo_s::maxs, bot_goal_s::mins, iteminfo_s::mins, levelitem_s::next, bot_goal_s::number, levelitem_s::number, iteminfo_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, bot_goal_s::entitynum, levelitem_s::entitynum, bot_goal_s::flags, levelitem_s::flags, FuzzyWeight(), FuzzyWeightUndecided(), g_gametype, levelitem_s::goalareanum, levelitem_s::goalorigin, itemconfig_t, bot_goal_s::iteminfo, levelitem_s::iteminfo, itemconfig_s::iteminfo, iteminfo_t, bot_goalstate_s::itemweightconfig, bot_goalstate_s::itemweightindex, bot_goalstate_s::lastreachabilityarea, levelitem_t, bot_goal_s::maxs, iteminfo_s::maxs, bot_goal_s::mins, iteminfo_s::mins, levelitem_s::next, bot_goal_s::number, levelitem_s::number, iteminfo_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 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:

|
|
Definition at line 1716 of file be_ai_goal.c. References bot_goalstate_t, BotGoalStateFromHandle(), FreeMemory(), FreeWeightConfig(), bot_goalstate_s::itemweightconfig, and bot_goalstate_s::itemweightindex. Referenced by BotFreeGoalState(). 01717 {
01718 bot_goalstate_t *gs;
01719
01720 gs = BotGoalStateFromHandle(goalstate);
01721 if (!gs) return;
01722 if (gs->itemweightconfig) FreeWeightConfig(gs->itemweightconfig);
01723 if (gs->itemweightindex) FreeMemory(gs->itemweightindex);
01724 } //end of the function BotFreeItemWeights
|
Here is the call graph for this function:

|
||||||||||||||||
|
Definition at line 859 of file be_ai_goal.c. References bot_goal_s::areanum, bot_goal_t, levelitem_s::entitynum, bot_goal_s::entitynum, bot_goal_s::flags, levelitem_s::flags, g_gametype, levelitem_s::goalareanum, levelitem_s::goalorigin, itemconfig, levelitem_s::iteminfo, itemconfig_s::iteminfo, levelitem_t, bot_goal_s::maxs, bot_goal_s::mins, name, levelitem_s::next, bot_goal_s::number, levelitem_s::number, bot_goal_s::origin, Q_stricmp(), levelitem_s::timeout, and VectorCopy. 00860 {
00861 levelitem_t *li;
00862
00863 if (!itemconfig) return -1;
00864 li = levelitems;
00865 if (index >= 0)
00866 {
00867 for (; li; li = li->next)
00868 {
00869 if (li->number == index)
00870 {
00871 li = li->next;
00872 break;
00873 } //end if
00874 } //end for
00875 } //end for
00876 for (; li; li = li->next)
00877 {
00878 //
00879 if (g_gametype == GT_SINGLE_PLAYER) {
00880 if (li->flags & IFL_NOTSINGLE) continue;
00881 }
00882 else if (g_gametype >= GT_TEAM) {
00883 if (li->flags & IFL_NOTTEAM) continue;
00884 }
00885 else {
00886 if (li->flags & IFL_NOTFREE) continue;
00887 }
00888 if (li->flags & IFL_NOTBOT) continue;
00889 //
00890 if (!Q_stricmp(name, itemconfig->iteminfo[li->iteminfo].name))
00891 {
00892 goal->areanum = li->goalareanum;
00893 VectorCopy(li->goalorigin, goal->origin);
00894 goal->entitynum = li->entitynum;
00895 VectorCopy(itemconfig->iteminfo[li->iteminfo].mins, goal->mins);
00896 VectorCopy(itemconfig->iteminfo[li->iteminfo].maxs, goal->maxs);
00897 goal->number = li->number;
00898 goal->flags = GFL_ITEM;
00899 if (li->timeout) goal->flags |= GFL_DROPPED;
00900 //botimport.Print(PRT_MESSAGE, "found li %s\n", itemconfig->iteminfo[li->iteminfo].name);
00901 return li->number;
00902 } //end if
00903 } //end for
00904 return -1;
00905 } //end of the function BotGetLevelItemGoal
|
Here is the call graph for this function:

|
||||||||||||
|
Definition at line 912 of file be_ai_goal.c. References maplocation_s::areanum, bot_goal_s::areanum, bot_goal_t, bot_goal_s::entitynum, maplocation_t, bot_goal_s::maxs, bot_goal_s::mins, name, maplocation_s::name, maplocation_s::next, bot_goal_s::origin, maplocation_s::origin, Q_stricmp(), vec3_t, and VectorCopy. 00913 {
00914 maplocation_t *ml;
00915 vec3_t mins = {-8, -8, -8}, maxs = {8, 8, 8};
00916
00917 for (ml = maplocations; ml; ml = ml->next)
00918 {
00919 if (!Q_stricmp(ml->name, name))
00920 {
00921 goal->areanum = ml->areanum;
00922 VectorCopy(ml->origin, goal->origin);
00923 goal->entitynum = 0;
00924 VectorCopy(mins, goal->mins);
00925 VectorCopy(maxs, goal->maxs);
00926 return qtrue;
00927 } //end if
00928 } //end for
00929 return qfalse;
00930 } //end of the function BotGetMapLocationGoal
|
Here is the call graph for this function:

|
||||||||||||
|
Definition at line 937 of file be_ai_goal.c. References campspot_s::areanum, bot_goal_s::areanum, bot_goal_t, campspot_t, bot_goal_s::entitynum, i, bot_goal_s::maxs, bot_goal_s::mins, campspot_s::next, bot_goal_s::origin, campspot_s::origin, vec3_t, and VectorCopy. 00938 {
00939 int i;
00940 campspot_t *cs;
00941 vec3_t mins = {-8, -8, -8}, maxs = {8, 8, 8};
00942
00943 if (num < 0) num = 0;
00944 i = num;
00945 for (cs = campspots; cs; cs = cs->next)
00946 {
00947 if (--i < 0)
00948 {
00949 goal->areanum = cs->areanum;
00950 VectorCopy(cs->origin, goal->origin);
00951 goal->entitynum = 0;
00952 VectorCopy(mins, goal->mins);
00953 VectorCopy(maxs, goal->maxs);
00954 return num+1;
00955 } //end if
00956 } //end for
00957 return 0;
00958 } //end of the function BotGetNextCampSpotGoal
|
|
||||||||||||
|
Definition at line 1267 of file be_ai_goal.c. References bot_goal_t, bot_goalstate_t, BotGoalStateFromHandle(), Com_Memcpy(), bot_goalstate_s::goalstack, and bot_goalstate_s::goalstacktop. 01268 {
01269 bot_goalstate_t *gs;
01270
01271 gs = BotGoalStateFromHandle(goalstate);
01272 if (!gs) return qfalse;
01273 if (gs->goalstacktop <= 1) return qfalse;
01274 Com_Memcpy(goal, &gs->goalstack[gs->goalstacktop-1], sizeof(bot_goal_t));
01275 return qtrue;
01276 } //end of the function BotGetSecondGoal
|
Here is the call graph for this function:

|
||||||||||||
|
Definition at line 1251 of file be_ai_goal.c. References bot_goal_t, bot_goalstate_t, BotGoalStateFromHandle(), Com_Memcpy(), bot_goalstate_s::goalstack, and bot_goalstate_s::goalstacktop. 01252 {
01253 bot_goalstate_t *gs;
01254
01255 gs = BotGoalStateFromHandle(goalstate);
01256 if (!gs) return qfalse;
01257 if (!gs->goalstacktop) return qfalse;
01258 Com_Memcpy(goal, &gs->goalstack[gs->goalstacktop], sizeof(bot_goal_t));
01259 return qtrue;
01260 } //end of the function BotGetTopGoal
|
Here is the call graph for this function:

|
||||||||||||||||
|
Definition at line 679 of file be_ai_goal.c. References itemconfig, levelitem_s::iteminfo, itemconfig_s::iteminfo, levelitem_t, name, levelitem_s::next, levelitem_s::number, strcpy(), and strncpy(). Referenced by BotDumpAvoidGoals(), and BotDumpGoalStack(). 00680 {
00681 levelitem_t *li;
00682
00683 if (!itemconfig) return;
00684 //
00685 for (li = levelitems; li; li = li->next)
00686 {
00687 if (li->number == number)
00688 {
00689 strncpy(name, itemconfig->iteminfo[li->iteminfo].name, size-1);
00690 name[size-1] = '\0';
00691 return;
00692 } //end for
00693 } //end for
00694 strcpy(name, "");
00695 return;
00696 } //end of the function BotGoalName
|
Here is the call graph for this function:

|
|
Definition at line 537 of file be_ai_goal.c. References AAS_BestReachableArea(), AAS_BestReachableFromJumpPadArea(), AAS_DropToFloor(), AAS_FloatForBSPEpairKey(), AAS_IntForBSPEpairKey(), AAS_Loaded(), AAS_NextBSPEntity(), AAS_PointContents(), AAS_Trace(), AAS_ValueForBSPEpairKey(), AAS_VectorForBSPEpairKey(), AddLevelItemToList(), AllocLevelItem(), botimport, BotInitInfoEntities(), bsp_trace_t, iteminfo_s::classname, CONTENTS_PLAYERCLIP, CONTENTS_SOLID, levelitem_s::entitynum, levelitem_s::flags, bsp_trace_s::fraction, levelitem_s::goalareanum, levelitem_s::goalorigin, i, InitLevelItemHeap(), itemconfig_t, levelitem_s::iteminfo, itemconfig_s::iteminfo, levelitem_t, levelitems, Log_Write(), MAX_EPAIRKEY, iteminfo_s::maxs, iteminfo_s::mins, iteminfo_s::modelindex, levelitem_s::number, itemconfig_s::numiteminfo, numlevelitems, levelitem_s::origin, PRT_ERROR, PRT_MESSAGE, strcmp(), levelitem_s::timeout, value, vec3_t, VectorCopy, and levelitem_s::weight. Referenced by Export_BotLibLoadMap(). 00538 {
00539 int i, spawnflags, value;
00540 char classname[MAX_EPAIRKEY];
00541 vec3_t origin, end;
00542 int ent, goalareanum;
00543 itemconfig_t *ic;
00544 levelitem_t *li;
00545 bsp_trace_t trace;
00546
00547 //initialize the map locations and camp spots
00548 BotInitInfoEntities();
00549
00550 //initialize the level item heap
00551 InitLevelItemHeap();
00552 levelitems = NULL;
00553 numlevelitems = 0;
00554 //
00555 ic = itemconfig;
00556 if (!ic) return;
00557
00558 //if there's no AAS file loaded
00559 if (!AAS_Loaded()) return;
00560
00561 //update the modelindexes of the item info
00562 for (i = 0; i < ic->numiteminfo; i++)
00563 {
00564 //ic->iteminfo[i].modelindex = AAS_IndexFromModel(ic->iteminfo[i].model);
00565 if (!ic->iteminfo[i].modelindex)
00566 {
00567 Log_Write("item %s has modelindex 0", ic->iteminfo[i].classname);
00568 } //end if
00569 } //end for
00570
00571 for (ent = AAS_NextBSPEntity(0); ent; ent = AAS_NextBSPEntity(ent))
00572 {
00573 if (!AAS_ValueForBSPEpairKey(ent, "classname", classname, MAX_EPAIRKEY)) continue;
00574 //
00575 spawnflags = 0;
00576 AAS_IntForBSPEpairKey(ent, "spawnflags", &spawnflags);
00577 //
00578 for (i = 0; i < ic->numiteminfo; i++)
00579 {
00580 if (!strcmp(classname, ic->iteminfo[i].classname)) break;
00581 } //end for
0 |