se_core::PhDefault Class Reference

A default movement formula. More...

#include <PhDefault.hpp>

Inheritance diagram for se_core::PhDefault:

se_core::Physics se_core::Object List of all members.

Public Member Functions

 PhDefault ()
 PhDefault (const char *name)
void calcNext (const se_core::PhysicsComponent &physics, const se_core::Pos &pos, se_core::Pos &nextPos, const se_core::Move &move, se_core::Move &nextMove) const
bool isBlocked (const se_core::PhysicsComponent &physics, const se_core::Pos &pos, se_core::Pos &nextPos) const
virtual void blocked (const se_core::PhysicsComponent &physics, const se_core::Pos &pos, se_core::Pos &nextPos, const se_core::Move &move, se_core::Move &nextMove) const
void affect (se_core::PhysicsComponent &physics) const
virtual void calcNext (const PhysicsComponent &physics, const Pos &pos, Pos &nextPos, const Move &move, Move &nextMove) const =0
 Calculate the next position of the actor.
virtual void affect (PhysicsComponent &physics) const =0
 State changes to actor as a result of its position should happen inside affect.
virtual bool isStacker () const
 Should return false if the physics state should be popped before any is pushed on top of it.
int id () const
 Get the Object id of the object.
virtual const char * name () const
 Get the name of the Object.
int type () const
 Get the type of the Object (got_ACTION, got_THING, etc).

Static Public Member Functions

const Physicslookup (const char *name)
int hash (int type, const char *name)
 Calculate hash (object id) given object type and name.

Protected Member Functions

void blendAnims (const se_core::Pos &pos, se_core::Pos &nextPos) const
void revertXZ (const se_core::Pos &pos, se_core::Pos &nextPos) const
void updateForces (se_core::Move &nextMove) const
void applyFriction (se_core::Move &nextMove) const
void applyForces (const se_core::Pos &pos, se_core::Pos &nextPos, const se_core::Move &move, se_core::Move &nextMove) const
void clampToGround (const se_core::Pos &pos, se_core::Pos &nextPos, se_core::Move &nextMove) const

Static Protected Member Functions

const Object_lookup (int hash)
const Object_lookup (int type, const char *name)

Static Protected Attributes

const se_core::Vector3 GRAVITY

Detailed Description

A default movement formula.

Definition at line 31 of file PhDefault.hpp.


Constructor & Destructor Documentation

se_core::PhDefault::PhDefault  )  [inline]
 

Definition at line 33 of file PhDefault.hpp.

se_core::PhDefault::PhDefault const char *  name  )  [inline]
 

Definition at line 34 of file PhDefault.hpp.


Member Function Documentation

const Object* se_core::Object::_lookup int  type,
const char *  name
[inline, static, protected, inherited]
 

Definition at line 102 of file Object.hpp.

const Object * se_core::Object::_lookup int  hash  )  [static, protected, inherited]
 

Definition at line 56 of file Object.cpp.

References se_core::ObjectRepository::get(), and se_core::CompSchema::objectRepository().

Referenced by se_core::Signal::lookup(), se_core::Script::lookup(), se_core::QuestGoal::lookup(), se_core::Cutscene::lookup(), se_core::ThingCollide::lookup(), se_core::Physics::lookup(), se_core::Ambience::lookup(), and se_core::Action::lookup().

virtual void se_core::Physics::affect PhysicsComponent physics  )  const [pure virtual, inherited]
 

State changes to actor as a result of its position should happen inside affect.

These can include health reductions as a result of standing on a firepit, etc. Changes that happen because of moving into a new terrain type should be handled by terrainMode switcher, though.

void se_core::PhDefault::affect se_core::PhysicsComponent physics  )  const [inline]
 

Definition at line 54 of file PhDefault.hpp.

void se_core::PhDefault::applyForces const se_core::Pos pos,
se_core::Pos nextPos,
const se_core::Move move,
se_core::Move nextMove
const [protected]
 

Definition at line 223 of file PhDefault.cpp.

References se_core::Tuple3::add(), se_core::Move::angularVelocity_, se_core::Pos::localCoor(), se_core::Pos::localFace(), se_core::Euler3::rotate(), se_core::Pos::updateWorldViewPoint(), and se_core::Move::velocity_.

void se_core::PhDefault::applyFriction se_core::Move nextMove  )  const [protected]
 

Definition at line 185 of file PhDefault.cpp.

References se_core::Tuple3::add(), se_core::Move::angularFriction_, se_core::Move::angularVelocity_, se_core::Move::bounceMaintain_, se_core::Move::didBounce_, se_core::Tuple3::isZero(), se_core::Move::linearFriction_, se_core::Vector3::normalize(), se_core::Tuple3::scale(), se_core::Euler3::scale(), se_core::Move::velocity(), se_core::Move::velocity_, se_core::Tuple3::x_, se_core::Vector3::xzLengthSquared(), se_core::Tuple3::y_, and se_core::Tuple3::z_.

void se_core::PhDefault::blendAnims const se_core::Pos pos,
se_core::Pos nextPos
const [protected]
 

Definition at line 130 of file PhDefault.cpp.

