本文整理汇总了C++中BotAI_Print函数的典型用法代码示例。如果您正苦于以下问题:C++ BotAI_Print函数的具体用法?C++ BotAI_Print怎么用?C++ BotAI_Print使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了BotAI_Print函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: BotTestAAS
/*
* BotTestAAS
*/
void
BotTestAAS(Vec3 origin)
{
int areanum;
aas_areainfo_t info;
trap_cvarupdate(&bot_testsolid);
trap_cvarupdate(&bot_testclusters);
if(bot_testsolid.integer){
if(!trap_AAS_Initialized()) return;
areanum = BotPointAreaNum(origin);
if(areanum) BotAI_Print(PRT_MESSAGE, "\remtpy area");
else BotAI_Print(PRT_MESSAGE, "\r^1SOLID area");
}else if(bot_testclusters.integer){
if(!trap_AAS_Initialized()) return;
areanum = BotPointAreaNum(origin);
if(!areanum)
BotAI_Print(PRT_MESSAGE,
"\r^1Solid! ");
else{
trap_AAS_AreaInfo(areanum, &info);
BotAI_Print(PRT_MESSAGE, "\rarea %d, cluster %d ",
areanum,
info.cluster);
}
}
}
示例2: BotTestAAS
/*
==================
BotTestAAS
==================
*/
void BotTestAAS(vec3_t origin)
{
int areanum;
aas_areainfo_t info;
if (bot_testsolid->integer)
{
if (!botlib_export->aas.AAS_Initialized()) return;
areanum = BotPointAreaNum(origin);
if (areanum) BotAI_Print(PRT_MESSAGE, "\remtpy area");
else BotAI_Print(PRT_MESSAGE, "\r^1SOLID area");
}
else if (bot_testclusters->integer)
{
if (!botlib_export->aas.AAS_Initialized()) return;
areanum = BotPointAreaNum(origin);
if (!areanum)
BotAI_Print(PRT_MESSAGE, "\r^1Solid! ");
else
{
botlib_export->aas.AAS_AreaInfo(areanum, &info);
BotAI_Print(PRT_MESSAGE, "\rarea %d, cluster %d ", areanum, info.cluster);
}
}
}
示例3: BotAI_Print
//========================================================================
//
// Parameter: -
// Returns: -
// Changes Globals: -
//========================================================================
bot_character_t *BotCharacterFromHandle(int handle)
{
if (handle <= 0 || handle >= MAX_BOT_CHARACTERS)
{
BotAI_Print(PRT_FATAL, "character handle %d out of range\n", handle);
return NULL;
} //end if
if (!botcharacters[handle].skill)
{
BotAI_Print(PRT_FATAL, "invalid character %d\n", handle);
return NULL;
} //end if
return &botcharacters[handle];
} //end of the function BotCharacterFromHandle
示例4: BotFreeCharacter2
//========================================================================
//
// Parameter: -
// Returns: -
// Changes Globals: -
//========================================================================
void BotFreeCharacter2(int handle)
{
if (handle <= 0 || handle >= MAX_BOT_CHARACTERS)
{
BotAI_Print(PRT_FATAL, "character handle %d out of range\n", handle);
return;
} //end if
if (!botcharacters[handle].skill)
{
BotAI_Print(PRT_FATAL, "invalid character %d\n", handle);
return;
} //end if
BotFreeCharacterStrings(&botcharacters[handle]);
Com_Memset(&botcharacters[handle], 0, sizeof (bot_character_t));
} //end of the function BotFreeCharacter2
示例5: AICast_ShutdownClient
/*
==============
AICast_ShutdownClient
==============
*/
int AICast_ShutdownClient(int client)
{
cast_state_t *cs;
bot_state_t *bs;
if (!(bs = botstates[client])) {
return BLERR_NOERROR;
}
if (!bs->inuse) {
BotAI_Print(PRT_ERROR, "client %d already shutdown\n", client);
return BLERR_AICLIENTALREADYSHUTDOWN;
}
cs = AICast_GetCastState( client );
//
memset( cs, 0, sizeof(cast_state_t) );
numcast--;
// now do the other bot stuff
#ifdef DEBUG
// botai_import.DebugLineDelete(bs->debugline);
#endif //DEBUG
trap_BotFreeMoveState(bs->ms);
//free the goal state
trap_BotFreeGoalState(bs->gs);
//
//clear the bot state
memset(bs, 0, sizeof(bot_state_t));
//set the inuse flag to qfalse
bs->inuse = qfalse;
//everything went ok
return BLERR_NOERROR;
}
示例6: AICast_SetupClient
/*
==============
AICast_SetupClient
==============
*/
int AICast_SetupClient(int client)
{
cast_state_t *cs;
bot_state_t *bs;
if (!botstates[client]) {
botstates[client] = G_Alloc(sizeof(bot_state_t));
memset( botstates[client], 0, sizeof(bot_state_t) );
}
bs = botstates[client];
if (bs->inuse) {
BotAI_Print(PRT_FATAL, "client %d already setup\n", client);
return qfalse;
}
cs = AICast_GetCastState(client);
cs->bs = bs;
//allocate a goal state
bs->gs = trap_BotAllocGoalState(client);
bs->inuse = qtrue;
bs->client = client;
bs->entitynum = client;
bs->setupcount = qtrue;
bs->entergame_time = trap_AAS_Time();
bs->ms = trap_BotAllocMoveState();
return qtrue;
}
示例7: zone
/*
==============
BotAimEnemySet
Sets the bot's aim enemy to the inputted enemy and
copies the inputted combat zone description for that
enemy. If enemy is NULL, the bot's combat zone is
instead reset to a default zone (and the input zone,
which may be NULL, is ignored). "sighted" is the
time at which the target was first sighted, or -1 if
the target is not currently in line of sight.
NOTE: The combat zone will get copied over even when
the input enemy is the bot's current enemy, but
additional fields will get reset when the input enemy
is a change. So it's important to call this function
when either the aim enemy or the enemy's combat zone
changes.
==============
*/
void BotAimEnemySet(bot_state_t *bs, gentity_t *enemy, combat_zone_t *zone)
{
// If the aim enemy changed, update some related data
if (bs->aim_enemy != enemy)
{
// Store the new enemy and their estimate health
bs->aim_enemy = enemy;
bs->enemy_health = 125;
// Look up their last known movement decision
if (enemy && enemy->client)
ClientViewDir(enemy->client, bs->aim_enemy_move_dir);
#ifdef DEBUG_AI
if (bs->debug_flags & BOT_DEBUG_INFO_ENEMY)
BotAI_Print(PRT_MESSAGE, "%s: Aim Enemy: %s\n",
EntityNameFast(bs->ent),
EntityNameFast(bs->aim_enemy));
#endif
}
// Update the enemy's combat zone if an enemy exists; otherwise use the last
// enemy's zone as the default.
//
// NOTE: It's likely the bot will make shots after it kills an enemy because
// the bots continue firing for a few milliseconds after they decide to stop.
// This code will reset the aim enemy as soon as the target dies, but shots
// will occur afterwards (and probably miss). Those misses should get applied
// to the combat zone the enemy was in at the time of attack decision.
if (enemy)
memcpy(&bs->aim_zone, zone, sizeof(combat_zone_t));
}
示例8: Characteristic_Integer
//===========================================================================
//
// Parameter: -
// Returns: -
// Changes Globals: -
//===========================================================================
int Characteristic_Integer(int character, int index)
{
bot_character_t *ch;
ch = BotCharacterFromHandle(character);
if (!ch) return 0;
//check if the index is in range
if (!CheckCharacteristicIndex(character, index)) return 0;
//an integer will just be returned
if (ch->c[index].type == CT_INTEGER)
{
return ch->c[index].value.integer;
} //end if
//floats are casted to integers
else if (ch->c[index].type == CT_FLOAT)
{
return (int) ch->c[index].value._float;
} //end else if
else
{
BotAI_Print(PRT_ERROR, "characteristic %d is not an integer\n", index);
return 0;
} //end else if
// return 0;
} //end of the function Characteristic_Integer
示例9: Characteristic_Float
//===========================================================================
//
// Parameter: -
// Returns: -
// Changes Globals: -
//===========================================================================
float Characteristic_Float(int character, int index)
{
bot_character_t *ch;
ch = BotCharacterFromHandle(character);
if (!ch) return 0;
//check if the index is in range
if (!CheckCharacteristicIndex(character, index)) return 0;
//an integer will be converted to a float
if (ch->c[index].type == CT_INTEGER)
{
return (float) ch->c[index].value.integer;
} //end if
//floats are just returned
else if (ch->c[index].type == CT_FLOAT)
{
return ch->c[index].value._float;
} //end else if
//cannot convert a string pointer to a float
else
{
BotAI_Print(PRT_ERROR, "characteristic %d is not a float\n", index);
return 0;
} //end else if
// return 0;
} //end of the function Characteristic_Float
示例10: BotGPSToPosition
/*
=======================================================================================================================================
BotGPSToPosition
=======================================================================================================================================
*/
int BotGPSToPosition(char *buf, vec3_t position) {
int i, j = 0;
int num, sign;
for (i = 0; i < 3; i++) {
num = 0;
while (buf[j] == ' ') j++;
if (buf[j] == '-') {
j++;
sign = -1;
} else {
sign = 1;
}
while (buf[j]) {
if (buf[j] >= '0' && buf[j] <= '9') {
num = num * 10 + buf[j] - '0';
j++;
} else {
j++;
break;
}
}
BotAI_Print(PRT_MESSAGE, "%d\n", sign * num);
position[i] = (float)sign * num;
}
return qtrue;
}
示例11: CheckCharacteristicIndex
//===========================================================================
//
// Parameter: -
// Returns: -
// Changes Globals: -
//===========================================================================
int CheckCharacteristicIndex(int character, int index)
{
bot_character_t *ch;
ch = BotCharacterFromHandle(character);
if (!ch) return qfalse;
if (index < 0 || index >= MAX_CHARACTERISTICS)
{
BotAI_Print(PRT_ERROR, "characteristic %d does not exist\n", index);
return qfalse;
} //end if
if (!ch->c[index].type)
{
BotAI_Print(PRT_ERROR, "characteristic %d is not initialized\n", index);
return qfalse;
} //end if
return qtrue;
} //end of the function CheckCharacteristicIndex
示例12: BotMatchMessage
/*
==================
BotMatchMessage
==================
*/
int BotMatchMessage(bot_state_t *bs, char *message) {
bot_match_t match;
match.type = 0;
//if it is an unknown message
if (!trap_BotFindMatch(message, &match, MTCONTEXT_MISC|MTCONTEXT_INITIALTEAMCHAT )) {
if(bot_developer.integer & AIDBG_CHAT ){
G_Printf("^2no match for ^1%s\n", message);
}
return qfalse;
}
if(bot_developer.integer & AIDBG_CHAT){
G_Printf("^6match %d for^1 %s\n", match.type, message);
}
//react to the found message
switch(match.type)
{
case MSG_WRONGWALL:{
BotMatch_WrongWall(bs, &match);
break;
}
//case MSG_GOFORBALLOON:{ //someone calling for company
// BotMatch_GoForBalloon(bs, &match);
// break;
//}
case MSG_DROPCART:{
BotMatch_DropCart(bs, &match);
break;
}
case MSG_GETITEM:{
BotMatch_GetItem(bs, &match);
break;
}
case MSG_ENTERGAME:{ //someone entered the game
BotMatch_EnterGame(bs, &match);
break;
}
case MSG_CATCHME:{
BotMatch_CatchMe(bs, &match);
break;
}
default:{
if(bot_developer.integer)
BotAI_Print(PRT_MESSAGE, "unknown match type %d\n",match.type);
break;
}
}
return qtrue;
}
示例13: Svcmd_BotTeamplayReport_f
/*
==================
Svcmd_BotTeamplayReport_f
==================
*/
void Svcmd_BotTeamplayReport_f(void) {
int i;
if (!bot_report.integer) {
BotAI_Print(PRT_MESSAGE, "Must set bot_report 1 before using botreport command.\n");
return;
}
if (gametype >= GT_TEAM) {
BotAI_Print(PRT_MESSAGE, S_COLOR_RED"RED\n");
for (i = 0; i < level.maxplayers; i++) {
//
if ( !botstates[i] || !botstates[i]->inuse ) continue;
//
if (BotTeam(botstates[i]) == TEAM_RED) {
BotReportStatus(botstates[i]);
}
}
BotAI_Print(PRT_MESSAGE, S_COLOR_BLUE"BLUE\n");
for (i = 0; i < level.maxplayers; i++) {
//
if ( !botstates[i] || !botstates[i]->inuse ) continue;
//
if (BotTeam(botstates[i]) == TEAM_BLUE) {
BotReportStatus(botstates[i]);
}
}
}
else {
for (i = 0; i < level.maxplayers; i++) {
//
if ( !botstates[i] || !botstates[i]->inuse ) continue;
//
BotReportStatus(botstates[i]);
}
}
}
示例14: BotCheckEvents
/*
===============
BotMatchMessage
This function returns if the message could be matched. It does not
mean the bot actually processed the message.
NOTE: Death messages are sent as an EV_OBITUARY event, not actual console
messages. As such, they are processed by BotCheckEvents() in ai_scan.c.
===============
*/
qboolean BotMatchMessage(bot_state_t *bs, char *message)
{
bot_match_t match;
char name[MAX_MESSAGE_SIZE];
gentity_t *sender;
// Try to match this message as a CTF teamchat message
match.type = 0;
if (!trap_BotFindMatch(message, &match,
MTCONTEXT_MISC | MTCONTEXT_INITIALTEAMCHAT | MTCONTEXT_CTF))
return qfalse;
// Ignore messages in deathmatch modes, but return true because it's a real message
if ( !(game_style & GS_TEAM) )
return qtrue;
// Check if this message is a team management message
trap_BotMatchVariable(&match, NETNAME, name, sizeof(name));
sender = TeammateFromName(bs, name);
if (BotMatch_Team(bs, &match, sender))
return qtrue;
// Ignore messages not from a teammate
if (!sender)
{
Bot_InitialChat(bs, "whois", name, NULL);
trap_BotEnterChat(bs->cs, bs->client, CHAT_TEAM);
return qtrue;
}
// Ignore other messages if they aren't intended for this bot
if (!BotAddresseeMatch(bs, &match))
return qtrue;
// Check if this message is an order
if (BotMatch_Order(bs, &match, sender))
return qtrue;
// Check if this message is a subteam request
if (BotMatch_Subteam(bs, &match, sender))
return qtrue;
// Still return true because the message matched-- our code just elected not to process it
BotAI_Print(PRT_WARNING, "Unknown match type %i\n", match.type);
return qtrue;
}
示例15: Characteristic_BInteger
//===========================================================================
//
// Parameter: -
// Returns: -
// Changes Globals: -
//===========================================================================
int Characteristic_BInteger(int character, int index, int min, int max)
{
int value;
bot_character_t *ch;
ch = BotCharacterFromHandle(character);
if (!ch) return 0;
if (min > max)
{
BotAI_Print(PRT_ERROR, "cannot bound characteristic %d between %d and %d\n", index, min, max);
return 0;
} //end if
value = Characteristic_Integer(character, index);
if (value < min) return min;
if (value > max) return max;
return value;
} //end of the function Characteristic_BInteger