| 1 | /* |
| 2 | * Descent 3 |
| 3 | * Copyright (C) 2024 Parallax Software |
| 4 | * |
| 5 | * This program is free software: you can redistribute it and/or modify |
| 6 | * it under the terms of the GNU General Public License as published by |
| 7 | * the Free Software Foundation, either version 3 of the License, or |
| 8 | * (at your option) any later version. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU General Public License |
| 16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 17 | |
| 18 | --- HISTORICAL COMMENTS FOLLOW --- |
| 19 | |
| 20 | * $Logfile: /DescentIII/main/AIMain.h $ |
| 21 | * $Revision: 41 $ |
| 22 | * $Date: 5/17/99 6:06p $ |
| 23 | * $Author: Chris $ |
| 24 | * |
| 25 | * General AI functions for use in Descent III |
| 26 | * |
| 27 | * $Log: /DescentIII/main/AIMain.h $ |
| 28 | * |
| 29 | * 41 5/17/99 6:06p Chris |
| 30 | * Adding robot debug code |
| 31 | * |
| 32 | * 40 5/08/99 4:42p Chris |
| 33 | * |
| 34 | * 39 5/08/99 4:12p Chris |
| 35 | * Added AI hearing noises... version 1 |
| 36 | * |
| 37 | * 38 5/01/99 2:21a Chris |
| 38 | * Use the GF_SPEED_XXX stuff |
| 39 | * |
| 40 | * 37 4/18/99 5:38a Chris |
| 41 | * Drastically improved the find_random_room function and added the |
| 42 | * makenextroomlist function |
| 43 | * |
| 44 | * 36 3/12/99 12:16p Chris |
| 45 | * Blending primary and blend goals!!!!!! Awesome. |
| 46 | * |
| 47 | * 35 2/28/99 11:30p Chris |
| 48 | * FindObjOfType and OSIRIS controllable deaths |
| 49 | * |
| 50 | * 34 2/10/99 1:47p Matt |
| 51 | * Changed object handle symbolic constants |
| 52 | * |
| 53 | * 33 1/29/99 5:10p Chris |
| 54 | * Added an optional parent handle check for FindObjOfType |
| 55 | * |
| 56 | * 32 1/20/99 1:01a Chris |
| 57 | * Improved AI and OSIRIS intergration |
| 58 | * |
| 59 | * 31 1/11/99 2:14p Chris |
| 60 | * Massive work on OSIRIS and AI |
| 61 | * |
| 62 | * 30 12/15/98 6:05p Chris |
| 63 | * Improved the path system |
| 64 | * |
| 65 | * 29 12/15/98 4:34p Chris |
| 66 | * |
| 67 | * 28 12/03/98 12:24p Chris |
| 68 | * Improved new anim code for instant updating |
| 69 | * |
| 70 | * 27 12/01/98 4:31p Chris |
| 71 | * Checked in a massive amount of AI work. Improved flocking code. :) |
| 72 | * (Still hacked lightly). In addition, I am moving toward using the |
| 73 | * composite dir. :) |
| 74 | * |
| 75 | * 26 10/16/98 3:39p Chris |
| 76 | * Improved the object linking system and AI and physics |
| 77 | * |
| 78 | * 25 10/13/98 1:08p Chris |
| 79 | * Greatly improved the AI's use of paths. Improved visability checking |
| 80 | * algorithm. Probably needs a second pass for further cleanup. |
| 81 | * |
| 82 | * 24 10/06/98 6:19p Chris |
| 83 | * Improved OSIRIS/AI intergration |
| 84 | * |
| 85 | * 23 9/28/98 4:09p Chris |
| 86 | * Added birth animations |
| 87 | * |
| 88 | * 22 9/14/98 12:16p Chris |
| 89 | * Vastly improved the multiplayer code |
| 90 | * |
| 91 | * 21 8/19/98 12:10p Chris |
| 92 | * Improved coop behavior |
| 93 | * |
| 94 | * 20 8/10/98 12:16p Chris |
| 95 | * Added AI_NumHostileAlert |
| 96 | * |
| 97 | * 19 6/30/98 6:36p Chris |
| 98 | * Added rev .1 of multiplayer animations - BTW It is totally not done. |
| 99 | * |
| 100 | * 18 5/17/98 7:54p Chris |
| 101 | * Correctly integrated the goal system and circle distance stuff. Added |
| 102 | * support for "target goals". |
| 103 | * |
| 104 | * 17 5/04/98 4:04p Chris |
| 105 | * Minestone checkin' -- energy effect and more AI functionality |
| 106 | * |
| 107 | * 16 4/30/98 11:31a Chris |
| 108 | * Massive upgrades to the AI system |
| 109 | * |
| 110 | * 15 4/16/98 2:56p Chris |
| 111 | * Updated buddy support and intergrated scripting and AI |
| 112 | * |
| 113 | * 14 4/07/98 4:25p Chris |
| 114 | * Added support for buddy bot |
| 115 | * |
| 116 | * 13 3/31/98 4:23p Chris |
| 117 | * Added a new AIpath system |
| 118 | * |
| 119 | * 12 3/10/98 12:51p Chris |
| 120 | * Added a truely D2 style homing missile |
| 121 | * |
| 122 | * 11 2/06/98 5:51p Chris |
| 123 | * Added the ability turn robots on and off |
| 124 | * |
| 125 | * 10 1/29/98 3:29p Chris |
| 126 | * Major update to the AI system. |
| 127 | * |
| 128 | * 9 11/14/97 11:55p Chris |
| 129 | * Dodge goals are semi-functional |
| 130 | * |
| 131 | * 8 11/12/97 5:47p Chris |
| 132 | * Incremental improvements |
| 133 | * |
| 134 | * 7 11/12/97 10:43a Chris |
| 135 | * Incremental |
| 136 | * |
| 137 | * 6 8/05/97 12:17p Chris |
| 138 | * |
| 139 | * 5 7/15/97 7:29p Chris |
| 140 | * Added a sound for helicopter blades. |
| 141 | * |
| 142 | * 4 7/15/97 5:35p Chris |
| 143 | * New AI code |
| 144 | * |
| 145 | * 3 7/15/97 4:59p Chris |
| 146 | * added support for AI and animations |
| 147 | * |
| 148 | * $NoKeywords: $ |
| 149 | */ |
| 150 | |
| 151 | #ifndef AIMAIN_H_ |
| 152 | #define AIMAIN_H_ |
| 153 | |
| 154 | #include "object.h" |
| 155 | #include "player.h" |
| 156 | |
| 157 | #define AI_SOUND_SHORT_DIST 60.0f |
| 158 | |
| 159 | extern int AI_NumRendered; |
| 160 | extern int AI_RenderedList[MAX_OBJECTS]; |
| 161 | |
| 162 | extern int AI_NumHostileAlert; // A rough number of alert/hostile robots |
| 163 | // that have seen the player recently |
| 164 | #ifdef _DEBUG |
| 165 | extern bool AI_debug_robot_do; |
| 166 | extern int AI_debug_robot_index; |
| 167 | #endif |
| 168 | |
| 169 | // Is my buddy in the level? (no if the handle is invalid) |
| 170 | extern int Buddy_handle[MAX_PLAYERS]; |
| 171 | |
| 172 | bool AINotify(object *obj, uint8_t notify_type, void *info = NULL); |
| 173 | void AIDoFrame(object *obj); |
| 174 | void AIFrameAll(void); |
| 175 | bool AIInit(object *obj, uint8_t ai_class, uint8_t ai_type, uint8_t ai_movement); |
| 176 | void AIInitAll(void); |
| 177 | void AIPowerSwitch(object *obj, bool f_on); |
| 178 | void AITurnTowardsDir(object *obj, /*velocity *new_vel,*/ vector *goal_dir /*, bool remain_level*/, float turn_rate); |
| 179 | void AIMoveTowardsDir(object *obj, vector *dir, float scale = 1.0f); |
| 180 | bool AIMoveTowardsPosition(object *obj, /*velocity *new_vel,*/ vector *pos, float scale, bool stop_at_end_point, |
| 181 | vector *mdir, bool *f_moved); |
| 182 | void AITurnTowardsPosition(object *obj, /*velocity *new_vel,*/ vector *pos /*, bool remain_level*/); |
| 183 | bool AIFindHidePos(object *hide_obj, object *view_obj, vector *hpos, int *hroom, float max_hide_time = 3.0f); |
| 184 | int AIFindRoomWithFlag(object *obj, int flag); |
| 185 | object *AIFindObjOfType(object *obj, int type, int id, bool f_ignore_init_room, int parent_handle = OBJECT_HANDLE_NONE); |
| 186 | float AIFindDist(vector *s_pos, int s_roomnum, vector *e_pos, int e_roomnum, int flags); |
| 187 | bool AIStatusCircleFrame(object *obj, object *g_obj, float dist, float c_dist, int *status_reg); |
| 188 | bool AIObjEnemy(object *obj, object *target); |
| 189 | bool AISetTarget(object *obj, int handle); |
| 190 | void AIDestroyObj(object *obj); |
| 191 | bool AIObjFriend(object *obj, object *target); |
| 192 | void AIUpdateAnim(object *obj); |
| 193 | bool AITurnTowardsMatrix(object *obj, float turn_rate, matrix *g_orient); |
| 194 | int AIFindRandomRoom(object *obj, ai_frame *ai_info, goal *goal_ptr, int avoid_room, int min_depth, int max_depth, |
| 195 | bool f_check_path, bool f_cur_room_ok, int *depth); |
| 196 | int AIMakeNextRoomList(int roomnum, int *next_rooms, int max_rooms); |
| 197 | |
| 198 | #endif |