se_core::ActionComponent Class Reference

Base class for actions. More...

#include <ActionComponent.hpp>

Inheritance diagram for se_core::ActionComponent:

se_core::Component List of all members.

Public Types

typedef ComponentPtr< ActionComponent,
sct_ACTION > 
Ptr
enum  { fb_UNDEFINED, fb_SPEECH_FINISHED, fb_USER_DEFINED }

Public Member Functions

 ActionComponent (Composite *owner)
 Constructor.
 ~ActionComponent ()
 Destructor.
void planAction (short channel, const Action &action, const Parameter *parameter=0) const
 Plan a new action.
void planAction (short channel, const ActionAndParameter &action) const
void planActionIfNone (short channel, const ActionAndParameter &action) const
void clearPlannedAction (short channel) const
 Clear planned action.
void disrupt ()
 Disrupt all actions the this ActionComponent has in the ActionQueue.
void resume ()
 Resume disrupted/paused script.
bool disrupt (short channel)
 Disrupt an action the this ActionComponent has in a given ActionQueue channel.
void unpause (short channel)
 Insert paused action into action queue.
void scheduleForDestruction ()
 Schedule this ActionComponent for destruction.
void resetActionFeed ()
void castFeedbackEvent (int type)
void setActionFeed (ActionFeed *feed)
void setActive (bool state)
 Called by Composite.
void setScriptActive (bool state)
virtual const char * name () const
 By default returns name of composite, which returns name of composite factory.
Compositeowner ()
const Compositeowner () const
 Component type.
Componentcomponent (int type)
const Componentcomponent (int type) const
int type () const
const ComponentFactoryfactory ()
bool isActive ()
bool isDead () const

Protected Member Functions

void cleanup ()
 Called by Composite.
void perform (long when, short channel)
 Perform an already scheduled Action.
void scheduleNextAction (long when, short channel)
 Schedule next action.
unsigned short actionSchedule (short channel)
 Get the ActionQueue index for when the action in a give channel is scheduled to be performed.
void continueAction (long when, short channel)
void scheduleNextAction (short channel)
void nextScriptAction (short channel)
 Ask currently running script for the next action in a channel.
virtual void setDead ()
 Called by Composite.
virtual void parentChanged (Composite *newParent, Composite *oldParent)
 Called by Composite.
virtual void zoneChanged (int type, Composite *newArea, Composite *oldArea)
 Called by Composite.
virtual void init ()
 Called by Composite.

Protected Attributes

ActionAndParameter presentAction_ [CHANNEL_COUNT]
ActionAndParameter plannedAction_ [CHANNEL_COUNT]
unsigned short presentActionScheduledComplete_ [CHANNEL_COUNT]
ActionFeedfeed_
int type_
 The type of Component.
Compositeowner_
const ComponentFactoryfactory_

Friends

class ActionQueue
class Composite

Detailed Description

Base class for actions.

ActionComponents are the atoms of game-character behaviour in SagaEngine. They define what a character can do.

Definition at line 41 of file ActionComponent.hpp.


Member Typedef Documentation

typedef ComponentPtr<ActionComponent, sct_ACTION> se_core::ActionComponent::Ptr
 

Definition at line 43 of file ActionComponent.hpp.


Member Enumeration Documentation

anonymous enum
 

Enumeration values:
fb_UNDEFINED 
fb_SPEECH_FINISHED 
fb_USER_DEFINED 

Definition at line 104 of file ActionComponent.hpp.


Constructor & Destructor Documentation

se_core::ActionComponent::ActionComponent Composite owner  ) 
 

Constructor.

Definition at line 30 of file ActionComponent.cpp.

References se_core::sct_ACTION.

se_core::ActionComponent::~ActionComponent  ) 
 

Destructor.

Definition at line 39 of file ActionComponent.cpp.


Member Function Documentation

unsigned short se_core::ActionComponent::actionSchedule short  channel  )  [inline, protected]
 

Get the ActionQueue index for when the action in a give channel is scheduled to be performed.

