xoreos  0.0.5
Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
Engines::Sonic::Area Class Reference

#include <area.h>

Inheritance diagram for Engines::Sonic::Area:
Inheritance graph
[legend]
Collaboration diagram for Engines::Sonic::Area:
Collaboration graph
[legend]

Public Member Functions

 Area (Module &module, uint32 id)
 
 ~Area ()
 
const Common::UStringgetName ()
 Return the area's localized name. More...
 
uint32 getWidth () const
 Return the width of the area, in pixels. More...
 
uint32 getHeight () const
 Return the height of the area, in pixels. More...
 
float getStartX () const
 Return the starting X position within this area. More...
 
float getStartY () const
 Return the starting Y position within this area. More...
 
void enter ()
 Enter the area. More...
 
void leave ()
 Leave the area. More...
 
void show ()
 Show the area. More...
 
void hide ()
 Hide the area. More...
 
void addEvent (const Events::Event &event)
 Add a single event for consideration into the area event queue. More...
 
void processEventQueue ()
 Process the current event queue. More...
 
void removeFocus ()
 Forcibly remove the focus from the currently highlighted object. More...
 
- Public Member Functions inherited from Engines::Sonic::Object
 Object (ObjectType type=kObjectTypeInvalid)
 
virtual ~Object ()
 
ObjectType getType () const
 Return the exact type of the object. More...
 
uint32 getModelID () const
 Return the ID of the object's model. More...
 
virtual void getPosition (float &x, float &y, float &z) const
 Return the object's position within its area. More...
 
virtual void getOrientation (float &x, float &y, float &z, float &angle) const
 Return the object's orientation. More...
 
virtual void setPosition (float x, float y, float z)
 Set the object's position within its area. More...
 
virtual void setOrientation (float x, float y, float z, float angle)
 Set the object's orientation. More...
 
virtual void highlight (bool enabled)
 (Un)Highlight the object. More...
 
- Public Member Functions inherited from Aurora::NWScript::Object
 Object ()
 
uint32 getID () const
 
const Common::UStringgetTag () const
 
- Public Member Functions inherited from Aurora::NWScript::VariableContainer
 VariableContainer ()
 
virtual ~VariableContainer ()
 
bool hasVariable (const Common::UString &var) const
 
VariablegetVariable (const Common::UString &var, Type type=kTypeVoid)
 
const VariablegetVariable (const Common::UString &var) const
 
void setVariable (const Common::UString &var, const Variable &value)
 
void removeVariable (const Common::UString &var)
 
void clearVariables ()
 
- Public Member Functions inherited from Events::Notifyable
 Notifyable ()
 
virtual ~Notifyable ()
 

Static Public Member Functions

static void getCameraPosition (float x, float y, float &cameraX, float &cameraY, float &cameraZ)
 Return a position that would position the camera on these coordinates within the area. More...
 
static void getWorldPosition (float x, float y, float z, float &worldX, float &worldY, float &worldZ)
 Return a position that would position on object at these coordinates within the area. More...
 

Protected Member Functions

void notifyCameraMoved ()
 Notify the area that the camera has been moved. More...
 

Private Types

typedef Common::PtrList< ObjectObjectList
 
typedef std::map< uint32, Object * > ObjectMap
 

Private Member Functions

void load ()
 
void loadDefinition ()
 
void loadBackground ()
 
void loadMiniMap ()
 
void loadLayout ()
 
void loadObject (Object &object)
 
void loadPlaceables (const Aurora::GFF4List &list)
 
void getCameraLimits (float &minX, float &minY, float &minZ, float &maxX, float &maxY, float &maxZ) const
 
void checkActive ()
 
void setActive (Object *object)
 
ObjectgetObjectAt (int x, int y)
 
void highlightAll (bool enabled)
 

Private Attributes

Module_module
 
Common::UString _name
 
Common::UString _background
 
Common::UString _layout
 
uint32 _width
 
uint32 _height
 
float _startPosX
 
float _startPosY
 
Common::UString _miniMap
 
uint32 _miniMapWidth
 
uint32 _miniMapHeight
 
Common::UString _soundMap
 
int32 _soundMapBank
 
int32 _sound
 
int32 _soundType
 
int32 _soundBank
 
uint32 _numberRings
 
uint32 _numberChaoEggs
 
std::list< Events::Event_eventQueue
 
Common::ScopedPtr< AreaBackground_bgPanel
 
Common::ScopedPtr< AreaMiniMap_mmPanel
 
ObjectList _objects
 
ObjectMap _objectMap
 
Object_activeObject
 
bool _highlightAll
 
Common::Mutex _mutex
 

Additional Inherited Members

- Protected Attributes inherited from Engines::Sonic::Object
ObjectType _type
 The object's type. More...
 
uint32 _modelID
 The ID of the object's model. More...
 
float _position [3]
 The object's position. More...
 
float _orientation [4]
 The object's orientation. More...
 
- Protected Attributes inherited from Aurora::NWScript::Object
uint32 _id
 
Common::UString _tag
 

Detailed Description

Definition at line 55 of file area.h.

Member Typedef Documentation

◆ ObjectList

Definition at line 105 of file area.h.

◆ ObjectMap

typedef std::map<uint32, Object *> Engines::Sonic::Area::ObjectMap
private

Definition at line 106 of file area.h.

Constructor & Destructor Documentation

◆ Area()

Engines::Sonic::Area::Area ( Module module,
uint32  id 
)

Definition at line 54 of file area.cpp.

References Aurora::NWScript::Object::_id, _module, Engines::Sonic::ObjectContainer::addObject(), load(), and ObjectMan.

Here is the call graph for this function:

◆ ~Area()

Engines::Sonic::Area::~Area ( )

Definition at line 68 of file area.cpp.

References _module, _objects, hide(), ObjectMan, and Engines::Sonic::ObjectContainer::removeObject().

Here is the call graph for this function:

Member Function Documentation

◆ addEvent()

void Engines::Sonic::Area::addEvent ( const Events::Event event)

Add a single event for consideration into the area event queue.

Definition at line 178 of file area.cpp.

References _eventQueue.

◆ checkActive()

void Engines::Sonic::Area::checkActive ( )
private

Definition at line 321 of file area.cpp.

References _highlightAll, _mutex, CursorMan, getObjectAt(), and setActive().

Referenced by notifyCameraMoved(), and processEventQueue().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ enter()

void Engines::Sonic::Area::enter ( )
virtual

Enter the area.

Reimplemented from Engines::Sonic::Object.

Definition at line 156 of file area.cpp.

References _bgPanel, _startPosX, _startPosY, CameraMan, getCameraLimits(), getCameraPosition(), and Engines::Sonic::kCameraAngle.

Here is the call graph for this function:

◆ getCameraLimits()

void Engines::Sonic::Area::getCameraLimits ( float &  minX,
float &  minY,
float &  minZ,
float &  maxX,
float &  maxY,
float &  maxZ 
) const
private

Definition at line 113 of file area.cpp.

References _height, _width, Common::deg2rad(), FLT_MAX, Engines::Sonic::kCameraAngle, Engines::Sonic::kScreenHeight, and Engines::Sonic::kScreenWidth.

Referenced by enter().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getCameraPosition()

void Engines::Sonic::Area::getCameraPosition ( float  x,
float  y,
float &  cameraX,
float &  cameraY,
float &  cameraZ 
)
static

Return a position that would position the camera on these coordinates within the area.

Definition at line 99 of file area.cpp.

References Common::deg2rad(), Engines::Sonic::kCameraAngle, Engines::Sonic::kCameraHeight, Engines::Sonic::kScreenHeight, and Engines::Sonic::kScreenWidth.

Referenced by enter().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getHeight()

uint32 Engines::Sonic::Area::getHeight ( ) const

Return the height of the area, in pixels.

Definition at line 87 of file area.cpp.

References _height.

◆ getName()

const Common::UString & Engines::Sonic::Area::getName ( )

Return the area's localized name.

Definition at line 79 of file area.cpp.

References _name.

◆ getObjectAt()

Object * Engines::Sonic::Area::getObjectAt ( int  x,
int  y 
)
private

Definition at line 296 of file area.cpp.

References _objectMap, Graphics::Renderable::getID(), and GfxMan.

Referenced by checkActive().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getStartX()

float Engines::Sonic::Area::getStartX ( ) const

Return the starting X position within this area.

Definition at line 91 of file area.cpp.

References _startPosX.

◆ getStartY()

float Engines::Sonic::Area::getStartY ( ) const

Return the starting Y position within this area.

Definition at line 95 of file area.cpp.

References _startPosY.

◆ getWidth()

uint32 Engines::Sonic::Area::getWidth ( ) const

Return the width of the area, in pixels.

Definition at line 83 of file area.cpp.

References _width.

