mirror of
https://github.com/UberGames/rpgxEF.git
synced 2024-11-10 07:11:34 +00:00
moved function declarations and updated code of ai_main
This commit is contained in:
parent
bb08b42f1c
commit
881df8c239
15 changed files with 1128 additions and 819 deletions
|
@ -103,7 +103,7 @@ static int32_t BotIsFirstInRankings(bot_state_t* bs) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
BotAI_GetClientState(i, &ps);
|
AI_main_BotAIGetClientState(i, &ps);
|
||||||
if (score < ps.persistant[PERS_SCORE]) {
|
if (score < ps.persistant[PERS_SCORE]) {
|
||||||
return qfalse;
|
return qfalse;
|
||||||
}
|
}
|
||||||
|
@ -142,7 +142,7 @@ static int32_t BotIsLastInRankings(bot_state_t* bs) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
BotAI_GetClientState(i, &ps);
|
AI_main_BotAIGetClientState(i, &ps);
|
||||||
if (score > ps.persistant[PERS_SCORE]) {
|
if (score > ps.persistant[PERS_SCORE]) {
|
||||||
return qfalse;
|
return qfalse;
|
||||||
}
|
}
|
||||||
|
@ -182,7 +182,7 @@ static char* BotFirstClientInRankings(void) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
BotAI_GetClientState(i, &ps);
|
AI_main_BotAIGetClientState(i, &ps);
|
||||||
if (ps.persistant[PERS_SCORE] > bestscore) {
|
if (ps.persistant[PERS_SCORE] > bestscore) {
|
||||||
bestscore = ps.persistant[PERS_SCORE];
|
bestscore = ps.persistant[PERS_SCORE];
|
||||||
bestclient = i;
|
bestclient = i;
|
||||||
|
@ -224,7 +224,7 @@ static char* BotLastClientInRankings(void) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
BotAI_GetClientState(i, &ps);
|
AI_main_BotAIGetClientState(i, &ps);
|
||||||
if (ps.persistant[PERS_SCORE] < worstscore) {
|
if (ps.persistant[PERS_SCORE] < worstscore) {
|
||||||
worstscore = ps.persistant[PERS_SCORE];
|
worstscore = ps.persistant[PERS_SCORE];
|
||||||
bestclient = i;
|
bestclient = i;
|
||||||
|
@ -388,7 +388,7 @@ static int32_t BotVisibleEnemies(bot_state_t* bs) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
BotEntityInfo(i, &entinfo);
|
AI_main_BotEntityInfo(i, &entinfo);
|
||||||
|
|
||||||
if (entinfo.valid == 0) {
|
if (entinfo.valid == 0) {
|
||||||
continue;
|
continue;
|
||||||
|
@ -467,7 +467,7 @@ int BotValidChatPosition(bot_state_t* bs) {
|
||||||
start[2] += 1;
|
start[2] += 1;
|
||||||
end[2] -= 10;
|
end[2] -= 10;
|
||||||
trap_AAS_PresenceTypeBoundingBox(PRESENCE_CROUCH, mins, maxs);
|
trap_AAS_PresenceTypeBoundingBox(PRESENCE_CROUCH, mins, maxs);
|
||||||
BotAI_Trace(&trace, start, mins, maxs, end, bs->client, MASK_SOLID);
|
AI_main_BotAITrace(&trace, start, mins, maxs, end, bs->client, MASK_SOLID);
|
||||||
|
|
||||||
if (trace.ent != ENTITYNUM_WORLD) {
|
if (trace.ent != ENTITYNUM_WORLD) {
|
||||||
return qfalse;
|
return qfalse;
|
||||||
|
@ -511,7 +511,7 @@ int32_t BotChat_EnterGame(bot_state_t* bs) {
|
||||||
if (BotValidChatPosition(bs) == 0) {
|
if (BotValidChatPosition(bs) == 0) {
|
||||||
return qfalse;
|
return qfalse;
|
||||||
}
|
}
|
||||||
BotAI_BotInitialChat(bs, "game_enter",
|
AI_main_BotAIInitialChat(bs, "game_enter",
|
||||||
EasyClientName(bs->client, name, 32), // 0
|
EasyClientName(bs->client, name, 32), // 0
|
||||||
BotRandomOpponentName(bs), // 1
|
BotRandomOpponentName(bs), // 1
|
||||||
"[invalid var]", // 2
|
"[invalid var]", // 2
|
||||||
|
@ -556,7 +556,7 @@ int32_t BotChat_ExitGame(bot_state_t* bs) {
|
||||||
return qfalse;
|
return qfalse;
|
||||||
}
|
}
|
||||||
|
|
||||||
BotAI_BotInitialChat(bs, "game_exit",
|
AI_main_BotAIInitialChat(bs, "game_exit",
|
||||||
EasyClientName(bs->client, name, 32), // 0
|
EasyClientName(bs->client, name, 32), // 0
|
||||||
BotRandomOpponentName(bs), // 1
|
BotRandomOpponentName(bs), // 1
|
||||||
"[invalid var]", // 2
|
"[invalid var]", // 2
|
||||||
|
@ -604,7 +604,7 @@ int32_t BotChat_StartLevel(bot_state_t* bs) {
|
||||||
if (BotNumActivePlayers() <= 1) {
|
if (BotNumActivePlayers() <= 1) {
|
||||||
return qfalse;
|
return qfalse;
|
||||||
}
|
}
|
||||||
BotAI_BotInitialChat(bs, "level_start",
|
AI_main_BotAIInitialChat(bs, "level_start",
|
||||||
EasyClientName(bs->client, name, 32), // 0
|
EasyClientName(bs->client, name, 32), // 0
|
||||||
NULL);
|
NULL);
|
||||||
bs->lastchat_time = trap_AAS_Time();
|
bs->lastchat_time = trap_AAS_Time();
|
||||||
|
@ -650,7 +650,7 @@ int32_t BotChat_EndLevel(bot_state_t* bs) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (BotIsFirstInRankings(bs) != 0) {
|
if (BotIsFirstInRankings(bs) != 0) {
|
||||||
BotAI_BotInitialChat(bs, "level_end_victory",
|
AI_main_BotAIInitialChat(bs, "level_end_victory",
|
||||||
EasyClientName(bs->client, name, 32), // 0
|
EasyClientName(bs->client, name, 32), // 0
|
||||||
BotRandomOpponentName(bs), // 1
|
BotRandomOpponentName(bs), // 1
|
||||||
"[invalid var]", // 2
|
"[invalid var]", // 2
|
||||||
|
@ -658,7 +658,7 @@ int32_t BotChat_EndLevel(bot_state_t* bs) {
|
||||||
BotMapTitle(), // 4
|
BotMapTitle(), // 4
|
||||||
NULL);
|
NULL);
|
||||||
} else if (BotIsLastInRankings(bs) != 0) {
|
} else if (BotIsLastInRankings(bs) != 0) {
|
||||||
BotAI_BotInitialChat(bs, "level_end_lose",
|
AI_main_BotAIInitialChat(bs, "level_end_lose",
|
||||||
EasyClientName(bs->client, name, 32), // 0
|
EasyClientName(bs->client, name, 32), // 0
|
||||||
BotRandomOpponentName(bs), // 1
|
BotRandomOpponentName(bs), // 1
|
||||||
BotFirstClientInRankings(), // 2
|
BotFirstClientInRankings(), // 2
|
||||||
|
@ -666,7 +666,7 @@ int32_t BotChat_EndLevel(bot_state_t* bs) {
|
||||||
BotMapTitle(), // 4
|
BotMapTitle(), // 4
|
||||||
NULL);
|
NULL);
|
||||||
} else {
|
} else {
|
||||||
BotAI_BotInitialChat(bs, "level_end",
|
AI_main_BotAIInitialChat(bs, "level_end",
|
||||||
EasyClientName(bs->client, name, 32), // 0
|
EasyClientName(bs->client, name, 32), // 0
|
||||||
BotRandomOpponentName(bs), // 1
|
BotRandomOpponentName(bs), // 1
|
||||||
BotFirstClientInRankings(), // 2
|
BotFirstClientInRankings(), // 2
|
||||||
|
@ -719,7 +719,7 @@ int32_t BotChat_Death(bot_state_t* bs) {
|
||||||
return qfalse;
|
return qfalse;
|
||||||
}
|
}
|
||||||
|
|
||||||
BotAI_BotInitialChat(bs, "death_teammate", name, NULL);
|
AI_main_BotAIInitialChat(bs, "death_teammate", name, NULL);
|
||||||
bs->chatto = CHAT_TEAM;
|
bs->chatto = CHAT_TEAM;
|
||||||
} else {
|
} else {
|
||||||
//don't chat in teamplay
|
//don't chat in teamplay
|
||||||
|
@ -728,13 +728,13 @@ int32_t BotChat_Death(bot_state_t* bs) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bs->botdeathtype == MOD_WATER) {
|
if (bs->botdeathtype == MOD_WATER) {
|
||||||
BotAI_BotInitialChat(bs, "death_drown", BotRandomOpponentName(bs), NULL);
|
AI_main_BotAIInitialChat(bs, "death_drown", BotRandomOpponentName(bs), NULL);
|
||||||
} else if (bs->botdeathtype == MOD_SLIME) {
|
} else if (bs->botdeathtype == MOD_SLIME) {
|
||||||
BotAI_BotInitialChat(bs, "death_slime", BotRandomOpponentName(bs), NULL);
|
AI_main_BotAIInitialChat(bs, "death_slime", BotRandomOpponentName(bs), NULL);
|
||||||
} else if (bs->botdeathtype == MOD_LAVA) {
|
} else if (bs->botdeathtype == MOD_LAVA) {
|
||||||
BotAI_BotInitialChat(bs, "death_lava", BotRandomOpponentName(bs), NULL);
|
AI_main_BotAIInitialChat(bs, "death_lava", BotRandomOpponentName(bs), NULL);
|
||||||
} else if (bs->botdeathtype == MOD_FALLING) {
|
} else if (bs->botdeathtype == MOD_FALLING) {
|
||||||
BotAI_BotInitialChat(bs, "death_cratered", BotRandomOpponentName(bs), NULL);
|
AI_main_BotAIInitialChat(bs, "death_cratered", BotRandomOpponentName(bs), NULL);
|
||||||
} else if (bs->botsuicide || //all other suicides by own weapon
|
} else if (bs->botsuicide || //all other suicides by own weapon
|
||||||
bs->botdeathtype == MOD_CRUSH ||
|
bs->botdeathtype == MOD_CRUSH ||
|
||||||
bs->botdeathtype == MOD_SUICIDE ||
|
bs->botdeathtype == MOD_SUICIDE ||
|
||||||
|
@ -743,17 +743,17 @@ int32_t BotChat_Death(bot_state_t* bs) {
|
||||||
bs->botdeathtype == MOD_TRIGGER_HURT ||
|
bs->botdeathtype == MOD_TRIGGER_HURT ||
|
||||||
bs->botdeathtype == MOD_UNKNOWN ||
|
bs->botdeathtype == MOD_UNKNOWN ||
|
||||||
bs->botdeathtype == MOD_EXPLOSION)
|
bs->botdeathtype == MOD_EXPLOSION)
|
||||||
BotAI_BotInitialChat(bs, "death_suicide", BotRandomOpponentName(bs), NULL);
|
AI_main_BotAIInitialChat(bs, "death_suicide", BotRandomOpponentName(bs), NULL);
|
||||||
else if (bs->botdeathtype == MOD_TELEFRAG) {
|
else if (bs->botdeathtype == MOD_TELEFRAG) {
|
||||||
BotAI_BotInitialChat(bs, "death_telefrag", name, NULL);
|
AI_main_BotAIInitialChat(bs, "death_telefrag", name, NULL);
|
||||||
} else {
|
} else {
|
||||||
if (random() < trap_Characteristic_BFloat(bs->character, CHARACTERISTIC_CHAT_INSULT, 0, 1)) {
|
if (random() < trap_Characteristic_BFloat(bs->character, CHARACTERISTIC_CHAT_INSULT, 0, 1)) {
|
||||||
BotAI_BotInitialChat(bs, "death_insult",
|
AI_main_BotAIInitialChat(bs, "death_insult",
|
||||||
name, // 0
|
name, // 0
|
||||||
BotWeaponNameForMeansOfDeath(bs->botdeathtype), // 1
|
BotWeaponNameForMeansOfDeath(bs->botdeathtype), // 1
|
||||||
NULL);
|
NULL);
|
||||||
} else {
|
} else {
|
||||||
BotAI_BotInitialChat(bs, "death_praise",
|
AI_main_BotAIInitialChat(bs, "death_praise",
|
||||||
name, // 0
|
name, // 0
|
||||||
BotWeaponNameForMeansOfDeath(bs->botdeathtype), // 1
|
BotWeaponNameForMeansOfDeath(bs->botdeathtype), // 1
|
||||||
NULL);
|
NULL);
|
||||||
|
@ -810,18 +810,18 @@ int32_t BotChat_Kill(bot_state_t* bs) {
|
||||||
|
|
||||||
bs->chatto = CHAT_ALL;
|
bs->chatto = CHAT_ALL;
|
||||||
if (TeamPlayIsOn() != 0 && BotSameTeam(bs, bs->lastkilledplayer) != 0) {
|
if (TeamPlayIsOn() != 0 && BotSameTeam(bs, bs->lastkilledplayer) != 0) {
|
||||||
BotAI_BotInitialChat(bs, "kill_teammate", name, NULL);
|
AI_main_BotAIInitialChat(bs, "kill_teammate", name, NULL);
|
||||||
bs->chatto = CHAT_TEAM;
|
bs->chatto = CHAT_TEAM;
|
||||||
} else {
|
} else {
|
||||||
//don't chat in teamplay
|
//don't chat in teamplay
|
||||||
if (TeamPlayIsOn() != 0) {
|
if (TeamPlayIsOn() != 0) {
|
||||||
return qfalse;
|
return qfalse;
|
||||||
} else if (bs->enemydeathtype == MOD_TELEFRAG) {
|
} else if (bs->enemydeathtype == MOD_TELEFRAG) {
|
||||||
BotAI_BotInitialChat(bs, "kill_telefrag", name, NULL);
|
AI_main_BotAIInitialChat(bs, "kill_telefrag", name, NULL);
|
||||||
} else if (random() < trap_Characteristic_BFloat(bs->character, CHARACTERISTIC_CHAT_INSULT, 0, 1)) { //choose between insult and praise
|
} else if (random() < trap_Characteristic_BFloat(bs->character, CHARACTERISTIC_CHAT_INSULT, 0, 1)) { //choose between insult and praise
|
||||||
BotAI_BotInitialChat(bs, "kill_insult", name, NULL);
|
AI_main_BotAIInitialChat(bs, "kill_insult", name, NULL);
|
||||||
} else {
|
} else {
|
||||||
BotAI_BotInitialChat(bs, "kill_praise", name, NULL);
|
AI_main_BotAIInitialChat(bs, "kill_praise", name, NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
bs->lastchat_time = trap_AAS_Time();
|
bs->lastchat_time = trap_AAS_Time();
|
||||||
|
@ -874,7 +874,7 @@ int32_t BotChat_EnemySuicide(bot_state_t* bs) {
|
||||||
} else {
|
} else {
|
||||||
strcpy(name, "");
|
strcpy(name, "");
|
||||||
}
|
}
|
||||||
BotAI_BotInitialChat(bs, "enemy_suicide", name, NULL);
|
AI_main_BotAIInitialChat(bs, "enemy_suicide", name, NULL);
|
||||||
bs->lastchat_time = trap_AAS_Time();
|
bs->lastchat_time = trap_AAS_Time();
|
||||||
bs->chatto = CHAT_ALL;
|
bs->chatto = CHAT_ALL;
|
||||||
|
|
||||||
|
@ -935,7 +935,7 @@ int32_t BotChat_HitTalking(bot_state_t* bs) {
|
||||||
ClientName(g_entities[bs->client].client->lasthurt_client, name, sizeof(name));
|
ClientName(g_entities[bs->client].client->lasthurt_client, name, sizeof(name));
|
||||||
weap = BotWeaponNameForMeansOfDeath(g_entities[bs->client].client->lasthurt_client);
|
weap = BotWeaponNameForMeansOfDeath(g_entities[bs->client].client->lasthurt_client);
|
||||||
|
|
||||||
BotAI_BotInitialChat(bs, "hit_talking", name, weap, NULL);
|
AI_main_BotAIInitialChat(bs, "hit_talking", name, weap, NULL);
|
||||||
bs->lastchat_time = trap_AAS_Time();
|
bs->lastchat_time = trap_AAS_Time();
|
||||||
bs->chatto = CHAT_ALL;
|
bs->chatto = CHAT_ALL;
|
||||||
|
|
||||||
|
@ -998,7 +998,7 @@ int32_t BotChat_HitNoDeath(bot_state_t* bs) {
|
||||||
return qfalse;
|
return qfalse;
|
||||||
}
|
}
|
||||||
|
|
||||||
BotEntityInfo(bs->enemy, &entinfo);
|
AI_main_BotEntityInfo(bs->enemy, &entinfo);
|
||||||
if (EntityIsShooting(&entinfo)) {
|
if (EntityIsShooting(&entinfo)) {
|
||||||
return qfalse;
|
return qfalse;
|
||||||
}
|
}
|
||||||
|
@ -1006,7 +1006,7 @@ int32_t BotChat_HitNoDeath(bot_state_t* bs) {
|
||||||
ClientName(lasthurt_client, name, sizeof(name));
|
ClientName(lasthurt_client, name, sizeof(name));
|
||||||
weap = BotWeaponNameForMeansOfDeath(g_entities[bs->client].client->lasthurt_mod);
|
weap = BotWeaponNameForMeansOfDeath(g_entities[bs->client].client->lasthurt_mod);
|
||||||
|
|
||||||
BotAI_BotInitialChat(bs, "hit_nodeath", name, weap, NULL);
|
AI_main_BotAIInitialChat(bs, "hit_nodeath", name, weap, NULL);
|
||||||
bs->lastchat_time = trap_AAS_Time();
|
bs->lastchat_time = trap_AAS_Time();
|
||||||
bs->chatto = CHAT_ALL;
|
bs->chatto = CHAT_ALL;
|
||||||
|
|
||||||
|
@ -1056,7 +1056,7 @@ int32_t BotChat_HitNoKill(bot_state_t* bs) {
|
||||||
return qfalse;
|
return qfalse;
|
||||||
}
|
}
|
||||||
|
|
||||||
BotEntityInfo(bs->enemy, &entinfo);
|
AI_main_BotEntityInfo(bs->enemy, &entinfo);
|
||||||
if (EntityIsShooting(&entinfo)) {
|
if (EntityIsShooting(&entinfo)) {
|
||||||
return qfalse;
|
return qfalse;
|
||||||
}
|
}
|
||||||
|
@ -1064,7 +1064,7 @@ int32_t BotChat_HitNoKill(bot_state_t* bs) {
|
||||||
ClientName(bs->enemy, name, sizeof(name));
|
ClientName(bs->enemy, name, sizeof(name));
|
||||||
weap = BotWeaponNameForMeansOfDeath(g_entities[bs->enemy].client->lasthurt_mod);
|
weap = BotWeaponNameForMeansOfDeath(g_entities[bs->enemy].client->lasthurt_mod);
|
||||||
|
|
||||||
BotAI_BotInitialChat(bs, "hit_nokill", name, weap, NULL);
|
AI_main_BotAIInitialChat(bs, "hit_nokill", name, weap, NULL);
|
||||||
bs->lastchat_time = trap_AAS_Time();
|
bs->lastchat_time = trap_AAS_Time();
|
||||||
bs->chatto = CHAT_ALL;
|
bs->chatto = CHAT_ALL;
|
||||||
|
|
||||||
|
@ -1131,7 +1131,7 @@ int32_t BotChat_Random(bot_state_t* bs) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (random() < trap_Characteristic_BFloat(bs->character, CHARACTERISTIC_CHAT_MISC, 0, 1)) {
|
if (random() < trap_Characteristic_BFloat(bs->character, CHARACTERISTIC_CHAT_MISC, 0, 1)) {
|
||||||
BotAI_BotInitialChat(bs, "random_misc",
|
AI_main_BotAIInitialChat(bs, "random_misc",
|
||||||
BotRandomOpponentName(bs), // 0
|
BotRandomOpponentName(bs), // 0
|
||||||
name, // 1
|
name, // 1
|
||||||
"[invalid var]", // 2
|
"[invalid var]", // 2
|
||||||
|
@ -1140,7 +1140,7 @@ int32_t BotChat_Random(bot_state_t* bs) {
|
||||||
BotRandomWeaponName(), // 5
|
BotRandomWeaponName(), // 5
|
||||||
NULL);
|
NULL);
|
||||||
} else {
|
} else {
|
||||||
BotAI_BotInitialChat(bs, "random_insult",
|
AI_main_BotAIInitialChat(bs, "random_insult",
|
||||||
BotRandomOpponentName(bs), // 0
|
BotRandomOpponentName(bs), // 0
|
||||||
name, // 1
|
name, // 1
|
||||||
"[invalid var]", // 2
|
"[invalid var]", // 2
|
||||||
|
@ -1176,7 +1176,7 @@ void BotChatTest(bot_state_t* bs) {
|
||||||
int num = trap_BotNumInitialChats(bs->cs, "game_enter");
|
int num = trap_BotNumInitialChats(bs->cs, "game_enter");
|
||||||
|
|
||||||
for (; i < num; i++) {
|
for (; i < num; i++) {
|
||||||
BotAI_BotInitialChat(bs, "game_enter",
|
AI_main_BotAIInitialChat(bs, "game_enter",
|
||||||
EasyClientName(bs->client, name, 32), // 0
|
EasyClientName(bs->client, name, 32), // 0
|
||||||
BotRandomOpponentName(bs), // 1
|
BotRandomOpponentName(bs), // 1
|
||||||
"[invalid var]", // 2
|
"[invalid var]", // 2
|
||||||
|
@ -1188,7 +1188,7 @@ void BotChatTest(bot_state_t* bs) {
|
||||||
|
|
||||||
num = trap_BotNumInitialChats(bs->cs, "game_exit");
|
num = trap_BotNumInitialChats(bs->cs, "game_exit");
|
||||||
for (i = 0; i < num; i++) {
|
for (i = 0; i < num; i++) {
|
||||||
BotAI_BotInitialChat(bs, "game_exit",
|
AI_main_BotAIInitialChat(bs, "game_exit",
|
||||||
EasyClientName(bs->client, name, 32), // 0
|
EasyClientName(bs->client, name, 32), // 0
|
||||||
BotRandomOpponentName(bs), // 1
|
BotRandomOpponentName(bs), // 1
|
||||||
"[invalid var]", // 2
|
"[invalid var]", // 2
|
||||||
|
@ -1200,7 +1200,7 @@ void BotChatTest(bot_state_t* bs) {
|
||||||
|
|
||||||
num = trap_BotNumInitialChats(bs->cs, "level_start");
|
num = trap_BotNumInitialChats(bs->cs, "level_start");
|
||||||
for (i = 0; i < num; i++) {
|
for (i = 0; i < num; i++) {
|
||||||
BotAI_BotInitialChat(bs, "level_start",
|
AI_main_BotAIInitialChat(bs, "level_start",
|
||||||
EasyClientName(bs->client, name, 32), // 0
|
EasyClientName(bs->client, name, 32), // 0
|
||||||
NULL);
|
NULL);
|
||||||
trap_BotEnterChat(bs->cs, bs->client, CHAT_ALL);
|
trap_BotEnterChat(bs->cs, bs->client, CHAT_ALL);
|
||||||
|
@ -1208,7 +1208,7 @@ void BotChatTest(bot_state_t* bs) {
|
||||||
|
|
||||||
num = trap_BotNumInitialChats(bs->cs, "level_end_victory");
|
num = trap_BotNumInitialChats(bs->cs, "level_end_victory");
|
||||||
for (i = 0; i < num; i++) {
|
for (i = 0; i < num; i++) {
|
||||||
BotAI_BotInitialChat(bs, "level_end_victory",
|
AI_main_BotAIInitialChat(bs, "level_end_victory",
|
||||||
EasyClientName(bs->client, name, 32), // 0
|
EasyClientName(bs->client, name, 32), // 0
|
||||||
BotRandomOpponentName(bs), // 1
|
BotRandomOpponentName(bs), // 1
|
||||||
BotFirstClientInRankings(), // 2
|
BotFirstClientInRankings(), // 2
|
||||||
|
@ -1220,7 +1220,7 @@ void BotChatTest(bot_state_t* bs) {
|
||||||
|
|
||||||
num = trap_BotNumInitialChats(bs->cs, "level_end_lose");
|
num = trap_BotNumInitialChats(bs->cs, "level_end_lose");
|
||||||
for (i = 0; i < num; i++) {
|
for (i = 0; i < num; i++) {
|
||||||
BotAI_BotInitialChat(bs, "level_end_lose",
|
AI_main_BotAIInitialChat(bs, "level_end_lose",
|
||||||
EasyClientName(bs->client, name, 32), // 0
|
EasyClientName(bs->client, name, 32), // 0
|
||||||
BotRandomOpponentName(bs), // 1
|
BotRandomOpponentName(bs), // 1
|
||||||
BotFirstClientInRankings(), // 2
|
BotFirstClientInRankings(), // 2
|
||||||
|
@ -1232,7 +1232,7 @@ void BotChatTest(bot_state_t* bs) {
|
||||||
|
|
||||||
num = trap_BotNumInitialChats(bs->cs, "level_end");
|
num = trap_BotNumInitialChats(bs->cs, "level_end");
|
||||||
for (i = 0; i < num; i++) {
|
for (i = 0; i < num; i++) {
|
||||||
BotAI_BotInitialChat(bs, "level_end",
|
AI_main_BotAIInitialChat(bs, "level_end",
|
||||||
EasyClientName(bs->client, name, 32), // 0
|
EasyClientName(bs->client, name, 32), // 0
|
||||||
BotRandomOpponentName(bs), // 1
|
BotRandomOpponentName(bs), // 1
|
||||||
BotFirstClientInRankings(), // 2
|
BotFirstClientInRankings(), // 2
|
||||||
|
@ -1246,43 +1246,43 @@ void BotChatTest(bot_state_t* bs) {
|
||||||
num = trap_BotNumInitialChats(bs->cs, "death_drown");
|
num = trap_BotNumInitialChats(bs->cs, "death_drown");
|
||||||
for (i = 0; i < num; i++) {
|
for (i = 0; i < num; i++) {
|
||||||
//
|
//
|
||||||
BotAI_BotInitialChat(bs, "death_drown", name, NULL);
|
AI_main_BotAIInitialChat(bs, "death_drown", name, NULL);
|
||||||
trap_BotEnterChat(bs->cs, bs->client, CHAT_ALL);
|
trap_BotEnterChat(bs->cs, bs->client, CHAT_ALL);
|
||||||
}
|
}
|
||||||
|
|
||||||
num = trap_BotNumInitialChats(bs->cs, "death_slime");
|
num = trap_BotNumInitialChats(bs->cs, "death_slime");
|
||||||
for (i = 0; i < num; i++) {
|
for (i = 0; i < num; i++) {
|
||||||
BotAI_BotInitialChat(bs, "death_slime", name, NULL);
|
AI_main_BotAIInitialChat(bs, "death_slime", name, NULL);
|
||||||
trap_BotEnterChat(bs->cs, bs->client, CHAT_ALL);
|
trap_BotEnterChat(bs->cs, bs->client, CHAT_ALL);
|
||||||
}
|
}
|
||||||
|
|
||||||
num = trap_BotNumInitialChats(bs->cs, "death_lava");
|
num = trap_BotNumInitialChats(bs->cs, "death_lava");
|
||||||
for (i = 0; i < num; i++) {
|
for (i = 0; i < num; i++) {
|
||||||
BotAI_BotInitialChat(bs, "death_lava", name, NULL);
|
AI_main_BotAIInitialChat(bs, "death_lava", name, NULL);
|
||||||
trap_BotEnterChat(bs->cs, bs->client, CHAT_ALL);
|
trap_BotEnterChat(bs->cs, bs->client, CHAT_ALL);
|
||||||
}
|
}
|
||||||
|
|
||||||
num = trap_BotNumInitialChats(bs->cs, "death_cratered");
|
num = trap_BotNumInitialChats(bs->cs, "death_cratered");
|
||||||
for (i = 0; i < num; i++) {
|
for (i = 0; i < num; i++) {
|
||||||
BotAI_BotInitialChat(bs, "death_cratered", name, NULL);
|
AI_main_BotAIInitialChat(bs, "death_cratered", name, NULL);
|
||||||
trap_BotEnterChat(bs->cs, bs->client, CHAT_ALL);
|
trap_BotEnterChat(bs->cs, bs->client, CHAT_ALL);
|
||||||
}
|
}
|
||||||
|
|
||||||
num = trap_BotNumInitialChats(bs->cs, "death_suicide");
|
num = trap_BotNumInitialChats(bs->cs, "death_suicide");
|
||||||
for (i = 0; i < num; i++) {
|
for (i = 0; i < num; i++) {
|
||||||
BotAI_BotInitialChat(bs, "death_suicide", name, NULL);
|
AI_main_BotAIInitialChat(bs, "death_suicide", name, NULL);
|
||||||
trap_BotEnterChat(bs->cs, bs->client, CHAT_ALL);
|
trap_BotEnterChat(bs->cs, bs->client, CHAT_ALL);
|
||||||
}
|
}
|
||||||
|
|
||||||
num = trap_BotNumInitialChats(bs->cs, "death_telefrag");
|
num = trap_BotNumInitialChats(bs->cs, "death_telefrag");
|
||||||
for (i = 0; i < num; i++) {
|
for (i = 0; i < num; i++) {
|
||||||
BotAI_BotInitialChat(bs, "death_telefrag", name, NULL);
|
AI_main_BotAIInitialChat(bs, "death_telefrag", name, NULL);
|
||||||
trap_BotEnterChat(bs->cs, bs->client, CHAT_ALL);
|
trap_BotEnterChat(bs->cs, bs->client, CHAT_ALL);
|
||||||
}
|
}
|
||||||
|
|
||||||
num = trap_BotNumInitialChats(bs->cs, "death_gauntlet");
|
num = trap_BotNumInitialChats(bs->cs, "death_gauntlet");
|
||||||
for (i = 0; i < num; i++) {
|
for (i = 0; i < num; i++) {
|
||||||
BotAI_BotInitialChat(bs, "death_gauntlet",
|
AI_main_BotAIInitialChat(bs, "death_gauntlet",
|
||||||
name, // 0
|
name, // 0
|
||||||
BotWeaponNameForMeansOfDeath(bs->botdeathtype), // 1
|
BotWeaponNameForMeansOfDeath(bs->botdeathtype), // 1
|
||||||
NULL);
|
NULL);
|
||||||
|
@ -1291,7 +1291,7 @@ void BotChatTest(bot_state_t* bs) {
|
||||||
|
|
||||||
num = trap_BotNumInitialChats(bs->cs, "death_rail");
|
num = trap_BotNumInitialChats(bs->cs, "death_rail");
|
||||||
for (i = 0; i < num; i++) {
|
for (i = 0; i < num; i++) {
|
||||||
BotAI_BotInitialChat(bs, "death_rail",
|
AI_main_BotAIInitialChat(bs, "death_rail",
|
||||||
name, // 0
|
name, // 0
|
||||||
BotWeaponNameForMeansOfDeath(bs->botdeathtype), // 1
|
BotWeaponNameForMeansOfDeath(bs->botdeathtype), // 1
|
||||||
NULL);
|
NULL);
|
||||||
|
@ -1300,7 +1300,7 @@ void BotChatTest(bot_state_t* bs) {
|
||||||
|
|
||||||
num = trap_BotNumInitialChats(bs->cs, "death_bfg");
|
num = trap_BotNumInitialChats(bs->cs, "death_bfg");
|
||||||
for (i = 0; i < num; i++) {
|
for (i = 0; i < num; i++) {
|
||||||
BotAI_BotInitialChat(bs, "death_bfg",
|
AI_main_BotAIInitialChat(bs, "death_bfg",
|
||||||
name, // 0
|
name, // 0
|
||||||
BotWeaponNameForMeansOfDeath(bs->botdeathtype), // 1
|
BotWeaponNameForMeansOfDeath(bs->botdeathtype), // 1
|
||||||
NULL);
|
NULL);
|
||||||
|
@ -1309,7 +1309,7 @@ void BotChatTest(bot_state_t* bs) {
|
||||||
|
|
||||||
num = trap_BotNumInitialChats(bs->cs, "death_insult");
|
num = trap_BotNumInitialChats(bs->cs, "death_insult");
|
||||||
for (i = 0; i < num; i++) {
|
for (i = 0; i < num; i++) {
|
||||||
BotAI_BotInitialChat(bs, "death_insult",
|
AI_main_BotAIInitialChat(bs, "death_insult",
|
||||||
name, // 0
|
name, // 0
|
||||||
BotWeaponNameForMeansOfDeath(bs->botdeathtype), // 1
|
BotWeaponNameForMeansOfDeath(bs->botdeathtype), // 1
|
||||||
NULL);
|
NULL);
|
||||||
|
@ -1318,7 +1318,7 @@ void BotChatTest(bot_state_t* bs) {
|
||||||
|
|
||||||
num = trap_BotNumInitialChats(bs->cs, "death_praise");
|
num = trap_BotNumInitialChats(bs->cs, "death_praise");
|
||||||
for (i = 0; i < num; i++) {
|
for (i = 0; i < num; i++) {
|
||||||
BotAI_BotInitialChat(bs, "death_praise",
|
AI_main_BotAIInitialChat(bs, "death_praise",
|
||||||
name, // 0
|
name, // 0
|
||||||
BotWeaponNameForMeansOfDeath(bs->botdeathtype), // 1
|
BotWeaponNameForMeansOfDeath(bs->botdeathtype), // 1
|
||||||
NULL);
|
NULL);
|
||||||
|
@ -1330,37 +1330,37 @@ void BotChatTest(bot_state_t* bs) {
|
||||||
num = trap_BotNumInitialChats(bs->cs, "kill_gauntlet");
|
num = trap_BotNumInitialChats(bs->cs, "kill_gauntlet");
|
||||||
for (i = 0; i < num; i++) {
|
for (i = 0; i < num; i++) {
|
||||||
//
|
//
|
||||||
BotAI_BotInitialChat(bs, "kill_gauntlet", name, NULL);
|
AI_main_BotAIInitialChat(bs, "kill_gauntlet", name, NULL);
|
||||||
trap_BotEnterChat(bs->cs, bs->client, CHAT_ALL);
|
trap_BotEnterChat(bs->cs, bs->client, CHAT_ALL);
|
||||||
}
|
}
|
||||||
|
|
||||||
num = trap_BotNumInitialChats(bs->cs, "kill_rail");
|
num = trap_BotNumInitialChats(bs->cs, "kill_rail");
|
||||||
for (i = 0; i < num; i++) {
|
for (i = 0; i < num; i++) {
|
||||||
BotAI_BotInitialChat(bs, "kill_rail", name, NULL);
|
AI_main_BotAIInitialChat(bs, "kill_rail", name, NULL);
|
||||||
trap_BotEnterChat(bs->cs, bs->client, CHAT_ALL);
|
trap_BotEnterChat(bs->cs, bs->client, CHAT_ALL);
|
||||||
}
|
}
|
||||||
|
|
||||||
num = trap_BotNumInitialChats(bs->cs, "kill_telefrag");
|
num = trap_BotNumInitialChats(bs->cs, "kill_telefrag");
|
||||||
for (i = 0; i < num; i++) {
|
for (i = 0; i < num; i++) {
|
||||||
BotAI_BotInitialChat(bs, "kill_telefrag", name, NULL);
|
AI_main_BotAIInitialChat(bs, "kill_telefrag", name, NULL);
|
||||||
trap_BotEnterChat(bs->cs, bs->client, CHAT_ALL);
|
trap_BotEnterChat(bs->cs, bs->client, CHAT_ALL);
|
||||||
}
|
}
|
||||||
|
|
||||||
num = trap_BotNumInitialChats(bs->cs, "kill_insult");
|
num = trap_BotNumInitialChats(bs->cs, "kill_insult");
|
||||||
for (i = 0; i < num; i++) {
|
for (i = 0; i < num; i++) {
|
||||||
BotAI_BotInitialChat(bs, "kill_insult", name, NULL);
|
AI_main_BotAIInitialChat(bs, "kill_insult", name, NULL);
|
||||||
trap_BotEnterChat(bs->cs, bs->client, CHAT_ALL);
|
trap_BotEnterChat(bs->cs, bs->client, CHAT_ALL);
|
||||||
}
|
}
|
||||||
|
|
||||||
num = trap_BotNumInitialChats(bs->cs, "kill_praise");
|
num = trap_BotNumInitialChats(bs->cs, "kill_praise");
|
||||||
for (i = 0; i < num; i++) {
|
for (i = 0; i < num; i++) {
|
||||||
BotAI_BotInitialChat(bs, "kill_praise", name, NULL);
|
AI_main_BotAIInitialChat(bs, "kill_praise", name, NULL);
|
||||||
trap_BotEnterChat(bs->cs, bs->client, CHAT_ALL);
|
trap_BotEnterChat(bs->cs, bs->client, CHAT_ALL);
|
||||||
}
|
}
|
||||||
|
|
||||||
num = trap_BotNumInitialChats(bs->cs, "enemy_suicide");
|
num = trap_BotNumInitialChats(bs->cs, "enemy_suicide");
|
||||||
for (i = 0; i < num; i++) {
|
for (i = 0; i < num; i++) {
|
||||||
BotAI_BotInitialChat(bs, "enemy_suicide", name, NULL);
|
AI_main_BotAIInitialChat(bs, "enemy_suicide", name, NULL);
|
||||||
trap_BotEnterChat(bs->cs, bs->client, CHAT_ALL);
|
trap_BotEnterChat(bs->cs, bs->client, CHAT_ALL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1368,19 +1368,19 @@ void BotChatTest(bot_state_t* bs) {
|
||||||
weap = BotWeaponNameForMeansOfDeath(g_entities[bs->client].client->lasthurt_client);
|
weap = BotWeaponNameForMeansOfDeath(g_entities[bs->client].client->lasthurt_client);
|
||||||
num = trap_BotNumInitialChats(bs->cs, "hit_talking");
|
num = trap_BotNumInitialChats(bs->cs, "hit_talking");
|
||||||
for (i = 0; i < num; i++) {
|
for (i = 0; i < num; i++) {
|
||||||
BotAI_BotInitialChat(bs, "hit_talking", name, weap, NULL);
|
AI_main_BotAIInitialChat(bs, "hit_talking", name, weap, NULL);
|
||||||
trap_BotEnterChat(bs->cs, bs->client, CHAT_ALL);
|
trap_BotEnterChat(bs->cs, bs->client, CHAT_ALL);
|
||||||
}
|
}
|
||||||
|
|
||||||
num = trap_BotNumInitialChats(bs->cs, "hit_nodeath");
|
num = trap_BotNumInitialChats(bs->cs, "hit_nodeath");
|
||||||
for (i = 0; i < num; i++) {
|
for (i = 0; i < num; i++) {
|
||||||
BotAI_BotInitialChat(bs, "hit_nodeath", name, weap, NULL);
|
AI_main_BotAIInitialChat(bs, "hit_nodeath", name, weap, NULL);
|
||||||
trap_BotEnterChat(bs->cs, bs->client, CHAT_ALL);
|
trap_BotEnterChat(bs->cs, bs->client, CHAT_ALL);
|
||||||
}
|
}
|
||||||
|
|
||||||
num = trap_BotNumInitialChats(bs->cs, "hit_nokill");
|
num = trap_BotNumInitialChats(bs->cs, "hit_nokill");
|
||||||
for (i = 0; i < num; i++) {
|
for (i = 0; i < num; i++) {
|
||||||
BotAI_BotInitialChat(bs, "hit_nokill", name, weap, NULL);
|
AI_main_BotAIInitialChat(bs, "hit_nokill", name, weap, NULL);
|
||||||
trap_BotEnterChat(bs->cs, bs->client, CHAT_ALL);
|
trap_BotEnterChat(bs->cs, bs->client, CHAT_ALL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1393,7 +1393,7 @@ void BotChatTest(bot_state_t* bs) {
|
||||||
num = trap_BotNumInitialChats(bs->cs, "random_misc");
|
num = trap_BotNumInitialChats(bs->cs, "random_misc");
|
||||||
for (i = 0; i < num; i++) {
|
for (i = 0; i < num; i++) {
|
||||||
//
|
//
|
||||||
BotAI_BotInitialChat(bs, "random_misc",
|
AI_main_BotAIInitialChat(bs, "random_misc",
|
||||||
BotRandomOpponentName(bs), // 0
|
BotRandomOpponentName(bs), // 0
|
||||||
name, // 1
|
name, // 1
|
||||||
"[invalid var]", // 2
|
"[invalid var]", // 2
|
||||||
|
@ -1406,7 +1406,7 @@ void BotChatTest(bot_state_t* bs) {
|
||||||
|
|
||||||
num = trap_BotNumInitialChats(bs->cs, "random_insult");
|
num = trap_BotNumInitialChats(bs->cs, "random_insult");
|
||||||
for (i = 0; i < num; i++) {
|
for (i = 0; i < num; i++) {
|
||||||
BotAI_BotInitialChat(bs, "random_insult",
|
AI_main_BotAIInitialChat(bs, "random_insult",
|
||||||
BotRandomOpponentName(bs), // 0
|
BotRandomOpponentName(bs), // 0
|
||||||
name, // 1
|
name, // 1
|
||||||
"[invalid var]", // 2
|
"[invalid var]", // 2
|
||||||
|
|
|
@ -54,42 +54,42 @@ void BotPrintTeamGoal(bot_state_t *bs) {
|
||||||
t = bs->teamgoal_time - trap_AAS_Time();
|
t = bs->teamgoal_time - trap_AAS_Time();
|
||||||
switch (bs->ltgtype) {
|
switch (bs->ltgtype) {
|
||||||
case LTG_TEAMHELP:
|
case LTG_TEAMHELP:
|
||||||
BotAI_Print(PRT_MESSAGE, "%s: I'm gonna help a team mate for %1.0f secs\n", netname, t);
|
AI_main_BotAIPrint(PRT_MESSAGE, "%s: I'm gonna help a team mate for %1.0f secs\n", netname, t);
|
||||||
break;
|
break;
|
||||||
case LTG_TEAMACCOMPANY:
|
case LTG_TEAMACCOMPANY:
|
||||||
BotAI_Print(PRT_MESSAGE, "%s: I'm gonna accompany a team mate for %1.0f secs\n", netname, t);
|
AI_main_BotAIPrint(PRT_MESSAGE, "%s: I'm gonna accompany a team mate for %1.0f secs\n", netname, t);
|
||||||
break;
|
break;
|
||||||
case LTG_GETFLAG:
|
case LTG_GETFLAG:
|
||||||
BotAI_Print(PRT_MESSAGE, "%s: I'm gonna get the flag for %1.0f secs\n", netname, t);
|
AI_main_BotAIPrint(PRT_MESSAGE, "%s: I'm gonna get the flag for %1.0f secs\n", netname, t);
|
||||||
break;
|
break;
|
||||||
case LTG_RUSHBASE:
|
case LTG_RUSHBASE:
|
||||||
BotAI_Print(PRT_MESSAGE, "%s: I'm gonna rush to the base for %1.0f secs\n", netname, t);
|
AI_main_BotAIPrint(PRT_MESSAGE, "%s: I'm gonna rush to the base for %1.0f secs\n", netname, t);
|
||||||
break;
|
break;
|
||||||
case LTG_RETURNFLAG:
|
case LTG_RETURNFLAG:
|
||||||
BotAI_Print(PRT_MESSAGE, "%s: I'm gonna try to return the flag for %1.0f secs\n", netname, t);
|
AI_main_BotAIPrint(PRT_MESSAGE, "%s: I'm gonna try to return the flag for %1.0f secs\n", netname, t);
|
||||||
break;
|
break;
|
||||||
case LTG_DEFENDKEYAREA:
|
case LTG_DEFENDKEYAREA:
|
||||||
BotAI_Print(PRT_MESSAGE, "%s: I'm gonna defend a key area for %1.0f secs\n", netname, t);
|
AI_main_BotAIPrint(PRT_MESSAGE, "%s: I'm gonna defend a key area for %1.0f secs\n", netname, t);
|
||||||
break;
|
break;
|
||||||
case LTG_GETITEM:
|
case LTG_GETITEM:
|
||||||
BotAI_Print(PRT_MESSAGE, "%s: I'm gonna get an item for %1.0f secs\n", netname, t);
|
AI_main_BotAIPrint(PRT_MESSAGE, "%s: I'm gonna get an item for %1.0f secs\n", netname, t);
|
||||||
break;
|
break;
|
||||||
case LTG_KILL:
|
case LTG_KILL:
|
||||||
BotAI_Print(PRT_MESSAGE, "%s: I'm gonna kill someone for %1.0f secs\n", netname, t);
|
AI_main_BotAIPrint(PRT_MESSAGE, "%s: I'm gonna kill someone for %1.0f secs\n", netname, t);
|
||||||
break;
|
break;
|
||||||
case LTG_CAMP:
|
case LTG_CAMP:
|
||||||
case LTG_CAMPORDER:
|
case LTG_CAMPORDER:
|
||||||
BotAI_Print(PRT_MESSAGE, "%s: I'm gonna camp for %1.0f secs\n", netname, t);
|
AI_main_BotAIPrint(PRT_MESSAGE, "%s: I'm gonna camp for %1.0f secs\n", netname, t);
|
||||||
break;
|
break;
|
||||||
case LTG_PATROL:
|
case LTG_PATROL:
|
||||||
BotAI_Print(PRT_MESSAGE, "%s: I'm gonna patrol for %1.0f secs\n", netname, t);
|
AI_main_BotAIPrint(PRT_MESSAGE, "%s: I'm gonna patrol for %1.0f secs\n", netname, t);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if (bs->ctfroam_time > trap_AAS_Time()) {
|
if (bs->ctfroam_time > trap_AAS_Time()) {
|
||||||
t = bs->ctfroam_time - trap_AAS_Time();
|
t = bs->ctfroam_time - trap_AAS_Time();
|
||||||
BotAI_Print(PRT_MESSAGE, "%s: I'm gonna roam for %1.0f secs\n", netname, t);
|
AI_main_BotAIPrint(PRT_MESSAGE, "%s: I'm gonna roam for %1.0f secs\n", netname, t);
|
||||||
} else {
|
} else {
|
||||||
BotAI_Print(PRT_MESSAGE, "%s: I've got a regular goal\n", netname);
|
AI_main_BotAIPrint(PRT_MESSAGE, "%s: I've got a regular goal\n", netname);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -459,7 +459,7 @@ int32_t BotGPSToPosition(char* buf, vec3_t position) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
BotAI_Print(PRT_MESSAGE, "%d\n", sign * num);
|
AI_main_BotAIPrint(PRT_MESSAGE, "%d\n", sign * num);
|
||||||
position[i] = (float)sign * num;
|
position[i] = (float)sign * num;
|
||||||
}
|
}
|
||||||
return qtrue;
|
return qtrue;
|
||||||
|
@ -517,9 +517,9 @@ static void BotMatch_HelpAccompany(bot_state_t* bs, bot_match_t* match) {
|
||||||
//if the bot doesn't know who to help (FindClientByName returned -1)
|
//if the bot doesn't know who to help (FindClientByName returned -1)
|
||||||
if (client < 0) {
|
if (client < 0) {
|
||||||
if (other != 0) {
|
if (other != 0) {
|
||||||
BotAI_BotInitialChat(bs, "whois", teammate, NULL);
|
AI_main_BotAIInitialChat(bs, "whois", teammate, NULL);
|
||||||
} else {
|
} else {
|
||||||
BotAI_BotInitialChat(bs, "whois", netname, NULL);
|
AI_main_BotAIInitialChat(bs, "whois", netname, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
trap_BotEnterChat(bs->cs, bs->client, CHAT_TEAM);
|
trap_BotEnterChat(bs->cs, bs->client, CHAT_TEAM);
|
||||||
|
@ -531,7 +531,7 @@ static void BotMatch_HelpAccompany(bot_state_t* bs, bot_match_t* match) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bs->teamgoal.entitynum = -1;
|
bs->teamgoal.entitynum = -1;
|
||||||
BotEntityInfo(client, &entinfo);
|
AI_main_BotEntityInfo(client, &entinfo);
|
||||||
//if info is valid (in PVS)
|
//if info is valid (in PVS)
|
||||||
if (entinfo.valid != 0) {
|
if (entinfo.valid != 0) {
|
||||||
int32_t areanum = BotPointAreaNum(entinfo.origin);
|
int32_t areanum = BotPointAreaNum(entinfo.origin);
|
||||||
|
@ -558,8 +558,8 @@ static void BotMatch_HelpAccompany(bot_state_t* bs, bot_match_t* match) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bs->teamgoal.entitynum < 0) {
|
if (bs->teamgoal.entitynum < 0) {
|
||||||
if (other) BotAI_BotInitialChat(bs, "whereis", teammate, NULL);
|
if (other) AI_main_BotAIInitialChat(bs, "whereis", teammate, NULL);
|
||||||
else BotAI_BotInitialChat(bs, "whereareyou", netname, NULL);
|
else AI_main_BotAIInitialChat(bs, "whereareyou", netname, NULL);
|
||||||
trap_BotEnterChat(bs->cs, bs->client, CHAT_TEAM);
|
trap_BotEnterChat(bs->cs, bs->client, CHAT_TEAM);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -679,7 +679,7 @@ void BotMatch_Camp(bot_state_t *bs, bot_match_t *match) {
|
||||||
client = FindClientByName(netname);
|
client = FindClientByName(netname);
|
||||||
//if there's no valid client with this name
|
//if there's no valid client with this name
|
||||||
if (client < 0) {
|
if (client < 0) {
|
||||||
BotAI_BotInitialChat(bs, "whois", netname, NULL);
|
AI_main_BotAIInitialChat(bs, "whois", netname, NULL);
|
||||||
trap_BotEnterChat(bs->cs, bs->client, CHAT_TEAM);
|
trap_BotEnterChat(bs->cs, bs->client, CHAT_TEAM);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -698,7 +698,7 @@ void BotMatch_Camp(bot_state_t *bs, bot_match_t *match) {
|
||||||
if (client == bs->client) return;
|
if (client == bs->client) return;
|
||||||
//
|
//
|
||||||
bs->teamgoal.entitynum = -1;
|
bs->teamgoal.entitynum = -1;
|
||||||
BotEntityInfo(client, &entinfo);
|
AI_main_BotEntityInfo(client, &entinfo);
|
||||||
//if info is valid (in PVS)
|
//if info is valid (in PVS)
|
||||||
if (entinfo.valid) {
|
if (entinfo.valid) {
|
||||||
areanum = BotPointAreaNum(entinfo.origin);
|
areanum = BotPointAreaNum(entinfo.origin);
|
||||||
|
@ -715,7 +715,7 @@ void BotMatch_Camp(bot_state_t *bs, bot_match_t *match) {
|
||||||
}
|
}
|
||||||
//if the other is not visible
|
//if the other is not visible
|
||||||
if (bs->teamgoal.entitynum < 0) {
|
if (bs->teamgoal.entitynum < 0) {
|
||||||
BotAI_BotInitialChat(bs, "whereareyou", netname, NULL);
|
AI_main_BotAIInitialChat(bs, "whereareyou", netname, NULL);
|
||||||
trap_BotEnterChat(bs->cs, bs->client, CHAT_TEAM);
|
trap_BotEnterChat(bs->cs, bs->client, CHAT_TEAM);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -850,7 +850,7 @@ void BotMatch_TaskPreference(bot_state_t *bs, bot_match_t *match) {
|
||||||
BotSetTeamMateCTFPreference(bs, teammate, preference);
|
BotSetTeamMateCTFPreference(bs, teammate, preference);
|
||||||
//
|
//
|
||||||
EasyClientName(teammate, teammatename, sizeof(teammatename));
|
EasyClientName(teammate, teammatename, sizeof(teammatename));
|
||||||
BotAI_BotInitialChat(bs, "keepinmind", teammatename, NULL);
|
AI_main_BotAIInitialChat(bs, "keepinmind", teammatename, NULL);
|
||||||
trap_BotEnterChat(bs->cs, bs->client, CHAT_TEAM);
|
trap_BotEnterChat(bs->cs, bs->client, CHAT_TEAM);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -893,7 +893,7 @@ void BotMatch_JoinSubteam(bot_state_t *bs, bot_match_t *match) {
|
||||||
strncpy(bs->subteam, teammate, 32);
|
strncpy(bs->subteam, teammate, 32);
|
||||||
bs->subteam[31] = '\0';
|
bs->subteam[31] = '\0';
|
||||||
//
|
//
|
||||||
BotAI_BotInitialChat(bs, "joinedteam", teammate, NULL);
|
AI_main_BotAIInitialChat(bs, "joinedteam", teammate, NULL);
|
||||||
trap_BotEnterChat(bs->cs, bs->client, CHAT_TEAM);
|
trap_BotEnterChat(bs->cs, bs->client, CHAT_TEAM);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -908,7 +908,7 @@ void BotMatch_LeaveSubteam(bot_state_t *bs, bot_match_t *match) {
|
||||||
if (!BotAddressedToBot(bs, match)) return;
|
if (!BotAddressedToBot(bs, match)) return;
|
||||||
//
|
//
|
||||||
if (strlen(bs->subteam)) {
|
if (strlen(bs->subteam)) {
|
||||||
BotAI_BotInitialChat(bs, "leftteam", bs->subteam, NULL);
|
AI_main_BotAIInitialChat(bs, "leftteam", bs->subteam, NULL);
|
||||||
} //end if
|
} //end if
|
||||||
trap_BotEnterChat(bs->cs, bs->client, CHAT_TEAM);
|
trap_BotEnterChat(bs->cs, bs->client, CHAT_TEAM);
|
||||||
strcpy(bs->subteam, "");
|
strcpy(bs->subteam, "");
|
||||||
|
@ -925,9 +925,9 @@ void BotMatch_WhichTeam(bot_state_t *bs, bot_match_t *match) {
|
||||||
if (!BotAddressedToBot(bs, match)) return;
|
if (!BotAddressedToBot(bs, match)) return;
|
||||||
//
|
//
|
||||||
if (strlen(bs->subteam)) {
|
if (strlen(bs->subteam)) {
|
||||||
BotAI_BotInitialChat(bs, "inteam", bs->subteam, NULL);
|
AI_main_BotAIInitialChat(bs, "inteam", bs->subteam, NULL);
|
||||||
} else {
|
} else {
|
||||||
BotAI_BotInitialChat(bs, "noteam", NULL);
|
AI_main_BotAIInitialChat(bs, "noteam", NULL);
|
||||||
}
|
}
|
||||||
trap_BotEnterChat(bs->cs, bs->client, CHAT_TEAM);
|
trap_BotEnterChat(bs->cs, bs->client, CHAT_TEAM);
|
||||||
}
|
}
|
||||||
|
@ -952,7 +952,7 @@ void BotMatch_CheckPoint(bot_state_t *bs, bot_match_t *match) {
|
||||||
areanum = BotPointAreaNum(position);
|
areanum = BotPointAreaNum(position);
|
||||||
if (!areanum) {
|
if (!areanum) {
|
||||||
if (BotAddressedToBot(bs, match)) {
|
if (BotAddressedToBot(bs, match)) {
|
||||||
BotAI_BotInitialChat(bs, "checkpoint_invalid", NULL);
|
AI_main_BotAIInitialChat(bs, "checkpoint_invalid", NULL);
|
||||||
trap_BotEnterChat(bs->cs, bs->client, CHAT_TEAM);
|
trap_BotEnterChat(bs->cs, bs->client, CHAT_TEAM);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
@ -979,7 +979,7 @@ void BotMatch_CheckPoint(bot_state_t *bs, bot_match_t *match) {
|
||||||
cp->goal.origin[1],
|
cp->goal.origin[1],
|
||||||
cp->goal.origin[2]);
|
cp->goal.origin[2]);
|
||||||
|
|
||||||
BotAI_BotInitialChat(bs, "checkpoint_confirm", cp->name, buf, NULL);
|
AI_main_BotAIInitialChat(bs, "checkpoint_confirm", cp->name, buf, NULL);
|
||||||
trap_BotEnterChat(bs->cs, bs->client, CHAT_TEAM);
|
trap_BotEnterChat(bs->cs, bs->client, CHAT_TEAM);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1020,7 +1020,7 @@ void BotMatch_Dismiss(bot_state_t *bs, bot_match_t *match) {
|
||||||
bs->ltgtype = 0;
|
bs->ltgtype = 0;
|
||||||
bs->lead_time = 0;
|
bs->lead_time = 0;
|
||||||
//
|
//
|
||||||
BotAI_BotInitialChat(bs, "dismissed", NULL);
|
AI_main_BotAIInitialChat(bs, "dismissed", NULL);
|
||||||
trap_BotEnterChat(bs->cs, bs->client, CHAT_TEAM);
|
trap_BotEnterChat(bs->cs, bs->client, CHAT_TEAM);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1113,62 +1113,62 @@ void BotMatch_WhatAreYouDoing(bot_state_t *bs, bot_match_t *match) {
|
||||||
case LTG_TEAMHELP:
|
case LTG_TEAMHELP:
|
||||||
{
|
{
|
||||||
EasyClientName(bs->teammate, netname, sizeof(netname));
|
EasyClientName(bs->teammate, netname, sizeof(netname));
|
||||||
BotAI_BotInitialChat(bs, "helping", netname, NULL);
|
AI_main_BotAIInitialChat(bs, "helping", netname, NULL);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case LTG_TEAMACCOMPANY:
|
case LTG_TEAMACCOMPANY:
|
||||||
{
|
{
|
||||||
EasyClientName(bs->teammate, netname, sizeof(netname));
|
EasyClientName(bs->teammate, netname, sizeof(netname));
|
||||||
BotAI_BotInitialChat(bs, "accompanying", netname, NULL);
|
AI_main_BotAIInitialChat(bs, "accompanying", netname, NULL);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case LTG_DEFENDKEYAREA:
|
case LTG_DEFENDKEYAREA:
|
||||||
{
|
{
|
||||||
trap_BotGoalName(bs->teamgoal.number, goalname, sizeof(goalname));
|
trap_BotGoalName(bs->teamgoal.number, goalname, sizeof(goalname));
|
||||||
BotAI_BotInitialChat(bs, "defending", goalname, NULL);
|
AI_main_BotAIInitialChat(bs, "defending", goalname, NULL);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case LTG_GETITEM:
|
case LTG_GETITEM:
|
||||||
{
|
{
|
||||||
trap_BotGoalName(bs->teamgoal.number, goalname, sizeof(goalname));
|
trap_BotGoalName(bs->teamgoal.number, goalname, sizeof(goalname));
|
||||||
BotAI_BotInitialChat(bs, "gettingitem", goalname, NULL);
|
AI_main_BotAIInitialChat(bs, "gettingitem", goalname, NULL);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case LTG_KILL:
|
case LTG_KILL:
|
||||||
{
|
{
|
||||||
ClientName(bs->teamgoal.entitynum, netname, sizeof(netname));
|
ClientName(bs->teamgoal.entitynum, netname, sizeof(netname));
|
||||||
BotAI_BotInitialChat(bs, "killing", netname, NULL);
|
AI_main_BotAIInitialChat(bs, "killing", netname, NULL);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case LTG_CAMP:
|
case LTG_CAMP:
|
||||||
case LTG_CAMPORDER:
|
case LTG_CAMPORDER:
|
||||||
{
|
{
|
||||||
BotAI_BotInitialChat(bs, "camping", NULL);
|
AI_main_BotAIInitialChat(bs, "camping", NULL);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case LTG_PATROL:
|
case LTG_PATROL:
|
||||||
{
|
{
|
||||||
BotAI_BotInitialChat(bs, "patrolling", NULL);
|
AI_main_BotAIInitialChat(bs, "patrolling", NULL);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case LTG_GETFLAG:
|
case LTG_GETFLAG:
|
||||||
{
|
{
|
||||||
BotAI_BotInitialChat(bs, "capturingflag", NULL);
|
AI_main_BotAIInitialChat(bs, "capturingflag", NULL);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case LTG_RUSHBASE:
|
case LTG_RUSHBASE:
|
||||||
{
|
{
|
||||||
BotAI_BotInitialChat(bs, "rushingbase", NULL);
|
AI_main_BotAIInitialChat(bs, "rushingbase", NULL);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case LTG_RETURNFLAG:
|
case LTG_RETURNFLAG:
|
||||||
{
|
{
|
||||||
BotAI_BotInitialChat(bs, "returningflag", NULL);
|
AI_main_BotAIInitialChat(bs, "returningflag", NULL);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
BotAI_BotInitialChat(bs, "roaming", NULL);
|
AI_main_BotAIInitialChat(bs, "roaming", NULL);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1212,7 +1212,7 @@ float BotNearestVisibleItem(bot_state_t *bs, char *itemname, bot_goal_t *goal) {
|
||||||
dist = VectorLength(dir);
|
dist = VectorLength(dir);
|
||||||
if (dist < bestdist) {
|
if (dist < bestdist) {
|
||||||
//trace from start to end
|
//trace from start to end
|
||||||
BotAI_Trace(&trace, bs->eye, NULL, NULL, tmpgoal.origin, bs->client, CONTENTS_SOLID | CONTENTS_PLAYERCLIP);
|
AI_main_BotAITrace(&trace, bs->eye, NULL, NULL, tmpgoal.origin, bs->client, CONTENTS_SOLID | CONTENTS_PLAYERCLIP);
|
||||||
if (trace.fraction >= 1.0) {
|
if (trace.fraction >= 1.0) {
|
||||||
bestdist = dist;
|
bestdist = dist;
|
||||||
memcpy(goal, &tmpgoal, sizeof(bot_goal_t));
|
memcpy(goal, &tmpgoal, sizeof(bot_goal_t));
|
||||||
|
@ -1271,14 +1271,14 @@ void BotMatch_WhereAreYou(bot_state_t *bs, bot_match_t *match) {
|
||||||
redflagtt = trap_AAS_AreaTravelTimeToGoalArea(bs->areanum, bs->origin, ctf_redflag.areanum, TFL_DEFAULT);
|
redflagtt = trap_AAS_AreaTravelTimeToGoalArea(bs->areanum, bs->origin, ctf_redflag.areanum, TFL_DEFAULT);
|
||||||
blueflagtt = trap_AAS_AreaTravelTimeToGoalArea(bs->areanum, bs->origin, ctf_blueflag.areanum, TFL_DEFAULT);
|
blueflagtt = trap_AAS_AreaTravelTimeToGoalArea(bs->areanum, bs->origin, ctf_blueflag.areanum, TFL_DEFAULT);
|
||||||
if (redflagtt < (redflagtt + blueflagtt) * 0.4) {
|
if (redflagtt < (redflagtt + blueflagtt) * 0.4) {
|
||||||
BotAI_BotInitialChat(bs, "ctflocation", nearbyitems[bestitem], "red", NULL);
|
AI_main_BotAIInitialChat(bs, "ctflocation", nearbyitems[bestitem], "red", NULL);
|
||||||
} else if (blueflagtt < (redflagtt + blueflagtt) * 0.4) {
|
} else if (blueflagtt < (redflagtt + blueflagtt) * 0.4) {
|
||||||
BotAI_BotInitialChat(bs, "ctflocation", nearbyitems[bestitem], "blue", NULL);
|
AI_main_BotAIInitialChat(bs, "ctflocation", nearbyitems[bestitem], "blue", NULL);
|
||||||
} else {
|
} else {
|
||||||
BotAI_BotInitialChat(bs, "location", nearbyitems[bestitem], NULL);
|
AI_main_BotAIInitialChat(bs, "location", nearbyitems[bestitem], NULL);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
BotAI_BotInitialChat(bs, "location", nearbyitems[bestitem], NULL);
|
AI_main_BotAIInitialChat(bs, "location", nearbyitems[bestitem], NULL);
|
||||||
}
|
}
|
||||||
trap_BotEnterChat(bs->cs, bs->client, CHAT_TEAM);
|
trap_BotEnterChat(bs->cs, bs->client, CHAT_TEAM);
|
||||||
}
|
}
|
||||||
|
@ -1319,13 +1319,13 @@ void BotMatch_LeadTheWay(bot_state_t *bs, bot_match_t *match) {
|
||||||
}
|
}
|
||||||
//if the bot doesn't know who to help (FindClientByName returned -1)
|
//if the bot doesn't know who to help (FindClientByName returned -1)
|
||||||
if (client < 0) {
|
if (client < 0) {
|
||||||
BotAI_BotInitialChat(bs, "whois", netname, NULL);
|
AI_main_BotAIInitialChat(bs, "whois", netname, NULL);
|
||||||
trap_BotEnterChat(bs->cs, bs->client, CHAT_TEAM);
|
trap_BotEnterChat(bs->cs, bs->client, CHAT_TEAM);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
bs->lead_teamgoal.entitynum = -1;
|
bs->lead_teamgoal.entitynum = -1;
|
||||||
BotEntityInfo(client, &entinfo);
|
AI_main_BotEntityInfo(client, &entinfo);
|
||||||
//if info is valid (in PVS)
|
//if info is valid (in PVS)
|
||||||
if (entinfo.valid) {
|
if (entinfo.valid) {
|
||||||
int32_t areanum = BotPointAreaNum(entinfo.origin);
|
int32_t areanum = BotPointAreaNum(entinfo.origin);
|
||||||
|
@ -1339,8 +1339,8 @@ void BotMatch_LeadTheWay(bot_state_t *bs, bot_match_t *match) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bs->teamgoal.entitynum < 0) {
|
if (bs->teamgoal.entitynum < 0) {
|
||||||
if (other) BotAI_BotInitialChat(bs, "whereis", teammate, NULL);
|
if (other) AI_main_BotAIInitialChat(bs, "whereis", teammate, NULL);
|
||||||
else BotAI_BotInitialChat(bs, "whereareyou", netname, NULL);
|
else AI_main_BotAIInitialChat(bs, "whereareyou", netname, NULL);
|
||||||
trap_BotEnterChat(bs->cs, bs->client, CHAT_TEAM);
|
trap_BotEnterChat(bs->cs, bs->client, CHAT_TEAM);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1367,7 +1367,7 @@ void BotMatch_Kill(bot_state_t *bs, bot_match_t *match) {
|
||||||
//
|
//
|
||||||
client = FindEnemyByName(bs, enemy);
|
client = FindEnemyByName(bs, enemy);
|
||||||
if (client < 0) {
|
if (client < 0) {
|
||||||
BotAI_BotInitialChat(bs, "whois", enemy, NULL);
|
AI_main_BotAIInitialChat(bs, "whois", enemy, NULL);
|
||||||
trap_BotEnterChat(bs->cs, bs->client, CHAT_TEAM);
|
trap_BotEnterChat(bs->cs, bs->client, CHAT_TEAM);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1589,7 +1589,7 @@ int32_t BotMatchMessage(bot_state_t *bs, char *message) {
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
BotAI_Print(PRT_MESSAGE, "unknown match type\n");
|
AI_main_BotAIPrint(PRT_MESSAGE, "unknown match type\n");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
21
code/game/ai_common.h
Normal file
21
code/game/ai_common.h
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
#ifndef _AI_COMMON_H
|
||||||
|
#define _AI_COMMON_H
|
||||||
|
|
||||||
|
//some maxs
|
||||||
|
#define MAX_NETNAME 36
|
||||||
|
#define MAX_FILEPATH 144
|
||||||
|
|
||||||
|
//bot settings
|
||||||
|
/** \struct bot_settings_t
|
||||||
|
* Containing settings for bots.
|
||||||
|
*/
|
||||||
|
typedef struct bot_settings_s {
|
||||||
|
char characterfile[MAX_FILEPATH]; /*!< filename of character file */
|
||||||
|
int skill; /*!< skill level */
|
||||||
|
char team[MAX_FILEPATH]; /*!< team */
|
||||||
|
char pclass[MAX_FILEPATH]; /*!< class */
|
||||||
|
} bot_settings_t;
|
||||||
|
|
||||||
|
#define AI_Assert(ptr, ret) if(ptr == NULL) { return ret; }
|
||||||
|
|
||||||
|
#endif /* _AI_COMMON_H */
|
|
@ -65,11 +65,11 @@ void BotDumpNodeSwitches(bot_state_t *bs) {
|
||||||
char netname[MAX_NETNAME];
|
char netname[MAX_NETNAME];
|
||||||
|
|
||||||
ClientName(bs->client, netname, sizeof(netname));
|
ClientName(bs->client, netname, sizeof(netname));
|
||||||
BotAI_Print(PRT_MESSAGE, "%s at %1.1f switched more than %d AI nodes\n", netname, trap_AAS_Time(), MAX_NODESWITCHES);
|
AI_main_BotAIPrint(PRT_MESSAGE, "%s at %1.1f switched more than %d AI nodes\n", netname, trap_AAS_Time(), MAX_NODESWITCHES);
|
||||||
for (i = 0; i < numnodeswitches; i++) {
|
for (i = 0; i < numnodeswitches; i++) {
|
||||||
BotAI_Print(PRT_MESSAGE, "%s", nodeswitch[i]);
|
AI_main_BotAIPrint(PRT_MESSAGE, "%s", nodeswitch[i]);
|
||||||
}
|
}
|
||||||
BotAI_Print(PRT_FATAL, "");
|
AI_main_BotAIPrint(PRT_FATAL, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -84,7 +84,7 @@ void BotRecordNodeSwitch(bot_state_t *bs, char *node, char *str) {
|
||||||
Com_sprintf(nodeswitch[numnodeswitches], 144, "%s at %2.1f entered %s: %s\n", netname, trap_AAS_Time(), node, str);
|
Com_sprintf(nodeswitch[numnodeswitches], 144, "%s at %2.1f entered %s: %s\n", netname, trap_AAS_Time(), node, str);
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
if (0) {
|
if (0) {
|
||||||
BotAI_Print(PRT_MESSAGE, nodeswitch[numnodeswitches]);
|
AI_main_BotAIPrint(PRT_MESSAGE, nodeswitch[numnodeswitches]);
|
||||||
}
|
}
|
||||||
#endif //DEBUG
|
#endif //DEBUG
|
||||||
numnodeswitches++;
|
numnodeswitches++;
|
||||||
|
@ -102,10 +102,10 @@ int BotGetAirGoal(bot_state_t *bs, bot_goal_t *goal) {
|
||||||
//trace up until we hit solid
|
//trace up until we hit solid
|
||||||
VectorCopy(bs->origin, end);
|
VectorCopy(bs->origin, end);
|
||||||
end[2] += 1000;
|
end[2] += 1000;
|
||||||
BotAI_Trace(&bsptrace, bs->origin, mins, maxs, end, bs->entitynum, CONTENTS_SOLID|CONTENTS_PLAYERCLIP);
|
AI_main_BotAITrace(&bsptrace, bs->origin, mins, maxs, end, bs->entitynum, CONTENTS_SOLID|CONTENTS_PLAYERCLIP);
|
||||||
//trace down until we hit water
|
//trace down until we hit water
|
||||||
VectorCopy(bsptrace.endpos, end);
|
VectorCopy(bsptrace.endpos, end);
|
||||||
BotAI_Trace(&bsptrace, end, mins, maxs, bs->origin, bs->entitynum, CONTENTS_WATER|CONTENTS_SLIME|CONTENTS_LAVA);
|
AI_main_BotAITrace(&bsptrace, end, mins, maxs, bs->origin, bs->entitynum, CONTENTS_WATER|CONTENTS_SLIME|CONTENTS_LAVA);
|
||||||
//if we found the water surface
|
//if we found the water surface
|
||||||
if (bsptrace.fraction > 0) {
|
if (bsptrace.fraction > 0) {
|
||||||
int areanum = BotPointAreaNum(bsptrace.endpos);
|
int areanum = BotPointAreaNum(bsptrace.endpos);
|
||||||
|
@ -319,7 +319,7 @@ int BotGetLongTermGoal(bot_state_t *bs, int tfl, int retreat, bot_goal_t *goal)
|
||||||
if (bs->ltgtype == LTG_TEAMHELP && !retreat) {
|
if (bs->ltgtype == LTG_TEAMHELP && !retreat) {
|
||||||
//check for bot typing status message
|
//check for bot typing status message
|
||||||
if (bs->teammessage_time && bs->teammessage_time < trap_AAS_Time()) {
|
if (bs->teammessage_time && bs->teammessage_time < trap_AAS_Time()) {
|
||||||
BotAI_BotInitialChat(bs, "help_start", EasyClientName(bs->teammate, netname, sizeof(netname)), NULL);
|
AI_main_BotAIInitialChat(bs, "help_start", EasyClientName(bs->teammate, netname, sizeof(netname)), NULL);
|
||||||
trap_BotEnterChat(bs->cs, bs->client, CHAT_TEAM);
|
trap_BotEnterChat(bs->cs, bs->client, CHAT_TEAM);
|
||||||
bs->teammessage_time = 0;
|
bs->teammessage_time = 0;
|
||||||
}
|
}
|
||||||
|
@ -329,7 +329,7 @@ int BotGetLongTermGoal(bot_state_t *bs, int tfl, int retreat, bot_goal_t *goal)
|
||||||
//if the team mate IS visible for quite some time
|
//if the team mate IS visible for quite some time
|
||||||
if (bs->teammatevisible_time < trap_AAS_Time() - 10) bs->ltgtype = 0;
|
if (bs->teammatevisible_time < trap_AAS_Time() - 10) bs->ltgtype = 0;
|
||||||
//get entity information of the companion
|
//get entity information of the companion
|
||||||
BotEntityInfo(bs->teammate, &entinfo);
|
AI_main_BotEntityInfo(bs->teammate, &entinfo);
|
||||||
//if the team mate is visible
|
//if the team mate is visible
|
||||||
if (BotEntityVisible(bs->entitynum, bs->eye, bs->viewangles, 360, bs->teammate)) {
|
if (BotEntityVisible(bs->entitynum, bs->eye, bs->viewangles, 360, bs->teammate)) {
|
||||||
//if close just stand still there
|
//if close just stand still there
|
||||||
|
@ -362,18 +362,18 @@ int BotGetLongTermGoal(bot_state_t *bs, int tfl, int retreat, bot_goal_t *goal)
|
||||||
if (bs->ltgtype == LTG_TEAMACCOMPANY && !retreat) {
|
if (bs->ltgtype == LTG_TEAMACCOMPANY && !retreat) {
|
||||||
//check for bot typing status message
|
//check for bot typing status message
|
||||||
if (bs->teammessage_time && bs->teammessage_time < trap_AAS_Time()) {
|
if (bs->teammessage_time && bs->teammessage_time < trap_AAS_Time()) {
|
||||||
BotAI_BotInitialChat(bs, "accompany_start", EasyClientName(bs->teammate, netname, sizeof(netname)), NULL);
|
AI_main_BotAIInitialChat(bs, "accompany_start", EasyClientName(bs->teammate, netname, sizeof(netname)), NULL);
|
||||||
trap_BotEnterChat(bs->cs, bs->client, CHAT_TEAM);
|
trap_BotEnterChat(bs->cs, bs->client, CHAT_TEAM);
|
||||||
bs->teammessage_time = 0;
|
bs->teammessage_time = 0;
|
||||||
}
|
}
|
||||||
//if accompanying the companion for 3 minutes
|
//if accompanying the companion for 3 minutes
|
||||||
if (bs->teamgoal_time < trap_AAS_Time()) {
|
if (bs->teamgoal_time < trap_AAS_Time()) {
|
||||||
BotAI_BotInitialChat(bs, "accompany_stop", EasyClientName(bs->teammate, netname, sizeof(netname)), NULL);
|
AI_main_BotAIInitialChat(bs, "accompany_stop", EasyClientName(bs->teammate, netname, sizeof(netname)), NULL);
|
||||||
trap_BotEnterChat(bs->cs, bs->client, CHAT_TEAM);
|
trap_BotEnterChat(bs->cs, bs->client, CHAT_TEAM);
|
||||||
bs->ltgtype = 0;
|
bs->ltgtype = 0;
|
||||||
}
|
}
|
||||||
//get entity information of the companion
|
//get entity information of the companion
|
||||||
BotEntityInfo(bs->teammate, &entinfo);
|
AI_main_BotEntityInfo(bs->teammate, &entinfo);
|
||||||
//if the companion is visible
|
//if the companion is visible
|
||||||
if (BotEntityVisible(bs->entitynum, bs->eye, bs->viewangles, 360, bs->teammate)) {
|
if (BotEntityVisible(bs->entitynum, bs->eye, bs->viewangles, 360, bs->teammate)) {
|
||||||
//update visible time
|
//update visible time
|
||||||
|
@ -395,7 +395,7 @@ int BotGetLongTermGoal(bot_state_t *bs, int tfl, int retreat, bot_goal_t *goal)
|
||||||
//if not arrived yet
|
//if not arrived yet
|
||||||
if (!bs->arrive_time) {
|
if (!bs->arrive_time) {
|
||||||
trap_EA_Gesture(bs->client);
|
trap_EA_Gesture(bs->client);
|
||||||
BotAI_BotInitialChat(bs, "accompany_arrive", EasyClientName(bs->teammate, netname, sizeof(netname)), NULL);
|
AI_main_BotAIInitialChat(bs, "accompany_arrive", EasyClientName(bs->teammate, netname, sizeof(netname)), NULL);
|
||||||
trap_BotEnterChat(bs->cs, bs->client, CHAT_TEAM);
|
trap_BotEnterChat(bs->cs, bs->client, CHAT_TEAM);
|
||||||
bs->arrive_time = trap_AAS_Time();
|
bs->arrive_time = trap_AAS_Time();
|
||||||
}
|
}
|
||||||
|
@ -455,7 +455,7 @@ int BotGetLongTermGoal(bot_state_t *bs, int tfl, int retreat, bot_goal_t *goal)
|
||||||
memcpy(goal, &bs->teamgoal, sizeof(bot_goal_t));
|
memcpy(goal, &bs->teamgoal, sizeof(bot_goal_t));
|
||||||
//if the companion is NOT visible for too long
|
//if the companion is NOT visible for too long
|
||||||
if (bs->teammatevisible_time < trap_AAS_Time() - 60) {
|
if (bs->teammatevisible_time < trap_AAS_Time() - 60) {
|
||||||
BotAI_BotInitialChat(bs, "accompany_cannotfind", EasyClientName(bs->teammate, netname, sizeof(netname)), NULL);
|
AI_main_BotAIInitialChat(bs, "accompany_cannotfind", EasyClientName(bs->teammate, netname, sizeof(netname)), NULL);
|
||||||
trap_BotEnterChat(bs->cs, bs->client, CHAT_TEAM);
|
trap_BotEnterChat(bs->cs, bs->client, CHAT_TEAM);
|
||||||
bs->ltgtype = 0;
|
bs->ltgtype = 0;
|
||||||
}
|
}
|
||||||
|
@ -474,7 +474,7 @@ int BotGetLongTermGoal(bot_state_t *bs, int tfl, int retreat, bot_goal_t *goal)
|
||||||
//check for bot typing status message
|
//check for bot typing status message
|
||||||
if (bs->teammessage_time && bs->teammessage_time < trap_AAS_Time()) {
|
if (bs->teammessage_time && bs->teammessage_time < trap_AAS_Time()) {
|
||||||
trap_BotGoalName(bs->teamgoal.number, buf, sizeof(buf));
|
trap_BotGoalName(bs->teamgoal.number, buf, sizeof(buf));
|
||||||
BotAI_BotInitialChat(bs, "defend_start", buf, NULL);
|
AI_main_BotAIInitialChat(bs, "defend_start", buf, NULL);
|
||||||
trap_BotEnterChat(bs->cs, bs->client, CHAT_TEAM);
|
trap_BotEnterChat(bs->cs, bs->client, CHAT_TEAM);
|
||||||
bs->teammessage_time = 0;
|
bs->teammessage_time = 0;
|
||||||
}
|
}
|
||||||
|
@ -483,7 +483,7 @@ int BotGetLongTermGoal(bot_state_t *bs, int tfl, int retreat, bot_goal_t *goal)
|
||||||
//stop after 2 minutes
|
//stop after 2 minutes
|
||||||
if (bs->teamgoal_time < trap_AAS_Time()) {
|
if (bs->teamgoal_time < trap_AAS_Time()) {
|
||||||
trap_BotGoalName(bs->teamgoal.number, buf, sizeof(buf));
|
trap_BotGoalName(bs->teamgoal.number, buf, sizeof(buf));
|
||||||
BotAI_BotInitialChat(bs, "defend_stop", buf, NULL);
|
AI_main_BotAIInitialChat(bs, "defend_stop", buf, NULL);
|
||||||
trap_BotEnterChat(bs->cs, bs->client, CHAT_TEAM);
|
trap_BotEnterChat(bs->cs, bs->client, CHAT_TEAM);
|
||||||
bs->ltgtype = 0;
|
bs->ltgtype = 0;
|
||||||
}
|
}
|
||||||
|
@ -501,14 +501,14 @@ int BotGetLongTermGoal(bot_state_t *bs, int tfl, int retreat, bot_goal_t *goal)
|
||||||
//check for bot typing status message
|
//check for bot typing status message
|
||||||
if (bs->teammessage_time && bs->teammessage_time < trap_AAS_Time()) {
|
if (bs->teammessage_time && bs->teammessage_time < trap_AAS_Time()) {
|
||||||
EasyClientName(bs->teamgoal.entitynum, buf, sizeof(buf));
|
EasyClientName(bs->teamgoal.entitynum, buf, sizeof(buf));
|
||||||
BotAI_BotInitialChat(bs, "kill_start", buf, NULL);
|
AI_main_BotAIInitialChat(bs, "kill_start", buf, NULL);
|
||||||
trap_BotEnterChat(bs->cs, bs->client, CHAT_TEAM);
|
trap_BotEnterChat(bs->cs, bs->client, CHAT_TEAM);
|
||||||
bs->teammessage_time = 0;
|
bs->teammessage_time = 0;
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
if (bs->lastkilledplayer == bs->teamgoal.entitynum) {
|
if (bs->lastkilledplayer == bs->teamgoal.entitynum) {
|
||||||
EasyClientName(bs->teamgoal.entitynum, buf, sizeof(buf));
|
EasyClientName(bs->teamgoal.entitynum, buf, sizeof(buf));
|
||||||
BotAI_BotInitialChat(bs, "kill_done", buf, NULL);
|
AI_main_BotAIInitialChat(bs, "kill_done", buf, NULL);
|
||||||
trap_BotEnterChat(bs->cs, bs->client, CHAT_TEAM);
|
trap_BotEnterChat(bs->cs, bs->client, CHAT_TEAM);
|
||||||
bs->lastkilledplayer = -1;
|
bs->lastkilledplayer = -1;
|
||||||
bs->ltgtype = 0;
|
bs->ltgtype = 0;
|
||||||
|
@ -525,7 +525,7 @@ int BotGetLongTermGoal(bot_state_t *bs, int tfl, int retreat, bot_goal_t *goal)
|
||||||
//check for bot typing status message
|
//check for bot typing status message
|
||||||
if (bs->teammessage_time && bs->teammessage_time < trap_AAS_Time()) {
|
if (bs->teammessage_time && bs->teammessage_time < trap_AAS_Time()) {
|
||||||
trap_BotGoalName(bs->teamgoal.number, buf, sizeof(buf));
|
trap_BotGoalName(bs->teamgoal.number, buf, sizeof(buf));
|
||||||
BotAI_BotInitialChat(bs, "getitem_start", buf, NULL);
|
AI_main_BotAIInitialChat(bs, "getitem_start", buf, NULL);
|
||||||
trap_BotEnterChat(bs->cs, bs->client, CHAT_TEAM);
|
trap_BotEnterChat(bs->cs, bs->client, CHAT_TEAM);
|
||||||
bs->teammessage_time = 0;
|
bs->teammessage_time = 0;
|
||||||
}
|
}
|
||||||
|
@ -538,13 +538,13 @@ int BotGetLongTermGoal(bot_state_t *bs, int tfl, int retreat, bot_goal_t *goal)
|
||||||
//
|
//
|
||||||
if (trap_BotItemGoalInVisButNotVisible(bs->entitynum, bs->eye, bs->viewangles, goal)) {
|
if (trap_BotItemGoalInVisButNotVisible(bs->entitynum, bs->eye, bs->viewangles, goal)) {
|
||||||
trap_BotGoalName(bs->teamgoal.number, buf, sizeof(buf));
|
trap_BotGoalName(bs->teamgoal.number, buf, sizeof(buf));
|
||||||
BotAI_BotInitialChat(bs, "getitem_notthere", buf, NULL);
|
AI_main_BotAIInitialChat(bs, "getitem_notthere", buf, NULL);
|
||||||
trap_BotEnterChat(bs->cs, bs->client, CHAT_TEAM);
|
trap_BotEnterChat(bs->cs, bs->client, CHAT_TEAM);
|
||||||
bs->ltgtype = 0;
|
bs->ltgtype = 0;
|
||||||
}
|
}
|
||||||
else if (BotReachedGoal(bs, goal)) {
|
else if (BotReachedGoal(bs, goal)) {
|
||||||
trap_BotGoalName(bs->teamgoal.number, buf, sizeof(buf));
|
trap_BotGoalName(bs->teamgoal.number, buf, sizeof(buf));
|
||||||
BotAI_BotInitialChat(bs, "getitem_gotit", buf, NULL);
|
AI_main_BotAIInitialChat(bs, "getitem_gotit", buf, NULL);
|
||||||
trap_BotEnterChat(bs->cs, bs->client, CHAT_TEAM);
|
trap_BotEnterChat(bs->cs, bs->client, CHAT_TEAM);
|
||||||
bs->ltgtype = 0;
|
bs->ltgtype = 0;
|
||||||
}
|
}
|
||||||
|
@ -555,7 +555,7 @@ int BotGetLongTermGoal(bot_state_t *bs, int tfl, int retreat, bot_goal_t *goal)
|
||||||
//check for bot typing status message
|
//check for bot typing status message
|
||||||
if (bs->teammessage_time && bs->teammessage_time < trap_AAS_Time()) {
|
if (bs->teammessage_time && bs->teammessage_time < trap_AAS_Time()) {
|
||||||
if (bs->ltgtype == LTG_CAMPORDER) {
|
if (bs->ltgtype == LTG_CAMPORDER) {
|
||||||
BotAI_BotInitialChat(bs, "camp_start", EasyClientName(bs->teammate, netname, sizeof(netname)), NULL);
|
AI_main_BotAIInitialChat(bs, "camp_start", EasyClientName(bs->teammate, netname, sizeof(netname)), NULL);
|
||||||
trap_BotEnterChat(bs->cs, bs->client, CHAT_TEAM);
|
trap_BotEnterChat(bs->cs, bs->client, CHAT_TEAM);
|
||||||
}
|
}
|
||||||
bs->teammessage_time = 0;
|
bs->teammessage_time = 0;
|
||||||
|
@ -565,7 +565,7 @@ int BotGetLongTermGoal(bot_state_t *bs, int tfl, int retreat, bot_goal_t *goal)
|
||||||
//
|
//
|
||||||
if (bs->teamgoal_time < trap_AAS_Time()) {
|
if (bs->teamgoal_time < trap_AAS_Time()) {
|
||||||
if (bs->ltgtype == LTG_CAMPORDER) {
|
if (bs->ltgtype == LTG_CAMPORDER) {
|
||||||
BotAI_BotInitialChat(bs, "camp_stop", NULL);
|
AI_main_BotAIInitialChat(bs, "camp_stop", NULL);
|
||||||
trap_BotEnterChat(bs->cs, bs->client, CHAT_TEAM);
|
trap_BotEnterChat(bs->cs, bs->client, CHAT_TEAM);
|
||||||
}
|
}
|
||||||
bs->ltgtype = 0;
|
bs->ltgtype = 0;
|
||||||
|
@ -577,7 +577,7 @@ int BotGetLongTermGoal(bot_state_t *bs, int tfl, int retreat, bot_goal_t *goal)
|
||||||
//if not arrived yet
|
//if not arrived yet
|
||||||
if (!bs->arrive_time) {
|
if (!bs->arrive_time) {
|
||||||
if (bs->ltgtype == LTG_CAMPORDER) {
|
if (bs->ltgtype == LTG_CAMPORDER) {
|
||||||
BotAI_BotInitialChat(bs, "camp_arrive", EasyClientName(bs->teammate, netname, sizeof(netname)), NULL);
|
AI_main_BotAIInitialChat(bs, "camp_arrive", EasyClientName(bs->teammate, netname, sizeof(netname)), NULL);
|
||||||
trap_BotEnterChat(bs->cs, bs->client, CHAT_TEAM);
|
trap_BotEnterChat(bs->cs, bs->client, CHAT_TEAM);
|
||||||
}
|
}
|
||||||
bs->arrive_time = trap_AAS_Time();
|
bs->arrive_time = trap_AAS_Time();
|
||||||
|
@ -606,7 +606,7 @@ int BotGetLongTermGoal(bot_state_t *bs, int tfl, int retreat, bot_goal_t *goal)
|
||||||
//make sure the bot is not gonna drown
|
//make sure the bot is not gonna drown
|
||||||
if (trap_PointContents(bs->eye,bs->entitynum) & (CONTENTS_WATER|CONTENTS_SLIME|CONTENTS_LAVA)) {
|
if (trap_PointContents(bs->eye,bs->entitynum) & (CONTENTS_WATER|CONTENTS_SLIME|CONTENTS_LAVA)) {
|
||||||
if (bs->ltgtype == LTG_CAMPORDER) {
|
if (bs->ltgtype == LTG_CAMPORDER) {
|
||||||
BotAI_BotInitialChat(bs, "camp_stop", NULL);
|
AI_main_BotAIInitialChat(bs, "camp_stop", NULL);
|
||||||
trap_BotEnterChat(bs->cs, bs->client, CHAT_TEAM);
|
trap_BotEnterChat(bs->cs, bs->client, CHAT_TEAM);
|
||||||
}
|
}
|
||||||
bs->ltgtype = 0;
|
bs->ltgtype = 0;
|
||||||
|
@ -630,7 +630,7 @@ int BotGetLongTermGoal(bot_state_t *bs, int tfl, int retreat, bot_goal_t *goal)
|
||||||
strcat(buf, wp->name);
|
strcat(buf, wp->name);
|
||||||
if (wp->next) strcat(buf, " to ");
|
if (wp->next) strcat(buf, " to ");
|
||||||
}
|
}
|
||||||
BotAI_BotInitialChat(bs, "patrol_start", buf, NULL);
|
AI_main_BotAIInitialChat(bs, "patrol_start", buf, NULL);
|
||||||
trap_BotEnterChat(bs->cs, bs->client, CHAT_TEAM);
|
trap_BotEnterChat(bs->cs, bs->client, CHAT_TEAM);
|
||||||
bs->teammessage_time = 0;
|
bs->teammessage_time = 0;
|
||||||
}
|
}
|
||||||
|
@ -662,7 +662,7 @@ int BotGetLongTermGoal(bot_state_t *bs, int tfl, int retreat, bot_goal_t *goal)
|
||||||
}
|
}
|
||||||
//stop after 5 minutes
|
//stop after 5 minutes
|
||||||
if (bs->teamgoal_time < trap_AAS_Time()) {
|
if (bs->teamgoal_time < trap_AAS_Time()) {
|
||||||
BotAI_BotInitialChat(bs, "patrol_stop", NULL);
|
AI_main_BotAIInitialChat(bs, "patrol_stop", NULL);
|
||||||
trap_BotEnterChat(bs->cs, bs->client, CHAT_TEAM);
|
trap_BotEnterChat(bs->cs, bs->client, CHAT_TEAM);
|
||||||
bs->ltgtype = 0;
|
bs->ltgtype = 0;
|
||||||
}
|
}
|
||||||
|
@ -678,7 +678,7 @@ int BotGetLongTermGoal(bot_state_t *bs, int tfl, int retreat, bot_goal_t *goal)
|
||||||
if (bs->ltgtype == LTG_GETFLAG) {
|
if (bs->ltgtype == LTG_GETFLAG) {
|
||||||
//check for bot typing status message
|
//check for bot typing status message
|
||||||
if (bs->teammessage_time && bs->teammessage_time < trap_AAS_Time()) {
|
if (bs->teammessage_time && bs->teammessage_time < trap_AAS_Time()) {
|
||||||
BotAI_BotInitialChat(bs, "captureflag_start", NULL);
|
AI_main_BotAIInitialChat(bs, "captureflag_start", NULL);
|
||||||
trap_BotEnterChat(bs->cs, bs->client, CHAT_TEAM);
|
trap_BotEnterChat(bs->cs, bs->client, CHAT_TEAM);
|
||||||
bs->teammessage_time = 0;
|
bs->teammessage_time = 0;
|
||||||
}
|
}
|
||||||
|
@ -693,7 +693,7 @@ int BotGetLongTermGoal(bot_state_t *bs, int tfl, int retreat, bot_goal_t *goal)
|
||||||
//stop after 3 minutes
|
//stop after 3 minutes
|
||||||
if (bs->teamgoal_time < trap_AAS_Time()) {
|
if (bs->teamgoal_time < trap_AAS_Time()) {
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
BotAI_Print(PRT_MESSAGE, "%s: I quit getting the flag\n", ClientName(bs->client, netname, sizeof(netname)));
|
AI_main_BotAIPrint(PRT_MESSAGE, "%s: I quit getting the flag\n", ClientName(bs->client, netname, sizeof(netname)));
|
||||||
#endif //DEBUG
|
#endif //DEBUG
|
||||||
bs->ltgtype = 0;
|
bs->ltgtype = 0;
|
||||||
}
|
}
|
||||||
|
@ -731,7 +731,7 @@ int BotGetLongTermGoal(bot_state_t *bs, int tfl, int retreat, bot_goal_t *goal)
|
||||||
//check for bot typing status message
|
//check for bot typing status message
|
||||||
if (bs->teammessage_time && bs->teammessage_time < trap_AAS_Time()) {
|
if (bs->teammessage_time && bs->teammessage_time < trap_AAS_Time()) {
|
||||||
EasyClientName(bs->teamgoal.entitynum, buf, sizeof(buf));
|
EasyClientName(bs->teamgoal.entitynum, buf, sizeof(buf));
|
||||||
BotAI_BotInitialChat(bs, "returnflag_start", buf, NULL);
|
AI_main_BotAIInitialChat(bs, "returnflag_start", buf, NULL);
|
||||||
trap_BotEnterChat(bs->cs, bs->client, CHAT_TEAM);
|
trap_BotEnterChat(bs->cs, bs->client, CHAT_TEAM);
|
||||||
bs->teammessage_time = 0;
|
bs->teammessage_time = 0;
|
||||||
}
|
}
|
||||||
|
@ -775,12 +775,12 @@ int BotLongTermGoal(bot_state_t *bs, int tfl, int retreat, bot_goal_t *goal) {
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
if (bs->leadmessage_time < 0 && -bs->leadmessage_time < trap_AAS_Time()) {
|
if (bs->leadmessage_time < 0 && -bs->leadmessage_time < trap_AAS_Time()) {
|
||||||
BotAI_BotInitialChat(bs, "followme", EasyClientName(bs->lead_teammate, teammate, sizeof(teammate)), NULL);
|
AI_main_BotAIInitialChat(bs, "followme", EasyClientName(bs->lead_teammate, teammate, sizeof(teammate)), NULL);
|
||||||
trap_BotEnterChat(bs->cs, bs->client, CHAT_TEAM);
|
trap_BotEnterChat(bs->cs, bs->client, CHAT_TEAM);
|
||||||
bs->leadmessage_time = trap_AAS_Time();
|
bs->leadmessage_time = trap_AAS_Time();
|
||||||
}
|
}
|
||||||
//get entity information of the companion
|
//get entity information of the companion
|
||||||
BotEntityInfo(bs->lead_teammate, &entinfo);
|
AI_main_BotEntityInfo(bs->lead_teammate, &entinfo);
|
||||||
//
|
//
|
||||||
if (entinfo.valid) {
|
if (entinfo.valid) {
|
||||||
int areanum = BotPointAreaNum(entinfo.origin);
|
int areanum = BotPointAreaNum(entinfo.origin);
|
||||||
|
@ -807,7 +807,7 @@ int BotLongTermGoal(bot_state_t *bs, int tfl, int retreat, bot_goal_t *goal) {
|
||||||
//if backing up towards the team mate
|
//if backing up towards the team mate
|
||||||
if (bs->leadbackup_time > trap_AAS_Time()) {
|
if (bs->leadbackup_time > trap_AAS_Time()) {
|
||||||
if (bs->leadmessage_time < trap_AAS_Time() - 20) {
|
if (bs->leadmessage_time < trap_AAS_Time() - 20) {
|
||||||
BotAI_BotInitialChat(bs, "followme", EasyClientName(bs->lead_teammate, teammate, sizeof(teammate)), NULL);
|
AI_main_BotAIInitialChat(bs, "followme", EasyClientName(bs->lead_teammate, teammate, sizeof(teammate)), NULL);
|
||||||
trap_BotEnterChat(bs->cs, bs->client, CHAT_TEAM);
|
trap_BotEnterChat(bs->cs, bs->client, CHAT_TEAM);
|
||||||
bs->leadmessage_time = trap_AAS_Time();
|
bs->leadmessage_time = trap_AAS_Time();
|
||||||
}
|
}
|
||||||
|
@ -823,7 +823,7 @@ int BotLongTermGoal(bot_state_t *bs, int tfl, int retreat, bot_goal_t *goal) {
|
||||||
//if quite distant from the team mate
|
//if quite distant from the team mate
|
||||||
if (dist > 500) {
|
if (dist > 500) {
|
||||||
if (bs->leadmessage_time < trap_AAS_Time() - 20) {
|
if (bs->leadmessage_time < trap_AAS_Time() - 20) {
|
||||||
BotAI_BotInitialChat(bs, "followme", EasyClientName(bs->lead_teammate, teammate, sizeof(teammate)), NULL);
|
AI_main_BotAIInitialChat(bs, "followme", EasyClientName(bs->lead_teammate, teammate, sizeof(teammate)), NULL);
|
||||||
trap_BotEnterChat(bs->cs, bs->client, CHAT_TEAM);
|
trap_BotEnterChat(bs->cs, bs->client, CHAT_TEAM);
|
||||||
bs->leadmessage_time = trap_AAS_Time();
|
bs->leadmessage_time = trap_AAS_Time();
|
||||||
}
|
}
|
||||||
|
@ -847,7 +847,7 @@ AIEnter_Intermission
|
||||||
void AIEnter_Intermission(bot_state_t *bs) {
|
void AIEnter_Intermission(bot_state_t *bs) {
|
||||||
BotRecordNodeSwitch(bs, "intermission", "");
|
BotRecordNodeSwitch(bs, "intermission", "");
|
||||||
//reset the bot state
|
//reset the bot state
|
||||||
BotResetState(bs);
|
AI_main_BotResetState(bs);
|
||||||
//check for end level chat
|
//check for end level chat
|
||||||
if (BotChat_EndLevel(bs)) {
|
if (BotChat_EndLevel(bs)) {
|
||||||
trap_BotEnterChat(bs->cs, bs->client, bs->chatto);
|
trap_BotEnterChat(bs->cs, bs->client, bs->chatto);
|
||||||
|
@ -882,7 +882,7 @@ AIEnter_Observer
|
||||||
void AIEnter_Observer(bot_state_t *bs) {
|
void AIEnter_Observer(bot_state_t *bs) {
|
||||||
BotRecordNodeSwitch(bs, "observer", "");
|
BotRecordNodeSwitch(bs, "observer", "");
|
||||||
//reset the bot state
|
//reset the bot state
|
||||||
BotResetState(bs);
|
AI_main_BotResetState(bs);
|
||||||
bs->ainode = AINode_Observer;
|
bs->ainode = AINode_Observer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1050,7 +1050,7 @@ int AINode_Seek_ActivateEntity(bot_state_t *bs) {
|
||||||
else if (trap_BotTouchingGoal(bs->origin, goal)) {
|
else if (trap_BotTouchingGoal(bs->origin, goal)) {
|
||||||
BotChooseWeapon(bs);
|
BotChooseWeapon(bs);
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
BotAI_Print(PRT_MESSAGE, "touched button or trigger\n");
|
AI_main_BotAIPrint(PRT_MESSAGE, "touched button or trigger\n");
|
||||||
#endif //DEBUG
|
#endif //DEBUG
|
||||||
bs->activate_time = 0;
|
bs->activate_time = 0;
|
||||||
}
|
}
|
||||||
|
@ -1475,7 +1475,7 @@ int AINode_Battle_Fight(bot_state_t *bs) {
|
||||||
return qfalse;
|
return qfalse;
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
BotEntityInfo(bs->enemy, &entinfo);
|
AI_main_BotEntityInfo(bs->enemy, &entinfo);
|
||||||
//if the enemy is dead
|
//if the enemy is dead
|
||||||
if (bs->enemydeath_time) {
|
if (bs->enemydeath_time) {
|
||||||
if (bs->enemydeath_time < trap_AAS_Time() - 1.0) {
|
if (bs->enemydeath_time < trap_AAS_Time() - 1.0) {
|
||||||
|
@ -1762,7 +1762,7 @@ int AINode_Battle_Retreat(bot_state_t *bs) {
|
||||||
return qfalse;
|
return qfalse;
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
BotEntityInfo(bs->enemy, &entinfo);
|
AI_main_BotEntityInfo(bs->enemy, &entinfo);
|
||||||
if (EntityIsDead(&entinfo)) {
|
if (EntityIsDead(&entinfo)) {
|
||||||
AIEnter_Seek_LTG(bs);
|
AIEnter_Seek_LTG(bs);
|
||||||
return qfalse;
|
return qfalse;
|
||||||
|
@ -1923,7 +1923,7 @@ int AINode_Battle_NBG(bot_state_t *bs) {
|
||||||
return qfalse;
|
return qfalse;
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
BotEntityInfo(bs->enemy, &entinfo);
|
AI_main_BotEntityInfo(bs->enemy, &entinfo);
|
||||||
if (EntityIsDead(&entinfo)) {
|
if (EntityIsDead(&entinfo)) {
|
||||||
AIEnter_Seek_NBG(bs);
|
AIEnter_Seek_NBG(bs);
|
||||||
return qfalse;
|
return qfalse;
|
||||||
|
|
|
@ -127,7 +127,7 @@ qboolean EntityIsDead(aas_entityinfo_t *entinfo) {
|
||||||
|
|
||||||
if (entinfo->number >= 0 && entinfo->number < MAX_CLIENTS) {
|
if (entinfo->number >= 0 && entinfo->number < MAX_CLIENTS) {
|
||||||
//retrieve the current client state
|
//retrieve the current client state
|
||||||
BotAI_GetClientState( entinfo->number, &ps );
|
AI_main_BotAIGetClientState( entinfo->number, &ps );
|
||||||
if (ps.pm_type != PM_NORMAL) return qtrue;
|
if (ps.pm_type != PM_NORMAL) return qtrue;
|
||||||
}
|
}
|
||||||
return qfalse;
|
return qfalse;
|
||||||
|
@ -271,7 +271,7 @@ void BotCTFSeekGoals(bot_state_t *bs) {
|
||||||
//if not already going for the enemy flag
|
//if not already going for the enemy flag
|
||||||
if (bs->ltgtype != LTG_GETFLAG) {
|
if (bs->ltgtype != LTG_GETFLAG) {
|
||||||
//if there's no bot team leader
|
//if there's no bot team leader
|
||||||
if (!BotTeamLeader(bs)) {
|
if (!AI_main_BotTeamLeader(bs)) {
|
||||||
//go for the enemy flag
|
//go for the enemy flag
|
||||||
bs->ltgtype = LTG_GETFLAG;
|
bs->ltgtype = LTG_GETFLAG;
|
||||||
//no team message
|
//no team message
|
||||||
|
@ -372,7 +372,7 @@ char *ClientName(int client, char *name, int size) {
|
||||||
char buf[MAX_INFO_STRING];
|
char buf[MAX_INFO_STRING];
|
||||||
|
|
||||||
if (client < 0 || client >= MAX_CLIENTS) {
|
if (client < 0 || client >= MAX_CLIENTS) {
|
||||||
BotAI_Print(PRT_ERROR, "ClientName: client out of range\n");
|
AI_main_BotAIPrint(PRT_ERROR, "ClientName: client out of range\n");
|
||||||
return "[client out of range]";
|
return "[client out of range]";
|
||||||
}
|
}
|
||||||
trap_GetConfigstring(CS_PLAYERS+client, buf, sizeof(buf));
|
trap_GetConfigstring(CS_PLAYERS+client, buf, sizeof(buf));
|
||||||
|
@ -391,7 +391,7 @@ char *ClientSkin(int client, char *skin, int size) {
|
||||||
char buf[MAX_INFO_STRING];
|
char buf[MAX_INFO_STRING];
|
||||||
|
|
||||||
if (client < 0 || client >= MAX_CLIENTS) {
|
if (client < 0 || client >= MAX_CLIENTS) {
|
||||||
BotAI_Print(PRT_ERROR, "ClientSkin: client out of range\n");
|
AI_main_BotAIPrint(PRT_ERROR, "ClientSkin: client out of range\n");
|
||||||
return "[client out of range]";
|
return "[client out of range]";
|
||||||
}
|
}
|
||||||
trap_GetConfigstring(CS_PLAYERS+client, buf, sizeof(buf));
|
trap_GetConfigstring(CS_PLAYERS+client, buf, sizeof(buf));
|
||||||
|
@ -623,7 +623,7 @@ void BotUpdateBattleInventory(bot_state_t *bs, int enemy) {
|
||||||
vec3_t dir;
|
vec3_t dir;
|
||||||
aas_entityinfo_t entinfo;
|
aas_entityinfo_t entinfo;
|
||||||
|
|
||||||
BotEntityInfo(enemy, &entinfo);
|
AI_main_BotEntityInfo(enemy, &entinfo);
|
||||||
VectorSubtract(entinfo.origin, bs->origin, dir);
|
VectorSubtract(entinfo.origin, bs->origin, dir);
|
||||||
bs->inventory[ENEMY_HEIGHT] = (int) dir[2];
|
bs->inventory[ENEMY_HEIGHT] = (int) dir[2];
|
||||||
dir[2] = 0;
|
dir[2] = 0;
|
||||||
|
@ -663,7 +663,7 @@ qboolean BotShouldDetonateDetPack(bot_state_t *bs)
|
||||||
// determine who would be killed in the blast radius
|
// determine who would be killed in the blast radius
|
||||||
for (botNum = 0; botNum < MAX_CLIENTS; botNum++)
|
for (botNum = 0; botNum < MAX_CLIENTS; botNum++)
|
||||||
{
|
{
|
||||||
BotEntityInfo(botNum, &botinfo);
|
AI_main_BotEntityInfo(botNum, &botinfo);
|
||||||
if (!botinfo.valid) continue;
|
if (!botinfo.valid) continue;
|
||||||
|
|
||||||
//calculate the distance towards the enemy
|
//calculate the distance towards the enemy
|
||||||
|
@ -838,7 +838,7 @@ bot_waypoint_t *BotCreateWayPoint(char *name, vec3_t origin, int areanum) {
|
||||||
|
|
||||||
wp = botai_freewaypoints;
|
wp = botai_freewaypoints;
|
||||||
if ( !wp ) {
|
if ( !wp ) {
|
||||||
BotAI_Print( PRT_WARNING, "BotCreateWayPoint: Out of waypoints\n" );
|
AI_main_BotAIPrint( PRT_WARNING, "BotCreateWayPoint: Out of waypoints\n" );
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
botai_freewaypoints = botai_freewaypoints->next;
|
botai_freewaypoints = botai_freewaypoints->next;
|
||||||
|
@ -970,7 +970,7 @@ int BotWantsToRetreat(bot_state_t *bs) {
|
||||||
//
|
//
|
||||||
if (bs->enemy >= 0) {
|
if (bs->enemy >= 0) {
|
||||||
//if the enemy is carrying a flag
|
//if the enemy is carrying a flag
|
||||||
BotEntityInfo(bs->enemy, &entinfo);
|
AI_main_BotEntityInfo(bs->enemy, &entinfo);
|
||||||
if (EntityCarriesFlag(&entinfo)) return qfalse;
|
if (EntityCarriesFlag(&entinfo)) return qfalse;
|
||||||
}
|
}
|
||||||
//if the bot is getting the flag
|
//if the bot is getting the flag
|
||||||
|
@ -991,7 +991,7 @@ int BotWantsToChase(bot_state_t *bs) {
|
||||||
//always retreat when carrying a CTF flag
|
//always retreat when carrying a CTF flag
|
||||||
if (BotCTFCarryingFlag(bs)) return qfalse;
|
if (BotCTFCarryingFlag(bs)) return qfalse;
|
||||||
//if the enemy is carrying a flag
|
//if the enemy is carrying a flag
|
||||||
BotEntityInfo(bs->enemy, &entinfo);
|
AI_main_BotEntityInfo(bs->enemy, &entinfo);
|
||||||
if (EntityCarriesFlag(&entinfo)) return qtrue;
|
if (EntityCarriesFlag(&entinfo)) return qtrue;
|
||||||
//if the bot is getting the flag
|
//if the bot is getting the flag
|
||||||
if (bs->ltgtype == LTG_GETFLAG) return qfalse;
|
if (bs->ltgtype == LTG_GETFLAG) return qfalse;
|
||||||
|
@ -1150,7 +1150,7 @@ void BotRoamGoal(bot_state_t *bs, vec3_t goal) {
|
||||||
//add a random value to the z-coordinate (NOTE: 48 = maxjump?)
|
//add a random value to the z-coordinate (NOTE: 48 = maxjump?)
|
||||||
bestorg[2] += 2 * 48 * crandom();
|
bestorg[2] += 2 * 48 * crandom();
|
||||||
//trace a line from the origin to the roam target
|
//trace a line from the origin to the roam target
|
||||||
BotAI_Trace(&trace, bs->origin, NULL, NULL, bestorg, bs->entitynum, MASK_SOLID);
|
AI_main_BotAITrace(&trace, bs->origin, NULL, NULL, bestorg, bs->entitynum, MASK_SOLID);
|
||||||
//direction and length towards the roam target
|
//direction and length towards the roam target
|
||||||
VectorSubtract(trace.endpos, bs->origin, dir);
|
VectorSubtract(trace.endpos, bs->origin, dir);
|
||||||
len = VectorNormalize(dir);
|
len = VectorNormalize(dir);
|
||||||
|
@ -1163,7 +1163,7 @@ void BotRoamGoal(bot_state_t *bs, vec3_t goal) {
|
||||||
belowbestorg[0] = bestorg[0];
|
belowbestorg[0] = bestorg[0];
|
||||||
belowbestorg[1] = bestorg[1];
|
belowbestorg[1] = bestorg[1];
|
||||||
belowbestorg[2] = bestorg[2] - 800;
|
belowbestorg[2] = bestorg[2] - 800;
|
||||||
BotAI_Trace(&trace, bestorg, NULL, NULL, belowbestorg, bs->entitynum, MASK_SOLID);
|
AI_main_BotAITrace(&trace, bestorg, NULL, NULL, belowbestorg, bs->entitynum, MASK_SOLID);
|
||||||
//
|
//
|
||||||
if (!trace.startsolid) {
|
if (!trace.startsolid) {
|
||||||
trace.endpos[2]++;
|
trace.endpos[2]++;
|
||||||
|
@ -1214,7 +1214,7 @@ bot_moveresult_t BotAttackMove(bot_state_t *bs, int tfl) {
|
||||||
//initialize the movement state
|
//initialize the movement state
|
||||||
BotSetupForMovement(bs);
|
BotSetupForMovement(bs);
|
||||||
//get the enemy entity info
|
//get the enemy entity info
|
||||||
BotEntityInfo(bs->enemy, &entinfo);
|
AI_main_BotEntityInfo(bs->enemy, &entinfo);
|
||||||
//direction towards the enemy
|
//direction towards the enemy
|
||||||
VectorSubtract(entinfo.origin, bs->origin, forward);
|
VectorSubtract(entinfo.origin, bs->origin, forward);
|
||||||
//the distance towards the enemy
|
//the distance towards the enemy
|
||||||
|
@ -1370,7 +1370,7 @@ float BotEntityVisible(int viewer, vec3_t eye, vec3_t viewangles, float fov, int
|
||||||
vec3_t dir, entangles, start, end, middle;
|
vec3_t dir, entangles, start, end, middle;
|
||||||
|
|
||||||
//calculate middle of bounding box
|
//calculate middle of bounding box
|
||||||
BotEntityInfo(ent, &entinfo);
|
AI_main_BotEntityInfo(ent, &entinfo);
|
||||||
VectorAdd(entinfo.mins, entinfo.maxs, middle);
|
VectorAdd(entinfo.mins, entinfo.maxs, middle);
|
||||||
VectorScale(middle, 0.5, middle);
|
VectorScale(middle, 0.5, middle);
|
||||||
VectorAdd(entinfo.origin, middle, middle);
|
VectorAdd(entinfo.origin, middle, middle);
|
||||||
|
@ -1408,7 +1408,7 @@ float BotEntityVisible(int viewer, vec3_t eye, vec3_t viewangles, float fov, int
|
||||||
contents_mask ^= (CONTENTS_LAVA|CONTENTS_SLIME|CONTENTS_WATER);
|
contents_mask ^= (CONTENTS_LAVA|CONTENTS_SLIME|CONTENTS_WATER);
|
||||||
}
|
}
|
||||||
//trace from start to end
|
//trace from start to end
|
||||||
BotAI_Trace(&trace, start, NULL, NULL, end, passent, contents_mask);
|
AI_main_BotAITrace(&trace, start, NULL, NULL, end, passent, contents_mask);
|
||||||
//if water was hit
|
//if water was hit
|
||||||
waterfactor = 1.0;
|
waterfactor = 1.0;
|
||||||
if (trace.contents & (CONTENTS_LAVA|CONTENTS_SLIME|CONTENTS_WATER)) {
|
if (trace.contents & (CONTENTS_LAVA|CONTENTS_SLIME|CONTENTS_WATER)) {
|
||||||
|
@ -1416,7 +1416,7 @@ float BotEntityVisible(int viewer, vec3_t eye, vec3_t viewangles, float fov, int
|
||||||
if (1) {
|
if (1) {
|
||||||
//trace through the water
|
//trace through the water
|
||||||
contents_mask &= ~(CONTENTS_LAVA|CONTENTS_SLIME|CONTENTS_WATER);
|
contents_mask &= ~(CONTENTS_LAVA|CONTENTS_SLIME|CONTENTS_WATER);
|
||||||
BotAI_Trace(&trace, trace.endpos, NULL, NULL, end, passent, contents_mask);
|
AI_main_BotAITrace(&trace, trace.endpos, NULL, NULL, end, passent, contents_mask);
|
||||||
waterfactor = 0.5;
|
waterfactor = 0.5;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1431,13 +1431,13 @@ float BotEntityVisible(int viewer, vec3_t eye, vec3_t viewangles, float fov, int
|
||||||
}
|
}
|
||||||
else if (infog) {
|
else if (infog) {
|
||||||
VectorCopy(trace.endpos, start);
|
VectorCopy(trace.endpos, start);
|
||||||
BotAI_Trace(&trace, start, NULL, NULL, eye, viewer, CONTENTS_FOG);
|
AI_main_BotAITrace(&trace, start, NULL, NULL, eye, viewer, CONTENTS_FOG);
|
||||||
VectorSubtract(eye, trace.endpos, dir);
|
VectorSubtract(eye, trace.endpos, dir);
|
||||||
fogdist = VectorLength(dir);
|
fogdist = VectorLength(dir);
|
||||||
}
|
}
|
||||||
else if (otherinfog) {
|
else if (otherinfog) {
|
||||||
VectorCopy(trace.endpos, end);
|
VectorCopy(trace.endpos, end);
|
||||||
BotAI_Trace(&trace, eye, NULL, NULL, end, viewer, CONTENTS_FOG);
|
AI_main_BotAITrace(&trace, eye, NULL, NULL, end, viewer, CONTENTS_FOG);
|
||||||
VectorSubtract(end, trace.endpos, dir);
|
VectorSubtract(end, trace.endpos, dir);
|
||||||
fogdist = VectorLength(dir);
|
fogdist = VectorLength(dir);
|
||||||
}
|
}
|
||||||
|
@ -1480,7 +1480,7 @@ int BotFindEnemy(bot_state_t *bs, int curenemy) {
|
||||||
bs->lasthealth = bs->inventory[INVENTORY_HEALTH];
|
bs->lasthealth = bs->inventory[INVENTORY_HEALTH];
|
||||||
//
|
//
|
||||||
if (curenemy >= 0) {
|
if (curenemy >= 0) {
|
||||||
BotEntityInfo(curenemy, &curenemyinfo);
|
AI_main_BotEntityInfo(curenemy, &curenemyinfo);
|
||||||
if (EntityCarriesFlag(&curenemyinfo)) return qfalse;
|
if (EntityCarriesFlag(&curenemyinfo)) return qfalse;
|
||||||
VectorSubtract(curenemyinfo.origin, bs->origin, dir);
|
VectorSubtract(curenemyinfo.origin, bs->origin, dir);
|
||||||
curdist = VectorLength(dir);
|
curdist = VectorLength(dir);
|
||||||
|
@ -1498,7 +1498,7 @@ int BotFindEnemy(bot_state_t *bs, int curenemy) {
|
||||||
//if it's the current enemy
|
//if it's the current enemy
|
||||||
if (i == curenemy) continue;
|
if (i == curenemy) continue;
|
||||||
//
|
//
|
||||||
BotEntityInfo(i, &entinfo);
|
AI_main_BotEntityInfo(i, &entinfo);
|
||||||
//
|
//
|
||||||
if (!entinfo.valid) continue;
|
if (!entinfo.valid) continue;
|
||||||
//if on the same team
|
//if on the same team
|
||||||
|
@ -1582,7 +1582,7 @@ int BotTeamFlagCarrierVisible(bot_state_t *bs) {
|
||||||
for (i = 0; i < maxclients && i < MAX_CLIENTS; i++) {
|
for (i = 0; i < maxclients && i < MAX_CLIENTS; i++) {
|
||||||
if (i == bs->client) continue;
|
if (i == bs->client) continue;
|
||||||
//
|
//
|
||||||
BotEntityInfo(i, &entinfo);
|
AI_main_BotEntityInfo(i, &entinfo);
|
||||||
//if this player is active
|
//if this player is active
|
||||||
if (!entinfo.valid) continue;
|
if (!entinfo.valid) continue;
|
||||||
//if this player is carrying a flag
|
//if this player is carrying a flag
|
||||||
|
@ -1678,7 +1678,7 @@ void BotAimAtEnemy(bot_state_t *bs) {
|
||||||
//
|
//
|
||||||
if (aim_accuracy <= 0) aim_accuracy = 0.0001;
|
if (aim_accuracy <= 0) aim_accuracy = 0.0001;
|
||||||
//get the enemy entity information
|
//get the enemy entity information
|
||||||
BotEntityInfo(bs->enemy, &entinfo);
|
AI_main_BotEntityInfo(bs->enemy, &entinfo);
|
||||||
//if the enemy is invisible then shoot crappy most of the time
|
//if the enemy is invisible then shoot crappy most of the time
|
||||||
if (EntityIsInvisible(&entinfo)) {
|
if (EntityIsInvisible(&entinfo)) {
|
||||||
if (random() > 0.1) aim_accuracy *= 0.4;
|
if (random() > 0.1) aim_accuracy *= 0.4;
|
||||||
|
@ -1718,7 +1718,7 @@ void BotAimAtEnemy(bot_state_t *bs) {
|
||||||
start[2] += bs->cur_ps.viewheight;
|
start[2] += bs->cur_ps.viewheight;
|
||||||
start[2] += wi.offset[2];
|
start[2] += wi.offset[2];
|
||||||
//
|
//
|
||||||
BotAI_Trace(&trace, start, mins, maxs, bestorigin, bs->entitynum, MASK_SHOT);
|
AI_main_BotAITrace(&trace, start, mins, maxs, bestorigin, bs->entitynum, MASK_SHOT);
|
||||||
//if the enemy is NOT hit
|
//if the enemy is NOT hit
|
||||||
if (trace.fraction <= 1 && trace.ent != entinfo.number) {
|
if (trace.fraction <= 1 && trace.ent != entinfo.number) {
|
||||||
bestorigin[2] += 16;
|
bestorigin[2] += 16;
|
||||||
|
@ -1781,13 +1781,13 @@ void BotAimAtEnemy(bot_state_t *bs) {
|
||||||
//try to aim at the ground in front of the enemy
|
//try to aim at the ground in front of the enemy
|
||||||
VectorCopy(entinfo.origin, end);
|
VectorCopy(entinfo.origin, end);
|
||||||
end[2] -= 64;
|
end[2] -= 64;
|
||||||
BotAI_Trace(&trace, entinfo.origin, NULL, NULL, end, entinfo.number, MASK_SHOT);
|
AI_main_BotAITrace(&trace, entinfo.origin, NULL, NULL, end, entinfo.number, MASK_SHOT);
|
||||||
//
|
//
|
||||||
VectorCopy(bestorigin, groundtarget);
|
VectorCopy(bestorigin, groundtarget);
|
||||||
if (trace.startsolid) groundtarget[2] = entinfo.origin[2] - 16;
|
if (trace.startsolid) groundtarget[2] = entinfo.origin[2] - 16;
|
||||||
else groundtarget[2] = trace.endpos[2] - 8;
|
else groundtarget[2] = trace.endpos[2] - 8;
|
||||||
//trace a line from projectile start to ground target
|
//trace a line from projectile start to ground target
|
||||||
BotAI_Trace(&trace, start, NULL, NULL, groundtarget, bs->entitynum, MASK_SHOT);
|
AI_main_BotAITrace(&trace, start, NULL, NULL, groundtarget, bs->entitynum, MASK_SHOT);
|
||||||
//if hitpoint is not vertically too far from the ground target
|
//if hitpoint is not vertically too far from the ground target
|
||||||
if (fabs(trace.endpos[2] - groundtarget[2]) < 50) {
|
if (fabs(trace.endpos[2] - groundtarget[2]) < 50) {
|
||||||
VectorSubtract(trace.endpos, groundtarget, dir);
|
VectorSubtract(trace.endpos, groundtarget, dir);
|
||||||
|
@ -1798,7 +1798,7 @@ void BotAimAtEnemy(bot_state_t *bs) {
|
||||||
if (VectorLength(dir) > 100) {
|
if (VectorLength(dir) > 100) {
|
||||||
//check if the bot is visible from the ground target
|
//check if the bot is visible from the ground target
|
||||||
trace.endpos[2] += 1;
|
trace.endpos[2] += 1;
|
||||||
BotAI_Trace(&trace, trace.endpos, NULL, NULL, entinfo.origin, entinfo.number, MASK_SHOT);
|
AI_main_BotAITrace(&trace, trace.endpos, NULL, NULL, entinfo.origin, entinfo.number, MASK_SHOT);
|
||||||
if (trace.fraction >= 1) {
|
if (trace.fraction >= 1) {
|
||||||
//botimport.Print(PRT_MESSAGE, "%1.1f aiming at ground\n", AAS_Time());
|
//botimport.Print(PRT_MESSAGE, "%1.1f aiming at ground\n", AAS_Time());
|
||||||
VectorCopy(groundtarget, bestorigin);
|
VectorCopy(groundtarget, bestorigin);
|
||||||
|
@ -1842,7 +1842,7 @@ void BotAimAtEnemy(bot_state_t *bs) {
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
if (enemyvisible) {
|
if (enemyvisible) {
|
||||||
BotAI_Trace(&trace, bs->eye, NULL, NULL, bestorigin, bs->entitynum, MASK_SHOT);
|
AI_main_BotAITrace(&trace, bs->eye, NULL, NULL, bestorigin, bs->entitynum, MASK_SHOT);
|
||||||
VectorCopy(trace.endpos, bs->aimtarget);
|
VectorCopy(trace.endpos, bs->aimtarget);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -1924,7 +1924,7 @@ void BotCheckAttack(bot_state_t *bs) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
BotEntityInfo(bs->enemy, &entinfo);
|
AI_main_BotEntityInfo(bs->enemy, &entinfo);
|
||||||
VectorSubtract(entinfo.origin, bs->eye, dir);
|
VectorSubtract(entinfo.origin, bs->eye, dir);
|
||||||
//
|
//
|
||||||
if (VectorLength(dir) < 100) fov = 120;
|
if (VectorLength(dir) < 100) fov = 120;
|
||||||
|
@ -1937,7 +1937,7 @@ void BotCheckAttack(bot_state_t *bs) {
|
||||||
}*/
|
}*/
|
||||||
vectoangles(dir, angles);
|
vectoangles(dir, angles);
|
||||||
if (!InFieldOfVision(bs->viewangles, fov, angles)) return;
|
if (!InFieldOfVision(bs->viewangles, fov, angles)) return;
|
||||||
BotAI_Trace(&bsptrace, bs->eye, NULL, NULL, bs->aimtarget, bs->client, CONTENTS_SOLID|CONTENTS_PLAYERCLIP);
|
AI_main_BotAITrace(&bsptrace, bs->eye, NULL, NULL, bs->aimtarget, bs->client, CONTENTS_SOLID|CONTENTS_PLAYERCLIP);
|
||||||
if (bsptrace.fraction < 1 && bsptrace.ent != bs->enemy) return;
|
if (bsptrace.fraction < 1 && bsptrace.ent != bs->enemy) return;
|
||||||
|
|
||||||
//get the weapon info
|
//get the weapon info
|
||||||
|
@ -1953,7 +1953,7 @@ void BotCheckAttack(bot_state_t *bs) {
|
||||||
VectorMA(start, 1000, forward, end);
|
VectorMA(start, 1000, forward, end);
|
||||||
//a little back to make sure not inside a very close enemy
|
//a little back to make sure not inside a very close enemy
|
||||||
VectorMA(start, -12, forward, start);
|
VectorMA(start, -12, forward, start);
|
||||||
BotAI_Trace(&trace, start, mins, maxs, end, bs->entitynum, MASK_SHOT);
|
AI_main_BotAITrace(&trace, start, mins, maxs, end, bs->entitynum, MASK_SHOT);
|
||||||
//if won't hit the enemy
|
//if won't hit the enemy
|
||||||
if (trace.ent != bs->enemy) {
|
if (trace.ent != bs->enemy) {
|
||||||
//if the entity is a client
|
//if the entity is a client
|
||||||
|
@ -2041,7 +2041,7 @@ void BotMapScripts(bot_state_t *bs) {
|
||||||
|
|
||||||
if (i == bs->client) continue;
|
if (i == bs->client) continue;
|
||||||
//
|
//
|
||||||
BotEntityInfo(i, &entinfo);
|
AI_main_BotEntityInfo(i, &entinfo);
|
||||||
//
|
//
|
||||||
if (!entinfo.valid) continue;
|
if (!entinfo.valid) continue;
|
||||||
//if the enemy isn't dead and the enemy isn't the bot self
|
//if the enemy isn't dead and the enemy isn't the bot self
|
||||||
|
@ -2104,19 +2104,19 @@ int BotEntityToActivate(int entitynum) {
|
||||||
char targetname[10][128];
|
char targetname[10][128];
|
||||||
aas_entityinfo_t entinfo;
|
aas_entityinfo_t entinfo;
|
||||||
|
|
||||||
BotEntityInfo(entitynum, &entinfo);
|
AI_main_BotEntityInfo(entitynum, &entinfo);
|
||||||
Com_sprintf(model, sizeof( model ), "*%d", entinfo.modelindex);
|
Com_sprintf(model, sizeof( model ), "*%d", entinfo.modelindex);
|
||||||
for (ent = trap_AAS_NextBSPEntity(0); ent; ent = trap_AAS_NextBSPEntity(ent)) {
|
for (ent = trap_AAS_NextBSPEntity(0); ent; ent = trap_AAS_NextBSPEntity(ent)) {
|
||||||
if (!trap_AAS_ValueForBSPEpairKey(ent, "model", tmpmodel, sizeof(tmpmodel))) continue;
|
if (!trap_AAS_ValueForBSPEpairKey(ent, "model", tmpmodel, sizeof(tmpmodel))) continue;
|
||||||
if (!strcmp(model, tmpmodel)) break;
|
if (!strcmp(model, tmpmodel)) break;
|
||||||
}
|
}
|
||||||
if (!ent) {
|
if (!ent) {
|
||||||
BotAI_Print(PRT_ERROR, "BotEntityToActivate: no entity found with model %s\n", model);
|
AI_main_BotAIPrint(PRT_ERROR, "BotEntityToActivate: no entity found with model %s\n", model);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
trap_AAS_ValueForBSPEpairKey(ent, "classname", classname, sizeof(classname));
|
trap_AAS_ValueForBSPEpairKey(ent, "classname", classname, sizeof(classname));
|
||||||
if (!classname[0]) {
|
if (!classname[0]) {
|
||||||
BotAI_Print(PRT_ERROR, "BotEntityToActivate: entity with model %s has no classname\n", model);
|
AI_main_BotAIPrint(PRT_ERROR, "BotEntityToActivate: entity with model %s has no classname\n", model);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
//if it is a door
|
//if it is a door
|
||||||
|
@ -2129,7 +2129,7 @@ int BotEntityToActivate(int entitynum) {
|
||||||
//get the targetname so we can find an entity with a matching target
|
//get the targetname so we can find an entity with a matching target
|
||||||
if (!trap_AAS_ValueForBSPEpairKey(ent, "targetname", targetname[0], sizeof(targetname[0]))) {
|
if (!trap_AAS_ValueForBSPEpairKey(ent, "targetname", targetname[0], sizeof(targetname[0]))) {
|
||||||
#ifdef OBSTACLEDEBUG
|
#ifdef OBSTACLEDEBUG
|
||||||
BotAI_Print(PRT_ERROR, "BotEntityToActivate: entity with model \"%s\" has no targetname\n", model);
|
AI_main_BotAIPrint(PRT_ERROR, "BotEntityToActivate: entity with model \"%s\" has no targetname\n", model);
|
||||||
#endif //OBSTACLEDEBUG
|
#endif //OBSTACLEDEBUG
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -2144,12 +2144,12 @@ int BotEntityToActivate(int entitynum) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!ent) {
|
if (!ent) {
|
||||||
BotAI_Print(PRT_ERROR, "BotEntityToActivate: no entity with target \"%s\"\n", targetname[i]);
|
AI_main_BotAIPrint(PRT_ERROR, "BotEntityToActivate: no entity with target \"%s\"\n", targetname[i]);
|
||||||
i--;
|
i--;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (!trap_AAS_ValueForBSPEpairKey(ent, "classname", classname, sizeof(classname))) {
|
if (!trap_AAS_ValueForBSPEpairKey(ent, "classname", classname, sizeof(classname))) {
|
||||||
BotAI_Print(PRT_ERROR, "BotEntityToActivate: entity with target \"%s\" has no classname\n", targetname[i]);
|
AI_main_BotAIPrint(PRT_ERROR, "BotEntityToActivate: entity with target \"%s\" has no classname\n", targetname[i]);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (!strcmp(classname, "func_button")) {
|
if (!strcmp(classname, "func_button")) {
|
||||||
|
@ -2164,7 +2164,7 @@ int BotEntityToActivate(int entitynum) {
|
||||||
i--;
|
i--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
BotAI_Print(PRT_ERROR, "BotEntityToActivate: unknown activator with classname \"%s\"\n", classname);
|
AI_main_BotAIPrint(PRT_ERROR, "BotEntityToActivate: unknown activator with classname \"%s\"\n", classname);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2249,10 +2249,10 @@ void BotAIBlocked(bot_state_t *bs, bot_moveresult_t *moveresult, int activate) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
BotEntityInfo(moveresult->blockentity, &entinfo);
|
AI_main_BotEntityInfo(moveresult->blockentity, &entinfo);
|
||||||
#ifdef OBSTACLEDEBUG
|
#ifdef OBSTACLEDEBUG
|
||||||
ClientName(bs->client, netname, sizeof(netname));
|
ClientName(bs->client, netname, sizeof(netname));
|
||||||
BotAI_Print(PRT_MESSAGE, "%s: I'm blocked by model %d\n", netname, entinfo.modelindex);
|
AI_main_BotAIPrint(PRT_MESSAGE, "%s: I'm blocked by model %d\n", netname, entinfo.modelindex);
|
||||||
#endif
|
#endif
|
||||||
//if blocked by a bsp model and the bot wants to activate it if possible
|
//if blocked by a bsp model and the bot wants to activate it if possible
|
||||||
if (entinfo.modelindex > 0 && entinfo.modelindex <= max_bspmodelindex && activate) {
|
if (entinfo.modelindex > 0 && entinfo.modelindex <= max_bspmodelindex && activate) {
|
||||||
|
@ -2262,14 +2262,14 @@ void BotAIBlocked(bot_state_t *bs, bot_moveresult_t *moveresult, int activate) {
|
||||||
if (!ent) {
|
if (!ent) {
|
||||||
strcpy(classname, "");
|
strcpy(classname, "");
|
||||||
#ifdef OBSTACLEDEBUG
|
#ifdef OBSTACLEDEBUG
|
||||||
BotAI_Print(PRT_MESSAGE, "%s: can't find activator for blocking entity\n", ClientName(bs->client, netname, sizeof(netname)));
|
AI_main_BotAIPrint(PRT_MESSAGE, "%s: can't find activator for blocking entity\n", ClientName(bs->client, netname, sizeof(netname)));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
trap_AAS_ValueForBSPEpairKey(ent, "classname", classname, sizeof(classname));
|
trap_AAS_ValueForBSPEpairKey(ent, "classname", classname, sizeof(classname));
|
||||||
#ifdef OBSTACLEDEBUG
|
#ifdef OBSTACLEDEBUG
|
||||||
ClientName(bs->client, netname, sizeof(netname));
|
ClientName(bs->client, netname, sizeof(netname));
|
||||||
BotAI_Print(PRT_MESSAGE, "%s: I should activate %s\n", netname, classname);
|
AI_main_BotAIPrint(PRT_MESSAGE, "%s: I should activate %s\n", netname, classname);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
if (!strcmp(classname, "func_button")) {
|
if (!strcmp(classname, "func_button")) {
|
||||||
|
@ -2370,8 +2370,8 @@ void BotAIBlocked(bot_state_t *bs, bot_moveresult_t *moveresult, int activate) {
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
#ifdef OBSTACLEDEBUG
|
#ifdef OBSTACLEDEBUG
|
||||||
if (!numareas) BotAI_Print(PRT_MESSAGE, "button not in an area\n");
|
if (!numareas) AI_main_BotAIPrint(PRT_MESSAGE, "button not in an area\n");
|
||||||
else BotAI_Print(PRT_MESSAGE, "button area has no reachabilities\n");
|
else AI_main_BotAIPrint(PRT_MESSAGE, "button area has no reachabilities\n");
|
||||||
#endif //OBSTACLEDEBUG
|
#endif //OBSTACLEDEBUG
|
||||||
if (bs->ainode == AINode_Seek_NBG) bs->nbg_time = 0;
|
if (bs->ainode == AINode_Seek_NBG) bs->nbg_time = 0;
|
||||||
else if (bs->ainode == AINode_Seek_LTG) bs->ltg_time = 0;
|
else if (bs->ainode == AINode_Seek_LTG) bs->ltg_time = 0;
|
||||||
|
@ -2523,16 +2523,16 @@ void BotCheckConsoleMessages(bot_state_t *bs) {
|
||||||
NULL, NULL,
|
NULL, NULL,
|
||||||
NULL, NULL,
|
NULL, NULL,
|
||||||
botname, netname)) {
|
botname, netname)) {
|
||||||
BotAI_Print(PRT_MESSAGE, "------------------------\n");
|
AI_main_BotAIPrint(PRT_MESSAGE, "------------------------\n");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
BotAI_Print(PRT_MESSAGE, "**** no valid reply ****\n");
|
AI_main_BotAIPrint(PRT_MESSAGE, "**** no valid reply ****\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//if at a valid chat position and not chatting already
|
//if at a valid chat position and not chatting already
|
||||||
else if (bs->ainode != AINode_Stand && BotValidChatPosition(bs)) {
|
else if (bs->ainode != AINode_Stand && BotValidChatPosition(bs)) {
|
||||||
chat_reply = 0;
|
chat_reply = 0;
|
||||||
if (random() < 1.5 / (NumBots()+1) && random() < chat_reply) {
|
if (random() < 1.5 / (AI_main_NumBots()+1) && random() < chat_reply) {
|
||||||
//if bot replies with a chat message
|
//if bot replies with a chat message
|
||||||
if (trap_BotReplyChat(bs->cs, message, context, CONTEXT_REPLY,
|
if (trap_BotReplyChat(bs->cs, message, context, CONTEXT_REPLY,
|
||||||
NULL, NULL,
|
NULL, NULL,
|
||||||
|
@ -2614,7 +2614,7 @@ void BotCheckEvents(bot_state_t *bs, entityState_t *state) {
|
||||||
case EV_GLOBAL_SOUND:
|
case EV_GLOBAL_SOUND:
|
||||||
{
|
{
|
||||||
if (state->eventParm < 0 || state->eventParm > MAX_SOUNDS) {
|
if (state->eventParm < 0 || state->eventParm > MAX_SOUNDS) {
|
||||||
BotAI_Print(PRT_ERROR, "EV_GLOBAL_SOUND: eventParm (%d) out of range\n", state->eventParm);
|
AI_main_BotAIPrint(PRT_ERROR, "EV_GLOBAL_SOUND: eventParm (%d) out of range\n", state->eventParm);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -2630,7 +2630,7 @@ void BotCheckEvents(bot_state_t *bs, entityState_t *state) {
|
||||||
case EV_TEAM_SOUND:
|
case EV_TEAM_SOUND:
|
||||||
{
|
{
|
||||||
if (state->eventParm < 0 || state->eventParm > MAX_TEAM_SOUNDS) {
|
if (state->eventParm < 0 || state->eventParm > MAX_TEAM_SOUNDS) {
|
||||||
BotAI_Print(PRT_ERROR, "EV_TEAM_SOUND: eventParm (%d) out of range\n", state->eventParm);
|
AI_main_BotAIPrint(PRT_ERROR, "EV_TEAM_SOUND: eventParm (%d) out of range\n", state->eventParm);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2665,7 +2665,7 @@ void BotCheckEvents(bot_state_t *bs, entityState_t *state) {
|
||||||
//if this sound is played on the bot
|
//if this sound is played on the bot
|
||||||
if (state->number == bs->client) {
|
if (state->number == bs->client) {
|
||||||
if (state->eventParm < 0 || state->eventParm > MAX_SOUNDS) {
|
if (state->eventParm < 0 || state->eventParm > MAX_SOUNDS) {
|
||||||
BotAI_Print(PRT_ERROR, "EV_GENERAL_SOUND: eventParm (%d) out of range\n", state->eventParm);
|
AI_main_BotAIPrint(PRT_ERROR, "EV_GENERAL_SOUND: eventParm (%d) out of range\n", state->eventParm);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
//check out the sound
|
//check out the sound
|
||||||
|
@ -2695,12 +2695,12 @@ void BotCheckSnapshot(bot_state_t *bs) {
|
||||||
|
|
||||||
//
|
//
|
||||||
ent = 0;
|
ent = 0;
|
||||||
while( ( ent = BotAI_GetSnapshotEntity( bs->client, ent, &state ) ) != -1 ) {
|
while( ( ent = AI_main_BotAIGetSnapshotEntity( bs->client, ent, &state ) ) != -1 ) {
|
||||||
//check the entity state for events
|
//check the entity state for events
|
||||||
BotCheckEvents(bs, &state);
|
BotCheckEvents(bs, &state);
|
||||||
}
|
}
|
||||||
//check the player state for events
|
//check the player state for events
|
||||||
BotAI_GetEntityState(bs->client, &state);
|
AI_main_BotAIGetEntityState(bs->client, &state);
|
||||||
//copy the player state events to the entity state
|
//copy the player state events to the entity state
|
||||||
state.event = bs->cur_ps.externalEvent;
|
state.event = bs->cur_ps.externalEvent;
|
||||||
state.eventParm = bs->cur_ps.externalEventParm;
|
state.eventParm = bs->cur_ps.externalEventParm;
|
||||||
|
@ -2803,7 +2803,7 @@ void BotDeathmatchAI(bot_state_t *bs, float thinktime) {
|
||||||
trap_BotDumpAvoidGoals(bs->gs);
|
trap_BotDumpAvoidGoals(bs->gs);
|
||||||
BotDumpNodeSwitches(bs);
|
BotDumpNodeSwitches(bs);
|
||||||
ClientName(bs->client, name, sizeof(name));
|
ClientName(bs->client, name, sizeof(name));
|
||||||
BotAI_Print(PRT_ERROR, "%s at %1.1f switched more than %d AI nodes\n", name, trap_AAS_Time(), MAX_NODESWITCHES);
|
AI_main_BotAIPrint(PRT_ERROR, "%s at %1.1f switched more than %d AI nodes\n", name, trap_AAS_Time(), MAX_NODESWITCHES);
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
bs->lastframe_health = bs->inventory[INVENTORY_HEALTH];
|
bs->lastframe_health = bs->inventory[INVENTORY_HEALTH];
|
||||||
|
@ -2831,9 +2831,9 @@ void BotSetupDeathmatchAI(void) {
|
||||||
//
|
//
|
||||||
if (gametype == GT_CTF) {
|
if (gametype == GT_CTF) {
|
||||||
if (trap_BotGetLevelItemGoal(-1, "Red Flag", &ctf_redflag) < 0)
|
if (trap_BotGetLevelItemGoal(-1, "Red Flag", &ctf_redflag) < 0)
|
||||||
BotAI_Print(PRT_WARNING, "CTF without Red Flag\n");
|
AI_main_BotAIPrint(PRT_WARNING, "CTF without Red Flag\n");
|
||||||
if (trap_BotGetLevelItemGoal(-1, "Blue Flag", &ctf_blueflag) < 0)
|
if (trap_BotGetLevelItemGoal(-1, "Blue Flag", &ctf_blueflag) < 0)
|
||||||
BotAI_Print(PRT_WARNING, "CTF without Blue Flag\n");
|
AI_main_BotAIPrint(PRT_WARNING, "CTF without Blue Flag\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
max_bspmodelindex = 0;
|
max_bspmodelindex = 0;
|
||||||
|
|
1024
code/game/ai_main.c
1024
code/game/ai_main.c
File diff suppressed because it is too large
Load diff
|
@ -7,7 +7,7 @@
|
||||||
* desc: Quake3 bot AI
|
* desc: Quake3 bot AI
|
||||||
*
|
*
|
||||||
* $Archive: /StarTrek/Code-DM/game/ai_main.h $
|
* $Archive: /StarTrek/Code-DM/game/ai_main.h $
|
||||||
* $Author: Jmonroe $
|
* $Author: Jmonroe $
|
||||||
* $Revision: 1 $
|
* $Revision: 1 $
|
||||||
* $Modtime: 1/21/00 10:12p $
|
* $Modtime: 1/21/00 10:12p $
|
||||||
* $Date: 1/25/00 6:26p $
|
* $Date: 1/25/00 6:26p $
|
||||||
|
@ -17,30 +17,46 @@
|
||||||
#ifndef AI_MAIN_H_
|
#ifndef AI_MAIN_H_
|
||||||
#define AI_AMIN_H_
|
#define AI_AMIN_H_
|
||||||
|
|
||||||
|
#include "ai_common.h"
|
||||||
|
#include "be_ai_goal.h"
|
||||||
|
#include "be_aas.h"
|
||||||
|
#include "botlib.h"
|
||||||
|
|
||||||
|
//some maxs
|
||||||
|
#define MAX_NETNAME 36
|
||||||
|
#define MAX_FILEPATH 144
|
||||||
|
|
||||||
//#define DEBUG
|
//#define DEBUG
|
||||||
#define CTF
|
#define CTF
|
||||||
|
|
||||||
#define MAX_ITEMS 256
|
#define MAX_ITEMS 256
|
||||||
//bot flags
|
//bot flags
|
||||||
#define BFL_STRAFERIGHT 1 //!<strafe to the right
|
|
||||||
#define BFL_ATTACKED 2 //!<bot has attacked last ai frame
|
typedef enum {
|
||||||
#define BFL_ATTACKJUMPED 4 //!<bot jumped during attack last frame
|
BFL_STRAFERIGHT = 1, //!<strafe to the right
|
||||||
#define BFL_AIMATENEMY 8 //!<bot aimed at the enemy this frame
|
BFL_ATTACKED = 2, //!<bot has attacked last ai frame
|
||||||
#define BFL_AVOIDRIGHT 16 //!<avoid obstacles by going to the right
|
BFL_ATTACKJUMPED = 4, //!<bot jumped during attack last frame
|
||||||
#define BFL_IDEALVIEWSET 32 //!<bot has ideal view angles set
|
BFL_AIMATENEMY = 8, //!<bot aimed at the enemy this frame
|
||||||
#define BFL_FIGHTSUICIDAL 64 //!<bot is in a suicidal fight
|
BFL_AVOIDRIGHT = 16, //!<avoid obstacles by going to the right
|
||||||
|
BFL_IDEALVIEWSET = 32, //!<bot has ideal view angles set
|
||||||
|
BFL_FIGHTSUICIDAL = 64 //!<bot is in a suicidal fight
|
||||||
|
} BFL;
|
||||||
|
|
||||||
//long term goal types
|
//long term goal types
|
||||||
#define LTG_TEAMHELP 1 //!<help a team mate
|
typedef enum {
|
||||||
#define LTG_TEAMACCOMPANY 2 //!<accompany a team mate
|
LTG_TEAMHELP = 1, //!<help a team mate
|
||||||
#define LTG_DEFENDKEYAREA 3 //!<defend a key area
|
LTG_TEAMACCOMPANY, //!<accompany a team mate
|
||||||
#define LTG_GETFLAG 4 //!<get the enemy flag
|
LTG_DEFENDKEYAREA, //!<defend a key area
|
||||||
#define LTG_RUSHBASE 5 //!<rush to the base
|
LTG_GETFLAG, //!<get the enemy flag
|
||||||
#define LTG_RETURNFLAG 6 //!<return the flag
|
LTG_RUSHBASE, //!<rush to the base
|
||||||
#define LTG_CAMP 7 //!<camp somewhere
|
LTG_RETURNFLAG, //!<return the flag
|
||||||
#define LTG_CAMPORDER 8 //!<ordered to camp somewhere
|
LTG_CAMP, //!<camp somewhere
|
||||||
#define LTG_PATROL 9 //!<patrol
|
LTG_CAMPORDER, //!<ordered to camp somewhere
|
||||||
#define LTG_GETITEM 10 //!<get an item
|
LTG_PATROL, //!<patrol
|
||||||
#define LTG_KILL 11 //!<kill someone
|
LTG_GETITEM, //!<get an item
|
||||||
|
LTG_KILL //!<kill someone
|
||||||
|
} LTG;
|
||||||
|
|
||||||
//some goal dedication times
|
//some goal dedication times
|
||||||
#define TEAM_HELP_TIME 10 //!<1 minute teamplay help time
|
#define TEAM_HELP_TIME 10 //!<1 minute teamplay help time
|
||||||
#define TEAM_ACCOMPANY_TIME 10 //!<10 minutes teamplay accompany time
|
#define TEAM_ACCOMPANY_TIME 10 //!<10 minutes teamplay accompany time
|
||||||
|
@ -69,139 +85,137 @@
|
||||||
#define PRESENCE_CROUCH 4
|
#define PRESENCE_CROUCH 4
|
||||||
|
|
||||||
//!check points
|
//!check points
|
||||||
typedef struct bot_waypoint_s
|
typedef struct bot_waypoint_s {
|
||||||
{
|
int32_t inuse;
|
||||||
int inuse;
|
|
||||||
char name[32];
|
char name[32];
|
||||||
bot_goal_t goal;
|
bot_goal_t goal;
|
||||||
struct bot_waypoint_s *next, *prev;
|
struct bot_waypoint_s *next, *prev;
|
||||||
} bot_waypoint_t;
|
} bot_waypoint_t;
|
||||||
|
|
||||||
//!bot state
|
//!bot state
|
||||||
typedef struct bot_state_s
|
typedef struct bot_state_s {
|
||||||
{
|
int32_t inuse; //!<true if this state is used by a bot client
|
||||||
int inuse; //!<true if this state is used by a bot client
|
int32_t botthink_residual; //!<residual for the bot thinks
|
||||||
int botthink_residual; //!<residual for the bot thinks
|
int32_t client; //!<client number of the bot
|
||||||
int client; //!<client number of the bot
|
int32_t entitynum; //!<entity number of the bot
|
||||||
int entitynum; //!<entity number of the bot
|
|
||||||
playerState_t cur_ps; //!<current player state
|
playerState_t cur_ps; //!<current player state
|
||||||
int last_eFlags; //!<last ps flags
|
int32_t last_eFlags; //!<last ps flags
|
||||||
usercmd_t lastucmd; //!<usercmd from last frame
|
usercmd_t lastucmd; //!<usercmd from last frame
|
||||||
int entityeventTime[1024]; //!<last entity event time
|
int32_t entityeventTime[1024]; //!<last entity event time
|
||||||
//
|
//
|
||||||
bot_settings_t settings; //!<several bot settings
|
bot_settings_t settings; //!<several bot settings
|
||||||
int (*ainode)(struct bot_state_s *bs); //!<current AI node
|
int(*ainode)(struct bot_state_s *bs); //!<current AI node
|
||||||
float thinktime; //!<time the bot thinks this frame
|
double thinktime; //!<time the bot thinks this frame
|
||||||
vec3_t origin; //!<origin of the bot
|
vec3_t origin; //!<origin of the bot
|
||||||
vec3_t velocity; //!<velocity of the bot
|
vec3_t velocity; //!<velocity of the bot
|
||||||
int presencetype; //!<presence type of the bot
|
int32_t presencetype; //!<presence type of the bot
|
||||||
vec3_t eye; //!<eye coordinates of the bot
|
vec3_t eye; //!<eye coordinates of the bot
|
||||||
int areanum; //!<the number of the area the bot is in
|
int32_t areanum; //!<the number of the area the bot is in
|
||||||
int inventory[MAX_ITEMS]; //!<string with items amounts the bot has
|
int32_t inventory[MAX_ITEMS]; //!<string with items amounts the bot has
|
||||||
int tfl; //!<the travel flags the bot uses
|
int32_t tfl; //!<the travel flags the bot uses
|
||||||
int flags; //!<several flags
|
int32_t flags; //!<several flags
|
||||||
int respawn_wait; //!<wait until respawned
|
int32_t respawn_wait; //!<wait until respawned
|
||||||
int lasthealth; //!<health value previous frame
|
int32_t lasthealth; //!<health value previous frame
|
||||||
int lastkilledplayer; //!<last killed player
|
int32_t lastkilledplayer; //!<last killed player
|
||||||
int lastkilledby; //!<player that last killed this bot
|
int32_t lastkilledby; //!<player that last killed this bot
|
||||||
int botdeathtype; //!<the death type of the bot
|
int32_t botdeathtype; //!<the death type of the bot
|
||||||
int enemydeathtype; //!<the death type of the enemy
|
int32_t enemydeathtype; //!<the death type of the enemy
|
||||||
int botsuicide; //!<true when the bot suicides
|
int32_t botsuicide; //!<true when the bot suicides
|
||||||
int enemysuicide; //!<true when the enemy of the bot suicides
|
int32_t enemysuicide; //!<true when the enemy of the bot suicides
|
||||||
int setupcount; //!<true when the bot has just been setup
|
int32_t setupcount; //!<true when the bot has just been setup
|
||||||
int entergamechat; //!<true when the bot used an enter game chat
|
int32_t entergamechat; //!<true when the bot used an enter game chat
|
||||||
int num_deaths; //!<number of time this bot died
|
int32_t num_deaths; //!<number of time this bot died
|
||||||
int num_kills; //!<number of kills of this bot
|
int32_t num_kills; //!<number of kills of this bot
|
||||||
int revenge_enemy; //!<the revenge enemy
|
int32_t revenge_enemy; //!<the revenge enemy
|
||||||
int revenge_kills; //!<number of kills the enemy made
|
int32_t revenge_kills; //!<number of kills the enemy made
|
||||||
int lastframe_health; //!<health value the last frame
|
int32_t lastframe_health; //!<health value the last frame
|
||||||
int lasthitcount; //!<number of hits last frame
|
int32_t lasthitcount; //!<number of hits last frame
|
||||||
int chatto; //!<chat to all or team
|
int32_t chatto; //!<chat to all or team
|
||||||
float walker; //!<walker charactertic
|
double walker; //!<walker charactertic
|
||||||
float ltime; //!<local bot time
|
double ltime; //!<local bot time
|
||||||
float entergame_time; //!<time the bot entered the game
|
double entergame_time; //!<time the bot entered the game
|
||||||
float ltg_time; //!<long term goal time
|
double ltg_time; //!<long term goal time
|
||||||
float nbg_time; //!<nearby goal time
|
double nbg_time; //!<nearby goal time
|
||||||
float respawn_time; //!<time the bot takes to respawn
|
double respawn_time; //!<time the bot takes to respawn
|
||||||
float respawnchat_time; //!<time the bot started a chat during respawn
|
double respawnchat_time; //!<time the bot started a chat during respawn
|
||||||
float chase_time; //!<time the bot will chase the enemy
|
double chase_time; //!<time the bot will chase the enemy
|
||||||
float enemyvisible_time; //!<time the enemy was last visible
|
double enemyvisible_time; //!<time the enemy was last visible
|
||||||
float check_time; //!<time to check for nearby items
|
double check_time; //!<time to check for nearby items
|
||||||
float stand_time; //!<time the bot is standing still
|
double stand_time; //!<time the bot is standing still
|
||||||
float lastchat_time; //!<time the bot last selected a chat
|
double lastchat_time; //!<time the bot last selected a chat
|
||||||
float standfindenemy_time; //!<time to find enemy while standing
|
double standfindenemy_time; //!<time to find enemy while standing
|
||||||
float attackstrafe_time; //!<time the bot is strafing in one dir
|
double attackstrafe_time; //!<time the bot is strafing in one dir
|
||||||
float attackcrouch_time; //!<time the bot will stop crouching
|
double attackcrouch_time; //!<time the bot will stop crouching
|
||||||
float attackchase_time; //!<time the bot chases during actual attack
|
double attackchase_time; //!<time the bot chases during actual attack
|
||||||
float attackjump_time; //!<time the bot jumped during attack
|
double attackjump_time; //!<time the bot jumped during attack
|
||||||
float enemysight_time; //!<time before reacting to enemy
|
double enemysight_time; //!<time before reacting to enemy
|
||||||
float enemydeath_time; //!<time the enemy died
|
double enemydeath_time; //!<time the enemy died
|
||||||
float enemyposition_time; //!<time the position and velocity of the enemy were stored
|
double enemyposition_time; //!<time the position and velocity of the enemy were stored
|
||||||
float activate_time; //!<time to activate something
|
double activate_time; //!<time to activate something
|
||||||
float activatemessage_time; //!<time to show activate message
|
double activatemessage_time; //!<time to show activate message
|
||||||
float defendaway_time; //!<time away while defending
|
double defendaway_time; //!<time away while defending
|
||||||
float defendaway_range; //!<max travel time away from defend area
|
double defendaway_range; //!<max travel time away from defend area
|
||||||
float rushbaseaway_time; //!<time away from rushing to the base
|
double rushbaseaway_time; //!<time away from rushing to the base
|
||||||
float ctfroam_time; //!<time the bot is roaming in ctf
|
double ctfroam_time; //!<time the bot is roaming in ctf
|
||||||
float killedenemy_time; //!<time the bot killed the enemy
|
double killedenemy_time; //!<time the bot killed the enemy
|
||||||
float arrive_time; //!<time arrived (at companion)
|
double arrive_time; //!<time arrived (at companion)
|
||||||
float lastair_time; //!<last time the bot had air
|
double lastair_time; //!<last time the bot had air
|
||||||
float teleport_time; //!<last time the bot teleported
|
double teleport_time; //!<last time the bot teleported
|
||||||
float camp_time; //!<last time camped
|
double camp_time; //!<last time camped
|
||||||
float camp_range; //!<camp range
|
double camp_range; //!<camp range
|
||||||
float weaponchange_time; //!<time the bot started changing weapons
|
double weaponchange_time; //!<time the bot started changing weapons
|
||||||
float firethrottlewait_time; //!<amount of time to wait
|
double firethrottlewait_time; //!<amount of time to wait
|
||||||
float firethrottleshoot_time; //!<amount of time to shoot
|
double firethrottleshoot_time; //!<amount of time to shoot
|
||||||
float notblocked_time; //!<last time the bot was not blocked
|
double notblocked_time; //!<last time the bot was not blocked
|
||||||
vec3_t aimtarget;
|
vec3_t aimtarget;
|
||||||
vec3_t enemyvelocity; //!<enemy velocity 0.5 secs ago during battle
|
vec3_t enemyvelocity; //!<enemy velocity 0.5 secs ago during battle
|
||||||
vec3_t enemyorigin; //!<enemy origin 0.5 secs ago during battle
|
vec3_t enemyorigin; //!<enemy origin 0.5 secs ago during battle
|
||||||
//
|
//
|
||||||
int character; //!<the bot character
|
int32_t character; //!<the bot character
|
||||||
int ms; //!<move state of the bot
|
int32_t ms; //!<move state of the bot
|
||||||
int gs; //!<goal state of the bot
|
int32_t gs; //!<goal state of the bot
|
||||||
int cs; //!<chat state of the bot
|
int32_t cs; //!<chat state of the bot
|
||||||
int ws; //!<weapon state of the bot
|
int32_t ws; //!<weapon state of the bot
|
||||||
//
|
//
|
||||||
int enemy; //!<enemy entity number
|
int32_t enemy; //!<enemy entity number
|
||||||
int lastenemyareanum; //!<last reachability area the enemy was in
|
int32_t lastenemyareanum; //!<last reachability area the enemy was in
|
||||||
vec3_t lastenemyorigin; //!<last origin of the enemy in the reachability area
|
vec3_t lastenemyorigin; //!<last origin of the enemy in the reachability area
|
||||||
int weaponnum; //!<current weapon number
|
int32_t weaponnum; //!<current weapon number
|
||||||
vec3_t viewangles; //!<current view angles
|
vec3_t viewangles; //!<current view angles
|
||||||
vec3_t ideal_viewangles; //!<ideal view angles
|
vec3_t ideal_viewangles; //!<ideal view angles
|
||||||
vec3_t viewanglespeed;
|
vec3_t viewanglespeed;
|
||||||
//
|
//
|
||||||
int ltgtype; //!<long term goal type
|
int32_t ltgtype; //!<long term goal type
|
||||||
//
|
//
|
||||||
int teammate; //!<team mate
|
int32_t teammate; //!<team mate
|
||||||
bot_goal_t teamgoal; //!<the team goal
|
bot_goal_t teamgoal; //!<the team goal
|
||||||
float teammessage_time; //!<time to message team mates what the bot is doing
|
double teammessage_time; //!<time to message team mates what the bot is doing
|
||||||
float teamgoal_time; //!<time to stop helping team mate
|
double teamgoal_time; //!<time to stop helping team mate
|
||||||
float teammatevisible_time; //!<last time the team mate was NOT visible
|
double teammatevisible_time; //!<last time the team mate was NOT visible
|
||||||
//
|
//
|
||||||
int lead_teammate; //!<team mate the bot is leading
|
int32_t lead_teammate; //!<team mate the bot is leading
|
||||||
bot_goal_t lead_teamgoal; //!<team goal while leading
|
bot_goal_t lead_teamgoal; //!<team goal while leading
|
||||||
float lead_time; //!<time leading someone
|
double lead_time; //!<time leading someone
|
||||||
float leadvisible_time; //!<last time the team mate was visible
|
double leadvisible_time; //!<last time the team mate was visible
|
||||||
float leadmessage_time; //!<last time a messaged was sent to the team mate
|
double leadmessage_time; //!<last time a messaged was sent to the team mate
|
||||||
float leadbackup_time; //!<time backing up towards team mate
|
double leadbackup_time; //!<time backing up towards team mate
|
||||||
//
|
//
|
||||||
char teamleader[32]; //!<netname of the team leader
|
char teamleader[32]; //!<netname of the team leader
|
||||||
float askteamleader_time; //!<time asked for team leader
|
double askteamleader_time; //!<time asked for team leader
|
||||||
float becometeamleader_time; //!<time the bot will become the team leader
|
double becometeamleader_time; //!<time the bot will become the team leader
|
||||||
float teamgiveorders_time; //!<time to give team orders
|
double teamgiveorders_time; //!<time to give team orders
|
||||||
float lastflagcapture_time; //!<last time a flag was captured
|
double lastflagcapture_time; //!<last time a flag was captured
|
||||||
int numteammates; //!<number of team mates
|
int32_t numteammates; //!<number of team mates
|
||||||
int redflagstatus; //!<0 = at base, 1 = not at base
|
int32_t redflagstatus; //!<0 = at base, 1 = not at base
|
||||||
int blueflagstatus; //!<0 = at base, 1 = not at base
|
int32_t blueflagstatus; //!<0 = at base, 1 = not at base
|
||||||
int flagstatuschanged; //!<flag status changed
|
int32_t flagstatuschanged; //!<flag status changed
|
||||||
int forceorders; //!<true if forced to give orders
|
int32_t forceorders; //!<true if forced to give orders
|
||||||
int flagcarrier; //!<team mate carrying the enemy flag
|
int32_t flagcarrier; //!<team mate carrying the enemy flag
|
||||||
int ctfstrategy; //!<ctf strategy
|
int32_t ctfstrategy; //!<ctf strategy
|
||||||
char subteam[32]; //!<sub team name
|
char subteam[32]; //!<sub team name
|
||||||
float formation_dist; //!<formation team mate intervening space
|
double formation_dist; //!<formation team mate intervening space
|
||||||
char formation_teammate[16]; //!<netname of the team mate the bot uses for relative positioning
|
char formation_teammate[16]; //!<netname of the team mate the bot uses for relative positioning
|
||||||
float formation_angle; //!<angle relative to the formation team mate
|
double formation_angle; //!<angle relative to the formation team mate
|
||||||
vec3_t formation_dir; //!<the direction the formation is moving in
|
vec3_t formation_dir; //!<the direction the formation is moving in
|
||||||
vec3_t formation_origin; //!<origin the bot uses for relative positioning
|
vec3_t formation_origin; //!<origin the bot uses for relative positioning
|
||||||
bot_goal_t formation_goal; //!<formation goal
|
bot_goal_t formation_goal; //!<formation goal
|
||||||
|
@ -209,24 +223,76 @@ typedef struct bot_state_s
|
||||||
bot_waypoint_t *checkpoints; //!<check points
|
bot_waypoint_t *checkpoints; //!<check points
|
||||||
bot_waypoint_t *patrolpoints; //!<patrol points
|
bot_waypoint_t *patrolpoints; //!<patrol points
|
||||||
bot_waypoint_t *curpatrolpoint; //!<current patrol point the bot is going for
|
bot_waypoint_t *curpatrolpoint; //!<current patrol point the bot is going for
|
||||||
int patrolflags; //!<patrol flags
|
int32_t patrolflags; //!<patrol flags
|
||||||
} bot_state_t;
|
} bot_state_t;
|
||||||
|
|
||||||
//!resets the whole bot state
|
//!resets the whole bot state
|
||||||
void BotResetState(bot_state_t *bs);
|
void AI_main_BotResetState(bot_state_t *bs);
|
||||||
|
|
||||||
//!returns the number of bots in the game
|
//!returns the number of bots in the game
|
||||||
int NumBots(void);
|
int32_t AI_main_NumBots(void);
|
||||||
|
|
||||||
//!returns info about the entity
|
//!returns info about the entity
|
||||||
void BotEntityInfo(int entnum, aas_entityinfo_t *info);
|
void AI_main_BotEntityInfo(int32_t entnum, aas_entityinfo_t *info);
|
||||||
|
|
||||||
// from the game source
|
// from the game source
|
||||||
void QDECL BotAI_Print(int type, char *fmt, ...) __attribute__ ((format (printf, 2, 3)));
|
void QDECL AI_main_BotAIPrint(int32_t type, char *fmt, ...) __attribute__((format(printf, 2, 3)));
|
||||||
void QDECL QDECL BotAI_BotInitialChat( bot_state_t *bs, char *type, ... );
|
|
||||||
void BotAI_Trace(bsp_trace_t *bsptrace, vec3_t start, vec3_t mins, vec3_t maxs, vec3_t end, int passent, int contentmask);
|
void QDECL QDECL AI_main_BotAIInitialChat(bot_state_t *bs, char *type, ...);
|
||||||
int BotAI_GetClientState( int clientNum, playerState_t *state );
|
|
||||||
int BotAI_GetEntityState( int entityNum, entityState_t *state );
|
void AI_main_BotAITrace(bsp_trace_t *bsptrace, vec3_t start, vec3_t mins, vec3_t maxs, vec3_t end, int32_t passent, int32_t contentmask);
|
||||||
int BotAI_GetSnapshotEntity( int clientNum, int sequence, entityState_t *state );
|
|
||||||
int BotTeamLeader(bot_state_t *bs);
|
int32_t AI_main_BotAIGetClientState(int32_t clientNum, playerState_t *state);
|
||||||
|
|
||||||
|
int32_t AI_main_BotAIGetEntityState(int32_t entityNum, entityState_t *state);
|
||||||
|
|
||||||
|
int32_t AI_main_BotAIGetSnapshotEntity(int32_t clientNum, int32_t sequence, entityState_t *state);
|
||||||
|
|
||||||
|
int32_t AI_main_BotTeamLeader(bot_state_t *bs);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Setup bot AI.
|
||||||
|
*
|
||||||
|
* \param restart Determines if this is a map restart.
|
||||||
|
*/
|
||||||
|
int32_t AI_main_BotAISetup(int32_t restart);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Shutdown bot AI.
|
||||||
|
*
|
||||||
|
* \param restart Determines if this is a map restart.
|
||||||
|
*/
|
||||||
|
int32_t AI_main_BotAIShutdown(int32_t restart);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load map in bot lib.
|
||||||
|
*
|
||||||
|
* \param restart Determines if this is a map restart.
|
||||||
|
*/
|
||||||
|
int32_t AI_main_BotAILoadMap(int32_t restart);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Setup bot AI for client.
|
||||||
|
*
|
||||||
|
* \param client client number
|
||||||
|
* \param settings bot settings
|
||||||
|
*/
|
||||||
|
int32_t AI_main_BotAISetupClient(int32_t client, bot_settings_t* settings);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Shutdown bot client.
|
||||||
|
*
|
||||||
|
* \param client client number
|
||||||
|
*/
|
||||||
|
int32_t AI_main_BotAIShutdownClient(int32_t client);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Star frame.
|
||||||
|
*
|
||||||
|
* \param time current time
|
||||||
|
*/
|
||||||
|
int32_t AI_main_BotAIStartFrame(int32_t time);
|
||||||
|
|
||||||
|
|
||||||
#endif /* AI_AMIN_H_ */
|
#endif /* AI_AMIN_H_ */
|
||||||
|
|
||||||
|
|
|
@ -91,7 +91,7 @@ int BotClientTravelTimeToGoal(int client, bot_goal_t *goal) {
|
||||||
playerState_t ps;
|
playerState_t ps;
|
||||||
int areanum;
|
int areanum;
|
||||||
|
|
||||||
BotAI_GetClientState(client, &ps);
|
AI_main_BotAIGetClientState(client, &ps);
|
||||||
areanum = BotPointAreaNum(ps.origin);
|
areanum = BotPointAreaNum(ps.origin);
|
||||||
if (!areanum) return 1;
|
if (!areanum) return 1;
|
||||||
return trap_AAS_AreaTravelTimeToGoalArea(areanum, ps.origin, goal->areanum, TFL_DEFAULT);
|
return trap_AAS_AreaTravelTimeToGoalArea(areanum, ps.origin, goal->areanum, TFL_DEFAULT);
|
||||||
|
@ -259,7 +259,7 @@ void BotCTFOrders_BothFlagsNotAtBase(bot_state_t *bs) {
|
||||||
if (teammates[0] != bs->flagcarrier) other = teammates[0];
|
if (teammates[0] != bs->flagcarrier) other = teammates[0];
|
||||||
else other = teammates[1];
|
else other = teammates[1];
|
||||||
ClientName(other, name, sizeof(name));
|
ClientName(other, name, sizeof(name));
|
||||||
BotAI_BotInitialChat(bs, "cmd_getflag", name, NULL);
|
AI_main_BotAIInitialChat(bs, "cmd_getflag", name, NULL);
|
||||||
BotSayTeamOrder(bs, other);
|
BotSayTeamOrder(bs, other);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -271,17 +271,17 @@ void BotCTFOrders_BothFlagsNotAtBase(bot_state_t *bs) {
|
||||||
ClientName(other, name, sizeof(name));
|
ClientName(other, name, sizeof(name));
|
||||||
ClientName(bs->flagcarrier, carriername, sizeof(carriername));
|
ClientName(bs->flagcarrier, carriername, sizeof(carriername));
|
||||||
if (bs->flagcarrier == bs->client) {
|
if (bs->flagcarrier == bs->client) {
|
||||||
BotAI_BotInitialChat(bs, "cmd_accompanyme", name, NULL);
|
AI_main_BotAIInitialChat(bs, "cmd_accompanyme", name, NULL);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
BotAI_BotInitialChat(bs, "cmd_accompany", name, carriername, NULL);
|
AI_main_BotAIInitialChat(bs, "cmd_accompany", name, carriername, NULL);
|
||||||
}
|
}
|
||||||
BotSayTeamOrder(bs, other);
|
BotSayTeamOrder(bs, other);
|
||||||
//tell the one furthest from the the base not carrying the flag to get the enemy flag
|
//tell the one furthest from the the base not carrying the flag to get the enemy flag
|
||||||
if (teammates[2] != bs->flagcarrier) other = teammates[2];
|
if (teammates[2] != bs->flagcarrier) other = teammates[2];
|
||||||
else other = teammates[1];
|
else other = teammates[1];
|
||||||
ClientName(other, name, sizeof(name));
|
ClientName(other, name, sizeof(name));
|
||||||
BotAI_BotInitialChat(bs, "cmd_getflag", name, NULL);
|
AI_main_BotAIInitialChat(bs, "cmd_getflag", name, NULL);
|
||||||
BotSayTeamOrder(bs, other);
|
BotSayTeamOrder(bs, other);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -299,10 +299,10 @@ void BotCTFOrders_BothFlagsNotAtBase(bot_state_t *bs) {
|
||||||
//
|
//
|
||||||
ClientName(teammates[i], name, sizeof(name));
|
ClientName(teammates[i], name, sizeof(name));
|
||||||
if (bs->flagcarrier == bs->client) {
|
if (bs->flagcarrier == bs->client) {
|
||||||
BotAI_BotInitialChat(bs, "cmd_accompanyme", name, NULL);
|
AI_main_BotAIInitialChat(bs, "cmd_accompanyme", name, NULL);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
BotAI_BotInitialChat(bs, "cmd_accompany", name, carriername, NULL);
|
AI_main_BotAIInitialChat(bs, "cmd_accompany", name, carriername, NULL);
|
||||||
}
|
}
|
||||||
BotSayTeamOrder(bs, teammates[i]);
|
BotSayTeamOrder(bs, teammates[i]);
|
||||||
}
|
}
|
||||||
|
@ -313,7 +313,7 @@ void BotCTFOrders_BothFlagsNotAtBase(bot_state_t *bs) {
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
ClientName(teammates[numteammates - i - 1], name, sizeof(name));
|
ClientName(teammates[numteammates - i - 1], name, sizeof(name));
|
||||||
BotAI_BotInitialChat(bs, "cmd_getflag", name, NULL);
|
AI_main_BotAIInitialChat(bs, "cmd_getflag", name, NULL);
|
||||||
BotSayTeamOrder(bs, teammates[numteammates - i - 1]);
|
BotSayTeamOrder(bs, teammates[numteammates - i - 1]);
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
|
@ -343,11 +343,11 @@ void BotCTFOrders_FlagNotAtBase(bot_state_t *bs) {
|
||||||
{
|
{
|
||||||
//both will go for the enemy flag
|
//both will go for the enemy flag
|
||||||
ClientName(teammates[0], name, sizeof(name));
|
ClientName(teammates[0], name, sizeof(name));
|
||||||
BotAI_BotInitialChat(bs, "cmd_getflag", name, NULL);
|
AI_main_BotAIInitialChat(bs, "cmd_getflag", name, NULL);
|
||||||
BotSayTeamOrder(bs, teammates[0]);
|
BotSayTeamOrder(bs, teammates[0]);
|
||||||
//
|
//
|
||||||
ClientName(teammates[1], name, sizeof(name));
|
ClientName(teammates[1], name, sizeof(name));
|
||||||
BotAI_BotInitialChat(bs, "cmd_getflag", name, NULL);
|
AI_main_BotAIInitialChat(bs, "cmd_getflag", name, NULL);
|
||||||
BotSayTeamOrder(bs, teammates[1]);
|
BotSayTeamOrder(bs, teammates[1]);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -355,15 +355,15 @@ void BotCTFOrders_FlagNotAtBase(bot_state_t *bs) {
|
||||||
{
|
{
|
||||||
//everyone go for the flag
|
//everyone go for the flag
|
||||||
ClientName(teammates[0], name, sizeof(name));
|
ClientName(teammates[0], name, sizeof(name));
|
||||||
BotAI_BotInitialChat(bs, "cmd_getflag", name, NULL);
|
AI_main_BotAIInitialChat(bs, "cmd_getflag", name, NULL);
|
||||||
BotSayTeamOrder(bs, teammates[0]);
|
BotSayTeamOrder(bs, teammates[0]);
|
||||||
//
|
//
|
||||||
ClientName(teammates[1], name, sizeof(name));
|
ClientName(teammates[1], name, sizeof(name));
|
||||||
BotAI_BotInitialChat(bs, "cmd_getflag", name, NULL);
|
AI_main_BotAIInitialChat(bs, "cmd_getflag", name, NULL);
|
||||||
BotSayTeamOrder(bs, teammates[1]);
|
BotSayTeamOrder(bs, teammates[1]);
|
||||||
//
|
//
|
||||||
ClientName(teammates[2], name, sizeof(name));
|
ClientName(teammates[2], name, sizeof(name));
|
||||||
BotAI_BotInitialChat(bs, "cmd_getflag", name, NULL);
|
AI_main_BotAIInitialChat(bs, "cmd_getflag", name, NULL);
|
||||||
BotSayTeamOrder(bs, teammates[2]);
|
BotSayTeamOrder(bs, teammates[2]);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -376,13 +376,13 @@ void BotCTFOrders_FlagNotAtBase(bot_state_t *bs) {
|
||||||
for (i = 0; i < defenders; i++) {
|
for (i = 0; i < defenders; i++) {
|
||||||
//
|
//
|
||||||
ClientName(teammates[i], name, sizeof(name));
|
ClientName(teammates[i], name, sizeof(name));
|
||||||
BotAI_BotInitialChat(bs, "cmd_defendbase", name, NULL);
|
AI_main_BotAIInitialChat(bs, "cmd_defendbase", name, NULL);
|
||||||
BotSayTeamOrder(bs, teammates[i]);
|
BotSayTeamOrder(bs, teammates[i]);
|
||||||
}
|
}
|
||||||
for (i = 0; i < attackers; i++) {
|
for (i = 0; i < attackers; i++) {
|
||||||
//
|
//
|
||||||
ClientName(teammates[numteammates - i - 1], name, sizeof(name));
|
ClientName(teammates[numteammates - i - 1], name, sizeof(name));
|
||||||
BotAI_BotInitialChat(bs, "cmd_getflag", name, NULL);
|
AI_main_BotAIInitialChat(bs, "cmd_getflag", name, NULL);
|
||||||
BotSayTeamOrder(bs, teammates[numteammates - i - 1]);
|
BotSayTeamOrder(bs, teammates[numteammates - i - 1]);
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
|
@ -412,7 +412,7 @@ void BotCTFOrders_EnemyFlagNotAtBase(bot_state_t *bs) {
|
||||||
if (teammates[0] == bs->flagcarrier) other = teammates[1];
|
if (teammates[0] == bs->flagcarrier) other = teammates[1];
|
||||||
else other = teammates[0];
|
else other = teammates[0];
|
||||||
ClientName(other, name, sizeof(name));
|
ClientName(other, name, sizeof(name));
|
||||||
BotAI_BotInitialChat(bs, "cmd_defendbase", name, NULL);
|
AI_main_BotAIInitialChat(bs, "cmd_defendbase", name, NULL);
|
||||||
BotSayTeamOrder(bs, other);
|
BotSayTeamOrder(bs, other);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -422,7 +422,7 @@ void BotCTFOrders_EnemyFlagNotAtBase(bot_state_t *bs) {
|
||||||
if (teammates[0] != bs->flagcarrier) other = teammates[0];
|
if (teammates[0] != bs->flagcarrier) other = teammates[0];
|
||||||
else other = teammates[1];
|
else other = teammates[1];
|
||||||
ClientName(other, name, sizeof(name));
|
ClientName(other, name, sizeof(name));
|
||||||
BotAI_BotInitialChat(bs, "cmd_defendbase", name, NULL);
|
AI_main_BotAIInitialChat(bs, "cmd_defendbase", name, NULL);
|
||||||
BotSayTeamOrder(bs, other);
|
BotSayTeamOrder(bs, other);
|
||||||
//tell the one furthest from the base not carrying the flag to accompany the flag carrier
|
//tell the one furthest from the base not carrying the flag to accompany the flag carrier
|
||||||
if (teammates[2] != bs->flagcarrier) other = teammates[2];
|
if (teammates[2] != bs->flagcarrier) other = teammates[2];
|
||||||
|
@ -430,10 +430,10 @@ void BotCTFOrders_EnemyFlagNotAtBase(bot_state_t *bs) {
|
||||||
ClientName(other, name, sizeof(name));
|
ClientName(other, name, sizeof(name));
|
||||||
ClientName(bs->flagcarrier, carriername, sizeof(carriername));
|
ClientName(bs->flagcarrier, carriername, sizeof(carriername));
|
||||||
if (bs->flagcarrier == bs->client) {
|
if (bs->flagcarrier == bs->client) {
|
||||||
BotAI_BotInitialChat(bs, "cmd_accompanyme", name, NULL);
|
AI_main_BotAIInitialChat(bs, "cmd_accompanyme", name, NULL);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
BotAI_BotInitialChat(bs, "cmd_accompany", name, carriername, NULL);
|
AI_main_BotAIInitialChat(bs, "cmd_accompany", name, carriername, NULL);
|
||||||
}
|
}
|
||||||
BotSayTeamOrder(bs, other);
|
BotSayTeamOrder(bs, other);
|
||||||
break;
|
break;
|
||||||
|
@ -451,7 +451,7 @@ void BotCTFOrders_EnemyFlagNotAtBase(bot_state_t *bs) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
ClientName(teammates[i], name, sizeof(name));
|
ClientName(teammates[i], name, sizeof(name));
|
||||||
BotAI_BotInitialChat(bs, "cmd_defendbase", name, NULL);
|
AI_main_BotAIInitialChat(bs, "cmd_defendbase", name, NULL);
|
||||||
BotSayTeamOrder(bs, teammates[i]);
|
BotSayTeamOrder(bs, teammates[i]);
|
||||||
}
|
}
|
||||||
ClientName(bs->flagcarrier, carriername, sizeof(carriername));
|
ClientName(bs->flagcarrier, carriername, sizeof(carriername));
|
||||||
|
@ -463,10 +463,10 @@ void BotCTFOrders_EnemyFlagNotAtBase(bot_state_t *bs) {
|
||||||
//
|
//
|
||||||
ClientName(teammates[numteammates - i - 1], name, sizeof(name));
|
ClientName(teammates[numteammates - i - 1], name, sizeof(name));
|
||||||
if (bs->flagcarrier == bs->client) {
|
if (bs->flagcarrier == bs->client) {
|
||||||
BotAI_BotInitialChat(bs, "cmd_accompanyme", name, NULL);
|
AI_main_BotAIInitialChat(bs, "cmd_accompanyme", name, NULL);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
BotAI_BotInitialChat(bs, "cmd_accompany", name, carriername, NULL);
|
AI_main_BotAIInitialChat(bs, "cmd_accompany", name, carriername, NULL);
|
||||||
}
|
}
|
||||||
BotSayTeamOrder(bs, teammates[numteammates - i - 1]);
|
BotSayTeamOrder(bs, teammates[numteammates - i - 1]);
|
||||||
}
|
}
|
||||||
|
@ -500,11 +500,11 @@ void BotCTFOrders_BothFlagsAtBase(bot_state_t *bs) {
|
||||||
{
|
{
|
||||||
//the one closest to the base will defend the base
|
//the one closest to the base will defend the base
|
||||||
ClientName(teammates[0], name, sizeof(name));
|
ClientName(teammates[0], name, sizeof(name));
|
||||||
BotAI_BotInitialChat(bs, "cmd_defendbase", name, NULL);
|
AI_main_BotAIInitialChat(bs, "cmd_defendbase", name, NULL);
|
||||||
BotSayTeamOrder(bs, teammates[0]);
|
BotSayTeamOrder(bs, teammates[0]);
|
||||||
//the other will get the flag
|
//the other will get the flag
|
||||||
ClientName(teammates[1], name, sizeof(name));
|
ClientName(teammates[1], name, sizeof(name));
|
||||||
BotAI_BotInitialChat(bs, "cmd_getflag", name, NULL);
|
AI_main_BotAIInitialChat(bs, "cmd_getflag", name, NULL);
|
||||||
BotSayTeamOrder(bs, teammates[1]);
|
BotSayTeamOrder(bs, teammates[1]);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -512,15 +512,15 @@ void BotCTFOrders_BothFlagsAtBase(bot_state_t *bs) {
|
||||||
{
|
{
|
||||||
//the one closest to the base will defend the base
|
//the one closest to the base will defend the base
|
||||||
ClientName(teammates[0], name, sizeof(name));
|
ClientName(teammates[0], name, sizeof(name));
|
||||||
BotAI_BotInitialChat(bs, "cmd_defendbase", name, NULL);
|
AI_main_BotAIInitialChat(bs, "cmd_defendbase", name, NULL);
|
||||||
BotSayTeamOrder(bs, teammates[0]);
|
BotSayTeamOrder(bs, teammates[0]);
|
||||||
//the others should go for the enemy flag
|
//the others should go for the enemy flag
|
||||||
ClientName(teammates[1], name, sizeof(name));
|
ClientName(teammates[1], name, sizeof(name));
|
||||||
BotAI_BotInitialChat(bs, "cmd_getflag", name, NULL);
|
AI_main_BotAIInitialChat(bs, "cmd_getflag", name, NULL);
|
||||||
BotSayTeamOrder(bs, teammates[1]);
|
BotSayTeamOrder(bs, teammates[1]);
|
||||||
//
|
//
|
||||||
ClientName(teammates[2], name, sizeof(name));
|
ClientName(teammates[2], name, sizeof(name));
|
||||||
BotAI_BotInitialChat(bs, "cmd_getflag", name, NULL);
|
AI_main_BotAIInitialChat(bs, "cmd_getflag", name, NULL);
|
||||||
BotSayTeamOrder(bs, teammates[2]);
|
BotSayTeamOrder(bs, teammates[2]);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -532,13 +532,13 @@ void BotCTFOrders_BothFlagsAtBase(bot_state_t *bs) {
|
||||||
for (i = 0; i < defenders; i++) {
|
for (i = 0; i < defenders; i++) {
|
||||||
//
|
//
|
||||||
ClientName(teammates[i], name, sizeof(name));
|
ClientName(teammates[i], name, sizeof(name));
|
||||||
BotAI_BotInitialChat(bs, "cmd_defendbase", name, NULL);
|
AI_main_BotAIInitialChat(bs, "cmd_defendbase", name, NULL);
|
||||||
BotSayTeamOrder(bs, teammates[i]);
|
BotSayTeamOrder(bs, teammates[i]);
|
||||||
}
|
}
|
||||||
for (i = 0; i < attackers; i++) {
|
for (i = 0; i < attackers; i++) {
|
||||||
//
|
//
|
||||||
ClientName(teammates[numteammates - i - 1], name, sizeof(name));
|
ClientName(teammates[numteammates - i - 1], name, sizeof(name));
|
||||||
BotAI_BotInitialChat(bs, "cmd_getflag", name, NULL);
|
AI_main_BotAIInitialChat(bs, "cmd_getflag", name, NULL);
|
||||||
BotSayTeamOrder(bs, teammates[numteammates - i - 1]);
|
BotSayTeamOrder(bs, teammates[numteammates - i - 1]);
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
|
@ -584,13 +584,13 @@ void BotTeamAI(bot_state_t *bs) {
|
||||||
}
|
}
|
||||||
if (bs->askteamleader_time && bs->askteamleader_time < trap_AAS_Time()) {
|
if (bs->askteamleader_time && bs->askteamleader_time < trap_AAS_Time()) {
|
||||||
//if asked for a team leader and no repsonse
|
//if asked for a team leader and no repsonse
|
||||||
BotAI_BotInitialChat(bs, "whoisteamleader", NULL);
|
AI_main_BotAIInitialChat(bs, "whoisteamleader", NULL);
|
||||||
trap_BotEnterChat(bs->cs, bs->client, CHAT_TEAM);
|
trap_BotEnterChat(bs->cs, bs->client, CHAT_TEAM);
|
||||||
bs->askteamleader_time = 0;
|
bs->askteamleader_time = 0;
|
||||||
bs->becometeamleader_time = trap_AAS_Time() + 15 + random() * 10;
|
bs->becometeamleader_time = trap_AAS_Time() + 15 + random() * 10;
|
||||||
}
|
}
|
||||||
if (bs->becometeamleader_time && bs->becometeamleader_time < trap_AAS_Time()) {
|
if (bs->becometeamleader_time && bs->becometeamleader_time < trap_AAS_Time()) {
|
||||||
BotAI_BotInitialChat(bs, "iamteamleader", NULL);
|
AI_main_BotAIInitialChat(bs, "iamteamleader", NULL);
|
||||||
trap_BotEnterChat(bs->cs, bs->client, CHAT_TEAM);
|
trap_BotEnterChat(bs->cs, bs->client, CHAT_TEAM);
|
||||||
ClientName(bs->client, netname, sizeof(netname));
|
ClientName(bs->client, netname, sizeof(netname));
|
||||||
strncpy(bs->teamleader, netname, sizeof(bs->teamleader));
|
strncpy(bs->teamleader, netname, sizeof(bs->teamleader));
|
||||||
|
|
|
@ -1810,7 +1810,7 @@ static void ClientEvents( gentity_t *ent, int oldEventSequence ) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void BotTestSolid(vec3_t origin);
|
void AI_main_BotTestSolid(vec3_t origin);
|
||||||
|
|
||||||
void G_ThrowWeapon( gentity_t *ent, char *txt )
|
void G_ThrowWeapon( gentity_t *ent, char *txt )
|
||||||
{
|
{
|
||||||
|
@ -2172,7 +2172,7 @@ static void ClientThink_real( gentity_t *ent ) {
|
||||||
VectorCopy( ps->origin, ent->r.currentOrigin );
|
VectorCopy( ps->origin, ent->r.currentOrigin );
|
||||||
|
|
||||||
//test for solid areas in the AAS file
|
//test for solid areas in the AAS file
|
||||||
BotTestSolid(ent->r.currentOrigin);
|
AI_main_BotTestSolid(ent->r.currentOrigin);
|
||||||
|
|
||||||
// touch other objects
|
// touch other objects
|
||||||
ClientImpacts( ent, &pm );
|
ClientImpacts( ent, &pm );
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
#include "g_main.h"
|
#include "g_main.h"
|
||||||
#include "g_client.h"
|
#include "g_client.h"
|
||||||
#include "g_syscalls.h"
|
#include "g_syscalls.h"
|
||||||
|
#include "ai_main.h"
|
||||||
|
|
||||||
|
|
||||||
static int32_t g_numBots;
|
static int32_t g_numBots;
|
||||||
|
@ -564,7 +565,7 @@ qboolean G_BotConnect( int32_t clientNum, qboolean restart ) {
|
||||||
strncpy( settings.team, Info_ValueForKey( userinfo, "team" ), sizeof(settings.team) );
|
strncpy( settings.team, Info_ValueForKey( userinfo, "team" ), sizeof(settings.team) );
|
||||||
strncpy( settings.pclass, Info_ValueForKey( userinfo, "class" ), sizeof(settings.pclass) );
|
strncpy( settings.pclass, Info_ValueForKey( userinfo, "class" ), sizeof(settings.pclass) );
|
||||||
|
|
||||||
if (BotAISetupClient( clientNum, &settings ) == 0) {
|
if (AI_main_BotAISetupClient( clientNum, &settings ) == 0) {
|
||||||
trap_DropClient( clientNum, "BotAISetupClient failed" );
|
trap_DropClient( clientNum, "BotAISetupClient failed" );
|
||||||
return qfalse;
|
return qfalse;
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,11 @@
|
||||||
#include "g_lua.h"
|
#include "g_lua.h"
|
||||||
#include "g_logger.h"
|
#include "g_logger.h"
|
||||||
#include "g_syscalls.h"
|
#include "g_syscalls.h"
|
||||||
|
#include "ai_common.h"
|
||||||
|
|
||||||
|
// predeclare ai main functions
|
||||||
|
extern int32_t AI_main_BotAISetupClient(int32_t client, bot_settings_t* settings);
|
||||||
|
extern int32_t AI_main_BotAIShutdownClient(int32_t client);
|
||||||
|
|
||||||
reconData_t g_reconData[MAX_RECON_NAMES]; //!< recon data for a limited ammount of clients
|
reconData_t g_reconData[MAX_RECON_NAMES]; //!< recon data for a limited ammount of clients
|
||||||
int32_t g_reconNum;
|
int32_t g_reconNum;
|
||||||
|
@ -2263,7 +2268,7 @@ void G_Client_Disconnect( int32_t clientNum ) {
|
||||||
G_Client_CalculateRanks( qfalse );
|
G_Client_CalculateRanks( qfalse );
|
||||||
|
|
||||||
if ( (ent->r.svFlags & SVF_BOT) != 0 ) {
|
if ( (ent->r.svFlags & SVF_BOT) != 0 ) {
|
||||||
BotAIShutdownClient( clientNum );
|
AI_main_BotAIShutdownClient( clientNum );
|
||||||
}
|
}
|
||||||
|
|
||||||
// kef -- if this guy contributed to any of our kills/deaths/weapons logs, clean 'em out
|
// kef -- if this guy contributed to any of our kills/deaths/weapons logs, clean 'em out
|
||||||
|
|
|
@ -1880,69 +1880,7 @@ void Svcmd_BotList_f( void );
|
||||||
*
|
*
|
||||||
* \todo Remove? We don't support bots.
|
* \todo Remove? We don't support bots.
|
||||||
*/
|
*/
|
||||||
void BotInterbreedEndMatch( void );
|
void AI_main_BotInterbreedEndMatch( void );
|
||||||
|
|
||||||
// ai_main.c
|
|
||||||
|
|
||||||
//some maxs
|
|
||||||
#define MAX_NETNAME 36
|
|
||||||
#define MAX_FILEPATH 144
|
|
||||||
|
|
||||||
//bot settings
|
|
||||||
/** \struct bot_settings_t
|
|
||||||
* Containing settings for bots.
|
|
||||||
*/
|
|
||||||
typedef struct bot_settings_s
|
|
||||||
{
|
|
||||||
char characterfile[MAX_FILEPATH]; /*!< filename of character file */
|
|
||||||
int skill; /*!< skill level */
|
|
||||||
char team[MAX_FILEPATH]; /*!< team */
|
|
||||||
char pclass[MAX_FILEPATH]; /*!< class */
|
|
||||||
} bot_settings_t;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Setup bot AI.
|
|
||||||
*
|
|
||||||
* \param restart Determines if this is a map restart.
|
|
||||||
*/
|
|
||||||
int BotAISetup( int restart );
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Shutdown bot AI.
|
|
||||||
*
|
|
||||||
* \param restart Determines if this is a map restart.
|
|
||||||
*/
|
|
||||||
int BotAIShutdown( int restart );
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Load map in bot lib.
|
|
||||||
*
|
|
||||||
* \param restart Determines if this is a map restart.
|
|
||||||
*/
|
|
||||||
int BotAILoadMap( int restart );
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Setup bot AI for client.
|
|
||||||
*
|
|
||||||
* \param client client number
|
|
||||||
* \param settings bot settings
|
|
||||||
*/
|
|
||||||
int BotAISetupClient( int client, bot_settings_t* settings );
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Shutdown bot client.
|
|
||||||
*
|
|
||||||
* \param client client number
|
|
||||||
*/
|
|
||||||
int BotAIShutdownClient( int client );
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Star frame.
|
|
||||||
*
|
|
||||||
* \param time current time
|
|
||||||
*/
|
|
||||||
int BotAIStartFrame( int time );
|
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// g_lua.c
|
// g_lua.c
|
||||||
|
|
|
@ -19,6 +19,12 @@
|
||||||
#include "g_weapon.h"
|
#include "g_weapon.h"
|
||||||
#include "g_syscalls.h"
|
#include "g_syscalls.h"
|
||||||
|
|
||||||
|
// pre declare ai functions
|
||||||
|
extern int32_t AI_main_BotAIStartFrame(int32_t time);
|
||||||
|
extern int32_t AI_main_BotAISetup(int32_t restart);
|
||||||
|
extern int32_t AI_main_BotAIShutdown(int32_t restart);
|
||||||
|
extern int32_t AI_main_BotAILoadMap(int32_t restart);
|
||||||
|
|
||||||
extern void BG_LoadItemNames(void);
|
extern void BG_LoadItemNames(void);
|
||||||
extern qboolean BG_ParseRankNames(char* fileName, rankNames_t rankNames[], size_t size);
|
extern qboolean BG_ParseRankNames(char* fileName, rankNames_t rankNames[], size_t size);
|
||||||
|
|
||||||
|
@ -514,7 +520,7 @@ Q_EXPORT intptr_t vmMain(int command, int arg0, int arg1, int arg2, /*@unused@*/
|
||||||
//RPG-X : TiM - plagiarised Red's logic from SFEFMOD here lol
|
//RPG-X : TiM - plagiarised Red's logic from SFEFMOD here lol
|
||||||
return (intptr_t)ConsoleCommand();
|
return (intptr_t)ConsoleCommand();
|
||||||
case BOTAI_START_FRAME:
|
case BOTAI_START_FRAME:
|
||||||
return (intptr_t)BotAIStartFrame(arg0);
|
return (intptr_t)AI_main_BotAIStartFrame(arg0);
|
||||||
}
|
}
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -1872,8 +1878,8 @@ void G_InitGame(int levelTime, unsigned int randomSeed, int restart) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (trap_Cvar_VariableIntegerValue("bot_enable") != 0) {
|
if (trap_Cvar_VariableIntegerValue("bot_enable") != 0) {
|
||||||
BotAISetup(restart);
|
AI_main_BotAISetup(restart);
|
||||||
BotAILoadMap(restart);
|
AI_main_BotAILoadMap(restart);
|
||||||
G_InitBots((qboolean)restart);
|
G_InitBots((qboolean)restart);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1980,7 +1986,7 @@ void G_ShutdownGame(int restart) {
|
||||||
G_WriteSessionData();
|
G_WriteSessionData();
|
||||||
|
|
||||||
if (trap_Cvar_VariableIntegerValue("bot_enable") != 0) {
|
if (trap_Cvar_VariableIntegerValue("bot_enable") != 0) {
|
||||||
BotAIShutdown(restart);
|
AI_main_BotAIShutdown(restart);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (level.timedMessages != NULL) {
|
if (level.timedMessages != NULL) {
|
||||||
|
@ -2271,7 +2277,7 @@ void ExitLevel(void) {
|
||||||
levelExiting = qtrue;
|
levelExiting = qtrue;
|
||||||
|
|
||||||
//bot interbreeding
|
//bot interbreeding
|
||||||
BotInterbreedEndMatch();
|
AI_main_BotInterbreedEndMatch();
|
||||||
|
|
||||||
G_ClearObjectives();
|
G_ClearObjectives();
|
||||||
// if we are running a tournement map, kick the loser to spectator status,
|
// if we are running a tournement map, kick the loser to spectator status,
|
||||||
|
|
|
@ -484,6 +484,7 @@
|
||||||
<ClInclude Include="..\qcommon\stv_version.h" />
|
<ClInclude Include="..\qcommon\stv_version.h" />
|
||||||
<ClInclude Include="ai_chat.h" />
|
<ClInclude Include="ai_chat.h" />
|
||||||
<ClInclude Include="ai_cmd.h" />
|
<ClInclude Include="ai_cmd.h" />
|
||||||
|
<ClInclude Include="ai_common.h" />
|
||||||
<ClInclude Include="ai_dmnet.h" />
|
<ClInclude Include="ai_dmnet.h" />
|
||||||
<ClInclude Include="ai_dmq3.h" />
|
<ClInclude Include="ai_dmq3.h" />
|
||||||
<ClInclude Include="ai_main.h" />
|
<ClInclude Include="ai_main.h" />
|
||||||
|
|
|
@ -539,6 +539,9 @@
|
||||||
<ClInclude Include="g_syscalls.h">
|
<ClInclude Include="g_syscalls.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="ai_common.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="game.def">
|
<None Include="game.def">
|
||||||
|
|
Loading…
Reference in a new issue