#include "bg_saga.h"#include "../namespace_begin.h"#include "../namespace_end.h"Go to the source code of this file.
|
|
Definition at line 74 of file ai_main.h. Referenced by BotGetFlagHome(). |
|
|
Definition at line 75 of file ai_main.h. Referenced by BotGetEnemyFlag(). |
|
|
Definition at line 73 of file ai_main.h. Referenced by BotDefendFlag(). |
|
|
Definition at line 77 of file ai_main.h. Referenced by CTFFlagMovement(). |
|
|
Definition at line 68 of file ai_main.h. Referenced by CTFTakesPriority(). |
|
|
Definition at line 66 of file ai_main.h. Referenced by SiegeTakesPriority(). |
|
|
Definition at line 65 of file ai_main.h. Referenced by CTFTakesPriority(), and SiegeTakesPriority(). |
|
|
Definition at line 70 of file ai_main.h. Referenced by Siege_TargetClosestObjective(). |
|
|
Definition at line 71 of file ai_main.h. Referenced by Siege_TargetClosestObjective(). |
|
|
Definition at line 63 of file ai_main.h. Referenced by BotCheckDetPacks(). |
|
|
Definition at line 61 of file ai_main.h. Referenced by StandardBotAI(). |
|
|
Definition at line 62 of file ai_main.h. Referenced by StandardBotAI(). |
|
|
Definition at line 55 of file ai_main.h. Referenced by BotIsAChickenWuss(). |
|
|
Definition at line 79 of file ai_main.h. Referenced by StandardBotAI(). |
|
|
Definition at line 56 of file ai_main.h. Referenced by StandardBotAI(). |
|
|
Definition at line 48 of file ai_main.h. Referenced by BotGetWeaponRange(), GetIdealDestination(), and StandardBotAI(). |
|
|
Definition at line 46 of file ai_main.h. Referenced by BotGetWeaponRange(), BotIsAChickenWuss(), BotTrace_Jump(), CombatBotAI(), GetIdealDestination(), Siege_TargetClosestObjective(), and StandardBotAI(). |
|
|
Definition at line 47 of file ai_main.h. Referenced by BotGetWeaponRange(), GetIdealDestination(), and StandardBotAI(). |
|
|
Definition at line 49 of file ai_main.h. Referenced by BotGetWeaponRange(), BotIsAChickenWuss(), BotTrace_Jump(), CombatBotAI(), GetIdealDestination(), Siege_TargetClosestObjective(), and StandardBotAI(). |
|
|
|
|
|
Definition at line 57 of file ai_main.h. Referenced by BotDamageNotification(), GetNearestBadThing(), and StandardBotAI(). |
|
|
Definition at line 411 of file ai_main.h. Referenced by BotAIRegularUpdate(), and BotAISetupClient(). |
|
|
Definition at line 41 of file ai_main.h. Referenced by PassStandardEnemyChecks(). |
|
|
Definition at line 42 of file ai_main.h. Referenced by BotIsAChickenWuss(). |
|
|
Definition at line 40 of file ai_main.h. Referenced by LoadPath_ThisLevel(), and StandardBotAI(). |
|
|
|
|
|
Definition at line 10 of file ai_main.h. Referenced by BotDoChat(), BotUtilizePersonality(), and ReadChatGroups(). |
|
|
Definition at line 12 of file ai_main.h. Referenced by BotDoChat(). |
|
|
Definition at line 53 of file ai_main.h. Referenced by BotIsAChickenWuss(). |
|
|
|
|
|
Definition at line 17 of file ai_main.h. Referenced by ParseEmotionalAttachments(). |
|
|
Definition at line 15 of file ai_main.h. Referenced by ConnectTrail(), and G_RMGPathing(). |
|
|
Definition at line 51 of file ai_main.h. Referenced by CombatBotAI(), and StandardBotAI(). |
|
|
Definition at line 52 of file ai_main.h. Referenced by CombatBotAI(), and StandardBotAI(). |
|
|
Definition at line 14 of file ai_main.h. Referenced by ConnectTrail(). |
|
|
Definition at line 44 of file ai_main.h. Referenced by GetNewFlagPoint(). |
|
|
Definition at line 32 of file ai_main.h. Referenced by CreateNewWP_FromObject(), FlagObjects(), GetFlagStr(), PassWayCheck(), and StandardBotAI(). |
|
|
Definition at line 37 of file ai_main.h. Referenced by ConnectTrail(), and RepairPaths(). |
|
|
Definition at line 23 of file ai_main.h. Referenced by AcceptBotCommand(), GetFlagStr(), and WPConstantRoutine(). |
|
|
Definition at line 30 of file ai_main.h. Referenced by AcceptBotCommand(), CalculateWeightGoals(), GetBestIdleGoal(), and GetFlagStr(). |
|
|
Definition at line 22 of file ai_main.h. Referenced by AcceptBotCommand(), CalculateJumpRoutes(), GetFlagStr(), RepairPaths(), WPConstantRoutine(), and WPTouchRoutine(). |
|
|
Definition at line 38 of file ai_main.h. Referenced by ConnectTrail(), and G_RMGPathing(). |
|
|
Definition at line 35 of file ai_main.h. Referenced by AcceptBotCommand(), GetFlagStr(), StandardBotAI(), and WPTouchRoutine(). |
|
|
Definition at line 24 of file ai_main.h. Referenced by AcceptBotCommand(), GetFlagStr(), RepairPaths(), and StandardBotAI(). |
|
|
Definition at line 29 of file ai_main.h. Referenced by AcceptBotCommand(), ConnectTrail(), GetFlagStr(), OpposingEnds(), PassWayCheck(), and TotalTrailDistance(). |
|
|
Definition at line 28 of file ai_main.h. Referenced by AcceptBotCommand(), ConnectTrail(), GetFlagStr(), OpposingEnds(), PassWayCheck(), and TotalTrailDistance(). |
|
|
Definition at line 31 of file ai_main.h. Referenced by CreateNewWP_FromObject(), FlagObjects(), GetFlagStr(), PassWayCheck(), and StandardBotAI(). |
|
|
Definition at line 34 of file ai_main.h. Referenced by CalculateSiegeGoals(), GetFlagStr(), and SiegeTakesPriority(). |
|
|
Definition at line 33 of file ai_main.h. Referenced by CalculateSiegeGoals(), GetFlagStr(), and SiegeTakesPriority(). |
|
|
Definition at line 27 of file ai_main.h. Referenced by AcceptBotCommand(), GetFlagStr(), and WPTouchRoutine(). |
|
|
Definition at line 25 of file ai_main.h. Referenced by AcceptBotCommand(), GetFlagStr(), and WPTouchRoutine(). |
|
|
Definition at line 26 of file ai_main.h. Referenced by AcceptBotCommand(), GetFlagStr(), and StandardBotAI(). |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Definition at line 81 of file ai_main.h.
00082 {
00083 CTFSTATE_NONE,
00084 CTFSTATE_ATTACKER,
00085 CTFSTATE_DEFENDER,
00086 CTFSTATE_RETRIEVAL,
00087 CTFSTATE_GUARDCARRIER,
00088 CTFSTATE_GETFLAGHOME,
00089 CTFSTATE_MAXCTFSTATES
00090 } bot_ctf_state_t;
|
|
|
Definition at line 92 of file ai_main.h.
00093 {
00094 SIEGESTATE_NONE,
00095 SIEGESTATE_ATTACKER,
00096 SIEGESTATE_DEFENDER,
00097 SIEGESTATE_MAXSIEGESTATES
00098 } bot_siege_state_t;
|
|
|
Definition at line 100 of file ai_main.h.
00101 {
00102 TEAMPLAYSTATE_NONE,
00103 TEAMPLAYSTATE_FOLLOWING,
00104 TEAMPLAYSTATE_ASSISTING,
00105 TEAMPLAYSTATE_REGROUP,
00106 TEAMPLAYSTATE_MAXTPSTATES
00107 } bot_teamplay_state_t;
|
|
|
Definition at line 25 of file ai_util.c. References BG_Alloc(), G_Printf(), and NULL. Referenced by BotAISetupClient(), CreateNewWP(), CreateNewWP_FromObject(), CreateNewWP_InsertUnder(), CreateNewWP_InTrail(), and TransferWPData().
00026 {
00027 #ifdef BOT_ZMALLOC
00028 void *ptr = NULL;
00029 int i = 0;
00030
00031 #ifdef BOTMEMTRACK
00032 int free = 0;
00033 int used = 0;
00034
00035 while (i < MAX_BALLOC)
00036 {
00037 if (!BAllocList[i])
00038 {
00039 free++;
00040 }
00041 else
00042 {
00043 used++;
00044 }
00045
00046 i++;
00047 }
00048
00049 G_Printf("Allocations used: %i\nFree allocation slots: %i\n", used, free);
00050
00051 i = 0;
00052 #endif
00053
00054 ptr = trap_BotGetMemoryGame(size);
00055
00056 while (i < MAX_BALLOC)
00057 {
00058 if (!BAllocList[i])
00059 {
00060 BAllocList[i] = ptr;
00061 break;
00062 }
00063 i++;
00064 }
00065
00066 if (i == MAX_BALLOC)
00067 {
00068 //If this happens we'll have to rely on this chunk being freed manually with B_Free, which it hopefully will be
00069 #ifdef DEBUG
00070 G_Printf("WARNING: MAXIMUM B_ALLOC ALLOCATIONS EXCEEDED\n");
00071 #endif
00072 }
00073
00074 return ptr;
00075 #else
00076
00077 return BG_Alloc(size);
00078
00079 #endif
00080 }
|
|
|
Definition at line 82 of file ai_util.c. References G_Printf(), and NULL.
00083 {
00084 #ifdef BOT_ZMALLOC
00085 int i = 0;
00086
00087 #ifdef BOTMEMTRACK
00088 int free = 0;
00089 int used = 0;
00090
00091 while (i < MAX_BALLOC)
00092 {
00093 if (!BAllocList[i])
00094 {
00095 free++;
00096 }
00097 else
00098 {
00099 used++;
00100 }
00101
00102 i++;
00103 }
00104
00105 G_Printf("Allocations used: %i\nFree allocation slots: %i\n", used, free);
00106
00107 i = 0;
00108 #endif
00109
00110 while (i < MAX_BALLOC)
00111 {
00112 if (BAllocList[i] == ptr)
00113 {
00114 BAllocList[i] = NULL;
00115 break;
00116 }
00117
00118 i++;
00119 }
00120
00121 if (i == MAX_BALLOC)
00122 {
00123 //Likely because the limit was exceeded and we're now freeing the chunk manually as we hoped would happen
00124 #ifdef DEBUG
00125 G_Printf("WARNING: Freeing allocation which is not in the allocation structure\n");
00126 #endif
00127 }
00128
00129 trap_BotFreeMemoryGame(ptr);
00130 #endif
00131 }
|
|
|
Definition at line 14 of file ai_util.c. References BG_TempAlloc(). Referenced by BotDoChat(), BotUtilizePersonality(), GetFlagStr(), LoadPathData(), and SavePathData().
00015 {
00016 return BG_TempAlloc(size);
00017 }
|
|
|
Definition at line 19 of file ai_util.c. References BG_TempFree(). Referenced by BotDoChat(), BotUtilizePersonality(), BotWaypointRender(), LoadPathData(), and SavePathData().
00020 {
00021 BG_TempFree(size);
00022 }
|
|
||||||||||||||||
|
Definition at line 328 of file ai_util.c. References B_TempAlloc(), B_TempFree(), bot_state_t, bot_state_s::canChat, bot_state_s::chatAltObject, bot_state_s::chatFrequency, bot_state_s::chatObject, bot_state_s::chatTeam, bot_state_s::chatTime, bot_state_s::chatTime_stored, bot_state_s::client, gentity_s::client, bot_state_s::currentChat, bot_state_s::doChat, gBotChatBuffer, gentity_t, GetValueGroup(), level, MAX_CHAT_BUFFER_SIZE, MAX_CHAT_LINE_SIZE, clientPersistant_t::netname, NULL, gclient_s::pers, Q_irand(), strcmp(), strlen(), level_locals_t::time, and trap_Cvar_VariableIntegerValue(). Referenced by BotAISetupClient(), BotLovedOneDied(), BotOrder(), BotReplyGreetings(), and StandardBotAI().
00329 {
00330 char *chatgroup;
00331 int rVal;
00332 int inc_1;
00333 int inc_2;
00334 int inc_n;
00335 int lines;
00336 int checkedline;
00337 int getthisline;
00338 gentity_t *cobject;
00339
00340 if (!bs->canChat)
00341 {
00342 return 0;
00343 }
00344
00345 if (bs->doChat)
00346 { //already have a chat scheduled
00347 return 0;
00348 }
00349
00350 if (trap_Cvar_VariableIntegerValue("se_language"))
00351 { //no chatting unless English.
00352 return 0;
00353 }
00354
00355 if (Q_irand(1, 10) > bs->chatFrequency && !always)
00356 {
00357 return 0;
00358 }
00359
00360 bs->chatTeam = 0;
00361
00362 chatgroup = (char *)B_TempAlloc(MAX_CHAT_BUFFER_SIZE);
00363
00364 rVal = GetValueGroup(gBotChatBuffer[bs->client], section, chatgroup);
00365
00366 if (!rVal) //the bot has no group defined for the specified chat event
00367 {
00368 B_TempFree(MAX_CHAT_BUFFER_SIZE); //chatgroup
00369 return 0;
00370 }
00371
00372 inc_1 = 0;
00373 inc_2 = 2;
00374
00375 while (chatgroup[inc_2] && chatgroup[inc_2] != '\0')
00376 {
00377 if (chatgroup[inc_2] != 13 && chatgroup[inc_2] != 9)
00378 {
00379 chatgroup[inc_1] = chatgroup[inc_2];
00380 inc_1++;
00381 }
00382 inc_2++;
00383 }
00384 chatgroup[inc_1] = '\0';
00385
00386 inc_1 = 0;
00387
00388 lines = 0;
00389
00390 while (chatgroup[inc_1] && chatgroup[inc_1] != '\0')
00391 {
00392 if (chatgroup[inc_1] == '\n')
00393 {
00394 lines++;
00395 }
00396 inc_1++;
00397 }
00398
00399 if (!lines)
00400 {
00401 B_TempFree(MAX_CHAT_BUFFER_SIZE); //chatgroup
00402 return 0;
00403 }
00404
00405 getthisline = Q_irand(0, (lines+1));
00406
00407 if (getthisline < 1)
00408 {
00409 getthisline = 1;
00410 }
00411 if (getthisline > lines)
00412 {
00413 getthisline = lines;
00414 }
00415
00416 checkedline = 1;
00417
00418 inc_1 = 0;
00419
00420 while (checkedline != getthisline)
00421 {
00422 if (chatgroup[inc_1] && chatgroup[inc_1] != '\0')
00423 {
00424 if (chatgroup[inc_1] == '\n')
00425 {
00426 inc_1++;
00427 checkedline++;
00428 }
00429 }
00430
00431 if (checkedline == getthisline)
00432 {
00433 break;
00434 }
00435
00436 inc_1++;
00437 }
00438
00439 //we're at the starting position of the desired line here
00440 inc_2 = 0;
00441
00442 while (chatgroup[inc_1] != '\n')
00443 {
00444 chatgroup[inc_2] = chatgroup[inc_1];
00445 inc_2++;
00446 inc_1++;
00447 }
00448 chatgroup[inc_2] = '\0';
00449
00450 //trap_EA_Say(bs->client, chatgroup);
00451 inc_1 = 0;
00452 inc_2 = 0;
00453
00454 if (strlen(chatgroup) > MAX_CHAT_LINE_SIZE)
00455 {
00456 B_TempFree(MAX_CHAT_BUFFER_SIZE); //chatgroup
00457 return 0;
00458 }
00459
00460 while (chatgroup[inc_1])
00461 {
00462 if (chatgroup[inc_1] == '%' && chatgroup[inc_1+1] != '%')
00463 {
00464 inc_1++;
00465
00466 if (chatgroup[inc_1] == 's' && bs->chatObject)
00467 {
00468 cobject = bs->chatObject;
00469 }
00470 else if (chatgroup[inc_1] == 'a' && bs->chatAltObject)
00471 {
00472 cobject = bs->chatAltObject;
00473 }
00474 else
00475 {
00476 cobject = NULL;
00477 }
00478
00479 if (cobject && cobject->client)
00480 {
00481 inc_n = 0;
00482
00483 while (cobject->client->pers.netname[inc_n])
00484 {
00485 bs->currentChat[inc_2] = cobject->client->pers.netname[inc_n];
00486 inc_2++;
00487 inc_n++;
00488 }
00489 inc_2--; //to make up for the auto-increment below
00490 }
00491 }
00492 else
00493 {
00494 bs->currentChat[inc_2] = chatgroup[inc_1];
00495 }
00496 inc_2++;
00497 inc_1++;
00498 }
00499 bs->currentChat[inc_2] = '\0';
00500
00501 if (strcmp(section, "GeneralGreetings") == 0)
00502 {
00503 bs->doChat = 2;
00504 }
00505 else
00506 {
00507 bs->doChat = 1;
00508 }
00509 bs->chatTime_stored = (strlen(bs->currentChat)*45)+Q_irand(1300, 1500);
00510 bs->chatTime = level.time + bs->chatTime_stored;
00511
00512 B_TempFree(MAX_CHAT_BUFFER_SIZE); //chatgroup
00513
00514 return 1;
00515 }
|
|
|
Definition at line 2301 of file ai_main.c. References BOT_RUN_HEALTH, bot_state_t, BotGetWeaponRange(), BWEAPONRANGE_MELEE, BWEAPONRANGE_SABER, bot_state_s::chickenWussCalculationTime, bot_state_s::client, gentity_s::client, bot_state_s::cur_ps, bot_state_s::currentEnemy, playerState_s::electrifyTime, playerState_s::fd, forcedata_s::forcePowersActive, FP_RAGE, bot_state_s::frame_Enemy_Len, g_entities, g_gametype, gLevelFlags, GT_CTF, GT_JEDIMASTER, GT_SINGLE_PLAYER, gentity_s::health, vmCvar_t::integer, playerState_s::isJediMaster, level, LEVELFLAG_IMUSTNTRUNAWAY, MAX_CHICKENWUSS_TIME, playerState_s::powerups, gclient_s::ps, PW_BLUEFLAG, PW_REDFLAG, bot_state_s::saberSpecialist, level_locals_t::time, playerState_s::weapon, WP_BRYAR_PISTOL, WP_ROCKET_LAUNCHER, and WP_SABER. Referenced by GetIdealDestination(), and WPTouchRoutine().
02302 {
02303 int bWRange;
02304
02305 if (gLevelFlags & LEVELFLAG_IMUSTNTRUNAWAY)
02306 { //The level says we mustn't run away!
02307 return 0;
02308 }
02309
02310 if (g_gametype.integer == GT_SINGLE_PLAYER)
02311 { //"coop" (not really)
02312 return 0;
02313 }
02314
02315 if (g_gametype.integer == GT_JEDIMASTER && !bs->cur_ps.isJediMaster)
02316 { //Then you may know no fear.
02317 //Well, unless he's strong.
02318 if (bs->currentEnemy && bs->currentEnemy->client &&
02319 bs->currentEnemy->client->ps.isJediMaster &&
02320 bs->currentEnemy->health > 40 &&
02321 bs->cur_ps.weapon < WP_ROCKET_LAUNCHER)
02322 { //explosive weapons are most effective against the Jedi Master
02323 goto jmPass;
02324 }
02325 return 0;
02326 }
02327
02328 if (g_gametype.integer == GT_CTF && bs->currentEnemy && bs->currentEnemy->client)
02329 {
02330 if (bs->currentEnemy->client->ps.powerups[PW_REDFLAG] ||
02331 bs->currentEnemy->client->ps.powerups[PW_BLUEFLAG])
02332 { //don't be afraid of flag carriers, they must die!
02333 return 0;
02334 }
02335 }
02336
02337 jmPass:
02338 if (bs->chickenWussCalculationTime > level.time)
02339 {
02340 return 2; //don't want to keep going between two points...
02341 }
02342
02343 if (bs->cur_ps.fd.forcePowersActive & (1 << FP_RAGE))
02344 { //don't run while raging
02345 return 0;
02346 }
02347
02348 if (g_gametype.integer == GT_JEDIMASTER && !bs->cur_ps.isJediMaster)
02349 { //be frightened of the jedi master? I guess in this case.
02350 return 1;
02351 }
02352
02353 bs->chickenWussCalculationTime = level.time + MAX_CHICKENWUSS_TIME;
02354
02355 if (g_entities[bs->client].health < BOT_RUN_HEALTH)
02356 { //we're low on health, let's get away
02357 return 1;
02358 }
02359
02360 bWRange = BotGetWeaponRange(bs);
02361
02362 if (bWRange == BWEAPONRANGE_MELEE || bWRange == BWEAPONRANGE_SABER)
02363 {
02364 if (bWRange != BWEAPONRANGE_SABER || !bs->saberSpecialist)
02365 { //run away if we're using melee, or if we're using a saber and not a "saber specialist"
02366 return 1;
02367 }
02368 }
02369
02370 if (bs->cur_ps.weapon == WP_BRYAR_PISTOL)
02371 { //the bryar is a weak weapon, so just try to find a new one if it's what you're having to use
02372 return 1;
02373 }
02374
02375 if (bs->currentEnemy && bs->currentEnemy->client &&
02376 bs->currentEnemy->client->ps.weapon == WP_SABER &&
02377 bs->frame_Enemy_Len < 512 && bs->cur_ps.weapon != WP_SABER)
02378 { //if close to an enemy with a saber and not using a saber, then try to back off
02379 return 1;
02380 }
02381
02382 if ((level.time-bs->cur_ps.electrifyTime) < 16000)
02383 { //lightning is dangerous.
02384 return 1;
02385 }
02386
02387 //didn't run, reset the timer
02388 bs->chickenWussCalculationTime = 0;
02389
02390 return 0;
02391 }
|
|
|
Definition at line 924 of file ai_main.c. References bot_settings_t, bot_state_t, bot_state_s::client, client, bot_state_s::cur_ps, bot_state_s::entergame_time, bot_state_s::entitynum, bot_state_s::gs, bot_state_s::inuse, memcpy(), memset(), bot_state_s::ms, playerState_t, bot_state_s::settings, trap_BotResetAvoidGoals(), trap_BotResetAvoidReach(), trap_BotResetGoalState(), trap_BotResetMoveState(), trap_BotResetWeaponState(), and bot_state_s::ws. Referenced by BotAILoadMap().
00924 {
00925 int client, entitynum, inuse;
00926 int movestate, goalstate, weaponstate;
00927 bot_settings_t settings;
00928 playerState_t ps; //current player state
00929 float entergame_time;
00930
00931 //save some things that should not be reset here
00932 memcpy(&settings, &bs->settings, sizeof(bot_settings_t));
00933 memcpy(&ps, &bs->cur_ps, sizeof(playerState_t));
00934 inuse = bs->inuse;
00935 client = bs->client;
00936 entitynum = bs->entitynum;
00937 movestate = bs->ms;
00938 goalstate = bs->gs;
00939 weaponstate = bs-> |