1 /* 2 =========================================================================== 3 Copyright (C) 2000 - 2013, Raven Software, Inc. 4 Copyright (C) 2001 - 2013, Activision, Inc. 5 Copyright (C) 2013 - 2015, OpenJK contributors 6 7 This file is part of the OpenJK source code. 8 9 OpenJK is free software; you can redistribute it and/or modify it 10 under the terms of the GNU General Public License version 2 as 11 published by the Free Software Foundation. 12 13 This program is distributed in the hope that it will be useful, 14 but WITHOUT ANY WARRANTY; without even the implied warranty of 15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 GNU General Public License for more details. 17 18 You should have received a copy of the GNU General Public License 19 along with this program; if not, see <http://www.gnu.org/licenses/>. 20 =========================================================================== 21 */ 22 23 #pragma once 24 25 //Distance ratings 26 typedef enum 27 { 28 DIST_MELEE, 29 DIST_LONG, 30 } distance_e; 31 32 //Attack types 33 typedef enum 34 { 35 ATTACK_MELEE, 36 ATTACK_RANGE, 37 } attack_e; 38 39 enum 40 { 41 SQUAD_IDLE, //No target found, waiting 42 SQUAD_STAND_AND_SHOOT, //Standing in position and shoot (no cover) 43 SQUAD_RETREAT, //Running away from combat 44 SQUAD_COVER, //Under protective cover 45 SQUAD_TRANSITION, //Moving between points, not firing 46 SQUAD_POINT, //On point, laying down suppressive fire 47 SQUAD_SCOUT, //Poking out to draw enemy 48 NUM_SQUAD_STATES, 49 }; 50 51 //sigh... had to move in here for groupInfo 52 typedef enum //# rank_e 53 { 54 RANK_CIVILIAN, 55 RANK_CREWMAN, 56 RANK_ENSIGN, 57 RANK_LT_JG, 58 RANK_LT, 59 RANK_LT_COMM, 60 RANK_COMMANDER, 61 RANK_CAPTAIN 62 } rank_t; 63 64 qboolean NPC_CheckPlayerTeamStealth( void ); 65 66 //AI_GRENADIER 67 void NPC_BSGrenadier_Default( void ); 68 69 //AI_SNIPER 70 void NPC_BSSniper_Default( void ); 71 72 //AI_STORMTROOPER 73 void NPC_BSST_Investigate( void ); 74 void NPC_BSST_Default( void ); 75 void NPC_BSST_Sleep( void ); 76 77 //AI_JEDI 78 void NPC_BSJedi_Investigate( void ); 79 void NPC_BSJedi_Default( void ); 80 void NPC_BSJedi_FollowLeader( void ); 81 82 // AI_DROID 83 void NPC_BSDroid_Default( void ); 84 85 // AI_ImperialProbe 86 void NPC_BSImperialProbe_Default( void ); 87 88 // AI_atst 89 void NPC_BSATST_Default( void ); 90 91 void NPC_BSInterrogator_Default( void ); 92 93 // AI Mark 1 94 void NPC_BSMark1_Default( void ); 95 96 // AI Mark 2 97 void NPC_BSMark2_Default( void ); 98 99 100 void NPC_BSMineMonster_Default( void ); 101 void NPC_BSHowler_Default( void ); 102 void NPC_BSRancor_Default( void ); 103 104 //Utilities 105 //Group AI 106 #define MAX_FRAME_GROUPS 32 107 // !!!!!!!!!! LOADSAVE-affecting structure !!!!!!!!!! 108 typedef struct AIGroupMember_s 109 { 110 int number; 111 int waypoint; 112 int pathCostToEnemy; 113 int closestBuddy; 114 } AIGroupMember_t; 115 116 #define MAX_GROUP_MEMBERS 32 117 // !!!!!!!!!! LOADSAVE-affecting structure !!!!!!!!!! 118 typedef struct AIGroupInfo_s 119 { 120 int numGroup; 121 qboolean processed; 122 team_t team; 123 gentity_t *enemy; 124 int enemyWP; 125 int speechDebounceTime; 126 int lastClearShotTime; 127 int lastSeenEnemyTime; 128 int morale; 129 int moraleAdjust; 130 int moraleDebounce; 131 int memberValidateTime; 132 int activeMemberNum; 133 gentity_t *commander; 134 vec3_t enemyLastSeenPos; 135 int numState[ NUM_SQUAD_STATES ]; 136 AIGroupMember_t member[ MAX_GROUP_MEMBERS ]; 137 } AIGroupInfo_t; 138 139 int AI_GetGroupSize( vec3_t origin, int radius, team_t playerTeam, gentity_t *avoid ); 140 int AI_GetGroupSize2( gentity_t *ent, int radius ); 141 142 void AI_GetGroup( gentity_t *self ); 143 144 qboolean AI_CheckEnemyCollision( gentity_t *ent, qboolean takeEnemy ); 145 gentity_t *AI_DistributeAttack( gentity_t *attacker, gentity_t *enemy, team_t team, int threshold ); 146