本文整理匯總了C++中BotAddressedToBot函數的典型用法代碼示例。如果您正苦於以下問題:C++ BotAddressedToBot函數的具體用法?C++ BotAddressedToBot怎麽用?C++ BotAddressedToBot使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了BotAddressedToBot函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。
示例1: BotMatch_WhichTeam
/*
==================
BotMatch_LeaveSubteam
==================
*/
void BotMatch_WhichTeam(bot_state_t *bs, bot_match_t *match) {
if (!TeamPlayIsOn()) return;
//if not addressed to this bot
if (!BotAddressedToBot(bs, match)) return;
//
if (strlen(bs->subteam)) {
BotAI_BotInitialChat(bs, "inteam", bs->subteam, NULL);
}
else {
BotAI_BotInitialChat(bs, "noteam", NULL);
}
trap_BotEnterChat(bs->cs, bs->client, CHAT_TEAM);
}
示例2: BotMatch_LeaveSubteam
/*
==================
BotMatch_LeaveSubteam
==================
*/
void BotMatch_LeaveSubteam( bot_state_t *bs, bot_match_t *match ) {
if ( !TeamPlayIsOn() ) {
return;
}
//if not addressed to this bot
if ( !BotAddressedToBot( bs, match ) ) {
return;
}
//
if ( strlen( bs->subteam ) ) {
BotAI_BotInitialChat( bs, "leftteam", bs->subteam, NULL );
} //end if
trap_BotEnterChat( bs->cs, bs->client, CHAT_TEAM );
strcpy( bs->subteam, "" );
}
示例3: BotMatch_Dismiss
/*
=======================================================================================================================================
BotMatch_Dismiss
=======================================================================================================================================
*/
void BotMatch_Dismiss(bot_state_t *bs, bot_match_t *match) {
if (!TeamPlayIsOn()) {
return;
}
// if not addressed to this bot
if (!BotAddressedToBot(bs, match)) {
return;
}
bs->ltgtype = 0;
bs->lead_time = 0;
BotAI_BotInitialChat(bs, "dismissed", NULL);
trap_BotEnterChat(bs->cs, bs->client, CHAT_TEAM);
}
示例4: BotMatch_Suicide
/*
==================
BotMatch_Suicide
==================
*/
void BotMatch_Suicide(bot_state_t *bs, bot_match_t *match) {
char netname[MAX_MESSAGE_SIZE];
int client;
if (!TeamPlayIsOn()) return;
//if not addressed to this bot
if (!BotAddressedToBot(bs, match)) return;
//
trap_EA_Command(bs->client, "kill");
//
trap_BotMatchVariable(match, NETNAME, netname, sizeof(netname));
client = ClientFromName(netname);
//
BotVoiceChat(bs, client, VOICECHAT_TAUNT);
trap_EA_Action(bs->client, ACTION_AFFIRMATIVE);
}
示例5: BotMatch_WhereAreYou
/*
=======================================================================================================================================
BotMatch_WhereAreYou
=======================================================================================================================================
*/
void BotMatch_WhereAreYou(bot_state_t *bs, bot_match_t *match) {
float dist, bestdist;
int i, bestitem, redflagtt, blueflagtt;
bot_goal_t goal;
char *nearbyitems[] = {
"Shotgun", "Grenade Launcher", "Rocket Launcher", "Plasmagun", "Railgun", "Lightning Gun", "BFG10K", "Quad Damage", "Regeneration", "Battle Suit", "Speed", "Invisibility", "Flight", "Armor", "Heavy Armor", "Red Flag", "Blue Flag", NULL
};
if (!TeamPlayIsOn()) {
return;
}
// if not addressed to this bot
if (!BotAddressedToBot(bs, match)) {
return;
}
bestitem = -1;
bestdist = 999999;
for (i = 0; nearbyitems[i]; i++) {
dist = BotNearestVisibleItem(bs, nearbyitems[i], &goal);
if (dist < bestdist) {
bestdist = dist;
bestitem = i;
}
}
if (bestitem != -1) {
if (gametype == GT_CTF) {
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);
if (redflagtt < (redflagtt + blueflagtt) * 0.4) {
BotAI_BotInitialChat(bs, "ctflocation", nearbyitems[bestitem], "red", NULL);
} else if (blueflagtt < (redflagtt + blueflagtt) * 0.4) {
BotAI_BotInitialChat(bs, "ctflocation", nearbyitems[bestitem], "blue", NULL);
} else {
BotAI_BotInitialChat(bs, "location", nearbyitems[bestitem], NULL);
}
} else {
BotAI_BotInitialChat(bs, "location", nearbyitems[bestitem], NULL);
}
trap_BotEnterChat(bs->cs, bs->client, CHAT_TEAM);
}
}
示例6: BotMatch_GetFlag
/*
==================
BotMatch_GetFlag
==================
*/
void BotMatch_GetFlag(bot_state_t *bs, bot_match_t *match) {
char netname[MAX_MESSAGE_SIZE];
int client;
if (gametype == GT_CTF) {
if (!ctf_redflag.areanum || !ctf_blueflag.areanum)
return;
}
#ifdef MISSIONPACK
else if (gametype == GT_1FCTF) {
if (!ctf_neutralflag.areanum || !ctf_redflag.areanum || !ctf_blueflag.areanum)
return;
}
#endif
else {
return;
}
//if not addressed to this bot
if (!BotAddressedToBot(bs, match)) return;
//
trap_BotMatchVariable(match, NETNAME, netname, sizeof(netname));
//
client = FindClientByName(netname);
//
bs->decisionmaker = client;
bs->ordered = qtrue;
bs->order_time = FloatTime();
//set the time to send a message to the team mates
bs->teammessage_time = FloatTime() + 2 * random();
//set the ltg type
bs->ltgtype = LTG_GETFLAG;
//set the team goal time
bs->teamgoal_time = FloatTime() + CTF_GETFLAG_TIME;
// get an alternate route in ctf
if (gametype == GT_CTF) {
//get an alternative route goal towards the enemy base
BotGetAlternateRouteGoal(bs, BotOppositeTeam(bs));
}
//
BotSetTeamStatus(bs);
// remember last ordered task
BotRememberLastOrderedTask(bs);
#ifdef DEBUG
BotPrintTeamGoal(bs);
#endif //DEBUG
}
示例7: BotMatch_FormationSpace
/*
==================
BotMatch_FormationSpace
==================
*/
void BotMatch_FormationSpace(bot_state_t *bs, bot_match_t *match) {
char buf[MAX_MESSAGE_SIZE];
float space;
if (!TeamPlayIsOn()) return;
//if not addressed to this bot
if (!BotAddressedToBot(bs, match)) return;
//
trap_BotMatchVariable(match, NUMBER, buf, MAX_MESSAGE_SIZE);
//if it's the distance in feet
if (match->subtype & ST_FEET) space = 0.3048 * 32 * atof(buf);
//else it's in meters
else space = 32 * atof(buf);
//check if the formation intervening space is valid
if (space < 48 || space > 500) space = 100;
bs->formation_dist = space;
}
示例8: BotMatch_LeaveSubteam
/*
==================
BotMatch_LeaveSubteam
==================
*/
void BotMatch_LeaveSubteam(bot_state_t *bs, bot_match_t *match) {
char netname[MAX_MESSAGE_SIZE];
int client;
if (!TeamPlayIsOn()) return;
//if not addressed to this bot
if (!BotAddressedToBot(bs, match)) return;
//
if (strlen(bs->subteam))
{
BotAI_BotInitialChat(bs, "leftteam", bs->subteam, NULL);
trap_BotMatchVariable(match, NETNAME, netname, sizeof(netname));
client = ClientFromName(netname);
trap_BotEnterChat(bs->cs, client, CHAT_TELL);
} //end if
strcpy(bs->subteam, "");
}
示例9: BotMatch_JoinSubteam
/*
=======================================================================================================================================
BotMatch_JoinSubteam
=======================================================================================================================================
*/
void BotMatch_JoinSubteam(bot_state_t *bs, bot_match_t *match) {
char teammate[MAX_MESSAGE_SIZE];
if (!TeamPlayIsOn()) {
return;
}
// if not addressed to this bot
if (!BotAddressedToBot(bs, match)) {
return;
}
// get the sub team name
trap_BotMatchVariable(match, TEAMNAME, teammate, MAX_MESSAGE_SIZE);
// set the sub team name
strncpy(bs->subteam, teammate, 32);
bs->subteam[31] = '\0';
BotAI_BotInitialChat(bs, "joinedteam", teammate, NULL);
trap_BotEnterChat(bs->cs, bs->client, CHAT_TEAM);
}
示例10: BotMatch_JoinSubteam
/*
==================
BotMatch_JoinSubteam
==================
*/
void BotMatch_JoinSubteam(bot_state_t *bs, bot_match_t *match) {
char teammate[MAX_MESSAGE_SIZE];
char netname[MAX_MESSAGE_SIZE];
int client;
if (!TeamPlayIsOn()) return;
//if not addressed to this bot
if (!BotAddressedToBot(bs, match)) return;
//get the sub team name
trap_BotMatchVariable(match, TEAMNAME, teammate, sizeof(teammate));
//set the sub team name
strncpy(bs->subteam, teammate, 32);
bs->subteam[31] = '\0';
//
trap_BotMatchVariable(match, NETNAME, netname, sizeof(netname));
BotAI_BotInitialChat(bs, "joinedteam", teammate, NULL);
client = ClientFromName(netname);
trap_BotEnterChat(bs->cs, client, CHAT_TELL);
}
示例11: BotMatch_GetFlag
/*
=======================================================================================================================================
BotMatch_GetFlag
=======================================================================================================================================
*/
void BotMatch_GetFlag(bot_state_t *bs, bot_match_t *match) {
// if not in CTF mode
if (gametype != GT_CTF || !ctf_redflag.areanum || !ctf_blueflag.areanum) {
return;
}
// if not addressed to this bot
if (!BotAddressedToBot(bs, match)) {
return;
}
// set the time to send a message to the team mates
bs->teammessage_time = trap_AAS_Time() + 2 * random();
// set the ltg type
bs->ltgtype = LTG_GETFLAG;
// set the team goal time
bs->teamgoal_time = trap_AAS_Time() + CTF_GETFLAG_TIME;
#ifdef DEBUG
BotPrintTeamGoal(bs);
#endif // DEBUG
}
示例12: BotMatch_Dismiss
/*
==================
BotMatch_Dismiss
==================
*/
void BotMatch_Dismiss(bot_state_t *bs, bot_match_t *match) {
char netname[MAX_MESSAGE_SIZE];
int client;
if (!TeamPlayIsOn()) return;
//if not addressed to this bot
if (!BotAddressedToBot(bs, match)) return;
trap_BotMatchVariable(match, NETNAME, netname, sizeof(netname));
client = ClientFromName(netname);
//
bs->decisionmaker = client;
//
bs->ltgtype = 0;
bs->lead_time = 0;
bs->lastgoal_ltgtype = 0;
//
BotAI_BotInitialChat(bs, "dismissed", NULL);
trap_BotEnterChat(bs->cs, client, CHAT_TELL);
}
示例13: BotMatch_DefendKeyArea
/*
==================
BotMatch_DefendKeyArea
==================
*/
void BotMatch_DefendKeyArea(bot_state_t *bs, bot_match_t *match) {
char itemname[MAX_MESSAGE_SIZE];
char netname[MAX_MESSAGE_SIZE];
int client;
if (!TeamPlayIsOn()) return;
//if not addressed to this bot
if (!BotAddressedToBot(bs, match)) return;
//get the match variable
trap_BotMatchVariable(match, KEYAREA, itemname, sizeof(itemname));
//
if (!BotGetMessageTeamGoal(bs, itemname, &bs->teamgoal)) {
//BotAI_BotInitialChat(bs, "cannotfind", itemname, NULL);
//trap_BotEnterChat(bs->cs, bs->client, CHAT_TEAM);
return;
}
//
trap_BotMatchVariable(match, NETNAME, netname, sizeof(netname));
//
client = ClientFromName(netname);
//the team mate who ordered
bs->decisionmaker = client;
bs->ordered = qtrue;
bs->order_time = FloatTime();
//set the time to send a message to the team mates
bs->teammessage_time = FloatTime() + 2 * random();
//set the ltg type
bs->ltgtype = LTG_DEFENDKEYAREA;
//get the team goal time
bs->teamgoal_time = BotGetTime(match);
//set the team goal time
if (!bs->teamgoal_time) bs->teamgoal_time = FloatTime() + TEAM_DEFENDKEYAREA_TIME;
//away from defending
bs->defendaway_time = 0;
//
BotSetTeamStatus(bs);
// remember last ordered task
BotRememberLastOrderedTask(bs);
#ifdef DEBUG
BotPrintTeamGoal(bs);
#endif //DEBUG
}
示例14: BotMatch_ReturnFlag
/*
=======================================================================================================================================
BotMatch_ReturnFlag
=======================================================================================================================================
*/
void BotMatch_ReturnFlag(bot_state_t *bs, bot_match_t *match) {
// if not in CTF mode
if (gametype != GT_CTF) {
return;
}
// if not addressed to this bot
if (!BotAddressedToBot(bs, match)) {
return;
}
// set the time to send a message to the team mates
bs->teammessage_time = trap_AAS_Time() + 2 * random();
// set the ltg type
bs->ltgtype = LTG_RETURNFLAG;
// set the team goal time
bs->teamgoal_time = trap_AAS_Time() + CTF_RETURNFLAG_TIME;
bs->rushbaseaway_time = 0;
#ifdef DEBUG
BotPrintTeamGoal(bs);
#endif // DEBUG
}
示例15: BotMatch_AttackEnemyBase
/*
==================
BotMatch_AttackEnemyBase
==================
*/
void BotMatch_AttackEnemyBase(bot_state_t *bs, bot_match_t *match) {
char netname[MAX_MESSAGE_SIZE];
int client;
if (gametype == GT_CTF) {
BotMatch_GetFlag(bs, match);
}
#ifdef MISSIONPACK
else if (gametype == GT_1FCTF || gametype == GT_OBELISK || gametype == GT_HARVESTER) {
if (!redobelisk.areanum || !blueobelisk.areanum)
return;
}
#endif
else {
return;
}
//if not addressed to this bot
if (!BotAddressedToBot(bs, match)) return;
//
trap_BotMatchVariable(match, NETNAME, netname, sizeof(netname));
//
client = FindClientByName(netname);
//
bs->decisionmaker = client;
bs->ordered = qtrue;
bs->order_time = FloatTime();
//set the time to send a message to the team mates
bs->teammessage_time = FloatTime() + 2 * random();
//set the ltg type
bs->ltgtype = LTG_ATTACKENEMYBASE;
//set the team goal time
bs->teamgoal_time = FloatTime() + TEAM_ATTACKENEMYBASE_TIME;
bs->attackaway_time = 0;
//
BotSetTeamStatus(bs);
// remember last ordered task
BotRememberLastOrderedTask(bs);
#ifdef DEBUG
BotPrintTeamGoal(bs);
#endif //DEBUG
}