| 1 | /* |
| 2 | * Descent 3 |
| 3 | * Copyright (C) 2024 Parallax Software |
| 4 | * |
| 5 | * This program is free software: you can redistribute it and/or modify |
| 6 | * it under the terms of the GNU General Public License as published by |
| 7 | * the Free Software Foundation, either version 3 of the License, or |
| 8 | * (at your option) any later version. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU General Public License |
| 16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 17 | |
| 18 | --- HISTORICAL COMMENTS FOLLOW --- |
| 19 | |
| 20 | * $Logfile: /DescentIII/main/AImain.cpp $ |
| 21 | * $Revision: 479 $ |
| 22 | * $Date: 4/19/00 5:08p $ |
| 23 | * $Author: Matt $ |
| 24 | * |
| 25 | * The Main of the AI code. |
| 26 | * |
| 27 | * $Log: /DescentIII/main/AImain.cpp $ |
| 28 | * |
| 29 | * 479 4/19/00 5:08p Matt |
| 30 | * From Duane for 1.4 |
| 31 | * Added checks, asserts, and fixes for bad return values |
| 32 | * Added error checking and minor optimization |
| 33 | * |
| 34 | * 478 3/20/00 12:00p Matt |
| 35 | * Merge of Duane's post-1.3 changes. |
| 36 | * Bail from anim update if no anim data. |
| 37 | * |
| 38 | * 477 11/02/99 12:17p Chris |
| 39 | * Improved the targetting code (no max dist when in the same room as |
| 40 | * target) |
| 41 | * |
| 42 | * 476 10/24/99 10:46p Chris |
| 43 | * Added the target_died notification |
| 44 | * |
| 45 | * 475 10/23/99 2:43a Chris |
| 46 | * Added the PutObjectOnObject AI Goal |
| 47 | * |
| 48 | * 474 10/22/99 10:43p Jeff |
| 49 | * put in check to handle new code from mac |
| 50 | * |
| 51 | * 473 10/22/99 3:40p Kevin |
| 52 | * Mac merge fixes |
| 53 | * |
| 54 | * 472 10/21/99 2:12p Matt |
| 55 | * Mac merge |
| 56 | * |
| 57 | * 471 10/20/99 5:40p Chris |
| 58 | * Added the Red Guidebot |
| 59 | * |
| 60 | * 470 10/17/99 11:58p Chris |
| 61 | * Improved the hearing/seeing code, Added AIN_FIRED_WEAPON notify, and |
| 62 | * added a *hack* so that the final boss could fire his weapons during a |
| 63 | * cutscene... (usually this is a no-no). |
| 64 | * |
| 65 | * 469 10/08/99 4:53p Nate |
| 66 | * Added ability to disable individual melee attacks |
| 67 | * |
| 68 | * 468 10/08/99 4:14p 3dsmax |
| 69 | * creeper fix (attached objs and FOV) (chris) |
| 70 | * |
| 71 | * 467 7/27/99 6:39p Chris |
| 72 | * Turned off the GB's player weapon dodging when he is in RTYPE mode |
| 73 | * |
| 74 | * 466 7/27/99 4:20p Chris |
| 75 | * Improved GB avoidance code |
| 76 | * |
| 77 | * 465 7/26/99 3:52p Chris |
| 78 | * Wall pulsing for the GB |
| 79 | * |
| 80 | * 464 7/26/99 1:18p Chris |
| 81 | * He now only dodges player shots |
| 82 | * |
| 83 | * 463 7/26/99 1:16p Chris |
| 84 | * GB now dodges player (and targetted robot) shots |
| 85 | * |
| 86 | * 462 5/24/99 3:23p Chris |
| 87 | * Fixed team anarchy bug. |
| 88 | * |
| 89 | * 461 5/23/99 10:39p Chris |
| 90 | * Fixed client gunboys so they not fire at the server |
| 91 | * |
| 92 | * 460 5/23/99 5:37a Chris |
| 93 | * Fixed bugs with non-AIF_DODGE objects dodging. Made stopping |
| 94 | * tolerances bigger |
| 95 | * |
| 96 | * 459 5/23/99 12:35a Chris |
| 97 | * Fixed the stop exactly problems |
| 98 | * |
| 99 | * 458 5/21/99 7:45p Chris |
| 100 | * Tweaked the cdist code... (again) |
| 101 | * |
| 102 | * 457 5/21/99 6:01p Chris |
| 103 | * Fixed turret speed scaling problems |
| 104 | * |
| 105 | * 456 5/21/99 7:29a Chris |
| 106 | * More tweaking... |
| 107 | * |
| 108 | * 455 5/20/99 3:48p Chris |
| 109 | * Rebel stuff isn't usually scaled by diff anymore |
| 110 | * |
| 111 | * 454 5/20/99 1:44a Chris |
| 112 | * Improved scaling of velocity for walkers (I.e. dont scale max speed or |
| 113 | * rotational speed because it make them look slow and dumb) |
| 114 | * |
| 115 | * 453 5/20/99 1:15a Chris |
| 116 | * Improved BNode Path Following for end points on the path. Fixed bugs |
| 117 | * with non-auto targetting |
| 118 | * |
| 119 | * 452 5/19/99 2:16a Chris |
| 120 | * Fixed gunboys in coop (will not fire on teammates now) |
| 121 | * |
| 122 | * 451 5/18/99 10:54p Chris |
| 123 | * Added some ASSERTs |
| 124 | * |
| 125 | * 450 5/18/99 6:58p Chris |
| 126 | * Hmmmm.... Not sure how that crash happened |
| 127 | * |
| 128 | * 449 5/18/99 10:57a Chris |
| 129 | * Various bug fixes |
| 130 | * |
| 131 | * 448 5/17/99 6:06p Chris |
| 132 | * Adding robot debug code |
| 133 | * |
| 134 | * 447 5/12/99 11:15p Chris |
| 135 | * Adjusted fvi_find for vis. |
| 136 | * |
| 137 | * 446 5/12/99 6:18a Chris |
| 138 | * Vastly improved FindObjOfType. Ignores non-rendered objects, if type |
| 139 | * is robot it ignores cameras, dead robots, or robots without any |
| 140 | * gunpoints (like a mine). |
| 141 | * |
| 142 | * 445 5/11/99 5:49p Chris |
| 143 | * Scaled energy drain by diff level... Increased HotShot energy drain, |
| 144 | * Fixed problem with Thief sound getting muffled by melee hit sound |
| 145 | * |
| 146 | * 444 5/10/99 5:11p Chris |
| 147 | * Fixed another hearing/seeing bug |
| 148 | * |
| 149 | * 443 5/10/99 2:59p Chris |
| 150 | * Fixed fov bug |
| 151 | * |
| 152 | * 442 5/10/99 8:21a Chris |
| 153 | * Reduced wall collision size for GB |
| 154 | * |
| 155 | * 441 5/10/99 12:23a Chris |
| 156 | * Fixed another hearing/seeing case. :) Buddy bot now is in the player |
| 157 | * ship at respawn |
| 158 | * |
| 159 | * 440 5/09/99 8:11p Chris |
| 160 | * Made the whole see/hear distintion work (mostly) |
| 161 | * |
| 162 | * 439 5/08/99 10:38p Chris |
| 163 | * Further scaled the game. :) |
| 164 | * |
| 165 | * 438 5/08/99 6:18p Chris |
| 166 | * Fixed up no hearing cases |
| 167 | * |
| 168 | * 437 5/08/99 4:12p Chris |
| 169 | * Added AI hearing noises... version 1 |
| 170 | * |
| 171 | * 436 5/07/99 10:56p Chris |
| 172 | * GB avoids forcefields, lava, and volatile surfaces... If he accidently |
| 173 | * hits one of these, he ignores the collision (i.e. no effects). It make |
| 174 | * him look smarter. |
| 175 | * |
| 176 | * 435 5/07/99 9:33p Chris |
| 177 | * Improve wall avoidance when never volatile, lava, and water surfaces |
| 178 | * |
| 179 | * 434 5/07/99 1:43p Chris |
| 180 | * Made in-game cinematics use the ORIENT_PATH_NODE for player ships |
| 181 | * |
| 182 | * 433 5/07/99 11:51a Chris |
| 183 | * Improve the algorithm for zero awareness firing |
| 184 | * |
| 185 | * 432 5/07/99 11:24a Chris |
| 186 | * Made 0 agresion robots only fire when they have a clear shot |
| 187 | * |
| 188 | * 431 5/04/99 6:49p Jason |
| 189 | * fixed dumb bug with spray weapons |
| 190 | * |
| 191 | * 430 5/02/99 1:59a Jason |
| 192 | * possibly fixed a bug related to spray weapons and dying |
| 193 | * |
| 194 | * 429 5/01/99 3:49a Chris |
| 195 | * Added the "No scale movement properties by diff level" checkbox |
| 196 | * |
| 197 | * 428 5/01/99 2:21a Chris |
| 198 | * Use the GF_SPEED_XXX stuff |
| 199 | * |
| 200 | * 427 4/30/99 2:09a Chris |
| 201 | * Gunboys will not target triggers anymore |
| 202 | * |
| 203 | * 426 4/29/99 3:59p Chris |
| 204 | * Fixed AI_SEE_SOUND playing too often (like all the time...) |
| 205 | * |
| 206 | * 425 4/27/99 4:41a Jeff |
| 207 | * only create guidebots if a single player game, or if its a multiplayer |
| 208 | * game and the correct netflag is set |
| 209 | * |
| 210 | * 424 4/26/99 11:11a Chris |
| 211 | * Updated Bnode system |
| 212 | * |
| 213 | * 423 4/24/99 2:20a Chris |
| 214 | * Added the Neutral_till_hit flag |
| 215 | * |
| 216 | * 422 4/21/99 2:53p Matt |
| 217 | * Added a new type for dying objects that have AI, instead of keeping a |
| 218 | * flag in the dying info. |
| 219 | * |
| 220 | * 421 4/21/99 11:05a Kevin |
| 221 | * new ps_rand and ps_srand to replace rand & srand |
| 222 | * |
| 223 | * 420 4/20/99 8:55p Chris |
| 224 | * Fixed problem with robots not being able to open locked doors that a |
| 225 | * player has the key for. |
| 226 | * |
| 227 | * 419 4/18/99 10:23a Chris |
| 228 | * |
| 229 | * 418 4/18/99 5:38a Chris |
| 230 | * Drastically improved the find_random_room function and added the |
| 231 | * makenextroomlist function |
| 232 | * |
| 233 | * 417 4/15/99 1:32a Jeff |
| 234 | * linux changes to compile /Main0 /Main1 /Main2 /Main3 /Main4 /Main5 |
| 235 | * /Main6 /Main7 /Main8 /Main9 /descent3/Main0 /descent3/Main1 |
| 236 | * /descent3/Main2 /descent3/Main3 /descent3/Main4 /descent3/Main5 |
| 237 | * /descent3/Main6 /descent3/Main7 /descent3/Main8 /descent3/Main9 |
| 238 | * AImain.cpp0 AImain.cpp1 AImain.cpp2 AImain.cpp3 AImain.cpp4 AImain.cpp5 |
| 239 | * AImain.cpp6 AImain.cpp7 AImain.cpp8 AImain.cpp9 linux0 linux1 linux2 |
| 240 | * linux3 linux4 linux5 linux6 linux7 linux8 |
| 241 | * |
| 242 | * 416 4/14/99 10:31p Jeff |
| 243 | * fixed name of ai_info struct to t_ai_info |
| 244 | * |
| 245 | * 415 4/14/99 2:50a Jeff |
| 246 | * fixed some case mismatched #includes |
| 247 | * |
| 248 | * 414 4/12/99 6:15p Samir |
| 249 | * Sound priorities pass 1 |
| 250 | * |
| 251 | * 413 4/12/99 5:45p Chris |
| 252 | * Improved Freud |
| 253 | * |
| 254 | * 412 4/10/99 6:39p Matt |
| 255 | * Only save the designer-editable AI data in the Object_info array, |
| 256 | * instead of the whole ai_frame structure. This saves 3200 bytes per |
| 257 | * Object_info entry, which is about 2 MB overall. |
| 258 | * |
| 259 | * 411 4/09/99 10:33a Chris |
| 260 | * Improvements to Freud |
| 261 | * |
| 262 | * 410 4/08/99 7:46p Chris |
| 263 | * Improving Freud |
| 264 | * |
| 265 | * 409 4/08/99 6:03p Chris |
| 266 | * Improved Freud |
| 267 | * |
| 268 | * 408 4/08/99 3:35p Chris |
| 269 | * Improved the Fear factor in Freud |
| 270 | * |
| 271 | * 407 4/07/99 3:55a Chris |
| 272 | * Independant (non-parented) Rebel robots will now fire on PTMC and |
| 273 | * Hostile robots. :) |
| 274 | * |
| 275 | * 406 4/06/99 11:04p Chris |
| 276 | * Global Unique id's for goals and circle dist stuff can be set when |
| 277 | * aware barely |
| 278 | * |
| 279 | * 405 4/06/99 6:36p Jason |
| 280 | * CHRIS -- Fixed a bug with AIDetermineFovVec() |
| 281 | * |
| 282 | * 404 4/06/99 11:18a Chris |
| 283 | * Fixed a big bug in the attach system where object's properties where |
| 284 | * not correctly reset after the attach |
| 285 | * |
| 286 | * 403 4/05/99 3:18p Chris |
| 287 | * Patching wandering code |
| 288 | * |
| 289 | * 402 4/05/99 11:36a Chris |
| 290 | * |
| 291 | * 401 4/05/99 11:36a Chris |
| 292 | * Fixed a few bugs with Orient to Node |
| 293 | * |
| 294 | * 400 4/02/99 3:55p Chris |
| 295 | * Fixed or at least commented about guidebot bugs |
| 296 | * |
| 297 | * 399 4/02/99 3:49p Chris |
| 298 | * Create GBs in multiplayer |
| 299 | * |
| 300 | * 398 4/02/99 10:18a Chris |
| 301 | * We can now mess with the Object_info anim stuff |
| 302 | * |
| 303 | * 397 3/30/99 4:32p Chris |
| 304 | * Moved subtype to the main goal sturct (from goal_info). Made move |
| 305 | * relative object vec finishable. (Like get behind player) |
| 306 | * |
| 307 | * 396 3/29/99 5:32p Kevin |
| 308 | * Build fixes |
| 309 | * |
| 310 | * 395 3/27/99 1:08p Chris |
| 311 | * AIPowerSwitch now prop's though all objects that are attached to the |
| 312 | * object that is turned on/off |
| 313 | * |
| 314 | * 394 3/26/99 6:57p Chris |
| 315 | * Fixed a bug with the landing code |
| 316 | * |
| 317 | * 393 3/26/99 2:58p Chris |
| 318 | * See sounds play 90% of the time |
| 319 | * |
| 320 | * 392 3/25/99 4:56p Chris |
| 321 | * Added code for the land on object DALLAS goal |
| 322 | * |
| 323 | * 391 3/25/99 12:00p Chris |
| 324 | * |
| 325 | * 390 3/25/99 11:56a Jason |
| 326 | * changed some sequencing bugs |
| 327 | * |
| 328 | * 389 3/23/99 11:51a Matt |
| 329 | * Made wander code not crash if the room selected was an outside room |
| 330 | * (from an inside wander) I.e. two rooms in two different mines with |
| 331 | * terrain between them. |
| 332 | * |
| 333 | * 388 3/22/99 7:10p Chris |
| 334 | * Added path node orientation |
| 335 | * |
| 336 | * 387 3/22/99 3:56p Chris |
| 337 | * |
| 338 | * 386 3/22/99 10:58a Chris |
| 339 | * Awareness code was tweaked. Multisafe stuff added for objects. |
| 340 | * |
| 341 | * 385 3/18/99 12:46p Chris |
| 342 | * Fixed an FOV and awareness conflict |
| 343 | * |
| 344 | * 384 3/17/99 5:23p Chris |
| 345 | * Fixed problems with low-priority paths |
| 346 | * |
| 347 | * 383 3/15/99 2:39p Chris |
| 348 | * Added some terrain avoidance |
| 349 | * |
| 350 | * 382 3/12/99 7:10p Chris |
| 351 | * Avoid avoid walls version 1.0 |
| 352 | * |
| 353 | * 381 3/12/99 12:16p Chris |
| 354 | * Blending primary and blend goals!!!!!! Awesome. |
| 355 | * |
| 356 | * 380 3/10/99 4:15p Chris |
| 357 | * Patches birds for now |
| 358 | * |
| 359 | * 379 3/09/99 2:42p Chris |
| 360 | * Backwards gone |
| 361 | * |
| 362 | * 378 3/09/99 2:13p Chris |
| 363 | * Robots flying backwards |
| 364 | * |
| 365 | * 377 3/05/99 6:07p Chris |
| 366 | * Fixed bug where OSIRIS wasn't informed at the 'level' level that a |
| 367 | * goal_uid was completed (it was and still is fine at the object level) |
| 368 | * |
| 369 | * 376 3/05/99 10:33a Chris |
| 370 | * Fixed the bashed it_handle bug |
| 371 | * |
| 372 | * 375 3/04/99 12:44p Chris |
| 373 | * Commented out Ignore height diff code -- chrishack |
| 374 | * |
| 375 | * 374 3/03/99 5:35p Kevin |
| 376 | * HAck |
| 377 | * |
| 378 | * 373 3/03/99 3:12p Chris |
| 379 | * No AI firing during cinematics |
| 380 | * |
| 381 | * 372 3/03/99 1:18p Chris |
| 382 | * Init'ed the perceived_vec_to_target |
| 383 | * |
| 384 | * 371 3/03/99 7:22a Chris |
| 385 | * Added Napalmed to the list |
| 386 | * |
| 387 | * 370 3/03/99 6:52a Chris |
| 388 | * Fixed headlight |
| 389 | * |
| 390 | * 369 3/03/99 5:47a Chris |
| 391 | * |
| 392 | * 368 3/03/99 5:47a Chris |
| 393 | * Fixed the headlight thing |
| 394 | * |
| 395 | * 367 3/03/99 5:45a Chris |
| 396 | * Further cased out the auto-turn stuff |
| 397 | * |
| 398 | * 366 3/02/99 11:41p Chris |
| 399 | * |
| 400 | * 365 3/02/99 10:53p Chris |
| 401 | * |
| 402 | * 364 3/02/99 10:46p Chris |
| 403 | * Improved the vis code |
| 404 | * |
| 405 | * 363 3/02/99 5:39p Chris |
| 406 | * Fixed the gunboy rotation problem |
| 407 | * |
| 408 | * 362 3/01/99 7:19p Chris |
| 409 | * Fixed dist problems with finding nearby objects |
| 410 | * |
| 411 | * 361 2/28/99 11:30p Chris |
| 412 | * FindObjOfType and OSIRIS controllable deaths |
| 413 | * |
| 414 | * 360 2/25/99 5:43p Chris |
| 415 | * Massive improvement to BOA and AI (again) |
| 416 | * |
| 417 | * 359 2/25/99 10:57a Matt |
| 418 | * Added new explosion system. |
| 419 | * |
| 420 | * 358 2/24/99 12:27p Chris |
| 421 | * Fixed problems with GB finding robots/room he couldn't get to. Fixed |
| 422 | * problems with forcefields(sound prop. and path finding). Fixed |
| 423 | * problems with small portals. |
| 424 | * |
| 425 | * 357 2/18/99 3:50p Chris |
| 426 | * Updated the exact stopping code for paths. Scaled acceleraion by |
| 427 | * max_speed scalar. |
| 428 | * |
| 429 | * 356 2/17/99 8:47p Chris |
| 430 | * See if this fixes Dan's rotating walker problem |
| 431 | * |
| 432 | * 355 2/17/99 1:21a Chris |
| 433 | * Updated the AI movement algorithm, fixed many bugs, added the |
| 434 | * last_dodge_dir vector so that robots can dodge the vauss and the like |
| 435 | * |
| 436 | * 354 2/15/99 9:03p Chris |
| 437 | * Added the base FOV off UVEC code and converted all the turrets |
| 438 | * |
| 439 | * 353 2/15/99 8:59a Chris |
| 440 | * |
| 441 | * 352 2/15/99 8:58a Chris |
| 442 | * |
| 443 | * 351 2/15/99 8:55a Chris |
| 444 | * Fixed a bug with AIF_XZ_DIST (It incorrectly computed the distance from |
| 445 | * a target) |
| 446 | * |
| 447 | * 350 2/12/99 11:19a Chris |
| 448 | * If max_turn_rate is zero, then don't call the orient code |
| 449 | * |
| 450 | * 349 2/10/99 4:02p Chris |
| 451 | * Updated the attach system so that if a robot is idling, the AI will not |
| 452 | * update the attached subobjects (if the object is still moving, physics |
| 453 | * will do it). |
| 454 | * |
| 455 | * 348 2/10/99 2:41p Chris |
| 456 | * Added debug info |
| 457 | * |
| 458 | * 347 2/10/99 1:47p Matt |
| 459 | * Changed object handle symbolic constants |
| 460 | * |
| 461 | * 346 2/09/99 3:52p Chris |
| 462 | * Fixed melee attacks |
| 463 | * |
| 464 | * 345 2/09/99 12:40p Chris |
| 465 | * More aipath stuff has been merged with the new BOA |
| 466 | * |
| 467 | * 344 2/09/99 9:58a Chris |
| 468 | * Massive BOA update :) Terrain happy now. Vis happy now. Sound happy |
| 469 | * now. |
| 470 | * |
| 471 | * 343 2/03/99 11:09a Chris |
| 472 | * Stop at position goals will now get the AIN_GOAL_COMPLETE correctly |
| 473 | * |
| 474 | * 342 2/02/99 12:24p Sean |
| 475 | * CHRIS -- Fixed a bug with dummy turrets. They wehre using a bogus |
| 476 | * index. |
| 477 | * |
| 478 | * 341 2/02/99 11:27a Chris |
| 479 | * Added the AIN_MOVIE_START and AIN_MOVIE_END notifies |
| 480 | * |
| 481 | * 340 2/02/99 9:23a Chris |
| 482 | * Fixed turning problems caused by zero vectors (which return a random |
| 483 | * vector) |
| 484 | * Fixed jitteryness problem caused by having too tight of a need-to-turn |
| 485 | * tolerance on large robots |
| 486 | * |
| 487 | * 339 2/02/99 9:06a Chris |
| 488 | * Fixed a bug where robots where starting in AS_ALERT instead of AS_IDLE |
| 489 | * |
| 490 | * 338 1/31/99 10:43p Chris |
| 491 | * added WBF_AIM_FVEC |
| 492 | * |
| 493 | * 337 1/29/99 5:27p Luke |
| 494 | * CHRIS - Updated the Gaurd goal |
| 495 | * |
| 496 | * 336 1/29/99 5:10p Chris |
| 497 | * Added an optional parent handle check for FindObjOfType |
| 498 | * |
| 499 | * 335 1/26/99 2:51p Chris |
| 500 | * AIG_WANDER improvements |
| 501 | * |
| 502 | * 334 1/25/99 7:43a Chris |
| 503 | * Added the GUID (Goal Unique Id) and added the ability for weapon |
| 504 | * batteries to always fire exactly forward. |
| 505 | * |
| 506 | * 333 1/24/99 10:58p Chris |
| 507 | * Fixed problems with AvoidObj code |
| 508 | * |
| 509 | * 332 1/24/99 8:17p Chris |
| 510 | * Updated AI and OSIRIS. Externalized fireball constants for spew and |
| 511 | * sparks. Added CreateRandomSparks to OSIRIS, renamed a bunch of AI |
| 512 | * Notify names to use underscores. Fixed a memory access leak in the |
| 513 | * matcen effect code. |
| 514 | * |
| 515 | * 331 1/23/99 2:20p Chris |
| 516 | * Removed a walker hack |
| 517 | * |
| 518 | * 330 1/22/99 6:53p Chris |
| 519 | * Fixed LoadandBind Aux notify problems, fixed static path problems, |
| 520 | * fixed AIF_FORCE_AWARE Problems, improved path code |
| 521 | * |
| 522 | * 329 1/21/99 11:15p Jeff |
| 523 | * pulled out some structs and defines from header files and moved them |
| 524 | * into seperate header files so that multiplayer dlls don't require major |
| 525 | * game headers, just those new headers. Side effect is a shorter build |
| 526 | * time. Also cleaned up some header file #includes that weren't needed. |
| 527 | * This affected polymodel.h, object.h, player.h, vecmat.h, room.h, |
| 528 | * manage.h and multi.h |
| 529 | * |
| 530 | * 328 1/20/99 2:13a Chris |
| 531 | * It is now possible for robots to have special immunities, resistances, |
| 532 | * and vunerabilities |
| 533 | * |
| 534 | * 327 1/20/99 1:01a Chris |
| 535 | * Improved AI and OSIRIS intergration |
| 536 | * |
| 537 | * 326 1/18/99 8:07p Chris |
| 538 | * Added the no-collide same flag (for flocks and nests) |
| 539 | * |
| 540 | * 325 1/18/99 10:14a Chris |
| 541 | * |
| 542 | * 324 1/18/99 9:05a Chris |
| 543 | * Improved OSIRIS, AI, and ATTACH system, changed wiggle code, changed |
| 544 | * attach code for rad attaches, and added the AIG_ATTACH_OBJ goal |
| 545 | * |
| 546 | * 323 1/15/99 5:57p Chris |
| 547 | * fixed some awareness bugs |
| 548 | * |
| 549 | * 322 1/13/99 6:37a Jeff |
| 550 | * fixed object.h. There were numerous struct declarations that were the |
| 551 | * same name as the instance of the struct (gcc doesn't like this). |
| 552 | * Changed the struct name. Also added some #ifdef's for linux build, |
| 553 | * along with fixing case-sensitive includes |
| 554 | * |
| 555 | * 321 1/13/99 2:28a Chris |
| 556 | * Massive AI, OSIRIS update |
| 557 | * |
| 558 | * 320 1/11/99 2:14p Chris |
| 559 | * Massive work on OSIRIS and AI |
| 560 | * |
| 561 | * 319 1/06/99 5:06p Chris |
| 562 | * Improving OSIRIS/game intergration - improved support for custom |
| 563 | * animations |
| 564 | * |
| 565 | * 318 1/05/99 6:28p Chris |
| 566 | * Fix OSIRIS AI_Notify problem |
| 567 | * |
| 568 | * 317 12/30/98 3:46p Chris |
| 569 | * Incremental AI changes |
| 570 | * |
| 571 | * 316 12/23/98 6:10p Matt |
| 572 | * Fixed compiler warnings |
| 573 | * |
| 574 | * 315 12/18/98 5:40p Chris |
| 575 | * Fixed a crash bug in the new OSIRIS |
| 576 | * |
| 577 | * 314 12/17/98 12:08p Jeff |
| 578 | * first checkin of new implementation of OSIRIS (old OSIRIS no longer |
| 579 | * works) |
| 580 | * |
| 581 | * 313 12/16/98 3:55p Chris |
| 582 | * Improved the sickles |
| 583 | * |
| 584 | * 312 12/15/98 4:58p Chris |
| 585 | * Improved the path system |
| 586 | * |
| 587 | * 311 12/15/98 4:08p Chris |
| 588 | * Removed the annoying stop mprintf |
| 589 | * |
| 590 | * 310 12/15/98 4:04p Chris |
| 591 | * Wall landers work |
| 592 | * |
| 593 | * 309 12/14/98 2:04p Chris |
| 594 | * Fixed an evader1 blend problem |
| 595 | * |
| 596 | * 308 12/14/98 1:07p Chris |
| 597 | * Allowed OSIRIS to change AI types |
| 598 | * |
| 599 | * 307 12/14/98 12:03a Chris |
| 600 | * Turning and orientation are done in one (minus a few hacks) spot |
| 601 | * |
| 602 | * 306 12/13/98 9:18p Chris |
| 603 | * Improved influence values for in-code goals (10000 to 1.0). Added |
| 604 | * GF_ORIENT stuff. :) |
| 605 | * |
| 606 | * 305 12/12/98 10:11p Chris |
| 607 | * Cleaned up some CT stuff |
| 608 | * |
| 609 | * 304 12/11/98 6:24p Chris |
| 610 | * Additional Comments |
| 611 | * |
| 612 | * 303 12/11/98 1:57p Chris |
| 613 | * Improved wall walking code |
| 614 | * |
| 615 | * 302 12/11/98 12:04p Chris |
| 616 | * Improved the flocking hack. :) |
| 617 | * |
| 618 | * 301 12/08/98 4:27p Chris |
| 619 | * Fixed all avoid code from avoiding attached robots |
| 620 | * |
| 621 | * 300 12/08/98 2:14p Chris |
| 622 | * Fixed bugs when an object is avoiding a robot the is attached to it |
| 623 | * |
| 624 | * 299 12/03/98 5:45p Chris |
| 625 | * I just added full code support for OSIRIS/DLL controlled goals, |
| 626 | * enablers, and influence levels. :) |
| 627 | * |
| 628 | * 298 12/03/98 2:31p Chris |
| 629 | * The auto-avoid friends flag is now cooler now (they avoid at greater |
| 630 | * distances when they are within thier circle distance from a targetted |
| 631 | * enemy) |
| 632 | * |
| 633 | * 297 12/03/98 12:24p Chris |
| 634 | * Improved new anim code for instant updating |
| 635 | * |
| 636 | * 296 12/03/98 12:04p Chris |
| 637 | * Further de-hacked flocking and other major AI systems |
| 638 | * |
| 639 | * 295 12/02/98 5:51p Chris |
| 640 | * Lint cleaning |
| 641 | * |
| 642 | * 294 12/02/98 2:27p Chris |
| 643 | * Algorithm swap stuff for target leading |
| 644 | * |
| 645 | * 293 12/02/98 2:13p Chris |
| 646 | * We now use the target lead accuracy slider |
| 647 | * |
| 648 | * 292 12/01/98 6:17p Chris |
| 649 | * Height bias is only for outside and GoalDetermineTrackDist is closer to |
| 650 | * final |
| 651 | * |
| 652 | * 291 12/01/98 5:09p Chris |
| 653 | * Improved the height bias code |
| 654 | * |
| 655 | * 290 12/01/98 4:31p Chris |
| 656 | * Checked in a massive amount of AI work. Improved flocking code. :) |
| 657 | * (Still hacked lightly). In addition, I am moving toward using the |
| 658 | * composite dir. :) |
| 659 | * |
| 660 | * 289 12/01/98 3:31p Keneta |
| 661 | * Added a temp fix for avoid_obj when there are no objs |
| 662 | * |
| 663 | * 288 11/23/98 3:11p Kevin |
| 664 | * Demo system |
| 665 | * |
| 666 | * 287 11/23/98 11:26a Chris |
| 667 | * More improvements to the AI system |
| 668 | * |
| 669 | * 286 11/23/98 11:09a Chris |
| 670 | * Incremental improvements |
| 671 | * |
| 672 | * 285 11/20/98 11:37a Chris |
| 673 | * Improved avoidance code |
| 674 | * |
| 675 | * 284 11/19/98 8:55p Chris |
| 676 | * |
| 677 | * 283 11/19/98 8:55p Chris |
| 678 | * |
| 679 | * 282 11/19/98 8:55p Chris |
| 680 | * I am being to clean up the structure |
| 681 | * |
| 682 | * 281 11/19/98 8:26p Chris |
| 683 | * Starting to add generic team avoidance code |
| 684 | * |
| 685 | * 280 11/18/98 6:25p Chris |
| 686 | * Dodge->avoid->normal. That is the order. To do it right, dodge will |
| 687 | * get a BIG scalar, avoid will get a smaller scalar, and normal stuff |
| 688 | * will get a tiny scalar. |
| 689 | * |
| 690 | * 279 11/18/98 3:59p Chris |
| 691 | * I added the avoid goal. I also improved the AIs for Evader1 and |
| 692 | * Evader2 by utilizing this goal when the target is well within the |
| 693 | * circle distance. |
| 694 | * |
| 695 | * 278 11/17/98 4:16p Kevin |
| 696 | * Demo recording system |
| 697 | * |
| 698 | * 277 11/11/98 7:18p Jeff |
| 699 | * changes made so that a dedicated server's team is always -1 (team game |
| 700 | * or not) |
| 701 | * |
| 702 | * 276 11/11/98 6:31p Chris |
| 703 | * AIF_DISABLE_FIRING and AIF_DISABLE_MELEE are now functional |
| 704 | * |
| 705 | * 275 11/11/98 2:46p Kevin |
| 706 | * Demo recording system work |
| 707 | * |
| 708 | * 274 11/11/98 12:11p Chris |
| 709 | * The attach system and weapon firing (continous and spray) are now |
| 710 | * network friendly |
| 711 | * |
| 712 | * 273 11/10/98 6:17p Chris |
| 713 | * Improved AI - added support for manual max firing distances |
| 714 | * |
| 715 | * 272 11/09/98 3:08p Kevin |
| 716 | * Turned off AI while playing back a demo |
| 717 | * |
| 718 | * 271 11/06/98 5:34p Chris |
| 719 | * |
| 720 | * 270 11/06/98 11:39a Chris |
| 721 | * Robots with flamethrowers and Omega cannons work in single player |
| 722 | * |
| 723 | * 269 10/29/98 1:45p Chris |
| 724 | * Checked in the better collision response code |
| 725 | * |
| 726 | * 268 10/28/98 4:37p Chris |
| 727 | * Robots who are parented by ghosts still know their team. |
| 728 | * |
| 729 | * 267 10/22/98 5:36p Chris |
| 730 | * Fixed ObjGet bugs |
| 731 | * |
| 732 | * 266 10/22/98 2:58p Chris |
| 733 | * Difficulty levels are in beta |
| 734 | * |
| 735 | * 265 10/21/98 5:35p Chris |
| 736 | * Added friend forgiving to the aggression slider |
| 737 | * |
| 738 | * 264 10/21/98 7:33a Chris |
| 739 | * Dead objects are not-targetable |
| 740 | * |
| 741 | * 263 10/20/98 11:56p Chris |
| 742 | * |
| 743 | * 262 10/20/98 10:52p Chris |
| 744 | * Improved the single player targeting when a player is dead |
| 745 | * (Player->buddy->none) |
| 746 | * |
| 747 | * 261 10/19/98 7:20p Chris |
| 748 | * Added custom fire dot code |
| 749 | * |
| 750 | * 260 10/19/98 7:17p Matt |
| 751 | * Added system to support different types of damage to the player and |
| 752 | * have these different types make different sounds. |
| 753 | * |
| 754 | * 259 10/16/98 3:39p Chris |
| 755 | * Improved the object linking system and AI and physics |
| 756 | * |
| 757 | * 258 10/15/98 3:26p Chris |
| 758 | * Fixed known ground plane issues and used PhysCalcGround everywhere |
| 759 | * |
| 760 | * 257 10/14/98 7:04p Chris |
| 761 | * Update turret sound code |
| 762 | * |
| 763 | * 256 10/14/98 6:54p Chris |
| 764 | * Added turret change direction sounds and level goal ability to toggle |
| 765 | * auto level end |
| 766 | * |
| 767 | * 255 10/14/98 4:45p Chris |
| 768 | * Added support for a endlevel in-game movie |
| 769 | * |
| 770 | * 254 10/14/98 3:39p Chris |
| 771 | * Improved robot dodging and firing |
| 772 | * |
| 773 | * 253 10/13/98 1:08p Chris |
| 774 | * Greatly improved the AI's use of paths. Improved visability checking |
| 775 | * algorithm. Probably needs a second pass for further cleanup. |
| 776 | * |
| 777 | * 252 10/09/98 4:01p Chris |
| 778 | * |
| 779 | * 251 10/09/98 2:24a Chris |
| 780 | * |
| 781 | * 250 10/09/98 2:22a Chris |
| 782 | * Improving vis checking |
| 783 | * |
| 784 | * 249 10/09/98 2:17a Chris |
| 785 | * |
| 786 | * 248 10/09/98 1:39a Chris |
| 787 | * Added very infrequent target updating for robots with an awareness less |
| 788 | * than AWARE_BARELY |
| 789 | * |
| 790 | * 247 10/09/98 1:35a Chris |
| 791 | * Fixed a bug with robots only attacking after they are rendered |
| 792 | * |
| 793 | * 246 10/08/98 8:49p Chris |
| 794 | * Improving AI initialization? |
| 795 | * |
| 796 | * 245 10/07/98 10:06p Chris |
| 797 | * Improved the attach system's updating |
| 798 | * |
| 799 | * 244 10/07/98 3:37p Chris |
| 800 | * Improved the melee attack code |
| 801 | * |
| 802 | * 243 10/07/98 12:39p Chris |
| 803 | * Added support for zero latency attacks |
| 804 | * |
| 805 | * 242 10/07/98 10:54a Chris |
| 806 | * Matcens use the birth animations |
| 807 | * |
| 808 | * 241 10/06/98 6:19p Chris |
| 809 | * Improved OSIRIS/AI intergration |
| 810 | * |
| 811 | * 240 10/06/98 5:45p Kevin |
| 812 | * Added new configuration for demo |
| 813 | * |
| 814 | * 239 9/30/98 4:40p Chris |
| 815 | * |
| 816 | * 238 9/30/98 4:36p Chris |
| 817 | * Fixed a targetting bug |
| 818 | * |
| 819 | * 237 9/30/98 3:49p Chris |
| 820 | * Changed comment |
| 821 | * |
| 822 | * 236 9/29/98 3:11p Chris |
| 823 | * |
| 824 | * 235 9/28/98 7:23p Chris |
| 825 | * same as prev |
| 826 | * |
| 827 | * 234 9/28/98 7:03p Chris |
| 828 | * Improved targetting of objects by AIs |
| 829 | * |
| 830 | * 233 9/28/98 6:23p Chris |
| 831 | * Changed multi_anim to custom_anim |
| 832 | * |
| 833 | * 232 9/28/98 4:09p Chris |
| 834 | * Added birth animations |
| 835 | * |
| 836 | * 231 9/28/98 1:15p Chris |
| 837 | * Fixed the targetting of parents(oops) after parent-collide-timeout |
| 838 | * |
| 839 | * 230 9/28/98 10:34a Chris |
| 840 | * Fixed a semi-colon bug |
| 841 | * |
| 842 | * 229 9/22/98 6:03p Samir |
| 843 | * ifdef out DoAI if not in debug version. |
| 844 | * |
| 845 | * 228 9/17/98 11:11a Chris |
| 846 | * Worked on goal system and improved integration with OSIRIS (better |
| 847 | * EVT_AI_INIT event calling) |
| 848 | * |
| 849 | * 227 9/16/98 4:30p Chris |
| 850 | * Added target by distance |
| 851 | * |
| 852 | * 226 9/15/98 7:29p Chris |
| 853 | * Improved OSIRIS and AI intergration |
| 854 | * |
| 855 | * 225 9/14/98 1:14p Chris |
| 856 | * Improved multiplayer team/non-team support |
| 857 | * |
| 858 | * 224 9/14/98 12:56p Chris |
| 859 | * Automatically put player parented objects as part of AIF_TEAM_REBEL |
| 860 | * |
| 861 | * 223 9/14/98 12:23p Chris |
| 862 | * |
| 863 | * 222 9/14/98 12:16p Chris |
| 864 | * Vastly improved the multiplayer code |
| 865 | * |
| 866 | * 221 9/11/98 5:27p Chris |
| 867 | * Further improved the cooperative multiplayer ai |
| 868 | * |
| 869 | * 220 9/11/98 11:58a Chris |
| 870 | * Fixed too many sounds in cooperative multiplayer |
| 871 | * |
| 872 | * 219 8/25/98 10:44a Chris |
| 873 | * Worked on leading code a bit |
| 874 | * |
| 875 | * 218 8/25/98 10:21a Chris |
| 876 | * Removed 2 annoying mprintfs |
| 877 | * |
| 878 | * 217 8/19/98 6:25p Chris |
| 879 | * Added the infighting sliders |
| 880 | * |
| 881 | * 216 8/17/98 4:55p Chris |
| 882 | * Reduced infighting |
| 883 | * |
| 884 | * 215 8/15/98 6:10p Chris |
| 885 | * Added OSIRIS controlled firing |
| 886 | * |
| 887 | * 214 8/12/98 6:10p Chris |
| 888 | * Added more to the attach code. Added support for OBJ_DUMMY |
| 889 | * |
| 890 | * 213 8/10/98 12:16p Chris |
| 891 | * Added AI_NumHostileAlert |
| 892 | * |
| 893 | * 212 8/06/98 11:49a Chris |
| 894 | * OBJ_NONE objects where getting notified of stuff |
| 895 | * |
| 896 | * 211 8/03/98 3:59p Chris |
| 897 | * Added support for FQ_IGNORE_WEAPONS, added .000001 attach code, fix a |
| 898 | * bug in polymodel collision detection |
| 899 | * |
| 900 | * 210 7/29/98 10:24a Chris |
| 901 | * Improved target updating code for multiplayer |
| 902 | * |
| 903 | * 209 7/28/98 5:48p Chris |
| 904 | * |
| 905 | * 208 7/28/98 5:41p Chris |
| 906 | * |
| 907 | * 207 7/28/98 5:04p Chris |
| 908 | * Added some new multiplayer support (for dodging and targetting) |
| 909 | * |
| 910 | * 206 7/24/98 6:06p Chris |
| 911 | * Initial robot leading code -- needs multiple wb support |
| 912 | * |
| 913 | * 205 7/17/98 6:08p Chris |
| 914 | * Greatly improved homing performance |
| 915 | * |
| 916 | * 204 7/14/98 5:52p Kevin |
| 917 | * Packet loss measurements and auto pps adjusting |
| 918 | * |
| 919 | * 203 7/09/98 3:36p Chris |
| 920 | * |
| 921 | * 201 7/09/98 1:05p Chris |
| 922 | * Added some parenthesis |
| 923 | * |
| 924 | * 200 7/09/98 12:44p Chris |
| 925 | * |
| 926 | * 199 7/09/98 12:34p Chris |
| 927 | * Fixed a problem with the current interp code |
| 928 | * |
| 929 | * 198 7/09/98 12:31p Chris |
| 930 | * Improved the turret interp code |
| 931 | * |
| 932 | * 197 7/09/98 11:34a Chris |
| 933 | * Turrets are interpolated. |
| 934 | * |
| 935 | * 196 7/08/98 1:02p Chris |
| 936 | * |
| 937 | * 195 7/08/98 12:11p Chris |
| 938 | * |
| 939 | * 194 7/08/98 11:38a Chris |
| 940 | * Improved the turret info passing in multiplayer |
| 941 | * |
| 942 | * 193 7/07/98 11:29a Chris |
| 943 | * |
| 944 | * 192 7/07/98 10:10a Kevin |
| 945 | * Added basic turret support for coop |
| 946 | * |
| 947 | * 191 7/06/98 10:27a Chris |
| 948 | * Re-added general awareness |
| 949 | * |
| 950 | * 190 7/02/98 6:08p Chris |
| 951 | * Removed the quick hack way of doing awareness |
| 952 | * |
| 953 | * 189 7/01/98 7:11p Chris |
| 954 | * Added multi blocks |
| 955 | * |
| 956 | * 188 7/01/98 6:36p Chris |
| 957 | * Added more multiplayer support |
| 958 | * |
| 959 | * 187 7/01/98 4:35p Chris |
| 960 | * More multiplayer sync issues |
| 961 | * |
| 962 | * 186 7/01/98 2:02p Chris |
| 963 | * Added the sound for animations |
| 964 | * |
| 965 | * 185 7/01/98 10:58a Chris |
| 966 | * Working on multiplayer AI stuff |
| 967 | * |
| 968 | * 184 6/30/98 6:36p Chris |
| 969 | * Added rev .1 of multiplayer animations - BTW It is totally not done. |
| 970 | * |
| 971 | * 183 6/29/98 1:50p Chris |
| 972 | * Fixed a turning multiplayer bug |
| 973 | * |
| 974 | * 182 6/29/98 1:35p Chris |
| 975 | * Incremental improvements |
| 976 | * |
| 977 | * 181 6/29/98 1:12p Chris |
| 978 | * Dodge updates |
| 979 | * |
| 980 | * 180 6/29/98 12:34p Chris |
| 981 | * Fighting robots get some notification of hostile fire |
| 982 | * |
| 983 | * 179 6/29/98 10:20a Chris |
| 984 | * Someone changed the way ObjGet works. |
| 985 | * |
| 986 | * 178 6/26/98 4:57p Chris |
| 987 | * Less flinching |
| 988 | * |
| 989 | * 177 6/26/98 4:03p Chris |
| 990 | * Added support for AI's changing targets -- VERY NOT DONE |
| 991 | * |
| 992 | * 176 6/26/98 2:52p Chris |
| 993 | * AI now reports when it updates its orientation |
| 994 | * |
| 995 | * 175 6/25/98 3:40p Chris |
| 996 | * Made AINotify work correctly (i.e. not at all) on clients |
| 997 | * |
| 998 | * 174 6/25/98 11:02a Chris |
| 999 | * Made clients bail. |
| 1000 | * |
| 1001 | * 173 6/15/98 6:29p Chris |
| 1002 | * Added FQ_NO_RELINK to the homing code |
| 1003 | * |
| 1004 | * 172 6/15/98 5:45p Chris |
| 1005 | * |
| 1006 | * 171 6/15/98 5:18p Chris |
| 1007 | * Added version 1 of the multiple ground point code |
| 1008 | * |
| 1009 | * 170 6/15/98 3:23p Chris |
| 1010 | * Single point walker update |
| 1011 | * |
| 1012 | * 169 6/03/98 6:42p Chris |
| 1013 | * Added multipoint collision detection an Assert on invalid (infinite |
| 1014 | * endpoint). |
| 1015 | * |
| 1016 | * 168 6/01/98 9:24p Chris |
| 1017 | * Improved the code for AIs that are off |
| 1018 | * |
| 1019 | * 167 5/27/98 5:54p Chris |
| 1020 | * If AI is off, no notifies are received |
| 1021 | * |
| 1022 | * 166 5/27/98 3:19p Chris |
| 1023 | * Made disabled AIs ignore dodge notifications |
| 1024 | * |
| 1025 | * 165 5/26/98 7:57p Chris |
| 1026 | * Worked on the avoid hack |
| 1027 | * |
| 1028 | * 164 5/26/98 7:41p Chris |
| 1029 | * Made hoppers not converge |
| 1030 | * |
| 1031 | * 163 5/26/98 5:04p Chris |
| 1032 | * rev .2 of walking |
| 1033 | * |
| 1034 | * 162 5/26/98 4:39p Chris |
| 1035 | * rev. .1 of walker code |
| 1036 | * |
| 1037 | * 161 5/26/98 4:10p Chris |
| 1038 | * Removed a hack |
| 1039 | * |
| 1040 | * 160 5/26/98 2:49p Chris |
| 1041 | * More fixes |
| 1042 | * |
| 1043 | * 159 5/26/98 2:26p Chris |
| 1044 | * Fixed the circle distance bug in AIGoalMoveRelativeObjectVec |
| 1045 | * |
| 1046 | * 158 5/26/98 10:03a Chris |
| 1047 | * move relative object and orient to vel where causing problems with each |
| 1048 | * other. I found a temp solution |
| 1049 | * |
| 1050 | * 157 5/26/98 9:45a Chris |
| 1051 | * DIstance and vec_to_target are independant |
| 1052 | * |
| 1053 | * 156 5/26/98 9:34a Chris |
| 1054 | * Added XZ distances for circle dist. :) |
| 1055 | * |
| 1056 | * 155 5/22/98 6:50p Chris |
| 1057 | * Improving the melee attacks |
| 1058 | * |
| 1059 | * 154 5/22/98 6:45p Chris |
| 1060 | * Fixed a bug with flinching and melee attacks |
| 1061 | * |
| 1062 | * 153 5/22/98 6:28p Chris |
| 1063 | * Working on melee attacks |
| 1064 | * |
| 1065 | * 152 5/22/98 6:22p Chris |
| 1066 | * Improved Dynamic path allocation |
| 1067 | * |
| 1068 | * 151 5/22/98 4:44p Chris |
| 1069 | * Added better melee hit prediction |
| 1070 | * |
| 1071 | * 150 5/22/98 11:59a Chris |
| 1072 | * Fixed improper uses of FindSoundName and made the proper static sounds |
| 1073 | * |
| 1074 | * 149 5/20/98 5:12p Chris |
| 1075 | * Print the notify number a robot gets when it is invalid |
| 1076 | * |
| 1077 | * 148 5/20/98 10:22a Chris |
| 1078 | * Improved targetting stuff |
| 1079 | * |
| 1080 | * 147 5/20/98 10:19a Chris |
| 1081 | * Fixed some bugs with status_reg's and circle distance |
| 1082 | * |
| 1083 | * 146 5/19/98 2:53p Chris |
| 1084 | * CreateObject in OSIRIS works outside now. |
| 1085 | * |
| 1086 | * 145 5/18/98 8:06p Chris |
| 1087 | * Made melee attacks closer to what I want in terms of functionality |
| 1088 | * |
| 1089 | * 144 5/18/98 12:40p Chris |
| 1090 | * Added a new flag (F_BLINE_IF_SEE_GOAL) |
| 1091 | * |
| 1092 | * 143 5/18/98 11:16a Chris |
| 1093 | * Fixed a problem with the GetToObj goal (an if statement was f*cked up) |
| 1094 | * |
| 1095 | * 142 5/17/98 9:07p Chris |
| 1096 | * Fixed melee attacks. Thanks to Ala. :) |
| 1097 | * |
| 1098 | * 141 5/17/98 8:05p Chris |
| 1099 | * |
| 1100 | * 140 5/17/98 7:54p Chris |
| 1101 | * Correctly integrated the goal system and circle distance stuff. Added |
| 1102 | * support for "target goals". |
| 1103 | * |
| 1104 | * 139 5/15/98 2:58p Chris |
| 1105 | * More on the big AI update |
| 1106 | * |
| 1107 | * 138 5/14/98 3:01p Chris |
| 1108 | * More new AI code |
| 1109 | * |
| 1110 | * 137 5/14/98 12:21p Chris |
| 1111 | * Updating AI system... Incomplete |
| 1112 | * |
| 1113 | * 136 5/12/98 3:46p Chris |
| 1114 | * Added some notify/goal system stuff and orientation to velocity |
| 1115 | * |
| 1116 | * 135 5/11/98 4:39p Chris |
| 1117 | * Improved AI system (goals have notifies and are more flexable). |
| 1118 | * |
| 1119 | * 134 5/04/98 4:20p Chris |
| 1120 | * Energy Drain |
| 1121 | * |
| 1122 | * 133 5/04/98 4:04p Chris |
| 1123 | * Minestone checkin' -- energy effect and more AI functionality |
| 1124 | * |
| 1125 | * 132 5/04/98 12:22p Chris |
| 1126 | * Hacked some buddy bot code |
| 1127 | * |
| 1128 | * 131 5/04/98 11:00a Chris |
| 1129 | * Hacks |
| 1130 | * |
| 1131 | * 130 5/03/98 7:02p Chris |
| 1132 | * Improved sound support for AI system |
| 1133 | * |
| 1134 | * 129 5/03/98 6:03p Chris |
| 1135 | * Added sound support to the animation system |
| 1136 | * |
| 1137 | * 128 5/03/98 5:38p Chris |
| 1138 | * Added sounds to anim page |
| 1139 | * |
| 1140 | * 127 5/01/98 7:53p Chris |
| 1141 | * |
| 1142 | * 126 5/01/98 7:52p Chris |
| 1143 | * Turn toward player - not last see position |
| 1144 | * |
| 1145 | * 125 5/01/98 3:41p Chris |
| 1146 | * |
| 1147 | * 124 5/31/98 3:03p Chris |
| 1148 | * Added death animations |
| 1149 | * |
| 1150 | * 123 4/30/98 2:03p Chris |
| 1151 | * Fixed the robot jiggyness problem. :) |
| 1152 | * |
| 1153 | * 122 4/30/98 11:31a Chris |
| 1154 | * Massive upgrades to the AI system |
| 1155 | * |
| 1156 | * 121 4/22/98 9:43p Chris |
| 1157 | * More AI improvements |
| 1158 | * |
| 1159 | * 120 4/22/98 4:15p Chris |
| 1160 | * Improved DebugBlockPrint |
| 1161 | * |
| 1162 | * 119 4/22/98 3:50p Chris |
| 1163 | * Added DebugBlockPrint |
| 1164 | * |
| 1165 | * 118 4/22/98 1:15p Chris |
| 1166 | * Incremental work on paths and goals |
| 1167 | * |
| 1168 | * 117 4/21/98 11:25a Chris |
| 1169 | * Improving GET_TO_OBJ goal |
| 1170 | * |
| 1171 | * 116 4/20/98 12:27p Chris |
| 1172 | * Made AIG_GET_TO_OBJECT work. |
| 1173 | * |
| 1174 | * 115 4/19/98 9:56p Chris |
| 1175 | * AI system is integrated with OSIRIS. Path system is integrated with |
| 1176 | * the AI system. Bugs will ensue. |
| 1177 | * |
| 1178 | * 114 4/17/98 1:59p Jason |
| 1179 | * added cool object effects |
| 1180 | * |
| 1181 | * 113 4/16/98 2:56p Chris |
| 1182 | * Updated buddy support and intergrated scripting and AI |
| 1183 | * |
| 1184 | * 112 4/15/98 5:56p Chris |
| 1185 | * Made the AI system script friendly |
| 1186 | * |
| 1187 | * 111 4/14/98 3:20p Chris |
| 1188 | * Made quirks happen more often |
| 1189 | * |
| 1190 | * 110 4/14/98 11:42a Chris |
| 1191 | * Added quirks and a better way of getting from idle to alert and from |
| 1192 | * alert to idle. |
| 1193 | * |
| 1194 | * 109 4/13/98 7:38p Chris |
| 1195 | * Added more support for a 'real' AI. |
| 1196 | * |
| 1197 | * 108 4/13/98 6:54p Chris |
| 1198 | * Improved the animation system. |
| 1199 | * |
| 1200 | * 107 4/13/98 2:20p Chris |
| 1201 | * IDLe works (kindof) |
| 1202 | * |
| 1203 | * 106 4/07/98 4:25p Chris |
| 1204 | * Added support for buddy bot |
| 1205 | * |
| 1206 | * 105 3/31/98 4:23p Chris |
| 1207 | * Added a new AIpath system |
| 1208 | * |
| 1209 | * 104 3/25/98 5:51p Chris |
| 1210 | * Added full model/body animations for weapon firing |
| 1211 | * |
| 1212 | * 103 3/25/98 11:02a Chris |
| 1213 | * version 1.0 of the new AI ranged firing code. |
| 1214 | * |
| 1215 | * 102 3/24/98 3:20p Chris |
| 1216 | * Improved local wb anim system |
| 1217 | * |
| 1218 | * 101 3/23/98 6:16p Chris |
| 1219 | * added some soar_helpers and some debug mprintf's |
| 1220 | * |
| 1221 | * 100 3/23/98 10:01a Chris |
| 1222 | * Added independant wb animations |
| 1223 | * |
| 1224 | * 99 3/17/98 11:27a Chris |
| 1225 | * Added object bump notifies for AI |
| 1226 | * |
| 1227 | * 98 3/13/98 5:55p Chris |
| 1228 | * Fixed problems with animations |
| 1229 | * |
| 1230 | * 97 3/12/98 7:30p Chris |
| 1231 | * Added ObjSetOrient |
| 1232 | * |
| 1233 | * 96 3/12/98 5:48p Chris |
| 1234 | * Fixed a bug in the animation cycle times |
| 1235 | * |
| 1236 | * 95 3/10/98 2:15p Chris |
| 1237 | * Made turrets with a zero angle fov usable to join sub-objects (for fire |
| 1238 | * animations) |
| 1239 | * |
| 1240 | * 94 3/10/98 12:51p Chris |
| 1241 | * Added a truely D2 style homing missile |
| 1242 | * |
| 1243 | * 93 3/05/98 11:34a Chris |
| 1244 | * Added the move_behind_object function |
| 1245 | * |
| 1246 | * 92 3/03/98 5:02p Chris |
| 1247 | * Added a status register to the ai_frame. Also, I enabled a bunch of |
| 1248 | * the fields from the AI Dialog. In addiition, I tweaked how melee |
| 1249 | * attacks work and animate. |
| 1250 | * |
| 1251 | * 91 3/02/98 6:52p Chris |
| 1252 | * Changed melee_dist to melee_damage |
| 1253 | * |
| 1254 | * 90 2/27/98 7:22p Chris |
| 1255 | * Started to add new AI fields -- no way near complete |
| 1256 | * |
| 1257 | * 89 2/20/98 3:24p Chris |
| 1258 | * |
| 1259 | * 88 2/19/98 6:16p Chris |
| 1260 | * Working on AI |
| 1261 | * |
| 1262 | * 87 2/18/98 8:42p Chris |
| 1263 | * Improving on the big object problem |
| 1264 | * |
| 1265 | * 86 2/18/98 4:47a Chris |
| 1266 | * |
| 1267 | * 85 2/18/98 4:38a Chris |
| 1268 | * |
| 1269 | * 84 2/18/98 4:37a Chris |
| 1270 | * |
| 1271 | * 83 2/18/98 4:18a Chris |
| 1272 | * |
| 1273 | * 82 2/18/98 4:13a Chris |
| 1274 | * |
| 1275 | * 81 2/18/98 4:05a Chris |
| 1276 | * |
| 1277 | * 80 2/17/98 11:31p Chris |
| 1278 | * |
| 1279 | * 79 2/17/98 4:24p Chris |
| 1280 | * Allow for simple walking robots |
| 1281 | * |
| 1282 | * 78 2/17/98 1:34p Chris |
| 1283 | * Improved timing of tear sound for melee |
| 1284 | * |
| 1285 | * 77 2/17/98 1:17p Chris |
| 1286 | * Improving the melee robots |
| 1287 | * |
| 1288 | * 76 2/17/98 1:05p Chris |
| 1289 | * Added in melee hit sound and effect |
| 1290 | * |
| 1291 | * 75 2/16/98 11:19p Chris |
| 1292 | * Added support for melee robots |
| 1293 | * |
| 1294 | * 74 2/16/98 4:56p Chris |
| 1295 | * Added melee attack support |
| 1296 | * |
| 1297 | * 73 2/16/98 3:50p Chris |
| 1298 | * Robots take melee swipes |
| 1299 | * |
| 1300 | * 72 2/16/98 1:05p Chris |
| 1301 | * Added some Flinch support |
| 1302 | * |
| 1303 | * 71 2/16/98 2:45a Chris |
| 1304 | * Massive improvements to the animation system and the AI |
| 1305 | * |
| 1306 | * 70 2/11/98 11:39a Chris |
| 1307 | * |
| 1308 | * 69 2/11/98 11:38a Chris |
| 1309 | * Added additional support to the beginning points on paths |
| 1310 | * |
| 1311 | * 68 2/11/98 11:06a Chris |
| 1312 | * Fixed the orient to node code. Thanks be to AI. |
| 1313 | * |
| 1314 | * 67 2/10/98 5:48p Chris |
| 1315 | * Improving the heuristic for when we update_next_path nodes. |
| 1316 | * |
| 1317 | * 66 2/10/98 4:45p Chris |
| 1318 | * Incremental changes: Made a new node_orient heuristic. Removed some |
| 1319 | * bad fields from the ai_info struct. |
| 1320 | * |
| 1321 | * 65 2/10/98 12:09a Chris |
| 1322 | * Improving the awareness system. Re-enabled super dodging. Added the |
| 1323 | * auto-fluctuate speed flag (allows some diversity). Enabled FOV |
| 1324 | * information. |
| 1325 | * |
| 1326 | * 64 2/06/98 5:51p Chris |
| 1327 | * Added the ability turn robots on and off |
| 1328 | * |
| 1329 | * 63 2/06/98 4:19p Chris |
| 1330 | * Added a boat load of path stuff |
| 1331 | * |
| 1332 | * 62 2/06/98 2:15a Chris |
| 1333 | * Activated the max_velocity, max_delta_velocity, and max_turn_rate |
| 1334 | * fields for AI objects. |
| 1335 | * |
| 1336 | * 61 2/05/98 6:55p Chris |
| 1337 | * Align orientation to path |
| 1338 | * |
| 1339 | * 60 2/04/98 6:09p Matt |
| 1340 | * Changed object room number to indicate a terrain cell via a flag. Got |
| 1341 | * rid of the object flag which used to indicate terrain. |
| 1342 | * |
| 1343 | * 59 2/03/98 6:33p Chris |
| 1344 | * Improving the path system |
| 1345 | * |
| 1346 | * 58 2/03/98 3:35p Chris |
| 1347 | * Added path support for AI and OSIRIS |
| 1348 | * |
| 1349 | * 57 2/02/98 8:15p Chris |
| 1350 | * Updated the AI system |
| 1351 | * |
| 1352 | * 56 2/02/98 11:06a Chris |
| 1353 | * |
| 1354 | * 55 1/30/98 4:09p Chris |
| 1355 | * |
| 1356 | * 54 1/30/98 4:07p Chris |
| 1357 | * |
| 1358 | * 53 1/30/98 3:42p Chris |
| 1359 | * Removed a bad memset (it zerod out static values) |
| 1360 | * |
| 1361 | * 52 1/30/98 2:19p Chris |
| 1362 | * More improvements (target vis stuff and setting of the AIN_ALWAYS_ON is |
| 1363 | * now done correctly) |
| 1364 | * |
| 1365 | * 51 1/29/98 3:29p Chris |
| 1366 | * Major update to the AI system. |
| 1367 | * |
| 1368 | * 50 1/21/98 3:54p Chris |
| 1369 | * |
| 1370 | * 49 1/20/98 4:40p Chris |
| 1371 | * Fixed some visability stuff. |
| 1372 | * |
| 1373 | * 48 1/20/98 12:21p Chris |
| 1374 | * Removed some printf's |
| 1375 | * |
| 1376 | * 47 1/20/98 11:34a Chris |
| 1377 | * Fixed problems with player visability and thus problems with awareness |
| 1378 | * |
| 1379 | * 46 1/19/98 10:04a Matt |
| 1380 | * Added new object handle system |
| 1381 | * |
| 1382 | * 45 1/14/98 7:58p Chris |
| 1383 | * |
| 1384 | * 44 12/09/97 2:48p Chris |
| 1385 | * Temporary less dodgy bots |
| 1386 | * |
| 1387 | * 43 11/24/97 4:12p Chris |
| 1388 | * Cleaner code |
| 1389 | * |
| 1390 | * 42 11/24/97 10:17a Chris |
| 1391 | * Handles dead, dying, and cloaked players |
| 1392 | * |
| 1393 | * 41 11/21/97 3:05p Chris |
| 1394 | * Robots will not fired at the player after he is dead. |
| 1395 | * |
| 1396 | * 40 11/21/97 1:14p Chris |
| 1397 | * Improved hueristic for robot firing. |
| 1398 | * |
| 1399 | * 39 11/17/97 9:48p Chris |
| 1400 | * Added some guarding |
| 1401 | * |
| 1402 | * 38 11/17/97 6:01p Chris |
| 1403 | * thief update |
| 1404 | * |
| 1405 | * 37 11/17/97 5:59p Chris |
| 1406 | * Allowed some thief stuff |
| 1407 | * |
| 1408 | * 36 11/17/97 5:46p Chris |
| 1409 | * Added some support for a Theif-like robot |
| 1410 | * |
| 1411 | * 35 11/15/97 6:39p Chris |
| 1412 | * Made robot firing signifantly less CPU costly. But, turrets are now |
| 1413 | * more choppy moving. |
| 1414 | * |
| 1415 | * 34 11/14/97 11:55p Chris |
| 1416 | * Dodge goals are semi-functional |
| 1417 | * |
| 1418 | * 33 11/13/97 3:56p Chris |
| 1419 | * Evading a little more random |
| 1420 | * |
| 1421 | * 32 11/13/97 3:34p Chris |
| 1422 | * Improved AI |
| 1423 | * |
| 1424 | * 31 11/12/97 5:47p Chris |
| 1425 | * Incremental improvements |
| 1426 | * |
| 1427 | * 30 11/12/97 10:43a Chris |
| 1428 | * Incremental |
| 1429 | * |
| 1430 | * 29 11/11/97 12:22p Chris |
| 1431 | * Incremental improvements |
| 1432 | * |
| 1433 | * 28 11/06/97 12:47p Chris |
| 1434 | * Some new incremental stuff |
| 1435 | * |
| 1436 | * 27 11/04/97 6:20p Chris |
| 1437 | * Added some incremental improvements |
| 1438 | * |
| 1439 | * 26 10/28/97 12:25p Chris |
| 1440 | * Added support for initial class, type, and movement types. Starting to |
| 1441 | * flush out the AI structure |
| 1442 | * |
| 1443 | * 25 9/23/97 5:47p Jason |
| 1444 | * return if "animation system not done" message is printed |
| 1445 | * |
| 1446 | * 24 9/18/97 1:27p Matt |
| 1447 | * Cleaned up object struct |
| 1448 | * |
| 1449 | * 23 9/17/97 11:31a Chris |
| 1450 | * |
| 1451 | * 22 9/15/97 4:07p Chris |
| 1452 | * AI only fires if you are in the same render as they are. |
| 1453 | * |
| 1454 | * 21 9/10/97 1:24p Chris |
| 1455 | * Fixed a bug with the wb firing masks |
| 1456 | * |
| 1457 | * 20 9/10/97 12:56p Chris |
| 1458 | * Added more support for weapon batteries |
| 1459 | * |
| 1460 | * 19 9/08/97 11:50a Chris |
| 1461 | * Added support for entering seconds-per-cycle animation information |
| 1462 | * |
| 1463 | * 18 9/05/97 8:52p Chris |
| 1464 | * Furthered the weapon bank support |
| 1465 | * |
| 1466 | * 17 9/04/97 3:50p Chris |
| 1467 | * Added new turret support |
| 1468 | * |
| 1469 | * 16 9/03/97 2:12p Chris |
| 1470 | * Added new weapon battery system and made the animation system usable. |
| 1471 | * |
| 1472 | * 15 8/20/97 3:13p Chris |
| 1473 | * |
| 1474 | * 14 8/11/97 1:53p Matt |
| 1475 | * Ripped out robot & powerup pages, and added generic page |
| 1476 | * |
| 1477 | * 13 8/06/97 1:35p Matt |
| 1478 | * Changes for new generic object_info struct which replace robot-specific |
| 1479 | * structure |
| 1480 | * |
| 1481 | * 12 8/05/97 12:29p Chris |
| 1482 | * |
| 1483 | * 11 7/30/97 4:10p Chris |
| 1484 | * Made test bot more interesting. |
| 1485 | * |
| 1486 | * 10 7/30/97 1:31p Chris |
| 1487 | * Made helicopters slightly more interesting. |
| 1488 | * |
| 1489 | * 9 7/29/97 12:20p Chris |
| 1490 | * Incremental improvements. Fixed a memory bug. |
| 1491 | * |
| 1492 | * 8 7/28/97 1:19p Chris |
| 1493 | * Expanding the AI system |
| 1494 | * |
| 1495 | * 7 7/16/97 5:15p Chris |
| 1496 | * Fixed use of updating 3d sounds |
| 1497 | * |
| 1498 | * 6 7/15/97 7:29p Chris |
| 1499 | * Added a sound for helicopter blades. |
| 1500 | * |
| 1501 | * 5 7/15/97 5:35p Chris |
| 1502 | * New AI code |
| 1503 | * |
| 1504 | * 4 7/15/97 4:59p Chris |
| 1505 | * added support for AI and animations |
| 1506 | * |
| 1507 | * $NoKeywords: $ |
| 1508 | */ |
| 1509 | |
| 1510 | #include <stdlib.h> |
| 1511 | #include "AIMain.h"cxx . . $ `<file>/Descent3/AIMain.h`/ |
| 1512 | #include "mono.h"cxx . . $ `<file>/ddebug/mono.h`/ |
| 1513 | #include "game.h"cxx . . $ `<file>/Descent3/game.h`/ |
| 1514 | #include "weapon.h"cxx . . $ `<file>/Descent3/weapon.h`/ |
| 1515 | #include "findintersection.h"cxx . . $ `<file>/physics/findintersection.h`/ |
| 1516 | #include "vecmat.h"cxx . . $ `<file>/lib/vecmat.h`/ |
| 1517 | #include "AIGoal.h"cxx . . $ `<file>/Descent3/AIGoal.h`/ |
| 1518 | #include "terrain.h"cxx . . $ `<file>/Descent3/terrain.h`/ |
| 1519 | #include "hlsoundlib.h"cxx . . $ `<file>/sndlib/hlsoundlib.h`/ |
| 1520 | #include "sounds.h"cxx . . $ `<file>/Descent3/sounds.h`/ |
| 1521 | #include "aiterrain.h"cxx . . $ `<file>/Descent3/aiterrain.h`/ |
| 1522 | #include "weapon.h"cxx . . $ `<file>/Descent3/weapon.h`/ |
| 1523 | #include "objinfo.h"cxx . . $ `<file>/Descent3/objinfo.h`/ |
| 1524 | #include "polymodel.h"cxx . . $ `<file>/model/polymodel.h`/ |
| 1525 | #include "robotfire.h"cxx . . $ `<file>/Descent3/robotfire.h`/ |
| 1526 | #include "BOA.h"cxx . . $ `<file>/Descent3/BOA.h`/ |
| 1527 | #include "player.h"cxx . . $ `<file>/Descent3/player.h`/ |
| 1528 | #include "memory.h" |
| 1529 | #include "gamepath.h"cxx . . $ `<file>/Descent3/gamepath.h`/ |
| 1530 | #include "soundload.h"cxx . . $ `<file>/sndlib/soundload.h`/ |
| 1531 | #include "damage.h"cxx . . $ `<file>/Descent3/damage.h`/ |
| 1532 | #include "aipath.h"cxx . . $ `<file>/Descent3/aipath.h`/ |
| 1533 | #include "robot.h"cxx . . $ `<file>/Descent3/robot.h`/ |
| 1534 | #include "attach.h"cxx . . $ `<file>/Descent3/attach.h`/ |
| 1535 | #include "demofile.h"cxx . . $ `<file>/lib/demofile.h`/ |
| 1536 | #include "matcen.h"cxx . . $ `<file>/Descent3/matcen.h`/ |
| 1537 | #include "physics.h"cxx . . $ `<file>/physics/physics.h`/ |
| 1538 | #include "difficulty.h"cxx . . $ `<file>/Descent3/difficulty.h`/ |
| 1539 | #include "osiris_dll.h"cxx . . $ `<file>/Descent3/osiris_dll.h`/ |
| 1540 | #include "multi.h"cxx . . $ `<file>/Descent3/multi.h`/ |
| 1541 | #include "gamecinematics.h"cxx . . $ `<file>/Descent3/gamecinematics.h`/ |
| 1542 | #include "room.h"cxx . . $ `<file>/Descent3/room.h`/ |
| 1543 | #include "psrand.h"cxx . . $ `<file>/misc/psrand.h`/ |
| 1544 | #include "gametexture.h"cxx . . $ `<file>/Descent3/gametexture.h`/ |
| 1545 | #include "difficulty.h"cxx . . $ `<file>/Descent3/difficulty.h`/ |
| 1546 | |
| 1547 | // Define's |
| 1548 | #define MAX_SEE_TARGET_DISTcxx . . $ `Descent3/AImain.cpp:1548:9`! 500.0f |
| 1549 | #define MAX_TRACK_TARGET_DISTcxx . . $ `Descent3/AImain.cpp:1549:9`! 800.0f |
| 1550 | #define MIN_VIS_RECENT_CHECK_INTERVALcxx . . $ `Descent3/AImain.cpp:1550:9`! 0.35f |
| 1551 | #define MIN_VIS_CHECK_INTERVALcxx . . $ `Descent3/AImain.cpp:1551:9`! 0.15f |
| 1552 | #define CHECK_VIS_INFREQUENTLY_TIMEcxx . . $ `Descent3/AImain.cpp:1552:9`! 7.0f |
| 1553 | #define CHECK_VIS_INFREQUENTLY_INTERVALcxx . . $ `Descent3/AImain.cpp:1553:9`! 2.0f |
| 1554 | |
| 1555 | #define MIN_TARGET_UPDATE_INTERVALcxx . . $ `Descent3/AImain.cpp:1555:9`! 2.0f |
| 1556 | #define MAX_TARGET_UPDATE_INTERVALcxx . . $ `Descent3/AImain.cpp:1556:9`! 4.5f |
| 1557 | |
| 1558 | float AI_last_time_room_noise_alert_timecxx . . $ AI_last_time_room_noise_alert_time.[MAX_ROOMScxx . . $ `Descent3/room.h:377:9`! + 8]; |
| 1559 | int AI_unique_goal_idcxx . . $ AI_unique_goal_id. = 0; |
| 1560 | |
| 1561 | #ifdef _DEBUGcxx . . $ `<built-in>:482:9`! |
| 1562 | bool AI_debug_robot_docxx . . $ AI_debug_robot_do. = false; |
| 1563 | int AI_debug_robot_indexcxx . . $ AI_debug_robot_index. = -2; |
| 1564 | #endif |
| 1565 | |
| 1566 | static bool compute_dodge_dircxx . . $ compute_dodge_dir(9fa7d4d2c8b4c2db).(/* vector *dodge_dir, */ objectcxx . . $ object# *obj, objectcxx . . $ object# *dodge_obj); |
| 1567 | static float AIDetermineObjVisLevelcxx . . $ AIDetermineObjVisLevel(b2028de646e3dfb9).(objectcxx . . $ object# *obj, objectcxx . . $ object# *target); |
| 1568 | static bool move_relative_object_veccxx . . $ move_relative_object_vec(2f4a138f1b2d22a4).(objectcxx . . $ object# *obj, vectorcxx . . $ vector# *vec, objectcxx . . $ object# *target, float circle_dist, float scalar, |
| 1569 | bool f_toward, vectorcxx . . $ vector# *mdir, bool *f_moved); |
| 1570 | static void move_away_from_positioncxx . . $ move_away_from_position(85fe40f658f75ff4).(objectcxx . . $ object# *obj, vectorcxx . . $ vector# *pos /*, bool random_evade*/, float scale, vectorcxx . . $ vector# *mdir, |
| 1571 | bool *f_moved); |
| 1572 | static bool goal_do_dodgecxx . . $ goal_do_dodge(9985ed114f2bfc78).(objectcxx . . $ object# *obj, int goal_index); |
| 1573 | static bool goal_do_avoid_wallscxx . . $ goal_do_avoid_walls(723205ab969e3cce).(objectcxx . . $ object# *obj, vectorcxx . . $ vector# *mdir); |
| 1574 | static bool MeleeHitOkcxx . . $ MeleeHitOk(39516aeee13ca5ab).(objectcxx . . $ object# *obj); |
| 1575 | static bool AiMeleecxx . . $ AiMelee(39516aeee13ca5ab).(objectcxx . . $ object# *obj); |
| 1576 | static void do_ranged_attackcxx . . $ do_ranged_attack(419c470199a90a97).(objectcxx . . $ object# *obj); |
| 1577 | static bool AIDetermineAimPointcxx . . $ AIDetermineAimPoint(f3784d1ff02632da).(objectcxx . . $ object# *robot, objectcxx . . $ object# *target, vectorcxx . . $ vector# *aim_pt, float weapon_speed = 0.0f); |
| 1578 | static vectorcxx . . $ vector# *AIDetermineFovVeccxx . . $ AIDetermineFovVec(899400cfb1a8da78).(objectcxx . . $ object# *obj, vectorcxx . . $ vector# *fov); |
| 1579 | static void AISeeTargetcxx . . $ AISeeTarget(674fac047436fc5b).(objectcxx . . $ object# *obj, bool f_see); |
| 1580 | static void ai_do_animationcxx . . $ ai_do_animation(4ebbd0c3cbf1b78a).(objectcxx . . $ object# *obj, float anim_time); |
| 1581 | static void ObjSetAIInfocxx . . $ ObjSetAIInfo(419c470199a90a97).(objectcxx . . $ object# *objp); |
| 1582 | static void AICheckTargetViscxx . . $ AICheckTargetVis(419c470199a90a97).(objectcxx . . $ object# *obj); |
| 1583 | static void ai_update_registerscxx . . $ ai_update_registers(419c470199a90a97).(objectcxx . . $ object# *obj); |
| 1584 | static bool AiGoalAvoidcxx . . $ AiGoalAvoid(b73dfffb7c1354e0).(vectorcxx . . $ vector# *adir, objectcxx . . $ object# *obj, objectcxx . . $ object# *a_obj, float dist); |
| 1585 | static void AIGoalDoRepulsecxx . . $ AIGoalDoRepulse(7da590384b204f40).(objectcxx . . $ object# *obj, float dist, vectorcxx . . $ vector# *dir, goalcxx . . $ goal# *goal, vectorcxx . . $ vector# *mdir); |
| 1586 | static void AIGoalDoCohesioncxx . . $ AIGoalDoCohesion(6d8f4adb736eccd0).(objectcxx . . $ object# *obj, objectcxx . . $ object# *g_obj, float dist, goalcxx . . $ goal# *goal, vectorcxx . . $ vector# *mdir); |
| 1587 | static void AIGoalDoAlignmentcxx . . $ AIGoalDoAlignment(7da590384b204f40).(objectcxx . . $ object# *obj, float dist, vectorcxx . . $ vector# *fvec, goalcxx . . $ goal# *goal, vectorcxx . . $ vector# *mdir); |
| 1588 | static void AIDoTrackFramecxx . . $ AIDoTrackFrame(419c470199a90a97).(objectcxx . . $ object# *obj); |
| 1589 | static void AIDoOrientVelocitycxx . . $ AIDoOrientVelocity(419c470199a90a97).(objectcxx . . $ object# *obj); |
| 1590 | static void AIDoOrientDefaultcxx . . $ AIDoOrientDefault(419c470199a90a97).(objectcxx . . $ object# *obj); |
| 1591 | static void AIDoOrientcxx . . $ AIDoOrient(766a1b7183ffa4b4).(objectcxx . . $ object# *obj, int g_index); |
| 1592 | static void AIDetermineSpeedcxx . . $ AIDetermineSpeed(2aa63262ee1f5e07).(objectcxx . . $ object# *obj, int flags, float *speed); |
| 1593 | static void ai_movecxx . . $ ai_move(419c470199a90a97).(objectcxx . . $ object# *obj); |
| 1594 | static void ai_firecxx . . $ ai_fire(419c470199a90a97).(objectcxx . . $ object# *obj); |
| 1595 | static int AIGetTeamcxx . . $ AIGetTeam(2da2a862cad4c994).(objectcxx . . $ object# *obj); |
| 1596 | static void AITargetCheckcxx . . $ AITargetCheck(4dd6dd5a44f23de7).(objectcxx . . $ object# *obj, objectcxx . . $ object# *target, objectcxx . . $ object# **best_obj, float *best_dot, float *best_dist); |
| 1597 | static void AIDetermineTargetcxx . . $ AIDetermineTarget(419c470199a90a97).(objectcxx . . $ object# *obj); |
| 1598 | static void AIDoFreudcxx . . $ AIDoFreud(419c470199a90a97).(objectcxx . . $ object# *obj); |
| 1599 | static void AIDoMemFramecxx . . $ AIDoMemFrame(419c470199a90a97).(objectcxx . . $ object# *obj); |
| 1600 | |
| 1601 | // chrishack -- AI problems |
| 1602 | |
| 1603 | // first frame problems: |
| 1604 | // If a robot has an initial velocity it might fly off because of excessive Frametime of the first frame |
| 1605 | // If a player fires on the first frame, robots will not know |
| 1606 | |
| 1607 | // Inside walkers will suck resources |
| 1608 | |
| 1609 | const char *const Ai_class_stringscxx . . $ Ai_class_strings.[MAX_AI_INIT_CLASSEScxx . . $ `Descent3/aistruct.h:419:9`!] = {"Static", "Pure Path", "Fully AIS"}; |
| 1610 | |
| 1611 | const char *const Ai_type_stringscxx . . $ Ai_type_strings.[MAX_AI_INIT_TYPEScxx . . $ `Descent3/aistruct.h:422:9`!] = { |
| 1612 | "Fly Lander", "Stalker", "Evader 1", "Evader 2", "Stationary Turret", "AIS", "Melee1", "Bird Flock 1", "Herd 1"}; |
| 1613 | |
| 1614 | const char *const Ai_movement_type_stringscxx . . $ Ai_movement_type_strings.[MAX_AI_INIT_MOVEMENT_TYPEScxx . . $ `Descent3/aistruct.h:425:9`!] = {"Standing", "Flying", "Rolling", "Walking"}; |
| 1615 | |
| 1616 | // AI Movement flying types |
| 1617 | const char *const Ai_movement_subtype_flying_stringscxx . . $ Ai_movement_subtype_flying_strings.[MAX_AI_INIT_MOVEMENT_SUBTYPEScxx . . $ `Descent3/aistruct.h:428:9`!] = { |
| 1618 | "Normal", "Path", "Helicopter", "Hovercraft", "Jet", "Player", "Buddy"}; |
| 1619 | |
| 1620 | // AI Movement walking types |
| 1621 | |
| 1622 | const char *const Ai_movement_subtype_walking_stringscxx . . $ Ai_movement_subtype_walking_strings.[MAX_AI_INIT_MOVEMENT_SUBTYPEScxx . . $ `Descent3/aistruct.h:428:9`!] = { |
| 1623 | "Restricted Flat", "Restricted Low-angle", "Restricted High_angle", "Non-restricted", "Water Only", "", ""}; |
| 1624 | |
| 1625 | #define AI_MAX_MELEE_RANGEcxx . . $ `Descent3/AImain.cpp:1625:9`! 5.0f |
| 1626 | |
| 1627 | int AI_NumRenderedcxx . . $ AI_NumRendered.; |
| 1628 | int AI_RenderedListcxx . . $ AI_RenderedList.[MAX_OBJECTScxx . . $ `lib/object_external_struct.h:107:9`!]; |
| 1629 | |
| 1630 | int AI_NumHostileAlertcxx . . $ AI_NumHostileAlert. = 0; |
| 1631 | |
| 1632 | int Buddy_handlecxx . . $ Buddy_handle.[MAX_PLAYERScxx . . $ `Descent3/player_external_struct.h:86:9`!]; |
| 1633 | |
| 1634 | static int AI_FriendNumNearcxx . . $ AI_FriendNumNear. = 0; // Number of friends found |
| 1635 | static objectcxx . . $ object# *AI_FriendObjcxx . . $ AI_FriendObj.[2]; // Friend objects |
| 1636 | static float AI_FriendDistcxx . . $ AI_FriendDist.[2]; // Distances to the friends |
| 1637 | static vectorcxx . . $ vector# AI_FriendDircxx . . $ AI_FriendDir.[2]; // Direction to the friends |
| 1638 | static int AI_EnemyNumNearcxx . . $ AI_EnemyNumNear. = 0; // Number of enemies found |
| 1639 | static objectcxx . . $ object# *AI_EnemyObjcxx . . $ AI_EnemyObj.[2]; // Enemy objects |
| 1640 | static float AI_EnemyDistcxx . . $ AI_EnemyDist.[2]; // Distances to the enemies |
| 1641 | static vectorcxx . . $ vector# AI_EnemyDircxx . . $ AI_EnemyDir.[2]; // Direction to the enemies |
| 1642 | |
| 1643 | #define AIVIS_NONEcxx . . $ `Descent3/AImain.cpp:1643:9`! 0.0f |
| 1644 | #define AIVIS_BARELYcxx . . $ `Descent3/AImain.cpp:1644:9`! 1.0f |
| 1645 | #define AIVIS_MOSTLYcxx . . $ `Descent3/AImain.cpp:1645:9`! 2.0f |
| 1646 | #define AIVIS_FULLcxx . . $ `Descent3/AImain.cpp:1646:9`! 3.0f |
| 1647 | |
| 1648 | // Allows the vis sliders to work |
| 1649 | float AIDetermineObjVisLevelcxx . . $ AIDetermineObjVisLevel(b2028de646e3dfb9).(objectcxx . . $ object# *obj, objectcxx . . $ object# *target) { |
| 1650 | float vis_level = AIVIS_FULLcxx . . $ `Descent3/AImain.cpp:1646:9`!; |
| 1651 | |
| 1652 | if (target == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) |
| 1653 | return AIVIS_NONEcxx . . $ `Descent3/AImain.cpp:1643:9`!; |
| 1654 | |
| 1655 | if ((target->effect_infocxx . . $ object#effect_info.) && (target->effect_infocxx . . $ object#effect_info.->type_flagscxx . . $ effect_info_s#type_flags. & EF_CLOAKEDcxx . . $ `Descent3/object_external.h:197:9`!)) { |
| 1656 | vis_level = AIVIS_NONEcxx . . $ `Descent3/AImain.cpp:1643:9`!; |
| 1657 | |
| 1658 | if (target->typecxx . . $ object#type. == OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`! && (Playerscxx . . $ Players.[target->idcxx . . $ object#id.].flagscxx . . $ player#flags. & PLAYER_FLAGS_AFTERBURN_ONcxx . . $ `Descent3/player_external.h:92:9`!)) { |
| 1659 | vis_level += 1.0f; |
| 1660 | } |
| 1661 | |
| 1662 | if (target->typecxx . . $ object#type. == OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`! && (Playerscxx . . $ Players.[target->idcxx . . $ object#id.].flagscxx . . $ player#flags. & PLAYER_FLAGS_HEADLIGHTcxx . . $ `Descent3/player_external.h:90:9`!)) { |
| 1663 | vectorcxx . . $ vector# from_target = obj->poscxx . . $ object#pos. -cxx . . $ operator-(b77b703cd1e43e33). target->poscxx . . $ object#pos.; |
| 1664 | vm_NormalizeVectorcxx . . $ vm_NormalizeVector(4939a7e530383cd4).(&from_target); |
| 1665 | |
| 1666 | if ((target->orientcxx . . $ object#orient..fveccxx . . $ matrix#fvec.) *cxx . . $ `operator*`(4a721543d64e126a). (from_target) > 0.965f) { |
| 1667 | vis_level += 1.0f; |
| 1668 | } |
| 1669 | } |
| 1670 | } |
| 1671 | |
| 1672 | if ((target->effect_infocxx . . $ object#effect_info.) && (target->effect_infocxx . . $ object#effect_info.->type_flagscxx . . $ effect_info_s#type_flags. & EF_NAPALMEDcxx . . $ `Descent3/object_external.h:200:9`!)) { |
| 1673 | vis_level += 1.75; |
| 1674 | } |
| 1675 | |
| 1676 | if (vis_level < AIVIS_NONEcxx . . $ `Descent3/AImain.cpp:1643:9`!) |
| 1677 | vis_level = AIVIS_NONEcxx . . $ `Descent3/AImain.cpp:1643:9`!; |
| 1678 | else if (vis_level > AIVIS_FULLcxx . . $ `Descent3/AImain.cpp:1646:9`!) |
| 1679 | vis_level = AIVIS_FULLcxx . . $ `Descent3/AImain.cpp:1646:9`!; |
| 1680 | |
| 1681 | return vis_level; |
| 1682 | } |
| 1683 | |
| 1684 | static inline bool ai_target_validcxx . . $ ai_target_valid(39516aeee13ca5ab).(objectcxx . . $ object# *obj) { |
| 1685 | ai_framecxx . . $ ai_frame# *ai_info = obj->ai_infocxx . . $ object#ai_info.; |
| 1686 | bool f_valid = false; |
| 1687 | |
| 1688 | if (ai_info->target_handlecxx . . $ ai_frame#target_handle. != OBJECT_HANDLE_NONEcxx . . $ `Descent3/object_external.h:156:9`!) { |
| 1689 | if (ObjGetcxx . . $ ObjGet(11672e354c0b263a).(ai_info->target_handlecxx . . $ ai_frame#target_handle.)) |
| 1690 | f_valid = true; |
| 1691 | else { |
| 1692 | AINotifycxx . . $ AINotify(f32b5964aaa42c22).(obj, AIN_TARGET_DIEDcxx . . $ `Descent3/aistruct_external.h:292:9`!, (void *)&ai_info->target_handlecxx . . $ ai_frame#target_handle.); |
| 1693 | ai_info->target_handlecxx . . $ ai_frame#target_handle. = OBJECT_HANDLE_NONEcxx . . $ `Descent3/object_external.h:156:9`!; |
| 1694 | } |
| 1695 | } |
| 1696 | |
| 1697 | return f_valid; |
| 1698 | } |
| 1699 | |
| 1700 | bool AISetTargetcxx . . $ AISetTarget(9985ed114f2bfc78).(objectcxx . . $ object# *obj, int handle) { |
| 1701 | ai_framecxx . . $ ai_frame# *ai_info = obj->ai_infocxx . . $ object#ai_info.; |
| 1702 | |
| 1703 | ai_info->target_handlecxx . . $ ai_frame#target_handle. = handle; |
| 1704 | if (handle == OBJECT_HANDLE_NONEcxx . . $ `Descent3/object_external.h:156:9`!) |
| 1705 | ai_info->last_see_target_poscxx . . $ ai_frame#last_see_target_pos. =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). obj->poscxx . . $ object#pos.; |
| 1706 | |
| 1707 | return ai_target_validcxx . . $ ai_target_valid(39516aeee13ca5ab).(obj); |
| 1708 | } |
| 1709 | |
| 1710 | // Note ASSUMES that dir is normalized |
| 1711 | void AIMoveTowardsDircxx . . $ AIMoveTowardsDir(cd233addd15cf1e2).(objectcxx . . $ object# *obj, vectorcxx . . $ vector# *dir, float scale) { |
| 1712 | physics_infocxx . . $ physics_info# *phys_info = &obj->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info.; |
| 1713 | vectorcxx . . $ vector# goal_velocity; |
| 1714 | vectorcxx . . $ vector# vel_diff; |
| 1715 | float delta_vel; |
| 1716 | float max_delta_vel; |
| 1717 | ai_framecxx . . $ ai_frame# *ai_info = obj->ai_infocxx . . $ object#ai_info.; |
| 1718 | float acc_scale; |
| 1719 | |
| 1720 | if (scale < 1.0f) |
| 1721 | acc_scale = 1.0f; |
| 1722 | else |
| 1723 | acc_scale = scale; |
| 1724 | |
| 1725 | goal_velocity =cxx . . $ vector#`operator=`(c0842353a20857d). *dir *cxx . . $ `operator*`(252247219a31502c). ai_info->max_velocitycxx . . $ ai_frame#max_velocity. *cxx . . $ `operator*`(252247219a31502c). scale; |
| 1726 | |
| 1727 | vel_diff =cxx . . $ vector#`operator=`(c0842353a20857d). goal_velocity -cxx . . $ operator-(b77b703cd1e43e33). phys_info->velocitycxx . . $ physics_info#velocity.; |
| 1728 | delta_vel = vm_NormalizeVectorcxx . . $ vm_NormalizeVector(4939a7e530383cd4).(&vel_diff); |
| 1729 | |
| 1730 | max_delta_vel = Frametimecxx . . $ Frametime. * ai_info->max_delta_velocitycxx . . $ ai_frame#max_delta_velocity. * acc_scale; |
| 1731 | |
| 1732 | if (delta_vel > max_delta_vel) { |
| 1733 | phys_info->velocitycxx . . $ physics_info#velocity. +=cxx . . $ `operator+=`(801a8d6f7ab7bef9). (vel_diff *cxx . . $ `operator*`(252247219a31502c). max_delta_vel); |
| 1734 | } else { |
| 1735 | phys_info->velocitycxx . . $ physics_info#velocity. =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). goal_velocity; |
| 1736 | } |
| 1737 | } |
| 1738 | |
| 1739 | bool AIMoveTowardsPositioncxx . . $ AIMoveTowardsPosition(e4ea9f4f5d132a1c).(objectcxx . . $ object# *obj, /*velocity *new_vel,*/ vectorcxx . . $ vector# *pos, float scale, bool stop_at_end_point, |
| 1740 | vectorcxx . . $ vector# *mdir, bool *f_moved) { |
| 1741 | vectorcxx . . $ vector# dir; |
| 1742 | float distance; |
| 1743 | ai_framecxx . . $ ai_frame# *ai_info = obj->ai_infocxx . . $ object#ai_info.; |
| 1744 | float acc_scale; |
| 1745 | |
| 1746 | if (scale < 1.0f) |
| 1747 | acc_scale = 1.0f; |
| 1748 | else |
| 1749 | acc_scale = scale; |
| 1750 | |
| 1751 | if (stop_at_end_point) { |
| 1752 | if (vm_VectorDistancecxx . . $ vm_VectorDistance(e65d563e2b53cc54).(pos, &obj->poscxx . . $ object#pos.) <= .2f) { |
| 1753 | obj->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..velocitycxx . . $ physics_info#velocity. =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). Zero_vectorcxx . . $ Zero_vector.; |
| 1754 | *f_moved = true; |
| 1755 | return true; |
| 1756 | } |
| 1757 | |
| 1758 | float s_to_stop = (ai_info->max_velocitycxx . . $ ai_frame#max_velocity. * scale) / (ai_info->max_delta_velocitycxx . . $ ai_frame#max_delta_velocity. * acc_scale); |
| 1759 | float d_to_stop = ai_info->max_velocitycxx . . $ ai_frame#max_velocity. * scale * s_to_stop; |
| 1760 | |
| 1761 | dir =cxx . . $ vector#`operator=`(c0842353a20857d). *pos -cxx . . $ operator-(b77b703cd1e43e33). obj->poscxx . . $ object#pos.; |
| 1762 | float d_to_target = vm_NormalizeVectorcxx . . $ vm_NormalizeVector(4939a7e530383cd4).(&dir); |
| 1763 | if (d_to_target < d_to_stop) { |
| 1764 | float speed = ai_info->max_velocitycxx . . $ ai_frame#max_velocity. * scale * (d_to_target / d_to_stop); |
| 1765 | |
| 1766 | if (d_to_target <= speed * Frametimecxx . . $ Frametime.) { |
| 1767 | obj->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..velocitycxx . . $ physics_info#velocity. =cxx . . $ vector#`operator=`(c0842353a20857d). ((d_to_target / Frametimecxx . . $ Frametime.) + .09f) *cxx . . $ `operator*`(9d6577ff3e9faa29). dir; |
| 1768 | } else { |
| 1769 | obj->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..velocitycxx . . $ physics_info#velocity. =cxx . . $ vector#`operator=`(c0842353a20857d). dir *cxx . . $ `operator*`(252247219a31502c). (speed + .1f); |
| 1770 | } |
| 1771 | |
| 1772 | *f_moved = true; |
| 1773 | return false; |
| 1774 | } |
| 1775 | } |
| 1776 | |
| 1777 | if (*pos ==cxx . . $ `operator==`(718c890c104af0f3). obj->poscxx . . $ object#pos.) { |
| 1778 | physics_infocxx . . $ physics_info# *phys_info = &obj->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info.; |
| 1779 | |
| 1780 | if (phys_info->velocitycxx . . $ physics_info#velocity. !=cxx . . $ `operator!=`(718c890c104af0f3). Zero_vectorcxx . . $ Zero_vector.) { |
| 1781 | vectorcxx . . $ vector# vel_diff = -cxx . . $ operator-(9e07539e219c6f20).phys_info->velocitycxx . . $ physics_info#velocity.; |
| 1782 | float delta_vel = vm_NormalizeVectorcxx . . $ vm_NormalizeVector(4939a7e530383cd4).(&vel_diff); |
| 1783 | float max_delta_vel = Frametimecxx . . $ Frametime. * ai_info->max_delta_velocitycxx . . $ ai_frame#max_delta_velocity. * acc_scale; |
| 1784 | |
| 1785 | if (delta_vel > max_delta_vel) { |
| 1786 | phys_info->velocitycxx . . $ physics_info#velocity. +=cxx . . $ `operator+=`(801a8d6f7ab7bef9). (vel_diff *cxx . . $ `operator*`(252247219a31502c). max_delta_vel); |
| 1787 | } else { |
| 1788 | vm_MakeZerocxx . . $ vm_MakeZero(ec8cf6451c36d470).(&phys_info->velocitycxx . . $ physics_info#velocity.); |
| 1789 | } |
| 1790 | } |
| 1791 | |
| 1792 | *f_moved = true; |
| 1793 | return false; |
| 1794 | } else { |
| 1795 | dir =cxx . . $ vector#`operator=`(c0842353a20857d). *pos -cxx . . $ operator-(b77b703cd1e43e33). obj->poscxx . . $ object#pos.; |
| 1796 | distance = vm_NormalizeVectorcxx . . $ vm_NormalizeVector(4939a7e530383cd4).(&dir); |
| 1797 | } |
| 1798 | |
| 1799 | *mdir =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). dir; |
| 1800 | *f_moved = false; |
| 1801 | |
| 1802 | // AIMoveTowardsDir(obj, &dir); |
| 1803 | return false; |
| 1804 | } |
| 1805 | |
| 1806 | bool move_relative_object_veccxx . . $ move_relative_object_vec(2f4a138f1b2d22a4).(objectcxx . . $ object# *obj, vectorcxx . . $ vector# *vec, objectcxx . . $ object# *target, float circle_dist, float scalar, bool f_toward, |
| 1807 | vectorcxx . . $ vector# *mdir, bool *f_moved) { |
| 1808 | // Getting behind an object is a 2 step process: Get to the side and then get behind. |
| 1809 | vectorcxx . . $ vector# from_target; |
| 1810 | vectorcxx . . $ vector# opposite_fvec; |
| 1811 | vectorcxx . . $ vector# goal_pos; |
| 1812 | ai_framecxx . . $ ai_frame# *ai_info = obj->ai_infocxx . . $ object#ai_info.; |
| 1813 | bool f_done = false; |
| 1814 | |
| 1815 | from_target =cxx . . $ vector#`operator=`(c0842353a20857d). obj->poscxx . . $ object#pos. -cxx . . $ operator-(b77b703cd1e43e33). target->poscxx . . $ object#pos.; |
| 1816 | |
| 1817 | if (f_toward) { |
| 1818 | opposite_fvec =cxx . . $ vector#`operator=`(c0842353a20857d). -cxx . . $ operator-(9e07539e219c6f20).(*vec); |
| 1819 | } else { |
| 1820 | opposite_fvec =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). *vec; |
| 1821 | } |
| 1822 | |
| 1823 | if (from_target *cxx . . $ `operator*`(4a721543d64e126a). opposite_fvec > 0.0f) { |
| 1824 | // I am currently on the side of the object that I do not want to be on |
| 1825 | vectorcxx . . $ vector# goal_dir; |
| 1826 | vectorcxx . . $ vector# vec_to_plane; |
| 1827 | vectorcxx . . $ vector# normal_component; |
| 1828 | vectorcxx . . $ vector# plane_component; |
| 1829 | |
| 1830 | vec_to_plane =cxx . . $ vector#`operator=`(c0842353a20857d). obj->poscxx . . $ object#pos. -cxx . . $ operator-(b77b703cd1e43e33). target->poscxx . . $ object#pos.; |
| 1831 | normal_component =cxx . . $ vector#`operator=`(c0842353a20857d). opposite_fvec *cxx . . $ `operator*`(252247219a31502c). (opposite_fvec *cxx . . $ `operator*`(4a721543d64e126a). vec_to_plane); |
| 1832 | plane_component =cxx . . $ vector#`operator=`(c0842353a20857d). vec_to_plane -cxx . . $ operator-(b77b703cd1e43e33). normal_component; |
| 1833 | |
| 1834 | if (plane_component ==cxx . . $ `operator==`(718c890c104af0f3). Zero_vectorcxx . . $ Zero_vector.) { |
| 1835 | goal_dir =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). target->orientcxx . . $ object#orient..rveccxx . . $ matrix#rvec.; |
| 1836 | } else { |
| 1837 | goal_dir =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). plane_component; |
| 1838 | vm_NormalizeVectorcxx . . $ vm_NormalizeVector(4939a7e530383cd4).(&goal_dir); |
| 1839 | } |
| 1840 | |
| 1841 | goal_pos =cxx . . $ vector#`operator=`(c0842353a20857d). target->poscxx . . $ object#pos. +cxx . . $ operator+(b77b703cd1e43e33). goal_dir *cxx . . $ `operator*`(252247219a31502c). (obj->sizecxx . . $ object#size. + target->sizecxx . . $ object#size. + circle_dist); |
| 1842 | } else { |
| 1843 | // else, I am going to get behind/in-front the object |
| 1844 | goal_pos =cxx . . $ vector#`operator=`(c0842353a20857d). target->poscxx . . $ object#pos. -cxx . . $ operator-(b77b703cd1e43e33). (opposite_fvec *cxx . . $ `operator*`(252247219a31502c). (obj->sizecxx . . $ object#size. + target->sizecxx . . $ object#size. + circle_dist)); |
| 1845 | if (vm_VectorDistancecxx . . $ vm_VectorDistance(e65d563e2b53cc54).(&goal_pos, &obj->poscxx . . $ object#pos.) < obj->sizecxx . . $ object#size.) { |
| 1846 | f_done = true; |
| 1847 | } |
| 1848 | } |
| 1849 | |
| 1850 | AIMoveTowardsPositioncxx . . $ AIMoveTowardsPosition(e4ea9f4f5d132a1c).(obj, &goal_pos, scalar, false, mdir, f_moved); |
| 1851 | return f_done; |
| 1852 | } |
| 1853 | |
| 1854 | void move_away_from_positioncxx . . $ move_away_from_position(85fe40f658f75ff4).(objectcxx . . $ object# *obj, vectorcxx . . $ vector# *pos /*, bool random_evade*/, float scale, vectorcxx . . $ vector# *mdir, |
| 1855 | bool *f_moved) { |
| 1856 | vectorcxx . . $ vector# dir; |
| 1857 | float distance; |
| 1858 | |
| 1859 | // Reverse of move towards |
| 1860 | dir =cxx . . $ vector#`operator=`(c0842353a20857d). obj->poscxx . . $ object#pos. -cxx . . $ operator-(b77b703cd1e43e33). *pos; |
| 1861 | distance = vm_NormalizeVectorcxx . . $ vm_NormalizeVector(4939a7e530383cd4).(&dir); |
| 1862 | |
| 1863 | // AIMoveTowardsDir(obj, &dir, scale); |
| 1864 | *mdir =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). dir; |
| 1865 | *f_moved = false; |
| 1866 | } |
| 1867 | |
| 1868 | #define NO_DODGE_SIZE_MULTIPLIERcxx . . $ `Descent3/AImain.cpp:1868:9`! 2.0f |
| 1869 | #define MIN_DODGE_DISTcxx . . $ `Descent3/AImain.cpp:1869:9`! 5.0f |
| 1870 | |
| 1871 | #define MAX_DODGE_INFLUENCEcxx . . $ `Descent3/AImain.cpp:1871:9`! 10.0f |
| 1872 | #define MIN_DODGE_INFLUENCEcxx . . $ `Descent3/AImain.cpp:1872:9`! 2.5f // Just less than max avoiding fiends |
| 1873 | |
| 1874 | // returns false if no dodge is necessary |
| 1875 | bool compute_dodge_dircxx . . $ compute_dodge_dir(5412ee7de38daebe).(vectorcxx . . $ vector# *movement_dir, objectcxx . . $ object# *obj, objectcxx . . $ object# *dodge_obj) { |
| 1876 | vectorcxx . . $ vector# vec_to_obj = obj->poscxx . . $ object#pos. -cxx . . $ operator-(b77b703cd1e43e33). dodge_obj->poscxx . . $ object#pos.; |
| 1877 | vectorcxx . . $ vector# dodge_vec; |
| 1878 | vectorcxx . . $ vector# dobj_motion = dodge_obj->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..velocitycxx . . $ physics_info#velocity.; |
| 1879 | vm_NormalizeVectorcxx . . $ vm_NormalizeVector(4939a7e530383cd4).(&dobj_motion); |
| 1880 | |
| 1881 | float closest_dist; |
| 1882 | |
| 1883 | float p; |
| 1884 | |
| 1885 | float max_dodge_dist = obj->sizecxx . . $ object#size. * NO_DODGE_SIZE_MULTIPLIERcxx . . $ `Descent3/AImain.cpp:1868:9`! + dodge_obj->sizecxx . . $ object#size.; |
| 1886 | if (max_dodge_dist < MIN_DODGE_DISTcxx . . $ `Descent3/AImain.cpp:1869:9`!) { |
| 1887 | max_dodge_dist = MIN_DODGE_DISTcxx . . $ `Descent3/AImain.cpp:1869:9`!; |
| 1888 | } |
| 1889 | |
| 1890 | if (IS_GUIDEBOTcxx . . $ `Descent3/objinfo.h:363:9`!(obj)) { |
| 1891 | max_dodge_dist += 10.0f; |
| 1892 | } |
| 1893 | |
| 1894 | vectorcxx . . $ vector# dpoint; |
| 1895 | |
| 1896 | p = dobj_motion *cxx . . $ `operator*`(4a721543d64e126a). vec_to_obj; |
| 1897 | |
| 1898 | if (p <= 0.0) |
| 1899 | return false; |
| 1900 | |
| 1901 | dpoint =cxx . . $ vector#`operator=`(c0842353a20857d). dodge_obj->poscxx . . $ object#pos. +cxx . . $ operator+(b77b703cd1e43e33). (p *cxx . . $ `operator*`(9d6577ff3e9faa29). dobj_motion); |
| 1902 | |
| 1903 | dodge_vec =cxx . . $ vector#`operator=`(c0842353a20857d). obj->poscxx . . $ object#pos. -cxx . . $ operator-(b77b703cd1e43e33). dpoint; |
| 1904 | closest_dist = vm_NormalizeVectorcxx . . $ vm_NormalizeVector(4939a7e530383cd4).(&dodge_vec); |
| 1905 | |
| 1906 | if (closest_dist > max_dodge_dist) |
| 1907 | return false; |
| 1908 | if (closest_dist == 0.0) |
| 1909 | dodge_vec =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). obj->orientcxx . . $ object#orient..rveccxx . . $ matrix#rvec.; |
| 1910 | |
| 1911 | // CHRISHACK -- Use the MIN/MAX INFLUENCE and INFLUENCE RAMP |
| 1912 | float scale = MAX_DODGE_INFLUENCEcxx . . $ `Descent3/AImain.cpp:1871:9`! * ((max_dodge_dist - closest_dist) / max_dodge_dist); |
| 1913 | if (scale < MIN_DODGE_INFLUENCEcxx . . $ `Descent3/AImain.cpp:1872:9`!) { |
| 1914 | scale = MIN_DODGE_INFLUENCEcxx . . $ `Descent3/AImain.cpp:1872:9`!; |
| 1915 | } |
| 1916 | |
| 1917 | if (IS_GUIDEBOTcxx . . $ `Descent3/objinfo.h:363:9`!(obj)) { |
| 1918 | scale *= 20.0f; |
| 1919 | } |
| 1920 | |
| 1921 | dodge_vec *=cxx . . $ `operator*=`(f132838b2cd11d6). scale; |
| 1922 | |
| 1923 | if (dodge_vec !=cxx . . $ `operator!=`(718c890c104af0f3). Zero_vectorcxx . . $ Zero_vector. && (obj->ai_infocxx . . $ object#ai_info.->dodge_till_timecxx . . $ ai_frame#dodge_till_time. < Gametimecxx . . $ Gametime. || |
| 1924 | vm_GetMagnitudecxx . . $ vm_GetMagnitude(4939a7e530383cd4).(&dodge_vec) > vm_GetMagnitudecxx . . $ vm_GetMagnitude(4939a7e530383cd4).(&obj->ai_infocxx . . $ object#ai_info.->last_dodge_dircxx . . $ ai_frame#last_dodge_dir.))) { |
| 1925 | obj->ai_infocxx . . $ object#ai_info.->last_dodge_dircxx . . $ ai_frame#last_dodge_dir. =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). dodge_vec; |
| 1926 | } |
| 1927 | |
| 1928 | obj->ai_infocxx . . $ object#ai_info.->dodge_till_timecxx . . $ ai_frame#dodge_till_time. = |
| 1929 | Gametimecxx . . $ Gametime. + ((float)ps_randcxx . . $ ps_rand(b126dc7c1de90089).() / (float)D3_RAND_MAXcxx . . $ `misc/psrand.h:41:9`!) * (3.0f * obj->ai_infocxx . . $ object#ai_info.->life_preservationcxx . . $ ai_frame#life_preservation.) + 1.0f; |
| 1930 | |
| 1931 | *movement_dir +=cxx . . $ `operator+=`(801a8d6f7ab7bef9). dodge_vec; |
| 1932 | |
| 1933 | return true; |
| 1934 | } |
| 1935 | |
| 1936 | bool goal_do_dodgecxx . . $ goal_do_dodge(9985ed114f2bfc78).(objectcxx . . $ object# *obj, int goal_index) { |
| 1937 | ai_framecxx . . $ ai_frame# *ai_info = obj->ai_infocxx . . $ object#ai_info.; |
| 1938 | objectcxx . . $ object# *other_obj = ObjGetcxx . . $ ObjGet(11672e354c0b263a).(ai_info->goalscxx . . $ ai_frame#goals.[goal_index].g_infocxx . . $ goal#g_info..handlecxx . . $ goal_info#$anonymous_type_1#handle.); |
| 1939 | int reason = AIN_GOAL_COMPLETEcxx . . $ `Descent3/aistruct_external.h:294:9`!; |
| 1940 | |
| 1941 | if (other_obj) { |
| 1942 | if (compute_dodge_dircxx . . $ compute_dodge_dir(5412ee7de38daebe).(&ai_info->movement_dircxx . . $ ai_frame#movement_dir., obj, other_obj)) { |
| 1943 | return true; |
| 1944 | } |
| 1945 | } else { |
| 1946 | reason = AIN_GOAL_INVALIDcxx . . $ `Descent3/aistruct_external.h:303:9`!; |
| 1947 | } |
| 1948 | |
| 1949 | GoalClearGoalcxx . . $ GoalClearGoal(5f6922bcf6358e70).(obj, &ai_info->goalscxx . . $ ai_frame#goals.[goal_index], reason); |
| 1950 | return false; |
| 1951 | } |
| 1952 | |
| 1953 | #define MAX_WALL_AVOID_INFLUENCEcxx . . $ `Descent3/AImain.cpp:1953:9`! 0.9f |
| 1954 | #define MAX_TERRAIN_AVOID_INFLUENCEcxx . . $ `Descent3/AImain.cpp:1954:9`! 0.9f |
| 1955 | #define GB_WALL_PULSE_INTERVALcxx . . $ `Descent3/AImain.cpp:1955:9`! 7 |
| 1956 | |
| 1957 | bool goal_do_avoid_wallscxx . . $ goal_do_avoid_walls(723205ab969e3cce).(objectcxx . . $ object# *obj, vectorcxx . . $ vector# *mdir) { |
| 1958 | fvi_face_room_listcxx . . $ fvi_face_room_list# facelist[200]; |
| 1959 | int num_faces; |
| 1960 | float rad; |
| 1961 | int i; |
| 1962 | vectorcxx . . $ vector# awall_dir = Zero_vectorcxx . . $ Zero_vector.; |
| 1963 | float closest_dist; |
| 1964 | vectorcxx . . $ vector# pos; |
| 1965 | bool f_danger = false; |
| 1966 | |
| 1967 | float wall_size = Poly_modelscxx . . $ Poly_models.[obj->rtypecxx . . $ object#rtype..pobj_infocxx . . $ object#$anonymous_type_10#pobj_info..model_numcxx . . $ polyobj_info#model_num.].wall_sizecxx . . $ poly_model#wall_size.; |
| 1968 | |
| 1969 | if (IS_GUIDEBOTcxx . . $ `Descent3/objinfo.h:363:9`!(obj)) { |
| 1970 | rad = 10.0f; |
| 1971 | } else { |
| 1972 | if (wall_size < 7.0f) |
| 1973 | rad = wall_size + 2.2f; |
| 1974 | else |
| 1975 | rad = wall_size + 1.0f; |
| 1976 | } |
| 1977 | |
| 1978 | pos =cxx . . $ vector#`operator=`(c0842353a20857d). obj->poscxx . . $ object#pos. +cxx . . $ operator+(b77b703cd1e43e33). obj->wall_sphere_offsetcxx . . $ object#wall_sphere_offset.; |
| 1979 | |
| 1980 | closest_dist = rad + 1.0f; |
| 1981 | |
| 1982 | if (obj->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..velocitycxx . . $ physics_info#velocity. ==cxx . . $ `operator==`(718c890c104af0f3). Zero_vectorcxx . . $ Zero_vector.) { |
| 1983 | return false; |
| 1984 | } |
| 1985 | |
| 1986 | if (!ROOMNUM_OUTSIDEcxx . . $ `lib/object_external_struct.h:127:9`!(obj->roomnum)) { |
| 1987 | num_faces = fvi_QuickDistFaceListcxx . . $ fvi_QuickDistFaceList(a662bbcbc4f3d9bd).(obj->roomnumcxx . . $ object#roomnum., &pos, rad, facelist, 200); |
| 1988 | |
| 1989 | for (i = 0; i < num_faces; i++) { |
| 1990 | roomcxx . . $ room# *rp = &Roomscxx . . $ Rooms.[facelist[i].room_indexcxx . . $ fvi_face_room_list#room_index.]; |
| 1991 | facecxx . . $ face# *fp = &rp->facescxx . . $ room#faces.[facelist[i].face_indexcxx . . $ fvi_face_room_list#face_index.]; |
| 1992 | |
| 1993 | int face_info = GetFacePhysicsFlagscxx . . $ GetFacePhysicsFlags(5ecd074e33cd6dc1).(rp, fp); |
| 1994 | if (!(face_info & FPF_SOLIDcxx . . $ `Descent3/room.h:506:9`!)) |
| 1995 | continue; |
| 1996 | |
| 1997 | vectorcxx . . $ vector# fpnt = rp->vertscxx . . $ room#verts.[fp->face_vertscxx . . $ face#face_verts.[0]]; |
| 1998 | |
| 1999 | // Ignore backfaces |
| 2000 | if ((pos -cxx . . $ operator-(b77b703cd1e43e33). fpnt) *cxx . . $ `operator*`(4a721543d64e126a). fp->normalcxx . . $ face#normal. > 0.0f) { |
| 2001 | float dist = vm_DistToPlanecxx . . $ vm_DistToPlane(94d642bbc45232c7).(&pos, &fp->normalcxx . . $ face#normal., &fpnt); |
| 2002 | |
| 2003 | if (dist < rad) { |
| 2004 | vectorcxx . . $ vector# pnt_on_face = pos -cxx . . $ operator-(b77b703cd1e43e33). (dist *cxx . . $ `operator*`(9d6577ff3e9faa29). fp->normalcxx . . $ face#normal.); |
| 2005 | vectorcxx . . $ vector# *vertex_ptr_list[MAX_VERTS_PER_FACEcxx . . $ `Descent3/room_external.h:108:9`!]; |
| 2006 | int j; |
| 2007 | |
| 2008 | for (j = 0; j < fp->num_vertscxx . . $ face#num_verts.; j++) { |
| 2009 | vertex_ptr_list[j] = &rp->vertscxx . . $ room#verts.[fp->face_vertscxx . . $ face#face_verts.[j]]; |
| 2010 | } |
| 2011 | |
| 2012 | int edgemask = check_point_to_facecxx . . $ check_point_to_face(ccece0347280792).(&pnt_on_face, &fp->normalcxx . . $ face#normal., fp->num_vertscxx . . $ face#num_verts., vertex_ptr_list); |
| 2013 | |
| 2014 | if (edgemask == 0) { |
| 2015 | float scale = 1.0f - ((dist - wall_size * .5f) / (rad - wall_size * .5f)); |
| 2016 | if (scale < 0.0) |
| 2017 | scale = 0.0f; |
| 2018 | else if (scale > 1.0f) |
| 2019 | scale = 1.0f; |
| 2020 | |
| 2021 | awall_dir +=cxx . . $ `operator+=`(801a8d6f7ab7bef9). (scale *cxx . . $ `operator*`(9d6577ff3e9faa29). fp->normalcxx . . $ face#normal.); |
| 2022 | |
| 2023 | // mprintf(0, "%d\n", facelist[i].face_index); |
| 2024 | if (GameTexturescxx . . $ GameTextures.[fp->tmapcxx . . $ face#tmap.].flagscxx . . $ texture#flags. & (TF_VOLATILEcxx . . $ `Descent3/gametexture.h:201:9`! | TF_FORCEFIELDcxx . . $ `Descent3/gametexture.h:206:9`! | TF_LAVAcxx . . $ `Descent3/gametexture.h:230:9`!)) { |
| 2025 | if (!(fp->portal_numcxx . . $ face#portal_num. >= 0 && !(rp->portalscxx . . $ room#portals.[fp->portal_numcxx . . $ face#portal_num.].flagscxx . . $ portal#flags. & PF_RENDER_FACEScxx . . $ `Descent3/room_external.h:155:9`!))) { |
| 2026 | f_danger = true; |
| 2027 | } |
| 2028 | } |
| 2029 | |
| 2030 | // mprintf(0, "Dist %f %f (%d, %d)\n", dist, scale, facelist[i].room_index, facelist[i].face_index)); |
| 2031 | |
| 2032 | if (dist < closest_dist) { |
| 2033 | closest_dist = dist; |
| 2034 | } |
| 2035 | } |
| 2036 | } |
| 2037 | } |
| 2038 | } |
| 2039 | } else { |
| 2040 | int num_cells; |
| 2041 | int cell_list[100]; |
| 2042 | |
| 2043 | num_cells = fvi_QuickDistCellListcxx . . $ fvi_QuickDistCellList(2280b6e28a61436a).(CELLNUMcxx . . $ `lib/object_external_struct.h:121:9`!(obj->roomnum), &pos, rad, cell_list, 100); |
| 2044 | |
| 2045 | for (i = 0; i < num_cells; i++) { |
| 2046 | const int cur_node = cell_list[i]; |
| 2047 | terrain_segmentcxx . . $ terrain_segment# *tseg = &Terrain_segcxx . . $ Terrain_seg.[cur_node]; |
| 2048 | |
| 2049 | vectorcxx . . $ vector# fpnt; |
| 2050 | ComputeTerrainSegmentCentercxx . . $ ComputeTerrainSegmentCenter(86b7faebfcd459cf).(&fpnt, cur_node); |
| 2051 | |
| 2052 | vectorcxx . . $ vector# normal = |
| 2053 | TerrainNormalscxx . . $ TerrainNormals.[MAX_TERRAIN_LODcxx . . $ `Descent3/terrain.h:38:9`! - 1][cur_node].normal1cxx . . $ terrain_normals#normal1. +cxx . . $ operator+(b77b703cd1e43e33). TerrainNormalscxx . . $ TerrainNormals.[MAX_TERRAIN_LODcxx . . $ `Descent3/terrain.h:38:9`! - 1][cur_node].normal2cxx . . $ terrain_normals#normal2.; |
| 2054 | vm_NormalizeVectorcxx . . $ vm_NormalizeVector(4939a7e530383cd4).(&normal); |
| 2055 | |
| 2056 | if (obj->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..velocitycxx . . $ physics_info#velocity. *cxx . . $ `operator*`(4a721543d64e126a). normal <= 0.0f) { |
| 2057 | vectorcxx . . $ vector# no_y_vec = pos -cxx . . $ operator-(b77b703cd1e43e33). fpnt; |
| 2058 | no_y_vec.ycxx . . $ vector#y. = 0.0f; |
| 2059 | |
| 2060 | float dist; |
| 2061 | |
| 2062 | dist = vm_NormalizeVectorcxx . . $ vm_NormalizeVector(4939a7e530383cd4).(&no_y_vec); |
| 2063 | |
| 2064 | if (dist <= rad) { |
| 2065 | awall_dir +=cxx . . $ `operator+=`(801a8d6f7ab7bef9). ((1.0f - (dist / rad)) *cxx . . $ `operator*`(9d6577ff3e9faa29). normal); |
| 2066 | |
| 2067 | if (GameTexturescxx . . $ GameTextures.[Terrain_tex_segcxx . . $ Terrain_tex_seg.[tseg->texseg_indexcxx . . $ terrain_segment#texseg_index.].tex_indexcxx . . $ terrain_tex_segment#tex_index.].flagscxx . . $ texture#flags. & |
| 2068 | (TF_VOLATILEcxx . . $ `Descent3/gametexture.h:201:9`! | TF_FORCEFIELDcxx . . $ `Descent3/gametexture.h:206:9`! | TF_LAVAcxx . . $ `Descent3/gametexture.h:230:9`!)) { |
| 2069 | #ifdef _DEBUGcxx . . $ `<built-in>:482:9`! |
| 2070 | if (AI_debug_robot_docxx . . $ AI_debug_robot_do. && OBJNUMcxx . . $ `Descent3/object.h:700:9`!(obj) == AI_debug_robot_indexcxx . . $ AI_debug_robot_index.) { |
| 2071 | mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "AI Note: Danger - NEAR FORCEFIELD, VOLATILE, OR LAVA\n"); |
| 2072 | } |
| 2073 | #endif |
| 2074 | f_danger = true; |
| 2075 | } |
| 2076 | |
| 2077 | if (dist < closest_dist) { |
| 2078 | closest_dist = dist; |
| 2079 | } |
| 2080 | } |
| 2081 | } |
| 2082 | } |
| 2083 | } |
| 2084 | |
| 2085 | if (closest_dist <= rad) { |
| 2086 | vm_NormalizeVectorcxx . . $ vm_NormalizeVector(4939a7e530383cd4).(&awall_dir); |
| 2087 | |
| 2088 | float max_influence = (ROOMNUM_OUTSIDEcxx . . $ `lib/object_external_struct.h:127:9`!(obj->roomnum)) ? MAX_TERRAIN_AVOID_INFLUENCEcxx . . $ `Descent3/AImain.cpp:1954:9`! : MAX_WALL_AVOID_INFLUENCEcxx . . $ `Descent3/AImain.cpp:1953:9`!; |
| 2089 | if (f_danger) { |
| 2090 | max_influence *= 7.1f; |
| 2091 | } |
| 2092 | |
| 2093 | float scale = (1.0f - ((closest_dist - wall_size) / (rad - wall_size))) * max_influence; |
| 2094 | if (scale > max_influence) |
| 2095 | scale = max_influence; |
| 2096 | *mdir +=cxx . . $ `operator+=`(801a8d6f7ab7bef9). scale *cxx . . $ `operator*`(9d6577ff3e9faa29). awall_dir; |
| 2097 | |
| 2098 | if (IS_GUIDEBOTcxx . . $ `Descent3/objinfo.h:363:9`!(obj) && closest_dist < 8.0f) { |
| 2099 | int test_time = Gametimecxx . . $ Gametime.; |
| 2100 | |
| 2101 | if ((test_time % GB_WALL_PULSE_INTERVALcxx . . $ `Descent3/AImain.cpp:1955:9`!) == 0) { |
| 2102 | *mdir *=cxx . . $ `operator*=`(f132838b2cd11d6). 10.0f; |
| 2103 | } |
| 2104 | } |
| 2105 | |
| 2106 | #ifdef _DEBUGcxx . . $ `<built-in>:482:9`! |
| 2107 | if (AI_debug_robot_docxx . . $ AI_debug_robot_do. && OBJNUMcxx . . $ `Descent3/object.h:700:9`!(obj) == AI_debug_robot_indexcxx . . $ AI_debug_robot_index.) { |
| 2108 | mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "AI Note: Avoid wall %f\n", scale); |
| 2109 | } |
| 2110 | #endif |
| 2111 | |
| 2112 | return true; |
| 2113 | } |
| 2114 | |
| 2115 | return false; |
| 2116 | } |
| 2117 | |
| 2118 | #define ONE_DEGREE_ARC_COScxx . . $ `Descent3/AImain.cpp:2118:9`! 0.99985f |
| 2119 | #define FIVE_DEGREE_ARC_COScxx . . $ `Descent3/AImain.cpp:2119:9`! 0.9962f |
| 2120 | |
| 2121 | // NOTE: Assumes that the vector is normalized |
| 2122 | void AITurnTowardsDircxx . . $ AITurnTowardsDir(cd233addd15cf1e2).(objectcxx . . $ object# *obj, /*velocity *new_vel,*/ vectorcxx . . $ vector# *goal_dir /*, bool remain_level*/, float turn_rate) { |
| 2123 | vectorcxx . . $ vector# u_axis; |
| 2124 | matrixcxx . . $ matrix# rot_matrix; |
| 2125 | anglecxx . . $ angle# goal_angle; |
| 2126 | float max_angle; |
| 2127 | |
| 2128 | matrixcxx . . $ matrix# saved_orient = obj->orientcxx . . $ object#orient.; |
| 2129 | vectorcxx . . $ vector# saved_uvec = obj->orientcxx . . $ object#orient..uveccxx . . $ matrix#uvec.; |
| 2130 | |
| 2131 | if (*goal_dir ==cxx . . $ `operator==`(718c890c104af0f3). Zero_vectorcxx . . $ Zero_vector. || (obj->orientcxx . . $ object#orient..fveccxx . . $ matrix#fvec. *cxx . . $ `operator*`(4a721543d64e126a). (*goal_dir)) >= ONE_DEGREE_ARC_COScxx . . $ `Descent3/AImain.cpp:2118:9`!) |
| 2132 | return; // No goal_dir or less than 1 degree off goal |
| 2133 | |
| 2134 | if (obj->sizecxx . . $ object#size. > 32.0f && (obj->orientcxx . . $ object#orient..fveccxx . . $ matrix#fvec. *cxx . . $ `operator*`(4a721543d64e126a). (*goal_dir)) >= FIVE_DEGREE_ARC_COScxx . . $ `Descent3/AImain.cpp:2119:9`!) |
| 2135 | return; // Big objects have more play |
| 2136 | |
| 2137 | if (obj->typecxx . . $ object#type. != OBJ_WEAPONcxx . . $ `Descent3/object_external.h:165:9`!) { |
| 2138 | obj->ai_infocxx . . $ object#ai_info.->flagscxx . . $ ai_frame#flags. |= AIF_REPORT_NEW_ORIENTcxx . . $ `Descent3/aistruct_external.h:372:9`!; |
| 2139 | if (obj->ai_infocxx . . $ object#ai_info.) |
| 2140 | obj->ai_infocxx . . $ object#ai_info.->saved_orientcxx . . $ ai_frame#saved_orient. =cxx . . $ matrix#`operator=`(4c6f8b29806742). obj->orientcxx . . $ object#orient.; |
| 2141 | } |
| 2142 | |
| 2143 | goal_angle = vm_DeltaAngVecNormcxx . . $ vm_DeltaAngVecNorm(2b95d4afcc0f9481).(&obj->orientcxx . . $ object#orient..fveccxx . . $ matrix#fvec., goal_dir, &u_axis); |
| 2144 | |
| 2145 | if (goal_angle == 0) |
| 2146 | return; |
| 2147 | |
| 2148 | max_angle = turn_rate * Frametimecxx . . $ Frametime.; |
| 2149 | |
| 2150 | if ((float)goal_angle > max_angle) { |
| 2151 | matrixcxx . . $ matrix# turn_matrix; |
| 2152 | |
| 2153 | if (max_angle != 32767 && max_angle != 32768) { |
| 2154 | // Get the up axis |
| 2155 | vm_CrossProductcxx . . $ vm_CrossProduct(af83aca25ba5b41c).(&u_axis, &obj->orientcxx . . $ object#orient..fveccxx . . $ matrix#fvec., goal_dir); |
| 2156 | |
| 2157 | // Using the forward(original orient's forward) and the up (computed), get the orientation matrix |
| 2158 | vm_VectorToMatrixcxx . . $ vm_VectorToMatrix(543233b88555916d).(&rot_matrix, &obj->orientcxx . . $ object#orient..fveccxx . . $ matrix#fvec., &u_axis, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!); |
| 2159 | } else { |
| 2160 | rot_matrix =cxx . . $ matrix#`operator=`(4c6f8b29806742). obj->orientcxx . . $ object#orient.; |
| 2161 | } |
| 2162 | |
| 2163 | vm_AnglesToMatrixcxx . . $ vm_AnglesToMatrix(654fa9e3c9c3be99).(&turn_matrix, 0.0, max_angle, 0.0); |
| 2164 | |
| 2165 | rot_matrix =cxx . . $ matrix#`operator=`(e859ffc26b91394f). rot_matrix *cxx . . $ `operator*`(683f8e040c904cb). turn_matrix; |
| 2166 | |
| 2167 | obj->orientcxx . . $ object#orient..fveccxx . . $ matrix#fvec. =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). rot_matrix.fveccxx . . $ matrix#fvec.; // ObjSetOrient below |
| 2168 | } else { |
| 2169 | obj->orientcxx . . $ object#orient..fveccxx . . $ matrix#fvec. =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). *goal_dir; // ObjSetOrient below |
| 2170 | } |
| 2171 | |
| 2172 | if (obj->movement_typecxx . . $ object#movement_type. == MT_WALKINGcxx . . $ `Descent3/object_external.h:235:9`!) { |
| 2173 | obj->orientcxx . . $ object#orient..uveccxx . . $ matrix#uvec. =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). saved_uvec; |
| 2174 | |
| 2175 | float f_proj = obj->orientcxx . . $ object#orient..uveccxx . . $ matrix#uvec. *cxx . . $ `operator*`(4a721543d64e126a). obj->orientcxx . . $ object#orient..fveccxx . . $ matrix#fvec.; |
| 2176 | float r_proj = obj->orientcxx . . $ object#orient..uveccxx . . $ matrix#uvec. *cxx . . $ `operator*`(4a721543d64e126a). obj->orientcxx . . $ object#orient..rveccxx . . $ matrix#rvec.; |
| 2177 | |
| 2178 | if (f_proj <= -1.0f || f_proj >= 1.0f || r_proj >= 1.0f || r_proj <= -1.0f) { |
| 2179 | obj->orientcxx . . $ object#orient. =cxx . . $ matrix#`operator=`(4c6f8b29806742). saved_orient; |
| 2180 | } else { |
| 2181 | obj->orientcxx . . $ object#orient..fveccxx . . $ matrix#fvec. -=cxx . . $ `operator-=`(801a8d6f7ab7bef9). (obj->orientcxx . . $ object#orient..uveccxx . . $ matrix#uvec. *cxx . . $ `operator*`(252247219a31502c). f_proj); |
| 2182 | obj->orientcxx . . $ object#orient..rveccxx . . $ matrix#rvec. -=cxx . . $ `operator-=`(801a8d6f7ab7bef9). (obj->orientcxx . . $ object#orient..uveccxx . . $ matrix#uvec. *cxx . . $ `operator*`(252247219a31502c). r_proj); |
| 2183 | |
| 2184 | vm_NormalizeVectorcxx . . $ vm_NormalizeVector(4939a7e530383cd4).(&obj->orientcxx . . $ object#orient..fveccxx . . $ matrix#fvec.); |
| 2185 | vm_NormalizeVectorcxx . . $ vm_NormalizeVector(4939a7e530383cd4).(&obj->orientcxx . . $ object#orient..rveccxx . . $ matrix#rvec.); |
| 2186 | } |
| 2187 | } |
| 2188 | |
| 2189 | vm_Orthogonalizecxx . . $ vm_Orthogonalize(dca75c48c9ab5b54).(&obj->orientcxx . . $ object#orient.); |
| 2190 | ObjSetOrientcxx . . $ ObjSetOrient(e1367e0f901c991f).(obj, &obj->orientcxx . . $ object#orient.); |
| 2191 | } |
| 2192 | |
| 2193 | bool AITurnTowardsMatrixcxx . . $ AITurnTowardsMatrix(4158910ac60c491b).(objectcxx . . $ object# *obj, float turn_rate, matrixcxx . . $ matrix# *g_orient) { |
| 2194 | float max_angles = turn_rate * Frametimecxx . . $ Frametime.; |
| 2195 | |
| 2196 | matrixcxx . . $ matrix# t_s_matrix = obj->orientcxx . . $ object#orient.; |
| 2197 | vm_TransposeMatrixcxx . . $ vm_TransposeMatrix(dca75c48c9ab5b54).(&t_s_matrix); |
| 2198 | |
| 2199 | matrixcxx . . $ matrix# rot_matrix; |
| 2200 | |
| 2201 | rot_matrix =cxx . . $ matrix#`operator=`(e859ffc26b91394f). t_s_matrix *cxx . . $ `operator*`(683f8e040c904cb). *g_orient; |
| 2202 | |
| 2203 | angveccxx . . $ angvec# a; |
| 2204 | vm_ExtractAnglesFromMatrixcxx . . $ vm_ExtractAnglesFromMatrix(5f9a6d6f613ae256).(&a, &rot_matrix); |
| 2205 | vectorcxx . . $ vector# dist; |
| 2206 | |
| 2207 | if (a.bcxx . . $ angvec#b. > 32768) |
| 2208 | dist.xcxx . . $ vector#x. = 65536 - a.bcxx . . $ angvec#b.; |
| 2209 | else |
| 2210 | dist.xcxx . . $ vector#x. = a.bcxx . . $ angvec#b.; |
| 2211 | |
| 2212 | if (a.hcxx . . $ angvec#h. > 32768) |
| 2213 | dist.ycxx . . $ vector#y. = 65536 - a.hcxx . . $ angvec#h.; |
| 2214 | else |
| 2215 | dist.ycxx . . $ vector#y. = a.hcxx . . $ angvec#h.; |
| 2216 | |
| 2217 | if (a.pcxx . . $ angvec#p. > 32768) |
| 2218 | dist.zcxx . . $ vector#z. = 65536 - a.pcxx . . $ angvec#p.; |
| 2219 | else |
| 2220 | dist.zcxx . . $ vector#z. = a.pcxx . . $ angvec#p.; |
| 2221 | |
| 2222 | float angles = vm_GetMagnitudecxx . . $ vm_GetMagnitude(4939a7e530383cd4).(&dist); |
| 2223 | |
| 2224 | if (angles <= max_angles) { |
| 2225 | obj->orientcxx . . $ object#orient. =cxx . . $ matrix#`operator=`(4c6f8b29806742). *g_orient; |
| 2226 | vm_Orthogonalizecxx . . $ vm_Orthogonalize(dca75c48c9ab5b54).(&obj->orientcxx . . $ object#orient.); |
| 2227 | ObjSetOrientcxx . . $ ObjSetOrient(e1367e0f901c991f).(obj, &obj->orientcxx . . $ object#orient.); |
| 2228 | return true; |
| 2229 | } |
| 2230 | |
| 2231 | float scale = max_angles / angles; |
| 2232 | dist *=cxx . . $ `operator*=`(f132838b2cd11d6). scale; |
| 2233 | |
| 2234 | if (a.bcxx . . $ angvec#b. > 32768) |
| 2235 | a.bcxx . . $ angvec#b. = 65535 - dist.xcxx . . $ vector#x.; |
| 2236 | else |
| 2237 | a.bcxx . . $ angvec#b. = dist.xcxx . . $ vector#x.; |
| 2238 | |
| 2239 | if (a.hcxx . . $ angvec#h. > 32768) |
| 2240 | a.hcxx . . $ angvec#h. = 65535 - dist.ycxx . . $ vector#y.; |
| 2241 | else |
| 2242 | a.hcxx . . $ angvec#h. = dist.ycxx . . $ vector#y.; |
| 2243 | |
| 2244 | if (a.pcxx . . $ angvec#p. > 32768) |
| 2245 | a.pcxx . . $ angvec#p. = 65535 - dist.zcxx . . $ vector#z.; |
| 2246 | else |
| 2247 | a.pcxx . . $ angvec#p. = dist.zcxx . . $ vector#z.; |
| 2248 | |
| 2249 | vm_AnglesToMatrixcxx . . $ vm_AnglesToMatrix(654fa9e3c9c3be99).(&rot_matrix, a.pcxx . . $ angvec#p., a.hcxx . . $ angvec#h., a.bcxx . . $ angvec#b.); |
| 2250 | obj->orientcxx . . $ object#orient. *=cxx . . $ `operator*=`(3149f8f1fe1d09b5). rot_matrix; |
| 2251 | vm_Orthogonalizecxx . . $ vm_Orthogonalize(dca75c48c9ab5b54).(&obj->orientcxx . . $ object#orient.); |
| 2252 | ObjSetOrientcxx . . $ ObjSetOrient(e1367e0f901c991f).(obj, &obj->orientcxx . . $ object#orient.); |
| 2253 | |
| 2254 | return false; |
| 2255 | } |
| 2256 | |
| 2257 | // MTS: Unused? |
| 2258 | void AITurnTowardsPositioncxx . . $ AITurnTowardsPosition(835e87111e401cce).(objectcxx . . $ object# *obj, /*velocity *new_vel,*/ vectorcxx . . $ vector# *pos /*, bool remain_level*/) { |
| 2259 | vectorcxx . . $ vector# goal_dir = *pos -cxx . . $ operator-(b77b703cd1e43e33). obj->poscxx . . $ object#pos.; |
| 2260 | ai_framecxx . . $ ai_frame# *ai_info = obj->ai_infocxx . . $ object#ai_info.; |
| 2261 | |
| 2262 | // If we want to face ourselves, we are done. :) |
| 2263 | float dist = vm_NormalizeVectorcxx . . $ vm_NormalizeVector(4939a7e530383cd4).(&goal_dir); |
| 2264 | if (dist < .1f) |
| 2265 | return; |
| 2266 | |
| 2267 | AITurnTowardsDircxx . . $ AITurnTowardsDir(cd233addd15cf1e2).(obj, &goal_dir, ai_info->max_turn_ratecxx . . $ ai_frame#max_turn_rate.); |
| 2268 | } |
| 2269 | |
| 2270 | #define AI_AVE_MELEE_TIMEcxx . . $ `Descent3/AImain.cpp:2270:9`! .45f |
| 2271 | |
| 2272 | bool MeleeHitOkcxx . . $ MeleeHitOk(39516aeee13ca5ab).(objectcxx . . $ object# *obj) { |
| 2273 | ai_framecxx . . $ ai_frame# *ai_info = obj->ai_infocxx . . $ object#ai_info.; |
| 2274 | vectorcxx . . $ vector# intp; |
| 2275 | float col_dist; |
| 2276 | int num_attacks = 0; |
| 2277 | float delay = 0.0f; |
| 2278 | const int ai_movement = ai_info->movement_typecxx . . $ ai_frame#movement_type.; |
| 2279 | polyobj_infocxx . . $ polyobj_info# *p_info = &obj->rtypecxx . . $ object#rtype..pobj_infocxx . . $ object#$anonymous_type_10#pobj_info.; |
| 2280 | float time_left; |
| 2281 | |
| 2282 | if (p_info->anim_end_framecxx . . $ polyobj_info#anim_end_frame. != p_info->anim_start_framecxx . . $ polyobj_info#anim_start_frame.) { |
| 2283 | float time_per_frame = p_info->anim_timecxx . . $ polyobj_info#anim_time. / ((float)p_info->anim_end_framecxx . . $ polyobj_info#anim_end_frame. - (float)p_info->anim_start_framecxx . . $ polyobj_info#anim_start_frame.); |
| 2284 | |
| 2285 | time_left = time_per_frame * (p_info->anim_end_framecxx . . $ polyobj_info#anim_end_frame. - p_info->anim_framecxx . . $ polyobj_info#anim_frame.); |
| 2286 | } else { |
| 2287 | time_left = 0.0f; |
| 2288 | } |
| 2289 | |
| 2290 | vectorcxx . . $ vector# relative_vel; |
| 2291 | vectorcxx . . $ vector# g_end_pos; |
| 2292 | |
| 2293 | objectcxx . . $ object# *target = ObjGetcxx . . $ ObjGet(11672e354c0b263a).(ai_info->target_handlecxx . . $ ai_frame#target_handle.); |
| 2294 | |
| 2295 | if (target == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`! || ai_info->dist_to_target_perceivedcxx . . $ ai_frame#dist_to_target_perceived. > 100.0f) { |
| 2296 | return false; |
| 2297 | } |
| 2298 | |
| 2299 | float dist = vm_VectorDistancecxx . . $ vm_VectorDistance(e65d563e2b53cc54).(&obj->poscxx . . $ object#pos., &target->poscxx . . $ object#pos.); |
| 2300 | |
| 2301 | if (dist <= AI_MAX_MELEE_RANGEcxx . . $ `Descent3/AImain.cpp:1625:9`!) { |
| 2302 | return true; |
| 2303 | } |
| 2304 | |
| 2305 | if (ai_info->flagscxx . . $ ai_frame#flags. & AIF_MELEE1cxx . . $ `Descent3/aistruct_external.h:347:9`!) { |
| 2306 | num_attacks++; |
| 2307 | delay += Object_infocxx . . $ Object_info.[obj->idcxx . . $ object#id.].animcxx . . $ object_info#anim.[ai_movement].elemcxx . . $ anim_elem#elem.[AS_MELEE1cxx . . $ `Descent3/aistruct_external.h:415:9`!].spccxx . . $ anim_entry#spc.; |
| 2308 | } |
| 2309 | |
| 2310 | if (ai_info->flagscxx . . $ ai_frame#flags. & AIF_MELEE2cxx . . $ `Descent3/aistruct_external.h:348:9`!) { |
| 2311 | num_attacks++; |
| 2312 | delay += Object_infocxx . . $ Object_info.[obj->idcxx . . $ object#id.].animcxx . . $ object_info#anim.[ai_movement].elemcxx . . $ anim_elem#elem.[AS_MELEE2cxx . . $ `Descent3/aistruct_external.h:417:9`!].spccxx . . $ anim_entry#spc.; |
| 2313 | } |
| 2314 | |
| 2315 | if (!num_attacks) { |
| 2316 | return false; |
| 2317 | } else if (num_attacks > 1) { |
| 2318 | delay = delay / (float)num_attacks; |
| 2319 | } |
| 2320 | |
| 2321 | delay += time_left + Frametimecxx . . $ Frametime.; |
| 2322 | |
| 2323 | // Determines the relative velocities |
| 2324 | if (obj->movement_typecxx . . $ object#movement_type. == MT_PHYSICScxx . . $ `Descent3/object_external.h:234:9`! || obj->movement_typecxx . . $ object#movement_type. == MT_PHYSICScxx . . $ `Descent3/object_external.h:234:9`!) { |
| 2325 | if (target->movement_typecxx . . $ object#movement_type. == MT_PHYSICScxx . . $ `Descent3/object_external.h:234:9`! || target->movement_typecxx . . $ object#movement_type. == MT_PHYSICScxx . . $ `Descent3/object_external.h:234:9`!) { |
| 2326 | relative_vel =cxx . . $ vector#`operator=`(c0842353a20857d). obj->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..velocitycxx . . $ physics_info#velocity. -cxx . . $ operator-(b77b703cd1e43e33). target->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..velocitycxx . . $ physics_info#velocity.; |
| 2327 | } else { |
| 2328 | relative_vel =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). obj->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..velocitycxx . . $ physics_info#velocity.; |
| 2329 | } |
| 2330 | } else { |
| 2331 | if (target->movement_typecxx . . $ object#movement_type. == MT_PHYSICScxx . . $ `Descent3/object_external.h:234:9`! || target->movement_typecxx . . $ object#movement_type. == MT_PHYSICScxx . . $ `Descent3/object_external.h:234:9`!) { |
| 2332 | relative_vel =cxx . . $ vector#`operator=`(c0842353a20857d). -cxx . . $ operator-(9e07539e219c6f20).target->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..velocitycxx . . $ physics_info#velocity.; |
| 2333 | } else { |
| 2334 | relative_vel =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). Zero_vectorcxx . . $ Zero_vector.; |
| 2335 | } |
| 2336 | } |
| 2337 | |
| 2338 | if (obj->movement_typecxx . . $ object#movement_type. == MT_PHYSICScxx . . $ `Descent3/object_external.h:234:9`! || obj->movement_typecxx . . $ object#movement_type. == MT_PHYSICScxx . . $ `Descent3/object_external.h:234:9`!) { |
| 2339 | if ((relative_vel *cxx . . $ `operator*`(4a721543d64e126a). ai_info->vec_to_target_perceivedcxx . . $ ai_frame#vec_to_target_perceived.) < 0.0f) { |
| 2340 | return false; |
| 2341 | } |
| 2342 | } |
| 2343 | |
| 2344 | g_end_pos =cxx . . $ vector#`operator=`(c0842353a20857d). obj->poscxx . . $ object#pos. +cxx . . $ operator+(b77b703cd1e43e33). (delay *cxx . . $ `operator*`(9d6577ff3e9faa29). relative_vel); |
| 2345 | |
| 2346 | if (check_vector_to_sphere_1cxx . . $ check_vector_to_sphere_1(ad73bf9bdb80d370).(&intp, &col_dist, &obj->poscxx . . $ object#pos., &g_end_pos, &target->poscxx . . $ object#pos., |
| 2347 | target->sizecxx . . $ object#size. + obj->sizecxx . . $ object#size. + (.9f * AI_MAX_MELEE_RANGEcxx . . $ `Descent3/AImain.cpp:1625:9`!), false, true) != 0) { |
| 2348 | return true; |
| 2349 | } |
| 2350 | |
| 2351 | return false; |
| 2352 | } |
| 2353 | |
| 2354 | bool AiMeleecxx . . $ AiMelee(39516aeee13ca5ab).(objectcxx . . $ object# *obj) { |
| 2355 | ai_framecxx . . $ ai_frame# *ai_info = obj->ai_infocxx . . $ object#ai_info.; |
| 2356 | vectorcxx . . $ vector# f_vec; |
| 2357 | float dot; |
| 2358 | |
| 2359 | objectcxx . . $ object# *target = ObjGetcxx . . $ ObjGet(11672e354c0b263a).(ai_info->target_handlecxx . . $ ai_frame#target_handle.); |
| 2360 | |
| 2361 | if (target == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) { |
| 2362 | ai_info->status_regcxx . . $ ai_frame#status_reg. &= ~AISR_MELEEcxx . . $ `Descent3/aistruct_external.h:398:9`!; |
| 2363 | return false; |
| 2364 | } |
| 2365 | |
| 2366 | if (((Gametimecxx . . $ Gametime. - ai_info->last_see_target_timecxx . . $ ai_frame#last_see_target_time.) > 4.0 && ((Gametimecxx . . $ Gametime. - ai_info->last_hear_target_timecxx . . $ ai_frame#last_hear_target_time.) > 4.0)) || |
| 2367 | ai_info->awarenesscxx . . $ ai_frame#awareness. <= AWARE_BARELYcxx . . $ `Descent3/aistruct_external.h:326:9`!) { |
| 2368 | ai_info->status_regcxx . . $ ai_frame#status_reg. &= ~AISR_MELEEcxx . . $ `Descent3/aistruct_external.h:398:9`!; |
| 2369 | return false; |
| 2370 | } |
| 2371 | |
| 2372 | if (ai_info->next_melee_timecxx . . $ ai_frame#next_melee_time. > Gametimecxx . . $ Gametime.) { |
| 2373 | ai_info->status_regcxx . . $ ai_frame#status_reg. &= ~AISR_MELEEcxx . . $ `Descent3/aistruct_external.h:398:9`!; |
| 2374 | return false; |
| 2375 | } |
| 2376 | |
| 2377 | if (ai_info->next_animation_typecxx . . $ ai_frame#next_animation_type. == AS_MELEE1cxx . . $ `Descent3/aistruct_external.h:415:9`! || ai_info->next_animation_typecxx . . $ ai_frame#next_animation_type. == AS_MELEE2cxx . . $ `Descent3/aistruct_external.h:417:9`!) { |
| 2378 | ai_info->status_regcxx . . $ ai_frame#status_reg. |= AISR_MELEEcxx . . $ `Descent3/aistruct_external.h:398:9`!; |
| 2379 | return false; |
| 2380 | } |
| 2381 | |
| 2382 | if (!(ai_info->flagscxx . . $ ai_frame#flags. & (AIF_MELEE1cxx . . $ `Descent3/aistruct_external.h:347:9`! | AIF_MELEE2cxx . . $ `Descent3/aistruct_external.h:348:9`!))) { |
| 2383 | ai_info->status_regcxx . . $ ai_frame#status_reg. &= ~AISR_MELEEcxx . . $ `Descent3/aistruct_external.h:398:9`!; |
| 2384 | return false; |
| 2385 | } |
| 2386 | |
| 2387 | // The AI wants to attack!!!!! |
| 2388 | ai_info->status_regcxx . . $ ai_frame#status_reg. |= AISR_MELEEcxx . . $ `Descent3/aistruct_external.h:398:9`!; |
| 2389 | |
| 2390 | // Determine if we are in melee range |
| 2391 | if (!MeleeHitOkcxx . . $ MeleeHitOk(39516aeee13ca5ab).(obj)) { |
| 2392 | return false; |
| 2393 | } |
| 2394 | |
| 2395 | f_vec =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). obj->orientcxx . . $ object#orient..fveccxx . . $ matrix#fvec.; |
| 2396 | vm_NormalizeVectorcxx . . $ vm_NormalizeVector(4939a7e530383cd4).(&f_vec); |
| 2397 | |
| 2398 | dot = f_vec *cxx . . $ `operator*`(4a721543d64e126a). ai_info->vec_to_target_perceivedcxx . . $ ai_frame#vec_to_target_perceived.; |
| 2399 | |
| 2400 | if (dot >= 0.8f) { |
| 2401 | gi_firecxx . . $ gi_fire# attack_info; |
| 2402 | int attack_num; |
| 2403 | |
| 2404 | if (!(ai_info->flagscxx . . $ ai_frame#flags. & AIF_MELEE1cxx . . $ `Descent3/aistruct_external.h:347:9`!) || ((ai_info->flagscxx . . $ ai_frame#flags. & AIF_MELEE2cxx . . $ `Descent3/aistruct_external.h:348:9`!) && (ps_randcxx . . $ ps_rand(b126dc7c1de90089).() > (D3_RAND_MAXcxx . . $ `misc/psrand.h:41:9`! >> 1)))) { |
| 2405 | attack_num = 1; |
| 2406 | } else { |
| 2407 | attack_num = 0; |
| 2408 | } |
| 2409 | |
| 2410 | // mprintf(0, "Melee attack now!!!!\n"); |
| 2411 | |
| 2412 | attack_info.melee_numbercxx . . $ gi_fire#melee_number. = attack_num; |
| 2413 | if (GoalAddGoalcxx . . $ GoalAddGoal(e0a3c222b6aee5c7).(obj, AIG_DO_MELEE_ANIMcxx . . $ `Descent3/aistruct_external.h:202:9`!, (void *)&attack_info, ACTIVATION_BLEND_LEVELcxx . . $ `Descent3/aistruct_external.h:280:9`!) == 0) |
| 2414 | return true; |
| 2415 | } |
| 2416 | |
| 2417 | return false; |
| 2418 | } |
| 2419 | |
| 2420 | void do_melee_attackcxx . . $ do_melee_attack(419c470199a90a97).(objectcxx . . $ object# *obj) { |
| 2421 | ai_framecxx . . $ ai_frame# *ai_info = obj->ai_infocxx . . $ object#ai_info.; |
| 2422 | float damage; |
| 2423 | notifycxx . . $ notify# melee_info; |
| 2424 | int attack_num; |
| 2425 | objectcxx . . $ object# *target = ObjGetcxx . . $ ObjGet(11672e354c0b263a).(ai_info->target_handlecxx . . $ ai_frame#target_handle.); |
| 2426 | |
| 2427 | if (ai_info->animation_typecxx . . $ ai_frame#animation_type. == AS_MELEE1cxx . . $ `Descent3/aistruct_external.h:415:9`!) { |
| 2428 | damage = ai_info->melee_damagecxx . . $ ai_frame#melee_damage.[0]; |
| 2429 | ai_info->next_melee_timecxx . . $ ai_frame#next_melee_time. = Gametimecxx . . $ Gametime. + ai_info->melee_latencycxx . . $ ai_frame#melee_latency.[0]; |
| 2430 | attack_num = 0; |
| 2431 | } else { |
| 2432 | damage = ai_info->melee_damagecxx . . $ ai_frame#melee_damage.[1]; |
| 2433 | ai_info->next_melee_timecxx . . $ ai_frame#next_melee_time. = Gametimecxx . . $ Gametime. + ai_info->melee_latencycxx . . $ ai_frame#melee_latency.[1]; |
| 2434 | attack_num = 1; |
| 2435 | } |
| 2436 | |
| 2437 | melee_info.obj_handlecxx . . $ notify#$anonymous_type_5#obj_handle. = ai_info->target_handlecxx . . $ ai_frame#target_handle.; |
| 2438 | melee_info.attack_numcxx . . $ notify#$anonymous_type_6#attack_num. = attack_num; |
| 2439 | |
| 2440 | AINotifycxx . . $ AINotify(f32b5964aaa42c22).(obj, AIN_MELEE_ATTACK_FRAMEcxx . . $ `Descent3/aistruct_external.h:309:9`!, (void *)&melee_info); |
| 2441 | |
| 2442 | if (target) { |
| 2443 | float dist = ai_info->dist_to_target_actualcxx . . $ ai_frame#dist_to_target_actual.; |
| 2444 | |
| 2445 | if (dist <= AI_MAX_MELEE_RANGEcxx . . $ `Descent3/AImain.cpp:1625:9`!) { |
| 2446 | AINotifycxx . . $ AINotify(f32b5964aaa42c22).(obj, AIN_MELEE_HITcxx . . $ `Descent3/aistruct_external.h:308:9`!, (void *)&melee_info); |
| 2447 | |
| 2448 | if (damage >= 1.0f) { |
| 2449 | objectcxx . . $ object# *objptr = ObjGetcxx . . $ ObjGet(11672e354c0b263a).(ai_info->target_handlecxx . . $ ai_frame#target_handle.); |
| 2450 | |
| 2451 | if (objptr) { |
| 2452 | if (ps_randcxx . . $ ps_rand(b126dc7c1de90089).() > D3_RAND_MAXcxx . . $ `misc/psrand.h:41:9`! / 2) { |
| 2453 | Sound_systemcxx . . $ Sound_system..Play3dSoundcxx . . $ hlsSystem#Play3dSound(17f485224ada8dd7).(SOUND_MELEE_HIT_0cxx . . $ `Descent3/sounds.h:111:9`!, SND_PRIORITY_HIGHESTcxx . . $ `sndlib/ssl_lib.h:282:9`!, objptr); |
| 2454 | if (Game_modecxx . . $ Game_mode. & GM_MULTIcxx . . $ `Descent3/game.h:288:9`!) |
| 2455 | MultiPlay3dSoundcxx . . $ MultiPlay3dSound(f056c30c88236a5f).(SOUND_MELEE_HIT_0cxx . . $ `Descent3/sounds.h:111:9`!, OBJNUMcxx . . $ `Descent3/object.h:700:9`!(objptr), SND_PRIORITY_HIGHESTcxx . . $ `sndlib/ssl_lib.h:282:9`!); |
| 2456 | if (Demo_flagscxx . . $ Demo_flags. == DF_RECORDINGcxx . . $ `lib/demofile.h:122:9`!) |
| 2457 | DemoWrite3DSoundcxx . . $ DemoWrite3DSound(c29d531f7e56abb1).(SOUND_MELEE_HIT_0cxx . . $ `Descent3/sounds.h:111:9`!, OBJNUMcxx . . $ `Descent3/object.h:700:9`!(objptr), SND_PRIORITY_HIGHESTcxx . . $ `sndlib/ssl_lib.h:282:9`!); |
| 2458 | } else { |
| 2459 | Sound_systemcxx . . $ Sound_system..Play3dSoundcxx . . $ hlsSystem#Play3dSound(17f485224ada8dd7).(SOUND_MELEE_HIT_1cxx . . $ `Descent3/sounds.h:112:9`!, SND_PRIORITY_HIGHESTcxx . . $ `sndlib/ssl_lib.h:282:9`!, objptr); |
| 2460 | if (Game_modecxx . . $ Game_mode. & GM_MULTIcxx . . $ `Descent3/game.h:288:9`!) |
| 2461 | MultiPlay3dSoundcxx . . $ MultiPlay3dSound(f056c30c88236a5f).(SOUND_MELEE_HIT_1cxx . . $ `Descent3/sounds.h:112:9`!, OBJNUMcxx . . $ `Descent3/object.h:700:9`!(objptr), SND_PRIORITY_HIGHESTcxx . . $ `sndlib/ssl_lib.h:282:9`!); |
| 2462 | if (Demo_flagscxx . . $ Demo_flags. == DF_RECORDINGcxx . . $ `lib/demofile.h:122:9`!) |
| 2463 | DemoWrite3DSoundcxx . . $ DemoWrite3DSound(c29d531f7e56abb1).(SOUND_MELEE_HIT_1cxx . . $ `Descent3/sounds.h:112:9`!, OBJNUMcxx . . $ `Descent3/object.h:700:9`!(objptr), SND_PRIORITY_HIGHESTcxx . . $ `sndlib/ssl_lib.h:282:9`!); |
| 2464 | } |
| 2465 | |
| 2466 | if (objptr->typecxx . . $ object#type. == OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`!) |
| 2467 | ApplyDamageToPlayercxx . . $ ApplyDamageToPlayer(1fbfa7277d8ac7b4).(objptr, obj, PD_MELEE_ATTACKcxx . . $ `Descent3/damage_external.h:26:9`!, damage); |
| 2468 | else |
| 2469 | ApplyDamageToGenericcxx . . $ ApplyDamageToGeneric(5474b9d0c3697015).(objptr, obj, GD_MELEE_ATTACKcxx . . $ `Descent3/damage_external.h:39:9`!, damage); |
| 2470 | } |
| 2471 | } else if (damage == 0.0f) { |
| 2472 | float energy; |
| 2473 | objectcxx . . $ object# *objptr = ObjGetcxx . . $ ObjGet(11672e354c0b263a).(ai_info->target_handlecxx . . $ ai_frame#target_handle.); |
| 2474 | |
| 2475 | // chrishack - milestone - replace with real code |
| 2476 | if (objptr) { |
| 2477 | Sound_systemcxx . . $ Sound_system..Play3dSoundcxx . . $ hlsSystem#Play3dSound(17f485224ada8dd7).(SOUND_ENERGY_DRAINcxx . . $ `Descent3/sounds.h:114:9`!, SND_PRIORITY_HIGHESTcxx . . $ `sndlib/ssl_lib.h:282:9`!, objptr); |
| 2478 | if (Game_modecxx . . $ Game_mode. & GM_MULTIcxx . . $ `Descent3/game.h:288:9`!) |
| 2479 | MultiPlay3dSoundcxx . . $ MultiPlay3dSound(f056c30c88236a5f).(SOUND_ENERGY_DRAINcxx . . $ `Descent3/sounds.h:114:9`!, OBJNUMcxx . . $ `Descent3/object.h:700:9`!(objptr), SND_PRIORITY_HIGHESTcxx . . $ `sndlib/ssl_lib.h:282:9`!); |
| 2480 | if (Demo_flagscxx . . $ Demo_flags. == DF_RECORDINGcxx . . $ `lib/demofile.h:122:9`!) |
| 2481 | DemoWrite3DSoundcxx . . $ DemoWrite3DSound(c29d531f7e56abb1).(SOUND_ENERGY_DRAINcxx . . $ `Descent3/sounds.h:114:9`!, OBJNUMcxx . . $ `Descent3/object.h:700:9`!(objptr), SND_PRIORITY_HIGHESTcxx . . $ `sndlib/ssl_lib.h:282:9`!); |
| 2482 | |
| 2483 | energy = (14 + ps_randcxx . . $ ps_rand(b126dc7c1de90089).() % 5) * Diff_general_inv_scalarcxx . . $ Diff_general_inv_scalar.[DIFF_LEVELcxx . . $ `Descent3/difficulty.h:29:9`!]; |
| 2484 | |
| 2485 | if (objptr->typecxx . . $ object#type. == OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`!) { |
| 2486 | if (Playerscxx . . $ Players.[objptr->idcxx . . $ object#id.].energycxx . . $ player#energy. < energy) |
| 2487 | energy = Playerscxx . . $ Players.[objptr->idcxx . . $ object#id.].energycxx . . $ player#energy.; |
| 2488 | |
| 2489 | DecreasePlayerEnergycxx . . $ DecreasePlayerEnergy(43c79ee2f1b9aefe).(objptr->idcxx . . $ object#id., energy); |
| 2490 | } |
| 2491 | } |
| 2492 | } |
| 2493 | } |
| 2494 | } |
| 2495 | } |
| 2496 | |
| 2497 | void do_ranged_attackcxx . . $ do_ranged_attack(419c470199a90a97).(objectcxx . . $ object# *obj) { |
| 2498 | ai_framecxx . . $ ai_frame# *ai_info = obj->ai_infocxx . . $ object#ai_info.; |
| 2499 | int cur_wb = ai_info->current_wb_firingcxx . . $ ai_frame#current_wb_firing.; |
| 2500 | |
| 2501 | // Fire Weapon |
| 2502 | WBFireBatterycxx . . $ WBFireBattery(cccf09a4825b46a4).(obj, &Object_infocxx . . $ Object_info.[obj->idcxx . . $ object#id.].static_wbcxx . . $ object_info#static_wb.[cur_wb], cur_wb); |
| 2503 | ai_info->status_regcxx . . $ ai_frame#status_reg. &= ~AISR_RANGED_ATTACKcxx . . $ `Descent3/aistruct_external.h:399:9`!; |
| 2504 | } |
| 2505 | |
| 2506 | void AIUpdateAnimcxx . . $ AIUpdateAnim(419c470199a90a97).(objectcxx . . $ object# *obj) { |
| 2507 | ai_framecxx . . $ ai_frame# *ai_info = obj->ai_infocxx . . $ object#ai_info.; |
| 2508 | polyobj_infocxx . . $ polyobj_info# *p_info = &obj->rtypecxx . . $ object#rtype..pobj_infocxx . . $ object#$anonymous_type_10#pobj_info.; |
| 2509 | int new_anim = ai_info->next_animation_typecxx . . $ ai_frame#next_animation_type.; |
| 2510 | int ai_movement = ai_info->movement_typecxx . . $ ai_frame#movement_type.; |
| 2511 | |
| 2512 | if (ai_info->anim_sound_handlecxx . . $ ai_frame#anim_sound_handle. != 0) |
| 2513 | Sound_systemcxx . . $ Sound_system..StopSoundLoopingcxx . . $ hlsSystem#StopSoundLooping(d4f767463ce0a6b3).(ai_info->anim_sound_handlecxx . . $ ai_frame#anim_sound_handle.); |
| 2514 | |
| 2515 | if (!Object_infocxx . . $ Object_info.[obj->idcxx . . $ object#id.].animcxx . . $ object_info#anim.) |
| 2516 | return; |
| 2517 | |
| 2518 | if ((Demo_flagscxx . . $ Demo_flags. == DF_PLAYBACKcxx . . $ `lib/demofile.h:123:9`!) || ((Game_modecxx . . $ Game_mode. & GM_MULTIcxx . . $ `Descent3/game.h:288:9`!) && (Netgamecxx . . $ Netgame..local_rolecxx . . $ netgame_info#local_role. == LR_CLIENTcxx . . $ `Descent3/multi_external.h:128:9`!))) { |
| 2519 | p_info->anim_flagscxx . . $ polyobj_info#anim_flags. &= ~AIAF_NOTIFYcxx . . $ `Descent3/aistruct_external.h:116:9`!; |
| 2520 | |
| 2521 | if (!(p_info->multi_anim_infocxx . . $ polyobj_info#$anonymous_type_0#multi_anim_info..flagscxx . . $ custom_anim#flags. & FMA_VALIDcxx . . $ `Descent3/object.h:661:9`!)) { |
| 2522 | mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "Update Anim: Earily bail\n"); |
| 2523 | return; |
| 2524 | } |
| 2525 | |
| 2526 | custom_animcxx . . $ custom_anim# *multi_anim_info = &p_info->multi_anim_infocxx . . $ polyobj_info#$anonymous_type_0#multi_anim_info.; |
| 2527 | |
| 2528 | multi_anim_info->server_timecxx . . $ custom_anim#server_time. = Gametimecxx . . $ Gametime.; |
| 2529 | p_info->anim_framecxx . . $ polyobj_info#anim_frame. = ((float)multi_anim_info->server_anim_framecxx . . $ custom_anim#server_anim_frame.) / 256.0f; |
| 2530 | |
| 2531 | p_info->anim_start_framecxx . . $ polyobj_info#anim_start_frame. = multi_anim_info->anim_start_framecxx . . $ custom_anim#anim_start_frame.; |
| 2532 | p_info->anim_end_framecxx . . $ polyobj_info#anim_end_frame. = multi_anim_info->anim_end_framecxx . . $ custom_anim#anim_end_frame.; |
| 2533 | p_info->anim_timecxx . . $ polyobj_info#anim_time. = multi_anim_info->anim_timecxx . . $ custom_anim#anim_time.; |
| 2534 | p_info->max_speedcxx . . $ polyobj_info#max_speed. = multi_anim_info->max_speedcxx . . $ custom_anim#max_speed.; |
| 2535 | |
| 2536 | p_info->anim_flagscxx . . $ polyobj_info#anim_flags. = 0; |
| 2537 | |
| 2538 | if (multi_anim_info->flagscxx . . $ custom_anim#flags. & FMA_LOOPINGcxx . . $ `Descent3/object.h:663:9`!) |
| 2539 | p_info->anim_flagscxx . . $ polyobj_info#anim_flags. |= AIAF_LOOPINGcxx . . $ `Descent3/aistruct_external.h:115:9`!; |
| 2540 | |
| 2541 | // Make sure we mark it as current and |
| 2542 | p_info->multi_anim_infocxx . . $ polyobj_info#$anonymous_type_0#multi_anim_info..flagscxx . . $ custom_anim#flags. |= FMA_CURRENTcxx . . $ `Descent3/object.h:662:9`!; |
| 2543 | |
| 2544 | if (multi_anim_info->anim_sound_indexcxx . . $ custom_anim#anim_sound_index. >= 0) { |
| 2545 | Sound_systemcxx . . $ Sound_system..StopSoundLoopingcxx . . $ hlsSystem#StopSoundLooping(d4f767463ce0a6b3).(ai_info->anim_sound_handlecxx . . $ ai_frame#anim_sound_handle.); |
| 2546 | ai_info->anim_sound_handlecxx . . $ ai_frame#anim_sound_handle. = Sound_systemcxx . . $ Sound_system..Play3dSoundcxx . . $ hlsSystem#Play3dSound(17f485224ada8dd7).(multi_anim_info->anim_sound_indexcxx . . $ custom_anim#anim_sound_index., SND_PRIORITY_LOWcxx . . $ `sndlib/ssl_lib.h:285:9`!, obj); |
| 2547 | } |
| 2548 | |
| 2549 | return; |
| 2550 | } |
| 2551 | |
| 2552 | if (new_anim == AS_FLINCHcxx . . $ `Descent3/aistruct_external.h:421:9`!) { |
| 2553 | float delta_time = 1.0f + obj->shieldscxx . . $ object#shields. / 10.0f; |
| 2554 | if (delta_time > 4.3) { |
| 2555 | delta_time = 4.3f; |
| 2556 | } |
| 2557 | |
| 2558 | ai_info->next_flinch_timecxx . . $ ai_frame#next_flinch_time. = Gametimecxx . . $ Gametime. + delta_time; |
| 2559 | } |
| 2560 | // mprintf(0, "D %d to %d\n", ai_info->animation_type, ai_info->next_animation_type); |
| 2561 | |
| 2562 | // Update the physics and movement class info |
| 2563 | switch (ai_info->animation_typecxx . . $ ai_frame#animation_type.) { |
| 2564 | case AS_GOTO_IDLE_STANDINGcxx . . $ `Descent3/aistruct_external.h:423:9`!: |
| 2565 | case AS_GOTO_ALERT_STANDINGcxx . . $ `Descent3/aistruct_external.h:428:9`!: |
| 2566 | if (obj->movement_typecxx . . $ object#movement_type. != MT_NONEcxx . . $ `Descent3/object_external.h:233:9`!) |
| 2567 | obj->movement_typecxx . . $ object#movement_type. = MT_WALKINGcxx . . $ `Descent3/object_external.h:235:9`!; |
| 2568 | ai_movement = ai_info->movement_typecxx . . $ ai_frame#movement_type. = MC_STANDINGcxx . . $ `Descent3/object_external.h:245:9`!; |
| 2569 | break; |
| 2570 | |
| 2571 | case AS_GOTO_IDLE_FLYINGcxx . . $ `Descent3/aistruct_external.h:424:9`!: |
| 2572 | case AS_GOTO_ALERT_FLYINGcxx . . $ `Descent3/aistruct_external.h:429:9`!: |
| 2573 | obj->movement_typecxx . . $ object#movement_type. = MT_PHYSICScxx . . $ `Descent3/object_external.h:234:9`!; |
| 2574 | ai_movement = ai_info->movement_typecxx . . $ ai_frame#movement_type. = MC_FLYINGcxx . . $ `Descent3/object_external.h:246:9`!; |
| 2575 | break; |
| 2576 | |
| 2577 | case AS_GOTO_IDLE_ROLLINGcxx . . $ `Descent3/aistruct_external.h:425:9`!: |
| 2578 | case AS_GOTO_ALERT_ROLLINGcxx . . $ `Descent3/aistruct_external.h:430:9`!: |
| 2579 | obj->movement_typecxx . . $ object#movement_type. = MT_WALKINGcxx . . $ `Descent3/object_external.h:235:9`!; |
| 2580 | ai_movement = ai_info->movement_typecxx . . $ ai_frame#movement_type. = MC_ROLLINGcxx . . $ `Descent3/object_external.h:247:9`!; |
| 2581 | break; |
| 2582 | |
| 2583 | case AS_GOTO_IDLE_WALKINGcxx . . $ `Descent3/aistruct_external.h:426:9`!: |
| 2584 | case AS_GOTO_ALERT_WALKINGcxx . . $ `Descent3/aistruct_external.h:431:9`!: |
| 2585 | obj->movement_typecxx . . $ object#movement_type. = MT_WALKINGcxx . . $ `Descent3/object_external.h:235:9`!; |
| 2586 | ai_movement = ai_info->movement_typecxx . . $ ai_frame#movement_type. = MC_WALKINGcxx . . $ `Descent3/object_external.h:248:9`!; |
| 2587 | break; |
| 2588 | |
| 2589 | case AS_GOTO_IDLE_JUMPINGcxx . . $ `Descent3/aistruct_external.h:427:9`!: |
| 2590 | case AS_GOTO_ALERT_JUMPINGcxx . . $ `Descent3/aistruct_external.h:432:9`!: |
| 2591 | obj->movement_typecxx . . $ object#movement_type. = MT_PHYSICScxx . . $ `Descent3/object_external.h:234:9`!; |
| 2592 | ai_movement = ai_info->movement_typecxx . . $ ai_frame#movement_type. = MC_JUMPINGcxx . . $ `Descent3/object_external.h:249:9`!; |
| 2593 | break; |
| 2594 | } |
| 2595 | |
| 2596 | if (new_anim == AS_RANGED_ATTACKcxx . . $ `Descent3/aistruct_external.h:442:9`!) { |
| 2597 | if (ai_info->soundcxx . . $ ai_frame#sound.[AI_ATTACK_SOUNDcxx . . $ `Descent3/aistruct_external.h:384:9`!] != SOUND_NONE_INDEXcxx . . $ `Descent3/sounds.h:105:9`!) { |
| 2598 | // Plays the sound and makes absolute sure that it is not looping |
| 2599 | if (Gametimecxx . . $ Gametime. - ai_info->last_sound_timecxx . . $ ai_frame#last_sound_time.[AI_ATTACK_SOUNDcxx . . $ `Descent3/aistruct_external.h:384:9`!] > 5.0f) { |
| 2600 | // A 75% chance of playing it |
| 2601 | if (ps_randcxx . . $ ps_rand(b126dc7c1de90089).() % 4 != 0) { |
| 2602 | Sound_systemcxx . . $ Sound_system..StopSoundLoopingcxx . . $ hlsSystem#StopSoundLooping(d4f767463ce0a6b3).( |
| 2603 | Sound_systemcxx . . $ Sound_system..Play3dSoundcxx . . $ hlsSystem#Play3dSound(17f485224ada8dd7).(ai_info->soundcxx . . $ ai_frame#sound.[AI_ATTACK_SOUNDcxx . . $ `Descent3/aistruct_external.h:384:9`!], SND_PRIORITY_NORMALcxx . . $ `sndlib/ssl_lib.h:284:9`!, obj)); |
| 2604 | if (Game_modecxx . . $ Game_mode. & GM_MULTIcxx . . $ `Descent3/game.h:288:9`!) |
| 2605 | MultiPlay3dSoundcxx . . $ MultiPlay3dSound(f056c30c88236a5f).(ai_info->soundcxx . . $ ai_frame#sound.[AI_ATTACK_SOUNDcxx . . $ `Descent3/aistruct_external.h:384:9`!], OBJNUMcxx . . $ `Descent3/object.h:700:9`!(obj), SND_PRIORITY_NORMALcxx . . $ `sndlib/ssl_lib.h:284:9`!); |
| 2606 | if (Demo_flagscxx . . $ Demo_flags. == DF_RECORDINGcxx . . $ `lib/demofile.h:122:9`!) |
| 2607 | DemoWrite3DSoundcxx . . $ DemoWrite3DSound(c29d531f7e56abb1).(ai_info->soundcxx . . $ ai_frame#sound.[AI_ATTACK_SOUNDcxx . . $ `Descent3/aistruct_external.h:384:9`!], OBJNUMcxx . . $ `Descent3/object.h:700:9`!(obj), SND_PRIORITY_NORMALcxx . . $ `sndlib/ssl_lib.h:284:9`!); |
| 2608 | } |
| 2609 | ai_info->last_sound_timecxx . . $ ai_frame#last_sound_time.[AI_ATTACK_SOUNDcxx . . $ `Descent3/aistruct_external.h:384:9`!] = Gametimecxx . . $ Gametime.; |
| 2610 | } |
| 2611 | } |
| 2612 | } else if (new_anim != AI_INVALID_INDEXcxx . . $ `Descent3/aistruct.h:404:9`! && new_anim != AS_RANGED_RECOILcxx . . $ `Descent3/aistruct_external.h:443:9`!) { |
| 2613 | if ((new_anim != AS_CUSTOMcxx . . $ `Descent3/aistruct_external.h:445:9`! && |
| 2614 | Object_infocxx . . $ Object_info.[obj->idcxx . . $ object#id.].animcxx . . $ object_info#anim.[ai_movement].elemcxx . . $ anim_elem#elem.[new_anim].anim_sound_indexcxx . . $ anim_entry#anim_sound_index. != SOUND_NONE_INDEXcxx . . $ `Descent3/sounds.h:105:9`!) || |
| 2615 | (new_anim == AS_CUSTOMcxx . . $ `Descent3/aistruct_external.h:445:9`! && p_info->custom_anim_infocxx . . $ polyobj_info#$anonymous_type_0#custom_anim_info..anim_sound_indexcxx . . $ custom_anim#anim_sound_index. != SOUND_NONE_INDEXcxx . . $ `Descent3/sounds.h:105:9`!)) { |
| 2616 | if (new_anim != AS_CUSTOMcxx . . $ `Descent3/aistruct_external.h:445:9`!) |
| 2617 | ai_info->last_played_sound_indexcxx . . $ ai_frame#last_played_sound_index. = Object_infocxx . . $ Object_info.[obj->idcxx . . $ object#id.].animcxx . . $ object_info#anim.[ai_movement].elemcxx . . $ anim_elem#elem.[new_anim].anim_sound_indexcxx . . $ anim_entry#anim_sound_index.; |
| 2618 | else |
| 2619 | ai_info->last_played_sound_indexcxx . . $ ai_frame#last_played_sound_index. = p_info->custom_anim_infocxx . . $ polyobj_info#$anonymous_type_0#custom_anim_info..anim_sound_indexcxx . . $ custom_anim#anim_sound_index.; |
| 2620 | |
| 2621 | ai_info->anim_sound_handlecxx . . $ ai_frame#anim_sound_handle. = Sound_systemcxx . . $ Sound_system..Play3dSoundcxx . . $ hlsSystem#Play3dSound(17f485224ada8dd7).(ai_info->last_played_sound_indexcxx . . $ ai_frame#last_played_sound_index., SND_PRIORITY_LOWcxx . . $ `sndlib/ssl_lib.h:285:9`!, obj); |
| 2622 | } else { |
| 2623 | ai_info->last_played_sound_indexcxx . . $ ai_frame#last_played_sound_index. = -1; |
| 2624 | } |
| 2625 | } |
| 2626 | |
| 2627 | new_anim_label: |
| 2628 | |
| 2629 | if (new_anim != AI_INVALID_INDEXcxx . . $ `Descent3/aistruct.h:404:9`!) { |
| 2630 | // Melee stuff |
| 2631 | if (ai_info->animation_typecxx . . $ ai_frame#animation_type. == AS_MELEE1cxx . . $ `Descent3/aistruct_external.h:415:9`! || ai_info->animation_typecxx . . $ ai_frame#animation_type. == AS_MELEE2cxx . . $ `Descent3/aistruct_external.h:417:9`!) { |
| 2632 | do_melee_attackcxx . . $ do_melee_attack(419c470199a90a97).(obj); |
| 2633 | } else if (ai_info->animation_typecxx . . $ ai_frame#animation_type. == AS_RANGED_ATTACKcxx . . $ `Descent3/aistruct_external.h:442:9`!) { |
| 2634 | ASSERTcxx . . $ `misc/pserror.h:246:9`!(new_anim == AS_RANGED_RECOILcxx . . $ `Descent3/aistruct_external.h:443:9`!); |
| 2635 | |
| 2636 | int cur_wb = ai_info->current_wb_firingcxx . . $ ai_frame#current_wb_firing.; |
| 2637 | int cur_mask = obj->dynamic_wbcxx . . $ object#dynamic_wb.[cur_wb].wb_anim_maskcxx . . $ dynamic_wb_info#wb_anim_mask.; |
| 2638 | float fire = Object_infocxx . . $ Object_info.[obj->idcxx . . $ object#id.].static_wbcxx . . $ object_info#static_wb.[cur_wb].anim_fire_framecxx . . $ otype_wb_info#anim_fire_frame.[cur_mask]; |
| 2639 | |
| 2640 | float temp_anim = p_info->anim_framecxx . . $ polyobj_info#anim_frame.; |
| 2641 | p_info->anim_framecxx . . $ polyobj_info#anim_frame. = fire; |
| 2642 | do_ranged_attackcxx . . $ do_ranged_attack(419c470199a90a97).(obj); |
| 2643 | p_info->anim_framecxx . . $ polyobj_info#anim_frame. = temp_anim; |
| 2644 | } |
| 2645 | |
| 2646 | // Set the new animation |
| 2647 | ai_info->animation_typecxx . . $ ai_frame#animation_type. = new_anim; |
| 2648 | |
| 2649 | if (new_anim == AS_RANGED_ATTACKcxx . . $ `Descent3/aistruct_external.h:442:9`!) { |
| 2650 | int cur_wb = ai_info->current_wb_firingcxx . . $ ai_frame#current_wb_firing.; |
| 2651 | int cur_mask = obj->dynamic_wbcxx . . $ object#dynamic_wb.[cur_wb].wb_anim_maskcxx . . $ dynamic_wb_info#wb_anim_mask.; |
| 2652 | |
| 2653 | float start = Object_infocxx . . $ Object_info.[obj->idcxx . . $ object#id.].static_wbcxx . . $ object_info#static_wb.[cur_wb].anim_start_framecxx . . $ otype_wb_info#anim_start_frame.[cur_mask]; |
| 2654 | float fire = Object_infocxx . . $ Object_info.[obj->idcxx . . $ object#id.].static_wbcxx . . $ object_info#static_wb.[cur_wb].anim_fire_framecxx . . $ otype_wb_info#anim_fire_frame.[cur_mask]; |
| 2655 | float end = Object_infocxx . . $ Object_info.[obj->idcxx . . $ object#id.].static_wbcxx . . $ object_info#static_wb.[cur_wb].anim_end_framecxx . . $ otype_wb_info#anim_end_frame.[cur_mask]; |
| 2656 | float total_time = Object_infocxx . . $ Object_info.[obj->idcxx . . $ object#id.].static_wbcxx . . $ object_info#static_wb.[cur_wb].anim_timecxx . . $ otype_wb_info#anim_time.[cur_mask]; |
| 2657 | |
| 2658 | p_info->anim_start_framecxx . . $ polyobj_info#anim_start_frame. = start; |
| 2659 | p_info->anim_end_framecxx . . $ polyobj_info#anim_end_frame. = fire; |
| 2660 | |
| 2661 | if (start < fire) { |
| 2662 | p_info->anim_timecxx . . $ polyobj_info#anim_time. = total_time * ((fire - start) / (end - start)); |
| 2663 | } else { |
| 2664 | new_anim = AS_RANGED_RECOILcxx . . $ `Descent3/aistruct_external.h:443:9`!; |
| 2665 | goto new_anim_label; |
| 2666 | } |
| 2667 | } else if (new_anim == AS_RANGED_RECOILcxx . . $ `Descent3/aistruct_external.h:443:9`!) { |
| 2668 | int cur_wb = ai_info->current_wb_firingcxx . . $ ai_frame#current_wb_firing.; |
| 2669 | int cur_mask = obj->dynamic_wbcxx . . $ object#dynamic_wb.[cur_wb].wb_anim_maskcxx . . $ dynamic_wb_info#wb_anim_mask.; |
| 2670 | |
| 2671 | float start = Object_infocxx . . $ Object_info.[obj->idcxx . . $ object#id.].static_wbcxx . . $ object_info#static_wb.[cur_wb].anim_start_framecxx . . $ otype_wb_info#anim_start_frame.[cur_mask]; |
| 2672 | float fire = Object_infocxx . . $ Object_info.[obj->idcxx . . $ object#id.].static_wbcxx . . $ object_info#static_wb.[cur_wb].anim_fire_framecxx . . $ otype_wb_info#anim_fire_frame.[cur_mask]; |
| 2673 | float end = Object_infocxx . . $ Object_info.[obj->idcxx . . $ object#id.].static_wbcxx . . $ object_info#static_wb.[cur_wb].anim_end_framecxx . . $ otype_wb_info#anim_end_frame.[cur_mask]; |
| 2674 | float total_time = Object_infocxx . . $ Object_info.[obj->idcxx . . $ object#id.].static_wbcxx . . $ object_info#static_wb.[cur_wb].anim_timecxx . . $ otype_wb_info#anim_time.[cur_mask]; |
| 2675 | |
| 2676 | p_info->anim_start_framecxx . . $ polyobj_info#anim_start_frame. = fire; |
| 2677 | p_info->anim_end_framecxx . . $ polyobj_info#anim_end_frame. = end; |
| 2678 | |
| 2679 | if (fire < end) |
| 2680 | p_info->anim_timecxx . . $ polyobj_info#anim_time. = total_time * ((end - fire) / (end - start)); |
| 2681 | else { |
| 2682 | new_anim = AS_ALERTcxx . . $ `Descent3/aistruct_external.h:409:9`!; |
| 2683 | goto new_anim_label; |
| 2684 | } |
| 2685 | } else if (new_anim == AS_CUSTOMcxx . . $ `Descent3/aistruct_external.h:445:9`!) { |
| 2686 | p_info->anim_start_framecxx . . $ polyobj_info#anim_start_frame. = p_info->custom_anim_infocxx . . $ polyobj_info#$anonymous_type_0#custom_anim_info..anim_start_framecxx . . $ custom_anim#anim_start_frame.; |
| 2687 | p_info->anim_end_framecxx . . $ polyobj_info#anim_end_frame. = p_info->custom_anim_infocxx . . $ polyobj_info#$anonymous_type_0#custom_anim_info..anim_end_framecxx . . $ custom_anim#anim_end_frame.; |
| 2688 | p_info->anim_timecxx . . $ polyobj_info#anim_time. = p_info->custom_anim_infocxx . . $ polyobj_info#$anonymous_type_0#custom_anim_info..anim_timecxx . . $ custom_anim#anim_time.; |
| 2689 | p_info->anim_flagscxx . . $ polyobj_info#anim_flags. = p_info->custom_anim_infocxx . . $ polyobj_info#$anonymous_type_0#custom_anim_info..flagscxx . . $ custom_anim#flags.; |
| 2690 | ai_info->next_animation_typecxx . . $ ai_frame#next_animation_type. = p_info->custom_anim_infocxx . . $ polyobj_info#$anonymous_type_0#custom_anim_info..next_anim_typecxx . . $ custom_anim#next_anim_type.; |
| 2691 | } else { |
| 2692 | p_info->anim_start_framecxx . . $ polyobj_info#anim_start_frame. = Object_infocxx . . $ Object_info.[obj->idcxx . . $ object#id.].animcxx . . $ object_info#anim.[ai_movement].elemcxx . . $ anim_elem#elem.[new_anim].fromcxx . . $ anim_entry#from.; |
| 2693 | p_info->anim_end_framecxx . . $ polyobj_info#anim_end_frame. = Object_infocxx . . $ Object_info.[obj->idcxx . . $ object#id.].animcxx . . $ object_info#anim.[ai_movement].elemcxx . . $ anim_elem#elem.[new_anim].tocxx . . $ anim_entry#to.; |
| 2694 | p_info->anim_timecxx . . $ polyobj_info#anim_time. = Object_infocxx . . $ Object_info.[obj->idcxx . . $ object#id.].animcxx . . $ object_info#anim.[ai_movement].elemcxx . . $ anim_elem#elem.[new_anim].spccxx . . $ anim_entry#spc.; |
| 2695 | } |
| 2696 | |
| 2697 | p_info->anim_framecxx . . $ polyobj_info#anim_frame. = p_info->anim_start_framecxx . . $ polyobj_info#anim_start_frame.; |
| 2698 | |
| 2699 | // Handle the next anim's |
| 2700 | switch (new_anim) { |
| 2701 | case AS_MELEE1cxx . . $ `Descent3/aistruct_external.h:415:9`!: |
| 2702 | case AS_MELEE2cxx . . $ `Descent3/aistruct_external.h:417:9`!: { |
| 2703 | p_info->anim_flagscxx . . $ polyobj_info#anim_flags. = AIAF_NOTIFYcxx . . $ `Descent3/aistruct_external.h:116:9`!; |
| 2704 | ai_info->next_animation_typecxx . . $ ai_frame#next_animation_type. = new_anim + 1; /* Recoil */ |
| 2705 | } break; |
| 2706 | |
| 2707 | case AS_RANGED_ATTACKcxx . . $ `Descent3/aistruct_external.h:442:9`!: { |
| 2708 | p_info->anim_flagscxx . . $ polyobj_info#anim_flags. = AIAF_NOTIFYcxx . . $ `Descent3/aistruct_external.h:116:9`!; |
| 2709 | ai_info->next_animation_typecxx . . $ ai_frame#next_animation_type. = AS_RANGED_RECOILcxx . . $ `Descent3/aistruct_external.h:443:9`!; /* Recoil */ |
| 2710 | } break; |
| 2711 | |
| 2712 | case AS_DEATHcxx . . $ `Descent3/aistruct_external.h:410:9`!: { |
| 2713 | p_info->anim_flagscxx . . $ polyobj_info#anim_flags. = 0; |
| 2714 | ai_info->next_animation_typecxx . . $ ai_frame#next_animation_type. = AI_INVALID_INDEXcxx . . $ `Descent3/aistruct.h:404:9`!; |
| 2715 | } break; |
| 2716 | |
| 2717 | case AS_ALERTcxx . . $ `Descent3/aistruct_external.h:409:9`!: |
| 2718 | case AS_IDLEcxx . . $ `Descent3/aistruct_external.h:419:9`!: { |
| 2719 | p_info->anim_flagscxx . . $ polyobj_info#anim_flags. = AIAF_LOOPINGcxx . . $ `Descent3/aistruct_external.h:115:9`!; |
| 2720 | ai_info->next_animation_typecxx . . $ ai_frame#next_animation_type. = AI_INVALID_INDEXcxx . . $ `Descent3/aistruct.h:404:9`!; |
| 2721 | } break; |
| 2722 | |
| 2723 | case (AS_MELEE1cxx . . $ `Descent3/aistruct_external.h:415:9`! + 1): |
| 2724 | |
| 2725 | { |
| 2726 | if (!AiMeleecxx . . $ AiMelee(39516aeee13ca5ab).(obj)) { |
| 2727 | p_info->anim_flagscxx . . $ polyobj_info#anim_flags. = AIAF_NOTIFYcxx . . $ `Descent3/aistruct_external.h:116:9`!; |
| 2728 | ai_info->next_animation_typecxx . . $ ai_frame#next_animation_type. = AS_ALERTcxx . . $ `Descent3/aistruct_external.h:409:9`!; |
| 2729 | } |
| 2730 | } break; |
| 2731 | |
| 2732 | case (AS_MELEE2cxx . . $ `Descent3/aistruct_external.h:417:9`! + 1): { |
| 2733 | if (!AiMeleecxx . . $ AiMelee(39516aeee13ca5ab).(obj)) { |
| 2734 | p_info->anim_flagscxx . . $ polyobj_info#anim_flags. = AIAF_NOTIFYcxx . . $ `Descent3/aistruct_external.h:116:9`!; |
| 2735 | ai_info->next_animation_typecxx . . $ ai_frame#next_animation_type. = AS_ALERTcxx . . $ `Descent3/aistruct_external.h:409:9`!; |
| 2736 | } |
| 2737 | } break; |
| 2738 | |
| 2739 | case AS_GOTO_IDLE_STANDINGcxx . . $ `Descent3/aistruct_external.h:423:9`!: |
| 2740 | case AS_GOTO_IDLE_FLYINGcxx . . $ `Descent3/aistruct_external.h:424:9`!: |
| 2741 | case AS_GOTO_IDLE_ROLLINGcxx . . $ `Descent3/aistruct_external.h:425:9`!: |
| 2742 | case AS_GOTO_IDLE_WALKINGcxx . . $ `Descent3/aistruct_external.h:426:9`!: |
| 2743 | case AS_GOTO_IDLE_JUMPINGcxx . . $ `Descent3/aistruct_external.h:427:9`!: |
| 2744 | case AS_QUIRKcxx . . $ `Descent3/aistruct_external.h:420:9`!: |
| 2745 | case AS_BIRTHcxx . . $ `Descent3/aistruct_external.h:411:9`!: { |
| 2746 | p_info->anim_flagscxx . . $ polyobj_info#anim_flags. = AIAF_NOTIFYcxx . . $ `Descent3/aistruct_external.h:116:9`!; |
| 2747 | ai_info->next_animation_typecxx . . $ ai_frame#next_animation_type. = AS_IDLEcxx . . $ `Descent3/aistruct_external.h:419:9`!; |
| 2748 | } break; |
| 2749 | |
| 2750 | case AS_CUSTOMcxx . . $ `Descent3/aistruct_external.h:445:9`!: |
| 2751 | break; |
| 2752 | |
| 2753 | default: { |
| 2754 | p_info->anim_flagscxx . . $ polyobj_info#anim_flags. = AIAF_NOTIFYcxx . . $ `Descent3/aistruct_external.h:116:9`!; |
| 2755 | ai_info->next_animation_typecxx . . $ ai_frame#next_animation_type. = AS_ALERTcxx . . $ `Descent3/aistruct_external.h:409:9`!; |
| 2756 | } break; |
| 2757 | } |
| 2758 | } |
| 2759 | |
| 2760 | if ((Game_modecxx . . $ Game_mode. & GM_MULTIcxx . . $ `Descent3/game.h:288:9`!) && (Netgamecxx . . $ Netgame..local_rolecxx . . $ netgame_info#local_role. == LR_SERVERcxx . . $ `Descent3/multi_external.h:129:9`!)) { |
| 2761 | MultiAddObjAnimUpdatecxx . . $ MultiAddObjAnimUpdate(d4f767463ce0a6b3).(OBJNUMcxx . . $ `Descent3/object.h:700:9`!(obj)); |
| 2762 | } |
| 2763 | if (Demo_flagscxx . . $ Demo_flags. == DF_RECORDINGcxx . . $ `lib/demofile.h:122:9`!) { |
| 2764 | DemoWriteObjAnimChangedcxx . . $ DemoWriteObjAnimChanged(ed53e3bbd3fa2f69).(OBJNUMcxx . . $ `Descent3/object.h:700:9`!(obj)); |
| 2765 | } |
| 2766 | } |
| 2767 | |
| 2768 | static inline void ApplyConstantForcecxx . . $ ApplyConstantForce(ea617a392626c022).(objectcxx . . $ object# *objp, vectorcxx . . $ vector# *new_pos, vectorcxx . . $ vector# *force, float delta_time) { |
| 2769 | const vectorcxx . . $ vector# velocity = objp->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..velocitycxx . . $ physics_info#velocity.; |
| 2770 | const float drag = objp->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..dragcxx . . $ physics_info#drag.; |
| 2771 | const float mass = objp->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..masscxx . . $ physics_info#mass.; |
| 2772 | |
| 2773 | // Standard motion with a linear air drag (drag is proportional to velocity) |
| 2774 | *new_pos =cxx . . $ vector#`operator=`(c0842353a20857d). objp->poscxx . . $ object#pos. +cxx . . $ operator+(b77b703cd1e43e33). (*force /cxx . . $ `operator/`(252247219a31502c). drag) *cxx . . $ `operator*`(252247219a31502c). (delta_time) +cxx . . $ operator+(b77b703cd1e43e33). |
| 2775 | (mass / drag) *cxx . . $ `operator*`(9d6577ff3e9faa29). (velocity -cxx . . $ operator-(b77b703cd1e43e33). (*force /cxx . . $ `operator/`(252247219a31502c). drag)) *cxx . . $ `operator*`(252247219a31502c). (1 - expcxx . . $ exp(fbcf3211dfe1bfd1).(-(drag / mass) * delta_time)); |
| 2776 | } |
| 2777 | |
| 2778 | bool AIDetermineAimPointcxx . . $ AIDetermineAimPoint(f3784d1ff02632da).(objectcxx . . $ object# *robot, objectcxx . . $ object# *target, vectorcxx . . $ vector# *aim_pt, float weapon_speed) { |
| 2779 | if (DIFF_LEVELcxx . . $ `Descent3/difficulty.h:29:9`! == DIFFICULTY_TRAINEEcxx . . $ `Descent3/difficulty_external.h:25:9`! && ((robot->ai_infocxx . . $ object#ai_info.->flagscxx . . $ ai_frame#flags. & AIF_TEAM_MASKcxx . . $ `Descent3/aistruct_external.h:364:9`!) != AIF_TEAM_REBELcxx . . $ `Descent3/aistruct_external.h:366:9`!)) { |
| 2780 | *aim_pt =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). target->poscxx . . $ object#pos.; |
| 2781 | return true; |
| 2782 | } |
| 2783 | |
| 2784 | float vl = AIDetermineObjVisLevelcxx . . $ AIDetermineObjVisLevel(b2028de646e3dfb9).(robot, target); |
| 2785 | |
| 2786 | ai_framecxx . . $ ai_frame# *ai_info = robot->ai_infocxx . . $ object#ai_info.; |
| 2787 | vectorcxx . . $ vector# to_target = target->poscxx . . $ object#pos. -cxx . . $ operator-(b77b703cd1e43e33). robot->poscxx . . $ object#pos.; |
| 2788 | float dist_to_target = vm_NormalizeVectorcxx . . $ vm_NormalizeVector(4939a7e530383cd4).(&to_target); |
| 2789 | |
| 2790 | if (weapon_speed == 0.0f && ai_info) |
| 2791 | weapon_speed = ai_info->weapon_speedcxx . . $ ai_frame#weapon_speed.; |
| 2792 | |
| 2793 | if (weapon_speed == 0.0f) { |
| 2794 | *aim_pt =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). target->poscxx . . $ object#pos.; |
| 2795 | return false; |
| 2796 | } |
| 2797 | |
| 2798 | float wsp = weapon_speed - (to_target *cxx . . $ `operator*`(4a721543d64e126a). target->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..velocitycxx . . $ physics_info#velocity.); |
| 2799 | |
| 2800 | if (wsp <= 0.0f || vl < AIVIS_BARELYcxx . . $ `Descent3/AImain.cpp:1644:9`!) { |
| 2801 | *aim_pt =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). target->poscxx . . $ object#pos.; |
| 2802 | return false; |
| 2803 | } |
| 2804 | |
| 2805 | float dt = dist_to_target / wsp; |
| 2806 | |
| 2807 | float scale; |
| 2808 | |
| 2809 | if (ai_info) |
| 2810 | scale = ai_info->lead_accuracycxx . . $ ai_frame#lead_accuracy.; |
| 2811 | else |
| 2812 | scale = 1.0f; |
| 2813 | |
| 2814 | // chrishack -- add stuff so that rebels get better as DIFF lowers and |
| 2815 | // ptmc gets better as DIFF increases |
| 2816 | if (target->typecxx . . $ object#type. != OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`! || |
| 2817 | (DIFF_LEVELcxx . . $ `Descent3/difficulty.h:29:9`! < DIFFICULTY_HOTSHOTcxx . . $ `Descent3/difficulty_external.h:27:9`! && ((robot->ai_infocxx . . $ object#ai_info.->flagscxx . . $ ai_frame#flags. & AIF_TEAM_MASKcxx . . $ `Descent3/aistruct_external.h:364:9`!) != AIF_TEAM_REBELcxx . . $ `Descent3/aistruct_external.h:366:9`!)) || |
| 2818 | scale < 0.4f || vl <= AIVIS_MOSTLYcxx . . $ `Descent3/AImain.cpp:1645:9`!) |
| 2819 | *aim_pt =cxx . . $ vector#`operator=`(c0842353a20857d). target->poscxx . . $ object#pos. +cxx . . $ operator+(b77b703cd1e43e33). (target->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..velocitycxx . . $ physics_info#velocity. *cxx . . $ `operator*`(252247219a31502c). dt) *cxx . . $ `operator*`(252247219a31502c). scale; |
| 2820 | else |
| 2821 | ApplyConstantForcecxx . . $ ApplyConstantForce(ea617a392626c022).(target, aim_pt, &target->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..thrustcxx . . $ physics_info#thrust., dt * scale); |
| 2822 | |
| 2823 | return true; |
| 2824 | } |
| 2825 | |
| 2826 | vectorcxx . . $ vector# *AIDetermineFovVeccxx . . $ AIDetermineFovVec(899400cfb1a8da78).(objectcxx . . $ object# *obj, vectorcxx . . $ vector# *fov) { |
| 2827 | ai_framecxx . . $ ai_frame# *ai_info = obj->ai_infocxx . . $ object#ai_info.; |
| 2828 | poly_modelcxx . . $ poly_model# *pm = &Poly_modelscxx . . $ Poly_models.[obj->rtypecxx . . $ object#rtype..pobj_infocxx . . $ object#$anonymous_type_10#pobj_info..model_numcxx . . $ polyobj_info#model_num.]; |
| 2829 | |
| 2830 | if ((ai_info->flagscxx . . $ ai_frame#flags. & AIF_AIM_PNT_FOVcxx . . $ `Descent3/aistruct_external.h:382:9`!) && pm->num_wbscxx . . $ poly_model#num_wbs. > 0) { |
| 2831 | int aiming_gp_index = Object_infocxx . . $ Object_info.[obj->idcxx . . $ object#id.].static_wbcxx . . $ object_info#static_wb.[0].aiming_gp_indexcxx . . $ otype_wb_info#aiming_gp_index.; |
| 2832 | WeaponCalcGuncxx . . $ WeaponCalcGun(85e3752e9562a225).(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, fov, obj, pm->poly_wbcxx . . $ poly_model#poly_wb.[0].gp_indexcxx . . $ poly_wb_info#gp_index.[aiming_gp_index]); |
| 2833 | } else if (ai_info->flagscxx . . $ ai_frame#flags. & AIF_UVEC_FOVcxx . . $ `Descent3/aistruct_external.h:381:9`!) { |
| 2834 | *fov =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). obj->orientcxx . . $ object#orient..uveccxx . . $ matrix#uvec.; |
| 2835 | } else { |
| 2836 | *fov =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). obj->orientcxx . . $ object#orient..fveccxx . . $ matrix#fvec.; |
| 2837 | } |
| 2838 | |
| 2839 | return fov; |
| 2840 | } |
| 2841 | |
| 2842 | #ifdef _DEBUGcxx . . $ `<built-in>:482:9`! |
| 2843 | extern int DoAIcxx . . $ DoAI.; |
| 2844 | #else |
| 2845 | #define DoAI 1 |
| 2846 | #endif |
| 2847 | |
| 2848 | void AISeeTargetcxx . . $ AISeeTarget(674fac047436fc5b).(objectcxx . . $ object# *obj, bool f_see) { |
| 2849 | ai_framecxx . . $ ai_frame# *ai_info = obj->ai_infocxx . . $ object#ai_info.; |
| 2850 | |
| 2851 | if (f_see) { |
| 2852 | if ((Gametimecxx . . $ Gametime. - ai_info->last_see_target_timecxx . . $ ai_frame#last_see_target_time. > CHECK_VIS_INFREQUENTLY_TIMEcxx . . $ `Descent3/AImain.cpp:1552:9`!) || !(ai_info->awarenesscxx . . $ ai_frame#awareness.)) { |
| 2853 | if (ai_info->soundcxx . . $ ai_frame#sound.[AI_SEE_SOUNDcxx . . $ `Descent3/aistruct_external.h:385:9`!] != SOUND_NONE_INDEXcxx . . $ `Descent3/sounds.h:105:9`!) { |
| 2854 | // Plays the sound and makes absolute sure that it is not looping |
| 2855 | if ((ps_randcxx . . $ ps_rand(b126dc7c1de90089).() % 10) != 0) // 90% chance of playing it |
| 2856 | { |
| 2857 | if (Gametimecxx . . $ Gametime. - ai_info->last_sound_timecxx . . $ ai_frame#last_sound_time.[AI_SEE_SOUNDcxx . . $ `Descent3/aistruct_external.h:385:9`!] >= CHECK_VIS_INFREQUENTLY_TIMEcxx . . $ `Descent3/AImain.cpp:1552:9`!) { |
| 2858 | Sound_systemcxx . . $ Sound_system..StopSoundLoopingcxx . . $ hlsSystem#StopSoundLooping(d4f767463ce0a6b3).( |
| 2859 | Sound_systemcxx . . $ Sound_system..Play3dSoundcxx . . $ hlsSystem#Play3dSound(17f485224ada8dd7).(ai_info->soundcxx . . $ ai_frame#sound.[AI_SEE_SOUNDcxx . . $ `Descent3/aistruct_external.h:385:9`!], SND_PRIORITY_NORMALcxx . . $ `sndlib/ssl_lib.h:284:9`!, obj)); |
| 2860 | if (Game_modecxx . . $ Game_mode. & GM_MULTIcxx . . $ `Descent3/game.h:288:9`!) |
| 2861 | MultiPlay3dSoundcxx . . $ MultiPlay3dSound(f056c30c88236a5f).(ai_info->soundcxx . . $ ai_frame#sound.[AI_SEE_SOUNDcxx . . $ `Descent3/aistruct_external.h:385:9`!], OBJNUMcxx . . $ `Descent3/object.h:700:9`!(obj), SND_PRIORITY_LOWcxx . . $ `sndlib/ssl_lib.h:285:9`!); |
| 2862 | if (Demo_flagscxx . . $ Demo_flags. == DF_RECORDINGcxx . . $ `lib/demofile.h:122:9`!) |
| 2863 | DemoWrite3DSoundcxx . . $ DemoWrite3DSound(c29d531f7e56abb1).(ai_info->soundcxx . . $ ai_frame#sound.[AI_SEE_SOUNDcxx . . $ `Descent3/aistruct_external.h:385:9`!], OBJNUMcxx . . $ `Descent3/object.h:700:9`!(obj), SND_PRIORITY_LOWcxx . . $ `sndlib/ssl_lib.h:285:9`!); |
| 2864 | } |
| 2865 | } |
| 2866 | |
| 2867 | ai_info->last_sound_timecxx . . $ ai_frame#last_sound_time.[AI_SEE_SOUNDcxx . . $ `Descent3/aistruct_external.h:385:9`!] = Gametimecxx . . $ Gametime.; |
| 2868 | } |
| 2869 | } |
| 2870 | } |
| 2871 | |
| 2872 | if (ai_info->awarenesscxx . . $ ai_frame#awareness. < AWARE_MOSTLYcxx . . $ `Descent3/aistruct_external.h:324:9`!) |
| 2873 | ai_info->awarenesscxx . . $ ai_frame#awareness. = AWARE_MOSTLYcxx . . $ `Descent3/aistruct_external.h:324:9`!; |
| 2874 | |
| 2875 | // Note: Player position is also updated in the visability test function |
| 2876 | // for MIN_VIS_RECENT_CHECK_INTERVAL seconds |
| 2877 | objectcxx . . $ object# *targetptr; |
| 2878 | objectcxx . . $ object# *other_obj = targetptr = ObjGetcxx . . $ ObjGet(11672e354c0b263a).(ai_info->target_handlecxx . . $ ai_frame#target_handle.); |
| 2879 | |
| 2880 | if (targetptr) { |
| 2881 | if (f_see) |
| 2882 | ai_info->last_see_target_timecxx . . $ ai_frame#last_see_target_time. = Gametimecxx . . $ Gametime.; |
| 2883 | else |
| 2884 | ai_info->last_hear_target_timecxx . . $ ai_frame#last_hear_target_time. = Gametimecxx . . $ Gametime.; |
| 2885 | |
| 2886 | AIDetermineAimPointcxx . . $ AIDetermineAimPoint(f3784d1ff02632da).(obj, targetptr, &ai_info->last_see_target_poscxx . . $ ai_frame#last_see_target_pos.); |
| 2887 | } |
| 2888 | } |
| 2889 | |
| 2890 | bool AINotifycxx . . $ AINotify(f32b5964aaa42c22).(objectcxx . . $ object# *obj, uint8_tcxx . . $ uint8_t# notify_type, void *info) { |
| 2891 | int next_anim; |
| 2892 | ai_framecxx . . $ ai_frame# *ai_info = obj->ai_infocxx . . $ object#ai_info.; |
| 2893 | //@$-tD3XEventArgs evtargs; |
| 2894 | objectcxx . . $ object# *other_obj = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 2895 | objectcxx . . $ object# *targetptr; |
| 2896 | int parent; |
| 2897 | objectcxx . . $ object# *new_enemy; |
| 2898 | tOSIRISEventInfocxx . . $ tOSIRISEventInfo# ei; |
| 2899 | bool f_it_set = false; |
| 2900 | |
| 2901 | if (Demo_flagscxx . . $ Demo_flags. == DF_PLAYBACKcxx . . $ `lib/demofile.h:123:9`!) { |
| 2902 | return false; |
| 2903 | } |
| 2904 | ASSERTcxx . . $ `misc/pserror.h:246:9`!(obj); |
| 2905 | ASSERTcxx . . $ `misc/pserror.h:246:9`!(notify_type >= 0 && notify_type < 32); |
| 2906 | |
| 2907 | if (((Game_modecxx . . $ Game_mode. & GM_MULTIcxx . . $ `Descent3/game.h:288:9`!) && (Netgamecxx . . $ Netgame..local_rolecxx . . $ netgame_info#local_role. == LR_CLIENTcxx . . $ `Descent3/multi_external.h:128:9`!))) |
| 2908 | return false; |
| 2909 | |
| 2910 | if (!DoAIcxx . . $ DoAI.) |
| 2911 | return false; |
| 2912 | |
| 2913 | if (obj->typecxx . . $ object#type. == OBJ_DUMMYcxx . . $ `Descent3/object_external.h:181:9`! && notify_type != AIN_USER_DEFINEDcxx . . $ `Descent3/aistruct_external.h:301:9`!) |
| 2914 | return false; |
| 2915 | |
| 2916 | if (obj && obj->control_typecxx . . $ object#control_type. == CT_AIcxx . . $ `Descent3/object_external.h:217:9`! && ai_info->flagscxx . . $ ai_frame#flags. & AIF_DISABLEDcxx . . $ `Descent3/aistruct_external.h:362:9`!) |
| 2917 | return false; |
| 2918 | |
| 2919 | // All events use |
| 2920 | //@$-evtargs.args[0] = MAKE_NUM_EVTARG((float)notify_type); |
| 2921 | ei.evt_ai_notifycxx . . $ tOSIRISEventInfo#$anonymous_type_1#evt_ai_notify..notify_typecxx . . $ tOSIRISEVTAINOTIFY#notify_type. = notify_type; |
| 2922 | |
| 2923 | switch (notify_type) { |
| 2924 | case AIN_ANIM_COMPLETEcxx . . $ `Descent3/aistruct_external.h:306:9`!: |
| 2925 | if (ai_info->notify_flagscxx . . $ ai_frame#notify_flags. & (0x00000001 << notify_type)) { |
| 2926 | AIUpdateAnimcxx . . $ AIUpdateAnim(419c470199a90a97).(obj); |
| 2927 | } |
| 2928 | break; // parent robot |
| 2929 | case AIN_SCRIPTED_ENABLERcxx . . $ `Descent3/aistruct_external.h:305:9`!: { |
| 2930 | //@$-evtargs.args[1] = MAKE_NUM_EVTARG(((notify *)info)->goal_num); |
| 2931 | //@$-evtargs.args[2] = MAKE_NUM_EVTARG(((notify *)info)->enabler_num); |
| 2932 | ei.evt_ai_notifycxx . . $ tOSIRISEventInfo#$anonymous_type_1#evt_ai_notify..goal_numcxx . . $ tOSIRISEVTAINOTIFY#goal_num. = ((notifycxx . . $ notify# *)info)->goal_numcxx . . $ notify#$anonymous_type_5#goal_num.; |
| 2933 | ei.evt_ai_notifycxx . . $ tOSIRISEventInfo#$anonymous_type_1#evt_ai_notify..enabler_numcxx . . $ tOSIRISEVTAINOTIFY#$anonymous_type_0#enabler_num. = ((notifycxx . . $ notify# *)info)->enabler_numcxx . . $ notify#$anonymous_type_6#enabler_num.; |
| 2934 | } break; |
| 2935 | case AIN_NEW_MOVEMENTcxx . . $ `Descent3/aistruct_external.h:286:9`!: |
| 2936 | break; // parent robot |
| 2937 | case AIN_OBJ_KILLEDcxx . . $ `Descent3/aistruct_external.h:287:9`!: |
| 2938 | break; // parent robot |
| 2939 | case AIN_MELEE_HITcxx . . $ `Descent3/aistruct_external.h:308:9`!: |
| 2940 | case AIN_MELEE_ATTACK_FRAMEcxx . . $ `Descent3/aistruct_external.h:309:9`!: { |
| 2941 | notifycxx . . $ notify# *melee_info = (notifycxx . . $ notify# *)info; |
| 2942 | |
| 2943 | other_obj = ObjGetcxx . . $ ObjGet(11672e354c0b263a).(melee_info->obj_handlecxx . . $ notify#$anonymous_type_5#obj_handle.); |
| 2944 | |
| 2945 | //@$-evtargs.args[1] = MAKE_NUM_EVTARG(((notify *)info)->attack_num); |
| 2946 | ei.evt_ai_notifycxx . . $ tOSIRISEventInfo#$anonymous_type_1#evt_ai_notify..attack_numcxx . . $ tOSIRISEVTAINOTIFY#$anonymous_type_0#attack_num. = melee_info->attack_numcxx . . $ notify#$anonymous_type_6#attack_num.; |
| 2947 | } break; |
| 2948 | case AIN_WHIT_BY_OBJcxx . . $ `Descent3/aistruct_external.h:288:9`!: |
| 2949 | break; // parent robot |
| 2950 | case AIN_SEE_TARGETcxx . . $ `Descent3/aistruct_external.h:289:9`!: // parent robot (who sees, type, player_obj) |
| 2951 | if (ai_info->notify_flagscxx . . $ ai_frame#notify_flags. & (0x00000001 << notify_type)) { |
| 2952 | AISeeTargetcxx . . $ AISeeTarget(674fac047436fc5b).(obj, true); |
| 2953 | } |
| 2954 | other_obj = (objectcxx . . $ object# *)info; |
| 2955 | break; |
| 2956 | case AIN_PLAYER_SEES_YOUcxx . . $ `Descent3/aistruct_external.h:290:9`!: // parent robot (who got seen, type, player_obj) |
| 2957 | if (ai_info->notify_flagscxx . . $ ai_frame#notify_flags. & (0x00000001 << notify_type)) { |
| 2958 | if (ai_info->awarenesscxx . . $ ai_frame#awareness. < AWARE_BARELYcxx . . $ `Descent3/aistruct_external.h:326:9`!) |
| 2959 | ai_info->awarenesscxx . . $ ai_frame#awareness. = AWARE_BARELYcxx . . $ `Descent3/aistruct_external.h:326:9`!; |
| 2960 | ai_info->last_render_timecxx . . $ ai_frame#last_render_time. = Gametimecxx . . $ Gametime.; |
| 2961 | } |
| 2962 | break; |
| 2963 | case AIN_WHIT_OBJECTcxx . . $ `Descent3/aistruct_external.h:291:9`!: // A robots (the one being notified, hit something) --chrishack -- if friend, no fire for X |
| 2964 | // seconds |
| 2965 | |
| 2966 | ai_info->memorycxx . . $ ai_frame#memory.[0].num_hit_enemycxx . . $ ai_mem#num_hit_enemy.++; |
| 2967 | |
| 2968 | if (ai_info->awarenesscxx . . $ ai_frame#awareness. < AWARE_MOSTLYcxx . . $ `Descent3/aistruct_external.h:324:9`!) { |
| 2969 | ai_info->awarenesscxx . . $ ai_frame#awareness. = AWARE_MOSTLYcxx . . $ `Descent3/aistruct_external.h:324:9`!; |
| 2970 | } |
| 2971 | // chrishack -- if hitobject is target then... But, this is ok for now |
| 2972 | targetptr = ObjGetcxx . . $ ObjGet(11672e354c0b263a).(ai_info->target_handlecxx . . $ ai_frame#target_handle.); |
| 2973 | |
| 2974 | // chrishack - not really done - quick implementation |
| 2975 | if (targetptr) { |
| 2976 | ai_info->last_see_target_timecxx . . $ ai_frame#last_see_target_time. = Gametimecxx . . $ Gametime.; |
| 2977 | AIDetermineAimPointcxx . . $ AIDetermineAimPoint(f3784d1ff02632da).(obj, targetptr, &ai_info->last_see_target_poscxx . . $ ai_frame#last_see_target_pos.); |
| 2978 | } |
| 2979 | |
| 2980 | // chrishack! |
| 2981 | other_obj = (objectcxx . . $ object# *)info; |
| 2982 | break; |
| 2983 | |
| 2984 | case AIN_MOVIE_STARTcxx . . $ `Descent3/aistruct_external.h:312:9`!: |
| 2985 | case AIN_MOVIE_ENDcxx . . $ `Descent3/aistruct_external.h:313:9`!: |
| 2986 | break; |
| 2987 | case AIN_TARGET_DIEDcxx . . $ `Descent3/aistruct_external.h:292:9`!: |
| 2988 | ei.evt_ai_notifycxx . . $ tOSIRISEventInfo#$anonymous_type_1#evt_ai_notify..it_handlecxx . . $ tOSIRISEVTAINOTIFY#it_handle. = *(int *)info; |
| 2989 | f_it_set = true; |
| 2990 | break; |
| 2991 | |
| 2992 | case AIN_OBJ_FIREDcxx . . $ `Descent3/aistruct_external.h:293:9`!: // All visable (obj fired, AIN_OBJFIRED, obj who fired) -- all rendered bots |
| 2993 | { |
| 2994 | int i; |
| 2995 | other_obj = (objectcxx . . $ object# *)info; |
| 2996 | objectcxx . . $ object# *targetptr; |
| 2997 | |
| 2998 | if (other_obj->control_typecxx . . $ object#control_type. == CT_AIcxx . . $ `Descent3/object_external.h:217:9`!) { |
| 2999 | tOSIRISEventInfocxx . . $ tOSIRISEventInfo# ei; |
| 3000 | |
| 3001 | ei.evt_ai_notifycxx . . $ tOSIRISEventInfo#$anonymous_type_1#evt_ai_notify..notify_typecxx . . $ tOSIRISEVTAINOTIFY#notify_type. = AIN_FIRED_WEAPONcxx . . $ `Descent3/aistruct_external.h:314:9`!; |
| 3002 | ei.evt_ai_notifycxx . . $ tOSIRISEventInfo#$anonymous_type_1#evt_ai_notify..attack_numcxx . . $ tOSIRISEVTAINOTIFY#$anonymous_type_0#attack_num. = obj->ctypecxx . . $ object#ctype..laser_infocxx . . $ object#$anonymous_type_9#laser_info..src_gun_numcxx . . $ laser_info_s#src_gun_num.; |
| 3003 | ei.evt_ai_notifycxx . . $ tOSIRISEventInfo#$anonymous_type_1#evt_ai_notify..it_handlecxx . . $ tOSIRISEVTAINOTIFY#it_handle. = obj->handlecxx . . $ object#handle.; |
| 3004 | |
| 3005 | Osiris_CallEventcxx . . $ Osiris_CallEvent(91e8d3045aa5549c).(other_obj, EVT_AI_NOTIFYcxx . . $ `scripts/osiris_common.h:371:9`!, &ei); |
| 3006 | } |
| 3007 | |
| 3008 | if (other_obj->typecxx . . $ object#type. == OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`!) { |
| 3009 | ain_hearcxx . . $ ain_hear# hear; |
| 3010 | |
| 3011 | hear.f_directly_playercxx . . $ ain_hear#f_directly_player. = true; |
| 3012 | hear.hostile_levelcxx . . $ ain_hear#hostile_level. = 1.0f; |
| 3013 | hear.curiosity_levelcxx . . $ ain_hear#curiosity_level. = 0.0f; |
| 3014 | hear.max_distcxx . . $ ain_hear#max_dist. = AI_SOUND_SHORT_DISTcxx . . $ `Descent3/AIMain.h:157:9`!; |
| 3015 | AINotifycxx . . $ AINotify(f32b5964aaa42c22).(other_obj, AIN_HEAR_NOISEcxx . . $ `Descent3/aistruct_external.h:297:9`!, (void *)&hear); |
| 3016 | } |
| 3017 | |
| 3018 | if (other_obj->control_typecxx . . $ object#control_type. == CT_AIcxx . . $ `Descent3/object_external.h:217:9`!) { |
| 3019 | targetptr = ObjGetcxx . . $ ObjGet(11672e354c0b263a).(other_obj->ai_infocxx . . $ object#ai_info.->target_handlecxx . . $ ai_frame#target_handle.); |
| 3020 | } else { |
| 3021 | targetptr = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 3022 | } |
| 3023 | |
| 3024 | // CHRISHACK - WTF - What was this actually for???? Hmmm..... |
| 3025 | // if(obj == targetptr) |
| 3026 | // { |
| 3027 | // ei.evt_ai_notify.it_handle = ai_info->target_handle; |
| 3028 | // |
| 3029 | // ai_info->memory[0].num_enemy_shots_fired++; |
| 3030 | // |
| 3031 | // //@$-D3XExecScript(obj, EVT_AI_NOTIFY, obj, REF_OBJTYPE, &evtargs); |
| 3032 | // Osiris_CallEvent(obj,EVT_AI_NOTIFY,&ei); |
| 3033 | // } |
| 3034 | |
| 3035 | if (targetptr && targetptr->control_typecxx . . $ object#control_type. == CT_AIcxx . . $ `Descent3/object_external.h:217:9`!) { |
| 3036 | if ((targetptr->ai_infocxx . . $ object#ai_info.->flagscxx . . $ ai_frame#flags. & AIF_DODGEcxx . . $ `Descent3/aistruct_external.h:355:9`!) && !(IS_GUIDEBOTcxx . . $ `Descent3/objinfo.h:363:9`!(targetptr))) { |
| 3037 | if (BOA_IsVisiblecxx . . $ BOA_IsVisible(cf9ef193275fa6d8).(targetptr->roomnumcxx . . $ object#roomnum., other_obj->roomnumcxx . . $ object#roomnum.)) { |
| 3038 | targetptr->ai_infocxx . . $ object#ai_info.->memorycxx . . $ ai_frame#memory.[0].num_enemy_shots_dodgedcxx . . $ ai_mem#num_enemy_shots_dodged.++; |
| 3039 | GoalAddGoalcxx . . $ GoalAddGoal(e0a3c222b6aee5c7).(targetptr, AIG_DODGE_OBJcxx . . $ `Descent3/aistruct_external.h:194:9`!, (void *)&obj->handlecxx . . $ object#handle., ACTIVATION_BLEND_LEVELcxx . . $ `Descent3/aistruct_external.h:280:9`!); |
| 3040 | |
| 3041 | //@$-D3XExecScript(targetptr, EVT_AI_NOTIFY, obj, REF_OBJTYPE, &evtargs); |
| 3042 | ei.evt_ai_notifycxx . . $ tOSIRISEventInfo#$anonymous_type_1#evt_ai_notify..it_handlecxx . . $ tOSIRISEVTAINOTIFY#it_handle. = obj->handlecxx . . $ object#handle.; |
| 3043 | Osiris_CallEventcxx . . $ Osiris_CallEvent(91e8d3045aa5549c).(targetptr, EVT_AI_NOTIFYcxx . . $ `scripts/osiris_common.h:371:9`!, &ei); |
| 3044 | } |
| 3045 | } |
| 3046 | } else if (other_obj->typecxx . . $ object#type. == OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`!) // chrishack -- we might be able use the target handle and last see time! |
| 3047 | // use BOA line-of-sight if any player then notify! Damn big improvement. |
| 3048 | { |
| 3049 | if (!(Game_modecxx . . $ Game_mode. & GM_MULTIcxx . . $ `Descent3/game.h:288:9`!)) { |
| 3050 | for (i = 0; i < AI_NumRenderedcxx . . $ AI_NumRendered.; i++) { |
| 3051 | // mprintf(0, "I know that I could dodge, if I was aware, says robot %d.\n", AI_RenderedList[i]); |
| 3052 | |
| 3053 | if (!BOA_IsVisiblecxx . . $ BOA_IsVisible(cf9ef193275fa6d8).(Objectscxx . . $ Objects.[AI_RenderedListcxx . . $ AI_RenderedList.[i]].roomnumcxx . . $ object#roomnum., other_obj->roomnumcxx . . $ object#roomnum.)) |
| 3054 | continue; |
| 3055 | |
| 3056 | ai_framecxx . . $ ai_frame# *ai_info = Objectscxx . . $ Objects.[AI_RenderedListcxx . . $ AI_RenderedList.[i]].ai_infocxx . . $ object#ai_info.; |
| 3057 | if (ai_info->notify_flagscxx . . $ ai_frame#notify_flags. & (0x00000001 << notify_type)) { |
| 3058 | if (!(ai_info->flagscxx . . $ ai_frame#flags. & AIF_DISABLEDcxx . . $ `Descent3/aistruct_external.h:362:9`!)) { |
| 3059 | if (ai_info->flagscxx . . $ ai_frame#flags. & AIF_DODGEcxx . . $ `Descent3/aistruct_external.h:355:9`!) { |
| 3060 | if (ai_info->awarenesscxx . . $ ai_frame#awareness. > AWARE_BARELYcxx . . $ `Descent3/aistruct_external.h:326:9`!) { |
| 3061 | if (ps_randcxx . . $ ps_rand(b126dc7c1de90089).() < ai_info->dodge_percentcxx . . $ ai_frame#dodge_percent. * D3_RAND_MAXcxx . . $ `misc/psrand.h:41:9`!) { |
| 3062 | vectorcxx . . $ vector# fov_vec; |
| 3063 | |
| 3064 | if (ai_info->vec_to_target_actualcxx . . $ ai_frame#vec_to_target_actual. *cxx . . $ `operator*`(4a721543d64e126a). (*AIDetermineFovVeccxx . . $ AIDetermineFovVec(899400cfb1a8da78).(&Objectscxx . . $ Objects.[AI_RenderedListcxx . . $ AI_RenderedList.[i]], &fov_vec)) >= |
| 3065 | Objectscxx . . $ Objects.[AI_RenderedListcxx . . $ AI_RenderedList.[i]].ai_infocxx . . $ object#ai_info.->fovcxx . . $ ai_frame#fov.) { |
| 3066 | // mprintf(0, "I am fired upon says robot %d\n", AI_RenderedList[i])); |
| 3067 | if (ai_info->notify_flagscxx . . $ ai_frame#notify_flags. & (0x00000001 << notify_type)) { |
| 3068 | ai_info->memorycxx . . $ ai_frame#memory.[0].num_enemy_shots_dodgedcxx . . $ ai_mem#num_enemy_shots_dodged.++; |
| 3069 | GoalAddGoalcxx . . $ GoalAddGoal(e0a3c222b6aee5c7).(&Objectscxx . . $ Objects.[AI_RenderedListcxx . . $ AI_RenderedList.[i]], AIG_DODGE_OBJcxx . . $ `Descent3/aistruct_external.h:194:9`!, (void *)&obj->handlecxx . . $ object#handle., |
| 3070 | ACTIVATION_BLEND_LEVELcxx . . $ `Descent3/aistruct_external.h:280:9`!, 1.0f, GF_SPEED_DODGEcxx . . $ `Descent3/aistruct_external.h:250:9`!); |
| 3071 | } |
| 3072 | } |
| 3073 | } |
| 3074 | } |
| 3075 | } |
| 3076 | } |
| 3077 | } |
| 3078 | //@$-D3XExecScript(&Objects[AI_RenderedList[i]], EVT_AI_NOTIFY, NULL, REF_OBJTYPE, &evtargs); |
| 3079 | Osiris_CallEventcxx . . $ Osiris_CallEvent(91e8d3045aa5549c).(&Objectscxx . . $ Objects.[AI_RenderedListcxx . . $ AI_RenderedList.[i]], EVT_AI_NOTIFYcxx . . $ `scripts/osiris_common.h:371:9`!, &ei); |
| 3080 | |
| 3081 | // This might be removed |
| 3082 | AISeeTargetcxx . . $ AISeeTarget(674fac047436fc5b).(&Objectscxx . . $ Objects.[AI_RenderedListcxx . . $ AI_RenderedList.[i]], false); |
| 3083 | } |
| 3084 | } else { |
| 3085 | for (i = 0; i <= Highest_object_indexcxx . . $ Highest_object_index.; i++) { |
| 3086 | // mprintf(0, "I know that I could dodge, if I was aware, says robot %d.\n", AI_RenderedList[i]); |
| 3087 | if (Objectscxx . . $ Objects.[i].control_typecxx . . $ object#control_type. != CT_AIcxx . . $ `Descent3/object_external.h:217:9`! || Objectscxx . . $ Objects.[i].typecxx . . $ object#type. == OBJ_NONEcxx . . $ `Descent3/object_external.h:159:9`!) |
| 3088 | continue; |
| 3089 | |
| 3090 | if (!BOA_IsVisiblecxx . . $ BOA_IsVisible(cf9ef193275fa6d8).(Objectscxx . . $ Objects.[i].roomnumcxx . . $ object#roomnum., other_obj->roomnumcxx . . $ object#roomnum.)) |
| 3091 | continue; |
| 3092 | |
| 3093 | ai_framecxx . . $ ai_frame# *ai_info = Objectscxx . . $ Objects.[i].ai_infocxx . . $ object#ai_info.; |
| 3094 | |
| 3095 | if (ai_info->notify_flagscxx . . $ ai_frame#notify_flags. & (0x00000001 << notify_type)) { |
| 3096 | if (!(ai_info->flagscxx . . $ ai_frame#flags. & AIF_DISABLEDcxx . . $ `Descent3/aistruct_external.h:362:9`!)) { |
| 3097 | if (ai_info->flagscxx . . $ ai_frame#flags. & AIF_DODGEcxx . . $ `Descent3/aistruct_external.h:355:9`!) { |
| 3098 | if (ps_randcxx . . $ ps_rand(b126dc7c1de90089).() < ai_info->dodge_percentcxx . . $ ai_frame#dodge_percent. * D3_RAND_MAXcxx . . $ `misc/psrand.h:41:9`!) { |
| 3099 | vectorcxx . . $ vector# to_weapon = other_obj->poscxx . . $ object#pos. -cxx . . $ operator-(b77b703cd1e43e33). Objectscxx . . $ Objects.[i].poscxx . . $ object#pos.; |
| 3100 | vm_NormalizeVectorcxx . . $ vm_NormalizeVector(4939a7e530383cd4).(&to_weapon); |
| 3101 | |
| 3102 | vectorcxx . . $ vector# fov_vec; |
| 3103 | AIDetermineFovVeccxx . . $ AIDetermineFovVec(899400cfb1a8da78).(&Objectscxx . . $ Objects.[i], &fov_vec); |
| 3104 | |
| 3105 | if (to_weapon *cxx . . $ `operator*`(4a721543d64e126a). fov_vec >= Objectscxx . . $ Objects.[i].ai_infocxx . . $ object#ai_info.->fovcxx . . $ ai_frame#fov.) { |
| 3106 | // mprintf(0, "I am fired upon says robot %d\n", AI_RenderedList[i]); |
| 3107 | if (ai_info->notify_flagscxx . . $ ai_frame#notify_flags. & (0x00000001 << notify_type)) { |
| 3108 | ai_info->memorycxx . . $ ai_frame#memory.[0].num_enemy_shots_dodgedcxx . . $ ai_mem#num_enemy_shots_dodged.++; |
| 3109 | GoalAddGoalcxx . . $ GoalAddGoal(e0a3c222b6aee5c7).(&Objectscxx . . $ Objects.[i], AIG_DODGE_OBJcxx . . $ `Descent3/aistruct_external.h:194:9`!, (void *)&obj->handlecxx . . $ object#handle., ACTIVATION_BLEND_LEVELcxx . . $ `Descent3/aistruct_external.h:280:9`!, 1.0f, |
| 3110 | GF_SPEED_DODGEcxx . . $ `Descent3/aistruct_external.h:250:9`!); |
| 3111 | } |
| 3112 | } |
| 3113 | } |
| 3114 | } |
| 3115 | } |
| 3116 | } |
| 3117 | //@$-D3XExecScript(&Objects[i], EVT_AI_NOTIFY, NULL, REF_OBJTYPE, &evtargs); |
| 3118 | Osiris_CallEventcxx . . $ Osiris_CallEvent(91e8d3045aa5549c).(&Objectscxx . . $ Objects.[i], EVT_AI_NOTIFYcxx . . $ `scripts/osiris_common.h:371:9`!, &ei); |
| 3119 | |
| 3120 | // This might be removed |
| 3121 | AISeeTargetcxx . . $ AISeeTarget(674fac047436fc5b).(&Objectscxx . . $ Objects.[i], false); |
| 3122 | } |
| 3123 | } |
| 3124 | } |
| 3125 | } break; |
| 3126 | case AIN_GOAL_COMPLETEcxx . . $ `Descent3/aistruct_external.h:294:9`!: |
| 3127 | case AIN_GOAL_INVALIDcxx . . $ `Descent3/aistruct_external.h:303:9`!: |
| 3128 | case AIN_GOAL_FAILcxx . . $ `Descent3/aistruct_external.h:295:9`!: |
| 3129 | case AIN_GOAL_ERRORcxx . . $ `Descent3/aistruct_external.h:296:9`!: |
| 3130 | case AIN_SCRIPTED_GOALcxx . . $ `Descent3/aistruct_external.h:304:9`!: |
| 3131 | case AIN_SCRIPTED_INFLUENCEcxx . . $ `Descent3/aistruct_external.h:310:9`!: |
| 3132 | case AIN_SCRIPTED_ORIENTcxx . . $ `Descent3/aistruct_external.h:311:9`!: |
| 3133 | ei.evt_ai_notifycxx . . $ tOSIRISEventInfo#$anonymous_type_1#evt_ai_notify..goal_numcxx . . $ tOSIRISEVTAINOTIFY#goal_num. = *((int *)info); |
| 3134 | ei.evt_ai_notifycxx . . $ tOSIRISEventInfo#$anonymous_type_1#evt_ai_notify..goal_uidcxx . . $ tOSIRISEVTAINOTIFY#goal_uid. = ai_info->goalscxx . . $ ai_frame#goals.[ei.evt_ai_notifycxx . . $ tOSIRISEventInfo#$anonymous_type_1#evt_ai_notify..goal_numcxx . . $ tOSIRISEVTAINOTIFY#goal_num.].guidcxx . . $ goal#guid.; |
| 3135 | ei.evt_ai_notifycxx . . $ tOSIRISEventInfo#$anonymous_type_1#evt_ai_notify..it_handlecxx . . $ tOSIRISEVTAINOTIFY#it_handle. = obj->handlecxx . . $ object#handle.; |
| 3136 | f_it_set = true; |
| 3137 | Osiris_CallLevelEventcxx . . $ Osiris_CallLevelEvent(a880c8b99cdc05b4).(EVT_AI_NOTIFYcxx . . $ `scripts/osiris_common.h:371:9`!, &ei); |
| 3138 | break; |
| 3139 | case AIN_HEAR_NOISEcxx . . $ `Descent3/aistruct_external.h:297:9`!: { |
| 3140 | ain_hearcxx . . $ ain_hear# *hptr = (ain_hearcxx . . $ ain_hear# *)info; |
| 3141 | int i; |
| 3142 | |
| 3143 | if (hptr->f_directly_playercxx . . $ ain_hear#f_directly_player.) { |
| 3144 | int16_t heard_noise_obj[50]; |
| 3145 | int num_objs = fvi_QuickDistObjectListcxx . . $ fvi_QuickDistObjectList(85643dfbd17d1ac8).(&obj->poscxx . . $ object#pos., obj->roomnumcxx . . $ object#roomnum., hptr->max_distcxx . . $ ain_hear#max_dist., heard_noise_obj, 50, false, true, |
| 3146 | false, true); |
| 3147 | |
| 3148 | for (i = 0; i < num_objs; i++) { |
| 3149 | if (Objectscxx . . $ Objects.[heard_noise_obj[i]].control_typecxx . . $ object#control_type. == CT_AIcxx . . $ `Descent3/object_external.h:217:9`!) { |
| 3150 | if (vm_VectorDistancecxx . . $ vm_VectorDistance(e65d563e2b53cc54).(&obj->poscxx . . $ object#pos., &Objectscxx . . $ Objects.[heard_noise_obj[i]].poscxx . . $ object#pos.) < |
| 3151 | hptr->max_distcxx . . $ ain_hear#max_dist. * Objectscxx . . $ Objects.[heard_noise_obj[i]].ai_infocxx . . $ object#ai_info.->hearingcxx . . $ ai_frame#hearing.) { |
| 3152 | AISeeTargetcxx . . $ AISeeTarget(674fac047436fc5b).(&Objectscxx . . $ Objects.[heard_noise_obj[i]], false); |
| 3153 | } |
| 3154 | } |
| 3155 | } |
| 3156 | } |
| 3157 | } break; // parent robot -- chrishack -- Not done |
| 3158 | case AIN_NEAR_TARGETcxx . . $ `Descent3/aistruct_external.h:298:9`!: |
| 3159 | other_obj = (objectcxx . . $ object# *)info; |
| 3160 | break; |
| 3161 | case AIN_HIT_BY_WEAPONcxx . . $ `Descent3/aistruct_external.h:299:9`!: { |
| 3162 | ai_info->memorycxx . . $ ai_frame#memory.[0].num_times_hitcxx . . $ ai_mem#num_times_hit.++; |
| 3163 | |
| 3164 | if (ai_info->notify_flagscxx . . $ ai_frame#notify_flags. & (0x00000001 << notify_type)) { |
| 3165 | ai_info->awarenesscxx . . $ ai_frame#awareness. = AWARE_FULLYcxx . . $ `Descent3/aistruct_external.h:323:9`!; |
| 3166 | |
| 3167 | // Flinching |
| 3168 | if (Gametimecxx . . $ Gametime. > ai_info->next_flinch_timecxx . . $ ai_frame#next_flinch_time.) { |
| 3169 | if (ps_randcxx . . $ ps_rand(b126dc7c1de90089).() % 10 > 8) { |
| 3170 | if (ai_info->flagscxx . . $ ai_frame#flags. & AIF_FLINCHcxx . . $ `Descent3/aistruct_external.h:357:9`!) { |
| 3171 | next_anim = AS_FLINCHcxx . . $ `Descent3/aistruct_external.h:421:9`!; |
| 3172 | GoalAddGoalcxx . . $ GoalAddGoal(e0a3c222b6aee5c7).(obj, AIG_SET_ANIMcxx . . $ `Descent3/aistruct_external.h:196:9`!, (void *)&next_anim, ACTIVATION_BLEND_LEVELcxx . . $ `Descent3/aistruct_external.h:280:9`!); |
| 3173 | } |
| 3174 | } |
| 3175 | } |
| 3176 | } |
| 3177 | |
| 3178 | if (ai_info->soundcxx . . $ ai_frame#sound.[AI_ANGRY_SOUNDcxx . . $ `Descent3/aistruct_external.h:387:9`!] != SOUND_NONE_INDEXcxx . . $ `Descent3/sounds.h:105:9`!) { |
| 3179 | // Plays the sound and makes absolute sure that it is not looping |
| 3180 | if (Gametimecxx . . $ Gametime. - ai_info->last_sound_timecxx . . $ ai_frame#last_sound_time.[AI_ANGRY_SOUNDcxx . . $ `Descent3/aistruct_external.h:387:9`!] > 5.0f) { |
| 3181 | Sound_systemcxx . . $ Sound_system..StopSoundLoopingcxx . . $ hlsSystem#StopSoundLooping(d4f767463ce0a6b3).( |
| 3182 | Sound_systemcxx . . $ Sound_system..Play3dSoundcxx . . $ hlsSystem#Play3dSound(17f485224ada8dd7).(ai_info->soundcxx . . $ ai_frame#sound.[AI_ANGRY_SOUNDcxx . . $ `Descent3/aistruct_external.h:387:9`!], SND_PRIORITY_NORMALcxx . . $ `sndlib/ssl_lib.h:284:9`!, obj)); |
| 3183 | if (Game_modecxx . . $ Game_mode. & GM_MULTIcxx . . $ `Descent3/game.h:288:9`!) |
| 3184 | MultiPlay3dSoundcxx . . $ MultiPlay3dSound(f056c30c88236a5f).(ai_info->soundcxx . . $ ai_frame#sound.[AI_ANGRY_SOUNDcxx . . $ `Descent3/aistruct_external.h:387:9`!], OBJNUMcxx . . $ `Descent3/object.h:700:9`!(obj), SND_PRIORITY_NORMALcxx . . $ `sndlib/ssl_lib.h:284:9`!); |
| 3185 | if (Demo_flagscxx . . $ Demo_flags. == DF_RECORDINGcxx . . $ `lib/demofile.h:122:9`!) |
| 3186 | DemoWrite3DSoundcxx . . $ DemoWrite3DSound(c29d531f7e56abb1).(ai_info->soundcxx . . $ ai_frame#sound.[AI_ANGRY_SOUNDcxx . . $ `Descent3/aistruct_external.h:387:9`!], OBJNUMcxx . . $ `Descent3/object.h:700:9`!(obj), SND_PRIORITY_NORMALcxx . . $ `sndlib/ssl_lib.h:284:9`!); |
| 3187 | ai_info->last_sound_timecxx . . $ ai_frame#last_sound_time.[AI_ANGRY_SOUNDcxx . . $ `Descent3/aistruct_external.h:387:9`!] = Gametimecxx . . $ Gametime.; |
| 3188 | } |
| 3189 | } |
| 3190 | |
| 3191 | other_obj = (objectcxx . . $ object# *)info; |
| 3192 | parent = other_obj->parent_handlecxx . . $ object#parent_handle.; |
| 3193 | new_enemy = ObjGetcxx . . $ ObjGet(11672e354c0b263a).(parent); |
| 3194 | |
| 3195 | if (ai_info->flagscxx . . $ ai_frame#flags. & AIF_ACT_AS_NEUTRAL_UNTIL_SHOTcxx . . $ `Descent3/aistruct_external.h:353:9`!) { |
| 3196 | ai_info->flagscxx . . $ ai_frame#flags. &= ~AIF_ACT_AS_NEUTRAL_UNTIL_SHOTcxx . . $ `Descent3/aistruct_external.h:353:9`!; |
| 3197 | if (!AIObjEnemycxx . . $ AIObjEnemy(9fa7d4d2c8b4c2db).(obj, new_enemy)) { |
| 3198 | ai_info->flagscxx . . $ ai_frame#flags. |= AIF_ACT_AS_NEUTRAL_UNTIL_SHOTcxx . . $ `Descent3/aistruct_external.h:353:9`!; |
| 3199 | } |
| 3200 | } |
| 3201 | |
| 3202 | bool f_enemy = AIObjEnemycxx . . $ AIObjEnemy(9fa7d4d2c8b4c2db).(obj, new_enemy); |
| 3203 | |
| 3204 | float rand_val = ps_randcxx . . $ ps_rand(b126dc7c1de90089).() / (float)D3_RAND_MAXcxx . . $ `misc/psrand.h:41:9`!; |
| 3205 | |
| 3206 | if (new_enemy && (new_enemy != obj)) { |
| 3207 | // 20% per hit of switching to hitting player |
| 3208 | if ((new_enemy->control_typecxx . . $ object#control_type. == CT_AIcxx . . $ `Descent3/object_external.h:217:9`! && |
| 3209 | ((new_enemy->ai_infocxx . . $ object#ai_info.->target_handlecxx . . $ ai_frame#target_handle. == obj->handlecxx . . $ object#handle.) || |
| 3210 | (!f_enemy && new_enemy->idcxx . . $ object#id. == obj->idcxx . . $ object#id. && new_enemy->typecxx . . $ object#type. == obj->typecxx . . $ object#type. && rand_val < ai_info->fight_samecxx . . $ ai_frame#fight_same.) || |
| 3211 | (!f_enemy && !(new_enemy->idcxx . . $ object#id. == obj->idcxx . . $ object#id. && new_enemy->typecxx . . $ object#type. == obj->typecxx . . $ object#type.) && |
| 3212 | rand_val < ai_info->fight_teamcxx . . $ ai_frame#fight_team.))) || |
| 3213 | (f_enemy && new_enemy->typecxx . . $ object#type. == OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`! && |
| 3214 | (ai_info->awarenesscxx . . $ ai_frame#awareness. <= AWARE_BARELYcxx . . $ `Descent3/aistruct_external.h:326:9`! || rand_val > .8 || ai_info->target_handlecxx . . $ ai_frame#target_handle. == OBJECT_HANDLE_NONEcxx . . $ `Descent3/object_external.h:156:9`!))) { |
| 3215 | // if(obj->ai_info->flags & AIF_DETERMINE_TARGET) |
| 3216 | { |
| 3217 | ai_info->flagscxx . . $ ai_frame#flags. |= AIF_DETERMINE_TARGETcxx . . $ `Descent3/aistruct_external.h:358:9`!; |
| 3218 | obj->ai_infocxx . . $ object#ai_info.->next_target_update_timecxx . . $ ai_frame#next_target_update_time. = |
| 3219 | Gametimecxx . . $ Gametime. + MIN_TARGET_UPDATE_INTERVALcxx . . $ `Descent3/AImain.cpp:1555:9`! + |
| 3220 | ((float)ps_randcxx . . $ ps_rand(b126dc7c1de90089).() / (float)D3_RAND_MAXcxx . . $ `misc/psrand.h:41:9`!) * (MAX_TARGET_UPDATE_INTERVALcxx . . $ `Descent3/AImain.cpp:1556:9`! - MIN_TARGET_UPDATE_INTERVALcxx . . $ `Descent3/AImain.cpp:1555:9`!); |
| 3221 | AISetTargetcxx . . $ AISetTarget(9985ed114f2bfc78).(obj, new_enemy->handlecxx . . $ object#handle.); |
| 3222 | } |
| 3223 | } |
| 3224 | } |
| 3225 | } break; |
| 3226 | |
| 3227 | case AIN_BUMPED_OBJcxx . . $ `Descent3/aistruct_external.h:307:9`!: |
| 3228 | other_obj = (objectcxx . . $ object# *)info; |
| 3229 | |
| 3230 | // 100% is previously not aware, 50% if already aware |
| 3231 | if (AIObjEnemycxx . . $ AIObjEnemy(9fa7d4d2c8b4c2db).(obj, other_obj)) { |
| 3232 | if ((ai_info->awarenesscxx . . $ ai_frame#awareness. <= AWARE_BARELYcxx . . $ `Descent3/aistruct_external.h:326:9`!) || ((ai_info->awarenesscxx . . $ ai_frame#awareness. > AWARE_BARELYcxx . . $ `Descent3/aistruct_external.h:326:9`!) && ((ps_randcxx . . $ ps_rand(b126dc7c1de90089).() % 100) > 50))) { |
| 3233 | // if(ai_info->flags & AIF_DETERMINE_TARGET) |
| 3234 | { |
| 3235 | ai_info->flagscxx . . $ ai_frame#flags. |= AIF_DETERMINE_TARGETcxx . . $ `Descent3/aistruct_external.h:358:9`!; |
| 3236 | ai_info->next_target_update_timecxx . . $ ai_frame#next_target_update_time. = |
| 3237 | Gametimecxx . . $ Gametime. + MIN_TARGET_UPDATE_INTERVALcxx . . $ `Descent3/AImain.cpp:1555:9`! + |
| 3238 | ((float)ps_randcxx . . $ ps_rand(b126dc7c1de90089).() / (float)D3_RAND_MAXcxx . . $ `misc/psrand.h:41:9`!) * (MAX_TARGET_UPDATE_INTERVALcxx . . $ `Descent3/AImain.cpp:1556:9`! - MIN_TARGET_UPDATE_INTERVALcxx . . $ `Descent3/AImain.cpp:1555:9`!); |
| 3239 | AISetTargetcxx . . $ AISetTarget(9985ed114f2bfc78).(obj, other_obj->handlecxx . . $ object#handle.); |
| 3240 | } |
| 3241 | } |
| 3242 | |
| 3243 | if (ai_info->notify_flagscxx . . $ ai_frame#notify_flags. & (0x00000001 << notify_type)) { |
| 3244 | ai_info->awarenesscxx . . $ ai_frame#awareness. = AWARE_FULLYcxx . . $ `Descent3/aistruct_external.h:323:9`!; |
| 3245 | AISeeTargetcxx . . $ AISeeTarget(674fac047436fc5b).(obj, false); |
| 3246 | } |
| 3247 | } |
| 3248 | |
| 3249 | if (ai_info->soundcxx . . $ ai_frame#sound.[AI_ANGRY_SOUNDcxx . . $ `Descent3/aistruct_external.h:387:9`!] != SOUND_NONE_INDEXcxx . . $ `Descent3/sounds.h:105:9`!) { |
| 3250 | // Plays the sound and makes absolute sure that it is not looping |
| 3251 | if (Gametimecxx . . $ Gametime. - ai_info->last_sound_timecxx . . $ ai_frame#last_sound_time.[AI_ANGRY_SOUNDcxx . . $ `Descent3/aistruct_external.h:387:9`!] > 5.0f) { |
| 3252 | Sound_systemcxx . . $ Sound_system..StopSoundLoopingcxx . . $ hlsSystem#StopSoundLooping(d4f767463ce0a6b3).( |
| 3253 | Sound_systemcxx . . $ Sound_system..Play3dSoundcxx . . $ hlsSystem#Play3dSound(17f485224ada8dd7).(ai_info->soundcxx . . $ ai_frame#sound.[AI_ANGRY_SOUNDcxx . . $ `Descent3/aistruct_external.h:387:9`!], SND_PRIORITY_NORMALcxx . . $ `sndlib/ssl_lib.h:284:9`!, obj)); |
| 3254 | if (Game_modecxx . . $ Game_mode. & GM_MULTIcxx . . $ `Descent3/game.h:288:9`!) |
| 3255 | MultiPlay3dSoundcxx . . $ MultiPlay3dSound(f056c30c88236a5f).(ai_info->soundcxx . . $ ai_frame#sound.[AI_ANGRY_SOUNDcxx . . $ `Descent3/aistruct_external.h:387:9`!], OBJNUMcxx . . $ `Descent3/object.h:700:9`!(obj), SND_PRIORITY_NORMALcxx . . $ `sndlib/ssl_lib.h:284:9`!); |
| 3256 | if (Demo_flagscxx . . $ Demo_flags. == DF_RECORDINGcxx . . $ `lib/demofile.h:122:9`!) |
| 3257 | DemoWrite3DSoundcxx . . $ DemoWrite3DSound(c29d531f7e56abb1).(ai_info->soundcxx . . $ ai_frame#sound.[AI_ANGRY_SOUNDcxx . . $ `Descent3/aistruct_external.h:387:9`!], OBJNUMcxx . . $ `Descent3/object.h:700:9`!(obj), SND_PRIORITY_NORMALcxx . . $ `sndlib/ssl_lib.h:284:9`!); |
| 3258 | ai_info->last_sound_timecxx . . $ ai_frame#last_sound_time.[AI_ANGRY_SOUNDcxx . . $ `Descent3/aistruct_external.h:387:9`!] = Gametimecxx . . $ Gametime.; |
| 3259 | } |
| 3260 | } |
| 3261 | break; |
| 3262 | case AIN_USER_DEFINEDcxx . . $ `Descent3/aistruct_external.h:301:9`!: |
| 3263 | //@$-evtargs.args[1] = MAKE_NUM_EVTARG((float)(*((int *)info))); |
| 3264 | ei.extra_infocxx . . $ tOSIRISEventInfo#extra_info. = info; |
| 3265 | break; |
| 3266 | default: |
| 3267 | mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "Warning, %d has been notified with an unhandled notification %d\n", OBJNUM(obj), notify_type); |
| 3268 | return true; |
| 3269 | } |
| 3270 | |
| 3271 | if (notify_type != AIN_OBJ_FIREDcxx . . $ `Descent3/aistruct_external.h:293:9`! && notify_type != AIN_HEAR_NOISEcxx . . $ `Descent3/aistruct_external.h:297:9`!) { |
| 3272 | //@$-return (D3XExecScript(obj, EVT_AI_NOTIFY, other_obj, REF_OBJTYPE, &evtargs)); |
| 3273 | if (!f_it_set) { |
| 3274 | ei.evt_ai_notifycxx . . $ tOSIRISEventInfo#$anonymous_type_1#evt_ai_notify..it_handlecxx . . $ tOSIRISEVTAINOTIFY#it_handle. = ((other_obj != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) ? other_obj->handlecxx . . $ object#handle. : OBJECT_HANDLE_NONEcxx . . $ `Descent3/object_external.h:156:9`!); |
| 3275 | } |
| 3276 | |
| 3277 | return Osiris_CallEventcxx . . $ Osiris_CallEvent(91e8d3045aa5549c).(obj, EVT_AI_NOTIFYcxx . . $ `scripts/osiris_common.h:371:9`!, &ei); |
| 3278 | } |
| 3279 | |
| 3280 | return true; |
| 3281 | } |
| 3282 | |
| 3283 | // Returns the amount of time left |
| 3284 | void ai_do_animationcxx . . $ ai_do_animation(4ebbd0c3cbf1b78a).(objectcxx . . $ object# *obj, float anim_time) { |
| 3285 | float *anim_frame = &obj->rtypecxx . . $ object#rtype..pobj_infocxx . . $ object#$anonymous_type_10#pobj_info..anim_framecxx . . $ polyobj_info#anim_frame.; |
| 3286 | |
| 3287 | float to; |
| 3288 | float from; |
| 3289 | float delta; |
| 3290 | float spc; |
| 3291 | bool f_looped; |
| 3292 | bool f_notify; |
| 3293 | int i; |
| 3294 | |
| 3295 | poly_modelcxx . . $ poly_model# *pm = &Poly_modelscxx . . $ Poly_models.[obj->rtypecxx . . $ object#rtype..pobj_infocxx . . $ object#$anonymous_type_10#pobj_info..model_numcxx . . $ polyobj_info#model_num.]; |
| 3296 | polyobj_infocxx . . $ polyobj_info# *p_info = &obj->rtypecxx . . $ object#rtype..pobj_infocxx . . $ object#$anonymous_type_10#pobj_info.; |
| 3297 | |
| 3298 | if (!(Object_infocxx . . $ Object_info.[obj->idcxx . . $ object#id.].animcxx . . $ object_info#anim.)) |
| 3299 | return; |
| 3300 | |
| 3301 | if ((Demo_flagscxx . . $ Demo_flags. == DF_PLAYBACKcxx . . $ `lib/demofile.h:123:9`!) || ((Game_modecxx . . $ Game_mode. & GM_MULTIcxx . . $ `Descent3/game.h:288:9`!) && (Netgamecxx . . $ Netgame..local_rolecxx . . $ netgame_info#local_role. == LR_CLIENTcxx . . $ `Descent3/multi_external.h:128:9`!))) { |
| 3302 | |
| 3303 | // Update animation keyframe |
| 3304 | if (p_info->multi_anim_infocxx . . $ polyobj_info#$anonymous_type_0#multi_anim_info..flagscxx . . $ custom_anim#flags. & FMA_VALIDcxx . . $ `Descent3/object.h:661:9`!) { |
| 3305 | if (!(p_info->multi_anim_infocxx . . $ polyobj_info#$anonymous_type_0#multi_anim_info..flagscxx . . $ custom_anim#flags. & FMA_CURRENTcxx . . $ `Descent3/object.h:662:9`!)) { |
| 3306 | AIUpdateAnimcxx . . $ AIUpdateAnim(419c470199a90a97).(obj); |
| 3307 | } |
| 3308 | } |
| 3309 | |
| 3310 | if (p_info->multi_turret_infocxx . . $ polyobj_info#multi_turret_info..flagscxx . . $ multi_turret#flags. & (FMT_UPDATINGcxx . . $ `Descent3/object.h:668:9`! | FMT_NEW_DATAcxx . . $ `Descent3/object.h:667:9`!)) { |
| 3311 | int count = 0; |
| 3312 | int i, j; |
| 3313 | if (p_info->multi_turret_infocxx . . $ polyobj_info#multi_turret_info..flagscxx . . $ multi_turret#flags. & FMT_NEW_DATAcxx . . $ `Descent3/object.h:667:9`!) { |
| 3314 | for (i = 0; i < pm->num_wbscxx . . $ poly_model#num_wbs.; i++) { |
| 3315 | for (j = 0; j < pm->poly_wbcxx . . $ poly_model#poly_wb.[i].num_turretscxx . . $ poly_wb_info#num_turrets.; j++) { |
| 3316 | p_info->multi_turret_infocxx . . $ polyobj_info#multi_turret_info..last_timecxx . . $ multi_turret#last_time. = Gametimecxx . . $ Gametime.; |
| 3317 | p_info->multi_turret_infocxx . . $ polyobj_info#multi_turret_info..last_keyframescxx . . $ multi_turret#last_keyframes.[count++] = obj->dynamic_wbcxx . . $ object#dynamic_wb.[i].norm_turret_anglecxx . . $ dynamic_wb_info#norm_turret_angle.[j]; |
| 3318 | } |
| 3319 | } |
| 3320 | |
| 3321 | p_info->multi_turret_infocxx . . $ polyobj_info#multi_turret_info..flagscxx . . $ multi_turret#flags. = FMT_UPDATINGcxx . . $ `Descent3/object.h:668:9`!; |
| 3322 | } |
| 3323 | |
| 3324 | count = 0; |
| 3325 | |
| 3326 | if ((Demo_flagscxx . . $ Demo_flags. == DF_PLAYBACKcxx . . $ `lib/demofile.h:123:9`!) || |
| 3327 | ((p_info->multi_turret_infocxx . . $ polyobj_info#multi_turret_info..last_timecxx . . $ multi_turret#last_time. + 1.0 / (float)NetPlayerscxx . . $ NetPlayers.[Player_numcxx . . $ Player_num.].ppscxx . . $ netplayer#pps.) >= Gametimecxx . . $ Gametime.)) { |
| 3328 | for (i = 0; i < pm->num_wbscxx . . $ poly_model#num_wbs.; i++) { |
| 3329 | for (j = 0; j < pm->poly_wbcxx . . $ poly_model#poly_wb.[i].num_turretscxx . . $ poly_wb_info#num_turrets.; j++) { |
| 3330 | obj->dynamic_wbcxx . . $ object#dynamic_wb.[i].norm_turret_anglecxx . . $ dynamic_wb_info#norm_turret_angle.[j] = p_info->multi_turret_infocxx . . $ polyobj_info#multi_turret_info..keyframescxx . . $ multi_turret#keyframes.[count++]; |
| 3331 | } |
| 3332 | } |
| 3333 | |
| 3334 | p_info->multi_turret_infocxx . . $ polyobj_info#multi_turret_info..flagscxx . . $ multi_turret#flags. = 0; |
| 3335 | } else { |
| 3336 | for (i = 0; i < pm->num_wbscxx . . $ poly_model#num_wbs.; i++) { |
| 3337 | for (j = 0; j < pm->poly_wbcxx . . $ poly_model#poly_wb.[i].num_turretscxx . . $ poly_wb_info#num_turrets.; j++) { |
| 3338 | float pd = (Gametimecxx . . $ Gametime. - p_info->multi_turret_infocxx . . $ polyobj_info#multi_turret_info..last_timecxx . . $ multi_turret#last_time.) / NetPlayerscxx . . $ NetPlayers.[Player_numcxx . . $ Player_num.].ppscxx . . $ netplayer#pps.; |
| 3339 | float diff; |
| 3340 | |
| 3341 | diff = p_info->multi_turret_infocxx . . $ polyobj_info#multi_turret_info..keyframescxx . . $ multi_turret#keyframes.[count] - p_info->multi_turret_infocxx . . $ polyobj_info#multi_turret_info..last_keyframescxx . . $ multi_turret#last_keyframes.[count]; |
| 3342 | |
| 3343 | if (fabsf(diff) < 0.5f) { |
| 3344 | obj->dynamic_wbcxx . . $ object#dynamic_wb.[i].norm_turret_anglecxx . . $ dynamic_wb_info#norm_turret_angle.[j] = (1.0 - pd) * p_info->multi_turret_infocxx . . $ polyobj_info#multi_turret_info..last_keyframescxx . . $ multi_turret#last_keyframes.[count] + |
| 3345 | pd * p_info->multi_turret_infocxx . . $ polyobj_info#multi_turret_info..keyframescxx . . $ multi_turret#keyframes.[count]; |
| 3346 | } else { |
| 3347 | diff = -(1.0f - diff) * pd; |
| 3348 | obj->dynamic_wbcxx . . $ object#dynamic_wb.[i].norm_turret_anglecxx . . $ dynamic_wb_info#norm_turret_angle.[j] = p_info->multi_turret_infocxx . . $ polyobj_info#multi_turret_info..last_keyframescxx . . $ multi_turret#last_keyframes.[count] + diff; |
| 3349 | |
| 3350 | if (obj->dynamic_wbcxx . . $ object#dynamic_wb.[i].norm_turret_anglecxx . . $ dynamic_wb_info#norm_turret_angle.[j] < 0.0) |
| 3351 | obj->dynamic_wbcxx . . $ object#dynamic_wb.[i].norm_turret_anglecxx . . $ dynamic_wb_info#norm_turret_angle.[j] += 1.0f; |
| 3352 | else if (obj->dynamic_wbcxx . . $ object#dynamic_wb.[i].norm_turret_anglecxx . . $ dynamic_wb_info#norm_turret_angle.[j] > 1.0) |
| 3353 | obj->dynamic_wbcxx . . $ object#dynamic_wb.[i].norm_turret_anglecxx . . $ dynamic_wb_info#norm_turret_angle.[j] -= 1.0f; |
| 3354 | } |
| 3355 | |
| 3356 | count++; |
| 3357 | } |
| 3358 | } |
| 3359 | } |
| 3360 | } |
| 3361 | } else { |
| 3362 | if (obj->ai_infocxx . . $ object#ai_info.->animation_typecxx . . $ ai_frame#animation_type. == AS_RANGED_ATTACKcxx . . $ `Descent3/aistruct_external.h:442:9`!) { |
| 3363 | char wb = obj->ai_infocxx . . $ object#ai_info.->last_special_wb_firingcxx . . $ ai_frame#last_special_wb_firing.; |
| 3364 | |
| 3365 | if (Object_infocxx . . $ Object_info.[obj->idcxx . . $ object#id.].static_wbcxx . . $ object_info#static_wb.[wb].flagscxx . . $ otype_wb_info#flags. & WBF_SPRAYcxx . . $ `lib/robotfirestruct_external.h:27:9`!) { |
| 3366 | obj->weapon_fire_flagscxx . . $ object#weapon_fire_flags. |= WFF_SPRAYcxx . . $ `Descent3/player_external.h:103:9`!; |
| 3367 | } |
| 3368 | |
| 3369 | if (Object_infocxx . . $ Object_info.[obj->idcxx . . $ object#id.].static_wbcxx . . $ object_info#static_wb.[wb].flagscxx . . $ otype_wb_info#flags. & WBF_ON_OFFcxx . . $ `lib/robotfirestruct_external.h:34:9`!) { |
| 3370 | obj->weapon_fire_flagscxx . . $ object#weapon_fire_flags. |= WFF_ON_OFFcxx . . $ `Descent3/player_external.h:104:9`!; |
| 3371 | } |
| 3372 | if (Demo_flagscxx . . $ Demo_flags. == DF_RECORDINGcxx . . $ `lib/demofile.h:122:9`!) { |
| 3373 | DemoWriteObjWeapFireFlagChangedcxx . . $ DemoWriteObjWeapFireFlagChanged(68e3ae50fe6578a9).(OBJNUMcxx . . $ `Descent3/object.h:700:9`!(obj)); |
| 3374 | } |
| 3375 | } |
| 3376 | } |
| 3377 | |
| 3378 | for (i = 0; i < pm->num_wbscxx . . $ poly_model#num_wbs.; i++) { |
| 3379 | if (obj->dynamic_wbcxx . . $ object#dynamic_wb.[i].flagscxx . . $ dynamic_wb_info#flags. & DWBF_ANIMATINGcxx . . $ `lib/robotfirestruct_external.h:45:9`!) { |
| 3380 | object_infocxx . . $ object_info# *obj_info = &Object_infocxx . . $ Object_info.[obj->idcxx . . $ object#id.]; |
| 3381 | if (obj_info->static_wbcxx . . $ object_info#static_wb.) |
| 3382 | WBFireAnimFramecxx . . $ WBFireAnimFrame(cccf09a4825b46a4).(obj, &obj_info->static_wbcxx . . $ object_info#static_wb.[i], i); |
| 3383 | } |
| 3384 | } |
| 3385 | |
| 3386 | start_loop: |
| 3387 | |
| 3388 | from = obj->rtypecxx . . $ object#rtype..pobj_infocxx . . $ object#$anonymous_type_10#pobj_info..anim_start_framecxx . . $ polyobj_info#anim_start_frame.; |
| 3389 | to = obj->rtypecxx . . $ object#rtype..pobj_infocxx . . $ object#$anonymous_type_10#pobj_info..anim_end_framecxx . . $ polyobj_info#anim_end_frame.; |
| 3390 | spc = obj->rtypecxx . . $ object#rtype..pobj_infocxx . . $ object#$anonymous_type_10#pobj_info..anim_timecxx . . $ polyobj_info#anim_time.; |
| 3391 | |
| 3392 | if (obj->movement_typecxx . . $ object#movement_type. == MT_WALKINGcxx . . $ `Descent3/object_external.h:235:9`! && obj->ai_infocxx . . $ object#ai_info.->movement_typecxx . . $ ai_frame#movement_type. == MC_WALKINGcxx . . $ `Descent3/object_external.h:248:9`!) { |
| 3393 | if (obj->ai_infocxx . . $ object#ai_info.->animation_typecxx . . $ ai_frame#animation_type. == AS_ALERTcxx . . $ `Descent3/aistruct_external.h:409:9`! || obj->ai_infocxx . . $ object#ai_info.->animation_typecxx . . $ ai_frame#animation_type. == AS_IDLEcxx . . $ `Descent3/aistruct_external.h:419:9`!) { |
| 3394 | float scaler; |
| 3395 | |
| 3396 | float speed = vm_GetMagnitudecxx . . $ vm_GetMagnitude(4939a7e530383cd4).(&obj->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..velocitycxx . . $ physics_info#velocity.); |
| 3397 | scaler = speed / obj->ai_infocxx . . $ object#ai_info.->max_velocitycxx . . $ ai_frame#max_velocity.; |
| 3398 | |
| 3399 | // If slow, use some rotational vel |
| 3400 | if (scaler < .7f) { |
| 3401 | float speed = vm_GetMagnitudecxx . . $ vm_GetMagnitude(4939a7e530383cd4).(&obj->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..rotvelcxx . . $ physics_info#$anonymous_type_1#rotvel.); |
| 3402 | scaler += speed / 40000.0f; |
| 3403 | |
| 3404 | if (scaler > 1.0f) |
| 3405 | scaler = 1.0f; |
| 3406 | } |
| 3407 | |
| 3408 | if ((obj->ai_infocxx . . $ object#ai_info.->next_animation_typecxx . . $ ai_frame#next_animation_type. == AS_GOTO_ALERT_STANDINGcxx . . $ `Descent3/aistruct_external.h:428:9`! || |
| 3409 | obj->ai_infocxx . . $ object#ai_info.->next_animation_typecxx . . $ ai_frame#next_animation_type. == AS_GOTO_IDLE_STANDINGcxx . . $ `Descent3/aistruct_external.h:423:9`!) && |
| 3410 | scaler < .15f) { |
| 3411 | scaler = .15f; |
| 3412 | } |
| 3413 | |
| 3414 | if (scaler <= 0.0f) { |
| 3415 | return; |
| 3416 | } |
| 3417 | |
| 3418 | spc /= scaler; |
| 3419 | } |
| 3420 | } |
| 3421 | // mprintf(0, "AI ANIM %d %d\n", from, to); |
| 3422 | |
| 3423 | f_looped = (obj->rtypecxx . . $ object#rtype..pobj_infocxx . . $ object#$anonymous_type_10#pobj_info..anim_flagscxx . . $ polyobj_info#anim_flags. & AIAF_LOOPINGcxx . . $ `Descent3/aistruct_external.h:115:9`!) != 0; |
| 3424 | f_notify = (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`!) != 0; |
| 3425 | |
| 3426 | if (!f_looped && *anim_frame == to) { |
| 3427 | goto done; |
| 3428 | } |
| 3429 | |
| 3430 | if (to == from) { |
| 3431 | anim_time = 0.0f; |
| 3432 | goto done; |
| 3433 | } |
| 3434 | |
| 3435 | if (spc <= 0) { |
| 3436 | *anim_frame = to; |
| 3437 | goto done; |
| 3438 | } |
| 3439 | |
| 3440 | ASSERTcxx . . $ `misc/pserror.h:246:9`!(from <= to); |
| 3441 | |
| 3442 | if (*anim_frame < from || *anim_frame > to) { |
| 3443 | mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "AI/Animation: Correcting for an incorrect frame number\n"); |
| 3444 | *anim_frame = from; |
| 3445 | } |
| 3446 | |
| 3447 | delta = to - from; |
| 3448 | |
| 3449 | ASSERTcxx . . $ `misc/pserror.h:246:9`!(delta >= 0.0f); |
| 3450 | ASSERTcxx . . $ `misc/pserror.h:246:9`!(spc > 0.0f); |
| 3451 | |
| 3452 | if (delta > 0.0f) { |
| 3453 | // step is how much we move this frame |
| 3454 | float max_step = anim_time * ((delta) / spc); |
| 3455 | |
| 3456 | if (*anim_frame + max_step >= to) { |
| 3457 | anim_time -= anim_time * (to - *anim_frame) / max_step; |
| 3458 | |
| 3459 | if (f_looped) |
| 3460 | *anim_frame = from; |
| 3461 | else |
| 3462 | *anim_frame = to; |
| 3463 | |
| 3464 | if (f_notify) { |
| 3465 | // mprintf(0, "Animation ended\n"); |
| 3466 | AINotifycxx . . $ AINotify(f32b5964aaa42c22).(obj, AIN_ANIM_COMPLETEcxx . . $ `Descent3/aistruct_external.h:306:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!); |
| 3467 | } |
| 3468 | |
| 3469 | goto start_loop; |
| 3470 | } else { |
| 3471 | *anim_frame += max_step; |
| 3472 | } |
| 3473 | } else { |
| 3474 | obj->rtypecxx . . $ object#rtype..pobj_infocxx . . $ object#$anonymous_type_10#pobj_info..anim_framecxx . . $ polyobj_info#anim_frame. = from; |
| 3475 | } |
| 3476 | |
| 3477 | if (obj->rtypecxx . . $ object#rtype..pobj_infocxx . . $ object#$anonymous_type_10#pobj_info..anim_framecxx . . $ polyobj_info#anim_frame. + 0.001 < from || obj->rtypecxx . . $ object#rtype..pobj_infocxx . . $ object#$anonymous_type_10#pobj_info..anim_framecxx . . $ polyobj_info#anim_frame. > to) { |
| 3478 | mprintfcxx . . $ `ddebug/mono.h:82:9`!(2, "AI ANIM from %0.6f (%0.6f) to %0.6f\n", from, obj->rtype.pobj_info.anim_frame, to); |
| 3479 | } |
| 3480 | if (obj->rtypecxx . . $ object#rtype..pobj_infocxx . . $ object#$anonymous_type_10#pobj_info..anim_framecxx . . $ polyobj_info#anim_frame. < from) { |
| 3481 | obj->rtypecxx . . $ object#rtype..pobj_infocxx . . $ object#$anonymous_type_10#pobj_info..anim_framecxx . . $ polyobj_info#anim_frame. = from; |
| 3482 | } |
| 3483 | if (obj->rtypecxx . . $ object#rtype..pobj_infocxx . . $ object#$anonymous_type_10#pobj_info..anim_framecxx . . $ polyobj_info#anim_frame. > to) { |
| 3484 | obj->rtypecxx . . $ object#rtype..pobj_infocxx . . $ object#$anonymous_type_10#pobj_info..anim_framecxx . . $ polyobj_info#anim_frame. = to; |
| 3485 | } |
| 3486 | |
| 3487 | return; |
| 3488 | |
| 3489 | done: |
| 3490 | |
| 3491 | if (f_notify) { |
| 3492 | AINotifycxx . . $ AINotify(f32b5964aaa42c22).(obj, AIN_ANIM_COMPLETEcxx . . $ `Descent3/aistruct_external.h:306:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!); |
| 3493 | } |
| 3494 | |
| 3495 | return; |
| 3496 | } |
| 3497 | |
| 3498 | #define FRR_MAX_TRIEScxx . . $ `Descent3/AImain.cpp:3498:9`! 15 |
| 3499 | |
| 3500 | // MTS: Unused? |
| 3501 | int AIGoalGotoRandomRoomcxx . . $ AIGoalGotoRandomRoom(b126dc7c1de90089).() { return -1; } |
| 3502 | |
| 3503 | int AIFindRandomRoomcxx . . $ AIFindRandomRoom(faebaf28fe240c5f).(objectcxx . . $ object# *obj, ai_framecxx . . $ ai_frame# *ai_info, goalcxx . . $ goal# *goal_ptr, int avoid_room, int min_depth, int max_depth, |
| 3504 | bool f_check_path, bool f_cur_room_ok, int *depth) { |
| 3505 | int random_room = obj->roomnumcxx . . $ object#roomnum.; |
| 3506 | int n_tries = 0; |
| 3507 | bool valid = false; |
| 3508 | bool f_use_depth = false; |
| 3509 | int cur_depth; |
| 3510 | int cur_room = obj->roomnumcxx . . $ object#roomnum.; |
| 3511 | int mine_rooms[MAX_ROOMScxx . . $ `Descent3/room.h:377:9`!]; |
| 3512 | int num_mine_rooms = 0; |
| 3513 | int cur_mine = MINE_INDEXcxx . . $ `Descent3/room.h:414:9`!(obj->roomnum); |
| 3514 | int i; |
| 3515 | |
| 3516 | for (i = 0; i <= Highest_room_indexcxx . . $ Highest_room_index.; i++) { |
| 3517 | if (Roomscxx . . $ Rooms.[i].usedcxx . . $ room#used. && !(Roomscxx . . $ Rooms.[i].flagscxx . . $ room#flags. & RF_EXTERNALcxx . . $ `Descent3/room_external.h:177:9`!) && cur_mine == MINE_INDEXcxx . . $ `Descent3/room.h:414:9`!(i)) { |
| 3518 | mine_rooms[num_mine_rooms++] = i; |
| 3519 | ASSERTcxx . . $ `misc/pserror.h:246:9`!(Rooms[mine_rooms[num_mine_rooms - 1]].used); |
| 3520 | } |
| 3521 | } |
| 3522 | |
| 3523 | if (max_depth >= 0 && min_depth >= 0) { |
| 3524 | f_use_depth = true; |
| 3525 | cur_depth = min_depth + (float)ps_randcxx . . $ ps_rand(b126dc7c1de90089).() / (float)D3_RAND_MAXcxx . . $ `misc/psrand.h:41:9`! * (max_depth - min_depth); |
| 3526 | } |
| 3527 | |
| 3528 | do { |
| 3529 | random_room = mine_rooms[ps_randcxx . . $ ps_rand(b126dc7c1de90089).() % num_mine_rooms]; |
| 3530 | valid = true; |
| 3531 | |
| 3532 | if (random_room == avoid_room || ((!f_cur_room_ok) && (random_room == obj->roomnumcxx . . $ object#roomnum.)) || (!Roomscxx . . $ Rooms.[random_room].usedcxx . . $ room#used.)) |
| 3533 | valid = false; |
| 3534 | |
| 3535 | if (valid && f_check_path) { |
| 3536 | ASSERTcxx . . $ `misc/pserror.h:246:9`!(Rooms[random_room].used); |
| 3537 | ASSERTcxx . . $ `misc/pserror.h:246:9`!(Rooms[obj->roomnum].used); |
| 3538 | valid = AIPathAllocPathcxx . . $ AIPathAllocPath(896bfa3f698eea41).(obj, ai_info, goal_ptr, &obj->roomnumcxx . . $ object#roomnum., &obj->poscxx . . $ object#pos., &random_room, |
| 3539 | &Roomscxx . . $ Rooms.[random_room].path_pntcxx . . $ room#path_pnt., 0.0f, 0, obj->handlecxx . . $ object#handle.); |
| 3540 | } |
| 3541 | |
| 3542 | n_tries++; |
| 3543 | } while (!valid && n_tries <= FRR_MAX_TRIEScxx . . $ `Descent3/AImain.cpp:3498:9`! && num_mine_rooms > 1); |
| 3544 | |
| 3545 | if (valid && f_use_depth) { |
| 3546 | while (cur_room != random_room && cur_depth > 0) { |
| 3547 | cur_room = BOA_NEXT_ROOMcxx . . $ `Descent3/BOA.h:200:9`!(cur_room, random_room); |
| 3548 | cur_depth--; |
| 3549 | } |
| 3550 | |
| 3551 | random_room = cur_room; |
| 3552 | } |
| 3553 | |
| 3554 | if (!valid) { |
| 3555 | int next_rooms[100]; |
| 3556 | int i; |
| 3557 | int pick_list[100]; |
| 3558 | int num_pickable = 0; |
| 3559 | |
| 3560 | int num_next_rooms = AIMakeNextRoomListcxx . . $ AIMakeNextRoomList(1df93256b606fe1f).(obj->roomnumcxx . . $ object#roomnum., next_rooms, 100); |
| 3561 | for (i = 0; i < num_next_rooms; i++) { |
| 3562 | if (next_rooms[i] <= Highest_room_indexcxx . . $ Highest_room_index. && |
| 3563 | BOA_DetermineStartRoomPortalcxx . . $ BOA_DetermineStartRoomPortal(836cef11f1e7b2ee).(obj->roomnumcxx . . $ object#roomnum., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, next_rooms[i], NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) >= 0) { |
| 3564 | pick_list[num_pickable++] = next_rooms[i]; |
| 3565 | } |
| 3566 | } |
| 3567 | |
| 3568 | if (num_pickable) { |
| 3569 | random_room = pick_list[ps_randcxx . . $ ps_rand(b126dc7c1de90089).() % num_pickable]; |
| 3570 | valid = true; |
| 3571 | } |
| 3572 | |
| 3573 | if (!valid) { |
| 3574 | mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "AI: Wander is generating the same room :(\n"); |
| 3575 | random_room = obj->roomnumcxx . . $ object#roomnum.; |
| 3576 | } |
| 3577 | } |
| 3578 | |
| 3579 | ASSERTcxx . . $ `misc/pserror.h:246:9`!(random_room >= 0 || random_room <= Highest_room_index + BOA_num_terrain_regions); |
| 3580 | if (random_room > Highest_room_indexcxx . . $ Highest_room_index.) { |
| 3581 | // This is a temporary chrishack -- we need to select a random cell in the region |
| 3582 | random_room = ps_randcxx . . $ ps_rand(b126dc7c1de90089).() % (TERRAIN_WIDTHcxx . . $ `Descent3/terrain.h:31:9`! * TERRAIN_DEPTHcxx . . $ `Descent3/terrain.h:32:9`!); |
| 3583 | random_room |= 0x80000000; |
| 3584 | } |
| 3585 | |
| 3586 | return random_room; |
| 3587 | } |
| 3588 | |
| 3589 | // +/- 8% fluctuation in speed parameters |
| 3590 | #define MAX_FLUCTUATION_PERCENTcxx . . $ `Descent3/AImain.cpp:3590:9`! 0.08f |
| 3591 | |
| 3592 | void AIDestroyObjcxx . . $ AIDestroyObj(419c470199a90a97).(objectcxx . . $ object# *obj) { |
| 3593 | ai_framecxx . . $ ai_frame# *ai_info = obj->ai_infocxx . . $ object#ai_info.; |
| 3594 | |
| 3595 | #ifdef _DEBUGcxx . . $ `<built-in>:482:9`! |
| 3596 | if (AI_debug_robot_docxx . . $ AI_debug_robot_do. && OBJNUMcxx . . $ `Descent3/object.h:700:9`!(obj) == AI_debug_robot_indexcxx . . $ AI_debug_robot_index.) { |
| 3597 | mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "AI Note: In free path\n"); |
| 3598 | } |
| 3599 | #endif |
| 3600 | AIPathFreePathcxx . . $ AIPathFreePath(211cadd9cc3984f1).(&ai_info->pathcxx . . $ ai_frame#path.); |
| 3601 | } |
| 3602 | |
| 3603 | // Copies AI settings from the object info struct to the object struct |
| 3604 | void ObjSetAIInfocxx . . $ ObjSetAIInfo(419c470199a90a97).(objectcxx . . $ object# *objp) { |
| 3605 | int i; |
| 3606 | |
| 3607 | ai_framecxx . . $ ai_frame# *dest = objp->ai_infocxx . . $ object#ai_info.; |
| 3608 | ASSERTcxx . . $ `misc/pserror.h:246:9`!(dest != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!); |
| 3609 | if (!(Object_infocxx . . $ Object_info.[objp->idcxx . . $ object#id.].ai_infocxx . . $ object_info#ai_info.)) |
| 3610 | return; |
| 3611 | |
| 3612 | t_ai_infocxx . . $ t_ai_info# *src = Object_infocxx . . $ Object_info.[objp->idcxx . . $ object#id.].ai_infocxx . . $ object_info#ai_info.; |
| 3613 | |
| 3614 | dest->ai_classcxx . . $ ai_frame#ai_class. = src->ai_classcxx . . $ t_ai_info#ai_class.; |
| 3615 | dest->ai_typecxx . . $ ai_frame#ai_type. = src->ai_typecxx . . $ t_ai_info#ai_type.; |
| 3616 | |
| 3617 | dest->max_velocitycxx . . $ ai_frame#max_velocity. = src->max_velocitycxx . . $ t_ai_info#max_velocity.; |
| 3618 | dest->max_delta_velocitycxx . . $ ai_frame#max_delta_velocity. = src->max_delta_velocitycxx . . $ t_ai_info#max_delta_velocity.; |
| 3619 | dest->max_turn_ratecxx . . $ ai_frame#max_turn_rate. = src->max_turn_ratecxx . . $ t_ai_info#max_turn_rate.; |
| 3620 | dest->max_delta_turn_ratecxx . . $ ai_frame#max_delta_turn_rate. = src->max_delta_turn_ratecxx . . $ t_ai_info#max_delta_turn_rate.; |
| 3621 | |
| 3622 | dest->attack_vel_percentcxx . . $ ai_frame#attack_vel_percent. = src->attack_vel_percentcxx . . $ t_ai_info#attack_vel_percent.; |
| 3623 | dest->flee_vel_percentcxx . . $ ai_frame#flee_vel_percent. = src->flee_vel_percentcxx . . $ t_ai_info#flee_vel_percent.; |
| 3624 | dest->dodge_vel_percentcxx . . $ ai_frame#dodge_vel_percent. = src->dodge_vel_percentcxx . . $ t_ai_info#dodge_vel_percent.; |
| 3625 | |
| 3626 | dest->circle_distancecxx . . $ ai_frame#circle_distance. = src->circle_distancecxx . . $ t_ai_info#circle_distance.; |
| 3627 | dest->dodge_percentcxx . . $ ai_frame#dodge_percent. = src->dodge_percentcxx . . $ t_ai_info#dodge_percent.; |
| 3628 | |
| 3629 | // Note: Chris is evil. There should be a symbolic to describe the size of these arrays |
| 3630 | for (i = 0; i < 2; i++) { |
| 3631 | dest->melee_damagecxx . . $ ai_frame#melee_damage.[i] = src->melee_damagecxx . . $ t_ai_info#melee_damage.[i]; |
| 3632 | dest->melee_latencycxx . . $ ai_frame#melee_latency.[i] = src->melee_latencycxx . . $ t_ai_info#melee_latency.[i]; |
| 3633 | } |
| 3634 | |
| 3635 | for (i = 0; i < MAX_AI_SOUNDScxx . . $ `Descent3/aistruct.h:712:9`!; i++) |
| 3636 | dest->soundcxx . . $ ai_frame#sound.[i] = src->soundcxx . . $ t_ai_info#sound.[i]; |
| 3637 | |
| 3638 | dest->movement_typecxx . . $ ai_frame#movement_type. = src->movement_typecxx . . $ t_ai_info#movement_type.; |
| 3639 | dest->movement_subtypecxx . . $ ai_frame#movement_subtype. = src->movement_subtypecxx . . $ t_ai_info#movement_subtype.; |
| 3640 | |
| 3641 | dest->flagscxx . . $ ai_frame#flags. = src->flagscxx . . $ t_ai_info#flags.; |
| 3642 | dest->notify_flagscxx . . $ ai_frame#notify_flags. = src->notify_flagscxx . . $ t_ai_info#notify_flags.; |
| 3643 | |
| 3644 | dest->fovcxx . . $ ai_frame#fov. = src->fovcxx . . $ t_ai_info#fov.; |
| 3645 | |
| 3646 | dest->avoid_friends_distancecxx . . $ ai_frame#avoid_friends_distance. = src->avoid_friends_distancecxx . . $ t_ai_info#avoid_friends_distance.; |
| 3647 | |
| 3648 | dest->frustrationcxx . . $ ai_frame#frustration. = src->frustrationcxx . . $ t_ai_info#frustration.; |
| 3649 | dest->curiousitycxx . . $ ai_frame#curiousity. = src->curiousitycxx . . $ t_ai_info#curiousity.; |
| 3650 | dest->life_preservationcxx . . $ ai_frame#life_preservation. = src->life_preservationcxx . . $ t_ai_info#life_preservation.; |
| 3651 | dest->agressioncxx . . $ ai_frame#agression. = src->agressioncxx . . $ t_ai_info#agression.; |
| 3652 | |
| 3653 | dest->fire_spreadcxx . . $ ai_frame#fire_spread. = src->fire_spreadcxx . . $ t_ai_info#fire_spread.; |
| 3654 | dest->night_visioncxx . . $ ai_frame#night_vision. = src->night_visioncxx . . $ t_ai_info#night_vision.; |
| 3655 | dest->fog_visioncxx . . $ ai_frame#fog_vision. = src->fog_visioncxx . . $ t_ai_info#fog_vision.; |
| 3656 | dest->lead_accuracycxx . . $ ai_frame#lead_accuracy. = src->lead_accuracycxx . . $ t_ai_info#lead_accuracy.; |
| 3657 | dest->lead_variencecxx . . $ ai_frame#lead_varience. = src->lead_variencecxx . . $ t_ai_info#lead_varience.; |
| 3658 | dest->fight_teamcxx . . $ ai_frame#fight_team. = src->fight_teamcxx . . $ t_ai_info#fight_team.; |
| 3659 | dest->fight_samecxx . . $ ai_frame#fight_same. = src->fight_samecxx . . $ t_ai_info#fight_same.; |
| 3660 | dest->hearingcxx . . $ ai_frame#hearing. = src->hearingcxx . . $ t_ai_info#hearing.; |
| 3661 | dest->roamingcxx . . $ ai_frame#roaming. = src->roamingcxx . . $ t_ai_info#roaming.; |
| 3662 | dest->biased_flight_importancecxx . . $ ai_frame#biased_flight_importance. = src->biased_flight_importancecxx . . $ t_ai_info#biased_flight_importance.; |
| 3663 | dest->biased_flight_mincxx . . $ ai_frame#biased_flight_min. = src->biased_flight_mincxx . . $ t_ai_info#biased_flight_min.; |
| 3664 | dest->biased_flight_maxcxx . . $ ai_frame#biased_flight_max. = src->biased_flight_maxcxx . . $ t_ai_info#biased_flight_max.; |
| 3665 | } |
| 3666 | |
| 3667 | bool AIInitcxx . . $ AIInit(cc53779520928514).(objectcxx . . $ object# *obj, uint8_tcxx . . $ uint8_t# ai_class, uint8_tcxx . . $ uint8_t# ai_type, uint8_tcxx . . $ uint8_t# ai_movement) { |
| 3668 | ai_framecxx . . $ ai_frame# *ai_info = obj->ai_infocxx . . $ object#ai_info.; |
| 3669 | ASSERTcxx . . $ `misc/pserror.h:246:9`!(ai_info); |
| 3670 | ASSERTcxx . . $ `misc/pserror.h:246:9`!(obj->control_type == CT_AIcxx . . $ `Descent3/object_external.h:217:9`! && obj->type != OBJ_NONEcxx . . $ `Descent3/object_external.h:159:9`!); |
| 3671 | |
| 3672 | // Get AI data from the object type info |
| 3673 | ASSERTcxx . . $ `misc/pserror.h:246:9`!(IS_GENERICcxx . . $ `Descent3/object_external.h:190:9`!(obj->type)); |
| 3674 | ObjSetAIInfocxx . . $ ObjSetAIInfo(419c470199a90a97).(obj); |
| 3675 | |
| 3676 | polyobj_infocxx . . $ polyobj_info# *p_info = &obj->rtypecxx . . $ object#rtype..pobj_infocxx . . $ object#$anonymous_type_10#pobj_info.; |
| 3677 | ai_path_infocxx . . $ ai_path_info# *path = &ai_info->pathcxx . . $ ai_frame#path.; |
| 3678 | int i; |
| 3679 | int anim; |
| 3680 | |
| 3681 | AIPathInitPathcxx . . $ AIPathInitPath(211cadd9cc3984f1).(path); |
| 3682 | |
| 3683 | bool f_no_scale = (IS_GENERICcxx . . $ `Descent3/object_external.h:190:9`!(obj->type) && (Object_infocxx . . $ Object_info.[obj->idcxx . . $ object#id.].flagscxx . . $ object_info#flags. & OIF_NO_DIFF_SCALE_MOVEcxx . . $ `Descent3/objinfo.h:345:9`!)) || |
| 3684 | ((ai_info->flagscxx . . $ ai_frame#flags. & AIF_TEAM_MASKcxx . . $ `Descent3/aistruct_external.h:364:9`!) == AIF_TEAM_REBELcxx . . $ `Descent3/aistruct_external.h:366:9`!); |
| 3685 | |
| 3686 | ai_info->mem_time_till_next_updatecxx . . $ ai_frame#mem_time_till_next_update. = 3.0f + (float)ps_randcxx . . $ ps_rand(b126dc7c1de90089).() / (float)D3_RAND_MAXcxx . . $ `misc/psrand.h:41:9`! * 2.0f; |
| 3687 | memset(ai_info->memorycxx . . $ ai_frame#memory., 0, sizeof(ai_memcxx . . $ ai_mem#) * AI_MEM_DEPTHcxx . . $ `Descent3/aistruct.h:714:9`!); |
| 3688 | for (i = 0; i < AI_MEM_DEPTHcxx . . $ `Descent3/aistruct.h:714:9`!; i++) { |
| 3689 | ai_info->memorycxx . . $ ai_frame#memory.[0].shieldscxx . . $ ai_mem#shields. = obj->shieldscxx . . $ object#shields.; |
| 3690 | } |
| 3691 | |
| 3692 | // In case there is none |
| 3693 | obj->rtypecxx . . $ object#rtype..pobj_infocxx . . $ object#$anonymous_type_10#pobj_info..anim_framecxx . . $ polyobj_info#anim_frame. = 0.0; |
| 3694 | |
| 3695 | ai_info->ai_classcxx . . $ ai_frame#ai_class. = ai_class; |
| 3696 | ai_info->ai_typecxx . . $ ai_frame#ai_type. = ai_type; |
| 3697 | ai_info->movement_typecxx . . $ ai_frame#movement_type. = ai_movement; |
| 3698 | ai_info->next_movementcxx . . $ ai_frame#next_movement. = AI_INVALID_INDEXcxx . . $ `Descent3/aistruct.h:404:9`!; |
| 3699 | ai_info->anim_sound_handlecxx . . $ ai_frame#anim_sound_handle. = 0; |
| 3700 | ai_info->status_regcxx . . $ ai_frame#status_reg. = 0; |
| 3701 | ai_info->last_played_sound_indexcxx . . $ ai_frame#last_played_sound_index. = -1; |
| 3702 | ai_info->weapon_speedcxx . . $ ai_frame#weapon_speed. = 0.0f; |
| 3703 | |
| 3704 | ai_info->vec_to_target_perceivedcxx . . $ ai_frame#vec_to_target_perceived. =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). obj->orientcxx . . $ object#orient..fveccxx . . $ matrix#fvec.; |
| 3705 | |
| 3706 | ai_info->last_dodge_dircxx . . $ ai_frame#last_dodge_dir. =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). Zero_vectorcxx . . $ Zero_vector.; |
| 3707 | ai_info->dodge_till_timecxx . . $ ai_frame#dodge_till_time. = Gametimecxx . . $ Gametime. - 1.0f; |
| 3708 | |
| 3709 | if (ObjGetcxx . . $ ObjGet(11672e354c0b263a).(obj->parent_handlecxx . . $ object#parent_handle.)) { |
| 3710 | objectcxx . . $ object# *parent = ObjGetcxx . . $ ObjGet(11672e354c0b263a).(obj->parent_handlecxx . . $ object#parent_handle.); |
| 3711 | |
| 3712 | if (parent && (parent->typecxx . . $ object#type. == OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`! || parent->typecxx . . $ object#type. == OBJ_GHOSTcxx . . $ `Descent3/object_external.h:172:9`!)) { |
| 3713 | obj->ai_infocxx . . $ object#ai_info.->flagscxx . . $ ai_frame#flags. &= ~AIF_TEAM_MASKcxx . . $ `Descent3/aistruct_external.h:364:9`!; |
| 3714 | obj->ai_infocxx . . $ object#ai_info.->flagscxx . . $ ai_frame#flags. |= AIF_TEAM_REBELcxx . . $ `Descent3/aistruct_external.h:366:9`!; |
| 3715 | } |
| 3716 | } |
| 3717 | |
| 3718 | for (i = 0; i < MAX_AI_SOUNDScxx . . $ `Descent3/aistruct.h:712:9`!; i++) { |
| 3719 | ai_info->last_sound_timecxx . . $ ai_frame#last_sound_time.[i] = Gametimecxx . . $ Gametime.; |
| 3720 | } |
| 3721 | |
| 3722 | // Set up the robot to walk if it is applicable |
| 3723 | if (ai_info->movement_typecxx . . $ ai_frame#movement_type. == MC_WALKINGcxx . . $ `Descent3/object_external.h:248:9`!) { |
| 3724 | if (Object_infocxx . . $ Object_info.[obj->idcxx . . $ object#id.].animcxx . . $ object_info#anim.[MC_STANDINGcxx . . $ `Descent3/object_external.h:245:9`!].elemcxx . . $ anim_elem#elem.[AS_ALERTcxx . . $ `Descent3/aistruct_external.h:409:9`!].tocxx . . $ anim_entry#to.) |
| 3725 | ai_info->movement_typecxx . . $ ai_frame#movement_type. = MC_STANDINGcxx . . $ `Descent3/object_external.h:245:9`!; |
| 3726 | |
| 3727 | obj->movement_typecxx . . $ object#movement_type. = MT_WALKINGcxx . . $ `Descent3/object_external.h:235:9`!; |
| 3728 | } |
| 3729 | |
| 3730 | if ((ObjGetcxx . . $ ObjGet(11672e354c0b263a).(obj->parent_handlecxx . . $ object#parent_handle.) || Matcen_createdcxx . . $ Matcen_created.) && (Object_infocxx . . $ Object_info.[obj->idcxx . . $ object#id.].animcxx . . $ object_info#anim.[ai_movement].elemcxx . . $ anim_elem#elem.[AS_BIRTHcxx . . $ `Descent3/aistruct_external.h:411:9`!].tocxx . . $ anim_entry#to.)) { |
| 3731 | anim = AS_BIRTHcxx . . $ `Descent3/aistruct_external.h:411:9`!; |
| 3732 | ai_info->next_animation_typecxx . . $ ai_frame#next_animation_type. = AS_IDLEcxx . . $ `Descent3/aistruct_external.h:419:9`!; |
| 3733 | p_info->anim_flagscxx . . $ polyobj_info#anim_flags. = AIAF_NOTIFYcxx . . $ `Descent3/aistruct_external.h:116:9`!; |
| 3734 | |
| 3735 | p_info->anim_start_framecxx . . $ polyobj_info#anim_start_frame. = Object_infocxx . . $ Object_info.[obj->idcxx . . $ object#id.].animcxx . . $ object_info#anim.[ai_movement].elemcxx . . $ anim_elem#elem.[anim].fromcxx . . $ anim_entry#from.; |
| 3736 | p_info->anim_end_framecxx . . $ polyobj_info#anim_end_frame. = Object_infocxx . . $ Object_info.[obj->idcxx . . $ object#id.].animcxx . . $ object_info#anim.[ai_movement].elemcxx . . $ anim_elem#elem.[anim].tocxx . . $ anim_entry#to.; |
| 3737 | p_info->anim_timecxx . . $ polyobj_info#anim_time. = Object_infocxx . . $ Object_info.[obj->idcxx . . $ object#id.].animcxx . . $ object_info#anim.[ai_movement].elemcxx . . $ anim_elem#elem.[anim].spccxx . . $ anim_entry#spc.; |
| 3738 | p_info->anim_framecxx . . $ polyobj_info#anim_frame. = Object_infocxx . . $ Object_info.[obj->idcxx . . $ object#id.].animcxx . . $ object_info#anim.[ai_movement].elemcxx . . $ anim_elem#elem.[anim].fromcxx . . $ anim_entry#from.; |
| 3739 | } else { |
| 3740 | anim = AS_IDLEcxx . . $ `Descent3/aistruct_external.h:419:9`!; |
| 3741 | |
| 3742 | if (Object_infocxx . . $ Object_info.[obj->idcxx . . $ object#id.].animcxx . . $ object_info#anim.[ai_movement].elemcxx . . $ anim_elem#elem.[anim].tocxx . . $ anim_entry#to. == 0.0f) |
| 3743 | anim = AS_ALERTcxx . . $ `Descent3/aistruct_external.h:409:9`!; |
| 3744 | |
| 3745 | ai_info->next_animation_typecxx . . $ ai_frame#next_animation_type. = AI_INVALID_INDEXcxx . . $ `Descent3/aistruct.h:404:9`!; |
| 3746 | p_info->anim_flagscxx . . $ polyobj_info#anim_flags. = AIAF_LOOPINGcxx . . $ `Descent3/aistruct_external.h:115:9`!; |
| 3747 | |
| 3748 | // Setup the initial animation state info |
| 3749 | float rand_offset = ps_randcxx . . $ ps_rand(b126dc7c1de90089).() / ((float)D3_RAND_MAXcxx . . $ `misc/psrand.h:41:9`!); |
| 3750 | p_info->anim_start_framecxx . . $ polyobj_info#anim_start_frame. = Object_infocxx . . $ Object_info.[obj->idcxx . . $ object#id.].animcxx . . $ object_info#anim.[ai_movement].elemcxx . . $ anim_elem#elem.[anim].fromcxx . . $ anim_entry#from.; |
| 3751 | p_info->anim_end_framecxx . . $ polyobj_info#anim_end_frame. = Object_infocxx . . $ Object_info.[obj->idcxx . . $ object#id.].animcxx . . $ object_info#anim.[ai_movement].elemcxx . . $ anim_elem#elem.[anim].tocxx . . $ anim_entry#to.; |
| 3752 | p_info->anim_timecxx . . $ polyobj_info#anim_time. = Object_infocxx . . $ Object_info.[obj->idcxx . . $ object#id.].animcxx . . $ object_info#anim.[ai_movement].elemcxx . . $ anim_elem#elem.[anim].spccxx . . $ anim_entry#spc.; |
| 3753 | p_info->anim_framecxx . . $ polyobj_info#anim_frame. = (rand_offset)*Object_infocxx . . $ Object_info.[obj->idcxx . . $ object#id.].animcxx . . $ object_info#anim.[ai_movement].elemcxx . . $ anim_elem#elem.[anim].fromcxx . . $ anim_entry#from. + |
| 3754 | (1.0f - rand_offset) * Object_infocxx . . $ Object_info.[obj->idcxx . . $ object#id.].animcxx . . $ object_info#anim.[ai_movement].elemcxx . . $ anim_elem#elem.[anim].tocxx . . $ anim_entry#to.; |
| 3755 | } |
| 3756 | |
| 3757 | ai_info->animation_typecxx . . $ ai_frame#animation_type. = anim; |
| 3758 | |
| 3759 | if (Object_infocxx . . $ Object_info.[obj->idcxx . . $ object#id.].animcxx . . $ object_info#anim.[ai_movement].elemcxx . . $ anim_elem#elem.[anim].anim_sound_indexcxx . . $ anim_entry#anim_sound_index. != SOUND_NONE_INDEXcxx . . $ `Descent3/sounds.h:105:9`!) { |
| 3760 | |
| 3761 | if (!Viewer_objectcxx . . $ Viewer_object. || !Player_objectcxx . . $ Player_object.) { |
| 3762 | Player_objectcxx . . $ Player_object. = &Objectscxx . . $ Objects.[0]; |
| 3763 | Viewer_objectcxx . . $ Viewer_object. = Player_objectcxx . . $ Player_object.; |
| 3764 | } |
| 3765 | |
| 3766 | // Accounts for sound loading |
| 3767 | if ((obj->handlecxx . . $ object#handle. & HANDLE_COUNT_MASKcxx . . $ `Descent3/object.h:643:9`!) != 0) { |
| 3768 | ai_info->last_played_sound_indexcxx . . $ ai_frame#last_played_sound_index. = Object_infocxx . . $ Object_info.[obj->idcxx . . $ object#id.].animcxx . . $ object_info#anim.[ai_movement].elemcxx . . $ anim_elem#elem.[anim].anim_sound_indexcxx . . $ anim_entry#anim_sound_index.; |
| 3769 | ai_info->anim_sound_handlecxx . . $ ai_frame#anim_sound_handle. = Sound_systemcxx . . $ Sound_system..Play3dSoundcxx . . $ hlsSystem#Play3dSound(17f485224ada8dd7).( |
| 3770 | Object_infocxx . . $ Object_info.[obj->idcxx . . $ object#id.].animcxx . . $ object_info#anim.[ai_movement].elemcxx . . $ anim_elem#elem.[anim].anim_sound_indexcxx . . $ anim_entry#anim_sound_index., SND_PRIORITY_LOWcxx . . $ `sndlib/ssl_lib.h:285:9`!, obj); |
| 3771 | } else { |
| 3772 | ai_info->last_played_sound_indexcxx . . $ ai_frame#last_played_sound_index. = -1; |
| 3773 | } |
| 3774 | } else { |
| 3775 | ai_info->last_played_sound_indexcxx . . $ ai_frame#last_played_sound_index. = -1; |
| 3776 | } |
| 3777 | |
| 3778 | ai_info->next_melee_timecxx . . $ ai_frame#next_melee_time. = Gametimecxx . . $ Gametime.; |
| 3779 | ai_info->next_flinch_timecxx . . $ ai_frame#next_flinch_time. = Gametimecxx . . $ Gametime.; |
| 3780 | AISetTargetcxx . . $ AISetTarget(9985ed114f2bfc78).(obj, OBJECT_HANDLE_NONEcxx . . $ `Descent3/object_external.h:156:9`!); |
| 3781 | ai_info->next_check_see_target_timecxx . . $ ai_frame#next_check_see_target_time. = Gametimecxx . . $ Gametime. + (float)ps_randcxx . . $ ps_rand(b126dc7c1de90089).() / (float)D3_RAND_MAXcxx . . $ `misc/psrand.h:41:9`!; |
| 3782 | ai_info->last_see_target_timecxx . . $ ai_frame#last_see_target_time. = Gametimecxx . . $ Gametime. - CHECK_VIS_INFREQUENTLY_TIMEcxx . . $ `Descent3/AImain.cpp:1552:9`! * 2.0f; |
| 3783 | ai_info->last_hear_target_timecxx . . $ ai_frame#last_hear_target_time. = Gametimecxx . . $ Gametime. - CHECK_VIS_INFREQUENTLY_TIMEcxx . . $ `Descent3/AImain.cpp:1552:9`! * 2.0f; |
| 3784 | ai_info->last_render_timecxx . . $ ai_frame#last_render_time. = -1.0f; |
| 3785 | ai_info->next_target_update_timecxx . . $ ai_frame#next_target_update_time. = Gametimecxx . . $ Gametime.; |
| 3786 | |
| 3787 | if (ai_info->flagscxx . . $ ai_frame#flags. & AIF_FLUCTUATE_SPEED_PROPERTIEScxx . . $ `Descent3/aistruct_external.h:363:9`!) { |
| 3788 | ai_info->max_velocitycxx . . $ ai_frame#max_velocity. *= |
| 3789 | 1.0f + (((float)ps_randcxx . . $ ps_rand(b126dc7c1de90089).() - D3_RAND_MAXcxx . . $ `misc/psrand.h:41:9`! * 0.5f) / (D3_RAND_MAXcxx . . $ `misc/psrand.h:41:9`! * 0.5f)) * MAX_FLUCTUATION_PERCENTcxx . . $ `Descent3/AImain.cpp:3590:9`!; |
| 3790 | ai_info->max_delta_velocitycxx . . $ ai_frame#max_delta_velocity. *= |
| 3791 | 1.0f + (((float)ps_randcxx . . $ ps_rand(b126dc7c1de90089).() - D3_RAND_MAXcxx . . $ `misc/psrand.h:41:9`! * 0.5f) / (D3_RAND_MAXcxx . . $ `misc/psrand.h:41:9`! * 0.5f)) * MAX_FLUCTUATION_PERCENTcxx . . $ `Descent3/AImain.cpp:3590:9`!; |
| 3792 | ai_info->max_turn_ratecxx . . $ ai_frame#max_turn_rate. *= |
| 3793 | 1.0f + (((float)ps_randcxx . . $ ps_rand(b126dc7c1de90089).() - D3_RAND_MAXcxx . . $ `misc/psrand.h:41:9`! * 0.5f) / (D3_RAND_MAXcxx . . $ `misc/psrand.h:41:9`! * 0.5f)) * MAX_FLUCTUATION_PERCENTcxx . . $ `Descent3/AImain.cpp:3590:9`!; |
| 3794 | } |
| 3795 | |
| 3796 | ai_info->notify_flagscxx . . $ ai_frame#notify_flags. |= AI_NOTIFIES_ALWAYS_ONcxx . . $ `Descent3/aistruct_external.h:316:9`!; |
| 3797 | |
| 3798 | ai_info->awarenesscxx . . $ ai_frame#awareness. = AWARE_NONEcxx . . $ `Descent3/aistruct_external.h:327:9`!; |
| 3799 | |
| 3800 | // Apply difficulty settings |
| 3801 | ai_info->dodge_percentcxx . . $ ai_frame#dodge_percent. *= (f_no_scale) ? 1.0f : Diff_ai_dodge_percentcxx . . $ Diff_ai_dodge_percent.[DIFF_LEVELcxx . . $ `Descent3/difficulty.h:29:9`!]; |
| 3802 | ai_info->dodge_vel_percentcxx . . $ ai_frame#dodge_vel_percent. *= (f_no_scale) ? 1.0f : Diff_ai_dodge_speedcxx . . $ Diff_ai_dodge_speed.[DIFF_LEVELcxx . . $ `Descent3/difficulty.h:29:9`!]; |
| 3803 | ai_info->max_velocitycxx . . $ ai_frame#max_velocity. *= (f_no_scale || obj->movement_typecxx . . $ object#movement_type. == MT_WALKINGcxx . . $ `Descent3/object_external.h:235:9`!) ? 1.0f : Diff_ai_speedcxx . . $ Diff_ai_speed.[DIFF_LEVELcxx . . $ `Descent3/difficulty.h:29:9`!]; |
| 3804 | ai_info->max_turn_ratecxx . . $ ai_frame#max_turn_rate. *= (f_no_scale || obj->movement_typecxx . . $ object#movement_type. == MT_WALKINGcxx . . $ `Descent3/object_external.h:235:9`!) ? 1.0f : Diff_ai_rotspeedcxx . . $ Diff_ai_rotspeed.[DIFF_LEVELcxx . . $ `Descent3/difficulty.h:29:9`!]; |
| 3805 | ai_info->circle_distancecxx . . $ ai_frame#circle_distance. *= (f_no_scale) ? 1.0f : Diff_ai_circle_distcxx . . $ Diff_ai_circle_dist.[DIFF_LEVELcxx . . $ `Descent3/difficulty.h:29:9`!]; |
| 3806 | |
| 3807 | ai_info->last_see_target_poscxx . . $ ai_frame#last_see_target_pos. =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). obj->poscxx . . $ object#pos.; |
| 3808 | |
| 3809 | ai_info->vec_to_target_actualcxx . . $ ai_frame#vec_to_target_actual. =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). obj->orientcxx . . $ object#orient..fveccxx . . $ matrix#fvec.; |
| 3810 | ai_info->vec_to_target_perceivedcxx . . $ ai_frame#vec_to_target_perceived. =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). obj->orientcxx . . $ object#orient..fveccxx . . $ matrix#fvec.; |
| 3811 | |
| 3812 | ai_info->dist_to_target_actualcxx . . $ ai_frame#dist_to_target_actual. = vm_NormalizeVectorcxx . . $ vm_NormalizeVector(4939a7e530383cd4).(&ai_info->vec_to_target_actualcxx . . $ ai_frame#vec_to_target_actual.); |
| 3813 | ai_info->dist_to_target_perceivedcxx . . $ ai_frame#dist_to_target_perceived. = 10000.0f; |
| 3814 | |
| 3815 | // Clear out the goals |
| 3816 | GoalInitTypeGoalscxx . . $ GoalInitTypeGoals(766a1b7183ffa4b4).(obj, ai_info->ai_typecxx . . $ ai_frame#ai_type.); |
| 3817 | |
| 3818 | if (IS_GUIDEBOTcxx . . $ `Descent3/objinfo.h:363:9`!(obj)) |
| 3819 | ai_info->flagscxx . . $ ai_frame#flags. |= AIF_DODGEcxx . . $ `Descent3/aistruct_external.h:355:9`!; |
| 3820 | |
| 3821 | return true; |
| 3822 | } |
| 3823 | |
| 3824 | // chrishack -- fix the problem with the object being needed for AIInit |
| 3825 | void AISetDefaultcxx . . $ AISetDefault(452b88ebebccf6b5).(t_ai_infocxx . . $ t_ai_info# *ai_info_ptr) {} |
| 3826 | |
| 3827 | void AIInitAllcxx . . $ AIInitAll(49f6e7a06ebc5aa8).() { |
| 3828 | int i; |
| 3829 | |
| 3830 | mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "Initializing AI systems\n"); |
| 3831 | |
| 3832 | // Initialize the terrain AI system |
| 3833 | ait_Initcxx . . $ ait_Init(49f6e7a06ebc5aa8).(); |
| 3834 | |
| 3835 | // Make sure that the buddies are located |
| 3836 | for (i = 0; i < MAX_PLAYERScxx . . $ `Descent3/player_external_struct.h:86:9`!; i++) { |
| 3837 | Buddy_handlecxx . . $ Buddy_handle.[i] = OBJECT_HANDLE_NONEcxx . . $ `Descent3/object_external.h:156:9`!; |
| 3838 | } |
| 3839 | |
| 3840 | // Initialize the room AI system |
| 3841 | |
| 3842 | // Now, initialize each AI object |
| 3843 | for (i = 0; i <= Highest_object_indexcxx . . $ Highest_object_index.; i++) |
| 3844 | if (Objectscxx . . $ Objects.[i].typecxx . . $ object#type. != OBJ_NONEcxx . . $ `Descent3/object_external.h:159:9`! && Objectscxx . . $ Objects.[i].control_typecxx . . $ object#control_type. == CT_AIcxx . . $ `Descent3/object_external.h:217:9`!) { |
| 3845 | ASSERTcxx . . $ `misc/pserror.h:246:9`!(Objects[i].ai_info); |
| 3846 | AIInitcxx . . $ AIInit(cc53779520928514).(&Objectscxx . . $ Objects.[i], Objectscxx . . $ Objects.[i].ai_infocxx . . $ object#ai_info.->ai_classcxx . . $ ai_frame#ai_class., Objectscxx . . $ Objects.[i].ai_infocxx . . $ object#ai_info.->ai_typecxx . . $ ai_frame#ai_type., Objectscxx . . $ Objects.[i].ai_infocxx . . $ object#ai_info.->movement_typecxx . . $ ai_frame#movement_type.); |
| 3847 | } |
| 3848 | |
| 3849 | AI_NumRenderedcxx . . $ AI_NumRendered. = 0; |
| 3850 | AI_NumHostileAlertcxx . . $ AI_NumHostileAlert. = 0; |
| 3851 | |
| 3852 | if (!(Game_modecxx . . $ Game_mode. & GM_MULTIcxx . . $ `Descent3/game.h:288:9`!)) { |
| 3853 | int objnum = |
| 3854 | ObjCreatecxx . . $ ObjCreate(849c3da80a4f387f).(OBJ_ROBOTcxx . . $ `Descent3/object_external.h:162:9`!, ROBOT_GUIDEBOTcxx . . $ `Descent3/object_external.h:354:9`!, Player_objectcxx . . $ Player_object.->roomnumcxx . . $ object#roomnum., &Player_objectcxx . . $ Player_object.->poscxx . . $ object#pos., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, Player_objectcxx . . $ Player_object.->handlecxx . . $ object#handle.); |
| 3855 | if (objnum > -1) { // DAJ -1FIX |
| 3856 | Buddy_handlecxx . . $ Buddy_handle.[0] = Objectscxx . . $ Objects.[objnum].handlecxx . . $ object#handle.; |
| 3857 | ObjGhostObjectcxx . . $ ObjGhostObject(d4f767463ce0a6b3).(objnum); |
| 3858 | } |
| 3859 | } else if (Netgamecxx . . $ Netgame..flagscxx . . $ netgame_info#flags. & NF_ALLOWGUIDEBOTcxx . . $ `Descent3/multi_external.h:232:9`!) { |
| 3860 | int i; |
| 3861 | |
| 3862 | for (i = 0; i < MAX_PLAYERScxx . . $ `Descent3/player_external_struct.h:86:9`!; i++) { |
| 3863 | if (Netgamecxx . . $ Netgame..local_rolecxx . . $ netgame_info#local_role. == LR_CLIENTcxx . . $ `Descent3/multi_external.h:128:9`!) { |
| 3864 | Buddy_handlecxx . . $ Buddy_handle.[i] = OBJECT_HANDLE_NONEcxx . . $ `Descent3/object_external.h:156:9`!; |
| 3865 | } else { |
| 3866 | int parent_handle; |
| 3867 | |
| 3868 | if (Playerscxx . . $ Players.[i].objnumcxx . . $ player#objnum. < 0 || Playerscxx . . $ Players.[i].objnumcxx . . $ player#objnum. > Highest_object_indexcxx . . $ Highest_object_index. || |
| 3869 | Objectscxx . . $ Objects.[Playerscxx . . $ Players.[i].objnumcxx . . $ player#objnum.].typecxx . . $ object#type. == OBJ_NONEcxx . . $ `Descent3/object_external.h:159:9`!) { |
| 3870 | parent_handle = OBJECT_HANDLE_NONEcxx . . $ `Descent3/object_external.h:156:9`!; |
| 3871 | } else { |
| 3872 | parent_handle = Objectscxx . . $ Objects.[Playerscxx . . $ Players.[i].objnumcxx . . $ player#objnum.].handlecxx . . $ object#handle.; |
| 3873 | } |
| 3874 | |
| 3875 | // BLACKPYRO |
| 3876 | int objnum = |
| 3877 | ObjCreatecxx . . $ ObjCreate(849c3da80a4f387f).(OBJ_ROBOTcxx . . $ `Descent3/object_external.h:162:9`!, ROBOT_GUIDEBOTcxx . . $ `Descent3/object_external.h:354:9`!, Player_objectcxx . . $ Player_object.->roomnumcxx . . $ object#roomnum., &Player_objectcxx . . $ Player_object.->poscxx . . $ object#pos., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, parent_handle); |
| 3878 | if (objnum > -1) { // DAJ -1FIX |
| 3879 | Buddy_handlecxx . . $ Buddy_handle.[i] = Objectscxx . . $ Objects.[objnum].handlecxx . . $ object#handle.; |
| 3880 | ObjGhostObjectcxx . . $ ObjGhostObject(d4f767463ce0a6b3).(objnum); |
| 3881 | } |
| 3882 | } |
| 3883 | } |
| 3884 | } |
| 3885 | |
| 3886 | mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "Done Initializing AI systems\n"); |
| 3887 | } |
| 3888 | |
| 3889 | void AICheckTargetViscxx . . $ AICheckTargetVis(419c470199a90a97).(objectcxx . . $ object# *obj) { |
| 3890 | ai_framecxx . . $ ai_frame# *ai_info = obj->ai_infocxx . . $ object#ai_info.; |
| 3891 | objectcxx . . $ object# *target = ObjGetcxx . . $ ObjGet(11672e354c0b263a).(ai_info->target_handlecxx . . $ ai_frame#target_handle.); |
| 3892 | |
| 3893 | #ifdef _DEBUGcxx . . $ `<built-in>:482:9`! |
| 3894 | if (AI_debug_robot_docxx . . $ AI_debug_robot_do. && OBJNUMcxx . . $ `Descent3/object.h:700:9`!(obj) == AI_debug_robot_indexcxx . . $ AI_debug_robot_index.) { |
| 3895 | mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "AI Note: Vis 1\n"); |
| 3896 | } |
| 3897 | #endif |
| 3898 | |
| 3899 | #ifdef _DEBUGcxx . . $ `<built-in>:482:9`! |
| 3900 | if (!Game_do_ai_viscxx . . $ Game_do_ai_vis.) { |
| 3901 | ai_info->status_regcxx . . $ ai_frame#status_reg. &= ~AISR_SEES_GOALcxx . . $ `Descent3/aistruct_external.h:400:9`!; |
| 3902 | ai_info->last_see_target_poscxx . . $ ai_frame#last_see_target_pos. =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). obj->poscxx . . $ object#pos.; |
| 3903 | return; |
| 3904 | } |
| 3905 | #endif |
| 3906 | |
| 3907 | if (target == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) { |
| 3908 | ai_info->status_regcxx . . $ ai_frame#status_reg. &= ~AISR_SEES_GOALcxx . . $ `Descent3/aistruct_external.h:400:9`!; |
| 3909 | ai_info->last_see_target_poscxx . . $ ai_frame#last_see_target_pos. =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). obj->poscxx . . $ object#pos.; |
| 3910 | return; |
| 3911 | } |
| 3912 | |
| 3913 | #ifdef _DEBUGcxx . . $ `<built-in>:482:9`! |
| 3914 | if (AI_debug_robot_docxx . . $ AI_debug_robot_do. && OBJNUMcxx . . $ `Descent3/object.h:700:9`!(obj) == AI_debug_robot_indexcxx . . $ AI_debug_robot_index.) { |
| 3915 | mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "AI Note: Vis 2\n"); |
| 3916 | } |
| 3917 | #endif |
| 3918 | |
| 3919 | if (!BOA_IsVisiblecxx . . $ BOA_IsVisible(cf9ef193275fa6d8).(obj->roomnumcxx . . $ object#roomnum., target->roomnumcxx . . $ object#roomnum.)) { |
| 3920 | ai_info->status_regcxx . . $ ai_frame#status_reg. &= ~AISR_SEES_GOALcxx . . $ `Descent3/aistruct_external.h:400:9`!; |
| 3921 | return; |
| 3922 | } |
| 3923 | |
| 3924 | #ifdef _DEBUGcxx . . $ `<built-in>:482:9`! |
| 3925 | if (AI_debug_robot_docxx . . $ AI_debug_robot_do. && OBJNUMcxx . . $ `Descent3/object.h:700:9`!(obj) == AI_debug_robot_indexcxx . . $ AI_debug_robot_index.) { |
| 3926 | mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "AI Note: Vis 3\n"); |
| 3927 | } |
| 3928 | #endif |
| 3929 | |
| 3930 | vectorcxx . . $ vector# pos; |
| 3931 | AIDetermineAimPointcxx . . $ AIDetermineAimPoint(f3784d1ff02632da).(obj, target, &pos); |
| 3932 | ai_info->vec_to_target_actualcxx . . $ ai_frame#vec_to_target_actual. =cxx . . $ vector#`operator=`(c0842353a20857d). pos -cxx . . $ operator-(b77b703cd1e43e33). obj->poscxx . . $ object#pos.; |
| 3933 | ai_info->dist_to_target_actualcxx . . $ ai_frame#dist_to_target_actual. = vm_NormalizeVectorcxx . . $ vm_NormalizeVector(4939a7e530383cd4).(&ai_info->vec_to_target_actualcxx . . $ ai_frame#vec_to_target_actual.); |
| 3934 | ai_info->dist_to_target_actualcxx . . $ ai_frame#dist_to_target_actual. -= (obj->sizecxx . . $ object#size. + target->sizecxx . . $ object#size.); |
| 3935 | if (ai_info->dist_to_target_actualcxx . . $ ai_frame#dist_to_target_actual. < 0.0f) |
| 3936 | ai_info->dist_to_target_actualcxx . . $ ai_frame#dist_to_target_actual. = 0.0f; |
| 3937 | |
| 3938 | vectorcxx . . $ vector# fov_vec; |
| 3939 | AIDetermineFovVeccxx . . $ AIDetermineFovVec(899400cfb1a8da78).(obj, &fov_vec); |
| 3940 | |
| 3941 | if (ai_info->vec_to_target_actualcxx . . $ ai_frame#vec_to_target_actual. *cxx . . $ `operator*`(4a721543d64e126a). fov_vec < ai_info->fovcxx . . $ ai_frame#fov.) { |
| 3942 | ai_info->status_regcxx . . $ ai_frame#status_reg. &= ~AISR_SEES_GOALcxx . . $ `Descent3/aistruct_external.h:400:9`!; |
| 3943 | return; |
| 3944 | } |
| 3945 | |
| 3946 | #ifdef _DEBUGcxx . . $ `<built-in>:482:9`! |
| 3947 | if (AI_debug_robot_docxx . . $ AI_debug_robot_do. && OBJNUMcxx . . $ `Descent3/object.h:700:9`!(obj) == AI_debug_robot_indexcxx . . $ AI_debug_robot_index.) { |
| 3948 | mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "AI Note: Vis 4\n"); |
| 3949 | } |
| 3950 | #endif |
| 3951 | |
| 3952 | if (ai_info->dist_to_target_actualcxx . . $ ai_frame#dist_to_target_actual. > MAX_TRACK_TARGET_DISTcxx . . $ `Descent3/AImain.cpp:1549:9`! * Diff_ai_vis_distcxx . . $ Diff_ai_vis_dist.[DIFF_LEVELcxx . . $ `Descent3/difficulty.h:29:9`!] && |
| 3953 | (!ObjGetcxx . . $ ObjGet(11672e354c0b263a).(ai_info->target_handlecxx . . $ ai_frame#target_handle.) || (obj->roomnumcxx . . $ object#roomnum. != ObjGetcxx . . $ ObjGet(11672e354c0b263a).(ai_info->target_handlecxx . . $ ai_frame#target_handle.)->roomnumcxx . . $ object#roomnum.))) { |
| 3954 | ai_info->status_regcxx . . $ ai_frame#status_reg. &= ~AISR_SEES_GOALcxx . . $ `Descent3/aistruct_external.h:400:9`!; |
| 3955 | return; |
| 3956 | } |
| 3957 | |
| 3958 | #ifdef _DEBUGcxx . . $ `<built-in>:482:9`! |
| 3959 | if (AI_debug_robot_docxx . . $ AI_debug_robot_do. && OBJNUMcxx . . $ `Descent3/object.h:700:9`!(obj) == AI_debug_robot_indexcxx . . $ AI_debug_robot_index.) { |
| 3960 | mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "AI Note: Vis 5\n"); |
| 3961 | } |
| 3962 | #endif |
| 3963 | |
| 3964 | if (ai_info->awarenesscxx . . $ ai_frame#awareness. == AWARE_NONEcxx . . $ `Descent3/aistruct_external.h:327:9`! && (target->roomnumcxx . . $ object#roomnum. != obj->roomnumcxx . . $ object#roomnum.) && |
| 3965 | ai_info->dist_to_target_actualcxx . . $ ai_frame#dist_to_target_actual. > MAX_SEE_TARGET_DISTcxx . . $ `Descent3/AImain.cpp:1548:9`! * Diff_ai_vis_distcxx . . $ Diff_ai_vis_dist.[DIFF_LEVELcxx . . $ `Descent3/difficulty.h:29:9`!]) { |
| 3966 | ai_info->status_regcxx . . $ ai_frame#status_reg. &= ~AISR_SEES_GOALcxx . . $ `Descent3/aistruct_external.h:400:9`!; |
| 3967 | return; |
| 3968 | } |
| 3969 | |
| 3970 | #ifdef _DEBUGcxx . . $ `<built-in>:482:9`! |
| 3971 | if (AI_debug_robot_docxx . . $ AI_debug_robot_do. && OBJNUMcxx . . $ `Descent3/object.h:700:9`!(obj) == AI_debug_robot_indexcxx . . $ AI_debug_robot_index.) { |
| 3972 | mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "AI Note: Vis 6\n"); |
| 3973 | } |
| 3974 | #endif |
| 3975 | |
| 3976 | if ((ai_info->dist_to_target_actualcxx . . $ ai_frame#dist_to_target_actual. > MAX_SEE_TARGET_DISTcxx . . $ `Descent3/AImain.cpp:1548:9`! * Diff_ai_vis_distcxx . . $ Diff_ai_vis_dist.[DIFF_LEVELcxx . . $ `Descent3/difficulty.h:29:9`!] && |
| 3977 | ai_info->awarenesscxx . . $ ai_frame#awareness. <= AWARE_BARELYcxx . . $ `Descent3/aistruct_external.h:326:9`! && (target->roomnumcxx . . $ object#roomnum. != obj->roomnumcxx . . $ object#roomnum.)) || |
| 3978 | (target->typecxx . . $ object#type. == OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`! && (Playerscxx . . $ Players.[target->idcxx . . $ object#id.].flagscxx . . $ player#flags. & (PLAYER_FLAGS_DEADcxx . . $ `Descent3/player_external.h:81:9`! | PLAYER_FLAGS_DYINGcxx . . $ `Descent3/player_external.h:80:9`!))) || |
| 3979 | target->typecxx . . $ object#type. == OBJ_GHOSTcxx . . $ `Descent3/object_external.h:172:9`! || !AIDetermineObjVisLevelcxx . . $ AIDetermineObjVisLevel(b2028de646e3dfb9).(obj, target)) { |
| 3980 | //. mprintf(0, "No check vis\n"); |
| 3981 | ai_info->status_regcxx . . $ ai_frame#status_reg. &= ~AISR_SEES_GOALcxx . . $ `Descent3/aistruct_external.h:400:9`!; |
| 3982 | return; |
| 3983 | } |
| 3984 | |
| 3985 | #ifdef _DEBUGcxx . . $ `<built-in>:482:9`! |
| 3986 | if (AI_debug_robot_docxx . . $ AI_debug_robot_do. && OBJNUMcxx . . $ `Descent3/object.h:700:9`!(obj) == AI_debug_robot_indexcxx . . $ AI_debug_robot_index.) { |
| 3987 | mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "AI Note: Vis 7\n"); |
| 3988 | } |
| 3989 | #endif |
| 3990 | |
| 3991 | // Can I see the target? |
| 3992 | if (Gametimecxx . . $ Gametime. - ai_info->last_see_target_timecxx . . $ ai_frame#last_see_target_time. > MIN_VIS_RECENT_CHECK_INTERVALcxx . . $ `Descent3/AImain.cpp:1550:9`!) { |
| 3993 | if (Gametimecxx . . $ Gametime. >= ai_info->next_check_see_target_timecxx . . $ ai_frame#next_check_see_target_time.) { |
| 3994 | // float dist; |
| 3995 | fvi_infocxx . . $ fvi_info# hit_info; |
| 3996 | fvi_querycxx . . $ fvi_query# fq; |
| 3997 | int fate; |
| 3998 | |
| 3999 | // Project a ray and see if target is around. -- We can use a quick room check to see if we should even do it. :) |
| 4000 | // --chrishack (do this later when room structure is in the game) |
| 4001 | // if we are in the same room, see see the target |
| 4002 | // Do FVI_stuff (maybe just a room connection check) |
| 4003 | |
| 4004 | // shoot a ray from the light position to the current vertex |
| 4005 | fq.p0cxx . . $ fvi_query#p0. = &obj->poscxx . . $ object#pos.; |
| 4006 | fq.p1cxx . . $ fvi_query#p1. = &target->poscxx . . $ object#pos.; |
| 4007 | fq.startroomcxx . . $ fvi_query#startroom. = obj->roomnumcxx . . $ object#roomnum.; |
| 4008 | |
| 4009 | fq.radcxx . . $ fvi_query#rad. = 0.0f; |
| 4010 | fq.flagscxx . . $ fvi_query#flags. = FQ_CHECK_OBJScxx . . $ `lib/findintersection_external.h:59:9`! | FQ_IGNORE_POWERUPScxx . . $ `lib/findintersection_external.h:62:9`! | FQ_IGNORE_WEAPONScxx . . $ `lib/findintersection_external.h:79:9`! | FQ_NO_RELINKcxx . . $ `lib/findintersection_external.h:73:9`! /* | FQ_IGNORE_MOVING_OBJECTS*/; |
| 4011 | if (ai_info->agressioncxx . . $ ai_frame#agression. > .7f) { |
| 4012 | fq.flagscxx . . $ fvi_query#flags. |= FQ_IGNORE_MOVING_OBJECTScxx . . $ `lib/findintersection_external.h:67:9`!; |
| 4013 | } |
| 4014 | |
| 4015 | fq.thisobjnumcxx . . $ fvi_query#thisobjnum. = -1; |
| 4016 | |
| 4017 | int ignore_obj_list[100]; |
| 4018 | ignore_obj_list[0] = OBJNUMcxx . . $ `Descent3/object.h:700:9`!(obj); |
| 4019 | int num_ignored = 1; |
| 4020 | int i; |
| 4021 | |
| 4022 | // CHRISHACK - ONLY IGNORES FIRST LEVEL OF CHILDREN - DO RECERSIVE |
| 4023 | for (i = 0; i < Poly_modelscxx . . $ Poly_models.[obj->rtypecxx . . $ object#rtype..pobj_infocxx . . $ object#$anonymous_type_10#pobj_info..model_numcxx . . $ polyobj_info#model_num.].n_attachcxx . . $ poly_model#n_attach.; i++) { |
| 4024 | objectcxx . . $ object# *child; |
| 4025 | |
| 4026 | if ((child = ObjGetcxx . . $ ObjGet(11672e354c0b263a).(obj->attach_childrencxx . . $ object#attach_children.[i])) != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`! && num_ignored < 99) { |
| 4027 | ignore_obj_list[num_ignored++] = OBJNUMcxx . . $ `Descent3/object.h:700:9`!(child); |
| 4028 | } |
| 4029 | } |
| 4030 | |
| 4031 | ignore_obj_list[num_ignored] = -1; |
| 4032 | fq.ignore_obj_listcxx . . $ fvi_query#ignore_obj_list. = ignore_obj_list; |
| 4033 | |
| 4034 | fate = fvi_FindIntersectioncxx . . $ fvi_FindIntersection(e1c4d7bd350effc8).(&fq, &hit_info); |
| 4035 | |
| 4036 | #ifdef _DEBUGcxx . . $ `<built-in>:482:9`! |
| 4037 | if (AI_debug_robot_docxx . . $ AI_debug_robot_do. && OBJNUMcxx . . $ `Descent3/object.h:700:9`!(obj) == AI_debug_robot_indexcxx . . $ AI_debug_robot_index.) { |
| 4038 | mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "AI Note: Vis 8\n"); |
| 4039 | } |
| 4040 | #endif |
| 4041 | |
| 4042 | if (((fate == HIT_OBJECTcxx . . $ `lib/findintersection_external.h:47:9`! || fate == HIT_SPHERE_2_POLY_OBJECTcxx . . $ `lib/findintersection_external.h:52:9`!) && hit_info.hit_objectcxx . . $ fvi_info#hit_object.[0] == OBJNUMcxx . . $ `Descent3/object.h:700:9`!(target)) || |
| 4043 | (fate == HIT_NONEcxx . . $ `lib/findintersection_external.h:45:9`!)) { |
| 4044 | ai_info->status_regcxx . . $ ai_frame#status_reg. |= AISR_SEES_GOALcxx . . $ `Descent3/aistruct_external.h:400:9`!; // chrishack -- need to do this stuff correctly |
| 4045 | // if(ai_info->highest_vis > ) chrishack -- need to do this stuff |
| 4046 | |
| 4047 | AINotifycxx . . $ AINotify(f32b5964aaa42c22).(obj, AIN_SEE_TARGETcxx . . $ `Descent3/aistruct_external.h:289:9`!, target); |
| 4048 | |
| 4049 | #ifdef _DEBUGcxx . . $ `<built-in>:482:9`! |
| 4050 | if (AI_debug_robot_docxx . . $ AI_debug_robot_do. && OBJNUMcxx . . $ `Descent3/object.h:700:9`!(obj) == AI_debug_robot_indexcxx . . $ AI_debug_robot_index.) { |
| 4051 | mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "AI Note: Vis SEE TARGET\n"); |
| 4052 | } |
| 4053 | #endif |
| 4054 | } |
| 4055 | |
| 4056 | if ((ai_info->status_regcxx . . $ ai_frame#status_reg. & AISR_SEES_GOALcxx . . $ `Descent3/aistruct_external.h:400:9`!) || |
| 4057 | Gametimecxx . . $ Gametime. - ai_info->last_see_target_timecxx . . $ ai_frame#last_see_target_time. < CHECK_VIS_INFREQUENTLY_TIMEcxx . . $ `Descent3/AImain.cpp:1552:9`!) |
| 4058 | ai_info->next_check_see_target_timecxx . . $ ai_frame#next_check_see_target_time. = |
| 4059 | Gametimecxx . . $ Gametime. + .9 * MIN_VIS_CHECK_INTERVALcxx . . $ `Descent3/AImain.cpp:1551:9`! + .2 * MIN_VIS_CHECK_INTERVALcxx . . $ `Descent3/AImain.cpp:1551:9`! * ((float)ps_randcxx . . $ ps_rand(b126dc7c1de90089).() / (float)D3_RAND_MAXcxx . . $ `misc/psrand.h:41:9`!); |
| 4060 | else |
| 4061 | ai_info->next_check_see_target_timecxx . . $ ai_frame#next_check_see_target_time. = |
| 4062 | Gametimecxx . . $ Gametime. + .9 * CHECK_VIS_INFREQUENTLY_INTERVALcxx . . $ `Descent3/AImain.cpp:1553:9`! + |
| 4063 | .2 * CHECK_VIS_INFREQUENTLY_INTERVALcxx . . $ `Descent3/AImain.cpp:1553:9`! * ((float)ps_randcxx . . $ ps_rand(b126dc7c1de90089).() / (float)D3_RAND_MAXcxx . . $ `misc/psrand.h:41:9`!); |
| 4064 | } |
| 4065 | } |
| 4066 | |
| 4067 | if ((ai_info->status_regcxx . . $ ai_frame#status_reg. & AISR_SEES_GOALcxx . . $ `Descent3/aistruct_external.h:400:9`!)) { |
| 4068 | ai_info->vec_to_target_perceivedcxx . . $ ai_frame#vec_to_target_perceived. =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). ai_info->vec_to_target_actualcxx . . $ ai_frame#vec_to_target_actual.; |
| 4069 | ai_info->dist_to_target_perceivedcxx . . $ ai_frame#dist_to_target_perceived. = ai_info->dist_to_target_actualcxx . . $ ai_frame#dist_to_target_actual.; |
| 4070 | |
| 4071 | // Assumes the the AI and the target are on the same XZ plane |
| 4072 | /* if(ai_info->flags & AIF_XZ_DIST) |
| 4073 | { |
| 4074 | vector xz; |
| 4075 | |
| 4076 | xz = ai_info->vec_to_target_perceived * ai_info->dist_to_target_perceived; |
| 4077 | xz.y = 0.0f; // chrishack - E3 - it this a good way to do this? |
| 4078 | |
| 4079 | // vm_NormalizeVector(&ai_info->vec_to_target_perceived); |
| 4080 | ai_info->dist_to_target_perceived = vm_GetMagnitude(&xz); |
| 4081 | }*/ |
| 4082 | } |
| 4083 | } |
| 4084 | |
| 4085 | bool AIStatusCircleFramecxx . . $ AIStatusCircleFrame(fd8d6ff82ee13e7b).(objectcxx . . $ object# *obj, objectcxx . . $ object# *g_obj, float dist, float c_dist, int *status_reg) { |
| 4086 | if ((*status_reg) & AISR_CIRCLE_DISTcxx . . $ `Descent3/aistruct_external.h:396:9`!) { |
| 4087 | if (dist > c_dist * 1.5f || (obj->ai_infocxx . . $ object#ai_info.->awarenesscxx . . $ ai_frame#awareness. <= AWARE_BARELYcxx . . $ `Descent3/aistruct_external.h:326:9`! && !(obj->ai_infocxx . . $ object#ai_info.->flagscxx . . $ ai_frame#flags. & AIF_PERSISTANTcxx . . $ `Descent3/aistruct_external.h:354:9`!))) { |
| 4088 | (*status_reg) &= ~AISR_CIRCLE_DISTcxx . . $ `Descent3/aistruct_external.h:396:9`!; |
| 4089 | return false; |
| 4090 | } else { |
| 4091 | return true; |
| 4092 | } |
| 4093 | } else if (dist <= c_dist + .1f && |
| 4094 | (obj->ai_infocxx . . $ object#ai_info.->awarenesscxx . . $ ai_frame#awareness. >= AWARE_BARELYcxx . . $ `Descent3/aistruct_external.h:326:9`! || (obj->ai_infocxx . . $ object#ai_info.->flagscxx . . $ ai_frame#flags. & AIF_PERSISTANTcxx . . $ `Descent3/aistruct_external.h:354:9`!))) { |
| 4095 | (*status_reg) |= AISR_CIRCLE_DISTcxx . . $ `Descent3/aistruct_external.h:396:9`!; |
| 4096 | |
| 4097 | if (g_obj) { |
| 4098 | AINotifycxx . . $ AINotify(f32b5964aaa42c22).(obj, AIN_NEAR_TARGETcxx . . $ `Descent3/aistruct_external.h:298:9`!, (void *)g_obj); |
| 4099 | } |
| 4100 | |
| 4101 | return true; |
| 4102 | } else { |
| 4103 | return false; |
| 4104 | } |
| 4105 | } |
| 4106 | |
| 4107 | // MTS: Unused? |
| 4108 | bool ai_target_need_pathcxx . . $ ai_target_need_path(39516aeee13ca5ab).(objectcxx . . $ object# *obj) { return true; } |
| 4109 | |
| 4110 | // MTS: Unused? |
| 4111 | bool ai_move_need_pathcxx . . $ ai_move_need_path(b898c8e4145a3f1a).(objectcxx . . $ object# *obj, vectorcxx . . $ vector# *pos, int roomnum) { |
| 4112 | if (obj->roomnumcxx . . $ object#roomnum. == roomnum) { |
| 4113 | return false; |
| 4114 | } |
| 4115 | |
| 4116 | return true; |
| 4117 | } |
| 4118 | |
| 4119 | void ai_update_registerscxx . . $ ai_update_registers(419c470199a90a97).(objectcxx . . $ object# *obj) { |
| 4120 | ai_framecxx . . $ ai_frame# *ai_info = obj->ai_infocxx . . $ object#ai_info.; |
| 4121 | |
| 4122 | if (ObjGetcxx . . $ ObjGet(11672e354c0b263a).(ai_info->target_handlecxx . . $ ai_frame#target_handle.)) { |
| 4123 | AIStatusCircleFramecxx . . $ AIStatusCircleFrame(fd8d6ff82ee13e7b).(obj, ObjGetcxx . . $ ObjGet(11672e354c0b263a).(ai_info->target_handlecxx . . $ ai_frame#target_handle.), ai_info->dist_to_target_perceivedcxx . . $ ai_frame#dist_to_target_perceived., |
| 4124 | ai_info->circle_distancecxx . . $ ai_frame#circle_distance., &ai_info->status_regcxx . . $ ai_frame#status_reg.); |
| 4125 | } else { |
| 4126 | ai_info->status_regcxx . . $ ai_frame#status_reg. &= ~AISR_CIRCLE_DISTcxx . . $ `Descent3/aistruct_external.h:396:9`!; |
| 4127 | } |
| 4128 | |
| 4129 | ai_info->status_regcxx . . $ ai_frame#status_reg. &= ~AISR_MELEEcxx . . $ `Descent3/aistruct_external.h:398:9`!; |
| 4130 | } |
| 4131 | |
| 4132 | bool AiGoalAvoidcxx . . $ AiGoalAvoid(b73dfffb7c1354e0).(vectorcxx . . $ vector# *adir, objectcxx . . $ object# *obj, objectcxx . . $ object# *a_obj, float dist) { |
| 4133 | float full_dist = dist; |
| 4134 | vectorcxx . . $ vector# a_vel; |
| 4135 | |
| 4136 | if (obj->movement_typecxx . . $ object#movement_type. != MT_PHYSICScxx . . $ `Descent3/object_external.h:234:9`! && obj->movement_typecxx . . $ object#movement_type. != MT_WALKINGcxx . . $ `Descent3/object_external.h:235:9`!) |
| 4137 | return false; |
| 4138 | |
| 4139 | if (a_obj->movement_typecxx . . $ object#movement_type. == MT_PHYSICScxx . . $ `Descent3/object_external.h:234:9`! || a_obj->movement_typecxx . . $ object#movement_type. == MT_WALKINGcxx . . $ `Descent3/object_external.h:235:9`!) |
| 4140 | a_vel =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). a_obj->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..velocitycxx . . $ physics_info#velocity.; |
| 4141 | else |
| 4142 | a_vel =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). Zero_vectorcxx . . $ Zero_vector.; |
| 4143 | |
| 4144 | vectorcxx . . $ vector# to_avoid = a_obj->poscxx . . $ object#pos. -cxx . . $ operator-(b77b703cd1e43e33). obj->poscxx . . $ object#pos.; |
| 4145 | vectorcxx . . $ vector# mdir; |
| 4146 | mdir =cxx . . $ vector#`operator=`(c0842353a20857d). obj->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..velocitycxx . . $ physics_info#velocity. -cxx . . $ operator-(b77b703cd1e43e33). a_vel; |
| 4147 | |
| 4148 | if (fabsf(mdir.xcxx . . $ vector#x.) < 0.1f && fabsf(mdir.ycxx . . $ vector#y.) < 0.1f && fabsf(mdir.zcxx . . $ vector#z.) < 0.1f) { |
| 4149 | *adir =cxx . . $ vector#`operator=`(c0842353a20857d). -cxx . . $ operator-(9e07539e219c6f20).to_avoid; |
| 4150 | vm_NormalizeVectorcxx . . $ vm_NormalizeVector(4939a7e530383cd4).(adir); |
| 4151 | |
| 4152 | return true; |
| 4153 | } |
| 4154 | |
| 4155 | vm_NormalizeVectorcxx . . $ vm_NormalizeVector(4939a7e530383cd4).(&mdir); |
| 4156 | float temp = mdir *cxx . . $ `operator*`(4a721543d64e126a). to_avoid; |
| 4157 | |
| 4158 | if (temp <= 0.0f) { |
| 4159 | *adir =cxx . . $ vector#`operator=`(c0842353a20857d). -cxx . . $ operator-(9e07539e219c6f20).to_avoid; |
| 4160 | vm_NormalizeVectorcxx . . $ vm_NormalizeVector(4939a7e530383cd4).(adir); |
| 4161 | |
| 4162 | return true; |
| 4163 | } |
| 4164 | |
| 4165 | vectorcxx . . $ vector# vtemp = -cxx . . $ operator-(9e07539e219c6f20).(to_avoid -cxx . . $ operator-(b77b703cd1e43e33). temp *cxx . . $ `operator*`(9d6577ff3e9faa29). mdir); |
| 4166 | |
| 4167 | // float cdist = vm_NormalizeVector(&vtemp); |
| 4168 | // if(cdist >= full_dist) |
| 4169 | // return false; |
| 4170 | |
| 4171 | vectorcxx . . $ vector# apnt = a_obj->poscxx . . $ object#pos. +cxx . . $ operator+(b77b703cd1e43e33). full_dist *cxx . . $ `operator*`(9d6577ff3e9faa29). vtemp; |
| 4172 | |
| 4173 | *adir =cxx . . $ vector#`operator=`(c0842353a20857d). apnt -cxx . . $ operator-(b77b703cd1e43e33). obj->poscxx . . $ object#pos.; |
| 4174 | vm_NormalizeVectorcxx . . $ vm_NormalizeVector(4939a7e530383cd4).(adir); |
| 4175 | |
| 4176 | return true; |
| 4177 | } |
| 4178 | |
| 4179 | static inline bool IsTargetLocalcxx . . $ IsTargetLocal(9fa7d4d2c8b4c2db).(objectcxx . . $ object# *obj, objectcxx . . $ object# *target) { |
| 4180 | int target_room = target->roomnumcxx . . $ object#roomnum.; |
| 4181 | int cur_room = obj->roomnumcxx . . $ object#roomnum.; |
| 4182 | int i; |
| 4183 | |
| 4184 | // If they are in the same room |
| 4185 | if ((target_room = obj->roomnumcxx . . $ object#roomnum.)) { |
| 4186 | return true; |
| 4187 | } |
| 4188 | |
| 4189 | // If the object is outside |
| 4190 | if (OBJECT_OUTSIDEcxx . . $ `lib/object_external_struct.h:130:9`!(obj)) { |
| 4191 | return false; |
| 4192 | } |
| 4193 | |
| 4194 | // If they are in directly adjacent rooms |
| 4195 | for (i = 0; i < Roomscxx . . $ Rooms.[cur_room].num_portalscxx . . $ room#num_portals.; i++) { |
| 4196 | if (Roomscxx . . $ Rooms.[cur_room].portalscxx . . $ room#portals.[i].croomcxx . . $ portal#croom. == target_room) { |
| 4197 | return true; |
| 4198 | } |
| 4199 | } |
| 4200 | |
| 4201 | return false; |
| 4202 | } |
| 4203 | |
| 4204 | #define AVOID_PLAYER_MAX_SCALARcxx . . $ `Descent3/AImain.cpp:4204:9`! 3.0f |
| 4205 | #define AVOID_PLAYER_MIN_SCALARcxx . . $ `Descent3/AImain.cpp:4205:9`! 2.0f |
| 4206 | |
| 4207 | #define ALIGNMENT_OPTI_DISTcxx . . $ `Descent3/AImain.cpp:4207:9`! 16.0f |
| 4208 | #define MAX_ALIGNMENT_DISTcxx . . $ `Descent3/AImain.cpp:4208:9`! 6.0f |
| 4209 | |
| 4210 | #define COHESION_OPTI1_DISTcxx . . $ `Descent3/AImain.cpp:4210:9`! 90.0f |
| 4211 | #define COHESION_OPTI2_DISTcxx . . $ `Descent3/AImain.cpp:4211:9`! 90.0f |
| 4212 | #define COHESION_FALL_OFFcxx . . $ `Descent3/AImain.cpp:4212:9`! 110.0f |
| 4213 | |
| 4214 | // MTS: commented out/returns a bool instead of a float |
| 4215 | float AIGoalIsEnabledForDistcxx . . $ AIGoalIsEnabledForDist(2cec53430be9cb3a).(goalcxx . . $ goal# *goal, float dist) { |
| 4216 | return true; // chrishack -- test code -- temp |
| 4217 | } |
| 4218 | |
| 4219 | void AIGoalDoRepulsecxx . . $ AIGoalDoRepulse(7da590384b204f40).(objectcxx . . $ object# *obj, float dist, vectorcxx . . $ vector# *dir, goalcxx . . $ goal# *goal, vectorcxx . . $ vector# *mdir) { |
| 4220 | float influence = 2.0f; // chrishack - temp - test code |
| 4221 | |
| 4222 | if (/*scale = AIGoalIsEnabledForDist(goal, dist)*/ 1) // chrishack - temp - test code - works like an enabler What |
| 4223 | // about AIDetermineScale???? |
| 4224 | { |
| 4225 | if (dist <= 12.0f) // chrishack - temp - test code |
| 4226 | { |
| 4227 | float scale; |
| 4228 | |
| 4229 | if (dist < 9.0f) |
| 4230 | scale = 1.0f; |
| 4231 | else |
| 4232 | scale = 1.0f - (dist - 9.0f) / 3.0; |
| 4233 | |
| 4234 | *mdir +=cxx . . $ `operator+=`(801a8d6f7ab7bef9). (*dir *cxx . . $ `operator*`(252247219a31502c). -scale) *cxx . . $ `operator*`(252247219a31502c). influence; |
| 4235 | } |
| 4236 | } |
| 4237 | } |
| 4238 | |
| 4239 | void AIGoalDoCohesioncxx . . $ AIGoalDoCohesion(6d8f4adb736eccd0).(objectcxx . . $ object# *obj, objectcxx . . $ object# *g_obj, float dist, goalcxx . . $ goal# *goal, vectorcxx . . $ vector# *mdir) { |
| 4240 | float influence = 2.0f; // chrishack - temp - test code |
| 4241 | |
| 4242 | if (/*scale = AIGoalIsEnabledForDist(goal, dist)*/ 1) // chrishack - temp - test code - works like an enabler What |
| 4243 | // about AIDetermineScale???? |
| 4244 | { |
| 4245 | if (dist >= COHESION_OPTI1_DISTcxx . . $ `Descent3/AImain.cpp:4210:9`! - COHESION_FALL_OFFcxx . . $ `Descent3/AImain.cpp:4212:9`! && dist <= COHESION_OPTI2_DISTcxx . . $ `Descent3/AImain.cpp:4211:9`! + COHESION_FALL_OFFcxx . . $ `Descent3/AImain.cpp:4212:9`!) { |
| 4246 | vectorcxx . . $ vector# cohesion_pnt; |
| 4247 | float scale; |
| 4248 | |
| 4249 | if (dist < COHESION_OPTI1_DISTcxx . . $ `Descent3/AImain.cpp:4210:9`!) |
| 4250 | scale = 1.0f - (COHESION_OPTI1_DISTcxx . . $ `Descent3/AImain.cpp:4210:9`! - dist) / COHESION_FALL_OFFcxx . . $ `Descent3/AImain.cpp:4212:9`!; |
| 4251 | else if (dist <= COHESION_OPTI2_DISTcxx . . $ `Descent3/AImain.cpp:4211:9`!) |
| 4252 | scale = 1.0f; |
| 4253 | else |
| 4254 | scale = 1.0f - (dist - COHESION_OPTI2_DISTcxx . . $ `Descent3/AImain.cpp:4211:9`!) / COHESION_FALL_OFFcxx . . $ `Descent3/AImain.cpp:4212:9`!; |
| 4255 | |
| 4256 | AIDetermineAimPointcxx . . $ AIDetermineAimPoint(f3784d1ff02632da).(obj, g_obj, &cohesion_pnt, obj->ai_infocxx . . $ object#ai_info.->max_velocitycxx . . $ ai_frame#max_velocity.); |
| 4257 | |
| 4258 | vectorcxx . . $ vector# cur_cohesion_dir = cohesion_pnt -cxx . . $ operator-(b77b703cd1e43e33). obj->poscxx . . $ object#pos.; |
| 4259 | vm_NormalizeVectorcxx . . $ vm_NormalizeVector(4939a7e530383cd4).(&cur_cohesion_dir); |
| 4260 | *mdir +=cxx . . $ `operator+=`(801a8d6f7ab7bef9). (cur_cohesion_dir *cxx . . $ `operator*`(252247219a31502c). scale) *cxx . . $ `operator*`(252247219a31502c). influence; |
| 4261 | } |
| 4262 | } |
| 4263 | } |
| 4264 | |
| 4265 | void AIGoalDoAlignmentcxx . . $ AIGoalDoAlignment(7da590384b204f40).(objectcxx . . $ object# *obj, float dist, vectorcxx . . $ vector# *fvec, goalcxx . . $ goal# *goal, vectorcxx . . $ vector# *mdir) { |
| 4266 | float influence = 3.0f; // chrishack - temp - test code |
| 4267 | |
| 4268 | if (/*scale = AIGoalIsEnabledForDist(goal, dist)*/ 1) // chrishack - temp - test code - works like an enabler What |
| 4269 | // about AIDetermineScale???? |
| 4270 | { |
| 4271 | float align_dist = fabscxx . . $ fabs(fbcf3211dfe1bfd1).(dist - ALIGNMENT_OPTI_DISTcxx . . $ `Descent3/AImain.cpp:4207:9`!); |
| 4272 | if (MAX_ALIGNMENT_DISTcxx . . $ `Descent3/AImain.cpp:4208:9`! >= align_dist) { |
| 4273 | float scale = 1.0f - (align_dist / MAX_ALIGNMENT_DISTcxx . . $ `Descent3/AImain.cpp:4208:9`!); |
| 4274 | *mdir +=cxx . . $ `operator+=`(801a8d6f7ab7bef9). (*fvec *cxx . . $ `operator*`(252247219a31502c). scale) *cxx . . $ `operator*`(252247219a31502c). influence; |
| 4275 | } |
| 4276 | } |
| 4277 | } |
| 4278 | |
| 4279 | void AIDoTrackFramecxx . . $ AIDoTrackFrame(419c470199a90a97).(objectcxx . . $ object# *obj) { |
| 4280 | ai_framecxx . . $ ai_frame# *ai_info = obj->ai_infocxx . . $ object#ai_info.; |
| 4281 | float track_distance; |
| 4282 | |
| 4283 | AI_FriendNumNearcxx . . $ AI_FriendNumNear. = 0; |
| 4284 | AI_EnemyNumNearcxx . . $ AI_EnemyNumNear. = 0; |
| 4285 | |
| 4286 | if (ai_info->ai_typecxx . . $ ai_frame#ai_type. == AIT_BIRD_FLOCK1cxx . . $ `Descent3/aistruct_external.h:81:9`! || |
| 4287 | ai_info->flagscxx . . $ ai_frame#flags. & (AIF_TRACK_CLOSEST_2_FRIENDScxx . . $ `Descent3/aistruct_external.h:377:9`! | AIF_TRACK_CLOSEST_2_ENEMIEScxx . . $ `Descent3/aistruct_external.h:378:9`!)) { |
| 4288 | |
| 4289 | if (ai_info->ai_typecxx . . $ ai_frame#ai_type. == AIT_BIRD_FLOCK1cxx . . $ `Descent3/aistruct_external.h:81:9`!) |
| 4290 | track_distance = 100.0f; |
| 4291 | else |
| 4292 | track_distance = GoalDetermineTrackDistcxx . . $ GoalDetermineTrackDist(9e89091ee687c4f3).(obj); |
| 4293 | |
| 4294 | if (track_distance > 0.0f) { |
| 4295 | int16_t near_objs[10]; |
| 4296 | int num_near = fvi_QuickDistObjectListcxx . . $ fvi_QuickDistObjectList(85643dfbd17d1ac8).(&obj->poscxx . . $ object#pos., obj->roomnumcxx . . $ object#roomnum., ai_info->avoid_friends_distancecxx . . $ ai_frame#avoid_friends_distance. + track_distance, |
| 4297 | near_objs, 10, false, true, false, true); |
| 4298 | float dist; |
| 4299 | vectorcxx . . $ vector# to; |
| 4300 | |
| 4301 | AI_EnemyDistcxx . . $ AI_EnemyDist.[0] = AI_EnemyDistcxx . . $ AI_EnemyDist.[1] = 9999999.0f; |
| 4302 | AI_FriendDistcxx . . $ AI_FriendDist.[0] = AI_FriendDistcxx . . $ AI_FriendDist.[1] = 9999999.0f; |
| 4303 | |
| 4304 | for (int xxx = 0; xxx < num_near; xxx++) { |
| 4305 | objectcxx . . $ object# *g_obj = &Objectscxx . . $ Objects.[near_objs[xxx]]; |
| 4306 | |
| 4307 | if (g_obj->typecxx . . $ object#type. == OBJ_POWERUPcxx . . $ `Descent3/object_external.h:167:9`! || (obj == g_obj) || ObjectsAreRelatedcxx . . $ ObjectsAreRelated(cf9ef193275fa6d8).(OBJNUMcxx . . $ `Descent3/object.h:700:9`!(obj), near_objs[xxx])) |
| 4308 | continue; |
| 4309 | |
| 4310 | int *cur_num_near; |
| 4311 | objectcxx . . $ object# **cur_obj; |
| 4312 | float *cur_dist; |
| 4313 | vectorcxx . . $ vector# *cur_dir; |
| 4314 | |
| 4315 | if ((ai_info->flagscxx . . $ ai_frame#flags. & AIF_TRACK_CLOSEST_2_ENEMIEScxx . . $ `Descent3/aistruct_external.h:378:9`!) && AIObjEnemycxx . . $ AIObjEnemy(9fa7d4d2c8b4c2db).(obj, g_obj)) { |
| 4316 | cur_num_near = &AI_EnemyNumNearcxx . . $ AI_EnemyNumNear.; |
| 4317 | cur_obj = AI_EnemyObjcxx . . $ AI_EnemyObj.; |
| 4318 | cur_dist = AI_EnemyDistcxx . . $ AI_EnemyDist.; |
| 4319 | cur_dir = AI_EnemyDircxx . . $ AI_EnemyDir.; |
| 4320 | } else if ((ai_info->flagscxx . . $ ai_frame#flags. & AIF_TRACK_CLOSEST_2_FRIENDScxx . . $ `Descent3/aistruct_external.h:377:9`!) && AIObjFriendcxx . . $ AIObjFriend(9fa7d4d2c8b4c2db).(obj, g_obj)) { |
| 4321 | cur_num_near = &AI_FriendNumNearcxx . . $ AI_FriendNumNear.; |
| 4322 | cur_obj = AI_FriendObjcxx . . $ AI_FriendObj.; |
| 4323 | cur_dist = AI_FriendDistcxx . . $ AI_FriendDist.; |
| 4324 | cur_dir = AI_FriendDircxx . . $ AI_FriendDir.; |
| 4325 | } else |
| 4326 | continue; |
| 4327 | |
| 4328 | to =cxx . . $ vector#`operator=`(c0842353a20857d). g_obj->poscxx . . $ object#pos. -cxx . . $ operator-(b77b703cd1e43e33). obj->poscxx . . $ object#pos.; |
| 4329 | dist = vm_NormalizeVectorcxx . . $ vm_NormalizeVector(4939a7e530383cd4).(&to); |
| 4330 | |
| 4331 | dist -= (obj->sizecxx . . $ object#size. + g_obj->sizecxx . . $ object#size.); |
| 4332 | if (dist < 0.0f) |
| 4333 | dist = 0.0f; |
| 4334 | |
| 4335 | vectorcxx . . $ vector# fov_vec; |
| 4336 | AIDetermineFovVeccxx . . $ AIDetermineFovVec(899400cfb1a8da78).(obj, &fov_vec); |
| 4337 | |
| 4338 | if (to *cxx . . $ `operator*`(4a721543d64e126a). fov_vec < ai_info->fovcxx . . $ ai_frame#fov.) |
| 4339 | continue; |
| 4340 | |
| 4341 | if (cur_dist[0] > dist) { |
| 4342 | cur_dist[1] = cur_dist[0]; |
| 4343 | cur_obj[1] = cur_obj[0]; |
| 4344 | cur_dir[1] =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). cur_dir[0]; |
| 4345 | |
| 4346 | cur_dist[0] = dist; |
| 4347 | cur_obj[0] = g_obj; |
| 4348 | cur_dir[0] =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). to; |
| 4349 | |
| 4350 | (*cur_num_near)++; |
| 4351 | } else if (cur_dist[1] > dist) { |
| 4352 | cur_dist[1] = dist; |
| 4353 | cur_obj[1] = g_obj; |
| 4354 | cur_dir[1] =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). to; |
| 4355 | |
| 4356 | (*cur_num_near)++; |
| 4357 | } |
| 4358 | |
| 4359 | if (*cur_num_near > 2) |
| 4360 | *cur_num_near = 2; |
| 4361 | } |
| 4362 | } |
| 4363 | } |
| 4364 | } |
| 4365 | |
| 4366 | // MTS: unused? |
| 4367 | float AIDetermineGoalInfluencecxx . . $ AIDetermineGoalInfluence(6a4f694e6376b3b8).(objectcxx . . $ object# *obj, goalcxx . . $ goal# *goal) { |
| 4368 | float influence = goal->influencecxx . . $ goal#$anonymous_type_4#influence.; |
| 4369 | int g_index = goal - obj->ai_infocxx . . $ object#ai_info.->goalscxx . . $ ai_frame#goals.; |
| 4370 | |
| 4371 | if (goal->flagscxx . . $ goal#flags. & GF_SCRIPTED_INFLUENCEcxx . . $ `Descent3/aistruct_external.h:232:9`!) { |
| 4372 | AINotifycxx . . $ AINotify(f32b5964aaa42c22).(obj, AIN_SCRIPTED_INFLUENCEcxx . . $ `Descent3/aistruct_external.h:310:9`!, &g_index); |
| 4373 | influence = goal->influencecxx . . $ goal#$anonymous_type_4#influence.; |
| 4374 | } else if (goal->flagscxx . . $ goal#flags. & GF_RAMPED_INFLUENCEcxx . . $ `Descent3/aistruct_external.h:230:9`!) { |
| 4375 | float scale; |
| 4376 | const float dist = goal->dist_to_goalcxx . . $ goal#dist_to_goal.; // chrishack -- dist to goal must be properly updated for TRACK goals |
| 4377 | |
| 4378 | if (dist < goal->ramp_influence_distscxx . . $ goal#ramp_influence_dists.[1]) { |
| 4379 | float delta = dist - goal->ramp_influence_distscxx . . $ goal#ramp_influence_dists.[0]; |
| 4380 | float width = goal->ramp_influence_distscxx . . $ goal#ramp_influence_dists.[1] - goal->ramp_influence_distscxx . . $ goal#ramp_influence_dists.[0]; |
| 4381 | |
| 4382 | if (width > 0.0f) |
| 4383 | scale = delta / width; |
| 4384 | else |
| 4385 | scale = 0.0f; |
| 4386 | } else if (dist <= goal->ramp_influence_distscxx . . $ goal#ramp_influence_dists.[2]) { |
| 4387 | scale = 1.0f; |
| 4388 | } else { |
| 4389 | float delta = goal->ramp_influence_distscxx . . $ goal#ramp_influence_dists.[3] - dist; |
| 4390 | float width = goal->ramp_influence_distscxx . . $ goal#ramp_influence_dists.[3] - goal->ramp_influence_distscxx . . $ goal#ramp_influence_dists.[2]; |
| 4391 | |
| 4392 | if (width > 0.0f) |
| 4393 | scale = delta / width; |
| 4394 | else |
| 4395 | scale = 0.0f; |
| 4396 | } |
| 4397 | |
| 4398 | influence *= scale; |
| 4399 | } |
| 4400 | |
| 4401 | if ((goal->flagscxx . . $ goal#flags. & GF_MIN_MAX_INFLUENCEcxx . . $ `Descent3/aistruct_external.h:231:9`!) && influence < goal->min_influencecxx . . $ goal#min_influence.) { |
| 4402 | influence = goal->min_influencecxx . . $ goal#min_influence.; |
| 4403 | } |
| 4404 | |
| 4405 | return influence; |
| 4406 | } |
| 4407 | |
| 4408 | void AIDoOrientVelocitycxx . . $ AIDoOrientVelocity(419c470199a90a97).(objectcxx . . $ object# *obj) { |
| 4409 | ai_framecxx . . $ ai_frame# *ai_info = obj->ai_infocxx . . $ object#ai_info.; |
| 4410 | |
| 4411 | vectorcxx . . $ vector# dir = obj->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..velocitycxx . . $ physics_info#velocity.; |
| 4412 | float mag = vm_NormalizeVectorcxx . . $ vm_NormalizeVector(4939a7e530383cd4).(&dir); |
| 4413 | |
| 4414 | if (mag > 0.1f) { |
| 4415 | AITurnTowardsDircxx . . $ AITurnTowardsDir(cd233addd15cf1e2).(obj, &dir, ai_info->max_turn_ratecxx . . $ ai_frame#max_turn_rate.); |
| 4416 | } |
| 4417 | } |
| 4418 | |
| 4419 | void AIDoOrientDefaultcxx . . $ AIDoOrientDefault(419c470199a90a97).(objectcxx . . $ object# *obj) { |
| 4420 | ai_framecxx . . $ ai_frame# *ai_info = obj->ai_infocxx . . $ object#ai_info.; |
| 4421 | |
| 4422 | if ((obj->movement_typecxx . . $ object#movement_type. != MT_WALKINGcxx . . $ `Descent3/object_external.h:235:9`! && obj->movement_typecxx . . $ object#movement_type. != MT_PHYSICScxx . . $ `Descent3/object_external.h:234:9`!) || !(ai_info)) { |
| 4423 | return; |
| 4424 | } |
| 4425 | |
| 4426 | // The aware barely stuff can be improved by using emotional sliders to determine if the robot will |
| 4427 | // 'lose track' of its target -- chrishack -- also use last see target time with the agression slider |
| 4428 | if ((ai_info->flagscxx . . $ ai_frame#flags. & AIF_ORIENT_TO_VELcxx . . $ `Descent3/aistruct_external.h:370:9`!) || (ai_info->awarenesscxx . . $ ai_frame#awareness. <= AWARE_BARELYcxx . . $ `Descent3/aistruct_external.h:326:9`! && ai_info->agressioncxx . . $ ai_frame#agression. < 0.4f) || |
| 4429 | !ObjGetcxx . . $ ObjGet(11672e354c0b263a).(ai_info->target_handlecxx . . $ ai_frame#target_handle.)) { |
| 4430 | AIDoOrientVelocitycxx . . $ AIDoOrientVelocity(419c470199a90a97).(obj); |
| 4431 | } else { |
| 4432 | vectorcxx . . $ vector# to = ai_info->last_see_target_poscxx . . $ ai_frame#last_see_target_pos. -cxx . . $ operator-(b77b703cd1e43e33). obj->poscxx . . $ object#pos.; |
| 4433 | float dist = vm_NormalizeVectorcxx . . $ vm_NormalizeVector(4939a7e530383cd4).(&to); |
| 4434 | |
| 4435 | if (dist > .1f) |
| 4436 | AITurnTowardsDircxx . . $ AITurnTowardsDir(cd233addd15cf1e2).(obj, &to, ai_info->max_turn_ratecxx . . $ ai_frame#max_turn_rate.); |
| 4437 | } |
| 4438 | } |
| 4439 | |
| 4440 | void AIDoOrientcxx . . $ AIDoOrient(766a1b7183ffa4b4).(objectcxx . . $ object# *obj, int g_index) { |
| 4441 | ai_framecxx . . $ ai_frame# *ai_info = obj->ai_infocxx . . $ object#ai_info.; |
| 4442 | goalcxx . . $ goal# *goal_ptr = &ai_info->goalscxx . . $ ai_frame#goals.[g_index]; |
| 4443 | |
| 4444 | if ((obj->movement_typecxx . . $ object#movement_type. != MT_WALKINGcxx . . $ `Descent3/object_external.h:235:9`! && obj->movement_typecxx . . $ object#movement_type. != MT_PHYSICScxx . . $ `Descent3/object_external.h:234:9`!) || !(ai_info)) { |
| 4445 | return; |
| 4446 | } |
| 4447 | |
| 4448 | if ((g_index >= 0) && ISORIENTGOALcxx . . $ `Descent3/aistruct_external.h:258:9`!(&ai_info->goals[g_index])) { |
| 4449 | objectcxx . . $ object# *g_obj = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 4450 | |
| 4451 | if (goal_ptr->flagscxx . . $ goal#flags. & GF_ORIENT_FOR_ATTACHcxx . . $ `Descent3/aistruct_external.h:236:9`!) { |
| 4452 | Int3cxx . . $ `misc/pserror.h:247:9`!(); // chrishack -- not done |
| 4453 | } else if (goal_ptr->flagscxx . . $ goal#flags. & GF_ORIENT_TARGETcxx . . $ `Descent3/aistruct_external.h:233:9`!) { |
| 4454 | target_goal: |
| 4455 | |
| 4456 | g_obj = ObjGetcxx . . $ ObjGet(11672e354c0b263a).(ai_info->target_handlecxx . . $ ai_frame#target_handle.); |
| 4457 | if (g_obj) { |
| 4458 | vectorcxx . . $ vector# to = ai_info->last_see_target_poscxx . . $ ai_frame#last_see_target_pos. -cxx . . $ operator-(b77b703cd1e43e33). obj->poscxx . . $ object#pos.; |
| 4459 | float dist = vm_NormalizeVectorcxx . . $ vm_NormalizeVector(4939a7e530383cd4).(&to); |
| 4460 | |
| 4461 | if (dist > .1f) |
| 4462 | AITurnTowardsDircxx . . $ AITurnTowardsDir(cd233addd15cf1e2).(obj, &to, ai_info->max_turn_ratecxx . . $ ai_frame#max_turn_rate.); |
| 4463 | } else { |
| 4464 | AIDoOrientVelocitycxx . . $ AIDoOrientVelocity(419c470199a90a97).(obj); |
| 4465 | } |
| 4466 | } else if (OBJGOALcxx . . $ `Descent3/aistruct.h:668:9`!(goal_ptr) && (goal_ptr->flagscxx . . $ goal#flags. & GF_ORIENT_GOAL_OBJcxx . . $ `Descent3/aistruct_external.h:235:9`!)) { |
| 4467 | objectcxx . . $ object# *t_obj = ObjGetcxx . . $ ObjGet(11672e354c0b263a).(ai_info->target_handlecxx . . $ ai_frame#target_handle.); |
| 4468 | g_obj = ObjGetcxx . . $ ObjGet(11672e354c0b263a).(goal_ptr->g_infocxx . . $ goal#g_info..handlecxx . . $ goal_info#$anonymous_type_1#handle.); |
| 4469 | |
| 4470 | if (g_obj && (g_obj == t_obj)) |
| 4471 | goto target_goal; |
| 4472 | |
| 4473 | if (g_obj) { |
| 4474 | vectorcxx . . $ vector# to = g_obj->poscxx . . $ object#pos. -cxx . . $ operator-(b77b703cd1e43e33). obj->poscxx . . $ object#pos.; |
| 4475 | float dist = vm_NormalizeVectorcxx . . $ vm_NormalizeVector(4939a7e530383cd4).(&to); |
| 4476 | |
| 4477 | if (dist > .1f) |
| 4478 | AITurnTowardsDircxx . . $ AITurnTowardsDir(cd233addd15cf1e2).(obj, &to, ai_info->max_turn_ratecxx . . $ ai_frame#max_turn_rate.); |
| 4479 | } else { |
| 4480 | AIDoOrientVelocitycxx . . $ AIDoOrientVelocity(419c470199a90a97).(obj); |
| 4481 | } |
| 4482 | } else if (goal_ptr->flagscxx . . $ goal#flags. & GF_ORIENT_VELOCITYcxx . . $ `Descent3/aistruct_external.h:228:9`!) { |
| 4483 | AIDoOrientVelocitycxx . . $ AIDoOrientVelocity(419c470199a90a97).(obj); |
| 4484 | } else if (goal_ptr->flagscxx . . $ goal#flags. & GF_ORIENT_SCRIPTEDcxx . . $ `Descent3/aistruct_external.h:234:9`!) { |
| 4485 | AINotifycxx . . $ AINotify(f32b5964aaa42c22).(obj, AIN_SCRIPTED_ORIENTcxx . . $ `Descent3/aistruct_external.h:311:9`!, &g_index); |
| 4486 | } else if (goal_ptr->flagscxx . . $ goal#flags. & GF_ORIENT_PATH_NODEcxx . . $ `Descent3/aistruct_external.h:237:9`!) { |
| 4487 | vectorcxx . . $ vector# uvec = obj->orientcxx . . $ object#orient..uveccxx . . $ matrix#uvec.; |
| 4488 | vectorcxx . . $ vector# fvec = obj->orientcxx . . $ object#orient..fveccxx . . $ matrix#fvec.; |
| 4489 | |
| 4490 | ai_path_infocxx . . $ ai_path_info# *aip = &obj->ai_infocxx . . $ object#ai_info.->pathcxx . . $ ai_frame#path.; |
| 4491 | |
| 4492 | int n = aip->cur_nodecxx . . $ ai_path_info#cur_node.; |
| 4493 | int p = aip->cur_pathcxx . . $ ai_path_info#cur_path.; |
| 4494 | |
| 4495 | int p_id = aip->path_idcxx . . $ ai_path_info#path_id.[p]; |
| 4496 | |
| 4497 | bool f_reverse = (goal_ptr->flagscxx . . $ goal#flags. & GF_PATH_MOVE_REVERSE_DIRcxx . . $ `Descent3/aistruct_external.h:242:9`!) != 0; |
| 4498 | |
| 4499 | if (aip->path_typecxx . . $ ai_path_info#path_type.[p] == AIP_STATICcxx . . $ `Descent3/aistruct.h:483:9`!) { |
| 4500 | game_pathcxx . . $ game_path# *gp = &GamePathscxx . . $ GamePaths.[p_id]; |
| 4501 | vectorcxx . . $ vector# cur_pos; |
| 4502 | AIPathGetCurrentNodePoscxx . . $ AIPathGetCurrentNodePos(ea4bd046b9d29bc1).(aip, &cur_pos); |
| 4503 | |
| 4504 | if ((f_reverse) && (!AIPathAtEndcxx . . $ AIPathAtEnd(211cadd9cc3984f1).(aip))) { |
| 4505 | vectorcxx . . $ vector# next_pos; |
| 4506 | AIPathGetNextNodePoscxx . . $ AIPathGetNextNodePos(ea4bd046b9d29bc1).(aip, &next_pos, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!); |
| 4507 | |
| 4508 | vectorcxx . . $ vector# proj = obj->poscxx . . $ object#pos. -cxx . . $ operator-(b77b703cd1e43e33). next_pos; |
| 4509 | vectorcxx . . $ vector# line = cur_pos -cxx . . $ operator-(b77b703cd1e43e33). next_pos; |
| 4510 | float line_len = vm_NormalizeVectorcxx . . $ vm_NormalizeVector(4939a7e530383cd4).(&line); |
| 4511 | float proj_len = proj *cxx . . $ `operator*`(4a721543d64e126a). line; |
| 4512 | |
| 4513 | if (proj_len > 0.0) { |
| 4514 | if (proj_len > line_len) |
| 4515 | return; // We should have updated nodes |
| 4516 | |
| 4517 | float scale1 = proj_len / line_len; |
| 4518 | float scale2 = 1.0f - scale1; |
| 4519 | |
| 4520 | fvec =cxx . . $ vector#`operator=`(c0842353a20857d). (scale1 *cxx . . $ `operator*`(9d6577ff3e9faa29). gp->pathnodescxx . . $ game_path#pathnodes.[n].fveccxx . . $ node#fvec. +cxx . . $ operator+(b77b703cd1e43e33). scale2 *cxx . . $ `operator*`(9d6577ff3e9faa29). gp->pathnodescxx . . $ game_path#pathnodes.[n + 1].fveccxx . . $ node#fvec.); |
| 4521 | uvec =cxx . . $ vector#`operator=`(c0842353a20857d). (scale1 *cxx . . $ `operator*`(9d6577ff3e9faa29). gp->pathnodescxx . . $ game_path#pathnodes.[n].uveccxx . . $ node#uvec. +cxx . . $ operator+(b77b703cd1e43e33). scale2 *cxx . . $ `operator*`(9d6577ff3e9faa29). gp->pathnodescxx . . $ game_path#pathnodes.[n + 1].uveccxx . . $ node#uvec.); |
| 4522 | } |
| 4523 | } else if ((!f_reverse) && (!AIPathAtStartcxx . . $ AIPathAtStart(211cadd9cc3984f1).(aip))) { |
| 4524 | vectorcxx . . $ vector# prev_pos; |
| 4525 | AIPathGetPrevNodePoscxx . . $ AIPathGetPrevNodePos(ea4bd046b9d29bc1).(aip, &prev_pos, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!); |
| 4526 | |
| 4527 | vectorcxx . . $ vector# proj = obj->poscxx . . $ object#pos. -cxx . . $ operator-(b77b703cd1e43e33). prev_pos; |
| 4528 | vectorcxx . . $ vector# line = cur_pos -cxx . . $ operator-(b77b703cd1e43e33). prev_pos; |
| 4529 | float line_len = vm_NormalizeVectorcxx . . $ vm_NormalizeVector(4939a7e530383cd4).(&line); |
| 4530 | float proj_len = proj *cxx . . $ `operator*`(4a721543d64e126a). line; |
| 4531 | |
| 4532 | if (proj_len > 0.0) { |
| 4533 | if (proj_len > line_len) |
| 4534 | return; // We should have updated nodes |
| 4535 | |
| 4536 | float scale1 = proj_len / line_len; |
| 4537 | float scale2 = 1.0f - scale1; |
| 4538 | |
| 4539 | fvec =cxx . . $ vector#`operator=`(c0842353a20857d). (scale1 *cxx . . $ `operator*`(9d6577ff3e9faa29). gp->pathnodescxx . . $ game_path#pathnodes.[n].fveccxx . . $ node#fvec. +cxx . . $ operator+(b77b703cd1e43e33). scale2 *cxx . . $ `operator*`(9d6577ff3e9faa29). gp->pathnodescxx . . $ game_path#pathnodes.[n - 1].fveccxx . . $ node#fvec.); |
| 4540 | uvec =cxx . . $ vector#`operator=`(c0842353a20857d). (scale1 *cxx . . $ `operator*`(9d6577ff3e9faa29). gp->pathnodescxx . . $ game_path#pathnodes.[n].uveccxx . . $ node#uvec. +cxx . . $ operator+(b77b703cd1e43e33). scale2 *cxx . . $ `operator*`(9d6577ff3e9faa29). gp->pathnodescxx . . $ game_path#pathnodes.[n - 1].uveccxx . . $ node#uvec.); |
| 4541 | } |
| 4542 | } |
| 4543 | |
| 4544 | matrixcxx . . $ matrix# orient; |
| 4545 | vm_VectorToMatrixcxx . . $ vm_VectorToMatrix(543233b88555916d).(&orient, &fvec, &uvec, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!); |
| 4546 | |
| 4547 | AITurnTowardsMatrixcxx . . $ AITurnTowardsMatrix(4158910ac60c491b).(obj, ai_info->max_turn_ratecxx . . $ ai_frame#max_turn_rate., &orient); |
| 4548 | } |
| 4549 | } else if (goal_ptr->flagscxx . . $ goal#flags. & GF_ORIENT_SET_FVEC_UVECcxx . . $ `Descent3/aistruct_external.h:247:9`!) { |
| 4550 | matrixcxx . . $ matrix# orient; |
| 4551 | vm_VectorToMatrixcxx . . $ vm_VectorToMatrix(543233b88555916d).(&orient, &goal_ptr->set_fveccxx . . $ goal#set_fvec., &goal_ptr->set_uveccxx . . $ goal#set_uvec., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!); |
| 4552 | |
| 4553 | AITurnTowardsMatrixcxx . . $ AITurnTowardsMatrix(4158910ac60c491b).(obj, ai_info->max_turn_ratecxx . . $ ai_frame#max_turn_rate., &orient); |
| 4554 | } else if (goal_ptr->flagscxx . . $ goal#flags. & GF_ORIENT_SET_FVECcxx . . $ `Descent3/aistruct_external.h:246:9`!) { |
| 4555 | AITurnTowardsDircxx . . $ AITurnTowardsDir(cd233addd15cf1e2).(obj, &goal_ptr->set_fveccxx . . $ goal#set_fvec., ai_info->max_turn_ratecxx . . $ ai_frame#max_turn_rate.); |
| 4556 | } else { |
| 4557 | AIDoOrientDefaultcxx . . $ AIDoOrientDefault(419c470199a90a97).(obj); |
| 4558 | } |
| 4559 | } else { |
| 4560 | AIDoOrientDefaultcxx . . $ AIDoOrientDefault(419c470199a90a97).(obj); |
| 4561 | } |
| 4562 | } |
| 4563 | |
| 4564 | void AIDetermineSpeedcxx . . $ AIDetermineSpeed(2aa63262ee1f5e07).(objectcxx . . $ object# *obj, int flags, float *speed) { |
| 4565 | float n_speed = 1.0f; |
| 4566 | |
| 4567 | switch (flags & GF_SPEED_MASKcxx . . $ `Descent3/aistruct_external.h:248:9`!) { |
| 4568 | case GF_SPEED_ATTACKcxx . . $ `Descent3/aistruct_external.h:252:9`!: |
| 4569 | n_speed = obj->ai_infocxx . . $ object#ai_info.->attack_vel_percentcxx . . $ ai_frame#attack_vel_percent.; |
| 4570 | break; |
| 4571 | case GF_SPEED_DODGEcxx . . $ `Descent3/aistruct_external.h:250:9`!: |
| 4572 | n_speed = obj->ai_infocxx . . $ object#ai_info.->dodge_vel_percentcxx . . $ ai_frame#dodge_vel_percent.; |
| 4573 | break; |
| 4574 | case GF_SPEED_FLEEcxx . . $ `Descent3/aistruct_external.h:251:9`!: |
| 4575 | n_speed = obj->ai_infocxx . . $ object#ai_info.->flee_vel_percentcxx . . $ ai_frame#flee_vel_percent.; |
| 4576 | break; |
| 4577 | } |
| 4578 | |
| 4579 | if (n_speed > *speed) { |
| 4580 | *speed = n_speed; |
| 4581 | } |
| 4582 | } |
| 4583 | |
| 4584 | void ai_movecxx . . $ ai_move(419c470199a90a97).(objectcxx . . $ object# *obj) { |
| 4585 | ai_framecxx . . $ ai_frame# *ai_info = obj->ai_infocxx . . $ object#ai_info.; |
| 4586 | int i; |
| 4587 | bool f_dodge = false; // Are there any dodge goals |
| 4588 | bool f_avoid = false; // Are there any avoid goals |
| 4589 | int highest_influence_goal = -1; |
| 4590 | float highest_influence = 0.0f; |
| 4591 | float highest_speed = 0.0f; |
| 4592 | bool f_turned = true; |
| 4593 | bool f_goal_found = false; |
| 4594 | |
| 4595 | // Post project GB Hacks to make him more combat friendly... |
| 4596 | if (IS_GUIDEBOTcxx . . $ `Descent3/objinfo.h:363:9`!(obj)) { |
| 4597 | if (ai_info->flagscxx . . $ ai_frame#flags. & AIF_GB_MIMIC_PLAYER_FIRING_HACKcxx . . $ `Descent3/aistruct_external.h:351:9`!) |
| 4598 | ai_info->flagscxx . . $ ai_frame#flags. &= ~AIF_DODGEcxx . . $ `Descent3/aistruct_external.h:355:9`!; |
| 4599 | else |
| 4600 | ai_info->flagscxx . . $ ai_frame#flags. |= AIF_DODGEcxx . . $ `Descent3/aistruct_external.h:355:9`!; |
| 4601 | } |
| 4602 | // int num_objects; |
| 4603 | // object *g_objs[5]; // 1 target + 2 enemies + 2 freinds |
| 4604 | |
| 4605 | objectcxx . . $ object# *targetptr = ObjGetcxx . . $ ObjGet(11672e354c0b263a).(ai_info->target_handlecxx . . $ ai_frame#target_handle.); // The target of this AI |
| 4606 | ai_info->movement_dircxx . . $ ai_frame#movement_dir. =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). Zero_vectorcxx . . $ Zero_vector.; |
| 4607 | |
| 4608 | // Hacked flocking code |
| 4609 | if (ai_info->ai_typecxx . . $ ai_frame#ai_type. == AIT_BIRD_FLOCK1cxx . . $ `Descent3/aistruct_external.h:81:9`!) { |
| 4610 | vectorcxx . . $ vector# composite_dir = Zero_vectorcxx . . $ Zero_vector.; |
| 4611 | |
| 4612 | for (int temp = 0; temp < AI_FriendNumNearcxx . . $ AI_FriendNumNear.; temp++) { |
| 4613 | objectcxx . . $ object# *g_obj = AI_FriendObjcxx . . $ AI_FriendObj.[temp]; |
| 4614 | |
| 4615 | ASSERTcxx . . $ `misc/pserror.h:246:9`!(g_obj->type != OBJ_WEAPONcxx . . $ `Descent3/object_external.h:165:9`!); |
| 4616 | ASSERTcxx . . $ `misc/pserror.h:246:9`!(g_obj != obj); |
| 4617 | |
| 4618 | AIGoalDoRepulsecxx . . $ AIGoalDoRepulse(7da590384b204f40).(obj, AI_FriendDistcxx . . $ AI_FriendDist.[temp], &AI_FriendDircxx . . $ AI_FriendDir.[temp], NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, &composite_dir); |
| 4619 | AIGoalDoAlignmentcxx . . $ AIGoalDoAlignment(7da590384b204f40).(obj, AI_FriendDistcxx . . $ AI_FriendDist.[temp], &g_obj->orientcxx . . $ object#orient..fveccxx . . $ matrix#fvec., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, &composite_dir); |
| 4620 | AIGoalDoCohesioncxx . . $ AIGoalDoCohesion(6d8f4adb736eccd0).(obj, g_obj, AI_FriendDistcxx . . $ AI_FriendDist.[temp], NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, &composite_dir); |
| 4621 | f_goal_found = true; |
| 4622 | } |
| 4623 | |
| 4624 | // Facing code |
| 4625 | if (composite_dir ==cxx . . $ `operator==`(718c890c104af0f3). Zero_vectorcxx . . $ Zero_vector.) |
| 4626 | composite_dir =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). obj->orientcxx . . $ object#orient..fveccxx . . $ matrix#fvec.; |
| 4627 | |
| 4628 | // FLOCK HEIGHT CODE |
| 4629 | if (ROOMNUM_OUTSIDEcxx . . $ `lib/object_external_struct.h:127:9`!(obj->roomnum) && (ai_info->flagscxx . . $ ai_frame#flags. & AIF_BIASED_FLIGHT_HEIGHTcxx . . $ `Descent3/aistruct_external.h:379:9`!)) { |
| 4630 | composite_dir.ycxx . . $ vector#y. *= .5f; |
| 4631 | |
| 4632 | float delta = obj->poscxx . . $ object#pos..ycxx . . $ vector#y. - GetTerrainGroundPointcxx . . $ GetTerrainGroundPoint(a0b9c8659ecc16b8).(&obj->poscxx . . $ object#pos.) - obj->sizecxx . . $ object#size.; |
| 4633 | if (delta < ai_info->biased_flight_mincxx . . $ ai_frame#biased_flight_min.) { |
| 4634 | if (composite_dir.ycxx . . $ vector#y. < 0.0) |
| 4635 | composite_dir.ycxx . . $ vector#y. *= .5f; |
| 4636 | else |
| 4637 | composite_dir.ycxx . . $ vector#y. *= 4.0f; |
| 4638 | } else if (delta > ai_info->biased_flight_maxcxx . . $ ai_frame#biased_flight_max.) { |
| 4639 | if (composite_dir.ycxx . . $ vector#y. < 0.0) |
| 4640 | composite_dir.ycxx . . $ vector#y. *= 4.0f; |
| 4641 | else |
| 4642 | composite_dir.ycxx . . $ vector#y. *= 0.5f; |
| 4643 | } |
| 4644 | |
| 4645 | float max_fly_upward_height = ai_info->biased_flight_mincxx . . $ ai_frame#biased_flight_min. * ai_info->biased_flight_importancecxx . . $ ai_frame#biased_flight_importance.; |
| 4646 | if (delta < max_fly_upward_height) { |
| 4647 | composite_dir.ycxx . . $ vector#y. += (1.0f - (delta / max_fly_upward_height)) * ai_info->biased_flight_importancecxx . . $ ai_frame#biased_flight_importance.; |
| 4648 | } |
| 4649 | } |
| 4650 | |
| 4651 | vm_NormalizeVectorcxx . . $ vm_NormalizeVector(4939a7e530383cd4).(&composite_dir); |
| 4652 | |
| 4653 | AIMoveTowardsDircxx . . $ AIMoveTowardsDir(cd233addd15cf1e2).(obj, &composite_dir, 1.0f); |
| 4654 | AITurnTowardsDircxx . . $ AITurnTowardsDir(cd233addd15cf1e2).(obj, &composite_dir, ai_info->max_turn_ratecxx . . $ ai_frame#max_turn_rate.); |
| 4655 | return; |
| 4656 | } |
| 4657 | |
| 4658 | // Stop objects that have not been active lately |
| 4659 | if (!(ai_info->flagscxx . . $ ai_frame#flags. & AIF_PERSISTANTcxx . . $ `Descent3/aistruct_external.h:354:9`!) && Gametimecxx . . $ Gametime. - ai_info->last_see_target_timecxx . . $ ai_frame#last_see_target_time. > CHECK_VIS_INFREQUENTLY_TIMEcxx . . $ `Descent3/AImain.cpp:1552:9`! && |
| 4660 | Gametimecxx . . $ Gametime. - ai_info->last_hear_target_timecxx . . $ ai_frame#last_hear_target_time. > CHECK_VIS_INFREQUENTLY_TIMEcxx . . $ `Descent3/AImain.cpp:1552:9`! && ai_info->awarenesscxx . . $ ai_frame#awareness. == AWARE_NONEcxx . . $ `Descent3/aistruct_external.h:327:9`!) { |
| 4661 | obj->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..velocitycxx . . $ physics_info#velocity. =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). Zero_vectorcxx . . $ Zero_vector.; |
| 4662 | obj->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..rotvelcxx . . $ physics_info#$anonymous_type_1#rotvel. =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). Zero_vectorcxx . . $ Zero_vector.; |
| 4663 | } else { |
| 4664 | // Determine movement stuff |
| 4665 | if (obj->movement_typecxx . . $ object#movement_type. == MT_PHYSICScxx . . $ `Descent3/object_external.h:234:9`! || obj->movement_typecxx . . $ object#movement_type. == MT_WALKINGcxx . . $ `Descent3/object_external.h:235:9`!) { |
| 4666 | if (targetptr && IsTargetLocalcxx . . $ IsTargetLocal(9fa7d4d2c8b4c2db).(obj, targetptr) || (ai_info->awarenesscxx . . $ ai_frame#awareness. >= AWARE_BARELYcxx . . $ `Descent3/aistruct_external.h:326:9`!) || |
| 4667 | (ai_info->flagscxx . . $ ai_frame#flags. & AIF_PERSISTANTcxx . . $ `Descent3/aistruct_external.h:354:9`!)) { |
| 4668 | for (i = NUM_ACTIVATION_LEVELScxx . . $ `Descent3/aistruct_external.h:279:9`!; i < MAX_GOALScxx . . $ `Descent3/aistruct_external.h:178:9`!; i++) { |
| 4669 | if (ai_info->goalscxx . . $ ai_frame#goals.[i].usedcxx . . $ goal#used.) { |
| 4670 | if (GoalIsGoalEnabledcxx . . $ GoalIsGoalEnabled(9985ed114f2bfc78).(obj, i)) { |
| 4671 | if (ai_info->goalscxx . . $ ai_frame#goals.[i].typecxx . . $ goal#type. == AIG_DODGE_OBJcxx . . $ `Descent3/aistruct_external.h:194:9`!) { |
| 4672 | f_goal_found = true; |
| 4673 | if (goal_do_dodgecxx . . $ goal_do_dodge(9985ed114f2bfc78).(obj, i)) { |
| 4674 | f_dodge = true; |
| 4675 | AIDetermineSpeedcxx . . $ AIDetermineSpeed(2aa63262ee1f5e07).(obj, ai_info->goalscxx . . $ ai_frame#goals.[i].flagscxx . . $ goal#flags., &highest_speed); |
| 4676 | |
| 4677 | #ifdef _DEBUGcxx . . $ `<built-in>:482:9`! |
| 4678 | if (AI_debug_robot_docxx . . $ AI_debug_robot_do. && OBJNUMcxx . . $ `Descent3/object.h:700:9`!(obj) == AI_debug_robot_indexcxx . . $ AI_debug_robot_index.) { |
| 4679 | mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "AI Note: Dodging\n"); |
| 4680 | } |
| 4681 | #endif |
| 4682 | } |
| 4683 | } else if (ai_info->goalscxx . . $ ai_frame#goals.[i].typecxx . . $ goal#type. == AIG_MELEE_TARGETcxx . . $ `Descent3/aistruct_external.h:186:9`!) { |
| 4684 | f_goal_found = true; |
| 4685 | AiMeleecxx . . $ AiMelee(39516aeee13ca5ab).(obj); |
| 4686 | AIDetermineSpeedcxx . . $ AIDetermineSpeed(2aa63262ee1f5e07).(obj, ai_info->goalscxx . . $ ai_frame#goals.[i].flagscxx . . $ goal#flags., &highest_speed); |
| 4687 | |
| 4688 | #ifdef _DEBUGcxx . . $ `<built-in>:482:9`! |
| 4689 | if (AI_debug_robot_docxx . . $ AI_debug_robot_do. && OBJNUMcxx . . $ `Descent3/object.h:700:9`!(obj) == AI_debug_robot_indexcxx . . $ AI_debug_robot_index.) { |
| 4690 | mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "AI Note: Melee\n"); |
| 4691 | } |
| 4692 | #endif |
| 4693 | } else if (ai_info->goalscxx . . $ ai_frame#goals.[i].typecxx . . $ goal#type. == AIG_GET_AROUND_OBJcxx . . $ `Descent3/aistruct_external.h:203:9`!) { |
| 4694 | f_goal_found = true; |
| 4695 | |
| 4696 | goalcxx . . $ goal# *cur_goal = &ai_info->goalscxx . . $ ai_frame#goals.[i]; |
| 4697 | objectcxx . . $ object# *g_obj = ObjGetcxx . . $ ObjGet(11672e354c0b263a).(cur_goal->g_infocxx . . $ goal#g_info..handlecxx . . $ goal_info#$anonymous_type_1#handle.); |
| 4698 | float dist = cur_goal->circle_distancecxx . . $ goal#circle_distance.; |
| 4699 | |
| 4700 | vectorcxx . . $ vector# adir; |
| 4701 | |
| 4702 | if (!g_obj || (g_obj == obj) || ObjectsAreRelatedcxx . . $ ObjectsAreRelated(cf9ef193275fa6d8).(OBJNUMcxx . . $ `Descent3/object.h:700:9`!(obj), OBJNUMcxx . . $ `Descent3/object.h:700:9`!(g_obj))) |
| 4703 | continue; |
| 4704 | |
| 4705 | float cur_dist = vm_VectorDistancecxx . . $ vm_VectorDistance(e65d563e2b53cc54).(&obj->poscxx . . $ object#pos., &g_obj->poscxx . . $ object#pos.) - obj->sizecxx . . $ object#size. - g_obj->sizecxx . . $ object#size.; |
| 4706 | if (cur_dist < 0.0) |
| 4707 | cur_dist = 0.0f; |
| 4708 | |
| 4709 | if (cur_dist > dist) |
| 4710 | continue; |
| 4711 | |
| 4712 | // Scale the life perservation too (if enemy DAMN GOOD IDEA - expand AVOID SIZE too) -- chrishack |
| 4713 | // Linear scale by distance |
| 4714 | float scale = cur_goal->influencecxx . . $ goal#$anonymous_type_4#influence. * ((dist - cur_dist) / dist); |
| 4715 | |
| 4716 | if (AiGoalAvoidcxx . . $ AiGoalAvoid(b73dfffb7c1354e0).(&adir, obj, g_obj, dist)) { |
| 4717 | #ifdef _DEBUGcxx . . $ `<built-in>:482:9`! |
| 4718 | if (AI_debug_robot_docxx . . $ AI_debug_robot_do. && OBJNUMcxx . . $ `Descent3/object.h:700:9`!(obj) == AI_debug_robot_indexcxx . . $ AI_debug_robot_index.) { |
| 4719 | mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "AI Note: Avoiding object\n"); |
| 4720 | } |
| 4721 | #endif |
| 4722 | |
| 4723 | ai_info->movement_dircxx . . $ ai_frame#movement_dir. +=cxx . . $ `operator+=`(801a8d6f7ab7bef9). (adir *cxx . . $ `operator*`(252247219a31502c). scale); |
| 4724 | f_avoid = true; |
| 4725 | AIDetermineSpeedcxx . . $ AIDetermineSpeed(2aa63262ee1f5e07).(obj, ai_info->goalscxx . . $ ai_frame#goals.[i].flagscxx . . $ goal#flags., &highest_speed); |
| 4726 | } |
| 4727 | } |
| 4728 | } |
| 4729 | } |
| 4730 | } |
| 4731 | |
| 4732 | if (ai_info->flagscxx . . $ ai_frame#flags. & AIF_AUTO_AVOID_FRIENDScxx . . $ `Descent3/aistruct_external.h:376:9`!) { |
| 4733 | objectcxx . . $ object# *g_obj; |
| 4734 | vectorcxx . . $ vector# adir; |
| 4735 | |
| 4736 | f_goal_found = true; |
| 4737 | |
| 4738 | int16_t near_objs[10]; |
| 4739 | |
| 4740 | float avoid_dist; |
| 4741 | |
| 4742 | avoid_dist = ai_info->avoid_friends_distancecxx . . $ ai_frame#avoid_friends_distance.; |
| 4743 | |
| 4744 | // We avoid friends more when we are in close proximity of our target |
| 4745 | if (AIObjEnemycxx . . $ AIObjEnemy(9fa7d4d2c8b4c2db).(obj, ObjGetcxx . . $ ObjGet(11672e354c0b263a).(ai_info->target_handlecxx . . $ ai_frame#target_handle.)) && (ai_info->status_regcxx . . $ ai_frame#status_reg. & AISR_CIRCLE_DISTcxx . . $ `Descent3/aistruct_external.h:396:9`!)) |
| 4746 | avoid_dist *= 2.3f; |
| 4747 | |
| 4748 | int num_near = fvi_QuickDistObjectListcxx . . $ fvi_QuickDistObjectList(85643dfbd17d1ac8).(&obj->poscxx . . $ object#pos., obj->roomnumcxx . . $ object#roomnum., ai_info->avoid_friends_distancecxx . . $ ai_frame#avoid_friends_distance. + obj->sizecxx . . $ object#size., |
| 4749 | near_objs, 10, false, true); |
| 4750 | |
| 4751 | for (int temp = 0; temp < num_near; temp++) { |
| 4752 | g_obj = &Objectscxx . . $ Objects.[near_objs[temp]]; |
| 4753 | |
| 4754 | if (g_obj->typecxx . . $ object#type. == OBJ_POWERUPcxx . . $ `Descent3/object_external.h:167:9`! || (g_obj == obj) || ObjectsAreRelatedcxx . . $ ObjectsAreRelated(cf9ef193275fa6d8).(OBJNUMcxx . . $ `Descent3/object.h:700:9`!(obj), near_objs[temp])) |
| 4755 | continue; |
| 4756 | |
| 4757 | if (!AIObjFriendcxx . . $ AIObjFriend(9fa7d4d2c8b4c2db).(obj, g_obj)) |
| 4758 | continue; |
| 4759 | |
| 4760 | float cur_dist = vm_VectorDistancecxx . . $ vm_VectorDistance(e65d563e2b53cc54).(&obj->poscxx . . $ object#pos., &g_obj->poscxx . . $ object#pos.) - obj->sizecxx . . $ object#size. - g_obj->sizecxx . . $ object#size.; |
| 4761 | if (cur_dist < 0.0) |
| 4762 | cur_dist = 0.0f; |
| 4763 | |
| 4764 | if (cur_dist > ai_info->avoid_friends_distancecxx . . $ ai_frame#avoid_friends_distance.) |
| 4765 | continue; |
| 4766 | |
| 4767 | if (AiGoalAvoidcxx . . $ AiGoalAvoid(b73dfffb7c1354e0).(&adir, obj, g_obj, ai_info->avoid_friends_distancecxx . . $ ai_frame#avoid_friends_distance.)) { |
| 4768 | float scale = 1.0f - cur_dist / ai_info->avoid_friends_distancecxx . . $ ai_frame#avoid_friends_distance.; |
| 4769 | if (scale < 0.01f) |
| 4770 | scale = 0.01f; |
| 4771 | |
| 4772 | ai_info->movement_dircxx . . $ ai_frame#movement_dir. +=cxx . . $ `operator+=`(801a8d6f7ab7bef9). (adir *cxx . . $ `operator*`(252247219a31502c). scale); |
| 4773 | f_avoid = true; |
| 4774 | AIDetermineSpeedcxx . . $ AIDetermineSpeed(2aa63262ee1f5e07).(obj, GF_SPEED_NORMALcxx . . $ `Descent3/aistruct_external.h:249:9`!, &highest_speed); |
| 4775 | |
| 4776 | #ifdef _DEBUGcxx . . $ `<built-in>:482:9`! |
| 4777 | if (AI_debug_robot_docxx . . $ AI_debug_robot_do. && OBJNUMcxx . . $ `Descent3/object.h:700:9`!(obj) == AI_debug_robot_indexcxx . . $ AI_debug_robot_index.) { |
| 4778 | mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "AI Note: Auto avoid friends.\n"); |
| 4779 | } |
| 4780 | #endif |
| 4781 | } |
| 4782 | } |
| 4783 | } |
| 4784 | |
| 4785 | if (ai_info->flagscxx . . $ ai_frame#flags. & AIF_AVOID_WALLScxx . . $ `Descent3/aistruct_external.h:361:9`!) { |
| 4786 | if (goal_do_avoid_wallscxx . . $ goal_do_avoid_walls(723205ab969e3cce).(obj, &ai_info->movement_dircxx . . $ ai_frame#movement_dir.)) { |
| 4787 | f_avoid = true; |
| 4788 | AIDetermineSpeedcxx . . $ AIDetermineSpeed(2aa63262ee1f5e07).(obj, GF_SPEED_NORMALcxx . . $ `Descent3/aistruct_external.h:249:9`!, &highest_speed); |
| 4789 | |
| 4790 | #ifdef _DEBUGcxx . . $ `<built-in>:482:9`! |
| 4791 | if (AI_debug_robot_docxx . . $ AI_debug_robot_do. && OBJNUMcxx . . $ `Descent3/object.h:700:9`!(obj) == AI_debug_robot_indexcxx . . $ AI_debug_robot_index.) { |
| 4792 | mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "AI Note: Avoiding walls\n"); |
| 4793 | } |
| 4794 | #endif |
| 4795 | } |
| 4796 | } |
| 4797 | |
| 4798 | goalcxx . . $ goal# *cur_goal = GoalGetCurrentGoalcxx . . $ GoalGetCurrentGoal(6a99c6e9427d0d95).(obj); |
| 4799 | vectorcxx . . $ vector# goal_mdir; |
| 4800 | bool goal_f_moved = false; |
| 4801 | bool goal_mset = false; |
| 4802 | |
| 4803 | if (cur_goal) { |
| 4804 | f_goal_found = true; |
| 4805 | highest_influence_goal = cur_goal - ai_info->goalscxx . . $ ai_frame#goals.; |
| 4806 | f_turned = false; |
| 4807 | AIDetermineSpeedcxx . . $ AIDetermineSpeed(2aa63262ee1f5e07).(obj, cur_goal->flagscxx . . $ goal#flags., &highest_speed); |
| 4808 | |
| 4809 | switch (cur_goal->typecxx . . $ goal#type.) { |
| 4810 | case AIG_SCRIPTEDcxx . . $ `Descent3/aistruct_external.h:197:9`!: { |
| 4811 | int g_index = cur_goal - ai_info->goalscxx . . $ ai_frame#goals.; |
| 4812 | AINotifycxx . . $ AINotify(f32b5964aaa42c22).(obj, AIN_SCRIPTED_GOALcxx . . $ `Descent3/aistruct_external.h:304:9`!, &g_index); // Assume that it modifies the movement vec |
| 4813 | |
| 4814 | int goal_mscale = vm_NormalizeVectorcxx . . $ vm_NormalizeVector(4939a7e530383cd4).(&ai_info->movement_dircxx . . $ ai_frame#movement_dir.); |
| 4815 | goal_mdir =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). ai_info->movement_dircxx . . $ ai_frame#movement_dir.; |
| 4816 | |
| 4817 | if (goal_mscale > highest_speed) { |
| 4818 | highest_speed = goal_mscale; |
| 4819 | } |
| 4820 | |
| 4821 | goal_mset = true; |
| 4822 | } break; |
| 4823 | |
| 4824 | case AIG_GUARD_AREAcxx . . $ `Descent3/aistruct_external.h:191:9`!: // Chrishack -- this goal could probably be removed |
| 4825 | { |
| 4826 | if (!(cur_goal->status_regcxx . . $ goal#status_reg. & AISR_CIRCLE_DISTcxx . . $ `Descent3/aistruct_external.h:396:9`!)) { |
| 4827 | if (cur_goal->g_infocxx . . $ goal#g_info..roomnumcxx . . $ goal_info#$anonymous_type_1#roomnum. != obj->roomnumcxx . . $ object#roomnum.) { |
| 4828 | cur_goal->g_infocxx . . $ goal#g_info..roomnumcxx . . $ goal_info#$anonymous_type_1#roomnum. = obj->roomnumcxx . . $ object#roomnum.; |
| 4829 | cur_goal->g_infocxx . . $ goal#g_info..poscxx . . $ goal_info#$anonymous_type_2#pos. =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). obj->poscxx . . $ object#pos.; |
| 4830 | } |
| 4831 | |
| 4832 | AIMoveTowardsPositioncxx . . $ AIMoveTowardsPosition(e4ea9f4f5d132a1c).(obj, &cur_goal->g_infocxx . . $ goal#g_info..poscxx . . $ goal_info#$anonymous_type_2#pos., 1.0f, false, &goal_mdir, &goal_f_moved); |
| 4833 | goal_mset = true; |
| 4834 | } |
| 4835 | } break; |
| 4836 | |
| 4837 | case AIG_GET_TO_OBJcxx . . $ `Descent3/aistruct_external.h:183:9`!: |
| 4838 | case AIG_GET_TO_POScxx . . $ `Descent3/aistruct_external.h:201:9`!: |
| 4839 | case AIG_WANDER_AROUNDcxx . . $ `Descent3/aistruct_external.h:187:9`!: |
| 4840 | case AIG_FOLLOW_PATHcxx . . $ `Descent3/aistruct_external.h:195:9`!: |
| 4841 | case AIG_PLACE_OBJ_ON_OBJcxx . . $ `Descent3/aistruct_external.h:189:9`!: |
| 4842 | case AIG_ATTACH_TO_OBJcxx . . $ `Descent3/aistruct_external.h:184:9`!: { |
| 4843 | if ((cur_goal->typecxx . . $ goal#type. == AIG_ATTACH_TO_OBJcxx . . $ `Descent3/aistruct_external.h:184:9`! || cur_goal->typecxx . . $ goal#type. == AIG_PLACE_OBJ_ON_OBJcxx . . $ `Descent3/aistruct_external.h:189:9`!) && |
| 4844 | (cur_goal->status_regcxx . . $ goal#status_reg. & AISR_CIRCLE_DISTcxx . . $ `Descent3/aistruct_external.h:396:9`!)) { |
| 4845 | objectcxx . . $ object# *g_obj = ObjGetcxx . . $ ObjGet(11672e354c0b263a).(cur_goal->g_infocxx . . $ goal#g_info..handlecxx . . $ goal_info#$anonymous_type_1#handle.); |
| 4846 | objectcxx . . $ object# *child_obj = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 4847 | |
| 4848 | if (cur_goal->typecxx . . $ goal#type. == AIG_PLACE_OBJ_ON_OBJcxx . . $ `Descent3/aistruct_external.h:189:9`!) { |
| 4849 | child_obj = ObjGetcxx . . $ ObjGet(11672e354c0b263a).(obj->attach_childrencxx . . $ object#attach_children.[0]); |
| 4850 | |
| 4851 | if (child_obj == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) { |
| 4852 | cur_goal->flagscxx . . $ goal#flags. &= ~(GF_NONFLUSHABLEcxx . . $ `Descent3/aistruct_external.h:216:9`! | GF_KEEP_AT_COMPLETIONcxx . . $ `Descent3/aistruct_external.h:218:9`!); |
| 4853 | GoalClearGoalcxx . . $ GoalClearGoal(5f6922bcf6358e70).(obj, cur_goal, AIN_GOAL_INVALIDcxx . . $ `Descent3/aistruct_external.h:303:9`!); |
| 4854 | return; |
| 4855 | } |
| 4856 | } |
| 4857 | |
| 4858 | vectorcxx . . $ vector# pos; |
| 4859 | matrixcxx . . $ matrix# orient; |
| 4860 | char p_ap = cur_goal->g_infocxx . . $ goal#g_info..attach_infocxx . . $ goal_info#$anonymous_type_3#attach_info..parent_apcxx . . $ g_attach#parent_ap.; |
| 4861 | char c_ap = cur_goal->g_infocxx . . $ goal#g_info..attach_infocxx . . $ goal_info#$anonymous_type_3#attach_info..child_apcxx . . $ g_attach#child_ap.; |
| 4862 | float rad = cur_goal->g_infocxx . . $ goal#g_info..attach_infocxx . . $ goal_info#$anonymous_type_3#attach_info..radcxx . . $ g_attach#rad.; |
| 4863 | |
| 4864 | // Investigate a better means of doing this... |
| 4865 | if (!(obj->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..flagscxx . . $ physics_info#flags. & PF_NO_ROBOT_COLLISIONScxx . . $ `Descent3/object_external.h:332:9`!)) { |
| 4866 | obj->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..flagscxx . . $ physics_info#flags. |= PF_NO_ROBOT_COLLISIONScxx . . $ `Descent3/object_external.h:332:9`!; |
| 4867 | cur_goal->g_infocxx . . $ goal#g_info..attach_infocxx . . $ goal_info#$anonymous_type_3#attach_info..flagscxx . . $ g_attach#flags. |= GAF_TEMP_CLEAR_ROBOT_COLLISIONScxx . . $ `Descent3/aistruct.h:581:9`!; |
| 4868 | } |
| 4869 | if (!(obj->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..flagscxx . . $ physics_info#flags. & PF_POINT_COLLIDE_WALLScxx . . $ `Descent3/object_external.h:333:9`!)) { |
| 4870 | obj->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..flagscxx . . $ physics_info#flags. |= PF_POINT_COLLIDE_WALLScxx . . $ `Descent3/object_external.h:333:9`!; |
| 4871 | cur_goal->g_infocxx . . $ goal#g_info..attach_infocxx . . $ goal_info#$anonymous_type_3#attach_info..flagscxx . . $ g_attach#flags. |= GAF_TEMP_POINT_COLLIDE_WALLScxx . . $ `Descent3/aistruct.h:582:9`!; |
| 4872 | } |
| 4873 | if ((cur_goal->g_infocxx . . $ goal#g_info..attach_infocxx . . $ goal_info#$anonymous_type_3#attach_info..flagscxx . . $ g_attach#flags. & GAF_ALIGNEDcxx . . $ `Descent3/aistruct.h:578:9`!) && (obj->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..flagscxx . . $ physics_info#flags. & PF_LEVELINGcxx . . $ `Descent3/object_external.h:314:9`!)) { |
| 4874 | obj->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..flagscxx . . $ physics_info#flags. &= (~PF_LEVELINGcxx . . $ `Descent3/object_external.h:314:9`!); |
| 4875 | cur_goal->g_infocxx . . $ goal#g_info..attach_infocxx . . $ goal_info#$anonymous_type_3#attach_info..flagscxx . . $ g_attach#flags. |= GAF_TEMP_CLEAR_AUTOLEVELcxx . . $ `Descent3/aistruct.h:580:9`!; |
| 4876 | } |
| 4877 | |
| 4878 | // Determine that attach pos and orient |
| 4879 | if ((cur_goal->g_infocxx . . $ goal#g_info..attach_infocxx . . $ goal_info#$anonymous_type_3#attach_info..flagscxx . . $ g_attach#flags. & GAF_ALIGNEDcxx . . $ `Descent3/aistruct.h:578:9`!) && |
| 4880 | AttachDoPosOrientcxx . . $ AttachDoPosOrient(abf0e4ef1467cf92).(obj, p_ap, g_obj, c_ap, true, false, &pos, &orient, |
| 4881 | (cur_goal->typecxx . . $ goal#type. == AIG_PLACE_OBJ_ON_OBJcxx . . $ `Descent3/aistruct_external.h:189:9`!))) { |
| 4882 | bool f_at_pos = AIMoveTowardsPositioncxx . . $ AIMoveTowardsPosition(e4ea9f4f5d132a1c).(obj, &pos, 1.0f, true, &goal_mdir, &goal_f_moved); |
| 4883 | goal_mset = true; |
| 4884 | if (!goal_f_moved) { |
| 4885 | AIMoveTowardsDircxx . . $ AIMoveTowardsDir(cd233addd15cf1e2).(obj, &goal_mdir); |
| 4886 | } |
| 4887 | |
| 4888 | bool f_orient = AITurnTowardsMatrixcxx . . $ AITurnTowardsMatrix(4158910ac60c491b).(obj, obj->ai_infocxx . . $ object#ai_info.->max_turn_ratecxx . . $ ai_frame#max_turn_rate., &orient); |
| 4889 | |
| 4890 | if (f_at_pos && f_orient) { |
| 4891 | int goal_index = cur_goal - ai_info->goalscxx . . $ ai_frame#goals.; |
| 4892 | |
| 4893 | if (cur_goal->typecxx . . $ goal#type. == AIG_PLACE_OBJ_ON_OBJcxx . . $ `Descent3/aistruct_external.h:189:9`!) { |
| 4894 | UnattachFromParentcxx . . $ UnattachFromParent(39516aeee13ca5ab).(child_obj); |
| 4895 | AttachObjectcxx . . $ AttachObject(f6b18a350068acc8).(g_obj, c_ap, child_obj, p_ap, true); |
| 4896 | } else { |
| 4897 | if (cur_goal->flagscxx . . $ goal#flags. & GF_IS_ATTACH_CHILDcxx . . $ `Descent3/aistruct_external.h:244:9`!) |
| 4898 | AttachObjectcxx . . $ AttachObject(f6b18a350068acc8).(g_obj, c_ap, obj, p_ap, true); |
| 4899 | else |
| 4900 | AttachObjectcxx . . $ AttachObject(f6b18a350068acc8).(obj, p_ap, g_obj, c_ap, true); |
| 4901 | } |
| 4902 | |
| 4903 | if (cur_goal->g_infocxx . . $ goal#g_info..attach_infocxx . . $ goal_info#$anonymous_type_3#attach_info..flagscxx . . $ g_attach#flags. & GAF_TEMP_CLEAR_ROBOT_COLLISIONScxx . . $ `Descent3/aistruct.h:581:9`!) { |
| 4904 | obj->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..flagscxx . . $ physics_info#flags. &= (~PF_NO_ROBOT_COLLISIONScxx . . $ `Descent3/object_external.h:332:9`!); |
| 4905 | } |
| 4906 | if (cur_goal->g_infocxx . . $ goal#g_info..attach_infocxx . . $ goal_info#$anonymous_type_3#attach_info..flagscxx . . $ g_attach#flags. & GAF_TEMP_POINT_COLLIDE_WALLScxx . . $ `Descent3/aistruct.h:582:9`!) { |
| 4907 | obj->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..flagscxx . . $ physics_info#flags. &= (~PF_POINT_COLLIDE_WALLScxx . . $ `Descent3/object_external.h:333:9`!); |
| 4908 | } |
| 4909 | if (cur_goal->g_infocxx . . $ goal#g_info..attach_infocxx . . $ goal_info#$anonymous_type_3#attach_info..flagscxx . . $ g_attach#flags. & GAF_TEMP_CLEAR_AUTOLEVELcxx . . $ `Descent3/aistruct.h:580:9`!) { |
| 4910 | obj->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..flagscxx . . $ physics_info#flags. |= PF_LEVELINGcxx . . $ `Descent3/object_external.h:314:9`!; |
| 4911 | } |
| 4912 | cur_goal->g_infocxx . . $ goal#g_info..attach_infocxx . . $ goal_info#$anonymous_type_3#attach_info..flagscxx . . $ g_attach#flags. &= |
| 4913 | ~(GAF_TEMP_CLEAR_AUTOLEVELcxx . . $ `Descent3/aistruct.h:580:9`! | GAF_TEMP_POINT_COLLIDE_WALLScxx . . $ `Descent3/aistruct.h:582:9`! | GAF_TEMP_CLEAR_ROBOT_COLLISIONScxx . . $ `Descent3/aistruct.h:581:9`!); |
| 4914 | |
| 4915 | cur_goal->flagscxx . . $ goal#flags. &= ~(GF_NONFLUSHABLEcxx . . $ `Descent3/aistruct_external.h:216:9`! | GF_KEEP_AT_COMPLETIONcxx . . $ `Descent3/aistruct_external.h:218:9`!); |
| 4916 | GoalClearGoalcxx . . $ GoalClearGoal(5f6922bcf6358e70).(obj, cur_goal, AIN_GOAL_COMPLETEcxx . . $ `Descent3/aistruct_external.h:294:9`!); |
| 4917 | } |
| 4918 | } else if ((cur_goal->g_infocxx . . $ goal#g_info..attach_infocxx . . $ goal_info#$anonymous_type_3#attach_info..flagscxx . . $ g_attach#flags. & GAF_SPHEREcxx . . $ `Descent3/aistruct.h:579:9`!) && |
| 4919 | AttachDoPosOrientRadcxx . . $ AttachDoPosOrientRad(5918c311dcb3dd22).(obj, p_ap, g_obj, rad, &pos)) { |
| 4920 | bool f_at_pos = AIMoveTowardsPositioncxx . . $ AIMoveTowardsPosition(e4ea9f4f5d132a1c).(obj, &pos, 1.0f, true, &goal_mdir, &goal_f_moved); |
| 4921 | goal_mset = true; |
| 4922 | if (!goal_f_moved) { |
| 4923 | AIMoveTowardsDircxx . . $ AIMoveTowardsDir(cd233addd15cf1e2).(obj, &goal_mdir); |
| 4924 | } |
| 4925 | |
| 4926 | if (f_at_pos) { |
| 4927 | int goal_index = cur_goal - ai_info->goalscxx . . $ ai_frame#goals.; |
| 4928 | |
| 4929 | AttachObjectcxx . . $ AttachObject(45561ecb6c1b979f).(obj, p_ap, g_obj, rad); |
| 4930 | |
| 4931 | if (cur_goal->g_infocxx . . $ goal#g_info..attach_infocxx . . $ goal_info#$anonymous_type_3#attach_info..flagscxx . . $ g_attach#flags. & GAF_TEMP_CLEAR_ROBOT_COLLISIONScxx . . $ `Descent3/aistruct.h:581:9`!) { |
| 4932 | obj->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..flagscxx . . $ physics_info#flags. &= (~PF_NO_ROBOT_COLLISIONScxx . . $ `Descent3/object_external.h:332:9`!); |
| 4933 | } |
| 4934 | if (cur_goal->g_infocxx . . $ goal#g_info..attach_infocxx . . $ goal_info#$anonymous_type_3#attach_info..flagscxx . . $ g_attach#flags. & GAF_TEMP_POINT_COLLIDE_WALLScxx . . $ `Descent3/aistruct.h:582:9`!) { |
| 4935 | obj->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..flagscxx . . $ physics_info#flags. &= (~PF_POINT_COLLIDE_WALLScxx . . $ `Descent3/object_external.h:333:9`!); |
| 4936 | } |
| 4937 | if (cur_goal->g_infocxx . . $ goal#g_info..attach_infocxx . . $ goal_info#$anonymous_type_3#attach_info..flagscxx . . $ g_attach#flags. & GAF_TEMP_CLEAR_AUTOLEVELcxx . . $ `Descent3/aistruct.h:580:9`!) { |
| 4938 | obj->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..flagscxx . . $ physics_info#flags. |= PF_LEVELINGcxx . . $ `Descent3/object_external.h:314:9`!; |
| 4939 | } |
| 4940 | cur_goal->g_infocxx . . $ goal#g_info..attach_infocxx . . $ goal_info#$anonymous_type_3#attach_info..flagscxx . . $ g_attach#flags. &= |
| 4941 | ~(GAF_TEMP_CLEAR_AUTOLEVELcxx . . $ `Descent3/aistruct.h:580:9`! | GAF_TEMP_POINT_COLLIDE_WALLScxx . . $ `Descent3/aistruct.h:582:9`! | GAF_TEMP_CLEAR_ROBOT_COLLISIONScxx . . $ `Descent3/aistruct.h:581:9`!); |
| 4942 | |
| 4943 | cur_goal->flagscxx . . $ goal#flags. &= ~(GF_NONFLUSHABLEcxx . . $ `Descent3/aistruct_external.h:216:9`! | GF_KEEP_AT_COMPLETIONcxx . . $ `Descent3/aistruct_external.h:218:9`!); |
| 4944 | GoalClearGoalcxx . . $ GoalClearGoal(5f6922bcf6358e70).(obj, cur_goal, AIN_GOAL_COMPLETEcxx . . $ `Descent3/aistruct_external.h:294:9`!); |
| 4945 | } |
| 4946 | } else { |
| 4947 | cur_goal->flagscxx . . $ goal#flags. &= ~(GF_NONFLUSHABLEcxx . . $ `Descent3/aistruct_external.h:216:9`! | GF_KEEP_AT_COMPLETIONcxx . . $ `Descent3/aistruct_external.h:218:9`!); |
| 4948 | GoalClearGoalcxx . . $ GoalClearGoal(5f6922bcf6358e70).(obj, cur_goal, AIN_GOAL_INVALIDcxx . . $ `Descent3/aistruct_external.h:303:9`!); |
| 4949 | } |
| 4950 | return; |
| 4951 | } else if (ai_info->pathcxx . . $ ai_frame#path..num_pathscxx . . $ ai_path_info#num_paths. && |
| 4952 | !((cur_goal->status_regcxx . . $ goal#status_reg. & AISR_SEES_GOALcxx . . $ `Descent3/aistruct_external.h:400:9`!) && (cur_goal->flagscxx . . $ goal#flags. & GF_USE_BLINE_IF_SEES_GOALcxx . . $ `Descent3/aistruct_external.h:223:9`!))) { |
| 4953 | AIPathMoveTurnTowardsNodecxx . . $ AIPathMoveTurnTowardsNode(682dd4424bca0090).(obj, &goal_mdir, &goal_f_moved); |
| 4954 | goal_mset = true; |
| 4955 | } else if (cur_goal->typecxx . . $ goal#type. == AIG_GET_TO_POScxx . . $ `Descent3/aistruct_external.h:201:9`! || cur_goal->typecxx . . $ goal#type. == AIG_WANDER_AROUNDcxx . . $ `Descent3/aistruct_external.h:187:9`!) { |
| 4956 | bool result = AIMoveTowardsPositioncxx . . $ AIMoveTowardsPosition(e4ea9f4f5d132a1c).(obj, &cur_goal->g_infocxx . . $ goal#g_info..poscxx . . $ goal_info#$anonymous_type_2#pos., 1.0f, |
| 4957 | fabscxx . . $ fabs(fbcf3211dfe1bfd1).(cur_goal->circle_distancecxx . . $ goal#circle_distance.) < .001, &goal_mdir, &goal_f_moved); |
| 4958 | goal_mset = true; |
| 4959 | |
| 4960 | if (result && (fabscxx . . $ fabs(fbcf3211dfe1bfd1).(cur_goal->circle_distancecxx . . $ goal#circle_distance.) < .001)) |
| 4961 | GoalClearGoalcxx . . $ GoalClearGoal(5f6922bcf6358e70).(obj, cur_goal, AIN_GOAL_COMPLETEcxx . . $ `Descent3/aistruct_external.h:294:9`!); |
| 4962 | } else if (OBJGOALcxx . . $ `Descent3/aistruct.h:668:9`!(cur_goal)) { |
| 4963 | objectcxx . . $ object# *g_obj = ObjGetcxx . . $ ObjGet(11672e354c0b263a).(cur_goal->g_infocxx . . $ goal#g_info..handlecxx . . $ goal_info#$anonymous_type_1#handle.); |
| 4964 | |
| 4965 | if (g_obj) { |
| 4966 | AIMoveTowardsPositioncxx . . $ AIMoveTowardsPosition(e4ea9f4f5d132a1c).(obj, &g_obj->poscxx . . $ object#pos., 1.0f, false, &goal_mdir, &goal_f_moved); |
| 4967 | goal_mset = true; |
| 4968 | } else { |
| 4969 | mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "AIG Warning: No obj for GetToObj.\n"); |
| 4970 | } |
| 4971 | } else if (cur_goal->typecxx . . $ goal#type. == AIG_FOLLOW_PATHcxx . . $ `Descent3/aistruct_external.h:195:9`!) { |
| 4972 | mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "AIG Warning: Follow path has no path\n"); |
| 4973 | } |
| 4974 | } break; |
| 4975 | |
| 4976 | case AIG_MOVE_RELATIVE_OBJ_VECcxx . . $ `Descent3/aistruct_external.h:199:9`!: { |
| 4977 | objectcxx . . $ object# *goal_obj = ObjGetcxx . . $ ObjGet(11672e354c0b263a).(cur_goal->g_infocxx . . $ goal#g_info..handlecxx . . $ goal_info#$anonymous_type_1#handle.); |
| 4978 | float g_circle_dist = cur_goal->circle_distancecxx . . $ goal#circle_distance.; |
| 4979 | |
| 4980 | if (goal_obj) { |
| 4981 | int subtype = cur_goal->subtypecxx . . $ goal#subtype.; |
| 4982 | int vec_id = (subtype & 0xFFFFFFFE); |
| 4983 | bool f_toward = (subtype & 0x00000001); |
| 4984 | vectorcxx . . $ vector# *vec; |
| 4985 | |
| 4986 | // mprintf(0, "Moving relative a type %d\n", obj->type); |
| 4987 | |
| 4988 | switch (vec_id) { |
| 4989 | case GST_FVECcxx . . $ `Descent3/aistruct_external.h:264:9`!: |
| 4990 | vec = &goal_obj->orientcxx . . $ object#orient..fveccxx . . $ matrix#fvec.; |
| 4991 | break; |
| 4992 | case GST_RVECcxx . . $ `Descent3/aistruct_external.h:266:9`!: |
| 4993 | vec = &goal_obj->orientcxx . . $ object#orient..rveccxx . . $ matrix#rvec.; |
| 4994 | break; |
| 4995 | case GST_UVECcxx . . $ `Descent3/aistruct_external.h:268:9`!: |
| 4996 | vec = &goal_obj->orientcxx . . $ object#orient..uveccxx . . $ matrix#uvec.; |
| 4997 | break; |
| 4998 | default: |
| 4999 | mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "Invalid vec in AIG_MOVE_RELATIVE_OBJ_VEC bashing to fvec\n"); |
| 5000 | cur_goal->subtypecxx . . $ goal#subtype. = GST_FVECcxx . . $ `Descent3/aistruct_external.h:264:9`! | (int)f_toward; |
| 5001 | vec_id = GST_FVECcxx . . $ `Descent3/aistruct_external.h:264:9`!; |
| 5002 | } |
| 5003 | |
| 5004 | if (move_relative_object_veccxx . . $ move_relative_object_vec(2f4a138f1b2d22a4).(obj, vec, goal_obj, g_circle_dist, 1.0f, f_toward, &goal_mdir, |
| 5005 | &goal_f_moved)) { |
| 5006 | GoalClearGoalcxx . . $ GoalClearGoal(5f6922bcf6358e70).(obj, cur_goal, AIN_GOAL_COMPLETEcxx . . $ `Descent3/aistruct_external.h:294:9`!); |
| 5007 | } |
| 5008 | goal_mset = true; |
| 5009 | } else { |
| 5010 | GoalClearGoalcxx . . $ GoalClearGoal(5f6922bcf6358e70).(obj, cur_goal, AIN_GOAL_INVALIDcxx . . $ `Descent3/aistruct_external.h:303:9`!); |
| 5011 | } |
| 5012 | } break; |
| 5013 | |
| 5014 | case AIG_MOVE_RELATIVE_OBJcxx . . $ `Descent3/aistruct_external.h:200:9`!: // chrishack make this out of other goals |
| 5015 | { |
| 5016 | objectcxx . . $ object# *goal_obj = ObjGetcxx . . $ ObjGet(11672e354c0b263a).(cur_goal->g_infocxx . . $ goal#g_info..handlecxx . . $ goal_info#$anonymous_type_1#handle.); |
| 5017 | float g_circle_dist = cur_goal->circle_distancecxx . . $ goal#circle_distance.; |
| 5018 | |
| 5019 | int g_status = cur_goal->status_regcxx . . $ goal#status_reg.; |
| 5020 | |
| 5021 | // if((ai_info->ai_type == AIT_MELEE1) && |
| 5022 | //(ai_info->status_reg & AISR_MELEE)) |
| 5023 | // { |
| 5024 | // AIMoveTowardsPosition(obj, |
| 5025 | //&ai_info->last_see_target_pos, ai_info->attack_vel_percent); |
| 5026 | // } |
| 5027 | // else |
| 5028 | |
| 5029 | if (ai_info->dist_to_target_perceivedcxx . . $ ai_frame#dist_to_target_perceived. < .7f * g_circle_dist) { |
| 5030 | move_away_from_positioncxx . . $ move_away_from_position(85fe40f658f75ff4).(obj, &ai_info->last_see_target_poscxx . . $ ai_frame#last_see_target_pos., ai_info->flee_vel_percentcxx . . $ ai_frame#flee_vel_percent., &goal_mdir, |
| 5031 | &goal_f_moved); |
| 5032 | goal_mset = true; |
| 5033 | |
| 5034 | if (ai_info->soundcxx . . $ ai_frame#sound.[AI_FLEE_SOUNDcxx . . $ `Descent3/aistruct_external.h:386:9`!] != SOUND_NONE_INDEXcxx . . $ `Descent3/sounds.h:105:9`!) { |
| 5035 | // Plays the sound and makes absolute sure that it is not looping |
| 5036 | if (Gametimecxx . . $ Gametime. - ai_info->last_sound_timecxx . . $ ai_frame#last_sound_time.[AI_FLEE_SOUNDcxx . . $ `Descent3/aistruct_external.h:386:9`!] > 5.0f) { |
| 5037 | // A 25% chance of playing it |
| 5038 | if (ps_randcxx . . $ ps_rand(b126dc7c1de90089).() % 4 == 0) { |
| 5039 | Sound_systemcxx . . $ Sound_system..StopSoundLoopingcxx . . $ hlsSystem#StopSoundLooping(d4f767463ce0a6b3).( |
| 5040 | Sound_systemcxx . . $ Sound_system..Play3dSoundcxx . . $ hlsSystem#Play3dSound(17f485224ada8dd7).(ai_info->soundcxx . . $ ai_frame#sound.[AI_FLEE_SOUNDcxx . . $ `Descent3/aistruct_external.h:386:9`!], SND_PRIORITY_NORMALcxx . . $ `sndlib/ssl_lib.h:284:9`!, obj)); |
| 5041 | if (Game_modecxx . . $ Game_mode. & GM_MULTIcxx . . $ `Descent3/game.h:288:9`!) |
| 5042 | MultiPlay3dSoundcxx . . $ MultiPlay3dSound(f056c30c88236a5f).(ai_info->soundcxx . . $ ai_frame#sound.[AI_FLEE_SOUNDcxx . . $ `Descent3/aistruct_external.h:386:9`!], OBJNUMcxx . . $ `Descent3/object.h:700:9`!(obj), SND_PRIORITY_NORMALcxx . . $ `sndlib/ssl_lib.h:284:9`!); |
| 5043 | if (Demo_flagscxx . . $ Demo_flags. == DF_RECORDINGcxx . . $ `lib/demofile.h:122:9`!) |
| 5044 | DemoWrite3DSoundcxx . . $ DemoWrite3DSound(c29d531f7e56abb1).(ai_info->soundcxx . . $ ai_frame#sound.[AI_FLEE_SOUNDcxx . . $ `Descent3/aistruct_external.h:386:9`!], OBJNUMcxx . . $ `Descent3/object.h:700:9`!(obj), SND_PRIORITY_NORMALcxx . . $ `sndlib/ssl_lib.h:284:9`!); |
| 5045 | } |
| 5046 | |
| 5047 | ai_info->last_sound_timecxx . . $ ai_frame#last_sound_time.[AI_FLEE_SOUNDcxx . . $ `Descent3/aistruct_external.h:386:9`!] = Gametimecxx . . $ Gametime.; |
| 5048 | } |
| 5049 | } |
| 5050 | } else if (g_status & AISR_CIRCLE_DISTcxx . . $ `Descent3/aistruct_external.h:396:9`!) { |
| 5051 | vectorcxx . . $ vector# movement_vec; |
| 5052 | int gtime = Gametimecxx . . $ Gametime. + OBJNUMcxx . . $ `Descent3/object.h:700:9`!(obj); |
| 5053 | gtime = gtime % 8; |
| 5054 | |
| 5055 | objectcxx . . $ object# *rel_obj; |
| 5056 | |
| 5057 | if (ai_info->flagscxx . . $ ai_frame#flags. & AIF_ORIENT_TO_VELcxx . . $ `Descent3/aistruct_external.h:370:9`!) |
| 5058 | rel_obj = goal_obj; |
| 5059 | else |
| 5060 | rel_obj = obj; |
| 5061 | |
| 5062 | if (rel_obj) { |
| 5063 | if (gtime < 2) |
| 5064 | movement_vec =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). rel_obj->orientcxx . . $ object#orient..rveccxx . . $ matrix#rvec.; |
| 5065 | else if (gtime < 4) |
| 5066 | movement_vec =cxx . . $ vector#`operator=`(c0842353a20857d). -cxx . . $ operator-(9e07539e219c6f20).rel_obj->orientcxx . . $ object#orient..rveccxx . . $ matrix#rvec.; |
| 5067 | else if (gtime < 6) { |
| 5068 | if (obj->movement_typecxx . . $ object#movement_type. != MT_WALKINGcxx . . $ `Descent3/object_external.h:235:9`!) { |
| 5069 | movement_vec =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). rel_obj->orientcxx . . $ object#orient..uveccxx . . $ matrix#uvec.; |
| 5070 | } else { |
| 5071 | movement_vec =cxx . . $ vector#`operator=`(c0842353a20857d). -cxx . . $ operator-(9e07539e219c6f20).rel_obj->orientcxx . . $ object#orient..rveccxx . . $ matrix#rvec.; |
| 5072 | } |
| 5073 | } else { |
| 5074 | if (obj->movement_typecxx . . $ object#movement_type. != MT_WALKINGcxx . . $ `Descent3/object_external.h:235:9`!) { |
| 5075 | movement_vec =cxx . . $ vector#`operator=`(c0842353a20857d). -cxx . . $ operator-(9e07539e219c6f20).rel_obj->orientcxx . . $ object#orient..uveccxx . . $ matrix#uvec.; |
| 5076 | } else { |
| 5077 | movement_vec =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). rel_obj->orientcxx . . $ object#orient..rveccxx . . $ matrix#rvec.; |
| 5078 | } |
| 5079 | } |
| 5080 | } else { |
| 5081 | movement_vec =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). obj->orientcxx . . $ object#orient..rveccxx . . $ matrix#rvec.; |
| 5082 | } |
| 5083 | |
| 5084 | if (obj->movement_typecxx . . $ object#movement_type. == MT_WALKINGcxx . . $ `Descent3/object_external.h:235:9`!) { |
| 5085 | int16_t robots[6]; |
| 5086 | int num_robots = |
| 5087 | fvi_QuickDistObjectListcxx . . $ fvi_QuickDistObjectList(85643dfbd17d1ac8).(&obj->poscxx . . $ object#pos., obj->roomnumcxx . . $ object#roomnum., 30.0f, robots, 6, false, true, false, true); |
| 5088 | vectorcxx . . $ vector# d = Zero_vectorcxx . . $ Zero_vector.; |
| 5089 | int i; |
| 5090 | float closest = 100000.0f; |
| 5091 | |
| 5092 | if (num_robots > 0) { |
| 5093 | for (i = 0; i < num_robots; i++) { |
| 5094 | if (Objectscxx . . $ Objects.[robots[i]].typecxx . . $ object#type. == obj->typecxx . . $ object#type. && Objectscxx . . $ Objects.[robots[i]].idcxx . . $ object#id. == obj->idcxx . . $ object#id.) { |
| 5095 | vectorcxx . . $ vector# dir; |
| 5096 | float distance; |
| 5097 | |
| 5098 | // Reverse of move towards |
| 5099 | dir =cxx . . $ vector#`operator=`(c0842353a20857d). obj->poscxx . . $ object#pos. -cxx . . $ operator-(b77b703cd1e43e33). Objectscxx . . $ Objects.[robots[i]].poscxx . . $ object#pos.; |
| 5100 | distance = vm_NormalizeVectorcxx . . $ vm_NormalizeVector(4939a7e530383cd4).(&dir); |
| 5101 | |
| 5102 | if (distance > 0.0) { |
| 5103 | if (distance < closest) { |
| 5104 | closest = distance; |
| 5105 | } |
| 5106 | |
| 5107 | if (distance < 30.0) { |
| 5108 | d +=cxx . . $ `operator+=`(801a8d6f7ab7bef9). (1.0f - distance / 30.f) *cxx . . $ `operator*`(9d6577ff3e9faa29). dir; |
| 5109 | } |
| 5110 | } |
| 5111 | } |
| 5112 | } |
| 5113 | } |
| 5114 | |
| 5115 | if (d !=cxx . . $ `operator!=`(718c890c104af0f3). Zero_vectorcxx . . $ Zero_vector.) { |
| 5116 | if (closest < 30.0f) { |
| 5117 | float scale = 1.0f - closest / 30.0f; |
| 5118 | vm_NormalizeVectorcxx . . $ vm_NormalizeVector(4939a7e530383cd4).(&d); |
| 5119 | |
| 5120 | movement_vec =cxx . . $ vector#`operator=`(c0842353a20857d). (scale *cxx . . $ `operator*`(9d6577ff3e9faa29). d) +cxx . . $ operator+(b77b703cd1e43e33). (1.0f - scale) *cxx . . $ `operator*`(9d6577ff3e9faa29). movement_vec; |
| 5121 | vm_NormalizeVectorcxx . . $ vm_NormalizeVector(4939a7e530383cd4).(&movement_vec); |
| 5122 | } |
| 5123 | } |
| 5124 | |
| 5125 | goal_mdir =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). movement_vec; |
| 5126 | goal_mset = true; |
| 5127 | // AIMoveTowardsDir(obj, |
| 5128 | //&movement_vec); |
| 5129 | } else { |
| 5130 | goal_mdir =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). movement_vec; |
| 5131 | goal_mset = true; |
| 5132 | // AIMoveTowardsDir(obj, |
| 5133 | //&movement_vec); |
| 5134 | } |
| 5135 | } else { |
| 5136 | AIMoveTowardsPositioncxx . . $ AIMoveTowardsPosition(e4ea9f4f5d132a1c).(obj, &ai_info->last_see_target_poscxx . . $ ai_frame#last_see_target_pos., 1.0f, false, &goal_mdir, &goal_f_moved); |
| 5137 | goal_mset = true; |
| 5138 | } |
| 5139 | } break; |
| 5140 | |
| 5141 | default: { |
| 5142 | mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "AI ERROR: Object %d trying a non-implemented goal\n", OBJNUM(obj)); |
| 5143 | AIMoveTowardsPositioncxx . . $ AIMoveTowardsPosition(e4ea9f4f5d132a1c).(obj, &ai_info->last_see_target_poscxx . . $ ai_frame#last_see_target_pos., 1.0f, true, &goal_mdir, &goal_f_moved); |
| 5144 | goal_mset = true; |
| 5145 | } |
| 5146 | } |
| 5147 | } else { |
| 5148 | if (!(f_dodge || f_avoid || |
| 5149 | (ai_info->dodge_till_timecxx . . $ ai_frame#dodge_till_time. >= Gametimecxx . . $ Gametime. && ai_info->last_dodge_dircxx . . $ ai_frame#last_dodge_dir. !=cxx . . $ `operator!=`(718c890c104af0f3). Zero_vectorcxx . . $ Zero_vector.))) { |
| 5150 | AIMoveTowardsPositioncxx . . $ AIMoveTowardsPosition(e4ea9f4f5d132a1c).(obj, &obj->poscxx . . $ object#pos., 1.0f, false, &goal_mdir, &goal_f_moved); |
| 5151 | goal_mset = true; |
| 5152 | } |
| 5153 | } |
| 5154 | |
| 5155 | // BLEND THIS! |
| 5156 | if ((f_dodge || f_avoid || (ai_info->dodge_till_timecxx . . $ ai_frame#dodge_till_time. >= Gametimecxx . . $ Gametime. && ai_info->last_dodge_dircxx . . $ ai_frame#last_dodge_dir. !=cxx . . $ `operator!=`(718c890c104af0f3). Zero_vectorcxx . . $ Zero_vector.)) || |
| 5157 | (!goal_f_moved && goal_mset)) { |
| 5158 | if (!f_dodge && (ai_info->dodge_till_timecxx . . $ ai_frame#dodge_till_time. >= Gametimecxx . . $ Gametime. && ai_info->last_dodge_dircxx . . $ ai_frame#last_dodge_dir. !=cxx . . $ `operator!=`(718c890c104af0f3). Zero_vectorcxx . . $ Zero_vector.)) { |
| 5159 | f_dodge = true; |
| 5160 | ai_info->movement_dircxx . . $ ai_frame#movement_dir. +=cxx . . $ `operator+=`(801a8d6f7ab7bef9). ai_info->last_dodge_dircxx . . $ ai_frame#last_dodge_dir.; |
| 5161 | |
| 5162 | if (ai_info->dodge_vel_percentcxx . . $ ai_frame#dodge_vel_percent. > highest_speed) { |
| 5163 | highest_speed = ai_info->dodge_vel_percentcxx . . $ ai_frame#dodge_vel_percent.; |
| 5164 | } |
| 5165 | } |
| 5166 | |
| 5167 | if (!goal_f_moved && goal_mset) { |
| 5168 | ai_info->movement_dircxx . . $ ai_frame#movement_dir. +=cxx . . $ `operator+=`(801a8d6f7ab7bef9). goal_mdir *cxx . . $ `operator*`(252247219a31502c). cur_goal->influencecxx . . $ goal#$anonymous_type_4#influence.; |
| 5169 | } |
| 5170 | |
| 5171 | float move_len = vm_NormalizeVectorcxx . . $ vm_NormalizeVector(4939a7e530383cd4).(&ai_info->movement_dircxx . . $ ai_frame#movement_dir.); |
| 5172 | if (move_len == 0.0f) { |
| 5173 | vm_MakeRandomVectorcxx . . $ vm_MakeRandomVector(ec8cf6451c36d470).(&ai_info->movement_dircxx . . $ ai_frame#movement_dir.); |
| 5174 | vm_NormalizeVectorcxx . . $ vm_NormalizeVector(4939a7e530383cd4).(&ai_info->movement_dircxx . . $ ai_frame#movement_dir.); |
| 5175 | } |
| 5176 | |
| 5177 | AIMoveTowardsDircxx . . $ AIMoveTowardsDir(cd233addd15cf1e2).(obj, &ai_info->movement_dircxx . . $ ai_frame#movement_dir., highest_speed); |
| 5178 | f_turned = false; |
| 5179 | } |
| 5180 | } |
| 5181 | } |
| 5182 | |
| 5183 | // Handle orientation now |
| 5184 | if ((!f_turned || |
| 5185 | ((!f_goal_found && Gametimecxx . . $ Gametime. - ai_info->last_see_target_timecxx . . $ ai_frame#last_see_target_time. < 5.0f) && |
| 5186 | (!f_goal_found && Gametimecxx . . $ Gametime. - ai_info->last_hear_target_timecxx . . $ ai_frame#last_hear_target_time. < 5.0f) && (ai_info->flagscxx . . $ ai_frame#flags. & AIF_FIREcxx . . $ `Descent3/aistruct_external.h:356:9`!))) && |
| 5187 | ai_info->max_turn_ratecxx . . $ ai_frame#max_turn_rate. > 0.0f) |
| 5188 | AIDoOrientcxx . . $ AIDoOrient(766a1b7183ffa4b4).(obj, highest_influence_goal); |
| 5189 | } |
| 5190 | } |
| 5191 | |
| 5192 | #define MAX_NOT_SEE_TARGET_FIRE_TIMEcxx . . $ `Descent3/AImain.cpp:5192:9`! 2.0f |
| 5193 | #define MIN_TURRET_SOUND_TIMEcxx . . $ `Descent3/AImain.cpp:5193:9`! 0.8f |
| 5194 | #define DEFAULT_FIRE_DOTcxx . . $ `Descent3/AImain.cpp:5194:9`! .93f |
| 5195 | |
| 5196 | void ai_firecxx . . $ ai_fire(419c470199a90a97).(objectcxx . . $ object# *obj) { |
| 5197 | if (!Object_infocxx . . $ Object_info.[obj->idcxx . . $ object#id.].static_wbcxx . . $ object_info#static_wb.) { |
| 5198 | // something is hosed due to 'Mac memory savings' (c) |
| 5199 | Int3cxx . . $ `misc/pserror.h:247:9`!(); |
| 5200 | return; // object can't fire anything... |
| 5201 | } |
| 5202 | |
| 5203 | ai_framecxx . . $ ai_frame# *ai_info = obj->ai_infocxx . . $ object#ai_info.; |
| 5204 | int i; |
| 5205 | int j; |
| 5206 | poly_modelcxx . . $ poly_model# *pm = &Poly_modelscxx . . $ Poly_models.[obj->rtypecxx . . $ object#rtype..pobj_infocxx . . $ object#$anonymous_type_10#pobj_info..model_numcxx . . $ polyobj_info#model_num.]; |
| 5207 | object_infocxx . . $ object_info# *obj_info = &Object_infocxx . . $ Object_info.[obj->idcxx . . $ object#id.]; |
| 5208 | bool f_turret_next_move_still; |
| 5209 | |
| 5210 | //. mprintf(0, "Aiming\n"); |
| 5211 | if (!(ai_info->flagscxx . . $ ai_frame#flags. & AIF_FIREcxx . . $ `Descent3/aistruct_external.h:356:9`!)) { |
| 5212 | if (ai_info->status_regcxx . . $ ai_frame#status_reg. & AISR_RANGED_ATTACKcxx . . $ `Descent3/aistruct_external.h:399:9`!) { |
| 5213 | for (i = 0; i < pm->num_wbscxx . . $ poly_model#num_wbs.; i++) { |
| 5214 | if (!(obj->dynamic_wbcxx . . $ object#dynamic_wb.[i].flagscxx . . $ dynamic_wb_info#flags. & DWBF_ENABLEDcxx . . $ `lib/robotfirestruct_external.h:43:9`!)) |
| 5215 | continue; |
| 5216 | |
| 5217 | if (WBIsBatteryReadycxx . . $ WBIsBatteryReady(ad7a19887510094c).(obj, &obj_info->static_wbcxx . . $ object_info#static_wb.[i], i) && |
| 5218 | !(Cinematic_inusecxx . . $ Cinematic_inuse. && !(ai_info->status_regcxx . . $ ai_frame#status_reg. & AISR_OK_TO_FIRE_DURING_CINEMATICScxx . . $ `Descent3/aistruct_external.h:401:9`!))) { |
| 5219 | int anim_type = obj_info->static_wbcxx . . $ object_info#static_wb.[i].flagscxx . . $ otype_wb_info#flags. & WBF_ANIM_MASKScxx . . $ `lib/robotfirestruct_external.h:30:9`!; |
| 5220 | |
| 5221 | if (anim_type == WBF_ANIM_LOCALcxx . . $ `lib/robotfirestruct_external.h:28:9`!) { |
| 5222 | WBSetupFireAnimcxx . . $ WBSetupFireAnim(cccf09a4825b46a4).(obj, &obj_info->static_wbcxx . . $ object_info#static_wb.[i], i); |
| 5223 | } else if (anim_type == WBF_ANIM_FULLcxx . . $ `lib/robotfirestruct_external.h:29:9`!) { |
| 5224 | gi_firecxx . . $ gi_fire# attack_info; |
| 5225 | |
| 5226 | attack_info.cur_wbcxx . . $ gi_fire#cur_wb. = i; |
| 5227 | attack_info.cur_maskcxx . . $ gi_fire#cur_mask. = obj->dynamic_wbcxx . . $ object#dynamic_wb.[i].cur_firing_maskcxx . . $ dynamic_wb_info#cur_firing_mask.; |
| 5228 | |
| 5229 | GoalAddGoalcxx . . $ GoalAddGoal(e0a3c222b6aee5c7).(obj, AIG_FIRE_AT_OBJcxx . . $ `Descent3/aistruct_external.h:185:9`!, (void *)&attack_info, ACTIVATION_BLEND_LEVELcxx . . $ `Descent3/aistruct_external.h:280:9`!); |
| 5230 | } else { |
| 5231 | WBFireBatterycxx . . $ WBFireBattery(cccf09a4825b46a4).(obj, &obj_info->static_wbcxx . . $ object_info#static_wb.[i], i); |
| 5232 | ai_info->status_regcxx . . $ ai_frame#status_reg. &= ~AISR_RANGED_ATTACKcxx . . $ `Descent3/aistruct_external.h:399:9`!; |
| 5233 | } |
| 5234 | } |
| 5235 | } |
| 5236 | } |
| 5237 | |
| 5238 | return; |
| 5239 | } |
| 5240 | |
| 5241 | if (((Gametimecxx . . $ Gametime. - ai_info->last_see_target_timecxx . . $ ai_frame#last_see_target_time.) > 4.0 && (Gametimecxx . . $ Gametime. - ai_info->last_hear_target_timecxx . . $ ai_frame#last_hear_target_time.) > 4.0) || |
| 5242 | ai_info->awarenesscxx . . $ ai_frame#awareness. <= AWARE_BARELYcxx . . $ `Descent3/aistruct_external.h:326:9`!) { |
| 5243 | ai_info->status_regcxx . . $ ai_frame#status_reg. &= ~AISR_RANGED_ATTACKcxx . . $ `Descent3/aistruct_external.h:399:9`!; |
| 5244 | return; |
| 5245 | } |
| 5246 | |
| 5247 | for (i = 0; i < pm->num_wbscxx . . $ poly_model#num_wbs.; i++) { |
| 5248 | vectorcxx . . $ vector# target_dir[3]; |
| 5249 | float dot[3]; |
| 5250 | vectorcxx . . $ vector# gun_point[3]; |
| 5251 | vectorcxx . . $ vector# gun_normal[3]; |
| 5252 | float ta[3]; |
| 5253 | int best_dot = WB_MOVE_STILLcxx . . $ `lib/robotfirestruct.h:79:9`!; |
| 5254 | |
| 5255 | if (!(obj->dynamic_wbcxx . . $ object#dynamic_wb.[i].flagscxx . . $ dynamic_wb_info#flags. & DWBF_ENABLEDcxx . . $ `lib/robotfirestruct_external.h:43:9`!)) |
| 5256 | continue; |
| 5257 | |
| 5258 | if (obj_info->static_wbcxx . . $ object_info#static_wb.[i].flagscxx . . $ otype_wb_info#flags. & WBF_USE_CUSTOM_MAX_DISTcxx . . $ `lib/robotfirestruct_external.h:35:9`!) { |
| 5259 | float max_dist = obj_info->static_wbcxx . . $ object_info#static_wb.[i].aiming_3d_distcxx . . $ otype_wb_info#aiming_3d_dist.; |
| 5260 | |
| 5261 | if (max_dist < ai_info->dist_to_target_actualcxx . . $ ai_frame#dist_to_target_actual.) |
| 5262 | continue; |
| 5263 | } |
| 5264 | |
| 5265 | int aiming_gp_index = obj_info->static_wbcxx . . $ object_info#static_wb.[i].aiming_gp_indexcxx . . $ otype_wb_info#aiming_gp_index.; |
| 5266 | |
| 5267 | // The WBF_AIM_FVEC and WBF_FIRE_FVEC stuff will work with a dummy turret or with no turrets |
| 5268 | if (pm->poly_wbcxx . . $ poly_model#poly_wb.[i].num_turretscxx . . $ poly_wb_info#num_turrets. == 0 || |
| 5269 | (pm->poly_wbcxx . . $ poly_model#poly_wb.[i].num_turretscxx . . $ poly_wb_info#num_turrets. == 1 && pm->submodelcxx . . $ poly_model#submodel.[pm->poly_wbcxx . . $ poly_model#poly_wb.[i].turret_indexcxx . . $ poly_wb_info#turret_index.[0]].fovcxx . . $ bsp_info#fov. == 0.0f)) { |
| 5270 | if (WBIsBatteryReadycxx . . $ WBIsBatteryReady(ad7a19887510094c).(obj, &obj_info->static_wbcxx . . $ object_info#static_wb.[i], i) && |
| 5271 | !(Cinematic_inusecxx . . $ Cinematic_inuse. && !(ai_info->status_regcxx . . $ ai_frame#status_reg. & AISR_OK_TO_FIRE_DURING_CINEMATICScxx . . $ `Descent3/aistruct_external.h:401:9`!))) { |
| 5272 | if (obj_info->static_wbcxx . . $ object_info#static_wb.[i].flagscxx . . $ otype_wb_info#flags. & WBF_AIM_FVECcxx . . $ `lib/robotfirestruct_external.h:38:9`!) { |
| 5273 | gun_point[WB_MOVE_STILLcxx . . $ `lib/robotfirestruct.h:79:9`!] =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). obj->poscxx . . $ object#pos.; |
| 5274 | gun_normal[WB_MOVE_STILLcxx . . $ `lib/robotfirestruct.h:79:9`!] =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). obj->orientcxx . . $ object#orient..fveccxx . . $ matrix#fvec.; |
| 5275 | |
| 5276 | if (obj_info->static_wbcxx . . $ object_info#static_wb.[i].flagscxx . . $ otype_wb_info#flags. & WBF_FIRE_FVECcxx . . $ `lib/robotfirestruct_external.h:37:9`!) { |
| 5277 | gun_normal[WB_MOVE_STILLcxx . . $ `lib/robotfirestruct.h:79:9`!] =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). obj->orientcxx . . $ object#orient..fveccxx . . $ matrix#fvec.; |
| 5278 | } |
| 5279 | } |
| 5280 | if (obj_info->static_wbcxx . . $ object_info#static_wb.[i].flagscxx . . $ otype_wb_info#flags. & WBF_FIRE_FVECcxx . . $ `lib/robotfirestruct_external.h:37:9`!) { |
| 5281 | WeaponCalcGuncxx . . $ WeaponCalcGun(85e3752e9562a225).(&gun_point[WB_MOVE_STILLcxx . . $ `lib/robotfirestruct.h:79:9`!], NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, obj, pm->poly_wbcxx . . $ poly_model#poly_wb.[i].gp_indexcxx . . $ poly_wb_info#gp_index.[aiming_gp_index]); |
| 5282 | gun_normal[WB_MOVE_STILLcxx . . $ `lib/robotfirestruct.h:79:9`!] =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). obj->orientcxx . . $ object#orient..fveccxx . . $ matrix#fvec.; |
| 5283 | } else { |
| 5284 | WeaponCalcGuncxx . . $ WeaponCalcGun(85e3752e9562a225).(&gun_point[WB_MOVE_STILLcxx . . $ `lib/robotfirestruct.h:79:9`!], &gun_normal[WB_MOVE_STILLcxx . . $ `lib/robotfirestruct.h:79:9`!], obj, |
| 5285 | pm->poly_wbcxx . . $ poly_model#poly_wb.[i].gp_indexcxx . . $ poly_wb_info#gp_index.[aiming_gp_index]); |
| 5286 | } |
| 5287 | |
| 5288 | target_dir[WB_MOVE_STILLcxx . . $ `lib/robotfirestruct.h:79:9`!] =cxx . . $ vector#`operator=`(c0842353a20857d). ai_info->last_see_target_poscxx . . $ ai_frame#last_see_target_pos. -cxx . . $ operator-(b77b703cd1e43e33). gun_point[WB_MOVE_STILLcxx . . $ `lib/robotfirestruct.h:79:9`!]; |
| 5289 | vm_NormalizeVectorcxx . . $ vm_NormalizeVector(4939a7e530383cd4).(&target_dir[WB_MOVE_STILLcxx . . $ `lib/robotfirestruct.h:79:9`!]); |
| 5290 | dot[WB_MOVE_STILLcxx . . $ `lib/robotfirestruct.h:79:9`!] = gun_normal[WB_MOVE_STILLcxx . . $ `lib/robotfirestruct.h:79:9`!] *cxx . . $ `operator*`(4a721543d64e126a). target_dir[WB_MOVE_STILLcxx . . $ `lib/robotfirestruct.h:79:9`!]; |
| 5291 | |
| 5292 | best_dot = WB_MOVE_STILLcxx . . $ `lib/robotfirestruct.h:79:9`!; |
| 5293 | } |
| 5294 | } |
| 5295 | |
| 5296 | for (j = 0; j < pm->poly_wbcxx . . $ poly_model#poly_wb.[i].num_turretscxx . . $ poly_wb_info#num_turrets.; j++) { |
| 5297 | f_turret_next_move_still = false; |
| 5298 | best_dot = WB_MOVE_STILLcxx . . $ `lib/robotfirestruct.h:79:9`!; |
| 5299 | float min_invalid_ang; |
| 5300 | float max_invalid_ang; |
| 5301 | bool f_constrain = true; |
| 5302 | |
| 5303 | float s_scale = |
| 5304 | (((obj->ai_infocxx . . $ object#ai_info.->flagscxx . . $ ai_frame#flags. & AIF_TEAM_MASKcxx . . $ `Descent3/aistruct_external.h:364:9`!) != AIF_TEAM_REBELcxx . . $ `Descent3/aistruct_external.h:366:9`!)) ? Diff_ai_turret_speedcxx . . $ Diff_ai_turret_speed.[DIFF_LEVELcxx . . $ `Descent3/difficulty.h:29:9`!] : 1.0f; |
| 5305 | const float rps = pm->submodelcxx . . $ poly_model#submodel.[pm->poly_wbcxx . . $ poly_model#poly_wb.[i].turret_indexcxx . . $ poly_wb_info#turret_index.[j]].rpscxx . . $ bsp_info#rps. * s_scale; |
| 5306 | |
| 5307 | if (pm->submodelcxx . . $ poly_model#submodel.[pm->poly_wbcxx . . $ poly_model#poly_wb.[i].turret_indexcxx . . $ poly_wb_info#turret_index.[j]].fovcxx . . $ bsp_info#fov. > |
| 5308 | 0.0f) // Gametime >= obj->dynamic_wb[i].turret_next_think_time[j]) |
| 5309 | { |
| 5310 | min_invalid_ang = pm->submodelcxx . . $ poly_model#submodel.[pm->poly_wbcxx . . $ poly_model#poly_wb.[i].turret_indexcxx . . $ poly_wb_info#turret_index.[j]].fovcxx . . $ bsp_info#fov.; |
| 5311 | max_invalid_ang = 1.0 - min_invalid_ang; |
| 5312 | |
| 5313 | if (min_invalid_ang >= 0.5f) |
| 5314 | f_constrain = false; |
| 5315 | |
| 5316 | ta[WB_MOVE_STILLcxx . . $ `lib/robotfirestruct.h:79:9`!] = obj->dynamic_wbcxx . . $ object#dynamic_wb.[i].norm_turret_anglecxx . . $ dynamic_wb_info#norm_turret_angle.[j]; |
| 5317 | |
| 5318 | ta[WB_MOVE_RIGHTcxx . . $ `lib/robotfirestruct.h:80:9`!] = obj->dynamic_wbcxx . . $ object#dynamic_wb.[i].norm_turret_anglecxx . . $ dynamic_wb_info#norm_turret_angle.[j] - Frametimecxx . . $ Frametime. * rps; |
| 5319 | while (ta[WB_MOVE_RIGHTcxx . . $ `lib/robotfirestruct.h:80:9`!] < 0.0) |
| 5320 | ta[WB_MOVE_RIGHTcxx . . $ `lib/robotfirestruct.h:80:9`!] += 1.0f; |
| 5321 | |
| 5322 | if (f_constrain && ta[WB_MOVE_RIGHTcxx . . $ `lib/robotfirestruct.h:80:9`!] > min_invalid_ang && ta[WB_MOVE_RIGHTcxx . . $ `lib/robotfirestruct.h:80:9`!] < max_invalid_ang) |
| 5323 | ta[WB_MOVE_RIGHTcxx . . $ `lib/robotfirestruct.h:80:9`!] = max_invalid_ang; |
| 5324 | |
| 5325 | ta[WB_MOVE_LEFTcxx . . $ `lib/robotfirestruct.h:81:9`!] = obj->dynamic_wbcxx . . $ object#dynamic_wb.[i].norm_turret_anglecxx . . $ dynamic_wb_info#norm_turret_angle.[j] + Frametimecxx . . $ Frametime. * rps; |
| 5326 | while (ta[WB_MOVE_LEFTcxx . . $ `lib/robotfirestruct.h:81:9`!] > 1.0) |
| 5327 | ta[WB_MOVE_LEFTcxx . . $ `lib/robotfirestruct.h:81:9`!] -= 1.0f; |
| 5328 | |
| 5329 | if (f_constrain && ta[WB_MOVE_LEFTcxx . . $ `lib/robotfirestruct.h:81:9`!] > min_invalid_ang && ta[WB_MOVE_LEFTcxx . . $ `lib/robotfirestruct.h:81:9`!] < max_invalid_ang) |
| 5330 | ta[WB_MOVE_LEFTcxx . . $ `lib/robotfirestruct.h:81:9`!] = min_invalid_ang; |
| 5331 | |
| 5332 | WeaponCalcGuncxx . . $ WeaponCalcGun(85e3752e9562a225).(&gun_point[WB_MOVE_STILLcxx . . $ `lib/robotfirestruct.h:79:9`!], &gun_normal[WB_MOVE_STILLcxx . . $ `lib/robotfirestruct.h:79:9`!], obj, |
| 5333 | pm->poly_wbcxx . . $ poly_model#poly_wb.[i].gp_indexcxx . . $ poly_wb_info#gp_index.[aiming_gp_index]); |
| 5334 | |
| 5335 | obj->dynamic_wbcxx . . $ object#dynamic_wb.[i].norm_turret_anglecxx . . $ dynamic_wb_info#norm_turret_angle.[j] = ta[WB_MOVE_RIGHTcxx . . $ `lib/robotfirestruct.h:80:9`!]; |
| 5336 | WeaponCalcGuncxx . . $ WeaponCalcGun(85e3752e9562a225).(&gun_point[WB_MOVE_RIGHTcxx . . $ `lib/robotfirestruct.h:80:9`!], &gun_normal[WB_MOVE_RIGHTcxx . . $ `lib/robotfirestruct.h:80:9`!], obj, |
| 5337 | pm->poly_wbcxx . . $ poly_model#poly_wb.[i].gp_indexcxx . . $ poly_wb_info#gp_index.[aiming_gp_index]); |
| 5338 | |
| 5339 | obj->dynamic_wbcxx . . $ object#dynamic_wb.[i].norm_turret_anglecxx . . $ dynamic_wb_info#norm_turret_angle.[j] = ta[WB_MOVE_LEFTcxx . . $ `lib/robotfirestruct.h:81:9`!]; |
| 5340 | WeaponCalcGuncxx . . $ WeaponCalcGun(85e3752e9562a225).(&gun_point[WB_MOVE_LEFTcxx . . $ `lib/robotfirestruct.h:81:9`!], &gun_normal[WB_MOVE_LEFTcxx . . $ `lib/robotfirestruct.h:81:9`!], obj, |
| 5341 | pm->poly_wbcxx . . $ poly_model#poly_wb.[i].gp_indexcxx . . $ poly_wb_info#gp_index.[aiming_gp_index]); |
| 5342 | |
| 5343 | // mprintf(0, "Weapon %f, %f, %f and normal %f, %f, %f\n", XYZ(&gun_point), XYZ(&gun_normal)); |
| 5344 | |
| 5345 | target_dir[WB_MOVE_STILLcxx . . $ `lib/robotfirestruct.h:79:9`!] =cxx . . $ vector#`operator=`(c0842353a20857d). ai_info->last_see_target_poscxx . . $ ai_frame#last_see_target_pos. -cxx . . $ operator-(b77b703cd1e43e33). gun_point[WB_MOVE_STILLcxx . . $ `lib/robotfirestruct.h:79:9`!]; |
| 5346 | target_dir[WB_MOVE_RIGHTcxx . . $ `lib/robotfirestruct.h:80:9`!] =cxx . . $ vector#`operator=`(c0842353a20857d). ai_info->last_see_target_poscxx . . $ ai_frame#last_see_target_pos. -cxx . . $ operator-(b77b703cd1e43e33). gun_point[WB_MOVE_RIGHTcxx . . $ `lib/robotfirestruct.h:80:9`!]; |
| 5347 | target_dir[WB_MOVE_LEFTcxx . . $ `lib/robotfirestruct.h:81:9`!] =cxx . . $ vector#`operator=`(c0842353a20857d). ai_info->last_see_target_poscxx . . $ ai_frame#last_see_target_pos. -cxx . . $ operator-(b77b703cd1e43e33). gun_point[WB_MOVE_LEFTcxx . . $ `lib/robotfirestruct.h:81:9`!]; |
| 5348 | |
| 5349 | vm_NormalizeVectorcxx . . $ vm_NormalizeVector(4939a7e530383cd4).(&target_dir[WB_MOVE_STILLcxx . . $ `lib/robotfirestruct.h:79:9`!]); |
| 5350 | vm_NormalizeVectorcxx . . $ vm_NormalizeVector(4939a7e530383cd4).(&target_dir[WB_MOVE_RIGHTcxx . . $ `lib/robotfirestruct.h:80:9`!]); |
| 5351 | vm_NormalizeVectorcxx . . $ vm_NormalizeVector(4939a7e530383cd4).(&target_dir[WB_MOVE_LEFTcxx . . $ `lib/robotfirestruct.h:81:9`!]); |
| 5352 | |
| 5353 | dot[WB_MOVE_STILLcxx . . $ `lib/robotfirestruct.h:79:9`!] = gun_normal[WB_MOVE_STILLcxx . . $ `lib/robotfirestruct.h:79:9`!] *cxx . . $ `operator*`(4a721543d64e126a). target_dir[WB_MOVE_STILLcxx . . $ `lib/robotfirestruct.h:79:9`!]; |
| 5354 | dot[WB_MOVE_RIGHTcxx . . $ `lib/robotfirestruct.h:80:9`!] = gun_normal[WB_MOVE_RIGHTcxx . . $ `lib/robotfirestruct.h:80:9`!] *cxx . . $ `operator*`(4a721543d64e126a). target_dir[WB_MOVE_RIGHTcxx . . $ `lib/robotfirestruct.h:80:9`!]; |
| 5355 | dot[WB_MOVE_LEFTcxx . . $ `lib/robotfirestruct.h:81:9`!] = gun_normal[WB_MOVE_LEFTcxx . . $ `lib/robotfirestruct.h:81:9`!] *cxx . . $ `operator*`(4a721543d64e126a). target_dir[WB_MOVE_LEFTcxx . . $ `lib/robotfirestruct.h:81:9`!]; |
| 5356 | |
| 5357 | if (dot[WB_MOVE_RIGHTcxx . . $ `lib/robotfirestruct.h:80:9`!] > dot[WB_MOVE_STILLcxx . . $ `lib/robotfirestruct.h:79:9`!]) |
| 5358 | best_dot = WB_MOVE_RIGHTcxx . . $ `lib/robotfirestruct.h:80:9`!; |
| 5359 | if (dot[WB_MOVE_LEFTcxx . . $ `lib/robotfirestruct.h:81:9`!] > dot[best_dot]) |
| 5360 | best_dot = WB_MOVE_LEFTcxx . . $ `lib/robotfirestruct.h:81:9`!; |
| 5361 | |
| 5362 | obj->dynamic_wbcxx . . $ object#dynamic_wb.[i].norm_turret_anglecxx . . $ dynamic_wb_info#norm_turret_angle.[j] = ta[best_dot]; |
| 5363 | |
| 5364 | uint8_tcxx . . $ uint8_t# last_t_d = obj->dynamic_wbcxx . . $ object#dynamic_wb.[i].turret_directioncxx . . $ dynamic_wb_info#turret_direction.[j]; |
| 5365 | |
| 5366 | if (dot[WB_MOVE_RIGHTcxx . . $ `lib/robotfirestruct.h:80:9`!] > dot[WB_MOVE_LEFTcxx . . $ `lib/robotfirestruct.h:81:9`!]) |
| 5367 | obj->dynamic_wbcxx . . $ object#dynamic_wb.[i].turret_directioncxx . . $ dynamic_wb_info#turret_direction.[j] = WB_MOVE_RIGHTcxx . . $ `lib/robotfirestruct.h:80:9`!; |
| 5368 | else |
| 5369 | obj->dynamic_wbcxx . . $ object#dynamic_wb.[i].turret_directioncxx . . $ dynamic_wb_info#turret_direction.[j] = WB_MOVE_LEFTcxx . . $ `lib/robotfirestruct.h:81:9`!; |
| 5370 | |
| 5371 | if (last_t_d != obj->dynamic_wbcxx . . $ object#dynamic_wb.[i].turret_directioncxx . . $ dynamic_wb_info#turret_direction.[j]) { |
| 5372 | if (ai_info->soundcxx . . $ ai_frame#sound.[AI_TURRET_SOUNDcxx . . $ `Descent3/aistruct_external.h:388:9`!] != SOUND_NONE_INDEXcxx . . $ `Descent3/sounds.h:105:9`! && |
| 5373 | (ai_info->last_sound_timecxx . . $ ai_frame#last_sound_time.[AI_TURRET_SOUNDcxx . . $ `Descent3/aistruct_external.h:388:9`!] + MIN_TURRET_SOUND_TIMEcxx . . $ `Descent3/AImain.cpp:5193:9`! <= Gametimecxx . . $ Gametime.)) { |
| 5374 | // Plays the sound and makes absolute sure that it is not looping |
| 5375 | Sound_systemcxx . . $ Sound_system..StopSoundLoopingcxx . . $ hlsSystem#StopSoundLooping(d4f767463ce0a6b3).( |
| 5376 | Sound_systemcxx . . $ Sound_system..Play3dSoundcxx . . $ hlsSystem#Play3dSound(17f485224ada8dd7).(ai_info->soundcxx . . $ ai_frame#sound.[AI_TURRET_SOUNDcxx . . $ `Descent3/aistruct_external.h:388:9`!], SND_PRIORITY_NORMALcxx . . $ `sndlib/ssl_lib.h:284:9`!, obj)); |
| 5377 | if (Game_modecxx . . $ Game_mode. & GM_MULTIcxx . . $ `Descent3/game.h:288:9`!) |
| 5378 | MultiPlay3dSoundcxx . . $ MultiPlay3dSound(f056c30c88236a5f).(ai_info->soundcxx . . $ ai_frame#sound.[AI_TURRET_SOUNDcxx . . $ `Descent3/aistruct_external.h:388:9`!], OBJNUMcxx . . $ `Descent3/object.h:700:9`!(obj), SND_PRIORITY_NORMALcxx . . $ `sndlib/ssl_lib.h:284:9`!); |
| 5379 | if (Demo_flagscxx . . $ Demo_flags. == DF_RECORDINGcxx . . $ `lib/demofile.h:122:9`!) |
| 5380 | DemoWrite3DSoundcxx . . $ DemoWrite3DSound(c29d531f7e56abb1).(ai_info->soundcxx . . $ ai_frame#sound.[AI_TURRET_SOUNDcxx . . $ `Descent3/aistruct_external.h:388:9`!], OBJNUMcxx . . $ `Descent3/object.h:700:9`!(obj), SND_PRIORITY_NORMALcxx . . $ `sndlib/ssl_lib.h:284:9`!); |
| 5381 | |
| 5382 | ai_info->last_sound_timecxx . . $ ai_frame#last_sound_time.[AI_TURRET_SOUNDcxx . . $ `Descent3/aistruct_external.h:388:9`!] = Gametimecxx . . $ Gametime.; |
| 5383 | } |
| 5384 | } |
| 5385 | |
| 5386 | obj->dynamic_wbcxx . . $ object#dynamic_wb.[i].turret_next_think_timecxx . . $ dynamic_wb_info#turret_next_think_time.[j] += pm->submodelcxx . . $ poly_model#submodel.[pm->poly_wbcxx . . $ poly_model#poly_wb.[i].turret_indexcxx . . $ poly_wb_info#turret_index.[j]].think_intervalcxx . . $ bsp_info#think_interval.; |
| 5387 | if (Demo_flagscxx . . $ Demo_flags. == DF_RECORDINGcxx . . $ `lib/demofile.h:122:9`!) { |
| 5388 | DemoWriteTurretChangedcxx . . $ DemoWriteTurretChanged(ed53e3bbd3fa2f69).(OBJNUMcxx . . $ `Descent3/object.h:700:9`!(obj)); |
| 5389 | } |
| 5390 | if (Game_modecxx . . $ Game_mode. & GM_MULTIcxx . . $ `Descent3/game.h:288:9`!) { |
| 5391 | MultiAddObjTurretUpdatecxx . . $ MultiAddObjTurretUpdate(d4f767463ce0a6b3).(OBJNUMcxx . . $ `Descent3/object.h:700:9`!(obj)); |
| 5392 | } |
| 5393 | |
| 5394 | } else { |
| 5395 | best_dot = obj->dynamic_wbcxx . . $ object#dynamic_wb.[i].turret_directioncxx . . $ dynamic_wb_info#turret_direction.[j]; |
| 5396 | |
| 5397 | if (best_dot != WB_MOVE_STILLcxx . . $ `lib/robotfirestruct.h:79:9`!) { |
| 5398 | min_invalid_ang = pm->submodelcxx . . $ poly_model#submodel.[pm->poly_wbcxx . . $ poly_model#poly_wb.[i].turret_indexcxx . . $ poly_wb_info#turret_index.[j]].fovcxx . . $ bsp_info#fov.; |
| 5399 | max_invalid_ang = 1.0 - min_invalid_ang; |
| 5400 | |
| 5401 | if (min_invalid_ang >= 0.5f) |
| 5402 | f_constrain = false; |
| 5403 | } |
| 5404 | |
| 5405 | // chrishack -- make next still |
| 5406 | switch (best_dot) { |
| 5407 | case WB_MOVE_STILLcxx . . $ `lib/robotfirestruct.h:79:9`!: |
| 5408 | ta[WB_MOVE_STILLcxx . . $ `lib/robotfirestruct.h:79:9`!] = obj->dynamic_wbcxx . . $ object#dynamic_wb.[i].norm_turret_anglecxx . . $ dynamic_wb_info#norm_turret_angle.[j]; |
| 5409 | break; |
| 5410 | |
| 5411 | case WB_MOVE_RIGHTcxx . . $ `lib/robotfirestruct.h:80:9`!: |
| 5412 | ta[WB_MOVE_RIGHTcxx . . $ `lib/robotfirestruct.h:80:9`!] = obj->dynamic_wbcxx . . $ object#dynamic_wb.[i].norm_turret_anglecxx . . $ dynamic_wb_info#norm_turret_angle.[j] - Frametimecxx . . $ Frametime. * rps; |
| 5413 | while (ta[WB_MOVE_RIGHTcxx . . $ `lib/robotfirestruct.h:80:9`!] < 0.0) |
| 5414 | ta[WB_MOVE_RIGHTcxx . . $ `lib/robotfirestruct.h:80:9`!] += 1.0f; |
| 5415 | |
| 5416 | if (f_constrain && ta[WB_MOVE_RIGHTcxx . . $ `lib/robotfirestruct.h:80:9`!] > min_invalid_ang && ta[WB_MOVE_RIGHTcxx . . $ `lib/robotfirestruct.h:80:9`!] < max_invalid_ang) { |
| 5417 | ta[WB_MOVE_RIGHTcxx . . $ `lib/robotfirestruct.h:80:9`!] = max_invalid_ang; |
| 5418 | f_turret_next_move_still = true; |
| 5419 | } |
| 5420 | break; |
| 5421 | |
| 5422 | case WB_MOVE_LEFTcxx . . $ `lib/robotfirestruct.h:81:9`!: |
| 5423 | ta[WB_MOVE_LEFTcxx . . $ `lib/robotfirestruct.h:81:9`!] = obj->dynamic_wbcxx . . $ object#dynamic_wb.[i].norm_turret_anglecxx . . $ dynamic_wb_info#norm_turret_angle.[j] + Frametimecxx . . $ Frametime. * rps; |
| 5424 | while (ta[WB_MOVE_LEFTcxx . . $ `lib/robotfirestruct.h:81:9`!] > 1.0) |
| 5425 | ta[WB_MOVE_LEFTcxx . . $ `lib/robotfirestruct.h:81:9`!] -= 1.0f; |
| 5426 | |
| 5427 | if (f_constrain && ta[WB_MOVE_LEFTcxx . . $ `lib/robotfirestruct.h:81:9`!] > min_invalid_ang && ta[WB_MOVE_LEFTcxx . . $ `lib/robotfirestruct.h:81:9`!] < max_invalid_ang) { |
| 5428 | ta[WB_MOVE_LEFTcxx . . $ `lib/robotfirestruct.h:81:9`!] = min_invalid_ang; |
| 5429 | f_turret_next_move_still = true; |
| 5430 | } |
| 5431 | break; |
| 5432 | } |
| 5433 | |
| 5434 | obj->dynamic_wbcxx . . $ object#dynamic_wb.[i].norm_turret_anglecxx . . $ dynamic_wb_info#norm_turret_angle.[j] = ta[best_dot]; |
| 5435 | |
| 5436 | if (WBIsBatteryReadycxx . . $ WBIsBatteryReady(ad7a19887510094c).(obj, &obj_info->static_wbcxx . . $ object_info#static_wb.[i], i) && |
| 5437 | !(Cinematic_inusecxx . . $ Cinematic_inuse. && !(ai_info->status_regcxx . . $ ai_frame#status_reg. & AISR_OK_TO_FIRE_DURING_CINEMATICScxx . . $ `Descent3/aistruct_external.h:401:9`!))) { |
| 5438 | WeaponCalcGuncxx . . $ WeaponCalcGun(85e3752e9562a225).(&gun_point[best_dot], &gun_normal[best_dot], obj, pm->poly_wbcxx . . $ poly_model#poly_wb.[i].gp_indexcxx . . $ poly_wb_info#gp_index.[aiming_gp_index]); |
| 5439 | |
| 5440 | target_dir[best_dot] =cxx . . $ vector#`operator=`(c0842353a20857d). ai_info->last_see_target_poscxx . . $ ai_frame#last_see_target_pos. -cxx . . $ operator-(b77b703cd1e43e33). gun_point[best_dot]; |
| 5441 | vm_NormalizeVectorcxx . . $ vm_NormalizeVector(4939a7e530383cd4).(&target_dir[best_dot]); |
| 5442 | dot[best_dot] = gun_normal[best_dot] *cxx . . $ `operator*`(4a721543d64e126a). target_dir[best_dot]; |
| 5443 | } |
| 5444 | } |
| 5445 | |
| 5446 | // This happens on a non-thinking frame the the turret hits a constrain |
| 5447 | if (f_turret_next_move_still) |
| 5448 | obj->dynamic_wbcxx . . $ object#dynamic_wb.[i].turret_directioncxx . . $ dynamic_wb_info#turret_direction.[j] = WB_MOVE_STILLcxx . . $ `lib/robotfirestruct.h:79:9`!; |
| 5449 | } |
| 5450 | |
| 5451 | if (Gametimecxx . . $ Gametime. - ai_info->last_see_target_timecxx . . $ ai_frame#last_see_target_time. < MAX_NOT_SEE_TARGET_FIRE_TIMEcxx . . $ `Descent3/AImain.cpp:5192:9`! || |
| 5452 | Gametimecxx . . $ Gametime. - ai_info->last_hear_target_timecxx . . $ ai_frame#last_hear_target_time. < MAX_NOT_SEE_TARGET_FIRE_TIMEcxx . . $ `Descent3/AImain.cpp:5192:9`!) { |
| 5453 | if (WBIsBatteryReadycxx . . $ WBIsBatteryReady(ad7a19887510094c).(obj, &obj_info->static_wbcxx . . $ object_info#static_wb.[i], i) && |
| 5454 | !(Cinematic_inusecxx . . $ Cinematic_inuse. && !(ai_info->status_regcxx . . $ ai_frame#status_reg. & AISR_OK_TO_FIRE_DURING_CINEMATICScxx . . $ `Descent3/aistruct_external.h:401:9`!))) { |
| 5455 | float fire_dot; |
| 5456 | |
| 5457 | if (obj_info->static_wbcxx . . $ object_info#static_wb.[i].flagscxx . . $ otype_wb_info#flags. & WBF_USE_CUSTOM_FOVcxx . . $ `lib/robotfirestruct_external.h:33:9`!) |
| 5458 | fire_dot = obj_info->static_wbcxx . . $ object_info#static_wb.[i].aiming_3d_dotcxx . . $ otype_wb_info#aiming_3d_dot.; |
| 5459 | else |
| 5460 | fire_dot = DEFAULT_FIRE_DOTcxx . . $ `Descent3/AImain.cpp:5194:9`!; |
| 5461 | |
| 5462 | if (dot[best_dot] >= fire_dot) { |
| 5463 | bool f_no_fire = false; |
| 5464 | int anim_type = obj_info->static_wbcxx . . $ object_info#static_wb.[i].flagscxx . . $ otype_wb_info#flags. & WBF_ANIM_MASKScxx . . $ `lib/robotfirestruct_external.h:30:9`!; |
| 5465 | |
| 5466 | if (ai_info->agressioncxx . . $ ai_frame#agression. == 0.0f && ai_info->memorycxx . . $ ai_frame#memory.[0].num_times_hitcxx . . $ ai_mem#num_times_hit. == 0) { |
| 5467 | // Assume no fire |
| 5468 | f_no_fire = true; |
| 5469 | |
| 5470 | objectcxx . . $ object# *target = ObjGetcxx . . $ ObjGet(11672e354c0b263a).(ai_info->target_handlecxx . . $ ai_frame#target_handle.); |
| 5471 | if (target) { |
| 5472 | fvi_querycxx . . $ fvi_query# fq; |
| 5473 | fvi_infocxx . . $ fvi_info# hit_info; |
| 5474 | int fate; |
| 5475 | int ignore_obj_list[100]; |
| 5476 | ignore_obj_list[0] = OBJNUMcxx . . $ `Descent3/object.h:700:9`!(obj); |
| 5477 | int num_ignored = 1; |
| 5478 | int i; |
| 5479 | |
| 5480 | // CHRISHACK - ONLY IGNORES FIRST LEVEL OF CHILDREN - DO RECERSIVE |
| 5481 | for (i = 0; i < Poly_modelscxx . . $ Poly_models.[obj->rtypecxx . . $ object#rtype..pobj_infocxx . . $ object#$anonymous_type_10#pobj_info..model_numcxx . . $ polyobj_info#model_num.].n_attachcxx . . $ poly_model#n_attach.; i++) { |
| 5482 | objectcxx . . $ object# *child; |
| 5483 | |
| 5484 | if ((child = ObjGetcxx . . $ ObjGet(11672e354c0b263a).(obj->attach_childrencxx . . $ object#attach_children.[i])) != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`! && num_ignored < 99) { |
| 5485 | ignore_obj_list[num_ignored++] = OBJNUMcxx . . $ `Descent3/object.h:700:9`!(child); |
| 5486 | } |
| 5487 | } |
| 5488 | |
| 5489 | ignore_obj_list[num_ignored] = -1; |
| 5490 | |
| 5491 | fq.p0cxx . . $ fvi_query#p0. = &obj->poscxx . . $ object#pos.; |
| 5492 | fq.p1cxx . . $ fvi_query#p1. = &target->poscxx . . $ object#pos.; |
| 5493 | fq.startroomcxx . . $ fvi_query#startroom. = obj->roomnumcxx . . $ object#roomnum.; |
| 5494 | |
| 5495 | fq.radcxx . . $ fvi_query#rad. = 0.01f; |
| 5496 | fq.flagscxx . . $ fvi_query#flags. = FQ_CHECK_OBJScxx . . $ `lib/findintersection_external.h:59:9`! | FQ_IGNORE_WEAPONScxx . . $ `lib/findintersection_external.h:79:9`! | FQ_IGNORE_POWERUPScxx . . $ `lib/findintersection_external.h:62:9`! | FQ_IGNORE_RENDER_THROUGH_PORTALScxx . . $ `lib/findintersection_external.h:84:9`! | |
| 5497 | FQ_NO_RELINKcxx . . $ `lib/findintersection_external.h:73:9`!; |
| 5498 | fq.thisobjnumcxx . . $ fvi_query#thisobjnum. = -1; |
| 5499 | fq.ignore_obj_listcxx . . $ fvi_query#ignore_obj_list. = ignore_obj_list; |
| 5500 | |
| 5501 | fate = fvi_FindIntersectioncxx . . $ fvi_FindIntersection(e1c4d7bd350effc8).(&fq, &hit_info); |
| 5502 | |
| 5503 | if (fate != HIT_TERRAINcxx . . $ `lib/findintersection_external.h:48:9`! && fate != HIT_WALLcxx . . $ `lib/findintersection_external.h:46:9`! && |
| 5504 | (((fate == HIT_OBJECTcxx . . $ `lib/findintersection_external.h:47:9`! || fate == HIT_SPHERE_2_POLY_OBJECTcxx . . $ `lib/findintersection_external.h:52:9`!) && |
| 5505 | hit_info.hit_objectcxx . . $ fvi_info#hit_object.[0] == OBJNUMcxx . . $ `Descent3/object.h:700:9`!(target)) || |
| 5506 | fate == HIT_NONEcxx . . $ `lib/findintersection_external.h:45:9`!)) { |
| 5507 | f_no_fire = false; |
| 5508 | } |
| 5509 | } |
| 5510 | } |
| 5511 | |
| 5512 | if (!f_no_fire) { |
| 5513 | if (anim_type == WBF_ANIM_LOCALcxx . . $ `lib/robotfirestruct_external.h:28:9`!) { |
| 5514 | WBSetupFireAnimcxx . . $ WBSetupFireAnim(cccf09a4825b46a4).(obj, &obj_info->static_wbcxx . . $ object_info#static_wb.[i], i); |
| 5515 | } else if (anim_type == WBF_ANIM_FULLcxx . . $ `lib/robotfirestruct_external.h:29:9`!) { |
| 5516 | gi_firecxx . . $ gi_fire# attack_info; |
| 5517 | |
| 5518 | attack_info.cur_wbcxx . . $ gi_fire#cur_wb. = i; |
| 5519 | attack_info.cur_maskcxx . . $ gi_fire#cur_mask. = obj->dynamic_wbcxx . . $ object#dynamic_wb.[i].cur_firing_maskcxx . . $ dynamic_wb_info#cur_firing_mask.; |
| 5520 | |
| 5521 | GoalAddGoalcxx . . $ GoalAddGoal(e0a3c222b6aee5c7).(obj, AIG_FIRE_AT_OBJcxx . . $ `Descent3/aistruct_external.h:185:9`!, (void *)&attack_info, ACTIVATION_BLEND_LEVELcxx . . $ `Descent3/aistruct_external.h:280:9`!); |
| 5522 | } else { |
| 5523 | WBFireBatterycxx . . $ WBFireBattery(cccf09a4825b46a4).(obj, &obj_info->static_wbcxx . . $ object_info#static_wb.[i], i); |
| 5524 | ai_info->status_regcxx . . $ ai_frame#status_reg. &= ~AISR_RANGED_ATTACKcxx . . $ `Descent3/aistruct_external.h:399:9`!; |
| 5525 | } |
| 5526 | } else { |
| 5527 | ai_info->status_regcxx . . $ ai_frame#status_reg. &= ~AISR_RANGED_ATTACKcxx . . $ `Descent3/aistruct_external.h:399:9`!; |
| 5528 | obj->dynamic_wbcxx . . $ object#dynamic_wb.[i].last_fire_timecxx . . $ dynamic_wb_info#last_fire_time. = Gametimecxx . . $ Gametime. + 1.0f + ps_randcxx . . $ ps_rand(b126dc7c1de90089).() / (float)D3_RAND_MAXcxx . . $ `misc/psrand.h:41:9`!; |
| 5529 | } |
| 5530 | } |
| 5531 | } |
| 5532 | } |
| 5533 | } |
| 5534 | } |
| 5535 | |
| 5536 | #define PERCENT_QUIRK_PER_SECcxx . . $ `Descent3/AImain.cpp:5536:9`! .1 |
| 5537 | #define PERCENT_TAUNT_PER_SECcxx . . $ `Descent3/AImain.cpp:5537:9`! .1 |
| 5538 | |
| 5539 | static inline void do_awareness_based_anim_stuffcxx . . $ do_awareness_based_anim_stuff(419c470199a90a97).(objectcxx . . $ object# *obj) { |
| 5540 | int next_anim; |
| 5541 | ai_framecxx . . $ ai_frame# *ai_info = obj->ai_infocxx . . $ object#ai_info.; |
| 5542 | |
| 5543 | if (ai_info->awarenesscxx . . $ ai_frame#awareness. <= AWARE_BARELYcxx . . $ `Descent3/aistruct_external.h:326:9`!) { |
| 5544 | 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_GOTO_ALERT_STANDINGcxx . . $ `Descent3/aistruct_external.h:428:9`!) { |
| 5545 | next_anim = AS_IDLEcxx . . $ `Descent3/aistruct_external.h:419:9`!; |
| 5546 | GoalAddGoalcxx . . $ GoalAddGoal(e0a3c222b6aee5c7).(obj, AIG_SET_ANIMcxx . . $ `Descent3/aistruct_external.h:196:9`!, (void *)&next_anim, ACTIVATION_BLEND_LEVELcxx . . $ `Descent3/aistruct_external.h:280:9`!); |
| 5547 | } else if (ai_info->animation_typecxx . . $ ai_frame#animation_type. == AS_IDLEcxx . . $ `Descent3/aistruct_external.h:419:9`! && ai_info->next_animation_typecxx . . $ ai_frame#next_animation_type. != AS_GOTO_IDLE_STANDINGcxx . . $ `Descent3/aistruct_external.h:423:9`!) { |
| 5548 | float local_seed = OBJNUMcxx . . $ `Descent3/object.h:700:9`!(obj) / 32.0f; |
| 5549 | |
| 5550 | int new_time_int = Gametimecxx . . $ Gametime. + local_seed; |
| 5551 | int last_time_int = Gametimecxx . . $ Gametime. - Frametimecxx . . $ Frametime. + local_seed; |
| 5552 | |
| 5553 | // Once a second we have a chance of doing a quirk |
| 5554 | if (new_time_int != last_time_int) { |
| 5555 | if (ps_randcxx . . $ ps_rand(b126dc7c1de90089).() < D3_RAND_MAXcxx . . $ `misc/psrand.h:41:9`! * PERCENT_QUIRK_PER_SECcxx . . $ `Descent3/AImain.cpp:5536:9`!) { |
| 5556 | next_anim = AS_QUIRKcxx . . $ `Descent3/aistruct_external.h:420:9`!; |
| 5557 | GoalAddGoalcxx . . $ GoalAddGoal(e0a3c222b6aee5c7).(obj, AIG_SET_ANIMcxx . . $ `Descent3/aistruct_external.h:196:9`!, (void *)&next_anim, ACTIVATION_BLEND_LEVELcxx . . $ `Descent3/aistruct_external.h:280:9`!); |
| 5558 | } |
| 5559 | } |
| 5560 | } |
| 5561 | } else if (ai_info->animation_typecxx . . $ ai_frame#animation_type. == AS_IDLEcxx . . $ `Descent3/aistruct_external.h:419:9`! || ai_info->animation_typecxx . . $ ai_frame#animation_type. == AS_QUIRKcxx . . $ `Descent3/aistruct_external.h:420:9`! || |
| 5562 | ai_info->animation_typecxx . . $ ai_frame#animation_type. == AS_BIRTHcxx . . $ `Descent3/aistruct_external.h:411:9`!) { |
| 5563 | next_anim = AS_ALERTcxx . . $ `Descent3/aistruct_external.h:409:9`!; |
| 5564 | GoalAddGoalcxx . . $ GoalAddGoal(e0a3c222b6aee5c7).(obj, AIG_SET_ANIMcxx . . $ `Descent3/aistruct_external.h:196:9`!, (void *)&next_anim, ACTIVATION_BLEND_LEVELcxx . . $ `Descent3/aistruct_external.h:280:9`!); |
| 5565 | } else if (ai_info->animation_typecxx . . $ ai_frame#animation_type. == AS_ALERTcxx . . $ `Descent3/aistruct_external.h:409:9`!) { |
| 5566 | if (!(ai_info->flagscxx . . $ ai_frame#flags. & AIF_ONLY_TAUNT_AT_DEATHcxx . . $ `Descent3/aistruct_external.h:360:9`!) && |
| 5567 | (Object_infocxx . . $ Object_info.[obj->idcxx . . $ object#id.].animcxx . . $ object_info#anim.[ai_info->movement_typecxx . . $ ai_frame#movement_type.].elemcxx . . $ anim_elem#elem.[AS_TAUNTcxx . . $ `Descent3/aistruct_external.h:422:9`!].tocxx . . $ anim_entry#to. != 0.0f)) { |
| 5568 | float local_seed = OBJNUMcxx . . $ `Descent3/object.h:700:9`!(obj) / 32.0f; |
| 5569 | |
| 5570 | int new_time_int = Gametimecxx . . $ Gametime. + local_seed; |
| 5571 | int last_time_int = Gametimecxx . . $ Gametime. - Frametimecxx . . $ Frametime. + local_seed; |
| 5572 | |
| 5573 | // Once a second we have a chance of doing a quirk |
| 5574 | if (new_time_int != last_time_int) { |
| 5575 | if (ps_randcxx . . $ ps_rand(b126dc7c1de90089).() < D3_RAND_MAXcxx . . $ `misc/psrand.h:41:9`! * PERCENT_TAUNT_PER_SECcxx . . $ `Descent3/AImain.cpp:5537:9`!) { |
| 5576 | next_anim = AS_TAUNTcxx . . $ `Descent3/aistruct_external.h:422:9`!; |
| 5577 | GoalAddGoalcxx . . $ GoalAddGoal(e0a3c222b6aee5c7).(obj, AIG_SET_ANIMcxx . . $ `Descent3/aistruct_external.h:196:9`!, (void *)&next_anim, ACTIVATION_BLEND_LEVELcxx . . $ `Descent3/aistruct_external.h:280:9`!); |
| 5578 | } |
| 5579 | } |
| 5580 | } |
| 5581 | } |
| 5582 | } |
| 5583 | |
| 5584 | static inline void ai_decrease_awarenesscxx . . $ ai_decrease_awareness(419c470199a90a97).(objectcxx . . $ object# *obj) { |
| 5585 | ai_framecxx . . $ ai_frame# *ai_info = obj->ai_infocxx . . $ object#ai_info.; |
| 5586 | |
| 5587 | if (ai_info->awarenesscxx . . $ ai_frame#awareness. == AWARE_NONEcxx . . $ `Descent3/aistruct_external.h:327:9`! && !(ai_info->flagscxx . . $ ai_frame#flags. & AIF_PERSISTANTcxx . . $ `Descent3/aistruct_external.h:354:9`!)) { |
| 5588 | #ifdef _DEBUGcxx . . $ `<built-in>:482:9`! |
| 5589 | if (AI_debug_robot_docxx . . $ AI_debug_robot_do. && OBJNUMcxx . . $ `Descent3/object.h:700:9`!(obj) == AI_debug_robot_indexcxx . . $ AI_debug_robot_index.) { |
| 5590 | mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "AI Note: In free path\n"); |
| 5591 | } |
| 5592 | #endif |
| 5593 | AIPathFreePathcxx . . $ AIPathFreePath(211cadd9cc3984f1).(&ai_info->pathcxx . . $ ai_frame#path.); |
| 5594 | } |
| 5595 | |
| 5596 | if (Gametimecxx . . $ Gametime. - ai_info->last_render_timecxx . . $ ai_frame#last_render_time. < AWARENESS_RENDER_RECENTLY_INTERVALcxx . . $ `Descent3/aistruct_external.h:332:9`! || |
| 5597 | Gametimecxx . . $ Gametime. - ai_info->last_see_target_timecxx . . $ ai_frame#last_see_target_time. < AWARENESS_SEE_TARGET_RECENTLY_INTERVALcxx . . $ `Descent3/aistruct_external.h:333:9`! || |
| 5598 | Gametimecxx . . $ Gametime. - ai_info->last_hear_target_timecxx . . $ ai_frame#last_hear_target_time. < AWARENESS_SEE_TARGET_RECENTLY_INTERVALcxx . . $ `Descent3/aistruct_external.h:333:9`!) |
| 5599 | ai_info->awarenesscxx . . $ ai_frame#awareness. -= (AWARE_RENDER_RECENTLY_FALLOFFcxx . . $ `Descent3/aistruct_external.h:336:9`! * Frametimecxx . . $ Frametime.); |
| 5600 | else |
| 5601 | ai_info->awarenesscxx . . $ ai_frame#awareness. -= (AWARE_FALLOFFcxx . . $ `Descent3/aistruct_external.h:335:9`! * Frametimecxx . . $ Frametime.); |
| 5602 | |
| 5603 | if (ai_info->awarenesscxx . . $ ai_frame#awareness. < AWARE_NONEcxx . . $ `Descent3/aistruct_external.h:327:9`!) { |
| 5604 | ai_info->awarenesscxx . . $ ai_frame#awareness. = AWARE_NONEcxx . . $ `Descent3/aistruct_external.h:327:9`!; |
| 5605 | } |
| 5606 | |
| 5607 | // mprintf(0, "Awareness %f", ai_info->awareness); |
| 5608 | } |
| 5609 | |
| 5610 | static inline bool ai_do_script_stuffcxx . . $ ai_do_script_stuff(39516aeee13ca5ab).(objectcxx . . $ object# *obj) { |
| 5611 | tOSIRISEventInfocxx . . $ tOSIRISEventInfo# ei; |
| 5612 | Osiris_CallEventcxx . . $ Osiris_CallEvent(91e8d3045aa5549c).(obj, EVT_AI_FRAMEcxx . . $ `scripts/osiris_common.h:364:9`!, &ei); |
| 5613 | //@$-D3XExecScript(obj, EVT_AI_FRAME, NULL, REF_OBJTYPE, NULL); |
| 5614 | |
| 5615 | return true; |
| 5616 | } |
| 5617 | |
| 5618 | static inline void ai_walker_stuffcxx . . $ ai_walker_stuff(419c470199a90a97).(objectcxx . . $ object# *obj) { |
| 5619 | ai_framecxx . . $ ai_frame# *ai_info = obj->ai_infocxx . . $ object#ai_info.; |
| 5620 | |
| 5621 | // Do standing->walking and walking->standing stuff |
| 5622 | if (ai_info->movement_typecxx . . $ ai_frame#movement_type. == MC_STANDINGcxx . . $ `Descent3/object_external.h:245:9`!) { |
| 5623 | int next_anim; |
| 5624 | |
| 5625 | if (vm_GetMagnitudecxx . . $ vm_GetMagnitude(4939a7e530383cd4).(&obj->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..velocitycxx . . $ physics_info#velocity.) > 0.01f || |
| 5626 | vm_GetMagnitudecxx . . $ vm_GetMagnitude(4939a7e530383cd4).(&obj->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..rotvelcxx . . $ physics_info#$anonymous_type_1#rotvel.) > 0.01) { |
| 5627 | if (ai_info->next_animation_typecxx . . $ ai_frame#next_animation_type. == AI_INVALID_INDEXcxx . . $ `Descent3/aistruct.h:404:9`!) { |
| 5628 | if (ai_info->animation_typecxx . . $ ai_frame#animation_type. == AS_ALERTcxx . . $ `Descent3/aistruct_external.h:409:9`!) { |
| 5629 | next_anim = AS_GOTO_ALERT_WALKINGcxx . . $ `Descent3/aistruct_external.h:431:9`!; |
| 5630 | GoalAddGoalcxx . . $ GoalAddGoal(e0a3c222b6aee5c7).(obj, AIG_SET_ANIMcxx . . $ `Descent3/aistruct_external.h:196:9`!, (void *)&next_anim, ACTIVATION_BLEND_LEVELcxx . . $ `Descent3/aistruct_external.h:280:9`!); |
| 5631 | } else if (ai_info->animation_typecxx . . $ ai_frame#animation_type. == AS_IDLEcxx . . $ `Descent3/aistruct_external.h:419:9`! || ai_info->animation_typecxx . . $ ai_frame#animation_type. == AS_QUIRKcxx . . $ `Descent3/aistruct_external.h:420:9`! || |
| 5632 | ai_info->animation_typecxx . . $ ai_frame#animation_type. == AS_BIRTHcxx . . $ `Descent3/aistruct_external.h:411:9`!) { |
| 5633 | next_anim = AS_GOTO_IDLE_WALKINGcxx . . $ `Descent3/aistruct_external.h:426:9`!; |
| 5634 | GoalAddGoalcxx . . $ GoalAddGoal(e0a3c222b6aee5c7).(obj, AIG_SET_ANIMcxx . . $ `Descent3/aistruct_external.h:196:9`!, (void *)&next_anim, ACTIVATION_BLEND_LEVELcxx . . $ `Descent3/aistruct_external.h:280:9`!); |
| 5635 | } |
| 5636 | } |
| 5637 | |
| 5638 | obj->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..velocitycxx . . $ physics_info#velocity. =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). Zero_vectorcxx . . $ Zero_vector.; |
| 5639 | } |
| 5640 | } else if (ai_info->movement_typecxx . . $ ai_frame#movement_type. == MC_WALKINGcxx . . $ `Descent3/object_external.h:248:9`!) { |
| 5641 | int next_anim; |
| 5642 | |
| 5643 | if (vm_GetMagnitudecxx . . $ vm_GetMagnitude(4939a7e530383cd4).(&obj->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..velocitycxx . . $ physics_info#velocity.) <= 0.01f && |
| 5644 | vm_GetMagnitudecxx . . $ vm_GetMagnitude(4939a7e530383cd4).(&obj->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..rotvelcxx . . $ physics_info#$anonymous_type_1#rotvel.) <= 0.01) { |
| 5645 | if (ai_info->animation_typecxx . . $ ai_frame#animation_type. == AS_ALERTcxx . . $ `Descent3/aistruct_external.h:409:9`!) { |
| 5646 | next_anim = AS_GOTO_ALERT_STANDINGcxx . . $ `Descent3/aistruct_external.h:428:9`!; |
| 5647 | GoalAddGoalcxx . . $ GoalAddGoal(e0a3c222b6aee5c7).(obj, AIG_SET_ANIMcxx . . $ `Descent3/aistruct_external.h:196:9`!, (void *)&next_anim, ACTIVATION_BLEND_LEVELcxx . . $ `Descent3/aistruct_external.h:280:9`!); |
| 5648 | } else if (ai_info->animation_typecxx . . $ ai_frame#animation_type. == AS_IDLEcxx . . $ `Descent3/aistruct_external.h:419:9`!) { |
| 5649 | next_anim = AS_GOTO_IDLE_STANDINGcxx . . $ `Descent3/aistruct_external.h:423:9`!; |
| 5650 | GoalAddGoalcxx . . $ GoalAddGoal(e0a3c222b6aee5c7).(obj, AIG_SET_ANIMcxx . . $ `Descent3/aistruct_external.h:196:9`!, (void *)&next_anim, ACTIVATION_BLEND_LEVELcxx . . $ `Descent3/aistruct_external.h:280:9`!); |
| 5651 | } |
| 5652 | } |
| 5653 | } |
| 5654 | } |
| 5655 | |
| 5656 | int AIGetTeamcxx . . $ AIGetTeam(2da2a862cad4c994).(objectcxx . . $ object# *obj) { |
| 5657 | int t_team; |
| 5658 | |
| 5659 | if (obj->typecxx . . $ object#type. == OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`!) { |
| 5660 | if (Num_teamscxx . . $ Num_teams. > 1 || ((Game_modecxx . . $ Game_mode. & GM_MULTIcxx . . $ `Descent3/game.h:288:9`!) && Num_teamscxx . . $ Num_teams. <= 1 && !(Netgamecxx . . $ Netgame..flagscxx . . $ netgame_info#flags. & NF_DAMAGE_FRIENDLYcxx . . $ `Descent3/multi_external.h:235:9`!))) { |
| 5661 | t_team = AIF_TEAM_REBELcxx . . $ `Descent3/aistruct_external.h:366:9`! + PlayerGetTeamcxx . . $ PlayerGetTeam(7864480464b09eea).(obj->idcxx . . $ object#id.) + 1; |
| 5662 | //@@t_team = AIF_TEAM_REBEL + Players[obj->id].team + 1; |
| 5663 | } else { |
| 5664 | t_team = AIF_TEAM_REBELcxx . . $ `Descent3/aistruct_external.h:366:9`! + obj->idcxx . . $ object#id. + 1; |
| 5665 | } |
| 5666 | } else { |
| 5667 | if (obj->ai_infocxx . . $ object#ai_info.->flagscxx . . $ ai_frame#flags. & AIF_ACT_AS_NEUTRAL_UNTIL_SHOTcxx . . $ `Descent3/aistruct_external.h:353:9`!) { |
| 5668 | t_team = AIF_TEAM_NEUTRALcxx . . $ `Descent3/aistruct_external.h:368:9`!; |
| 5669 | } else { |
| 5670 | t_team = obj->ai_infocxx . . $ object#ai_info.->flagscxx . . $ ai_frame#flags. & AIF_TEAM_MASKcxx . . $ `Descent3/aistruct_external.h:364:9`!; |
| 5671 | |
| 5672 | if (t_team == AIF_TEAM_REBELcxx . . $ `Descent3/aistruct_external.h:366:9`!) { |
| 5673 | objectcxx . . $ object# *p = ObjGetcxx . . $ ObjGet(11672e354c0b263a).(obj->parent_handlecxx . . $ object#parent_handle.); |
| 5674 | |
| 5675 | if (p && (p->typecxx . . $ object#type. == OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`! || p->typecxx . . $ object#type. == OBJ_GHOSTcxx . . $ `Descent3/object_external.h:172:9`!)) { |
| 5676 | if (Num_teamscxx . . $ Num_teams. > 1) { |
| 5677 | t_team += PlayerGetTeamcxx . . $ PlayerGetTeam(7864480464b09eea).(p->idcxx . . $ object#id.) + 1; |
| 5678 | //@@t_team += Players[p->id].team + 1; |
| 5679 | } else { |
| 5680 | t_team += p->idcxx . . $ object#id. + 1; |
| 5681 | } |
| 5682 | } |
| 5683 | } |
| 5684 | } |
| 5685 | } |
| 5686 | |
| 5687 | return t_team; |
| 5688 | } |
| 5689 | |
| 5690 | bool AIObjFriendcxx . . $ AIObjFriend(9fa7d4d2c8b4c2db).(objectcxx . . $ object# *obj, objectcxx . . $ object# *target) { |
| 5691 | bool f_friend = false; |
| 5692 | |
| 5693 | // If an object isn't an AI object, it isn't a friend |
| 5694 | if (!obj || !target || (target->typecxx . . $ object#type. != OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`! && !target->ai_infocxx . . $ object#ai_info.) || (obj->typecxx . . $ object#type. != OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`! && !obj->ai_infocxx . . $ object#ai_info.)) |
| 5695 | return false; |
| 5696 | |
| 5697 | if (obj->typecxx . . $ object#type. == OBJ_GHOSTcxx . . $ `Descent3/object_external.h:172:9`! || obj->typecxx . . $ object#type. == OBJ_POWERUPcxx . . $ `Descent3/object_external.h:167:9`! || (obj->flagscxx . . $ object#flags. & OF_DESTROYEDcxx . . $ `Descent3/object_external.h:271:9`!)) |
| 5698 | return false; |
| 5699 | |
| 5700 | if ((target->control_typecxx . . $ object#control_type. == CT_AIcxx . . $ `Descent3/object_external.h:217:9`!) && (target->movement_typecxx . . $ object#movement_type. == MT_NONEcxx . . $ `Descent3/object_external.h:233:9`!) && |
| 5701 | Poly_modelscxx . . $ Poly_models.[target->rtypecxx . . $ object#rtype..pobj_infocxx . . $ object#$anonymous_type_10#pobj_info..model_numcxx . . $ polyobj_info#model_num.].num_wbscxx . . $ poly_model#num_wbs. == 0) { |
| 5702 | return false; |
| 5703 | } |
| 5704 | |
| 5705 | if (obj->typecxx . . $ object#type. == OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`! && (Playerscxx . . $ Players.[obj->idcxx . . $ object#id.].flagscxx . . $ player#flags. & PLAYER_FLAGS_DEADcxx . . $ `Descent3/player_external.h:81:9`!)) |
| 5706 | return false; |
| 5707 | |
| 5708 | int team = AIGetTeamcxx . . $ AIGetTeam(2da2a862cad4c994).(obj); |
| 5709 | int t_team = AIGetTeamcxx . . $ AIGetTeam(2da2a862cad4c994).(target); |
| 5710 | |
| 5711 | // If this object is targetting you - it is your enemy |
| 5712 | if ((target->control_typecxx . . $ object#control_type. == CT_AIcxx . . $ `Descent3/object_external.h:217:9`!) && (target->ai_infocxx . . $ object#ai_info.->target_handlecxx . . $ ai_frame#target_handle. == obj->handlecxx . . $ object#handle.)) { |
| 5713 | return false; |
| 5714 | } |
| 5715 | |
| 5716 | // If its neutral and not targetting you -- its not an enemy (unless your hostile) |
| 5717 | if (team == AIF_TEAM_HOSTILEcxx . . $ `Descent3/aistruct_external.h:367:9`!) |
| 5718 | return false; |
| 5719 | |
| 5720 | // Related objects shouldn't kill each other |
| 5721 | if (ObjectsAreRelatedcxx . . $ ObjectsAreRelated(cf9ef193275fa6d8).(OBJNUMcxx . . $ `Descent3/object.h:700:9`!(obj), OBJNUMcxx . . $ `Descent3/object.h:700:9`!(target))) { |
| 5722 | return true; |
| 5723 | } |
| 5724 | |
| 5725 | if (obj->parent_handlecxx . . $ object#parent_handle. == target->handlecxx . . $ object#handle. || target->parent_handlecxx . . $ object#parent_handle. == obj->handlecxx . . $ object#handle.) { |
| 5726 | return true; |
| 5727 | } |
| 5728 | |
| 5729 | switch (team) { |
| 5730 | case AIF_TEAM_PTMCcxx . . $ `Descent3/aistruct_external.h:365:9`!: |
| 5731 | if (t_team == AIF_TEAM_PTMCcxx . . $ `Descent3/aistruct_external.h:365:9`!) { |
| 5732 | f_friend = true; |
| 5733 | } |
| 5734 | break; |
| 5735 | |
| 5736 | case AIF_TEAM_HOSTILEcxx . . $ `Descent3/aistruct_external.h:367:9`!: |
| 5737 | f_friend = false; |
| 5738 | break; |
| 5739 | |
| 5740 | case AIF_TEAM_NEUTRALcxx . . $ `Descent3/aistruct_external.h:368:9`!: |
| 5741 | |
| 5742 | if (t_team == AIF_TEAM_NEUTRALcxx . . $ `Descent3/aistruct_external.h:368:9`!) { |
| 5743 | f_friend = true; |
| 5744 | } |
| 5745 | break; |
| 5746 | |
| 5747 | // A player team |
| 5748 | default: |
| 5749 | // All REBEL sub teams are friends with non player-parented rebels |
| 5750 | if (t_team == AIF_TEAM_REBELcxx . . $ `Descent3/aistruct_external.h:366:9`! || team == AIF_TEAM_REBELcxx . . $ `Descent3/aistruct_external.h:366:9`! || t_team == team) { |
| 5751 | f_friend = true; |
| 5752 | } |
| 5753 | break; |
| 5754 | } |
| 5755 | |
| 5756 | return f_friend; |
| 5757 | } |
| 5758 | |
| 5759 | bool AIObjEnemycxx . . $ AIObjEnemy(9fa7d4d2c8b4c2db).(objectcxx . . $ object# *obj, objectcxx . . $ object# *target) { |
| 5760 | bool f_enemy = false; |
| 5761 | |
| 5762 | // If an object isn't an AI object or player, it isn't an enemy |
| 5763 | if (!obj || !target || (target->typecxx . . $ object#type. != OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`! && !target->ai_infocxx . . $ object#ai_info.) || (obj->typecxx . . $ object#type. != OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`! && !obj->ai_infocxx . . $ object#ai_info.)) |
| 5764 | return false; |
| 5765 | |
| 5766 | if (obj->typecxx . . $ object#type. == OBJ_GHOSTcxx . . $ `Descent3/object_external.h:172:9`! || obj->typecxx . . $ object#type. == OBJ_POWERUPcxx . . $ `Descent3/object_external.h:167:9`! || (obj->flagscxx . . $ object#flags. & OF_DESTROYEDcxx . . $ `Descent3/object_external.h:271:9`!)) |
| 5767 | return false; |
| 5768 | |
| 5769 | if (obj->typecxx . . $ object#type. == OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`! && (Playerscxx . . $ Players.[obj->idcxx . . $ object#id.].flagscxx . . $ player#flags. & PLAYER_FLAGS_DEADcxx . . $ `Descent3/player_external.h:81:9`!)) |
| 5770 | return false; |
| 5771 | |
| 5772 | int team = AIGetTeamcxx . . $ AIGetTeam(2da2a862cad4c994).(obj); |
| 5773 | int t_team = AIGetTeamcxx . . $ AIGetTeam(2da2a862cad4c994).(target); |
| 5774 | |
| 5775 | // If this object is targetting you - it is your enemy |
| 5776 | if ((target->control_typecxx . . $ object#control_type. == CT_AIcxx . . $ `Descent3/object_external.h:217:9`!) && (target->ai_infocxx . . $ object#ai_info.->target_handlecxx . . $ ai_frame#target_handle. == obj->handlecxx . . $ object#handle.)) { |
| 5777 | return true; |
| 5778 | } |
| 5779 | |
| 5780 | if ((target->control_typecxx . . $ object#control_type. == CT_AIcxx . . $ `Descent3/object_external.h:217:9`!) && (target->movement_typecxx . . $ object#movement_type. == MT_NONEcxx . . $ `Descent3/object_external.h:233:9`!) && |
| 5781 | Poly_modelscxx . . $ Poly_models.[target->rtypecxx . . $ object#rtype..pobj_infocxx . . $ object#$anonymous_type_10#pobj_info..model_numcxx . . $ polyobj_info#model_num.].num_wbscxx . . $ poly_model#num_wbs. == 0) { |
| 5782 | return false; |
| 5783 | } |
| 5784 | |
| 5785 | // If its neutral and not targetting you -- its not an enemy (unless your hostile) |
| 5786 | if ((team != AIF_TEAM_HOSTILEcxx . . $ `Descent3/aistruct_external.h:367:9`!) && (t_team == AIF_TEAM_NEUTRALcxx . . $ `Descent3/aistruct_external.h:368:9`! && target->ai_infocxx . . $ object#ai_info.->target_handlecxx . . $ ai_frame#target_handle. != obj->handlecxx . . $ object#handle.)) { |
| 5787 | return false; |
| 5788 | } |
| 5789 | |
| 5790 | // Related objects shouldn't kill each other |
| 5791 | if (ObjectsAreRelatedcxx . . $ ObjectsAreRelated(cf9ef193275fa6d8).(OBJNUMcxx . . $ `Descent3/object.h:700:9`!(obj), OBJNUMcxx . . $ `Descent3/object.h:700:9`!(target))) { |
| 5792 | return false; |
| 5793 | } |
| 5794 | |
| 5795 | if (obj->parent_handlecxx . . $ object#parent_handle. == target->handlecxx . . $ object#handle. || target->parent_handlecxx . . $ object#parent_handle. == obj->handlecxx . . $ object#handle.) { |
| 5796 | return false; |
| 5797 | } |
| 5798 | |
| 5799 | switch (team) { |
| 5800 | case AIF_TEAM_PTMCcxx . . $ `Descent3/aistruct_external.h:365:9`!: |
| 5801 | if (t_team != AIF_TEAM_PTMCcxx . . $ `Descent3/aistruct_external.h:365:9`!) { |
| 5802 | f_enemy = true; |
| 5803 | } |
| 5804 | break; |
| 5805 | |
| 5806 | case AIF_TEAM_HOSTILEcxx . . $ `Descent3/aistruct_external.h:367:9`!: |
| 5807 | f_enemy = true; |
| 5808 | break; |
| 5809 | |
| 5810 | case AIF_TEAM_NEUTRALcxx . . $ `Descent3/aistruct_external.h:368:9`!: |
| 5811 | |
| 5812 | ASSERTcxx . . $ `misc/pserror.h:246:9`!(obj->ai_info); |
| 5813 | |
| 5814 | if (obj->ai_infocxx . . $ object#ai_info.->target_handlecxx . . $ ai_frame#target_handle. == target->handlecxx . . $ object#handle.) { |
| 5815 | f_enemy = true; |
| 5816 | } |
| 5817 | break; |
| 5818 | |
| 5819 | // A player team |
| 5820 | default: |
| 5821 | // All REBEL sub teams are friends with non player-parented rebels |
| 5822 | if (t_team == AIF_TEAM_PTMCcxx . . $ `Descent3/aistruct_external.h:365:9`! || t_team == AIF_TEAM_HOSTILEcxx . . $ `Descent3/aistruct_external.h:367:9`! || |
| 5823 | (t_team != AIF_TEAM_REBELcxx . . $ `Descent3/aistruct_external.h:366:9`! && team != AIF_TEAM_REBELcxx . . $ `Descent3/aistruct_external.h:366:9`! && t_team != team && |
| 5824 | !(((Game_modecxx . . $ Game_mode. & GM_MULTIcxx . . $ `Descent3/game.h:288:9`!) && Num_teamscxx . . $ Num_teams. <= 1 && !(Netgamecxx . . $ Netgame..flagscxx . . $ netgame_info#flags. & NF_DAMAGE_FRIENDLYcxx . . $ `Descent3/multi_external.h:235:9`!))))) { |
| 5825 | f_enemy = true; |
| 5826 | } |
| 5827 | break; |
| 5828 | } |
| 5829 | |
| 5830 | return f_enemy; |
| 5831 | } |
| 5832 | |
| 5833 | #define AI_FORGIVE_AGRESSION_MULTIPLIERcxx . . $ `Descent3/AImain.cpp:5833:9`! 1.2f |
| 5834 | |
| 5835 | void AITargetCheckcxx . . $ AITargetCheck(4dd6dd5a44f23de7).(objectcxx . . $ object# *obj, objectcxx . . $ object# *target, objectcxx . . $ object# **best_obj, float *best_dot, float *best_dist) { |
| 5836 | bool f_use_dot = (obj->ai_infocxx . . $ object#ai_info.->flagscxx . . $ ai_frame#flags. & AIF_TARGET_BY_DISTcxx . . $ `Descent3/aistruct_external.h:373:9`!) != 0; |
| 5837 | |
| 5838 | if (AIObjEnemycxx . . $ AIObjEnemy(9fa7d4d2c8b4c2db).(obj, target)) { |
| 5839 | float dot; |
| 5840 | float dist; |
| 5841 | vectorcxx . . $ vector# to_obj; |
| 5842 | fvi_querycxx . . $ fvi_query# fq; |
| 5843 | fvi_infocxx . . $ fvi_info# hit_info; |
| 5844 | int fate; |
| 5845 | |
| 5846 | if (obj == target) |
| 5847 | return; |
| 5848 | |
| 5849 | if (!BOA_IsVisiblecxx . . $ BOA_IsVisible(cf9ef193275fa6d8).(obj->roomnumcxx . . $ object#roomnum., target->roomnumcxx . . $ object#roomnum.)) |
| 5850 | return; |
| 5851 | |
| 5852 | if (!AIDetermineObjVisLevelcxx . . $ AIDetermineObjVisLevel(b2028de646e3dfb9).(obj, target)) |
| 5853 | return; |
| 5854 | |
| 5855 | if (target->typecxx . . $ object#type. == OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`! && (Playerscxx . . $ Players.[target->idcxx . . $ object#id.].flagscxx . . $ player#flags. & (PLAYER_FLAGS_DEADcxx . . $ `Descent3/player_external.h:81:9`! | PLAYER_FLAGS_DYINGcxx . . $ `Descent3/player_external.h:80:9`!))) |
| 5856 | return; |
| 5857 | |
| 5858 | to_obj =cxx . . $ vector#`operator=`(c0842353a20857d). target->poscxx . . $ object#pos. -cxx . . $ operator-(b77b703cd1e43e33). obj->poscxx . . $ object#pos.; |
| 5859 | |
| 5860 | dist = vm_NormalizeVectorcxx . . $ vm_NormalizeVector(4939a7e530383cd4).(&to_obj); |
| 5861 | |
| 5862 | if (dist > MAX_SEE_TARGET_DISTcxx . . $ `Descent3/AImain.cpp:1548:9`!) |
| 5863 | return; |
| 5864 | |
| 5865 | vectorcxx . . $ vector# look_dir; |
| 5866 | AIDetermineFovVeccxx . . $ AIDetermineFovVec(899400cfb1a8da78).(obj, &look_dir); |
| 5867 | |
| 5868 | dot = to_obj *cxx . . $ `operator*`(4a721543d64e126a). look_dir; |
| 5869 | |
| 5870 | if (f_use_dot && dot <= *best_dot) { |
| 5871 | return; |
| 5872 | } else if (!f_use_dot && dist >= *best_dist) { |
| 5873 | return; |
| 5874 | } |
| 5875 | |
| 5876 | fq.p0cxx . . $ fvi_query#p0. = &obj->poscxx . . $ object#pos.; |
| 5877 | fq.p1cxx . . $ fvi_query#p1. = &target->poscxx . . $ object#pos.; |
| 5878 | fq.startroomcxx . . $ fvi_query#startroom. = obj->roomnumcxx . . $ object#roomnum.; |
| 5879 | |
| 5880 | fq.radcxx . . $ fvi_query#rad. = 0.0f; |
| 5881 | fq.flagscxx . . $ fvi_query#flags. = FQ_CHECK_OBJScxx . . $ `lib/findintersection_external.h:59:9`! | FQ_ONLY_DOOR_OBJcxx . . $ `lib/findintersection_external.h:72:9`! | FQ_NO_RELINKcxx . . $ `lib/findintersection_external.h:73:9`!; |
| 5882 | fq.thisobjnumcxx . . $ fvi_query#thisobjnum. = -1; |
| 5883 | |
| 5884 | int ignore_obj_list[100]; |
| 5885 | ignore_obj_list[0] = OBJNUMcxx . . $ `Descent3/object.h:700:9`!(obj); |
| 5886 | int num_ignored = 1; |
| 5887 | int i; |
| 5888 | |
| 5889 | // CHRISHACK - ONLY IGNORES FIRST LEVEL OF CHILDREN - DO RECERSIVE |
| 5890 | for (i = 0; i < Poly_modelscxx . . $ Poly_models.[obj->rtypecxx . . $ object#rtype..pobj_infocxx . . $ object#$anonymous_type_10#pobj_info..model_numcxx . . $ polyobj_info#model_num.].n_attachcxx . . $ poly_model#n_attach.; i++) { |
| 5891 | objectcxx . . $ object# *child; |
| 5892 | |
| 5893 | if ((child = ObjGetcxx . . $ ObjGet(11672e354c0b263a).(obj->attach_childrencxx . . $ object#attach_children.[i])) != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`! && num_ignored < 99) { |
| 5894 | ignore_obj_list[num_ignored++] = OBJNUMcxx . . $ `Descent3/object.h:700:9`!(child); |
| 5895 | } |
| 5896 | } |
| 5897 | |
| 5898 | ignore_obj_list[num_ignored] = -1; |
| 5899 | fq.ignore_obj_listcxx . . $ fvi_query#ignore_obj_list. = ignore_obj_list; |
| 5900 | |
| 5901 | fate = fvi_FindIntersectioncxx . . $ fvi_FindIntersection(e1c4d7bd350effc8).(&fq, &hit_info); |
| 5902 | |
| 5903 | if (fate != HIT_NONEcxx . . $ `lib/findintersection_external.h:45:9`!) |
| 5904 | return; |
| 5905 | |
| 5906 | *best_dot = dot; |
| 5907 | *best_dist = dist; |
| 5908 | *best_obj = target; |
| 5909 | } |
| 5910 | } |
| 5911 | |
| 5912 | void AIDetermineTargetcxx . . $ AIDetermineTarget(419c470199a90a97).(objectcxx . . $ object# *obj) { |
| 5913 | ai_framecxx . . $ ai_frame# *ai_info = obj->ai_infocxx . . $ object#ai_info.; |
| 5914 | objectcxx . . $ object# *best_obj = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 5915 | float best_dot = -1.0f; |
| 5916 | float best_dist = MAX_SEE_TARGET_DISTcxx . . $ `Descent3/AImain.cpp:1548:9`! + 1; |
| 5917 | int i; |
| 5918 | |
| 5919 | if (Gametimecxx . . $ Gametime. < ai_info->next_target_update_timecxx . . $ ai_frame#next_target_update_time.) |
| 5920 | return; |
| 5921 | |
| 5922 | if (ai_info->awarenesscxx . . $ ai_frame#awareness. >= AWARE_BARELYcxx . . $ `Descent3/aistruct_external.h:326:9`!) |
| 5923 | ai_info->next_target_update_timecxx . . $ ai_frame#next_target_update_time. = |
| 5924 | Gametimecxx . . $ Gametime. + MIN_TARGET_UPDATE_INTERVALcxx . . $ `Descent3/AImain.cpp:1555:9`! + |
| 5925 | ((float)ps_randcxx . . $ ps_rand(b126dc7c1de90089).() / (float)D3_RAND_MAXcxx . . $ `misc/psrand.h:41:9`!) * (MAX_TARGET_UPDATE_INTERVALcxx . . $ `Descent3/AImain.cpp:1556:9`! - MIN_TARGET_UPDATE_INTERVALcxx . . $ `Descent3/AImain.cpp:1555:9`!); |
| 5926 | else |
| 5927 | ai_info->next_target_update_timecxx . . $ ai_frame#next_target_update_time. = |
| 5928 | Gametimecxx . . $ Gametime. + 2.0f * MIN_TARGET_UPDATE_INTERVALcxx . . $ `Descent3/AImain.cpp:1555:9`! + |
| 5929 | ((float)ps_randcxx . . $ ps_rand(b126dc7c1de90089).() / (float)D3_RAND_MAXcxx . . $ `misc/psrand.h:41:9`!) * 2.0f * (MAX_TARGET_UPDATE_INTERVALcxx . . $ `Descent3/AImain.cpp:1556:9`! - MIN_TARGET_UPDATE_INTERVALcxx . . $ `Descent3/AImain.cpp:1555:9`!); |
| 5930 | |
| 5931 | // Chrishack -- if agression is over a value, NO switching targets!!!!!!!!! Need to implement |
| 5932 | // Chrishack -- if frustration is over a value, act as hostile -- temp stuff AIF_TEAM_HOSTILE |
| 5933 | |
| 5934 | // They forget their enemies after a few seconds |
| 5935 | if ((ai_info->flagscxx . . $ ai_frame#flags. & AIF_TEAM_MASKcxx . . $ `Descent3/aistruct_external.h:364:9`!) == AIF_TEAM_NEUTRALcxx . . $ `Descent3/aistruct_external.h:368:9`! || (ai_info->flagscxx . . $ ai_frame#flags. & AIF_ACT_AS_NEUTRAL_UNTIL_SHOTcxx . . $ `Descent3/aistruct_external.h:353:9`!)) { |
| 5936 | best_obj = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 5937 | } else if ((ai_info->flagscxx . . $ ai_frame#flags. & AIF_TEAM_MASKcxx . . $ `Descent3/aistruct_external.h:364:9`!) != AIF_TEAM_PTMCcxx . . $ `Descent3/aistruct_external.h:365:9`!) { |
| 5938 | int16_t list[50]; |
| 5939 | int num = fvi_QuickDistObjectListcxx . . $ fvi_QuickDistObjectList(85643dfbd17d1ac8).(&obj->poscxx . . $ object#pos., obj->roomnumcxx . . $ object#roomnum., MAX_SEE_TARGET_DISTcxx . . $ `Descent3/AImain.cpp:1548:9`!, list, 50, false, true, false, true); |
| 5940 | |
| 5941 | for (i = 0; i < num; i++) { |
| 5942 | AITargetCheckcxx . . $ AITargetCheck(4dd6dd5a44f23de7).(obj, &Objectscxx . . $ Objects.[list[i]], &best_obj, &best_dot, &best_dist); |
| 5943 | } |
| 5944 | } else // Team PTMC :) |
| 5945 | { |
| 5946 | if (Game_modecxx . . $ Game_mode. & GM_MULTIcxx . . $ `Descent3/game.h:288:9`!) { |
| 5947 | // Multiplayer targetting (Major difference is that robot will ignore players while infighting in single player) |
| 5948 | for (i = 0; i < MAX_PLAYERScxx . . $ `Descent3/player_external_struct.h:86:9`!; i++) { |
| 5949 | if ((NetPlayerscxx . . $ NetPlayers.[i].flagscxx . . $ netplayer#flags. & NPF_CONNECTEDcxx . . $ `Descent3/multi_external.h:165:9`!) && (NetPlayerscxx . . $ NetPlayers.[i].sequencecxx . . $ netplayer#sequence. >= NETSEQ_PLAYINGcxx . . $ `Descent3/multi_external.h:161:9`!)) { |
| 5950 | objectcxx . . $ object# *target = &Objectscxx . . $ Objects.[Playerscxx . . $ Players.[i].objnumcxx . . $ player#objnum.]; |
| 5951 | |
| 5952 | AITargetCheckcxx . . $ AITargetCheck(4dd6dd5a44f23de7).(obj, target, &best_obj, &best_dot, &best_dist); |
| 5953 | } |
| 5954 | } |
| 5955 | } else { |
| 5956 | objectcxx . . $ object# *t = ObjGetcxx . . $ ObjGet(11672e354c0b263a).(ai_info->target_handlecxx . . $ ai_frame#target_handle.); |
| 5957 | bool f_forgive_friend = false; |
| 5958 | |
| 5959 | if ((t) && (t->control_typecxx . . $ object#control_type. == CT_AIcxx . . $ `Descent3/object_external.h:217:9`!) && ((t->ai_infocxx . . $ object#ai_info.->flagscxx . . $ ai_frame#flags. & AIF_TEAM_MASKcxx . . $ `Descent3/aistruct_external.h:364:9`!) == AIF_TEAM_PTMCcxx . . $ `Descent3/aistruct_external.h:365:9`!)) { |
| 5960 | // Do the divide because we don't want D3_RAND_MAX to go too high |
| 5961 | if (ps_randcxx . . $ ps_rand(b126dc7c1de90089).() / AI_FORGIVE_AGRESSION_MULTIPLIERcxx . . $ `Descent3/AImain.cpp:5833:9`! > ai_info->agressioncxx . . $ ai_frame#agression. * D3_RAND_MAXcxx . . $ `misc/psrand.h:41:9`!) { |
| 5962 | f_forgive_friend = true; |
| 5963 | } |
| 5964 | } |
| 5965 | |
| 5966 | // chrishack -- FUCK a multi-guidebot bug!!!!!! |
| 5967 | if (f_forgive_friend || !ai_target_validcxx . . $ ai_target_valid(39516aeee13ca5ab).(obj) || |
| 5968 | (ai_info->target_handlecxx . . $ ai_frame#target_handle. != OBJECT_HANDLE_NONEcxx . . $ `Descent3/object_external.h:156:9`! && ai_info->target_handlecxx . . $ ai_frame#target_handle. == Buddy_handlecxx . . $ Buddy_handle.[0] && |
| 5969 | ObjGetcxx . . $ ObjGet(11672e354c0b263a).(Buddy_handlecxx . . $ Buddy_handle.[0])->typecxx . . $ object#type. != OBJ_GHOSTcxx . . $ `Descent3/object_external.h:172:9`!)) { |
| 5970 | if (Player_objectcxx . . $ Player_object.->typecxx . . $ object#type. != OBJ_GHOSTcxx . . $ `Descent3/object_external.h:172:9`!) |
| 5971 | best_obj = Player_objectcxx . . $ Player_object.; |
| 5972 | else if (Buddy_handlecxx . . $ Buddy_handle.[0] != OBJECT_HANDLE_NONEcxx . . $ `Descent3/object_external.h:156:9`! && ObjGetcxx . . $ ObjGet(11672e354c0b263a).(Buddy_handlecxx . . $ Buddy_handle.[0])->typecxx . . $ object#type. != OBJ_GHOSTcxx . . $ `Descent3/object_external.h:172:9`!) |
| 5973 | best_obj = ObjGetcxx . . $ ObjGet(11672e354c0b263a).(Buddy_handlecxx . . $ Buddy_handle.[0]); |
| 5974 | else |
| 5975 | best_obj = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 5976 | } else { |
| 5977 | best_obj = ObjGetcxx . . $ ObjGet(11672e354c0b263a).(obj->ai_infocxx . . $ object#ai_info.->target_handlecxx . . $ ai_frame#target_handle.); |
| 5978 | } |
| 5979 | } |
| 5980 | } |
| 5981 | |
| 5982 | if (best_obj) { |
| 5983 | AISetTargetcxx . . $ AISetTarget(9985ed114f2bfc78).(obj, best_obj->handlecxx . . $ object#handle.); |
| 5984 | } else { |
| 5985 | AISetTargetcxx . . $ AISetTarget(9985ed114f2bfc78).(obj, OBJECT_HANDLE_NONEcxx . . $ `Descent3/object_external.h:156:9`!); |
| 5986 | } |
| 5987 | } |
| 5988 | |
| 5989 | // chrishack -- make sure that some checks are done with a ps_rand() based on the emotion involved |
| 5990 | // also current emotional levels should influence the percent chance of the check being successful |
| 5991 | void AIDoFreudcxx . . $ AIDoFreud(419c470199a90a97).(objectcxx . . $ object# *obj) { |
| 5992 | ai_framecxx . . $ ai_frame# *ai_info = obj->ai_infocxx . . $ object#ai_info.; |
| 5993 | ai_memcxx . . $ ai_mem# *mem = ai_info->memorycxx . . $ ai_frame#memory.; |
| 5994 | |
| 5995 | int fear_depth = (ai_info->life_preservationcxx . . $ ai_frame#life_preservation.) * (AI_MEM_DEPTHcxx . . $ `Descent3/aistruct.h:714:9`! - 1) + 1; |
| 5996 | int anger_depth = (ai_info->agressioncxx . . $ ai_frame#agression.) * (AI_MEM_DEPTHcxx . . $ `Descent3/aistruct.h:714:9`! - 1) + 1; |
| 5997 | int frust_depth = (ai_info->frustrationcxx . . $ ai_frame#frustration.) * (AI_MEM_DEPTHcxx . . $ `Descent3/aistruct.h:714:9`! - 1) + 1; |
| 5998 | |
| 5999 | if (fear_depth >= AI_MEM_DEPTHcxx . . $ `Descent3/aistruct.h:714:9`!) |
| 6000 | fear_depth = AI_MEM_DEPTHcxx . . $ `Descent3/aistruct.h:714:9`! - 1; |
| 6001 | if (anger_depth >= AI_MEM_DEPTHcxx . . $ `Descent3/aistruct.h:714:9`!) |
| 6002 | anger_depth = AI_MEM_DEPTHcxx . . $ `Descent3/aistruct.h:714:9`! - 1; |
| 6003 | if (frust_depth >= AI_MEM_DEPTHcxx . . $ `Descent3/aistruct.h:714:9`!) |
| 6004 | frust_depth = AI_MEM_DEPTHcxx . . $ `Descent3/aistruct.h:714:9`! - 1; |
| 6005 | |
| 6006 | if (ai_info->goalscxx . . $ ai_frame#goals.[3].usedcxx . . $ goal#used. == 0 && ai_info->awarenesscxx . . $ ai_frame#awareness. > AWARE_BARELYcxx . . $ `Descent3/aistruct_external.h:326:9`!) { |
| 6007 | if (IS_GENERICcxx . . $ `Descent3/object_external.h:190:9`!(obj->type) && mem[0].shieldscxx . . $ ai_mem#shields. / Object_infocxx . . $ Object_info.[obj->idcxx . . $ object#id.].hit_pointscxx . . $ object_info#hit_points. < ai_info->life_preservationcxx . . $ ai_frame#life_preservation. && |
| 6008 | mem[0].num_enemy_shots_dodgedcxx . . $ ai_mem#num_enemy_shots_dodged. > 0 && mem[0].num_friendscxx . . $ ai_mem#num_friends. < 2 && |
| 6009 | (float)ps_randcxx . . $ ps_rand(b126dc7c1de90089).() / (float)D3_RAND_MAXcxx . . $ `misc/psrand.h:41:9`! < ai_info->life_preservationcxx . . $ ai_frame#life_preservation.) { |
| 6010 | float time = 10.0f * ai_info->life_preservationcxx . . $ ai_frame#life_preservation. + 5.0f; |
| 6011 | |
| 6012 | GoalAddGoalcxx . . $ GoalAddGoal(e0a3c222b6aee5c7).(obj, AIG_WANDER_AROUNDcxx . . $ `Descent3/aistruct_external.h:187:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, 3, 2.0f, GF_SPEED_FLEEcxx . . $ `Descent3/aistruct_external.h:251:9`! | GF_ORIENT_VELOCITYcxx . . $ `Descent3/aistruct_external.h:228:9`! | GF_NONFLUSHABLEcxx . . $ `Descent3/aistruct_external.h:216:9`!); |
| 6013 | GoalAddEnablercxx . . $ GoalAddEnabler(abecc65ce55ccb39).(obj, 3, AIE_CLEAR_TIMEcxx . . $ `Descent3/aistruct_external.h:168:9`!, (void *)&time, 1.0, 0.0); |
| 6014 | |
| 6015 | mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "Fear!!!!\n"); |
| 6016 | return; |
| 6017 | } |
| 6018 | |
| 6019 | // Accounts for massive loss of shields |
| 6020 | if (IS_GENERICcxx . . $ `Descent3/object_external.h:190:9`!(obj->type) && |
| 6021 | (mem[fear_depth].shieldscxx . . $ ai_mem#shields. - mem[0].shieldscxx . . $ ai_mem#shields.) / mem[fear_depth].shieldscxx . . $ ai_mem#shields. > |
| 6022 | 0.25f * (1.0f - ai_info->life_preservationcxx . . $ ai_frame#life_preservation.) && |
| 6023 | (float)ps_randcxx . . $ ps_rand(b126dc7c1de90089).() / (float)D3_RAND_MAXcxx . . $ `misc/psrand.h:41:9`! < ai_info->life_preservationcxx . . $ ai_frame#life_preservation.) { |
| 6024 | float time = 10.0f * ai_info->life_preservationcxx . . $ ai_frame#life_preservation. + 5.0f; |
| 6025 | |
| 6026 | GoalAddGoalcxx . . $ GoalAddGoal(e0a3c222b6aee5c7).(obj, AIG_WANDER_AROUNDcxx . . $ `Descent3/aistruct_external.h:187:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, 3, 2.0f, GF_SPEED_FLEEcxx . . $ `Descent3/aistruct_external.h:251:9`! | GF_ORIENT_VELOCITYcxx . . $ `Descent3/aistruct_external.h:228:9`! | GF_NONFLUSHABLEcxx . . $ `Descent3/aistruct_external.h:216:9`!); |
| 6027 | GoalAddEnablercxx . . $ GoalAddEnabler(abecc65ce55ccb39).(obj, 3, AIE_CLEAR_TIMEcxx . . $ `Descent3/aistruct_external.h:168:9`!, (void *)&time, 1.0, 0.0); |
| 6028 | |
| 6029 | mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "Fear!!!!\n"); |
| 6030 | return; |
| 6031 | } |
| 6032 | |
| 6033 | // If others have died and/or left... (Me too) |
| 6034 | if (ai_info->life_preservationcxx . . $ ai_frame#life_preservation. > 0.5f && mem[fear_depth].num_friendscxx . . $ ai_mem#num_friends. > 0 && mem[0].num_friendscxx . . $ ai_mem#num_friends. == 0 && |
| 6035 | mem[0].num_enemiescxx . . $ ai_mem#num_enemies. > 0) { |
| 6036 | float time = 10.0f * ai_info->life_preservationcxx . . $ ai_frame#life_preservation. + 5.0f; |
| 6037 | |
| 6038 | GoalAddGoalcxx . . $ GoalAddGoal(e0a3c222b6aee5c7).(obj, AIG_WANDER_AROUNDcxx . . $ `Descent3/aistruct_external.h:187:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, 3, 2.0f, GF_SPEED_FLEEcxx . . $ `Descent3/aistruct_external.h:251:9`! | GF_ORIENT_VELOCITYcxx . . $ `Descent3/aistruct_external.h:228:9`! | GF_NONFLUSHABLEcxx . . $ `Descent3/aistruct_external.h:216:9`!); |
| 6039 | GoalAddEnablercxx . . $ GoalAddEnabler(abecc65ce55ccb39).(obj, 3, AIE_CLEAR_TIMEcxx . . $ `Descent3/aistruct_external.h:168:9`!, (void *)&time, 1.0, 0.0); |
| 6040 | |
| 6041 | mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "Fear!!!!\n"); |
| 6042 | return; |
| 6043 | } |
| 6044 | } |
| 6045 | } |
| 6046 | |
| 6047 | void AIDoMemFramecxx . . $ AIDoMemFrame(419c470199a90a97).(objectcxx . . $ object# *obj) { |
| 6048 | ai_framecxx . . $ ai_frame# *ai_info = obj->ai_infocxx . . $ object#ai_info.; |
| 6049 | ai_info->mem_time_till_next_updatecxx . . $ ai_frame#mem_time_till_next_update. -= Frametimecxx . . $ Frametime.; |
| 6050 | |
| 6051 | if (ai_info->mem_time_till_next_updatecxx . . $ ai_frame#mem_time_till_next_update. <= 0.0f) { |
| 6052 | int i; |
| 6053 | |
| 6054 | // Compute next analyze time |
| 6055 | ai_info->mem_time_till_next_updatecxx . . $ ai_frame#mem_time_till_next_update. = 3.0f + (float)ps_randcxx . . $ ps_rand(b126dc7c1de90089).() / (float)D3_RAND_MAXcxx . . $ `misc/psrand.h:41:9`! * 2.0f; |
| 6056 | |
| 6057 | // Do the amount of friends/enemies left and the current shields before running Freud |
| 6058 | int16_t near_objs[100]; |
| 6059 | float dist = 100.0f; |
| 6060 | |
| 6061 | // chrishack -- there must be a better way... |
| 6062 | if (ai_info->coop_teamcxx . . $ ai_frame#coop_team. * 300.0f > dist) { |
| 6063 | dist = ai_info->coop_teamcxx . . $ ai_frame#coop_team. * 300.0f > dist; |
| 6064 | } |
| 6065 | |
| 6066 | int num_near = fvi_QuickDistObjectListcxx . . $ fvi_QuickDistObjectList(85643dfbd17d1ac8).(&obj->poscxx . . $ object#pos., obj->roomnumcxx . . $ object#roomnum., dist, near_objs, 100, false, true, false, true); |
| 6067 | |
| 6068 | ai_info->memorycxx . . $ ai_frame#memory.[0].num_enemiescxx . . $ ai_mem#num_enemies. = 0; |
| 6069 | ai_info->memorycxx . . $ ai_frame#memory.[0].num_friendscxx . . $ ai_mem#num_friends. = 0; |
| 6070 | |
| 6071 | for (i = 0; i < num_near; i++) { |
| 6072 | objectcxx . . $ object# *check_obj = &Objectscxx . . $ Objects.[near_objs[i]]; |
| 6073 | |
| 6074 | if (check_obj == obj) |
| 6075 | continue; |
| 6076 | |
| 6077 | if (AIObjEnemycxx . . $ AIObjEnemy(9fa7d4d2c8b4c2db).(obj, check_obj)) |
| 6078 | ai_info->memorycxx . . $ ai_frame#memory.[0].num_enemiescxx . . $ ai_mem#num_enemies.++; |
| 6079 | else if (AIObjFriendcxx . . $ AIObjFriend(9fa7d4d2c8b4c2db).(obj, check_obj)) |
| 6080 | ai_info->memorycxx . . $ ai_frame#memory.[0].num_friendscxx . . $ ai_mem#num_friends.++; |
| 6081 | } |
| 6082 | |
| 6083 | ai_info->memorycxx . . $ ai_frame#memory.[0].shieldscxx . . $ ai_mem#shields. = obj->shieldscxx . . $ object#shields.; |
| 6084 | |
| 6085 | // Do emotions based on new data |
| 6086 | AIDoFreudcxx . . $ AIDoFreud(419c470199a90a97).(obj); |
| 6087 | |
| 6088 | // Move emotions through the stack |
| 6089 | for (i = AI_MEM_DEPTHcxx . . $ `Descent3/aistruct.h:714:9`! - 1; i > 0; i--) { |
| 6090 | ai_info->memorycxx . . $ ai_frame#memory.[i] =cxx . . $ ai_mem#`operator=`(1aaaeba020ebe3f4). ai_info->memorycxx . . $ ai_frame#memory.[i - 1]; |
| 6091 | } |
| 6092 | |
| 6093 | // Reset the accumulators |
| 6094 | |
| 6095 | // These are imcremented as this memory time slice is active |
| 6096 | ai_info->memorycxx . . $ ai_frame#memory.[0].num_enemy_shots_dodgedcxx . . $ ai_mem#num_enemy_shots_dodged. = 0; |
| 6097 | ai_info->memorycxx . . $ ai_frame#memory.[0].num_enemy_shots_firedcxx . . $ ai_mem#num_enemy_shots_fired. = 0; |
| 6098 | ai_info->memorycxx . . $ ai_frame#memory.[0].num_hit_enemycxx . . $ ai_mem#num_hit_enemy. = 0; |
| 6099 | ai_info->memorycxx . . $ ai_frame#memory.[0].num_times_hitcxx . . $ ai_mem#num_times_hit. = 0; |
| 6100 | |
| 6101 | // Dummy values, as these are computed at the end of the time frame (as seen above) |
| 6102 | ai_info->memorycxx . . $ ai_frame#memory.[0].shieldscxx . . $ ai_mem#shields. = obj->shieldscxx . . $ object#shields.; |
| 6103 | ai_info->memorycxx . . $ ai_frame#memory.[0].num_enemiescxx . . $ ai_mem#num_enemies. = ai_info->memorycxx . . $ ai_frame#memory.[1].num_enemiescxx . . $ ai_mem#num_enemies.; |
| 6104 | ai_info->memorycxx . . $ ai_frame#memory.[0].num_friendscxx . . $ ai_mem#num_friends. = ai_info->memorycxx . . $ ai_frame#memory.[1].num_friendscxx . . $ ai_mem#num_friends.; |
| 6105 | } |
| 6106 | } |
| 6107 | |
| 6108 | void AIDoFramecxx . . $ AIDoFrame(419c470199a90a97).(objectcxx . . $ object# *obj) { |
| 6109 | |
| 6110 | bool f_attach_done = false; |
| 6111 | int multi_saved_weapon_flags; |
| 6112 | char multi_saved_wb_firing; |
| 6113 | |
| 6114 | // AI objects don't use thrust (in general) |
| 6115 | obj->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..flagscxx . . $ physics_info#flags. &= ~PF_USES_THRUSTcxx . . $ `Descent3/object_external.h:319:9`!; |
| 6116 | obj->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..rotthrustcxx . . $ physics_info#$anonymous_type_2#rotthrust. =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). Zero_vectorcxx . . $ Zero_vector.; |
| 6117 | obj->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..thrustcxx . . $ physics_info#thrust. =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). Zero_vectorcxx . . $ Zero_vector.; |
| 6118 | |
| 6119 | if (obj->typecxx . . $ object#type. == OBJ_DUMMYcxx . . $ `Descent3/object_external.h:181:9`!) |
| 6120 | return; |
| 6121 | |
| 6122 | if ((Game_modecxx . . $ Game_mode. & GM_MULTIcxx . . $ `Descent3/game.h:288:9`!) && (Netgamecxx . . $ Netgame..local_rolecxx . . $ netgame_info#local_role. == LR_SERVERcxx . . $ `Descent3/multi_external.h:129:9`!)) { |
| 6123 | multi_saved_wb_firing = obj->ai_infocxx . . $ object#ai_info.->last_special_wb_firingcxx . . $ ai_frame#last_special_wb_firing.; |
| 6124 | multi_saved_weapon_flags = obj->weapon_fire_flagscxx . . $ object#weapon_fire_flags.; |
| 6125 | } |
| 6126 | |
| 6127 | ai_framecxx . . $ ai_frame# *ai_info = obj->ai_infocxx . . $ object#ai_info.; |
| 6128 | ASSERTcxx . . $ `misc/pserror.h:246:9`!((obj->control_type == CT_AIcxx . . $ `Descent3/object_external.h:217:9`!) || (obj->control_type == CT_DYING_AND_AIcxx . . $ `Descent3/object_external.h:230:9`!)); |
| 6129 | |
| 6130 | if ((ai_info->flagscxx . . $ ai_frame#flags. & AIF_DISABLEDcxx . . $ `Descent3/aistruct_external.h:362:9`!) || (obj->typecxx . . $ object#type. == OBJ_DUMMYcxx . . $ `Descent3/object_external.h:181:9`!)) { |
| 6131 | return; |
| 6132 | } |
| 6133 | |
| 6134 | // Animate the object |
| 6135 | ai_do_animationcxx . . $ ai_do_animation(4ebbd0c3cbf1b78a).(obj, Frametimecxx . . $ Frametime.); |
| 6136 | if (ai_info->animation_typecxx . . $ ai_frame#animation_type. == AS_IDLEcxx . . $ `Descent3/aistruct_external.h:419:9`!) { |
| 6137 | f_attach_done = true; |
| 6138 | } |
| 6139 | |
| 6140 | if (Demo_flagscxx . . $ Demo_flags. == DF_PLAYBACKcxx . . $ `lib/demofile.h:123:9`!) { |
| 6141 | // All we want is animation |
| 6142 | return; |
| 6143 | } |
| 6144 | // Handle On/off and spray weapons |
| 6145 | { |
| 6146 | if ((obj->weapon_fire_flagscxx . . $ object#weapon_fire_flags. & WFF_SPRAYcxx . . $ `Descent3/player_external.h:103:9`!) && !(obj->flagscxx . . $ object#flags. & (OF_DESTROYEDcxx . . $ `Descent3/object_external.h:271:9`! | OF_DYINGcxx . . $ `Descent3/object_external.h:282:9`!))) { |
| 6147 | char wb_index = ai_info->last_special_wb_firingcxx . . $ ai_frame#last_special_wb_firing.; |
| 6148 | DoSprayEffectcxx . . $ DoSprayEffect(8a3ad1df6cc7128b).(obj, &Object_infocxx . . $ Object_info.[obj->idcxx . . $ object#id.].static_wbcxx . . $ object_info#static_wb.[wb_index], wb_index); |
| 6149 | if (!((Game_modecxx . . $ Game_mode. & GM_MULTIcxx . . $ `Descent3/game.h:288:9`!) && (Netgamecxx . . $ Netgame..local_rolecxx . . $ netgame_info#local_role. == LR_CLIENTcxx . . $ `Descent3/multi_external.h:128:9`!))) { |
| 6150 | if (WBIsBatteryReadycxx . . $ WBIsBatteryReady(ad7a19887510094c).(obj, &Object_infocxx . . $ Object_info.[obj->idcxx . . $ object#id.].static_wbcxx . . $ object_info#static_wb.[wb_index], wb_index) && |
| 6151 | !(Cinematic_inusecxx . . $ Cinematic_inuse. && !(ai_info->status_regcxx . . $ ai_frame#status_reg. & AISR_OK_TO_FIRE_DURING_CINEMATICScxx . . $ `Descent3/aistruct_external.h:401:9`!))) { |
| 6152 | WBFireBatterycxx . . $ WBFireBattery(cccf09a4825b46a4).(obj, &Object_infocxx . . $ Object_info.[obj->idcxx . . $ object#id.].static_wbcxx . . $ object_info#static_wb.[wb_index], wb_index); |
| 6153 | } |
| 6154 | } |
| 6155 | } |
| 6156 | |
| 6157 | if (obj->weapon_fire_flagscxx . . $ object#weapon_fire_flags. & WFF_ON_OFFcxx . . $ `Descent3/player_external.h:104:9`!) { |
| 6158 | FireOnOffWeaponcxx . . $ FireOnOffWeapon(419c470199a90a97).(obj); |
| 6159 | } |
| 6160 | } |
| 6161 | |
| 6162 | if ((Game_modecxx . . $ Game_mode. & GM_MULTIcxx . . $ `Descent3/game.h:288:9`!) && (Netgamecxx . . $ Netgame..local_rolecxx . . $ netgame_info#local_role. == LR_CLIENTcxx . . $ `Descent3/multi_external.h:128:9`!)) { |
| 6163 | if (!f_attach_done) { |
| 6164 | AttachUpdateSubObjectscxx . . $ AttachUpdateSubObjects(419c470199a90a97).(obj); |
| 6165 | f_attach_done = true; |
| 6166 | } |
| 6167 | return; |
| 6168 | } |
| 6169 | |
| 6170 | // If awareness if forced, do so |
| 6171 | if ((ai_info->flagscxx . . $ ai_frame#flags. & AIF_FORCE_AWARENESScxx . . $ `Descent3/aistruct_external.h:380:9`!) && (ai_info->awarenesscxx . . $ ai_frame#awareness. < AWARE_MOSTLYcxx . . $ `Descent3/aistruct_external.h:324:9`!)) { |
| 6172 | ai_info->awarenesscxx . . $ ai_frame#awareness. = AWARE_MOSTLYcxx . . $ `Descent3/aistruct_external.h:324:9`!; |
| 6173 | } |
| 6174 | |
| 6175 | // If not multiplayer - these must be set each frame |
| 6176 | obj->weapon_fire_flagscxx . . $ object#weapon_fire_flags. = 0; |
| 6177 | |
| 6178 | // If the object is dead, it does not think |
| 6179 | if (obj->flagscxx . . $ object#flags. & OF_DEADcxx . . $ `Descent3/object_external.h:270:9`!) { |
| 6180 | if (!f_attach_done) { |
| 6181 | AttachUpdateSubObjectscxx . . $ AttachUpdateSubObjects(419c470199a90a97).(obj); |
| 6182 | f_attach_done = true; |
| 6183 | } |
| 6184 | return; |
| 6185 | } |
| 6186 | |
| 6187 | AIDoMemFramecxx . . $ AIDoMemFrame(419c470199a90a97).(obj); |
| 6188 | |
| 6189 | if (ai_info->flagscxx . . $ ai_frame#flags. & AIF_DETERMINE_TARGETcxx . . $ `Descent3/aistruct_external.h:358:9`!) |
| 6190 | AIDetermineTargetcxx . . $ AIDetermineTarget(419c470199a90a97).(obj); |
| 6191 | |
| 6192 | // Update the robot's eyes -- gets player distance -- (only if AI cares about player) |
| 6193 | if (ai_info->notify_flagscxx . . $ ai_frame#notify_flags. & (0x00000001 << AIN_SEE_TARGETcxx . . $ `Descent3/aistruct_external.h:289:9`!)) |
| 6194 | AICheckTargetViscxx . . $ AICheckTargetVis(419c470199a90a97).(obj); |
| 6195 | |
| 6196 | // Updates some of the AI status registers |
| 6197 | ai_update_registerscxx . . $ ai_update_registers(419c470199a90a97).(obj); |
| 6198 | |
| 6199 | // Have goals result in movement |
| 6200 | // I will think if either the player or me sees anything within 4 seconds |
| 6201 | if ((ai_info->awarenesscxx . . $ ai_frame#awareness.) || (ai_info->flagscxx . . $ ai_frame#flags. & AIF_PERSISTANTcxx . . $ `Descent3/aistruct_external.h:354:9`!)) { |
| 6202 | // Does the scripting stuff for an AI |
| 6203 | ai_do_script_stuffcxx . . $ ai_do_script_stuff(39516aeee13ca5ab).(obj); |
| 6204 | |
| 6205 | if (ai_info->ai_typecxx . . $ ai_frame#ai_type. == AIT_BIRD_FLOCK1cxx . . $ `Descent3/aistruct_external.h:81:9`!) |
| 6206 | ai_info->flagscxx . . $ ai_frame#flags. |= AIF_TRACK_CLOSEST_2_FRIENDScxx . . $ `Descent3/aistruct_external.h:377:9`!; // chrishack -- remove -- testing only |
| 6207 | |
| 6208 | // Determines all tracked objects |
| 6209 | AIDoTrackFramecxx . . $ AIDoTrackFrame(419c470199a90a97).(obj); |
| 6210 | |
| 6211 | // Does goal updating for the frame |
| 6212 | GoalDoFramecxx . . $ GoalDoFrame(419c470199a90a97).(obj); |
| 6213 | |
| 6214 | // Allow the robot to move |
| 6215 | if (obj->control_typecxx . . $ object#control_type. == CT_AIcxx . . $ `Descent3/object_external.h:217:9`!) { |
| 6216 | if (ai_info->animation_typecxx . . $ ai_frame#animation_type. != AS_FLINCHcxx . . $ `Descent3/aistruct_external.h:421:9`!) { |
| 6217 | float speed; |
| 6218 | |
| 6219 | #ifdef _DEBUGcxx . . $ `<built-in>:482:9`! |
| 6220 | if (!Game_do_ai_movementcxx . . $ Game_do_ai_movement.) { |
| 6221 | goto after_move; |
| 6222 | } |
| 6223 | #endif |
| 6224 | |
| 6225 | ai_movecxx . . $ ai_move(419c470199a90a97).(obj); |
| 6226 | |
| 6227 | speed = vm_GetMagnitudecxx . . $ vm_GetMagnitude(4939a7e530383cd4).(&obj->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..velocitycxx . . $ physics_info#velocity.); |
| 6228 | |
| 6229 | // Removes the framerate independance from objects moving within 2x of there normal max speed |
| 6230 | if (speed > 0.1f && speed <= ai_info->max_velocitycxx . . $ ai_frame#max_velocity. * 2.0) { |
| 6231 | if (obj->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..dragcxx . . $ physics_info#drag. > 0.0f && obj->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..masscxx . . $ physics_info#mass. > 0.0f) { |
| 6232 | obj->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..flagscxx . . $ physics_info#flags. |= PF_USES_THRUSTcxx . . $ `Descent3/object_external.h:319:9`!; |
| 6233 | obj->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..rotthrustcxx . . $ physics_info#$anonymous_type_2#rotthrust. =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). Zero_vectorcxx . . $ Zero_vector.; |
| 6234 | obj->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..thrustcxx . . $ physics_info#thrust. =cxx . . $ vector#`operator=`(c0842353a20857d). obj->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..velocitycxx . . $ physics_info#velocity. *cxx . . $ `operator*`(252247219a31502c). obj->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..dragcxx . . $ physics_info#drag.; |
| 6235 | } |
| 6236 | } |
| 6237 | |
| 6238 | #ifdef _DEBUGcxx . . $ `<built-in>:482:9`! |
| 6239 | after_move:; |
| 6240 | #endif |
| 6241 | } |
| 6242 | |
| 6243 | if (!f_attach_done) { |
| 6244 | AttachUpdateSubObjectscxx . . $ AttachUpdateSubObjects(419c470199a90a97).(obj); |
| 6245 | f_attach_done = true; |
| 6246 | } |
| 6247 | |
| 6248 | if (!((ai_info->status_regcxx . . $ ai_frame#status_reg. & AISR_MELEEcxx . . $ `Descent3/aistruct_external.h:398:9`!) || (ai_info->flagscxx . . $ ai_frame#flags. & AIF_DISABLE_FIRINGcxx . . $ `Descent3/aistruct_external.h:374:9`!))) |
| 6249 | ai_firecxx . . $ ai_fire(419c470199a90a97).(obj); |
| 6250 | } else { |
| 6251 | if (obj->movement_typecxx . . $ object#movement_type. == MT_WALKINGcxx . . $ `Descent3/object_external.h:235:9`! && ai_info->animation_typecxx . . $ ai_frame#animation_type. == AS_DEATHcxx . . $ `Descent3/aistruct_external.h:410:9`!) { |
| 6252 | vectorcxx . . $ vector# mdir; |
| 6253 | bool f_moved; |
| 6254 | |
| 6255 | AIMoveTowardsPositioncxx . . $ AIMoveTowardsPosition(e4ea9f4f5d132a1c).(obj, &obj->poscxx . . $ object#pos., 1.5f, false, &mdir, &f_moved); |
| 6256 | if (!f_moved) { |
| 6257 | AIMoveTowardsDircxx . . $ AIMoveTowardsDir(cd233addd15cf1e2).(obj, &mdir, 1.0f); |
| 6258 | } |
| 6259 | } |
| 6260 | } |
| 6261 | } |
| 6262 | |
| 6263 | if (!f_attach_done) { |
| 6264 | AttachUpdateSubObjectscxx . . $ AttachUpdateSubObjects(419c470199a90a97).(obj); |
| 6265 | f_attach_done = true; |
| 6266 | } |
| 6267 | |
| 6268 | if (obj->movement_typecxx . . $ object#movement_type. == MT_WALKINGcxx . . $ `Descent3/object_external.h:235:9`!) |
| 6269 | ai_walker_stuffcxx . . $ ai_walker_stuff(419c470199a90a97).(obj); |
| 6270 | |
| 6271 | // Animation state changes based on current level of awareness |
| 6272 | if (obj->control_typecxx . . $ object#control_type. == CT_AIcxx . . $ `Descent3/object_external.h:217:9`!) |
| 6273 | do_awareness_based_anim_stuffcxx . . $ do_awareness_based_anim_stuff(419c470199a90a97).(obj); |
| 6274 | |
| 6275 | // Decrease awareness |
| 6276 | if (obj->control_typecxx . . $ object#control_type. == CT_AIcxx . . $ `Descent3/object_external.h:217:9`!) |
| 6277 | ai_decrease_awarenesscxx . . $ ai_decrease_awareness(419c470199a90a97).(obj); |
| 6278 | |
| 6279 | if (obj->ai_infocxx . . $ object#ai_info.->awarenesscxx . . $ ai_frame#awareness. > AWARE_BARELYcxx . . $ `Descent3/aistruct_external.h:326:9`! && obj->ai_infocxx . . $ object#ai_info.->target_handlecxx . . $ ai_frame#target_handle. == Player_objectcxx . . $ Player_object.->handlecxx . . $ object#handle. && |
| 6280 | (obj->ai_infocxx . . $ object#ai_info.->last_see_target_timecxx . . $ ai_frame#last_see_target_time. + (CHECK_VIS_INFREQUENTLY_INTERVALcxx . . $ `Descent3/AImain.cpp:1553:9`! * 2.0f)) >= Gametimecxx . . $ Gametime. && |
| 6281 | (obj->ai_infocxx . . $ object#ai_info.->last_hear_target_timecxx . . $ ai_frame#last_hear_target_time. + (CHECK_VIS_INFREQUENTLY_INTERVALcxx . . $ `Descent3/AImain.cpp:1553:9`! * 2.0f)) >= Gametimecxx . . $ Gametime. && |
| 6282 | obj->parent_handlecxx . . $ object#parent_handle. != Player_objectcxx . . $ Player_object.->handlecxx . . $ object#handle.) { |
| 6283 | AI_NumHostileAlertcxx . . $ AI_NumHostileAlert.++; |
| 6284 | } |
| 6285 | |
| 6286 | if ((Game_modecxx . . $ Game_mode. & GM_MULTIcxx . . $ `Descent3/game.h:288:9`!) && (Netgamecxx . . $ Netgame..local_rolecxx . . $ netgame_info#local_role. == LR_SERVERcxx . . $ `Descent3/multi_external.h:129:9`!)) { |
| 6287 | if ((multi_saved_wb_firing != obj->ai_infocxx . . $ object#ai_info.->last_special_wb_firingcxx . . $ ai_frame#last_special_wb_firing.) || |
| 6288 | (multi_saved_weapon_flags != obj->weapon_fire_flagscxx . . $ object#weapon_fire_flags.)) { |
| 6289 | MultiSendAiWeaponFlagscxx . . $ MultiSendAiWeaponFlags(a7790401ac9fc765).(obj, obj->weapon_fire_flagscxx . . $ object#weapon_fire_flags., obj->ai_infocxx . . $ object#ai_info.->last_special_wb_firingcxx . . $ ai_frame#last_special_wb_firing.); |
| 6290 | } |
| 6291 | } |
| 6292 | |
| 6293 | } |
| 6294 | |
| 6295 | void AIFrameAllcxx . . $ AIFrameAll(49f6e7a06ebc5aa8).(void) { |
| 6296 | int i; |
| 6297 | |
| 6298 | if ((Game_modecxx . . $ Game_mode. & GM_MULTIcxx . . $ `Descent3/game.h:288:9`!) && (Netgamecxx . . $ Netgame..local_rolecxx . . $ netgame_info#local_role. == LR_CLIENTcxx . . $ `Descent3/multi_external.h:128:9`!)) |
| 6299 | return; |
| 6300 | |
| 6301 | // Currently, -- chrishack -- In multiplayer, all robots are aware. |
| 6302 | if (Game_modecxx . . $ Game_mode. & GM_MULTIcxx . . $ `Descent3/game.h:288:9`!) { |
| 6303 | for (i = 0; i <= Highest_object_indexcxx . . $ Highest_object_index.; i++) { |
| 6304 | if (Objectscxx . . $ Objects.[i].ai_infocxx . . $ object#ai_info.) { |
| 6305 | AINotifycxx . . $ AINotify(f32b5964aaa42c22).(&Objectscxx . . $ Objects.[i], AIN_PLAYER_SEES_YOUcxx . . $ `Descent3/aistruct_external.h:290:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!); |
| 6306 | } |
| 6307 | } |
| 6308 | } else { |
| 6309 | for (i = 0; i < AI_NumRenderedcxx . . $ AI_NumRendered.; i++) { |
| 6310 | AINotifycxx . . $ AINotify(f32b5964aaa42c22).(&Objectscxx . . $ Objects.[AI_RenderedListcxx . . $ AI_RenderedList.[i]], AIN_PLAYER_SEES_YOUcxx . . $ `Descent3/aistruct_external.h:290:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!); |
| 6311 | } |
| 6312 | } |
| 6313 | } |
| 6314 | |
| 6315 | void AIPowerSwitchcxx . . $ AIPowerSwitch(674fac047436fc5b).(objectcxx . . $ object# *obj, bool f_on) { |
| 6316 | ai_framecxx . . $ ai_frame# *ai_info = obj->ai_infocxx . . $ object#ai_info.; |
| 6317 | if (obj->control_typecxx . . $ object#control_type. != CT_AIcxx . . $ `Descent3/object_external.h:217:9`!) |
| 6318 | return; |
| 6319 | |
| 6320 | if (f_on) |
| 6321 | ai_info->flagscxx . . $ ai_frame#flags. &= (~AIF_DISABLEDcxx . . $ `Descent3/aistruct_external.h:362:9`!); |
| 6322 | else |
| 6323 | ai_info->flagscxx . . $ ai_frame#flags. |= AIF_DISABLEDcxx . . $ `Descent3/aistruct_external.h:362:9`!; |
| 6324 | |
| 6325 | poly_modelcxx . . $ poly_model# *parent_pm = &Poly_modelscxx . . $ Poly_models.[obj->rtypecxx . . $ object#rtype..pobj_infocxx . . $ object#$anonymous_type_10#pobj_info..model_numcxx . . $ polyobj_info#model_num.]; |
| 6326 | int i; |
| 6327 | |
| 6328 | if (!obj->attach_childrencxx . . $ object#attach_children.) |
| 6329 | return; |
| 6330 | |
| 6331 | for (i = 0; i < parent_pm->n_attachcxx . . $ poly_model#n_attach.; i++) { |
| 6332 | objectcxx . . $ object# *child; |
| 6333 | |
| 6334 | if ((child = ObjGetcxx . . $ ObjGet(11672e354c0b263a).(obj->attach_childrencxx . . $ object#attach_children.[i])) != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) { |
| 6335 | AIPowerSwitchcxx . . $ AIPowerSwitch(674fac047436fc5b).(child, f_on); |
| 6336 | } |
| 6337 | } |
| 6338 | } |
| 6339 | |
| 6340 | int AIFindRoomWithFlagcxx . . $ AIFindRoomWithFlag(174cacb9d899a77a).(objectcxx . . $ object# *obj, int flag) { |
| 6341 | int cur_room = obj->roomnumcxx . . $ object#roomnum.; |
| 6342 | float best_dist = 0.0f; |
| 6343 | int best_room = -1; |
| 6344 | int i; |
| 6345 | |
| 6346 | for (i = 0; i <= Highest_room_indexcxx . . $ Highest_room_index.; i++) { |
| 6347 | if ((Roomscxx . . $ Rooms.[i].usedcxx . . $ room#used.) && (Roomscxx . . $ Rooms.[i].flagscxx . . $ room#flags. & flag)) { |
| 6348 | float cur_dist; |
| 6349 | |
| 6350 | if (BOA_ComputeMinDistcxx . . $ BOA_ComputeMinDist(d76bc30baaf01f3b).(obj->roomnumcxx . . $ object#roomnum., i, 0.0f, &cur_dist, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!)) { |
| 6351 | if (best_room == -1 || cur_dist < best_dist) { |
| 6352 | bool f_path_exists = AIFindAltPathcxx . . $ AIFindAltPath(4c063a45e14c3cfe).(obj, cur_room, i, &cur_dist); |
| 6353 | |
| 6354 | if (f_path_exists && (best_room == -1 || cur_dist < best_dist)) { |
| 6355 | best_dist = cur_dist; |
| 6356 | best_room = i; |
| 6357 | } |
| 6358 | } |
| 6359 | } |
| 6360 | } |
| 6361 | } |
| 6362 | |
| 6363 | return best_room; |
| 6364 | } |
| 6365 | |
| 6366 | bool AIFindHidePoscxx . . $ AIFindHidePos(5b8d3226dd1a19bc).(objectcxx . . $ object# *hide_obj, objectcxx . . $ object# *view_obj, vectorcxx . . $ vector# *hpos, int *hroom, float max_hide_time) { return false; } |
| 6367 | |
| 6368 | objectcxx . . $ object# *AIFindObjOfTypecxx . . $ AIFindObjOfType(21432d3b7e9150b9).(objectcxx . . $ object# *obj, int type, int id, bool f_ignore_init_room, int parent_handle) { |
| 6369 | int cur_room = obj->roomnumcxx . . $ object#roomnum.; |
| 6370 | float best_dist = 0.0f; |
| 6371 | objectcxx . . $ object# *best_obj = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 6372 | int i; |
| 6373 | int my_obj_index = OBJNUMcxx . . $ `Descent3/object.h:700:9`!(obj); |
| 6374 | |
| 6375 | for (i = 0; i <= Highest_object_indexcxx . . $ Highest_object_index.; i++) { |
| 6376 | if ((Objectscxx . . $ Objects.[i].typecxx . . $ object#type. == type || (type == OBJ_ROBOTcxx . . $ `Descent3/object_external.h:162:9`! && Objectscxx . . $ Objects.[i].typecxx . . $ object#type. == OBJ_BUILDINGcxx . . $ `Descent3/object_external.h:176:9`!)) && i != my_obj_index) { |
| 6377 | float cur_dist; |
| 6378 | |
| 6379 | if (f_ignore_init_room && (Objectscxx . . $ Objects.[i].roomnumcxx . . $ object#roomnum. == obj->roomnumcxx . . $ object#roomnum.)) |
| 6380 | continue; |
| 6381 | |
| 6382 | if (id != -1 && id != Objectscxx . . $ Objects.[i].idcxx . . $ object#id.) |
| 6383 | continue; |
| 6384 | |
| 6385 | // Allow us to find a players powerups |
| 6386 | if (parent_handle != OBJECT_HANDLE_NONEcxx . . $ `Descent3/object_external.h:156:9`! && parent_handle != Objectscxx . . $ Objects.[i].parent_handlecxx . . $ object#parent_handle.) |
| 6387 | continue; |
| 6388 | |
| 6389 | // Invisible powerups |
| 6390 | if (Objectscxx . . $ Objects.[i].render_typecxx . . $ object#render_type. == RT_NONEcxx . . $ `Descent3/object_external.h:257:9`!) |
| 6391 | continue; |
| 6392 | |
| 6393 | // Dying robots, other non-active robots |
| 6394 | if (Objectscxx . . $ Objects.[i].typecxx . . $ object#type. == OBJ_ROBOTcxx . . $ `Descent3/object_external.h:162:9`! && Objectscxx . . $ Objects.[i].control_typecxx . . $ object#control_type. != CT_AIcxx . . $ `Descent3/object_external.h:217:9`!) |
| 6395 | continue; |
| 6396 | |
| 6397 | // Robots that don't shoot |
| 6398 | poly_modelcxx . . $ poly_model# *pm = &Poly_modelscxx . . $ Poly_models.[Objectscxx . . $ Objects.[i].rtypecxx . . $ object#rtype..pobj_infocxx . . $ object#$anonymous_type_10#pobj_info..model_numcxx . . $ polyobj_info#model_num.]; |
| 6399 | if (Objectscxx . . $ Objects.[i].typecxx . . $ object#type. == OBJ_ROBOTcxx . . $ `Descent3/object_external.h:162:9`! && pm->num_wbscxx . . $ poly_model#num_wbs. == 0) |
| 6400 | continue; |
| 6401 | |
| 6402 | // cameras |
| 6403 | if (Objectscxx . . $ Objects.[i].typecxx . . $ object#type. == OBJ_ROBOTcxx . . $ `Descent3/object_external.h:162:9`! && pm->num_wbscxx . . $ poly_model#num_wbs. == 1 && Object_infocxx . . $ Object_info.[Objectscxx . . $ Objects.[i].idcxx . . $ object#id.].static_wbcxx . . $ object_info#static_wb.[0].num_maskscxx . . $ otype_wb_info#num_masks. == 1 && |
| 6404 | Object_infocxx . . $ Object_info.[Objectscxx . . $ Objects.[i].idcxx . . $ object#id.].static_wbcxx . . $ object_info#static_wb.[0].gp_fire_maskscxx . . $ otype_wb_info#gp_fire_masks.[0] == 0) |
| 6405 | continue; |
| 6406 | |
| 6407 | if (BOA_ComputeMinDistcxx . . $ BOA_ComputeMinDist(d76bc30baaf01f3b).(obj->roomnumcxx . . $ object#roomnum., Objectscxx . . $ Objects.[i].roomnumcxx . . $ object#roomnum., 0.0f, &cur_dist, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!)) { |
| 6408 | if (best_obj == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`! || cur_dist < best_dist) { |
| 6409 | bool f_path_exists = AIFindAltPathcxx . . $ AIFindAltPath(4c063a45e14c3cfe).(obj, cur_room, Objectscxx . . $ Objects.[i].roomnumcxx . . $ object#roomnum., &cur_dist); |
| 6410 | |
| 6411 | if (f_path_exists && (best_obj == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`! || cur_dist < best_dist)) { |
| 6412 | best_dist = cur_dist; |
| 6413 | best_obj = &Objectscxx . . $ Objects.[i]; |
| 6414 | } |
| 6415 | } |
| 6416 | } |
| 6417 | } |
| 6418 | } |
| 6419 | |
| 6420 | return best_obj; |
| 6421 | } |
| 6422 | |
| 6423 | int AIMakeNextRoomListcxx . . $ AIMakeNextRoomList(1df93256b606fe1f).(int roomnum, int *next_rooms, int max_rooms) { |
| 6424 | int num_next_rooms = 0; |
| 6425 | int i, j; |
| 6426 | int croom; |
| 6427 | |
| 6428 | if (!ROOMNUM_OUTSIDEcxx . . $ `lib/object_external_struct.h:127:9`!(roomnum) && roomnum <= Highest_room_indexcxx . . $ Highest_room_index.) { |
| 6429 | for (i = 0; i < Roomscxx . . $ Rooms.[roomnum].num_portalscxx . . $ room#num_portals.; i++) { |
| 6430 | bool f_found = false; |
| 6431 | |
| 6432 | if (Roomscxx . . $ Rooms.[roomnum].portalscxx . . $ room#portals.[i].croomcxx . . $ portal#croom. >= 0) { |
| 6433 | if (Roomscxx . . $ Rooms.[Roomscxx . . $ Rooms.[roomnum].portalscxx . . $ room#portals.[i].croomcxx . . $ portal#croom.].flagscxx . . $ room#flags. & RF_EXTERNALcxx . . $ `Descent3/room_external.h:177:9`!) { |
| 6434 | croom = Highest_room_indexcxx . . $ Highest_room_index. + |
| 6435 | TERRAIN_REGIONcxx . . $ TERRAIN_REGION(7864480464b09eea).(GetTerrainRoomFromPoscxx . . $ GetTerrainRoomFromPos(177d9005acf670a0).( |
| 6436 | &Roomscxx . . $ Rooms.[Roomscxx . . $ Rooms.[roomnum].portalscxx . . $ room#portals.[i].croomcxx . . $ portal#croom.].portalscxx . . $ room#portals.[Roomscxx . . $ Rooms.[roomnum].portalscxx . . $ room#portals.[i].cportalcxx . . $ portal#cportal.].path_pntcxx . . $ portal#path_pnt.)) + |
| 6437 | 1; |
| 6438 | } else { |
| 6439 | croom = Roomscxx . . $ Rooms.[roomnum].portalscxx . . $ room#portals.[i].croomcxx . . $ portal#croom.; |
| 6440 | } |
| 6441 | |
| 6442 | for (j = 0; j < num_next_rooms; j++) { |
| 6443 | if (next_rooms[j] == croom) { |
| 6444 | f_found = true; |
| 6445 | break; |
| 6446 | } |
| 6447 | } |
| 6448 | |
| 6449 | if (!f_found) { |
| 6450 | // If you hit assert, get chris -- make constant larger |
| 6451 | ASSERTcxx . . $ `misc/pserror.h:246:9`!(num_next_rooms < max_rooms); |
| 6452 | |
| 6453 | ASSERTcxx . . $ `misc/pserror.h:246:9`!((croom >= 0 && croom <= Highest_room_index + 8) || |
| 6454 | (ROOMNUM_OUTSIDEcxx . . $ `lib/object_external_struct.h:127:9`!(croom) && CELLNUMcxx . . $ `lib/object_external_struct.h:121:9`!(roomnum) > 0 && CELLNUMcxx . . $ `lib/object_external_struct.h:121:9`!(roomnum) < TERRAIN_WIDTHcxx . . $ `Descent3/terrain.h:31:9`! * TERRAIN_DEPTHcxx . . $ `Descent3/terrain.h:32:9`!)); |
| 6455 | |
| 6456 | next_rooms[num_next_rooms] = croom; |
| 6457 | num_next_rooms++; |
| 6458 | } |
| 6459 | } |
| 6460 | } |
| 6461 | } else { |
| 6462 | int t_index; |
| 6463 | |
| 6464 | if (BOA_num_terrain_regionscxx . . $ BOA_num_terrain_regions. == 0) { |
| 6465 | return 0; |
| 6466 | } |
| 6467 | |
| 6468 | if (roomnum > Highest_room_indexcxx . . $ Highest_room_index. && roomnum <= Highest_room_indexcxx . . $ Highest_room_index. + 8) { |
| 6469 | t_index = roomnum - Highest_room_indexcxx . . $ Highest_room_index. - 1; |
| 6470 | } else { |
| 6471 | t_index = TERRAIN_REGIONcxx . . $ TERRAIN_REGION(7864480464b09eea).(roomnum); |
| 6472 | } |
| 6473 | |
| 6474 | ASSERTcxx . . $ `misc/pserror.h:246:9`!(t_index >= 0 && t_index < BOA_num_terrain_regions); |
| 6475 | |
| 6476 | for (i = 0; i < BOA_num_connectcxx . . $ BOA_num_connect.[t_index]; i++) { |
| 6477 | bool f_found = false; |
| 6478 | croom = BOA_connectcxx . . $ BOA_connect.[t_index][i].roomnumcxx . . $ connect_data#roomnum.; |
| 6479 | |
| 6480 | for (j = 0; j < num_next_rooms; j++) { |
| 6481 | if (next_rooms[j] == croom) { |
| 6482 | f_found = true; |
| 6483 | break; |
| 6484 | } |
| 6485 | } |
| 6486 | |
| 6487 | if (!f_found) { |
| 6488 | // If you hit assert, get chris -- make constant larger |
| 6489 | ASSERTcxx . . $ `misc/pserror.h:246:9`!(num_next_rooms < max_rooms); |
| 6490 | next_rooms[num_next_rooms++] = croom; |
| 6491 | } |
| 6492 | } |
| 6493 | } |
| 6494 | |
| 6495 | return num_next_rooms; |
| 6496 | } |