#include <stdio.h>
#include <string.h>
#include "../../common/platform.h"
#include "../../common/common_utils.h"
#include "../../string/wtstring.h"
#include "../../memory/memory.h"
#include "../../filesys/file.h"
#include "../../loaders/tga.h"
Data Structures | |
struct | huffnode |
struct | pictable_t |
struct | fontstruct |
Defines | |
#define | NUM_CHUNKS 256 |
Functions | |
PRIVATE SW32 | getGFXFilePosition (W32 chunk) |
Calculate graphic file position. | |
PRIVATE SW32 | getGFXChunkLength (W32 chunk) |
Calculate length of compressed graphic chunk. | |
PRIVATE void | HuffExpand (const W8 *source, W8 *destination, W32 length, huffnode *hufftable) |
Expand Huffman compressed data. | |
PRIVATE SW32 | expandGFXChunk (W32 chunk, const W8 *source) |
Expand compressed graphic chunk. | |
PUBLIC SW32 | GFXFile_cacheChunk (W32 chunkId) |
Load graphic chunk into memory. | |
PUBLIC wtBoolean | GFXFile_Setup (const char *dictfname, const char *headfname, const char *graphfname) |
Setup graphic files for decoding. | |
PUBLIC void | GFXFile_Shutdown (void) |
Shutdown graphic files. | |
PUBLIC void | GFXFile_printPicTable (void) |
Prints out graphic header information [Used for debugging]. | |
PUBLIC void * | GFXFile_getChunk (W32 chunkId) |
Get raw data. | |
PUBLIC void * | GFXFile_decodeChunk_RGB24 (W32 chunkId, W32 *width_out, W32 *height_out, W8 *palette) |
Decode graphic chunk into RGB24 image data. | |
PUBLIC void * | GFXFile_decodeChunk_RGB32 (W32 chunkId, W32 *width_out, W32 *height_out, W8 *palette) |
Decode graphic chunk into RGB32 image data. | |
PUBLIC void | GFXFile_setStartPicValue (W32 startpic) |
Set startpic value. | |
PUBLIC W32 | GFXFile_getStartPicValue (void) |
Get startpic value. | |
PUBLIC void | GFXFile_decodeFont (W32 fontId, W32 font_width, W32 font_height, const char *path) |
Extract and save font as TGA file. | |
PUBLIC wtBoolean | GFXFile_decodeScript (W32 textId_start, W32 textId_end, const char *path) |
Extract and save game script to file. | |
PUBLIC wtBoolean | GFXFile_decodeGFX (W32 start, W32 end, W8 *palette, const char *path) |
Decode gfx data into TGA files. | |
Variables | |
PRIVATE pictable_t * | pictable |
PRIVATE huffnode | grhuffman [255] |
PRIVATE FILE * | file_handle_gfx |
PRIVATE SW32 * | grstarts |
PRIVATE W32 | numImages |
PRIVATE W32 | start_pics = 3 |
PRIVATE void * | graphic_segments [NUM_CHUNKS] |
PRIVATE SW32 expandGFXChunk | ( | W32 | chunk, | |
const W8 * | source | |||
) |
Expand compressed graphic chunk.
[in] | chunk | Chunk number to expand. |
[in] | source | Pointer to compressed data. |
PRIVATE SW32 getGFXChunkLength | ( | W32 | chunk | ) |
Calculate length of compressed graphic chunk.
[in] | chunk | Chunk number to calculate file offset. |
PRIVATE SW32 getGFXFilePosition | ( | W32 | chunk | ) |
Calculate graphic file position.
[in] | chunk | Chunk number to calculate file offset. |
PUBLIC SW32 GFXFile_cacheChunk | ( | W32 | chunkId | ) |
Load graphic chunk into memory.
[in] | chunkId | Chunk number to cache. |
PUBLIC void* GFXFile_decodeChunk_RGB24 | ( | W32 | chunkId, | |
W32 * | width_out, | |||
W32 * | height_out, | |||
W8 * | palette | |||
) |
Decode graphic chunk into RGB24 image data.
[in] | chunkId | Graphic chunk to decode. |
[out] | width_out | Width of image in pixels. |
[out] | height_out | Height of image in pixels. |
[in] | palette | Pointer to image palette (Must have 768 entries). |
PUBLIC void* GFXFile_decodeChunk_RGB32 | ( | W32 | chunkId, | |
W32 * | width_out, | |||
W32 * | height_out, | |||
W8 * | palette | |||
) |
Decode graphic chunk into RGB32 image data.
[in] | chunkId | Graphic chunk to decode. |
[out] | width_out | Width of image in pixels. |
[out] | height_out | Height of image in pixels. |
[in] | palette | Pointer to image palette (Must have 768 entries). |
PUBLIC void GFXFile_decodeFont | ( | W32 | fontId, | |
W32 | font_width, | |||
W32 | font_height, | |||
const char * | path | |||
) |
Extract and save font as TGA file.
[in] | fontId | Font chunk to save. |
[in] | font_width | Width of font slate in pixels. |
[in] | font_height | Height of font slate in pixels. |
[in] | path | Path to save font files to. |
PUBLIC wtBoolean GFXFile_decodeGFX | ( | W32 | start, | |
W32 | end, | |||
W8 * | palette, | |||
const char * | path | |||
) |
Decode gfx data into TGA files.
[in] | start | start offset. |
[in] | end | end offset. |
[in] | palette | Pointer to palette array. |
[in] | path | Directory path to save files to. |
PUBLIC wtBoolean GFXFile_decodeScript | ( | W32 | textId_start, | |
W32 | textId_end, | |||
const char * | path | |||
) |
Extract and save game script to file.
[in] | textId_start | Text start identifier. |
[in] | textId_end | Text end identifier. |
[in] | path | Path to save script into. |
PUBLIC void* GFXFile_getChunk | ( | W32 | chunkId | ) |
Get raw data.
[in] | chunkId | Graphic chunk number. |
PUBLIC W32 GFXFile_getStartPicValue | ( | void | ) |
Get startpic value.
PUBLIC void GFXFile_setStartPicValue | ( | W32 | startpic | ) |
Set startpic value.
[in] | startpic | startpic value. |
PUBLIC wtBoolean GFXFile_Setup | ( | const char * | dictfname, | |
const char * | headfname, | |||
const char * | graphfname | |||
) |
Setup graphic files for decoding.
[in] | dictfname | Huffman dictionary file name. |
[in] | headfname | Graphic header file name. |
[in] | graphfname | Graphic data file name. |
PRIVATE void HuffExpand | ( | const W8 * | source, | |
W8 * | destination, | |||
W32 | length, | |||
huffnode * | hufftable | |||
) |
Expand Huffman compressed data.
[in] | source | Pointer to compressed data. |
[out] | destination | Pointer to hold decompressed data. |
[in] | length | Length of expanded data in bytes. |
[in] | hufftable | Huffman dictionary data. |