Wing Commander II
Reconstructed Win32 source (1996)
Loading...
Searching...
No Matches
usedcols.c
Go to the documentation of this file.
1/*
2 * Collects the palette indices in use.
3 *
4 * Retail object 0x4589D0-0x458A8F (link order; see docs/ORDER.md).
5 */
6#include "game.h"
7#include <malloc.h>
8
9#pragma function(memset)
10/* Function start: 0x4589D0 */
12 unsigned char *indices,
13 short capacity)
14{
15 short count;
16 short index;
17 unsigned char *map;
18
19 count = 0;
20 map = AllocateTaggedMemory((unsigned int)capacity, 0);
21 if (map == 0)
22 return 0;
23
24 memset(map, 0, (unsigned int)capacity);
25 EstablishColors(viewport, map);
26 for (index = 0; index < capacity; index++) {
27 if (map[index] != 0) {
28 indices[count] = (unsigned char)index;
29 count++;
30 }
31 }
33 return count;
34}
short CollectActivePaletteIndices(Viewport *viewport, unsigned char *indices, short capacity)
Definition usedcols.c:11
void * AllocateTaggedMemory(unsigned int size, short flags)
Definition memapi.c:92
void EstablishColors(Viewport *viewport, unsigned char *active)
Definition gr.c:663
void ReleasePacketHandle(void *handle)
Definition memapi.c:108
Shared Win32 declarations, types and library interfaces.