| 1 |
/* |
| 2 |
=========================================================================== |
| 3 |
Copyright (C) 1999-2005 Id Software, Inc. |
| 4 |
|
| 5 |
This file is part of Quake III Arena source code. |
| 6 |
|
| 7 |
Quake III Arena source code is free software; you can redistribute it |
| 8 |
and/or modify it under the terms of the GNU General Public License as |
| 9 |
published by the Free Software Foundation; either version 2 of the License, |
| 10 |
or (at your option) any later version. |
| 11 |
|
| 12 |
Quake III Arena source code is distributed in the hope that it will be |
| 13 |
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 |
GNU General Public License for more details. |
| 16 |
|
| 17 |
You should have received a copy of the GNU General Public License |
| 18 |
along with Quake III Arena source code; if not, write to the Free Software |
| 19 |
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
| 20 |
=========================================================================== |
| 21 |
*/ |
| 22 |
// |
| 23 |
|
| 24 |
/***************************************************************************** |
| 25 |
* name: ai_dmq3.h |
| 26 |
* |
| 27 |
* desc: Quake3 bot AI |
| 28 |
* |
| 29 |
* $Archive: /source/code/botai/ai_chat.c $ |
| 30 |
* |
| 31 |
*****************************************************************************/ |
| 32 |
|
| 33 |
//setup the deathmatch AI |
| 34 |
void BotSetupDeathmatchAI(void); |
| 35 |
//shutdown the deathmatch AI |
| 36 |
void BotShutdownDeathmatchAI(void); |
| 37 |
//let the bot live within it's deathmatch AI net |
| 38 |
void BotDeathmatchAI(bot_state_t *bs, float thinktime); |
| 39 |
//free waypoints |
| 40 |
void BotFreeWaypoints(bot_waypoint_t *wp); |
| 41 |
//choose a weapon |
| 42 |
void BotChooseWeapon(bot_state_t *bs); |
| 43 |
//setup movement stuff |
| 44 |
void BotSetupForMovement(bot_state_t *bs); |
| 45 |
//update the inventory |
| 46 |
void BotUpdateInventory(bot_state_t *bs); |
| 47 |
//update the inventory during battle |
| 48 |
void BotUpdateBattleInventory(bot_state_t *bs, int enemy); |
| 49 |
//use holdable items during battle |
| 50 |
void BotBattleUseItems(bot_state_t *bs); |
| 51 |
//return true if the bot is dead |
| 52 |
qboolean BotIsDead(bot_state_t *bs); |
| 53 |
//returns true if the bot is in observer mode |
| 54 |
qboolean BotIsObserver(bot_state_t *bs); |
| 55 |
//returns true if the bot is in the intermission |
| 56 |
qboolean BotIntermission(bot_state_t *bs); |
| 57 |
//returns true if the bot is in lava or slime |
| 58 |
qboolean BotInLavaOrSlime(bot_state_t *bs); |
| 59 |
//returns true if the entity is dead |
| 60 |
qboolean EntityIsDead(aas_entityinfo_t *entinfo); |
| 61 |
//returns true if the entity is invisible |
| 62 |
qboolean EntityIsInvisible(aas_entityinfo_t *entinfo); |
| 63 |
//returns true if the entity is shooting |
| 64 |
qboolean EntityIsShooting(aas_entityinfo_t *entinfo); |
| 65 |
//returns true if this entity has the kamikaze |
| 66 |
qboolean EntityHasKamikaze(aas_entityinfo_t *entinfo); |
| 67 |
// set a user info key/value pair |
| 68 |
void BotSetUserInfo(bot_state_t *bs, char *key, char *value); |
| 69 |
// set the team status (offense, defense etc.) |
| 70 |
void BotSetTeamStatus(bot_state_t *bs); |
| 71 |
//returns the name of the client |
| 72 |
char *ClientName(int client, char *name, int size); |
| 73 |
//returns an simplyfied client name |
| 74 |
char *EasyClientName(int client, char *name, int size); |
| 75 |
//returns the skin used by the client |
| 76 |
char *ClientSkin(int client, char *skin, int size); |
| 77 |
// returns the appropriate synonym context for the current game type and situation |
| 78 |
int BotSynonymContext(bot_state_t *bs); |
| 79 |
// set last ordered task |
| 80 |
int BotSetLastOrderedTask(bot_state_t *bs); |
| 81 |
// selection of goals for teamplay |
| 82 |
void BotTeamGoals(bot_state_t *bs, int retreat); |
| 83 |
//returns the aggression of the bot in the range [0, 100] |
| 84 |
float BotAggression(bot_state_t *bs); |
| 85 |
//returns how bad the bot feels |
| 86 |
float BotFeelingBad(bot_state_t *bs); |
| 87 |
//returns true if the bot wants to retreat |
| 88 |
int BotWantsToRetreat(bot_state_t *bs); |
| 89 |
//returns true if the bot wants to chase |
| 90 |
int BotWantsToChase(bot_state_t *bs); |
| 91 |
//returns true if the bot wants to help |
| 92 |
int BotWantsToHelp(bot_state_t *bs); |
| 93 |
//returns true if the bot can and wants to rocketjump |
| 94 |
int BotCanAndWantsToRocketJump(bot_state_t *bs); |
| 95 |
// returns true if the bot has a persistant powerup and a weapon |
| 96 |
int BotHasPersistantPowerupAndWeapon(bot_state_t *bs); |
| 97 |
//returns true if the bot wants to and goes camping |
| 98 |
int BotWantsToCamp(bot_state_t *bs); |
| 99 |
//the bot will perform attack movements |
| 100 |
bot_moveresult_t BotAttackMove(bot_state_t *bs, int tfl); |
| 101 |
//returns true if the bot and the entity are in the same team |
| 102 |
int BotSameTeam(bot_state_t *bs, int entnum); |
| 103 |
//returns true if teamplay is on |
| 104 |
int TeamPlayIsOn(void); |
| 105 |
// returns the client number of the team mate flag carrier (-1 if none) |
| 106 |
int BotTeamFlagCarrier(bot_state_t *bs); |
| 107 |
//returns visible team mate flag carrier if available |
| 108 |
int BotTeamFlagCarrierVisible(bot_state_t *bs); |
| 109 |
//returns visible enemy flag carrier if available |
| 110 |
int BotEnemyFlagCarrierVisible(bot_state_t *bs); |
| 111 |
//get the number of visible teammates and enemies |
| 112 |
void BotVisibleTeamMatesAndEnemies(bot_state_t *bs, int *teammates, int *enemies, float range); |
| 113 |
//returns true if within the field of vision for the given angles |
| 114 |
qboolean InFieldOfVision(vec3_t viewangles, float fov, vec3_t angles); |
| 115 |
//returns true and sets the .enemy field when an enemy is found |
| 116 |
int BotFindEnemy(bot_state_t *bs, int curenemy); |
| 117 |
//returns a roam goal |
| 118 |
void BotRoamGoal(bot_state_t *bs, vec3_t goal); |
| 119 |
//returns entity visibility in the range [0, 1] |
| 120 |
float BotEntityVisible(int viewer, vec3_t eye, vec3_t viewangles, float fov, int ent); |
| 121 |
//the bot will aim at the current enemy |
| 122 |
void BotAimAtEnemy(bot_state_t *bs); |
| 123 |
//check if the bot should attack |
| 124 |
void BotCheckAttack(bot_state_t *bs); |
| 125 |
//AI when the bot is blocked |
| 126 |
void BotAIBlocked(bot_state_t *bs, bot_moveresult_t *moveresult, int activate); |
| 127 |
//AI to predict obstacles |
| 128 |
int BotAIPredictObstacles(bot_state_t *bs, bot_goal_t *goal); |
| 129 |
//enable or disable the areas the blocking entity is in |
| 130 |
void BotEnableActivateGoalAreas(bot_activategoal_t *activategoal, int enable); |
| 131 |
//pop an activate goal from the stack |
| 132 |
int BotPopFromActivateGoalStack(bot_state_t *bs); |
| 133 |
//clear the activate goal stack |
| 134 |
void BotClearActivateGoalStack(bot_state_t *bs); |
| 135 |
//returns the team the bot is in |
| 136 |
int BotTeam(bot_state_t *bs); |
| 137 |
//retuns the opposite team of the bot |
| 138 |
int BotOppositeTeam(bot_state_t *bs); |
| 139 |
//returns the flag the bot is carrying (CTFFLAG_?) |
| 140 |
int BotCTFCarryingFlag(bot_state_t *bs); |
| 141 |
//remember the last ordered task |
| 142 |
void BotRememberLastOrderedTask(bot_state_t *bs); |
| 143 |
//set ctf goals (defend base, get enemy flag) during seek |
| 144 |
void BotCTFSeekGoals(bot_state_t *bs); |
| 145 |
//set ctf goals (defend base, get enemy flag) during retreat |
| 146 |
void BotCTFRetreatGoals(bot_state_t *bs); |
| 147 |
// |
| 148 |
int Bot1FCTFCarryingFlag(bot_state_t *bs); |
| 149 |
int BotHarvesterCarryingCubes(bot_state_t *bs); |
| 150 |
void Bot1FCTFSeekGoals(bot_state_t *bs); |
| 151 |
void Bot1FCTFRetreatGoals(bot_state_t *bs); |
| 152 |
void BotObeliskSeekGoals(bot_state_t *bs); |
| 153 |
void BotObeliskRetreatGoals(bot_state_t *bs); |
| 154 |
void BotGoHarvest(bot_state_t *bs); |
| 155 |
void BotHarvesterSeekGoals(bot_state_t *bs); |
| 156 |
void BotHarvesterRetreatGoals(bot_state_t *bs); |
| 157 |
int BotTeamCubeCarrierVisible(bot_state_t *bs); |
| 158 |
int BotEnemyCubeCarrierVisible(bot_state_t *bs); |
| 159 |
//get a random alternate route goal towards the given base |
| 160 |
int BotGetAlternateRouteGoal(bot_state_t *bs, int base); |
| 161 |
//returns either the alternate route goal or the given goal |
| 162 |
bot_goal_t *BotAlternateRoute(bot_state_t *bs, bot_goal_t *goal); |
| 163 |
//create a new waypoint |
| 164 |
bot_waypoint_t *BotCreateWayPoint(char *name, vec3_t origin, int areanum); |
| 165 |
//find a waypoint with the given name |
| 166 |
bot_waypoint_t *BotFindWayPoint(bot_waypoint_t *waypoints, char *name); |
| 167 |
//strstr but case insensitive |
| 168 |
char *stristr(char *str, char *charset); |
| 169 |
//returns the number of the client with the given name |
| 170 |
int ClientFromName(char *name); |
| 171 |
int ClientOnSameTeamFromName(bot_state_t *bs, char *name); |
| 172 |
// |
| 173 |
int BotPointAreaNum(vec3_t origin); |
| 174 |
// |
| 175 |
void BotMapScripts(bot_state_t *bs); |
| 176 |
|
| 177 |
//ctf flags |
| 178 |
#define CTF_FLAG_NONE 0 |
| 179 |
#define CTF_FLAG_RED 1 |
| 180 |
#define CTF_FLAG_BLUE 2 |
| 181 |
//CTF skins |
| 182 |
#define CTF_SKIN_REDTEAM "red" |
| 183 |
#define CTF_SKIN_BLUETEAM "blue" |
| 184 |
|
| 185 |
extern int gametype; //game type |
| 186 |
extern int maxclients; //maximum number of clients |
| 187 |
|
| 188 |
extern vmCvar_t bot_grapple; |
| 189 |
extern vmCvar_t bot_rocketjump; |
| 190 |
extern vmCvar_t bot_fastchat; |
| 191 |
extern vmCvar_t bot_nochat; |
| 192 |
extern vmCvar_t bot_testrchat; |
| 193 |
extern vmCvar_t bot_challenge; |
| 194 |
|
| 195 |
extern bot_goal_t ctf_redflag; |
| 196 |
extern bot_goal_t ctf_blueflag; |
| 197 |
extern bot_goal_t ctf_neutralflag; |
| 198 |
extern bot_goal_t redobelisk; |
| 199 |
extern bot_goal_t blueobelisk; |
| 200 |
extern bot_goal_t neutralobelisk; |