Changeset View
Changeset View
Standalone View
Standalone View
0ad/source/tools/atlas/GameInterface/ActorViewer.cpp
Show First 20 Lines • Show All 538 Lines • ▼ Show 20 Lines | void ActorViewer::Update(float simFrameLength, float realFrameLength) | ||||
m.Simulation2.Interpolate(simFrameLength, 0, realFrameLength); | m.Simulation2.Interpolate(simFrameLength, 0, realFrameLength); | ||||
if (m.WalkEnabled && m.CurrentSpeed) | if (m.WalkEnabled && m.CurrentSpeed) | ||||
{ | { | ||||
CmpPtr<ICmpPosition> cmpPosition(m.Simulation2, m.Entity); | CmpPtr<ICmpPosition> cmpPosition(m.Simulation2, m.Entity); | ||||
if (cmpPosition) | if (cmpPosition) | ||||
{ | { | ||||
// Move the model by speed*simFrameLength forwards | // Move the model by speed*simFrameLength forwards | ||||
float z = cmpPosition->GetPosition().Z.ToFloat(); | float z = cmpPosition->GetPosition().getZ().ToFloat(); | ||||
z -= m.CurrentSpeed*simFrameLength; | z -= m.CurrentSpeed*simFrameLength; | ||||
// Wrap at the edges, so it doesn't run off into the horizon | // Wrap at the edges, so it doesn't run off into the horizon | ||||
ssize_t c = TERRAIN_TILE_SIZE * m.Terrain.GetPatchesPerSide()*PATCH_SIZE/2; | ssize_t c = TERRAIN_TILE_SIZE * m.Terrain.GetPatchesPerSide()*PATCH_SIZE/2; | ||||
if (z < c - TERRAIN_TILE_SIZE*PATCH_SIZE * 0.1f) | if (z < c - TERRAIN_TILE_SIZE*PATCH_SIZE * 0.1f) | ||||
z = c + TERRAIN_TILE_SIZE*PATCH_SIZE * 0.1f; | z = c + TERRAIN_TILE_SIZE*PATCH_SIZE * 0.1f; | ||||
cmpPosition->JumpTo(cmpPosition->GetPosition().X, entity_pos_t::FromFloat(z)); | cmpPosition->JumpTo(cmpPosition->GetPosition().getX(), entity_pos_t::FromFloat(z)); | ||||
} | } | ||||
} | } | ||||
} | } |
Wildfire Games · Phabricator