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

ai_vcmd.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 "ai_team.h"
#include "ai_vcmd.h"
#include "chars.h"
#include "inv.h"
#include "syn.h"
#include "match.h"
#include "../../ui/menudef.h"

Include dependency graph for ai_vcmd.c:

Include dependency graph

Go to the source code of this file.

Data Structures

struct  voiceCommand_s

Typedefs

typedef voiceCommand_s voiceCommand_t

Functions

void BotVoiceChat_Camp (bot_state_t *bs, int client, int mode)
void BotVoiceChat_Defend (bot_state_t *bs, int client, int mode)
void BotVoiceChat_DefendFlag (bot_state_t *bs, int client, int mode)
void BotVoiceChat_Dummy (bot_state_t *bs, int client, int mode)
void BotVoiceChat_FollowFlagCarrier (bot_state_t *bs, int client, int mode)
void BotVoiceChat_FollowMe (bot_state_t *bs, int client, int mode)
void BotVoiceChat_GetFlag (bot_state_t *bs, int client, int mode)
void BotVoiceChat_Offense (bot_state_t *bs, int client, int mode)
void BotVoiceChat_Patrol (bot_state_t *bs, int client, int mode)
void BotVoiceChat_ReturnFlag (bot_state_t *bs, int client, int mode)
void BotVoiceChat_StartLeader (bot_state_t *bs, int client, int mode)
void BotVoiceChat_StopLeader (bot_state_t *bs, int client, int mode)
void BotVoiceChat_WantOnDefense (bot_state_t *bs, int client, int mode)
void BotVoiceChat_WantOnOffense (bot_state_t *bs, int client, int mode)
void BotVoiceChat_WhoIsLeader (bot_state_t *bs, int client, int mode)
int BotVoiceChatCommand (bot_state_t *bs, int mode, char *voiceChat)

Variables

voiceCommand_t voiceCommands []


Typedef Documentation

typedef struct voiceCommand_s voiceCommand_t
 


Function Documentation

void BotVoiceChat_Camp bot_state_t bs,
int  client,
int  mode
 

Definition at line 257 of file ai_vcmd.c.

References aas_entityinfo_t, bot_goal_s::areanum, bot_state_s::arrive_time, bot_state_t, BotAI_BotInitialChat(), BotEntityInfo(), BotPointAreaNum(), BotPrintTeamGoal(), BotRememberLastOrderedTask(), BotSetTeamStatus(), CHAT_TELL, bot_state_s::cs, bot_state_s::decisionmaker, EasyClientName(), bot_goal_s::entitynum, FloatTime, bot_state_s::ltgtype, bot_goal_s::maxs, bot_goal_s::mins, NULL, bot_state_s::order_time, bot_state_s::ordered, bot_goal_s::origin, aas_entityinfo_s::origin, random, bot_state_s::teamgoal, bot_state_s::teamgoal_time, bot_state_s::teammate, bot_state_s::teammessage_time, trap_BotEnterChat(), aas_entityinfo_s::valid, VectorCopy, and VectorSet.

