V-Gears 0
Free Final Fantasy VII engine.
Entity Class Referenceabstract

Any entity in a field. More...

#include <Entity.h>

Inheritance diagram for Entity:
Collaboration diagram for Entity:

Public Types

enum  AnimationState { REQUESTED_ANIMATION , AUTO_ANIMATION }
 Entity animation states. More...
 
enum  AnimationPlayType { PLAY_DEFAULT , PLAY_ONCE , PLAY_LOOPED }
 Types of animations. More...
 
enum  State {
  NONE , WALKMESH , LINEAR , JUMP ,
  NEEDS_TO_REATTACH
}
 Entity state. More...
 

Public Member Functions

 Entity (const Ogre::String &name, Ogre::SceneNode *node)
 Constructor. More...
 
virtual ~Entity ()
 Destructor. More...
 
virtual void Update ()
 Updates the entity status. More...
 
virtual void UpdateDebug ()
 Updates the entity status with debug information. More...
 
const Ogre::String & GetName () const
 Retrieves the entity name. More...
 
void SetPosition (const Ogre::Vector3 &position)
 Sets the entity position. More...
 
void ScriptSetPosition (const float x, const float y, const float z)
 Sets the entity position. More...
 
const Ogre::Vector3 GetPosition () const
 Retrieves the entity position. More...
 
void ScriptGetPosition () const
 Retrieves the entity position. More...
 
void SetOffset (const Ogre::Vector3 &position)
 Sets the entity position. More...
 
const Ogre::Vector3 GetOffset () const
 Retrieves the entity position. More...
 
void SetRotation (const Ogre::Degree &rotation)
 Sets the entity rotation. More...
 
void ScriptSetRotation (const float rotation)
 Sets the entity rotation. More...
 
Ogre::Degree GetRotation () const
 Retrieves the entity rotation. More...
 
float ScriptGetRotation () const
 Retrieves the entity rotation. More...
 
virtual void setScale (const Ogre::Vector3 &scale)
 Sets the entity scale. More...
 
void SetIndex (const int index)
 Sets the entity index in the field. More...
 
int GetIndex ()
 Retrieves the entity index in the field. More...
 
virtual void setRootOrientation (const Ogre::Quaternion &root_orientation)
 Sets the entity's absolute orientation. More...
 
float GetHeight () const
 Retrieves the entity's height. More...
 
void SetSolidRadius (const float radius)
 Sets the entity's solid radius. More...
 
float GetSolidRadius () const
 Retrieves the entity's solid radius. More...
 
void SetSolid (const bool solid)
 Makes the entity solid or non-solid. More...
 
bool IsSolid () const
 Checks if the entity is solid. More...
 
void SetTalkRadius (const float radius)
 Sets the entity talk radius. More...
 
float GetTalkRadius () const
 Retrieves the entity talk radius. More...
 
void SetTalkable (const bool talkable)
 Sets an entity as talkable or non-talkable. More...
 
bool IsTalkable () const
 Checks if an entity is talkable or non-talkable. More...
 
virtual void SetVisible (const bool visible)=0
 Makes the entity visible or invisible. More...
 
virtual bool IsVisible () const =0
 Checks if the entity is visible or invisible. More...
 
void SetState (const State state)
 Sets the entity's state. More...
 
State GetState () const
 Retrieves the entity's state. More...
 
void SetMoveAutoSpeed (const float speed)
 Sets the entity's automatic movement speed. More...
 
float GetMoveAutoSpeed () const
 Retrieves the entity's automatic movement speed. More...
 
void SetMoveWalkSpeed (const float speed)
 Sets the entity's walking movement speed. More...
 
float GetMoveWalkSpeed () const
 Retrieves the entity's walking speed. More...
 
void SetMoveRunSpeed (const float speed)
 Sets the entity's running movement speed. More...
 
float GetMoveRunSpeed () const
 Retrieves the entity's running speed. More...
 
void SetMovePosition (const Ogre::Vector3 &target)
 Sets the entity's movement destination position. More...
 
const Ogre::Vector3 & GetMovePosition () const
 Retrieves the entity's movement destination position. More...
 
float GetMoveStopDistance () const
 Retrieves the distance to destination. More...
 
void SetMoveTriangleId (const int triangle)
 Sets the destination triangle in the walkmesh. More...
 
int GetMoveTriangleId () const
 Sets the destination triangle in the walkmesh. More...
 
void SetMoveAutoRotation (const bool rotate)
 Enables or disables autorotation while the entity is moving. More...
 
bool GetMoveAutoRotation () const
 Checks if the unit can autorotate while it's moving. More...
 
void SetMoveAutoAnimation (const bool animate)
 Enables or disables autoanimation while the entity is moving. More...
 
bool GetMoveAutoAnimation () const
 Checks if the unit can autoanimate while it's moving. More...
 
const Ogre::String & GetMoveAnimationWalkName () const
 Retrieves the entity's walk animation name. More...
 
const Ogre::String & GetMoveAnimationRunName () const
 Retrieves the entity's run animation name. More...
 
void ScriptMoveToPosition (const float x, const float y)
 Makes the entity move to a point in the map. More...
 
void ScriptMoveToEntity (Entity *entity)
 Makes the unit move towards another in the map. More...
 
int ScriptMoveSync ()
 Waits for entity's movement to end. More...
 
int ScriptJumpSync ()
 Waits for the jump to finish. More...
 
void UnsetMove ()
 Cancels the entity's current movement. More...
 
void ScriptLinearToPosition (const float x, const float y, const float z, const LinearMovement movement, const char *animation, const float orientation, const int dest_triangle)
 Linearly moves the entity. More...
 
int ScriptLinearSync ()
 Adds the unit linear movement to the sync queue. More...
 
void SetLinear (const Ogre::Vector3 &end, const LinearMovement movement, const Ogre::String &animation, const float orientation, const int dest_triangle)
 Linearly moves the entity. More...
 
void UnsetLinear ()
 Cancels the entity's current linear movement. More...
 
LinearMovement GetLinearMovement () const
 Retrieves the entity's current linear movement. More...
 
const Ogre::Vector3 & GetLinearStart () const
 Retrieves the starting point of the current linear movement. More...
 
const Ogre::Vector3 & GetLinearEnd () const
 Retrieves the ending point of the current linear movement. More...
 
const int GetLinearDestTriangle () const
 Retrieves the ending triangle of the current linear movement. More...
 
void ScriptJumpToPosition (const float x, const float y, const float z, const float seconds, const int dest_triangle)
 Makes the unit jump to a point in the field. More...
 
void SetJump (const Ogre::Vector3 &jump_to, const float seconds, const int dest_triangle)
 Makes the unit jump to a point in the field. More...
 
void UnsetJump ()
 Cancels the entity's current jump. More...
 
const Ogre::Vector3 & GetJumpStart () const
 Retrieves the starting point of the current jump. More...
 
const Ogre::Vector3 & GetJumpEnd () const
 Retrieves the ending point of the current jump. More...
 
float GetJumpSeconds () const
 Gets the total duration of the jump. More...
 
void SetJumpCurrentSeconds (const float seconds)
 Sets the current duration of the jump. More...
 
float GetJumpCurrentSeconds () const
 Gets the current duration of the jump. More...
 
const int GetJumpDestTriangle () const
 Retrieves the ending triangle of the current jump. More...
 
void ScriptOffsetToPosition (const float x, const float y, const float z, const ActionType type, const float seconds)
 
int ScriptOffsetSync ()
 
void UnsetOffset ()
 
const Ogre::Vector3 & GetOffsetPositionStart () const
 
const Ogre::Vector3 & GetOffsetPositionEnd () const
 
ActionType GetOffsetType () const
 
float GetOffsetSeconds () const
 
void SetOffsetCurrentSeconds (const float seconds)
 
float GetOffsetCurrentSeconds () const
 
void ScriptTurnToDirection (const float direction, const TurnDirection turn_direction, const ActionType turn_type, const float seconds)
 Makes the entity turn to a fixed direction. More...
 
void ScriptTurnToEntity (Entity *entity, const TurnDirection turn_direction, const float seconds)
 Makes the entity turn towards another entity. More...
 
int ScriptTurnSync ()
 Adds the entity's turn to the sync queue. More...
 
void SetTurn (const Ogre::Degree &direction_to, Entity *entity, const TurnDirection turn_direction, const ActionType turn_type, const float seconds)
 Makes the entity turn towards a point or another entity. More...
 
void UnsetTurn ()
 Cancels the entity's current jump. More...
 
Ogre::Degree CalculateTurnAngle (const Ogre::Degree &start, const Ogre::Degree &end) const
 Calculates the turn angle. More...
 
Ogre::Degree GetTurnDirectionStart () const
 Retrieves the turn staring orientation. More...
 
Ogre::Degree GetTurnDirectionEnd () const
 Retrieves the turn ending orientation. More...
 
ActionType GetTurnType () const
 Retrieves the turn type. More...
 
float GetTurnSeconds () const
 Retrieves the turn total duration. More...
 
void SetTurnCurrentSeconds (const float seconds)
 Sets the turn current duration. More...
 
float GetTurnCurrentSeconds () const
 Retrieves the turn current duration. More...
 
void ScriptSetAnimationSpeed (const float speed)
 Sets the animation speed. More...
 
const Ogre::String & GetDefaultAnimationName () const
 Retrieves the entity's default animation name. More...
 
const Ogre::String & GetCurrentAnimationName () const
 Retrieves the entity's current animation name. More...
 
AnimationState GetAnimationState () const
 Retrieves the entity's current animation state. More...
 
virtual void PlayAnimation (const Ogre::String &animation, AnimationState state, AnimationPlayType play_type, const float start, const float end)=0
 Plays one of the entity's animations. More...
 
virtual void PlayAnimationContinue (const Ogre::String &animation)=0
 Resumes an animation. More...
 
virtual void UpdateAnimation (const float delta)=0
 Updates the animation state. More...
 
void ScriptPlayAnimation (const char *name)
 Plays one of the entity's animations. More...
 
void ScriptPlayAnimationStop (const char *name)
 Stops one of the entity's animations. More...
 
void ScriptPlayAnimation (const char *name, const float start, const float end)
 Plays one of the entity's animations. More...
 
void ScriptPlayAnimationStop (const char *name, const float start, const float end)
 Stops one of the entity's animations. More...
 
void ScriptSetDefaultAnimation (const char *animation)
 Sets the default animation of the entity. More...
 
int ScriptAnimationSync ()
 Adds the entity's animation to the sync queue. More...
 
void SetCharacter (int char_id)
 Assigns the entity as a character. More...
 
bool IsCharacter ()
 Checks if the entity is a character. More...
 
int GetCharacterId ()
 Retrieves the entity's character ID. More...
 
bool IsLine ()
 Checks if the entity is a line. More...
 

Protected Attributes

Ogre::String name_
 The name of the entity. More...
 
Ogre::SceneNode * scene_node_
 The scene node the entity is attached to. More...
 
Ogre::SceneNode * model_node_
 The entity's model. More...
 
Ogre::SceneNode * model_root_node_
 The entity's root node. More...
 
float height_
 The entity's height. More...
 
Ogre::SceneNode * direction_node_
 The entity's direction node. More...
 
EntityDirectiondirection_
 The entity's direction. More...
 
Ogre::SceneNode * solid_collision_node_
 The entity's collision node. More...
 
EntityCollisionsolid_collision_
 The entity's collision. More...
 
float solid_radius_
 The entity's solid radius. More...
 
bool solid_
 Indicates it the entity is solid and can handle collisions. More...
 
