Wing Commander
Reconstructed Win32 source (1996)
Loading...
Searching...
No Matches
video.c
Go to the documentation of this file.
1/**
2 * @file
3 * @ingroup graphics
4 * @brief Video resource shutdown and palette allocation.
5 *
6 * Address range 4318f0-431a0f.
7 */
8#include "wc1.h"
9#include <dos.h>
10#include <sys/types.h>
11
12short nVideoMode = -1; /* 0x0046b168 */
13
14
15/* Linker commons defined here; LINK orders them by identifier hash. */
16int aiPilotLevel[12]; /* 0x0059cf30 */
17short asTargetListRangesArray[16]; /* 0x0059cf60 */
18short asObjectDrawPosY[SPACE_OBJECT_COUNT]; /* 0x0059cf80 */
19short asObjectDrawPosX[SPACE_OBJECT_COUNT]; /* 0x0059d000 */
22enum ShipObjective aeShipObjectiveList[12]; /* 0x0059d200 */
23short asObjectViewFrames[SPACE_OBJECT_COUNT]; /* 0x0059d230 */
24int nCurObjectiveRangeValue; /* 0x0059d2b0 */
25signed char acWingmanMessageStatesArray[16]; /* 0x0059d2c0 */
26short asCollisionDelayList[16]; /* 0x0059d2d0 */
27
28/* Function start: 0x4318F0 */
29void __stdcall ShutdownVideoHook(short mode)
30{
32}
33
34/* Function start: 0x431900 */
35short __stdcall ReserveContiguousPaletteEntries(short entryCount)
36{
37 short entry;
38 short freeEntries;
39 short firstEntry;
40
41 firstEntry = 0;
42 freeEntries = 0;
43 entry = 0;
44 for (;;) {
45 if (awPalEntryAllocation[entry] != 0) {
46 freeEntries = 0;
47 firstEntry = (short)(entry + 1);
48 } else
49 freeEntries++;
50 if (freeEntries == entryCount)
51 break;
52 entry++;
53 if (entry >= 256)
54 return -1;
55 }
56
57 for (freeEntries = 0; freeEntries < entryCount; freeEntries++) {
58 awPalEntryAllocation[firstEntry + freeEntries] =
59 entryCount;
60 }
61 return firstEntry;
62}
63
64/* Function start: 0x431970 */
65void __stdcall ReleaseContiguousPaletteEntries(short firstEntry)
66{
67 short entry;
68 short entryCount;
69
70 entry = 0;
71 entryCount = awPalEntryAllocation[firstEntry];
72 while (entry < entryCount) {
73 awPalEntryAllocation[firstEntry + entry] = 0;
74 entry++;
75 }
76}
77
78/* Function start: 0x4319B0 */
80{
81 short index;
82 short row;
83 short column;
84
85 index = 0;
86 row = 4;
87 do {
88 column = 0x40;
89 do {
90 printf("%c", awPalEntryAllocation[index++] < 1 ?
91 '_' : '.');
92 column--;
93 } while (column != 0);
94 printf("\n");
95 row--;
96 } while (row != 0);
97}
short asObjectDrawPosX[SPACE_OBJECT_COUNT]
Definition video.c:19
unsigned short awPalEntryAllocation[256]
Definition music.c:95
int aiPilotLevel[12]
Definition video.c:16
short nVideoMode
Definition video.c:12
signed char acWingmanMessageStatesArray[16]
Definition video.c:25
short asCollisionDelayList[16]
Definition video.c:26
short asObjectDrawPosY[SPACE_OBJECT_COUNT]
Definition video.c:18
enum ShipObjective aeShipObjectiveList[12]
Definition video.c:22
short asTargetListRangesArray[16]
Definition video.c:17
enum ObjectClass aeObjectClass[SPACE_OBJECT_COUNT]
Definition video.c:21
short asPreviousObjectDistance[SPACE_OBJECT_COUNT]
Definition video.c:20
int nCurObjectiveRangeValue
Definition video.c:24
short asObjectViewFrames[SPACE_OBJECT_COUNT]
Definition video.c:23
Umbrella header for the game core.
void __stdcall ReleaseContiguousPaletteEntries(short firstEntry)
Definition video.c:65
void ReleaseVideoResourcesHook(void)
Definition mathfp.c:190
void __stdcall ShutdownVideoHook(short mode)
Definition video.c:29
short __stdcall ReserveContiguousPaletteEntries(short entryCount)
Definition video.c:35
void PrintPaletteAllocationMap(void)
Definition video.c:79
ShipObjective
Definition wcdata.h:136
#define SPACE_OBJECT_COUNT
Definition wcdata.h:1004
ObjectClass
Definition wcdata.h:37