1
0
forked from mirrors/0ad

Rename CELL_SIZE to TERRAIN_TILE_SIZE, to free up the term "cell" for other concepts.

This was SVN commit r10902.
This commit is contained in:
Ykkrosh
2012-01-12 12:51:10 +00:00
parent 4f559e8aff
commit ce67dfd333
31 changed files with 188 additions and 188 deletions
@@ -344,7 +344,7 @@ void ActorViewer::SetActor(const CStrW& name, const CStrW& animation)
CmpPtr<ICmpPosition> cmpPosition(m.Simulation2, m.Entity);
if (!cmpPosition.null())
{
ssize_t c = CELL_SIZE * m.Terrain.GetPatchesPerSide()*PATCH_SIZE/2;
ssize_t c = TERRAIN_TILE_SIZE * m.Terrain.GetPatchesPerSide()*PATCH_SIZE/2;
cmpPosition->JumpTo(entity_pos_t::FromInt(c), entity_pos_t::FromInt(c));
cmpPosition->SetYRotation(entity_angle_t::Pi());
}
@@ -478,7 +478,7 @@ void ActorViewer::Render()
cmpVisual->GetBounds().GetCentre(centre);
else
centre.Y = 0.f;
centre.X = centre.Z = CELL_SIZE * m.Terrain.GetPatchesPerSide()*PATCH_SIZE/2;
centre.X = centre.Z = TERRAIN_TILE_SIZE * m.Terrain.GetPatchesPerSide()*PATCH_SIZE/2;
CCamera camera = View::GetView_Actor()->GetCamera();
camera.m_Orientation.Translate(centre.X, centre.Y, centre.Z);
@@ -541,9 +541,9 @@ void ActorViewer::Update(float dt)
float z = cmpPosition->GetPosition().Z.ToFloat();
z -= m.CurrentSpeed*dt;
// Wrap at the edges, so it doesn't run off into the horizon
ssize_t c = CELL_SIZE * m.Terrain.GetPatchesPerSide()*PATCH_SIZE/2;
if (z < c - CELL_SIZE*PATCH_SIZE * 0.1f)
z = c + CELL_SIZE*PATCH_SIZE * 0.1f;
ssize_t c = TERRAIN_TILE_SIZE * m.Terrain.GetPatchesPerSide()*PATCH_SIZE/2;
if (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));
}
}
+2 -2
View File
@@ -90,8 +90,8 @@ void Brush::SetData(ssize_t w, ssize_t h, const std::vector<float>& data)
void Brush::GetCentre(ssize_t& x, ssize_t& y) const
{
CVector3D c = m_Centre;
if (m_W % 2) c.X += CELL_SIZE/2.f;
if (m_H % 2) c.Z += CELL_SIZE/2.f;
if (m_W % 2) c.X += TERRAIN_TILE_SIZE/2.f;
if (m_H % 2) c.Z += TERRAIN_TILE_SIZE/2.f;
ssize_t cx, cy;
CTerrain::CalcFromPosition(c, cx, cy);
@@ -265,7 +265,7 @@ static CVector3D GetUnitPos(const Position& pos, bool floating)
// Use 'clamp' with a value slightly less than the width, so that converting
// to integer (rounding towards zero) will put it on the tile inside the edge
// instead of just outside
float mapWidth = (g_Game->GetWorld()->GetTerrain()->GetVerticesPerSide()-1)*CELL_SIZE;
float mapWidth = (g_Game->GetWorld()->GetTerrain()->GetVerticesPerSide()-1)*TERRAIN_TILE_SIZE;
float delta = 1e-6f; // fraction of map width - must be > FLT_EPSILON
float xOnMap = clamp(vec.X, 0.f, mapWidth * (1.f - delta));