◆ getWorldPosition()

void Engines::Sonic::Area::getWorldPosition ( float  x,
float  y,
float  z,
float &  worldX,
float &  worldY,
float &  worldZ 
)
static

Return a position that would position on object at these coordinates within the area.

Definition at line 105 of file area.cpp.

References Common::deg2rad(), Engines::Sonic::kCameraAngle, Engines::Sonic::kCameraHeight, Engines::Sonic::kScreenHeight, and Engines::Sonic::kScreenWidth.

Referenced by Engines::Sonic::Placeable::setPosition().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ hide()

void Engines::Sonic::Area::hide ( )
virtual

Hide the area.

Reimplemented from Engines::Sonic::Object.

Definition at line 139 of file area.cpp.

References _bgPanel, _mmPanel, _objects, GfxMan, and removeFocus().

Referenced by ~Area().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ highlightAll()

void Engines::Sonic::Area::highlightAll ( bool  enabled)
private

Definition at line 333 of file area.cpp.

References _highlightAll, and _objectMap.

Referenced by processEventQueue().

Here is the caller graph for this function:

◆ leave()

void Engines::Sonic::Area::leave ( )
virtual

Leave the area.

Reimplemented from Engines::Sonic::Object.

Definition at line 173 of file area.cpp.

References CameraMan.

◆ load()

void Engines::Sonic::Area::load ( )
private

Definition at line 204 of file area.cpp.

References loadBackground(), loadDefinition(), loadLayout(), and loadMiniMap().

Referenced by Area().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ loadBackground()

void Engines::Sonic::Area::loadBackground ( )
private

Definition at line 258 of file area.cpp.

References _background, _bgPanel, _height, and _width.

Referenced by load().

Here is the caller graph for this function:

◆ loadDefinition()

void Engines::Sonic::Area::loadDefinition ( )
private

◆ loadLayout()

void Engines::Sonic::Area::loadLayout ( )
private

Definition at line 271 of file area.cpp.

References _layout, Aurora::NWScript::Object::_tag, Aurora::GFF4Struct::getList(), Aurora::GFF4Struct::getString(), Aurora::GFF4File::getTopLevel(), Aurora::GFF4Struct::hasField(), kAREID, Aurora::kFileTypeARE, and loadPlaceables().

Referenced by load().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ loadMiniMap()

void Engines::Sonic::Area::loadMiniMap ( )
private

Definition at line 266 of file area.cpp.

References _miniMap, _mmPanel, and Common::UString::empty().

Referenced by load().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ loadObject()

void Engines::Sonic::Area::loadObject ( Object object)
private

Definition at line 281 of file area.cpp.

References _module, _objectMap, _objects, Engines::Sonic::ObjectContainer::addObject(), and Engines::Sonic::Object::getModelID().

Referenced by loadPlaceables().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ loadPlaceables()

void Engines::Sonic::Area::loadPlaceables ( const Aurora::GFF4List list)
private

Definition at line 288 of file area.cpp.

References loadObject().

Referenced by loadLayout().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ notifyCameraMoved()

void Engines::Sonic::Area::notifyCameraMoved ( )
protectedvirtual

Notify the area that the camera has been moved.

Reimplemented from Events::Notifyable.

Definition at line 350 of file area.cpp.

References checkActive().

Here is the call graph for this function:

◆ processEventQueue()

void Engines::Sonic::Area::processEventQueue ( )

Process the current event queue.

Definition at line 182 of file area.cpp.

References _eventQueue, checkActive(), highlightAll(), Events::kEventKeyDown, Events::kEventKeyUp, and Events::kEventMouseMove.

Here is the call graph for this function:

◆ removeFocus()

void Engines::Sonic::Area::removeFocus ( )

Forcibly remove the focus from the currently highlighted object.

Definition at line 343 of file area.cpp.

References _activeObject, and Engines::Sonic::Object::leave().

Referenced by hide().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setActive()

void Engines::Sonic::Area::setActive ( Object object)
private

Definition at line 308 of file area.cpp.

References _activeObject, Engines::Sonic::Object::enter(), and Engines::Sonic::Object::leave().

Referenced by checkActive().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ show()

void Engines::Sonic::Area::show ( )
virtual

Show the area.

Reimplemented from Engines::Sonic::Object.

Definition at line 124 of file area.cpp.

References _bgPanel, _mmPanel, _objects, and GfxMan.

Member Data Documentation

◆ _activeObject

