Wing Commander II
Reconstructed Win32 source (1996)
Loading...
Searching...
No Matches
gameflow.c
Go to the documentation of this file.
1/*
2 * Cutscene engine and game flow.
3 *
4 * Retail object 0x42BB70-0x43340F (link order; see docs/ORDER.md).
5 */
6#define GAMEFLOW_C
7#include "game.h"
8
9static char g_szLastCutsceneWorkBuffer[16]; /* 0x00499ec0 */
10static char g_szLastCutscenePrintBuffer[12]; /* 0x00499ed0 */
11
12unsigned char g_bMemoryLogToFile = 0; /* 0x00499bf8 */
13signed char g_bAutopilotDebugEnabled = 0; /* 0x00499bfc */
14signed char g_bRoomTransitionAnimationEnabled = 1; /* 0x00499c00 */
15void *g_pCutsceneCockpitPacket = 0; /* 0x00499c04 */
16void *g_pSceneMusicPacket = 0; /* 0x00499c08 */
17void *g_pCutsceneCockpitPalette = 0; /* 0x00499c0c */
18short g_nCutsceneSpritesDrawn = 0; /* 0x00499c10 */
20 "sprite",
21 "plane",
22 "sequence",
23 "script"
24}; /* 0x00499c18 */
25
26/* WC2's screens.c declares the memory-status flag one byte wide where the
27 * rest of the game declares it as a short. Only the load and store width
28 * differ; the flag itself is 0 or 1. */
29#define g_cShowMemoryStatus \
30 (*(signed char *)&g_nShowMemoryStatus)
31
32/* Forward declarations of the script and resource-cache routines defined
33 * further down. Their named parameters also give this unit retail's
34 * symbol-key numbering (each named parameter takes one key). */
36signed char RunCutsceneScript(unsigned char **scriptCursor, short objectType);
37char *GetPackedStringByIndex(CutsceneResourceTable *resources, short index);
38void RewriteDiskFileGraphicsExtensions(char *fileName);
40 short index, int resourceType);
43 short index);
44int MapCutsceneSoundEffectNumber(int soundIndex);
45
46#pragma function(memcpy)
47/* Function start: 0x42BB70 */
49{
50 signed char ticks;
51 signed char frame;
52 signed char speaker;
53 signed char speechSpeed;
54
55 speechSpeed = g_cCutsceneSpeechSpeed;
58 return;
59 }
60 if (g_bCutsceneSkipFrame != 0 ||
63 (signed char)(g_2_bMovieStringAdvanceState = 0);
65 sprite->currentFrame = 11;
66 return;
67 }
68 if (g_wDigiPlaying != 0 ||
70 if (g_wDigiPlaying == 0) {
72 (signed char)(g_2_bMovieStringAdvanceState = 0);
73 sprite->currentFrame = 11;
75 return;
76 }
78 }
79 if (g_wDigiPlaying != 0)
80 speechSpeed = 0;
84 speaker = (signed char)toupper(*g_pszCutsceneSpeechCursor);
85 if (speaker < 0) {
86 speaker = (signed char)(speaker + 0x80);
87 frame = g_acCutsceneMouthFrames[speaker];
88 ticks = g_acCutsceneMouthDurations[speaker];
89 } else if (speaker < ' ') {
90 if (speaker == 0) {
92 (signed char)(g_2_bMovieStringAdvanceState = 0);
94 }
95 frame = -1;
96 } else if (speaker == 'T' &&
97 toupper(*g_pszCutsceneSpeechCursor) == 'H') {
98 frame = 8;
99 ticks = 3;
101 } else {
102 frame = g_acCutsceneMouthFrames[speaker];
103 ticks = g_acCutsceneMouthDurations[speaker];
104 }
105 if (frame != -1) {
106 sprite->currentFrame = frame;
107 sprite->waitTicks = (short)(speechSpeed * ticks);
108 } else {
109 sprite->currentFrame = 11;
110 sprite->waitTicks = (short)(speechSpeed * RandomInRange(2, 4));
111 }
112 if (g_pszCutsceneSpeechCursor != 0 &&
115 }
116}
117
118/* Function start: 0x42BDDB */
120{
121 if (node != 0)
122 return 1;
123 return 0;
124}
125
126/* Function start: 0x42BDFE */
128{
129}
130
131/* Function start: 0x42BE09 */
132void LogMemoryStateToFile(FILE *file)
133{
134 FILE *previousFile;
135 unsigned char previousFileMode;
136
137 previousFile = g_pMemoryLogFile;
138 previousFileMode = g_bMemoryLogToFile;
140 g_pMemoryLogFile = file;
142 g_pMemoryLogFile = previousFile;
143 g_bMemoryLogToFile = previousFileMode;
144}
145
146/* Function start: 0x42BE4B */
148{
149 unsigned int mainAvail;
150 unsigned int mainLargest;
151 unsigned int farFree;
152 unsigned int farBlock;
153 unsigned short nearTotal;
154
156 if (g_pMemoryLogFile != 0) {
157 mainAvail = GetAvailableMainMemory();
158 mainLargest = GetLargestMainMemoryBlock();
159 farFree = GetAvailableFarMemory();
160 farBlock = GetLargestFreeMemoryBlock();
161 nearTotal = GetOriginalFreeMemory();
162 fprintf(g_pMemoryLogFile,
163 "----- Mem State ------\n");
164 fprintf(g_pMemoryLogFile,
165 "NEAR: %ud\n", nearTotal);
166 fprintf(g_pMemoryLogFile,
167 "FAR: %6ld Largest: %6ld\n",
168 mainAvail, mainLargest);
169 fprintf(g_pMemoryLogFile,
170 "EMS: %6ld Largest: %6ld\n",
171 farFree, farBlock);
172 fprintf(g_pMemoryLogFile,
173 "----------------------\n");
174 }
175}
176
177#pragma function(memcmp, strlen)
178/* Function start: 0x42BF0C */
198
199/* Function start: 0x42BFB8 */
201{
202 unsigned char *firstRow;
203
204 firstRow = 0;
206 g_cCutsceneVideoMode == 0x13 &&
212 if (g_pMemoryLogFile != 0)
213 fprintf(g_pMemoryLogFile, "Rerouted LZ.\n");
215 }
217}
218
219/* Function start: 0x42C04B */
221{
222 unsigned char *firstRow;
223
225 g_cCutsceneVideoMode == 0x13) {
228 if (g_13_pActiveCutscenePixelsAddress == firstRow)
230 }
231}
232
233/* Function start: 0x42C0A2 */
234signed char IsCutsceneSpeechLoaded(void)
235{
236 short slot;
237
238 for (slot = 0; slot < 8; slot++) {
239 if (g_12_apszMovieSpeechFiles[slot] != 0)
240 return 1;
241 }
242 return 0;
243}
244
245#pragma intrinsic(memcpy)
246/* Function start: 0x42C0F1 */
247void DrawCutsceneTextAt(short x, short y, short viewportIndex,
248 const char *text)
249{
250 ShortRect savedBounds;
251
254 switch (viewportIndex) {
255 case 0:
258 break;
259 case 1:
262 break;
263 case 2:
266 break;
267 case 3:
270 break;
271 case 4:
274 break;
275 }
277 savedBounds =
292 }
294 if (x > -1) {
297 }
298 if (y > -1) {
301 }
302 } else {
307 }
308 if ((IsCutsceneSpeechLoaded() == 0 ||
310 g_nAudioEnabled == 0) &&
311 memcmp(text, "50", 2) != 0) {
312 FormatTextBufferFromStart("%s%P", text);
313 }
317 savedBounds;
319}
320
321/* Function start: 0x42C373 */
322void LoadCutsceneCockpitOverlay(short scriptValue)
323{
324 if (g_pCutsceneCockpitPacket == 0) {
326 g_7_szCockpitAssetFilenameText, 8, 0, 0, 0, 1);
327 }
328 (void)scriptValue;
329}
330
331/* Function start: 0x42C3A7 */
332void DrawCutsceneCockpitOverlay(short unused, short verticalOffset)
333{
334 short hits;
335 short x;
336 short y;
337
338 if (g_pCutsceneCockpitPacket != 0) {
339 for (hits = 0; hits < 4; hits++) {
340 if (g_69_asCockpitDmgStateList[hits] == 1) {
342 y = (short)(
344 verticalOffset);
346 x, y,
348 hits);
349 }
350 }
351 }
352 (void)unused;
353}
354
355/* Function start: 0x42C43D */
356void RunCutsceneWipeTransition(Viewport *destination, Viewport *source,
357 int wipeType, short duration)
358{
359 signed char done;
360 void *workspace;
361
362 done = 0;
363 workspace = 0;
365 if (g_bCutsceneSkipFrame == 0 &&
367 if (g_cCutsceneVideoMode == 0x13) {
369 workspace = malloc(0xce);
370 if (workspace == 0) {
371 if (g_pMemoryLogFile != 0)
372 fprintf(g_pMemoryLogFile,
373 "Unable to allocate Wipe.\n");
374 CopyViewportContents(source, destination);
375 } else {
376 if (InitializeViewportWipe(source, destination, wipeType,
377 duration, 1, workspace) != 0) {
378 while (done == 0) {
379 done = AdvanceViewportWipe(workspace);
380 if (wipeType == 8 || wipeType == 9) {
381 MarkDibDirty();
382 DIBslamReal();
383 }
384 }
385 } else if (g_pMemoryLogFile != 0) {
386 fprintf(g_pMemoryLogFile,
387 "Unable to allocate Wipe (1).\n");
388 }
389 FinishViewportWipe(workspace);
390 free(workspace);
391 }
392 } else {
393 CopyViewportContents(source, destination);
394 }
395 }
396}
397
398/* Function start: 0x42C5A2 */
400{
401 if (FindQueuedInputEvent(2) == 0) {
402 for (;;) {
403 if (ServiceInputDevices(-1) != 0) {
405 if (FindQueuedInputEvent(2) != 0 ||
406 FindQueuedInputEvent(5) != 0)
407 break;
408 }
409 }
410 }
411}
412
413/* Function start: 0x42C607 */
415 CutsceneResourceTable *resources)
416{
417 while (resources != 0) {
418 if (resources->owner == g_nActiveCutsceneResourceLevel)
419 return resources;
420 else
421 resources = resources->next;
422 }
423 FatalCutsceneError("A1");
424}
425
426/* Function start: 0x42C659 */
429{
430 while (resources != 0) {
431 if (resources->owner == g_nActiveCutsceneResourceLevel)
432 return resources;
433 else
434 resources = resources->next;
435 }
436 FatalCutsceneError("A2");
437}
438
439/* Function start: 0x42C6AC */
440short RemoveCutsceneMemberIndex(short count, unsigned char *indices,
441 signed char index)
442{
443 short member;
444
445 for (member = 0; member < count; member++) {
446 if (indices[member] == (unsigned char)index) {
447 DosMemmove(indices, &indices[member + 1], (size_t)(15 - member));
448 count--;
449 }
450 }
451 return count;
452}
453
454/* Function start: 0x42C725 */
455void FatalCutsceneError(const char *format, ...)
456{
457 va_list arguments;
458
459 va_start(arguments, format);
460 vsprintf(g_4_pszFilmWorkScratch, format, arguments);
462}
463
464/* Function start: 0x42C75D */
466{
467 short index;
468
469 for (index = 0; index < 0x80; index++) {
470 if (g_apSceneObjects[index] != 0)
471 g_apSceneObjects[index]->tick = 0;
472 }
474}
475
476/* Function start: 0x42C7BC */
477void PresentCutsceneFrame(Viewport *source, Viewport *destination)
478{
479 Viewport debugViewport;
480 unsigned short debugFrameNumber;
481
482 if (g_cCutsceneVideoMode != 0x13 &&
483 g_cCutsceneVideoMode != 0x0d)
484 return;
486 debugViewport = g_2_stModalSourceWindow;
487 debugViewport.bottom = 0x17;
490 g_6_stMovieDebugTextCtx.viewport = &debugViewport;
495 debugFrameNumber = g_wCutsceneDebugFrameNumber++;
497 "%X%Y%d Delay: %d DrawsCalled: %d * %d Time: %U ",
498 0, 0, debugFrameNumber, g_nCutsceneFrameDelay,
502 }
503 if (g_nFrameSkipCountdown == 0) {
504 ConsumeCutscenePalettePacket(0, 0x100, 1);
505 CopyViewportContents(source, destination);
507 }
509}
510
511/* Function start: 0x42C8E1 */
512void ConsumeCutscenePalettePacket(short firstColour, short count,
513 signed char releasePacket)
514{
515 signed char malformed;
516 unsigned int size;
517 unsigned char *nextChunk;
518 unsigned char *chunk;
519
520 malformed = 0;
521 if (g_26_pFilmRgbPacket == 0)
522 return;
523 if (ReadNextSceneForm(&g_26_pFilmRgbPacket, &nextChunk) ==
524 0x204c4150) {
525 chunk = g_26_pFilmRgbPacket;
527 if (*(unsigned int *)chunk == 0x50414d43) {
528 size = *(unsigned int *)g_26_pFilmRgbPacket;
530 SwapSceneChunkSizeEndian((int *)&size);
531 if (size / 3 != 0x100)
532 malformed++;
533 } else {
534 malformed++;
535 }
536 if (malformed != 0)
537 FatalCutsceneError("A3");
538 }
539 if (releasePacket != 0)
541}
542
543/* Function start: 0x42C9B0 */
544/* Returns the playing sound effect slot of this resource: the third slot
545 * found for it is stopped and reused; otherwise 0. */
547{
548 CutsceneSoundEffect *effect;
549 short count;
550
552 count = 0;
553 while (effect != 0) {
554 if (effect->resourceIndex == resourceIndex) {
555 count++;
556 if (count == 3) {
557 ((void (__cdecl *)(void *, int))FlushSoundEffect)(
558 effect->sound, 0);
559 return effect;
560 }
561 }
562 effect = effect->next;
563 }
564 return effect;
565}
566
567/* Function start: 0x42CA28 */
568/* Nothing in the shipped executable calls this. Records a started sound
569 * effect: reuses the slot FindCutsceneSoundEffect returns, or links a new
570 * slot at the head of the list. */
571void AddCutsceneSoundEffect(void *sound, short resourceIndex)
572{
573 CutsceneSoundEffect *effect;
574
575 if (g_bCutsceneSkipFrame != 0 ||
578 return;
579 effect = FindCutsceneSoundEffect(resourceIndex);
580 if (effect != 0) {
581 effect->sound = sound;
582 return;
583 }
584 effect = (CutsceneSoundEffect *)calloc(1, sizeof(CutsceneSoundEffect));
585 if (effect == 0)
586 FatalCutsceneError("A5");
587 if (g_pMemoryLogFile != 0) {
588 fprintf(g_pMemoryLogFile, "Alloc FX: %p free: %d\n",
589 effect, (int)(short)GetOriginalFreeMemory());
590 }
591 effect->resourceIndex = resourceIndex;
592 effect->sound = sound;
595}
596
597/* Function start: 0x42CB08 */
598void ReleaseCutsceneSoundEffects(short resourceIndex)
599{
600 CutsceneSoundEffect *previous;
601 CutsceneSoundEffect *effect;
602
603 previous = 0;
605 if (g_nMusicDriverMode != 1 && g_nMusicDriverMode != 2)
606 return;
607 if (resourceIndex == -1) {
608 while (effect != 0) {
609 ((void (__cdecl *)(void *, int))FlushSoundEffect)(
610 effect->sound, 0);
611 previous = effect->next;
612 free(effect);
613 effect = previous;
614 }
616 } else {
617 while (effect != 0) {
618 if (effect->resourceIndex == resourceIndex) {
619 ((void (__cdecl *)(void *, int))FlushSoundEffect)(
620 effect->sound, 0);
621 if (previous != 0)
622 previous->next = effect->next;
623 else
625 free(effect);
626 if (g_pMemoryLogFile != 0) {
627 fprintf(g_pMemoryLogFile,
628 "Free FX: %p free: %d\n", effect,
629 (int)(short)GetOriginalFreeMemory());
630 }
631 return;
632 }
633 previous = effect;
634 effect = effect->next;
635 }
636 }
637}
638
639/* Function start: 0x42CC42 */
640void LoadCutsceneSpeechSlot(short resourceIndex, short slot)
641{
642 CutsceneResourceTable *resourceTable;
643 int packetSize;
644
645 if (g_bSpeechEnabledFlag == 0 ||
648 return;
649 resourceTable = FindActiveCutsceneFileResources(
651 while (g_wDigiPlaying != 0)
657 resourceTable, resourceTable->filenameIndices[resourceIndex]);
659 resourceTable->sectionIndices[resourceIndex];
660 packetSize = (int)GetNamedPacketSize(
663 if (packetSize <= 0) {
666 } else {
671 if (g_3_apSceneSpeechPacketsList[slot] != 0) {
673 (short)packetSize;
674 }
675 }
676}
677
678/* Function start: 0x42CDB5 */
679/* Nothing in the shipped executable calls this. Makes sure a song is in the
680 * loaded-song list: an empty list gets a first node, otherwise a new node is
681 * added after the last one. The list pointer is left at the new node. */
682void AddCutsceneMusicNode(CutsceneMusicNode **head, short resourceIndex)
683{
684 CutsceneMusicNode *node;
685 CutsceneMusicNode *nextNode;
686 CutsceneMusicNode *allocated;
687
688 node = *head;
689 if (g_nMusicDriverMode != 1 &&
691 return;
693 return;
694 if (head == 0)
695 return;
696 if (HasCutsceneMusicNode(node) == 0) {
697 allocated = (CutsceneMusicNode *)calloc(1,
698 sizeof(CutsceneMusicNode));
699 if (allocated == 0)
700 FatalCutsceneError("A6");
701 if (g_pMemoryLogFile != 0) {
702 fprintf(g_pMemoryLogFile,
703 "Alloc Music: %p free: %d\n", allocated,
704 (int)(short)GetOriginalFreeMemory());
705 }
706 node = allocated;
707 node->resourceIndex = (unsigned char)resourceIndex;
711 resourceIndex, 2);
712 *head = node;
713 return;
714 }
715 while (HasCutsceneMusicNode(node->previous) != 0)
716 node = node->previous;
717 do {
718 nextNode = node->next;
719 if (node->resourceIndex == resourceIndex)
720 return;
721 if (HasCutsceneMusicNode(nextNode) != 0)
722 node = nextNode;
723 } while (HasCutsceneMusicNode(nextNode) != 0);
724 allocated = (CutsceneMusicNode *)calloc(1, sizeof(CutsceneMusicNode));
725 if (allocated != 0) {
726 if (g_pMemoryLogFile != 0) {
727 fprintf(g_pMemoryLogFile,
728 "Alloc Music: %p free: %d\n", allocated,
729 (int)(short)GetOriginalFreeMemory());
730 }
731 nextNode = allocated;
732 node->next = nextNode;
733 *head = nextNode;
734 nextNode->previous = node;
735 nextNode->resourceIndex = (unsigned char)resourceIndex;
739 resourceIndex, 2);
740 } else {
741 FatalCutsceneError("A7");
742 }
743}
744
745/* Function start: 0x42CFDB */
747 short resourceIndex)
748{
749 CutsceneMusicNode *node;
750 CutsceneMusicNode *previous;
751
752 node = *head;
753 if (g_nMusicDriverMode != 1 &&
755 return;
756 if (HasCutsceneMusicNode(node) == 0)
757 return;
758 while (HasCutsceneMusicNode(node->next) != 0)
759 node = node->next;
760 *head = node;
761 while (HasCutsceneMusicNode(node) != 0) {
762 previous = node->previous;
763 if (node->resourceIndex == resourceIndex ||
764 resourceIndex == 0xff) {
765 if (HasCutsceneMusicNode(previous) != 0)
766 previous->next = node->next;
767 if (HasCutsceneMusicNode(node->next) != 0)
768 node->next->previous = previous;
769 if (*head == node)
770 *head = previous;
774 node->resourceIndex);
775 free(node);
776 if (g_pMemoryLogFile != 0) {
777 fprintf(g_pMemoryLogFile,
778 "Free Music: %p free: %d\n",
779 node, (int)(short)GetOriginalFreeMemory());
780 }
781 node = 0;
782 if (resourceIndex != 0xff)
783 return;
784 }
785 node = previous;
786 }
787}
788
789/* Function start: 0x42D181 */
790void *FindLoadedCutsceneMusic(short resourceIndex)
791{
792 CutsceneMusicNode *node;
793
795 if (HasCutsceneMusicNode(node) == 0)
796 return 0;
797 while (HasCutsceneMusicNode(node->next) != 0)
798 node = node->next;
799 while (HasCutsceneMusicNode(node) != 0) {
800 if (node->resourceIndex == resourceIndex)
801 return node->packet;
802 node = node->previous;
803 }
804 return 0;
805}
806
807/* Function start: 0x42D227 */
809{
810 if (g_nCutsceneResourceLevel == 0) {
811 if (g_bAutopilotDebugEnabled != 0 &&
813 g_pMemoryLogFile = fopen("logger.$$$", "w");
824 /* The retail image sets and immediately clears this flag. */
827 if (g_apSceneObjects == 0) {
829 0x80, HOST_POINTER_SIZE, 0,
830 "Cannot alloc SpritesArray");
831 }
832 if (g_apCutscenePlanes == 0) {
834 0x40, HOST_POINTER_SIZE, 0,
835 "Cannot alloc PlanesArray");
836 }
837 if (g_apCutsceneSequences == 0) {
839 0x100, HOST_POINTER_SIZE, 0,
840 "Cannot alloc SequenceArray");
841 }
842 if (g_apCutsceneScenes == 0) {
844 0x20, HOST_POINTER_SIZE, 0,
845 "Cannot alloc ScriptArray");
846 }
847 if (g_4_pszFilmWorkScratch == 0) {
849 g_4_pszFilmWorkScratch = calloc(0x100, 1);
850 if (g_4_pszFilmWorkScratch == 0)
851 FatalCutsceneError("A8");
852 if (g_pMemoryLogFile != 0)
853 fprintf(g_pMemoryLogFile,
854 "Alloc ___workstring: %p free: %d\n",
856 (int)GetOriginalFreeMemory());
857 }
858 if (g_116_pszFilmPrintStore == 0) {
860 g_116_pszFilmPrintStore = calloc(0x100, 1);
862 FatalCutsceneError("A9");
863 if (g_pMemoryLogFile != 0)
864 fprintf(g_pMemoryLogFile,
865 "Alloc ___printstring: %p free: %d\n",
867 (int)GetOriginalFreeMemory());
868 }
869 }
870}
871
872/* Function start: 0x42D444 */
892
893/* Function start: 0x42D4C1 */
895{
896 if (g_pSceneMusicPacket != 0) {
897 StopMusic(0);
898 /* Track 44's slot of the music table holds the scene music. */
900 (void *)g_4_dwSceneMusicMode;
902 }
903}
904
905/* Function start: 0x42D4FA */
907{
908 short index;
909
910 for (index = 0; index < 8; index++) {
912 g_12_apszMovieSpeechFiles[index] = 0;
915 }
916}
917
918/* Function start: 0x42D568 */
920{
921 TextContext *savedTextContext;
922 short savedInputPollPeriod;
923 short previousMemoryStatus;
924
925 savedTextContext = g_29_pCurrentTextContext;
926 savedInputPollPeriod = g_nInputPollPeriod;
927 previousMemoryStatus = g_cShowMemoryStatus;
932 (signed char)QueryCurrentGraphicsMode();
942 if (g_pMemoryLogFile != 0) {
943 fprintf(g_pMemoryLogFile,
944 "************************************\n"
945 "Initial %ld Overhead %ld\n",
948 }
952 g_pCutsceneSceneResources)->scriptSymbolIndices]);
964 if (g_pMemoryLogFile != 0) {
965 fprintf(g_pMemoryLogFile,
966 "Free ___workstring %p free: %d\n",
968 (int)(short)GetOriginalFreeMemory());
969 }
971 if (g_pMemoryLogFile != 0) {
972 fprintf(g_pMemoryLogFile,
973 "Free ___printstring %p free: %d\n",
975 (int)(short)GetOriginalFreeMemory());
976 }
983 if (g_bSceneCockpitLoaded != 0) {
986 }
987 g_nInputPollPeriod = savedInputPollPeriod;
988 g_29_pCurrentTextContext = savedTextContext;
990 if (g_pSceneMusicPacket != 0) {
991 }
992 StopMusic(0);
1000 if (g_pMemoryLogFile != 0)
1001 fclose(g_pMemoryLogFile);
1002 g_cShowMemoryStatus = (signed char)previousMemoryStatus;
1003}
1004
1005/* Function start: 0x42D81C */
1007{
1008 SceneFlicObject *savedSprite;
1009 CutscenePlane *savedPlane;
1010 short savedOwner;
1011
1012 savedOwner = g_nActiveCutsceneResourceLevel;
1013 savedSprite = g_pCurrentCutsceneSprite;
1014 savedPlane = g_pCurrentCutscenePlane;
1015 if (scene == 0)
1016 FatalCutsceneError("A10");
1020 if (g_bCutsceneSkipFrame == 0 &&
1024 }
1025 if (g_bCutsceneSkipAll == 0)
1026 RunCutsceneScript(&scene->scriptCursor, 3);
1027 g_pCurrentCutsceneSprite = savedSprite;
1028 g_pCurrentCutscenePlane = savedPlane;
1029 g_nActiveCutsceneResourceLevel = savedOwner;
1030}
1031
1032/* Function start: 0x42D8E2 */
1033void CopyCutsceneSpriteDisplay(unsigned char destination,
1034 unsigned char source)
1035{
1036 SceneFlicObject *target;
1037 SceneFlicObject *sourceSprite;
1038
1039 target = g_apSceneObjects[
1042 ->scriptSymbolIndices[destination]];
1043 sourceSprite = g_apSceneObjects[
1046 ->scriptSymbolIndices[source]];
1047 ReleaseCutsceneSpriteShape(sourceSprite);
1048 sourceSprite->drawType = target->drawType;
1049 sourceSprite->shape = target->shape;
1050 sourceSprite->baseFrame = target->baseFrame;
1051 sourceSprite->finalFrame = target->finalFrame;
1052 sourceSprite->currentFrame = target->currentFrame;
1053}
1054
1055/* Function start: 0x42D98C */
1056void LinkCutsceneSpriteScript(unsigned char destination,
1057 unsigned char source)
1058{
1059 SceneFlicObject *target;
1060 SceneFlicObject *sourceSprite;
1061
1062 target = g_apSceneObjects[
1065 ->scriptSymbolIndices[destination]];
1066 sourceSprite = g_apSceneObjects[
1069 ->scriptSymbolIndices[source]];
1070 sourceSprite->linkedOwner = sourceSprite->owner;
1071 sourceSprite->linkedScript = sourceSprite->scriptStart;
1072 sourceSprite->scriptCursor = target->scriptStart;
1073 sourceSprite->scriptStart = sourceSprite->scriptCursor;
1074 sourceSprite->owner = g_nActiveCutsceneResourceLevel;
1075}
1076
1077/* Two sprites a developer could watch: drawing either one resets x first,
1078 * a store the real x then overwrites. */
1079extern SceneFlicObject *g_7_pWatchedSceneSpriteA; /* 0x005d2e90 */
1080extern SceneFlicObject *g_11_pWatchedSceneSpriteB; /* 0x005d2e94 */
1081
1082/* Function start: 0x42DA25 */
1084{
1085 short y;
1086 short x;
1087 short rotation;
1088 short attributes;
1089 short scale;
1090
1091 if (sprite == 0)
1092 FatalCutsceneError("A11");
1093 if (sprite == g_7_pWatchedSceneSpriteA ||
1094 sprite == g_11_pWatchedSceneSpriteB)
1095 x = 0;
1096 if (g_bCutsceneDrawingEnabled == 0 &&
1098 return;
1099 if (sprite->active != 0 && sprite->visible != 0 &&
1100 sprite->shape != 0 && g_bCutsceneViewportPreallocated == 0) {
1101 x = sprite->x;
1102 y = sprite->y;
1103 rotation = sprite->rotation;
1104 scale = sprite->scale;
1105 attributes = sprite->drawFlags;
1107 x = (short)(x + g_pCutsceneSpriteParentPlane->x);
1108 y = (short)(y + g_pCutsceneSpriteParentPlane->y);
1109 rotation = (short)(rotation +
1111 scale = (short)(scale +
1113 attributes ^= (short)g_pCutsceneSpriteParentPlane->drawFlags;
1114 }
1115 rotation = (short)(rotation % 360);
1116 if (rotation < 0)
1117 rotation = (short)(rotation + 360);
1118 if (scale < 0)
1119 scale = 0;
1120 if (scale > 0x4000)
1121 scale = 0x4000;
1122 if ((attributes & 1) != 0) {
1123 if ((attributes & 0x10) != 0) {
1124 x = (short)(160 - x + 160);
1125 }
1126 if ((attributes & 0x20) != 0) {
1127 y = (short)(100 - y + 100);
1128 }
1129 attributes &= ~1;
1130 }
1133 switch (sprite->drawType) {
1134 case 4:
1135 if (g_nFrameSkipCountdown == 0) {
1137 x, y, sprite->shape,
1138 (short)(sprite->currentFrame -
1139 sprite->segmentStartFrame),
1140 rotation, scale, attributes);
1141 }
1142 sprite->currentFrame++;
1144 (void *)sprite->decoderState;
1145 AdvanceSceneFlicStream(sprite);
1146 break;
1147 case 0:
1148 case 2:
1149 if (g_nFrameSkipCountdown == 0) {
1151 x, y, sprite->shape, sprite->baseFrame,
1152 rotation, scale, attributes);
1154 x, y, sprite->shape,
1155 (short)(sprite->baseFrame + sprite->currentFrame + 1),
1156 rotation, scale, attributes);
1157 }
1158 sprite->tick++;
1159 break;
1160 case 1:
1161 case 3:
1162 if (g_nFrameSkipCountdown == 0) {
1164 x, y, sprite->shape,
1165 (short)(sprite->baseFrame + sprite->currentFrame),
1166 rotation, scale, attributes);
1167 }
1168 sprite->tick++;
1169 break;
1170 }
1171 }
1172}
1173
1174/* Function start: 0x42DD9F */
1176{
1177 short index;
1178
1179 if (plane == 0)
1180 FatalCutsceneError("A12");
1181 if (g_bCutsceneDrawingEnabled == 0 &&
1183 return;
1184 if (plane->active != 0 && plane->visible != 0 &&
1187 for (index = 0; index < plane->spriteCount; index++) {
1189 plane->spriteIndices[index]]);
1190 }
1191 }
1192}
1193
1194/* Function start: 0x42DE62 */
1195void ClearCutsceneViewport(Viewport *viewport, unsigned char colour)
1196{
1197 if (g_cCutsceneVideoMode == 13)
1198 colour = g_abCutscenePaletteTranslation[colour];
1199 ClearViewport(viewport, colour);
1200}
1201
1202/* Function start: 0x42DE9D */
1222
1223/* Function start: 0x42DF32 */
1233
1234/* Function start: 0x42DF80 */
1235void ExpandCutsceneText(const unsigned char *source, char *destination)
1236{
1237 char character;
1238 char *out;
1239 unsigned int number[4];
1240
1241 out = destination;
1242 if (out == 0)
1243 return;
1244 DosMemset(out, 0x100, 0);
1245 while ((character = *source++) != 0) {
1246 if ((unsigned char)character == 0x40) {
1247 itoa(g_117_nCutsceneFormatValueWord, (char *)number, 10);
1248 out = CopyStringAndReturnEnd(out, (char *)number);
1249 } else if ((unsigned char)character >= 0x85) {
1250 switch ((unsigned char)character) {
1251 case 0x85:
1254 break;
1255 case 0x86:
1258 break;
1259 case 0x89:
1262 break;
1263 case 0x87:
1264 itoa(*((short *)g_pCampaignGlobals + 54),
1265 (char *)number, 10);
1266 out = CopyStringAndReturnEnd(out, (char *)number);
1267 break;
1268 case 0x88:
1269 itoa(*((short *)g_pCampaignGlobals + 55),
1270 (char *)number, 10);
1271 out = CopyStringAndReturnEnd(out, (char *)number);
1272 break;
1273 default:
1274 out++;
1275 break;
1276 }
1277 } else {
1278 *out++ = character;
1279 }
1280 }
1281}
1282
1283/* Function start: 0x42E12A */
1285 unsigned char *text, signed char draw)
1286{
1287 short priorOwner;
1288 signed char continueSequence;
1289 signed char textShown;
1290 short planeIndex;
1291 CutsceneSequence *priorSequence;
1292
1293 textShown = 0;
1294 priorOwner = g_nActiveCutsceneResourceLevel;
1295 priorSequence = g_pCurrentCutsceneSequence;
1296 if (sequence == 0)
1297 FatalCutsceneError("A13");
1299 g_pCurrentCutsceneSequence = sequence;
1301 do {
1303 if (textShown == 0 && text != 0) {
1304 textShown++;
1307 if ((IsCutsceneSpeechLoaded() == 0 ||
1308 g_nAudioEnabled == 0) &&
1309 memcmp(g_4_pszFilmWorkScratch, "50", 2) != 0) {
1311 "%s%P", g_4_pszFilmWorkScratch);
1312 }
1316 }
1317 while (g_bCutsceneSkipFrame == 0 &&
1321 }
1323 continueSequence = RunCutsceneScript(&sequence->scriptCursor, 2);
1324 g_pCurrentCutsceneSequence = sequence;
1325 if (draw != 0) {
1326 if (continueSequence != 0 && sequence->planeCount != 0 &&
1328 for (planeIndex = 0; planeIndex < sequence->planeCount;
1329 planeIndex++) {
1332 sequence->planeIndices[planeIndex]], 1);
1333 }
1334 for (planeIndex = 0; planeIndex < sequence->planeCount;
1335 planeIndex++) {
1337 sequence->planeIndices[planeIndex]]);
1338 }
1339 if (g_bCutsceneSkipFrame == 0 &&
1341 ConsumeCutscenePalettePacket(0, 0x100, 1);
1346 if (g_nCutsceneFrameDelay != 0) {
1350 }
1351 }
1352 } else {
1354 }
1355 } else {
1356 continueSequence = 0;
1357 }
1358 } while (continueSequence != 0);
1359 g_pCurrentCutsceneSequence = priorSequence;
1360 g_nActiveCutsceneResourceLevel = priorOwner;
1361}
1362
1363/* Function start: 0x42E3CF */
1365 signed char updateChildren)
1366{
1367 short savedOwner;
1368 short blocked;
1369 CutscenePlane *savedPlane;
1370 short listSlot;
1371 short objectIndex;
1372
1373 savedOwner = g_nActiveCutsceneResourceLevel;
1374 savedPlane = g_pCurrentCutscenePlane;
1375 blocked = 0;
1376 if (plane == 0)
1377 FatalCutsceneError("A14");
1378 if (plane->waitTicks != 0) {
1380 g_bCutsceneSkipFrame == 0 &&
1381 g_196_nInputTimerTicks < plane->waitStart + plane->waitTicks) {
1382 blocked++;
1383 } else {
1384 plane->waitTicks = 0;
1385 }
1386 }
1390 if (blocked == 0)
1391 RunCutsceneScript(&plane->scriptCursor, 1);
1392 if (updateChildren != 0) {
1393 for (listSlot = 0; listSlot < plane->spriteCount; listSlot++) {
1394 objectIndex = plane->spriteIndices[listSlot];
1396 }
1397 plane->x = (short)(plane->x + plane->deltaX);
1398 plane->y = (short)(plane->y + plane->deltaY);
1399 plane->depth = (short)(plane->depth + plane->deltaDepth);
1400 }
1401 g_pCurrentCutscenePlane = savedPlane;
1402 g_nActiveCutsceneResourceLevel = savedOwner;
1403}
1404
1405/* Function start: 0x42E553 */
1407{
1408 SceneFlicObject *savedSprite;
1409 signed char waiting;
1410
1411 waiting = 0;
1412 if (sprite == 0)
1413 FatalCutsceneError("A15");
1414 if (sprite->delayFrames != 0) {
1415 sprite->delayFrames--;
1416 waiting++;
1417 }
1418 if (sprite->waitTicks != 0) {
1420 g_bCutsceneSkipFrame == 0 &&
1421 g_196_nInputTimerTicks < sprite->waitStart + sprite->waitTicks) {
1422 waiting++;
1423 } else {
1424 sprite->waitTicks = 0;
1425 }
1426 }
1427 if (waiting != 0)
1428 return;
1430 savedSprite = g_pCurrentCutsceneSprite;
1431 g_pCurrentCutsceneSprite = sprite;
1432 if (sprite->field_3 >= 0)
1434 RunCutsceneScript(&sprite->scriptCursor, 0);
1435 sprite->x = (short)(sprite->x + sprite->deltaX);
1436 sprite->y = (short)(sprite->y + sprite->deltaY);
1437 sprite->field_2f = (short)(sprite->field_2f + sprite->deltaDepth);
1438 g_pCurrentCutsceneSprite = savedSprite;
1439}
1440
1441/* Function start: 0x42E692 */
1443 short handlerType)
1444{
1445 SceneFlicObject *object;
1446 void (*handler)(SceneFlicObject *sprite);
1447
1448 switch (handlerType) {
1449 case 0:
1450 object = sprite;
1451 handler = g_apCutsceneSpriteHandlers[object->field_3];
1452 handler(object);
1453 break;
1454 default:
1455 break;
1456 }
1457}
1458
1459void DispatchCutsceneSpriteHandler(SceneFlicObject *sprite, short handlerType);
1460char *GetPackedStringByIndex(CutsceneResourceTable *resources, short index);
1461
1462/* Function start: 0x42E6EB */
1464 short index,
1465 SceneFlicObject *object)
1466{
1467 object->filename = GetPackedStringByIndex(
1468 resources, resources->filenameIndices[index]);
1469 object->nextSection = resources->sectionIndices[index];
1470 object->segmentStartFrame = 0;
1471 object->segmentEndFrame = 0;
1472 object->currentFrame = 0;
1473 object->context = g_nSceneFlicContext;
1474 AdvanceSceneFlicStream(object);
1475}
1476
1477/* Function start: 0x42E762 */
1479{
1480 short cacheIndex;
1481 short objectIndex;
1482 SceneFlicObject *object;
1483
1484 for (cacheIndex = 0; cacheIndex < 15U; cacheIndex++) {
1485 if (g_aSceneFlicCopyTable[cacheIndex].shape != 0) {
1486 for (objectIndex = 0; objectIndex < 128; objectIndex++) {
1487 object = g_apSceneObjects[objectIndex];
1488 if (object != 0 && object->drawType == 4 &&
1489 g_aSceneFlicCopyTable[cacheIndex].shape ==
1490 object->shape) {
1491 object->shape = 0;
1492 object->active = 0;
1493 break;
1494 }
1495 }
1496 }
1497 }
1498 for (cacheIndex = 0; cacheIndex < 15U; cacheIndex++) {
1500 (void **)&g_aSceneFlicCopyTable[cacheIndex].shape);
1502 &g_aSceneFlicCopyTable[cacheIndex].auxiliaryAllocation);
1503 }
1504}
1505
1506/* Function start: 0x42E868 */
1508{
1509 signed char fetch;
1510 char filename[68];
1511 short slot;
1512 short probe;
1513 void *retired;
1514
1515 fetch = 1;
1516 object->decoderState = 0;
1517 if (object->segmentEndFrame <= object->currentFrame) {
1518 if (object->finalFrame <= object->currentFrame) {
1519 object->active = 0;
1521 object->shape = 0;
1522 } else {
1523 if (object->currentFrame != 0) {
1526 }
1527 DosStrcpy(filename, object->filename);
1529 retired = object->shape;
1530 if (retired != 0) {
1531 for (slot = 0; slot < 15U; slot++) {
1532 if (g_aSceneFlicCopyTable[slot].shape ==
1533 retired) {
1534 ReleasePacketSlot(&retired);
1535 g_aSceneFlicCopyTable[slot].shape = 0;
1536 retired =
1538 break;
1539 }
1540 }
1541 }
1542 while (fetch != 0) {
1543 if (g_aSceneFlicCopyTable[0].shape == 0) {
1544 object->shape = 0;
1545 for (slot = 0; slot < 15U; slot++) {
1550 filename,
1551 (short)(object->nextSection + slot),
1552 0, 0x0c, 0, 1);
1553 if (g_aSceneFlicCopyTable[slot].shape ==
1554 0) {
1555 if (slot == 0) {
1557 "FLIC Failed %s (%d)\n Hit Key to Continue",
1558 filename,
1559 object->nextSection + slot);
1561 object->segmentEndFrame = 0;
1562 object->currentFrame = object->finalFrame;
1563 }
1564 fetch = 0;
1565 break;
1566 } else if (g_pMemoryLogFile != 0) {
1567 fprintf(
1569 "Loaded Flic %s (%d) at %Fp\n", filename,
1570 object->nextSection + slot,
1572 }
1573 }
1574 fetch = 0;
1575 }
1576 if (g_aSceneFlicCopyTable[0].shape != 0) {
1577 slot = 0;
1578 if (object->shape != 0) {
1579 while (slot < 15U) {
1580 slot++;
1581 if (g_aSceneFlicCopyTable[slot - 1]
1582 .shape == object->shape)
1583 break;
1584 }
1585 }
1586 if (g_aSceneFlicCopyTable[slot].shape != 0) {
1587 object->shape =
1589 object->decoderState = 0;
1592 object->segmentStartFrame = object->currentFrame;
1593 object->segmentEndFrame =
1594 (short)(GetShapeFrameCount(object->shape) +
1595 object->currentFrame);
1596 object->nextSection++;
1597 fetch = 0;
1598 } else {
1599 for (probe = 0;
1600 probe < slot;
1601 probe++) {
1603 (void **)&g_aSceneFlicCopyTable[
1604 probe].shape);
1605 }
1606 object->shape = 0;
1607 }
1608 }
1609 }
1612 }
1613 }
1614}
1615
1616/* Function start: 0x42EBD0 */
1618 void *packet)
1619{
1620 short scan;
1621 short count;
1622 CutsceneResourceTable *activeResources;
1623 void **packetSlot;
1624
1625 activeResources = FindActiveCutsceneFileResources(resources);
1626 count = activeResources->count;
1627 packetSlot = activeResources->loadedPackets;
1628 for (scan = 0; scan < count; scan++, packetSlot++) {
1629 if (*packetSlot == packet) {
1630 ReleasePacketSlot(packetSlot);
1631 if (g_pMemoryLogFile != 0) {
1632 fprintf(g_pMemoryLogFile,
1633 "--- Dumped (reset): %Fp item: %3d "
1634 "level = %d free = %8lu\n",
1635 packet, (int)scan,
1638 }
1639 break;
1640 }
1641 }
1642}
1643
1644/* Function start: 0x42EC7F */
1658
1659/* Function start: 0x42ECCB */
1660void UpdateMap(char *text, short objective)
1661{
1662 int deadline;
1663
1669 g_cCurrentObjective = (signed char)objective;
1676 ExpandCutsceneText((const unsigned char *)text,
1678 if (IsCutsceneSpeechLoaded() == 0 || g_nAudioEnabled == 0) {
1679 if (memcmp(g_4_pszFilmWorkScratch, "50", 2) != 0)
1681 }
1685 deadline = g_196_nInputTimerTicks + 600;
1686 while ((int)g_196_nInputTimerTicks < deadline &&
1687 g_bCutsceneSkipFrame == 0 &&
1689 if (ServiceInputDevices(-1) != 0) {
1691 if (FindQueuedInputEvent(2) != 0 || FindQueuedInputEvent(5) != 0)
1692 break;
1693 }
1694 }
1696}
1697
1698/* Function start: 0x42EE4F */
1699void AllocateCutsceneViewportOrFatal(Viewport *viewport, short colour,
1700 short flags)
1701{
1702 if ((short)AllocateViewport(viewport, colour, flags) == 0)
1703 FatalCutsceneError("A17");
1704}
1705
1706/* Function start: 0x42EE86 */
1708{
1709 signed char release;
1710
1711 release = 1;
1712 if (viewport->pixels != 0) {
1713 switch (g_cCutsceneVideoMode) {
1714 case 0x0d:
1715 case 0x13:
1716 if (GetDIBPixelBuffer() != viewport->pixels)
1717 release++;
1718 break;
1719 default:
1720 release++;
1721 break;
1722 }
1723 if (release != 0) {
1724 free_viewport(viewport);
1725 viewport->pixels = 0;
1726 }
1727 }
1728}
1729
1730#pragma function(strcpy)
1731/* Function start: 0x42EF12 */
1732void DrawCinematicMemoryStatus(const char *message)
1733{
1734 unsigned int farMemory;
1735 char text[256];
1736 unsigned int largest;
1737 Viewport viewport;
1738 unsigned int memory;
1739
1740 viewport = g_2_stModalSourceWindow;
1741 if ((g_cCutsceneVideoMode == 0x13 ||
1742 g_cCutsceneVideoMode == 0x0d) &&
1743 g_cShowMemoryStatus != 0) {
1744 if (*message != '~') {
1749 }
1750 largest = GetLargestMainMemoryBlock();
1751 memory = GetAvailableMainMemory();
1752 farMemory = GetAvailableFarMemory();
1753 if (*message != '~') {
1754 sprintf(text,
1755 "%s Far: %lu (Lg) = %lu EMS: %lu\n"
1756 "OVR: %lu INITIAL: %lu",
1757 message, memory, largest,
1758 farMemory,
1761 } else {
1762 strcpy(text, "Game Paused");
1763 }
1773 FormatTextBufferFromStart("%s%P", text);
1777 viewport.top = 0;
1778 viewport.bottom =
1780 ClearViewport(&viewport, 0);
1781 }
1782}
1783
1784/* Function start: 0x42F0B3 */
1785void FormatCinematicMemoryStatus(const char *format, ...)
1786{
1787 va_list marker;
1788 char text[256];
1789
1790 va_start(marker, format);
1791 vsprintf(text, format, marker);
1793 va_end(marker);
1794}
1795
1796/* Function start: 0x42F100 */
1798 short section,
1799 unsigned int packetSize)
1800{
1801 if (g_cCutsceneVideoMode == 0x13) {
1803 "Alloc Failed %s (%d) size=%ld\n",
1804 filename, section, packetSize);
1805 }
1806}
1807
1808/* Function start: 0x42F135 */
1809short PopCutsceneScriptValue(short **stack, short *stackBottom)
1810{
1811 int current;
1812 short *top;
1813 int limit;
1814
1815 top = *stack;
1816 current = DosFarPtrToNear(top);
1817 limit = DosFarPtrToNear(stackBottom);
1818 if (limit <= current)
1819 FatalCutsceneError("A18");
1820 top++;
1821 *stack = top;
1822 return top[-1];
1823}
1824
1825/* Function start: 0x42F19A */
1826void PushCutsceneScriptValue(short **stack, short *stackTop,
1827 short value)
1828{
1829 int current;
1830 short *cell;
1831 int topAddress;
1832
1833 cell = *stack;
1834 current = DosFarPtrToNear(cell);
1835 topAddress = DosFarPtrToNear(stackTop);
1836 if (topAddress >= current)
1837 FatalCutsceneError("A19");
1838 cell--;
1839 *cell = value;
1840 *stack = cell;
1841}
1842
1843/* Function start: 0x42F1FD */
1844signed char RunCutsceneScript(unsigned char **scriptCursor,
1845 short objectType)
1846{
1847 unsigned char *scriptBytes;
1848 short opcode;
1849 short scriptValueStack[10];
1850 short secondaryOperand;
1851 short value;
1852 short *scriptLocal;
1853 short baseValue;
1854 int inputSeen;
1855 /* Retail reserves 100 unreferenced bytes between topOperand and
1856 * scriptBytes. The original declaration and purpose are unknown. */
1857 unsigned char unreferencedFrameStorage[100];
1858 short *topOperand;
1859 signed char protectCondition;
1860 signed char shouldContinue;
1861
1862 scriptBytes = *scriptCursor;
1863 protectCondition = 1;
1864 shouldContinue = 1;
1865 topOperand = scriptValueStack + 10;
1866 inputSeen = 0;
1867 if (scriptBytes == 0)
1869 "ERROR: Running script for UNLINKED EXTERNAL (%s)",
1870 g_apszCutsceneObjectTypeNames[objectType]);
1871 if (g_pCurrentCutsceneSprite == 0) {
1876 scriptSymbolIndices[0]];
1877 }
1878 if (g_pCurrentCutscenePlane == 0 &&
1881 scriptSymbolIndices != 0) {
1886 scriptSymbolIndices[0]];
1887 }
1888 if (g_pCurrentCutsceneSequence == 0 &&
1891 scriptSymbolIndices != 0) {
1896 scriptSymbolIndices[0]];
1897 }
1898 for (;;) {
1899 if (g_bCutsceneSkipAll != 0)
1901 if (g_bCutsceneSkipFrame == 0 &&
1903 if (ServiceInputDevices(-1) != 0) {
1906 if (g_19_pFilmInputFlag != 0) {
1907 switch (g_19_pFilmInputFlag->status) {
1908 case 2:
1910 goto cutscene_input_processed;
1911 case 3:
1913 goto cutscene_input_processed;
1914 case 4:
1916 goto cutscene_input_processed;
1917 case 5:
1919 goto cutscene_input_processed;
1920 case 6:
1922 goto cutscene_input_processed;
1923 case 0x19:
1926 0x1800) == 0) {
1928 } else {
1930 }
1931 goto cutscene_input_processed;
1932 case 0x11:
1935 0x1800) != 0) {
1937 "Series: %d Mission: %c Talk: %d\n",
1941 }
1942 goto cutscene_input_processed;
1943 }
1944 }
1945 if (g_wDigiPlaying == 0 &&
1946 (FindQueuedInputEvent(4) != 0 ||
1947 FindQueuedInputEvent(1) != 0)) {
1950 if (g_bSceneEscapeRequested != 0) {
1956 return 0;
1957 }
1963 inputSeen = 1;
1964 }
1965 }
1966cutscene_input_processed:
1967 if (g_wDigiPlaying == 0 &&
1968 TakeInputPressCount() != 0 && inputSeen == 0) {
1971 if (g_bSceneEscapeRequested != 0) {
1977 return 0;
1978 }
1985 }
1986 if (objectType == 2 &&
1991 }
1992 if (objectType == 2 &&
1993 g_bCutsceneSkipFrame != 0) {
1995 }
1996 } else if (g_bCutsceneSkipFrame != 0) {
1997 /* The Win32 build retains the DOS release-input branch test. */
1998 }
1999 opcode = *scriptBytes++;
2000 switch (opcode) {
2001 case 0x07:
2002 *topOperand = (short)(*topOperand == 0);
2003 break;
2004 case 0x05:
2005 value = PopCutsceneScriptValue(&topOperand, scriptValueStack + 10);
2006 *topOperand = (short)(*topOperand != 0 && value != 0);
2007 break;
2008 case 0x06:
2009 value = PopCutsceneScriptValue(&topOperand, scriptValueStack + 10);
2010 *topOperand = (short)(*topOperand != 0 || value != 0);
2011 break;
2012 case 0x00:
2013 value = PopCutsceneScriptValue(&topOperand, scriptValueStack + 10);
2014 *topOperand = (short)(*topOperand + value);
2015 break;
2016 case 0x01:
2017 value = PopCutsceneScriptValue(&topOperand, scriptValueStack + 10);
2018 *topOperand = (short)(*topOperand - value);
2019 break;
2020 case 0x02:
2021 value = PopCutsceneScriptValue(&topOperand, scriptValueStack + 10);
2022 *topOperand = (short)(*topOperand * value);
2023 break;
2024 case 0x03:
2025 value = PopCutsceneScriptValue(&topOperand, scriptValueStack + 10);
2026 *topOperand = (short)(*topOperand / value);
2027 break;
2028 case 0x04:
2029 value = PopCutsceneScriptValue(&topOperand, scriptValueStack + 10);
2030 *topOperand = (short)(*topOperand % value);
2031 break;
2032 case 0x0b:
2033 value = PopCutsceneScriptValue(&topOperand, scriptValueStack + 10);
2034 *topOperand = (short)(*topOperand & value);
2035 break;
2036 case 0x0c:
2037 value = PopCutsceneScriptValue(&topOperand, scriptValueStack + 10);
2038 *topOperand = (short)(*topOperand | value);
2039 break;
2040 case 0x0d:
2041 value = PopCutsceneScriptValue(&topOperand, scriptValueStack + 10);
2042 *topOperand = (short)(*topOperand ^ value);
2043 break;
2044 case 0x09:
2045 value = PopCutsceneScriptValue(&topOperand, scriptValueStack + 10);
2046 *topOperand <<= value;
2047 break;
2048 case 0x0a:
2049 value = PopCutsceneScriptValue(&topOperand, scriptValueStack + 10);
2050 *topOperand >>= value;
2051 break;
2052 case 0x08:
2053 secondaryOperand = PopCutsceneScriptValue(
2054 &topOperand, scriptValueStack + 10);
2055 baseValue = PopCutsceneScriptValue(
2056 &topOperand, scriptValueStack + 10);
2057 PushCutsceneScriptValue(&topOperand, scriptValueStack,
2058 RandomInRange((unsigned short)baseValue,
2059 (unsigned short)secondaryOperand));
2060 break;
2061 case 0x0f:
2062 value = PopCutsceneScriptValue(&topOperand, scriptValueStack + 10);
2063 if (protectCondition == 0 &&
2064 g_bCutsceneSkipFrame != 0 &&
2066 value = 0;
2067 }
2068 if (g_bCutsceneSkipAll != 0)
2069 value = 0;
2070 if (value == 0) {
2071 g_2_nCutsceneForkOffsetNumber = *(short *)scriptBytes;
2072 scriptBytes += g_2_nCutsceneForkOffsetNumber;
2073 } else {
2074 scriptBytes += 2;
2075 }
2076 break;
2077 case 0x10:
2078 case 0x11:
2079 case 0x12:
2080 case 0x13:
2081 case 0x14:
2082 case 0x15:
2083 case 0x16:
2084 value = PopCutsceneScriptValue(&topOperand, scriptValueStack + 10);
2085 if (protectCondition == 0 &&
2086 g_bCutsceneSkipFrame != 0 &&
2088 value = 1;
2089 }
2090 if (g_bCutsceneSkipAll != 0)
2091 value = 0;
2092 if (value == 1) {
2093 g_2_nCutsceneForkOffsetNumber = *(short *)scriptBytes;
2094 scriptBytes += g_2_nCutsceneForkOffsetNumber;
2095 } else {
2096 scriptBytes += 2;
2097 }
2098 break;
2099 case 0x0e:
2100 g_2_nCutsceneForkOffsetNumber = *(short *)scriptBytes;
2101 scriptBytes += g_2_nCutsceneForkOffsetNumber;
2102 break;
2103 case 0x17:
2104 value = PopCutsceneScriptValue(&topOperand, scriptValueStack + 10);
2105 *topOperand = *topOperand >= value ? 0 : 1;
2106 break;
2107 case 0x18:
2108 value = PopCutsceneScriptValue(&topOperand, scriptValueStack + 10);
2109 *topOperand = (short)(*topOperand > value);
2110 break;
2111 case 0x19:
2112 value = PopCutsceneScriptValue(&topOperand, scriptValueStack + 10);
2113 *topOperand = *topOperand > value ? 0 : 1;
2114 break;
2115 case 0x1a:
2116 value = PopCutsceneScriptValue(&topOperand, scriptValueStack + 10);
2117 *topOperand = (short)(*topOperand >= value);
2118 break;
2119 case 0x1b:
2120 value = PopCutsceneScriptValue(&topOperand, scriptValueStack + 10);
2121 *topOperand = (short)(*topOperand == value);
2122 break;
2123 case 0x1c:
2124 value = PopCutsceneScriptValue(&topOperand, scriptValueStack + 10);
2125 *topOperand = (short)(*topOperand != value);
2126 break;
2127 case 0x1d:
2128 *topOperand = (short)(*topOperand == 0);
2129 break;
2130 case 0x1e:
2131 *topOperand = (short)(*topOperand != 0);
2132 break;
2133 case 0x1f:
2138 scriptSymbolIndices[*scriptBytes++]];
2139 if (g_pCurrentCutsceneSprite == 0)
2140 FatalCutsceneError("A21");
2141 break;
2142 case 0x20:
2147 scriptSymbolIndices[*scriptBytes++]];
2148 if (g_pCurrentCutscenePlane == 0)
2149 FatalCutsceneError("A22");
2150 break;
2151 case 0x21:
2156 scriptSymbolIndices[*scriptBytes++]];
2157 if (g_pCurrentCutscenePlane == 0)
2158 FatalCutsceneError("A23");
2159 break;
2160 case 0x8a:
2166 scriptSymbolIndices[*scriptBytes++]];
2167 if (g_pLinkedCutsceneSprite == 0)
2168 FatalCutsceneError("A24");
2170 break;
2171 case 0x9e:
2172 g_nSceneFlicContext = *scriptBytes++;
2173 break;
2174 case 0x77:
2175 value = *scriptBytes++;
2177 value, 2, 0, "Cannot Allocate Loacls Data");
2178 switch (objectType) {
2179 case 0:
2180 if (g_pCurrentCutsceneSprite == 0)
2181 FatalCutsceneError("A25");
2187 else
2189 break;
2190 case 1:
2191 if (g_pCurrentCutscenePlane == 0)
2192 FatalCutsceneError("A26");
2197 break;
2198 case 2:
2200 FatalCutsceneError("A27");
2205 break;
2206 }
2207 break;
2208 case 0x7d:
2210 break;
2211 case 0x7e: {
2212 int waitUntil;
2213
2214 waitUntil = g_196_nInputTimerTicks +
2215 PopCutsceneScriptValue(&topOperand, scriptValueStack + 10);
2216 while (g_196_nInputTimerTicks < waitUntil &&
2217 g_bCutsceneSkipFrame == 0 &&
2219 if (ServiceInputDevices(-1) != 0) {
2221 if (FindQueuedInputEvent(2) != 0 ||
2222 FindQueuedInputEvent(5) != 0) {
2223 break;
2224 }
2225 }
2226 }
2227 break;
2228 }
2229 case 0x7f:
2231 (short)(signed char)*scriptBytes++;
2235 }
2241 (short)(g_4_nCutsceneResourceScratchValue + 0x7d);
2244 (short)(g_4_nCutsceneResourceScratchValue + 0x7e);
2263 break;
2264 case 0x80:
2286 break;
2287 case 0xb8:
2288 protectCondition = (signed char)PopCutsceneScriptValue(
2289 &topOperand, scriptValueStack + 10);
2290 protectCondition = 1;
2291 break;
2292 case 0x22:
2293 shouldContinue = 0;
2294 break;
2295 case 0x23:
2296 *scriptCursor = scriptBytes;
2297 return 0;
2298 case 0x24:
2299 PushCutsceneScriptValue(&topOperand, scriptValueStack,
2300 (short)(signed char)*scriptBytes++);
2301 break;
2302 case 0x25:
2303 /* The original word cursor uses MSVC's pointer aliasing. */
2304 PushCutsceneScriptValue(&topOperand, scriptValueStack,
2305 *(*(short **)&scriptBytes)++);
2306 break;
2307 case 0x26:
2308 if (g_pCampaignGlobals == 0)
2309 FatalCutsceneError("A28");
2310 value = 0;
2311 while (*scriptBytes == 0xff) {
2312 value = (short)(value + *scriptBytes++);
2313 }
2314 value = (short)(value + *scriptBytes++);
2315 PushCutsceneScriptValue(&topOperand, scriptValueStack,
2316 ((short *)g_pCampaignGlobals)[value]);
2317 break;
2318 case 0xae:
2319 value = *scriptBytes++;
2320 switch (value) {
2321 case 0:
2323 PopCutsceneScriptValue(&topOperand, scriptValueStack + 10);
2324 break;
2325 case 1:
2327 PopCutsceneScriptValue(&topOperand, scriptValueStack + 10);
2328 break;
2329 case 2:
2331 PopCutsceneScriptValue(&topOperand, scriptValueStack + 10);
2332 break;
2333 case 3:
2335 PopCutsceneScriptValue(&topOperand, scriptValueStack + 10);
2336 break;
2337 }
2339 break;
2340 case 0xaf:
2341 g_29_pCurrentTextContext->alignment = *scriptBytes++;
2342 break;
2343 case 0x28:
2344 if (g_pCampaignGlobals == 0)
2345 FatalCutsceneError("A29");
2346 value = 0;
2347 while (*scriptBytes == 0xff) {
2348 value = (short)(value + *scriptBytes++);
2349 }
2350 value = (short)(value + *scriptBytes++);
2351 ((short *)g_pCampaignGlobals)[value] =
2352 PopCutsceneScriptValue(&topOperand, scriptValueStack + 10);
2353 break;
2354 case 0x27:
2355 if (g_pCampaignGlobals == 0)
2356 FatalCutsceneError("A30");
2357 value = *(short *)scriptBytes;
2358 scriptBytes += 2;
2359 value = (short)(value + PopCutsceneScriptValue(
2360 &topOperand, scriptValueStack + 10));
2361 PushCutsceneScriptValue(&topOperand, scriptValueStack,
2362 ((short *)g_pCampaignGlobals)[value]);
2363 break;
2364 case 0x29:
2365 if (g_pCampaignGlobals == 0)
2366 FatalCutsceneError("A31");
2367 value = *(short *)scriptBytes;
2368 scriptBytes += 2;
2369 value = (short)(value + PopCutsceneScriptValue(
2370 &topOperand, scriptValueStack + 10));
2371 ((short *)g_pCampaignGlobals)[value] =
2372 PopCutsceneScriptValue(&topOperand, scriptValueStack + 10);
2373 break;
2374 case 0x2a:
2378 else
2380 break;
2381 case 0x2b:
2384 else
2387 break;
2388 case 0x2c:
2389 PushCutsceneScriptValue(&topOperand, scriptValueStack,
2391 break;
2392 case 0x2d:
2393 PushCutsceneScriptValue(&topOperand, scriptValueStack,
2395 break;
2396 case 0x2e:
2397 PushCutsceneScriptValue(&topOperand, scriptValueStack,
2399 break;
2400 case 0x30:
2401 PushCutsceneScriptValue(&topOperand, scriptValueStack,
2403 break;
2404 case 0x31:
2405 PushCutsceneScriptValue(&topOperand, scriptValueStack,
2407 break;
2408 case 0x32:
2409 PushCutsceneScriptValue(&topOperand, scriptValueStack,
2411 break;
2412 case 0x2f:
2413 PushCutsceneScriptValue(&topOperand, scriptValueStack,
2415 break;
2416 case 0x33:
2417 PushCutsceneScriptValue(&topOperand, scriptValueStack,
2419 break;
2420 case 0x34:
2421 PushCutsceneScriptValue(&topOperand, scriptValueStack,
2423 break;
2424 case 0x35:
2425 PushCutsceneScriptValue(&topOperand, scriptValueStack,
2427 break;
2428 case 0x36:
2429 PushCutsceneScriptValue(&topOperand, scriptValueStack,
2431 break;
2432 case 0x37:
2433 PushCutsceneScriptValue(&topOperand, scriptValueStack,
2435 break;
2436 case 0x38:
2437 PushCutsceneScriptValue(&topOperand, scriptValueStack,
2439 break;
2440 case 0x39:
2441 PushCutsceneScriptValue(&topOperand, scriptValueStack,
2443 break;
2444 case 0x3d:
2445 PushCutsceneScriptValue(&topOperand, scriptValueStack,
2446 g_pCurrentCutsceneSprite->locals[*scriptBytes++]);
2447 break;
2448 case 0x3a:
2449 PushCutsceneScriptValue(&topOperand, scriptValueStack,
2451 break;
2452 case 0x3b:
2453 PushCutsceneScriptValue(&topOperand, scriptValueStack,
2455 break;
2456 case 0x3c:
2457 PushCutsceneScriptValue(&topOperand, scriptValueStack,
2459 break;
2460 case 0x3e:
2461 g_pCurrentCutsceneSprite->active = (signed char)
2462 PopCutsceneScriptValue(&topOperand, scriptValueStack + 10);
2463 break;
2464 case 0x41:
2466 PopCutsceneScriptValue(&topOperand, scriptValueStack + 10);
2467 break;
2468 case 0x3f:
2469 g_pCurrentCutsceneSprite->visible = (signed char)
2470 PopCutsceneScriptValue(&topOperand, scriptValueStack + 10);
2471 break;
2472 case 0x40:
2474 PopCutsceneScriptValue(&topOperand, scriptValueStack + 10);
2475 break;
2476 case 0x42:
2478 PopCutsceneScriptValue(&topOperand, scriptValueStack + 10);
2479 break;
2480 case 0x43:
2482 PopCutsceneScriptValue(&topOperand, scriptValueStack + 10);
2483 break;
2484 case 0x44:
2485 value = PopCutsceneScriptValue(&topOperand, scriptValueStack + 10);
2486 if (g_bCutsceneSkipFrame != 0)
2487 value = 0;
2491 if (objectType == 0) {
2492 *scriptCursor = scriptBytes;
2493 return shouldContinue;
2494 }
2495 break;
2496 case 0x45:
2498 PopCutsceneScriptValue(&topOperand, scriptValueStack + 10);
2499 break;
2500 case 0x46:
2502 PopCutsceneScriptValue(&topOperand, scriptValueStack + 10);
2503 break;
2504 case 0x47:
2506 PopCutsceneScriptValue(&topOperand, scriptValueStack + 10);
2507 break;
2508 case 0x48:
2510 PopCutsceneScriptValue(&topOperand, scriptValueStack + 10);
2511 break;
2512 case 0x49:
2514 PopCutsceneScriptValue(&topOperand, scriptValueStack + 10);
2515 break;
2516 case 0x4a:
2518 PopCutsceneScriptValue(&topOperand, scriptValueStack + 10);
2519 break;
2520 case 0x4b:
2522 (unsigned short)PopCutsceneScriptValue(
2523 &topOperand, scriptValueStack + 10);
2524 break;
2525 case 0x4f:
2526 g_pCurrentCutsceneSprite->locals[*scriptBytes++] =
2527 PopCutsceneScriptValue(&topOperand, scriptValueStack + 10);
2528 break;
2529 case 0x4c:
2530 g_pCurrentCutsceneSprite->deltaX = (signed char)
2531 PopCutsceneScriptValue(&topOperand, scriptValueStack + 10);
2532 break;
2533 case 0x4d:
2534 g_pCurrentCutsceneSprite->deltaY = (signed char)
2535 PopCutsceneScriptValue(&topOperand, scriptValueStack + 10);
2536 break;
2537 case 0x4e:
2538 g_pCurrentCutsceneSprite->deltaDepth = (signed char)
2539 PopCutsceneScriptValue(&topOperand, scriptValueStack + 10);
2540 break;
2541 case 0xab:
2542 PushCutsceneScriptValue(&topOperand, scriptValueStack,
2544 break;
2545 case 0x50:
2546 PushCutsceneScriptValue(&topOperand, scriptValueStack,
2548 break;
2549 case 0x51:
2550 PushCutsceneScriptValue(&topOperand, scriptValueStack,
2552 break;
2553 case 0x52:
2554 PushCutsceneScriptValue(&topOperand, scriptValueStack,
2556 break;
2557 case 0x53:
2558 PushCutsceneScriptValue(&topOperand, scriptValueStack,
2560 break;
2561 case 0x54:
2562 PushCutsceneScriptValue(&topOperand, scriptValueStack,
2564 break;
2565 case 0x55:
2566 PushCutsceneScriptValue(&topOperand, scriptValueStack,
2568 break;
2569 case 0x56:
2570 PushCutsceneScriptValue(&topOperand, scriptValueStack,
2572 break;
2573 case 0x58:
2574 PushCutsceneScriptValue(&topOperand, scriptValueStack,
2576 break;
2577 case 0x57:
2578 PushCutsceneScriptValue(&topOperand, scriptValueStack,
2579 g_pCurrentCutscenePlane->locals[*scriptBytes++]);
2580 break;
2581 case 0x59:
2582 PushCutsceneScriptValue(&topOperand, scriptValueStack,
2584 break;
2585 case 0x5a:
2586 PushCutsceneScriptValue(&topOperand, scriptValueStack,
2588 break;
2589 case 0x5b:
2590 PushCutsceneScriptValue(&topOperand, scriptValueStack,
2592 break;
2593 case 0x5c:
2594 g_pCurrentCutscenePlane->active = (signed char)
2595 PopCutsceneScriptValue(&topOperand, scriptValueStack + 10);
2596 break;
2597 case 0x5d:
2598 g_pCurrentCutscenePlane->visible = (signed char)
2599 PopCutsceneScriptValue(&topOperand, scriptValueStack + 10);
2600 break;
2601 case 0x5e:
2603 PopCutsceneScriptValue(&topOperand, scriptValueStack + 10);
2604 break;
2605 case 0x5f:
2607 PopCutsceneScriptValue(&topOperand, scriptValueStack + 10);
2608 break;
2609 case 0x60:
2611 PopCutsceneScriptValue(&topOperand, scriptValueStack + 10);
2612 break;
2613 case 0x61:
2615 PopCutsceneScriptValue(&topOperand, scriptValueStack + 10);
2616 break;
2617 case 0x62:
2619 PopCutsceneScriptValue(&topOperand, scriptValueStack + 10);
2620 break;
2621 case 0x64:
2623 (unsigned short)PopCutsceneScriptValue(
2624 &topOperand, scriptValueStack + 10);
2625 break;
2626 case 0x63:
2627 g_pCurrentCutscenePlane->locals[*scriptBytes++] =
2628 PopCutsceneScriptValue(&topOperand, scriptValueStack + 10);
2629 break;
2630 case 0x65:
2631 g_pCurrentCutscenePlane->deltaX = (signed char)
2632 PopCutsceneScriptValue(&topOperand, scriptValueStack + 10);
2633 break;
2634 case 0x66:
2635 g_pCurrentCutscenePlane->deltaY = (signed char)
2636 PopCutsceneScriptValue(&topOperand, scriptValueStack + 10);
2637 break;
2638 case 0x67:
2639 g_pCurrentCutscenePlane->deltaDepth = (signed char)
2640 PopCutsceneScriptValue(&topOperand, scriptValueStack + 10);
2641 break;
2642 case 0xaa:
2643 value = PopCutsceneScriptValue(&topOperand, scriptValueStack + 10);
2644 if (g_bCutsceneSkipFrame != 0)
2645 value = 0;
2649 if (objectType == 1) {
2650 *scriptCursor = scriptBytes;
2651 return shouldContinue;
2652 }
2653 break;
2654 case 0x71:
2655 g_pCurrentCutsceneSequence->locals[*scriptBytes++] =
2656 PopCutsceneScriptValue(&topOperand, scriptValueStack + 10);
2657 break;
2658 case 0x70:
2659 PushCutsceneScriptValue(&topOperand, scriptValueStack,
2660 g_pCurrentCutsceneSequence->locals[*scriptBytes++]);
2661 break;
2662 case 0x68:
2663 PushCutsceneScriptValue(&topOperand, scriptValueStack,
2665 break;
2666 case 0x69:
2667 g_pCurrentCutsceneSequence->active = (signed char)
2668 PopCutsceneScriptValue(&topOperand, scriptValueStack + 10);
2669 break;
2670 case 0x6a:
2671 if (g_bCutsceneSkipFrame != 0)
2673 PushCutsceneScriptValue(&topOperand, scriptValueStack,
2675 break;
2676 case 0x6b:
2677 value = PopCutsceneScriptValue(&topOperand, scriptValueStack + 10);
2678 if (value != 0 && g_bCutsceneSkipFrame == 0) {
2679 while (g_196_nInputTimerTicks <
2683 }
2684 }
2688 break;
2689 case 0x81:
2690 value = PopCutsceneScriptValue(&topOperand, scriptValueStack + 10);
2691 if (g_cCutsceneVideoMode == 0x0d)
2692 value = g_abCutscenePaletteTranslation[value];
2693 g_2_stCutsceneMessageCtxInfo.colour = (unsigned char)value;
2694 break;
2695 case 0x8b:
2696 value = PopCutsceneScriptValue(&topOperand, scriptValueStack + 10);
2697 if (g_bCutsceneSkipFrame == 0 &&
2701 (unsigned char)value);
2704 MarkDibDirty();
2705 DIBslamReal();
2708 }
2709 break;
2710 case 0x8c:
2711 value = PopCutsceneScriptValue(&topOperand, scriptValueStack + 10);
2714 &g_2_stModalSourceWindow, value, 1);
2717 (unsigned char)value);
2718 MarkDibDirty();
2719 DIBslamReal();
2721 break;
2722 case 0xb3:
2723 secondaryOperand = PopCutsceneScriptValue(
2724 &topOperand, scriptValueStack + 10);
2725 baseValue = PopCutsceneScriptValue(
2726 &topOperand, scriptValueStack + 10);
2728 PopCutsceneScriptValue(&topOperand, scriptValueStack + 10);
2729 g_3_nCutsceneTextIdx = *(short *)scriptBytes;
2730 scriptBytes += 2;
2735 (unsigned char *)g_4_pszFilmSourceText,
2737 DrawCutsceneTextAt(baseValue, secondaryOperand, 4,
2739 break;
2740 case 0x6f:
2741 g_3_nCutsceneTextIdx = *(short *)scriptBytes;
2742 scriptBytes += 2;
2747 (unsigned char *)g_4_pszFilmSourceText,
2751 break;
2752 case 0xb4:
2754 PopCutsceneScriptValue(&topOperand, scriptValueStack + 10);
2755 break;
2756 case 0x6e:
2757 secondaryOperand = PopCutsceneScriptValue(
2758 &topOperand, scriptValueStack + 10);
2759 baseValue = PopCutsceneScriptValue(
2760 &topOperand, scriptValueStack + 10);
2761 value = *scriptBytes++;
2762 DrawCutsceneTextAt(baseValue, secondaryOperand, value,
2764 break;
2765 case 0xad:
2769 scriptSymbolIndices[*scriptBytes++]]);
2770 break;
2771 case 0x94:
2772 value = PopCutsceneScriptValue(&topOperand, scriptValueStack + 10);
2773 switch (*scriptBytes++) {
2774 case 0:
2777 (unsigned char)value);
2778 break;
2779 case 1:
2781 (unsigned char)value);
2782 break;
2783 case 2:
2785 (unsigned char)value);
2786 break;
2787 case 3:
2790 (unsigned char)value);
2791 break;
2792 case 4:
2794 (unsigned char)value);
2795 break;
2796 }
2797 break;
2798 case 0xa3:
2800 &topOperand, scriptValueStack,
2801 (short)(signed char)g_nOriginDevUnlock);
2802 break;
2803 case 0x9d:
2804 value = 0;
2805 if (g_bCutsceneSkipFrame != 0)
2806 value = 1;
2807 if (g_bCutsceneSkipAll != 0)
2808 value = 2;
2809 PushCutsceneScriptValue(&topOperand, scriptValueStack, value);
2810 break;
2811 case 0xa4:
2812 value = PopCutsceneScriptValue(&topOperand, scriptValueStack + 10);
2813 switch (value) {
2814 case -2:
2817 break;
2818 case -1:
2820 break;
2821 case 0:
2826 break;
2827 case 1:
2831 break;
2832 }
2833 break;
2834 case 0x9b:
2835 PushCutsceneScriptValue(&topOperand, scriptValueStack,
2837 break;
2838 case 0x9c:
2839 PushCutsceneScriptValue(&topOperand, scriptValueStack,
2841 break;
2842 case 0xa2:
2843 value = PopCutsceneScriptValue(&topOperand, scriptValueStack + 10);
2844 LoadCutsceneSpeechSlot(*scriptBytes++, value);
2847 break;
2848 case 0xb0: {
2849 while (g_wDigiPlaying != 0) {
2851 }
2852 value = PopCutsceneScriptValue(&topOperand, scriptValueStack + 10);
2853 if (g_3_apSceneSpeechPacketsList[value] != 0 &&
2854 g_12_apszMovieSpeechFiles[value] != 0) {
2858 } else if (g_12_apszMovieSpeechFiles[value] != 0) {
2867 }
2868 g_12_apszMovieSpeechFiles[value] = 0;
2870 break;
2871 }
2872 case 0xa9:
2873 value = 0;
2874 if ((g_aObjectTypeData[
2876 damageCapacity >> 1) - 1 <=
2878 value++;
2879 }
2880 PushCutsceneScriptValue(&topOperand, scriptValueStack, value);
2881 break;
2882 case 0x96:
2884 break;
2885 case 0x82:
2890 *scriptBytes++, 1);
2892 (signed char)*scriptBytes++;
2895 break;
2896 case 0x9f:
2897 g_cCutsceneSoundVolume = (signed char)
2898 PopCutsceneScriptValue(&topOperand, scriptValueStack + 10);
2899 break;
2900 case 0x91:
2901 value = *scriptBytes++;
2903 "VAL=========================================%d\n",
2904 (int)value);
2905 if (g_bCutsceneSkipFrame == 0 &&
2908 MapCutsceneSoundEffectNumber((int)value),
2909 -1, 0);
2910 }
2911 PopCutsceneScriptValue(&topOperand, scriptValueStack + 10);
2912 break;
2913 case 0x93:
2914 value = (signed char)*scriptBytes++;
2916 break;
2917 case 0x84:
2918 value = *scriptBytes++;
2919 if ((g_nMusicDriverMode == 1 ||
2920 g_nMusicDriverMode == 2) &&
2927 g_pCutsceneFxResources), value, 3);
2928 SoundDebugPrintf("LOAD FX val=%d\n", (int)value);
2929 }
2930 break;
2931 case 0x98:
2934 break;
2935 case 0xb2:
2936 value = *scriptBytes++;
2937 if ((g_nMusicDriverMode == 1 ||
2938 g_nMusicDriverMode == 2) &&
2940 FadeMusic(value);
2941 }
2942 break;
2943 case 0x90:
2944 if (g_pSceneMusicPacket != 0)
2945 StopMusic(0);
2946 value = *scriptBytes++;
2947 if (g_bCutsceneSkipFrame != 0 ||
2949 break;
2951 StartInteractiveMusic(value);
2952 break;
2953 case 0x92:
2954 StopMusic(*(*(short **)&scriptBytes)++);
2956 break;
2957 case 0x85:
2958 value = *scriptBytes++;
2959 break;
2960 case 0x97:
2962 &g_pCutsceneMusicPackets, *scriptBytes++);
2963 break;
2964 case 0x83:
2966 scriptBytes += 3;
2967 } else {
2968 unsigned char paletteIndex;
2969 short colourEntries;
2970 unsigned char firstColour;
2971
2972 paletteIndex = *scriptBytes++;
2979 paletteIndex, 1);
2980 firstColour = *scriptBytes++;
2981 colourEntries = (short)(*scriptBytes++ + 1);
2982 ConsumeCutscenePalettePacket(firstColour, colourEntries, 0);
2985 paletteIndex);
2987 break;
2988 }
2989 /* A preallocated viewport falls through to the frame check. */
2990 case 0x7c:
2993 break;
2994 while (g_196_nInputTimerTicks <
2997 }
3000 if (g_pMemoryLogFile != 0)
3004 if (g_nCutsceneFrameDelay != 0) {
3008 }
3009 break;
3010 case 0x6d:
3011 if (g_bCutsceneDrawingEnabled == 0 &&
3012 (g_bCutsceneSkipFrame != 0 ||
3014 scriptBytes++;
3015 break;
3016 }
3017 value = *scriptBytes++;
3019 if (value != 0xff) {
3022 scriptSymbolIndices[value];
3025 } else if (g_pCurrentCutsceneSprite != 0) {
3028 }
3031 break;
3032 case 0x6c:
3033 if (g_bCutsceneDrawingEnabled == 0 &&
3034 (g_bCutsceneSkipFrame != 0 ||
3036 scriptBytes++;
3037 break;
3038 }
3039 value = *scriptBytes++;
3040 if (value != 0xff) {
3043 scriptSymbolIndices[value];
3046 } else if (g_pCurrentCutscenePlane != 0) {
3049 }
3050 break;
3051 case 0x86:
3052 g_bCutsceneDrawingEnabled = (signed char)
3053 PopCutsceneScriptValue(&topOperand, scriptValueStack + 10);
3054 break;
3055 case 0xb9:
3056 value = PopCutsceneScriptValue(&topOperand, scriptValueStack + 10);
3057 g_3_nCutsceneTextIdx = *(short *)scriptBytes;
3058 scriptBytes += 2;
3062 if (g_pMemoryLogFile != 0) {
3063 fprintf(g_pMemoryLogFile,
3064 "%%%%%% ELOG: %Fs = %d\n",
3065 g_4_pszFilmSourceText, value);
3066 }
3067 break;
3068 case 0xb1:
3069 value = *(short *)scriptBytes;
3070 scriptBytes += 2;
3071 if (g_pMemoryLogFile != 0) {
3072 fprintf(g_pMemoryLogFile,
3073 "@@@@@@@@@@@@@@@@ Logged: %d\n", value);
3075 }
3076 break;
3077 case 0xa1:
3080 break;
3081 case 0x95:
3082 g_cCutsceneTextStyle = (signed char)*scriptBytes++;
3083 break;
3084 case 0x89: {
3085 unsigned char filmNumber;
3086 CutsceneResourceTable *savedFilmResources;
3087 void *packet;
3088
3089 g_nSceneFlicContext = 0x40;
3090 filmNumber = *scriptBytes++;
3094 g_pCutsceneFilmResources), filmNumber, 0);
3095 savedFilmResources = g_pCutsceneFilmResources;
3101 ParseCutsceneContainer(packet);
3110 scriptSymbolIndices[0]]);
3113 g_pCutsceneFilmResources = savedFilmResources;
3120 g_pCutsceneFilmResources), filmNumber);
3122 }
3123 break;
3124 }
3125 case 0x88:
3130 scriptSymbolIndices[*scriptBytes++]],
3131 0, 1);
3132 if (g_bCutsceneSkipFrame != 0 && objectType == 3)
3134 break;
3135 case 0x87:
3136 g_3_nCutsceneTextIdx = *(short *)scriptBytes;
3137 scriptBytes += 2;
3145 scriptSymbolIndices[*scriptBytes++]],
3146 (unsigned char *)g_4_pszFilmSourceText, 1);
3147 if (g_bCutsceneSkipFrame != 0 &&
3148 (objectType == 3 || objectType == 2)) {
3150 }
3151 break;
3152 case 0x8d:
3154 (unsigned short)PopCutsceneScriptValue(
3155 &topOperand, scriptValueStack + 10);
3156 break;
3157 case 0x8e:
3159 PopCutsceneScriptValue(&topOperand, scriptValueStack + 10);
3160 break;
3161 case 0x8f:
3162 g_4_nCutsceneResourceScratchValue = *(short *)scriptBytes;
3163 scriptBytes += 2;
3164 /* The original divides by 0x3b (59), not 0x3c (60).
3165 * g_196_nInputTimerTicks (what this delay is measured against,
3166 * see PumpWindowMessages/winmain.c) ticks in exact 1/60s units
3167 * -- confirmed independently by CUTSCENE_MOUTH_MIN_TICKS=3
3168 * meaning exactly 3/60s=50ms=one 20fps frame elsewhere in this
3169 * file. Converting a requested-fps `value` to a tick delay is
3170 * 60/value, not 59/value; the sibling opcode 0x8d (above) takes
3171 * an already-computed tick delay straight from the script with
3172 * no arithmetic at all, so this is specifically the "set rate
3173 * by fps" formula and nothing else. With integer division,
3174 * 59/value truncates to a smaller (i.e. faster) delay than
3175 * 60/value for nearly every value -- e.g. a scene requesting
3176 * 20fps gets 59/20=2 ticks/frame (~30fps, 50% too fast)
3177 * instead of the correct 60/20=3 (20fps). Different requested
3178 * rates truncate by different amounts, which is consistent
3179 * with cutscenes running at inconsistent, scene-dependent
3180 * speeds rather than a single uniform offset. Corrected on the
3181 * port only -- the reference build keeps the original's own
3182 * 0x3b so it stays byte-comparable for verification.
3183 * https://github.com/schlangz/openwc2/blob/main/docs/wc2re_cross_reference.md
3184 */
3186 (unsigned short)(0x3b / g_4_nCutsceneResourceScratchValue);
3187 break;
3188 case 0x75:
3189 scriptLocal = g_pCurrentCutsceneScene->locals;
3190 scriptLocal += *scriptBytes++ * 2;
3191 *scriptLocal =
3192 PopCutsceneScriptValue(&topOperand, scriptValueStack + 10);
3193 break;
3194 case 0x74:
3195 scriptLocal = g_pCurrentCutsceneScene->locals;
3196 scriptLocal += *scriptBytes++ * 2;
3197 PushCutsceneScriptValue(&topOperand, scriptValueStack, *scriptLocal);
3198 break;
3199 case 0x78:
3203 }
3204 if (g_pCurrentCutsceneSprite == 0) {
3207 }
3208 if (g_pCurrentCutsceneSprite == 0)
3209 FatalCutsceneError("A32");
3210 g_pCurrentCutsceneSprite->drawType = *scriptBytes++;
3211 g_pCurrentCutsceneSprite->baseFrame = *scriptBytes++;
3212 g_pCurrentCutsceneSprite->finalFrame = *scriptBytes++;
3214 value = 0;
3215 while (*scriptBytes == 0xff) {
3216 value = (short)(value + *scriptBytes++);
3217 }
3218 value = (short)(value + *scriptBytes++);
3222 }
3227 g_pCutsceneShapeResources), value, 1);
3228 } else {
3233 }
3237 }
3238 break;
3239 case 0x99:
3240 value = 0;
3241 while (*scriptBytes == 0xff) {
3242 value = (short)(value + *scriptBytes++);
3243 }
3244 value = (short)(value + *scriptBytes++);
3248 break;
3249 case 0x9a:
3255 while (g_4_nCutsceneResourceScratchValue-- != 0) {
3259 }
3260 break;
3261 case 0x7b:
3263 scriptBytes += 2;
3264 break;
3265 }
3266 switch ((signed char)*scriptBytes++) {
3267 case 0:
3268 if (g_pCurrentCutscenePlane == 0)
3269 FatalCutsceneError("A33");
3273 scriptSymbolIndices[*scriptBytes++];
3279 break;
3280 case 1:
3282 FatalCutsceneError("A34");
3286 scriptSymbolIndices[*scriptBytes++];
3292 break;
3293 case 2:
3294 case 3:
3295 scriptBytes++;
3296 break;
3297 case 4:
3298 if (g_pCurrentCutscenePlane == 0)
3299 FatalCutsceneError("A35");
3301 break;
3302 case 5:
3304 FatalCutsceneError("A36");
3306 break;
3307 case 6:
3308 if (g_pCurrentCutsceneScene == 0)
3309 FatalCutsceneError("A37");
3311 break;
3312 case 7:
3313 break;
3314 }
3315 break;
3316 case 0x79:
3318 scriptBytes += 2;
3319 break;
3320 }
3321 switch ((signed char)*scriptBytes++) {
3322 case 0:
3323 if (g_pCurrentCutscenePlane == 0)
3324 FatalCutsceneError("A38");
3327 (unsigned char)FindActiveCutsceneObjectResources(
3329 scriptSymbolIndices[*scriptBytes++];
3330 break;
3331 case 1:
3333 FatalCutsceneError("A39");
3336 (unsigned char)FindActiveCutsceneObjectResources(
3338 scriptSymbolIndices[*scriptBytes++];
3339 break;
3340 case 2:
3341 if (g_pCurrentCutsceneScene == 0)
3342 FatalCutsceneError("A40");
3345 (unsigned char)FindActiveCutsceneObjectResources(
3347 scriptSymbolIndices[*scriptBytes++];
3348 break;
3349 case 3:
3350 scriptBytes++;
3351 break;
3352 }
3353 break;
3354 case 0xac:
3355 value = *scriptBytes++;
3356 CopyCutsceneSpriteDisplay(value, *scriptBytes++);
3357 break;
3358 case 0xb7:
3361 break;
3362 case 0xa8:
3363 value = *scriptBytes++;
3364 LinkCutsceneSpriteScript(value, *scriptBytes++);
3365 break;
3366 case 0x7a:
3367 switch ((signed char)*scriptBytes++) {
3368 case 0:
3373 scriptSymbolIndices[*scriptBytes++]];
3374 if (g_pLinkedCutsceneSprite == 0)
3375 FatalCutsceneError("A41");
3381 objectType == 0)
3382 FatalCutsceneError("A42");
3384 }
3387 objectType == 0) {
3388 scriptBytes =
3390 }
3399 break;
3400 case 1:
3405 scriptSymbolIndices[*scriptBytes++]];
3406 if (g_pLinkedCutscenePlane == 0)
3407 FatalCutsceneError("A43");
3410 objectType == 1) {
3411 scriptBytes =
3413 }
3416 break;
3417 case 2:
3422 scriptSymbolIndices[*scriptBytes++]];
3424 FatalCutsceneError("A44");
3427 objectType == 1) {
3428 scriptBytes =
3430 }
3433 break;
3434 case 3:
3435 scriptBytes++;
3436 break;
3437 }
3438 break;
3439 case 0xa5:
3443 (int)(signed char)*scriptBytes++,
3444 PopCutsceneScriptValue(&topOperand, scriptValueStack + 10));
3445 break;
3446 case 0xa6:
3447 value = *scriptBytes++;
3448 g_3_nCutsceneTextIdx = *(short *)scriptBytes;
3449 scriptBytes += 2;
3453 if (g_bCutsceneSkipFrame == 0) {
3455 value);
3456 }
3457 break;
3458 case 0xb6:
3460 break;
3461 case 0xb5:
3462 value = PopCutsceneScriptValue(&topOperand, scriptValueStack + 10);
3464 break;
3465 case 0xa7:
3466 value = PopCutsceneScriptValue(&topOperand, scriptValueStack + 10);
3467 secondaryOperand = PopCutsceneScriptValue(
3468 &topOperand, scriptValueStack + 10);
3469 if (g_bCutsceneSkipFrame == 0)
3470 DrawCutsceneCockpitOverlay(secondaryOperand, value);
3471 break;
3472 default:
3473 FatalCutsceneError("Illegal OpCode: 0x%2x (%d)\n",
3474 (unsigned char)opcode, opcode);
3475 break;
3476 }
3477 }
3478 return 0;
3479}
3480
3481/* Keep this callee declaration here: CL 4.1's symbol order controls the
3482 * following function's comparison operands. */
3484 short index, int);
3485
3486/* Function start: 0x432DCC */
3488 short index)
3489{
3490 char *text;
3491 short stringIndex;
3492
3493 text = resources->packedFilenames;
3494 for (stringIndex = 0; stringIndex < index; stringIndex++) {
3495 text = DosStrchr(text, 0);
3496 text++;
3497 }
3498 return text;
3499}
3500
3501/* Function start: 0x432E23 */
3503{
3504 char *extensionPosition;
3505
3506 if (g_cCutsceneVideoMode == 13) {
3507 extensionPosition = DosStrchr(fileName, '.');
3508 if (extensionPosition++ != 0 &&
3509 toupper((int)*extensionPosition) == 'V')
3510 *extensionPosition = 'E';
3511 }
3512}
3513
3514/* Function start: 0x432E83 */
3516{
3517 char *extension;
3518
3519 extension = DosStrchr(filename, '.');
3520 if (extension++ != 0 && *extension != 0) {
3521 if (g_nMusicDriverMode == 2)
3522 *extension = 'A';
3523 else
3524 *extension = 'R';
3525 }
3526}
3527
3528/* Function start: 0x432EE4 */
3530{
3531 char *extension;
3532
3533 extension = DosStrchr(filename, '.');
3534 if (extension++ != 0 && *extension != 0)
3535 *extension = 'R';
3536}
3537
3538/* Function start: 0x432F2A */
3540 short index, int resourceType)
3541{
3542 short retryMusicExtension;
3543 long size;
3544 char filename[132];
3545 char *packedFilename;
3546 short sectionIndex;
3547 void *packet;
3548
3549 packet = resources->loadedPackets[index];
3550 retryMusicExtension = 0;
3551 if (g_pMemoryLogFile != 0 && packet != 0) {
3552 fprintf(g_pMemoryLogFile,
3553 "Found: loc: %Fp level = %d, free = %8lu\n",
3554 packet, (int)g_nActiveCutsceneResourceLevel,
3556 }
3557 while (packet == 0) {
3558 if (g_nSceneFlicContext == 4 &&
3560 g_nSceneFlicContext = 0x40;
3561 break;
3562 }
3563 packedFilename = GetPackedStringByIndex(
3564 resources, resources->filenameIndices[index]);
3565 DosStrcpy(filename, packedFilename);
3566 switch (resourceType) {
3567 case 1:
3569 break;
3570 case 2:
3572 retryMusicExtension = 1;
3573 break;
3574 }
3575 sectionIndex = resources->sectionIndices[index];
3576 packet = LoadNamedPacket(filename, sectionIndex, 0,
3577 (unsigned short)(g_nSceneFlicContext & 0x7f),
3578 0, 1);
3579 if (packet == 0 && g_nPacketError == 8) {
3580 if (retryMusicExtension != 0) {
3581 retryMusicExtension = 0;
3583 packet = LoadNamedPacket(filename, sectionIndex, 0,
3584 (unsigned short)(
3585 g_nSceneFlicContext & 0x7f),
3586 0, 1);
3587 if (packet == 0) {
3589 filename, sectionIndex, 0);
3590 }
3591 } else {
3593 filename, sectionIndex, 0);
3594 }
3595 } else if (packet == 0 &&
3596 (g_nSceneFlicContext & 0x40) != 0) {
3598 "Unsuccessful load of %s packet %d error = %d",
3599 filename, sectionIndex, g_nPacketError);
3600 }
3601 if (packet == 0) {
3603 filename, sectionIndex,
3604 GetNamedPacketSize(filename, sectionIndex));
3605 }
3606 if (g_pMemoryLogFile != 0) {
3607 size = GetNamedPacketSize(filename, sectionIndex);
3608 fprintf(g_pMemoryLogFile,
3609 "Loaded: %12s (%03d) size %ld loc: %Fp "
3610 "level = %d, free = %8lu\n",
3611 filename, sectionIndex, size, packet,
3614 }
3615 g_nSceneFlicContext = 0x40;
3616 resources->loadedPackets[index] = packet;
3617 break;
3618 }
3619 return packet;
3620}
3621
3622/* Function start: 0x433269 */
3624{
3625 SceneFlicObject *peer;
3626 void *frames;
3627 short index;
3628
3629 frames = sprite->shape;
3632 if (frames != 0) {
3633 for (index = 0; index < 0x80; index++) {
3634 peer = g_apSceneObjects[index];
3635 if (peer != 0 && peer->shape == frames && peer != sprite) {
3636 goto shape_is_shared;
3637 }
3638 }
3639 }
3642shape_is_shared:
3645 sprite->shape = 0;
3646}
3647
3648/* Function start: 0x433328 */
3650 short index)
3651{
3652 SceneFlicObject *flic;
3653 short scan;
3654 void *resource;
3655
3656 resource = resources->loadedPackets[index];
3657 ReleasePacketSlot(&resources->loadedPackets[index]);
3658 if (g_pMemoryLogFile != 0 && resource != 0)
3659 fprintf(g_pMemoryLogFile,
3660 "--- Dumped: %Fp level = %d free = %8lu\n", resource,
3663 if (resource != 0) {
3664 for (scan = 0; scan < 0x80; scan++) {
3665 flic = g_apSceneObjects[scan];
3666 if (flic != 0 && flic->shape == resource)
3667 flic->shape = 0;
3668 }
3669 }
3670}
3671
3672/* Function start: 0x4333F8 */
3674{
3675 return soundIndex + 1;
3676}
3677
3679signed char g_cCutsceneSoundVolume = 0x40; /* 0x00499c2c */
3680void *g_pCutsceneFxPacket = 0; /* 0x00499c30 */
3682SceneFlicObject **g_apSceneObjects = 0; /* 0x00499c38 */
3683CutscenePlane **g_apCutscenePlanes = 0; /* 0x00499c3c */
3685CutsceneScene **g_apCutsceneScenes = 0; /* 0x00499c44 */
3686signed char g_cCutsceneVideoMode = 0x13; /* 0x00499c48 */
3687signed char g_bCutsceneViewportPreallocated = 0; /* 0x00499c4c */
3688short g_nSceneFlicContext = 0; /* 0x00499c50 */
3689signed char g_bCutsceneSkipFrame = 0; /* 0x00499c54 */
3690signed char g_bCutsceneSkipAll = 0; /* 0x00499c58 */
3694signed char g_bCutsceneDrawingEnabled = 0; /* 0x00499c60 */
3698int g_nUnusedCutsceneWord1 = 0; /* 0x00499c70 */
3699int g_nUnusedCutsceneWord2 = 0; /* 0x00499c74 */
3704short g_nCutsceneFrameTick = 0; /* 0x00499c88 */
3705unsigned short g_nCutsceneFrameDelay = 0; /* 0x00499c8c */
3706int g_nNextCutsceneFrameClock = 0; /* 0x00499c90 */
3709 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
3710 7, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 6, 6, 6, 6, 6,
3711 11, 11, 11, 9, 9, 9, 9, 9, 9, 9, 9, 9, 1, 1, 1, 1,
3712 15, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8,
3713 14, 14, 14, 14, 14, 14, 14, 4, 4, 4, 4, 4, 4, 4, 4, 4,
3714 12, 12, 12, 12, 12, 12, 12, 12, 14, 10, 10, 10, 10, 10, 2, 2,
3715 14, 14, 14, 14, 14, 14, 14, 14, 6, 6, 6, 6, 6, 6, 6, 6,
3716 12, 12, 12, 12, 12, 12, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
3717 10, 10, 10, 10, 10, 10, 10, 10, 4, 4, 4, 4, 4, 4, 4, 4,
3718 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 9, 9, 9, 9, 1,
3719 7, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8,
3720 12, 12, 12, 12, 12, 12, 12, 12, 4, 4, 4, 4, 4, 4, 4, 4,
3721 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
3722 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 2, 2, 2, 2, 2, 2,
3723 7, 7, 7, 7, 8, 8, 8, 8, 12, 12, 12, 12, 4, 4, 4, 4,
3724 10, 10, 10, 10, 2, 2, 2, 2, 13, 13, 13, 13, 13, 13, 13, 13
3725}; /* 0x00499c98 */
3726short g_nCutsceneResourceLevel = 0; /* 0x00499d98 */
3727short g_nActiveCutsceneResourceLevel = 0; /* 0x00499d9c */
3728signed char g_bCutsceneTextRestorePending = 0; /* 0x00499da0 */
3729char *g_pszCurrentCutsceneText = 0; /* 0x00499da4 */
3730FILE *g_pMemoryLogFile = 0; /* 0x00499da8 */
3731signed char g_acCutsceneMouthFrames[128] = {
3732 10, 13, 14, 12, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
3733 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
3734 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
3735 3, 5, 5, 1, 5, 9, 5, 5, 1, 2, 5, -1, -1, -1, -1, -1,
3736 -1, 1, 0, 5, 5, 1, 9, 5, 3, 2, 5, 5, 8, 0, 5, 3,
3737 0, 6, 5, 5, 5, 4, 9, 6, 5, 5, 5, 1, -1, -1, -1, -1,
3738 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3739 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
3740}; /* 0x00499db0 */
3741signed char g_acCutsceneMouthDurations[128] = {
3742 40, 3, 3, 50, 60, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
3743 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
3744 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
3745 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
3746 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1,
3747 1, 1, 1, 1, 2, 1, 1, 2, 2, 1, 1, 1, 1, 1, 1, 1,
3748 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3749 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
3750}; /* 0x00499e30 */
3751char *g_pszCutsceneSpeechCursor = 0; /* 0x00499eb0 */
3752signed char g_cCutsceneSpeechSpeed = 1; /* 0x00499eb4 */
3753signed char g_bCutsceneSpeechActive = 0; /* 0x00499eb8 */
3754static char g_szLastCutsceneWorkBuffer[16] = "@@@@@@@@@@"; /* 0x00499ec0 */
3755static char g_szLastCutscenePrintBuffer[12] = "@@@@@@@@@@"; /* 0x00499ed0 */
3756signed char g_bCutsceneTextBoundsOverride = 0; /* 0x00499edc */
3757ShortRect g_stCutsceneTextBounds = { 0, 0, 319, 199 }; /* 0x00499ee0 */
3758signed char g_bCutsceneDebugOverlayEnabled = 0; /* 0x00499ee8 */
3759unsigned short g_wCutsceneDebugFrameNumber = 0; /* 0x00499eec */
3761int g_nUnusedCutsceneWord3 = 0; /* 0x00499ef4 */
3763 "CALLSIGN", "PCNAME", "FIRSTNAME"
3764}; /* 0x00499ef8 */
3765signed char g_cCutsceneTextStyle = 0; /* 0x00499f40 */
3766
3767/* Linker commons defined here. LINK lays a unit's commons out by the
3768 * identifiers' hash keys, so these spellings follow the original addresses. */
3769signed char g_bSceneCockpitLoaded; /* 0x005d2d66 */
3771short g_1_asCutsceneSpeechChannelsTable[8]; /* 0x005d2d70 */
3772char g_13_nFreeGameflowWord1; /* 0x005d2d80 */ /* never referenced */
3776unsigned int g_4_dwSceneMusicMode; /* 0x005d2dc4 */
3777char *g_27_pszCutsceneFormattedText; /* 0x005d2dc8 */
3778char *g_4_pszFilmSourceText; /* 0x005d2dcc */
3779short g_19_asCutsceneSpeechSectionsList[8]; /* 0x005d2dd0 */
3780signed char g_bMovieFramePresented; /* 0x005d2de0 */
3783unsigned int g_28_nCutsceneInitialAvailableMemoryWord; /* 0x005d2e88 */
3784short g_2_nCutsceneForkOffsetNumber; /* 0x005d2e8c */
3787unsigned char *g_26_pFilmRgbPacket; /* 0x005d2e98 */
3789int g_39_nIdleGameflowWord1; /* 0x005d2ea0 */ /* never referenced */
3790short g_3_nCutsceneTextIdx; /* 0x005d2ea4 */
3791unsigned int g_17_nSceneInitialLargestBlockWord; /* 0x005d2ea8 */
3793short g_nEarlierGlobalCount; /* 0x005d2ec4 */
3794int g_47_nCutsceneMemDelta; /* 0x005d2ec8 */
3795char *g_4_pszFilmWorkScratch; /* 0x005d2ecc */
3796short g_2_bMovieStringAdvanceState; /* 0x005d2ed0 */
3797char *g_12_apszMovieSpeechFiles[8]; /* 0x005d2ee0 */
3798short *g_2_pCutsceneLocalsTemp; /* 0x005d2f00 */
3799char g_10_nSpareGameflowWord; /* 0x005d2f04 */ /* never referenced */
3801short g_117_nCutsceneFormatValueWord; /* 0x005d2f0c */
3802char *g_116_pszFilmPrintStore; /* 0x005d2f10 */
3803int g_17_nIdleGameflowWord2[5]; /* 0x005d2f20 */ /* never referenced */
3806void *g_3_apSceneSpeechPacketsList[8]; /* 0x005d2f80 */
3807short g_1_nCutsceneFontOwnerNumber; /* 0x005d2fa0 */
3808char g_68_nUnusedGameflowNumberValue; /* 0x005d2fa2 */ /* never referenced */
3809short g_8_bUserDestroyedFlag; /* 0x005d2fa4 */
3810short g_4_nFreeGameflowWord2; /* 0x005d2fa6 */ /* never referenced */
3811signed char g_36_cPilotKillCountValue; /* 0x005d2fa8 */
void(__cdecl *g_pIxFree)(void *)
void Build_objective_list(void)
Definition nav.c:193
signed char RunCutsceneScript(unsigned char **cursor, short objectType)
Definition gameflow.c:1844
CutsceneObjectResourceList * FindActiveCutsceneObjectResources(CutsceneObjectResourceList *resources)
Definition gameflow.c:427
unsigned int GetLargestFreeMemoryBlock(void)
Definition eventmgr.c:1515
void FormatTextBufferFromStart(const char *format,...)
Definition textfmt.c:123
unsigned int DosFarPtrToNear(void *v)
Definition eventmgr.c:441
void FatalCutsceneError(const char *format,...)
Definition gameflow.c:455
void FadeViewportPaletteToColour(Viewport *viewport, unsigned short colour, short enabled)
Definition palfade.c:10
void FadeMusic(short duration)
Definition music.c:75
short MaxShort(short a, short b)
Definition disk.c:36
void LoadMissionData(short series, short mission)
Definition loadmisn.c:10
signed char InitializeViewportWipe(Viewport *source, Viewport *destination, int wipeType, short duration, short passFlags, void *workspace)
Definition wipe.c:12
unsigned int GetAvailableMainMemory(void)
Definition memfree.c:13
void ReleaseLoadedCutsceneResource(CutsceneResourceTable *resources, short index)
Definition gameflow.c:3649
void * LoadCachedCutsceneResource(CutsceneResourceTable *resources, short index, int resourceType)
Definition gameflow.c:3539
short ServiceInputDevices(short deviceMask)
Definition eventmgr.c:2071
void LoadCutsceneSpeechSlot(short resourceIndex, short slot)
Definition gameflow.c:640
void DispatchCutsceneSpriteHandler(SceneFlicObject *sprite, short handlerType)
Definition gameflow.c:1442
void LogMemoryStateToFile(FILE *file)
Definition gameflow.c:132
short AllocateViewport(Viewport *viewport, short clearColour, short flags)
Definition vpalloc.c:32
void ReleaseActiveCutscenePacket(CutsceneResourceTable *resources, void *packet)
Definition gameflow.c:1617
void WriteDetailedMemoryStateReport(void)
Definition gameflow.c:147
void DosMemmove(void *dst, const void *src, unsigned short n)
unsigned int GetLargestMainMemoryBlock(void)
Definition memfree.c:35
void InitializeCinematicTextRenderer(void)
Definition text.c:132
void RunCutsceneWipeTransition(Viewport *destination, Viewport *source, int wipeType, short duration)
Definition gameflow.c:356
void free_viewport(Viewport *viewport)
Definition vpfree.c:10
InputEventState * FindQueuedInputEvent(int type)
Definition eventmgr.c:969
signed char HasCutsceneMusicNode(CutsceneMusicNode *node)
Definition gameflow.c:119
void DrawCinematicMemoryStatus(const char *message)
Definition gameflow.c:1732
void SetTextContext(TextContext *context)
Definition eventmgr.c:179
long GetNamedPacketSize(const char *filename, short section)
Definition eventmgr.c:2164
void StopMusic(short enabled)
Definition music.c:30
void * LoadSpeechPacketIntoBuffer(char *fileName, short section, void *destination)
Definition speech.c:45
void ReleaseSceneFlicPackets(void)
Definition gameflow.c:1478
void ResetCutsceneSpriteDrawTicks(void)
Definition gameflow.c:465
void ReleaseCutsceneResourceLevel(short owner)
Definition iffload.c:763
void DrawCutsceneTextAt(short x, short y, short viewportIndex, const char *text)
Definition gameflow.c:247
void RestoreGamePalette(void)
Definition palette.c:21
void InitializeCutsceneViewports(void)
Definition gameflow.c:873
void DrawSpriteDefault(Viewport *viewport, short x, short y, unsigned char *shape, short frame)
Definition gr.c:682
void * LoadNamedPacket(const char *filename, short section, void *destination, unsigned short flags, void *decompressionWorkspace, int registerHandle)
Definition eventmgr.c:2170
void FlushInputEvents(void)
Definition eventmgr.c:1014
short MinShort(short a, short b)
Definition disk.c:27
void UpdateCutsceneSpriteObject(SceneFlicObject *sprite)
Definition gameflow.c:1406
void SoundDebugPrintf(const char *fmt,...)
Definition mono.c:64
void DIBslamReal(void)
Definition dib.cpp:562
signed char AdvanceViewportWipe(void *workspace)
Definition wipe.c:255
void RestoreCutsceneTextBacking(void)
Definition gameflow.c:1203
void ClearCutsceneViewport(Viewport *viewport, unsigned char colour)
Definition gameflow.c:1195
short GetOriginalFreeMemory(void)
Definition eventmgr.c:1914
void ExpandCutsceneText(const unsigned char *source, char *destination)
Definition gameflow.c:1235
void ClearActiveCutscenePixelAlias(void)
Definition gameflow.c:220
void AddCutsceneMusicNode(CutsceneMusicNode **head, short resourceIndex)
Definition gameflow.c:682
unsigned int PumpWindowMessages(int skipMessages)
Definition winmain.c:292
short StartInteractiveMusic(int track)
Definition music.c:44
void AnimateCutsceneSpeakerMouth(SceneFlicObject *sprite)
Definition gameflow.c:48
void LogChangedCutsceneWorkBuffers(void)
Definition gameflow.c:179
void ExecuteCutsceneSequence(CutsceneSequence *sequence, unsigned char *text, signed char draw)
Definition gameflow.c:1284
void ReleaseCutsceneSpriteShape(SceneFlicObject *sprite)
Definition gameflow.c:3623
void InitializeCutsceneRuntimeResources(void)
Definition gameflow.c:808
void RewriteCutsceneMusicExtensionForDriver(char *filename)
Definition gameflow.c:3515
void AdvanceSceneFlicStream(SceneFlicObject *object)
Definition gameflow.c:1507
void AllocateCutsceneViewportOrFatal(Viewport *viewport, short colour, short flags)
Definition gameflow.c:1699
void ReleaseCutsceneSpeechPackets(void)
Definition gameflow.c:906
void ReleasePacketSlot(void **slot)
Definition iffload.c:23
void ConsumeCutscenePalettePacket(short firstColour, short count, signed char releasePacket)
Definition gameflow.c:512
void PresentCutsceneFrame(Viewport *source, Viewport *destination)
Definition gameflow.c:477
void LoadAndPlaySpeechPacket(char *fileName, short section)
Definition speech.c:103
int TakeInputPressCount(void)
Definition winmain.c:1313
void LinkCutsceneSpriteScript(unsigned char destination, unsigned char source)
Definition gameflow.c:1056
void PlaySpeechPacketBuffer(void *packet, unsigned short packetSize, int interrupt)
Definition speech.c:67
void PanToScreen(Viewport *source, Viewport *destination)
Definition pan.c:10
unsigned char * GetDIBPixelBuffer(void)
Definition dib.cpp:779
void RunLoadedCutscene(void)
Definition gameflow.c:919
void CopyCutsceneSpriteDisplay(unsigned char destination, unsigned char source)
Definition gameflow.c:1033
void DrawCutsceneSprite(SceneFlicObject *sprite)
Definition gameflow.c:1083
void LoadCutsceneCockpitOverlay(short scriptValue)
Definition gameflow.c:322
void DosMemset(void *destination, unsigned int count, short value)
Definition eventmgr.c:492
char * DosStrcpy(char *dst, const char *src)
Definition eventmgr.c:465
CutsceneResourceTable * FindActiveCutsceneFileResources(CutsceneResourceTable *resources)
Definition gameflow.c:414
unsigned int ReadNextSceneForm(unsigned char **cursor, unsigned char **nextForm)
Definition iffload.c:66
void RewriteCutsceneMusicExtensionForRetry(char *filename)
Definition gameflow.c:3529
void * AllocateScenePointerTable(int count, short elementSize, unsigned short flags, const char *errorMessage)
Definition iffload.c:131
void InitializeSceneFlicStream(CutsceneResourceTable *resources, short index, SceneFlicObject *object)
Definition gameflow.c:1463
void DrawCutscenePlane(CutscenePlane *plane)
Definition gameflow.c:1175
void ReportCutscenePacketAllocationFailure(const char *filename, short section, unsigned int packetSize)
Definition gameflow.c:1797
void ClearViewport(Viewport *viewport, short colour)
Definition gr.c:1027
int MapCutsceneSoundEffectNumber(int soundIndex)
Definition gameflow.c:3673
void WriteMemoryStateReportHook(void)
Definition gameflow.c:127
void RewriteDiskFileGraphicsExtensions(char *fileName)
Definition gameflow.c:3502
void DrawCutsceneCockpitOverlay(short unused, short verticalOffset)
Definition gameflow.c:332
char * CopyStringAndReturnEnd(char *destination, const char *source)
Definition eventmgr.c:471
void UpdateCutscenePlaneObject(CutscenePlane *plane, signed char updateChildren)
Definition gameflow.c:1364
void ServiceCutsceneRuntimeHook(void)
Definition eventmgr.c:2192
short PopCutsceneScriptValue(short **stack, short *stackBottom)
Definition gameflow.c:1809
short QueryCurrentGraphicsMode(void)
Definition getmode.c:9
void ReleaseCutsceneViewport(Viewport *viewport)
Definition gameflow.c:1707
void PlaySfxWaveFileByNumber(int soundNumber, int sourceObject, int looping)
Definition music.c:490
void * FindLoadedCutsceneMusic(short resourceIndex)
Definition gameflow.c:790
char * DosStrchr(const char *s, short c)
Definition eventmgr.c:459
void ClearCutsceneTextViewport(void)
Definition gameflow.c:1224
void FormatCinematicMemoryStatus(const char *format,...)
Definition gameflow.c:1785
void PushCutsceneScriptValue(short **stack, short *stackTop, short value)
Definition gameflow.c:1826
void ReleaseSceneMusicPacket(void)
Definition gameflow.c:894
void AddCutsceneSoundEffect(void *sound, short resourceIndex)
Definition gameflow.c:571
void DrawSpriteScaled(Viewport *viewport, short x, short y, unsigned char *shape, short frame, short angle, short scale, short flip)
Definition gr.c:1494
CutsceneSoundEffect * FindCutsceneSoundEffect(short resourceIndex)
Definition gameflow.c:546
void BriefingMap_DisplayMap(void)
Definition nav.c:968
void SwapSceneChunkSizeEndian(int *value)
Definition iffload.c:32
short RemoveCutsceneMemberIndex(short count, unsigned char *indices, signed char index)
Definition gameflow.c:440
char * GetPackedStringByIndex(CutsceneResourceTable *resources, short index)
Definition gameflow.c:3487
void SaveGamePalette(void)
Definition palette.c:9
void ReleaseCutsceneMusicNodes(CutsceneMusicNode **head, short resourceIndex)
Definition gameflow.c:746
void FlushSoundEffect(void)
Definition music.c:61
void exit_squadron(const char *msg,...)
Definition message.c:44
void ReleaseCutsceneSoundEffects(short resourceIndex)
Definition gameflow.c:598
void RouteCutsceneViewportToDisplay(void)
Definition gameflow.c:200
short GetShapeFrameCount(unsigned char *shape)
Definition gr.c:137
void ReleaseCutsceneFileResource(short owner, CutsceneResourceTable **head)
Definition iffload.c:731
signed char IsCutsceneSpeechLoaded(void)
Definition gameflow.c:234
void WaitForCutsceneInputEvent(void)
Definition gameflow.c:399
unsigned short RandomInRange(unsigned short lo, unsigned short hi)
Definition eventmgr.c:31
void FlushSoundEffects(void)
Definition music.c:68
unsigned int GetAvailableFarMemory(void)
Definition eventmgr.c:1509
void ReleaseCutsceneFontPacket(void)
Definition gameflow.c:1645
void OutputDebugPrintf(const char *format,...)
Definition winmain.c:204
void DrawFormattedText(const char *format,...)
Definition textfmt.c:103
void MarkDibDirty(void)
Definition dib.cpp:532
void CopyViewportContents(Viewport *source, Viewport *destination)
Definition gr.c:995
void FlushPendingInputEvents(void)
Definition eventmgr.c:2157
void FinishViewportWipe(void *workspace)
Definition wipe.c:902
unsigned char ParseCutsceneContainer(void *scenePacket)
Definition iffload.c:410
void UpdateMap(char *text, short objective)
Definition gameflow.c:1660
void ExecuteCutsceneScene(CutsceneScene *scene)
Definition gameflow.c:1006
Shared Win32 declarations, types and library interfaces.
#define HOST_POINTER_SIZE
Definition game.h:103
static char g_szLastCutsceneWorkBuffer[16]
Definition gameflow.c:9
short g_4_nFreeGameflowWord2
Definition gameflow.c:3810
SceneFlicObject * g_11_pWatchedSceneSpriteB
Definition gameflow.c:3786
char g_13_nFreeGameflowWord1
Definition gameflow.c:3772
int g_nUnusedCutsceneWord1
Definition gameflow.c:3698
SceneFlicObject * g_7_pWatchedSceneSpriteA
Definition gameflow.c:3785
int g_17_nIdleGameflowWord2[5]
Definition gameflow.c:3803
int g_39_nIdleGameflowWord1
Definition gameflow.c:3789
char g_10_nSpareGameflowWord
Definition gameflow.c:3799
int g_nUnusedCutsceneWord3
Definition gameflow.c:3761
#define g_cShowMemoryStatus
Definition gameflow.c:29
static char g_szLastCutscenePrintBuffer[12]
Definition gameflow.c:10
short g_nEarlierGlobalCount
Definition gameflow.c:3793
char g_68_nUnusedGameflowNumberValue
Definition gameflow.c:3808
int g_nUnusedCutsceneWord2
Definition gameflow.c:3699
unsigned char * g_26_pFilmRgbPacket
Definition gameflow.c:3787
void(* g_apCutsceneSpriteHandlers[1])(SceneFlicObject *sprite)
Definition gameflow.c:3691
TextContext g_2_stCutsceneMessageCtxInfo
Definition gameflow.c:3804
short g_2_bMovieStringAdvanceState
Definition gameflow.c:3796
ShortPoint g_aCockpitDamagePositions[4]
Definition cockpt.c:14
void * g_3_apSceneSpeechPacketsList[8]
Definition gameflow.c:3806
CutsceneScene * g_pCurrentCutsceneScene
Definition gameflow.c:3703
CutsceneScene ** g_apCutsceneScenes
Definition gameflow.c:3685
CutsceneObjectResourceList * g_pCutsceneSceneResources
Definition iffload.c:11
short g_bBriefingMapActive
Definition nav.c:62
TextContext g_6_stMovieDebugTextCtx
Definition gameflow.c:3781
short g_nYourWingman
Definition viewrect.c:75
signed char g_bCutsceneDebugOverlayEnabled
Definition gameflow.c:3758
CutsceneSequence * g_pCurrentCutsceneSequence
Definition gameflow.c:3702
short g_nCutsceneResourceLevel
Definition gameflow.c:3726
short g_bSpeechEnabledFlag
Definition startup.c:598
short g_117_nCutsceneFormatValueWord
Definition gameflow.c:3801
signed char g_bSceneEscapeRequested
Definition eventmgr.c:2420
FILE * g_pMemoryLogFile
Definition gameflow.c:3730
CutsceneResourceTable * g_pCutsceneMusicResources
Definition iffload.c:20
short * g_2_pCutsceneLocalsTemp
Definition gameflow.c:3798
signed char g_9_bCinematicSpriteTextEnableStatus
Definition eventmgr.c:2516
unsigned int g_4_dwSceneMusicMode
Definition gameflow.c:3776
unsigned short g_wCutsceneDebugFrameNumber
Definition gameflow.c:3759
CutsceneObjectResourceList * g_pCutsceneSpriteResources
Definition iffload.c:8
signed char g_cCutsceneVideoMode
Definition gameflow.c:3686
short g_nInputPollPeriod
Definition eventmgr.c:2482
signed char g_cCurrentObjective
Definition viewrect.c:57
CutscenePlane * g_pCutsceneSpriteParentPlane
Definition gameflow.c:3760
InputEventState * g_19_pFilmInputFlag
Definition gameflow.c:3800
signed char g_bCutsceneTextRestorePending
Definition gameflow.c:3728
unsigned char g_abCutscenePaletteTranslation[256]
Definition gameflow.c:3708
signed char g_bAutopilotDebugEnabled
Definition gameflow.c:13
CampaignGlobals * g_pCampaignGlobals
Definition gameflow.c:3707
Viewport g_9_stCutsceneTextBackingPort
Definition gameflow.c:3775
CutsceneResourceTable * g_1_pActiveSceneFileResourcesRef
Definition gameflow.c:3774
short g_2_nCutsceneForkOffsetNumber
Definition gameflow.c:3784
short g_19_asCutsceneSpeechSectionsList[8]
Definition gameflow.c:3779
TextContext g_16_stCutsceneDrawingTextSettingsInfo
Definition gameflow.c:3805
short g_69_asCockpitDmgStateList[4]
Definition cockpt.c:3818
ObjectTypeData g_aObjectTypeData[OBJECT_DATA_COUNT]
Definition campglob.c:310
short g_nCutsceneFrameTick
Definition gameflow.c:3704
signed char g_bCutsceneSkipFrame
Definition gameflow.c:3689
signed char g_bSceneCockpitLoaded
Definition gameflow.c:3769
signed char g_bCutsceneDrawingEnabled
Definition gameflow.c:3694
CutsceneSequence * g_pLinkedCutsceneSequence
Definition gameflow.c:3697
CutsceneSequence ** g_apCutsceneSequences
Definition gameflow.c:3684
char * g_pszCutsceneSpeechCursor
Definition gameflow.c:3751
CutsceneMusicNode * g_pCutsceneMusicPackets
Definition gameflow.c:3681
CutsceneResourceTable * g_pCutsceneFilmResources
Definition iffload.c:18
CutsceneSoundEffect * g_pCutsceneSoundEffects
Definition gameflow.c:3678
short g_nSceneFlicContext
Definition gameflow.c:3688
Viewport g_15_stSceneFlicScratchViewport
Definition gameflow.c:3792
TextContext * g_29_pCurrentTextContext
Definition eventmgr.c:2563
CutsceneResourceTable * g_pCutsceneFxResources
Definition iffload.c:19
char g_7_szCockpitAssetFilenameText[16]
Definition fltsetup.c:1066
CutsceneTextResource * g_pCutsceneTextResources
Definition iffload.c:12
short g_4_nCutsceneResourceScratchValue
Definition gameflow.c:3788
char * g_4_pszFilmWorkScratch
Definition gameflow.c:3795
signed char g_bCutsceneSkipAll
Definition gameflow.c:3690
SceneFlicObject * g_pCurrentCutsceneSprite
Definition gameflow.c:3700
void * g_pSceneMusicPacket
Definition gameflow.c:16
signed char g_bCutsceneSpeechActive
Definition gameflow.c:3753
signed char g_acCutsceneMouthDurations[128]
Definition gameflow.c:3741
SceneFlicObject * g_pLinkedCutsceneSprite
Definition gameflow.c:3695
CutsceneResourceTable * g_pCutsceneFontResources
Definition iffload.c:13
unsigned char * g_13_pActiveCutscenePixelsAddress
Definition eventmgr.c:2522
CutscenePlane * g_pCurrentCutscenePlane
Definition gameflow.c:3701
short g_asObjectDamage[SPACE_OBJECT_COUNT]
Definition viewrect.c:121
char * g_27_pszCutsceneFormattedText
Definition gameflow.c:3777
short g_1_asCutsceneSpeechChannelsTable[8]
Definition gameflow.c:3771
signed char g_bCutsceneTextBoundsOverride
Definition gameflow.c:3756
CutsceneResourceTable * g_pCutsceneSpeechResources
Definition iffload.c:14
short g_8_bUserDestroyedFlag
Definition gameflow.c:3809
signed char g_acCutsceneMouthFrames[128]
Definition gameflow.c:3731
short g_3_nCutsceneTextIdx
Definition gameflow.c:3790
short g_nMusicDriverMode
Definition music.c:522
SceneFlicObject ** g_apSceneObjects
Definition gameflow.c:3682
signed char g_36_cPilotKillCountValue
Definition gameflow.c:3811
int g_47_nCutsceneMemDelta
Definition gameflow.c:3794
signed char g_cCutsceneSoundVolume
Definition gameflow.c:3679
short g_nActiveCutsceneResourceLevel
Definition gameflow.c:3727
char * g_12_apszMovieSpeechFiles[8]
Definition gameflow.c:3797
CutscenePlane ** g_apCutscenePlanes
Definition gameflow.c:3683
CutsceneResourceTable * g_pCutsceneShapeResources
Definition iffload.c:15
void * g_pCutsceneFxPacket
Definition gameflow.c:3680
Viewport g_2_stModalSourceWindow
Definition message.c:231
short g_1_nCutsceneFontOwnerNumber
Definition gameflow.c:3807
char g_16_szTextBufferBuffer[256]
Definition cockpt.c:3793
volatile int g_196_nInputTimerTicks
Definition eventmgr.c:2550
CutsceneResourceTable * g_pCutscenePaletteResources
Definition iffload.c:17
signed char g_bCutsceneViewportPreallocated
Definition gameflow.c:3687
short g_nPacketError
Definition datafile.c:10
short g_19_bStoredHighMemoryEnabled
Definition eventmgr.c:2505
signed char g_bMovieFramePresented
Definition gameflow.c:3780
short g_nCutsceneMusicVolume
Definition music.c:523
unsigned short g_wDigiPlaying
Definition speech.c:14
char * g_pszCurrentCutsceneText
Definition gameflow.c:3729
signed char g_bRoomTransitionAnimationEnabled
Definition gameflow.c:14
CutsceneObjectResourceList * g_pCutscenePlaneResources
Definition iffload.c:9
Viewport g_10_stCutsceneStringViewportBlock
Definition gameflow.c:3773
unsigned int g_17_nSceneInitialLargestBlockWord
Definition gameflow.c:3791
signed char g_cCutsceneSpeechSpeed
Definition gameflow.c:3752
PilotNameVariables g_stPilotNameVariables
Definition gameflow.c:3762
int g_nNextCutsceneFrameClock
Definition gameflow.c:3706
unsigned char g_bMemoryLogToFile
Definition gameflow.c:12
MusicResource g_aTuneResources[66]
Definition music.c:608
CutscenePlane * g_pLinkedCutscenePlane
Definition gameflow.c:3696
Viewport g_stSecondaryViewBufferBlock
Definition message.c:234
unsigned short g_nCutsceneFrameDelay
Definition gameflow.c:3705
short g_nOriginDevUnlock
Definition main.c:1944
short g_8_nSavedCutsceneResourceOwnerValue
Definition gameflow.c:3770
CutsceneObjectResourceList * g_pCutsceneSequenceResources
Definition iffload.c:10
short g_nFrameSkipCountdown
Definition main.c:1939
void * g_pCutsceneCockpitPalette
Definition gameflow.c:17
signed char g_acObjectType[SPACE_OBJECT_COUNT]
Definition viewrect.c:101
signed char g_cCutsceneTextStyle
Definition gameflow.c:3765
char * g_4_pszFilmSourceText
Definition gameflow.c:3778
char * g_116_pszFilmPrintStore
Definition gameflow.c:3802
unsigned int g_28_nCutsceneInitialAvailableMemoryWord
Definition gameflow.c:3783
void * g_pCutsceneCockpitPacket
Definition gameflow.c:15
short g_nCutsceneSpritesDrawn
Definition gameflow.c:18
SceneFlicCacheEntry g_aSceneFlicCopyTable[15]
Definition gameflow.c:3782
ShortRect g_stCutsceneTextBounds
Definition gameflow.c:3757
const char * g_apszCutsceneObjectTypeNames[4]
Definition gameflow.c:19
int g_nAudioEnabled
Definition winmain.c:1349
struct CutsceneMusicNode * previous
Definition game_data.h:933
struct CutsceneMusicNode * next
Definition game_data.h:932
unsigned char resourceIndex
Definition game_data.h:930
struct CutsceneObjectResourceList * next
Definition game_data.h:914
short spriteCount
Definition game_data.h:942
signed char visible
Definition game_data.h:938
signed char deltaY
Definition game_data.h:945
unsigned char * spriteIndices
Definition game_data.h:943
signed char deltaX
Definition game_data.h:944
signed char deltaDepth
Definition game_data.h:946
signed char active
Definition game_data.h:937
unsigned char * scriptCursor
Definition game_data.h:940
unsigned short drawFlags
Definition game_data.h:952
short waitTicks
Definition game_data.h:954
short * locals
Definition game_data.h:941
unsigned char * scriptStart
Definition game_data.h:939
const unsigned char * filenameIndices
Definition game_data.h:874
const unsigned char * sectionIndices
Definition game_data.h:875
struct CutsceneResourceTable * next
Definition game_data.h:878
unsigned char * sequenceIndices
Definition game_data.h:974
short * locals
Definition game_data.h:978
unsigned char * scriptCursor
Definition game_data.h:977
short sequenceCount
Definition game_data.h:973
signed char active
Definition game_data.h:959
unsigned char * scriptCursor
Definition game_data.h:964
unsigned char * scriptStart
Definition game_data.h:963
unsigned char * planeIndices
Definition game_data.h:961
struct CutsceneSoundEffect * next
Definition game_data.h:924
short status
Definition game.h:213
unsigned short modifiers
Definition game.h:215
void * packet
Definition game_data.h:692
char lastName[24]
Definition globals.h:1693
char firstName[24]
Definition globals.h:1694
char callsign[24]
Definition globals.h:1692
unsigned char * shape
Definition game_data.h:1022
signed char visible
Definition game_data.h:987
unsigned char * shape
Definition game_data.h:991
signed char deltaX
Definition game_data.h:1002
unsigned char * linkedScript
Definition game_data.h:995
unsigned char * scriptCursor
Definition game_data.h:997
unsigned char * scriptStart
Definition game_data.h:996
const char * filename
Definition game_data.h:1013
signed char active
Definition game_data.h:986
signed char field_3
Definition game_data.h:989
short segmentEndFrame
Definition game_data.h:1012
short segmentStartFrame
Definition game_data.h:1011
signed char deltaDepth
Definition game_data.h:1004
signed char tick
Definition game_data.h:988
signed char deltaY
Definition game_data.h:1003
unsigned int decoderState
Definition game_data.h:1016
unsigned short drawFlags
Definition game_data.h:1010
short top
Definition game_data.h:480
short left
Definition game_data.h:479
short right
Definition game_data.h:481
short bottom
Definition game_data.h:482
unsigned char colour
Definition game.h:288
short cursorY
Definition game.h:286
unsigned char * font
Definition game.h:287
char * text
Definition game.h:290
unsigned char backgroundColour
Definition game.h:289
signed char alignment
Definition game.h:292
short cursorX
Definition game.h:285
Viewport * viewport
Definition game.h:284
unsigned char * pixels
Definition game.h:150
short right
Definition game.h:154
short bottom
Definition game.h:155
unsigned short * rowOffsets
Definition game.h:151
short left
Definition game.h:152
short top
Definition game.h:153