Actor Class Reference

#include <Actor.h>

Inheritance diagram for Actor:
Container ParticleSystem

# Public Types

typedef const ActorSpec ActorROMSpec
typedef const PositionedActor PositionedActorROMSpec

# Public Member Functions

void constructor (const ActorSpec *actorSpec, int16 internalId, const char *const name)
override bool onEvent (ListenerObject eventFirer, uint16 eventCode)
override void createComponents (ComponentSpec **componentSpecs)
override void destroyComponents ()
 Destroy the components that attach to this actor.
override void calculateSize ()
 Configure the actor's size.
override fixed_t getRadius ()
override uint32 getInGameType ()
override void ready (bool recursive)
override void suspend ()
 Prepare to suspend this instance's logic.
override void resume ()
 Prepare to resume this instance's logic.
override void handleCommand (int32 command, va_list args)
override bool handlePropagatedString (const char *string)
const ActorSpecgetSpec ()
ActorFactory getActorFactory ()
Actor spawnChildActor (const PositionedActor *const positionedActor)
void addChildActors (const PositionedActor *childrenSpecs)
void addChildActorsDeferred (const PositionedActor *childrenSpecs)
fixed_t getWidth ()
fixed_t getHeight ()
fixed_t getDepth ()
bool isInCameraRange (int16 padding, bool recursive)
void playAnimation (const char *animationName)
void pauseAnimation (bool pause)
void stopAnimation ()
 Stop any playing animation if any.
bool isPlaying ()
bool isPlayingAnimation (char *animationName)
const char * getPlayingAnimationName ()
void setActualFrame (int16 frame)
void nextFrame ()
 Skip the currently playing animation to the next frame.
void previousFrame ()
 Rewind the currently playing animation to the previous frame.
int16 getActualFrame ()
int32 getNumberOfFrames ()
virtual void setSpec (void *actorSpec)
virtual void setExtraInfo (void *extraInfo)
virtual bool alwaysStreamIn ()

# Static Public Member Functions

static Actor createActor (const PositionedActor *const positionedActor, int16 internalId)
static Actor createActorDeferred (const PositionedActor *const positionedActor, int16 internalId)
static RightBox getRightBoxFromSpec (const PositionedActor *positionedActor, const Vector3D *environmentPosition)
static bool isInsideFrustrum (Vector3D vector3D, RightBox rightBox)

# Protected Attributes

Size size
ActorFactory actorFactory
 Factory to create this actor's children.
const ActorSpecactorSpec
 Pointer to the spec that defines how to initialize the actor.
Vector3DcenterDisplacement
const char * playingAnimationName

# Additional Inherited Members

- Private Member Functions inherited from Container
void constructor (int16 internalId, const char *const name)
override void setDirection (const Vector3D *direction)
override void show ()
 Make this instance visible.
override void hide ()
 Make this instance invisible.
override void setTransparency (uint8 transparency)
override void setPosition (const Vector3D *position)
override void setRotation (const Rotation *rotation)
override void setScale (const Scale *scale)
void setNormalizedDirection (NormalizedDirection normalizedDirection)
NormalizedDirection getNormalizedDirection ()
void deleteMyself ()
int16 getInternalId ()
void setName (const char *const name)
const char * getName ()
void streamOut (bool streamOut)
Container getParent ()
void addChild (Container child)
void removeChild (Container child, bool deleteChild)
void purgeChildren ()
 Force the destruction of all children marked to be deleted.
bool getChildren (ClassPointer classPointer, VirtualList children)
Container getChildById (int16 id)
Container getChildByName (const char *childName, bool recursive)
Container getChildAtPosition (int16 position)
int32 getChildrenCount ()
Container getFirstAncestor ()
Container getRelativeByName (const char *relativeName)
void updateChildren ()
 Update the children of this container.
