Wing Commander II
Reconstructed Win32 source (1996)
Toggle main menu visibility
Loading...
Searching...
No Matches
vpfree.c
Go to the documentation of this file.
1
/*
2
* Frees a viewport.
3
*
4
* Retail object 0x4471B0-0x4472FF (link order; see docs/ORDER.md).
5
*/
6
#include "
game.h
"
7
#include <malloc.h>
8
9
/* Function start: 0x4471B0 */
10
void
free_viewport
(
Viewport
*viewport)
11
{
12
int
i;
13
unsigned
char
*allocation;
14
15
g_2_nFreeViewportCalls
++;
16
allocation = viewport->
allocation
;
17
if
(allocation == 0)
18
return
;
19
20
for
(i = 0; i <
g_nViewportAllocationCount
; i++) {
21
if
(
g_apViewportAllocations
[i] == viewport->
allocation
) {
22
g_nViewportAllocationCount
--;
23
g_apViewportAllocations
[i] =
24
g_apViewportAllocations
[
25
g_nViewportAllocationCount
];
26
break
;
27
}
28
}
29
30
if
(viewport->
rowOffsets
!= 0) {
31
ReleasePacketHandle
(viewport->
rowOffsets
);
32
viewport->
rowOffsets
= 0;
33
}
34
if
(
g_nSpacePaletteFadeMode
!= 0x13)
35
printf(
"free_viewport not mcga\n"
);
36
ReleasePacketHandle
(allocation);
37
viewport->
pixels
= 0;
38
viewport->
allocation
= 0;
39
if
(
g_101_stScrViewInfo
.
pixels
== allocation)
40
g_101_stScrViewInfo
.
pixels
= 0;
41
if
(
g_101_stScrViewInfo
.
allocation
== allocation)
42
g_101_stScrViewInfo
.
allocation
= 0;
43
if
(
g_stSecondaryViewBufferBlock
.
pixels
== allocation)
44
g_stSecondaryViewBufferBlock
.
pixels
= 0;
45
if
(
g_stSecondaryViewBufferBlock
.
allocation
== allocation)
46
g_stSecondaryViewBufferBlock
.
allocation
= 0;
47
}
48
49
/* Linker commons defined here. LINK lays a unit's commons out by the
50
* identifiers' hash keys, so these spellings follow the original addresses. */
51
int
g_nViewportAllocationCount
;
/* 0x005d19bc */
52
unsigned
char
*
g_apViewportAllocations
[128];
/* 0x005d19c0 */
53
int
g_2_nFreeViewportCalls
;
/* 0x005d1bc0 */
free_viewport
void free_viewport(Viewport *viewport)
Definition
vpfree.c:10
ReleasePacketHandle
void ReleasePacketHandle(void *handle)
Definition
memapi.c:108
game.h
Shared Win32 declarations, types and library interfaces.
g_apViewportAllocations
unsigned char * g_apViewportAllocations[128]
Definition
vpfree.c:52
g_nSpacePaletteFadeMode
short g_nSpacePaletteFadeMode
Definition
palalloc.c:8
g_nViewportAllocationCount
int g_nViewportAllocationCount
Definition
vpfree.c:51
g_101_stScrViewInfo
Viewport g_101_stScrViewInfo
Definition
cockpt.c:3831
g_stSecondaryViewBufferBlock
Viewport g_stSecondaryViewBufferBlock
Definition
message.c:234
g_2_nFreeViewportCalls
int g_2_nFreeViewportCalls
Definition
vpfree.c:53
Viewport
Definition
game.h:149
Viewport::pixels
unsigned char * pixels
Definition
game.h:150
Viewport::allocation
unsigned char * allocation
Definition
game.h:156
Viewport::rowOffsets
unsigned short * rowOffsets
Definition
game.h:151
src
vpfree.c
Generated by
1.18.0