Actor represents a 3D character on screen. More...
#include <actor.h>
Public Member Functions | |
Actor () | |
~Actor () | |
void | saveState (SaveGame *savedState) const |
bool | restoreState (SaveGame *savedState) |
const Common::String & | getName () const |
void | setName (const Common::String &name) |
void | setTalkColor (const Color &color) |
Color | getTalkColor () const |
void | setPos (const Math::Vector3d &position) |
Math::Vector3d | getPos () const |
Math::Vector3d | getDestPos () const |
void | walkTo (const Math::Vector3d &position) |
void | stopWalking () |
bool | isWalking () const |
void | turnTo (const Math::Angle &pitch, const Math::Angle &yaw, const Math::Angle &roll, bool snap=false) |
void | turnTo (const Math::Vector3d &pos, bool snap=false) |
bool | singleTurnTo (const Math::Vector3d &pos) |
bool | isTurning () const |
void | stopTurning () |
void | setRot (const Math::Angle &pitch, const Math::Angle &yaw, const Math::Angle &roll) |
void | setRot (const Math::Vector3d &pos) |
void | turn (int dir) |
Math::Angle | getPitch () const |
Math::Angle | getYaw () const |
Math::Angle | getRoll () const |
Math::Angle | getYawTo (const Actor *actor) const |
Math::Angle | getYawTo (const Math::Vector3d &p) const |
void | setVisibility (bool val) |
bool | isVisible () const |
void | setScale (float scale) |
float | getScale () const |
void | setTimeScale (float scale) |
float | getTimeScale () const |
void | putInSet (const Common::String &setName) |
bool | isDrawableInSet (const Common::String &setName) const |
bool | isInSet (const Common::String &setName) const |
void | setTurnRate (float rate) |
float | getTurnRate () const |
void | setWalkRate (float rate) |
float | getWalkRate () const |
void | setLooking (bool lookingMode) |
void | walkForward () |
void | moveTo (const Math::Vector3d &pos) |
void | setRunning (bool running) |
void | setReflection (float angle) |
Math::Vector3d | getPuckVector () const |
void | setPuckOrient (bool orient) |
void | sayLine (const char *msgId, bool background, float x, float y) |
void | lineCleanup () |
void | shutUp () |
bool | isTalking () |
void | setRestChore (int choreNumber, Costume *cost) |
int | getRestChore () const |
void | setWalkChore (int choreNumber, Costume *cost) |
void | setTurnChores (int left_chore, int right_chore, Costume *cost) |
void | setTalkChore (int index, int choreNumber, Costume *cost) |
int | getTalkChore (int index) const |
Costume * | getTalkCostume (int index) const |
void | setMumbleChore (int choreNumber, Costume *cost) |
void | stopAllChores (bool ignoreLoopingChores=false) |
void | setColormap (const char *map) |
void | pushCostume (const char *name) |
void | setCostume (const char *name) |
void | popCostume () |
void | clearCostumes () |
Costume * | getCurrentCostume () const |
void | setLocalAlphaMode (unsigned int vertex, AlphaMode alphamode) |
void | setLocalAlpha (unsigned int vertex, float alpha) |
bool | hasLocalAlpha () const |
float | getLocalAlpha (unsigned int vertex) const |
Costume * | findCostume (const Common::String &name) |
int | getCostumeStackDepth () const |
const Common::List< Costume * > & | getCostumes () const |
void | setActiveShadow (int shadowId) |
void | setShadowPoint (const Math::Vector3d &pos) |
void | setShadowColor (const Color &color) |
void | setShadowPlane (const char *name) |
void | addShadowPlane (const char *name) |
void | clearShadowPlanes () |
void | clearShadowPlane (int i) |
void | setShadowValid (int) |
void | setActivateShadow (int, bool) |
void | setFollowBoxes (bool follow) |
bool | hasFollowBoxes () const |
bool | hasFollowedBoxes () const |
void | update (uint frameTime) |
bool | updateTalk (uint frameTime) |
void | draw () |
bool | isLookAtVectorZero () |
void | setLookAtVectorZero () |
void | setLookAtVector (const Math::Vector3d &vector) |
Math::Vector3d | getLookAtVector () |
void | setLookAtActor (Actor *other) |
void | setLookAtRate (float rate) |
float | getLookAtRate () const |
void | setHead (int joint1, int joint2, int joint3, float maxRoll, float maxPitch, float maxYaw) |
void | setHead (const char *joint, const Math::Vector3d &offset) |
void | setHeadLimits (float yawRange, float maxPitch, float minPitch) |
void | setCollisionMode (CollisionMode mode) |
void | setCollisionScale (float scale) |
bool | handleCollisionWith (Actor *actor, CollisionMode mode, Math::Vector3d *vec) const |
bool | isAttached () const |
Math::Vector3d | getWorldPos () const |
void | attachToActor (Actor *other, const char *joint) |
void | detach () |
Math::Quaternion | getRotationQuat () const |
const Math::Matrix4 | getFinalMatrix () const |
Math::Vector3d | getHeadPos () const |
void | setInOverworld (bool inOverworld) |
bool | isInOverworld () const |
float | getGlobalAlpha () const |
AlphaMode | getAlphaMode () const |
float | getEffectiveAlpha () const |
void | setGlobalAlpha (float alpha, const Common::String &mesh) |
void | setAlphaMode (AlphaMode mode, const Common::String &mesh) |
int | getSortOrder () const |
void | setSortOrder (const int order) |
int | getEffectiveSortOrder () const |
void | activateShadow (bool active, const char *shadowName) |
void | activateShadow (bool active, SetShadow *shadow) |
void | drawToCleanBuffer () |
bool | isTalkingForeground () const |
LightMode | getLightMode () const |
void | setLightMode (LightMode lightMode) |
ObjectPtr< Material > | loadMaterial (const Common::String &name, bool clamp) |
ObjectPtr< Material > | findMaterial (const Common::String &name) |
void | getBBoxInfo (Math::Vector3d &bboxPos, Math::Vector3d &bboxSize) const |
Public Member Functions inherited from Grim::PoolObject< Actor > | |
void | setId (int id) |
int | getId () const override |
int32 | getTag () const override |
Static Public Member Functions | |
static int32 | getStaticTag () |
static void | saveStaticState (SaveGame *state) |
static void | restoreStaticState (SaveGame *state) |
Static Public Member Functions inherited from Grim::PoolObject< Actor > | |
static Pool & | getPool () |
Additional Inherited Members | |
Static Protected Member Functions inherited from Grim::PoolObject< Actor > | |
static void | saveStaticState (SaveGame *state) |
static void | restoreStaticState (SaveGame *state) |
Actor represents a 3D character on screen.
Grim::Actor::Actor | ( | ) |
Builds an actor setting up only the minimal variables.
Grim::Actor::~Actor | ( | ) |
Destroys the actor. The actor is automatically removed from the GrimEngine instance.
void Grim::Actor::saveState | ( | SaveGame * | savedState | ) | const |
Saves the actor state.
savedState | The save state to which save the actor's state. |
bool Grim::Actor::restoreState | ( | SaveGame * | savedState | ) |
Restores the actor state.
savedState | The saved state from which the actor will be restored. |
|
inline |
Returns the name of the actor.
|
inline |
Sets the name of the actor.
name | The name. |
|
inline |
|
inline |
Returns the color of the subtitles of the actor.
void Grim::Actor::setPos | ( | const Math::Vector3d & | position | ) |
|
inline |
Returns the position of the actor on the 3D scene.
void Grim::Actor::walkTo | ( | const Math::Vector3d & | position | ) |
Tells the actor to go to the wanted position. If the actor follows the walkboxes it will find the best route to go there, otherwise it will walk on a straight line.
position | The destination position. |
|
inline |
bool Grim::Actor::isWalking | ( | ) | const |
Returns true if the actor is walking to a position.
void Grim::Actor::turnTo | ( | const Math::Angle & | pitch, |
const Math::Angle & | yaw, | ||
const Math::Angle & | roll, | ||
bool | snap = false |
||
) |
Sets the rotation of thes actor in the 3D scene. The effect is not immediate, the actor will slowly rotate to the destination orientation.
pitch | The rotation of the x axis |
yaw | The rotation of the z axis |
roll | The rotation of the y axis |
snap | If true tells the actor to increate its turn speed. |
void Grim::Actor::turnTo | ( | const Math::Vector3d & | pos, |
bool | snap = false |
||
) |
bool Grim::Actor::singleTurnTo | ( | const Math::Vector3d & | pos | ) |
Turn the actor towards a point in space, by an amount defined by the turn rate. This function does not make an actor point at the given position, but it makes it rotate towards that.
pos | The position the actor should turn to. |
bool Grim::Actor::isTurning | ( | ) | const |
Returns true if the actor is turning.
void Grim::Actor::stopTurning | ( | ) |
Stops the actor from turning
void Grim::Actor::setRot | ( | const Math::Angle & | pitch, |
const Math::Angle & | yaw, | ||
const Math::Angle & | roll | ||
) |
void Grim::Actor::setRot | ( | const Math::Vector3d & | pos | ) |
void Grim::Actor::turn | ( | int | dir | ) |
|
inline |
|
inline |
|
inline |
Math::Angle Grim::Actor::getYawTo | ( | const Actor * | actor | ) | const |
Calculates and returns the angle between the direction the actor is facing and the direction towards another actor.
actor | The actor to look at. |
Math::Angle Grim::Actor::getYawTo | ( | const Math::Vector3d & | p | ) | const |
Calculates and returns the angle between the direction the actor is facing and the direction towards a point.
actor | The point to look at. |
|
inline |
Sets the actor visibility.
val | The value: true if visible, false otherwise. |
|
inline |
Returns true if the actor is visible.
|
inline |
Sets the scale of the actor. A value of 1 is the natural size.
scale | The scale of the actor. |
|
inline |
Sets the time scale of the actor, used to calculate the speed of its animations. A value of 1 is the normal speed.
scale | The time scale. |
|
inline |
Returns the time scale of the actor.
void Grim::Actor::putInSet | ( | const Common::String & | setName | ) |
Puts the actor in a set.
setName | The name of the set. |
bool Grim::Actor::isDrawableInSet | ( | const Common::String & | setName | ) | const |
Returns true if the actor is in the given set. For engine internal use only, do not expose via lua API.
setName | The name of the set. |
bool Grim::Actor::isInSet | ( | const Common::String & | setName | ) | const |
Returns true if the actor is in the given set. Can be exposed via lua API.
setName | The name of the set. |
|
inline |
|
inline |
Returns the turn rate.
|
inline |
|
inline |
Returns the walk rate of the actor.
void Grim::Actor::walkForward | ( | ) |
Makes the actor move forward, the length of the movement based on the walk rate. If it is following boxes it will not go into not walkable areas.
|
inline |
Used to tell the actor if it is running or not.
running | The value: true if it is running. |
Math::Vector3d Grim::Actor::getPuckVector | ( | ) | const |
Returns a vector representing the direction the actor is facing.
void Grim::Actor::sayLine | ( | const char * | msgId, |
bool | background, | ||
float | x, | ||
float | y | ||
) |
Makes the actor say the given line. It will show a subtitle and/or play the voice, depending on the speech mode set in the GrimEngine instance.
msgId | The id of the message to say. |
background | ?? actual meaning unknown yet. |
void Grim::Actor::shutUp | ( | ) |
bool Grim::Actor::isTalking | ( | ) |
bool Grim::Actor::updateTalk | ( | uint | frameTime | ) |
Check if the actor is still talking. If it is returns true, otherwise false.