void invalidateTransformation ()
void transformChildren (uint8 invalidateTransformationFlag)
void propagateCommand (uint32 command,...)
bool propagateMessage (bool(*propagatedMessageHandler)(void *, va_list),...)
bool onPropagatedMessage (va_list args)
bool propagateString (bool(*propagatedMessageHandler)(void *, va_list),...)
bool onPropagatedString (va_list args)
void translate (const Vector3D *translation)
void rotate (const Rotation *rotation)
void scale (const Scale *scale)
const Vector3DgetLocalPosition ()
const RotationgetLocalRotation ()
const ScalegetLocalScale ()
virtual void setLocalPosition (const Vector3D *position)
virtual void setLocalRotation (const Rotation *rotation)
virtual void setLocalScale (const Scale *scale)
virtual void transform (const Transformation *environmentTransform, uint8 invalidateTransformationFlag)
virtual void update ()
 Update this instance's logic.
virtual bool handlePropagatedMessage (int32 message)
- Private Attributes inherited from Container
Container parent
 Container of which this one is a child.
VirtualList children
Transformation localTransformation
 3D local transformation
char * name
 Container's name.
int16 internalId
 Container's internal id, set by the engine.
bool deleteMe
 If true, the parent will delete this container when appropriate.
bool ready
bool dontStreamOut
bool hidden
 Flag to mark the container (and its children) as non visible.
int8 axisForSynchronizationWithBody
 Axises around which to rotate the container when syncronizing with body.

# Detailed Description

Class Actor

Inherits from Container

Implements a container that can be added to stages

Definition at line 111 of file Actor.h.

# Member Typedef Documentation

# ActorROMSpec

typedef const ActorSpec ActorROMSpec

An Actor spec that is stored in ROM

Definition at line 63 of file Actor.h.

# PositionedActorROMSpec

A PositionedActor spec that is stored in ROM

Definition at line 100 of file Actor.h.

# Member Function Documentation

# addChildActors()

void Actor::addChildActors ( const PositionedActor * childrenSpecs)

Spawn children and configure them with the provided actor specs.

Parameters
childrenSpecsArray of actor specs to use to initialize the new children

Definition at line 623 of file Actor.c.

# addChildActorsDeferred()

void Actor::addChildActorsDeferred ( const PositionedActor * childrenSpecs)

Spawn children and configure them over time with the provided actor specs.

Parameters
childrenSpecsArray of actor specs to use to initialize the new children

Definition at line 645 of file Actor.c.

# alwaysStreamIn()

bool Actor::alwaysStreamIn ( )
virtual

Check if the actor must be streamed in after being streamed out or destroyed.

Returns
True if the streaming must spawn this actor back when deleted

Definition at line 908 of file Actor.c.

# calculateSize()

void Actor::calculateSize ( )
virtual

Configure the actor's size.

Reimplemented from Entity.

Definition at line 672 of file Actor.c.

# constructor()

void Actor::constructor ( const ActorSpec * actorSpec,
int16 internalId,
const char *const name )

Class' constructor

Parameters
actorSpecSpecification that determines how to configure the actor
internalIdID to keep track internally of the new instance
nameName to assign to the new instance

Definition at line 362 of file Actor.c.

# createActor()

static Actor Actor::createActor ( const PositionedActor *const positionedActor,
int16 internalId )
static

Create a new actor instance and configure it with the provided arguments.

Parameters
positionedActorStruct that defines which actor spec to use to configure the new actor and the spatial information about where and how to positione it
internalIdID to keep track internally of the new instance
Returns
The new actor

Definition at line 49 of file Actor.c.

# createActorDeferred()

static Actor Actor::createActorDeferred ( const PositionedActor *const positionedActor,
int16 internalId )
static

Create a new actor instance and configure it over time with the provided arguments.

Parameters
positionedActorStruct that defines which actor spec to use to configure the new actor and the spatial information about where and how to positione it
internalIdID to keep track internally of the new instance
Returns
The new, still not configured actor

Definition at line 87 of file Actor.c.

# createComponents()

void Actor::createComponents ( ComponentSpec ** componentSpecs)
virtual

Add the components that must attach to this actor. Create the components that must attach to this container.

Parameters
componentSpecsSpecifications to be used to configure the new components

Reimplemented from Entity.

Definition at line 455 of file Actor.c.

# destroyComponents()

void Actor::destroyComponents ( )
virtual

Destroy the components that attach to this actor.