00257                                                               {
00258     int areanum;
00259     aas_entityinfo_t entinfo;
00260     char netname[MAX_NETNAME];
00261 
00262     //
00263     bs->teamgoal.entitynum = -1;
00264     BotEntityInfo(client, &entinfo);
00265     //if info is valid (in PVS)
00266     if (entinfo.valid) {
00267         areanum = BotPointAreaNum(entinfo.origin);
00268         if (areanum) { // && trap_AAS_AreaReachability(areanum)) {
00269             //NOTE: just assume the bot knows where the person is
00270             //if (BotEntityVisible(bs->entitynum, bs->eye, bs->viewangles, 360, client)) {
00271                 bs->teamgoal.entitynum = client;
00272                 bs->teamgoal.areanum = areanum;
00273                 VectorCopy(entinfo.origin, bs->teamgoal.origin);
00274                 VectorSet(bs->teamgoal.mins, -8, -8, -8);
00275                 VectorSet(bs->teamgoal.maxs, 8, 8, 8);
00276             //}
00277         }
00278     }
00279     //if the other is not visible
00280     if (bs->teamgoal.entitynum < 0) {
00281         BotAI_BotInitialChat(bs, "whereareyou", EasyClientName(client, netname, sizeof(netname)), NULL);
00282         trap_BotEnterChat(bs->cs, client, CHAT_TELL);
00283         return;
00284     }
00285     //
00286     bs->decisionmaker = client;
00287     bs->ordered = qtrue;
00288     bs->order_time = FloatTime();
00289     //set the time to send a message to the team mates
00290     bs->teammessage_time = FloatTime() + 2 * random();
00291     //set the ltg type
00292     bs->ltgtype = LTG_CAMPORDER;
00293     //get the team goal time
00294     bs->teamgoal_time = FloatTime() + TEAM_CAMP_TIME;
00295     //the teammate that requested the camping
00296     bs->teammate = client;
00297     //not arrived yet
00298     bs->arrive_time = 0;
00299     //
00300     BotSetTeamStatus(bs);
00301     // remember last ordered task
00302     BotRememberLastOrderedTask(bs);
00303 #ifdef DEBUG
00304     BotPrintTeamGoal(bs);
00305 #endif //DEBUG
00306 }

Here is the call graph for this function:

void BotVoiceChat_Defend bot_state_t bs,
int  client,
int  mode
 

Definition at line 172 of file ai_vcmd.c.

References bot_goal_t, bot_state_t, BotPrintTeamGoal(), BotRememberLastOrderedTask(), BotSetTeamStatus(), BotTeam(), ctf_blueflag, ctf_redflag, bot_state_s::decisionmaker, bot_state_s::defendaway_time, FloatTime, gametype, GT_1FCTF, GT_CTF, GT_OBELISK, bot_state_s::ltgtype, memcpy(), bot_state_s::order_time, bot_state_s::ordered, random, TEAM_BLUE, TEAM_RED, bot_state_s::teamgoal, bot_state_s::teamgoal_time, and bot_state_s::teammessage_time.

Referenced by BotVoiceChat_DefendFlag(), and FindHumanTeamLeader().

00172                                                                 {
00173 #ifdef MISSIONPACK
00174     if ( gametype == GT_OBELISK || gametype == GT_HARVESTER) {
00175         //
00176         switch(BotTeam(bs)) {
00177             case TEAM_RED: memcpy(&bs->teamgoal, &redobelisk, sizeof(bot_goal_t)); break;
00178             case TEAM_BLUE: memcpy(&bs->teamgoal, &blueobelisk, sizeof(bot_goal_t)); break;
00179             default: return;
00180         }
00181     }
00182     else
00183 #endif
00184         if (gametype == GT_CTF
00185 #ifdef MISSIONPACK
00186             || gametype == GT_1FCTF
00187 #endif
00188             ) {
00189         //
00190         switch(BotTeam(bs)) {
00191             case TEAM_RED: memcpy(&bs->teamgoal, &ctf_redflag, sizeof(bot_goal_t)); break;
00192             case TEAM_BLUE: memcpy(&bs->teamgoal, &ctf_blueflag, sizeof(bot_goal_t)); break;
00193             default: return;
00194         }
00195     }
00196     else {
00197         return;
00198     }
00199     //
00200     bs->decisionmaker = client;
00201     bs->ordered = qtrue;
00202     bs->order_time = FloatTime();
00203     //set the time to send a message to the team mates
00204     bs->teammessage_time = FloatTime() + 2 * random();
00205     //set the ltg type
00206     bs->ltgtype = LTG_DEFENDKEYAREA;
00207     //get the team goal time
00208     bs->teamgoal_time = FloatTime() + TEAM_DEFENDKEYAREA_TIME;
00209     //away from defending
00210     bs->defendaway_time = 0;
00211     //
00212     BotSetTeamStatus(bs);
00213     // remember last ordered task
00214     BotRememberLastOrderedTask(bs);
00215 #ifdef DEBUG
00216     BotPrintTeamGoal(bs);
00217 #endif //DEBUG
00218 }

Here is the call graph for this function:

void BotVoiceChat_DefendFlag bot_state_t bs,
int  client,
int  mode
 