Ogre::SceneNode * talk_collision_node_
 The entity's talk collision node. More...
 
EntityCollisiontalk_collision_
 The entity's talk collision. More...
 
float talk_radius_
 The radius at which the entity can be interacted with. More...
 
bool talkable_
 Indicates if the entity can be interacted with. More...
 
State state_
 Entity's movement status. More...
 
std::vector< ScriptIdsync_
 Entity's movement sync queue. More...
 
float move_auto_speed_
 The entity's automatic movement speed. More...
 
float move_walk_speed_
 The entity's walking speed. More...
 
float move_run_speed_
 The entity's running speed. More...
 
Ogre::Vector3 move_position_
 The entity's movement destination point. More...
 
Entitymove_entity_
 The entity's movement destination entity. More...
 
float move_stop_distance_
 Distance between the entity and it's movement destination point. More...
 
int move_triangle_id_
 Entity's movement destination triangle ID. More...
 
bool move_auto_rotation_
 Indicates if the entity can rotate while moving. More...
 
bool move_auto_animation_
 Indicates if the entity can animate while moving. More...
 
Ogre::String move_animation_walk_
 The name of the entity's walk animation. More...
 
Ogre::String move_animation_run_
 The name of the entity's run animation. More...
 
LinearMovement linear_movement_
 The entity's linear movement direction. More...
 
Ogre::Vector3 linear_start_
 The linear movement starting point. More...
 
Ogre::Vector3 linear_end_
 The linear movement ending point. More...
 
int linear_dest_triangle_
 Triangle to set the entity on after a linear movement. More...
 
Ogre::Vector3 jump_start_
 The jump starting point. More...
 
Ogre::Vector3 jump_end_
 The jump ending point. More...
 
float jump_seconds_
 Total jump duration. More...
 
float jump_current_seconds_
 Current jump duration. More...
 
bool jump_was_solid_
 Used to store solidity status before a jump. More...
 
int jump_dest_triangle_
 Triangle to set the entity on after a jump. More...
 
Ogre::Vector3 offset_position_start_
 
Ogre::Vector3 offset_position_end_
 
ActionType offset_type_
 
float offset_seconds_
 
float offset_current_seconds_
 
std::vector< ScriptIdoffset_sync_
 
TurnDirection turn_direction_
 Turn movement direction. More...
 
Ogre::Degree turn_direction_start_
 Turn initial orientation. More...
 
Ogre::Degree turn_direction_end_
 Turn final orientation. More...
 
Entityturn_entity_
 The turn destination entity. More...
 
ActionType turn_type_
 The turn type. More...
 
float turn_seconds_
 Total turn duration. More...
 
float turn_current_seconds_
 Current turn duration. More...
 
std::vector< ScriptIdturn_sync_
 Entity's turning sync queue. More...
 
float animation_speed_
 The animation speed. More...
 
Ogre::String animation_current_name_
 The entity's current animation name. More...
 
std::vector< ScriptIdanimation_sync_
 Entity's animation sync queue. More...
 
AnimationState animation_state_
 The entity's current animation state. More...
 
AnimationPlayType animation_play_type_
 The entity's current animation type. More...
 
Ogre::String animation_default_
 The name of the entity's default name. More...
 
float animation_end_time_
 
bool animation_auto_play_
 Indicates if an automation must be played automatically. More...
 

Private Member Functions

 Entity ()
 Constructor. More...
 
Ogre::Degree GetDirectionToEntity (Entity *entity) const
 Calculates the angular distance to an entity. More...
 

Private Attributes

bool is_character_
 Indicates if the entity is a playable character. More...
 
int character_id_
 The ID of the playable character the entity is, if any. More...
 
int index_
 Index of the entity on the field. More...
 
bool is_line_
 Indicates if the entity is a line. More...
 

Detailed Description

Any entity in a field.

Member Enumeration Documentation

◆ AnimationPlayType

Types of animations.

Enumerator
PLAY_DEFAULT 

Default animation mode.

Todo:
Same as PLAY_ONCE?
PLAY_ONCE 

Play the animation once, then stop.

PLAY_LOOPED 

Play an animation in a continous loop.

◆ AnimationState

Entity animation states.

Enumerator
REQUESTED_ANIMATION 

An animation has been requested.

AUTO_ANIMATION 

An animation is set to play automatically.

◆ State

Entity state.

Enumerator
NONE 

No state.

The entity has not been placed or it has been removed.

WALKMESH 

The entity is attached to the walkmesh.

LINEAR 

The entity is in the middle of a linear movement.

JUMP 

The entity is in the middle of a jump.

NEEDS_TO_REATTACH 

The entity has completed an action and needs to be reattached to the walkmesh before continuing execution.

Constructor & Destructor Documentation

◆ Entity() [1/2]

Entity::Entity ( const Ogre::String &  name,
Ogre::SceneNode *  node 
)

Constructor.

Parameters
[in]nameEntity name.
[in]nodeScene node to which the entity should be attached.

◆ ~Entity()

Entity::~Entity ( )
virtual

Destructor.

◆ Entity() [2/2]

Entity::Entity ( )
private

Constructor.

Member Function Documentation

◆ CalculateTurnAngle()

Ogre::Degree Entity::CalculateTurnAngle ( const Ogre::Degree &  start,
const Ogre::Degree &  end 
) const

Calculates the turn angle.

If the turn direction is {

See also
TD_CLOSEST}, the result is the smallest angle between the two orientations. Otherwise, is the angle in the specified turn direction.
Parameters
[in]startStarting angle.
[in]endEnding angle.
Returns
[in] Calculated turn angle.

◆ GetAnimationState()

Entity::AnimationState Entity::GetAnimationState ( ) const

Retrieves the entity's current animation state.

Returns
The current animation state.

◆ GetCharacterId()

int Entity::GetCharacterId ( )

Retrieves the entity's character ID.

Returns
The character ID, or a negative value if the entity is not a character.

◆ GetCurrentAnimationName()

const Ogre::String & Entity::GetCurrentAnimationName ( ) const

Retrieves the entity's current animation name.

Returns
The current animation name.

◆ GetDefaultAnimationName()

const Ogre::String & Entity::GetDefaultAnimationName ( ) const

Retrieves the entity's default animation name.

Returns
The default animation name.

◆ GetDirectionToEntity()

Ogre::Degree Entity::GetDirectionToEntity ( Entity entity) const
private

Calculates the angular distance to an entity.

Parameters
[in]entityEntity to calculate the angular distance to.
Returns
Angular distance to the specified entity.

◆ GetHeight()

float Entity::GetHeight ( ) const

Retrieves the entity's height.

Returns
The entity's height.

◆ GetIndex()

int Entity::GetIndex ( )

Retrieves the entity index in the field.

Returns
Index of the entity.

◆ GetJumpCurrentSeconds()

float Entity::GetJumpCurrentSeconds ( ) const

Gets the current duration of the jump.

Returns
Jump current duration, in seconds.

◆ GetJumpDestTriangle()

const int Entity::GetJumpDestTriangle ( ) const

Retrieves the ending triangle of the current jump.

Returns
Ending triangle.

◆ GetJumpEnd()

const Ogre::Vector3 & Entity::GetJumpEnd ( ) const

Retrieves the ending point of the current jump.

Returns
Ending point.

◆ GetJumpSeconds()

float Entity::GetJumpSeconds ( ) const

Gets the total duration of the jump.

Returns
Jump total duration, in seconds.

◆ GetJumpStart()

const Ogre::Vector3 & Entity::GetJumpStart ( ) const

Retrieves the starting point of the current jump.

Returns
Starting point.

◆ GetLinearDestTriangle()

const int Entity::GetLinearDestTriangle ( ) const

Retrieves the ending triangle of the current linear movement.

Returns
Ending triangle.

◆ GetLinearEnd()

const Ogre::Vector3 & Entity::GetLinearEnd ( ) const

Retrieves the ending point of the current linear movement.

Returns
Ending point.

◆ GetLinearMovement()

LinearMovement Entity::GetLinearMovement ( ) const

Retrieves the entity's current linear movement.

Returns
Current linear movement.

◆ GetLinearStart()

const Ogre::Vector3 & Entity::GetLinearStart ( ) const

Retrieves the starting point of the current linear movement.

Returns
Starting point.

◆ GetMoveAnimationRunName()

const Ogre::String & Entity::GetMoveAnimationRunName ( ) const

Retrieves the entity's run animation name.

Returns
The run animation name.

◆ GetMoveAnimationWalkName()

const Ogre::String & Entity::GetMoveAnimationWalkName ( ) const

Retrieves the entity's walk animation name.

Returns
The walk animation name.

◆ GetMoveAutoAnimation()

bool Entity::GetMoveAutoAnimation ( ) const

Checks if the unit can autoanimate while it's moving.

Returns
If true, the entity will animate automatically while moving. If false, the entity will not animate.

◆ GetMoveAutoRotation()

bool Entity::GetMoveAutoRotation ( ) const

Checks if the unit can autorotate while it's moving.

Returns
If true, the entity will rotate automatically while moving. If false, the entity will not rotate.

◆ GetMoveAutoSpeed()

float Entity::GetMoveAutoSpeed ( ) const

Retrieves the entity's automatic movement speed.

Returns
Automatic movement speed.
Todo:
Describe where this speed is used, and max and mins or references.

◆ GetMovePosition()

const Ogre::Vector3 & Entity::GetMovePosition ( ) const

Retrieves the entity's movement destination position.

Returns
The destination position.

◆ GetMoveRunSpeed()

float Entity::GetMoveRunSpeed ( ) const

Retrieves the entity's running speed.

Returns
Running speed.
Todo:
Describe where this speed is used, and max and mins or references.

◆ GetMoveStopDistance()

float Entity::GetMoveStopDistance ( ) const

Retrieves the distance to destination.

It's the distance between the entity's current position and it's current movement destination point.

Returns
The distance to destination.
Todo:
Verify this description. Also, indicate units (pixels?).

◆ GetMoveTriangleId()

int Entity::GetMoveTriangleId ( ) const

Sets the destination triangle in the walkmesh.

Returns
Destination triangle in the walkmesh.

◆ GetMoveWalkSpeed()

float Entity::GetMoveWalkSpeed ( ) const

Retrieves the entity's walking speed.

Returns
Walking speed.
Todo:
Describe where this speed is used, and max and mins or references.

◆ GetName()

const Ogre::String & Entity::GetName ( ) const

Retrieves the entity name.

Returns
The entity name.

◆ GetOffset()

const Ogre::Vector3 Entity::GetOffset ( ) const

Retrieves the entity position.

Returns
The entity position.
Todo:
Offset to what?

◆ GetOffsetCurrentSeconds()

float Entity::GetOffsetCurrentSeconds ( ) const
Todo:
Understand and document.
Returns
Action current duration in seconds.

◆ GetOffsetPositionEnd()

const Ogre::Vector3 & Entity::GetOffsetPositionEnd ( ) const
Todo:
Understand and document.
Returns
Ending position.

◆ GetOffsetPositionStart()

const Ogre::Vector3 & Entity::GetOffsetPositionStart ( ) const
Todo:
Understand and document.
Returns
Starting position.

◆ GetOffsetSeconds()

float Entity::GetOffsetSeconds ( ) const
Todo:
Understand and document.
Returns
Action total duration in seconds.

◆ GetOffsetType()

ActionType Entity::GetOffsetType ( ) const
Todo:
Understand and document.
Returns
The action type.

◆ GetPosition()

const Ogre::Vector3 Entity::GetPosition ( ) const

Retrieves the entity position.

Returns
The entity position.

◆ GetRotation()

Ogre::Degree Entity::GetRotation ( ) const

Retrieves the entity rotation.

Returns
The entity rotation, in degrees.

◆ GetSolidRadius()

float Entity::GetSolidRadius ( ) const

Retrieves the entity's solid radius.

The solid radius is used to detect collisions.

Returns
The solid radius.
Todo:
Is it in pixels?

◆ GetState()

Entity::State Entity::GetState ( ) const

Retrieves the entity's state.

Returns
The entity's state.

◆ GetTalkRadius()

float Entity::GetTalkRadius ( ) const

Retrieves the entity talk radius.

The talk radius is the maximum distance at which an entity can be talked to or interacted with.

Returns
The talk radius.
Todo:
Is it in pixels?

◆ GetTurnCurrentSeconds()

float Entity::GetTurnCurrentSeconds ( ) const

Retrieves the turn current duration.

Returns
The turn current duration, in seconds.

◆ GetTurnDirectionEnd()

Ogre::Degree Entity::GetTurnDirectionEnd ( ) const

Retrieves the turn ending orientation.

Returns
The turn ending orientation.

◆ GetTurnDirectionStart()

Ogre::Degree Entity::GetTurnDirectionStart ( ) const

Retrieves the turn staring orientation.

Returns
The turn starting orientation.

◆ GetTurnSeconds()

float Entity::GetTurnSeconds ( ) const

Retrieves the turn total duration.

Returns
The turn total duration, in seconds.

◆ GetTurnType()

ActionType Entity::GetTurnType ( ) const

Retrieves the turn type.

Returns
The turn type.

◆ IsCharacter()

bool Entity::IsCharacter ( )

Checks if the entity is a character.

An entity is not a character until {

See also
SetCharacter} has been called.
Returns
True if the entity is a character, false otherwise.

◆ IsLine()

bool Entity::IsLine ( )

Checks if the entity is a line.

Returns
True if the entity is a line, false otherwise.

◆ IsSolid()

bool Entity::IsSolid ( ) const

Checks if the entity is solid.

Solid entities can produce collisions.

Returns
True if the entity is solid, false otherwise.

◆ IsTalkable()

bool Entity::IsTalkable ( ) const

Checks if an entity is talkable or non-talkable.

Talkable units can be talked to or interacted with.

Returns
True if the entity is talkable, false if it's not.

◆ IsVisible()

virtual bool Entity::IsVisible ( ) const
pure virtual

Checks if the entity is visible or invisible.

Invisible entities can't be interacted with.

Returns
True if the unit is visible, false if it's invisible.

Implemented in EntityModel.

◆ PlayAnimation()

virtual void Entity::PlayAnimation ( const Ogre::String &  animation,
AnimationState  state,
AnimationPlayType  play_type,
const float  start,
const float  end 
)
pure virtual

Plays one of the entity's animations.

Parameters
[in]animationName of the animation to play.
[in]stateThe animation initial state.
[in]play_typeThe animation play type, to play it once or in a loop.
[in]startAnimation starting point in time, in seconds.
[in]endAnimation ending point in time, in seconds.

Implemented in EntityModel.

◆ PlayAnimationContinue()

virtual void Entity::PlayAnimationContinue ( const Ogre::String &  animation)
pure virtual

Resumes an animation.

Parameters
[in]animationName of the animation to resume.

Implemented in EntityModel.

◆ ScriptAnimationSync()

int Entity::ScriptAnimationSync ( )

Adds the entity's animation to the sync queue.

Returns
Always -1.
Todo:
Properly describe this.

◆ ScriptGetPosition()

void Entity::ScriptGetPosition ( ) const

Retrieves the entity position.

To be used from Lua scripts only. It doesn't return anything, but adds three values to the stack for the X, Y and Z coordinates.

◆ ScriptGetRotation()

float Entity::ScriptGetRotation ( ) const

Retrieves the entity rotation.

Returns
The entity rotation (0-360).

◆ ScriptJumpSync()

int Entity::ScriptJumpSync ( )

Waits for the jump to finish.

Returns
Always -1.

◆ ScriptJumpToPosition()

void Entity::ScriptJumpToPosition ( const float  x,
const float  y,
const float  z,
const float  seconds,
const int  dest_triangle 
)

Makes the unit jump to a point in the field.

Parameters
[in]xX coordinate of the jump destination point.
[in]yY coordinate of the jump destination point.
[in]zMaximum height of the jump.
[in]secondsJump duration.
[in]dest_triangleTriangle to place the entity after the jump.

◆ ScriptLinearSync()

int Entity::ScriptLinearSync ( )

Adds the unit linear movement to the sync queue.

Returns
Always -1.
Todo:
Properly describe this.

◆ ScriptLinearToPosition()

void Entity::ScriptLinearToPosition ( const float  x,
const float  y,
const float  z,
const LinearMovement  movement,
const char *  animation,
const float  orientation,
const int  dest_triangle 
)

Linearly moves the entity.

Parameters
[in]xX coordinate of the destination point.
[in]yY coordinate of the destination point.
[in]zZ coordinate of the destination point.
[in]movementMovement direction.
[in]animationMovement animation.
[in]orientationOrientation during the animation.
[in]dest_triangleTriangle to place the entity after the linear movement.

◆ ScriptMoveSync()

int Entity::ScriptMoveSync ( )

Waits for entity's movement to end.

Returns
Always -1.

◆ ScriptMoveToEntity()

void Entity::ScriptMoveToEntity ( Entity entity)

Makes the unit move towards another in the map.

Parameters
[in]entityentity to move towards.

◆ ScriptMoveToPosition()

void Entity::ScriptMoveToPosition ( const float  x,
const float  y 
)

Makes the entity move to a point in the map.

Parameters
[in]xX coordinate of the destination point.
[in]yY coordinate of the destination point.

