Main Page | Class Hierarchy | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals

ai_chat.c File Reference

#include "g_local.h"
#include "botlib.h"
#include "be_aas.h"
#include "be_ea.h"
#include "be_ai_char.h"
#include "be_ai_chat.h"
#include "be_ai_gen.h"
#include "be_ai_goal.h"
#include "be_ai_move.h"
#include "be_ai_weap.h"
#include "ai_main.h"
#include "ai_dmq3.h"
#include "ai_chat.h"
#include "ai_cmd.h"
#include "ai_dmnet.h"
#include "chars.h"
#include "inv.h"
#include "syn.h"
#include "match.h"

Include dependency graph for ai_chat.c:

Include dependency graph

Go to the source code of this file.

Defines

#define TIME_BETWEENCHATTING   25

Functions

int BotChat_Death (bot_state_t *bs)
int BotChat_EndLevel (bot_state_t *bs)
int BotChat_EnemySuicide (bot_state_t *bs)
int BotChat_EnterGame (bot_state_t *bs)
int BotChat_ExitGame (bot_state_t *bs)
int BotChat_HitNoDeath (bot_state_t *bs)
int BotChat_HitNoKill (bot_state_t *bs)
int BotChat_HitTalking (bot_state_t *bs)
int BotChat_Kill (bot_state_t *bs)
int BotChat_Random (bot_state_t *bs)
int BotChat_StartLevel (bot_state_t *bs)
void BotChatTest (bot_state_t *bs)
float BotChatTime (bot_state_t *bs)
char * BotFirstClientInRankings (void)
int BotIsFirstInRankings (bot_state_t *bs)
int BotIsLastInRankings (bot_state_t *bs)
char * BotLastClientInRankings (void)
char * BotMapTitle (void)
int BotNumActivePlayers (void)
char * BotRandomOpponentName (bot_state_t *bs)
char * BotRandomWeaponName (void)
int BotValidChatPosition (bot_state_t *bs)
int BotVisibleEnemies (bot_state_t *bs)
char * BotWeaponNameForMeansOfDeath (int mod)


Define Documentation

#define TIME_BETWEENCHATTING   25
 

Definition at line 60 of file ai_chat.c.


Function Documentation

int BotChat_Death bot_state_t bs  ) 
 

Definition at line 573 of file ai_chat.c.

References bot_fastchat, bot_nochat, bot_state_t, BotAI_BotInitialChat(), bot_state_s::botdeathtype, BotNumActivePlayers(), BotRandomOpponentName(), BotSameTeam(), bot_state_s::botsuicide, BotWeaponNameForMeansOfDeath(), bot_state_s::character, CHARACTERISTIC_CHAT_DEATH, CHARACTERISTIC_CHAT_INSULT, bot_state_s::chatto, bot_state_s::client, bot_state_s::cs, EasyClientName(), FloatTime, gametype, vmCvar_t::integer, bot_state_s::lastchat_time, bot_state_s::lastkilledby, MOD_BFG, MOD_CRUSH, MOD_GAUNTLET, MOD_RAILGUN, MOD_SUICIDE, MOD_TARGET_LASER, MOD_TRIGGER_HURT, name, NULL, random, strcpy(), TeamPlayIsOn(), trap_BotNumInitialChats(), trap_Characteristic_BFloat(), and trap_EA_Command().

Referenced by AIEnter_Respawn().

