| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307 |
- /*
- * Copyright (C) 2022 The V-Gears Team
- *
- * This file is part of V-Gears
- *
- * V-Gears is free software: you can redistribute it and/or modify it under
- * terms of the GNU General Public License as published by the Free Software
- * Foundation, version 3.0 (GPLv3) of the License.
- *
- * V-Gears is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- */
- #pragma once
- #include <OgreString.h>
- #include "EntityCollision.h"
- #include "EntityDirection.h"
- #include "ScriptManager.h"
- /**
- * Action types.
- */
- enum ActionType{
- /**
- * No action.
- */
- AT_NONE,
- /**
- * Linear action.
- *
- * It starts and ends at full speed.
- */
- AT_LINEAR,
- /**
- * Smooth action.
- *
- * The action speed steadily increases when started, and it steadily
- * decreases before the end.
- */
- AT_SMOOTH
- };
- /**
- * The direction for an entity turn.
- */
- enum TurnDirection{
- /**
- * Turn clockwise.
- */
- TD_CLOCKWISE,
- /**
- * Turn anticlockwise.
- */
- TD_ANTICLOCKWISE,
- /**
- * Choose direction automatically.
- *
- * The direction in which the turn is shorter will be selected.
- */
- TD_CLOSEST
- };
- /**
- * Linear movement modes.
- */
- enum LinearMovement{
- /**
- * Move down.
- */
- LM_UP_TO_DOWN,
- /**
- * Move up.
- */
- LM_DOWN_TO_UP,
- /**
- * Move right.
- */
- LM_LEFT_TO_RIGHT,
- /**
- * Move left.
- */
- LM_RIGHT_TO_LEFT
- };
- /**
- * Any entity in a field.
- */
- class Entity{
- public:
- /**
- * Entity animation states.
- */
- enum AnimationState{
- /**
- * An animation has been requested.
- */
- REQUESTED_ANIMATION,
- /**
- * An animation is set to play automatically.
- */
- AUTO_ANIMATION
- };
- /**
- * Types of animations.
- */
- enum AnimationPlayType{
- /**
- * Default animation mode.
- *
- * @todo Same as PLAY_ONCE?
- */
- PLAY_DEFAULT,
- /**
- * Play the animation once, then stop.
- */
- PLAY_ONCE,
- /**
- * Play an animation in a continous loop.
- */
- PLAY_LOOPED
- };
- /**
- * Entity state.
- */
- enum State{
- /**
- * No state.
- *
- * The entity has not been placed or it has been removed.
- */
- NONE,
- /**
- * The entity is in the walkmesh.
- */
- WALKMESH,
- /**
- * @todo Understand and document.
- */
- LINEAR,
- /**
- * @todo Understand and document.
- */
- JUMP
- };
- /**
- * Constructor.
- *
- * @param name[in] Entity name.
- * @param node[in] Scene node to which the entity should be attached.
- */
- Entity(const Ogre::String& name, Ogre::SceneNode* node);
- /**
- * Destructor.
- */
- virtual ~Entity();
- /**
- * Updates the entity status.
- */
- virtual void Update();
- /**
- * Updates the entity status with debug information.
- */
- virtual void UpdateDebug();
- /**
- * Retrieves the entity name.
- *
- * @return The entity name.
- */
- const Ogre::String& GetName() const;
- /**
- * Sets the entity position.
- *
- * @param position[in] Entity's new position.
- */
- void SetPosition(const Ogre::Vector3& position);
- /**
- * Sets the entity position.
- *
- * It also resets the walkmesh triangle to reattach entity to walkmesh
- * again if needed.
- *
- * @param x[in] Entity's new position X coordinate.
- * @param y[in] Entity's new position Y coordinate.
- * @param z[in] Entity's new position Z coordinate.
- */
- void ScriptSetPosition(const float x, const float y, const float z);
- /**
- * Retrieves the entity position.
- *
- * @return The entity position.
- */
- const Ogre::Vector3 GetPosition() const;
- /**
- * Informs the script manager of the entity position.
- *
- * @todo Im not really sure what this actually does.
- */
- void ScriptGetPosition() const;
- /**
- * Sets the entity position.
- *
- * @param position[in] The entity new position.
- * @todo Offset to what?
- */
- void SetOffset(const Ogre::Vector3& position);
- /**
- * Retrieves the entity position.
- *
- * @return The entity position.
- * @todo Offset to what?
- */
- const Ogre::Vector3 GetOffset() const;
- /**
- * Sets the entity rotation.
- *
- * @param rotation[in] The entity rotation, in degrees.
- */
- void SetRotation(const Ogre::Degree& rotation);
- /**
- * Sets the entity rotation.
- *
- * @param rotation[in] The entity rotation (0-360).
- */
- void ScriptSetRotation(const float rotation);
- /**
- * Retrieves the entity rotation.
- *
- * @return The entity rotation, in degrees.
- */
- Ogre::Degree GetRotation() const;
- /**
- * Retrieves the entity rotation.
- *
- * @return The entity rotation (0-360).
- */
- float ScriptGetRotation() const;
- /**
- * Sets the entity scale.
- *
- * @param scale[in] Three dimensional scale.
- */
- virtual void setScale(const Ogre::Vector3 &scale);
- /**
- * Sets the entity's absolute orientation.
- *
- * @param root_orientation[in] The entity's new orientation.
- */
- virtual void setRootOrientation(
- const Ogre::Quaternion &root_orientation
- );
- /**
- * Retrieves the entity's height.
- *
- * @return The entity's height.
- */
- float GetHeight() const;
- /**
- * Sets the entity's solid radius.
- *
- * The solid radius is used to detect collisions.
- *
- * @param radius[in] The solid radius.
- * @todo Is it in pixels?
- */
- void SetSolidRadius(const float radius);
- /**
- * Retrieves the entity's solid radius.
- *
- * The solid radius is used to detect collisions.
- *
- * @return The solid radius.
- * @todo Is it in pixels?
- */
- float GetSolidRadius() const;
- /**
- * Makes the entity solid or non-solid.
- *
- * Solid entities can produce collisions.
- *
- * @param solid[in] True to make the entity solid, false otherwise.
- */
- void SetSolid(const bool solid);
- /**
- * Checks if the entity is solid.
- *
- * Solid entities can produce collisions.
- *
- * @return True if the entity is solid, false otherwise.
- */
- bool IsSolid() const;
- /**
- * Sets the entity talk radius.
- *
- * The talk radius is the maximum distance at which an entity can be
- * talked to or interacted with.
- *
- * @param radius[in] The talk radius.
- * @todo Is it in pixels?
- */
- void SetTalkRadius(const float radius);
- /**
- * Retrieves the entity talk radius.
- *
- * The talk radius is the maximum distance at which an entity can be
- * talked to or interacted with.
- *
- * @return The talk radius.
- * @todo Is it in pixels?
- */
- float GetTalkRadius() const;
- /**
- * Sets an entity as talkable or non-talkable.
- *
- * Talkable units can be talked to or interacted with.
- *
- * @param talkable[in] True to make the entity talkable, false to make
- * it non-talkable.
- */
- void SetTalkable(const bool talkable);
- /**
- * Checks if an entity is talkable or non-talkable.
- *
- * Talkable units can be talked to or interacted with.
- *
- * @return True if the entity is talkable, false if it's not.
- */
- bool IsTalkable() const;
- /**
- * Makes the entity visible or invisible.
- *
- * Invisible entities can't be interacted with.
- *
- * @param visible[in] True to make the unit visible, false to make it
- * invisible.
- */
- virtual void SetVisible(const bool visible) = 0;
- /**
- * Checks if the entity is visible or invisible.
- *
- * Invisible entities can't be interacted with.
- *
- * @return True if the unit is visible, false if it's invisible.
- */
- virtual bool IsVisible() const = 0;
- /**
- * Sets the entity's state.
- *
- * @param state[in] The entity's state.
- */
- void SetState(const State state);
- /**
- * Retrieves the entity's state.
- *
- * @return The entity's state.
- */
- State GetState() const;
- /**
- * Sets the entity's automatic movement speed.
- *
- * @param speed[in] Automatic movement speed.
- * @todo Describe where this speed is used, and max and mins or
- * references.
- */
- void SetMoveAutoSpeed(const float speed);
- /**
- * Retrieves the entity's automatic movement speed.
- *
- * @return Automatic movement speed.
- * @todo Describe where this speed is used, and max and mins or
- * references.
- */
- float GetMoveAutoSpeed() const;
- /**
- * Sets the entity's walking movement speed.
- *
- * @param speed[in] Walking speed.
- * @todo Describe where this speed is used, and max and mins or
- * references.
- */
- void SetMoveWalkSpeed(const float speed);
- /**
- * Retrieves the entity's walking speed.
- *
- * @return Walking speed.
- * @todo Describe where this speed is used, and max and mins or
- * references.
- */
- float GetMoveWalkSpeed() const;
- /**
- * Sets the entity's running movement speed.
- *
- * @param speed[in] Running speed.
- * @todo Describe where this speed is used, and max and mins or
- * references.
- */
- void SetMoveRunSpeed(const float speed);
- /**
- * Retrieves the entity's running speed.
- *
- * @return Running speed.
- * @todo Describe where this speed is used, and max and mins or
- * references.
- */
- float GetMoveRunSpeed() const;
- /**
- * Sets the entity's movement destination position.
- *
- * @param target[in] The destination position.
- */
- void SetMovePosition(const Ogre::Vector3& target);
- /**
- * Retrieves the entity's movement destination position.
- *
- * @return The destination position.
- */
- const Ogre::Vector3& GetMovePosition() const;
- /**
- * Retrieves the distance to destination.
- *
- * It's the distance between the entity's current position and it's
- * current movement destination point.
- *
- * @return The distance to destination.
- * @todo Verify this description. Also, indicate units (pixels?).
- */
- float GetMoveStopDistance() const;
- /**
- * 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.
- *
- * @param triangle[in] Destination triangle in the walkmesh.
- */
- void SetMoveTriangleId(const int triangle);
- /**
- * Sets the destination triangle in the walkmesh.
- *
- * @return Destination triangle in the walkmesh.
- */
- int GetMoveTriangleId() const;
- /**
- * Enables or disables autorotation while the entity is moving.
- *
- * @param rotate[in] If true, the entity will rotate automatically
- * while moving. If false, the entity will not rotate.
- */
- void SetMoveAutoRotation(const bool rotate);
- /**
- * Checks if the unit can autorotate while it's moving.
- *
- * @return If true, the entity will rotate automatically while moving.
- * If false, the entity will not rotate.
- */
- bool GetMoveAutoRotation() const;
- /**
- * Enables or disables autoanimation while the entity is moving.
- *
- * @param animate[in] If true, the entity will animate automatically
- * while moving. If false, the entity will not animate.
- */
- void SetMoveAutoAnimation(const bool animate);
- /**
- * Checks if the unit can autoanimate while it's moving.
- *
- * @return If true, the entity will animate automatically while moving.
- * If false, the entity will not animate.
- */
- bool GetMoveAutoAnimation() const;
- /**
- * Retrieves the entity's walk animation name.
- *
- * @return The walk animation name.
- */
- const Ogre::String& GetMoveAnimationWalkName() const;
- /**
- * Retrieves the entity's run animation name.
- *
- * @return The run animation name.
- */
- const Ogre::String& GetMoveAnimationRunName() const;
- /**
- * Makes the unit move to a point in the map.
- *
- * @param x[in] X coordinate of the destination point.
- * @param y[in] Y coordinate of the destination point.
- */
- void ScriptMoveToPosition(const float x, const float y);
- /**
- * Makes the unit move towards another in the map.
- *
- * @param entity[in] entity to move towards.
- */
- void ScriptMoveToEntity(Entity* entity);
- /**
- * Adds the entity's movement to the sync queue.
- *
- * @return Always -1.
- * @todo Properly describe this.
- */
- int ScriptMoveSync();
- /**
- * Cancels the entity's current movement.
- *
- * It also clears the movement sync queue.
- */
- void UnsetMove();
- /**
- * Linearly moves the entity.
- *
- * @param x[in] X coordinate of the destination point.
- * @param y[in] Y coordinate of the destination point.
- * @param z[in] Z coordinate of the destination point.
- * @param movement[in] Movement direction.
- * @param animation[in] Movement animation.
- */
- void ScriptLinearToPosition(
- const float x, const float y, const float z,
- const LinearMovement movement, const char* animation
- );
- /**
- * Adds the unit linear movement to the sync queue.
- *
- * @return Always -1.
- * @todo Properly describe this.
- */
- int ScriptLinearSync();
- /**
- * Linearly moves the entity.
- *
- * @param end[in] Destination point.
- * @param movement[in] Movement direction.
- * @param animation[in] Movement animation.
- */
- void SetLinear(
- const Ogre::Vector3& end, const LinearMovement movement,
- const Ogre::String& animation
- );
- /**
- * Cancels the entity's current linear movement.
- *
- * It also clears the movement sync queue.
- */
- void UnsetLinear();
- /**
- * Retrieves the entity's current linear movement.
- *
- * @return Current linear movement.
- */
- LinearMovement GetLinearMovement() const;
- /**
- * Retrieves the starting point of the current linear movement.
- *
- * @return Starting point.
- */
- const Ogre::Vector3& GetLinearStart() const;
- /**
- * Retrieves the ending point of the current linear movement.
- *
- * @return Ending point.
- */
- const Ogre::Vector3& GetLinearEnd() const;
- /**
- * Makes the unit jump to a point in the field.
- *
- * @param x[in] X coordinate of the jump destination point.
- * @param y[in] Y coordinate of the jump destination point.
- * @param z[in] Z coordinate of the jump destination point.
- * @param seconds[in] Jump duration.
- */
- void ScriptJumpToPosition(
- const float x, const float y, const float z,const float seconds
- );
- /**
- * Adds the entity's jump to the sync queue.
- *
- * @return Always -1.
- * @todo Properly describe this.
- */
- int ScriptJumpSync();
- /**
- * Makes the unit jump to a point in the field.
- *
- * @param jump_to[in] The jump destination point.
- * @param seconds[in] Jump duration.
- */
- void SetJump(const Ogre::Vector3& jump_to, const float seconds);
- /**
- * Cancels the entity's current jump.
- *
- * It also clears the movement sync queue.
- */
- void UnsetJump();
- /**
- * Retrieves the starting point of the current jump.
- *
- * @return Starting point.
- */
- const Ogre::Vector3& GetJumpStart() const;
- /**
- * Retrieves the ending point of the current jump.
- *
- * @return Ending point.
- */
- const Ogre::Vector3& GetJumpEnd() const;
- /**
- * Gets the total duration of the jump.
- *
- * @param Jump total duration, in seconds.
- */
- float GetJumpSeconds() const;
- /**
- * Sets the current duration of the jump.
- *
- * @param Jump current duration, in seconds.
- */
- void SetJumpCurrentSeconds(const float seconds);
- /**
- * Gets the current duration of the jump.
- *
- * @param Jump current duration, in seconds.
- */
- float GetJumpCurrentSeconds() const;
- /**
- * @todo Understand and document.
- *
- * @param x[in] X coordinate of the destination point.
- * @param y[in] Y coordinate of the destination point.
- * @param z[in] Z coordinate of the destination point.
- * @param type[in] Type of action.
- * @param seconds[in] Duration of the action, in seconds.
- */
- void ScriptOffsetToPosition(
- const float x, const float y, const float z,
- const ActionType type, const float seconds
- );
- /**
- * @todo Understand and document.
- *
- * @return Always -1.
- */
- int ScriptOffsetSync();
- /**
- * @todo Understand and document.
- */
- void UnsetOffset();
- /**
- * @todo Understand and document.
- *
- * @return Starting position.
- */
- const Ogre::Vector3& GetOffsetPositionStart() const;
- /**
- * @todo Understand and document.
- *
- * @return Ending position.
- */
- const Ogre::Vector3& GetOffsetPositionEnd() const;
- /**
- * @todo Understand and document.
- *
- * @return The action type.
- */
- ActionType GetOffsetType() const;
- /**
- * @todo Understand and document.
- *
- * @return Action total duration in seconds.
- */
- float GetOffsetSeconds() const;
- /**
- * @todo Understand and document.
- *
- * @param seconds[in] Action current duration in seconds.
- */
- void SetOffsetCurrentSeconds(const float seconds);
- /**
- * @todo Understand and document.
- *
- * @return Action current duration in seconds.
- */
- float GetOffsetCurrentSeconds() const;
- /**
- * Makes the entity turn to a fixed direction.
- *
- * @param direction[in] Final direction to turn the entity's to.
- * @param turn_direction[in] Direction of the turn.
- * @param turn_type[in] Turn mode.
- * @param seconds[in] Total turn duration, in seconds.
- */
- void ScriptTurnToDirection(
- const float direction, const TurnDirection turn_direction,
- const ActionType turn_type, const float seconds
- );
- /**
- * Makes the entity turn towards another entity.
- *
- * @param entity[in] Entity to turn to.
- * @param turn_direction[in] Direction of the turn.
- * @param turn_type[in] Turn mode.
- * @param seconds[in] Total turn duration, in seconds.
- */
- void ScriptTurnToEntity(
- Entity* entity, const TurnDirection turn_direction,
- const float seconds
- );
- /**
- * Adds the entity's turn to the sync queue.
- *
- * @return Always -1.
- * @todo Properly describe this.
- */
- int ScriptTurnSync();
- /**
- * Makes the entity turn towards a point or another entity.
- *
- * @param direction_to[in] Final direction to turn the entity's to.
- * @param entity[in] Entity to turn to.
- * @param turn_direction[in] Direction of the turn.
- * @param turn_type[in] Turn mode.
- * @param seconds[in] Total turn duration, in seconds.
- * @todo What if the point
- */
- void SetTurn(const Ogre::Degree& direction_to, Entity* entity, const TurnDirection turn_direction, const ActionType turn_type, const float seconds);
- /**
- * Cancels the entity's current jump.
- *
- * It also clears the movement sync queue.
- */
- void UnsetTurn();
- /**
- * Calculates the turn angle.
- *
- * If the turn direction is {@see TD_CLOSEST}, the result is the
- * smallest angle between the two orientations. Otherwise, is the angle
- * in the specified turn direction.
- *
- * @param start[in] Starting angle.
- * @param start[in] Ending angle.
- * @return[in] Calculated turn angle.
- */
- Ogre::Degree CalculateTurnAngle(
- const Ogre::Degree& start, const Ogre::Degree& end
- ) const;
- /**
- * Retrieves the turn staring orientation.
- *
- * @return The turn starting orientation.
- */
- Ogre::Degree GetTurnDirectionStart() const;
- /**
- * Retrieves the turn ending orientation.
- *
- * @return The turn ending orientation.
- */
- Ogre::Degree GetTurnDirectionEnd() const;
- /**
- * Retrieves the turn type.
- *
- * @return The turn type.
- */
- ActionType GetTurnType() const;
- /**
- * Retrieves the turn total duration.
- *
- * @return The turn total duration, in seconds.
- */
- float GetTurnSeconds() const;
- /**
- * Sets the turn current duration.
- *
- * @param seconds[in] The turn current duration, in seconds.
- */
- void SetTurnCurrentSeconds(const float seconds);
- /**
- * Retrieves the turn current duration.
- *
- * @return The turn current duration, in seconds.
- */
- float GetTurnCurrentSeconds() const;
- /**
- * Sets the animation speed.
- *
- * @param speed[in] The animation speed.
- * @todo Indicate units, max and mins, or references.
- */
- void ScriptSetAnimationSpeed(const float speed);
- /**
- * Retrieves the entity's default animation name.
- *
- * @return The default animation name.
- */
- const Ogre::String& GetDefaultAnimationName() const;
- /**
- * Retrieves the entity's current animation name.
- *
- * @return The current animation name.
- */
- const Ogre::String& GetCurrentAnimationName() const;
- /**
- * Retrieves the entity's current animation state.
- *
- * @return The current animation state.
- */
- AnimationState GetAnimationState() const;
- /**
- * Plays one of the entity's animations.
- *
- * @param animation[in] Name of the animation to play.
- * @param state[in] The animation initial state.
- * @param play_type[in] The animation play type, to play it once or in
- * a loop.
- * @param start[in] Animation starting point in time, in seconds.
- * @param start[in] Animation ending point in time, in seconds.
- */
- virtual void PlayAnimation(
- const Ogre::String& animation, AnimationState state,
- AnimationPlayType play_type, const float start, const float end
- ) = 0;
- /**
- * Resumes an animation.
- *
- * @param animation[in] Name of the animation to resume.
- */
- virtual void PlayAnimationContinue(const Ogre::String& animation) = 0;
- /**
- * Updates the animation state.
- *
- * @param delta[in] @todo.
- */
- virtual void UpdateAnimation(const float delta) = 0;
- /**
- * Plays one of the entity's animations.
- *
- * @param name[in] Name of the animation to play.
- */
- void ScriptPlayAnimation(const char* name);
- /**
- * Stops one of the entity's animations.
- *
- * @param name[in] Name of the animation to stop.
- */
- void ScriptPlayAnimationStop(const char* name);
- /**
- * Plays one of the entity's animations.
- *
- * @param name[in] Name of the animation to play.
- * @param start[in] Animation starting point in time, in seconds.
- * @param start[in] Animation ending point in time, in seconds.
- */
- void ScriptPlayAnimation(
- const char* name, const float start, const float end
- );
- /**
- * Stops one of the entity's animations.
- *
- * @param name[in] Name of the animation to stop.
- * @param start[in] Animation starting point in time, in seconds.
- * @param start[in] Animation ending point in time, in seconds.
- */
- void ScriptPlayAnimationStop(
- const char* name, const float start, const float end
- );
- /**
- * Sets the default animation of the entity.
- *
- * @param animation[in] Name of the default animation.
- */
- void ScriptSetDefaultAnimation(const char* animation);
- /**
- * Adds the entity's animation to the sync queue.
- *
- * @return Always -1.
- * @todo Properly describe this.
- */
- int ScriptAnimationSync();
- protected:
- /**
- * The name of the entity.
- */
- Ogre::String name_;
- /**
- * The scene node the entity is attached to.
- */
- Ogre::SceneNode* scene_node_;
- /**
- * The entity's model.
- */
- Ogre::SceneNode* model_node_;
- /**
- * The entity's root node.
- */
- Ogre::SceneNode* model_root_node_;
- /**
- * The entity's height.
- */
- float height_;
- /**
- * The entity's direction node.
- */
- Ogre::SceneNode* direction_node_;
- /**
- * The entity's direction.
- */
- EntityDirection* direction_;
- /**
- * The entity's collision node.
- */
- Ogre::SceneNode* solid_collision_node_;
- /**
- * The entity's collision.
- */
- EntityCollision* solid_collision_;
- /**
- * The entity's solid radius.
- */
- float solid_radius_;
- /**
- * Indicates it the entity is solid and can handle collisions.
- */
- bool solid_;
- /**
- * The entity's talk collision node.
- */
- Ogre::SceneNode* talk_collision_node_;
- /**
- * The entity's talk collision.
- */
- EntityCollision* talk_collision_;
- /**
- * The radius at which the entity can be interacted with.
- */
- float talk_radius_;
- /**
- * Indicates if the entity can be interacted with.
- */
- bool talkable_;
- /**
- * Entity's movement status.
- */
- State state_;
- /**
- * Entity's movement sync queue.
- */
- std::vector<ScriptId> sync_;
- /**
- * The entity's automatic movement speed.
- */
- float move_auto_speed_;
- /**
- * The entity's walking speed.
- */
- float move_walk_speed_;
- /**
- * The entity's running speed.
- */
- float move_run_speed_;
- /**
- * The entity's movement destination point.
- */
- Ogre::Vector3 move_position_;
- /**
- * The entity's movement destination entity.
- */
- Entity* move_entity_;
- /**
- * Distance between the entity and it's movement destination point.
- */
- float move_stop_distance_;
- /**
- * Entity's movement destination triangle ID.
- */
- int move_triangle_id_;
- /**
- * Indicates if the entity can rotate while moving.
- */
- bool move_auto_rotation_;
- /**
- * Indicates if the entity can animate while moving.
- */
- bool move_auto_animation_;
- /**
- * The name of the entity's walk animation.
- */
- Ogre::String move_animation_walk_;
- /**
- * The name of the entity's run animation.
- */
- Ogre::String move_animation_run_;
- /**
- * The entity's linear movement direction.
- */
- LinearMovement linear_movement_;
- /**
- * The linear movement starting point.
- */
- Ogre::Vector3 linear_start_;
- /**
- * The linear movement ending point.
- */
- Ogre::Vector3 linear_end_;
- /**
- * The jump starting point.
- */
- Ogre::Vector3 jump_start_;
- /**
- * The jump ending point.
- */
- Ogre::Vector3 jump_end_;
- /**
- * Total jump duration.
- */
- float jump_seconds_;
- /**
- * Current jump duration.
- */
- float jump_current_seconds_;
- /**
- * @todo Understand and document.
- */
- Ogre::Vector3 offset_position_start_;
- /**
- * @todo Understand and document.
- */
- Ogre::Vector3 offset_position_end_;
- /**
- * @todo Understand and document.
- */
- ActionType offset_type_;
- /**
- * @todo Understand and document.
- */
- float offset_seconds_;
- /**
- * @todo Understand and document.
- */
- float offset_current_seconds_;
- /**
- * @todo Understand and document.
- */
- std::vector<ScriptId> offset_sync_;
- /**
- * Turn movement direction.
- */
- TurnDirection turn_direction_;
- /**
- * Turn initial orientation.
- */
- Ogre::Degree turn_direction_start_;
- /**
- * Turn final orientation.
- */
- Ogre::Degree turn_direction_end_;
- /**
- * The turn destination entity.
- */
- Entity* turn_entity_;
- /**
- * The turn type.
- */
- ActionType turn_type_;
- /**
- * Total turn duration.
- */
- float turn_seconds_;
- /**
- * Current turn duration.
- */
- float turn_current_seconds_;
- /**
- * Entity's turning sync queue.
- */
- std::vector<ScriptId> turn_sync_;
- /**
- * The animation speed.
- */
- float animation_speed_;
- /**
- * The entity's current animation name.
- */
- Ogre::String animation_current_name_;
- /**
- * Entity's animation sync queue.
- */
- std::vector<ScriptId> animation_sync_;
- /**
- * The entity's current animation state.
- */
- AnimationState animation_state_;
- /**
- * The entity's current animation type.
- */
- AnimationPlayType animation_play_type_;
- /**
- * The name of the entity's default name.
- */
- Ogre::String animation_default_;
- /**
- * @todo Understand and document.
- */
- float animation_end_time_;
- /**
- * Indicates if an automation must be played automatically.
- */
- bool animation_auto_play_;
- private:
- /**
- * Constructor.
- */
- Entity();
- /**
- * Calculates the angular distance to an entity.
- *
- * @param entity[in] Entity to calculate the angular distance to.
- * @return Angular distance to the specified entity.
- */
- Ogre::Degree GetDirectionToEntity(Entity* entity) const;
- };
|