References se_core::Pos::anim(), scale_t, se_core::Anim::setWeight(), se_core::Anim::updatePos(), and se_core::Anim::weight().

void se_core::PhDefault::blocked const se_core::PhysicsComponent physics,
const se_core::Pos pos,
se_core::Pos nextPos,
const se_core::Move move,
se_core::Move nextMove
const [virtual]
 

Definition at line 97 of file PhDefault.cpp.

virtual void se_core::Physics::calcNext const PhysicsComponent physics,
const Pos pos,
Pos nextPos,
const Move move,
Move nextMove
const [pure virtual, inherited]
 

Calculate the next position of the actor.

The pos and nextPos parameter values will usually be the ones returned by actor.pos() and actor.nextPos(). But they are explicit parameters to enable movement prediction.

No state changes other than those that applies to nextPos should happen in calcNext, because the results of this method should be reversible on collision, and be usable for prediction.

It is the responsibility of this method to check for collisions with static terrain.

Parameters:
physics the physics of composite that is moved
pos the position of the actor is at the beginning of this simulation step
nextPos output var - where the actor should be the beginning of the next simulation step
move work vars for movement, as they where at the beginning if this simulation step
nextMove output var - values are the same as move when the method is first called, but changes will be passed on to the next simulation step

Referenced by se_core::PhysicsComponent::calcNextCoor().

void se_core::PhDefault::calcNext const se_core::PhysicsComponent physics,
const se_core::Pos pos,
se_core::Pos nextPos,
const se_core::Move move,
se_core::Move nextMove
const
 

Definition at line 35 of file PhDefault.cpp.

References se_core::Pos::isKeyFramePath(), and se_core::Pos::updateArea().

void se_core::PhDefault::clampToGround const se_core::Pos pos,
se_core::Pos nextPos,
se_core::Move nextMove
const [protected]
 

Definition at line 237 of file PhDefault.cpp.

References se_core::Pos::area(), coor_t, se_core::Pos::index(), se_core::Pos::isGrounded(), se_core::Pos::localCoor(), se_core::Pos::setGrounded(), se_core::Pos::updateLocalViewPoint(), se_core::Move::velocity_, se_core::Pos::worldCoor(), and se_core::Tuple3::y_.

int se_core::Object::hash int  type,
const char *  name
[static, inherited]
 

Calculate hash (object id) given object type and name.

Definition at line 42 of file Object.cpp.

int se_core::Object::id  )  const [inline, inherited]
 

Get the Object id of the object.

Each instance of Object has a unique Object id assigned to it during construction. The id_ is a hash of the name. And will be the same every time the game is run.

Sometimes two different names can give the same hash, and id. When this occurs the name of the object must be changed.

Returns:
The unique Object instance id.

Definition at line 69 of file Object.hpp.

Referenced by se_core::ObjectRepository::add(), se_core::operator<<(), and se_core::ObjectRepository::remove().

bool se_core::PhDefault::isBlocked const se_core::PhysicsComponent physics,
const se_core::Pos pos,
se_core::Pos nextPos
const
 

Definition at line 76 of file PhDefault.cpp.

References se_core::Pos::hasIndex(), and se_core::Pos::terrainStyle().

virtual bool se_core::Physics::isStacker  )  const [inline, virtual, inherited]
 

Should return false if the physics state should be popped before any is pushed on top of it.

Definition at line 92 of file Physics.hpp.

const Physics* se_core::Physics::lookup const char *  name  )  [inline, static, inherited]
 

Definition at line 37 of file Physics.hpp.

References se_core::Object::_lookup(), and se_core::got_PHYSICS.

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

Get the name of the Object.

Returns:
The name of the Object, or 0 if is not named.

Definition at line 78 of file Object.hpp.

Referenced by se_core::operator<<(), se_core::CutsceneParser::parse(), and se_basic::Say::perform().

void se_core::PhDefault::revertXZ const se_core::Pos pos,
se_core::Pos nextPos
const [protected]
 

Definition at line 159 of file PhDefault.cpp.

References se_core::Pos::area(), se_core::Pos::index_, se_core::Pos::localCoor(), se_core::Pos::setArea(), se_core::Pos::worldCoor(), se_core::Tuple3::x_, and se_core::Tuple3::z_.

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

Get the type of the Object (got_ACTION, got_THING, etc).

Classes subclassing game objects should have a type enumerated in the enum ObjectType. The subclass is itself responsible for reporting the type during construction, and a whole subclass hierarchy may share the same type (like Action and its subclasses, Script and its subclasses, etc).

Returns:
The type of the game object.

Definition at line 91 of file Object.hpp.

Referenced by se_core::operator<<().

void se_core::PhDefault::updateForces se_core::Move nextMove  )  const [protected]
 

Definition at line 177 of file PhDefault.cpp.

References se_core::Tuple3::add(), se_core::Move::angularVelocity_, se_core::Move::force_, se_core::Euler3::rotate(), se_core::Move::torque_, and se_core::Move::velocity_.


Member Data Documentation

const Vector3 se_core::PhDefault::GRAVITY [static, protected]
 


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

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

SourceForge.net Logo