| 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/AIGoal.cpp $ |
| 21 | * $Revision: 137 $ |
| 22 | * $Date: 4/19/00 5:07p $ |
| 23 | * $Author: Matt $ |
| 24 | * |
| 25 | * AI Goal Functions |
| 26 | * |
| 27 | * $Log: /DescentIII/main/AIGoal.cpp $ |
| 28 | * |
| 29 | * 137 4/19/00 5:07p Matt |
| 30 | * From Duane for 1.4 |
| 31 | * Added checks, asserts, and fixes for bad return values |
| 32 | * |
| 33 | * 136 3/20/00 12:02p Matt |
| 34 | * Merge of Duane's post-1.3 changes. |
| 35 | * Added check for bad wb index |
| 36 | * |
| 37 | * 135 10/23/99 2:43a Chris |
| 38 | * Added the PutObjectOnObject AI Goal |
| 39 | * |
| 40 | * 134 10/21/99 2:17p Matt |
| 41 | * Mac merge |
| 42 | * |
| 43 | * 133 10/08/99 4:31p Nate |
| 44 | * Allow custom scripts to overide normal AI animation changes |
| 45 | * |
| 46 | * 132 7/27/99 4:16p Chris |
| 47 | * Now dodge goals can get killed |
| 48 | * |
| 49 | * 131 5/23/99 12:34a Chris |
| 50 | * Removed experimental code |
| 51 | * |
| 52 | * 130 5/22/99 3:36p Chris |
| 53 | * Further bulletproof the path stuff |
| 54 | * |
| 55 | * 129 5/22/99 3:12p Chris |
| 56 | * |
| 57 | * 128 5/22/99 3:11p Chris |
| 58 | * Fixed a bug in the wander code |
| 59 | * |
| 60 | * 127 5/21/99 7:46p Chris |
| 61 | * |
| 62 | * 126 5/21/99 7:22p Chris |
| 63 | * Fixed bugs in wander code |
| 64 | * |
| 65 | * 125 5/20/99 1:15a Chris |
| 66 | * Improved BNode Path Following for end points on the path. Fixed bugs |
| 67 | * with non-auto targetting |
| 68 | * |
| 69 | * 124 5/18/99 10:57a Chris |
| 70 | * Various bug fixes |
| 71 | * |
| 72 | * 123 5/17/99 6:06p Chris |
| 73 | * Adding robot debug code |
| 74 | * |
| 75 | * 122 5/09/99 8:11p Chris |
| 76 | * Made the whole see/hear distintion work (mostly) |
| 77 | * |
| 78 | * 121 5/01/99 2:21a Chris |
| 79 | * Use the GF_SPEED_XXX stuff |
| 80 | * |
| 81 | * 120 4/28/99 5:33a Chris |
| 82 | * Further improved the BNode system. (It actually works inside and |
| 83 | * outside now) |
| 84 | * |
| 85 | * 119 4/24/99 2:19a Chris |
| 86 | * Fixed Tubbs and paths |
| 87 | * |
| 88 | * 118 4/21/99 11:05a Kevin |
| 89 | * new ps_rand and ps_srand to replace rand & srand |
| 90 | * |
| 91 | * 117 4/20/99 8:55p Chris |
| 92 | * Fixed problem with robots not being able to open locked doors that a |
| 93 | * player has the key for. |
| 94 | * |
| 95 | * 116 4/18/99 5:38a Chris |
| 96 | * Drastically improved the find_random_room function and added the |
| 97 | * makenextroomlist function |
| 98 | * |
| 99 | * 115 4/14/99 2:50a Jeff |
| 100 | * fixed some case mismatched #includes |
| 101 | * |
| 102 | * 114 4/09/99 10:33a Chris |
| 103 | * Improvements to Freud |
| 104 | * |
| 105 | * 113 4/06/99 11:03p Chris |
| 106 | * Added goal unique id's. Improved FindRandomRoom (not so close to the |
| 107 | * edge of the terrain) |
| 108 | * |
| 109 | * 112 4/06/99 11:18a Chris |
| 110 | * Fixed a big bug in the attach system where object's properties where |
| 111 | * not correctly reset after the attach |
| 112 | * |
| 113 | * 111 4/05/99 5:38p Chris |
| 114 | * Fixed a bug where a wander_around goal could end up with a room 0 pos |
| 115 | * 0,0,0 path when first init'ed |
| 116 | * |
| 117 | * 110 4/05/99 3:18p Chris |
| 118 | * Patching wandering code |
| 119 | * |
| 120 | * 109 4/05/99 2:37p Chris |
| 121 | * Stalkers are now wandering robots |
| 122 | * |
| 123 | * 108 3/31/99 12:50p Chris |
| 124 | * Evader goal doesn't do avoid stuff for robots with a circle distance of |
| 125 | * zero |
| 126 | * |
| 127 | * 107 3/30/99 4:32p Chris |
| 128 | * Moved subtype to the main goal sturct (from goal_info). Made move |
| 129 | * relative object vec finishable. (Like get behind player) |
| 130 | * |
| 131 | * 106 3/27/99 3:00p Chris |
| 132 | * Fixed bug where high priority paths wouldn't reset the path if the |
| 133 | * previously active path was a static path |
| 134 | * |
| 135 | * 105 3/27/99 12:29p Chris |
| 136 | * Fixed problems with assigned lower priority goals that used paths (it |
| 137 | * would confuse the bot because the .path field was getting updated for |
| 138 | * the new goal even though it was lower priority) |
| 139 | * |
| 140 | * 104 3/23/99 11:51a Matt |
| 141 | * Made wander code not crash if the room selected was an outside room |
| 142 | * (from an inside wander) I.e. two rooms in two different mines with |
| 143 | * terrain between them. |
| 144 | * |
| 145 | * 103 3/22/99 5:47p Chris |
| 146 | * Improved AI difficulties when a goal is being deleted and, in script, a |
| 147 | * new goal uses that slot in middle of the delete code |
| 148 | * |
| 149 | * 102 3/22/99 10:58a Chris |
| 150 | * Awareness code was tweaked. Multisafe stuff added for objects. |
| 151 | * |
| 152 | * 101 3/17/99 5:23p Chris |
| 153 | * Fixed problems with low-priority paths |
| 154 | * |
| 155 | * 100 3/17/99 12:25p Chris |
| 156 | * Low priority paths |
| 157 | * |
| 158 | * 99 3/03/99 10:51a Chris |
| 159 | * Got rid of goal_ptr |
| 160 | * |
| 161 | * 98 2/15/99 9:03p Chris |
| 162 | * Added the base FOV off UVEC code and converted all the turrets |
| 163 | * |
| 164 | * 97 2/12/99 11:19a Chris |
| 165 | * If a path doesn't exist, look for it next frame |
| 166 | * |
| 167 | * 96 2/10/99 1:47p Matt |
| 168 | * Changed object handle symbolic constants |
| 169 | * |
| 170 | * 95 2/09/99 9:58a Chris |
| 171 | * Massive BOA update :) Terrain happy now. Vis happy now. Sound happy |
| 172 | * now. |
| 173 | * |
| 174 | * 94 2/02/99 3:52p Luke |
| 175 | * Fixed a circular loop in the AINotify stuff |
| 176 | * |
| 177 | * 93 1/30/99 4:41p Luke |
| 178 | * Make the guard goal work |
| 179 | * |
| 180 | * 92 1/26/99 2:51p Chris |
| 181 | * AIG_WANDER improvements |
| 182 | * |
| 183 | * 91 1/25/99 8:16a Chris |
| 184 | * Made sure the DALLAS is informed about code forced cleared goals that |
| 185 | * have GUIDs. |
| 186 | * |
| 187 | * 90 1/25/99 7:43a Chris |
| 188 | * Added the GUID (Goal Unique Id) and added the ability for weapon |
| 189 | * batteries to always fire exactly forward. |
| 190 | * |
| 191 | * 89 1/24/99 8:17p Chris |
| 192 | * Updated AI and OSIRIS. Externalized fireball constants for spew and |
| 193 | * sparks. Added CreateRandomSparks to OSIRIS, renamed a bunch of AI |
| 194 | * Notify names to use underscores. Fixed a memory access leak in the |
| 195 | * matcen effect code. |
| 196 | * |
| 197 | * 88 1/22/99 6:53p Chris |
| 198 | * Fixed LoadandBind Aux notify problems, fixed static path problems, |
| 199 | * fixed AIF_FORCE_AWARE Problems, improved path code |
| 200 | * |
| 201 | * 87 1/20/99 1:01a Chris |
| 202 | * Improved AI and OSIRIS intergration |
| 203 | * |
| 204 | * 86 1/18/99 8:07p Chris |
| 205 | * Added the no-collide same flag (for flocks and nests) |
| 206 | * |
| 207 | * 85 1/18/99 9:05a Chris |
| 208 | * Improved OSIRIS, AI, and ATTACH system, changed wiggle code, changed |
| 209 | * attach code for rad attaches, and added the AIG_ATTACH_OBJ goal |
| 210 | * |
| 211 | * 84 1/15/99 5:54p Chris |
| 212 | * |
| 213 | * 83 1/11/99 2:14p Chris |
| 214 | * Massive work on OSIRIS and AI |
| 215 | * |
| 216 | * 82 12/16/98 3:55p Chris |
| 217 | * Improved the sickles |
| 218 | * |
| 219 | * 81 12/14/98 1:07p Chris |
| 220 | * Allowed OSIRIS to change AI types |
| 221 | * |
| 222 | * 80 12/13/98 9:18p Chris |
| 223 | * Improved influence values for in-code goals (10000 to 1.0). Added |
| 224 | * GF_ORIENT stuff. :) |
| 225 | * |
| 226 | * 79 12/08/98 4:26p Chris |
| 227 | * Fixed problems with same anim animations (both with .to of zero no |
| 228 | * longer will do it) |
| 229 | * |
| 230 | * 78 12/03/98 5:45p Chris |
| 231 | * I just added full code support for OSIRIS/DLL controlled goals, |
| 232 | * enablers, and influence levels. :) |
| 233 | * |
| 234 | * 77 12/03/98 12:24p Chris |
| 235 | * Improved new anim code for instant updating |
| 236 | * |
| 237 | * 76 12/03/98 12:04p Chris |
| 238 | * Added the instant mode switching for shared frame anims! |
| 239 | * |
| 240 | * 75 12/02/98 5:50p Chris |
| 241 | * GoalDetermineTrackDist is more complete |
| 242 | * |
| 243 | * 74 12/01/98 6:17p Chris |
| 244 | * Height bias is only for outside and GoalDetermineTrackDist is closer to |
| 245 | * final |
| 246 | * |
| 247 | * 73 12/01/98 5:30p Chris |
| 248 | * |
| 249 | * 72 12/01/98 5:25p Chris |
| 250 | * fixed switch statement for AIT_ init stuff |
| 251 | * |
| 252 | * 71 12/01/98 4:29p Chris |
| 253 | * Checked in a massive amount of AI work. Improved flocking code. :) |
| 254 | * (Still hacked lightly). In addition, I am moving toward using the |
| 255 | * composite dir. :) |
| 256 | * |
| 257 | * 70 11/19/98 9:24p Chris |
| 258 | * |
| 259 | * 69 11/19/98 8:25p Chris |
| 260 | * Starting to add generic team avoidance code |
| 261 | * |
| 262 | * 68 11/18/98 3:59p Chris |
| 263 | * I added the avoid goal. I also improved the AIs for Evader1 and |
| 264 | * Evader2 by utilizing this goal when the target is well within the |
| 265 | * circle distance. |
| 266 | * |
| 267 | * 67 11/11/98 6:31p Chris |
| 268 | * AIF_DISABLE_FIRING and AIF_DISABLE_MELEE are now functional |
| 269 | * |
| 270 | * 66 11/06/98 11:39a Chris |
| 271 | * Robots with flamethrowers and Omega cannons work in single player |
| 272 | * |
| 273 | * 65 10/22/98 7:55a Chris |
| 274 | * |
| 275 | * 64 10/22/98 7:07a Chris |
| 276 | * Improved Evader2 |
| 277 | * |
| 278 | * 63 10/21/98 7:33a Chris |
| 279 | * Dead objects are not-targetable |
| 280 | * |
| 281 | * 62 10/20/98 11:58p Chris |
| 282 | * AIGetToObj is not enabled when the target is NULL or OBJ_GHOST |
| 283 | * |
| 284 | * 61 10/13/98 1:08p Chris |
| 285 | * Greatly improved the AI's use of paths. Improved visability checking |
| 286 | * algorithm. Probably needs a second pass for further cleanup. |
| 287 | * |
| 288 | * 60 10/07/98 3:37p Chris |
| 289 | * Improved the melee attack code |
| 290 | * |
| 291 | * 59 9/28/98 4:09p Chris |
| 292 | * Added birth animations |
| 293 | * |
| 294 | * 58 9/17/98 11:11a Chris |
| 295 | * Worked on goal system and improved integration with OSIRIS (better |
| 296 | * EVT_AI_INIT event calling) |
| 297 | * |
| 298 | * 57 9/15/98 7:29p Chris |
| 299 | * Improved OSIRIS and AI intergration |
| 300 | * |
| 301 | * 56 9/01/98 3:50p Chris |
| 302 | * |
| 303 | * 55 8/17/98 4:55p Chris |
| 304 | * Added GF_FORCE_AWARENESS for goals |
| 305 | * |
| 306 | * 54 8/06/98 5:27p Chris |
| 307 | * Fixed a bug when AIs regenerate their paths (they where not storing the |
| 308 | * goal pos/room) with the AIGoalGetToPos goal. |
| 309 | * |
| 310 | * 53 6/29/98 5:34p Chris |
| 311 | * Do general goal stuff before the currently active goal |
| 312 | * |
| 313 | * 52 6/29/98 5:03p Chris |
| 314 | * |
| 315 | * 51 6/29/98 4:36p Chris |
| 316 | * Fixed a bug with melee robots |
| 317 | * |
| 318 | * 50 6/15/98 3:23p Chris |
| 319 | * Single point walker update |
| 320 | * |
| 321 | * 49 5/22/98 6:45p Chris |
| 322 | * Fixed a bug with flinching and melee attacks |
| 323 | * |
| 324 | * 48 5/22/98 6:22p Chris |
| 325 | * Improved Dynamic path allocation |
| 326 | * |
| 327 | * 47 5/22/98 4:44p Chris |
| 328 | * Added better melee hit prediction |
| 329 | * |
| 330 | * 46 5/20/98 10:19a Chris |
| 331 | * Fixed some bugs with status_reg's and circle distance |
| 332 | * |
| 333 | * 45 5/18/98 12:40p Chris |
| 334 | * Added a new flag (F_BLINE_IF_SEE_GOAL) |
| 335 | * |
| 336 | * 44 5/17/98 9:07p Chris |
| 337 | * Fixed melee attacks. Thanks to Ala. :) |
| 338 | * |
| 339 | * 43 5/17/98 7:54p Chris |
| 340 | * Correctly integrated the goal system and circle distance stuff. Added |
| 341 | * support for "target goals". |
| 342 | * |
| 343 | * 42 5/15/98 2:58p Chris |
| 344 | * More on the big AI update |
| 345 | * |
| 346 | * 41 5/14/98 3:01p Chris |
| 347 | * More new AI code |
| 348 | * |
| 349 | * 40 5/14/98 12:21p Chris |
| 350 | * Updating AI system... Incomplete |
| 351 | * |
| 352 | * 39 5/12/98 3:46p Chris |
| 353 | * Added some notify/goal system stuff and orientation to velocity |
| 354 | * |
| 355 | * 38 5/11/98 4:39p Chris |
| 356 | * Improved AI system (goals have notifies and are more flexable). |
| 357 | * |
| 358 | * 37 5/04/98 4:04p Chris |
| 359 | * Minestone checkin' -- energy effect and more AI functionality |
| 360 | * |
| 361 | * 36 5/01/98 3:41p Chris |
| 362 | * |
| 363 | * 35 5/31/98 3:05p Chris |
| 364 | * Allowed death anims (fixed problem with ctype union of CT_DEBRIS and |
| 365 | * CT_AI) |
| 366 | * |
| 367 | * 34 4/30/98 11:31a Chris |
| 368 | * Massive upgrades to the AI system |
| 369 | * |
| 370 | * 33 4/22/98 1:15p Chris |
| 371 | * Incremental work on paths and goals |
| 372 | * |
| 373 | * 32 4/21/98 11:25a Chris |
| 374 | * Improving GET_TO_OBJ goal |
| 375 | * |
| 376 | * 31 4/20/98 3:19p Chris |
| 377 | * Added more goal/path support |
| 378 | * |
| 379 | * 30 4/20/98 12:27p Chris |
| 380 | * Made AIG_GET_TO_OBJECT work. |
| 381 | * |
| 382 | * 29 4/19/98 9:56p Chris |
| 383 | * AI system is integrated with OSIRIS. Path system is integrated with |
| 384 | * the AI system. Bugs will ensue. |
| 385 | * |
| 386 | * 28 4/14/98 11:42a Chris |
| 387 | * Added quirks and a better way of getting from idle to alert and from |
| 388 | * alert to idle. |
| 389 | * |
| 390 | * 27 4/13/98 6:54p Chris |
| 391 | * Improved the animation system. |
| 392 | * |
| 393 | * 26 4/13/98 2:20p Chris |
| 394 | * IDLe works (kindof) |
| 395 | * |
| 396 | * 25 3/30/98 10:50a Chris |
| 397 | * AI's will not go into fire if a flinch is lined up. |
| 398 | * |
| 399 | * 24 3/25/98 5:51p Chris |
| 400 | * Added full model/body animations for weapon firing |
| 401 | * |
| 402 | * 23 3/25/98 11:02a Chris |
| 403 | * version 1.0 of the new AI ranged firing code. |
| 404 | * |
| 405 | * 22 3/13/98 5:55p Chris |
| 406 | * Fixed problems with animations |
| 407 | * |
| 408 | * 21 3/12/98 5:55p Chris |
| 409 | * Updated flinch |
| 410 | * |
| 411 | * 20 3/12/98 5:51p Chris |
| 412 | * Working on Bashing anim's to other anims |
| 413 | * |
| 414 | * 19 3/03/98 5:02p Chris |
| 415 | * Added a status register to the ai_frame. Also, I enabled a bunch of |
| 416 | * the fields from the AI Dialog. In addiition, I tweaked how melee |
| 417 | * attacks work and animate. |
| 418 | * |
| 419 | * 18 2/16/98 12:52p Chris |
| 420 | * Added some Flinch support |
| 421 | * |
| 422 | * 17 2/11/98 7:00p Chris |
| 423 | * Removed priority (changed to influence) and added activation_level |
| 424 | * |
| 425 | * 16 2/02/98 8:14p Chris |
| 426 | * Updated the AI system |
| 427 | * |
| 428 | * 15 1/19/98 10:04a Matt |
| 429 | * Added new object handle system |
| 430 | * |
| 431 | * 14 1/14/98 7:57p Chris |
| 432 | * Improving the awareness system |
| 433 | * |
| 434 | * 13 11/17/97 9:48p Chris |
| 435 | * Added guarding |
| 436 | * |
| 437 | * 12 11/17/97 5:46p Chris |
| 438 | * Added some support for a Theif-like robot |
| 439 | * |
| 440 | * 11 11/14/97 11:55p Chris |
| 441 | * Dodge goals are semi-functional |
| 442 | * |
| 443 | * 10 9/02/97 3:28p Matt |
| 444 | * Got rid of warnings |
| 445 | * |
| 446 | * 9 8/05/97 12:29p Chris |
| 447 | * |
| 448 | * 8 7/30/97 1:31p Chris |
| 449 | * Made helicopters slightly more interesting. |
| 450 | * |
| 451 | * 7 7/29/97 12:20p Chris |
| 452 | * Incremental improvements. Fixed a memory bug. |
| 453 | * |
| 454 | * 6 7/15/97 7:29p Chris |
| 455 | * Added a sound for helicopter blades. |
| 456 | * |
| 457 | * 5 7/15/97 5:35p Chris |
| 458 | * New AI code |
| 459 | * |
| 460 | * 4 7/15/97 4:59p Chris |
| 461 | * added support for AI and animations |
| 462 | * |
| 463 | * $NoKeywords: $ |
| 464 | */ |
| 465 | |
| 466 | #include <stdlib.h> |
| 467 | #include "AIGoal.h"cxx . . $ `<file>/Descent3/AIGoal.h`/ |
| 468 | #include "aistruct.h"cxx . . $ `<file>/Descent3/aistruct.h`/ |
| 469 | #include "aipath.h"cxx . . $ `<file>/Descent3/aipath.h`/ |
| 470 | #include "object.h"cxx . . $ `<file>/Descent3/object.h`/ |
| 471 | #include "game.h"cxx . . $ `<file>/Descent3/game.h`/ |
| 472 | #include "terrain.h"cxx . . $ `<file>/Descent3/terrain.h`/ |
| 473 | #include "objinfo.h"cxx . . $ `<file>/Descent3/objinfo.h`/ |
| 474 | #include "AIMain.h"cxx . . $ `<file>/Descent3/AIMain.h`/ |
| 475 | #include "room.h"cxx . . $ `<file>/Descent3/room.h`/ |
| 476 | #include "psrand.h"cxx . . $ `<file>/misc/psrand.h`/ |
| 477 | #include "BOA.h"cxx . . $ `<file>/Descent3/BOA.h`/ |
| 478 | #include "findintersection.h"cxx . . $ `<file>/physics/findintersection.h`/ |
| 479 | |
| 480 | extern int AI_unique_goal_idcxx . . $ AI_unique_goal_id.; |
| 481 | |
| 482 | static void GoalInitWanderAroundcxx . . $ GoalInitWanderAround(e0a81a5323189e4a).(objectcxx . . $ object# *obj, goalcxx . . $ goal# *goal_ptr); |
| 483 | static int GoalAllocSlotcxx . . $ GoalAllocSlot(ff7fc2e970afd0b0).(objectcxx . . $ object# *obj, int level, float influence); |
| 484 | |
| 485 | #define BASH_TO_ANIM_SCALERcxx . . $ `Descent3/AIGoal.cpp:485:9`! 10.0f |
| 486 | #define MAX_BASH_TO_FLINCH_TIMEcxx . . $ `Descent3/AIGoal.cpp:486:9`! 2.5f |
| 487 | |
| 488 | void GoalInitWanderAroundcxx . . $ GoalInitWanderAround(e0a81a5323189e4a).(objectcxx . . $ object# *obj, goalcxx . . $ goal# *goal_ptr) { |
| 489 | ai_framecxx . . $ ai_frame# *ai_info = obj->ai_infocxx . . $ object#ai_info.; |
| 490 | int roomnum; |
| 491 | vectorcxx . . $ vector# pos; |
| 492 | |
| 493 | // mprintf(0, "Wander around\n"); |
| 494 | |
| 495 | goalcxx . . $ goal# *cur_goal = GoalGetCurrentGoalcxx . . $ GoalGetCurrentGoal(6a99c6e9427d0d95).(obj); |
| 496 | if (cur_goal != goal_ptr) |
| 497 | return; |
| 498 | |
| 499 | if (!ROOMNUM_OUTSIDEcxx . . $ `lib/object_external_struct.h:127:9`!(obj->roomnum)) { |
| 500 | roomnum = AIFindRandomRoomcxx . . $ AIFindRandomRoom(faebaf28fe240c5f).(obj, ai_info, goal_ptr, obj->roomnumcxx . . $ object#roomnum., -1, -1, true, false, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!); |
| 501 | if (!ROOMNUM_OUTSIDEcxx . . $ `lib/object_external_struct.h:127:9`!(roomnum)) { |
| 502 | pos =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). Roomscxx . . $ Rooms.[roomnum].path_pntcxx . . $ room#path_pnt.; |
| 503 | } else { |
| 504 | ComputeTerrainSegmentCentercxx . . $ ComputeTerrainSegmentCenter(86b7faebfcd459cf).(&pos, CELLNUMcxx . . $ `lib/object_external_struct.h:121:9`!(roomnum)); |
| 505 | pos.ycxx . . $ vector#y. += (ai_info->biased_flight_maxcxx . . $ ai_frame#biased_flight_max. + ai_info->biased_flight_mincxx . . $ ai_frame#biased_flight_min.) / 2.0f; |
| 506 | } |
| 507 | } else { |
| 508 | int tx = (ps_randcxx . . $ ps_rand(b126dc7c1de90089).() % (TERRAIN_WIDTHcxx . . $ `Descent3/terrain.h:31:9`! - 56)) + (56 / 2); |
| 509 | int tz = (ps_randcxx . . $ ps_rand(b126dc7c1de90089).() % (TERRAIN_DEPTHcxx . . $ `Descent3/terrain.h:32:9`! - 56)) + (56 / 2); |
| 510 | |
| 511 | int cell = tx + TERRAIN_WIDTHcxx . . $ `Descent3/terrain.h:31:9`! * tz; |
| 512 | roomnum = 0x80000000 | cell; |
| 513 | ComputeTerrainSegmentCentercxx . . $ ComputeTerrainSegmentCenter(86b7faebfcd459cf).(&pos, cell); |
| 514 | pos.ycxx . . $ vector#y. += (ai_info->biased_flight_maxcxx . . $ ai_frame#biased_flight_max. + ai_info->biased_flight_mincxx . . $ ai_frame#biased_flight_min.) / 2.0f; |
| 515 | } |
| 516 | |
| 517 | goal_ptr->g_infocxx . . $ goal#g_info..poscxx . . $ goal_info#$anonymous_type_2#pos. =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). pos; |
| 518 | goal_ptr->g_infocxx . . $ goal#g_info..roomnumcxx . . $ goal_info#$anonymous_type_1#roomnum. = roomnum; |
| 519 | |
| 520 | goal_ptr->next_path_timecxx . . $ goal#next_path_time. = Gametimecxx . . $ Gametime. + MIN_NEXT_PATH_INTERVALcxx . . $ `Descent3/aistruct_external.h:338:9`! + ps_randcxx . . $ ps_rand(b126dc7c1de90089).() / (float)D3_RAND_MAXcxx . . $ `misc/psrand.h:41:9`!; |
| 521 | goal_ptr->flagscxx . . $ goal#flags. |= GF_HAS_PATHcxx . . $ `Descent3/aistruct_external.h:217:9`!; |
| 522 | } |
| 523 | |
| 524 | void GoalClearGoalcxx . . $ GoalClearGoal(5f6922bcf6358e70).(objectcxx . . $ object# *obj, goalcxx . . $ goal# *cur_goal, int reason) { |
| 525 | ai_framecxx . . $ ai_frame# *ai_info = obj->ai_infocxx . . $ object#ai_info.; |
| 526 | bool f_continue = true; |
| 527 | |
| 528 | // Set the in clear flag so that we know if this goal is updated in script |
| 529 | cur_goal->flagscxx . . $ goal#flags. |= GF_IN_CLEARcxx . . $ `Descent3/aistruct_external.h:243:9`!; |
| 530 | |
| 531 | if (reason != AI_INVALID_INDEXcxx . . $ `Descent3/aistruct.h:404:9`!) { |
| 532 | int goal_index = (cur_goal - ai_info->goalscxx . . $ ai_frame#goals.); |
| 533 | |
| 534 | f_continue = AINotifycxx . . $ AINotify(f32b5964aaa42c22).(obj, reason, (void *)&goal_index); |
| 535 | } else if (cur_goal->guidcxx . . $ goal#guid. != -1 && reason != AI_INVALID_INDEXcxx . . $ `Descent3/aistruct.h:404:9`!) { |
| 536 | int goal_index = (cur_goal - ai_info->goalscxx . . $ ai_frame#goals.); |
| 537 | AINotifycxx . . $ AINotify(f32b5964aaa42c22).(obj, AIN_GOAL_FAILcxx . . $ `Descent3/aistruct_external.h:295:9`!, (void *)&goal_index); |
| 538 | } |
| 539 | |
| 540 | // Don't continue if this is a different goal |
| 541 | if (!(cur_goal->flagscxx . . $ goal#flags. & GF_IN_CLEARcxx . . $ `Descent3/aistruct_external.h:243:9`!)) |
| 542 | return; |
| 543 | |
| 544 | // Clear the in clear flag |
| 545 | cur_goal->flagscxx . . $ goal#flags. &= ~GF_IN_CLEARcxx . . $ `Descent3/aistruct_external.h:243:9`!; |
| 546 | |
| 547 | if ((reason == AIN_GOAL_COMPLETEcxx . . $ `Descent3/aistruct_external.h:294:9`!) && (cur_goal->flagscxx . . $ goal#flags. & GF_KEEP_AT_COMPLETIONcxx . . $ `Descent3/aistruct_external.h:218:9`!)) { |
| 548 | if (cur_goal->typecxx . . $ goal#type. == AIG_WANDER_AROUNDcxx . . $ `Descent3/aistruct_external.h:187:9`!) { |
| 549 | GoalInitWanderAroundcxx . . $ GoalInitWanderAround(e0a81a5323189e4a).(obj, cur_goal); |
| 550 | } |
| 551 | return; |
| 552 | } |
| 553 | |
| 554 | if ((cur_goal->flagscxx . . $ goal#flags. & GF_NONFLUSHABLEcxx . . $ `Descent3/aistruct_external.h:216:9`!) && (reason != AI_INVALID_INDEXcxx . . $ `Descent3/aistruct.h:404:9`!)) |
| 555 | return; |
| 556 | |
| 557 | if (!f_continue) |
| 558 | return; |
| 559 | |
| 560 | // cur_goal->goal_type = AIG_NOT_USED; |
| 561 | cur_goal->usedcxx . . $ goal#used. = false; |
| 562 | |
| 563 | if (obj->ai_infocxx . . $ object#ai_info.->pathcxx . . $ ai_frame#path..goal_uidcxx . . $ ai_path_info#goal_uid. == cur_goal->goal_uidcxx . . $ goal#goal_uid.) { |
| 564 | #ifdef _DEBUGcxx . . $ `<built-in>:482:9`! |
| 565 | if (AI_debug_robot_docxx . . $ AI_debug_robot_do. && OBJNUMcxx . . $ `Descent3/object.h:700:9`!(obj) == AI_debug_robot_indexcxx . . $ AI_debug_robot_index.) { |
| 566 | mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "AI Note: In free path\n"); |
| 567 | } |
| 568 | #endif |
| 569 | AIPathFreePathcxx . . $ AIPathFreePath(211cadd9cc3984f1).(&ai_info->pathcxx . . $ ai_frame#path.); |
| 570 | } |
| 571 | |
| 572 | // for(i = 0; i < MAX_ENDERS_PER_GOAL; i++) |
| 573 | // { |
| 574 | // cur_goal->enders[i].ender_type = AIE_NOT_USED; |
| 575 | // } |
| 576 | } |
| 577 | |
| 578 | #define MAX_NEAR_OBJ_SEARCH_DISTcxx . . $ `Descent3/AIGoal.cpp:578:9`! 200.0f |
| 579 | |
| 580 | float GoalDetermineTrackDistcxx . . $ GoalDetermineTrackDist(9e89091ee687c4f3).(objectcxx . . $ object# *obj) { |
| 581 | float dist = 0.0f; |
| 582 | int i; |
| 583 | |
| 584 | for (i = 0; i < MAX_GOALScxx . . $ `Descent3/aistruct_external.h:178:9`!; i++) { |
| 585 | goalcxx . . $ goal# *cur_goal = &obj->ai_infocxx . . $ object#ai_info.->goalscxx . . $ ai_frame#goals.[i]; |
| 586 | |
| 587 | if (cur_goal->usedcxx . . $ goal#used. && ISTRACKGOALcxx . . $ `Descent3/aistruct_external.h:261:9`!(cur_goal)) { |
| 588 | if (cur_goal->flagscxx . . $ goal#flags. & GF_RAMPED_INFLUENCEcxx . . $ `Descent3/aistruct_external.h:230:9`!) { |
| 589 | if (cur_goal->ramp_influence_distscxx . . $ goal#ramp_influence_dists.[3] > dist) { |
| 590 | // Get the maximum distance this goal has influence |
| 591 | dist = cur_goal->ramp_influence_distscxx . . $ goal#ramp_influence_dists.[3]; |
| 592 | } |
| 593 | } else { |
| 594 | // Influence isn't distnace based; so, check out to max dist |
| 595 | dist = MAX_NEAR_OBJ_SEARCH_DISTcxx . . $ `Descent3/AIGoal.cpp:578:9`!; |
| 596 | } |
| 597 | } |
| 598 | } |
| 599 | |
| 600 | if (dist > 0.0f) |
| 601 | return dist + obj->sizecxx . . $ object#size.; |
| 602 | else |
| 603 | return 0.0f; |
| 604 | } |
| 605 | |
| 606 | void GoalDoFramecxx . . $ GoalDoFrame(419c470199a90a97).(objectcxx . . $ object# *obj) { |
| 607 | ai_framecxx . . $ ai_frame# *ai_info = obj->ai_infocxx . . $ object#ai_info.; |
| 608 | goalcxx . . $ goal# *cur_goal; |
| 609 | int i; |
| 610 | |
| 611 | goalcxx . . $ goal# *cur_task_goal = GoalGetCurrentGoalcxx . . $ GoalGetCurrentGoal(6a99c6e9427d0d95).(obj); |
| 612 | if (ai_info->pathcxx . . $ ai_frame#path..num_pathscxx . . $ ai_path_info#num_paths. > 0 && (cur_task_goal == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`! || (cur_task_goal->goal_uidcxx . . $ goal#goal_uid. != ai_info->pathcxx . . $ ai_frame#path..goal_uidcxx . . $ ai_path_info#goal_uid.))) { |
| 613 | #ifdef _DEBUGcxx . . $ `<built-in>:482:9`! |
| 614 | if (AI_debug_robot_docxx . . $ AI_debug_robot_do. && OBJNUMcxx . . $ `Descent3/object.h:700:9`!(obj) == AI_debug_robot_indexcxx . . $ AI_debug_robot_index.) { |
| 615 | mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "AI Note: In free path\n"); |
| 616 | } |
| 617 | #endif |
| 618 | AIPathFreePathcxx . . $ AIPathFreePath(211cadd9cc3984f1).(&ai_info->pathcxx . . $ ai_frame#path.); |
| 619 | } |
| 620 | |
| 621 | // Process all goals |
| 622 | cur_goal = &ai_info->goalscxx . . $ ai_frame#goals.[0]; |
| 623 | for (i = 0; i < MAX_GOALScxx . . $ `Descent3/aistruct_external.h:178:9`!; i++) { |
| 624 | if (cur_goal->usedcxx . . $ goal#used.) { |
| 625 | if ((cur_goal->flagscxx . . $ goal#flags. & GF_CLEAR_IF_NOT_CURRENT_GOALcxx . . $ `Descent3/aistruct_external.h:245:9`!) && cur_goal != cur_task_goal) { |
| 626 | GoalClearGoalcxx . . $ GoalClearGoal(5f6922bcf6358e70).(obj, cur_goal); |
| 627 | continue; |
| 628 | } |
| 629 | |
| 630 | // Does the |
| 631 | if (cur_goal->flagscxx . . $ goal#flags. & GF_OBJ_IS_TARGETcxx . . $ `Descent3/aistruct_external.h:220:9`!) { |
| 632 | cur_goal->g_infocxx . . $ goal#g_info..handlecxx . . $ goal_info#$anonymous_type_1#handle. = ai_info->target_handlecxx . . $ ai_frame#target_handle.; |
| 633 | |
| 634 | if (ai_info->status_regcxx . . $ ai_frame#status_reg. & AISR_SEES_GOALcxx . . $ `Descent3/aistruct_external.h:400:9`!) { |
| 635 | cur_goal->status_regcxx . . $ goal#status_reg. |= AISR_SEES_GOALcxx . . $ `Descent3/aistruct_external.h:400:9`!; |
| 636 | } else { |
| 637 | cur_goal->status_regcxx . . $ goal#status_reg. &= ~AISR_SEES_GOALcxx . . $ `Descent3/aistruct_external.h:400:9`!; |
| 638 | } |
| 639 | } else { |
| 640 | // chrishack -- Currently, we can only see target based goals and position goals |
| 641 | cur_goal->status_regcxx . . $ goal#status_reg. &= ~AISR_SEES_GOALcxx . . $ `Descent3/aistruct_external.h:400:9`!; |
| 642 | if (POSGOALcxx . . $ `Descent3/aistruct.h:674:9`!(cur_goal) && cur_goal->g_infocxx . . $ goal#g_info..roomnumcxx . . $ goal_info#$anonymous_type_1#roomnum. == obj->roomnumcxx . . $ object#roomnum.) { |
| 643 | cur_goal->status_regcxx . . $ goal#status_reg. |= AISR_SEES_GOALcxx . . $ `Descent3/aistruct_external.h:400:9`!; |
| 644 | } |
| 645 | } |
| 646 | |
| 647 | if (cur_goal->flagscxx . . $ goal#flags. & GF_CIRCLE_OBJcxx . . $ `Descent3/aistruct_external.h:221:9`!) { |
| 648 | int handle = cur_goal->g_infocxx . . $ goal#g_info..handlecxx . . $ goal_info#$anonymous_type_1#handle.; |
| 649 | objectcxx . . $ object# *goal_obj = ObjGetcxx . . $ ObjGet(11672e354c0b263a).(handle); |
| 650 | |
| 651 | if (cur_goal->flagscxx . . $ goal#flags. & GF_OBJ_IS_TARGETcxx . . $ `Descent3/aistruct_external.h:220:9`!) { |
| 652 | cur_goal->dist_to_goalcxx . . $ goal#dist_to_goal. = ai_info->dist_to_target_actualcxx . . $ ai_frame#dist_to_target_actual.; |
| 653 | } else { |
| 654 | if (goal_obj) { |
| 655 | cur_goal->dist_to_goalcxx . . $ goal#dist_to_goal. = vm_VectorDistancecxx . . $ vm_VectorDistance(e65d563e2b53cc54).(&obj->poscxx . . $ object#pos., &goal_obj->poscxx . . $ object#pos.) - obj->sizecxx . . $ object#size. - goal_obj->sizecxx . . $ object#size.; |
| 656 | if (cur_goal->dist_to_goalcxx . . $ goal#dist_to_goal. < 0.0f) { |
| 657 | cur_goal->dist_to_goalcxx . . $ goal#dist_to_goal. = 0.0f; |
| 658 | } |
| 659 | } |
| 660 | } |
| 661 | |
| 662 | if (goal_obj) { |
| 663 | AIStatusCircleFramecxx . . $ AIStatusCircleFrame(fd8d6ff82ee13e7b).(obj, goal_obj, cur_goal->dist_to_goalcxx . . $ goal#dist_to_goal., cur_goal->circle_distancecxx . . $ goal#circle_distance., &cur_goal->status_regcxx . . $ goal#status_reg.); |
| 664 | } else { |
| 665 | cur_goal->status_regcxx . . $ goal#status_reg. &= ~AISR_CIRCLE_DISTcxx . . $ `Descent3/aistruct_external.h:396:9`!; |
| 666 | } |
| 667 | } else if (POSGOALcxx . . $ `Descent3/aistruct.h:674:9`!(cur_goal)) { |
| 668 | float dist = vm_VectorDistancecxx . . $ vm_VectorDistance(e65d563e2b53cc54).(&obj->poscxx . . $ object#pos., &cur_goal->g_infocxx . . $ goal#g_info..poscxx . . $ goal_info#$anonymous_type_2#pos.); |
| 669 | |
| 670 | // mprintf(0, "Dist is %f\n", dist); |
| 671 | // mprintf(0, "Dist %f, %f, %f\n", XYZ(&cur_goal->g_info.pos)); |
| 672 | // mprintf(0, "Obj %f, %f, %f\n", XYZ(&obj->pos)); |
| 673 | |
| 674 | cur_goal->dist_to_goalcxx . . $ goal#dist_to_goal. = dist; |
| 675 | AIStatusCircleFramecxx . . $ AIStatusCircleFrame(fd8d6ff82ee13e7b).(obj, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, dist, cur_goal->circle_distancecxx . . $ goal#circle_distance., &cur_goal->status_regcxx . . $ goal#status_reg.); |
| 676 | } |
| 677 | } |
| 678 | |
| 679 | cur_goal++; |
| 680 | } |
| 681 | |
| 682 | // cur_task_goal might get cleared out above, so we should just recompute the current task goal |
| 683 | cur_goal = GoalGetCurrentGoalcxx . . $ GoalGetCurrentGoal(6a99c6e9427d0d95).(obj); |
| 684 | |
| 685 | if (cur_goal) { |
| 686 | int handle = OBJECT_HANDLE_NONEcxx . . $ `Descent3/object_external.h:156:9`!; |
| 687 | objectcxx . . $ object# *goal_obj = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 688 | |
| 689 | if (cur_goal->flagscxx . . $ goal#flags. & GF_FORCE_AWARENESScxx . . $ `Descent3/aistruct_external.h:224:9`!) { |
| 690 | if (obj->ai_infocxx . . $ object#ai_info.->awarenesscxx . . $ ai_frame#awareness. < AWARE_MOSTLYcxx . . $ `Descent3/aistruct_external.h:324:9`!) |
| 691 | obj->ai_infocxx . . $ object#ai_info.->awarenesscxx . . $ ai_frame#awareness. = AWARE_MOSTLYcxx . . $ `Descent3/aistruct_external.h:324:9`!; |
| 692 | } |
| 693 | |
| 694 | // Does the save and restore of path information for static paths (i.e. if the path_info is |
| 695 | // taken away by a higher priority goal and then returned at a later time |
| 696 | if (cur_goal->typecxx . . $ goal#type. == AIG_FOLLOW_PATHcxx . . $ `Descent3/aistruct_external.h:195:9`!) { |
| 697 | if (ai_info->pathcxx . . $ ai_frame#path..goal_uidcxx . . $ ai_path_info#goal_uid. == cur_goal->goal_uidcxx . . $ goal#goal_uid. && ai_info->pathcxx . . $ ai_frame#path..num_pathscxx . . $ ai_path_info#num_paths. > 0) { |
| 698 | cur_goal->g_infocxx . . $ goal#g_info..static_path_infocxx . . $ goal_info#$anonymous_type_3#static_path_info..cur_nodecxx . . $ g_static_path#cur_node. = ai_info->pathcxx . . $ ai_frame#path..cur_nodecxx . . $ ai_path_info#cur_node.; |
| 699 | cur_goal->g_infocxx . . $ goal#g_info..static_path_infocxx . . $ goal_info#$anonymous_type_3#static_path_info..start_nodecxx . . $ g_static_path#start_node. = ai_info->pathcxx . . $ ai_frame#path..path_start_nodecxx . . $ ai_path_info#path_start_node.[0]; |
| 700 | cur_goal->g_infocxx . . $ goal#g_info..static_path_infocxx . . $ goal_info#$anonymous_type_3#static_path_info..end_nodecxx . . $ g_static_path#end_node. = ai_info->pathcxx . . $ ai_frame#path..path_end_nodecxx . . $ ai_path_info#path_end_node.[0]; |
| 701 | } else { |
| 702 | AIPathSetAsStaticPathcxx . . $ AIPathSetAsStaticPath(adaaf699fc2cec17).(obj, cur_goal, cur_goal->g_infocxx . . $ goal#g_info..idcxx . . $ goal_info#$anonymous_type_1#id., cur_goal->g_infocxx . . $ goal#g_info..static_path_infocxx . . $ goal_info#$anonymous_type_3#static_path_info..start_nodecxx . . $ g_static_path#start_node., |
| 703 | cur_goal->g_infocxx . . $ goal#g_info..static_path_infocxx . . $ goal_info#$anonymous_type_3#static_path_info..end_nodecxx . . $ g_static_path#end_node., cur_goal->g_infocxx . . $ goal#g_info..static_path_infocxx . . $ goal_info#$anonymous_type_3#static_path_info..cur_nodecxx . . $ g_static_path#cur_node.); |
| 704 | } |
| 705 | } |
| 706 | |
| 707 | if (cur_goal->typecxx . . $ goal#type. == AIG_WANDER_AROUNDcxx . . $ `Descent3/aistruct_external.h:187:9`!) { |
| 708 | if (!(cur_goal->flagscxx . . $ goal#flags. & GF_HAS_PATHcxx . . $ `Descent3/aistruct_external.h:217:9`!) || ai_info->pathcxx . . $ ai_frame#path..num_pathscxx . . $ ai_path_info#num_paths. == 0) { |
| 709 | GoalInitWanderAroundcxx . . $ GoalInitWanderAround(e0a81a5323189e4a).(obj, cur_goal); |
| 710 | } |
| 711 | /* |
| 712 | else if ((cur_goal->flags & GF_HAS_PATH) && ai_info->path.num_paths != 0) { |
| 713 | vector *posp = &cur_goal->g_info.pos; |
| 714 | float dist = vm_VectorDistance( |
| 715 | &AIDynamicPath[ai_info->path.num_paths - 1].pos[ai_info->path.path_end_node[ai_info->path.num_paths - 1]], |
| 716 | posp); |
| 717 | |
| 718 | if (dist > 5.0f) { |
| 719 | mprintf(0, "In wander path case for obj %d - %s....\n", OBJNUM(obj), Object_info[obj->id].name); |
| 720 | cur_goal->next_path_time = Gametime - 1.0f; |
| 721 | } |
| 722 | } |
| 723 | */ |
| 724 | } |
| 725 | |
| 726 | if (OBJGOALcxx . . $ `Descent3/aistruct.h:668:9`!(cur_goal)) { |
| 727 | handle = cur_goal->g_infocxx . . $ goal#g_info..handlecxx . . $ goal_info#$anonymous_type_1#handle.; |
| 728 | goal_obj = ObjGetcxx . . $ ObjGet(11672e354c0b263a).(handle); |
| 729 | } |
| 730 | |
| 731 | // Automatically end |
| 732 | if ((COMPLETEATOBJcxx . . $ `Descent3/aistruct.h:673:9`!(cur_goal)) && (goal_obj) && (cur_goal->status_regcxx . . $ goal#status_reg. & AISR_CIRCLE_DISTcxx . . $ `Descent3/aistruct_external.h:396:9`!)) { |
| 733 | GoalClearGoalcxx . . $ GoalClearGoal(5f6922bcf6358e70).(obj, cur_goal, AIN_GOAL_COMPLETEcxx . . $ `Descent3/aistruct_external.h:294:9`!); |
| 734 | } else if ((COMPLETEATPOScxx . . $ `Descent3/aistruct.h:676:9`!(cur_goal)) && (cur_goal->status_regcxx . . $ goal#status_reg. & AISR_CIRCLE_DISTcxx . . $ `Descent3/aistruct_external.h:396:9`!)) { |
| 735 | GoalClearGoalcxx . . $ GoalClearGoal(5f6922bcf6358e70).(obj, cur_goal, AIN_GOAL_COMPLETEcxx . . $ `Descent3/aistruct_external.h:294:9`!); |
| 736 | } else if ((Gametimecxx . . $ Gametime. > cur_goal->next_path_timecxx . . $ goal#next_path_time. || ai_info->pathcxx . . $ ai_frame#path..num_pathscxx . . $ ai_path_info#num_paths. == 0) && |
| 737 | (cur_goal->typecxx . . $ goal#type. != AIG_FOLLOW_PATHcxx . . $ `Descent3/aistruct_external.h:195:9`!)) { |
| 738 | bool f_make_path = false; |
| 739 | int ignore_obj = -1; |
| 740 | bool f_kill_goal = false; |
| 741 | int kill_reason; |
| 742 | |
| 743 | vectorcxx . . $ vector# *posp; |
| 744 | int roomnum; |
| 745 | |
| 746 | if (OBJGOALcxx . . $ `Descent3/aistruct.h:668:9`!(cur_goal)) { |
| 747 | if (goal_obj) { |
| 748 | // if(cur_goal->g_info.pos != goal_obj->pos) |
| 749 | f_make_path = true; |
| 750 | ignore_obj = OBJNUMcxx . . $ `Descent3/object.h:700:9`!(goal_obj); |
| 751 | |
| 752 | posp = &goal_obj->poscxx . . $ object#pos.; |
| 753 | roomnum = goal_obj->roomnumcxx . . $ object#roomnum.; |
| 754 | |
| 755 | float dist = vm_VectorDistancecxx . . $ vm_VectorDistance(e65d563e2b53cc54).( |
| 756 | &AIDynamicPathcxx . . $ AIDynamicPath.[ai_info->pathcxx . . $ ai_frame#path..num_pathscxx . . $ ai_path_info#num_paths. - 1].poscxx . . $ ai_dynamic_path#pos.[ai_info->pathcxx . . $ ai_frame#path..path_end_nodecxx . . $ ai_path_info#path_end_node.[ai_info->pathcxx . . $ ai_frame#path..num_pathscxx . . $ ai_path_info#num_paths. - 1]], |
| 757 | posp); |
| 758 | |
| 759 | if (dist < 5.0f && ai_info->pathcxx . . $ ai_frame#path..num_pathscxx . . $ ai_path_info#num_paths. != 0) { |
| 760 | int obj_room = BOA_INDEXcxx . . $ `Descent3/BOA.h:197:9`!(obj->roomnum); |
| 761 | int path_room = BOA_INDEXcxx . . $ `Descent3/BOA.h:197:9`!(AIDynamicPath[ai_info->path.cur_path].roomnum[ai_info->path.cur_node]); |
| 762 | vectorcxx . . $ vector# path_pos = AIDynamicPathcxx . . $ AIDynamicPath.[ai_info->pathcxx . . $ ai_frame#path..cur_pathcxx . . $ ai_path_info#cur_path.].poscxx . . $ ai_dynamic_path#pos.[ai_info->pathcxx . . $ ai_frame#path..cur_nodecxx . . $ ai_path_info#cur_node.]; |
| 763 | |
| 764 | if (obj_room != path_room) { |
| 765 | fvi_querycxx . . $ fvi_query# fq; |
| 766 | fvi_infocxx . . $ fvi_info# hit_info; |
| 767 | |
| 768 | fq.p0cxx . . $ fvi_query#p0. = &obj->poscxx . . $ object#pos.; |
| 769 | fq.startroomcxx . . $ fvi_query#startroom. = obj->roomnumcxx . . $ object#roomnum.; |
| 770 | fq.p1cxx . . $ fvi_query#p1. = &path_pos; |
| 771 | fq.radcxx . . $ fvi_query#rad. = obj->sizecxx . . $ object#size. / 4.0f; |
| 772 | fq.thisobjnumcxx . . $ fvi_query#thisobjnum. = OBJNUMcxx . . $ `Descent3/object.h:700:9`!(obj); |
| 773 | fq.ignore_obj_listcxx . . $ fvi_query#ignore_obj_list. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 774 | fq.flagscxx . . $ fvi_query#flags. = FQ_CHECK_OBJScxx . . $ `lib/findintersection_external.h:59:9`! | FQ_NO_RELINKcxx . . $ `lib/findintersection_external.h:73:9`! | FQ_IGNORE_NON_LIGHTMAP_OBJECTScxx . . $ `lib/findintersection_external.h:68:9`!; |
| 775 | |
| 776 | if (fvi_FindIntersectioncxx . . $ fvi_FindIntersection(e1c4d7bd350effc8).(&fq, &hit_info) == HIT_NONEcxx . . $ `lib/findintersection_external.h:45:9`!) { |
| 777 | mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "AI OBJ Path: No need to update the path for obj %d\n", OBJNUM(obj)); |
| 778 | f_make_path = false; |
| 779 | } |
| 780 | } |
| 781 | } |
| 782 | } else { |
| 783 | kill_reason = AIN_GOAL_INVALIDcxx . . $ `Descent3/aistruct_external.h:303:9`!; |
| 784 | f_kill_goal = true; |
| 785 | } |
| 786 | } else if (POSGOALcxx . . $ `Descent3/aistruct.h:674:9`!(cur_goal)) { |
| 787 | f_make_path = true; |
| 788 | |
| 789 | posp = &cur_goal->g_infocxx . . $ goal#g_info..poscxx . . $ goal_info#$anonymous_type_2#pos.; |
| 790 | roomnum = cur_goal->g_infocxx . . $ goal#g_info..roomnumcxx . . $ goal_info#$anonymous_type_1#roomnum.; |
| 791 | |
| 792 | float dist = vm_VectorDistancecxx . . $ vm_VectorDistance(e65d563e2b53cc54).( |
| 793 | &AIDynamicPathcxx . . $ AIDynamicPath.[ai_info->pathcxx . . $ ai_frame#path..num_pathscxx . . $ ai_path_info#num_paths. - 1].poscxx . . $ ai_dynamic_path#pos.[ai_info->pathcxx . . $ ai_frame#path..path_end_nodecxx . . $ ai_path_info#path_end_node.[ai_info->pathcxx . . $ ai_frame#path..num_pathscxx . . $ ai_path_info#num_paths. - 1]], |
| 794 | posp); |
| 795 | |
| 796 | if (dist < 5.0f && ai_info->pathcxx . . $ ai_frame#path..num_pathscxx . . $ ai_path_info#num_paths. != 0) { |
| 797 | int obj_room = BOA_INDEXcxx . . $ `Descent3/BOA.h:197:9`!(obj->roomnum); |
| 798 | int path_room = BOA_INDEXcxx . . $ `Descent3/BOA.h:197:9`!(AIDynamicPath[ai_info->path.cur_path].roomnum[ai_info->path.cur_node]); |
| 799 | vectorcxx . . $ vector# path_pos = AIDynamicPathcxx . . $ AIDynamicPath.[ai_info->pathcxx . . $ ai_frame#path..cur_pathcxx . . $ ai_path_info#cur_path.].poscxx . . $ ai_dynamic_path#pos.[ai_info->pathcxx . . $ ai_frame#path..cur_nodecxx . . $ ai_path_info#cur_node.]; |
| 800 | |
| 801 | if (obj_room != path_room) { |
| 802 | fvi_querycxx . . $ fvi_query# fq; |
| 803 | fvi_infocxx . . $ fvi_info# hit_info; |
| 804 | |
| 805 | fq.p0cxx . . $ fvi_query#p0. = &obj->poscxx . . $ object#pos.; |
| 806 | fq.startroomcxx . . $ fvi_query#startroom. = obj->roomnumcxx . . $ object#roomnum.; |
| 807 | fq.p1cxx . . $ fvi_query#p1. = &path_pos; |
| 808 | fq.radcxx . . $ fvi_query#rad. = obj->sizecxx . . $ object#size. / 4.0f; |
| 809 | fq.thisobjnumcxx . . $ fvi_query#thisobjnum. = OBJNUMcxx . . $ `Descent3/object.h:700:9`!(obj); |
| 810 | fq.ignore_obj_listcxx . . $ fvi_query#ignore_obj_list. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 811 | fq.flagscxx . . $ fvi_query#flags. = FQ_CHECK_OBJScxx . . $ `lib/findintersection_external.h:59:9`! | FQ_NO_RELINKcxx . . $ `lib/findintersection_external.h:73:9`! | FQ_IGNORE_NON_LIGHTMAP_OBJECTScxx . . $ `lib/findintersection_external.h:68:9`!; |
| 812 | |
| 813 | if (fvi_FindIntersectioncxx . . $ fvi_FindIntersection(e1c4d7bd350effc8).(&fq, &hit_info) == HIT_NONEcxx . . $ `lib/findintersection_external.h:45:9`!) { |
| 814 | mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "AI POS Path: No need to update the path for obj %d\n", OBJNUM(obj)); |
| 815 | f_make_path = false; |
| 816 | } |
| 817 | } |
| 818 | } |
| 819 | } |
| 820 | |
| 821 | // If we are supposed to make it, do it. |
| 822 | if (f_make_path) { |
| 823 | AIPathAllocPathcxx . . $ AIPathAllocPath(896bfa3f698eea41).(obj, ai_info, cur_goal, &obj->roomnumcxx . . $ object#roomnum., &obj->poscxx . . $ object#pos., &roomnum, posp, 0.0f, 0, obj->handlecxx . . $ object#handle., |
| 824 | ignore_obj); |
| 825 | } |
| 826 | |
| 827 | // Kill it or update the time |
| 828 | if (f_kill_goal) { |
| 829 | GoalClearGoalcxx . . $ GoalClearGoal(5f6922bcf6358e70).(obj, cur_goal, kill_reason); |
| 830 | } else { |
| 831 | // Update time regardless of if we made the path (so dont don't do this every frame |
| 832 | cur_goal->next_path_timecxx . . $ goal#next_path_time. = Gametimecxx . . $ Gametime. + MIN_NEXT_PATH_INTERVALcxx . . $ `Descent3/aistruct_external.h:338:9`! + ps_randcxx . . $ ps_rand(b126dc7c1de90089).() / (float)D3_RAND_MAXcxx . . $ `misc/psrand.h:41:9`!; |
| 833 | } |
| 834 | } |
| 835 | } |
| 836 | } |
| 837 | |
| 838 | void GoalPathCompletecxx . . $ GoalPathComplete(419c470199a90a97).(objectcxx . . $ object# *obj) { |
| 839 | ai_framecxx . . $ ai_frame# *ai_info = obj->ai_infocxx . . $ object#ai_info.; |
| 840 | goalcxx . . $ goal# *cur_goal = GoalGetCurrentGoalcxx . . $ GoalGetCurrentGoal(6a99c6e9427d0d95).(obj); |
| 841 | |
| 842 | if (!cur_goal) |
| 843 | return; |
| 844 | |
| 845 | if (COMPLETEATOBJcxx . . $ `Descent3/aistruct.h:673:9`!(cur_goal)) { |
| 846 | int handle = cur_goal->g_infocxx . . $ goal#g_info..handlecxx . . $ goal_info#$anonymous_type_1#handle.; |
| 847 | objectcxx . . $ object# *goal_obj = ObjGetcxx . . $ ObjGet(11672e354c0b263a).(handle); |
| 848 | |
| 849 | if ((goal_obj) && (cur_goal->g_infocxx . . $ goal#g_info..poscxx . . $ goal_info#$anonymous_type_2#pos. !=cxx . . $ `operator!=`(718c890c104af0f3). goal_obj->poscxx . . $ object#pos.)) { |
| 850 | int ignore_obj = OBJNUMcxx . . $ `Descent3/object.h:700:9`!(goal_obj); |
| 851 | |
| 852 | if (AIPathAllocPathcxx . . $ AIPathAllocPath(896bfa3f698eea41).(obj, ai_info, cur_goal, &obj->roomnumcxx . . $ object#roomnum., &obj->poscxx . . $ object#pos., &goal_obj->roomnumcxx . . $ object#roomnum., &goal_obj->poscxx . . $ object#pos., 0.0f, 0, |
| 853 | obj->handlecxx . . $ object#handle., ignore_obj)) { |
| 854 | cur_goal->next_path_timecxx . . $ goal#next_path_time. = Gametimecxx . . $ Gametime. + MIN_NEXT_PATH_INTERVALcxx . . $ `Descent3/aistruct_external.h:338:9`! + ps_randcxx . . $ ps_rand(b126dc7c1de90089).() / (float)D3_RAND_MAXcxx . . $ `misc/psrand.h:41:9`!; |
| 855 | } |
| 856 | } else { |
| 857 | GoalClearGoalcxx . . $ GoalClearGoal(5f6922bcf6358e70).(obj, cur_goal, AIN_GOAL_COMPLETEcxx . . $ `Descent3/aistruct_external.h:294:9`!); |
| 858 | } |
| 859 | } else { |
| 860 | GoalClearGoalcxx . . $ GoalClearGoal(5f6922bcf6358e70).(obj, cur_goal, AIN_GOAL_COMPLETEcxx . . $ `Descent3/aistruct_external.h:294:9`!); |
| 861 | } |
| 862 | } |
| 863 | |
| 864 | void GoalClearAllcxx . . $ GoalClearAll(419c470199a90a97).(objectcxx . . $ object# *obj) { |
| 865 | int i; |
| 866 | ai_framecxx . . $ ai_frame# *ai_info = obj->ai_infocxx . . $ object#ai_info.; |
| 867 | |
| 868 | for (i = 0; i < MAX_GOALScxx . . $ `Descent3/aistruct_external.h:178:9`!; i++) { |
| 869 | GoalClearGoalcxx . . $ GoalClearGoal(5f6922bcf6358e70).(obj, &ai_info->goalscxx . . $ ai_frame#goals.[i]); |
| 870 | } |
| 871 | } |
| 872 | |
| 873 | int GoalAllocSlotcxx . . $ GoalAllocSlot(ff7fc2e970afd0b0).(objectcxx . . $ object# *obj, int level, float influence) { |
| 874 | float lowest_influence_slot = -1.0; |
| 875 | float lowest_influence = MAX_INFLUENCEcxx . . $ `Descent3/aistruct_external.h:272:9`! + 1.0; |
| 876 | int alloc_slot = AI_INVALID_INDEXcxx . . $ `Descent3/aistruct.h:404:9`!; |
| 877 | ai_framecxx . . $ ai_frame# *ai_info = obj->ai_infocxx . . $ object#ai_info.; |
| 878 | int cur_slot; |
| 879 | |
| 880 | ASSERTcxx . . $ `misc/pserror.h:246:9`!((level >= 0 && level < NUM_ACTIVATION_LEVELScxx . . $ `Descent3/aistruct_external.h:279:9`!) || (level == ACTIVATION_BLEND_LEVELcxx . . $ `Descent3/aistruct_external.h:280:9`!)); |
| 881 | |
| 882 | if (influence > MAX_INFLUENCEcxx . . $ `Descent3/aistruct_external.h:272:9`!) { |
| 883 | mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "Goal added with too much influence -- bashing down\n"); |
| 884 | influence = MAX_INFLUENCEcxx . . $ `Descent3/aistruct_external.h:272:9`!; |
| 885 | } else if (influence < 0.0f) { |
| 886 | mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "Goal added with negative influence -- bashing to zero\n"); |
| 887 | influence = 0.0f; |
| 888 | } |
| 889 | |
| 890 | if (level < NUM_ACTIVATION_LEVELScxx . . $ `Descent3/aistruct_external.h:279:9`!) { |
| 891 | cur_slot = level; |
| 892 | |
| 893 | if (level < 0) { |
| 894 | mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "AI: Bashed an invalid activation level to zero\n"); |
| 895 | level = 0; |
| 896 | } |
| 897 | |
| 898 | if (ai_info->goalscxx . . $ ai_frame#goals.[cur_slot].usedcxx . . $ goal#used.) { |
| 899 | if (!(ai_info->goalscxx . . $ ai_frame#goals.[cur_slot].flagscxx . . $ goal#flags. & GF_NONFLUSHABLEcxx . . $ `Descent3/aistruct_external.h:216:9`!)) |
| 900 | GoalClearGoalcxx . . $ GoalClearGoal(5f6922bcf6358e70).(obj, &ai_info->goalscxx . . $ ai_frame#goals.[cur_slot]); |
| 901 | else |
| 902 | cur_slot = AI_INVALID_INDEXcxx . . $ `Descent3/aistruct.h:404:9`!; |
| 903 | } |
| 904 | } else { |
| 905 | cur_slot = NUM_ACTIVATION_LEVELScxx . . $ `Descent3/aistruct_external.h:279:9`!; |
| 906 | goalcxx . . $ goal# *cur_goal = &ai_info->goalscxx . . $ ai_frame#goals.[cur_slot]; |
| 907 | |
| 908 | if (level != ACTIVATION_BLEND_LEVELcxx . . $ `Descent3/aistruct_external.h:280:9`!) { |
| 909 | mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "AI: Bashed an invalid activation blend level to blend level\n"); |
| 910 | level = ACTIVATION_BLEND_LEVELcxx . . $ `Descent3/aistruct_external.h:280:9`!; |
| 911 | } |
| 912 | |
| 913 | while (cur_slot < MAX_GOALScxx . . $ `Descent3/aistruct_external.h:178:9`! && ai_info->goalscxx . . $ ai_frame#goals.[cur_slot].usedcxx . . $ goal#used. == true) { |
| 914 | |
| 915 | if (!(cur_goal->usedcxx . . $ goal#used.)) { |
| 916 | lowest_influence_slot = cur_slot; |
| 917 | lowest_influence = -1.0f; |
| 918 | } |
| 919 | |
| 920 | if (cur_goal->influencecxx . . $ goal#$anonymous_type_4#influence. < lowest_influence && !(cur_goal->flagscxx . . $ goal#flags. & GF_NONFLUSHABLEcxx . . $ `Descent3/aistruct_external.h:216:9`!)) { |
| 921 | lowest_influence_slot = cur_slot; |
| 922 | lowest_influence = cur_goal->influencecxx . . $ goal#$anonymous_type_4#influence.; |
| 923 | } |
| 924 | |
| 925 | cur_goal++; |
| 926 | cur_slot++; |
| 927 | } |
| 928 | |
| 929 | // If there are no free slots but the lowest influence goal has less than the new goal's |
| 930 | // influence, kill the old goal |
| 931 | if (cur_slot >= MAX_GOALScxx . . $ `Descent3/aistruct_external.h:178:9`! && lowest_influence < influence) { |
| 932 | cur_slot = lowest_influence_slot; |
| 933 | GoalClearGoalcxx . . $ GoalClearGoal(5f6922bcf6358e70).(obj, &ai_info->goalscxx . . $ ai_frame#goals.[cur_slot]); |
| 934 | } |
| 935 | } |
| 936 | |
| 937 | if (cur_slot < MAX_GOALScxx . . $ `Descent3/aistruct_external.h:178:9`!) { |
| 938 | ai_info->goalscxx . . $ ai_frame#goals.[cur_slot].usedcxx . . $ goal#used. = true; |
| 939 | } else { |
| 940 | cur_slot = AI_INVALID_INDEXcxx . . $ `Descent3/aistruct.h:404:9`!; |
| 941 | } |
| 942 | |
| 943 | return cur_slot; |
| 944 | } |
| 945 | |
| 946 | // Adds a goal to the object |
| 947 | int GoalAddGoalcxx . . $ GoalAddGoal(e0a3c222b6aee5c7).(objectcxx . . $ object# *obj, uint32_tcxx . . $ uint32_t# goal_type, void *arg_struct, int level, float influence, int f_goal, int guid, |
| 948 | char subtype) { |
| 949 | ai_framecxx . . $ ai_frame# *ai_info = obj->ai_infocxx . . $ object#ai_info.; |
| 950 | int goal_index = AI_INVALID_INDEXcxx . . $ `Descent3/aistruct.h:404:9`!; |
| 951 | goalcxx . . $ goal# *goal_ptr = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 952 | |
| 953 | if (!(goal_type & (AIG_SET_ANIMcxx . . $ `Descent3/aistruct_external.h:196:9`! | AIG_DO_MELEE_ANIMcxx . . $ `Descent3/aistruct_external.h:202:9`! | AIG_FIRE_AT_OBJcxx . . $ `Descent3/aistruct_external.h:185:9`!))) { |
| 954 | goal_index = GoalAllocSlotcxx . . $ GoalAllocSlot(ff7fc2e970afd0b0).(obj, level, influence); |
| 955 | if (goal_index == AI_INVALID_INDEXcxx . . $ `Descent3/aistruct.h:404:9`!) { |
| 956 | // mprintf(0, "WARNING: Object %d has too many goals\n", OBJNUM(obj)); |
| 957 | return AI_INVALID_INDEXcxx . . $ `Descent3/aistruct.h:404:9`!; |
| 958 | } |
| 959 | |
| 960 | goal_ptr = &ai_info->goalscxx . . $ ai_frame#goals.[goal_index]; |
| 961 | |
| 962 | goal_ptr->typecxx . . $ goal#type. = goal_type; |
| 963 | goal_ptr->influencecxx . . $ goal#$anonymous_type_4#influence. = influence; |
| 964 | goal_ptr->start_timecxx . . $ goal#start_time. = Gametimecxx . . $ Gametime.; |
| 965 | goal_ptr->flagscxx . . $ goal#flags. = f_goal; |
| 966 | goal_ptr->status_regcxx . . $ goal#status_reg. = 0; |
| 967 | goal_ptr->num_enablerscxx . . $ goal#num_enablers. = 0; |
| 968 | goal_ptr->circle_distancecxx . . $ goal#circle_distance. = ai_info->circle_distancecxx . . $ ai_frame#circle_distance.; |
| 969 | goal_ptr->guidcxx . . $ goal#guid. = guid; |
| 970 | goal_ptr->creation_timecxx . . $ goal#creation_time. = Gametimecxx . . $ Gametime.; |
| 971 | goal_ptr->subtypecxx . . $ goal#subtype. = subtype; |
| 972 | goal_ptr->goal_uidcxx . . $ goal#goal_uid. = AI_unique_goal_idcxx . . $ AI_unique_goal_id.++; |
| 973 | } |
| 974 | |
| 975 | switch (goal_type) { |
| 976 | case AIG_WANDER_AROUNDcxx . . $ `Descent3/aistruct_external.h:187:9`!: { |
| 977 | goal_ptr->next_path_timecxx . . $ goal#next_path_time. = Gametimecxx . . $ Gametime.; |
| 978 | } break; |
| 979 | |
| 980 | case AIG_SCRIPTEDcxx . . $ `Descent3/aistruct_external.h:197:9`!: |
| 981 | goal_ptr->g_infocxx . . $ goal#g_info..scripted_data_ptrcxx . . $ goal_info#$anonymous_type_3#scripted_data_ptr. = arg_struct; |
| 982 | break; |
| 983 | |
| 984 | case AIG_DODGE_OBJcxx . . $ `Descent3/aistruct_external.h:194:9`!: |
| 985 | case AIG_GET_AROUND_OBJcxx . . $ `Descent3/aistruct_external.h:203:9`!: |
| 986 | case AIG_MOVE_RELATIVE_OBJcxx . . $ `Descent3/aistruct_external.h:200:9`!: |
| 987 | goal_ptr->g_infocxx . . $ goal#g_info..handlecxx . . $ goal_info#$anonymous_type_1#handle. = *((int *)arg_struct); |
| 988 | break; |
| 989 | |
| 990 | case AIG_MOVE_RELATIVE_OBJ_VECcxx . . $ `Descent3/aistruct_external.h:199:9`!: |
| 991 | goal_ptr->g_infocxx . . $ goal#g_info..handlecxx . . $ goal_info#$anonymous_type_1#handle. = ((goal_infocxx . . $ goal_info# *)arg_struct)->handlecxx . . $ goal_info#$anonymous_type_1#handle.; |
| 992 | break; |
| 993 | |
| 994 | case AIG_GUARD_AREAcxx . . $ `Descent3/aistruct_external.h:191:9`!: |
| 995 | goal_ptr->g_infocxx . . $ goal#g_info..roomnumcxx . . $ goal_info#$anonymous_type_1#roomnum. = ((goal_infocxx . . $ goal_info# *)arg_struct)->roomnumcxx . . $ goal_info#$anonymous_type_1#roomnum.; |
| 996 | goal_ptr->g_infocxx . . $ goal#g_info..poscxx . . $ goal_info#$anonymous_type_2#pos. =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). ((goal_infocxx . . $ goal_info# *)arg_struct)->poscxx . . $ goal_info#$anonymous_type_2#pos.; |
| 997 | break; |
| 998 | |
| 999 | case AIG_PLACE_OBJ_ON_OBJcxx . . $ `Descent3/aistruct_external.h:189:9`!: { |
| 1000 | int handle = ((goal_infocxx . . $ goal_info# *)arg_struct)->handlecxx . . $ goal_info#$anonymous_type_1#handle.; |
| 1001 | objectcxx . . $ object# *goal_obj = ObjGetcxx . . $ ObjGet(11672e354c0b263a).(handle); |
| 1002 | |
| 1003 | goal_ptr->g_infocxx . . $ goal#g_info..attach_infocxx . . $ goal_info#$anonymous_type_3#attach_info..flagscxx . . $ g_attach#flags. = 0; |
| 1004 | |
| 1005 | if (goal_obj) { |
| 1006 | goal_ptr->g_infocxx . . $ goal#g_info. =cxx . . $ goal_info#`operator=`(74e9191c78983bda). *((goal_infocxx . . $ goal_info# *)arg_struct); |
| 1007 | goal_ptr->g_infocxx . . $ goal#g_info..poscxx . . $ goal_info#$anonymous_type_2#pos. =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). goal_obj->poscxx . . $ object#pos.; |
| 1008 | int ignore_obj = OBJNUMcxx . . $ `Descent3/object.h:700:9`!(goal_obj); |
| 1009 | |
| 1010 | if (AIPathAllocPathcxx . . $ AIPathAllocPath(896bfa3f698eea41).(obj, ai_info, &ai_info->goalscxx . . $ ai_frame#goals.[goal_index], &obj->roomnumcxx . . $ object#roomnum., &obj->poscxx . . $ object#pos., &goal_obj->roomnumcxx . . $ object#roomnum., |
| 1011 | &goal_obj->poscxx . . $ object#pos., 0.0f, 0, obj->handlecxx . . $ object#handle., ignore_obj)) { |
| 1012 | goal_ptr->next_path_timecxx . . $ goal#next_path_time. = Gametimecxx . . $ Gametime. + MIN_NEXT_PATH_INTERVALcxx . . $ `Descent3/aistruct_external.h:338:9`! + ps_randcxx . . $ ps_rand(b126dc7c1de90089).() / (float)D3_RAND_MAXcxx . . $ `misc/psrand.h:41:9`!; |
| 1013 | } else { |
| 1014 | goal_ptr->next_path_timecxx . . $ goal#next_path_time. = Gametimecxx . . $ Gametime.; |
| 1015 | } |
| 1016 | } else |
| 1017 | goal_ptr->g_infocxx . . $ goal#g_info..handlecxx . . $ goal_info#$anonymous_type_1#handle. = OBJECT_HANDLE_NONEcxx . . $ `Descent3/object_external.h:156:9`!; |
| 1018 | } break; |
| 1019 | |
| 1020 | case AIG_ATTACH_TO_OBJcxx . . $ `Descent3/aistruct_external.h:184:9`!: { |
| 1021 | int handle = ((goal_infocxx . . $ goal_info# *)arg_struct)->handlecxx . . $ goal_info#$anonymous_type_1#handle.; |
| 1022 | objectcxx . . $ object# *goal_obj = ObjGetcxx . . $ ObjGet(11672e354c0b263a).(handle); |
| 1023 | |
| 1024 | goal_ptr->g_infocxx . . $ goal#g_info..attach_infocxx . . $ goal_info#$anonymous_type_3#attach_info..flagscxx . . $ g_attach#flags. = 0; |
| 1025 | |
| 1026 | if (goal_obj) { |
| 1027 | goal_ptr->g_infocxx . . $ goal#g_info. =cxx . . $ goal_info#`operator=`(74e9191c78983bda). *((goal_infocxx . . $ goal_info# *)arg_struct); |
| 1028 | goal_ptr->g_infocxx . . $ goal#g_info..poscxx . . $ goal_info#$anonymous_type_2#pos. =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). goal_obj->poscxx . . $ object#pos.; |
| 1029 | int ignore_obj = OBJNUMcxx . . $ `Descent3/object.h:700:9`!(goal_obj); |
| 1030 | |
| 1031 | if (AIPathAllocPathcxx . . $ AIPathAllocPath(896bfa3f698eea41).(obj, ai_info, &ai_info->goalscxx . . $ ai_frame#goals.[goal_index], &obj->roomnumcxx . . $ object#roomnum., &obj->poscxx . . $ object#pos., &goal_obj->roomnumcxx . . $ object#roomnum., |
| 1032 | &goal_obj->poscxx . . $ object#pos., 0.0f, 0, obj->handlecxx . . $ object#handle., ignore_obj)) { |
| 1033 | goal_ptr->next_path_timecxx . . $ goal#next_path_time. = Gametimecxx . . $ Gametime. + MIN_NEXT_PATH_INTERVALcxx . . $ `Descent3/aistruct_external.h:338:9`! + ps_randcxx . . $ ps_rand(b126dc7c1de90089).() / (float)D3_RAND_MAXcxx . . $ `misc/psrand.h:41:9`!; |
| 1034 | } else { |
| 1035 | goal_ptr->next_path_timecxx . . $ goal#next_path_time. = Gametimecxx . . $ Gametime.; |
| 1036 | } |
| 1037 | } else |
| 1038 | goal_ptr->g_infocxx . . $ goal#g_info..handlecxx . . $ goal_info#$anonymous_type_1#handle. = OBJECT_HANDLE_NONEcxx . . $ `Descent3/object_external.h:156:9`!; |
| 1039 | } break; |
| 1040 | |
| 1041 | case AIG_GET_TO_OBJcxx . . $ `Descent3/aistruct_external.h:183:9`!: { |
| 1042 | int handle = *((int *)arg_struct); |
| 1043 | objectcxx . . $ object# *goal_obj = ObjGetcxx . . $ ObjGet(11672e354c0b263a).(handle); |
| 1044 | |
| 1045 | if (goal_obj) { |
| 1046 | goal_ptr->g_infocxx . . $ goal#g_info..handlecxx . . $ goal_info#$anonymous_type_1#handle. = handle; |
| 1047 | goal_ptr->g_infocxx . . $ goal#g_info..poscxx . . $ goal_info#$anonymous_type_2#pos. =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). goal_obj->poscxx . . $ object#pos.; |
| 1048 | } else |
| 1049 | goal_ptr->g_infocxx . . $ goal#g_info..handlecxx . . $ goal_info#$anonymous_type_1#handle. = OBJECT_HANDLE_NONEcxx . . $ `Descent3/object_external.h:156:9`!; |
| 1050 | |
| 1051 | goal_ptr->next_path_timecxx . . $ goal#next_path_time. = Gametimecxx . . $ Gametime.; |
| 1052 | } break; |
| 1053 | |
| 1054 | case AIG_GET_TO_POScxx . . $ `Descent3/aistruct_external.h:201:9`!: { |
| 1055 | int roomnum = ((goal_infocxx . . $ goal_info# *)arg_struct)->roomnumcxx . . $ goal_info#$anonymous_type_1#roomnum.; |
| 1056 | vectorcxx . . $ vector# pos = ((goal_infocxx . . $ goal_info# *)arg_struct)->poscxx . . $ goal_info#$anonymous_type_2#pos.; |
| 1057 | |
| 1058 | goal_ptr->g_infocxx . . $ goal#g_info..poscxx . . $ goal_info#$anonymous_type_2#pos. =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). pos; |
| 1059 | goal_ptr->g_infocxx . . $ goal#g_info..roomnumcxx . . $ goal_info#$anonymous_type_1#roomnum. = roomnum; |
| 1060 | |
| 1061 | goal_ptr->next_path_timecxx . . $ goal#next_path_time. = Gametimecxx . . $ Gametime.; |
| 1062 | } break; |
| 1063 | |
| 1064 | case AIG_FOLLOW_PATHcxx . . $ `Descent3/aistruct_external.h:195:9`!: { |
| 1065 | path_informationcxx . . $ path_information# path_info = *((path_informationcxx . . $ path_information# *)arg_struct); |
| 1066 | |
| 1067 | goal_ptr->g_infocxx . . $ goal#g_info..idcxx . . $ goal_info#$anonymous_type_1#id. = path_info.path_idcxx . . $ path_information#path_id.; |
| 1068 | goal_ptr->g_infocxx . . $ goal#g_info..static_path_infocxx . . $ goal_info#$anonymous_type_3#static_path_info..cur_nodecxx . . $ g_static_path#cur_node. = path_info.next_nodecxx . . $ path_information#next_node.; |
| 1069 | goal_ptr->g_infocxx . . $ goal#g_info..static_path_infocxx . . $ goal_info#$anonymous_type_3#static_path_info..start_nodecxx . . $ g_static_path#start_node. = path_info.start_nodecxx . . $ path_information#start_node.; |
| 1070 | goal_ptr->g_infocxx . . $ goal#g_info..static_path_infocxx . . $ goal_info#$anonymous_type_3#static_path_info..end_nodecxx . . $ g_static_path#end_node. = path_info.end_nodecxx . . $ path_information#end_node.; |
| 1071 | |
| 1072 | goal_ptr->next_path_timecxx . . $ goal#next_path_time. = Gametimecxx . . $ Gametime.; |
| 1073 | } break; |
| 1074 | |
| 1075 | case AIG_FIRE_AT_OBJcxx . . $ `Descent3/aistruct_external.h:185:9`!: { |
| 1076 | gi_firecxx . . $ gi_fire# *attack_info = (gi_firecxx . . $ gi_fire# *)arg_struct; |
| 1077 | if (attack_info->cur_wbcxx . . $ gi_fire#cur_wb. > MAX_WBS_PER_OBJcxx . . $ `lib/robotfirestruct.h:32:9`!) { // DAJ |
| 1078 | mprintfcxx . . $ `ddebug/mono.h:82:9`!(2, "GoalAddGoal wb_index %d > MAX_WBS_PER_OBJ\n", attack_info->cur_wb); |
| 1079 | return 0; |
| 1080 | } |
| 1081 | if ((ai_info->animation_typecxx . . $ ai_frame#animation_type. == AS_ALERTcxx . . $ `Descent3/aistruct_external.h:409:9`! && !(ai_info->next_animation_typecxx . . $ ai_frame#next_animation_type. == AS_FLINCHcxx . . $ `Descent3/aistruct_external.h:421:9`!)) || |
| 1082 | ai_info->animation_typecxx . . $ ai_frame#animation_type. == AS_RANGED_RECOILcxx . . $ `Descent3/aistruct_external.h:443:9`!) { |
| 1083 | ai_info->current_wb_firingcxx . . $ ai_frame#current_wb_firing. = attack_info->cur_wbcxx . . $ gi_fire#cur_wb.; |
| 1084 | obj->dynamic_wbcxx . . $ object#dynamic_wb.[attack_info->cur_wbcxx . . $ gi_fire#cur_wb.].wb_anim_maskcxx . . $ dynamic_wb_info#wb_anim_mask. = attack_info->cur_maskcxx . . $ gi_fire#cur_mask.; |
| 1085 | |
| 1086 | obj->rtypecxx . . $ object#rtype..pobj_infocxx . . $ object#$anonymous_type_10#pobj_info..anim_flagscxx . . $ polyobj_info#anim_flags. |= AIAF_NOTIFYcxx . . $ `Descent3/aistruct_external.h:116:9`!; |
| 1087 | ai_info->next_animation_typecxx . . $ ai_frame#next_animation_type. = AS_RANGED_ATTACKcxx . . $ `Descent3/aistruct_external.h:442:9`!; |
| 1088 | |
| 1089 | if (Object_infocxx . . $ Object_info.[obj->idcxx . . $ object#id.].static_wbcxx . . $ object_info#static_wb.[attack_info->cur_wbcxx . . $ gi_fire#cur_wb.].flagscxx . . $ otype_wb_info#flags. & (WBF_SPRAYcxx . . $ `lib/robotfirestruct_external.h:27:9`! | WBF_ON_OFFcxx . . $ `lib/robotfirestruct_external.h:34:9`!)) { |
| 1090 | ai_info->last_special_wb_firingcxx . . $ ai_frame#last_special_wb_firing. = (char)attack_info->cur_wbcxx . . $ gi_fire#cur_wb.; |
| 1091 | } |
| 1092 | |
| 1093 | return 0; |
| 1094 | } else if (ai_info->animation_typecxx . . $ ai_frame#animation_type. == AS_IDLEcxx . . $ `Descent3/aistruct_external.h:419:9`!) { |
| 1095 | obj->rtypecxx . . $ object#rtype..pobj_infocxx . . $ object#$anonymous_type_10#pobj_info..anim_flagscxx . . $ polyobj_info#anim_flags. |= AIAF_NOTIFYcxx . . $ `Descent3/aistruct_external.h:116:9`!; |
| 1096 | ai_info->next_animation_typecxx . . $ ai_frame#next_animation_type. = AS_GOTO_ALERT_OFFSETcxx . . $ `Descent3/aistruct_external.h:439:9`! + ai_info->movement_typecxx . . $ ai_frame#movement_type.; |
| 1097 | } |
| 1098 | } break; |
| 1099 | |
| 1100 | case AIG_DO_MELEE_ANIMcxx . . $ `Descent3/aistruct_external.h:202:9`!: { |
| 1101 | gi_firecxx . . $ gi_fire# *attack_info = (gi_firecxx . . $ gi_fire# *)arg_struct; |
| 1102 | if ((ai_info->animation_typecxx . . $ ai_frame#animation_type. == AS_ALERTcxx . . $ `Descent3/aistruct_external.h:409:9`!) || (ai_info->animation_typecxx . . $ ai_frame#animation_type. == AS_MELEE1cxx . . $ `Descent3/aistruct_external.h:415:9`! + 1) || |
| 1103 | (ai_info->animation_typecxx . . $ ai_frame#animation_type. == AS_MELEE2cxx . . $ `Descent3/aistruct_external.h:417:9`! + 1)) { |
| 1104 | uint8_tcxx . . $ uint8_t# m_num = attack_info->melee_numbercxx . . $ gi_fire#melee_number.; |
| 1105 | char new_anim; |
| 1106 | |
| 1107 | if (m_num) |
| 1108 | new_anim = AS_MELEE1cxx . . $ `Descent3/aistruct_external.h:415:9`!; |
| 1109 | else |
| 1110 | new_anim = AS_MELEE2cxx . . $ `Descent3/aistruct_external.h:417:9`!; |
| 1111 | |
| 1112 | obj->rtypecxx . . $ object#rtype..pobj_infocxx . . $ object#$anonymous_type_10#pobj_info..anim_flagscxx . . $ polyobj_info#anim_flags. |= AIAF_NOTIFYcxx . . $ `Descent3/aistruct_external.h:116:9`!; |
| 1113 | ai_info->next_animation_typecxx . . $ ai_frame#next_animation_type. = new_anim; |
| 1114 | return 0; |
| 1115 | } else if (ai_info->animation_typecxx . . $ ai_frame#animation_type. == AS_IDLEcxx . . $ `Descent3/aistruct_external.h:419:9`!) { |
| 1116 | obj->rtypecxx . . $ object#rtype..pobj_infocxx . . $ object#$anonymous_type_10#pobj_info..anim_flagscxx . . $ polyobj_info#anim_flags. |= AIAF_NOTIFYcxx . . $ `Descent3/aistruct_external.h:116:9`!; |
| 1117 | ai_info->next_animation_typecxx . . $ ai_frame#next_animation_type. = AS_GOTO_ALERT_OFFSETcxx . . $ `Descent3/aistruct_external.h:439:9`! + ai_info->movement_typecxx . . $ ai_frame#movement_type.; |
| 1118 | } |
| 1119 | } break; |
| 1120 | |
| 1121 | case AIG_MELEE_TARGETcxx . . $ `Descent3/aistruct_external.h:186:9`!: |
| 1122 | break; |
| 1123 | |
| 1124 | case AIG_SET_ANIMcxx . . $ `Descent3/aistruct_external.h:196:9`!: { |
| 1125 | char new_anim = *((int *)arg_struct); |
| 1126 | polyobj_infocxx . . $ polyobj_info# *p_info = &obj->rtypecxx . . $ object#rtype..pobj_infocxx . . $ object#$anonymous_type_10#pobj_info.; |
| 1127 | |
| 1128 | // mprintf(0, "Anim Goal %d\n", new_anim); |
| 1129 | // Custom animations cannot be overriden |
| 1130 | if (ai_info->next_animation_typecxx . . $ ai_frame#next_animation_type. == AS_CUSTOMcxx . . $ `Descent3/aistruct_external.h:445:9`!) { |
| 1131 | return -1; |
| 1132 | } |
| 1133 | |
| 1134 | if (new_anim >= 0 && new_anim < NUM_ANIMS_PER_CLASScxx . . $ `Descent3/objinfo.h:369:9`!) { |
| 1135 | if ((Object_infocxx . . $ Object_info.[obj->idcxx . . $ object#id.].animcxx . . $ object_info#anim.[ai_info->movement_typecxx . . $ ai_frame#movement_type.].elemcxx . . $ anim_elem#elem.[ai_info->animation_typecxx . . $ ai_frame#animation_type.].fromcxx . . $ anim_entry#from. == |
| 1136 | Object_infocxx . . $ Object_info.[obj->idcxx . . $ object#id.].animcxx . . $ object_info#anim.[ai_info->movement_typecxx . . $ ai_frame#movement_type.].elemcxx . . $ anim_elem#elem.[new_anim].fromcxx . . $ anim_entry#from.) && |
| 1137 | (Object_infocxx . . $ Object_info.[obj->idcxx . . $ object#id.].animcxx . . $ object_info#anim.[ai_info->movement_typecxx . . $ ai_frame#movement_type.].elemcxx . . $ anim_elem#elem.[ai_info->animation_typecxx . . $ ai_frame#animation_type.].tocxx . . $ anim_entry#to. == |
| 1138 | Object_infocxx . . $ Object_info.[obj->idcxx . . $ object#id.].animcxx . . $ object_info#anim.[ai_info->movement_typecxx . . $ ai_frame#movement_type.].elemcxx . . $ anim_elem#elem.[new_anim].tocxx . . $ anim_entry#to.) && |
| 1139 | (Object_infocxx . . $ Object_info.[obj->idcxx . . $ object#id.].animcxx . . $ object_info#anim.[ai_info->movement_typecxx . . $ ai_frame#movement_type.].elemcxx . . $ anim_elem#elem.[ai_info->animation_typecxx . . $ ai_frame#animation_type.].tocxx . . $ anim_entry#to.) && |
| 1140 | (Object_infocxx . . $ Object_info.[obj->idcxx . . $ object#id.].animcxx . . $ object_info#anim.[ai_info->movement_typecxx . . $ ai_frame#movement_type.].elemcxx . . $ anim_elem#elem.[new_anim].tocxx . . $ anim_entry#to.)) { |
| 1141 | ai_info->next_animation_typecxx . . $ ai_frame#next_animation_type. = new_anim; |
| 1142 | AIUpdateAnimcxx . . $ AIUpdateAnim(419c470199a90a97).(obj); |
| 1143 | return 0; |
| 1144 | } |
| 1145 | } |
| 1146 | |
| 1147 | if (ai_info->animation_typecxx . . $ ai_frame#animation_type. == AS_ALERTcxx . . $ `Descent3/aistruct_external.h:409:9`!) { |
| 1148 | if (new_anim == AS_FLINCHcxx . . $ `Descent3/aistruct_external.h:421:9`!) // Get to flinch quickly |
| 1149 | { |
| 1150 | if (p_info->anim_end_framecxx . . $ polyobj_info#anim_end_frame. != p_info->anim_start_framecxx . . $ polyobj_info#anim_start_frame.) { |
| 1151 | float time_per_frame = p_info->anim_timecxx . . $ polyobj_info#anim_time. / (p_info->anim_end_framecxx . . $ polyobj_info#anim_end_frame. - p_info->anim_start_framecxx . . $ polyobj_info#anim_start_frame.); |
| 1152 | float time_left = time_per_frame * (p_info->anim_end_framecxx . . $ polyobj_info#anim_end_frame. - p_info->anim_framecxx . . $ polyobj_info#anim_frame.); |
| 1153 | |
| 1154 | if (time_left > MAX_BASH_TO_FLINCH_TIMEcxx . . $ `Descent3/AIGoal.cpp:486:9`!) { |
| 1155 | return -1; |
| 1156 | } |
| 1157 | } |
| 1158 | p_info->anim_timecxx . . $ polyobj_info#anim_time. /= BASH_TO_ANIM_SCALERcxx . . $ `Descent3/AIGoal.cpp:485:9`!; |
| 1159 | } else if (new_anim == AS_TAUNTcxx . . $ `Descent3/aistruct_external.h:422:9`!) { |
| 1160 | if (ai_info->next_animation_typecxx . . $ ai_frame#next_animation_type. != AI_INVALID_INDEXcxx . . $ `Descent3/aistruct.h:404:9`!) { |
| 1161 | return -1; |
| 1162 | } |
| 1163 | } else if (new_anim == AS_IDLEcxx . . $ `Descent3/aistruct_external.h:419:9`!) { |
| 1164 | new_anim = AS_GOTO_IDLE_OFFSETcxx . . $ `Descent3/aistruct_external.h:438:9`! + ai_info->movement_typecxx . . $ ai_frame#movement_type.; |
| 1165 | |
| 1166 | if (Object_infocxx . . $ Object_info.[obj->idcxx . . $ object#id.].animcxx . . $ object_info#anim.[ai_info->movement_typecxx . . $ ai_frame#movement_type.].elemcxx . . $ anim_elem#elem.[new_anim].tocxx . . $ anim_entry#to. == 0.0f) { |
| 1167 | return -1; |
| 1168 | } |
| 1169 | } |
| 1170 | |
| 1171 | obj->rtypecxx . . $ object#rtype..pobj_infocxx . . $ object#$anonymous_type_10#pobj_info..anim_flagscxx . . $ polyobj_info#anim_flags. |= AIAF_NOTIFYcxx . . $ `Descent3/aistruct_external.h:116:9`!; |
| 1172 | ai_info->next_animation_typecxx . . $ ai_frame#next_animation_type. = new_anim; |
| 1173 | return 0; |
| 1174 | } else if (ai_info->animation_typecxx . . $ ai_frame#animation_type. == AS_IDLEcxx . . $ `Descent3/aistruct_external.h:419:9`!) { |
| 1175 | if ((new_anim == AS_ALERTcxx . . $ `Descent3/aistruct_external.h:409:9`!) || |
| 1176 | (new_anim == AS_QUIRKcxx . . $ `Descent3/aistruct_external.h:420:9`! && Object_infocxx . . $ Object_info.[obj->idcxx . . $ object#id.].animcxx . . $ object_info#anim.[ai_info->movement_typecxx . . $ ai_frame#movement_type.].elemcxx . . $ anim_elem#elem.[new_anim].tocxx . . $ anim_entry#to. != 0.0f)) { |
| 1177 | obj->rtypecxx . . $ object#rtype..pobj_infocxx . . $ object#$anonymous_type_10#pobj_info..anim_flagscxx . . $ polyobj_info#anim_flags. |= AIAF_NOTIFYcxx . . $ `Descent3/aistruct_external.h:116:9`!; |
| 1178 | |
| 1179 | if (new_anim == AS_ALERTcxx . . $ `Descent3/aistruct_external.h:409:9`!) |
| 1180 | ai_info->next_animation_typecxx . . $ ai_frame#next_animation_type. = AS_GOTO_ALERT_OFFSETcxx . . $ `Descent3/aistruct_external.h:439:9`! + ai_info->movement_typecxx . . $ ai_frame#movement_type.; |
| 1181 | else |
| 1182 | ai_info->next_animation_typecxx . . $ ai_frame#next_animation_type. = new_anim; |
| 1183 | } |
| 1184 | return 0; |
| 1185 | } else if (ai_info->animation_typecxx . . $ ai_frame#animation_type. == AS_QUIRKcxx . . $ `Descent3/aistruct_external.h:420:9`! || ai_info->animation_typecxx . . $ ai_frame#animation_type. == AS_BIRTHcxx . . $ `Descent3/aistruct_external.h:411:9`!) { |
| 1186 | if (new_anim == AS_ALERTcxx . . $ `Descent3/aistruct_external.h:409:9`!) { |
| 1187 | ai_info->next_animation_typecxx . . $ ai_frame#next_animation_type. = AS_GOTO_ALERT_OFFSETcxx . . $ `Descent3/aistruct_external.h:439:9`! + ai_info->movement_typecxx . . $ ai_frame#movement_type.; |
| 1188 | return 0; |
| 1189 | } |
| 1190 | |
| 1191 | return -1; |
| 1192 | } |
| 1193 | } break; |
| 1194 | |
| 1195 | default: |
| 1196 | ASSERTcxx . . $ `misc/pserror.h:246:9`!(0); |
| 1197 | break; |
| 1198 | } |
| 1199 | |
| 1200 | // Do init. stuff |
| 1201 | if (goal_index != AI_INVALID_INDEXcxx . . $ `Descent3/aistruct.h:404:9`!) { |
| 1202 | if (OBJGOALcxx . . $ `Descent3/aistruct.h:668:9`!(&ai_info->goals[goal_index])) { |
| 1203 | goal_ptr->flagscxx . . $ goal#flags. |= GF_CIRCLE_OBJcxx . . $ `Descent3/aistruct_external.h:221:9`!; |
| 1204 | } else if (POSGOALcxx . . $ `Descent3/aistruct.h:674:9`!(&ai_info->goals[goal_index])) { |
| 1205 | goal_ptr->flagscxx . . $ goal#flags. |= GF_CIRCLE_POScxx . . $ `Descent3/aistruct_external.h:222:9`!; |
| 1206 | } |
| 1207 | |
| 1208 | if (TARGETONLYGOALcxx . . $ `Descent3/aistruct.h:675:9`!(&ai_info->goals[goal_index])) { |
| 1209 | goal_ptr->flagscxx . . $ goal#flags. |= GF_OBJ_IS_TARGETcxx . . $ `Descent3/aistruct_external.h:220:9`!; |
| 1210 | } |
| 1211 | |
| 1212 | if (goal_ptr->flagscxx . . $ goal#flags. & GF_OBJ_IS_TARGETcxx . . $ `Descent3/aistruct_external.h:220:9`!) { |
| 1213 | goal_ptr->g_infocxx . . $ goal#g_info..handlecxx . . $ goal_info#$anonymous_type_1#handle. = ai_info->target_handlecxx . . $ ai_frame#target_handle.; |
| 1214 | if (ai_info->status_regcxx . . $ ai_frame#status_reg. & AISR_CIRCLE_DISTcxx . . $ `Descent3/aistruct_external.h:396:9`!) { |
| 1215 | goal_ptr->status_regcxx . . $ goal#status_reg. |= AISR_CIRCLE_DISTcxx . . $ `Descent3/aistruct_external.h:396:9`!; |
| 1216 | } else { |
| 1217 | goal_ptr->status_regcxx . . $ goal#status_reg. &= ~AISR_CIRCLE_DISTcxx . . $ `Descent3/aistruct_external.h:396:9`!; |
| 1218 | } |
| 1219 | |
| 1220 | goal_ptr->dist_to_goalcxx . . $ goal#dist_to_goal. = ai_info->dist_to_target_actualcxx . . $ ai_frame#dist_to_target_actual.; |
| 1221 | } |
| 1222 | |
| 1223 | goalcxx . . $ goal# *cur_goal = GoalGetCurrentGoalcxx . . $ GoalGetCurrentGoal(6a99c6e9427d0d95).(obj); |
| 1224 | if (cur_goal != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`! && cur_goal == goal_ptr) { |
| 1225 | if (cur_goal->flagscxx . . $ goal#flags. & GF_FORCE_AWARENESScxx . . $ `Descent3/aistruct_external.h:224:9`!) { |
| 1226 | if (obj->ai_infocxx . . $ object#ai_info.->awarenesscxx . . $ ai_frame#awareness. < AWARE_MOSTLYcxx . . $ `Descent3/aistruct_external.h:324:9`!) |
| 1227 | obj->ai_infocxx . . $ object#ai_info.->awarenesscxx . . $ ai_frame#awareness. = AWARE_MOSTLYcxx . . $ `Descent3/aistruct_external.h:324:9`!; |
| 1228 | } |
| 1229 | } |
| 1230 | } |
| 1231 | |
| 1232 | return goal_index; |
| 1233 | } |
| 1234 | |
| 1235 | int GoalAddEnablercxx . . $ GoalAddEnabler(abecc65ce55ccb39).(objectcxx . . $ object# *obj, int goal_index, uint8_tcxx . . $ uint8_t# enabler_type, void *arg_struct, float percent, float interval) { |
| 1236 | ai_framecxx . . $ ai_frame# *ai_info = obj->ai_infocxx . . $ object#ai_info.; |
| 1237 | goal_enablercxx . . $ goal_enabler# *e_info; |
| 1238 | |
| 1239 | int enabler_index = ai_info->goalscxx . . $ ai_frame#goals.[goal_index].num_enablerscxx . . $ goal#num_enablers.; |
| 1240 | |
| 1241 | if (ai_info->goalscxx . . $ ai_frame#goals.[goal_index].num_enablerscxx . . $ goal#num_enablers. >= MAX_ENABLERS_PER_GOALcxx . . $ `Descent3/aistruct_external.h:131:9`!) { |
| 1242 | mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "Object %d with goal %d has to many enablers\n", OBJNUM(obj), goal_index); |
| 1243 | return AI_INVALID_INDEXcxx . . $ `Descent3/aistruct.h:404:9`!; |
| 1244 | } |
| 1245 | |
| 1246 | e_info = &ai_info->goalscxx . . $ ai_frame#goals.[goal_index].enablercxx . . $ goal#enabler.[enabler_index]; |
| 1247 | |
| 1248 | e_info->enabler_typecxx . . $ goal_enabler#enabler_type. = enabler_type; |
| 1249 | e_info->percent_enablecxx . . $ goal_enabler#percent_enable. = percent; |
| 1250 | e_info->check_intervalcxx . . $ goal_enabler#check_interval. = interval; |
| 1251 | e_info->last_check_timecxx . . $ goal_enabler#last_check_time. = Gametimecxx . . $ Gametime.; |
| 1252 | |
| 1253 | // Hmmm... What about 2 seconds to be enabled???? I think it is possible --chrishack |
| 1254 | switch (enabler_type) { |
| 1255 | case (AIE_AI_STATUS_FLAGcxx . . $ `Descent3/aistruct_external.h:161:9`!): |
| 1256 | e_info->flagscxx . . $ goal_enabler#$anonymous_type_0#flags. = *((int *)arg_struct); |
| 1257 | break; |
| 1258 | case (AIE_NEARcxx . . $ `Descent3/aistruct_external.h:155:9`!): |
| 1259 | case (AIE_FARcxx . . $ `Descent3/aistruct_external.h:156:9`!): |
| 1260 | e_info->distcxx . . $ goal_enabler#$anonymous_type_0#dist. = *((float *)arg_struct); |
| 1261 | break; |
| 1262 | case (AIE_SCRIPTEDcxx . . $ `Descent3/aistruct_external.h:162:9`!): |
| 1263 | break; |
| 1264 | case (AIE_GT_AWARENESScxx . . $ `Descent3/aistruct_external.h:158:9`!): |
| 1265 | case (AIE_LTE_AWARENESScxx . . $ `Descent3/aistruct_external.h:157:9`!): |
| 1266 | e_info->awarenesscxx . . $ goal_enabler#$anonymous_type_0#awareness. = *((float *)arg_struct); |
| 1267 | break; |
| 1268 | case (AIE_GT_LAST_SEE_TARGET_INTERVALcxx . . $ `Descent3/aistruct_external.h:160:9`!): |
| 1269 | case (AIE_LTE_LAST_SEE_TARGET_INTERVALcxx . . $ `Descent3/aistruct_external.h:159:9`!): |
| 1270 | e_info->timecxx . . $ goal_enabler#$anonymous_type_0#time. = *((float *)arg_struct); |
| 1271 | break; |
| 1272 | case (AIE_FEARcxx . . $ `Descent3/aistruct_external.h:163:9`!): |
| 1273 | e_info->float_valuecxx . . $ goal_enabler#$anonymous_type_0#float_value. = *((float *)arg_struct); |
| 1274 | break; |
| 1275 | case (AIE_ANGRYcxx . . $ `Descent3/aistruct_external.h:164:9`!): |
| 1276 | e_info->float_valuecxx . . $ goal_enabler#$anonymous_type_0#float_value. = *((float *)arg_struct); |
| 1277 | break; |
| 1278 | case (AIE_CURIOUScxx . . $ `Descent3/aistruct_external.h:165:9`!): |
| 1279 | e_info->float_valuecxx . . $ goal_enabler#$anonymous_type_0#float_value. = *((float *)arg_struct); |
| 1280 | break; |
| 1281 | case (AIE_FRUSTRATEDcxx . . $ `Descent3/aistruct_external.h:166:9`!): |
| 1282 | e_info->float_valuecxx . . $ goal_enabler#$anonymous_type_0#float_value. = *((float *)arg_struct); |
| 1283 | break; |
| 1284 | case (AIE_DELAY_TIMEcxx . . $ `Descent3/aistruct_external.h:167:9`!): |
| 1285 | e_info->timecxx . . $ goal_enabler#$anonymous_type_0#time. = *((float *)arg_struct); |
| 1286 | break; |
| 1287 | case (AIE_CLEAR_TIMEcxx . . $ `Descent3/aistruct_external.h:168:9`!): |
| 1288 | e_info->timecxx . . $ goal_enabler#$anonymous_type_0#time. = *((float *)arg_struct); |
| 1289 | break; |
| 1290 | default: |
| 1291 | ASSERTcxx . . $ `misc/pserror.h:246:9`!(0); |
| 1292 | break; |
| 1293 | } |
| 1294 | |
| 1295 | ai_info->goalscxx . . $ ai_frame#goals.[goal_index].num_enablerscxx . . $ goal#num_enablers.++; |
| 1296 | |
| 1297 | return enabler_index; |
| 1298 | } |
| 1299 | |
| 1300 | void GoalInitTypeGoalscxx . . $ GoalInitTypeGoals(766a1b7183ffa4b4).(objectcxx . . $ object# *obj, int ai_type) { |
| 1301 | ai_framecxx . . $ ai_frame# *ai_info = obj->ai_infocxx . . $ object#ai_info.; |
| 1302 | float aware = AWARE_BARELYcxx . . $ `Descent3/aistruct_external.h:326:9`!; |
| 1303 | float time = 25.0f; |
| 1304 | |
| 1305 | GoalClearAllcxx . . $ GoalClearAll(419c470199a90a97).(obj); |
| 1306 | |
| 1307 | // This goal has a proirity of 50. Mabye I should split up intermediate goals |
| 1308 | // and long term goals. -- Wander around within 2000 units of your starting |
| 1309 | // position (goal has priority of 100) The AI type decides what to do with |
| 1310 | // a goal when it is done. |
| 1311 | switch (ai_type) { |
| 1312 | case AIT_STALKERcxx . . $ `Descent3/aistruct_external.h:75:9`!: { |
| 1313 | int goal_room; |
| 1314 | |
| 1315 | goal_room = obj->roomnumcxx . . $ object#roomnum.; |
| 1316 | |
| 1317 | GoalAddGoalcxx . . $ GoalAddGoal(e0a3c222b6aee5c7).(obj, AIG_WANDER_AROUNDcxx . . $ `Descent3/aistruct_external.h:187:9`!, (void *)&goal_room, 1, 1.0f, GF_NONFLUSHABLEcxx . . $ `Descent3/aistruct_external.h:216:9`! | GF_KEEP_AT_COMPLETIONcxx . . $ `Descent3/aistruct_external.h:218:9`!); |
| 1318 | // GoalAddEnabler(obj, 1, AIE_GT_AWARENESS, (void *)&aware, 1.0, 0.0); |
| 1319 | // GoalAddEnabler(obj, 1, AIE_LTE_LAST_SEE_TARGET_INTERVAL, (void *)&time, 1.0, 0.0); |
| 1320 | } break; |
| 1321 | |
| 1322 | case AIT_EVADER2cxx . . $ `Descent3/aistruct_external.h:77:9`!: { |
| 1323 | goal_infocxx . . $ goal_info# g_info; |
| 1324 | |
| 1325 | g_info.roomnumcxx . . $ goal_info#$anonymous_type_1#roomnum. = obj->roomnumcxx . . $ object#roomnum.; |
| 1326 | g_info.poscxx . . $ goal_info#$anonymous_type_2#pos. =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). obj->poscxx . . $ object#pos.; |
| 1327 | |
| 1328 | GoalAddGoalcxx . . $ GoalAddGoal(e0a3c222b6aee5c7).(obj, AIG_GUARD_AREAcxx . . $ `Descent3/aistruct_external.h:191:9`!, (void *)&g_info, 1, 1.0f, GF_NONFLUSHABLEcxx . . $ `Descent3/aistruct_external.h:216:9`!); |
| 1329 | obj->ai_infocxx . . $ object#ai_info.->goalscxx . . $ ai_frame#goals.[1].circle_distancecxx . . $ goal#circle_distance. = obj->sizecxx . . $ object#size. * 2.0f; |
| 1330 | GoalAddEnablercxx . . $ GoalAddEnabler(abecc65ce55ccb39).(obj, 1, AIE_GT_AWARENESScxx . . $ `Descent3/aistruct_external.h:158:9`!, (void *)&aware, 1.0, 0.0); |
| 1331 | GoalAddEnablercxx . . $ GoalAddEnabler(abecc65ce55ccb39).(obj, 1, AIE_LTE_LAST_SEE_TARGET_INTERVALcxx . . $ `Descent3/aistruct_external.h:159:9`!, (void *)&time, 1.0, 0.0); |
| 1332 | |
| 1333 | int handle = OBJECT_HANDLE_NONEcxx . . $ `Descent3/object_external.h:156:9`!; |
| 1334 | |
| 1335 | int gi = GoalAddGoalcxx . . $ GoalAddGoal(e0a3c222b6aee5c7).(obj, AIG_GET_AROUND_OBJcxx . . $ `Descent3/aistruct_external.h:203:9`!, (void *)&handle, ACTIVATION_BLEND_LEVELcxx . . $ `Descent3/aistruct_external.h:280:9`!, 3.0f, |
| 1336 | GF_NONFLUSHABLEcxx . . $ `Descent3/aistruct_external.h:216:9`! | GF_OBJ_IS_TARGETcxx . . $ `Descent3/aistruct_external.h:220:9`!); |
| 1337 | if (gi != -1) { // DAJ -1FIX |
| 1338 | float temp = ai_info->circle_distancecxx . . $ ai_frame#circle_distance.; |
| 1339 | GoalAddEnablercxx . . $ GoalAddEnabler(abecc65ce55ccb39).(obj, gi, AIE_NEARcxx . . $ `Descent3/aistruct_external.h:155:9`!, (void *)&temp, 1.0, 0.0); |
| 1340 | ai_info->goalscxx . . $ ai_frame#goals.[gi].circle_distancecxx . . $ goal#circle_distance. = ai_info->circle_distancecxx . . $ ai_frame#circle_distance.; |
| 1341 | } |
| 1342 | } break; |
| 1343 | |
| 1344 | case AIT_EVADER1cxx . . $ `Descent3/aistruct_external.h:76:9`!: { |
| 1345 | goal_infocxx . . $ goal_info# g_info; |
| 1346 | g_info.handlecxx . . $ goal_info#$anonymous_type_1#handle. = ai_info->target_handlecxx . . $ ai_frame#target_handle.; |
| 1347 | |
| 1348 | GoalAddGoalcxx . . $ GoalAddGoal(e0a3c222b6aee5c7).(obj, AIG_MOVE_RELATIVE_OBJcxx . . $ `Descent3/aistruct_external.h:200:9`!, (void *)&g_info, 1, 1.0f, GF_SPEED_ATTACKcxx . . $ `Descent3/aistruct_external.h:252:9`! | GF_NONFLUSHABLEcxx . . $ `Descent3/aistruct_external.h:216:9`!); |
| 1349 | GoalAddEnablercxx . . $ GoalAddEnabler(abecc65ce55ccb39).(obj, 1, AIE_GT_AWARENESScxx . . $ `Descent3/aistruct_external.h:158:9`!, (void *)&aware, 1.0, 0.0); |
| 1350 | GoalAddEnablercxx . . $ GoalAddEnabler(abecc65ce55ccb39).(obj, 1, AIE_LTE_LAST_SEE_TARGET_INTERVALcxx . . $ `Descent3/aistruct_external.h:159:9`!, (void *)&time, 1.0, 0.0); |
| 1351 | ai_info->goalscxx . . $ ai_frame#goals.[1].flagscxx . . $ goal#flags. |= GF_OBJ_IS_TARGETcxx . . $ `Descent3/aistruct_external.h:220:9`!; |
| 1352 | |
| 1353 | if (ai_info->circle_distancecxx . . $ ai_frame#circle_distance. > 0.0f) { |
| 1354 | int handle = OBJECT_HANDLE_NONEcxx . . $ `Descent3/object_external.h:156:9`!; |
| 1355 | int gi = GoalAddGoalcxx . . $ GoalAddGoal(e0a3c222b6aee5c7).(obj, AIG_GET_AROUND_OBJcxx . . $ `Descent3/aistruct_external.h:203:9`!, (void *)&handle, ACTIVATION_BLEND_LEVELcxx . . $ `Descent3/aistruct_external.h:280:9`!, 3.0f, |
| 1356 | GF_NONFLUSHABLEcxx . . $ `Descent3/aistruct_external.h:216:9`! | GF_OBJ_IS_TARGETcxx . . $ `Descent3/aistruct_external.h:220:9`!); |
| 1357 | if (gi != -1) { // DAJ -1FIX |
| 1358 | float temp = ai_info->circle_distancecxx . . $ ai_frame#circle_distance. * 0.55f; |
| 1359 | GoalAddEnablercxx . . $ GoalAddEnabler(abecc65ce55ccb39).(obj, gi, AIE_NEARcxx . . $ `Descent3/aistruct_external.h:155:9`!, (void *)&temp, 1.0, 0.0); |
| 1360 | ai_info->goalscxx . . $ ai_frame#goals.[gi].circle_distancecxx . . $ goal#circle_distance. = ai_info->circle_distancecxx . . $ ai_frame#circle_distance. * 0.55f; |
| 1361 | } |
| 1362 | } |
| 1363 | } break; |
| 1364 | |
| 1365 | case AIT_MELEE1cxx . . $ `Descent3/aistruct_external.h:80:9`!: { |
| 1366 | goal_infocxx . . $ goal_info# g_info; |
| 1367 | int flags = AISR_MELEEcxx . . $ `Descent3/aistruct_external.h:398:9`!; |
| 1368 | int m_goal; |
| 1369 | |
| 1370 | g_info.handlecxx . . $ goal_info#$anonymous_type_1#handle. = ai_info->target_handlecxx . . $ ai_frame#target_handle.; |
| 1371 | |
| 1372 | GoalAddGoalcxx . . $ GoalAddGoal(e0a3c222b6aee5c7).(obj, AIG_MOVE_RELATIVE_OBJcxx . . $ `Descent3/aistruct_external.h:200:9`!, (void *)&g_info, 1, 1.0f, |
| 1373 | GF_NONFLUSHABLEcxx . . $ `Descent3/aistruct_external.h:216:9`! | GF_OBJ_IS_TARGETcxx . . $ `Descent3/aistruct_external.h:220:9`! | GF_KEEP_AT_COMPLETIONcxx . . $ `Descent3/aistruct_external.h:218:9`!); |
| 1374 | GoalAddEnablercxx . . $ GoalAddEnabler(abecc65ce55ccb39).(obj, 1, AIE_GT_AWARENESScxx . . $ `Descent3/aistruct_external.h:158:9`!, (void *)&aware, 1.0, 0.0); |
| 1375 | GoalAddEnablercxx . . $ GoalAddEnabler(abecc65ce55ccb39).(obj, 1, AIE_LTE_LAST_SEE_TARGET_INTERVALcxx . . $ `Descent3/aistruct_external.h:159:9`!, (void *)&time, 1.0, 0.0); |
| 1376 | |
| 1377 | GoalAddGoalcxx . . $ GoalAddGoal(e0a3c222b6aee5c7).(obj, AIG_GET_TO_OBJcxx . . $ `Descent3/aistruct_external.h:183:9`!, (void *)&ai_info->target_handlecxx . . $ ai_frame#target_handle., 2, 1.0f, |
| 1378 | GF_SPEED_ATTACKcxx . . $ `Descent3/aistruct_external.h:252:9`! | GF_NONFLUSHABLEcxx . . $ `Descent3/aistruct_external.h:216:9`! | GF_OBJ_IS_TARGETcxx . . $ `Descent3/aistruct_external.h:220:9`! | GF_USE_BLINE_IF_SEES_GOALcxx . . $ `Descent3/aistruct_external.h:223:9`! | |
| 1379 | GF_KEEP_AT_COMPLETIONcxx . . $ `Descent3/aistruct_external.h:218:9`!); |
| 1380 | GoalAddEnablercxx . . $ GoalAddEnabler(abecc65ce55ccb39).(obj, 2, AIE_AI_STATUS_FLAGcxx . . $ `Descent3/aistruct_external.h:161:9`!, (void *)&flags, 1.0, 0.0); |
| 1381 | ai_info->goalscxx . . $ ai_frame#goals.[2].circle_distancecxx . . $ goal#circle_distance. = -100.0f; |
| 1382 | GoalAddEnablercxx . . $ GoalAddEnabler(abecc65ce55ccb39).(obj, 2, AIE_GT_AWARENESScxx . . $ `Descent3/aistruct_external.h:158:9`!, (void *)&aware, 1.0, 0.0); |
| 1383 | GoalAddEnablercxx . . $ GoalAddEnabler(abecc65ce55ccb39).(obj, 2, AIE_LTE_LAST_SEE_TARGET_INTERVALcxx . . $ `Descent3/aistruct_external.h:159:9`!, (void *)&time, 1.0, 0.0); |
| 1384 | |
| 1385 | m_goal = GoalAddGoalcxx . . $ GoalAddGoal(e0a3c222b6aee5c7).(obj, AIG_MELEE_TARGETcxx . . $ `Descent3/aistruct_external.h:186:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, ACTIVATION_BLEND_LEVELcxx . . $ `Descent3/aistruct_external.h:280:9`!, 1.0f, GF_NONFLUSHABLEcxx . . $ `Descent3/aistruct_external.h:216:9`!); |
| 1386 | if (m_goal != -1) { // DAJ -1FIX |
| 1387 | ai_info->goalscxx . . $ ai_frame#goals.[m_goal].flagscxx . . $ goal#flags. |= GF_OBJ_IS_TARGETcxx . . $ `Descent3/aistruct_external.h:220:9`! | GF_KEEP_AT_COMPLETIONcxx . . $ `Descent3/aistruct_external.h:218:9`!; |
| 1388 | GoalAddEnablercxx . . $ GoalAddEnabler(abecc65ce55ccb39).(obj, m_goal, AIE_GT_AWARENESScxx . . $ `Descent3/aistruct_external.h:158:9`!, (void *)&aware, 1.0, 0.0); |
| 1389 | GoalAddEnablercxx . . $ GoalAddEnabler(abecc65ce55ccb39).(obj, m_goal, AIE_LTE_LAST_SEE_TARGET_INTERVALcxx . . $ `Descent3/aistruct_external.h:159:9`!, (void *)&time, 1.0, 0.0); |
| 1390 | } |
| 1391 | } break; |
| 1392 | |
| 1393 | case AIT_BIRD_FLOCK1cxx . . $ `Descent3/aistruct_external.h:81:9`!: { |
| 1394 | } break; |
| 1395 | |
| 1396 | case AIT_HERD1cxx . . $ `Descent3/aistruct_external.h:82:9`!: { |
| 1397 | } break; |
| 1398 | |
| 1399 | case AIT_STATIONARY_TURRETcxx . . $ `Descent3/aistruct_external.h:78:9`!: |
| 1400 | break; |
| 1401 | |
| 1402 | case AIT_AIScxx . . $ `Descent3/aistruct_external.h:79:9`!: |
| 1403 | break; |
| 1404 | |
| 1405 | case AIT_FLYLANDERcxx . . $ `Descent3/aistruct_external.h:74:9`!: |
| 1406 | break; |
| 1407 | |
| 1408 | default: { |
| 1409 | Int3cxx . . $ `misc/pserror.h:247:9`!(); |
| 1410 | } |
| 1411 | } |
| 1412 | } |
| 1413 | |
| 1414 | bool GoalIsGoalEnabledcxx . . $ GoalIsGoalEnabled(9985ed114f2bfc78).(objectcxx . . $ object# *obj, int goal_index) { |
| 1415 | ai_framecxx . . $ ai_frame# *ai_info = obj->ai_infocxx . . $ object#ai_info.; |
| 1416 | goalcxx . . $ goal# *cur_goal = &ai_info->goalscxx . . $ ai_frame#goals.[goal_index]; |
| 1417 | bool f_enabled = true; |
| 1418 | int i; |
| 1419 | goal_enablercxx . . $ goal_enabler# *e_info = &cur_goal->enablercxx . . $ goal#enabler.[0]; |
| 1420 | |
| 1421 | ASSERTcxx . . $ `misc/pserror.h:246:9`!(goal_index >= 0 && goal_index < MAX_GOALScxx . . $ `Descent3/aistruct_external.h:178:9`!); |
| 1422 | |
| 1423 | if (OBJGOALcxx . . $ `Descent3/aistruct.h:668:9`!(cur_goal)) { |
| 1424 | objectcxx . . $ object# *gobj = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 1425 | |
| 1426 | if (cur_goal->flagscxx . . $ goal#flags. & GF_OBJ_IS_TARGETcxx . . $ `Descent3/aistruct_external.h:220:9`!) { |
| 1427 | gobj = ObjGetcxx . . $ ObjGet(11672e354c0b263a).(obj->ai_infocxx . . $ object#ai_info.->target_handlecxx . . $ ai_frame#target_handle.); |
| 1428 | } else if (cur_goal->flagscxx . . $ goal#flags. & (GF_OBJS_ARE_SPECIEScxx . . $ `Descent3/aistruct_external.h:226:9`! | GF_OBJS_ARE_ENEMIEScxx . . $ `Descent3/aistruct_external.h:227:9`! | GF_OBJS_ARE_FRIENDScxx . . $ `Descent3/aistruct_external.h:225:9`!)) { |
| 1429 | bool done = false; |
| 1430 | |
| 1431 | if (cur_goal->flagscxx . . $ goal#flags. & (GF_OBJS_ARE_SPECIEScxx . . $ `Descent3/aistruct_external.h:226:9`! | GF_OBJS_ARE_FRIENDScxx . . $ `Descent3/aistruct_external.h:225:9`!)) { |
| 1432 | // chrishack -- not done |
| 1433 | } |
| 1434 | } else { |
| 1435 | gobj = ObjGetcxx . . $ ObjGet(11672e354c0b263a).(cur_goal->g_infocxx . . $ goal#g_info..handlecxx . . $ goal_info#$anonymous_type_1#handle.); |
| 1436 | } |
| 1437 | |
| 1438 | if (gobj == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`! && cur_goal->typecxx . . $ goal#type. == AIG_DODGE_OBJcxx . . $ `Descent3/aistruct_external.h:194:9`!) |
| 1439 | return true; |
| 1440 | |
| 1441 | if (!gobj || gobj->typecxx . . $ object#type. == OBJ_GHOSTcxx . . $ `Descent3/object_external.h:172:9`! || (gobj->flagscxx . . $ object#flags. & (OF_DYINGcxx . . $ `Descent3/object_external.h:282:9`! | OF_DESTROYEDcxx . . $ `Descent3/object_external.h:271:9`!)) || |
| 1442 | (gobj->typecxx . . $ object#type. == OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`! && Playerscxx . . $ Players.[gobj->idcxx . . $ object#id.].flagscxx . . $ player#flags. & (PLAYER_FLAGS_DEADcxx . . $ `Descent3/player_external.h:81:9`! + PLAYER_FLAGS_DYINGcxx . . $ `Descent3/player_external.h:80:9`!))) { |
| 1443 | return false; |
| 1444 | } |
| 1445 | } |
| 1446 | |
| 1447 | if (cur_goal->typecxx . . $ goal#type. == AIG_MELEE_TARGETcxx . . $ `Descent3/aistruct_external.h:186:9`!) { |
| 1448 | if (ai_info->flagscxx . . $ ai_frame#flags. & AIF_DISABLE_MELEEcxx . . $ `Descent3/aistruct_external.h:375:9`!) { |
| 1449 | return false; |
| 1450 | } |
| 1451 | } |
| 1452 | |
| 1453 | if (cur_goal->num_enablerscxx . . $ goal#num_enablers. == 0) { |
| 1454 | return true; |
| 1455 | } |
| 1456 | |
| 1457 | for (i = 0; i < cur_goal->num_enablerscxx . . $ goal#num_enablers.; i++) { |
| 1458 | // Hmmm... What about 2 seconds to be enabled???? I think it is possible --chrishack |
| 1459 | switch (e_info->enabler_typecxx . . $ goal_enabler#enabler_type.) { |
| 1460 | case (AIE_AI_STATUS_FLAGcxx . . $ `Descent3/aistruct_external.h:161:9`!): |
| 1461 | f_enabled = ((e_info->flagscxx . . $ goal_enabler#$anonymous_type_0#flags.) & (ai_info->status_regcxx . . $ ai_frame#status_reg.)) != 0; |
| 1462 | break; |
| 1463 | |
| 1464 | case (AIE_NEARcxx . . $ `Descent3/aistruct_external.h:155:9`!): { |
| 1465 | float a_dist = e_info->distcxx . . $ goal_enabler#$anonymous_type_0#dist.; |
| 1466 | f_enabled = (cur_goal->dist_to_goalcxx . . $ goal#dist_to_goal. <= a_dist) != 0; |
| 1467 | } break; |
| 1468 | case (AIE_FARcxx . . $ `Descent3/aistruct_external.h:156:9`!): { |
| 1469 | float a_dist = e_info->distcxx . . $ goal_enabler#$anonymous_type_0#dist.; |
| 1470 | f_enabled = (cur_goal->dist_to_goalcxx . . $ goal#dist_to_goal. >= a_dist) != 0; |
| 1471 | } break; |
| 1472 | case (AIE_SCRIPTEDcxx . . $ `Descent3/aistruct_external.h:162:9`!): { |
| 1473 | notifycxx . . $ notify# se_info; |
| 1474 | se_info.goal_numcxx . . $ notify#$anonymous_type_5#goal_num. = goal_index; |
| 1475 | se_info.enabler_numcxx . . $ notify#$anonymous_type_6#enabler_num. = i; |
| 1476 | |
| 1477 | f_enabled = AINotifycxx . . $ AINotify(f32b5964aaa42c22).(obj, AIN_SCRIPTED_ENABLERcxx . . $ `Descent3/aistruct_external.h:305:9`!, &se_info); |
| 1478 | } break; |
| 1479 | case (AIE_GT_AWARENESScxx . . $ `Descent3/aistruct_external.h:158:9`!): { |
| 1480 | f_enabled = (ai_info->awarenesscxx . . $ ai_frame#awareness. > e_info->awarenesscxx . . $ goal_enabler#$anonymous_type_0#awareness.); |
| 1481 | } break; |
| 1482 | case (AIE_LTE_AWARENESScxx . . $ `Descent3/aistruct_external.h:157:9`!): { |
| 1483 | f_enabled = (ai_info->awarenesscxx . . $ ai_frame#awareness. <= e_info->awarenesscxx . . $ goal_enabler#$anonymous_type_0#awareness.); |
| 1484 | } break; |
| 1485 | case (AIE_LTE_LAST_SEE_TARGET_INTERVALcxx . . $ `Descent3/aistruct_external.h:159:9`!): { |
| 1486 | f_enabled = (Gametimecxx . . $ Gametime. - ai_info->last_see_target_timecxx . . $ ai_frame#last_see_target_time. <= e_info->timecxx . . $ goal_enabler#$anonymous_type_0#time.) || |
| 1487 | (Gametimecxx . . $ Gametime. - ai_info->last_hear_target_timecxx . . $ ai_frame#last_hear_target_time. <= e_info->timecxx . . $ goal_enabler#$anonymous_type_0#time.); |
| 1488 | } break; |
| 1489 | case (AIE_GT_LAST_SEE_TARGET_INTERVALcxx . . $ `Descent3/aistruct_external.h:160:9`!): { |
| 1490 | f_enabled = (Gametimecxx . . $ Gametime. - ai_info->last_see_target_timecxx . . $ ai_frame#last_see_target_time. > e_info->timecxx . . $ goal_enabler#$anonymous_type_0#time.) || |
| 1491 | (Gametimecxx . . $ Gametime. - ai_info->last_hear_target_timecxx . . $ ai_frame#last_hear_target_time. > e_info->timecxx . . $ goal_enabler#$anonymous_type_0#time.); |
| 1492 | } break; |
| 1493 | case (AIE_FEARcxx . . $ `Descent3/aistruct_external.h:163:9`!): { |
| 1494 | f_enabled = e_info->float_valuecxx . . $ goal_enabler#$anonymous_type_0#float_value. <= ai_info->cur_life_preservationcxx . . $ ai_frame#cur_life_preservation.; |
| 1495 | } break; |
| 1496 | case (AIE_ANGRYcxx . . $ `Descent3/aistruct_external.h:164:9`!): { |
| 1497 | f_enabled = e_info->float_valuecxx . . $ goal_enabler#$anonymous_type_0#float_value. <= ai_info->cur_agressioncxx . . $ ai_frame#cur_agression.; |
| 1498 | } break; |
| 1499 | case (AIE_CURIOUScxx . . $ `Descent3/aistruct_external.h:165:9`!): { |
| 1500 | f_enabled = e_info->float_valuecxx . . $ goal_enabler#$anonymous_type_0#float_value. <= ai_info->cur_curiousitycxx . . $ ai_frame#cur_curiousity.; |
| 1501 | } break; |
| 1502 | case (AIE_FRUSTRATEDcxx . . $ `Descent3/aistruct_external.h:166:9`!): { |
| 1503 | f_enabled = e_info->float_valuecxx . . $ goal_enabler#$anonymous_type_0#float_value. <= ai_info->cur_frustrationcxx . . $ ai_frame#cur_frustration.; |
| 1504 | } break; |
| 1505 | case (AIE_DELAY_TIMEcxx . . $ `Descent3/aistruct_external.h:167:9`!): { |
| 1506 | f_enabled = e_info->timecxx . . $ goal_enabler#$anonymous_type_0#time. < Gametimecxx . . $ Gametime. - cur_goal->creation_timecxx . . $ goal#creation_time.; |
| 1507 | } break; |
| 1508 | case (AIE_CLEAR_TIMEcxx . . $ `Descent3/aistruct_external.h:168:9`!): { |
| 1509 | f_enabled = e_info->timecxx . . $ goal_enabler#$anonymous_type_0#time. >= Gametimecxx . . $ Gametime. - cur_goal->creation_timecxx . . $ goal#creation_time.; |
| 1510 | if (!f_enabled) { |
| 1511 | GoalClearGoalcxx . . $ GoalClearGoal(5f6922bcf6358e70).(obj, cur_goal); |
| 1512 | } |
| 1513 | } break; |
| 1514 | default: |
| 1515 | ASSERTcxx . . $ `misc/pserror.h:246:9`!(0); |
| 1516 | break; |
| 1517 | } |
| 1518 | |
| 1519 | // We are currently and'ing enablers |
| 1520 | if (f_enabled == false) |
| 1521 | break; |
| 1522 | |
| 1523 | e_info++; |
| 1524 | } |
| 1525 | |
| 1526 | return f_enabled; |
| 1527 | } |
| 1528 | |
| 1529 | goalcxx . . $ goal# *GoalGetCurrentGoalcxx . . $ GoalGetCurrentGoal(6a99c6e9427d0d95).(objectcxx . . $ object# *obj) { |
| 1530 | ai_framecxx . . $ ai_frame# *ai_info = obj->ai_infocxx . . $ object#ai_info.; |
| 1531 | int i; |
| 1532 | goalcxx . . $ goal# *cur_goal = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 1533 | |
| 1534 | for (i = NUM_ACTIVATION_LEVELScxx . . $ `Descent3/aistruct_external.h:279:9`! - 1; i >= 0; i--) { |
| 1535 | if (ai_info->goalscxx . . $ ai_frame#goals.[i].usedcxx . . $ goal#used. && GoalIsGoalEnabledcxx . . $ GoalIsGoalEnabled(9985ed114f2bfc78).(obj, i)) { |
| 1536 | cur_goal = &ai_info->goalscxx . . $ ai_frame#goals.[i]; |
| 1537 | break; |
| 1538 | } |
| 1539 | } |
| 1540 | |
| 1541 | return cur_goal; |
| 1542 | } |