Object* Engines::Sonic::Area::_activeObject
private

Definition at line 144 of file area.h.

Referenced by removeFocus(), and setActive().

◆ _background

Common::UString Engines::Sonic::Area::_background
private

Definition at line 112 of file area.h.

Referenced by loadBackground(), and loadDefinition().

◆ _bgPanel

Common::ScopedPtr<AreaBackground> Engines::Sonic::Area::_bgPanel
private

Definition at line 138 of file area.h.

Referenced by enter(), hide(), loadBackground(), and show().

◆ _eventQueue

std::list<Events::Event> Engines::Sonic::Area::_eventQueue
private

Definition at line 136 of file area.h.

Referenced by addEvent(), and processEventQueue().

◆ _height

uint32 Engines::Sonic::Area::_height
private

Definition at line 116 of file area.h.

Referenced by getCameraLimits(), getHeight(), loadBackground(), and loadDefinition().

◆ _highlightAll

bool Engines::Sonic::Area::_highlightAll
private

Definition at line 146 of file area.h.

Referenced by checkActive(), and highlightAll().

◆ _layout

Common::UString Engines::Sonic::Area::_layout
private

Definition at line 113 of file area.h.

Referenced by loadDefinition(), and loadLayout().

◆ _miniMap

Common::UString Engines::Sonic::Area::_miniMap
private

Definition at line 121 of file area.h.

Referenced by loadDefinition(), and loadMiniMap().

◆ _miniMapHeight

uint32 Engines::Sonic::Area::_miniMapHeight
private

Definition at line 124 of file area.h.

Referenced by loadDefinition().

◆ _miniMapWidth

uint32 Engines::Sonic::Area::_miniMapWidth
private

Definition at line 123 of file area.h.

Referenced by loadDefinition().

◆ _mmPanel

Common::ScopedPtr<AreaMiniMap> Engines::Sonic::Area::_mmPanel
private

Definition at line 139 of file area.h.

Referenced by hide(), loadMiniMap(), and show().

◆ _module

Module* Engines::Sonic::Area::_module
private

Definition at line 109 of file area.h.

Referenced by Area(), loadObject(), and ~Area().

◆ _mutex

Common::Mutex Engines::Sonic::Area::_mutex
private

Definition at line 148 of file area.h.

Referenced by checkActive().

◆ _name

Common::UString Engines::Sonic::Area::_name
private

Definition at line 111 of file area.h.

Referenced by getName(), and loadDefinition().

◆ _numberChaoEggs

uint32 Engines::Sonic::Area::_numberChaoEggs
private

Definition at line 134 of file area.h.

Referenced by loadDefinition().

◆ _numberRings

uint32 Engines::Sonic::Area::_numberRings
private

Definition at line 133 of file area.h.

Referenced by loadDefinition().

◆ _objectMap

ObjectMap Engines::Sonic::Area::_objectMap
private

Definition at line 142 of file area.h.

Referenced by getObjectAt(), highlightAll(), and loadObject().

◆ _objects

ObjectList Engines::Sonic::Area::_objects
private

Definition at line 141 of file area.h.

Referenced by hide(), loadObject(), show(), and ~Area().

◆ _sound

int32 Engines::Sonic::Area::_sound
private

Definition at line 129 of file area.h.

Referenced by loadDefinition().

◆ _soundBank

int32 Engines::Sonic::Area::_soundBank
private

Definition at line 131 of file area.h.

Referenced by loadDefinition().

◆ _soundMap

Common::UString Engines::Sonic::Area::_soundMap
private

Definition at line 126 of file area.h.

Referenced by loadDefinition().

◆ _soundMapBank

int32 Engines::Sonic::Area::_soundMapBank
private

Definition at line 128 of file area.h.

Referenced by loadDefinition().

◆ _soundType

int32 Engines::Sonic::Area::_soundType
private

Definition at line 130 of file area.h.

Referenced by loadDefinition().

◆ _startPosX

float Engines::Sonic::Area::_startPosX
private

Definition at line 118 of file area.h.

Referenced by enter(), getStartX(), and loadDefinition().

◆ _startPosY

float Engines::Sonic::Area::_startPosY
private

Definition at line 119 of file area.h.

Referenced by enter(), getStartY(), and loadDefinition().

◆ _width

uint32 Engines::Sonic::Area::_width
private

Definition at line 115 of file area.h.

Referenced by getCameraLimits(), getWidth(), loadBackground(), and loadDefinition().


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