Definition at line 225 of file ai_vcmd.c.

References bot_state_t, BotVoiceChat_Defend(), and mode.

00225                                                                     {
00226     BotVoiceChat_Defend(bs, client, mode);
00227 }

Here is the call graph for this function:

void BotVoiceChat_Dummy bot_state_t bs,
int  client,
int  mode
 

Definition at line 494 of file ai_vcmd.c.

References bot_state_t.

00494                                                                {
00495 }

void BotVoiceChat_FollowFlagCarrier bot_state_t bs,
int  client,
int  mode
 

Definition at line 367 of file ai_vcmd.c.

References bot_state_t, BotPrintTeamGoal(), BotTeamFlagCarrier(), BotVoiceChat_FollowMe(), and mode.

00367                                                                            {
00368     int carrier;
00369 
00370     carrier = BotTeamFlagCarrier(bs);
00371     if (carrier >= 0)
00372         BotVoiceChat_FollowMe(bs, carrier, mode);
00373 #ifdef DEBUG
00374     BotPrintTeamGoal(bs);
00375 #endif //DEBUG
00376 }

Here is the call graph for this function:

void BotVoiceChat_FollowMe bot_state_t bs,
int  client,
int  mode
 

Definition at line 313 of file ai_vcmd.c.

References aas_entityinfo_t, bot_goal_s::areanum, bot_state_s::arrive_time, bot_state_t, BotAI_BotInitialChat(), BotEntityInfo(), BotPointAreaNum(), BotPrintTeamGoal(), BotRememberLastOrderedTask(), BotSetTeamStatus(), CHAT_TELL, bot_state_s::cs, bot_state_s::decisionmaker, EasyClientName(), bot_goal_s::entitynum, FloatTime, bot_state_s::formation_dist, bot_state_s::ltgtype, bot_goal_s::maxs, bot_goal_s::mins, NULL, bot_state_s::order_time, bot_state_s::ordered, bot_goal_s::origin, aas_entityinfo_s::origin, random, bot_state_s::teamgoal, bot_state_s::teamgoal_time, bot_state_s::teammate, bot_state_s::teammatevisible_time, bot_state_s::teammessage_time, trap_BotEnterChat(), aas_entityinfo_s::valid, VectorCopy, and VectorSet.

Referenced by BotVoiceChat_FollowFlagCarrier().

00313                                                                   {
00314     int areanum;
00315     aas_entityinfo_t entinfo;
00316     char netname[MAX_NETNAME];
00317 
00318     bs->teamgoal.entitynum = -1;
00319     BotEntityInfo(client, &entinfo);
00320     //if info is valid (in PVS)
00321     if (entinfo.valid) {
00322         areanum = BotPointAreaNum(entinfo.origin);
00323         if (areanum) { // && trap_AAS_AreaReachability(areanum)) {
00324             bs->teamgoal.entitynum = client;
00325             bs->teamgoal.areanum = areanum;
00326             VectorCopy(entinfo.origin, bs->teamgoal.origin);
00327             VectorSet(bs->teamgoal.mins, -8, -8, -8);
00328             VectorSet(bs->teamgoal.maxs, 8, 8, 8);
00329         }
00330     }
00331     //if the other is not visible
00332     if (bs->teamgoal.entitynum < 0) {
00333         BotAI_BotInitialChat(bs, "whereareyou", EasyClientName(client, netname, sizeof(netname)), NULL);
00334         trap_BotEnterChat(bs->cs, client, CHAT_TELL);
00335         return;
00336     }
00337     //
00338     bs->decisionmaker = client;
00339     bs->ordered = qtrue;
00340     bs->order_time = FloatTime();
00341     //the team mate
00342     bs->teammate = client;
00343     //last time the team mate was assumed visible
00344     bs->teammatevisible_time = FloatTime();
00345     //set the time to send a message to the team mates
00346     bs->teammessage_time = FloatTime() + 2 * random();
00347     //get the team goal time
00348     bs->teamgoal_time = FloatTime() + TEAM_ACCOMPANY_TIME;
00349     //set the ltg type
00350     bs->ltgtype = LTG_TEAMACCOMPANY;
00351     bs->formation_dist = 3.5 * 32;      //3.5 meter
00352     bs->arrive_time = 0;
00353     //
00354     BotSetTeamStatus(bs);
00355     // remember last ordered task
00356     BotRememberLastOrderedTask(bs);
00357 #ifdef DEBUG
00358     BotPrintTeamGoal(bs);
00359 #endif //DEBUG
00360 }

Here is the call graph for this function:

void BotVoiceChat_GetFlag bot_state_t bs,
int  client,
int  mode
 

Definition at line 72 of file ai_vcmd.c.

References bot_goal_s::areanum, bot_state_t, BotGetAlternateRouteGoal(), BotOppositeTeam(), BotPrintTeamGoal(), BotRememberLastOrderedTask(), BotSetTeamStatus(), ctf_blueflag, ctf_redflag, bot_state_s::decisionmaker, FloatTime, gametype, bot_state_s::ltgtype, bot_state_s::order_time, bot_state_s::ordered, random, bot_state_s::teamgoal_time, and bot_state_s::teammessage_time.

Referenced by BotVoiceChat_Offense().

00072                                                                  {
00073     //
00074     if (gametype == GT_CTF) {
00075         if (!ctf_redflag.areanum || !ctf_blueflag.areanum)
00076             return;
00077     }
00078 #ifdef MISSIONPACK
00079     else if (gametype == GT_1FCTF) {
00080         if (!ctf_neutralflag.areanum || !ctf_redflag.areanum || !ctf_blueflag.areanum)
00081             return;
00082     }
00083 #endif
00084     else {
00085         return;
00086     }
00087     //
00088     bs->decisionmaker = client;
00089     bs->ordered = qtrue;
00090     bs->order_time = FloatTime();
00091     //set the time to send a message to the team mates
00092     bs->teammessage_time = FloatTime() + 2 * random();
00093     //set the ltg type
00094     bs->ltgtype = LTG_GETFLAG;
00095     //set the team goal time
00096     bs->teamgoal_time = FloatTime() + CTF_GETFLAG_TIME;
00097     // get an alternate route in ctf
00098     if (gametype == GT_CTF) {
00099         //get an alternative route goal towards the enemy base
00100         BotGetAlternateRouteGoal(bs, BotOppositeTeam(bs));
00101     }
00102     //
00103     BotSetTeamStatus(bs);
00104     // remember last ordered task
00105     BotRememberLastOrderedTask(bs);
00106 #ifdef DEBUG
00107     BotPrintTeamGoal(bs);
00108 #endif //DEBUG
00109 }

Here is the call graph for this function:

void BotVoiceChat_Offense bot_state_t bs,
int  client,
int  mode
 

Definition at line 116 of file ai_vcmd.c.

References bot_state_s::attackaway_time, bot_state_t, BotPrintTeamGoal(), BotRememberLastOrderedTask(), BotSetTeamStatus(), BotVoiceChat_GetFlag(), bot_state_s::decisionmaker, FloatTime, gametype, GT_1FCTF, GT_CTF, bot_state_s::harvestaway_time, bot_state_s::ltgtype, mode, bot_state_s::order_time, bot_state_s::ordered, random, bot_state_s::teamgoal_time, and bot_state_s::teammessage_time.

00116                                                                  {
00117     if ( gametype == GT_CTF
00118 #ifdef MISSIONPACK
00119         || gametype == GT_1FCTF
00120 #endif
00121         ) {
00122         BotVoiceChat_GetFlag(bs, client, mode);
00123         return;
00124     }
00125 #ifdef MISSIONPACK
00126     if (gametype == GT_HARVESTER) {
00127         //
00128         bs->decisionmaker = client;
00129         bs->ordered = qtrue;
00130         bs->order_time = FloatTime();
00131         //set the time to send a message to the team mates
00132         bs->teammessage_time = FloatTime() + 2 * random();
00133         //set the ltg type
00134         bs->ltgtype = LTG_HARVEST;
00135         //set the team goal time
00136         bs->teamgoal_time = FloatTime() + TEAM_HARVEST_TIME;
00137         bs->harvestaway_time = 0;
00138         //
00139         BotSetTeamStatus(bs);
00140         // remember last ordered task
00141         BotRememberLastOrderedTask(bs);
00142     }
00143     else
00144 #endif
00145     {
00146         //
00147         bs->decisionmaker = client;
00148         bs->ordered = qtrue;
00149         bs->order_time = FloatTime();
00150         //set the time to send a message to the team mates
00151         bs->teammessage_time = FloatTime() + 2 * random();
00152         //set the ltg type
00153         bs->ltgtype = LTG_ATTACKENEMYBASE;
00154         //set the team goal time
00155         bs->teamgoal_time = FloatTime() + TEAM_ATTACKENEMYBASE_TIME;
00156         bs->attackaway_time = 0;
00157         //
00158         BotSetTeamStatus(bs);
00159         // remember last ordered task
00160         BotRememberLastOrderedTask(bs);
00161     }
00162 #ifdef DEBUG
00163     BotPrintTeamGoal(bs);
00164 #endif //DEBUG
00165 }

Here is the call graph for this function:

void BotVoiceChat_Patrol bot_state_t bs,
int  client,
int  mode
 

Definition at line 234 of file ai_vcmd.c.

References bot_state_t, BotAI_BotInitialChat(), BotPrintTeamGoal(), BotSetTeamStatus(), BotVoiceChatOnly(), CHAT_TELL, bot_state_s::cs, bot_state_s::decisionmaker, bot_state_s::lastgoal_ltgtype, bot_state_s::lead_time, bot_state_s::ltgtype, NULL, trap_BotEnterChat(), and VOICECHAT_ONPATROL.

00234                                                                 {
00235     //
00236     bs->decisionmaker = client;
00237     //
00238     bs->ltgtype = 0;
00239     bs->lead_time = 0;
00240     bs->lastgoal_ltgtype = 0;
00241     //
00242     BotAI_BotInitialChat(bs, "dismissed", NULL);
00243     trap_BotEnterChat(bs->cs, client, CHAT_TELL);
00244     BotVoiceChatOnly(bs, -1, VOICECHAT_ONPATROL);
00245     //
00246     BotSetTeamStatus(bs);
00247 #ifdef DEBUG
00248     BotPrintTeamGoal(bs);
00249 #endif //DEBUG
00250 }

Here is the call graph for this function:

void BotVoiceChat_ReturnFlag bot_state_t bs,
int  client,
int  mode
 

Definition at line 383 of file ai_vcmd.c.

References bot_state_t, BotPrintTeamGoal(), BotSetTeamStatus(), bot_state_s::decisionmaker, FloatTime, gametype, GT_1FCTF, GT_CTF, bot_state_s::ltgtype, bot_state_s::order_time, bot_state_s::ordered, random, bot_state_s::rushbaseaway_time, bot_state_s::teamgoal_time, and bot_state_s::teammessage_time.

00383                                                                     {
00384     //if not in CTF mode
00385     if (
00386         gametype != GT_CTF
00387 #ifdef MISSIONPACK
00388         && gametype != GT_1FCTF
00389 #endif
00390         ) {
00391         return;
00392     }
00393     //
00394     bs->decisionmaker = client;
00395     bs->ordered = qtrue;
00396     bs->order_time = FloatTime();
00397     //set the time to send a message to the team mates
00398     bs->teammessage_time = FloatTime() + 2 * random();
00399     //set the ltg type
00400     bs->ltgtype = LTG_RETURNFLAG;
00401     //set the team goal time
00402     bs->teamgoal_time = FloatTime() + CTF_RETURNFLAG_TIME;
00403     bs->rushbaseaway_time = 0;
00404     BotSetTeamStatus(bs);
00405 #ifdef DEBUG
00406     BotPrintTeamGoal(bs);
00407 #endif //DEBUG
00408 }

Here is the call graph for this function:

void BotVoiceChat_StartLeader bot_state_t bs,
int  client,
int  mode
 

Definition at line 415 of file ai_vcmd.c.

References bot_state_t, ClientName(), and bot_state_s::teamleader.

