Wing Commander
Reconstructed Win32 source (1996)
Loading...
Searching...
No Matches
cockpt.c
Go to the documentation of this file.
1/**
2 * @file
3 * @ingroup cockpit
4 * @brief Cockpit HUD: weapon, damage, target, objective, message and pilot
5 * displays.
6 *
7 * Address range 413a10-41807f, the Mac cockpt compilation unit: its symbol
8 * list identifies the surviving functions throughout this range, with the
9 * port-specific helpers interleaved in their original address order.
10 */
11#include "wc1.h"
12
13static short asVduSelectionSound[2] = { 0x7f, 0 }; /* 0x00469000 */
14char *pszPendingHudMessage = 0; /* 0x00469004 */
15static char *volatile pszDisplayedHudMessage = 0; /* 0x00469008 */
16static volatile signed char cRenderedPilotHandFrame = -1; /* 0x0046900c */
17/* Nothing in the shipped executable references these eight zero bytes. */
18static int DAT_00469010[2] = { 0, 0 }; /* 0x00469010 */
19/* 0x00469018 */
20static short asPilotHandOffsets[34] = {
21 6, -3, 7, 2, 7, 9, 7, 12, 8, 13, 0, -1, -1, -1,
22 -4, -1, -6, -1, 6, 0, 8, 0, 10, 0, 13, 3, 8, -7,
23 6, -9, 5, -11, 5, -14
24};
25struct Shape *pCockpitPilotShape = 0; /* 0x0046905c */
26unsigned char *pCockpitExplosionBackground = 0; /* 0x00469060 */
27struct Shape *pCockpitExplosionShape = 0; /* 0x00469064 */
28short nCockpitExplosionFrame = 8; /* 0x00469068 */
29unsigned char *pReleaseWeaponDisplayBackground = 0; /* 0x0046906c */
30static signed char cReleaseWeaponDisplayFrame = -1; /* 0x00469070 */
31static signed char cReleaseWeaponDisplayTicks = 0; /* 0x00469074 */
32static signed char cReleaseWeaponDisplayState = 0; /* 0x00469078 */
33static char szNoWeaponName[5] = "None"; /* 0x00469080 */
34static int nDisplayedObjectiveRange = 40000; /* 0x00469088 */
35/* 0x0046908c */
36static char *pszObjectiveStatusMessage = "Wait for ??????????????????";
37static short nScannerTargetObject = -1; /* 0x00469090 */
38/* 0x00469098 */
39static int aiScannerGridRows[79] = {
40 5, 13, 16, -1,
41 5, 13, 16, -1,
42 5, 13, 16, -1,
43 4, 13, 16, -1,
44 4, 12, 16, -1,
45 2, 3, 4, 12, 15, -1,
46 0, 1, 5, 12, 15, -1,
47 6, 11, 15, -1,
48 7, 11, 14, -1,
49 8, 10, 14, -1,
50 9, 13, -1,
51 8, 13, -1,
52 6, 7, 12, -1,
53 4, 5, 11, -1,
54 0, 1, 2, 3, 10, -1,
55 9, -1,
56 7, 8, -1,
57 4, 5, 6, -1,
58 0, 1, 2, 3, -1,
59 -2
60};
61/* 0x004691d4 */
62static const char *pszMissileLockedMessage = "MISSILE LOCKED ";
63static unsigned char bTargetBracketVisible = 1; /* 0x004691d8 */
64/* 0x004691e0 */
65static short asHudMessageOrigins[10] = {
66 18, 14, 71, 5, 80, 29, 49, 27, 14, 13
67};
68static short nTargetLockMarkerX = -0x7fff; /* 0x004691f4 */
69static ShortRect stTargetBracketBounds = {-0x7fff, 0, 0, 0}; /* 0x004691f8 */
70static ShortRect stPreviousTargetBracketBounds = {-0x7fff, 0, 0, 0}; /* 0x00469200 */
71short nNavPointerObject = -1; /* 0x00469208 */
72static Viewport stTrainSimVduSource = {0}; /* 0x00469210 */
73/* 0x00469228 */
75 {{224, 5}, {132, 96}, {233, 107}, {149, 161}},
76 {{177, 6}, {153, 142}, {103, 140}, {55, 183}},
77 {{107, 25}, {211, 32}, {21, 178}, {300, 178}},
78 {{74, 10}, {294, 19}, {197, 105}, {105, 134}},
79 {{0, 0}, {0, 0}, {0, 0}, {0, 0}}
80};
81struct Shape *pConfedCommBackground = 0; /* 0x00469278 */
82struct Shape *pCommStaticShape = 0; /* 0x0046927c */
83struct Shape *pKilrathiCommBackground = 0; /* 0x00469280 */
84static int nCommPortraitFrame = -1; /* 0x00469284 */
85static int bForceDamageDisplayRedraw = 0; /* 0x00469288 */
86
87/* 0x00475ff0 */
88static unsigned char abMouseCursorBackground[0x400];
89
90enum ObjectType eReleaseWpnDisplayType; /* 0x005a7dc0 */
91unsigned char *pRadarMarkerBackground; /* 0x005a7dc4 */
92signed char bStickIndicatorFrameState; /* 0x005a7dc8 */
93short nCurrentNoticeTimer; /* 0x005a7dca */
94short nPendingCockpitDamageValue; /* 0x005a7dcc */
96signed char cLastTargetObject; /* 0x005a7df2 */
97int nSavedMouseCursorY; /* 0x005a7df4 */
98int nStoredMouseCursorPosX; /* 0x005a7df8 */
99char szComponentHitMessage[40]; /* 0x005a7e00 */
100short nTargetLockMarkerY; /* 0x005a7e28 */
101short nCarrierMissionShipIndexValue; /* 0x005a7e2a */
103short nScannerCursorX; /* 0x005a7e6c */
104short nScannerCursorY; /* 0x005a7e6e */
105unsigned char abCockpitIndicatorStatesArray[7]; /* 0x005a7e70 */
106/* Function start: 0x413A10 */
107void EmitTextString(void (__stdcall *writer)(int character), const char *text)
108{
109 short character;
110
111 while ((character = (signed char)*text++) != 0)
112 writer((short)character);
113}
114
115/* Function start: 0x413A40 */
116void FormatTextTokens(void (__stdcall *writer)(int),
117 const char *format, va_list arguments)
118{
119 short character;
120 char number[64];
121
122 character = (signed char)*format++;
123 while (character != 0) {
124 switch (character) {
125 default:
126 writer((short)character);
127 break;
128 case '%':
129 character = (signed char)*format++;
130 switch (character) {
131 case 'B':
133 (unsigned char)va_arg(arguments, int);
134 break;
135 case 'D':
136 EmitTextString(writer,
137 ltoa(va_arg(arguments, long),
138 number, 10));
139 break;
140 case 'F':
142 (unsigned char)va_arg(arguments, int);
143 break;
144 case 'J':
146 (unsigned char)va_arg(arguments, int);
147 break;
148 case 'P':
150 break;
151 case 'U':
152 EmitTextString(writer,
153 ultoa(va_arg(arguments, unsigned long),
154 number, 10));
155 break;
156 case 'X':
158 va_arg(arguments, short);
159 break;
160 case 'Y':
162 va_arg(arguments, short);
163 break;
164 case 'c':
165 writer(va_arg(arguments, short));
166 break;
167 case 'd':
168 EmitTextString(writer,
169 itoa((int)va_arg(arguments, short),
170 number, 10));
171 break;
172 case 's':
173 EmitTextString(writer, va_arg(arguments, char *));
174 break;
175 case 'u':
176 EmitTextString(writer,
177 ultoa(va_arg(arguments, unsigned short),
178 number, 10));
179 break;
180 case 'x':
181 EmitTextString(writer,
182 strupr(ultoa(
183 va_arg(arguments, unsigned short),
184 number, 16)));
185 break;
186 default:
187 writer((short)character);
188 break;
189 }
190 break;
191 }
192 character = (signed char)*format++;
193 }
194}
195
196/* Function start: 0x413C40 */
197void DrawFormattedText(const char *format, ...)
198{
199 va_list arguments;
200
201 va_start(arguments, format);
202 FormatTextTokens((void (__stdcall *)(int))DrawTextCharacter,
203 format, arguments);
204 va_end(arguments);
207 DIBslam();
208}
209
210/* Function start: 0x413C70 */
211void FormatTextBufferFromStart(const char *format, ...)
212{
213 va_list arguments;
214
215 va_start(arguments, format);
218 FormatTextTokens((void (__stdcall *)(int))AppendTextCharacter,
219 format, arguments);
220 va_end(arguments);
223 DIBslam();
224}
225
226/* Function start: 0x413CB0 */
227void AppendFormattedText(const char *format, ...)
228{
229 FormatTextTokens((void (__stdcall *)(int))AppendTextCharacter,
230 format, (va_list)(&format + 1));
233 DIBslam();
234}
235
236/* Function start: 0x413CE0 */
237void FatalErrorAndExit(const char *format, ...)
238{
239 char text[0xfc];
240
241 vsprintf(text, format, (char *)(&format + 1));
243 exit_squadron(text);
244}
245
246/* Function start: 0x413D20 */
247unsigned short IsCockpitExplosionActive(void)
248{
249 return nCockpitExplosionFrame < 8;
250}
251
252/* Function start: 0x413D40 */
253void EraseCockpitReadoutRegion(Viewport *viewport, short left,
254 short top, short right, short bottom,
255 short colour)
256{
257 Viewport clippedViewport;
258
259 clippedViewport = *viewport;
260 if (right >= left && bottom >= top) {
261 clippedViewport.left = left;
262 clippedViewport.top = top;
263 clippedViewport.right = right;
264 clippedViewport.bottom = bottom;
265 ClearViewport(&clippedViewport, colour);
266 }
267}
268
269/* Function start: 0x413DA0 */
270void vdu_polygon(signed char bar, short percent)
271{
272 signed char filledFrame;
273 signed char emptyFrame;
274 signed char swapFrame;
275 short direction;
276 short left;
277 short top;
278 short bottom;
279 short right;
280 short extent;
281
282 extent = (short)((percent *
283 aaCockpitBars[cCurrentCockpitView][bar].length) / 100);
285 left = stCockpitBar.left =
287 if (left != -99) {
288 right = stCockpitBar.right =
290 top = stCockpitBar.top =
292 bottom = stCockpitBar.bottom =
294 emptyFrame = (signed char)
295 aaCockpitBars[cCurrentCockpitView][bar].emptyFrame;
296 filledFrame = (signed char)
297 aaCockpitBars[cCurrentCockpitView][bar].filledFrame;
299
300 if (direction < 2) {
301 if (direction == 1) {
302 extent = (short)(percent - extent);
303 swapFrame = emptyFrame;
304 emptyFrame = filledFrame;
305 filledFrame = swapFrame;
306 }
307 stCockpitBar.bottom -= extent;
311 filledFrame);
312 stCockpitBar.top = (short)(stCockpitBar.bottom + 1);
313 stCockpitBar.bottom = bottom;
314 if (stCockpitBar.top <= bottom)
317 emptyFrame);
318 } else {
319 if (direction == 3) {
320 extent = (short)(percent - extent);
321 swapFrame = emptyFrame;
322 emptyFrame = filledFrame;
323 filledFrame = swapFrame;
324 }
325 stCockpitBar.right -= extent;
329 filledFrame);
330 stCockpitBar.left = (short)(stCockpitBar.right + 1);
331 stCockpitBar.right = right;
332 if (stCockpitBar.left <= right)
335 emptyFrame);
336 }
337 }
338}
339
340/* Function start: 0x413F70 */
341unsigned int InitializeCockpitReadout(signed char slot,
342 TextContext *context)
343{
344 aCockpitReadouts[slot].context = context;
345 aCockpitReadouts[slot].x = context->cursorX;
346 aCockpitReadouts[slot].y = context->cursorY;
348 return 0;
349}
350
351/* Function start: 0x413FB0 */
352void DrawCockpitReadout(signed char slot, const char *text)
353{
354 if (aCockpitReadouts[slot].x != -99) {
355 SetTextContext(aCockpitReadouts[slot].context);
356 SetTextCursor((unsigned short)aCockpitReadouts[slot].x,
357 (unsigned short)aCockpitReadouts[slot].y);
358 DrawFormattedText(text);
360 &stScreenView, aCockpitReadouts[slot].context->cursorX,
361 aCockpitReadouts[slot].y,
363 (short)(*(short *)aCockpitReadouts[slot].context->font +
364 aCockpitReadouts[slot].y - 1),
368 }
369}
370
371/* Function start: 0x414050 */
372void EraseCockpitReadoutAtPosition(signed char slot, short left,
373 short top)
374{
376 &stScreenView, left, top, aCockpitReadouts[slot].previousRight,
377 (short)(*(short *)aCockpitReadouts[slot].context->font +
378 aCockpitReadouts[slot].y),
380}
381
382/* Function start: 0x4140A0 */
384{
385 unsigned char savedColour;
386 short oldDrawColour;
387 short showingEraseColour;
388
389 if (nCameraViewMode != 0)
390 return 1;
391
392 oldDrawColour = slot->drawColour;
393 if (((int)nTickCount60Hz / 40) % 3 == 0)
394 slot->drawColour = cBlackColour;
395 else
396 slot->drawColour = slot->colour;
397
398 if (slot->flashCount != -1) {
399 if (slot->drawColour == cBlackColour &&
400 oldDrawColour == slot->colour) {
401 slot->flashCount = (signed char)MaxShort(
402 0, (short)(slot->flashCount - 1));
403 }
404 if (slot->flashCount == 0)
405 slot->drawColour = cBlackColour;
406 }
407
408 showingEraseColour = slot->drawColour == cBlackColour;
409 savedColour = slot->context->colour;
410 slot->context->colour = (unsigned char)slot->drawColour;
411 DrawTextAt(slot->context, slot->x, slot->y, slot->text, 2);
412 slot->context->colour = savedColour;
413 return showingEraseColour;
414}
415
416/* Function start: 0x414180 */
418{
419 slot->flashCount = 0;
420 if (slot->text != 0)
421 DrawHudMessageSlot(slot);
422 slot->text = 0;
423}
424
425/* Function start: 0x4141B0 */
426void ClearHudMessageIfMatching(HudMessageSlot *slot, const char *text)
427{
428 if (slot->text == text)
430}
431
432/* Function start: 0x4141D0 */
440
441/* Function start: 0x4141F0 */
443 short x, short y, const char *text,
444 unsigned short colour, signed char flashCount)
445{
446 if (slot->text != 0)
448 slot->context = context;
449 slot->x = x;
450 slot->y = y;
451 slot->colour = colour;
452 slot->drawColour = colour;
453 slot->text = text;
454 slot->flashCount = flashCount;
455}
456
457/* Function start: 0x414240 */
459{
460 short showingEraseColour;
461
462 if (slot->text != 0) {
463 showingEraseColour = DrawHudMessageSlot(slot);
464 if (slot->flashCount == 0 && showingEraseColour != 0)
466 }
467}
468
469/* Function start: 0x414270 */
470void set_global_message(const char *text, unsigned short colour,
471 int flashCount)
472{
475 (short)(stRightVduViewport.bottom - 6),
476 text, colour, (signed char)flashCount);
477}
478
479/* Function start: 0x4142B0 */
480void CockpitMessage(const char *text, unsigned short colour,
481 int flashCount)
482{
483 if (text != aCockpitHudMessageSlotsTable[1].text)
484 set_global_message(text, colour, flashCount);
485}
486
487/* Function start: 0x4142D0 */
488/* Nothing in the shipped executable calls this. */
493
494/* Function start: 0x4142E0 */
495void remove_message(const char *text)
496{
498}
499
500/* Function start: 0x414300 */
501short kilrathi_near(short obj, short range)
502{
503 short ship;
504
505 for (ship = 0; ship < 10; ship++) {
506 if (aeObjectClass[ship] >= OBJECT_CLASS_SHIP &&
507 aeShipSide[ship] == SIDE_KILRATHI &&
509 &aShipPositionsArray[ship],
510 range) != 0)
511 return 1;
512 }
513 return 0;
514}
515
516/* Function start: 0x414380 */
517short auto_pilot_valid(short showReason)
518{
519 const char *reason;
520
521 reason = 0;
523 return 0;
525 0,
527 cCurrentObjective].position) < 8000) {
528 reason = "Already Near";
529 } else if (kilrathi_near(0, 16000) != 0) {
530 reason = "Enemy Near";
531 } else if (pActiveHazardField != 0) {
532 reason = "Hazard Near";
533 }
534 if (showReason != 0 && reason != 0)
536 return reason == 0;
537}
538
539/* Function start: 0x414410 */
548
549/* Function start: 0x414440 */
550unsigned int SetCockpitLightBlink(signed char light, short interval)
551{
552 if (interval < 20) {
553 if (interval == 0) {
554 abCockpitLightGoalArray[light] ^= 1;
555 return 0;
556 }
557 if (nCurrentSpaceFrameValue % interval == 0) {
558 abCockpitLightGoalArray[light] ^= 1;
559 return 0;
560 }
561 } else {
562 abCockpitLightGoalArray[light] = 0;
563 }
564 return 0;
565}
566
567/* Function start: 0x414490 */
569{
570 signed char light;
571 short x;
572 short y;
573 short frame;
574
575 if (nRenderedSpaceFrame % 4 == 0) {
576 if (auto_pilot_valid(0) != 0)
578 else
580 }
581 for (light = 0; light < 7; light++) {
582 if (bCockpitlessView == 0) {
586 cCurrentCockpitView][light];
588 cCurrentCockpitView][light];
589 if (abCockpitLightGoalArray[light] == 1)
591 cCurrentCockpitView][light];
592 else
594 cCurrentCockpitView][light];
596 pCockpitDamageShape, frame);
599 }
600 continue;
601 }
602 {
603 short cockpitlessY;
604
606 cCurrentCockpitView][light];
607 cockpitlessY = aasCockpitLightY[
608 cCurrentCockpitView][light];
609 if (abCockpitLightGoalArray[light] == 1)
611 cCurrentCockpitView][light];
612 else
614 cCurrentCockpitView][light];
615 DrawSpriteDefault(&stScreenView, x, cockpitlessY,
616 pCockpitDamageShape, frame);
619 }
620 }
621}
622
623/* Function start: 0x4145B0 */
625{
626 short fuelPercent;
627
628 fuelPercent = (short)(
629 (anShipFuelsTable[0] * 100) /
631 aeObjectTypeList[0]].lifetime);
632 SetCockpitLightBlink(6, fuelPercent);
633 vdu_polygon(0, fuelPercent);
635
636 if (nTrainSimActive == 0) {
637 if (calculate_damage_level() >= 3 &&
638 (int)aasShipShield[0][1] +
639 (int)aasShipShield[0][0] < 10) {
642 nCurrentSpaceFrameValue % 10 == 0)
643 PlaySfxWaveFileByNumber(0x20, -1, 0);
644 } else if (nCurrentDamageAlarmSfxHandle != 0) {
649 }
650 }
651}
652
653/* Function start: 0x414690 */
654void update_bars(void)
655{
656 ObjectTypeData *typeData;
657 short forePercent;
658 short aftPercent;
659
660 typeData = &aObjectTypeData[aeObjectTypeList[0]];
661 vdu_polygon(2,
662 (short)((aasShipArmor[0][0] * 100) /
663 typeData->armorFront));
664 vdu_polygon(3,
665 (short)((aasShipArmor[0][1] * 100) /
666 typeData->armorRear));
667 vdu_polygon(4,
668 (short)((aasShipArmor[0][2] * 100) /
669 typeData->armorRight));
670 vdu_polygon(5,
671 (short)((aasShipArmor[0][3] * 100) /
672 typeData->armorLeft));
673 forePercent = (short)((aasShipShield[0][0] * 100) /
674 typeData->shieldFore);
675 SetCockpitLightBlink(0, forePercent);
676 vdu_polygon(6, forePercent);
678 4, itoa((int)aasShipShield[0][0],
680 aftPercent = (short)((aasShipShield[0][1] * 100) /
681 typeData->shieldAft);
682 SetCockpitLightBlink(1, aftPercent);
683 vdu_polygon(7, aftPercent);
685 5, itoa((int)aasShipShield[0][1],
687}
688
689/* Function start: 0x4147E0 */
690short get_mode(short i)
691{
692 return ausVduModeStack[
693 ((int)acVduModeStackDepth[i] + i * 4) * 2];
694}
695
696/* Function start: 0x414800 */
697void set_mode(short i, int state)
698{
699 if (get_mode(i) != state)
701 acVduModeStackDepth[i] = 0;
702 *(int *)&ausVduModeStack[i * 8] = state;
703}
704
705/* Function start: 0x414850 */
706unsigned short SetVduModeIfChanged(short i, int state)
707{
708 short changed;
709
710 changed = get_mode(i) != state;
711 if (changed != 0)
712 set_mode(i, state);
713 return changed;
714}
715
716/* Function start: 0x414890 */
718{
719 return acVduModeStackDepth[i];
720}
721
722/* Function start: 0x4148A0 */
723void push_mode(short i, int state)
724{
727 *(int *)&ausVduModeStack[
728 ((int)acVduModeStackDepth[i] + i * 4) * 2] = state;
729}
730
731/* Function start: 0x4148E0 */
737
738/* Function start: 0x414910 */
739void set_new_vdu(short vdu)
740{
741 if (get_mode(vdu) == 0) {
742 malf_noise(vdu, 1, cDarkGreenColour, 0x17, 0);
743 } else {
744 if (vdu == 1)
746 else
748 }
749 anVduModeCache[vdu] = (unsigned int)get_mode(vdu);
750}
751
752/* Function start: 0x414980 */
753short update_vid_disp(short vdu)
754{
755 short changed;
756
757 changed = get_mode(vdu) != (int)anVduModeCache[vdu];
758 if (changed != 0)
759 set_new_vdu(vdu);
760 return changed;
761}
762
763/* Function start: 0x4149C0 */
764void InvalidateVduMode(short i)
765{
766 anVduModeCache[i] = 0;
767}
768
769/* Function start: 0x4149E0 */
771{
773}
774
775/* Function start: 0x4149F0 */
777{
778 return 0 < nCurrentNoticeTimer;
779}
780
781/* Function start: 0x414A10 */
782unsigned short set_message_time(unsigned short v)
783{
784 nCurrentNoticeTimer = (short)v;
785 return 0;
786}
787
788/* Function start: 0x414A20 */
790{
791 if (message_showing() &&
794 EndCommMenu();
795}
796
797/* Function start: 0x414A50 */
798unsigned int update_digital_readouts(void)
799{
800 long velocity;
801 short speed;
802
804 speed = (short)((anShipSpeed[0] >> 8) * 10);
806 2, itoa((int)speed,
808 velocity = MultiplyFixed(
809 Vector_magnitude(&aShipVelocity[0]), 0xa00);
811 3, itoa((int)(short)(velocity >> 8),
813 return 0;
814}
815
816/* Function start: 0x414AD0 */
818{
819 PlaySfxWaveFileByNumber(0x18, -1, 0);
820}
821
822/* Function start: 0x414AE0 */
823void malf_sound(void)
824{
825 PlaySfxWaveFileByNumber(0x1f, -1, 0);
826}
827
828/* Function start: 0x414AF0 */
829short malf(char component)
830{
831 int damage = acPlayerComponentDamageList[component];
832
833 return (unsigned short)RandomInRange(0, 15) < damage * damage;
834}
835
836/* Function start: 0x414B20 */
837unsigned short vdu_malf(short vdu, short sound)
838{
839 if (nCameraViewMode == 0
840 )
841 malf_noise(vdu, 1, cDarkGreenColour, sound, 0);
842 set_mode(vdu, 0);
843 return 0;
844}
845
846/* Function start: 0x414B70 */
847void ShowComponentHitHudMessage(const char *text, unsigned short colour,
848 short flashCount)
849{
850 if (nTrainSimActive == 0 && get_mode(0) != 0) {
851 if (aCockpitHudMessageSlotsTable[0].text != 0)
857 (short)(stLeftVdu.bottom - 6),
859 colour, (signed char)flashCount);
860 }
861}
862
863/* Function start: 0x414BF0 */
864int damage_your_component(char component, char amount, char maximum)
865{
866 int index = (int)component;
867 char text[40];
868
869 acPlayerComponentDamageList[index] = (signed char)MinShort(
870 (short)(acPlayerComponentDamageList[index] + amount),
871 (short)maximum);
872 if (malf(component) != 0 && index == 3) {
873 vdu_malf(0, 0x18);
874 vdu_malf(1, 0x18);
875 }
876 if (get_mode(0) == 2 || get_mode(0) == 1) {
877 sprintf(text, "%s HIT",
878 apszComponentNames[index]);
879 ShowComponentHitHudMessage(text, (unsigned char)cRedColour, 5);
880 }
881 return acPlayerComponentDamageList[index];
882}
883
884/* Function start: 0x414CB0 */
885void RemovePlayerReleaseWeapon(signed char weapon)
886{
887 enum ObjectType preferredType;
888 int hardpoint;
889
890 preferredType = ((ShipWeaponSlot *)&aShipWeaponsTable[0][1])[weapon].type;
891 eReleaseWpnDisplayType = preferredType;
893 (signed char)(preferredType * 2 - 0x2f);
894 hardpoint = ((ShipWeaponSlot *)&aShipWeaponsTable[0][1])[weapon].hardpoint;
896 (short)(aWeaponDisplayPositions[hardpoint].x +
899 (short)(aWeaponDisplayPositions[hardpoint].y +
905 remove_weapon(0, weapon);
907 select_new_release_weapon(preferredType);
908}
909
910/* Function start: 0x414D50 */
952
953/* Function start: 0x414EA0 */
955{
956 signed char count;
957 ShipWeaponSlot *weapons;
958 ShipWeaponSlot *selectedWeapon;
959 const char *releaseName;
960 const char *gunName;
961 enum ObjectType selectedGunType;
962 short frame;
963
964 selectedWeapon =
967 set_new_vdu(0);
970 "WEAPON DISPLAY", 2);
972 (short)(stLeftVdu.top + 5),
973 (short)(stLeftVdu.right - 2),
974 (short)(stLeftVdu.top + 5),
976
977 releaseName = szNoWeaponName;
979 releaseName = aObjectTypeData[
980 selectedWeapon->type].displayName;
981 selectedGunType = eSelectedGunType;
982 switch ((int)selectedGunType) {
983 case -1:
984 gunName = szNoWeaponName;
985 break;
986 case 0x80:
987 gunName = "Full Guns";
988 break;
989 default:
990 gunName = aObjectTypeData[
991 selectedGunType].displayName;
992 break;
993 }
994 DrawFormattedText("\nWeapon: %s", releaseName);
995 DrawFormattedText("\nGun: %s", gunName);
996
998 (short)(stLeftVdu.left +
1002 (short)(stLeftVdu.top +
1008 weapons = (ShipWeaponSlot *)&aShipWeaponsTable[0][1];
1009 for (count = 0; aShipWeaponsTable[0][0] > count; count++, weapons++) {
1010 frame = (short)((int)weapons->type * 2 +
1011 weapons->disabled - 0x2f);
1013 &stLeftVdu,
1014 (short)(stWpnDispOrigin.x +
1016 weapons->hardpoint].x),
1017 (short)(stWpnDispOrigin.y +
1019 weapons->hardpoint].y),
1020 pCockpitWeaponShapePtr, frame);
1021 }
1022}
1023
1024/* Function start: 0x415040 */
1026{
1027}
1028
1029/* Function start: 0x415050 */
1030short sighted(short objective)
1031{
1032 return (aMissionObjectivesArray[objective].flags & 4) == 4;
1033}
1034
1035/* Function start: 0x415070 */
1036short visited(short objective)
1037{
1038 return (aMissionObjectivesArray[objective].flags & 1) == 1;
1039}
1040
1041/* Function start: 0x415090 */
1042short achieved(short objective)
1043{
1044 return (aMissionObjectivesArray[objective].flags & 2) == 2;
1045}
1046
1047/* Function start: 0x4150B0 */
1048void flag_objective(short objective, unsigned char flags)
1049{
1050 aMissionObjectivesArray[objective].flags |= flags;
1051}
1052
1053/* Function start: 0x4150D0 */
1055{
1056 if (nCurObjectiveRangeValue <= 0) {
1057 DrawCockpitReadout(0, "CALCULATING");
1058 } else {
1059 strcpy(szTxtWorkspaceBuffer +
1060 strlen(ltoa((long)nCurObjectiveRangeValue,
1062 " km");
1064 }
1067}
1068
1069/* Function start: 0x415130 */
1070const char *objective_name(short objective)
1071{
1072 if (objective >= (short)cMissionObjectiveCountValue)
1073 return "NONE";
1074 if (*aMissionObjectivesArray[objective].name == '?' &&
1075 sighted(objective) == 0)
1076 return "UNKNOWN";
1077 return aMissionObjectivesArray[objective].displayName;
1078}
1079
1080/* Function start: 0x415180 */
1082{
1085 "COMP NAVIGATION", 2);
1086 DrawFormattedText("\n\nDESTINATION\n %s",
1088 DrawFormattedText("\n\nRANGE\n ");
1090 DrawFormattedText("\n\n(N)ew Objective");
1092}
1093
1094/* Mission-ship lookup callee of the objective routines below. */
1095short find_ship_index(short missionShip);
1096
1097/* Function start: 0x4151F0 */
1098short hidden_objective(short objective)
1099{
1100 short nameHidden;
1101 short hidden;
1102 short ship;
1103
1104 nameHidden =
1105 *aMissionObjectivesArray[objective].displayName == '.' ||
1106 *aMissionObjectivesArray[objective].name == '.';
1107 if (nameHidden != 0 ||
1108 (mobile_objective(objective) != 0 &&
1110 (signed char)aMissionObjectivesArray[
1111 objective].index].state != 0))
1112 hidden = 1;
1113 else
1114 hidden = 0;
1115 if (hidden == 0 && mobile_objective(objective) != 0 &&
1117 cMissionObjectiveCountValue].type == 0) {
1118 ship = find_ship_index(
1119 (short)aMissionObjectivesArray[objective].index);
1120 if (aMissionShips[
1121 (signed char)aMissionObjectivesArray[
1122 objective].index].missionType ==
1124 ship != -1)
1125 hidden = 1;
1126 }
1127 return hidden;
1128}
1129
1130/* Function start: 0x4152C0 */
1131int set_new_objective(short pathIndex)
1132{
1133 if (pathIndex < 0) {
1134 pathIndex = -1;
1135 do {
1136 pathIndex++;
1137 } while (abFlightPathList[pathIndex] != -1 &&
1138 pathIndex < (short)cMissionObjectiveCountValue);
1139 pathIndex--;
1140 }
1141 if (pathIndex > (short)cMissionObjectiveCountValue)
1142 pathIndex = 0;
1143 if (abFlightPathList[pathIndex] == -1)
1144 pathIndex = 0;
1145 cCurrentNavPtIdx = (signed char)pathIndex;
1146 if (hidden_objective(
1147 (short)abFlightPathList[pathIndex]) != 0)
1148 return 0;
1153 (short)cCurrentObjective].type;
1155 return 1;
1156}
1157
1158/* Function start: 0x415370 */
1160{
1161 short wraps;
1162
1163 wraps = 0;
1164 do {
1166 (short)((short)cCurrentNavPtIdx + 1)) != 0)
1167 break;
1168 if (cCurrentNavPtIdx == 0)
1169 wraps++;
1170 } while (wraps < 3);
1171 if (wraps >= 3) {
1172 cCurrentNavPtIdx = 0;
1174 }
1175 return wraps < 3;
1176}
1177
1178/* Function start: 0x4153D0 */
1180{
1182 do {
1184 (short)cCurrentNavPtIdx) != 0 &&
1186 cCurrentNavPtIdx]) == 0)
1187 break;
1189 } while (cCurrentNavPtIdx <
1192 cCurrentNavPtIdx] != -1);
1193 if (cCurrentNavPtIdx >=
1196 cCurrentNavPtIdx] == -1) {
1199 }
1201}
1202
1203/* Function start: 0x415470 */
1204short LocateMobileObjective(short objective)
1205{
1206 short ship = -1;
1207
1208 if (mobile_objective(objective) != 0) {
1209 ship = locate_ship(
1210 aMissionObjectivesArray[objective].index,
1211 &aMissionObjectivesArray[objective].position);
1212 }
1213 return ship;
1214}
1215
1216/* Function start: 0x4154C0 */
1217unsigned int someone_coming(void)
1218{
1219 short ship = 0;
1220 signed char navPoint;
1221
1222 navPoint = cCurrentNavPtIdx;
1223 do {
1224 if (aeObjectClass[ship] >= OBJECT_CLASS_SHIP &&
1226 abShipNavPtIdx[ship] <= navPoint)
1227 return 1;
1228 ship = ship + 1;
1229 } while (ship < 10);
1230 return 0;
1231}
1232
1233/* Function start: 0x415510 */
1235{
1236 enum ShipMissionType missionType = aeShipMissionType[0];
1237 unsigned int (*checkArrivingShips)(void) = someone_coming;
1238
1239 if (missionType != MISSION_TYPE_ESCORT) {
1240 unsigned int arriving = checkArrivingShips();
1241
1242 if (arriving == 0)
1243 return 0;
1244 }
1245 return 1;
1246}
1247
1248/* Function start: 0x415530 */
1249void flag_reached(short objective, short reached)
1250{
1251 short carrierMissionShip;
1252 short carrierObject;
1253 short objectiveType;
1254 short advanceDestination;
1255 short markVisited;
1256
1257 objectiveType = (short)aMissionObjectivesArray[objective].type;
1258 carrierMissionShip = anShipMissionShips[0];
1259 carrierObject = find_ship_index(anShipMissionShips[0]);
1260 markVisited = objective != cCurrentObjective;
1261 advanceDestination = 0;
1262 if (objective == cCurrentObjective) {
1263 if (reached != 0 || escorting_a_ship() == 0 ||
1264 carrierObject == -1 ||
1265 aMissionObjectivesArray[objective].index ==
1266 anShipMissionShips[0]) {
1267 if (visited(objective) != 0)
1268 CockpitMessage("Already Visited", cYellowColour, 4);
1269 else
1270 CockpitMessage("Objective Reached", cYellowColour, 4);
1271 advanceDestination = markVisited = 1;
1272 } else {
1273 if (objectiveType != 1 ||
1274 aMissionShips[carrierMissionShip].state != 1) {
1276 "Wait for %s",
1278 aeObjectTypeList[carrierObject]].
1279 displayName);
1281 cYellowColour, 4);
1282 }
1283 }
1284 }
1285 if (objectiveType != 1 && markVisited != 0) {
1286 if (visited(objective) == 0 && carrierObject != -1 &&
1287 aMissionObjectivesArray[objective].index ==
1288 anShipMissionShips[0] &&
1289 aeObjectTypeList[carrierObject] !=
1291 send_message(carrierObject, 6);
1292 flag_objective(objective, 1);
1293 }
1294 if (advanceDestination != 0)
1296}
1297
1298/* Objective tracking, scanner, and target-lock callees from other modules. */
1299short FixedToShortSaturating(int value);
1300void transform_to_objects_frame(const FixedVector *source,
1301 FixedVector *destination,
1302 short obj);
1303void rectangular_to_spherical(const FixedVector *rectangular,
1304 SphericalVector *spherical);
1305void DrawViewportPixel(Viewport *viewport, short x, short y,
1306 short colour);
1307int GetViewportPixel(Viewport *viewport, short x, short y);
1308short RandomBelowOrEqual(short n);
1309
1310/* Function start: 0x4156D0 */
1311void check_sighting(short objective, short range, short object)
1312{
1313 if (sighted(objective) == 0 && range < 16000 &&
1314 (object == -1 ||
1315 asObjectScreenXList[object] != (short)0x8001))
1316 flag_objective(objective, 4);
1317}
1318
1319/* Function start: 0x415720 */
1320void check_visit(short objective, short range)
1321{
1322 int reachedRange;
1323
1324 if ((short)aMissionObjectivesArray[objective].type == 3 ||
1325 (short)aMissionObjectivesArray[objective].type == 4)
1326 reachedRange = 6000;
1327 else
1328 reachedRange = 1500;
1329 if (range < reachedRange)
1330 flag_reached(objective, 0);
1331}
1332
1333/* Function start: 0x415770 */
1334void update_objective_location(short objective)
1335{
1336 FixedVector delta;
1337 short range;
1338 short object;
1339
1340 object = LocateMobileObjective(objective);
1341 if (sighted(objective) != 0 && visited(objective) != 0 &&
1342 cCurrentObjective != objective)
1343 return;
1345 &aMissionObjectivesArray[objective].position,
1346 &delta);
1347 range = FixedToShortSaturating(
1348 Vector_magnitude(&delta));
1349 check_sighting(objective, range, object);
1350 if (mobile_objective(objective) != 0) {
1351 if (object != -1)
1352 check_visit(objective, range);
1353 } else if (aMissionNavPoints[
1354 aMissionObjectivesArray[objective].index].type >= 1) {
1355 check_visit(objective, range);
1356 }
1357}
1358
1359/* Function start: 0x415850 */
1360unsigned int objective_lost(short objective)
1361{
1362 unsigned short state;
1363
1364 state = aMissionShips[
1366 switch (aMissionObjectivesArray[objective].type) {
1367 case 2:
1368 case 3:
1369 return state >= 1;
1370 case 4:
1371 return state == 3;
1372 default:
1373 return 0;
1374 }
1375}
1376
1377/* Function start: 0x4158A0 */
1379{
1380 if (objective_lost((short)cCurrentObjective) != 0) {
1383 } else {
1385 }
1389}
1390
1391/* Function start: 0x4158F0 */
1392void rotational_pos_to_scanner_pos(signed char object,
1393 const SphericalVector *position)
1394{
1395 short horizontal;
1396
1397 horizontal = position->yaw;
1398 if (abs((int)horizontal) < 45)
1399 nScannerCursorX = (short)(
1401 cCurrentCockpitView].centerX + horizontal / 4);
1402 else
1403 nScannerCursorX = (short)(
1405 cCurrentCockpitView].centerX + horizontal / 6);
1406
1407 nScannerCursorY = (short)(
1409 cCurrentCockpitView].centerY + position->pitch / -3);
1426 asScannerObjectPositionX[object] =
1428 asScannerObjectY[object] =
1430}
1431
1432/* Function start: 0x415A30 */
1433short mobile_objective(short objective)
1434{
1435 short type = (short)aMissionObjectivesArray[objective].type;
1436
1437 if (type == 1 || type == 3 || type == 4 || type == 2)
1438 return 1;
1439 return 0;
1440}
1441
1442/* Function start: 0x415A70 */
1444{
1445 short i = 10;
1446
1447 do {
1449 i = i - 1;
1450 } while (i != 0);
1452}
1453
1454/* Function start: 0x415A90 */
1456{
1457 short object;
1458
1459 if (nScannerTargetObject != -1) {
1466 }
1467 if (asScannerObjectPositionX[10] != 0) {
1471 asScannerObjectY[10],
1472 pTgtLockShapePtr, 2);
1474 }
1475 object = 9;
1476 do {
1477 if (asScannerObjectPositionX[object] != 0) {
1480 asScannerObjectY[object],
1482 asScannerObjectPositionX[object] = 0;
1483 }
1484 object--;
1485 } while (object != 0);
1487}
1488
1489/* Function start: 0x415B70 */
1490unsigned int set_objective_range(short showOnScanner)
1491{
1492 FixedVector relative;
1493 FixedVector rotated;
1494 SphericalVector spherical;
1495
1499 (short)cCurrentObjective].position,
1500 &relative);
1501 transform_to_objects_frame(&relative, &rotated, 0);
1502 rectangular_to_spherical(&rotated, &spherical);
1503 if (showOnScanner != 0)
1504 rotational_pos_to_scanner_pos(10, &spherical);
1505 nCurObjectiveRangeValue = spherical.radius >> 8;
1506 return 0;
1507}
1508
1509/* Function start: 0x415C00 */
1510short get_color(short object, unsigned short *colour)
1511{
1512 enum ObjectClass objectClass;
1513
1514 objectClass = aeObjectClass[object];
1515 if (objectClass < OBJECT_CLASS_MISSILE)
1516 return 0;
1517 if (objectClass == OBJECT_CLASS_SHIP) {
1518 if (aeShipSide[object] == SIDE_KILRATHI)
1519 *colour = cRedColour;
1520 else if (aeShipSide[object] == SIDE_IMPERIAL)
1521 *colour = cBlueColour;
1522 else
1523 *colour = cPrimaryTextColour;
1524 return 1;
1525 }
1526 if (objectClass == OBJECT_CLASS_CAPITAL_SHIP) {
1527 if (aeShipSide[object] == SIDE_KILRATHI)
1528 *colour = cOrangeColour;
1529 else if (aeObjectTypeList[object] ==
1531 *colour = cViewportClearColour;
1532 else
1533 *colour = cDarkGreyColour;
1534 return 1;
1535 }
1536 if (acShipTargetTable[object] == 0) {
1537 *colour = cYellowColour;
1538 return 1;
1539 }
1540 return 0;
1541}
1542
1543/* Function start: 0x415CE0 */
1544unsigned int draw_3d_scanner(void)
1545{
1546 int row;
1547 SphericalVector spherical;
1548 unsigned short colour;
1549 short object;
1550 const int *grid;
1551 int gridValue;
1552
1553 if (bCockpitlessView != 0) {
1554 row = 0;
1555 if (aiScannerGridRows[0] != -2) {
1556 grid = aiScannerGridRows;
1557 do {
1558 gridValue = *grid;
1559 if (gridValue == -1) {
1560 row++;
1561 } else {
1563 (short)(stCockpitLayout.scanner[
1565 (short)(stCockpitLayout.scanner[
1566 cCurrentCockpitView].centerY + gridValue), 0xaa);
1567 if (gridValue != 0)
1569 (short)(stCockpitLayout.scanner[
1571 (short)(stCockpitLayout.scanner[
1572 cCurrentCockpitView].centerY - gridValue), 0xaa);
1573 if (row != 0) {
1575 (short)(stCockpitLayout.scanner[
1577 (short)(stCockpitLayout.scanner[
1578 cCurrentCockpitView].centerY + gridValue), 0xaa);
1579 if (gridValue != 0)
1581 (short)(stCockpitLayout.scanner[
1583 (short)(stCockpitLayout.scanner[
1584 cCurrentCockpitView].centerY - gridValue), 0xaa);
1585 }
1586 }
1587 grid++;
1588 } while (*grid != -2);
1589 }
1590 }
1591
1594 if (nScannerTargetObject != -1 &&
1598
1599 for (object = 1; object <= 9; object++) {
1600 if (get_color(object, &colour) != 0) {
1602 &spherical);
1603 if (spherical.radius < 0xea6000) {
1604 rotational_pos_to_scanner_pos((signed char)object,
1605 &spherical);
1607 (short)GetViewportPixel(
1610 if (nScannerTargetObject != object)
1614 colour);
1615 }
1616 }
1617 }
1618
1619 if (get_mode(1) == 5) {
1625 pTgtLockShapePtr, 2);
1629 pTgtLockShapePtr, 2);
1630 }
1631
1632 object = nScannerTargetObject;
1633 if (object != -1 && get_color(object, &colour) != 0) {
1637 (short)(nCurrentSpaceFrameValue % 2) != 0 ? (short)colour : cBlackColour);
1638 }
1639 return 0;
1640}
1641
1642/* Function start: 0x415FC0 */
1643void start_lock(unsigned short v)
1644{
1648 RandomBelowOrEqual(0x167);
1649}
1650
1651/* Function start: 0x415FF0 */
1652unsigned short starting_lock(unsigned short v)
1653{
1654 if (nTargetLockCountdown == -1) {
1655 start_lock(v);
1656 return 1;
1657 }
1658 return 0;
1659}
1660
1661/* Function start: 0x416010 */
1669
1670/* Function start: 0x416040 */
1672{
1673 short countdown;
1674
1675 if (malf(5) != 0) {
1676 countdown = -10;
1677 lock_off();
1678 countdown = (short)(countdown - RandomBelowOrEqual(30));
1679 nTargetLockCountdown = countdown;
1680 PlaySfxWaveFileByNumber(7, -1, 0);
1681 return 1;
1682 }
1683 return 0;
1684}
1685
1686/* Function start: 0x416090 */
1687short decrement_lock_time(short screenX)
1688{
1689 (void)screenX;
1690 if (nTargetLockCountdown > 0) {
1691 if (malf(5) == 0) {
1695 if (bTargetLockAcquired != 0) {
1696 if (CheckTargetLockMalfunction() == 0)
1697 PlaySfxWaveFileByNumber(0x16, -1, 0);
1699 cRedColour, 2);
1700 return 1;
1701 }
1702 PlaySfxWaveFileByNumber(0x15, -1, 0);
1703 }
1704 return 1;
1705 }
1706 return 0;
1707}
1708
1709/* Function start: 0x416120 */
1710void target_locking(signed char target)
1711{
1712 enum ObjectType weaponType;
1713 short x;
1714 short y;
1715 short countdown;
1716 int radiusSquared;
1717
1718 if (target != -1 &&
1719 aeShipSide[(short)target] != aeShipSide[0] &&
1721 x = asObjectScreenXList[(short)target];
1722 if (x == -0x7fff)
1723 return;
1724 y = asObjectScreenYArray[(short)target];
1725 countdown = nTargetLockCountdown;
1726 if (countdown < -1) {
1727 nTargetLockCountdown = ++countdown;
1728 return;
1729 }
1730 radiusSquared = y * y;
1731 radiusSquared += x * x;
1732 if (radiusSquared > 0xe10) {
1733 lock_off();
1734 return;
1735 }
1736 weaponType = ((ShipWeaponSlot *)&aShipWeaponsTable[0][1])[
1738 switch (weaponType) {
1739 default:
1740 lock_off();
1741 return;
1743 get_facing_range_from_object(0, (short)target);
1744 if (nTargetFacingValue > -0x41) {
1745 lock_off();
1746 return;
1747 }
1748 if (starting_lock(0x12) == 0)
1750 return;
1752 if (starting_lock(0x20) != 0)
1753 return;
1755 return;
1756 }
1757 }
1758 lock_off();
1759}
1760
1761/* Function start: 0x416220 */
1762void SetRectBounds(Viewport *viewport, unsigned short a, unsigned short b,
1763 unsigned short c, unsigned short d)
1764{
1765 viewport->left = (short)a;
1766 viewport->top = (short)b;
1767 viewport->right = (short)c;
1768 viewport->bottom = (short)d;
1769}
1770
1771/* Function start: 0x416250 */
1772short GetRectHeight(const Viewport *viewport)
1773{
1774 return viewport->right - viewport->left;
1775}
1776
1777/* Function start: 0x416260 */
1778void print_message_text(char *text, unsigned short colour)
1779{
1780 TextContext context;
1781 Viewport viewport;
1782 char wrapped[84];
1783 char source[84];
1784 short charactersPerLine;
1785 short lastSpace = -1;
1786 short position;
1787 int characterPosition;
1788 char *input;
1789 char *output;
1790
1791 if (text == 0)
1792 return;
1793
1794 DosStrcpy(source, text);
1795 wrapped[0] = *"";
1797 context = stHudMessageTextContext;
1798 context.viewport = &viewport;
1799
1800 SetRectBounds(&viewport,
1801 (unsigned short)asHudMessageOrigins[
1803 (unsigned short)asHudMessageOrigins[
1804 cCurrentCockpitView * 2 + 1],
1805 (unsigned short)(
1806 319 - asHudMessageOrigins[
1807 cCurrentCockpitView * 2]),
1808 (unsigned short)(
1810 cCurrentCockpitView * 2 + 1] + 60));
1811 context.backgroundColour = 0xff;
1812 context.colour = colour;
1813 charactersPerLine = GetRectHeight(&viewport) / 6;
1814 input = source;
1815 output = wrapped;
1816 for (position = 0; *input != 0; position++, input++, output++) {
1817 *output = *input;
1818 if (*output == ' ')
1819 lastSpace = position;
1820 characterPosition = position;
1821 if ((characterPosition + 1) % charactersPerLine == 0) {
1822 if (lastSpace == -1) {
1823 output[1] = '\n';
1824 output++;
1825 } else {
1826 characterPosition -= lastSpace;
1827 output[characterPosition] = '\n';
1828 }
1829 }
1830 }
1831 *output = 0;
1832
1833 if (bCockpitlessView != 0) {
1834 switch ((int)cCurrentCockpitView) {
1835 case 0:
1836 DrawTextAt(&context,
1838 (short)(asHudMessageOrigins[
1839 cCurrentCockpitView * 2 + 1] + 10),
1840 wrapped, 2);
1841 break;
1842 case 1:
1843 DrawTextAt(&context,
1845 (short)(asHudMessageOrigins[
1846 cCurrentCockpitView * 2 + 1] + 25),
1847 wrapped, 2);
1848 break;
1849 case 2:
1850 DrawTextAt(&context,
1852 (short)(asHudMessageOrigins[
1853 cCurrentCockpitView * 2 + 1] + 50),
1854 wrapped, 2);
1855 break;
1856 case 3:
1857 DrawTextAt(&context,
1860 wrapped, 2);
1861 break;
1862 default:
1863 break;
1864 }
1865 } else {
1866 DrawTextAt(&context,
1869 wrapped, 2);
1870 }
1872}
1873
1874/* Function start: 0x416460 */
1875void ShowHudTextLine(char *s, unsigned short b)
1876{
1878 print_message_text(s, b);
1879}
1880
1881/* Function start: 0x416480 */
1882void SetHudTextColour(short v)
1883{
1884 if (v != 0)
1885 EndCommMenu();
1887 (unsigned char)cPrimaryViewBufferColour);
1888}
1889
1890/* Function start: 0x4164B0 */
1891void draw_target_box(unsigned short colour, signed char object,
1892 short solid, short drawLockMarker, short padding,
1893 ShortRect *savedBounds)
1894{
1895 short centerX;
1896 short centerY;
1897 ShortRect bounds;
1898 int colourValue;
1899 short valid;
1900
1901 colourValue = (short)colour;
1902 if ((int)(unsigned char)cPrimaryViewBufferColour == colourValue) {
1903 valid = savedBounds->left != -0x7fff;
1904 bounds = *savedBounds;
1905 } else {
1906 valid = object != -1 &&
1907 asObjectScreenXList[object] != -0x7fff;
1908 if (valid != 0) {
1909 centerX = (short)(asObjectScreenXList[object] +
1911 centerY = (short)(asObjectScreenYArray[object] +
1913 if ((short)GetTransformedShapeBounds(
1914 &stSpaceBufferViewport, centerX, centerY,
1915 apObjShapeArray[object],
1916 asObjectViewFrames[object],
1917 asObjScreenAngles[object],
1918 asObjScreenScalesArray[object],
1919 asObjectFlipArray[object],
1920 &bounds) != 0) {
1921 bounds.left = (short)(bounds.left - padding);
1922 bounds.top = (short)(bounds.top - padding);
1923 bounds.right = (short)(bounds.right + padding);
1924 bounds.bottom = (short)(bounds.bottom + padding);
1925 } else {
1926 valid = 0;
1927 }
1928 }
1929 }
1930 if (valid != 0) {
1931 if ((int)(unsigned char)cRedColour == colourValue &&
1932 aeShipSide[object] == aeShipSide[0]) {
1933 colour = (unsigned char)cBlueColour;
1934 }
1935 if (solid != 0) {
1937 bounds.right, bounds.bottom, colour);
1938 } else {
1939 short segmentLength;
1940
1941 segmentLength =
1942 (short)(((int)bounds.right - bounds.left) / 6 + 1);
1944 (short)(bounds.left + segmentLength), bounds.top,
1945 colour);
1947 (short)(bounds.left + segmentLength), bounds.bottom,
1948 colour);
1950 (short)(bounds.right - segmentLength), bounds.top,
1951 colour);
1953 (short)(bounds.right - segmentLength), bounds.bottom,
1954 colour);
1955 segmentLength =
1956 (short)(((int)bounds.bottom - bounds.top) / 6 + 1);
1958 bounds.left, (short)(bounds.top + segmentLength),
1959 colour);
1961 bounds.left,
1962 (short)(bounds.bottom - segmentLength), colour);
1964 bounds.right, (short)(bounds.top + segmentLength),
1965 colour);
1967 bounds.right,
1968 (short)(bounds.bottom - segmentLength), colour);
1969 }
1970 if (drawLockMarker != 0) {
1971 if ((int)(short)colour != (int)(unsigned char)cPrimaryViewBufferColour) {
1972 if (nTargetLockCountdown > -1) {
1973 nTargetLockMarkerAngle = (short)(
1976 anObjPitchRot[0]);
1977 centerX = (short)(centerX +
1979 nTargetLockCountdown * 2) >> 8));
1980 centerY = (short)(centerY +
1982 nTargetLockCountdown * 2) >> 8));
1983 DrawSpriteDefault(&stSpaceBufferViewport, centerX, centerY,
1984 pTgtLockShapePtr, 1);
1985 nTargetLockMarkerX = centerX;
1986 nTargetLockMarkerY = centerY;
1987 }
1988 } else if (nTargetLockMarkerX != -0x7fff) {
1994 nTargetLockMarkerX = -0x7fff;
1995 }
1996 }
1997 if ((int)(unsigned char)cPrimaryViewBufferColour == (int)(short)colour) {
1998 savedBounds->left = -0x7fff;
1999 } else {
2000 *savedBounds = bounds;
2001 }
2002 } else {
2003 savedBounds->left = -0x7fff;
2004 }
2005}
2006
2007/* Function start: 0x4168A0 */
2009{
2010 if (nNavPointerObject != -1)
2012}
2013
2014/* Function start: 0x4168C0 */
2016{
2017 FixedVector objectivePosition;
2018 FixedVector direction;
2019 FixedVector viewPosition;
2020 int distance;
2021 short active;
2022 short object;
2023
2024 if (get_mode(1) == 5 &&
2025 nCannedSceneMode != 4 &&
2026 (nCameraViewMode == 0 || nCameraViewMode == 4))
2027 active = 1;
2028 else
2029 active = 0;
2030 if (active == 0) {
2032 return;
2033 }
2034 object = nNavPointerObject;
2035 if (object == -1) {
2036 object = find_vacant_3d_object();
2037 nNavPointerObject = object;
2038 if (object == -1)
2039 return;
2041 asObjectViewFrames[object] = 3;
2042 asObjScreenAngles[object] = 0;
2043 asObjScreenScalesArray[object] = 0x100;
2044 apObjShapeArray[object] =
2046 acObjOwnersTable[object] = -1;
2047 }
2048 nNavPointerObject = object;
2049 asObjectScreenXList[object] = (short)0x8001;
2050 asObjDistancesTable[object] = 0;
2051 objectivePosition = aMissionObjectivesArray[
2052 (signed char)cCurrentObjective].position;
2054 &objectivePosition, &direction);
2055 distance = Vector_magnitude(&direction);
2056 if (asObjectCollisionRadius[EYE_OBJECT] * 0x100 >=
2057 distance)
2058 return;
2059 transform_to_objects_frame(&direction, &viewPosition,
2060 EYE_OBJECT);
2061 if (asObjectCollisionRadius[EYE_OBJECT] * 0x100 >
2062 viewPosition.z)
2063 return;
2064 if (DivideFixed(viewPosition.z, distance) < 0x94)
2065 return;
2068 (short)(nScreenWidth & ~1) << 7,
2069 viewPosition.x),
2070 viewPosition.z) >> 8);
2073 (short)(nScreenWidth & ~1) << 7,
2074 viewPosition.y),
2075 viewPosition.z) >> 8);
2077}
2078
2079/* Function start: 0x416AC0 */
2080unsigned int overlay_head_up_display(void)
2081{
2083 if (message_showing() && nCommSpeakerObject != -1) {
2085 (signed char)nCommSpeakerObject;
2088 0, 0, 2,
2090 }
2091 if (nTargetLockCountdown == 0) {
2092 if ((short)(nRenderedSpaceFrame % 2) == 0)
2094 if (bTargetBracketVisible == 1) {
2098 1, 1,
2100 }
2101 } else {
2105 1, 1,
2107 }
2108
2109 if (bCockpitlessView != 0) {
2110 switch (cCurrentCockpitView) {
2111 case 0:
2112 case 2:
2116 pTgtLockShapePtr, 0);
2117 break;
2118 case 1:
2121 (short)(nCurrentViewCenterPosY - 1),
2122 pTgtLockShapePtr, 0);
2123 break;
2124 case 3:
2127 (short)(nCurrentViewCenterPosY + 14),
2128 pTgtLockShapePtr, 0);
2129 break;
2130 default:
2131 break;
2132 }
2133 } else {
2137 pTgtLockShapePtr, 0);
2138 }
2139 DAT_0046c05c = 0;
2140 if (pszPendingHudMessage != 0)
2142 if (bMouseCursorVisible == 1) {
2156 }
2157 return 0;
2158}
2159
2160/* Function start: 0x416C90 */
2168
2169/* Function start: 0x416CB0 */
2216
2217/* Function start: 0x416DE0 */
2218void SetHudMessageText(char *text, unsigned short colour,
2219 unsigned short duration)
2220{
2221 if (bInflightComputerActive == 0) {
2222 if (message_showing())
2224 pszPendingHudMessage = text;
2225 nPendingHudMessageColour = colour;
2226 set_message_time(duration);
2227 }
2228}
2229
2230/* Function start: 0x416E20 */
2231void malf_noise(short vdu, int effect, unsigned short colour,
2232 short sound, short refresh)
2233{
2234 Viewport *viewport = vdu == 0 ? &stLeftVdu : &stRightVduViewport;
2235
2236 if (sound != -1) {
2237 if (sound == 0x17)
2239 else
2240 PlaySfxWaveFileByNumber(sound, -1, 0);
2241 }
2242 snow_viewport(viewport, effect, colour);
2243 if (refresh != 0)
2244 set_new_vdu(vdu);
2245}
2246
2247/* Function start: 0x416E90 */
2248void build_your_target_list(short *hasEnemy)
2249{
2250 short distance;
2251 enum Side playerSide;
2252 signed char object;
2253 signed char targetIndex;
2254
2255 *hasEnemy = 0;
2257 object = 1;
2258 do {
2259 if (aeObjectClass[object] >= OBJECT_CLASS_SHIP &&
2260 aeSpecialManeuvers[object] !=
2262 asObjectScreenXList[object] != (short)0x8001 &&
2263 (unsigned short)(distance = asObjDistancesTable[object]) <
2264 12000) {
2265 targetIndex = cViableTargetCount;
2266 asViableTgtDistList[targetIndex] = distance;
2267 acViableTargetList[targetIndex] = object;
2269 playerSide = aeShipSide[0];
2270 if (aeShipSide[object] != playerSide)
2271 *hasEnemy = 1;
2272 }
2273 object++;
2274 } while (object <= 9);
2275 if (cViableTargetCount > 1)
2277}
2278
2279/* Function start: 0x416F30 */
2281{
2282 unsigned char index;
2283 short previousTarget;
2284 signed char count;
2285 short hasEnemy;
2286
2287 previousTarget = acShipTargetTable[0];
2288 build_your_target_list(&hasEnemy);
2289 count = cViableTargetCount;
2290 if (count == 0) {
2291 acShipTargetTable[0] = -1;
2292 } else {
2293 for (index = 0;
2294 (signed char)index < count &&
2295 acViableTargetList[(signed char)index] !=
2297 index++)
2298 ;
2299 do {
2300 index = ((signed char)index + 1) % count;
2302 acViableTargetList[(signed char)index];
2303 if (hasEnemy == 0)
2304 break;
2305 } while (aeShipSide[
2306 acShipTargetTable[0]] ==
2307 aeShipSide[0]);
2308 }
2309 if (acShipTargetTable[0] != previousTarget)
2311}
2312
2313/* Function start: 0x416FD0 */
2315{
2316 short selectNewTarget;
2317 short oldTarget;
2318 short targetIndex;
2319 short hasEnemy;
2320 unsigned char count;
2321
2322 selectNewTarget = 1;
2323 oldTarget = acShipTargetTable[0];
2324 if (oldTarget != -1 &&
2325 aeSpecialManeuvers[oldTarget] ==
2327 acShipTargetTable[0] = -1;
2328 oldTarget = -1;
2329 }
2330 if (nTargetLockMode != 0 &&
2331 (short)(nRenderedSpaceFrame % 8) == 0 &&
2332 malf(5) != 0) {
2333 nTargetLockMode = 0;
2334 malf_sound();
2335 }
2336 if (oldTarget != -1 &&
2337 (nTargetLockMode != 0 ||
2338 asObjectScreenXList[oldTarget] != (short)0x8001) &&
2339 (nTargetLockMode != 0 ||
2340 aeShipSide[oldTarget] != aeShipSide[0]))
2341 return;
2342 if (oldTarget == -1)
2343 nTargetLockMode = 0;
2344
2345 build_your_target_list(&hasEnemy);
2346 count = cViableTargetCount;
2347 if (count == 0) {
2348 if (nTargetLockMode != 0)
2349 acShipTargetTable[0] = oldTarget;
2350 else
2351 acShipTargetTable[0] = -1;
2352 } else {
2353 if (hasEnemy == 0 && oldTarget != -1 &&
2354 aeShipSide[oldTarget] ==
2355 aeShipSide[0] &&
2356 (nTargetLockMode != 0 ||
2357 asObjectScreenXList[oldTarget] != (short)0x8001)) {
2358 selectNewTarget = 0;
2359 acShipTargetTable[0] = oldTarget;
2360 }
2361 if (selectNewTarget != 0) {
2362 for (targetIndex = 0;
2363 targetIndex < (signed char)count &&
2364 aeShipSide[
2365 (short)acViableTargetList[targetIndex]] ==
2366 aeShipSide[0];
2367 targetIndex++)
2368 ;
2371 targetIndex % (signed char)count];
2372 }
2373 }
2374 if (acShipTargetTable[0] != oldTarget) {
2375 if (oldTarget != -1 && acShipTargetTable[0] == -1)
2376 nTargetLockMode = 0;
2378 }
2379}
2380
2381/* Function start: 0x417190 */
2383{
2384 if (missile_on_tail(0) != 0) {
2386 if (nTrainSimActive == 0)
2387 spacetrack(3, 1, -1);
2388 } else {
2390 }
2391}
2392
2393/* Function start: 0x4171D0 */
2395{
2396 short yaw;
2397 short pitch;
2398
2399 yaw = stRotationInput.y / 2;
2400 pitch = stRotationInput.x / 2;
2401 if (yaw > 0) {
2403 (signed char)MinShort((short)(yaw + 8), 12);
2404 return;
2405 }
2406 if (yaw < 0) {
2408 (signed char)MinShort((short)(4 - yaw), 8);
2409 return;
2410 }
2411 if (pitch > 0) {
2413 (signed char)MinShort((short)(pitch + 12), 16);
2414 return;
2415 }
2416 if (pitch < 0) {
2418 (signed char)MinShort((short)-pitch, 4);
2419 return;
2420 }
2422}
2423
2424/* Function start: 0x417260 */
2446
2447/* Function start: 0x417320 */
2466
2467/* Function start: 0x4173C0 */
2469{
2470 if (pCurrentPilotHandShapePtr != 0) {
2475 }
2476}
2477
2478/* Function start: 0x4173F0 */
2487
2488/* Function start: 0x417420 */
2489void send_message(short obj, short message)
2490{
2491 if (nTrainSimActive == 0 &&
2493 nCannedSceneMode == 0) {
2494 if (nYourWingman != -1 &&
2495 nYourWingman == obj &&
2496 bRadioSilence != 0) {
2498 return;
2499 }
2500 if (obj > -1 && obj < 10 &&
2502 if (acShipRating[obj] != -1) {
2503 acWingmanMessageStatesArray[obj] = message;
2504 return;
2505 }
2506 if (aeObjectTypeList[obj] ==
2508 nShipMissionIndices[obj] ==
2509 anShipMissionShips[0]) {
2510 acWingmanMessageStatesArray[obj] = message;
2511 } else if (aeShipSide[obj] == SIDE_KILRATHI) {
2512 acWingmanMessageStatesArray[obj] = message;
2513 return;
2514 }
2515 }
2516 }
2517}
2518
2519/* Function start: 0x4174F0 */
2521{
2522 signed char obj;
2523
2524 if (nCannedSceneMode == 0 &&
2525 nTrainSimActive == 0) {
2526 for (obj = 1; message_showing() == 0 && obj <= 9; obj++) {
2527 if (aeObjectClass[(short)obj] >=
2529 acWingmanMessageStatesArray[(short)obj] != -1) {
2530 vid_equiv((short)obj,
2531 (short)acWingmanMessageStatesArray[(short)obj]);
2532 acWingmanMessageStatesArray[(short)obj] = -1;
2533 }
2534 }
2535 if (RandomBelowOrEqual(5000) > 4998) {
2536 for (obj = 1; nCommSpeakerObject == -1 && obj <= 9; obj++) {
2537 if (aeObjectClass[(short)obj] >=
2539 aeShipSide[(short)obj] == SIDE_KILRATHI &&
2540 (aeShipObjectiveList[(short)obj] ==
2542 aeShipObjectiveList[(short)obj] ==
2544 (acShipRating[(short)obj] != -1 ||
2545 RandomBelowOrEqual(100) < 20)) {
2546 acWingmanMessageStatesArray[(short)obj] =
2547 (signed char)(RandomBelowOrEqual(2) + 2);
2548 return;
2549 }
2550 }
2551 }
2552 }
2553}
2554
2555/* Function start: 0x417610 */
2557{
2558 memset(anCockpitDamageState, 0,
2559 sizeof(anCockpitDamageState));
2560}
2561
2562/* Function start: 0x417630 */
2564{
2565 short damage;
2566
2567 if (pCockpitPilotShape == 0)
2570 (short)cCockpitLogicalFile, 4, 0);
2571 for (damage = 0; damage < 4; damage++) {
2572 if (anCockpitDamageState[damage] == 1) {
2574 &stScreenView,
2576 cCurrentCockpitView][damage].x,
2578 cCurrentCockpitView][damage].y,
2579 pCockpitPilotShape, damage);
2580 }
2581 }
2583}
2584
2585/* Function start: 0x4176C0 */
2609
2610/* Function start: 0x417760 */
2624
2625/* Function start: 0x4177B0 */
2658
2659/* Function start: 0x4178A0 */
2660void place_damage_on_cockpit(short damage)
2661{
2662 unsigned int *state;
2663
2664 if (nCameraViewMode == 0 && nTrainSimActive == 0 &&
2665 *(state = &anCockpitDamageState[damage]) == 0) {
2666 if (pCockpitExplosionShape == 0) {
2668 *state = 1;
2670 return;
2671 }
2673 *state = 1;
2674 if (IsCockpitExplosionActive() == 0) {
2677 (signed char)cCurrentCockpitView][damage];
2678 nCockpitExplosionFrame = 0x7fff;
2679 }
2680 }
2681}
2682
2683/* Function start: 0x417910 */
2685{
2686 short randomFrame;
2687 short speaker;
2688
2689 speaker = nCommSpeakerObject;
2690 if (aeShipSide[speaker] == SIDE_NEUTRAL) {
2692 return;
2693 }
2694 /* The original repeats the cockpitless check after frame parity. */
2695 if ((bCockpitlessView != 0 ||
2696 nRenderedSpaceFrame % 2 != 0 ||
2697 bCockpitlessView != 0) &&
2698 nCommPortraitIndex != -1 &&
2701 if (aeSpecialManeuvers[speaker] ==
2703 if (aeShipSide[speaker] == SIDE_IMPERIAL) {
2708 (short)(asObjectCounterArray[speaker] / 5));
2709 return;
2710 }
2713 pCommStaticShape, 2);
2714 return;
2715 }
2716 if (nCommPortraitFrame == -1) {
2718 (unsigned short)RandomInRange(0, 2);
2719 }
2720 randomFrame = RandomInRange(0, 3);
2721 if (randomFrame < 3)
2722 nCommPortraitFrame = randomFrame;
2723 set_new_vdu(1);
2728 } else {
2732 }
2736 (short)nCommPortraitFrame);
2737 }
2738}
2739
2740/* Function start: 0x417AC0 */
2741void vid_equiv(short obj, short message)
2742{
2743 if (get_mode(1) != 4 &&
2744 nTrainSimActive == 0 &&
2745 nCannedSceneMode == 0 && nCameraViewMode == 0 &&
2746 message_showing() == 0)
2747 real_vid_transmit(obj, message);
2748}
2749
2750/* Function start: 0x417B10 */
2751void update_dead_disp(short a)
2752{
2753 malf_noise(a, 1, cDarkGreenColour, 0x17, 0);
2754}
2755
2756/* Function start: 0x417B30 */
2758{
2759 if (nTrainSimActive == 0 &&
2761 nCarrierMissionShipIndexValue].state == 3 &&
2762 any_enemy(0, 30000) == 0)
2763 nArcadeState = 3;
2764}
2765
2766/* Function start: 0x417B70 */
2767void update_VDUs(void)
2768{
2769 short changed;
2770
2772 if (bCockpitlessView != 0) {
2774 &stScreenView,
2783 0);
2785 &stScreenView,
2794 0);
2795 }
2796 changed = update_vid_disp(0);
2797 if (changed != 0) {
2798 switch (get_mode(0)) {
2799 case 0:
2801 break;
2802 case 1:
2804 break;
2805 case 2:
2807 break;
2808 case 8:
2810 break;
2811 }
2812 } else {
2813 switch (get_mode(0)) {
2814 case 0:
2816 break;
2817 case 1:
2818 if (bCockpitlessView != 0)
2821 break;
2822 case 2:
2823 if (bCockpitlessView != 0) {
2827 }
2829 break;
2830 case 8:
2832 break;
2833 }
2834 }
2835 if (get_mode(0) == 0)
2837 else
2839
2841 changed = update_vid_disp(1);
2842 if (changed != 0) {
2843 switch (get_mode(1)) {
2844 case 0:
2846 break;
2847 case 3:
2849 break;
2850 case 4:
2852 break;
2853 case 5:
2855 break;
2856 case 6:
2857 vid_transmit();
2858 break;
2859 }
2860 } else {
2861 switch (get_mode(1)) {
2862 case 0:
2864 break;
2865 case 3:
2866 if (bCockpitlessView != 0)
2869 break;
2870 case 4:
2871 if (bCockpitlessView != 0)
2873 talk_equiv();
2874 break;
2875 case 5:
2876 if (bCockpitlessView != 0)
2879 break;
2880 case 6:
2881 vid_transmit();
2882 break;
2883 }
2884 }
2885 if (get_mode(1) == 6 || get_mode(1) == 0)
2887 else
2889 if (nTrainSimActive != 0 &&
2892}
2893
2894/* Function start: 0x417E70 */
2922
2923/* Function start: 0x417F00 */
2924void PlayCockpitSelectionSfx(short selectionSound)
2925{
2926 (void)selectionSound;
2927 PlaySfxWaveFileByNumber(0x19, -1, 0);
2928}
2929
2930/* Function start: 0x417F10 */
2931void vdu_pop_all(short vdu)
2932{
2933 int mode;
2934
2935 while ((short)GetVduModeStackDepth(vdu) > 0) {
2936 mode = get_mode(vdu);
2937 if (mode != 6)
2938 pop_mode(vdu);
2939 else
2940 EndCommMenu();
2941 }
2942}
2943
2944/* Function start: 0x417F60 */
2945void SelectCockpitVduMode(short vdu, int mode)
2946{
2947 short changed;
2948
2949 if (nCameraViewMode != 0)
2950 return;
2951 if (malf(3) != 0 ||
2952 (mode == 4 && malf(4) != 0)) {
2953 vdu_malf(vdu, 0x17);
2954 return;
2955 }
2957 changed = get_mode(vdu) != mode;
2958 if (changed != 0) {
2959 vdu_pop_all(vdu);
2960 InvalidateVduMode(vdu);
2961 if (mode != 4) {
2962 set_mode(vdu, mode);
2963 update_VDUs();
2964 return;
2965 }
2967 update_VDUs();
2968 return;
2969 }
2970 switch (mode) {
2971 case 1:
2972 if (bCurrentKey == 0x22)
2974 else
2976 break;
2977 case 2:
2979 break;
2980 case 3:
2982 break;
2983 case 4:
2984 talk_equiv();
2985 break;
2986 case 5:
2988 break;
2989 }
2990}
static ShortPoint aaCockpitDamagePositions[5][4]
Definition cockpt.c:74
static signed char cReleaseWeaponDisplayState
Definition cockpt.c:32
static char szNoWeaponName[5]
Definition cockpt.c:33
static Viewport stTrainSimVduSource
Definition cockpt.c:72
static const char * pszMissileLockedMessage
Definition cockpt.c:62
static signed char cReleaseWeaponDisplayFrame
Definition cockpt.c:30
static short asHudMessageOrigins[10]
Definition cockpt.c:65
static int nDisplayedObjectiveRange
Definition cockpt.c:34
static int DAT_00469010[2]
Definition cockpt.c:18
static signed char cReleaseWeaponDisplayTicks
Definition cockpt.c:31
static int nCommPortraitFrame
Definition cockpt.c:84
static short nTargetLockMarkerX
Definition cockpt.c:68
static unsigned char bTargetBracketVisible
Definition cockpt.c:63
static short asPilotHandOffsets[34]
Definition cockpt.c:20
static short nScannerTargetObject
Definition cockpt.c:37
static int aiScannerGridRows[79]
Definition cockpt.c:39
static char * pszObjectiveStatusMessage
Definition cockpt.c:36
static unsigned char abMouseCursorBackground[0x400]
Definition cockpt.c:88
static int bForceDamageDisplayRedraw
Definition cockpt.c:85
static char *volatile pszDisplayedHudMessage
Definition cockpt.c:15
static ShortRect stPreviousTargetBracketBounds
Definition cockpt.c:70
static volatile signed char cRenderedPilotHandFrame
Definition cockpt.c:16
void ClearGlobalMessage(void)
Definition cockpt.c:489
static short asVduSelectionSound[2]
Definition cockpt.c:13
static ShortRect stTargetBracketBounds
Definition cockpt.c:69
void(__cdecl *pIxFree)(void *)
struct Shape * pCockpitExplosionShape
Definition cockpt.c:27
unsigned char cYellowColour
Definition init.c:15
Viewport stPilotHandBackdropView
Definition timer.c:15
short nNavPointerObject
Definition cockpt.c:71
signed char acShipRating[16]
Definition joycal.c:25
enum ObjectType eReleaseWpnDisplayType
Definition cockpt.c:90
short asViableTgtDistList[16]
Definition game.c:555
short asObjScreenScalesArray[SPACE_OBJECT_COUNT]
Definition dib.c:105
short anShipMissionShips[16]
Definition comm.c:57
unsigned char cRedColour
Definition init.c:16
TextContext stRightVduTxtContext
Definition targ.c:12
int nCameraViewMode
Definition game.c:49
signed char acViableTargetList[16]
Definition dib.c:102
enum Side aeShipSide[12]
Definition ending.c:22
unsigned short nPendingHudMessageColour
Definition spc.c:26
Viewport stPilotHandComposite
Definition select.c:16
struct Shape * pConfedCommBackground
Definition cockpt.c:81
struct Shape * pCockpitDamageShape
Definition select.c:19
Viewport stRightVduViewport
Definition timer.c:14
short nRenderedSpaceFrame
Definition input.c:22
signed char aShipWeaponsTable[10][0x47]
Definition dib.c:108
short nCommSpeakerObject
Definition comm.c:42
Viewport stPilotHandView
Definition launch.c:47
signed char acPlayerComponentDamageList[9]
Definition smart.c:19
short nScannerCursorX
Definition cockpt.c:103
short nCommPortraitIndex
Definition comm.c:44
short asObjScreenAngles[SPACE_OBJECT_COUNT]
Definition joycal.c:26
short nTargetLockMarkerAngle
Definition game.c:82
unsigned char * pRadarMarkerBackground
Definition cockpt.c:91
ObjectTypeData aObjectTypeData[OBJECT_TYPE_COUNT]
Definition objdata.c:86
short nCockpitExplosionFrame
Definition cockpt.c:28
signed char abShipNavPtIdx[16]
Definition screen.c:14
signed char acVduModeStackDepth[16]
Definition music.c:87
short nScannerCursorY
Definition cockpt.c:104
unsigned char cBlackColour
Definition init.c:12
ShortVector stRotationInput
Definition comm.c:50
short anObjectRollRotationList[SPACE_OBJECT_COUNT]
Definition screen.c:16
signed char cViableTargetCount
Definition game.c:107
short anObjPitchRot[SPACE_OBJECT_COUNT]
Definition data.c:247
unsigned int anVduModeCache[2]
Definition joycal.c:28
char szTxtWorkspaceBuffer[256]
Definition screens.c:164
signed char cMissionObjectiveCountValue
Definition game.c:554
unsigned short ausVduModeStack[16]
Definition input.c:15
signed char acWingmanMessageStatesArray[16]
Definition video.c:25
short asScannerBackgroundColour[10]
Definition spc.c:24
TextContext * pCurTextContext
Definition data.c:244
char szComponentHitMessage[40]
Definition cockpt.c:99
unsigned char cBlueColour
Definition init.c:14
int bTargetLockAcquired
Definition game.c:92
short DAT_0046c05c
Definition game.c:73
int anShipFuelsTable[12]
Definition data.c:252
unsigned char cViewportClearColour
Definition init.c:13
short aasCockpitLightX[5][7]
Definition data.c:103
FixedVector aObjectViewPositionsList[SPACE_OBJECT_COUNT]
Definition data.c:246
int bInflightComputerActive
Definition nav.c:51
signed char abFlightPathList[MISSION_OBJECTIVE_COUNT]
Definition smart.c:20
struct Shape * pCockpitWeaponShapePtr
Definition timer.c:16
short asPilotHandOrigins[10]
Definition data.c:229
signed char aacCockpitLightOffFrame[5][7]
Definition data.c:121
short nTargetLockMarkerY
Definition cockpt.c:100
volatile int bMouseCursorVisible
Definition main.c:43
int bCockpitlessView
Definition main.c:39
unsigned char * pReleaseWeaponDisplayBackground
Definition cockpt.c:29
unsigned char cDarkGreenColour
Definition init.c:17
short asShipWpnEnergyList[10]
Definition comm.c:54
short nTargetLockCountdown
Definition game.c:79
char * pszPendingHudMessage
Definition cockpt.c:14
unsigned char bVideoImagesSuppressed
Definition comm.c:15
HazardField * pActiveHazardField
Definition smart.c:18
enum ShipMissionType aeShipMissionType[12]
Definition game.c:550
TextContext stCurrentCockpitReadoutTextCtx
Definition targ.c:13
ShortPoint stCockpitExplosionPosition
Definition spc.c:20
enum ShipObjective aeShipObjectiveList[12]
Definition video.c:22
ShortPoint aWeaponDisplayOrigins[5]
Definition objdata.c:593
MissionNavPoint aMissionNavPoints[MISSION_NAV_POINT_COUNT]
Definition game.c:199
enum ObjectClass aeObjectClass[SPACE_OBJECT_COUNT]
Definition video.c:21
short nYourWingman
Definition game.c:61
short aasShipArmor[10][4]
Definition comm.c:53
unsigned int anCockpitDamageState[4]
Definition spc.c:25
const char * apszComponentNames[9]
Definition damage.c:18
MouseCursorState stMouseCursorState
Definition strdos.c:19
short asObjectScreenYArray[SPACE_OBJECT_COUNT]
Definition screen.c:20
short asScannerObjectY[11]
Definition spc.c:19
signed char bStickIndicatorFrameState
Definition cockpt.c:92
ShortPoint stReleaseWeaponDisplayPosition
Definition version.c:14
struct Shape * pTgtLockShapePtr
Definition pload.c:12
FixedVector aShipVelocity[SPACE_OBJECT_COUNT]
Definition smart.c:21
Viewport stLeftVdu
Definition launch.c:48
short asObjectCollisionRadius[64]
Definition ending.c:27
short aasShipShield[10][2]
Definition input.c:19
signed char cCurrentCockpitView
Definition screen.c:23
unsigned char cPrimaryViewBufferColour
Definition init.c:27
int nArcadeState
Definition main.c:22
signed char cCockpitLogicalFile
Definition logic.c:107
short nCarrierMissionShipIndexValue
Definition cockpt.c:101
short nCurrentViewCenterPosX
Definition eventmgr.c:25
int anShipSpeed[64]
Definition data.c:248
unsigned char cOrangeColour
Definition init.c:19
short nScreenWidth
Definition data.c:34
Viewport stScreenView
Definition launch.c:50
struct Shape * pCommStaticShape
Definition cockpt.c:82
unsigned short asObjDistancesTable[SPACE_OBJECT_COUNT]
Definition data.c:253
int nCurObjectiveRangeValue
Definition video.c:24
short nCurrentNoticeTimer
Definition cockpt.c:93
Viewport stSpaceBufferViewport
Definition timer.c:13
short asScannerObjectPositionX[11]
Definition spc.c:21
int nTickCount60Hz
Definition mathfp.c:23
enum ObjectType eSelectedGunType
Definition game.c:67
TextContext stLeftVduTextContext
Definition timer.c:12
short nTargetFacingValue
Definition input.c:17
unsigned char cPrimaryTextColour
Definition init.c:18
CockpitReadout aCockpitReadouts[6]
Definition cockpt.c:102
short asObjectCounterArray[SPACE_OBJECT_COUNT]
Definition game.c:547
int nCannedSceneMode
Definition main.c:21
short bTargetLockReadoutDirty
Definition game.c:76
signed char cCurrentObjective
Definition game.c:37
short nPendingCockpitDamageValue
Definition cockpt.c:94
struct Shape * pCurrentPilotHandShapePtr
Definition select.c:15
ShortPoint aWeaponDisplayPositions[32]
Definition objdata.c:582
short asObjectScreenXList[SPACE_OBJECT_COUNT]
Definition screen.c:21
signed char acObjOwnersTable[64]
Definition joycal.c:29
short nCurrentSpaceFrameValue
Definition data.c:249
unsigned char abCockpitLightGoalArray[7]
Definition spc.c:22
MissionObjective aMissionObjectivesArray[MISSION_OBJECTIVE_COUNT]
Definition screen.c:24
TextContext stHudMessageTextContext
Definition launch.c:51
int nTrainSimActive
Definition trainsim.c:31
signed char aacCockpitLightOnFrame[5][7]
Definition data.c:130
struct Shape * apObjShapeArray[SPACE_OBJECT_COUNT]
Definition comm.c:48
struct Shape * pKilrathiCommBackground
Definition cockpt.c:83
CockpitBarDefinition aaCockpitBars[5][8]
Definition data.c:139
int nSelectedReleaseWeaponIndex
Definition game.c:70
HudMessageSlot aCockpitHudMessageSlotsTable[2]
Definition cockpt.c:95
enum ObjectType aeObjectTypeList[SPACE_OBJECT_COUNT]
Definition data.c:255
int nSavedMouseCursorY
Definition cockpt.c:97
short asObjectViewFrames[SPACE_OBJECT_COUNT]
Definition video.c:23
signed char cLastTargetObject
Definition cockpt.c:96
CockpitLayout stCockpitLayout
Definition data.c:193
unsigned char abCockpitIndicatorStatesArray[7]
Definition cockpt.c:105
struct Shape * pCockpitPilotShape
Definition cockpt.c:25
short asObjectFlipArray[SPACE_OBJECT_COUNT]
Definition dib.c:97
MissionShipRecord aMissionShips[MISSION_SHIP_STORAGE_COUNT]
Definition game.c:230
Viewport stCockpitBar
Definition launch.c:52
unsigned char bRadioSilence
Definition comm.c:14
short nShipMissionIndices[10]
Definition game.c:559
FixedVector aShipPositionsArray[SPACE_OBJECT_COUNT]
Definition game.c:556
short aasCockpitLightY[5][7]
Definition data.c:112
signed char bCurrentKey
Definition game.c:28
int nCurrentDamageAlarmSfxHandle
Definition spc.c:23
signed char acShipTargetTable[16]
Definition joycal.c:30
short nCurrentViewCenterPosY
Definition eventmgr.c:26
signed char cCurrentNavPtIdx
Definition dib.c:96
ShortPoint stWpnDispOrigin
Definition targ.c:18
struct Shape * apCommunicationPortraitShapesTable[16]
Definition music.c:96
int nStoredMouseCursorPosX
Definition cockpt.c:98
short nCurrentDmgDispTicks
Definition targ.c:17
unsigned char * pCockpitExplosionBackground
Definition cockpt.c:26
char * aapszPilotSpeeches[14][11]
Definition music.c:98
unsigned char cDarkGreyColour
Definition init.c:21
short nTargetLockMode
Definition game.c:95
enum SpecialManeuver aeSpecialManeuvers[12]
Definition game.c:549
ShortRect rightVduBounds[5]
Definition wcdata.h:462
CockpitScannerGeometry scanner[5]
Definition wcdata.h:463
ShortRect leftVduBounds[5]
Definition wcdata.h:461
short previousRight
Definition wc1base.h:254
TextContext * context
Definition wc1base.h:251
TextContext * context
Definition wc1base.h:273
signed char flashCount
Definition wc1base.h:278
short drawColour
Definition wc1base.h:277
const char * text
Definition wc1base.h:279
const char * displayName
Definition wcdata.h:929
unsigned char flags
Definition wcdata.h:928
signed char index
Definition wcdata.h:927
signed char state
Definition wcdata.h:896
Viewport * viewport
Definition wc1base.h:110
struct Shape * shape
Definition wc1base.h:107
unsigned short frame
Definition wc1base.h:108
short armorRight
Definition wcdata.h:392
short shieldFore
Definition wcdata.h:387
short armorRear
Definition wcdata.h:390
short shieldAft
Definition wcdata.h:388
short armorLeft
Definition wcdata.h:391
short armorFront
Definition wcdata.h:389
const char * displayName
Definition wcdata.h:369
short hardpoint
Definition wcdata.h:409
enum ObjectType type
Definition wcdata.h:408
signed char disabled
Definition wcdata.h:410
short y
Definition wcdata.h:416
short x
Definition wcdata.h:415
short top
Definition wcdata.h:441
short left
Definition wcdata.h:440
short right
Definition wcdata.h:442
short bottom
Definition wcdata.h:443
short x
Definition wcdata.h:433
short y
Definition wcdata.h:434
unsigned char colour
Definition wc1base.h:240
short cursorY
Definition wc1base.h:238
unsigned char * font
Definition wc1base.h:239
char * text
Definition wc1base.h:242
unsigned char backgroundColour
Definition wc1base.h:241
char * textCursor
Definition wc1base.h:243
short cursorX
Definition wc1base.h:237
Viewport * viewport
Definition wc1base.h:236
unsigned char alignment
Definition wc1base.h:244
unsigned char * pixels
Definition wc1base.h:74
short right
Definition wc1base.h:78
short bottom
Definition wc1base.h:79
short left
Definition wc1base.h:76
short top
Definition wc1base.h:77
Umbrella header for the game core.
void __stdcall DrawTextCharacter(char character)
Definition mathfp.c:313
void vid_equiv(short obj, short message)
Definition cockpt.c:2741
void transform_to_objects_frame(const FixedVector *source, FixedVector *destination, short obj)
Definition geom.c:610
unsigned int objective_lost(short objective)
Definition cockpt.c:1360
void show_communications_disp(void)
Definition comm.c:341
short get_mode(short i)
Definition cockpt.c:690
void FormatTextBufferFromStart(const char *format,...)
Definition cockpt.c:211
void update_bars(void)
Definition cockpt.c:654
short kilrathi_near(short obj, short range)
Definition cockpt.c:501
void DrawViewportLine(Viewport *viewport, short x1, short y1, short x2, short y2, short colour)
Definition gr.c:995
void SetRectBounds(Viewport *viewport, unsigned short left, unsigned short top, unsigned short right, unsigned short bottom)
Definition cockpt.c:1762
void * reset_cockpit(void)
Definition cockpt.c:540
short GetTransformedShapeBounds(Viewport *viewport, short x, short y, struct Shape *shape, short frame, short angle, short scale, short flip, ShortRect *bounds)
Definition gr.c:1196
unsigned int set_objective_range(short showOnScanner)
Definition cockpt.c:1490
void DIBslam(void)
Definition dib.c:513
void DrawCockpitReadout(signed char slot, const char *text)
Definition cockpt.c:352
int locate_ship(short missionShip, FixedVector *point)
Definition logic.c:1200
unsigned int DrawPendingCockpitDamage(void)
Definition cockpt.c:2586
long MultiplyFixed(int left, int right)
Definition mathfp.c:67
short DrawHudMessageSlot(HudMessageSlot *slot)
Definition cockpt.c:383
void cockpit_explosion(void)
Definition cockpt.c:2626
void snow_viewport(Viewport *viewport, int effect, unsigned short colour)
Definition gr.c:1331
void set_next_destination(void)
Definition cockpt.c:1179
void place_damage_on_cockpit(short damage)
Definition cockpt.c:2660
short distance_from_point(short obj, const FixedVector *point)
Definition geom.c:655
void check_message(void)
Definition cockpt.c:789
void start_lock(unsigned short v)
Definition cockpt.c:1643
short LocateMobileObjective(short objective)
Definition cockpt.c:1204
unsigned short set_message_time(unsigned short v)
Definition cockpt.c:782
void show_target_disp(void)
Definition view.c:573
void remove_object(short obj)
Definition geom.c:1002
void UpdateDamageDisplay(void)
Definition damage.c:104
void build_your_target_list(short *hasEnemy)
Definition cockpt.c:2248
int missile_on_tail(short obj)
Definition logic.c:562
void malf_noise(short vdu, int effect, unsigned short colour, short sound, short refresh)
Definition cockpt.c:2231
short GetRectHeight(const Viewport *viewport)
Definition cockpt.c:1772
long Vector_magnitude(const FixedVector *vector)
Definition mathfp.c:132
void update_missile_warning(void)
Definition cockpt.c:2382
void update_objective_location(short objective)
Definition cockpt.c:1334
void * FetchDiskPacketRetrying(short logicalFile, short section, short flags)
Definition disk.c:126
void __stdcall SetTextCursor(unsigned short a, unsigned short b)
Definition mathfp.c:145
unsigned short IsCockpitExplosionActive(void)
Definition cockpt.c:247
void check_objectives(void)
Definition cockpt.c:1378
void draw_nav_pointer(void)
Definition cockpt.c:2015
void ShowHudTextLine(char *s, unsigned short b)
Definition cockpt.c:1875
short sighted(short objective)
Definition cockpt.c:1030
unsigned int RestoreTransientCockpitGraphics(void)
Definition cockpt.c:2170
void EndCommMenu(void)
Definition comm.c:427
void DrawViewportPixel(Viewport *viewport, short x, short y, short colour)
Definition gr.c:976
void repair_internal_damage(void)
Definition ship.c:940
void PlaySnowStaticSound(void)
Definition sound.c:292
void clear_cockpit_damage(void)
Definition cockpt.c:2556
short CheckTargetLockMalfunction(void)
Definition cockpt.c:1671
void ResetPilotHandAnimation(void)
Definition cockpt.c:2479
void flag_reached(short objective, short reached)
Definition cockpt.c:1249
void ClearHudMessageSlot(HudMessageSlot *slot)
Definition cockpt.c:417
unsigned int spacetrack(int track, int mode, short enabled)
Definition music.c:411
short update_vid_disp(short vdu)
Definition cockpt.c:753
void check_visit(short objective, short range)
Definition cockpt.c:1320
void PlayCockpitSelectionSfx(short selectionSound)
Definition cockpt.c:2924
unsigned int IsPointWithinRange(const FixedVector *from, const FixedVector *to, short range)
Definition geom.c:913
void update_status_text(void)
Definition cockpt.c:1025
void DrawSpriteDefault(Viewport *viewport, short x, short y, struct Shape *shape, short frame)
Definition gr.c:660
void update_lights(void)
Definition cockpt.c:624
void RestoreCockpitExplosionBackground(void)
Definition cockpt.c:2611
short FixedToShortSaturating(int value)
Definition geom.c:193
void clear_head_up_display(void)
Definition cockpt.c:1455
long SinFixed(short degrees)
Definition mathfp.c:89
short MinShort(short a, short b)
Definition mathutil.c:20
void ClearHudMessageIfMatching(HudMessageSlot *slot, const char *text)
Definition cockpt.c:426
void show_navigation_disp(void)
Definition cockpt.c:1081
void InvalidateVduMode(short i)
Definition cockpt.c:764
void ClearHudGunReadouts(void)
Definition cockpt.c:433
void CockpitMessage(const char *text, unsigned short colour, int flashCount)
Definition cockpt.c:480
void remove_message(const char *text)
Definition cockpt.c:495
void real_vid_transmit(short obj, short message)
Definition comm.c:515
int GetViewportPixel(Viewport *viewport, short x, short y)
Definition gr.c:986
unsigned int select_new_release_weapon(enum ObjectType preferredType)
Definition select.c:93
void __stdcall SetTextContext(TextContext *context)
Definition mathfp.c:152
void DrawFilledViewportRect(Viewport *viewport, short left, short top, short right, short bottom, short colour)
Definition gr.c:1033
void rotational_pos_to_scanner_pos(signed char object, const SphericalVector *position)
Definition cockpt.c:1392
const char * objective_name(short objective)
Definition cockpt.c:1070
void EndCommSessionWithWingman(void)
Definition comm.c:416
void clear_message_time(void)
Definition cockpt.c:770
unsigned short SetVduModeIfChanged(short i, int state)
Definition cockpt.c:706
char *__stdcall DosStrcpy(char *dst, const char *src)
Definition strdos.c:49
void show_damage_disp(void)
Definition damage.c:56
int set_new_objective(short pathIndex)
Definition cockpt.c:1131
short visited(short objective)
Definition cockpt.c:1036
short achieved(short objective)
Definition cockpt.c:1042
void update_cockpit(void)
Definition cockpt.c:2895
int damage_your_component(char component, char amount, char maximum)
Definition cockpt.c:864
void EraseCockpitReadoutRegion(Viewport *viewport, short left, short top, short right, short bottom, short colour)
Definition cockpt.c:253
void PlayTargetLockSfx(void)
Definition cockpt.c:817
long CosFixed(short degrees)
Definition mathfp.c:95
void cycle_onscreen_targets(void)
Definition cockpt.c:2280
unsigned int overlay_head_up_display(void)
Definition cockpt.c:2080
void RemovePlayerReleaseWeapon(signed char weapon)
Definition cockpt.c:885
void RestoreSpriteBackground(Viewport *viewport, unsigned char *background, short x, short y, struct Shape *shape, short frame)
Definition gr.c:799
void check_target(void)
Definition cockpt.c:2314
void npc_communication(void)
Definition cockpt.c:2520
void ShowComponentHitHudMessage(const char *text, unsigned short colour, short flashCount)
Definition cockpt.c:847
unsigned int sort_viable_target_list(void)
Definition ship.c:447
void lock_off(void)
Definition cockpt.c:1662
short auto_pilot_valid(short showReason)
Definition cockpt.c:517
void UpdateMessage(HudMessageSlot *slot)
Definition cockpt.c:458
void pop_mode(short i)
Definition cockpt.c:732
void InflightComputer(void)
Definition nav.c:822
void send_message(short obj, short message)
Definition cockpt.c:2489
void __stdcall DrawTextString(const char *text)
Definition mathfp.c:232
void malf_sound(void)
Definition cockpt.c:823
void update_dead_disp(short a)
Definition cockpt.c:2751
long DivideFixed(int numerator, int denominator)
Definition mathfp.c:76
void explosion_draw(void)
Definition cockpt.c:2563
void print_message_text(char *text, unsigned short colour)
Definition cockpt.c:1778
void check_stranded(void)
Definition cockpt.c:2757
void EraseCockpitReadoutAtPosition(signed char slot, short left, short top)
Definition cockpt.c:372
unsigned short starting_lock(unsigned short v)
Definition cockpt.c:1652
void DrawSolidColourSprite(Viewport *viewport, short x, short y, struct Shape *shape, short frame, short colour)
Definition gr.c:935
void vdu_polygon(signed char bar, short percent)
Definition cockpt.c:270
void SetHudTextColour(short v)
Definition cockpt.c:1882
void show_info_disp(void)
Definition game.c:564
int any_enemy(short obj, short range)
Definition logic.c:887
unsigned int update_digital_readouts(void)
Definition cockpt.c:798
void DrawViewportBorder(Viewport *viewport, short left, short top, short right, short bottom, short colour)
Definition gr.c:1052
void remove_nav_pointer(void)
Definition cockpt.c:2008
void EmitTextString(void(__stdcall *writer)(int), const char *text)
Definition cockpt.c:107
short malf(char component)
Definition cockpt.c:829
void ClearViewport(Viewport *viewport, short colour)
Definition gr.c:963
void DrawPilotHandFrame(void)
Definition cockpt.c:2425
short escorting_a_ship(void)
Definition cockpt.c:1234
void exit_squadron(const char *msg)
Definition main.c:122
short find_vacant_3d_object(void)
Definition geom.c:987
void SetHudMessageText(char *text, unsigned short colour, unsigned short duration)
Definition cockpt.c:2218
void get_facing_range_from_object(short obj, short other)
Definition geom.c:691
short GetVduModeStackDepth(short i)
Definition cockpt.c:717
void draw_target_box(unsigned short colour, signed char object, short solid, short drawLockMarker, short padding, ShortRect *savedBounds)
Definition cockpt.c:1891
void FormatTextTokens(void(__stdcall *writer)(int), const char *format, va_list arguments)
Definition cockpt.c:116
void push_mode(short i, int state)
Definition cockpt.c:723
void set_new_vdu(short vdu)
Definition cockpt.c:739
void ResetScannerContacts(void)
Definition cockpt.c:1443
void vdu_pop_all(short vdu)
Definition cockpt.c:2931
short hidden_objective(short objective)
Definition cockpt.c:1098
unsigned int InitializeCockpitReadout(signed char slot, TextContext *context)
Definition cockpt.c:341
void rectangular_to_spherical(const FixedVector *rectangular, SphericalVector *spherical)
Definition geom.c:383
void draw_cockpit_lights(void)
Definition cockpt.c:568
void PlaySfxWaveFileByNumber()
int calculate_damage_level(void)
Definition main.c:2123
void set_mode(short i, int state)
Definition cockpt.c:697
void DrawTargetRangeReadout(void)
Definition view.c:679
void flag_objective(short objective, unsigned char flags)
Definition cockpt.c:1048
void check_sighting(short objective, short range, short object)
Definition cockpt.c:1311
void CaptureSpriteBackground(Viewport *viewport, unsigned char *background, short x, short y, struct Shape *shape, short frame)
Definition gr.c:669
void determine_pilot_hand(void)
Definition cockpt.c:2394
void DrawCalculatingLabel(void)
Definition cockpt.c:1054
void ComputeVectorDelta(const FixedVector *from, const FixedVector *to, FixedVector *delta)
Definition geom.c:314
unsigned int DrawTextAt(TextContext *context, short x, short y, const char *text, unsigned char alignment)
Definition disk.c:239
short mobile_objective(short objective)
Definition cockpt.c:1433
short decrement_lock_time(short screenX)
Definition cockpt.c:1687
unsigned int select_new_gun(void)
Definition select.c:83
void CopyTrainSimPilotViewToRightVdu(void)
Definition cockpt.c:2448
void FlushSoundEffectsAndLog(int soundHandle, short fadeTicks)
Definition music.c:714
short MaxShort(short a, short b,...)
Definition mathutil.c:29
void fire_computer_graphic_missile(void)
Definition cockpt.c:911
void RestoreCockpitExplosionIfVisible(void)
Definition cockpt.c:2161
void AppendFormattedText(const char *format,...)
Definition cockpt.c:227
void SetHudMessageSlot(HudMessageSlot *slot, TextContext *context, short x, short y, const char *text, unsigned short colour, signed char flashCount)
Definition cockpt.c:442
unsigned int someone_coming(void)
Definition cockpt.c:1217
void FatalErrorAndExit(const char *format,...)
Definition cockpt.c:237
void FreePacketAndClear(void *slot, unsigned short releaseFlags)
Definition mathutil.c:37
void __stdcall AppendTextCharacter(char character)
Definition mathfp.c:341
short find_ship_index(short missionShip)
Definition logic.c:439
void update_VDUs(void)
Definition cockpt.c:2767
short __stdcall RandomInRange(short lo, short hi)
Definition mathfp.c:49
unsigned int SetCockpitLightBlink(signed char light, short interval)
Definition cockpt.c:550
void target_locking(signed char target)
Definition cockpt.c:1710
unsigned int remove_weapon(short obj, short weapon)
Definition ship.c:132
void show_weapon_disp(void)
Definition cockpt.c:954
void DrawFormattedText(const char *format,...)
Definition cockpt.c:197
void vid_transmit(void)
Definition cockpt.c:2684
short RandomBelowOrEqual(short n)
Definition mathfp.c:59
void SelectCockpitVduMode(short vdu, int mode)
Definition cockpt.c:2945
unsigned int draw_3d_scanner(void)
Definition cockpt.c:1544
unsigned short vdu_malf(short vdu, short sound)
Definition cockpt.c:837
short get_color(short object, unsigned short *colour)
Definition cockpt.c:1510
void CopyViewportContents(Viewport *source, Viewport *destination)
Definition gr.c:945
void set_global_message(const char *text, unsigned short colour, int flashCount)
Definition cockpt.c:470
short cycle_next_objective(void)
Definition cockpt.c:1159
void ShutdownEventManager(void)
Definition strdos.c:101
void talk_equiv(void)
Definition comm.c:397
void animate_pilot(void)
Definition cockpt.c:2468
short message_showing(void)
Definition cockpt.c:776
ShipMissionType
Definition wcdata.h:120
@ MISSION_TYPE_ESCORT
Definition wcdata.h:123
@ MISSION_TYPE_WARP_ARRIVE
Definition wcdata.h:129
@ MISSION_TYPE_COME_HOME
Definition wcdata.h:132
#define EYE_OBJECT
Definition wcdata.h:1006
ObjectType
Definition wcdata.h:54
@ OBJECT_TYPE_TIGERS_CLAW
Definition wcdata.h:63
@ OBJECT_TYPE_HEAT_SEEKING_MISSILE
Definition wcdata.h:84
@ OBJECT_TYPE_IMAGE_RECOGNITION_MISSILE
Definition wcdata.h:86
@ OBJECT_TYPE_SPACE_MINE
Definition wcdata.h:88
Side
Definition wcdata.h:173
@ SIDE_IMPERIAL
Definition wcdata.h:174
@ SIDE_KILRATHI
Definition wcdata.h:175
@ SIDE_NEUTRAL
Definition wcdata.h:176
ShipObjective
Definition wcdata.h:136
@ OBJECTIVE_ENGAGE_ENEMY
Definition wcdata.h:144
@ OBJECTIVE_DESTROY_SHIP
Definition wcdata.h:142
@ SPECIAL_MANEUVER_UNKNOWN_9
Definition wcdata.h:268
ObjectClass
Definition wcdata.h:37
@ OBJECT_CLASS_PLANET
Definition wcdata.h:41
@ OBJECT_CLASS_MISSILE
Definition wcdata.h:49
@ OBJECT_CLASS_SHIP
Definition wcdata.h:50
@ OBJECT_CLASS_CAPITAL_SHIP
Definition wcdata.h:51
@ OBJECT_CLASS_NULL
Definition wcdata.h:38