Wing Commander
Reconstructed Win32 source (1996)
Loading...
Searching...
No Matches
smart.c
Go to the documentation of this file.
1/**
2 * @file
3 * @ingroup flight
4 * @brief Collision avoidance, formation flying and manoeuvre selection.
5 *
6 * Address range 433ac0-434ccf. The ordered MacsBug symbols of the Super Wing
7 * Commander smart unit corroborate the boundary: its final routine is
8 * chase_speed, immediately followed by the random unit.
9 */
10#include "wc1.h"
11#include <dos.h>
12#include <process.h>
13
14/* Linker commons defined here; LINK orders them by identifier hash. */
15FixedVector aShipRightVector[64]; /* 0x0059b6e0 */
16FixedVector aShipUpVector[64]; /* 0x0059b9e0 */
17FixedVector aShipFwdVec[64]; /* 0x0059bce0 */
19signed char acPlayerComponentDamageList[9]; /* 0x0059bff0 */
20signed char abFlightPathList[MISSION_OBJECTIVE_COUNT]; /* 0x0059c000 */
22short anYawTarget[16]; /* 0x0059c310 */
23
24/* Function start: 0x433AC0 */
25unsigned int steer_away_from_object(short obj, short other, short amount)
26{
27 FixedVector predicted;
28 FixedVector difference;
29 FixedVector relative;
30
31 anRollGoal[obj] = 0;
33 &aShipVelocity[other], &predicted);
35 &predicted, &difference);
36 transform_to_objects_frame(&difference, &relative, obj);
37 if (abs(relative.x) < abs(relative.y)) {
38 if (relative.x > 0)
39 amount = -amount;
40 anYawTarget[obj] = amount;
41 } else {
42 if (relative.y > 0)
43 amount = -amount;
44 anPitchGoal[obj] = amount;
45 }
46 return 0;
47}
48
49/* Function start: 0x433B90 */
50void steer_away_from_predicted_object(short obj, short other,
51 short predictionTicks, short amount)
52{
53 FixedVector predicted;
54 FixedVector difference;
55 FixedVector relative;
56
57 anRollGoal[obj] = 0;
59 (int)predictionTicks << 8, &predicted);
61 &predicted, &predicted);
63 &predicted, &difference);
64 transform_to_objects_frame(&difference, &relative, obj);
65 if (abs(relative.x) < abs(relative.y)) {
66 if (relative.x < 0)
67 amount = -amount;
68 anYawTarget[obj] = amount;
69 } else {
70 if (relative.y > 0)
71 amount = -amount;
72 anPitchGoal[obj] = amount;
73 }
74}
75
76/* Function start: 0x433C80 */
77void prevent_collision(short obj)
78{
79 short other;
80 short collisionTime;
81 short amount;
82 short facing;
83
84 other = (short)(signed char)abCollisionAlertTargets[obj];
85 if (other == -1) {
86 clear_alert(obj);
87 return;
88 }
89 collisionTime = crash_time(obj, other);
90 if (collisionTime >= 30) {
93 return;
94 }
96 facing = nFacingToTargetValue;
97 if (facing > 75) {
98 if (nTargetFacingValue < -70)
100 else
102 } else if (facing < -70 && normal_speed(obj) != 0) {
103 fire_afterburner(obj, 8);
104 } else {
106 }
107 if (no_goal(obj) != 0) {
108 facing = nFacingToTargetValue;
109 if (facing < -60 &&
110 nTargetFacingValue > 60) {
111 veer_random(obj, 14);
112 return;
113 }
114 amount = MinShort(facing, 25);
115 amount = MaxShort(0, amount);
117 (short)(collisionTime >> 1), amount);
118 }
119}
120
121/* Function start: 0x433D90 */
122short handle_collisions(short obj)
123{
124 short other;
125
126 other = detect_collisions(obj);
127 if (other != -1)
128 start_collision_alert(obj, other);
129 if ((short)alert_flag(obj, 1) != 0)
131 return alert_flag(obj, 1);
132}
133
134/* Function start: 0x433DE0 */
135int regulate_turn(short obj)
136{
137 signed char count;
138
139 if (aeSpecialManeuvers[obj] ==
141 return 1;
143 handle_collisions(obj) != 0)
144 return 1;
145 count = --acTurnRegulatorsArray[obj];
146 if (count > 0)
147 return 1;
148 abShipTurnList[obj]++;
150 return 0;
151}
152
153/* Function start: 0x433E50 */
154unsigned int select_target(short obj)
155{
156 if (aeShipSide[obj] == SIDE_KILRATHI) {
157 if (RandomBelow(100) < 50) {
158 if (attacker_in_range(0, 16000) == 0) {
159 if (distance_from_object(obj, 0) < 5000) {
160 acShipTargetTable[obj] = 0;
161 return 0;
162 }
163 }
164 }
165 }
166 acShipTargetTable[obj] =
167 (signed char)scan_for_enemy(obj, 16000);
168 return 0;
169}
170
171/* Function start: 0x433EC0 */
172unsigned int veer_random(short obj, short amount)
173{
174 switch (RandomBelowOrEqual(3)) {
175 case 0:
176 anYawTarget[obj] = amount;
177 return 0;
178 case 1:
179 anYawTarget[obj] = -amount;
180 return 0;
181 case 2:
182 anPitchGoal[obj] = amount;
183 return 0;
184 case 3:
185 anPitchGoal[obj] = -amount;
186 break;
187 }
188 return 0;
189}
190
191/* Function start: 0x433F50 */
192unsigned int offset_location(short obj, const ShortVector *offset,
193 FixedVector *location)
194{
195 *location = aShipPositionsArray[obj];
196 position_relative(location, aShipFwdVec[obj],
197 offset->z);
198 position_relative(location, aShipUpVector[obj],
199 offset->y);
200 position_relative(location, aShipRightVector[obj],
201 offset->x);
202 return 0;
203}
204
205/* Function start: 0x433FF0 */
206unsigned int compute_formation_destination(short leader,
207 const ShortVector *offset,
208 FixedVector *destination)
209{
210 offset_location(leader, offset, destination);
211 AddFixedVectors(destination, &aShipVelocity[leader],
212 destination);
213 AddFixedVectors(destination, &aShipVelocity[leader],
214 destination);
215 AddFixedVectors(destination, &aShipVelocity[leader],
216 destination);
217 return 0;
218}
219
220/* Function start: 0x434040 */
221unsigned int control_speed(short obj, unsigned short range,
222 int desiredSpeed)
223{
224 unsigned short travelTime;
225 int brakingMargin;
226 int acceleration;
227
228 travelTime = range /
230 acceleration = GetShipAccelerationRate(obj) * travelTime;
231 brakingMargin = desiredSpeed - anShipSpeed[obj];
232 brakingMargin = acceleration - AbsInt(brakingMargin);
233 if (brakingMargin <= 0) {
234 approach_speed(obj, desiredSpeed);
235 return 0;
236 }
237 if (brakingMargin < 12800) {
238 celerate(obj, 0x100);
239 return 0;
240 }
242 return 0;
243}
244
245/* Function start: 0x4340F0 */
246unsigned int chase_location(short obj, const FixedVector *destination,
247 short reference)
248{
249 int pointAtDestination;
250 int desiredSpeed;
251 short forwardFacing;
252 FixedVector forwardTravel;
253 FixedVector projectedDestination;
254
255 pointAtDestination = 0;
256 desiredSpeed = anShipSpeed[reference] - 0x200;
257 if (desiredSpeed < 0)
258 desiredSpeed = 0;
259 ScaleFixedVector(&aShipFwdVec[reference],
260 anShipSpeed[reference] * 15,
261 &forwardTravel);
262 AddFixedVectors(destination, &forwardTravel, &projectedDestination);
263 get_facing_range_from_point(obj, &projectedDestination);
264 forwardFacing = nFacingToTargetValue;
265 get_facing_range_from_point(obj, destination);
266 if (nFacingToTargetValue < 0) {
267 approach_speed(obj, 0);
268 if (nTgtRange /
269 MaxShort(FixedToShortSaturating(anShipSpeed[reference]), 1) > 49)
270 pointAtDestination = 1;
271 } else if (nTgtRange > 175 && no_goal(obj) != 0) {
272 pointAtDestination = 1;
273 }
274 control_speed(obj, (unsigned short)nTgtRange,
275 desiredSpeed);
276 if (nFacingToTargetValue > 85 &&
277 nTgtRange > 175)
278 anRollGoal[obj] =
279 match_roll_orientation(obj, reference);
280 if (pointAtDestination != 0)
281 point_ship(obj, 0, &vToTgt);
282 if (nTgtRange < 175) {
283 if (forwardFacing > 90) {
284 copy_frame(reference, obj);
285 steady_object(obj);
286 approach_speed(obj, anShipSpeed[reference]);
287 return 0;
288 }
289 point_ship(obj, 0, &forwardTravel);
290 }
291 if (nTgtRange < 600)
292 trim_goals(obj, 10);
293 return 0;
294}
295
296/* Function start: 0x4342C0 */
297unsigned int goto_location(short obj, const FixedVector *destination)
298{
299 short range;
300
301 ship_vs_point(obj, destination);
302 if (nFacingToTargetValue < 51) {
304 if (no_goal(obj) != 0) {
305 point_ship_at_point(obj, destination);
306 return 0;
307 }
308 } else {
309 range = nTgtRange;
310 if (range <= 3000) {
311 if (range /
314 return 0;
315 }
316 }
318 }
319 return 0;
320}
321
322/* Function start: 0x434360 */
323unsigned int goto_formation(short obj, const FixedVector *destination,
324 short leader)
325{
326 short forwardFacing;
327 FixedVector projected;
328
330 &aShipFwdVec[leader], &projected);
331 get_facing_range_from_point(obj, &projected);
332 forwardFacing = nFacingToTargetValue;
333 get_facing_range_from_point(obj, destination);
334 if (nFacingToTargetValue < 40) {
336 } else if (nTgtRange > 2000) {
338 if (nTgtRange > 3000 &&
339 nFacingToTargetValue > 70 && normal_speed(obj) != 0)
340 fire_afterburner(obj, 5);
341 } else if (nTgtRange > 200) {
342 control_speed(obj, (unsigned short)nTgtRange,
343 anShipSpeed[leader]);
344 } else {
345 approach_ship_speed(obj, leader);
346 }
347 if (nTgtRange < 200) {
348 steady_object(obj);
349 if (forwardFacing > 90) {
350 copy_frame(leader, obj);
351 return 0;
352 }
353 point_parallel(obj, leader);
354 } else if (no_goal(obj) != 0) {
355 point_ship(obj, 0, &vToTgt);
356 }
357 if (nTgtRange < 700) {
358 trim_goals(obj, 10);
359 if (forwardFacing > 90)
360 anRollGoal[obj] =
361 match_roll_orientation(obj, leader);
362 }
363 return 0;
364}
365
366/* Function start: 0x4344E0 */
367unsigned int maintain_formation(short obj)
368{
369 short leader;
370 FixedVector destination;
371
372 leader = asShipWingLeaderArray[obj];
375 &destination);
376 aShipDestinationsArray[obj] = destination;
377 goto_formation(obj, &destination, leader);
378 return 0;
379}
380
381/* Function start: 0x434550 */
382unsigned int reset_stress(short obj)
383{
384 short damage;
385
386 if (obj >= 12) {
387 if (acPilotAggression[aiPilotLevel[obj]] == 0)
388 damage = 100;
389 else
390 damage = evaluate_damage(obj);
391 if (damage < 30) {
392 damage = 30;
393 } else if (damage < 75) {
394 damage = find_ratio(30, 74, damage, 29, 15);
395 } else {
396 damage = find_ratio(75, 100, damage, 14, 0);
397 }
398 acShipStressList[obj] = (signed char)damage;
399 }
400 return 0;
401}
402
403/* Function start: 0x4345D0 */
404short stress_morale(short obj)
405{
406 if (acShipStressList[obj] < 15)
407 return 0;
408 if (acShipStressList[obj] < 30)
409 return 1;
410 return 2;
411}
412
413/* Function start: 0x4345F0 */
415{
416 signed char *maneuvers;
417 short count;
418
419 count = 0;
420 maneuvers = apDefenseManeuvers[
421 aiPilotLevel[obj]];
422 while (maneuvers[count] != -1)
423 count++;
424 return (enum ShipManeuver)maneuvers[RandomBelowOrEqual(count)];
425}
426
427/* Function start: 0x434630 */
428enum ShipManeuver pick_regular_maneuver(short obj, int event)
429{
430 short reroll;
431 short morale;
432
433 reroll = RandomBelowOrEqual(100) < 3 ||
435 morale = stress_morale(obj);
436 if (morale == 2)
437 return MANEUVER_OUTA_HERE;
438 if ((aiIntelligenceEvent[obj] == event ||
439 RandomBelowOrEqual(100) < 20) &&
440 (event == 0 || event == 3 || event == 4 || event == 7) &&
441 reroll == 0)
442 return aeShipManeuversTable[obj];
443
444 switch (event) {
445 case 0:
446 if (aeObjectClass[
447 acShipTargetTable[obj]] ==
450 if (RandomBelow(100) <
451 aiPilotLevel[obj] * 5 + 60)
452 return MANEUVER_ZIP_PAST;
453 return any_defense(obj);
454 case 2:
455 return MANEUVER_TRY2TAIL;
456 case 3:
457 if (mine_available(obj) != -1 && RandomBelow(100) < 10)
459 return any_defense(obj);
460 case 4:
461 if (RandomBelowOrEqual(100) >=
462 aiPilotLevel[obj] * 20 + 30)
463 return any_defense(obj);
465 case 5:
466 return MANEUVER_TAIL_FIRE;
467 case 6:
468 if (aiPilotLevel[obj] >= 2)
469 return MANEUVER_HARD_TURN;
470 return MANEUVER_WABBLE;
471 case 7:
472 return any_defense(obj);
473 case 8:
475 default:
476 return MANEUVER_ROLL_OVER;
477 }
478}
479
480/* Function start: 0x434800 */
481enum ShipManeuver pick_from_list(const ManeuverChoice *choice, short obj)
482{
483 enum ShipManeuver maneuver;
484 short chooseAgain;
485
486 maneuver = aeShipManeuversTable[obj];
487 chooseAgain = maneuver == MANEUVER_NONE;
488 if (choice->primary != maneuver && choice->secondary != maneuver &&
489 RandomBelow(100) < 10 &&
490 choice->primary < MANEUVER_UNKNOWN_45 &&
492 chooseAgain = 1;
493 if (chooseAgain == 0) {
494 if (RandomBelowOrEqual(100) < 5)
495 chooseAgain = 1;
496 }
497 if (chooseAgain != 0) {
498 if (RandomBelowOrEqual(100) >= choice->threshold)
499 maneuver = (enum ShipManeuver)choice->secondary;
500 else
501 maneuver = (enum ShipManeuver)choice->primary;
502 }
503 return maneuver;
504}
505
506/* Function start: 0x4348A0 */
507enum ShipManeuver pick_kilrathi_maneuver(short obj, int event)
508{
509 const ManeuverChoice *choice;
510 enum ShipManeuver maneuver;
511
512 choice =
514 aiPilotLevel[obj]][event][stress_morale(obj)];
515 maneuver = pick_from_list(choice, obj);
516 switch (maneuver) {
520 return any_defense(obj);
521 default:
522 return maneuver;
523 }
524}
525
526/* Function start: 0x434900 */
527unsigned int process_maneuver_node(short obj, int event)
528{
529 const ManeuverChoice *choice;
530 short rating;
531 enum ShipManeuver maneuver;
532 int objectIndex;
533
534 objectIndex = obj;
535 rating = (short)acShipRating[objectIndex];
536 if (rating == -1) {
537 if (aeShipSide[objectIndex] == SIDE_KILRATHI)
538 maneuver = pick_kilrathi_maneuver(obj, event);
539 else
540 maneuver = pick_regular_maneuver(obj, event);
541 } else {
542 choice =
543 &aRatedManeuverChoices[rating][event][stress_morale(obj)];
544 maneuver = pick_from_list(choice, obj);
545 }
546 if (aeShipManeuversTable[objectIndex] != maneuver)
547 reset_maneuver(obj, (short)maneuver);
548 return 0;
549}
550
551/* Function start: 0x434980 */
552void handle_stress(short obj, int event)
553{
554 short aggression;
555 short damage;
556
557 aggression =
559 switch (event) {
560 case 3:
561 case 4:
562 case 7:
563 acShipStressList[obj] += aggression;
564 break;
565 case 5:
566 acShipStressList[obj] -= aggression;
567 break;
568 case 6:
569 acShipStressList[obj] += aggression * 2;
570 break;
571 case 8:
572 acShipStressList[obj] /= 2;
573 break;
574 case -1:
575 case 2:
576 acShipStressList[obj] -=
578 break;
579 }
580 damage = evaluate_damage(obj);
581 if (damage < 40) {
582 acShipStressList[obj] += aggression * 2;
583 } else if (damage < 75) {
584 acShipStressList[obj] =
585 (signed char)MinShort(
586 (short)((short)acShipStressList[obj] + aggression),
587 28);
588 } else {
589 acShipStressList[obj] =
590 (signed char)MinShort(acShipStressList[obj], 7);
591 }
592 if (event == 6 && acShipStressList[obj] >= 30)
593 acShipStressList[obj] = 29;
594 if (acShipStressList[obj] < 0)
595 acShipStressList[obj] = 0;
596}
597
598/* Function start: 0x434A80 */
599void intelligence_events(short obj)
600{
601 int event;
602 short targetGone;
603 short target;
604 short previousStress;
605 short playerDamage;
606
607 event = -1;
608 target = acShipTargetTable[obj];
609 previousStress = (short)acShipStressList[obj];
610 targetGone = 0;
611 if (missile_on_tail(obj) != 0) {
612 event = 6;
613 } else if (unactive(target) == 0) {
616 event = 8;
617 } else {
618 event = 0;
619 ship_vs_ship(obj, target);
620 if (nTgtRange > 8000) {
621 event = 2;
622 } else if (acShipAiCooldowns[obj] > 0) {
623 event = 7;
624 } else if (nFacingToTargetValue > 55 &&
625 nTargetFacingValue < -55) {
626 event = 5;
627 } else if (nFacingToTargetValue > 75 &&
628 nTargetFacingValue > 75) {
629 event = 4;
630 } else if (nFacingToTargetValue < -60 &&
631 nTargetFacingValue > 85 &&
632 nTgtRange < 7000) {
633 event = 3;
634 } else if (anShipSpeed[target] < 20) {
635 event = 1;
636 }
637 }
638 } else {
639 targetGone = 1;
640 }
641
642 handle_stress(obj, event);
643 if (event != -1)
644 process_maneuver_node(obj, event);
645 if (event == -1 && targetGone != 0) {
646 if (any_enemy(obj, 16000) == 0)
648 else
649 select_target(obj);
650 reset_stress(obj);
651 }
652
653 if (nYourWingman == obj &&
656 if (previousStress < 15 && acShipStressList[obj] >= 15) {
657 send_message(obj, 4);
658 } else {
659 playerDamage = evaluate_damage(0);
660 if (RandomBelow(1000) < 4 && playerDamage < 35) {
661 if (evaluate_damage(obj) > playerDamage)
662 send_message(obj, 8);
663 else
664 send_message(obj, 4);
665 }
666 }
667 }
668 aiIntelligenceEvent[obj] = event;
669}
670
671/* Function start: 0x434C70 */
672unsigned int chase_speed(short obj, short range)
673{
674 if (range < nTgtRange) {
676 return 0;
677 }
678 if (range > nTgtRange) {
680 return 0;
681 }
682 approach_speed(obj,
684 acShipTargetTable[obj]]);
685 return 0;
686}
signed char acShipRating[16]
Definition joycal.c:25
enum Side aeShipSide[12]
Definition ending.c:22
short anRollGoal[16]
Definition ending.c:21
signed char acShipStressList[16]
Definition ending.c:20
signed char acPlayerComponentDamageList[9]
Definition smart.c:19
enum ShipManeuver aeShipManeuversTable[12]
Definition screen.c:25
int aiPilotLevel[12]
Definition video.c:16
short anPitchGoal[16]
Definition screen.c:13
ManeuverChoice aKilrathiManeuverChoices[5][9][3]
Definition game.c:477
ShortVector aShipFormationDeltaList[10]
Definition data.c:254
signed char acWingmanMessageStatesArray[16]
Definition video.c:25
FixedVector aShipDestinationsArray[10]
Definition input.c:18
short nTgtRange
Definition joycal.c:27
signed char abFlightPathList[MISSION_OBJECTIVE_COUNT]
Definition smart.c:20
signed char abShipTurnList[16]
Definition screen.c:17
short nFacingToTargetValue
Definition screen.c:19
signed char acPilotRecovery[20]
Definition game.c:542
FixedVector vToTgt
Definition comm.c:58
HazardField * pActiveHazardField
Definition smart.c:18
FixedVector aShipRightVector[64]
Definition smart.c:15
enum ObjectClass aeObjectClass[SPACE_OBJECT_COUNT]
Definition video.c:21
short nYourWingman
Definition game.c:61
int aiIntelligenceEvent[10]
Definition game.c:293
FixedVector aShipVelocity[SPACE_OBJECT_COUNT]
Definition smart.c:21
int anShipSpeed[64]
Definition data.c:248
signed char acPilotAggression[24]
Definition game.c:536
short asShipWingLeaderArray[16]
Definition comm.c:51
short nTargetFacingValue
Definition input.c:17
FixedVector aShipUpVector[64]
Definition smart.c:16
unsigned char abCollisionAlertTargets[0x10]
Definition joycal.c:36
signed char acTurnIntervalArray[16]
Definition screen.c:15
FixedVector aShipPositionsArray[SPACE_OBJECT_COUNT]
Definition game.c:556
FixedVector aShipFwdVec[64]
Definition smart.c:17
signed char acShipTargetTable[16]
Definition joycal.c:30
short anYawTarget[16]
Definition smart.c:22
signed char * apDefenseManeuvers[5]
Definition game.c:321
enum SpecialManeuver aeSpecialManeuvers[12]
Definition game.c:549
ManeuverChoice aRatedManeuverChoices[13][9][3]
Definition game.c:330
signed char acTurnRegulatorsArray[16]
Definition joycal.c:35
signed char acShipAiCooldowns[16]
Definition ending.c:23
signed char secondary
Definition wcdata.h:806
signed char threshold
Definition wcdata.h:804
signed char primary
Definition wcdata.h:805
short z
Definition wcdata.h:435
short x
Definition wcdata.h:433
short y
Definition wcdata.h:434
Umbrella header for the game core.
void clear_alert(short obj)
Definition logic.c:189
unsigned int approach_full_speed(short ship)
Definition logic.c:779
short match_roll_orientation(short obj, short reference)
Definition geom.c:730
void transform_to_objects_frame(const FixedVector *source, FixedVector *destination, short obj)
Definition geom.c:610
unsigned int approach_zero_speed(short ship)
Definition logic.c:746
unsigned int select_target(short obj)
Definition smart.c:154
void get_facing_range_from_point(short obj, const FixedVector *point)
Definition geom.c:676
short detect_collisions(short obj)
Definition logic.c:325
unsigned int reset_objective(short ship, enum ShipObjective objective)
Definition logic.c:676
void ship_vs_ship(short obj, short other)
Definition geom.c:710
unsigned int steady_object(short ship)
Definition ship.c:422
void fire_afterburner(short obj, short time)
Definition ship.c:1976
int missile_on_tail(short obj)
Definition logic.c:562
void AddFixedVectors(const FixedVector *left, const FixedVector *right, FixedVector *sum)
Definition geom.c:296
short evaluate_damage(short obj)
Definition logic.c:1366
enum ShipManeuver pick_from_list(const ManeuverChoice *choice, short obj)
Definition smart.c:481
unsigned int reset_stress(short obj)
Definition smart.c:382
short FixedToShortSaturating(int value)
Definition geom.c:193
enum ShipManeuver pick_regular_maneuver(short obj, int event)
Definition smart.c:428
short MinShort(short a, short b)
Definition mathutil.c:20
short crash_time(short obj, short other)
Definition logic.c:306
void steer_away_from_predicted_object(short obj, short other, short predictionTicks, short amount)
Definition smart.c:50
short find_ratio(short inputMinimum, short inputMaximum, short input, short outputMinimum, short outputMaximum)
Definition logic.c:1352
short scan_for_enemy(short obj, unsigned short range)
Definition logic.c:856
unsigned int control_speed(short obj, unsigned short range, int desiredSpeed)
Definition smart.c:221
unsigned int offset_location(short obj, const ShortVector *offset, FixedVector *location)
Definition smart.c:192
enum ShipManeuver pick_kilrathi_maneuver(short obj, int event)
Definition smart.c:507
void point_ship(short obj, short turnRate, const FixedVector *direction)
Definition geom.c:793
unsigned int approach_ship_speed(short obj, short other)
Definition logic.c:787
unsigned int approach_half_speed(short obj)
Definition logic.c:760
short distance_from_object(short obj, short other)
Definition geom.c:667
unsigned int approach_speed(short ship, int targetSpeed)
Definition ship.c:405
void try2end_collision_alert(short obj)
Definition logic.c:210
void copy_frame(short source, short destination)
Definition geom.c:585
short mine_available(short obj)
Definition logic.c:1389
unsigned int chase_location(short obj, const FixedVector *destination, short reference)
Definition smart.c:246
unsigned int goto_location(short obj, const FixedVector *destination)
Definition smart.c:297
void intelligence_events(short obj)
Definition smart.c:599
void ScaleFixedVector(const FixedVector *vector, int scale, FixedVector *result)
Definition geom.c:322
unsigned int process_maneuver_node(short obj, int event)
Definition smart.c:527
signed char no_goal(short ship)
Definition logic.c:495
void ship_vs_point(short obj, const FixedVector *point)
Definition geom.c:704
void send_message(short obj, short message)
Definition cockpt.c:2489
int attacker_in_range(short obj, unsigned short range)
Definition logic.c:979
void handle_stress(short obj, int event)
Definition smart.c:552
short handle_collisions(short obj)
Definition smart.c:122
int AbsInt(int v)
Definition geom.c:217
unsigned int goto_formation(short obj, const FixedVector *destination, short leader)
Definition smart.c:323
short RandomBelow(short n)
Definition mathfp.c:29
int any_enemy(short obj, short range)
Definition logic.c:887
void position_relative(FixedVector *position, FixedVector direction, short distance)
Definition geom.c:172
unsigned int approach_min_speed(short obj)
Definition logic.c:753
unsigned int veer_random(short obj, short amount)
Definition smart.c:172
void start_collision_alert(short obj, short other)
Definition logic.c:197
int regulate_turn(short obj)
Definition smart.c:135
unsigned int approach_cruise_speed(short ship)
Definition logic.c:770
unsigned int chase_speed(short obj, short range)
Definition smart.c:672
enum ShipManeuver any_defense(short obj)
Definition smart.c:414
void ComputeVectorDelta(const FixedVector *from, const FixedVector *to, FixedVector *delta)
Definition geom.c:314
short MaxShort(short a, short b,...)
Definition mathutil.c:29
unsigned int maintain_formation(short obj)
Definition smart.c:367
void prevent_collision(short obj)
Definition smart.c:77
short normal_speed(short obj)
Definition logic.c:220
int trim_goals(short obj, short amount)
Definition logic.c:372
unsigned int compute_formation_destination(short leader, const ShortVector *offset, FixedVector *destination)
Definition smart.c:206
void point_ship_at_point(short obj, const FixedVector *point)
Definition geom.c:802
int alert_flag(short ship, unsigned int bits)
Definition logic.c:166
unsigned int celerate(short ship, int delta)
Definition ship.c:390
void point_parallel(short obj, short other)
Definition geom.c:866
void reset_maneuver(short ship, short maneuver)
Definition logic.c:712
short RandomBelowOrEqual(short n)
Definition mathfp.c:59
short stress_morale(short obj)
Definition smart.c:404
unsigned int unactive(short ship)
Definition logic.c:353
unsigned int steer_away_from_object(short obj, short other, short amount)
Definition smart.c:25
int GetShipAccelerationRate(short ship)
Definition geom.c:140
@ SIDE_KILRATHI
Definition wcdata.h:175
@ OBJECTIVE_NONE
Definition wcdata.h:137
#define SPACE_OBJECT_COUNT
Definition wcdata.h:1004
@ SPECIAL_MANEUVER_UNKNOWN_9
Definition wcdata.h:268
ShipManeuver
Definition wcdata.h:206
@ MANEUVER_UNKNOWN_45
Definition wcdata.h:253
@ MANEUVER_ZIP_PAST
Definition wcdata.h:248
@ MANEUVER_WABBLE
Definition wcdata.h:221
@ MANEUVER_UNKNOWN_46
Definition wcdata.h:254
@ MANEUVER_OUTA_HERE
Definition wcdata.h:229
@ MANEUVER_ROLL_OVER
Definition wcdata.h:222
@ MANEUVER_HARD_TURN
Definition wcdata.h:223
@ MANEUVER_TAIL_FIRE
Definition wcdata.h:234
@ MANEUVER_DROP_A_MINE
Definition wcdata.h:230
@ MANEUVER_TRY2TAIL
Definition wcdata.h:247
@ MANEUVER_NONE
Definition wcdata.h:207
@ MANEUVER_LINE_UP_DROP
Definition wcdata.h:250
@ MANEUVER_STRAFE_ENEMY
Definition wcdata.h:237
#define MISSION_OBJECTIVE_COUNT
Definition wcdata.h:1014
@ OBJECT_CLASS_SHIP
Definition wcdata.h:50
@ OBJECT_CLASS_CAPITAL_SHIP
Definition wcdata.h:51