Changeset View
Changeset View
Standalone View
Standalone View
source/simulation2/components/CCmpUnitMotion.cpp
Show All 21 Lines | |||||
#include "simulation2/components/ICmpObstruction.h" | #include "simulation2/components/ICmpObstruction.h" | ||||
#include "simulation2/components/ICmpObstructionManager.h" | #include "simulation2/components/ICmpObstructionManager.h" | ||||
#include "simulation2/components/ICmpOwnership.h" | #include "simulation2/components/ICmpOwnership.h" | ||||
#include "simulation2/components/ICmpPosition.h" | #include "simulation2/components/ICmpPosition.h" | ||||
#include "simulation2/components/ICmpPathfinder.h" | #include "simulation2/components/ICmpPathfinder.h" | ||||
#include "simulation2/components/ICmpRangeManager.h" | #include "simulation2/components/ICmpRangeManager.h" | ||||
#include "simulation2/components/ICmpValueModificationManager.h" | #include "simulation2/components/ICmpValueModificationManager.h" | ||||
#include "simulation2/components/ICmpVisual.h" | |||||
#include "simulation2/helpers/Geometry.h" | #include "simulation2/helpers/Geometry.h" | ||||
#include "simulation2/helpers/Render.h" | #include "simulation2/helpers/Render.h" | ||||
#include "simulation2/MessageTypes.h" | #include "simulation2/MessageTypes.h" | ||||
#include "simulation2/serialization/SerializeTemplates.h" | #include "simulation2/serialization/SerializeTemplates.h" | ||||
#include "graphics/Overlay.h" | #include "graphics/Overlay.h" | ||||
#include "graphics/Terrain.h" | #include "graphics/Terrain.h" | ||||
#include "maths/FixedVector2D.h" | #include "maths/FixedVector2D.h" | ||||
▲ Show 20 Lines • Show All 509 Lines • ▼ Show 20 Lines | private: | ||||
/** | /** | ||||
* Update other components on our speed. | * Update other components on our speed. | ||||
* This doesn't use messages for efficiency. | * This doesn't use messages for efficiency. | ||||
* This should only be called when speed changes. | * This should only be called when speed changes. | ||||
*/ | */ | ||||
void UpdateMovementState(entity_pos_t speed) | void UpdateMovementState(entity_pos_t speed) | ||||
{ | { | ||||
CmpPtr<ICmpObstruction> cmpObstruction(GetEntityHandle()); | CmpPtr<ICmpObstruction> cmpObstruction(GetEntityHandle()); | ||||
CmpPtr<ICmpVisual> cmpVisual(GetEntityHandle()); | |||||
Stan: Check for that ? | |||||
// Moved last turn, didn't this turn. | // Moved last turn, didn't this turn. | ||||
if (speed == fixed::Zero() && m_CurSpeed > fixed::Zero()) | if (speed == fixed::Zero() && m_CurSpeed > fixed::Zero()) | ||||
{ | { | ||||
if (cmpObstruction) | if (cmpObstruction) | ||||
cmpObstruction->SetMovingFlag(false); | cmpObstruction->SetMovingFlag(false); | ||||
if (cmpVisual) | |||||
cmpVisual->SelectMovementAnimation("idle", fixed::FromInt(1)); | |||||
} | } | ||||
// Moved this turn, didn't last turn | // Moved this turn, didn't last turn | ||||
else if (speed > fixed::Zero() && m_CurSpeed == fixed::Zero()) | else if (speed > fixed::Zero() && m_CurSpeed == fixed::Zero()) | ||||
{ | { | ||||
if (cmpObstruction) | if (cmpObstruction) | ||||
cmpObstruction->SetMovingFlag(true); | cmpObstruction->SetMovingFlag(true); | ||||
if (cmpVisual) | |||||
cmpVisual->SelectMovementAnimation(m_Speed > m_WalkSpeed ? "run" : "walk", m_Speed); | |||||
Not Done Inline ActionsWhat about special formation walking animations ? Stan: What about special formation walking animations ? | |||||
Done Inline ActionsThese use a special override. See also https://code.wildfiregames.com/D1337. wraitii: These use a special override. See also https://code.wildfiregames.com/D1337. | |||||
Done Inline ActionsMh, sorry, I thought you were referring to something in unitAI -_- This does indeed break formation walking animations, it required D1337 to work as currently written but I think I'll just fix it for this diff. Maybe not. wraitii: Mh, sorry, I thought you were referring to something in unitAI -_-
This does indeed break… | |||||
} | } | ||||
// Speed change, update the visual actor if necessary. | |||||
else if (speed != m_CurSpeed && cmpVisual) | |||||
cmpVisual->SelectMovementAnimation(m_Speed > m_WalkSpeed ? "run" : "walk", m_Speed); | |||||
m_CurSpeed = speed; | m_CurSpeed = speed; | ||||
} | } | ||||
bool MoveToPointRange(entity_pos_t x, entity_pos_t z, entity_pos_t minRange, entity_pos_t maxRange, entity_id_t target); | bool MoveToPointRange(entity_pos_t x, entity_pos_t z, entity_pos_t minRange, entity_pos_t maxRange, entity_id_t target); | ||||
/** | /** | ||||
* Handle the result of an asynchronous path query. | * Handle the result of an asynchronous path query. | ||||
▲ Show 20 Lines • Show All 1,058 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator
Check for that ?