ResidualVM logo ResidualVM website - Forums - Contact us BuildBot - Doxygen - Wiki curved edge

Game resource base object. More...

#include <object.h>

Inheritance diagram for Stark::Resources::Object:
Collaboration diagram for Stark::Resources::Object:

List of all members.

Public Member Functions

virtual ~Object ()
Type getType () const
 Get the resource type.
byte getSubType () const
 Get the resource sub type.
uint16 getIndex () const
 Get the resource index.
Common::String getIndexAsString () const
 Get the resource index as a string.
Common::String getName () const
 Get the name of the resource.
virtual void readData (Formats::XRCReadStream *stream)
 Deserialize the resource static data and initial state.
virtual void saveLoad (ResourceSerializer *serializer)
 Persist / restore the resource state.
virtual void saveLoadCurrent (ResourceSerializer *serializer)
 Persist / restore the resource state.
virtual void onPostRead ()
 Called when the node's initialization is complete.
virtual void onAllLoaded ()
 Called when the resource sub-tree is entirely loaded.
virtual void onEnterLocation ()
 Called when entering a location.
virtual void onGameLoop ()
 Called once per game loop.
virtual void onEnginePause (bool pause)
 Called when ResidualVM pauses or resumes the engine.
virtual void onExitLocation ()
 Called when exiting a location.
virtual void onPreDestroy ()
 Called before a resource sub-tree is unloaded.
template<class T >
T * findParent ()
 Find the first parent resource with the specified type.
ObjectfindChildWithIndex (Type type, uint16 index, int subType=-1) const
 Find a child resource matching the specified type, index and subtype.
ObjectfindChildWithOrder (Type type, uint16 order, int subType=-1) const
 Find a child resource matching the specified type, order in the children list and subtype.
ObjectfindChildWithName (Type type, const Common::String &name, int subType=-1) const
 Find a child resource matching the specified type, name and subtype.
template<class T >
T * findChild (bool mustBeUnique=true) const
 Find a child matching the template parameter type.
template<class T >
T * findChildWithSubtype (int subType, bool mustBeUnique=true) const
 Find a child matching the template parameter type and the specified subtype.
template<class T >
T * findChildWithIndex (uint16 index, int subType=-1) const
 Find a child matching the template parameter type and the specified index.
template<class T >
T * findChildWithOrder (uint16 order, int subType=-1) const
 Find a child matching the template parameter type, order in the children list and subtype.
template<class T >
T * findChildWithName (const Common::String &name, int subType=-1) const
 Find a child matching the template parameter type, name and subtype.
template<class T >
Common::Array< T * > listChildren (int subType=-1) const
 List children matching the template parameter type and the specified subtype.
template<class T >
Common::Array< T * > listChildrenRecursive (int subType=-1)
 List children recursively matching the template parameter type and the specified subtype.
void addChild (Object *child)
 Add a resource to the children list.
virtual void print (uint depth=0)
 Print debug information for the resource.

Static Public Member Functions

template<class T >
static T * cast (Object *resource)
 Cast a resource, performing a type check.

Protected Member Functions

 Object (Object *parent, byte subType, uint16 index, const Common::String &name)
void printWithDepth (uint depth, const Common::String &string) const
void printDescription (uint depth) const
virtual void printData ()

Protected Attributes

Type _type
byte _subType
uint16 _index
Common::String _name
Object_parent
Common::Array< Object * > _children

Detailed Description

Game resource base object.

The in-game objects are represented using subclasses of this class.

The game world is made of a tree of resources, with each level further down the tree adding further details. An instance of this class is a node in that tree.

The first few tree levels are as follow:

The actual world tree is cut off in several sub-trees. There is one sub-tree per xarc archive. For resource management reasons the sub-trees are not merged in memory, the sub-trees are loaded and unloaded as needed, according to the current level / location.

The xarc archives contain each an xrc file, which is a serialized version of the initial state of a resource sub-tree. The readData method is called for each resource by the archive loader when a resource tree is loaded to set up its initial state.

As the game plays, modifications are made to the resources to reflect the game's state. When the resource sub-trees are loaded or unloaded their state is restored or persisted by the state provider. The saveLoad method is called to perform the serialization / deserialization of a resource. The saveLoadCurrent method is additionally called when loading or saving a sub-tree corresponding to the current level / location. This allows to persist additional data needed when restoring an active location.

The OnEnterLocation and OnExitLocation methods are called by the resource provider when entering or leaving a level / location.

The OnGameLoop method is called during the game loop.

Definition at line 144 of file engines/stark/resources/object.h.


Constructor & Destructor Documentation

Stark::Resources::Object::~Object (  )  [virtual]

Definition at line 107 of file engines/stark/resources/object.cpp.

Stark::Resources::Object::Object ( Object parent,
byte  subType,
uint16  index,
const Common::String name 
) [protected]

Definition at line 99 of file engines/stark/resources/object.cpp.


Member Function Documentation

void Stark::Resources::Object::addChild ( Object child  ) 

Add a resource to the children list.

Definition at line 276 of file engines/stark/resources/object.cpp.

Object * Stark::Resources::Object::cast< Object > ( Object resource  )  [static]

Cast a resource, performing a type check.

Definition at line 308 of file engines/stark/resources/object.h.

