Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

Doomwad::Flat Class Reference

Inheritance diagram for Doomwad::Flat:

Doomwad::WadEntry List of all members.

Detailed Description

Represents a single Flat, a ceiling or floor texture.

See also:
PlayPal Sector Sectors WadEntry
Each flat is a 64 by 64 square representing a single ceiling or floor texture. Each texel is a single byte, which is an offset into the game's palette, for a total of 4,096 bytes.

Definition at line 71 of file flats.hpp.

Public Member Functions

virtual byteat (size_t, size_t) throw (std::domain_error)
 Get the byte at a specific coordinate.
virtual const byteat (size_t, size_t) const throw (std::domain_error)
 Get the byte at a specific coordinate.
 Flat (const Lump &) throw ()
 Construct from a Lump.
 Flat (void) throw ()
 Default constructor.
virtual bool setFromLump (const Lump &lump) throw ()
 Convert a Lump to this entry.
virtual Lump toLump (void) const throw ()
 Convert this entry to a Lump.
virtual std::string toString (void) const throw ()
 Convert this entry to a std::string.
virtual ~Flat (void) throw ()
 Flat destructor.

Static Public Attributes

static const size_t LENGTH = 0x00001000
 Length of a single Flat object.

Private Attributes

byte data [4096]
 Raw texel data.
std::string name
 Flat name.


Constructor & Destructor Documentation

Flat::Flat void   )  throw ()
 

Default constructor.

Constructs a Flat object.

Definition at line 56 of file flats.cpp.

Flat::Flat const Lump lump  )  throw ()
 

Construct from a Lump.

Constructs from a Lump.

Parameters:
lump Source Lump.

Definition at line 68 of file flats.cpp.

References setFromLump().


Member Function Documentation

Doomwad::byte & Flat::at size_t  x,
size_t  y
throw (std::domain_error) [virtual]
 

Get the byte at a specific coordinate.

Parameters:
x X coordinate.
y Y coordinate.
Exceptions:
std::domain_error If the index is out of bounds.
Returns:
Reference to the byte.

Definition at line 128 of file flats.cpp.

References Doomwad::exceptionString().

const Doomwad::byte & Flat::at size_t  x,
size_t  y
const throw (std::domain_error) [virtual]
 

Get the byte at a specific coordinate.

Parameters:
x X coordinate.
y Y coordinate.
Exceptions:
std::domain_error If the index is out of bounds.
Returns:
Reference to the byte.

Definition at line 111 of file flats.cpp.

References Doomwad::exceptionString().

bool Flat::setFromLump const Lump lump  )  throw () [virtual]
 

Convert a Lump to this entry.

Lumps should not know about specific data structures. Those structures know about Lumps, including how to convert from them.

Setting from a Lump involves parsing that Lump's contents to see if they are valid. If they are, then this object will contain what you expect it to. If not, it will return false and the atomic operation will not succeed.

Parameters:
lump Reference to a source Lump object.
Returns:
True if successful, false if not.

Implements Doomwad::WadEntry.

Definition at line 81 of file flats.cpp.

References LENGTH.

Referenced by Flat().

Lump Flat::toLump void   )  const throw () [virtual]
 

Convert this entry to a Lump.

Each subclass must be able to convert itself to a Lump for storage in a Wad.

Returns:
Lump containing the raw file representation of this entry.

Implements Doomwad::WadEntry.

Definition at line 88 of file flats.cpp.

References LENGTH.

std::string Flat::toString void   )  const throw () [virtual]
 

Convert this entry to a std::string.

The exact implementation varies by the exact concrete class, but the idea is to convert the entry into a summary to be displayed to the user. Please note that converting to a string may lose information. This is not serialization in the purest sense of the word, this is merely a quick and dirty user-readable summary of the entry.

True serialization is achieved by converting a Lump object and using its stream I/O functions to read and write.

Returns:
std::string containing a summary of this entry.

Implements Doomwad::WadEntry.

Definition at line 94 of file flats.cpp.


Generated on Fri Jun 10 19:38:52 2005 for libdoomwad by  doxygen 1.4.0