Skip to content

Commit

Permalink
Update properties.
Browse files Browse the repository at this point in the history
git-svn-id: svn+ssh://jay/var/svn/wolf/trunk@63 32837ae5-38f0-4cfd-8401-3ff76d8497c4
  • Loading branch information
paul committed Aug 3, 2007
1 parent 07599d1 commit 3a5fb71
Showing 1 changed file with 70 additions and 0 deletions.
70 changes: 70 additions & 0 deletions build_pictable.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
#include "wl_def.h"

#include "huffman.h"

void CAL_HuffExpand(const byte *source, byte *dest, long length,
const huffnode *htable)
{
const huffnode *headptr;
const huffnode *nodeon;
byte mask = 0x01;
word path;
byte *endoff = dest + length;

nodeon = headptr = htable + 254;

do {
if (*source & mask)
path = 1;
else
path = 0;
mask <<= 1;
if (mask == 0x00) {
mask = 0x01;
source++;
}
if (path ? nodeon->flag1 : nodeon->flag0) {
nodeon = (htable + nodeon->val[path]);
} else {
*dest = nodeon->val[path];
dest++;
nodeon = headptr;
}
} while (dest != endoff);
}

int main()
{
byte *source;
byte *p;
int start;
int end;
int i;
int size;
int compressed;
FILE *f = fopen("vgagraph.wl6", "rb");
if (!f)
return 1;

start = grstarts[STRUCTPIC];
compressed = grstarts[STRUCTPIC + 1] - start;
source = malloc(compressed);
fread(source, 1, compressed, f);
fclose(f);

size = source[0]|(source[1]<<8)|(source[2]<<16)|(source[3]<<24);
source += 4;

p = malloc(size);
CAL_HuffExpand(source, p, size, grhuffman);

printf("#include \"wl_def.h\"\n");
printf("const pictabletype pictable[%d] = {\n", size / 4);
for (i = 0; i < size / 4; i++)
{
printf("{%d,%d},\n", p[0] | (p[1] << 8), p[2] | (p[3] << 8));
p += 4;
}
printf("};\n");
return 0;
}

0 comments on commit 3a5fb71

Please sign in to comment.