00573                                    {
00574     char name[32];
00575     float rnd;
00576 
00577     if (bot_nochat.integer) return qfalse;
00578     if (bs->lastchat_time > FloatTime() - TIME_BETWEENCHATTING) return qfalse;
00579     rnd = trap_Characteristic_BFloat(bs->character, CHARACTERISTIC_CHAT_DEATH, 0, 1);
00580     // don't chat in tournament mode
00581     if (gametype == GT_TOURNAMENT) return qfalse;
00582     //if fast chatting is off
00583     if (!bot_fastchat.integer) {
00584         if (random() > rnd) return qfalse;
00585     }
00586     if (BotNumActivePlayers() <= 1) return qfalse;
00587     //
00588     if (bs->lastkilledby >= 0 && bs->lastkilledby < MAX_CLIENTS)
00589         EasyClientName(bs->lastkilledby, name, 32);
00590     else
00591         strcpy(name, "[world]");
00592     //
00593     if (TeamPlayIsOn() && BotSameTeam(bs, bs->lastkilledby)) {
00594         if (bs->lastkilledby == bs->client) return qfalse;
00595         BotAI_BotInitialChat(bs, "death_teammate", name, NULL);
00596         bs->chatto = CHAT_TEAM;
00597     }
00598     else
00599     {
00600         //teamplay
00601         if (TeamPlayIsOn()) {
00602             trap_EA_Command(bs->client, "vtaunt");
00603             return qtrue;
00604         }
00605         //
00606         if (bs->botdeathtype == MOD_WATER)
00607             BotAI_BotInitialChat(bs, "death_drown", BotRandomOpponentName(bs), NULL);
00608         else if (bs->botdeathtype == MOD_SLIME)
00609             BotAI_BotInitialChat(bs, "death_slime", BotRandomOpponentName(bs), NULL);
00610         else if (bs->botdeathtype == MOD_LAVA)
00611             BotAI_BotInitialChat(bs, "death_lava", BotRandomOpponentName(bs), NULL);
00612         else if (bs->botdeathtype == MOD_FALLING)
00613             BotAI_BotInitialChat(bs, "death_cratered", BotRandomOpponentName(bs), NULL);
00614         else if (bs->botsuicide || //all other suicides by own weapon
00615                 bs->botdeathtype == MOD_CRUSH ||
00616                 bs->botdeathtype == MOD_SUICIDE ||
00617                 bs->botdeathtype == MOD_TARGET_LASER ||
00618                 bs->botdeathtype == MOD_TRIGGER_HURT ||
00619                 bs->botdeathtype == MOD_UNKNOWN)
00620             BotAI_BotInitialChat(bs, "death_suicide", BotRandomOpponentName(bs), NULL);
00621         else if (bs->botdeathtype == MOD_TELEFRAG)
00622             BotAI_BotInitialChat(bs, "death_telefrag", name, NULL);
00623 #ifdef MISSIONPACK
00624         else if (bs->botdeathtype == MOD_KAMIKAZE && trap_BotNumInitialChats(bs->cs, "death_kamikaze"))
00625             BotAI_BotInitialChat(bs, "death_kamikaze", name, NULL);
00626 #endif
00627         else {
00628             if ((bs->botdeathtype == MOD_GAUNTLET ||
00629                 bs->botdeathtype == MOD_RAILGUN ||
00630                 bs->botdeathtype == MOD_BFG ||
00631                 bs->botdeathtype == MOD_BFG_SPLASH) && random() < 0.5) {
00632 
00633                 if (bs->botdeathtype == MOD_GAUNTLET)
00634                     BotAI_BotInitialChat(bs, "death_gauntlet",
00635                             name,                                               // 0
00636                             BotWeaponNameForMeansOfDeath(bs->botdeathtype),     // 1
00637                             NULL);
00638                 else if (bs->botdeathtype == MOD_RAILGUN)
00639                     BotAI_BotInitialChat(bs, "death_rail",
00640                             name,                                               // 0
00641                             BotWeaponNameForMeansOfDeath(bs->botdeathtype),     // 1
00642                             NULL);
00643                 else
00644                     BotAI_BotInitialChat(bs, "death_bfg",
00645                             name,                                               // 0
00646                             BotWeaponNameForMeansOfDeath(bs->botdeathtype),     // 1
00647                             NULL);
00648             }
00649             //choose between insult and praise
00650             else if (random() < trap_Characteristic_BFloat(bs->character, CHARACTERISTIC_CHAT_INSULT, 0, 1)) {
00651                 BotAI_BotInitialChat(bs, "death_insult",
00652                             name,                                               // 0
00653                             BotWeaponNameForMeansOfDeath(bs->botdeathtype),     // 1
00654                             NULL);
00655             }
00656             else {
00657                 BotAI_BotInitialChat(bs, "death_praise",
00658                             name,                                               // 0
00659                             BotWeaponNameForMeansOfDeath(bs->botdeathtype),     // 1
00660                             NULL);
00661             }
00662         }
00663         bs->chatto = CHAT_ALL;
00664     }
00665     bs->lastchat_time = FloatTime();
00666     return qtrue;
00667 }

Here is the call graph for this function:

int BotChat_EndLevel bot_state_t bs  ) 
 

Definition at line 513 of file ai_chat.c.

References bot_fastchat, bot_nochat, bot_state_t, BotAI_BotInitialChat(), BotFirstClientInRankings(), BotIsFirstInRankings(), BotIsLastInRankings(), BotIsObserver(), BotLastClientInRankings(), BotMapTitle(), BotNumActivePlayers(), BotRandomOpponentName(), bot_state_s::character, CHARACTERISTIC_CHAT_STARTENDLEVEL, bot_state_s::chatto, bot_state_s::client, EasyClientName(), FloatTime, gametype, vmCvar_t::integer, bot_state_s::lastchat_time, name, NULL, random, TeamPlayIsOn(), trap_Characteristic_BFloat(), and trap_EA_Command().

Referenced by AIEnter_Intermission().