◆ ScriptOffsetSync()

int Entity::ScriptOffsetSync ( )
Todo:
Understand and document.
Returns
Always -1.

◆ ScriptOffsetToPosition()

void Entity::ScriptOffsetToPosition ( const float  x,
const float  y,
const float  z,
const ActionType  type,
const float  seconds 
)
Todo:
Understand and document.
Parameters
[in]xX coordinate of the destination point.
[in]yY coordinate of the destination point.
[in]zZ coordinate of the destination point.
[in]typeType of action.
[in]secondsDuration of the action, in seconds.

◆ ScriptPlayAnimation() [1/2]

void Entity::ScriptPlayAnimation ( const char *  name)

Plays one of the entity's animations.

Parameters
[in]nameName of the animation to play.

◆ ScriptPlayAnimation() [2/2]

void Entity::ScriptPlayAnimation ( const char *  name,
const float  start,
const float  end 
)

Plays one of the entity's animations.

Parameters
[in]nameName of the animation to play.
[in]startAnimation starting point in time, in seconds.
[in]endAnimation ending point in time, in seconds.

◆ ScriptPlayAnimationStop() [1/2]

void Entity::ScriptPlayAnimationStop ( const char *  name)

Stops one of the entity's animations.

Parameters
[in]nameName of the animation to stop.

◆ ScriptPlayAnimationStop() [2/2]

void Entity::ScriptPlayAnimationStop ( const char *  name,
const float  start,
const float  end 
)

Stops one of the entity's animations.

Parameters
[in]nameName of the animation to stop.
[in]startAnimation starting point in time, in seconds.
[in]endAnimation ending point in time, in seconds.

◆ ScriptSetAnimationSpeed()

void Entity::ScriptSetAnimationSpeed ( const float  speed)

Sets the animation speed.

Parameters
[in]speedThe animation speed.
Todo:
Indicate units, max and mins, or references.

◆ ScriptSetDefaultAnimation()

void Entity::ScriptSetDefaultAnimation ( const char *  animation)

Sets the default animation of the entity.

Parameters
[in]animationName of the default animation.

◆ ScriptSetPosition()

void Entity::ScriptSetPosition ( const float  x,
const float  y,
const float  z 
)

Sets the entity position.

It also resets the walkmesh triangle to reattach entity to walkmesh again if needed.

Parameters
[in]xEntity's new position X coordinate.
[in]yEntity's new position Y coordinate.
[in]zEntity's new position Z coordinate.

◆ ScriptSetRotation()

void Entity::ScriptSetRotation ( const float  rotation)

Sets the entity rotation.

Parameters
[in]rotationThe entity rotation (0-360).

◆ ScriptTurnSync()

int Entity::ScriptTurnSync ( )

Adds the entity's turn to the sync queue.

Returns
Always -1.
Todo:
Properly describe this.

◆ ScriptTurnToDirection()

void Entity::ScriptTurnToDirection ( const float  direction,
const TurnDirection  turn_direction,
const ActionType  turn_type,
const float  seconds 
)

Makes the entity turn to a fixed direction.

Parameters
[in]directionFinal direction to turn the entity's to.
[in]turn_directionDirection of the turn.
[in]turn_typeTurn mode.
[in]secondsTotal turn duration, in seconds.

◆ ScriptTurnToEntity()

void Entity::ScriptTurnToEntity ( Entity entity,
const TurnDirection  turn_direction,
const float  seconds 
)

Makes the entity turn towards another entity.

Parameters
[in]entityEntity to turn to.
[in]turn_directionDirection of the turn.
[in]secondsTotal turn duration, in seconds.

◆ SetCharacter()

void Entity::SetCharacter ( int  char_id)

Assigns the entity as a character.

Marks the entity as a character, and assigns a character name and ID. If the ID is passed as a negative number, the entity will no longer be considered a character.

Parameters
[in]char_idThe character name.

◆ SetIndex()

void Entity::SetIndex ( const int  index)

Sets the entity index in the field.

Parameters
[in]indexIndex of the entity.

◆ SetJump()

void Entity::SetJump ( const Ogre::Vector3 &  jump_to,
const float  seconds,
const int  dest_triangle 
)

Makes the unit jump to a point in the field.

Parameters
[in]jump_toThe jump destination point.
[in]secondsJump duration.
[in]dest_triangleTriangle to place the entity after the jump.

◆ SetJumpCurrentSeconds()

void Entity::SetJumpCurrentSeconds ( const float  seconds)

Sets the current duration of the jump.

Parameters
[in]secondsJump current duration, in seconds.

◆ SetLinear()

void Entity::SetLinear ( const Ogre::Vector3 &  end,
const LinearMovement  movement,
const Ogre::String &  animation,
const float  orientation,
const int  dest_triangle 
)

Linearly moves the entity.

Parameters
[in]endDestination point.
[in]movementMovement direction.
[in]animationMovement animation.
[in]orientationOrientation during the animation.
[in]dest_triangleTriangle to place the entity after the linear movement.

◆ SetMoveAutoAnimation()

void Entity::SetMoveAutoAnimation ( const bool  animate)

Enables or disables autoanimation while the entity is moving.

Parameters
[in]animateIf true, the entity will animate automatically while moving. If false, the entity will not animate.

◆ SetMoveAutoRotation()

void Entity::SetMoveAutoRotation ( const bool  rotate)

Enables or disables autorotation while the entity is moving.

Parameters
[in]rotateIf true, the entity will rotate automatically while moving. If false, the entity will not rotate.

◆ SetMoveAutoSpeed()

void Entity::SetMoveAutoSpeed ( const float  speed)

Sets the entity's automatic movement speed.

Parameters
[in]speedAutomatic movement speed.
Todo:
Describe where this speed is used, and max and mins or references.

◆ SetMovePosition()

void Entity::SetMovePosition ( const Ogre::Vector3 &  target)

Sets the entity's movement destination position.

Parameters
[in]targetThe destination position.

◆ SetMoveRunSpeed()

void Entity::SetMoveRunSpeed ( const float  speed)

Sets the entity's running movement speed.

Parameters
[in]speedRunning speed.
Todo:
Describe where this speed is used, and max and mins or references.

◆ SetMoveTriangleId()

void Entity::SetMoveTriangleId ( const int  triangle)

Sets the destination triangle in the walkmesh.

Sets the units destination to one of the walkmesh triangles. The movement will stop once the unit enters the triangle.

Parameters
[in]triangleDestination triangle in the walkmesh.

◆ SetMoveWalkSpeed()

void Entity::SetMoveWalkSpeed ( const float  speed)

Sets the entity's walking movement speed.

Parameters
[in]speedWalking speed.
Todo:
Describe where this speed is used, and max and mins or references.

◆ SetOffset()

void Entity::SetOffset ( const Ogre::Vector3 &  position)

Sets the entity position.

Parameters
[in]positionThe entity new position.
Todo:
Offset to what?

◆ SetOffsetCurrentSeconds()

void Entity::SetOffsetCurrentSeconds ( const float  seconds)
Todo:
Understand and document.
Parameters
[in]secondsAction current duration in seconds.

◆ SetPosition()

void Entity::SetPosition ( const Ogre::Vector3 &  position)

Sets the entity position.

Parameters
[in]positionEntity's new position.

◆ setRootOrientation()

void Entity::setRootOrientation ( const Ogre::Quaternion &  root_orientation)
virtual

Sets the entity's absolute orientation.

Parameters
[in]root_orientationThe entity's new orientation.

◆ SetRotation()

void Entity::SetRotation ( const Ogre::Degree &  rotation)

Sets the entity rotation.

Parameters
[in]rotationThe entity rotation, in degrees.

◆ setScale()

void Entity::setScale ( const Ogre::Vector3 &  scale)
virtual

Sets the entity scale.

Parameters
[in]scaleThree dimensional scale.

◆ SetSolid()

void Entity::SetSolid ( const bool  solid)

Makes the entity solid or non-solid.

Solid entities can produce collisions.

Parameters
[in]solidTrue to make the entity solid, false otherwise.

◆ SetSolidRadius()

void Entity::SetSolidRadius ( const float  radius)

Sets the entity's solid radius.

The solid radius is used to detect collisions.

Parameters
[in]radiusThe solid radius.
Todo:
Is it in pixels?

◆ SetState()

void Entity::SetState ( const State  state)

Sets the entity's state.

Parameters
[in]stateThe entity's state.

◆ SetTalkable()

void Entity::SetTalkable ( const bool  talkable)

Sets an entity as talkable or non-talkable.

Talkable units can be talked to or interacted with.

Parameters
[in]talkableTrue to make the entity talkable, false to make it non-talkable.

◆ SetTalkRadius()

void Entity::SetTalkRadius ( const float  radius)

Sets the entity talk radius.

The talk radius is the maximum distance at which an entity can be talked to or interacted with.

Parameters
[in]radiusThe talk radius.
Todo:
Is it in pixels?

◆ SetTurn()

void Entity::SetTurn ( const Ogre::Degree &  direction_to,
Entity entity,
const TurnDirection  turn_direction,
const ActionType  turn_type,
const float  seconds 
)

Makes the entity turn towards a point or another entity.

Parameters
[in]direction_toFinal direction to turn the entity's to.
[in]entityEntity to turn to.
[in]turn_directionDirection of the turn.
[in]turn_typeTurn mode.
[in]secondsTotal turn duration, in seconds.
Todo:
What if the point

◆ SetTurnCurrentSeconds()

void Entity::SetTurnCurrentSeconds ( const float  seconds)

Sets the turn current duration.

Parameters
[in]secondsThe turn current duration, in seconds.

◆ SetVisible()

virtual void Entity::SetVisible ( const bool  visible)
pure virtual

Makes the entity visible or invisible.

Invisible entities can't be interacted with.

Parameters
[in]visibleTrue to make the unit visible, false to make it invisible.

Implemented in EntityModel.

◆ UnsetJump()

void Entity::UnsetJump ( )

Cancels the entity's current jump.

It also clears the movement sync queue.

◆ UnsetLinear()

void Entity::UnsetLinear ( )

Cancels the entity's current linear movement.

It also clears the movement sync queue.

◆ UnsetMove()

void Entity::UnsetMove ( )

Cancels the entity's current movement.

It also clears the movement sync queue.

◆ UnsetOffset()

void Entity::UnsetOffset ( )
Todo:
Understand and document.

◆ UnsetTurn()

void Entity::UnsetTurn ( )

Cancels the entity's current jump.

It also clears the movement sync queue.

◆ Update()

void Entity::Update ( )
virtual

Updates the entity status.

Reimplemented in EntityModel.

◆ UpdateAnimation()

virtual void Entity::UpdateAnimation ( const float  delta)
pure virtual

Updates the animation state.

Parameters
[in]deltaThe animation delta.

Implemented in EntityModel.

◆ UpdateDebug()

void Entity::UpdateDebug ( )
virtual

Updates the entity status with debug information.

Member Data Documentation

◆ animation_auto_play_

bool Entity::animation_auto_play_
protected

Indicates if an automation must be played automatically.

◆ animation_current_name_

Ogre::String Entity::animation_current_name_
protected

The entity's current animation name.

◆ animation_default_

Ogre::String Entity::animation_default_
protected

The name of the entity's default name.

◆ animation_end_time_

float Entity::animation_end_time_
protected
Todo:
Understand and document.

◆ animation_play_type_

AnimationPlayType Entity::animation_play_type_
protected

The entity's current animation type.

◆ animation_speed_

float Entity::animation_speed_
protected

The animation speed.

◆ animation_state_

