V-Gears 0
Free Final Fantasy VII engine.
VGears::BackgroundFileSerializer Class Reference

Handles the serialization of background files. More...

#include <VGearsBackgroundFileSerializer.h>

Inheritance diagram for VGears::BackgroundFileSerializer:
Collaboration diagram for VGears::BackgroundFileSerializer:

Classes

struct  Header
 A background file header. More...
 

Public Types

enum  {
  BIT_MASK_RED = 0xF800 , BIT_MASK_GREEN = 0x07C0 , BIT_MASK_BLUE = 0x001F , BIT_SIZE = 0x001F ,
  BIT_MASK_RGB = BIT_MASK_BLUE | BIT_MASK_GREEN | BIT_MASK_RED , SPRITE_DST_MAX = 1024
}
 
typedef BackgroundFile::Layer Layer
 
typedef BackgroundFile::SpriteData SpriteData
 
typedef BackgroundFile::SpriteList SpriteList
 
typedef BackgroundFile::Page Page
 
typedef BackgroundFile::Color Color
 

Public Member Functions

 BackgroundFileSerializer ()
 Constructor. More...
 
virtual ~BackgroundFileSerializer ()
 Destructor. More...
 
void ImportBackgroundFile (Ogre::DataStreamPtr &stream, BackgroundFile *dest)
 Imports a background file. More...
 
- Public Member Functions inherited from VGears::Serializer
 Serializer ()
 Constructor. More...
 
virtual ~Serializer ()
 Destructor. More...
 

Protected Member Functions

virtual void ReadFileHeader (Ogre::DataStreamPtr &stream)
 Reads a background file header. More...
 
virtual void ReadSectionHeader (Ogre::DataStreamPtr &stream, const String &section_name)
 Reads a section of a background file header. More...
 
virtual void ReadPallete (Ogre::DataStreamPtr &stream, BackgroundFile *dest)
 Reads pallete data from a background file. More...
 
virtual void ReadBackground (Ogre::DataStreamPtr &stream, BackgroundFile *dest)
 Reads background data from a background file. More...
 
virtual void ReadTexture (Ogre::DataStreamPtr &stream, BackgroundFile *dest)
 Reads texture data from a background file. More...
 
virtual void ReadEnd (Ogre::DataStreamPtr &stream)
 
virtual void ReadLayer (Ogre::DataStreamPtr &stream, Layer *dest, size_t layer_index)
 Reads a layer from a background file. More...
 
virtual void readObject (Ogre::DataStreamPtr &stream, SpriteData &dest)
 Reads an object as a sprite. More...
 
virtual void readObject (Ogre::DataStreamPtr &stream, Color &dest)
 Reads an object as colour data. More...
 
virtual void readObject (Ogre::DataStreamPtr &stream, Page &dest)
 Reads an object as a background page. More...
 
template<typename ValueType >
void ReadVector (Ogre::DataStreamPtr &stream, std::vector< ValueType > &dest, size_t count)
 Reads a stream as a vector. More...
 
void readObject (Ogre::DataStreamPtr &stream, Ogre::Vector2 &dest)
 Reads an object as a 2 dimensional vector. More...
 
void readObject (Ogre::DataStreamPtr &stream, Ogre::Vector3 &dest)
 Reads an object as a 3 dimensional vector. More...
 
void readObject (Ogre::DataStreamPtr &stream, Ogre::AxisAlignedBox &dest)
 Reads an object as an axis aligned box. More...
 
void readObject (Ogre::DataStreamPtr &stream, Pixel &dest)
 Reads an object as a pixel. More...
 
- Protected Member Functions inherited from VGears::Serializer
void readObject (Ogre::DataStreamPtr &stream, Ogre::Vector2 &dest)
 Reads an object as a 2 dimensional vector. More...
 
void readObject (Ogre::DataStreamPtr &stream, Ogre::Vector3 &dest)
 Reads an object as a 3 dimensional vector. More...
 
void readObject (Ogre::DataStreamPtr &stream, Ogre::AxisAlignedBox &dest)
 Reads an object as an axis aligned box. More...
 
void readObject (Ogre::DataStreamPtr &stream, Pixel &dest)
 Reads an object as a pixel. More...
 
void ReadChars (Ogre::DataStreamPtr &stream, char *dest, size_t count)
 Reads a stream as text. More...
 
void Read1ByteBool (Ogre::DataStreamPtr &stream, bool &dest)
 Reads one byte from a stream and evaluates it as a boolean. More...
 
void Read2ByteBool (Ogre::DataStreamPtr &stream, bool &dest)
 Reads two bytes from a stream and evaluates them as a boolean. More...
 
void ReadShort (Ogre::DataStreamPtr &stream, uint16 &dest)
 Reads 16 bytes from a stream and evaluates as an unsigned short. More...
 