00513                                       {
00514     char name[32];
00515     float rnd;
00516 
00517     if (bot_nochat.integer) return qfalse;
00518     if (BotIsObserver(bs)) return qfalse;
00519     if (bs->lastchat_time > FloatTime() - TIME_BETWEENCHATTING) return qfalse;
00520     // teamplay
00521     if (TeamPlayIsOn()) 
00522     {
00523         if (BotIsFirstInRankings(bs)) {
00524             trap_EA_Command(bs->client, "vtaunt");
00525         }
00526         return qtrue;
00527     }
00528     // don't chat in tournament mode
00529     if (gametype == GT_TOURNAMENT) return qfalse;
00530     rnd = trap_Characteristic_BFloat(bs->character, CHARACTERISTIC_CHAT_STARTENDLEVEL, 0, 1);
00531     if (!bot_fastchat.integer) {
00532         if (random() > rnd) return qfalse;
00533     }
00534     if (BotNumActivePlayers() <= 1) return qfalse;
00535     //
00536     if (BotIsFirstInRankings(bs)) {
00537         BotAI_BotInitialChat(bs, "level_end_victory",
00538                 EasyClientName(bs->client, name, 32),   // 0
00539                 BotRandomOpponentName(bs),              // 1
00540                 "[invalid var]",                        // 2
00541                 BotLastClientInRankings(),              // 3
00542                 BotMapTitle(),                          // 4
00543                 NULL);
00544     }
00545     else if (BotIsLastInRankings(bs)) {
00546         BotAI_BotInitialChat(bs, "level_end_lose",
00547                 EasyClientName(bs->client, name, 32),   // 0
00548                 BotRandomOpponentName(bs),              // 1
00549                 BotFirstClientInRankings(),             // 2
00550                 "[invalid var]",                        // 3
00551                 BotMapTitle(),                          // 4
00552                 NULL);
00553     }
00554     else {
00555         BotAI_BotInitialChat(bs, "level_end",
00556                 EasyClientName(bs->client, name, 32),   // 0
00557                 BotRandomOpponentName(bs),              // 1
00558                 BotFirstClientInRankings(),             // 2
00559                 BotLastClientInRankings(),              // 3
00560                 BotMapTitle(),                          // 4
00561                 NULL);
00562     }
00563     bs->lastchat_time = FloatTime();
00564     bs->chatto = CHAT_ALL;
00565     return qtrue;
00566 }

Here is the call graph for this function:

int BotChat_EnemySuicide bot_state_t bs  ) 
 

Definition at line 738 of file ai_chat.c.

References bot_fastchat, bot_nochat, bot_state_t, BotAI_BotInitialChat(), BotNumActivePlayers(), BotValidChatPosition(), BotVisibleEnemies(), bot_state_s::character, CHARACTERISTIC_CHAT_KILL, bot_state_s::chatto, EasyClientName(), bot_state_s::enemy, FloatTime, gametype, vmCvar_t::integer, bot_state_s::lastchat_time, name, NULL, random, strcpy(), TeamPlayIsOn(), and trap_Characteristic_BFloat().

Referenced by AINode_Battle_Fight().

00738                                           {
00739     char name[32];
00740     float rnd;
00741 
00742     if (bot_nochat.integer) return qfalse;
00743     if (bs->lastchat_time > FloatTime() - TIME_BETWEENCHATTING) return qfalse;
00744     if (BotNumActivePlayers() <= 1) return qfalse;
00745     //
00746     rnd = trap_Characteristic_BFloat(bs->character, CHARACTERISTIC_CHAT_KILL, 0, 1);
00747     //don't chat in teamplay
00748     if (TeamPlayIsOn()) return qfalse;
00749     // don't chat in tournament mode
00750     if (gametype == GT_TOURNAMENT) return qfalse;
00751     //if fast chat is off
00752     if (!bot_fastchat.integer) {
00753         if (random() > rnd) return qfalse;
00754     }
00755     if (!BotValidChatPosition(bs)) return qfalse;
00756     //
00757     if (BotVisibleEnemies(bs)) return qfalse;
00758     //
00759     if (bs->enemy >= 0) EasyClientName(bs->enemy, name, 32);
00760     else strcpy(name, "");
00761     BotAI_BotInitialChat(bs, "enemy_suicide", name, NULL);
00762     bs->lastchat_time = FloatTime();
00763     bs->chatto = CHAT_ALL;
00764     return qtrue;
00765 }

Here is the call graph for this function:

int BotChat_EnterGame bot_state_t bs  ) 
 

Definition at line 415 of file ai_chat.c.

References bot_fastchat, bot_nochat, bot_state_t, BotAI_BotInitialChat(), BotMapTitle(), BotNumActivePlayers(), BotRandomOpponentName(), BotValidChatPosition(), bot_state_s::character, CHARACTERISTIC_CHAT_ENTEREXITGAME, bot_state_s::chatto, bot_state_s::client, EasyClientName(), FloatTime, gametype, vmCvar_t::integer, bot_state_s::lastchat_time, name, NULL, random, TeamPlayIsOn(), and trap_Characteristic_BFloat().