AnimationState Entity::animation_state_
protected

The entity's current animation state.

◆ animation_sync_

std::vector<ScriptId> Entity::animation_sync_
protected

Entity's animation sync queue.

◆ character_id_

int Entity::character_id_
private

The ID of the playable character the entity is, if any.

◆ direction_

EntityDirection* Entity::direction_
protected

The entity's direction.

◆ direction_node_

Ogre::SceneNode* Entity::direction_node_
protected

The entity's direction node.

◆ height_

float Entity::height_
protected

The entity's height.

◆ index_

int Entity::index_
private

Index of the entity on the field.

◆ is_character_

bool Entity::is_character_
private

Indicates if the entity is a playable character.

◆ is_line_

bool Entity::is_line_
private

Indicates if the entity is a line.

◆ jump_current_seconds_

float Entity::jump_current_seconds_
protected

Current jump duration.

◆ jump_dest_triangle_

int Entity::jump_dest_triangle_
protected

Triangle to set the entity on after a jump.

◆ jump_end_

Ogre::Vector3 Entity::jump_end_
protected

The jump ending point.

◆ jump_seconds_

float Entity::jump_seconds_
protected

Total jump duration.

◆ jump_start_

Ogre::Vector3 Entity::jump_start_
protected

The jump starting point.

◆ jump_was_solid_

bool Entity::jump_was_solid_
protected

Used to store solidity status before a jump.

◆ linear_dest_triangle_

int Entity::linear_dest_triangle_
protected

Triangle to set the entity on after a linear movement.

◆ linear_end_

Ogre::Vector3 Entity::linear_end_
protected

The linear movement ending point.

◆ linear_movement_

LinearMovement Entity::linear_movement_
protected

The entity's linear movement direction.

◆ linear_start_

Ogre::Vector3 Entity::linear_start_
protected

The linear movement starting point.

◆ model_node_

Ogre::SceneNode* Entity::model_node_
protected

The entity's model.

◆ model_root_node_

Ogre::SceneNode* Entity::model_root_node_
protected

The entity's root node.

◆ move_animation_run_

Ogre::String Entity::move_animation_run_
protected

The name of the entity's run animation.

◆ move_animation_walk_

Ogre::String Entity::move_animation_walk_
protected

The name of the entity's walk animation.

◆ move_auto_animation_

bool Entity::move_auto_animation_
protected

Indicates if the entity can animate while moving.

◆ move_auto_rotation_

bool Entity::move_auto_rotation_
protected

Indicates if the entity can rotate while moving.

◆ move_auto_speed_

float Entity::move_auto_speed_
protected

The entity's automatic movement speed.

◆ move_entity_

Entity* Entity::move_entity_
protected

The entity's movement destination entity.

◆ move_position_

Ogre::Vector3 Entity::move_position_
protected

The entity's movement destination point.

◆ move_run_speed_

float Entity::move_run_speed_
protected

The entity's running speed.

◆ move_stop_distance_

float Entity::move_stop_distance_
protected

Distance between the entity and it's movement destination point.

◆ move_triangle_id_

int Entity::move_triangle_id_
protected

Entity's movement destination triangle ID.

◆ move_walk_speed_

float Entity::move_walk_speed_
protected

The entity's walking speed.

◆ name_

Ogre::String Entity::name_
protected

The name of the entity.

◆ offset_current_seconds_

float Entity::offset_current_seconds_
protected
Todo:
Understand and document.

◆ offset_position_end_

Ogre::Vector3 Entity::offset_position_end_
protected
Todo:
Understand and document.

◆ offset_position_start_

Ogre::Vector3 Entity::offset_position_start_
protected
Todo:
Understand and document.

◆ offset_seconds_

float Entity::offset_seconds_
protected
Todo:
Understand and document.

◆ offset_sync_

std::vector<ScriptId> Entity::offset_sync_
protected
Todo:
Understand and document.

◆ offset_type_

ActionType Entity::offset_type_
protected
Todo:
Understand and document.

◆ scene_node_

Ogre::SceneNode* Entity::scene_node_
protected

The scene node the entity is attached to.

◆ solid_

bool Entity::solid_
protected

Indicates it the entity is solid and can handle collisions.

◆ solid_collision_

EntityCollision* Entity::solid_collision_
protected

The entity's collision.

◆ solid_collision_node_

Ogre::SceneNode* Entity::solid_collision_node_
protected

The entity's collision node.

◆ solid_radius_

float Entity::solid_radius_
protected

The entity's solid radius.

◆ state_

State Entity::state_
protected

Entity's movement status.

◆ sync_

std::vector<ScriptId> Entity::sync_
protected

Entity's movement sync queue.

◆ talk_collision_

EntityCollision* Entity::talk_collision_
protected

The entity's talk collision.

◆ talk_collision_node_

Ogre::SceneNode* Entity::talk_collision_node_
protected

The entity's talk collision node.

◆ talk_radius_

float Entity::talk_radius_
protected

The radius at which the entity can be interacted with.

◆ talkable_

bool Entity::talkable_
protected

Indicates if the entity can be interacted with.

◆ turn_current_seconds_

float Entity::turn_current_seconds_
protected

Current turn duration.

◆ turn_direction_

TurnDirection Entity::turn_direction_
protected

Turn movement direction.

◆ turn_direction_end_

Ogre::Degree Entity::turn_direction_end_
protected

Turn final orientation.

◆ turn_direction_start_

Ogre::Degree Entity::turn_direction_start_
protected

Turn initial orientation.

◆ turn_entity_

Entity* Entity::turn_entity_
protected

The turn destination entity.

◆ turn_seconds_

float Entity::turn_seconds_
protected

Total turn duration.

◆ turn_sync_

std::vector<ScriptId> Entity::turn_sync_
protected

Entity's turning sync queue.

◆ turn_type_

ActionType Entity::turn_type_
protected

The turn type.


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