18#include <OgreString.h>
291 virtual void setScale(
const Ogre::Vector3 &scale);
313 const Ogre::Quaternion &root_orientation
626 const float x,
const float y,
const float z,
const LinearMovement movement,
627 const char* animation,
const float orientation,
const int dest_triangle
650 const Ogre::String& animation,
const float orientation,
const int dest_triangle
699 const float x,
const float y,
const float z,
const float seconds,
const int dest_triangle
710 void SetJump(
const Ogre::Vector3& jump_to,
const float seconds,
const int dest_triangle);
771 const float x,
const float y,
const float z,
839 const ActionType turn_type,
const float seconds
874 const ActionType turn_type,
const float seconds
895 Ogre::Degree
CalculateTurnAngle(
const Ogre::Degree& start,
const Ogre::Degree& end)
const;
float * position
Used to keep track of the skeleton and it's bones positions.
Definition: DrawSkeleton.cpp:33
ActionType
Action types.
Definition: Entity.h:26
@ AT_SMOOTH
Smooth action.
Definition: Entity.h:46
@ AT_LINEAR
Linear action.
Definition: Entity.h:38
@ AT_NONE
No action.
Definition: Entity.h:31
TurnDirection
The direction for an entity turn.
Definition: Entity.h:52
@ TD_CLOSEST
Choose direction automatically.
Definition: Entity.h:69
@ TD_CLOCKWISE
Turn clockwise.
Definition: Entity.h:57
@ TD_ANTICLOCKWISE
Turn anticlockwise.
Definition: Entity.h:62
LinearMovement
Linear movement modes.
Definition: Entity.h:75
@ LM_UP_TO_DOWN
Move down.
Definition: Entity.h:80
@ LM_RIGHT_TO_LEFT
Move left.
Definition: Entity.h:95
@ LM_LEFT_TO_RIGHT
Move right.
Definition: Entity.h:90
@ LM_DOWN_TO_UP
Move up.
Definition: Entity.h:85
An entity collision.
Definition: EntityCollision.h:24
An entity direction.
Definition: EntityDirection.h:24
Any entity in a field.
Definition: Entity.h:101
Ogre::Degree turn_direction_end_
Turn final orientation.
Definition: Entity.h:1312
float solid_radius_
The entity's solid radius.
Definition: Entity.h:1127
const Ogre::Vector3 & GetLinearEnd() const
Retrieves the ending point of the current linear movement.
Definition: Entity.cpp:433
int linear_dest_triangle_
Triangle to set the entity on after a linear movement.
Definition: Entity.h:1237
const Ogre::Vector3 & GetMovePosition() const
Retrieves the entity's movement destination position.
Definition: Entity.cpp:323
TurnDirection turn_direction_
Turn movement direction.
Definition: Entity.h:1302
void SetMovePosition(const Ogre::Vector3 &target)
Sets the entity's movement destination position.
Definition: Entity.cpp:321
bool IsLine()
Checks if the entity is a line.
Definition: Entity.cpp:683
void SetTurnCurrentSeconds(const float seconds)
Sets the turn current duration.
Definition: Entity.cpp:629
void ScriptGetPosition() const
Retrieves the entity position.
Definition: Entity.cpp:218
void ScriptPlayAnimationStop(const char *name)
Stops one of the entity's animations.
Definition: Entity.cpp:645
float move_stop_distance_
Distance between the entity and it's movement destination point.
Definition: Entity.h:1192
float GetOffsetCurrentSeconds() const
Definition: Entity.cpp:541
Ogre::String animation_default_
The name of the entity's default name.
Definition: Entity.h:1367
float GetTalkRadius() const
Retrieves the entity talk radius.
Definition: Entity.cpp:299
float talk_radius_
The radius at which the entity can be interacted with.
Definition: Entity.h:1147
const Ogre::Vector3 & GetOffsetPositionEnd() const
Definition: Entity.cpp:533
float turn_seconds_
Total turn duration.
Definition: Entity.h:1327
const Ogre::String & GetMoveAnimationWalkName() const
Retrieves the entity's walk animation name.
Definition: Entity.cpp:339
std::vector< ScriptId > animation_sync_
Entity's animation sync queue.
Definition: Entity.h:1352
float move_run_speed_
The entity's running speed.
Definition: Entity.h:1177
Ogre::SceneNode * direction_node_
The entity's direction node.
Definition: Entity.h:1107
int ScriptTurnSync()
Adds the entity's turn to the sync queue.
Definition: Entity.cpp:564
void UnsetLinear()
Cancels the entity's current linear movement.
Definition: Entity.cpp:419
EntityDirection * direction_
The entity's direction.
Definition: Entity.h:1112
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.
Definition: Entity.cpp:380
int move_triangle_id_
Entity's movement destination triangle ID.
Definition: Entity.h:1197
const Ogre::String & GetCurrentAnimationName() const
Retrieves the entity's current animation name.
Definition: Entity.cpp:637
AnimationPlayType
Types of animations.
Definition: Entity.h:124
@ PLAY_ONCE
Play the animation once, then stop.
Definition: Entity.h:136
@ PLAY_DEFAULT
Default animation mode.
Definition: Entity.h:131
@ PLAY_LOOPED
Play an animation in a continous loop.
Definition: Entity.h:141
AnimationState animation_state_
The entity's current animation state.
Definition: Entity.h:1357
float turn_current_seconds_
Current turn duration.
Definition: Entity.h:1332
float move_walk_speed_
The entity's walking speed.
Definition: Entity.h:1172
float offset_seconds_
Definition: Entity.h:1287
float ScriptGetRotation() const
Retrieves the entity rotation.
Definition: Entity.cpp:262
const Ogre::Vector3 & GetJumpEnd() const
Retrieves the ending point of the current jump.
Definition: Entity.cpp:485
ActionType GetTurnType() const
Retrieves the turn type.
Definition: Entity.cpp:625
Ogre::String move_animation_walk_
The name of the entity's walk animation.
Definition: Entity.h:1212
float animation_end_time_
Definition: Entity.h:1372
State
Entity state.
Definition: Entity.h:147
@ WALKMESH
The entity is attached to the walkmesh.
Definition: Entity.h:159
@ JUMP
The entity is in the middle of a jump.
Definition: Entity.h:169
@ NONE
No state.
Definition: Entity.h:154
@ LINEAR
The entity is in the middle of a linear movement.
Definition: Entity.h:164
@ NEEDS_TO_REATTACH
The entity has completed an action and needs to be reattached to the walkmesh before continuing execu...
Definition: Entity.h:175
ActionType offset_type_
Definition: Entity.h:1282
float move_auto_speed_
The entity's automatic movement speed.
Definition: Entity.h:1167
void SetIndex(const int index)
Sets the entity index in the field.
Definition: Entity.cpp:269
EntityCollision * solid_collision_
The entity's collision.
Definition: Entity.h:1122
State state_
Entity's movement status.
Definition: Entity.h:1157
int ScriptJumpSync()
Waits for the jump to finish.
Definition: Entity.cpp:451
const int GetJumpDestTriangle() const
Retrieves the ending triangle of the current jump.
Definition: Entity.cpp:493
void ScriptPlayAnimation(const char *name)
Plays one of the entity's animations.
Definition: Entity.cpp:641
Ogre::String animation_current_name_
The entity's current animation name.
Definition: Entity.h:1347
float jump_current_seconds_
Current jump duration.
Definition: Entity.h:1257
const Ogre::Vector3 & GetJumpStart() const
Retrieves the starting point of the current jump.
Definition: Entity.cpp:483
void ScriptSetAnimationSpeed(const float speed)
Sets the animation speed.
Definition: Entity.cpp:633
Ogre::SceneNode * model_node_
The entity's model.
Definition: Entity.h:1092
Ogre::Degree GetTurnDirectionEnd() const
Retrieves the turn ending orientation.
Definition: Entity.cpp:623
Ogre::Vector3 offset_position_end_
Definition: Entity.h:1277
Ogre::Degree GetTurnDirectionStart() const
Retrieves the turn staring orientation.
Definition: Entity.cpp:621
void SetSolid(const bool solid)
Makes the entity solid or non-solid.
Definition: Entity.cpp:290
std::vector< ScriptId > turn_sync_
Entity's turning sync queue.
Definition: Entity.h:1337
void ScriptTurnToEntity(Entity *entity, const TurnDirection turn_direction, const float seconds)
Makes the entity turn towards another entity.
Definition: Entity.cpp:554
virtual void setScale(const Ogre::Vector3 &scale)
Sets the entity scale.
Definition: Entity.cpp:264
virtual bool IsVisible() const =0
Checks if the entity is visible or invisible.
float GetMoveAutoSpeed() const
Retrieves the entity's automatic movement speed.
Definition: Entity.cpp:311
Entity * move_entity_
The entity's movement destination entity.
Definition: Entity.h:1187
bool GetMoveAutoAnimation() const
Checks if the unit can autoanimate while it's moving.
Definition: Entity.cpp:337
bool IsTalkable() const
Checks if an entity is talkable or non-talkable.
Definition: Entity.cpp:303
void SetMoveAutoSpeed(const float speed)
Sets the entity's automatic movement speed.
Definition: Entity.cpp:309
Ogre::SceneNode * scene_node_
The scene node the entity is attached to.
Definition: Entity.h:1087
const int GetLinearDestTriangle() const
Retrieves the ending triangle of the current linear movement.
Definition: Entity.cpp:435
int ScriptLinearSync()
Adds the unit linear movement to the sync queue.
Definition: Entity.cpp:392
void SetJumpCurrentSeconds(const float seconds)
Sets the current duration of the jump.
Definition: Entity.cpp:489
void SetJump(const Ogre::Vector3 &jump_to, const float seconds, const int dest_triangle)
Makes the unit jump to a point in the field.
Definition: Entity.cpp:461
std::vector< ScriptId > sync_
Entity's movement sync queue.
Definition: Entity.h:1162
Ogre::Vector3 jump_start_
The jump starting point.
Definition: Entity.h:1242
ActionType turn_type_
The turn type.
Definition: Entity.h:1322
std::vector< ScriptId > offset_sync_
Definition: Entity.h:1297
void UnsetMove()
Cancels the entity's current movement.
Definition: Entity.cpp:372
Ogre::SceneNode * solid_collision_node_
The entity's collision node.
Definition: Entity.h:1117
ActionType GetOffsetType() const
Definition: Entity.cpp:535
virtual void PlayAnimationContinue(const Ogre::String &animation)=0
Resumes an animation.
virtual void Update()
Updates the entity status.
Definition: Entity.cpp:114
void SetTalkRadius(const float radius)
Sets the entity talk radius.
Definition: Entity.cpp:294
Ogre::Degree turn_direction_start_
Turn initial orientation.
Definition: Entity.h:1307
void ScriptTurnToDirection(const float direction, const TurnDirection turn_direction, const ActionType turn_type, const float seconds)
Makes the entity turn to a fixed direction.
Definition: Entity.cpp:543
float height_
The entity's height.
Definition: Entity.h:1102
bool move_auto_animation_
Indicates if the entity can animate while moving.
Definition: Entity.h:1207
int GetIndex()
Retrieves the entity index in the field.
Definition: Entity.cpp:274
Ogre::Vector3 offset_position_start_
Definition: Entity.h:1272
float GetTurnSeconds() const
Retrieves the turn total duration.
Definition: Entity.cpp:627
bool animation_auto_play_
Indicates if an automation must be played automatically.
Definition: Entity.h:1377
float offset_current_seconds_
Definition: Entity.h:1292
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.
Definition: Entity.cpp:437
void UnsetOffset()
Definition: Entity.cpp:524
AnimationState GetAnimationState() const
Retrieves the entity's current animation state.
Definition: Entity.cpp:639
Ogre::Vector3 jump_end_
The jump ending point.
Definition: Entity.h:1247
void SetRotation(const Ogre::Degree &rotation)
Sets the entity rotation.
Definition: Entity.cpp:235
bool solid_
Indicates it the entity is solid and can handle collisions.
Definition: Entity.h:1132
void ScriptOffsetToPosition(const float x, const float y, const float z, const ActionType type, const float seconds)
Definition: Entity.cpp:495
int GetCharacterId()
Retrieves the entity's character ID.
Definition: Entity.cpp:681
Ogre::String move_animation_run_
The name of the entity's run animation.
Definition: Entity.h:1217
Ogre::SceneNode * model_root_node_
The entity's root node.
Definition: Entity.h:1097
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.
void SetPosition(const Ogre::Vector3 &position)
Sets the entity position.
Definition: Entity.cpp:201
void ScriptSetPosition(const float x, const float y, const float z)
Sets the entity position.
Definition: Entity.cpp:203
Ogre::Vector3 move_position_
The entity's movement destination point.
Definition: Entity.h:1182
bool IsCharacter()
Checks if the entity is a character.
Definition: Entity.cpp:679
void ScriptMoveToPosition(const float x, const float y)
Makes the entity move to a point in the map.
Definition: Entity.cpp:343
void ScriptSetDefaultAnimation(const char *animation)
Sets the default animation of the entity.
Definition: Entity.cpp:659
bool move_auto_rotation_
Indicates if the entity can rotate while moving.
Definition: Entity.h:1202
Ogre::SceneNode * talk_collision_node_
The entity's talk collision node.
Definition: Entity.h:1137
Ogre::Vector3 linear_end_
The linear movement ending point.
Definition: Entity.h:1232
void SetMoveWalkSpeed(const float speed)
Sets the entity's walking movement speed.
Definition: Entity.cpp:313
EntityCollision * talk_collision_
The entity's talk collision.
Definition: Entity.h:1142
float GetMoveWalkSpeed() const
Retrieves the entity's walking speed.
Definition: Entity.cpp:315
bool is_character_
Indicates if the entity is a playable character.
Definition: Entity.h:1397
void SetMoveAutoRotation(const bool rotate)
Enables or disables autorotation while the entity is moving.
Definition: Entity.cpp:331
const Ogre::String & GetMoveAnimationRunName() const
Retrieves the entity's run animation name.
Definition: Entity.cpp:341
void SetSolidRadius(const float radius)
Sets the entity's solid radius.
Definition: Entity.cpp:283
State GetState() const
Retrieves the entity's state.
Definition: Entity.cpp:307
virtual void setRootOrientation(const Ogre::Quaternion &root_orientation)
Sets the entity's absolute orientation.
Definition: Entity.cpp:276
const Ogre::Vector3 & GetOffsetPositionStart() const
Definition: Entity.cpp:531
int ScriptMoveSync()
Waits for entity's movement to end.
Definition: Entity.cpp:362
void SetState(const State state)
Sets the entity's state.
Definition: Entity.cpp:305
int index_
Index of the entity on the field.
Definition: Entity.h:1407
float GetOffsetSeconds() const
Definition: Entity.cpp:537
void SetOffset(const Ogre::Vector3 &position)
Sets the entity position.
Definition: Entity.cpp:225
AnimationPlayType animation_play_type_
The entity's current animation type.
Definition: Entity.h:1362
void ScriptMoveToEntity(Entity *entity)
Makes the unit move towards another in the map.
Definition: Entity.cpp:354
float jump_seconds_
Total jump duration.
Definition: Entity.h:1252
void ScriptSetRotation(const float rotation)
Sets the entity rotation.
Definition: Entity.cpp:249
const Ogre::Vector3 GetPosition() const
Retrieves the entity position.
Definition: Entity.cpp:216
void SetMoveAutoAnimation(const bool animate)
Enables or disables autoanimation while the entity is moving.
Definition: Entity.cpp:335
int ScriptAnimationSync()
Adds the entity's animation to the sync queue.
Definition: Entity.cpp:663
Ogre::Vector3 linear_start_
The linear movement starting point.
Definition: Entity.h:1227
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.
Definition: Entity.cpp:574
const Ogre::Vector3 GetOffset() const
Retrieves the entity position.
Definition: Entity.cpp:230
float GetJumpCurrentSeconds() const
Gets the current duration of the jump.
Definition: Entity.cpp:491
virtual void UpdateDebug()
Updates the entity status with debug information.
Definition: Entity.cpp:126
int GetMoveTriangleId() const
Sets the destination triangle in the walkmesh.
Definition: Entity.cpp:329
void SetLinear(const Ogre::Vector3 &end, const LinearMovement movement, const Ogre::String &animation, const float orientation, const int dest_triangle)
Linearly moves the entity.
Definition: Entity.cpp:402
bool jump_was_solid_
Used to store solidity status before a jump.
Definition: Entity.h:1262
const Ogre::String & GetDefaultAnimationName() const
Retrieves the entity's default animation name.
Definition: Entity.cpp:635
bool IsSolid() const
Checks if the entity is solid.
Definition: Entity.cpp:292
const Ogre::Vector3 & GetLinearStart() const
Retrieves the starting point of the current linear movement.
Definition: Entity.cpp:431
Entity * turn_entity_
The turn destination entity.
Definition: Entity.h:1317
bool talkable_
Indicates if the entity can be interacted with.
Definition: Entity.h:1152
virtual ~Entity()
Destructor.
Definition: Entity.cpp:107
void SetMoveRunSpeed(const float speed)
Sets the entity's running movement speed.
Definition: Entity.cpp:317
Ogre::String name_
The name of the entity.
Definition: Entity.h:1082
void UnsetTurn()
Cancels the entity's current jump.
Definition: Entity.cpp:593
int jump_dest_triangle_
Triangle to set the entity on after a jump.
Definition: Entity.h:1267
bool is_line_
Indicates if the entity is a line.
Definition: Entity.h:1412
void SetMoveTriangleId(const int triangle)
Sets the destination triangle in the walkmesh.
Definition: Entity.cpp:327
float animation_speed_
The animation speed.
Definition: Entity.h:1342
Ogre::Degree GetDirectionToEntity(Entity *entity) const
Calculates the angular distance to an entity.
Definition: Entity.cpp:685
AnimationState
Entity animation states.
Definition: Entity.h:108
@ AUTO_ANIMATION
An animation is set to play automatically.
Definition: Entity.h:118
@ REQUESTED_ANIMATION
An animation has been requested.
Definition: Entity.h:113
float GetSolidRadius() const
Retrieves the entity's solid radius.
Definition: Entity.cpp:288
Ogre::Degree CalculateTurnAngle(const Ogre::Degree &start, const Ogre::Degree &end) const
Calculates the turn angle.
Definition: Entity.cpp:600
float GetMoveRunSpeed() const
Retrieves the entity's running speed.
Definition: Entity.cpp:319
int character_id_
The ID of the playable character the entity is, if any.
Definition: Entity.h:1402
void SetOffsetCurrentSeconds(const float seconds)
Definition: Entity.cpp:539
bool GetMoveAutoRotation() const
Checks if the unit can autorotate while it's moving.
Definition: Entity.cpp:333
float GetJumpSeconds() const
Gets the total duration of the jump.
Definition: Entity.cpp:487
virtual void SetVisible(const bool visible)=0
Makes the entity visible or invisible.
virtual void UpdateAnimation(const float delta)=0
Updates the animation state.
float GetMoveStopDistance() const
Retrieves the distance to destination.
Definition: Entity.cpp:325
int ScriptOffsetSync()
Definition: Entity.cpp:514
const Ogre::String & GetName() const
Retrieves the entity name.
Definition: Entity.cpp:199
LinearMovement linear_movement_
The entity's linear movement direction.
Definition: Entity.h:1222
void SetCharacter(int char_id)
Assigns the entity as a character.
Definition: Entity.cpp:673
LinearMovement GetLinearMovement() const
Retrieves the entity's current linear movement.
Definition: Entity.cpp:429
Ogre::Degree GetRotation() const
Retrieves the entity rotation.
Definition: Entity.cpp:251
float GetTurnCurrentSeconds() const
Retrieves the turn current duration.
Definition: Entity.cpp:631
void SetTalkable(const bool talkable)
Sets an entity as talkable or non-talkable.
Definition: Entity.cpp:301
float GetHeight() const
Retrieves the entity's height.
Definition: Entity.cpp:281
void UnsetJump()
Cancels the entity's current jump.
Definition: Entity.cpp:474
Ogre::String String
Definition: TypeDefine.h:37