Don't call this method yourself. It is a helper function for ActionQueue's disrupt().

Definition at line 138 of file ActionComponent.hpp.

Referenced by se_core::ActionQueue::disrupt().

void se_core::ActionComponent::castFeedbackEvent int  type  ) 
 

Definition at line 223 of file ActionComponent.cpp.

References se_core::Action::feedbackEvent().

void se_core::ActionComponent::cleanup  )  [protected, virtual]
 

Called by Composite.

Reimplemented from se_core::Component.

Definition at line 44 of file ActionComponent.cpp.

void se_core::ActionComponent::clearPlannedAction short  channel  )  const
 

Clear planned action.

Clear an action that is waiting for being entered into the ActionQueue, but hasn't yet gotten there (because another Action for the same ActionComponent and channel is already in the queue).

Definition at line 129 of file ActionComponent.cpp.

const Component* se_core::Component::component int  type  )  const [inline, inherited]
 

Definition at line 71 of file Component.hpp.

References se_core::Component::component().

Component* se_core::Component::component int  type  )  [inline, inherited]
 

Definition at line 67 of file Component.hpp.

References se_core::Composite::component().

Referenced by se_core::Component::component(), se_core::Component::ComponentPtr< T, type >::ComponentPtr(), se_ogre::O3dThingComponent::get(), se_ogre::O3dNodeComponent::get(), and se_ogre::O3dAreaComponent::get().

void se_core::ActionComponent::continueAction long  when,
short  channel
[protected]
 

Definition at line 78 of file ActionComponent.cpp.

References se_core::Action::doPause(), se_core::Action::duration(), and se_core::Parameter::incrActionStage().

bool se_core::ActionComponent::disrupt short  channel  ) 
 

Disrupt an action the this ActionComponent has in a given ActionQueue channel.

Actions that are performed in the on-going initiative are not disrupted.

Definition at line 157 of file ActionComponent.cpp.

References se_core::Action::disrupt().

void se_core::ActionComponent::disrupt  ) 
 

Disrupt all actions the this ActionComponent has in the ActionQueue.

Actions that are performed in the on-going initiative are not disrupted.

Definition at line 135 of file ActionComponent.cpp.

const ComponentFactory* se_core::Component::factory  )  [inline, inherited]
 

Definition at line 81 of file Component.hpp.

Referenced by se_core::Composite::releaseComponents().

void se_core::Component::init  )  [protected, virtual, inherited]
 

Called by Composite.

Reimplemented in se_core::RootComponent, se_core::SignalAreaComponent, se_ogre::O3dAreaComponent, and se_ogre::O3dThingComponent.

Definition at line 42 of file Component.cpp.

Referenced by se_core::Composite::init().

bool se_core::Component::isActive  )  [inherited]
 

Definition at line 26 of file Component.cpp.

bool se_core::Component::isDead  )  const [inherited]
 

Definition at line 31 of file Component.cpp.

Referenced by se_core::Actor::affect().

const char * se_core::Component::name  )  const [virtual, inherited]
 

By default returns name of composite, which returns name of composite factory.

Reimplemented in se_core::CutsceneAreaComponent, se_core::CutsceneComponent, se_core::CutsceneManager, se_core::CollisionAreaComponent, se_core::SignalAreaComponent, se_core::SignalComponent, se_core::SpawnAreaComponent, se_core::SpawnManager, se_core::ZoneAreaComponent, se_core::ZoneComponent, se_core::ZoneManager, se_basic::NavMeshAreaComponent, se_basic::NavMeshComponent, and se_basic::NavMeshManager.

Definition at line 21 of file Component.cpp.

Referenced by se_core::Area::addNeighbour(), se_core::DefaultTC::collide(), se_core::CoDefault::collide(), se_basic::Say::perform(), and se_ogre::SpeechBubble::speechEvent().

void se_core::ActionComponent::nextScriptAction short  channel  )  [protected]
 

Ask currently running script for the next action in a channel.

Definition at line 175 of file ActionComponent.cpp.

References se_core::ActionAndParameter::hasAction().

const Composite* se_core::Component::owner  )  const [inline, inherited]
 

Component type.

Definition at line 62 of file Component.hpp.

Composite* se_core::Component::owner  )  [inline, inherited]
 

Definition at line 54 of file Component.hpp.

Referenced by se_core::CollisionAreaComponent::_testCollisionCandidates(), se_core::CollisionAreaComponent::_testCollisionCandidates2(), se_core::HealthListeners::add(), se_core::ZoneAreaComponent::addNeighbour(), se_basic::PhTrackingCamera::affect(), se_core::HealthListeners::castHealthChangedEvent(), se_core::Component::ComponentPtr< T, type >::ComponentPtr(), se_ogre::ThingMOManager::create(), se_basic::SimpleAreaThingEncoder::encode(), se_core::SpawnComponent::get(), se_core::SignalComponent::get(), se_core::SignalAreaComponent::get(), se_core::ScriptComponent::get(), se_core::PosComponent::get(), se_core::PhysicsComponent::get(), se_core::StatComponent::get(), se_ogre::O3dThingComponent::get(), se_ogre::O3dNodeComponent::get(), se_ogre::O3dAreaComponent::get(), se_core::Pos::hasArea(), se_core::CollisionGrid::insert(), se_core::CollisionComponent::isCollideable(), se_core::ZoneComponent::name(), se_core::Component::ComponentPtr< T, type >::operator=(), se_core::DefaultTC::pop(), se_core::CoDefault::pop(), se_core::DefaultTC::popAndDie(), se_core::CoDefault::popAndDie(), se_core::CollisionAreaComponent::removeCollideable(), se_core::AreaManager::resetThings(), se_core::Actor::scheduleForDestruction(), se_core::AreaManager::setActive(), se_core::AreaManager::setInactive(), and se_ogre::O3dManager::updateStats().

virtual void se_core::Component::parentChanged Composite newParent,
Composite oldParent
[inline, protected, virtual, inherited]
 

Called by Composite.

Reimplemented in se_core::AreaChildComponent, and se_core::NodeComponent.

Definition at line 101 of file Component.hpp.

Referenced by se_core::Composite::resetParent(), and se_core::Composite::setParent().

void se_core::ActionComponent::perform long  when,
short  channel
[inline, protected]
 

Perform an already scheduled Action.

Don't call this method yourself. It is used by the ActionQueue.

Definition at line 162 of file ActionComponent.hpp.

References se_core::Action::perform().

Referenced by se_core::ActionQueue::performScheduledActions().

void se_core::ActionComponent::planAction short  channel,
const ActionAndParameter action
const
 

Definition at line 111 of file ActionComponent.cpp.

References se_core::ActionAndParameter::hasAction().

void se_core::ActionComponent::planAction short  channel,
const Action action,
const Parameter parameter = 0
const
 

Plan a new action.

Plan an Action that will be scheduled when the present one is finished. Will overwrite any action that is presently planned but not yet in the ActionQueue.

Definition at line 99 of file ActionComponent.cpp.

void se_core::ActionComponent::planActionIfNone short  channel,
const ActionAndParameter action
const
 

Definition at line 122 of file ActionComponent.cpp.

void se_core::ActionComponent::resetActionFeed  )  [inline]
 

Definition at line 100 of file ActionComponent.hpp.

void se_core::ActionComponent::resume  ) 
 

Resume disrupted/paused script.

Definition at line 143 of file ActionComponent.cpp.

void se_core::ActionComponent::scheduleForDestruction  ) 
 

Schedule this ActionComponent for destruction.

It will be destroyed when the on-going initative is performed, allowing the actor to complete any action it is performing this initiative.

void se_core::ActionComponent::scheduleNextAction short  channel  )  [protected]
 

Definition at line 53 of file ActionComponent.cpp.