Referenced by BotDeathmatchAI().

00415                                        {
00416     char name[32];
00417     float rnd;
00418 
00419     if (bot_nochat.integer) return qfalse;
00420     if (bs->lastchat_time > FloatTime() - TIME_BETWEENCHATTING) return qfalse;
00421     //don't chat in teamplay
00422     if (TeamPlayIsOn()) return qfalse;
00423     // don't chat in tournament mode
00424     if (gametype == GT_TOURNAMENT) return qfalse;
00425     rnd = trap_Characteristic_BFloat(bs->character, CHARACTERISTIC_CHAT_ENTEREXITGAME, 0, 1);
00426     if (!bot_fastchat.integer) {
00427         if (random() > rnd) return qfalse;
00428     }
00429     if (BotNumActivePlayers() <= 1) return qfalse;
00430     if (!BotValidChatPosition(bs)) return qfalse;
00431     BotAI_BotInitialChat(bs, "game_enter",
00432                 EasyClientName(bs->client, name, 32),   // 0
00433                 BotRandomOpponentName(bs),              // 1
00434                 "[invalid var]",                        // 2
00435                 "[invalid var]",                        // 3
00436                 BotMapTitle(),                          // 4
00437                 NULL);
00438     bs->lastchat_time = FloatTime();
00439     bs->chatto = CHAT_ALL;
00440     return qtrue;
00441 }

Here is the call graph for this function:

int BotChat_ExitGame bot_state_t bs  ) 
 

Definition at line 448 of file ai_chat.c.

References bot_fastchat, bot_nochat, bot_state_t, BotAI_BotInitialChat(), BotMapTitle(), BotNumActivePlayers(), BotRandomOpponentName(), bot_state_s::character, CHARACTERISTIC_CHAT_ENTEREXITGAME, bot_state_s::chatto, bot_state_s::client, EasyClientName(), FloatTime, gametype, vmCvar_t::integer, bot_state_s::lastchat_time, name, NULL, random, TeamPlayIsOn(), and trap_Characteristic_BFloat().

Referenced by BotAIShutdownClient().

00448                                       {
00449     char name[32];
00450     float rnd;
00451 
00452     if (bot_nochat.integer) return qfalse;
00453     if (bs->lastchat_time > FloatTime() - TIME_BETWEENCHATTING) return qfalse;
00454     //don't chat in teamplay
00455     if (TeamPlayIsOn()) return qfalse;
00456     // don't chat in tournament mode
00457     if (gametype == GT_TOURNAMENT) return qfalse;
00458     rnd = trap_Characteristic_BFloat(bs->character, CHARACTERISTIC_CHAT_ENTEREXITGAME, 0, 1);
00459     if (!bot_fastchat.integer) {
00460         if (random() > rnd) return qfalse;
00461     }
00462     if (BotNumActivePlayers() <= 1) return qfalse;
00463     //
00464     BotAI_BotInitialChat(bs, "game_exit",
00465                 EasyClientName(bs->client, name, 32),   // 0
00466                 BotRandomOpponentName(bs),              // 1
00467                 "[invalid var]",                        // 2
00468                 "[invalid var]",                        // 3
00469                 BotMapTitle(),                          // 4
00470                 NULL);
00471     bs->lastchat_time = FloatTime();
00472     bs->chatto = CHAT_ALL;
00473     return qtrue;
00474 }

Here is the call graph for this function:

int BotChat_HitNoDeath bot_state_t bs  ) 
 

Definition at line 811 of file ai_chat.c.

References aas_entityinfo_t, bot_fastchat, bot_nochat, bot_state_t, BotAI_BotInitialChat(), BotEntityInfo(), BotNumActivePlayers(), BotValidChatPosition(), BotVisibleEnemies(), BotWeaponNameForMeansOfDeath(), bot_state_s::character, CHARACTERISTIC_CHAT_HITNODEATH, bot_state_s::chatto, bot_state_s::client, gentity_s::client, ClientName(), bot_state_s::enemy, EntityIsShooting(), FloatTime, g_entities, gametype, vmCvar_t::integer, bot_state_s::lastchat_time, gclient_s::lasthurt_client, name, NULL, random, TeamPlayIsOn(), and trap_Characteristic_BFloat().

Referenced by AINode_Battle_Fight().