Reimplemented from Entity.

Definition at line 462 of file Actor.c.

# getActorFactory()

ActorFactory Actor::getActorFactory ( )

Retrieve the actor's actor factory

Returns
Actor's actor facotyr

Definition at line 595 of file Actor.c.

# getActualFrame()

int16 Actor::getActualFrame ( )

Retrieve the actual frame of the playing animation if any.

Returns
Actual frame of the playing animation if any

# getDepth()

fixed_t Actor::getDepth ( )

Retrieve the actor's depth.

Returns
Actor's depth

Definition at line 733 of file Actor.c.

# getHeight()

fixed_t Actor::getHeight ( )

Retrieve the actor's height.

Returns
Actor's height

Definition at line 720 of file Actor.c.

# getInGameType()

uint32 Actor::getInGameType ( )
virtual

Retrieve the enum that determines the type of game object.

Returns
The enum that determines the type of game object

Reimplemented from Entity.

Definition at line 502 of file Actor.c.

# getNumberOfFrames()

int32 Actor::getNumberOfFrames ( )

Retrieve the number of frames in the currently playing animation if any.

Returns
The numer of frames if an animation is playing; o otherwise

# getPlayingAnimationName()

const char * Actor::getPlayingAnimationName ( )

Retrieve the animation function's name currently playing if any

Returns
Animation function's name currently playing if any

Definition at line 888 of file Actor.c.

# getRadius()

fixed_t Actor::getRadius ( )
virtual

Retrieve the object's radius.

Returns
Radius

Reimplemented from Entity.

Definition at line 471 of file Actor.c.

# getRightBoxFromSpec()

static RightBox Actor::getRightBoxFromSpec ( const PositionedActor * positionedActor,
const Vector3D * environmentPosition )
static

Compute the spatially located bounding box of an actor created with the provided positioned actor struct.

Parameters
positionedActorStruct that defines which actor spec to use to configure the an actor
environmentPositionVector used as the origin with respect to which computed the bounding box's position
Returns
Spatially located bounding box of an actor that would be created with the provided positioned actor struct

Definition at line 126 of file Actor.c.

# getSpec()

const ActorSpec * Actor::getSpec ( )

Retrieve the actor's spec.

Returns
Specification that determines how the actor was configured

Definition at line 588 of file Actor.c.

# getWidth()

fixed_t Actor::getWidth ( )

Retrieve the actor's width.

Returns
Actor's width

Definition at line 707 of file Actor.c.

# handleCommand()

void Actor::handleCommand ( int32 command,
va_list args )
virtual

Default command handler.

Parameters
commandPropagated command
valudA command related value
Returns
True if the propagation must stop; false if the propagation must reach other containers

Reimplemented from Container.

Definition at line 545 of file Actor.c.

# handlePropagatedString()

bool Actor::handlePropagatedString ( const char * string)
virtual

Default string handler for propagateString

Parameters
stringPropagated string
Returns
True if the propagation must stop; false if the propagation must reach other containers

Reimplemented from Container.

Definition at line 571 of file Actor.c.

# isInCameraRange()

bool Actor::isInCameraRange ( int16 padding,
bool recursive )

Check if the actor is withing the camera's frustum.

Parameters
paddingPadding to be added to camera's frustum
recursiveIf true, the check is performed on the children, grand children, etc.
Returns
True if the actor is within the camera's frustum

Definition at line 746 of file Actor.c.

# isInsideFrustrum()

static bool Actor::isInsideFrustrum ( Vector3D vector3D,
RightBox rightBox )
inlinestatic

Test if the provided right box lies inside the camera's frustum.

Parameters
vector3DRightBox's translation vector
rightBoxRightBox to test

# isPlaying()

bool Actor::isPlaying ( )

Check if an animation is playing.

Returns
True if an animation is playing; false otherwise

Definition at line 859 of file Actor.c.

# isPlayingAnimation()

bool Actor::isPlayingAnimation ( char * animationName)

Check if the animation whose name is provided is playing.

Parameters
animationNameName of the animation to check
Returns
True if an animation is playing; false otherwise

