[ Home ]

wolfcore_pm.c File Reference

Wolfenstein 3-D page file decoder. More...

#include <stdio.h>
#include <string.h>
#include "../../common/platform.h"
#include "../../common/common_utils.h"
#include "../../string/wtstring.h"
#include "../../memory/memory.h"
#include "../../loaders/wav.h"
#include "../../loaders/tga.h"
#include "../../image/image.h"
#include "../../image/hq2x.h"
#include "../../image/scalebit.h"

Include dependency graph for wolfcore_pm.c:


Data Structures

struct  PageList_t
struct  t_compshape

Functions

PUBLIC wtBoolean PageFile_Setup (const char *pagefname, W32 *nBlocks, W32 *SpriteStart, W32 *SoundStart)
 Setup page file for decoding.
PUBLIC void PageFile_Shutdown (void)
 Shutdown page cache.
PRIVATE void PageFile_ReadFromFile (W8 *buf, SW32 offset, W32 length)
 Reads in data from Page file.
PUBLIC void * PageFile_getPage (W32 pagenum, W32 *length)
 Get Page file raw data.
PUBLIC void * PageFile_decodeWall_RGB24 (W8 *data, W8 *palette)
 Decodes raw wall data into RGB-24.
PUBLIC void * PageFile_decodeWall_RGB32 (W8 *data, W8 *palette)
 Decodes raw wall data into RGB-32.
PUBLIC void * PageFile_decodeSprite_RGB24 (W8 *data, W8 *palette)
 Decodes raw sprite data into RGB-24.
PUBLIC void * PageFile_decodeSprite_RGB32 (W8 *data, W8 *palette)
 Decodes raw sprite data into RGB32.
PUBLIC wtBoolean PageFile_ReduxDecodePageData (const char *vsfname, const char *wallPath, const char *spritePath, const char *soundPath, W32 scaleFilter, W8 *palette)
 Redux the Page file data.

Variables

PUBLIC const W32 SAMPLERATE = 7000
wtBoolean _saveAudioAsWav
PRIVATE PageList_t * PMPages = NULL
PRIVATE FILE * file_handle_page = NULL

Detailed Description

Wolfenstein 3-D page file decoder.

Author:
Michael Liebscher
Date:
2007-2009
Note:
Portion of this code was derived from Wolfenstein 3-D, and was originally written by Id Software, Inc.

Function Documentation

PUBLIC void* PageFile_decodeSprite_RGB24 ( W8 *  data,
W8 *  palette 
)

Decodes raw sprite data into RGB-24.

Parameters:
[in] data Raw sprite data.
[in] palette Palette array.
Returns:
On success pointer to raw image data block, otherwise NULL.
Note:
Caller is responsible for freeing allocated data by calling MM_FREE.

PUBLIC void* PageFile_decodeSprite_RGB32 ( W8 *  data,
W8 *  palette 
)

Decodes raw sprite data into RGB32.

Parameters:
[in] data Raw sprite data.
[in] palette Palette array.
Returns:
On success pointer to raw image data block, otherwise NULL.
Note:
Caller is responsible for freeing allocated data by calling MM_FREE.

Here is the caller graph for this function:

PUBLIC void* PageFile_decodeWall_RGB24 ( W8 *  data,
W8 *  palette 
)

Decodes raw wall data into RGB-24.

Parameters:
[in] data Raw wall data.
[in] palette Palette array.
Returns:
On success pointer to raw image data block, otherwise NULL.
Note:
Caller is responsible for freeing allocated data by calling MM_FREE.

PUBLIC void* PageFile_decodeWall_RGB32 ( W8 *  data,
W8 *  palette 
)

Decodes raw wall data into RGB-32.

Parameters:
[in] data Raw wall data.
[in] palette Palette array.
Returns:
On success pointer to raw image data block, otherwise NULL.
Note:
Caller is responsible for freeing allocated data by calling MM_FREE.

Here is the caller graph for this function:

PUBLIC void* PageFile_getPage ( W32  pagenum,
W32 *  length 
)

Get Page file raw data.

Parameters:
[in] pagenum Page to load.
[in] length Length of data.
Returns:
On success pointer to data block, otherwise NULL.
Note:
Caller is responsible for freeing allocated data by calling MM_FREE.

Here is the call graph for this function:

Here is the caller graph for this function:

PRIVATE void PageFile_ReadFromFile ( W8 *  buf,
SW32  offset,
W32  length 
)

Reads in data from Page file.

Parameters:
[out] buf Storage location for data.
[in] offset Number of bytes from beginning of file.
[in] length Maximum number of items to be read.
Returns:
Nothing.

Here is the caller graph for this function:

PUBLIC wtBoolean PageFile_ReduxDecodePageData ( const char *  vsfname,
const char *  wallPath,
const char *  spritePath,
const char *  soundPath,
W32  scaleFilter,
W8 *  palette 
)

Redux the Page file data.

Parameters:
[in] vsfname data file name.
[in] wallPath Path to save wall data.
[in] spritePath Path to save sprite data.
[in] soundPath Path to save sound data.
[in] scaleFilter Scale images [0 = Original, 1 = Scale2x, 2 = hq2x].
[in] palette Palette array.
Returns:
On success true, otherwise false.
Note:
Caller is responsible for freeing allocated data by calling MM_FREE.

Here is the call graph for this function:

Here is the caller graph for this function:

PUBLIC wtBoolean PageFile_Setup ( const char *  pagefname,
W32 *  nBlocks,
W32 *  SpriteStart,
W32 *  SoundStart 
)

Setup page file for decoding.

Parameters:
[in] pagefname Source buffer to convert from
[out] nBlocks Destination buffer to convert to.
[out] SpriteStart Offset index for sprite data.
[out] SoundStart Offset index for sound data.
Returns:
On success true, otherwise false.

Here is the call graph for this function:

Here is the caller graph for this function: