ScummVM API documentation
Grim::Actor Class Reference

Actor represents a 3D character on screen. More...

#include <actor.h>

Inheritance diagram for Grim::Actor:
Grim::PoolObject< Actor > Grim::PoolObjectBase

Public Types

enum  CollisionMode { CollisionOff = 0, CollisionBox = 1, CollisionSphere = 2 }
 
enum  AlphaMode { AlphaOff = -1, AlphaReplace = 2, AlphaModulate = 3 }
 
enum  LightMode { LightStatic = 0, LightFastDyn = 1, LightNormDyn = 2, LightNone = 3 }
 

Public Member Functions

 Actor ()
 
 ~Actor ()
 
void saveState (SaveGame *savedState) const
 
bool restoreState (SaveGame *savedState)
 
const Common::StringgetName () 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
 
CostumegetTalkCostume (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 ()
 
CostumegetCurrentCostume () const
 
void setLocalAlphaMode (unsigned int vertex, AlphaMode alphamode)
 
void setLocalAlpha (unsigned int vertex, float alpha)
 
bool hasLocalAlpha () const
 
float getLocalAlpha (unsigned int vertex) const
 
CostumefindCostume (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< MaterialloadMaterial (const Common::String &name, bool clamp)
 
ObjectPtr< MaterialfindMaterial (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 PoolgetPool ()
 

Additional Inherited Members

- Static Protected Member Functions inherited from Grim::PoolObject< Actor >
static void saveStaticState (SaveGame *state)
 
static void restoreStaticState (SaveGame *state)
 

Detailed Description

Actor represents a 3D character on screen.

Constructor & Destructor Documentation

◆ Actor()

Grim::Actor::Actor ( )

Builds an actor setting up only the minimal variables.

◆ ~Actor()

Grim::Actor::~Actor ( )

Destroys the actor. The actor is automatically removed from the GrimEngine instance.

Member Function Documentation

◆ saveState()

void Grim::Actor::saveState ( SaveGame savedState) const

Saves the actor state.

Parameters
savedStateThe save state to which save the actor's state.

◆ restoreState()

bool Grim::Actor::restoreState ( SaveGame savedState)

Restores the actor state.

Parameters
savedStateThe saved state from which the actor will be restored.

◆ getName()

const Common::String& Grim::Actor::getName ( ) const
inline

Returns the name of the actor.

◆ setName()

void Grim::Actor::setName ( const Common::String name)
inline

Sets the name of the actor.

Parameters
nameThe name.

◆ setTalkColor()

void Grim::Actor::setTalkColor ( const Color color)
inline

Sets the color of the subtitles of the actor.

Parameters
colorThe color.
See also
getTalkColor

◆ getTalkColor()

Color Grim::Actor::getTalkColor ( ) const
inline

Returns the color of the subtitles of the actor.

See also
setTalkColor

◆ setPos()

void Grim::Actor::setPos ( const Math::Vector3d &  position)

Sets the position of the actor on the 3D scene.

Parameters
positionThe position.
See also
getPos

◆ getPos()

Math::Vector3d Grim::Actor::getPos ( ) const
inline

Returns the position of the actor on the 3D scene.

See also
setPos

◆ walkTo()

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.

Parameters
positionThe destination position.
See also
stopWalking
isWalking

◆ stopWalking()

void Grim::Actor::stopWalking ( )
inline

Stops immediately the actor's walk.

See also
walkTo
isWalking

◆ isWalking()

bool Grim::Actor::isWalking ( ) const

Returns true if the actor is walking to a position.

See also
walkTo
stopWalking

◆ turnTo() [1/2]

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.

Parameters
pitchThe rotation of the x axis
yawThe rotation of the z axis
rollThe rotation of the y axis
snapIf true tells the actor to increate its turn speed.
See also
getPitch
getYaw
getRoll
setRot
turn
isTurning

◆ turnTo() [2/2]

void Grim::Actor::turnTo ( const Math::Vector3d &  pos,
bool  snap = false 
)

Turn the actor towards a point in space. The effect is not immediate, the actor will slowly rotate to the destination orientation.

Parameters
posThe position the actor should turn to.
snapIf true tells the actor to increate its turn speed.
See also
turnTo
setRot

◆ singleTurnTo()

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.

Parameters
posThe position the actor should turn to.
Returns
true if the actor has reached the desired orientation
See also
turnTo
setRot

◆ isTurning()

bool Grim::Actor::isTurning ( ) const

Returns true if the actor is turning.

See also
turnTo

◆ stopTurning()

void Grim::Actor::stopTurning ( )

Stops the actor from turning

◆ setRot() [1/2]

void Grim::Actor::setRot ( const Math::Angle &  pitch,
const Math::Angle &  yaw,
const Math::Angle &  roll 
)

Sets the rotation of the actor in the 3D scene. The effect is immediate.

Parameters
pitchThe rotation of the x axis
yawThe rotation of the z axis
rollThe rotation of the y axis
See also
getPitch
getYaw
getRoll
turnTo
turn
isTurning

◆ setRot() [2/2]

void Grim::Actor::setRot ( const Math::Vector3d &  pos)

Turn the actor towards a point in space. The effect is immediate.

Parameters
posThe position the actor should turn to.
See also
turnTo
setRot

◆ turn()

void Grim::Actor::turn ( int  dir)

Turns the actor by the given parameter on the z axis. The actual movement depends also on the turn rate.

Parameters
dirThe quantity of the movement.
See also
getPitch
getYaw
getRoll
setRot
turnTo
isTurning

◆ getPitch()

Math::Angle Grim::Actor::getPitch ( ) const
inline

Returns the pitch of the actor, which is the rotation on the x axis.

See also
getYaw
getRoll
setRot
turnTo
isTurning

◆ getYaw()

Math::Angle Grim::Actor::getYaw ( ) const
inline

Returns the yaw of the actor, which is the rotation on the z axis.

See also
getPitch
getRoll
setRot
turnTo
isTurning

◆ getRoll()

Math::Angle Grim::Actor::getRoll ( ) const
inline

Returns the roll of the actor, which is the rotation on the y axis.

See also
getPitch
getYaw
setRot
turnTo
isTurning

◆ getYawTo() [1/2]

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.

Parameters
actorThe actor to look at.

◆ getYawTo() [2/2]

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.

Parameters
actorThe point to look at.

◆ setVisibility()

void Grim::Actor::setVisibility ( bool  val)
inline

Sets the actor visibility.

Parameters
valThe value: true if visible, false otherwise.
See also
isVisible

◆ isVisible()

bool Grim::Actor::isVisible ( ) const
inline

Returns true if the actor is visible.

See also
setVisibility

◆ setScale()

void Grim::Actor::setScale ( float  scale)
inline

Sets the scale of the actor. A value of 1 is the natural size.

Parameters
scaleThe scale of the actor.

◆ setTimeScale()

void Grim::Actor::setTimeScale ( float  scale)
inline

Sets the time scale of the actor, used to calculate the speed of its animations. A value of 1 is the normal speed.

Parameters
scaleThe time scale.
See also
getTimeScale

◆ getTimeScale()

float Grim::Actor::getTimeScale ( ) const
inline

Returns the time scale of the actor.

See also
setTimeScale

◆ putInSet()

void Grim::Actor::putInSet ( const Common::String setName)

Puts the actor in a set.

Parameters
setNameThe name of the set.

◆ isDrawableInSet()

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.

Parameters
setNameThe name of the set.

◆ isInSet()

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.

Parameters
setNameThe name of the set.

◆ setTurnRate()

void Grim::Actor::setTurnRate ( float  rate)
inline

Sets the rate of the turning.

Parameters
ratThe wanted rate.
See also
getTurnRate

◆ getTurnRate()

float Grim::Actor::getTurnRate ( ) const
inline

Returns the turn rate.

See also
setTurnRate

◆ setWalkRate()

void Grim::Actor::setWalkRate ( float  rate)
inline

Sets the rate of the walk movement.

Parameters
rateThe wanted rate.
See also
getWalkRate

◆ getWalkRate()

float Grim::Actor::getWalkRate ( ) const
inline

Returns the walk rate of the actor.

See also
setWalkRate

◆ walkForward()

void Grim::Actor::walkForward ( )

Makes the actor move forward, the lenght of the movement based on the walk rate. If it is following boxes it will not go into not walkable areas.

See also
walkTo

◆ setRunning()

void Grim::Actor::setRunning ( bool  running)
inline

Used to tell the actor if it is running or not.

Parameters
runningThe value: true if it is running.

◆ getPuckVector()

Math::Vector3d Grim::Actor::getPuckVector ( ) const

Returns a vector representing the direction the actor is facing.

◆ sayLine()

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.

Parameters
msgIdThe id of the message to say.
background?? actual meaning unknown yet.
See also
isTalking
shutUp

◆ shutUp()

void Grim::Actor::shutUp ( )

Makes the actor discard any subtitle and voice.

See also
sayLine
isTalking

◆ isTalking()

bool Grim::Actor::isTalking ( )

Returns true if the actor is saying something.

See also
sayLine
shutUp

◆ updateTalk()

bool Grim::Actor::updateTalk ( uint  frameTime)

Check if the actor is still talking. If it is returns true, otherwise false.


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