00811                                         {
00812     char name[32], *weap;
00813     float rnd;
00814     int lasthurt_client;
00815     aas_entityinfo_t entinfo;
00816 
00817     lasthurt_client = g_entities[bs->client].client->lasthurt_client;
00818     if (!lasthurt_client) return qfalse;
00819     if (lasthurt_client == bs->client) return qfalse;
00820     //
00821     if (lasthurt_client < 0 || lasthurt_client >= MAX_CLIENTS) return qfalse;
00822     //
00823     if (bot_nochat.integer) return qfalse;
00824     if (bs->lastchat_time > FloatTime() - TIME_BETWEENCHATTING) return qfalse;
00825     if (BotNumActivePlayers() <= 1) return qfalse;
00826     rnd = trap_Characteristic_BFloat(bs->character, CHARACTERISTIC_CHAT_HITNODEATH, 0, 1);
00827     //don't chat in teamplay
00828     if (TeamPlayIsOn()) return qfalse;
00829     // don't chat in tournament mode
00830     if (gametype == GT_TOURNAMENT) return qfalse;
00831     //if fast chat is off
00832     if (!bot_fastchat.integer) {
00833         if (random() > rnd * 0.5) return qfalse;
00834     }
00835     if (!BotValidChatPosition(bs)) return qfalse;
00836     //
00837     if (BotVisibleEnemies(bs)) return qfalse;
00838     //
00839     BotEntityInfo(bs->enemy, &entinfo);
00840     if (EntityIsShooting(&entinfo)) return qfalse;
00841     //
00842     ClientName(lasthurt_client, name, sizeof(name));
00843     weap = BotWeaponNameForMeansOfDeath(g_entities[bs->client].client->lasthurt_mod);
00844     //
00845     BotAI_BotInitialChat(bs, "hit_nodeath", name, weap, NULL);
00846     bs->lastchat_time = FloatTime();
00847     bs->chatto = CHAT_ALL;
00848     return qtrue;
00849 }

Here is the call graph for this function:

int BotChat_HitNoKill bot_state_t bs  ) 
 

Definition at line 856 of file ai_chat.c.

References aas_entityinfo_t, bot_fastchat, bot_nochat, bot_state_t, BotAI_BotInitialChat(), BotEntityInfo(), BotNumActivePlayers(), BotValidChatPosition(), BotVisibleEnemies(), BotWeaponNameForMeansOfDeath(), bot_state_s::character, CHARACTERISTIC_CHAT_HITNOKILL, bot_state_s::chatto, bot_state_s::client, ClientName(), bot_state_s::enemy, EntityIsShooting(), FloatTime, g_entities, gametype, vmCvar_t::integer, bot_state_s::lastchat_time, name, NULL, random, TeamPlayIsOn(), and trap_Characteristic_BFloat().

Referenced by AINode_Battle_Fight().

00856                                        {
00857     char name[32], *weap;
00858     float rnd;
00859     aas_entityinfo_t entinfo;
00860 
00861     if (bot_nochat.integer) return qfalse;
00862     if (bs->lastchat_time > FloatTime() - TIME_BETWEENCHATTING) return qfalse;
00863     if (BotNumActivePlayers() <= 1) return qfalse;
00864     rnd = trap_Characteristic_BFloat(bs->character, CHARACTERISTIC_CHAT_HITNOKILL, 0, 1);
00865     //don't chat in teamplay
00866     if (TeamPlayIsOn()) return qfalse;
00867     // don't chat in tournament mode
00868     if (gametype == GT_TOURNAMENT) return qfalse;
00869     //if fast chat is off
00870     if (!bot_fastchat.integer) {
00871         if (random() > rnd * 0.5) return qfalse;
00872     }
00873     if (!BotValidChatPosition(bs)) return qfalse;
00874     //
00875     if (BotVisibleEnemies(bs)) return qfalse;
00876     //
00877     BotEntityInfo(bs->enemy, &entinfo);
00878     if (EntityIsShooting(&entinfo)) return qfalse;
00879     //
00880     ClientName(bs->enemy, name, sizeof(name));
00881     weap = BotWeaponNameForMeansOfDeath(g_entities[bs->enemy].client->lasthurt_mod);
00882     //
00883     BotAI_BotInitialChat(bs, "hit_nokill", name, weap, NULL);
00884     bs->lastchat_time = FloatTime();
00885     bs->chatto = CHAT_ALL;
00886     return qtrue;
00887 }

Here is the call graph for this function:

int BotChat_HitTalking bot_state_t bs  ) 
 

Definition at line 772 of file ai_chat.c.

References bot_fastchat, bot_nochat, bot_state_t, BotAI_BotInitialChat(), BotNumActivePlayers(), BotValidChatPosition(), BotWeaponNameForMeansOfDeath(), bot_state_s::character, CHARACTERISTIC_CHAT_HITTALKING, bot_state_s::chatto, bot_state_s::client, gentity_s::client, ClientName(), FloatTime, g_entities, gametype, vmCvar_t::integer, bot_state_s::lastchat_time, gclient_s::lasthurt_client, name, NULL, random, TeamPlayIsOn(), and trap_Characteristic_BFloat().

Referenced by AINode_Stand().

00772                                         {
00773     char name[32], *weap;
00774     int lasthurt_client;
00775     float rnd;
00776 
00777     if (bot_nochat.integer) return qfalse;
00778     if (bs->lastchat_time > FloatTime() - TIME_BETWEENCHATTING) return qfalse;
00779     if (BotNumActivePlayers() <= 1) return qfalse;
00780     lasthurt_client = g_entities[bs->client].client->lasthurt_client;
00781     if (!lasthurt_client) return qfalse;
00782     if (lasthurt_client == bs->client) return qfalse;
00783     //
00784     if (lasthurt_client < 0 || lasthurt_client >= MAX_CLIENTS) return qfalse;
00785     //
00786     rnd = trap_Characteristic_BFloat(bs->character, CHARACTERISTIC_CHAT_HITTALKING, 0, 1);
00787     //don't chat in teamplay
00788     if (TeamPlayIsOn()) return qfalse;
00789     // don't chat in tournament mode
00790     if (gametype == GT_TOURNAMENT) return qfalse;
00791     //if fast chat is off
00792     if (!bot_fastchat.integer) {
00793         if (random() > rnd * 0.5) return qfalse;
00794     }
00795     if (!BotValidChatPosition(bs)) return qfalse;
00796     //
00797     ClientName(g_entities[bs->client].client->lasthurt_client, name, sizeof(name));
00798     weap = BotWeaponNameForMeansOfDeath(g_entities[bs->client].client->lasthurt_client);
00799     //
00800     BotAI_BotInitialChat(bs, "hit_talking", name, weap, NULL);
00801     bs->lastchat_time = FloatTime();
00802     bs->chatto = CHAT_ALL;
00803     return qtrue;
00804 }

Here is the call graph for this function:

int BotChat_Kill bot_state_t bs  ) 
 

Definition at line 674 of file ai_chat.c.

References bot_fastchat, bot_nochat, bot_state_t, BotAI_BotInitialChat(), bot_state_s::botdeathtype, BotNumActivePlayers(), BotSameTeam(), BotValidChatPosition(), BotVisibleEnemies(), bot_state_s::character, CHARACTERISTIC_CHAT_INSULT, CHARACTERISTIC_CHAT_KILL, bot_state_s::chatto, bot_state_s::client, bot_state_s::cs, EasyClientName(), bot_state_s::enemydeathtype, FloatTime, gametype, vmCvar_t::integer, bot_state_s::lastchat_time, bot_state_s::lastkilledplayer, name, NULL, random, TeamPlayIsOn(), trap_BotNumInitialChats(), trap_Characteristic_BFloat(), and trap_EA_Command().

Referenced by AINode_Battle_Fight().

00674                                   {
00675     char name[32];
00676     float rnd;
00677 
00678     if (bot_nochat.integer) return qfalse;
00679     if (bs->lastchat_time > FloatTime() - TIME_BETWEENCHATTING) return qfalse;
00680     rnd = trap_Characteristic_BFloat(bs->character, CHARACTERISTIC_CHAT_KILL, 0, 1);
00681     // don't chat in tournament mode
00682     if (gametype == GT_TOURNAMENT) return qfalse;
00683     //if fast chat is off
00684     if (!bot_fastchat.integer) {
00685         if (random() > rnd) return qfalse;
00686     }
00687     if (bs->lastkilledplayer == bs->client) return qfalse;
00688     if (BotNumActivePlayers() <= 1) return qfalse;
00689     if (!BotValidChatPosition(bs)) return qfalse;
00690     //
00691     if (BotVisibleEnemies(bs)) return qfalse;
00692     //
00693     EasyClientName(bs->lastkilledplayer, name, 32);
00694     //
00695     bs->chatto = CHAT_ALL;
00696     if (TeamPlayIsOn() && BotSameTeam(bs, bs->lastkilledplayer)) {
00697         BotAI_BotInitialChat(bs, "kill_teammate", name, NULL);
00698         bs->chatto = CHAT_TEAM;
00699     }
00700     else
00701     {
00702         //don't chat in teamplay
00703         if (TeamPlayIsOn()) {
00704             trap_EA_Command(bs->client, "vtaunt");
00705             return qfalse;          // don't wait
00706         }
00707         //
00708         if (bs->enemydeathtype == MOD_GAUNTLET) {
00709             BotAI_BotInitialChat(bs, "kill_gauntlet", name, NULL);
00710         }
00711         else if (bs->enemydeathtype == MOD_RAILGUN) {
00712             BotAI_BotInitialChat(bs, "kill_rail", name, NULL);
00713         }
00714         else if (bs->enemydeathtype == MOD_TELEFRAG) {
00715             BotAI_BotInitialChat(bs, "kill_telefrag", name, NULL);
00716         }
00717 #ifdef MISSIONPACK
00718         else if (bs->botdeathtype == MOD_KAMIKAZE && trap_BotNumInitialChats(bs->cs, "kill_kamikaze"))
00719             BotAI_BotInitialChat(bs, "kill_kamikaze", name, NULL);
00720 #endif
00721         //choose between insult and praise
00722         else if (random() < trap_Characteristic_BFloat(bs->character, CHARACTERISTIC_CHAT_INSULT, 0, 1)) {
00723             BotAI_BotInitialChat(bs, "kill_insult", name, NULL);
00724         }
00725         else {
00726             BotAI_BotInitialChat(bs, "kill_praise", name, NULL);
00727         }
00728     }
00729     bs->lastchat_time = FloatTime();
00730     return qtrue;
00731 }

Here is the call graph for this function:

int BotChat_Random bot_state_t bs  ) 
 

Definition at line 894 of file ai_chat.c.

References bot_fastchat, bot_nochat, bot_state_t, BotAI_BotInitialChat(), BotIsObserver(), BotMapTitle(), BotNumActivePlayers(), BotRandomOpponentName(), BotRandomWeaponName(), BotValidChatPosition(), BotVisibleEnemies(), bot_state_s::character, CHARACTERISTIC_CHAT_MISC, CHARACTERISTIC_CHAT_RANDOM, bot_state_s::chatto, bot_state_s::client, EasyClientName(), FloatTime, gametype, vmCvar_t::integer, bot_state_s::lastchat_time, bot_state_s::lastkilledplayer, LTG_TEAMACCOMPANY, LTG_TEAMHELP, bot_state_s::ltgtype, name, NULL, random, strcpy(), TeamPlayIsOn(), bot_state_s::thinktime, trap_Characteristic_BFloat(), and trap_EA_Command().

Referenced by AINode_Seek_LTG().

00894                                     {
00895     float rnd;
00896     char name[32];
00897 
00898     if (bot_nochat.integer) return qfalse;
00899     if (BotIsObserver(bs)) return qfalse;
00900     if (bs->lastchat_time > FloatTime() - TIME_BETWEENCHATTING) return qfalse;
00901     // don't chat in tournament mode
00902     if (gametype == GT_TOURNAMENT) return qfalse;
00903     //don't chat when doing something important :)
00904     if (bs->ltgtype == LTG_TEAMHELP ||
00905         bs->ltgtype == LTG_TEAMACCOMPANY ||
00906         bs->ltgtype == LTG_RUSHBASE) return qfalse;
00907     //
00908     rnd = trap_Characteristic_BFloat(bs->character, CHARACTERISTIC_CHAT_RANDOM, 0, 1);
00909     if (random() > bs->thinktime * 0.1) return qfalse;
00910     if (!bot_fastchat.integer) {
00911         if (random() > rnd) return qfalse;
00912         if (random() > 0.25) return qfalse;
00913     }
00914     if (BotNumActivePlayers() <= 1) return qfalse;
00915     //
00916     if (!BotValidChatPosition(bs)) return qfalse;
00917     //
00918     if (BotVisibleEnemies(bs)) return qfalse;
00919     //
00920     if (bs->lastkilledplayer == bs->client) {
00921         strcpy(name, BotRandomOpponentName(bs));
00922     }
00923     else {
00924         EasyClientName(bs->lastkilledplayer, name, sizeof(name));
00925     }
00926     if (TeamPlayIsOn()) {
00927         trap_EA_Command(bs->client, "vtaunt");
00928         return qfalse;          // don't wait
00929     }
00930     //
00931     if (random() < trap_Characteristic_BFloat(bs->character, CHARACTERISTIC_CHAT_MISC, 0, 1)) {
00932         BotAI_BotInitialChat(bs, "random_misc",
00933                     BotRandomOpponentName(bs),  // 0
00934                     name,                       // 1
00935                     "[invalid var]",            // 2
00936                     "[invalid var]",            // 3
00937                     BotMapTitle(),              // 4
00938                     BotRandomWeaponName(),      // 5
00939                     NULL);
00940     }
00941     else {
00942         BotAI_BotInitialChat(bs, "random_insult",
00943                     BotRandomOpponentName(bs),  // 0
00944                     name,                       // 1
00945                     "[invalid var]",            // 2
00946                     "[invalid var]",            // 3
00947                     BotMapTitle(),              // 4
00948                     BotRandomWeaponName(),      // 5
00949                     NULL);
00950     }
00951     bs->lastchat_time = FloatTime();
00952     bs->chatto = CHAT_ALL;
00953     return qtrue;
00954 }

Here is the call graph for this function:

int BotChat_StartLevel bot_state_t bs  ) 
 

Definition at line 481 of file ai_chat.c.

References bot_fastchat, bot_nochat, bot_state_t, BotAI_BotInitialChat(), BotIsObserver(), BotNumActivePlayers(), bot_state_s::character, CHARACTERISTIC_CHAT_STARTENDLEVEL, bot_state_s::chatto, bot_state_s::client, EasyClientName(), FloatTime, gametype, vmCvar_t::integer, bot_state_s::lastchat_time, name, NULL, random, TeamPlayIsOn(), trap_Characteristic_BFloat(), and trap_EA_Command().

Referenced by AINode_Intermission().

00481                                         {
00482     char name[32];
00483     float rnd;
00484 
00485     if (bot_nochat.integer) return qfalse;
00486     if (BotIsObserver(bs)) return qfalse;
00487     if (bs->lastchat_time > FloatTime() - TIME_BETWEENCHATTING) return qfalse;
00488     //don't chat in teamplay
00489     if (TeamPlayIsOn()) {
00490         trap_EA_Command(bs->client, "vtaunt");
00491         return qfalse;
00492     }
00493     // don't chat in tournament mode
00494     if (gametype == GT_TOURNAMENT) return qfalse;
00495     rnd = trap_Characteristic_BFloat(bs->character, CHARACTERISTIC_CHAT_STARTENDLEVEL, 0, 1);
00496     if (!bot_fastchat.integer) {
00497         if (random() > rnd) return qfalse;
00498     }
00499     if (BotNumActivePlayers() <= 1) return qfalse;
00500     BotAI_BotInitialChat(bs, "level_start",
00501                 EasyClientName(bs->client, name, 32),   // 0
00502                 NULL);
00503     bs->lastchat_time = FloatTime();
00504     bs->chatto = CHAT_ALL;
00505     return qtrue;
00506 }

Here is the call graph for this function:

void BotChatTest bot_state_t bs  ) 
 

Definition at line 974 of file ai_chat.c.

References bot_state_t, BotAI_BotInitialChat(), bot_state_s::botdeathtype, BotFirstClientInRankings(), BotLastClientInRankings(), BotMapTitle(), BotRandomOpponentName(), BotRandomWeaponName(), BotWeaponNameForMeansOfDeath(), CHAT_ALL, bot_state_s::client, ClientName(), bot_state_s::cs, EasyClientName(), g_entities, i, bot_state_s::lastkilledby, bot_state_s::lastkilledplayer, name, NULL, strcpy(), trap_BotEnterChat(), and trap_BotNumInitialChats().

Referenced by BotAISetupClient().

00974                                   {
00975 
00976     char name[32];
00977     char *weap;
00978     int num, i;
00979 
00980     num = trap_BotNumInitialChats(bs->cs, "game_enter");
00981     for (i = 0; i < num; i++)
00982     {
00983         BotAI_BotInitialChat(bs, "game_enter",
00984                     EasyClientName(bs->client, name, 32),   // 0
00985                     BotRandomOpponentName(bs),              // 1
00986                     "[invalid var]",                        // 2
00987                     "[invalid var]",                        // 3
00988                     BotMapTitle(),                          // 4
00989                     NULL);
00990         trap_BotEnterChat(bs->cs, 0, CHAT_ALL);
00991     }
00992     num = trap_BotNumInitialChats(bs->cs, "game_exit");
00993     for (i = 0; i < num; i++)
00994     {
00995         BotAI_BotInitialChat(bs, "game_exit",
00996                     EasyClientName(bs->client, name, 32),   // 0
00997                     BotRandomOpponentName(bs),              // 1
00998                     "[invalid var]",                        // 2
00999                     "[invalid var]",                        // 3
01000                     BotMapTitle(),                          // 4
01001                     NULL);
01002         trap_BotEnterChat(bs->cs, 0, CHAT_ALL);
01003     }
01004     num = trap_BotNumInitialChats(bs->cs, "level_start");
01005     for (i = 0; i < num; i++)
01006     {
01007         BotAI_BotInitialChat(bs, "level_start",
01008                     EasyClientName(bs->client, name, 32),   // 0
01009                     NULL);
01010         trap_BotEnterChat(bs->cs, 0, CHAT_ALL);
01011     }
01012     num = trap_BotNumInitialChats(bs->cs, "level_end_victory");
01013     for (i = 0; i < num; i++)
01014     {
01015         BotAI_BotInitialChat(bs, "level_end_victory",
01016                 EasyClientName(bs->client, name, 32),   // 0
01017                 BotRandomOpponentName(bs),              // 1
01018                 BotFirstClientInRankings(),             // 2
01019                 BotLastClientInRankings(),              // 3
01020                 BotMapTitle(),                          // 4
01021                 NULL);
01022         trap_BotEnterChat(bs->cs, 0, CHAT_ALL);
01023     }
01024     num = trap_BotNumInitialChats(bs->cs, "level_end_lose");
01025     for (i = 0; i < num; i++)
01026     {
01027         BotAI_BotInitialChat(bs, "level_end_lose",
01028                 EasyClientName(bs->client, name, 32),   // 0