00415                                                                      {
00416     ClientName(client, bs->teamleader, sizeof(bs->teamleader));
00417 }

Here is the call graph for this function:

void BotVoiceChat_StopLeader bot_state_t bs,
int  client,
int  mode
 

Definition at line 424 of file ai_vcmd.c.

References bot_state_t, ClientName(), notleader, Q_stricmp(), and bot_state_s::teamleader.

00424                                                                     {
00425     char netname[MAX_MESSAGE_SIZE];
00426 
00427     if (!Q_stricmp(bs->teamleader, ClientName(client, netname, sizeof(netname)))) {
00428         bs->teamleader[0] = '\0';
00429         notleader[client] = qtrue;
00430     }
00431 }

Here is the call graph for this function:

void BotVoiceChat_WantOnDefense bot_state_t bs,
int  client,
int  mode
 

Definition at line 457 of file ai_vcmd.c.

References ACTION_AFFIRMATIVE, bot_state_t, BotAI_BotInitialChat(), BotGetTeamMateTaskPreference(), BotSetTeamMateTaskPreference(), BotVoiceChatOnly(), CHAT_TELL, bot_state_s::client, bot_state_s::cs, EasyClientName(), NULL, trap_BotEnterChat(), trap_EA_Action(), and VOICECHAT_YES.

00457                                                                        {
00458     char netname[MAX_NETNAME];
00459     int preference;
00460 
00461     preference = BotGetTeamMateTaskPreference(bs, client);
00462     preference &= ~TEAMTP_ATTACKER;
00463     preference |= TEAMTP_DEFENDER;
00464     BotSetTeamMateTaskPreference(bs, client, preference);
00465     //
00466     EasyClientName(client, netname, sizeof(netname));
00467     BotAI_BotInitialChat(bs, "keepinmind", netname, NULL);
00468     trap_BotEnterChat(bs->cs, client, CHAT_TELL);
00469     BotVoiceChatOnly(bs, client, VOICECHAT_YES);
00470     trap_EA_Action(bs->client, ACTION_AFFIRMATIVE);
00471 }

Here is the call graph for this function:

void BotVoiceChat_WantOnOffense bot_state_t bs,
int  client,
int  mode
 

Definition at line 478 of file ai_vcmd.c.

References ACTION_AFFIRMATIVE, bot_state_t, BotAI_BotInitialChat(), BotGetTeamMateTaskPreference(), BotSetTeamMateTaskPreference(), BotVoiceChatOnly(), CHAT_TELL, bot_state_s::client, bot_state_s::cs, EasyClientName(), NULL, trap_BotEnterChat(), trap_EA_Action(), and VOICECHAT_YES.

00478                                                                        {
00479     char netname[MAX_NETNAME];
00480     int preference;
00481 
00482     preference = BotGetTeamMateTaskPreference(bs, client);
00483     preference &= ~TEAMTP_DEFENDER;
00484     preference |= TEAMTP_ATTACKER;
00485     BotSetTeamMateTaskPreference(bs, client, preference);
00486     //
00487     EasyClientName(client, netname, sizeof(netname));
00488     BotAI_BotInitialChat(bs, "keepinmind", netname, NULL);
00489     trap_BotEnterChat(bs->cs, client, CHAT_TELL);
00490     BotVoiceChatOnly(bs, client, VOICECHAT_YES);
00491     trap_EA_Action(bs->client, ACTION_AFFIRMATIVE);
00492 }

Here is the call graph for this function:

void BotVoiceChat_WhoIsLeader bot_state_t bs,
int  client,
int  mode
 

Definition at line 438 of file ai_vcmd.c.

References bot_state_t, BotAI_BotInitialChat(), BotVoiceChatOnly(), CHAT_TEAM, bot_state_s::client, ClientName(), bot_state_s::cs, NULL, Q_stricmp(), bot_state_s::teamleader, TeamPlayIsOn(), trap_BotEnterChat(), and VOICECHAT_STARTLEADER.

00438                                                                      {
00439     char netname[MAX_MESSAGE_SIZE];
00440 
00441     if (!TeamPlayIsOn()) return;
00442 
00443     ClientName(bs->client, netname, sizeof(netname));
00444     //if this bot IS the team leader
00445     if (!Q_stricmp(netname, bs->teamleader)) {
00446         BotAI_BotInitialChat(bs, "iamteamleader", NULL);
00447         trap_BotEnterChat(bs->cs, 0, CHAT_TEAM);
00448         BotVoiceChatOnly(bs, -1, VOICECHAT_STARTLEADER);
00449     }
00450 }

Here is the call graph for this function:

int BotVoiceChatCommand bot_state_t bs,
int  mode,
char *  voiceChat
 

Definition at line 515 of file ai_vcmd.c.

References atoi, bot_state_t, BotSameTeam(), voiceCommand_s::cmd, voiceCommand_s::func, i, mode, ptr(), Q_stricmp(), Q_strncpyz(), TeamPlayIsOn(), and voiceCommands.

Referenced by BotAI().

00515                                                                     {
00516     int i, voiceOnly, clientNum, color;
00517     char *ptr, buf[MAX_MESSAGE_SIZE], *cmd;
00518 
00519     if (!TeamPlayIsOn()) {
00520         return qfalse;
00521     }
00522 
00523     if ( mode == SAY_ALL ) {
00524         return qfalse;  // don't do anything with voice chats to everyone
00525     }
00526 
00527     Q_strncpyz(buf, voiceChat, sizeof(buf));
00528     cmd = buf;
00529     for (ptr = cmd; *cmd && *cmd > ' '; cmd++);
00530     while (*cmd && *cmd <= ' ') *cmd++ = '\0';
00531     voiceOnly = atoi(ptr);
00532     for (ptr = cmd; *cmd && *cmd > ' '; cmd++);
00533     while (*cmd && *cmd <= ' ') *cmd++ = '\0';
00534     clientNum = atoi(ptr);
00535     for (ptr = cmd; *cmd && *cmd > ' '; cmd++);
00536     while (*cmd && *cmd <= ' ') *cmd++ = '\0';
00537     color = atoi(ptr);
00538 
00539     if (!BotSameTeam(bs, clientNum)) {
00540         return qfalse;
00541     }
00542 
00543     for (i = 0; voiceCommands[i].cmd; i++) {
00544         if (!Q_stricmp(cmd, voiceCommands[i].cmd)) {
00545             voiceCommands[i].func(bs, clientNum, mode);
00546             return qtrue;
00547         }
00548     }
00549     return qfalse;
00550 }

Here is the call graph for this function:


Variable Documentation

voiceCommand_t voiceCommands[]
 

Initial value:

 {
    {VOICECHAT_GETFLAG, BotVoiceChat_GetFlag},
    {VOICECHAT_OFFENSE, BotVoiceChat_Offense },
    {VOICECHAT_DEFEND, BotVoiceChat_Defend },
    {VOICECHAT_DEFENDFLAG, BotVoiceChat_DefendFlag },
    {VOICECHAT_PATROL, BotVoiceChat_Patrol },
    {VOICECHAT_CAMP, BotVoiceChat_Camp },
    {VOICECHAT_FOLLOWME, BotVoiceChat_FollowMe },
    {VOICECHAT_FOLLOWFLAGCARRIER, BotVoiceChat_FollowFlagCarrier },
    {VOICECHAT_RETURNFLAG, BotVoiceChat_ReturnFlag },
    {VOICECHAT_STARTLEADER, BotVoiceChat_StartLeader },
    {VOICECHAT_STOPLEADER, BotVoiceChat_StopLeader },
    {VOICECHAT_WHOISLEADER, BotVoiceChat_WhoIsLeader },
    {VOICECHAT_WANTONDEFENSE, BotVoiceChat_WantOnDefense },
    {VOICECHAT_WANTONOFFENSE, BotVoiceChat_WantOnOffense },
    {NULL, BotVoiceChat_Dummy}
}

Definition at line 497 of file ai_vcmd.c.

Referenced by BotVoiceChatCommand().


Generated on Thu Aug 25 13:45:31 2005 for Quake III Arena by  doxygen 1.3.9.1