Wing Commander
Reconstructed Win32 source (1996)
Toggle main menu visibility
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
12
short
nVideoMode
= -1;
/* 0x0046b168 */
13
14
15
/* Linker commons defined here; LINK orders them by identifier hash. */
16
int
aiPilotLevel
[12];
/* 0x0059cf30 */
17
short
asTargetListRangesArray
[16];
/* 0x0059cf60 */
18
short
asObjectDrawPosY
[
SPACE_OBJECT_COUNT
];
/* 0x0059cf80 */
19
short
asObjectDrawPosX
[
SPACE_OBJECT_COUNT
];
/* 0x0059d000 */
20
short
asPreviousObjectDistance
[
SPACE_OBJECT_COUNT
];
/* 0x0059d080 */
21
enum
ObjectClass
aeObjectClass
[
SPACE_OBJECT_COUNT
];
/* 0x0059d100 */
22
enum
ShipObjective
aeShipObjectiveList
[12];
/* 0x0059d200 */
23
short
asObjectViewFrames
[
SPACE_OBJECT_COUNT
];
/* 0x0059d230 */
24
int
nCurObjectiveRangeValue
;
/* 0x0059d2b0 */
25
signed
char
acWingmanMessageStatesArray
[16];
/* 0x0059d2c0 */
26
short
asCollisionDelayList
[16];
/* 0x0059d2d0 */
27
28
/* Function start: 0x4318F0 */
29
void
__stdcall
ShutdownVideoHook
(
short
mode)
30
{
31
ReleaseVideoResourcesHook
();
32
}
33
34
/* Function start: 0x431900 */
35
short
__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 */
65
void
__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 */
79
void
PrintPaletteAllocationMap
(
void
)
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
}
asObjectDrawPosX
short asObjectDrawPosX[SPACE_OBJECT_COUNT]
Definition
video.c:19
awPalEntryAllocation
unsigned short awPalEntryAllocation[256]
Definition
music.c:95
aiPilotLevel
int aiPilotLevel[12]
Definition
video.c:16
nVideoMode
short nVideoMode
Definition
video.c:12
acWingmanMessageStatesArray
signed char acWingmanMessageStatesArray[16]
Definition
video.c:25
asCollisionDelayList
short asCollisionDelayList[16]
Definition
video.c:26
asObjectDrawPosY
short asObjectDrawPosY[SPACE_OBJECT_COUNT]
Definition
video.c:18
aeShipObjectiveList
enum ShipObjective aeShipObjectiveList[12]
Definition
video.c:22
asTargetListRangesArray
short asTargetListRangesArray[16]
Definition
video.c:17
aeObjectClass
enum ObjectClass aeObjectClass[SPACE_OBJECT_COUNT]
Definition
video.c:21
asPreviousObjectDistance
short asPreviousObjectDistance[SPACE_OBJECT_COUNT]
Definition
video.c:20
nCurObjectiveRangeValue
int nCurObjectiveRangeValue
Definition
video.c:24
asObjectViewFrames
short asObjectViewFrames[SPACE_OBJECT_COUNT]
Definition
video.c:23
wc1.h
Umbrella header for the game core.
ReleaseContiguousPaletteEntries
void __stdcall ReleaseContiguousPaletteEntries(short firstEntry)
Definition
video.c:65
ReleaseVideoResourcesHook
void ReleaseVideoResourcesHook(void)
Definition
mathfp.c:190
ShutdownVideoHook
void __stdcall ShutdownVideoHook(short mode)
Definition
video.c:29
ReserveContiguousPaletteEntries
short __stdcall ReserveContiguousPaletteEntries(short entryCount)
Definition
video.c:35
PrintPaletteAllocationMap
void PrintPaletteAllocationMap(void)
Definition
video.c:79
ShipObjective
ShipObjective
Definition
wcdata.h:136
SPACE_OBJECT_COUNT
#define SPACE_OBJECT_COUNT
Definition
wcdata.h:1004
ObjectClass
ObjectClass
Definition
wcdata.h:37
src
video.c
Generated by
1.18.0