void ReadInt16 (Ogre::DataStream &stream, sint16 &dest)
 Reads 16 bytes from a stream and evaluates as a signed integer. More...
 
void ReadUInt16 (Ogre::DataStream &stream, uint16 &dest)
 Reads 16 bytes from a stream and evaluates as an unsigned int. More...
 
void ReadInt16 (Ogre::DataStreamPtr &stream, sint16 &dest)
 Reads 16 bytes from a stream and evaluates as a signed integer. More...
 
void ReadUInt16 (Ogre::DataStreamPtr &stream, uint16 &dest)
 Reads 16 bytes from a stream and evaluates as an unsigned int. More...
 
void ReadUInt32 (Ogre::DataStreamPtr &stream, uint32 &dest)
 Reads 32 bytes from a stream and evaluates as an unsigned int. More...
 
void ReadSInt32 (Ogre::DataStreamPtr &stream, sint32 &dest)
 Reads 32 bytes from a stream and evaluates as a signed int. More...
 
void ReadUInt32 (Ogre::DataStream &stream, uint32 &dest)
 Reads 32 bytes from a stream and evaluates as an unsigned int. More...
 
void ReadUInt8 (Ogre::DataStream &stream, uint8 &dest)
 Reads 8 bytes from a stream and evaluates as an unsigned int. More...
 
void ReadUInt8 (Ogre::DataStreamPtr &stream, uint8 &dest)
 Reads 8 bytes from a stream and evaluates as an unsigned int. More...
 
void ReadFloat (Ogre::DataStreamPtr &stream, float &dest)
 Reads bytes from a stream and evaluates them as a float. More...
 
void ReadEndString (Ogre::DataStreamPtr &stream, const String &end_text)
 
String GetLine (Ogre::DataStreamPtr &stream) const
 

Static Protected Attributes

static const String SECTION_NAME_PALETTE
 Name of the palette section in the file. More...
 
static const String SECTION_NAME_BACK
 Name of the back section in the file. More...
 
static const String SECTION_NAME_TEXTURE
 Name of the texture section in the file. More...
 
static const String TAG_FILE_END
 End-of-file tag. More...
 
static const Ogre::Real SRC_BIG_SCALE
 
- Static Protected Attributes inherited from VGears::Serializer
static const String TAG_COMMENT
 A comment tag. More...
 

Private Member Functions

void RemoveBuggySprites (SpriteList &sprites)
 Removes malformed sprites from the map. More...
 

Private Attributes

Header header_
 The file header. More...
 
size_t layer_index_
 

Detailed Description

Handles the serialization of background files.

Member Typedef Documentation

◆ Color

◆ Layer

◆ Page

◆ SpriteData

◆ SpriteList

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
BIT_MASK_RED 

Bitmask for red colour.

BIT_MASK_GREEN 

Bitmask for green colour.

BIT_MASK_BLUE 

Bitmask for blue colour.

BIT_SIZE 
Todo:
Understand and document.
BIT_MASK_RGB 

Bitmask for RGB colour.

SPRITE_DST_MAX 
Todo:
Understand and document.

Constructor & Destructor Documentation

◆ BackgroundFileSerializer()

VGears::BackgroundFileSerializer::BackgroundFileSerializer ( )

Constructor.

◆ ~BackgroundFileSerializer()

VGears::BackgroundFileSerializer::~BackgroundFileSerializer ( )
virtual

Destructor.

Member Function Documentation

◆ ImportBackgroundFile()

void VGears::BackgroundFileSerializer::ImportBackgroundFile ( Ogre::DataStreamPtr &  stream,
BackgroundFile dest 
)

Imports a background file.

Parameters
[in]streamThe contents of the background file.
[out]destThe background file.

◆ ReadBackground()

void VGears::BackgroundFileSerializer::ReadBackground ( Ogre::DataStreamPtr &  stream,
BackgroundFile dest 
)
protectedvirtual

Reads background data from a background file.

Parameters
[in]streamInput stream.
[out]destThe data will be set on this file.

◆ ReadEnd()

void VGears::BackgroundFileSerializer::ReadEnd ( Ogre::DataStreamPtr &  stream)
protectedvirtual
Todo:
Understand and document.
Parameters
[in]streamInput stream.

◆ ReadFileHeader()

void VGears::BackgroundFileSerializer::ReadFileHeader ( Ogre::DataStreamPtr &  stream)
protectedvirtual

Reads a background file header.

Parameters
[in]streamThe contents of the header.

◆ ReadLayer()

void VGears::BackgroundFileSerializer::ReadLayer ( Ogre::DataStreamPtr &  stream,
Layer dest,
size_t  layer_index 
)
protectedvirtual

Reads a layer from a background file.

