Wing Commander II
Reconstructed Win32 source (1996)
Loading...
Searching...
No Matches
brains.c
Go to the documentation of this file.
1/*
2 * Ship intelligence and missions.
3 *
4 * Retail object 0x442770-0x44655F (link order; see docs/ORDER.md).
5 */
6#define BRAINS_C
7#include "game.h"
8
9short g_nEnemySighting = 0x7fff; /* 0x0049b670 */
10short g_bHomeObjectiveFlagged = 0; /* 0x0049b674 */
11short g_asShipIntelState[10] = { 0 }; /* 0x0049b678 */
12
13/* Function start: 0x442770 */
14void cruise_home(short obj)
15{
16 short range;
17
18 if (abandoned(obj, 0) != 0)
19 return;
20 if ((g_abShipTurn[obj] & 7) == 5) {
22 g_asShipSide[obj] == g_asShipSide[0] &&
23 distance_from_object(obj, 0) > 16000) {
24 remove_object(obj);
25 return;
26 }
28 g_asObjectType[obj] == 0x33)
30 else if (normal_speed(obj) != 0)
31 fire_afterburner(obj, 10);
32 if (CanSetNewShipTurnGoal(obj) != 0)
34 range = distance_from_point(obj, &g_aShipDestination[obj]);
36 &g_aShipMissionSpot[obj]) != 0) {
37 if (range < 5000) {
41 }
42 return;
43 }
44 if (range < 1500) {
47 g_abShipNavPointIndex[obj]]].type != 1)
50 g_abShipNavPointIndex[obj]], 1);
52 }
53 }
54}
55
56/* Function start: 0x4429A7 */
57void fail(short obj)
58{
60}
61
62/* Function start: 0x4429C0 */
63void coming_home(short obj)
64{
65 short home;
66 short range;
67
68 switch (g_asShipTactic[obj]) {
69 case TACTIC_CRUISE:
70 cruise_home(obj);
71 break;
74 range = distance_from_object(obj, home);
75 if (g_asObjectCollisionRadius[obj] + 800 < range)
77 else
78 approach_ship_speed(obj, home);
79 point_ship_behind_object(obj, home);
81 g_asObjectCollisionRadius[obj] + 800 > range)
82 remove_object(obj);
83 break;
84 case TACTIC_NONE:
86 if (g_asShipSide[obj] == SIDE_IMPERIAL &&
91 } else {
93 }
94 break;
95 default:
96 fail(obj);
97 }
98}
99
100/* Function start: 0x442B78 */
101void run_away(short obj)
102{
103 FixedVector direction;
104
105 if (unactive(g_asShipWingLeader[obj]) == 0 &&
109 return;
110 }
111 if (g_asShipSide[obj] == SIDE_IMPERIAL) {
112 coming_home(obj);
113 return;
114 }
115
116 zero_vector(&direction);
117 direction.y = 0x100;
118 if ((obj & 1) != 0)
119 direction.y = -direction.y;
120 point_ship(obj, 0, &direction);
121 if (normal_speed(obj) != 0 &&
122 (RandomBelow(100) < 50 || any_enemy(obj, 16000) != 0))
123 fire_afterburner(obj, 40);
124 else
126 if (distance_from_object(obj, 0) > 16000)
127 remove_object(obj);
128}
129
130/* Function start: 0x442CC3 */
131short check_engage_target(short obj)
132{
133 short newTarget = detect_enemy_tail(obj);
134
135 if (newTarget != -1 && newTarget != g_acShipTarget[obj])
136 g_acShipTarget[obj] = newTarget;
137 else if (target_valid(obj, g_acShipTarget[obj]) == 0)
138 select_target(obj);
139 return g_acShipTarget[obj];
140}
141
142/* Function start: 0x442D58 */
143short check_destroy_target(short obj)
144{
145 short destroyTarget = find_ship_index(g_asShipMissionParameter[obj]);
146
147 if (destroyTarget == -1) {
149 } else if (g_aeObjectClass[destroyTarget] ==
153 } else {
154 if (70 - MaxShort(0, MinShort(4,
155 (short)g_asPilotLevel[obj])) * 15 <
156 evaluate_damage(obj)) {
157 g_acShipTarget[obj] = destroyTarget;
158 if (g_asShipSide[destroyTarget] ==
159 g_asShipSide[obj])
160 g_acShipTarget[obj] = -1;
161 } else if (target_valid(obj, g_acShipTarget[obj]) != 0 &&
162 RandomBelow(100) > 3) {
164 } else {
165 g_acShipTarget[obj] = destroyTarget;
166 }
167 }
168 if (g_acShipTarget[obj] == -1)
170 return g_acShipTarget[obj];
171}
172
173/* Function start: 0x442EFC */
174void maneuvering(short obj, short newTarget)
175{
176 g_acShipTarget[obj] = newTarget;
178 perform_maneuver(obj);
179}
180
181/* Function start: 0x442F2D */
182void formation_burst(short obj)
183{
185 if (CanSetNewShipTurnGoal(obj) != 0)
186 point_ship(obj, 0, &g_aShipDestination[obj]);
187 g_asShipCount[obj]++;
188 if (g_asShipCount[obj] > 9) {
190 engage(obj, g_acShipTarget[obj],
192 else
193 engage(obj, g_acShipTarget[obj],
195 }
196}
197
198/* Function start: 0x442FE9 */
200{
202}
203
204/* Function start: 0x442FFD */
205void allow_engage(void)
206{
209}
210
211void engage(short obj, short target, short objective);
212void send_message(short obj, signed char message);
213short attacker_in_range(short obj, unsigned short range);
214void fire_afterburner(short obj, short time);
215short real_velocity(short obj);
216
217/* Function start: 0x44301A */
218void try2allow_engage(short obj)
219{
220 if (obj != g_nYourWingman) {
221 allow_engage();
222 return;
223 }
225 allow_engage();
226 return;
227 }
229 RandomBelowOrEqual(100) < 50) {
230 allow_engage();
231 return;
232 }
233 g_nAutoEngageTimer = -40;
234}
235
236void point_ship_at_object(short obj, short other);
237unsigned int approach_ship_speed(short obj, short other);
238unsigned int change_mission_type(short obj, short missionType);
239short facing_to_object(short obj, FixedVector *point);
240short distance_from_point(short obj, const FixedVector *point);
241void wingman_mission(short obj);
242
243/* Function start: 0x443095 */
244void imperial_formation(short obj)
245{
246 short leader = g_asShipWingLeader[obj];
247
248 if (leader == -1)
249 leader = obj;
251 if (attacker_in_range(leader, 12000) != 0) {
252 if (obj == g_nYourWingman ||
253 g_nYourWingman == -1) {
254 if (g_nAutoEngageTimer < -1)
256 else if (g_nAutoEngageTimer != -1 &&
257 --g_nAutoEngageTimer == 0)
258 try2allow_engage(obj);
259 }
260 if (g_bEngageAllowed != 0) {
263 } else if (obj == g_nYourWingman &&
264 g_nAutoEngageTimer == -1) {
265 send_message(obj, 3);
267 }
268 } else if (obj == g_nYourWingman &&
270 any_enemy(obj, 16000) != 0 &&
271 message_showing() == 0 && g_nCurrentView == 0) {
272 send_message(obj, 2);
274 }
275
277 distance_from_object(obj, leader) > 9000) {
278 if (facing_to_object(obj, &g_aShipPosition[leader]) > 85 &&
279 real_velocity(obj) < 110) {
280 fire_afterburner(obj, 10);
281 return;
282 }
283 point_ship_at_object(obj, leader);
284 approach_ship_speed(obj, leader);
285 }
286}
287
288/* Function start: 0x4432EB */
289void formation_break(short obj)
290{
291 switch (g_acShipSequence[obj]) {
292 case 0:
293 steady_object(obj);
294 g_anYawGoal[obj] = -30;
295 g_anRollGoal[obj] = -45;
296 g_anPitchGoal[obj] = -20;
297 g_acShipSequence[obj]++;
298 break;
299 case 1:
300 if (CanSetNewShipTurnGoal(obj) != 0)
301 engage(obj, g_acShipTarget[obj],
303 break;
304 default:
305 g_acShipSequence[obj] = 0;
306 }
307}
308
309/* Function start: 0x4433B1 */
310void imperial_wingman(short obj)
311{
312 switch (g_aeShipObjective[obj]) {
315 break;
317 formation_break(obj);
318 break;
321 break;
324 break;
325 case OBJECTIVE_NONE:
327 break;
328 default:
329 fail(obj);
330 }
331}
332
333/* Function start: 0x443499 */
334void kilrathi_wingman(short obj)
335{
336 short leader = g_asShipWingLeader[obj];
337
338 if (leader == -1) {
340 return;
341 } else if (unactive(leader) != 0) {
342 inherit_leader(obj);
343 return;
344 }
347 g_aeShipObjective[obj] != g_aeShipObjective[leader])
348 engage(obj, g_acShipTarget[obj],
349 g_aeShipObjective[leader]);
350
351 switch (g_aeShipObjective[obj]) {
354 break;
356 formation_burst(obj);
357 break;
361 break;
362 case OBJECTIVE_NONE:
364 break;
365 default:
366 fail(obj);
367 }
368}
369
370/* Function start: 0x443631 */
371void wingman_mission(short obj)
372{
373 if (g_asShipSide[obj] == SIDE_IMPERIAL) {
374 imperial_wingman(obj);
375 return;
376 }
377 kilrathi_wingman(obj);
378}
379
380/* Function start: 0x44366D */
381short dist_from_home(short obj)
382{
383 return distance_from_point(obj, &g_aShipMissionSpot[obj]);
384}
385
386/* Function start: 0x443698 */
387short scan_and_lock(short obj, short newTactic)
388{
389 g_acShipTarget[obj] = scan_for_enemy(obj, 14000);
390 if (g_acShipTarget[obj] != -1)
391 g_asShipTactic[obj] = newTactic;
392 return g_acShipTarget[obj] != -1;
393}
394
395/* Function start: 0x443707 */
396void patrol_area(short obj)
397{
398 short target = g_acShipTarget[obj];
399
400 switch (g_asShipTactic[obj]) {
401 case TACTIC_LOOK_OUT:
403 if (scan_and_lock(obj, TACTIC_APPROACH_TARGET) == 0 &&
404 dist_from_home(obj) > 8000)
406 break;
407 case TACTIC_HEAD_HOME:
409 if (scan_and_lock(obj, TACTIC_APPROACH_TARGET) == 0) {
411 if (g_nTargetRange < 3000) {
413 } else {
415 trim_goals(obj, 7);
416 }
417 }
418 break;
421 if (unactive(target) != 0) {
424 } else {
425 get_facing_range_from_object(obj, target);
426 if (g_nTargetRange < 10000)
428 else if (CanSetNewShipTurnGoal(obj) != 0)
429 point_ship_at_object(obj, target);
430 }
431 break;
432 case TACTIC_NONE:
434 break;
435 default:
436 fail(obj);
437 }
438}
439
440/* Function start: 0x443930 */
441void kilrathi_patrol(short obj)
442{
443 switch (g_aeShipObjective[obj]) {
445 formation_burst(obj);
446 break;
447 case OBJECTIVE_WANDER:
449 patrol_area(obj);
450 break;
453 break;
454 case OBJECTIVE_NONE:
457 break;
458 default:
459 fail(obj);
460 }
461}
462
463/* Function start: 0x443A08 */
465{
466 short range;
467
468 if (abandoned(obj, 0) != 0)
469 return;
470 if ((g_abShipTurn[obj] & 7) == 6)
471 g_acShipTarget[obj] = scan_for_enemy(obj, 15000);
472
473 if (g_acShipTarget[obj] == -1) {
475 } else {
476 fire_turrets(obj);
478 if (g_nFacingToTarget > 65)
480 else
482 }
483
484 if ((g_abShipTurn[obj] & 7) == 2) {
485 if (g_asShipMissionParameter[obj] ==
487 g_acShipNavPoint[obj] =
488 (signed char)g_nCurrentNavPoint;
489 g_aShipDestination[obj] =
491 }
492 if (CanSetNewShipTurnGoal(obj) != 0)
494 range = distance_from_point(obj, &g_aShipDestination[obj]);
495 if (range < 1500) {
496 if (g_asShipSide[obj] == SIDE_IMPERIAL)
498 g_abShipNavPointIndex[obj]], 1);
500 &g_aShipMissionSpot[obj]) != 0) {
503 } else {
505 }
506 }
507 }
508}
509
510/* Function start: 0x443C45 */
511void prepare_for_jump(short obj)
512{
513 if (g_anShipSpeed[obj] != 0) {
515 return;
516 }
517 g_asShipCount[obj]++;
518 if ((g_asShipSide[obj] == SIDE_KILRATHI ? 250 : 25) <
519 g_asShipCount[obj]) {
521 if (g_nFacingToTarget > 90 &&
522 CanSetNewShipTurnGoal(obj) != 0) {
523 g_anYawGoal[obj] = signed_random(30);
524 } else if ((g_asShipSide[obj] == SIDE_KILRATHI ? 250
525 : 25) +
526 20 <
527 g_asShipCount[obj] ||
528 (g_nTargetFacing > 80 &&
529 g_nTargetRange < 6000)) {
531 fire_afterburner(obj, 10);
532 }
533 }
534}
535
536unsigned int reset_tactic(short ship, short tactic);
537
538/* Function start: 0x443D6E */
539void accelerate_and_jump(short obj)
540{
542 if (g_asShipCount[obj]++ == 4)
543 warp(obj);
544}
545
546/* Function start: 0x443DBD */
547void reach_warp(short obj)
548{
549 switch (g_asShipTactic[obj]) {
550 case TACTIC_CRUISE:
552 break;
553 case TACTIC_SIT_STILL:
554 prepare_for_jump(obj);
555 break;
556 case TACTIC_WARP_OUT:
558 break;
559 case TACTIC_NONE:
562 break;
563 default:
564 fail(obj);
565 }
566}
567
568/* Function start: 0x443E8C */
569void split_patrol_mission(short obj)
570{
571 if (g_asShipMissionParameter[obj] ==
573 g_asShipWingLeader[obj] = -1;
574 g_acShipNavPoint[obj] =
575 (signed char)g_nCurrentNavPoint;
576 }
578 imperial_wingman(obj);
579}
580
581/* Function start: 0x443EE9 */
582void warp_arrival(short obj)
583{
584 if (g_asShipTactic[obj] == TACTIC_WARP_IN)
585 arrive_from_warp(obj);
586 else
588}
589
590/* Function start: 0x443F28 */
591void return_to_buddy(short obj, short buddy)
592{
594 if (CanSetNewShipTurnGoal(obj) != 0)
595 point_ship_at_object(obj, buddy);
596 if (distance_from_object(obj, buddy) < 1000) {
598 point_parallel(obj, buddy);
599 }
600}
601
602/* Function start: 0x443FA2 */
603void escort_buddy(short obj, short buddy)
604{
605 approach_ship_speed(obj, buddy);
606 if (CanSetNewShipTurnGoal(obj) != 0)
607 point_parallel(obj, buddy);
608}
609
610/* Function start: 0x443FE4 */
611void escort_mission(short obj)
612{
613 short buddy = find_ship_index(g_asShipMissionParameter[obj]);
614
615 if (unactive(buddy) != 0) {
617 return;
618 }
619 if ((g_abShipTurn[obj] & 3) == 0 && in_danger(buddy) != 0 &&
620 g_nTargetRange < 3000)
624 (g_abShipTurn[obj] & 7) == 4 &&
625 distance_from_object(obj, buddy) > 5000)
627
628 switch (g_aeShipObjective[obj]) {
629 case OBJECTIVE_WANDER:
630 escort_buddy(obj, buddy);
631 break;
633 return_to_buddy(obj, buddy);
634 break;
637 break;
638 case OBJECTIVE_NONE:
640 break;
641 default:
642 fail(obj);
643 }
644}
645
646/* Function start: 0x444199 */
647void check_goal(short obj)
648{
649 if (gone_ship(g_asShipMissionParameter[obj]) != 0)
651 else
653}
654
655/* Function start: 0x4441E5 */
656void streak_toward(short obj, short goal, short range)
657{
658 if (CanSetNewShipTurnGoal(obj) != 0) {
659 if (RandomBelow(100) < 95)
660 point_ship_at_object(obj, goal);
661 else
662 veer_random(obj, 20);
663 }
664 if (range > 2000 && normal_speed(obj) != 0) {
666 fire_afterburner(obj, 10);
667 } else {
669 }
670}
671
672/* Function start: 0x444291 */
673void approach_and_engage(short obj, short goal)
674{
675 unsigned short dist;
676 unsigned short possibleRange;
677 short possibleTarget;
678 short nearRange;
679
680 if (g_asObjectType[obj] == 0x33)
681 nearRange = 8000;
682 else
683 nearRange = 5000;
684 dist = (unsigned short)distance_from_object(obj, goal);
686 70 - MaxShort(0, MinShort(4,
687 (short)g_asPilotLevel[obj])) * 15 <
688 evaluate_damage(obj) &&
689 nearRange < dist) {
690 streak_toward(obj, goal, (short)dist);
691 return;
692 }
693 possibleTarget = scan_for_enemy(obj, 10000);
694 possibleRange = (unsigned short)g_nTargetRange;
695 if (possibleTarget != -1 &&
696 (possibleRange * 3 < dist ||
699 g_acShipTarget[obj] = (signed char)possibleTarget;
700 } else if (nearRange > dist) {
701 engage(obj, goal, OBJECTIVE_DESTROY_SHIP);
702 } else {
703 streak_toward(obj, goal, (short)dist);
704 }
705}
706
707/* Function start: 0x444420 */
708void strike_mission(short obj)
709{
710 short goal;
711
713 if (goal == -1 ||
714 (goal != -1 &&
716 if (is_team_member(g_asShipMissionIndex[obj]) == 0) {
717 check_goal(obj);
718 } else if (g_aMissionShips[
719 g_asShipMissionParameter[obj]].state == 3) {
720 change_mission_type(obj, 9);
722 if (g_bHomeObjectiveFlagged == 0) {
726 }
728 &g_aShipMissionSpot[obj]);
729 g_aShipDestination[obj] =
731 return;
732 } else {
734 switch (g_asShipTactic[obj]) {
735 case TACTIC_NONE:
738 &g_aShipDestination[obj]);
739 break;
740 case TACTIC_CRUISE:
742 break;
743 }
744 return;
745 }
746 }
747 switch (g_aeShipObjective[obj]) {
749 formation_burst(obj);
750 break;
753 approach_and_engage(obj, goal);
754 break;
757 break;
760 break;
761 case OBJECTIVE_NONE:
763 break;
764 default:
765 fail(obj);
766 }
767}
768
769/* Function start: 0x4446C9 */
770void return_to_master(short obj, short master)
771{
772 short range = distance_from_object(obj, master);
773
774 streak_toward(obj, master, range);
775 if (range < 5000) {
777 point_perpendicular(obj, master);
778 }
779}
780
781/* Function start: 0x44472C */
782void defend_mission(short obj)
783{
784 short master = find_ship_index(g_asShipMissionParameter[obj]);
785
786 if (master == -1) {
788 return;
789 }
790 if (g_abShipTurn[obj] % 10 == 0 &&
791 in_danger(master) != 0 && g_nTargetRange < 6000 &&
796 (g_abShipTurn[obj] & 7) == 4 &&
797 distance_from_object(obj, master) > 10000)
799
800 switch (g_aeShipObjective[obj]) {
801 case OBJECTIVE_WANDER:
802 g_acShipTarget[obj] =
803 (signed char)scan_for_enemy(obj, 7000);
804 if (g_acShipTarget[obj] != -1) {
805 engage(obj, (short)g_acShipTarget[obj],
807 } else {
809 if (CanSetNewShipTurnGoal(obj) != 0)
810 point_perpendicular(obj, master);
811 }
812 break;
814 return_to_master(obj, master);
815 break;
818 break;
819 case OBJECTIVE_NONE:
821 break;
822 default:
823 fail(obj);
824 }
825}
826
827/* Function start: 0x444966 */
828void rendezvous_mission(short obj)
829{
830 short goal = find_ship_index(g_asShipMissionParameter[obj]);
831
832 if (unactive(goal) != 0) {
834 return;
835 }
836 switch (g_aeShipObjective[obj]) {
838 if (attacker_in_range(obj, 3500) != 0)
841 if (distance_from_object(obj, goal) < 2500) {
843 return;
844 }
845 if (attacker_in_range(goal, 9000) != 0)
847 else
849 if (CanSetNewShipTurnGoal(obj) != 0)
850 point_ship_at_object(obj, goal);
851 break;
854 break;
855 default:
857 }
858}
859
860/* Function start: 0x444ADC */
861void ship_intelligence(short obj)
862{
863 if (g_acShipCollisionCooldown[obj] > 0)
865 if (regulate_turn(obj) != 0)
866 return;
867 switch (g_asShipMissionType[obj]) {
869 kilrathi_patrol(obj);
870 break;
872 escort_mission(obj);
873 break;
875 strike_mission(obj);
876 break;
878 defend_mission(obj);
879 break;
881 wingman_mission(obj);
882 break;
885 break;
887 reach_warp(obj);
888 break;
890 warp_arrival(obj);
891 break;
893 coming_home(obj);
894 break;
896 run_away(obj);
897 break;
900 break;
902 if (obj == 0) {
904 break;
905 }
907 break;
908 default:
909 fail(obj);
910 }
911}
912
913/* Function start: 0x444C80 */
914void orbit_sphere(short obj)
915{
916 short radius = g_aMissionNavPoints[
918 FixedVector center =
920 short range = distance_from_point(obj, &center);
921
922 if (CanSetNewShipTurnGoal(obj) != 0 && range > radius - 750) {
923 if (range > radius)
924 point_ship_at_point(obj, &center);
925 else
926 point_perpendicular_to_point(obj, &center);
927 }
928 trim_goals(obj, 10);
929}
930
931/* Function start: 0x444D5C */
932void tanker_intelligence(short obj)
933{
934 if (attacker_in_range(obj, 3000) != 0) {
938 fire(obj, g_nTargetShip);
939 if (CanSetNewShipTurnGoal(obj) != 0) {
940 if (RandomBelowOrEqual(4) == 0) {
941 g_anYawGoal[obj] = signed_random(90);
942 g_anRollGoal[obj] = signed_random(90);
943 } else {
946 }
947 }
948 return;
949 }
951 orbit_sphere(obj);
952}
953
954/* Function start: 0x444E51 */
956{
957 if (fire_turrets(obj) != 0) {
958 g_acShipTarget[obj] = -1;
960 } else {
962 }
963 orbit_sphere(obj);
964}
965
966void point_capital_ship_at_object(short obj, short other);
967
968/* Function start: 0x444EA7 */
970{
971 short other;
972
974 g_anObjectYawRotation[obj] = 2;
975 fire_turrets(obj);
976 for (other = 0; other < 10; other++) {
978 g_asShipSide[other] != g_asShipSide[obj]) {
980 g_acShipTarget[obj] = -1;
981 }
982 }
983}
984
985/* Function start: 0x444F53 */
986void SpawnCapitalFlakProjectile(short weapon, short obj,
987 int x, int y, int z)
988{
989 FixedVector direction;
990 short projectile;
991 short speed;
992
993 projectile = new_object(0x0d, obj);
994 if (projectile != -1) {
995 g_acObjectOwner[projectile] = (signed char)obj;
998 g_acShipTarget[obj]],
999 &direction);
1000 NormalizeFixedVector(&direction);
1002 &direction,
1003 (int)g_aObjectTypeData[
1004 g_acObjectType[obj]].collisionRadius << 8,
1005 &direction);
1006 zero_vector(&g_aShipPosition[projectile]);
1007 AddFixedVectors(&g_aShipPosition[obj], &direction,
1008 &g_aShipPosition[projectile]);
1009 speed = g_aObjectTypeData[0x0d].maximumVelocity;
1010 g_asObjectDamage[projectile] =
1012 g_asObjectCounter[projectile] =
1014 send_at_point(projectile, (FixedVector *)&x, speed);
1015 RecordCannedSceneObjectEvent(projectile, 0);
1016 }
1017}
1018
1019int send_at_point(short obj, FixedVector *point, short speed);
1020void point_capital_ship_at_object(short obj, short other);
1021void get_facing_range_from_object(short obj, short other);
1022short unactive(short ship);
1023
1024/* Function start: 0x445087 */
1026{
1027 short lockedTarget;
1028 int aimOffset;
1029 short cue;
1030 short victim;
1031 short mayFire;
1032 short enemyShips;
1033 FixedVector adjustedAim;
1034 ShipWeaponSlot *mountSlot;
1035 short allies;
1036 short frames;
1037 FixedVector spot;
1038 short gun;
1039 FixedVector leadVector;
1040 FixedVector direction;
1041 short candidate;
1042 short dodging;
1043 short seen;
1044 short shotSpeed;
1045 short flakShot;
1046 short flakIndex;
1047 short dist;
1048
1049 flakIndex = 0;
1050 flakShot = 0;
1051 victim = g_acShipTarget[obj];
1052 if (victim != -1 &&
1055 if (victim == -1) {
1056 g_acShipTarget[obj] =
1057 (signed char)find_ship_index(
1059 g_acShipSequence[obj] = 0;
1060 }
1061 victim = g_acShipTarget[obj];
1062 if (victim == -1 || unactive(victim) != 0) {
1063 seen = 0;
1064 for (candidate = 0; candidate < 10; candidate++) {
1065 if (g_aeObjectClass[candidate] >=
1067 g_asShipSide[obj] !=
1068 g_asShipSide[candidate]) {
1069 g_acShipTarget[obj] = (signed char)candidate;
1070 victim = candidate;
1071 seen = 1;
1072 }
1073 }
1074 if (seen == 0) {
1075 g_acShipTarget[obj] = -1;
1077 fire_turrets(obj);
1078 return;
1079 }
1080 }
1083 fire_turrets(obj);
1084 g_acShipTarget[obj] = (signed char)victim;
1085 get_facing_range_from_object(obj, victim);
1086
1087 /* The flak countdown shares its else with the idle case: retail
1088 * decrements inside the condition. */
1089 if (g_asSpikeriLaunchCountdown[obj] != 0 && --g_asSpikeriLaunchCountdown[obj] == 0) {
1090 cue = new_object(0x0e, obj);
1091 if (cue != -1) {
1092 g_asSpikeriCooldown[obj] =
1093 (short)((unsigned short)RandomInRange(0, 200) +
1094 400);
1095 g_acObjectOwner[cue] = (signed char)obj;
1097 &g_aShipPosition[obj],
1099 g_acShipTarget[obj]],
1100 &direction);
1101 NormalizeFixedVector(&direction);
1103 &direction,
1104 (int)g_aObjectTypeData[
1105 g_acObjectType[obj]].collisionRadius << 8,
1106 &direction);
1109 &direction,
1110 &g_aShipPosition[cue]);
1111 shotSpeed =
1113 g_asObjectDamage[cue] =
1115 g_asObjectCounter[cue] =
1118 cue,
1120 g_acShipTarget[obj]],
1121 shotSpeed);
1123 PlaySfxWaveFileByNumber(0x29, obj, 0);
1124 }
1125 } else {
1126 dist = distance_from_object(obj, victim);
1127 lockedTarget = victim;
1128 if (dist < 5000) {
1129 g_acShipSequence[obj] = 1;
1130 point_capital_ship_at_object(obj, lockedTarget);
1132 obj,
1133 (unsigned short)RandomInRange(
1134 50, (unsigned short)(
1135 g_asShipMaximumVelocity[obj] << 8)));
1136 } else if (dist > 10000 ||
1137 g_acShipSequence[obj] != 1) {
1138 g_acShipSequence[obj] = 2;
1139 point_ship_at_object(obj, lockedTarget);
1141 obj,
1142 (unsigned short)RandomInRange(
1143 50, (unsigned short)(
1144 g_asShipMaximumVelocity[obj] << 8)));
1145 }
1146 if (dist < 10000) {
1147 mountSlot = (ShipWeaponSlot *)&g_aShipWeapons[obj][1];
1148 for (gun = 0;
1149 gun <
1150 (signed char)g_aShipWeapons[obj][0];
1151 gun++, mountSlot++) {
1152 if (mountSlot->type == 0x0e &&
1153 g_asSpikeriCooldown[obj] == 0 &&
1154 g_asSpikeriLaunchCountdown[obj] == 0 &&
1155 g_nFacingToTarget > 20) {
1156 PlaySfxWaveFileByNumber(0x28, obj, 0);
1158 }
1159 if (mountSlot->type == 0x0d &&
1160 g_2_asFlakCooldownTable[obj] == 0) {
1161 enemyShips = 0;
1162 allies = 0;
1163 dodging = 0;
1164 for (candidate = 0; candidate < 10; candidate++) {
1165 if (g_aeObjectClass[candidate] ==
1167 if (g_asShipSide[obj] !=
1168 g_asShipSide[candidate])
1169 enemyShips =
1170 (short)(enemyShips + 1);
1171 else
1172 allies =
1173 (short)(allies + 1);
1174 }
1175 }
1176 if (enemyShips > allies &&
1177 RandomBelowOrEqual(2) == 0)
1178 dodging = 1;
1179 if (g_asObjectDamage[obj] > 0 &&
1180 RandomBelowOrEqual(1) == 0)
1181 dodging = 1;
1182 aimOffset =
1184 lockedTarget] << 8) * 3;
1185 flakShot = 1;
1186 switch (flakIndex % 8) {
1187 case 0:
1189 &g_aShipPosition[obj],
1190 &g_aShipPosition[lockedTarget],
1191 &g_vToTarget);
1192 mayFire = (short)(
1195 &g_vToTarget)) -
1198 lockedTarget]);
1199 frames = (short)(mayFire / 250);
1201 &g_aShipVelocity[lockedTarget],
1202 (int)frames << 8, &leadVector);
1204 &g_aShipPosition[lockedTarget],
1205 &leadVector, &spot);
1206 if (dodging == 1) {
1207 if (RandomBelowOrEqual(1) == 0)
1208 spot.x +=
1209 (int)(mayFire / 3) << 8;
1210 if (RandomBelowOrEqual(1) == 0)
1211 spot.y +=
1212 (int)(mayFire / 3) << 8;
1213 if (RandomBelowOrEqual(1) == 0)
1214 spot.z +=
1215 (int)(mayFire / 3) << 8;
1216 }
1218 gun, obj, spot.x,
1219 spot.y, spot.z);
1220 break;
1221 case 1:
1222 adjustedAim = spot;
1223 adjustedAim.x += aimOffset;
1225 gun, obj, adjustedAim.x,
1226 adjustedAim.y, adjustedAim.z);
1227 break;
1228 case 2:
1229 adjustedAim = spot;
1230 adjustedAim.x -= aimOffset;
1232 gun, obj, adjustedAim.x,
1233 adjustedAim.y, adjustedAim.z);
1234 break;
1235 case 3:
1236 adjustedAim = spot;
1237 adjustedAim.y += aimOffset;
1239 gun, obj, adjustedAim.x,
1240 adjustedAim.y, adjustedAim.z);
1241 break;
1242 case 4:
1243 adjustedAim = spot;
1244 adjustedAim.y -= aimOffset;
1246 gun, obj, adjustedAim.x,
1247 adjustedAim.y, adjustedAim.z);
1248 break;
1249 case 5:
1250 adjustedAim = spot;
1251 adjustedAim.y -= aimOffset;
1253 gun, obj, adjustedAim.x,
1254 adjustedAim.y, adjustedAim.z);
1255 break;
1256 case 6:
1257 adjustedAim = spot;
1258 adjustedAim.y += aimOffset;
1259 adjustedAim.x -= aimOffset;
1261 gun, obj, adjustedAim.x,
1262 adjustedAim.y, adjustedAim.z);
1263 break;
1264 case 7:
1265 adjustedAim = spot;
1266 adjustedAim.x -= aimOffset;
1267 adjustedAim.y -= aimOffset;
1269 gun, obj, adjustedAim.x,
1270 adjustedAim.y, adjustedAim.z);
1271 break;
1272 }
1273 flakIndex = (short)(flakIndex + 1);
1274 }
1275 }
1276 }
1277 if (flakShot != 0) {
1278 seen = 0;
1279 for (candidate = 0; candidate < 10; candidate++) {
1280 if (g_asSpikeriLaunchCountdown[candidate] != 0)
1281 seen = 1;
1282 }
1283 if (seen == 0)
1284 PlaySfxWaveFileByNumber(0x27, obj, 0);
1286 (short)((unsigned short)RandomInRange(0, 200) + 300);
1287 }
1288 }
1289}
1290
1291/* Function start: 0x445AAC */
1293{
1294 if (regulate_turn(obj) != 0)
1295 return;
1296 if (g_asObjectType[obj] >= 0x39)
1298
1299 switch (g_asShipMissionType[obj]) {
1300 case MISSION_TYPE_NONE:
1302 break;
1304 reach_warp(obj);
1305 break;
1307 warp_arrival(obj);
1308 break;
1310 coming_home(obj);
1311 break;
1312 case MISSION_TYPE_ROUT:
1313 run_away(obj);
1314 break;
1317 break;
1318 default:
1319 if (obj == 0) {
1321 break;
1322 }
1323 if (g_asShipSide[obj] == SIDE_KILRATHI) {
1324 switch (g_asObjectType[obj]) {
1325 case 0x36:
1326 case 0x37:
1328 break;
1329 case 0x34:
1330 case 0x35:
1331 case 0x38:
1332 case 0x39:
1333 case 0x3A:
1335 break;
1336 }
1337 break;
1338 }
1340 if (unactive(g_nTargetShip) != 0)
1341 scan_for_enemy(obj, 15000);
1342
1343 switch (g_asShipTactic[obj]) {
1346 if (unactive(g_acShipTarget[obj]) != 0) {
1347 select_target(obj);
1348 if (unactive(g_acShipTarget[obj]) != 0)
1350 } else {
1351 fire_turrets(obj);
1352 }
1353 break;
1354 default:
1355 if (g_nTargetShip != -1) {
1357 g_asShipTactic[obj] =
1359 g_acShipTarget[obj] =
1360 (signed char)g_nTargetShip;
1361 fire_turrets(obj);
1362 } else {
1364 }
1365 }
1366 }
1367}
1368
1369/* Function start: 0x445D9A */
1371{
1373 g_asActionCount[obj]++;
1374 if (g_nTargetRange > 1000 &&
1375 g_asActionCount[obj] > 1000) {
1376 g_aeObjectClass[obj] =
1377 (enum ObjectClass)g_asObjectCounter[obj];
1378 return;
1379 }
1380 if (g_asActionCount[obj] > 200 &&
1381 g_nTargetRange < 4000 &&
1382 g_nTargetRange > 1000 &&
1383 g_nFacingToTarget > 80)
1384 g_aeObjectClass[obj] =
1385 (enum ObjectClass)g_asObjectCounter[obj];
1386}
1387
1388/* Function start: 0x445E68 */
1390{
1391 short chaffFound;
1392 short hottestHeat;
1393 short hottest;
1394 short other;
1395
1396 chaffFound = 0;
1397 for (other = 0; other < 10; other++) {
1398 if (g_aeObjectClass[other] != OBJECT_CLASS_NULL &&
1400 distance_from_object(obj, other) < 3000) {
1401 g_acShipTarget[obj] = (signed char)other;
1402 chaffFound = 1;
1403 break;
1404 }
1405 }
1406 if (chaffFound != 0) {
1407 point_ship_at_object(obj, other);
1408 g_anShipSpeed[obj] =
1409 (get_ship_max_velocity(obj) + 10) << 8;
1410 } else if (g_nFacingToTarget < 0 ||
1411 g_acShipTarget[obj] == -1) {
1412 g_acShipTarget[obj] = -1;
1414 for (other = 0; other <= 9; other++) {
1415 if (other != obj &&
1417 get_facing_range_from_object(obj, other);
1418 if (g_nTargetRange < 9000 &&
1419 g_nFacingToTarget > 0 &&
1420 g_nTargetFacing < 0) {
1422 g_cViableTargetCount] = (signed char)other;
1427 }
1428 }
1429 }
1431 if (g_cViableTargetCount > 0) {
1432 for (hottestHeat = 3; hottestHeat > 0; hottestHeat--) {
1433 for (hottest = 0;
1434 hottest < g_cViableTargetCount;
1435 hottest++) {
1436 if (g_aeObjectClass[
1437 g_acViableTarget[hottest]] ==
1440 g_acViableTarget[hottest]] == hottestHeat) {
1441 g_acShipTarget[obj] =
1442 g_acViableTarget[hottest];
1443 hottestHeat = 0;
1444 break;
1445 }
1446 }
1447 }
1448 }
1449 if (g_acShipTarget[obj] == -1)
1450 explode(obj, obj);
1451 } else {
1452 point_ship(obj, 0, &g_vToTarget);
1453 g_anShipSpeed[obj] =
1454 (get_ship_max_velocity(obj) + 10) << 8;
1455 }
1456}
1457
1458void point_ship(short obj, short turnRate, const FixedVector *direction);
1459void point_ship_at_object(short obj, short other);
1460short explode(short attacker, short victim);
1461short distance_from_object(short obj, short other);
1462/* Function start: 0x446133 */
1464{
1465 short chaffFound;
1466 short other;
1467
1468 chaffFound = 0;
1469 if (g_asShipTactic[obj] == TACTIC_RAM) {
1470 for (other = 0; other < 10; other++) {
1471 if (g_aeObjectClass[other] != OBJECT_CLASS_NULL &&
1472 g_asObjectType[other] ==
1475 g_acObjectOwner[other]] !=
1477 g_acObjectOwner[obj]] &&
1478 distance_from_object(obj, other) < 3000) {
1479 g_acShipTarget[obj] = (signed char)other;
1480 chaffFound = 1;
1481 break;
1482 }
1483 }
1484 if (chaffFound != 0) {
1485 point_ship_at_object(obj, other);
1486 g_anShipSpeed[obj] =
1487 (get_ship_max_velocity(obj) + 10) << 8;
1488 } else if (g_acShipTarget[obj] == -1) {
1490 for (other = 0; other <= 9; other++) {
1491 if (obj != other &&
1493 (g_asShipSide[
1494 g_acObjectOwner[obj]] !=
1495 g_asShipSide[other] ||
1496 g_acShipCommunicator[other] == -1)) {
1498 distance_from_object(obj, other);
1499 if (g_nTargetRange < 9000) {
1502 (signed char)other;
1507 }
1508 }
1509 }
1511 if (g_cViableTargetCount > 0)
1512 g_acShipTarget[obj] =
1514 } else {
1515 point_ship(obj, 0, &g_vToTarget);
1516 g_anShipSpeed[obj] =
1517 (get_ship_max_velocity(obj) + 10) << 8;
1518 }
1519 }
1520}
1521
1522/* Function start: 0x446395 */
1523void chaff_intelligence(short obj)
1524{
1525 short other;
1526 short distance;
1527
1528 for (other = 1; other < 10; other++) {
1529 if (g_aeObjectClass[other] == OBJECT_CLASS_MISSILE &&
1531 distance = distance_from_object(obj, other);
1532 if (distance < 3000) {
1533 switch (g_asObjectType[other]) {
1535 explode(obj, other);
1536 break;
1539 g_acShipTarget[other] = (signed char)obj;
1540 break;
1541 }
1542 }
1543 }
1544 }
1545}
1546
1547short explode(short attacker, short victim);
1548
1549/* Function start: 0x446474 */
1550void mine_intelligence(short obj)
1551{
1552 short other;
1553 short range;
1554
1555 if (g_asObjectCounter[obj] != -1)
1556 return;
1557 for (other = 0; other <= 9; other++) {
1558 if (other != obj &&
1560 range = distance_from_object(obj, other);
1561 if (range < g_aObjectTypeData[
1562 g_acObjectType[obj]].collisionRadius ||
1563 (range < 50 && RandomBelowOrEqual(7) == 0)) {
1564 explode(obj, obj);
1565 return;
1566 }
1567 }
1568 }
1569}
1570
1571/* Linker commons defined here. LINK lays a unit's commons out by the
1572 * identifiers' hash keys, so these spellings follow the original addresses. */
1573short g_2_asFlakCooldownTable[16]; /* 0x005d1bd0 */
1574short g_asSpikeriCooldown[16]; /* 0x005d1bf0 */
1575short g_asSpikeriLaunchCountdown[10]; /* 0x005d1c10 */
unsigned int approach_full_speed(short ship)
Definition logic.c:537
void imperial_wingman(short obj)
Definition brains.c:310
void ComputeVectorDelta(FixedVector *from, FixedVector *to, FixedVector *delta)
Definition geom.c:229
unsigned int approach_zero_speed(short ship)
Definition logic.c:508
short regulate_turn(short obj)
Definition smart.c:173
void set_special(short ship, short special)
Definition logic.c:493
unsigned int select_target(short obj)
Definition smart.c:199
void approach_and_engage(short obj, short goal)
Definition brains.c:673
void escort_buddy(short obj, short buddy)
Definition brains.c:603
void kilrathi_patrol(short obj)
Definition brains.c:441
void get_facing_range_from_point(short obj, const FixedVector *point)
Definition geom.c:562
void get_follow_point(short obj, FixedVector *point)
Definition logic.c:872
short MaxShort(short a, short b)
Definition disk.c:36
int send_at_point(short obj, FixedVector *point, short speed)
Definition ship.c:2008
void cruise_to_destination(short obj)
Definition brains.c:464
short explode(short attacker, short victim)
Definition ship.c:1915
void set_next_destination(void)
Definition cockpt.c:1319
void formation_burst(short obj)
Definition brains.c:182
unsigned int get_first_follow_point(short obj, FixedVector *point)
Definition logic.c:907
void point_ship_at_object(short obj, short other)
Definition geom.c:686
short distance_from_point(short obj, const FixedVector *point)
Definition geom.c:538
void perform_maneuver(short obj)
Definition fl.c:1014
void warp_arrival(short obj)
Definition brains.c:582
void imperial_formation(short obj)
Definition brains.c:244
void SpawnCapitalFlakProjectile(short weapon, short obj, int x, int y, int z)
Definition brains.c:986
void remove_object(short obj)
Definition geom.c:858
void fire_afterburner(short obj, short time)
Definition ship.c:2733
void formation_break(short obj)
Definition brains.c:289
void disallow_engage(void)
Definition brains.c:199
void maneuvering(short obj, short newTarget)
Definition brains.c:174
short abandoned(short obj, short other)
Definition logic.c:933
void capital_ship_strike_mission(short obj)
Definition brains.c:1025
long Vector_magnitude(const FixedVector *vector)
Definition eventmgr.c:157
short is_team_member(short missionShip)
Definition mission.c:1217
void AddFixedVectors(const FixedVector *left, const FixedVector *right, FixedVector *sum)
Definition geom.c:211
short evaluate_damage(short obj)
Definition logic.c:1027
void wingman_mission(short obj)
Definition brains.c:371
void init_formation_burst(short obj)
Definition logic.c:403
void patrol_area(short obj)
Definition brains.c:396
void point_capital_ship_at_object(short obj, short other)
Definition geom.c:692
void accelerate_and_jump(short obj)
Definition brains.c:539
signed char CanSetNewShipTurnGoal(short ship)
Definition logic.c:303
void flag_reached(short objective, short reached)
Definition cockpt.c:1379
short unactive(short ship)
Definition logic.c:186
void kilrathi_wingman(short obj)
Definition brains.c:334
void run_away(short obj)
Definition brains.c:101
void ScaleFixedVector(FixedVector *vector, int scale, FixedVector *result)
Definition geom.c:237
void escort_mission(short obj)
Definition brains.c:611
void rendezvous_mission(short obj)
Definition brains.c:828
void FF_missile_intelligence(short obj)
Definition brains.c:1463
short FixedToShortSaturating(int value)
Definition geom.c:122
short MinShort(short a, short b)
Definition disk.c:27
void intelligence_events(int obj)
short any_enemy(short obj, short range)
Definition logic.c:610
short scan_for_enemy(short obj, unsigned short range)
Definition logic.c:576
void return_to_master(short obj, short master)
Definition brains.c:770
void cruise_home(short obj)
Definition brains.c:14
short get_ship_max_velocity(short obj)
Definition geom.c:9
void point_ship(short obj, short turnRate, const FixedVector *direction)
Definition geom.c:667
unsigned int approach_ship_speed(short obj, short other)
Definition logic.c:544
void strike_mission(short obj)
Definition brains.c:708
void defend_mission(short obj)
Definition brains.c:782
short distance_from_object(short obj, short other)
Definition geom.c:547
void fail(short obj)
Definition brains.c:57
unsigned int approach_speed(short ship, int targetSpeed)
Definition ship.c:682
unsigned int maintain_formation(int obj)
void inherit_leader_mission(short obj)
Definition logic.c:758
void streak_toward(short obj, short goal, short range)
Definition brains.c:656
void prepare_for_jump(short obj)
Definition brains.c:511
short signed_random(short range)
Definition logic.c:19
void point_perpendicular(short obj, short other)
Definition geom.c:734
void check_goal(short obj)
Definition brains.c:647
void launch_carrier_fighter(short carrier)
Definition carrier.c:22
void split_patrol_mission(short obj)
Definition brains.c:569
void steady_object(short ship)
Definition ship.c:698
void point_perpendicular_to_point(short obj, const FixedVector *point)
Definition geom.c:702
short attacker_in_range(short obj, unsigned short range)
Definition logic.c:664
unsigned int reset_tactic(short ship, short tactic)
Definition logic.c:461
short in_danger(short obj)
Definition logic.c:688
short facing_to_object(short obj, FixedVector *point)
Definition geom.c:591
void zero_vector(FixedVector *vector)
Definition geom.c:197
unsigned int reset_objective(short ship, short objective)
Definition logic.c:445
short real_velocity(short obj)
Definition ship.c:705
void SortViableTargetsByDistance(void)
Definition ship.c:720
void ship_intelligence(short obj)
Definition brains.c:861
short RandomBelow(short n)
Definition eventmgr.c:12
void point_ship_behind_object(short obj, short other)
Definition geom.c:712
void trim_goals(short obj, short amount)
Definition logic.c:201
void engage(short obj, short target, short objective)
Definition logic.c:952
short locate_ship(short missionShip, FixedVector *point)
Definition logic.c:848
unsigned int veer_random(short obj, short amount)
Definition smart.c:211
short detect_enemy_tail(short obj)
Definition logic.c:330
void warp(short obj)
Definition jump.c:88
void get_facing_range_from_object(short obj, short other)
Definition geom.c:578
short dist_from_home(short obj)
Definition brains.c:381
short new_object(short type, short owner)
Definition ship.c:240
void PlaySfxWaveFileByNumber(int soundNumber, int sourceObject, int looping)
Definition music.c:490
unsigned int approach_cruise_speed(short ship)
Definition logic.c:529
void capital_ship_intelligence(short obj)
Definition brains.c:1292
void futurion_intelligence(short obj)
Definition brains.c:1370
void fire(short obj, short target)
Definition ship.c:2059
short gone_ship(short missionShip)
Definition logic.c:798
void arrive_from_warp(short obj)
Definition jump.c:30
void chaff_intelligence(short obj)
Definition brains.c:1523
void reach_warp(short obj)
Definition brains.c:547
void inherit_leader(short obj)
Definition logic.c:775
short scan_and_lock(short obj, short newTactic)
Definition brains.c:387
void mine_intelligence(short obj)
Definition brains.c:1550
void send_message(short obj, signed char message)
Definition cockpt.c:3116
short target_valid(short obj, short target)
Definition logic.c:968
void flag_objective(short objective, unsigned char flags)
Definition cockpt.c:1153
void allow_engage(void)
Definition brains.c:205
void tanker_intelligence(short obj)
Definition brains.c:932
void stationary_intelligence(short obj)
Definition brains.c:969
void RecordCannedSceneObjectEvent(short obj, int event)
Definition taperec.c:176
void heat_seeking_missile_intelligence(short obj)
Definition brains.c:1389
void destroyer_intelligence(short obj)
Definition brains.c:955
void approach_half_speed(short obj)
Definition logic.c:520
void reset_mission_type(short obj, short missionType)
Definition logic.c:426
short equ_vector(const FixedVector *left, const FixedVector *right)
Definition geom.c:182
short check_engage_target(short obj)
Definition brains.c:131
void coming_home(short obj)
Definition brains.c:63
short fire_turrets(short obj)
Definition ship.c:2352
short check_destroy_target(short obj)
Definition brains.c:143
unsigned short RandomInRange(unsigned short lo, unsigned short hi)
Definition eventmgr.c:31
short normal_speed(short obj)
Definition logic.c:68
unsigned int alter_tactic(short ship, short tactic)
Definition logic.c:469
short find_ship_index(short missionShip)
Definition logic.c:251
void return_to_buddy(short obj, short buddy)
Definition brains.c:591
void point_ship_at_point(short obj, const FixedVector *point)
Definition geom.c:676
unsigned int change_mission_type(short obj, short missionType)
Definition logic.c:436
void orbit_sphere(short obj)
Definition brains.c:914
void point_parallel(short obj, short other)
Definition geom.c:740
short RandomBelowOrEqual(short n)
Definition eventmgr.c:43
short NormalizeFixedVector(FixedVector *vector)
Definition geom.c:347
short find_objective(short type, short index)
Definition jump.c:14
void try2allow_engage(short obj)
Definition brains.c:218
short message_showing(void)
Definition cockpt.c:726
Shared Win32 declarations, types and library interfaces.
#define OBJECT_DATA_CHAFF_POD
Definition game_data.h:1614
@ MISSION_TYPE_PATROL
Definition game_data.h:122
@ MISSION_TYPE_ESCORT
Definition game_data.h:123
@ MISSION_TYPE_WARP_ARRIVE
Definition game_data.h:129
@ MISSION_TYPE_GOTO_WARP
Definition game_data.h:128
@ MISSION_TYPE_RENDEZVOUS
Definition game_data.h:130
@ MISSION_TYPE_WINGMAN
Definition game_data.h:126
@ MISSION_TYPE_ROUT
Definition game_data.h:127
@ MISSION_TYPE_DEFEND
Definition game_data.h:125
@ MISSION_TYPE_COME_HOME
Definition game_data.h:131
@ MISSION_TYPE_NONE
Definition game_data.h:121
@ MISSION_TYPE_STRIKE
Definition game_data.h:124
@ MISSION_TYPE_SPLIT_PATROL
Definition game_data.h:134
@ SIDE_IMPERIAL
Definition game_data.h:175
@ SIDE_KILRATHI
Definition game_data.h:176
@ OBJECTIVE_ENGAGE_ENEMY
Definition game_data.h:145
@ OBJECTIVE_DESTROY_SHIP
Definition game_data.h:143
@ OBJECTIVE_HOLD_FORMATION
Definition game_data.h:147
@ OBJECTIVE_REACH_SHIP
Definition game_data.h:142
@ OBJECTIVE_BREAK_FORMATION
Definition game_data.h:148
@ OBJECTIVE_WANDER
Definition game_data.h:144
@ OBJECTIVE_HOME_BASE
Definition game_data.h:140
@ OBJECTIVE_NONE
Definition game_data.h:138
@ OBJECT_DATA_SPICULUM_IMAGE_RECOGNITION_MISSILE
Definition game_data.h:443
@ OBJECT_DATA_PILUM_FRIEND_OR_FOE_MISSILE
Definition game_data.h:442
@ OBJECT_DATA_JAVELIN_HEAT_SEEKING_MISSILE
Definition game_data.h:441
@ SPECIAL_MANEUVER_STOP_DRIFT
Definition game_data.h:266
@ SPECIAL_MANEUVER_KILL_ENGINES
Definition game_data.h:265
@ SPECIAL_MANEUVER_NONE
Definition game_data.h:259
ObjectClass
Definition game_data.h:36
@ OBJECT_CLASS_MISSILE
Definition game_data.h:48
@ OBJECT_CLASS_SHIP
Definition game_data.h:49
@ OBJECT_CLASS_CAPITAL_SHIP
Definition game_data.h:50
@ OBJECT_CLASS_FUTURION
Definition game_data.h:38
@ OBJECT_CLASS_NULL
Definition game_data.h:37
@ OBJECT_CLASS_BASE
Definition game_data.h:51
@ TACTIC_SELF_DEFENSE
Definition game_data.h:169
@ TACTIC_HEAD_HOME
Definition game_data.h:161
@ TACTIC_APPROACH_TARGET
Definition game_data.h:164
@ TACTIC_CRUISE
Definition game_data.h:153
@ TACTIC_WARP_OUT
Definition game_data.h:159
@ TACTIC_NONE
Definition game_data.h:152
@ TACTIC_WARP_IN
Definition game_data.h:160
@ TACTIC_LOOK_OUT
Definition game_data.h:163
@ TACTIC_RAM
Definition game_data.h:157
@ TACTIC_SIT_STILL
Definition game_data.h:154
signed char g_acShipNavPoint[12]
Definition viewrect.c:127
short g_asObjectCollisionRadius[SPACE_OBJECT_COUNT]
Definition viewrect.c:120
short g_asShipMissionParameter[12]
Definition viewrect.c:164
short g_nCurrentWave
Definition viewrect.c:54
short g_nYourWingman
Definition viewrect.c:75
FixedVector g_vToTarget
Definition viewrect.c:44
short g_asPilotLevel[12]
Definition viewrect.c:157
short g_nFacingToTarget
Definition viewrect.c:45
int g_nCurrentView
Definition spc.c:11
signed char g_abFlightPath[MISSION_OBJECTIVE_COUNT]
Definition viewrect.c:68
signed char g_acShipCommunicator[16]
Definition viewrect.c:147
signed char g_acShipSequence[14]
Definition viewrect.c:176
signed char g_acShipExhaustHeat[16]
Definition viewrect.c:145
short g_asSpikeriCooldown[16]
Definition brains.c:1574
short g_aeObjectClass[SPACE_OBJECT_COUNT]
Definition viewrect.c:125
short g_asViableTargetDistance[10]
Definition viewrect.c:199
signed char g_acShipTarget[16]
Definition viewrect.c:167
short g_anObjectYawRotation[SPACE_OBJECT_COUNT]
Definition viewrect.c:118
signed char g_cCurrentObjective
Definition viewrect.c:57
short g_asObjectType[SPACE_OBJECT_COUNT]
Definition viewrect.c:124
short g_bHomeObjectiveFlagged
Definition brains.c:10
short g_anRollGoal[12]
Definition viewrect.c:132
signed char g_acShipCollisionCooldown[16]
Definition viewrect.c:178
short g_asSpikeriLaunchCountdown[10]
Definition brains.c:1575
ObjectTypeData g_aObjectTypeData[OBJECT_DATA_COUNT]
Definition campglob.c:310
MissionNavPoint g_aMissionNavPoints[MISSION_NAV_POINT_COUNT]
Definition hotspot.c:237
short g_aeSpecialManeuver[12]
Definition viewrect.c:141
short g_anYawGoal[12]
Definition viewrect.c:131
short g_nEnemySighting
Definition brains.c:9
signed char g_acViableTarget[16]
Definition viewrect.c:198
signed char g_acObjectOwner[SPACE_OBJECT_COUNT]
Definition viewrect.c:122
signed char g_abShipNavPointIndex[16]
Definition viewrect.c:170
short g_asObjectDamage[SPACE_OBJECT_COUNT]
Definition viewrect.c:121
short g_asShipTactic[12]
Definition viewrect.c:168
short g_nTargetFacing
Definition viewrect.c:46
short g_asShipMaximumVelocity[12]
Definition viewrect.c:171
ShipIntelligenceMetadata g_stWingmanIntelligence
Definition viewrect.c:193
short g_asShipCount[12]
Definition viewrect.c:177
short g_anPitchGoal[12]
Definition viewrect.c:130
int g_anShipSpeed[SPACE_OBJECT_COUNT]
Definition viewrect.c:116
unsigned char g_aShipWeapons[10][0xA1]
Definition viewrect.c:150
short g_2_asFlakCooldownTable[16]
Definition brains.c:1573
short g_nAutoEngageTimer
Definition viewrect.c:191
short g_asShipIntelState[10]
Definition brains.c:11
short g_nTargetShip
Definition viewrect.c:48
short g_asShipWingLeader[12]
Definition viewrect.c:162
short g_bEngageAllowed
Definition viewrect.c:190
short g_asActionCount[12]
Definition viewrect.c:140
FixedVector g_aShipPosition[SPACE_OBJECT_COUNT]
Definition viewrect.c:108
FixedVector g_aShipVelocity[SPACE_OBJECT_COUNT]
Definition viewrect.c:109
short g_asShipMissionIndex[12]
Definition viewrect.c:153
signed char g_abShipTurn[16]
Definition viewrect.c:175
short g_aeShipObjective[12]
Definition viewrect.c:166
FixedVector g_aShipDestination[10]
Definition viewrect.c:128
MissionObjective g_aMissionObjectives[MISSION_OBJECTIVE_COUNT]
Definition viewrect.c:69
signed char g_cViableTargetCount
Definition viewrect.c:197
short g_nTargetRange
Definition viewrect.c:47
MissionShipRecord g_aMissionShips[MISSION_SHIP_COUNT]
Definition hotspot.c:240
short g_asShipMissionType[12]
Definition viewrect.c:163
FixedVector g_aShipMissionSpot[20]
Definition viewrect.c:165
short g_asShipSide[12]
Definition viewrect.c:139
signed char g_acObjectType[SPACE_OBJECT_COUNT]
Definition viewrect.c:101
short g_nCurrentNavPoint
Definition viewrect.c:53
short g_asObjectCounter[SPACE_OBJECT_COUNT]
Definition viewrect.c:110
MissionHeader g_13_stMissionHeaderBlock
Definition hotspot.c:253
short homeMissionShip
Definition game_data.h:1345
FixedVector position
Definition game_data.h:1327
short proximityRadius
Definition game_data.h:1328
FixedVector position
Definition game_data.h:1422
short maximumVelocity
Definition game_data.h:377
short damageCapacity
Definition game_data.h:375