template<class T >
T * Stark::Resources::Object::findChild ( bool  mustBeUnique = true  )  const

Find a child matching the template parameter type.

Definition at line 371 of file engines/stark/resources/object.h.

Object * Stark::Resources::Object::findChildWithIndex ( Type  type,
uint16  index,
int  subType = -1 
) const

Find a child resource matching the specified type, index and subtype.

Definition at line 210 of file engines/stark/resources/object.cpp.

template<class T >
T * Stark::Resources::Object::findChildWithIndex ( uint16  index,
int  subType = -1 
) const

Find a child matching the template parameter type and the specified index.

Definition at line 391 of file engines/stark/resources/object.h.

Object * Stark::Resources::Object::findChildWithName ( Type  type,
const Common::String name,
int  subType = -1 
) const

Find a child resource matching the specified type, name and subtype.

Definition at line 239 of file engines/stark/resources/object.cpp.

template<class T >
T * Stark::Resources::Object::findChildWithName ( const Common::String name,
int  subType = -1 
) const

Find a child matching the template parameter type, name and subtype.

Definition at line 401 of file engines/stark/resources/object.h.

Object * Stark::Resources::Object::findChildWithOrder ( Type  type,
uint16  order,
int  subType = -1 
) const

Find a child resource matching the specified type, order in the children list and subtype.

Definition at line 223 of file engines/stark/resources/object.cpp.

template<class T >
T * Stark::Resources::Object::findChildWithOrder ( uint16  order,
int  subType = -1 
) const

Find a child matching the template parameter type, order in the children list and subtype.

Definition at line 396 of file engines/stark/resources/object.h.

template<class T >
T * Stark::Resources::Object::findChildWithSubtype ( int  subType,
bool  mustBeUnique = true 
) const

Find a child matching the template parameter type and the specified subtype.

Definition at line 376 of file engines/stark/resources/object.h.

Object * Stark::Resources::Object::findParent (  ) 

Find the first parent resource with the specified type.

Definition at line 272 of file engines/stark/resources/object.cpp.

uint16 Stark::Resources::Object::getIndex (  )  const [inline]

Get the resource index.

Definition at line 155 of file engines/stark/resources/object.h.

Common::String Stark::Resources::Object::getIndexAsString (  )  const [inline]

Get the resource index as a string.

Definition at line 158 of file engines/stark/resources/object.h.

Common::String Stark::Resources::Object::getName (  )  const [inline]

Get the name of the resource.

Definition at line 161 of file engines/stark/resources/object.h.

byte Stark::Resources::Object::getSubType (  )  const [inline]

Get the resource sub type.

Definition at line 152 of file engines/stark/resources/object.h.

Type Stark::Resources::Object::getType (  )  const [inline]

Get the resource type.

Definition at line 149 of file engines/stark/resources/object.h.

Common::Array< Object * > Stark::Resources::Object::listChildren< Object > ( int  subType = -1  )  const

List children matching the template parameter type and the specified subtype.

Definition at line 335 of file engines/stark/resources/object.h.

template<class T >
Common::Array< T * > Stark::Resources::Object::listChildrenRecursive ( int  subType = -1  ) 

List children recursively matching the template parameter type and the specified subtype.

Definition at line 350 of file engines/stark/resources/object.h.

void Stark::Resources::Object::onEnginePause ( bool  pause  )  [virtual]

Called when ResidualVM pauses or resumes the engine.

Reimplemented in Stark::Resources::AnimVideo, and Stark::Resources::Sound.

Definition at line 155 of file engines/stark/resources/object.cpp.

void Stark::Resources::Object::onEnterLocation (  )  [virtual]
void Stark::Resources::Object::onExitLocation (  )  [virtual]

Called when exiting a location.

Reimplemented in Stark::Resources::ModelItem, Stark::Resources::Layer2D, and Stark::Resources::Speech.

Definition at line 163 of file engines/stark/resources/object.cpp.

void Stark::Resources::Object::onPostRead (  )  [virtual]

Called when the node's initialization is complete.

Allows to load additional data from file.

Reimplemented in Stark::Resources::AnimProp, Stark::Resources::AnimSkeleton, Stark::Resources::BonesMesh, Stark::Resources::ImageStill, Stark::Resources::Light, and Stark::Resources::TextureSet.

Definition at line 128 of file engines/stark/resources/object.cpp.

void Stark::Resources::Object::onPreDestroy (  )  [virtual]

Called before a resource sub-tree is unloaded.

Reimplemented in Stark::Resources::AnimSkeleton, Stark::Resources::Sound, and Stark::Resources::Speech.

Definition at line 171 of file engines/stark/resources/object.cpp.

void Stark::Resources::Object::print ( uint  depth = 0  )  [virtual]

Print debug information for the resource.

Reimplemented in Stark::Resources::Script.

Definition at line 179 of file engines/stark/resources/object.cpp.

void Stark::Resources::Object::printDescription ( uint  depth  )  const [protected]

Definition at line 189 of file engines/stark/resources/object.cpp.

void Stark::Resources::Object::printWithDepth ( uint  depth,
const Common::String string 
) const [protected]

Definition at line 201 of file engines/stark/resources/object.cpp.


Member Data Documentation


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


Generated on Sat May 18 2019 05:07:34 for ResidualVM by doxygen 1.7.1
curved edge   curved edge