Commit 05ebc4c7 authored by Lee Shallis's avatar Lee Shallis
Browse files

FINALLY! Image actuually came out correct with my own decompression

code! I look forward to going back to texture tests now :)
parent c8384c61
......@@ -333,28 +333,13 @@ int LoadZlibHuffs( ZLIB *zlib )
ZLIB_SYMBOL *codes = Codes->symbols, *Code;
ZLIB_FULL_SYMBOL fullType = {0}, Temp;
STREAM *Stream = zlib->Stream;
FILE *verbose = zlib->Buffers->Alloc->verbose;
int done = 0, pos = ZLIB_MAX_TYPES, lit = 0, prv = 0,
keep = Codes->foresee,
total = keep + Loops->foresee, count = keep, loose = 0;
if ( !quiet_zlib )
{
ECHO
(
verbose,
fprintf
(
verbose,
"LoadZlibHuffs( %p, %d )\n",
(void*)zlib, count
)
);
}
total = keep + Loops->foresee, stop = keep, lose = 0;
while ( done < total )
{
while ( done < count && Stream->err == 0 )
while ( done < stop && Stream->err == 0 )
{
int i = 0;
ZLIB_SYMBOL *Type = SeekZlibSymbol( Stream, Types );
......@@ -365,7 +350,7 @@ int LoadZlibHuffs( ZLIB *zlib )
Temp.cpy = fullType.cpy;
if ( Type->lit < 16 )
Temp.len = loose ? Type->len + 1 : Type->lit;
Temp.len = Type->lit;
else
{
Temp.cpy += StreamBits( Stream, fullType.get, true );
......@@ -393,14 +378,14 @@ int LoadZlibHuffs( ZLIB *zlib )
Code->use = Temp.use;
Code->len = Temp.len;
Code->lit = lit;
Code->src = done - loose;
Code->src = done - lose;
}
}
lit = ZLIB_LOOP_LIT0;
pos = ZLIB_MAX_TYPES + ZLIB_MAX_CODES;
count = total;
loose = keep;
lose = keep;
stop = total;
}
Codes->used = ZLIB_MAX_CODES;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment