15 { 1, 137, 88, 149, 94 },
16 { 1, 110, 88, 136, 94 },
17 { 1, 172, 88, 184, 94 },
18 { 1, 185, 88, 210, 94 },
19 { 1, 133, 98, 146, 107 },
20 { 1, 100, 98, 132, 107 },
21 { 1, 174, 98, 189, 107 },
22 { 1, 190, 98, 220, 107 },
23 { 1, 124, 114, 142, 128 },
24 { 1, 81, 114, 123, 128 },
25 { 1, 178, 114, 197, 128 },
26 { 1, 198, 114, 238, 128 },
27 { 1, 109, 141, 135, 164 },
28 { 1, 50, 141, 108, 164 },
29 { 1, 185, 141, 213, 164 },
30 { 1, 214, 141, 268, 164 },
31 { 1, 288, 39, 311, 85 },
33 { 1, 218, 37, 248, 78 },
34 { 1, 86, 44, 181, 78 },
39 {109, 86}, {170, 86}, {98, 95}, {173, 95},
40 {78, 110}, {176, 110}, {42, 136}, {183, 136}
43 "Save this campaign ",
47 0, 0, 0, 0, 0, 0, 0, 0,
48 0, 0, 0, 0, 0, 0, 0, 0,
51 "Quit Wing Commander",
67 short backgroundColour,
77 (
unsigned char)clearColour,
78 (
signed char)backgroundColour);
97 unsigned char alignment,
98 const char *format, ...)
104 va_start(arguments, format);
105 vsprintf(text, format, arguments);
108 (
unsigned short)(panel->
top + y));
129 vsprintf(text, format, (
char *)(&format + 1));
145 halfWidth = (short)((
int)halfWidth * 8 / 16);
147 bounds.
left = (short)(159 - halfWidth);
148 bounds.
right = (short)(161 + halfWidth);
182 for (slot = 0; slot < 8; slot++) {
183 if (
LoadGame(slot, &gameRecord) != 0) {
199 unsigned char *diskBytes;
200 unsigned char *gameBytes;
201 short *diskDeathMission;
202 int *gameDeathMission;
213 for (; slot < 8; slot++) {
214 sprintf(gameRecord.
description,
"game %d", (
int)slot + 1);
215 diskBytes = (
unsigned char *)diskRecord.
description;
216 gameBytes = (
unsigned char *)gameRecord.
description;
217 memcpy(diskBytes, gameBytes,
sizeof(diskRecord.
description));
220 sizeof(diskRecord.
pilots));
226 diskBytes = diskCampaign->
medals;
228 for (index = 0; index < 5; index++) {
229 diskBytes[index] = gameBytes[index];
232 diskBytes = diskCampaign->
badges;
234 for (index = 0; index < 12; index++) {
235 diskBytes[index] = gameBytes[index];
244 diskBytes = (
unsigned char *)
246 gameBytes = (
unsigned char *)
248 for (index = 0; index < 8; index++) {
249 diskBytes[index] = gameBytes[index];
256 for (; diskDeathMission <
258 gameDeathMission++, diskDeathMission++) {
259 *diskDeathMission = (short)*gameDeathMission;
264 for (index = 0; index < 4; index++) {
265 diskBytes[index] = gameBytes[index];
284 for (; diskObjective < diskRecord.
objectives + 16;
285 gameObjective++, diskObjective++) {
286 diskObjective->
mapX = gameObjective->
mapX;
287 diskObjective->
mapY = gameObjective->
mapY;
289 diskObjective->
type = (short)gameObjective->
type;
294 diskObjective->
name = (short)(
int)gameObjective->
name;
295 gameBytes = (
unsigned char *)&gameObjective->
position;
296 diskBytes = (
unsigned char *)&diskObjective->
position;
303 (
int)slot * 0x33c, 0x33c,
322 length = filelength((
int)file);
324 if (length != 0x19e0)
333 for (bunk = 0; bunk < 8; bunk++) {
376 const char *saveCampaignLabel;
380 for (bunk = 0; bunk < 8; bunk++) {
402 unsigned char *diskBytes;
403 short *diskDeathMission;
404 int *gameDeathMission;
409 diskBytes = (
unsigned char *)diskRecord.
description;
414 sizeof(diskRecord.
pilots));
419 diskBytes = diskCampaign->
medals;
420 for (index = 0; index < 5; index++) {
424 diskBytes = diskCampaign->
badges;
425 for (index = 0; index < 12; index++) {
435 for (index = 0; index < 8; index++) {
442 for (; diskDeathMission <
444 gameDeathMission++, diskDeathMission++) {
445 *diskDeathMission = (short)*gameDeathMission;
449 for (index = 0; index < 4; index++) {
469 for (; diskObjective < diskRecord.
objectives + 16;
470 gameObjective++, diskObjective++) {
471 diskObjective->
mapX = gameObjective->
mapX;
472 diskObjective->
mapY = gameObjective->
mapY;
474 diskObjective->
type = (short)gameObjective->
type;
479 diskObjective->
name = (short)(
int)gameObjective->
name;
485 (
int)slot * 0x33c, 0x33c,
488 return ((written != 0) & (file >= 0)) & 1;
493 char *destination,
short maximumLength,
503 bounds.
bottom = (short)(y + 20);
508 bounds.
right = (short)(x +
519 if (
ReadTextInput(destination, maximumLength, inputMode) != 0)
575 memcpy(gameRecord.
pilots, pilots,
576 sizeof(gameRecord.
pilots));
578 if (
SaveGame(slot, &gameRecord) == 0)
591 unsigned char *diskBytes;
592 int *gameDeathMission;
593 short *diskDeathMission;
601 fileOpen = (file >= 0) & 1;
603 (
int)slot * 0x33c, 0x33c,
605 diskBytes = (
unsigned char *)diskRecord.
description;
610 sizeof(gameRecord->
pilots));
615 diskBytes = diskCampaign->
medals;
616 for (index = 0; index < 5; index++) {
620 diskBytes = diskCampaign->
badges;
621 for (index = 0; index < 12; index++) {
631 for (index = 0; index < 8; index++) {
637 for (; diskDeathMission <
639 diskDeathMission++, gameDeathMission++) {
640 *gameDeathMission = (int)*diskDeathMission;
644 for (index = 0; index < 4; index++) {
664 for (; diskObjective < diskRecord.
objectives + 16;
665 diskObjective++, gameObjective++) {
666 gameObjective->
mapX = diskObjective->
mapX;
667 gameObjective->
mapY = diskObjective->
mapY;
669 gameObjective->
type = (int)diskObjective->
type;
674 gameObjective->
name = (
char *)(
int)diskObjective->
name;
678 fileOpen &= read != 0;
680 if (fileOpen != 0 && gameRecord->
occupied != 0)
695 loaded =
LoadGame(slot, &gameRecord);
697 memcpy(pilots, gameRecord.
pilots,
698 sizeof(gameRecord.
pilots));
725 short series,
short mission,
char *description)
745 for (bunk = 0; bunk < 8; bunk++) {
771 for (bunk = 0; bunk < 8; bunk++) {
777 shape, (
short)(bunk + 1));
781 (
short)((bunk % 2) * 31 + 143),
782 (
short)((
short)(bunk / 2) * 5 + 167),
809 for (bunk = 0; bunk < 8; bunk++) {
811 bunkState = &state->
bunks[bunk];
813 bunkTick = frameTick / 4;
827 (
short)((bunk % 2) * 14 + 148),
828 (
short)((bunk / 2) * 5 + 166),
853 (
short)(state->
fallingY / 40 + 27));
890 confirmed = (short)((
short)toupper(
895 return (
int)confirmed;
905 if (
LoadGame(slot, &gameRecord) == 0)
910 confirmed = (short)((
short)toupper(
915 return (
int)confirmed;
929 if (
LoadGame(slot, &gameRecord) == 0)
934 confirmed = (short)((
short)toupper(
939 return (
int)confirmed;
952 }
else if (region % 2 == 0) {
982 struct Shape *background;
1011 while (result == 0) {
1014 background, &animation);
1018 switch (eventType) {
1023 switch ((
short)event.
value) {
1042 if (region >= 0 && region < 16) {
1063 "You step out of the airlock and into...");
1094 background, &animation);
const char * apszSaveCampaignMenuLabels[2]
ModalTextPanel * pModalTextPanel
const TitleMenuRegion aBarracksMenuRegions[21]
ShortPoint aBarracksBunkOrigins[8]
char * apszBarracksMenuLabels[20]
ShortRect stModalTextBounds
short asCampaignBriefingFiles[3]
short asMissionDataFiles[3]
TextContext stDefaultTxtContext
unsigned char cBlackColour
char szTxtWorkspaceBuffer[256]
Viewport stRoomScreenViewport
TextContext * pCurTextContext
unsigned char cBlueColour
unsigned char cViewportClearColour
ConstellationObjectDefinition * pConstellationDefinitionsPtr
unsigned char bInputModeState
MouseCursorState stMouseCursorState
char szDefaultTxtBuf[0xc8]
short nQueuedCampaignIndex
CampaignState stCampaignState
MissionObjective aMissionObjectivesArray[MISSION_OBJECTIVE_COUNT]
Viewport stModalSrcViewport
short nMenuInputRepeatDelay
unsigned char * pMissionCampaignInfo
short asCampaignPilotFiles[3]
PilotRecord aPilotEntriesList[9]
RoomMenu stCurrentRoomMenu
BarracksBunkState bunks[8]
signed char seriesHistory[8]
PilotRecord * currentPilot
signed char seriesHistoryCount
enum ObjectType playerShipType
signed char currentSeries
unsigned char aceFlags[4]
int personalityDeathMission[8]
signed char currentMission
TextContext * previousContext
signed char currentMission
signed char currentSeries
signed char seriesHistoryCount
signed char seriesHistory[8]
short personalityDeathMission[8]
unsigned char aceFlags[4]
SaveGameDiskCampaignState campaign
SaveGameDiskObjective objectives[16]
MissionObjective objectives[16]
Umbrella header for the game core.
void * AllocateTaggedMemory(int size, unsigned short flags)
void HandleBarracksBunkSelection(Viewport *viewport, struct Shape *shape, BarracksAnimationState *state, short region)
void FormatTextBufferFromStart(const char *format,...)
void LeaveAllocationScope(void)
void MoveMenuPointerFromKeyboard(InputEventState *event)
unsigned int InitializeTextContextFromFont(TextContext *context, short fontIndex, unsigned char colour, signed char background)
int ConfirmQuitWingCommander(void)
short __stdcall PollInputEvent(InputEventState *event, short filter)
char *__stdcall DosStrchr(const char *s, short c)
void RestoreModalTextPanel(ModalTextPanel *panel)
unsigned short __stdcall AllocateViewport(Viewport *viewport, short clearColour, short flags)
int ConfirmAwakenAfterBadData(short slot)
void UpdateRoomMenuCursor(void)
void * FetchDiskPacketRetrying(short logicalFile, short section, short flags)
void __stdcall SetTextCursor(unsigned short a, unsigned short b)
void CalibrateJoystickInteractive()
void InitializeRoomViewports(void)
void DrawBarracksStaticDetails(Viewport *viewport, struct Shape *shape)
void __stdcall PromptInsertNumberedDisk(short logicalFile)
void ClearInputKeyStatePreservingModifiers(void)
unsigned int spacetrack(int track, int mode, short enabled)
int FindMenuRegionAtPoint(short x, short y, const TitleMenuRegion *regions)
short ReadTextInput(char *destination, short maximumLength, short mode)
short SaveGame(short slot, SaveGameRecord *gameRecord)
void DrawModalTextPanel(ModalTextPanel *panel, short x, short y, unsigned char alignment, const char *format,...)
short __stdcall MeasureTextPixelWidthClamped(const char *text)
void DrawSpriteDefault(Viewport *viewport, short x, short y, struct Shape *shape, short frame)
int __stdcall ReadDataFileAtOffset(unsigned short fd, int offset, unsigned int length, void *data)
int IsFrameTickElapsed(void)
void StopMusicUnlessSuppressed(void)
void FlushInputEvents(void)
unsigned int ViewMedals(void)
void AnimateBarracks(Viewport *viewport, struct Shape *shape, BarracksAnimationState *state)
void * LoadPacketIntoBuffer(short logicalFile, short section, void *destination)
void ShowModalMessage(const char *format,...)
short WaitForInputKey(void)
void __stdcall DosMemcpy(void *dst, const void *src, unsigned short n)
unsigned int PreloadMusicTrackHook(short track)
void InitializeRoomMenu(const TitleMenuRegion *regions, char **labels, Viewport *viewport, char *text, unsigned char alignment)
void __stdcall CloseDataFile(unsigned short fd)
short PromptForTextInput(short x, short y, const char *prompt, char *destination, short maximumLength, short inputMode)
void InitializeBarracksAnimation(BarracksAnimationState *state)
void EnterAllocationScope(void)
int ConfirmReplaceFaultyData(short slot)
char *__stdcall DosStrcpy(char *dst, const char *src)
short BarracksScreen(void)
void SetAwakenBarracksMenuLabel(char **label, short series, short mission, char *description)
short __stdcall OpenDataFileOrDie(const char *path)
void __stdcall SetFrameTimerPeriodDirect(short p)
void __stdcall WarpMouseTo(short x, short y)
unsigned int ReleaseMusicTrackHook(short track)
short __stdcall CreateDataFile(const char *path)
short WaitForStreamInputKey(void)
void SaveGameWithNamePrompt(short slot, CampaignState *campaign, PilotRecord *pilots, MissionObjective *objectives)
unsigned int LoadMissionData(short series, short mission)
void RefreshRoomMenuLabel(void)
void FreeBarracksMenuLabels(void)
unsigned short EraseTextContextBackground(TextContext *context)
void FreeBarracksMenuLabel(char **label)
void EnsureSaveGameFile(void)
void DrawBarracksBunks(Viewport *viewport, struct Shape *shape, BarracksAnimationState *state)
void DrawViewportBorder(Viewport *viewport, short left, short top, short right, short bottom, short colour)
void ClearViewport(Viewport *viewport, short colour)
void exit_squadron(const char *msg)
void PlaySfxWaveFileByNumber()
short InitializeModalTextPanel(ModalTextPanel *panel, short fontIndex, ShortRect bounds, short clearColour, short backgroundColour, short borderColour)
void CorrectPointers(void)
void __stdcall free_viewport(Viewport *viewport)
void ReleasePacketHandle(void *handle)
void UpdateBarracksScreen(Viewport *viewport, struct Shape *shape, BarracksAnimationState *state)
int LoadGame(short slot, SaveGameRecord *gameRecord)
short __stdcall WriteDataFileAtOffset(unsigned short fd, int offset, unsigned int length, const void *data)
void GetBunkInfo(BarracksAnimationState *state)
void __stdcall EventManagerHook(void(*callback)(void))
unsigned int ShowMemoryStatusDebug(void)
void ReleaseModalTextPanel(void)
void SetBunkMenuLabel(short occupied, short side, char **label, short series, short mission, char *description)
unsigned int ReleaseTextFont(short fontIndex)
short __stdcall RandomInRange(short lo, short hi)
short AnySavedGames(void)
int WarnLoadGameFirst(void)
void LoadGameFromSlot(short slot, CampaignState *campaign, PilotRecord *pilots, MissionObjective *objectives)
char *__stdcall ResetStringBuilder(TextContext *context)
void CopyViewportContents(Viewport *source, Viewport *destination)
short ShowModalTextPanel(short fontIndex, const char *format,...)
void ShutdownEventManager(void)
void CreateEmptySaveGameFile(void)