codemp/game/ai.h

Go to the documentation of this file.
00001 #ifndef __AI__
00002 #define __AI__
00003 
00004 //Distance ratings
00005 typedef enum
00006 {
00007         DIST_MELEE,
00008         DIST_LONG,
00009 } distance_e;
00010 
00011 //Attack types
00012 typedef enum
00013 {
00014         ATTACK_MELEE,
00015         ATTACK_RANGE,
00016 } attack_e;
00017 
00018 enum
00019 {
00020         SQUAD_IDLE,                                     //No target found, waiting
00021         SQUAD_STAND_AND_SHOOT,          //Standing in position and shoot (no cover)
00022         SQUAD_RETREAT,                          //Running away from combat
00023         SQUAD_COVER,                            //Under protective cover
00024         SQUAD_TRANSITION,                       //Moving between points, not firing
00025         SQUAD_POINT,                            //On point, laying down suppressive fire
00026         SQUAD_SCOUT,                            //Poking out to draw enemy
00027         NUM_SQUAD_STATES,
00028 };
00029 
00030 //sigh... had to move in here for groupInfo
00031 typedef enum //# rank_e
00032 {
00033         RANK_CIVILIAN,
00034         RANK_CREWMAN,
00035         RANK_ENSIGN,
00036         RANK_LT_JG,
00037         RANK_LT,
00038         RANK_LT_COMM,
00039         RANK_COMMANDER,
00040         RANK_CAPTAIN
00041 } rank_t;
00042 
00043 qboolean NPC_CheckPlayerTeamStealth( void );
00044 
00045 //AI_GRENADIER
00046 void NPC_BSGrenadier_Default( void );
00047 
00048 //AI_SNIPER
00049 void NPC_BSSniper_Default( void );
00050 
00051 //AI_STORMTROOPER
00052 void NPC_BSST_Investigate( void );
00053 void NPC_BSST_Default( void );
00054 void NPC_BSST_Sleep( void );
00055 
00056 //AI_JEDI
00057 void NPC_BSJedi_Investigate( void );
00058 void NPC_BSJedi_Default( void );
00059 void NPC_BSJedi_FollowLeader( void );
00060 
00061 // AI_DROID
00062 void NPC_BSDroid_Default( void );
00063 
00064 // AI_ImperialProbe
00065 void NPC_BSImperialProbe_Default( void );
00066 
00067 // AI_atst
00068 void NPC_BSATST_Default( void );
00069 
00070 void NPC_BSInterrogator_Default( void );
00071 
00072 // AI Mark 1
00073 void NPC_BSMark1_Default( void );
00074 
00075 // AI Mark 2
00076 void NPC_BSMark2_Default( void );
00077 
00078 
00079 void NPC_BSMineMonster_Default( void );
00080 void NPC_BSHowler_Default( void );
00081 void NPC_BSRancor_Default( void );
00082 
00083 //Utilities
00084 //Group AI
00085 #define MAX_FRAME_GROUPS        32
00086 // !!!!!!!!!! LOADSAVE-affecting structure !!!!!!!!!!
00087 typedef struct AIGroupMember_s
00088 {
00089         int     number;
00090         int waypoint;
00091         int pathCostToEnemy;
00092         int     closestBuddy;
00093 } AIGroupMember_t;
00094 
00095 #define MAX_GROUP_MEMBERS 32
00096 // !!!!!!!!!! LOADSAVE-affecting structure !!!!!!!!!!
00097 typedef struct AIGroupInfo_s
00098 {
00099         int                     numGroup;
00100         qboolean        processed;
00101         team_t          team;
00102         gentity_t       *enemy;
00103         int                     enemyWP;
00104         int                     speechDebounceTime;
00105         int                     lastClearShotTime;
00106         int                     lastSeenEnemyTime;
00107         int                     morale;
00108         int                     moraleAdjust;
00109         int                     moraleDebounce;
00110         int                     memberValidateTime;
00111         int                     activeMemberNum;
00112         gentity_t       *commander;
00113         vec3_t          enemyLastSeenPos;
00114         int                     numState[ NUM_SQUAD_STATES ];
00115         AIGroupMember_t member[ MAX_GROUP_MEMBERS ];
00116 } AIGroupInfo_t;
00117 
00118 int     AI_GetGroupSize( vec3_t origin, int radius, team_t playerTeam, gentity_t *avoid );
00119 int AI_GetGroupSize2( gentity_t *ent, int radius );
00120 
00121 void AI_GetGroup( gentity_t *self );
00122 
00123 qboolean AI_CheckEnemyCollision( gentity_t *ent, qboolean takeEnemy );
00124 gentity_t *AI_DistributeAttack( gentity_t *attacker, gentity_t *enemy, team_t team, int threshold );
00125 
00126 #endif  //__AI__