Wing Commander II
Reconstructed Win32 source (1996)
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 */
10void free_viewport(Viewport *viewport)
11{
12 int i;
13 unsigned char *allocation;
14
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) {
26 break;
27 }
28 }
29
30 if (viewport->rowOffsets != 0) {
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)
41 if (g_101_stScrViewInfo.allocation == allocation)
43 if (g_stSecondaryViewBufferBlock.pixels == allocation)
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. */
51int g_nViewportAllocationCount; /* 0x005d19bc */
52unsigned char *g_apViewportAllocations[128]; /* 0x005d19c0 */
53int g_2_nFreeViewportCalls; /* 0x005d1bc0 */
void free_viewport(Viewport *viewport)
Definition vpfree.c:10
void ReleasePacketHandle(void *handle)
Definition memapi.c:108
Shared Win32 declarations, types and library interfaces.
unsigned char * g_apViewportAllocations[128]
Definition vpfree.c:52
short g_nSpacePaletteFadeMode
Definition palalloc.c:8
int g_nViewportAllocationCount
Definition vpfree.c:51
Viewport g_101_stScrViewInfo
Definition cockpt.c:3831
Viewport g_stSecondaryViewBufferBlock
Definition message.c:234
int g_2_nFreeViewportCalls
Definition vpfree.c:53
unsigned char * pixels
Definition game.h:150
unsigned char * allocation
Definition game.h:156
unsigned short * rowOffsets
Definition game.h:151