Definition at line 881 of file Actor.c.

# nextFrame()

void Actor::nextFrame ( )

Skip the currently playing animation to the next frame.

Definition at line 845 of file Actor.c.

# onEvent()

bool Actor::onEvent ( ListenerObject eventFirer,
uint16 eventCode )
virtual

Process an event that the instance is listen for.

Parameters
eventFirerListenerObject that signals the event
eventCodeCode of the firing event
Returns
False if the listener has to be removed; true to keep it

Reimplemented from ListenerObject.

Definition at line 415 of file Actor.c.

# pauseAnimation()

void Actor::pauseAnimation ( bool pause)

Pause or unpause the currently playing animation if any.

Parameters
pauseFlag that signals if the animation must be paused or unpaused

Definition at line 822 of file Actor.c.

# playAnimation()

void Actor::playAnimation ( const char * animationName)

Play the animation with the provided name.

Parameters
animationNameName of the animation to play

Definition at line 805 of file Actor.c.

# previousFrame()

void Actor::previousFrame ( )

Rewind the currently playing animation to the previous frame.

Definition at line 852 of file Actor.c.

# ready()

void Actor::ready ( bool recursive)
virtual

Make the animated actor ready to start operating once it has been completely intialized.

Parameters
recursiveIf true, the ready call is propagated to its children, grand children, etc.

Reimplemented from Container.

Definition at line 509 of file Actor.c.

# resume()

void Actor::resume ( )
virtual

Prepare to resume this instance's logic.

Reimplemented from Container.

Reimplemented in ParticleSystem.

Definition at line 530 of file Actor.c.

# setActualFrame()

void Actor::setActualFrame ( int16 frame)

Skip the currently playing animation to the provided frame.

Parameters
frameThe frame of the playing animation to skip to
Returns
True if the actual frame was changed; false otherwise

Definition at line 838 of file Actor.c.

# setExtraInfo()

void Actor::setExtraInfo ( void * extraInfo)
virtual

Set any extra info provided by the PositionedActor struct used to instantiate this actor.

Parameters
extraInfoPointer to the extra information that the actor might need

Definition at line 903 of file Actor.c.

# setSpec()

void Actor::setSpec ( void * actorSpec)
virtual

Set the actor's spec.

Parameters
actorSpecSpecification that determines how to configure the actor

Reimplemented in ParticleSystem.

Definition at line 895 of file Actor.c.

# spawnChildActor()

Actor Actor::spawnChildActor ( const PositionedActor *const positionedActor)

Spawn a new child and configure it with the provided positioned actor struct.

Parameters
positionedActorStruct that defines which actor spec to use to configure the new child

Definition at line 602 of file Actor.c.

# stopAnimation()

void Actor::stopAnimation ( )

Stop any playing animation if any.

Definition at line 829 of file Actor.c.

# suspend()

void Actor::suspend ( )
virtual

Prepare to suspend this instance's logic.

Reimplemented from Container.

Reimplemented in ParticleSystem.

Definition at line 520 of file Actor.c.

# Member Data Documentation

# actorFactory

ActorFactory Actor::actorFactory
protected

Factory to create this actor's children.

Definition at line 120 of file Actor.h.

# actorSpec

const ActorSpec* Actor::actorSpec
protected

Pointer to the spec that defines how to initialize the actor.

Definition at line 123 of file Actor.h.

# centerDisplacement

Vector3D* Actor::centerDisplacement
protected

Diplacement between the actor's bounding box's center and its local position used to speed up the visibility check of the actor withing the camera's frustum

Definition at line 127 of file Actor.h.

# playingAnimationName

const char* Actor::playingAnimationName
protected

Name of the currently playing animation. This is here to save on memory on Entities that don't need to keep track of the playing animation for resuming

Definition at line 131 of file Actor.h.

# size

Size Actor::size
protected

Size of the actor in function of its components and its children's, grand children's, etc. components

Definition at line 117 of file Actor.h.


The documentation for this class was generated from the following files:
  • VUEngine-Core/source/Entity/Container/Actor/Actor.h
  • VUEngine-Core/source/Entity/Container/Actor/Actor.c