References Assert, se_core::Action::doPause(), se_core::Action::duration(), se_core::Action::prepare(), se_core::Parameter::resetActionStage(), and se_core::Parameter::setChannel().

void se_core::ActionComponent::scheduleNextAction long  when,
short  channel
[inline, protected]
 

Schedule next action.

Schedule the next action when the present one is finished. The next action may be:

  • The same one if it is a multi-stage action that has not finished it's last stage
  • It can be a planned one.
  • The same one if it is auto-repeating and no new action is planned.
  • One fetched from the present Script if none of the above are true. Don't call this method yourself. It is used by the ActionQueue.

Definition at line 170 of file ActionComponent.hpp.

References se_core::ActionAndParameter::action(), se_core::ActionAndParameter::hasAction(), se_core::Action::isContinuing(), se_core::ActionAndParameter::isDisrupted(), se_core::Action::isRepeating(), se_core::ActionAndParameter::parameter(), se_core::ActionAndParameter::resetAction(), and se_core::ActionAndParameter::setDisrupted().

Referenced by se_core::ActionQueue::scheduleNextActions().

void se_core::ActionComponent::setActionFeed ActionFeed feed  ) 
 

Definition at line 188 of file ActionComponent.cpp.

References AssertFatal.

void se_core::ActionComponent::setActive bool  state  )  [virtual]
 

Called by Composite.

Reimplemented from se_core::Component.

Definition at line 216 of file ActionComponent.cpp.

References LogDetail.

virtual void se_core::Component::setDead  )  [inline, protected, virtual, inherited]
 

Called by Composite.

Reimplemented in se_core::SignalComponent, and se_core::SpawnComponent.

Definition at line 97 of file Component.hpp.

Referenced by se_core::Composite::scheduleForDestruction().

void se_core::ActionComponent::setScriptActive bool  state  ) 
 

Definition at line 195 of file ActionComponent.cpp.

int se_core::Component::type  )  const [inline, inherited]
 

Definition at line 76 of file Component.hpp.

Referenced by se_core::Composite::component().

void se_core::ActionComponent::unpause short  channel  ) 
 

Insert paused action into action queue.

Definition at line 91 of file ActionComponent.cpp.

References se_core::Action::duration().

void se_core::Component::zoneChanged int  type,
Composite newArea,
Composite oldArea
[protected, virtual, inherited]
 

Called by Composite.

Reimplemented in se_core::AreaChildComponent, se_core::CollisionComponent, and se_core::SignalComponent.

Definition at line 37 of file Component.cpp.

Referenced by se_core::Composite::zoneChanged().


Friends And Related Function Documentation

friend class ActionQueue [friend]
 

Definition at line 112 of file ActionComponent.hpp.

friend class Composite [friend, inherited]
 

Definition at line 89 of file Component.hpp.


Member Data Documentation

const ComponentFactory* se_core::Component::factory_ [protected, inherited]
 

Definition at line 120 of file Component.hpp.

ActionFeed* se_core::ActionComponent::feed_ [protected]
 

Definition at line 155 of file ActionComponent.hpp.

Composite* se_core::Component::owner_ [protected, inherited]
 

Definition at line 118 of file Component.hpp.

ActionAndParameter se_core::ActionComponent::plannedAction_[CHANNEL_COUNT] [mutable, protected]
 

Definition at line 150 of file ActionComponent.hpp.

ActionAndParameter se_core::ActionComponent::presentAction_[CHANNEL_COUNT] [mutable, protected]
 

Definition at line 149 of file ActionComponent.hpp.

unsigned short se_core::ActionComponent::presentActionScheduledComplete_[CHANNEL_COUNT] [mutable, protected]
 

Definition at line 152 of file ActionComponent.hpp.

int se_core::Component::type_ [protected, inherited]
 

The type of Component.

Definition at line 117 of file Component.hpp.


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

Home Page | SagaEngine trunk (updated nightly) reference generated Sun Dec 2 20:06:25 2007 by Doxygen version 1.3.9.1.

SourceForge.net Logo