Parameters
[in]streamInput stream.
[out]destThe layer info will be loaded here.
[in]layer_indexIndex of the layer to read.

◆ readObject() [1/7]

void VGears::BackgroundFileSerializer::readObject ( Ogre::DataStreamPtr &  stream,
Color dest 
)
protectedvirtual

Reads an object as colour data.

Parameters
[in]streamInput data.
[out]destThe formed colour data.

◆ readObject() [2/7]

void VGears::Serializer::readObject ( Ogre::DataStreamPtr &  stream,
Ogre::AxisAlignedBox &  dest 
)
protected

Reads an object as an axis aligned box.

Can be used for bounding boxes.

Parameters
[in]streamInput data.
[out]destThe formed box data.

◆ readObject() [3/7]

void VGears::Serializer::readObject ( Ogre::DataStreamPtr &  stream,
Ogre::Vector2 &  dest 
)
protected

Reads an object as a 2 dimensional vector.

Parameters
[in]streamInput data.
[out]destThe formed vector data.

◆ readObject() [4/7]

void VGears::Serializer::readObject ( Ogre::DataStreamPtr &  stream,
Ogre::Vector3 &  dest 
)
protected

Reads an object as a 3 dimensional vector.

Parameters
[in]streamInput data.
[out]destThe formed vector data.

◆ readObject() [5/7]

void VGears::BackgroundFileSerializer::readObject ( Ogre::DataStreamPtr &  stream,
Page dest 
)
protectedvirtual

Reads an object as a background page.

Parameters
[in]streamInput data.
[out]destThe formed page.

◆ readObject() [6/7]

void VGears::Serializer::readObject ( Ogre::DataStreamPtr &  stream,
Pixel dest 
)
protected

Reads an object as a pixel.

Parameters
[in]streamInput data.
[out]destThe formed pixel data.

◆ readObject() [7/7]

void VGears::BackgroundFileSerializer::readObject ( Ogre::DataStreamPtr &  stream,
SpriteData dest 
)
protectedvirtual

Reads an object as a sprite.

Parameters
[in]streamInput data.
[out]destThe formed sprite.

◆ ReadPallete()

void VGears::BackgroundFileSerializer::ReadPallete ( Ogre::DataStreamPtr &  stream,
BackgroundFile dest 
)
protectedvirtual

Reads pallete data from a background file.

Parameters
[in]streamInput stream.
[out]destThe data will be set on this file.

◆ ReadSectionHeader()

void VGears::BackgroundFileSerializer::ReadSectionHeader ( Ogre::DataStreamPtr &  stream,
const String section_name 
)
protectedvirtual

Reads a section of a background file header.

Parameters
[in]streamThe contents of the header.
[in]section_nameThe name of the section to read.

◆ ReadTexture()

void VGears::BackgroundFileSerializer::ReadTexture ( Ogre::DataStreamPtr &  stream,
BackgroundFile dest 
)
protectedvirtual

Reads texture data from a background file.

Parameters
[in]streamInput stream.
[out]destThe data will be set on this file.

◆ ReadVector()

template<typename ValueType >
void VGears::BackgroundFileSerializer::ReadVector ( Ogre::DataStreamPtr &  stream,
std::vector< ValueType > &  dest,
size_t  count 
)
inlineprotected

Reads a stream as a vector.

Parameters
[in]streamThe input stream.
[out]destThe vector data will be loaded here.
[in]countData units to copy.

◆ RemoveBuggySprites()

void VGears::BackgroundFileSerializer::RemoveBuggySprites ( SpriteList sprites)
private

Removes malformed sprites from the map.

Parameters
[in,out]spritesThe list from which to remove malformed sprites.
Todo:
Why are they malformed?

Member Data Documentation

◆ header_

Header VGears::BackgroundFileSerializer::header_
private

The file header.

◆ layer_index_

size_t VGears::BackgroundFileSerializer::layer_index_
private
Todo:
Understand and document.

◆ SECTION_NAME_BACK

const String VGears::BackgroundFileSerializer::SECTION_NAME_BACK
staticprotected

Name of the back section in the file.

◆ SECTION_NAME_PALETTE

const String VGears::BackgroundFileSerializer::SECTION_NAME_PALETTE
staticprotected

Name of the palette section in the file.

◆ SECTION_NAME_TEXTURE

const String VGears::BackgroundFileSerializer::SECTION_NAME_TEXTURE
staticprotected

Name of the texture section in the file.

◆ SRC_BIG_SCALE

const Ogre::Real VGears::BackgroundFileSerializer::SRC_BIG_SCALE
staticprotected
Todo:
Understand and document.

◆ TAG_FILE_END

const String VGears::BackgroundFileSerializer::TAG_FILE_END
staticprotected

End-of-file tag.


The documentation for this class was generated from the following files: