Quake-III-Arena

Quake III Arena GPL Source Release
Log | Files | Refs

ai_dmq3.h (8312B)


      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 Foobar; 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 #ifdef MISSIONPACK
     66 //returns true if this entity has the kamikaze
     67 qboolean EntityHasKamikaze(aas_entityinfo_t *entinfo);
     68 #endif
     69 // set a user info key/value pair
     70 void BotSetUserInfo(bot_state_t *bs, char *key, char *value);
     71 // set the team status (offense, defense etc.)
     72 void BotSetTeamStatus(bot_state_t *bs);
     73 //returns the name of the client
     74 char *ClientName(int client, char *name, int size);
     75 //returns an simplyfied client name
     76 char *EasyClientName(int client, char *name, int size);
     77 //returns the skin used by the client
     78 char *ClientSkin(int client, char *skin, int size);
     79 // returns the appropriate synonym context for the current game type and situation
     80 int BotSynonymContext(bot_state_t *bs);
     81 // set last ordered task
     82 int BotSetLastOrderedTask(bot_state_t *bs);
     83 // selection of goals for teamplay
     84 void BotTeamGoals(bot_state_t *bs, int retreat);
     85 //returns the aggression of the bot in the range [0, 100]
     86 float BotAggression(bot_state_t *bs);
     87 //returns how bad the bot feels
     88 float BotFeelingBad(bot_state_t *bs);
     89 //returns true if the bot wants to retreat
     90 int BotWantsToRetreat(bot_state_t *bs);
     91 //returns true if the bot wants to chase
     92 int BotWantsToChase(bot_state_t *bs);
     93 //returns true if the bot wants to help
     94 int BotWantsToHelp(bot_state_t *bs);
     95 //returns true if the bot can and wants to rocketjump
     96 int BotCanAndWantsToRocketJump(bot_state_t *bs);
     97 // returns true if the bot has a persistant powerup and a weapon
     98 int BotHasPersistantPowerupAndWeapon(bot_state_t *bs);
     99 //returns true if the bot wants to and goes camping
    100 int BotWantsToCamp(bot_state_t *bs);
    101 //the bot will perform attack movements
    102 bot_moveresult_t BotAttackMove(bot_state_t *bs, int tfl);
    103 //returns true if the bot and the entity are in the same team
    104 int BotSameTeam(bot_state_t *bs, int entnum);
    105 //returns true if teamplay is on
    106 int TeamPlayIsOn(void);
    107 // returns the client number of the team mate flag carrier (-1 if none)
    108 int BotTeamFlagCarrier(bot_state_t *bs);
    109 //returns visible team mate flag carrier if available
    110 int BotTeamFlagCarrierVisible(bot_state_t *bs);
    111 //returns visible enemy flag carrier if available
    112 int BotEnemyFlagCarrierVisible(bot_state_t *bs);
    113 //get the number of visible teammates and enemies
    114 void BotVisibleTeamMatesAndEnemies(bot_state_t *bs, int *teammates, int *enemies, float range);
    115 //returns true if within the field of vision for the given angles
    116 qboolean InFieldOfVision(vec3_t viewangles, float fov, vec3_t angles);
    117 //returns true and sets the .enemy field when an enemy is found
    118 int BotFindEnemy(bot_state_t *bs, int curenemy);
    119 //returns a roam goal
    120 void BotRoamGoal(bot_state_t *bs, vec3_t goal);
    121 //returns entity visibility in the range [0, 1]
    122 float BotEntityVisible(int viewer, vec3_t eye, vec3_t viewangles, float fov, int ent);
    123 //the bot will aim at the current enemy
    124 void BotAimAtEnemy(bot_state_t *bs);
    125 //check if the bot should attack
    126 void BotCheckAttack(bot_state_t *bs);
    127 //AI when the bot is blocked
    128 void BotAIBlocked(bot_state_t *bs, bot_moveresult_t *moveresult, int activate);
    129 //AI to predict obstacles
    130 int BotAIPredictObstacles(bot_state_t *bs, bot_goal_t *goal);
    131 //enable or disable the areas the blocking entity is in
    132 void BotEnableActivateGoalAreas(bot_activategoal_t *activategoal, int enable);
    133 //pop an activate goal from the stack
    134 int BotPopFromActivateGoalStack(bot_state_t *bs);
    135 //clear the activate goal stack
    136 void BotClearActivateGoalStack(bot_state_t *bs);
    137 //returns the team the bot is in
    138 int BotTeam(bot_state_t *bs);
    139 //retuns the opposite team of the bot
    140 int BotOppositeTeam(bot_state_t *bs);
    141 //returns the flag the bot is carrying (CTFFLAG_?)
    142 int BotCTFCarryingFlag(bot_state_t *bs);
    143 //remember the last ordered task
    144 void BotRememberLastOrderedTask(bot_state_t *bs);
    145 //set ctf goals (defend base, get enemy flag) during seek
    146 void BotCTFSeekGoals(bot_state_t *bs);
    147 //set ctf goals (defend base, get enemy flag) during retreat
    148 void BotCTFRetreatGoals(bot_state_t *bs);
    149 //
    150 #ifdef MISSIONPACK
    151 int Bot1FCTFCarryingFlag(bot_state_t *bs);
    152 int BotHarvesterCarryingCubes(bot_state_t *bs);
    153 void Bot1FCTFSeekGoals(bot_state_t *bs);
    154 void Bot1FCTFRetreatGoals(bot_state_t *bs);
    155 void BotObeliskSeekGoals(bot_state_t *bs);
    156 void BotObeliskRetreatGoals(bot_state_t *bs);
    157 void BotGoHarvest(bot_state_t *bs);
    158 void BotHarvesterSeekGoals(bot_state_t *bs);
    159 void BotHarvesterRetreatGoals(bot_state_t *bs);
    160 int BotTeamCubeCarrierVisible(bot_state_t *bs);
    161 int BotEnemyCubeCarrierVisible(bot_state_t *bs);
    162 #endif
    163 //get a random alternate route goal towards the given base
    164 int BotGetAlternateRouteGoal(bot_state_t *bs, int base);
    165 //returns either the alternate route goal or the given goal
    166 bot_goal_t *BotAlternateRoute(bot_state_t *bs, bot_goal_t *goal);
    167 //create a new waypoint
    168 bot_waypoint_t *BotCreateWayPoint(char *name, vec3_t origin, int areanum);
    169 //find a waypoint with the given name
    170 bot_waypoint_t *BotFindWayPoint(bot_waypoint_t *waypoints, char *name);
    171 //strstr but case insensitive
    172 char *stristr(char *str, char *charset);
    173 //returns the number of the client with the given name
    174 int ClientFromName(char *name);
    175 int ClientOnSameTeamFromName(bot_state_t *bs, char *name);
    176 //
    177 int BotPointAreaNum(vec3_t origin);
    178 //
    179 void BotMapScripts(bot_state_t *bs);
    180 
    181 //ctf flags
    182 #define CTF_FLAG_NONE		0
    183 #define CTF_FLAG_RED		1
    184 #define CTF_FLAG_BLUE		2
    185 //CTF skins
    186 #define CTF_SKIN_REDTEAM	"red"
    187 #define CTF_SKIN_BLUETEAM	"blue"
    188 
    189 extern int gametype;		//game type
    190 extern int maxclients;		//maximum number of clients
    191 
    192 extern vmCvar_t bot_grapple;
    193 extern vmCvar_t bot_rocketjump;
    194 extern vmCvar_t bot_fastchat;
    195 extern vmCvar_t bot_nochat;
    196 extern vmCvar_t bot_testrchat;
    197 extern vmCvar_t bot_challenge;
    198 
    199 extern bot_goal_t ctf_redflag;
    200 extern bot_goal_t ctf_blueflag;
    201 #ifdef MISSIONPACK
    202 extern bot_goal_t ctf_neutralflag;
    203 extern bot_goal_t redobelisk;
    204 extern bot_goal_t blueobelisk;
    205 extern bot_goal_t neutralobelisk;
    206 #endif