Changeset View
Changeset View
Standalone View
Standalone View
source/tools/atlas/GameInterface/ActorViewer.cpp
Show First 20 Lines • Show All 71 Lines • ▼ Show 20 Lines | ActorViewerImpl() : | ||||
LOSTexture(Simulation2), | LOSTexture(Simulation2), | ||||
TerritoryTexture(Simulation2) | TerritoryTexture(Simulation2) | ||||
{ | { | ||||
UnitManager.SetObjectManager(ObjectManager); | UnitManager.SetObjectManager(ObjectManager); | ||||
} | } | ||||
entity_id_t Entity; | entity_id_t Entity; | ||||
CStrW CurrentUnitID; | CStrW CurrentUnitID; | ||||
CStrW CurrentUnitAnim; | CStr CurrentUnitAnim; | ||||
float CurrentSpeed; | float CurrentSpeed; | ||||
bool WalkEnabled; | bool WalkEnabled; | ||||
bool GroundEnabled; | bool GroundEnabled; | ||||
bool WaterEnabled; | bool WaterEnabled; | ||||
bool ShadowsEnabled; | bool ShadowsEnabled; | ||||
// Whether shadows, sky and water are enabled outside of the actor viewer. | // Whether shadows, sky and water are enabled outside of the actor viewer. | ||||
bool OldShadows; | bool OldShadows; | ||||
▲ Show 20 Lines • Show All 234 Lines • ▼ Show 20 Lines | entity_id_t ActorViewer::GetEntity() | ||||
return m.Entity; | return m.Entity; | ||||
} | } | ||||
void ActorViewer::UnloadObjects() | void ActorViewer::UnloadObjects() | ||||
{ | { | ||||
m.ObjectManager.UnloadObjects(); | m.ObjectManager.UnloadObjects(); | ||||
} | } | ||||
void ActorViewer::SetActor(const CStrW& name, const CStrW& animation, player_id_t playerID) | void ActorViewer::SetActor(const CStrW& name, const CStr& animation, player_id_t playerID) | ||||
{ | { | ||||
bool needsAnimReload = false; | bool needsAnimReload = false; | ||||
CStrW id = name; | CStrW id = name; | ||||
// Recreate the entity, if we don't have one or if the new one is different | // Recreate the entity, if we don't have one or if the new one is different | ||||
if (m.Entity == INVALID_ENTITY || id != m.CurrentUnitID) | if (m.Entity == INVALID_ENTITY || id != m.CurrentUnitID) | ||||
{ | { | ||||
Show All 31 Lines | if (m.Entity == INVALID_ENTITY || id != m.CurrentUnitID) | ||||
needsAnimReload = true; | needsAnimReload = true; | ||||
} | } | ||||
if (animation != m.CurrentUnitAnim) | if (animation != m.CurrentUnitAnim) | ||||
needsAnimReload = true; | needsAnimReload = true; | ||||
if (needsAnimReload) | if (needsAnimReload) | ||||
{ | { | ||||
CStr anim = animation.ToUTF8().LowerCase(); | CStr anim = animation.LowerCase(); | ||||
// Emulate the typical simulation animation behaviour | // Emulate the typical simulation animation behaviour | ||||
float speed; | float speed; | ||||
float repeattime = 0.f; | float repeattime = 0.f; | ||||
if (anim == "walk") | if (anim == "walk") | ||||
{ | { | ||||
CmpPtr<ICmpUnitMotion> cmpUnitMotion(m.Simulation2, m.Entity); | CmpPtr<ICmpUnitMotion> cmpUnitMotion(m.Simulation2, m.Entity); | ||||
if (cmpUnitMotion) | if (cmpUnitMotion) | ||||
▲ Show 20 Lines • Show All 170 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator