Remove leftover terrain-based movement cost code.
6581796103
removed the ability for terrain to affect movement speed. The
JPS pathfinder cannot support it, and the approach was poor anyways,
coupling rendering data with simulation data.
This lets us remove the dependency on CTerrainTextureManager everywhere.
Tested by: langbart
Differential Revision: https://code.wildfiregames.com/D4459
This was SVN commit r26269.
This commit is contained in:
parent
1d7eb7492e
commit
410d2e883a
@ -5,6 +5,6 @@
|
||||
<texture name="normTex" file="types/medit_city_tile_norm.png"/>
|
||||
<texture name="specTex" file="types/medit_city_tile_spec.png"/>
|
||||
</textures>
|
||||
<props groups="city" movementclass="city" mmap="230 227 198" angle="45.0" size="18.0"/>
|
||||
<props groups="city" mmap="230 227 198" angle="45.0" size="18.0"/>
|
||||
<material>terrain_norm_spec.xml</material>
|
||||
</terrain>
|
@ -5,6 +5,6 @@
|
||||
<texture name="normTex" file="types/temp_road_broken_norm.png"/>
|
||||
<texture name="specTex" file="types/temp_road_broken_spec.png"/>
|
||||
</textures>
|
||||
<props groups="city" movementclass="city" mmap="230 227 198"/>
|
||||
<props groups="city" mmap="230 227 198"/>
|
||||
<material>terrain_norm_spec.xml</material>
|
||||
</terrain>
|
@ -5,6 +5,6 @@
|
||||
<texture name="normTex" file="types/savanna_tile_a_norm.png"/>
|
||||
<texture name="specTex" file="types/savanna_tile_a_spec.png"/>
|
||||
</textures>
|
||||
<props groups="city" movementclass="city" mmap="230 227 198" angle="45.0"/>
|
||||
<props groups="city" mmap="230 227 198" angle="45.0"/>
|
||||
<material>terrain_norm_spec.xml</material>
|
||||
</terrain>
|
@ -5,6 +5,6 @@
|
||||
<texture name="normTex" file="types/savanna_tile_a_norm.png"/>
|
||||
<texture name="specTex" file="types/savanna_tile_a_spec.png"/>
|
||||
</textures>
|
||||
<props groups="city" movementclass="city" mmap="230 227 198" angle="45.0"/>
|
||||
<props groups="city" mmap="230 227 198" angle="45.0"/>
|
||||
<material>terrain_norm_spec.xml</material>
|
||||
</terrain>
|
@ -3,6 +3,6 @@
|
||||
<textures>
|
||||
<texture name="baseTex" file="types/temp_road_muddy.png"/>
|
||||
</textures>
|
||||
<props groups="city" movementclass="city" mmap="230 227 198"/>
|
||||
<props groups="city" mmap="230 227 198"/>
|
||||
<material>terrain_base.xml</material>
|
||||
</terrain>
|
||||
|
@ -3,6 +3,6 @@
|
||||
<textures>
|
||||
<texture name="baseTex" file="types/tropic_citytile_a.png"/>
|
||||
</textures>
|
||||
<props groups="city" movementclass="city" mmap="230 227 198"/>
|
||||
<props groups="city" mmap="230 227 198"/>
|
||||
<material>terrain_base.xml</material>
|
||||
</terrain>
|
||||
|
@ -38,9 +38,6 @@
|
||||
<data type="float"/>
|
||||
</attribute>
|
||||
</optional>
|
||||
<optional>
|
||||
<attribute name="movementclass"/>
|
||||
</optional>
|
||||
</interleave>
|
||||
</element>
|
||||
</element>
|
||||
|
@ -59,9 +59,6 @@
|
||||
<data type="float"/>
|
||||
</attribute>
|
||||
</optional>
|
||||
<optional>
|
||||
<attribute name="movementclass"/>
|
||||
</optional>
|
||||
</interleave>
|
||||
</element>
|
||||
</zeroOrMore>
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2021 Wildfire Games.
|
||||
/* Copyright (C) 2022 Wildfire Games.
|
||||
* This file is part of 0 A.D.
|
||||
*
|
||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||
@ -247,9 +247,11 @@ int CMapReader::UnpackTerrain()
|
||||
CStr texturename;
|
||||
unpacker.UnpackString(texturename);
|
||||
|
||||
ENSURE(CTerrainTextureManager::IsInitialised()); // we need this for the terrain properties (even when graphics are disabled)
|
||||
CTerrainTextureEntry* texentry = g_TexMan.FindTexture(texturename);
|
||||
m_TerrainTextures.push_back(texentry);
|
||||
if(CTerrainTextureManager::IsInitialised())
|
||||
{
|
||||
CTerrainTextureEntry* texentry = g_TexMan.FindTexture(texturename);
|
||||
m_TerrainTextures.push_back(texentry);
|
||||
}
|
||||
|
||||
cur_terrain_tex++;
|
||||
LDR_CHECK_TIMEOUT(cur_terrain_tex, num_terrain_tex);
|
||||
@ -1354,9 +1356,11 @@ if (!Script::GetProperty(rq, val, #prop, out))\
|
||||
|
||||
while (cur_terrain_tex < num_terrain_tex)
|
||||
{
|
||||
ENSURE(CTerrainTextureManager::IsInitialised()); // we need this for the terrain properties (even when graphics are disabled)
|
||||
CTerrainTextureEntry* texentry = g_TexMan.FindTexture(textureNames[cur_terrain_tex]);
|
||||
m_TerrainTextures.push_back(texentry);
|
||||
if (CTerrainTextureManager::IsInitialised())
|
||||
{
|
||||
CTerrainTextureEntry* texentry = g_TexMan.FindTexture(textureNames[cur_terrain_tex]);
|
||||
m_TerrainTextures.push_back(texentry);
|
||||
}
|
||||
|
||||
cur_terrain_tex++;
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2021 Wildfire Games.
|
||||
/* Copyright (C) 2022 Wildfire Games.
|
||||
* This file is part of 0 A.D.
|
||||
*
|
||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||
@ -95,17 +95,6 @@ bool CTerrain::Initialize(ssize_t patchesPerSide, const u16* data)
|
||||
return true;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
CStr8 CTerrain::GetMovementClass(ssize_t i, ssize_t j) const
|
||||
{
|
||||
CMiniPatch* tile = GetTile(i, j);
|
||||
if (tile && tile->GetTextureEntry())
|
||||
return tile->GetTextureEntry()->GetProperties().GetMovementClass();
|
||||
|
||||
return "default";
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// CalcPosition: calculate the world space position of the vertex at (i,j)
|
||||
// If i,j is off the map, it acts as if the edges of the terrain are extended
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2021 Wildfire Games.
|
||||
/* Copyright (C) 2022 Wildfire Games.
|
||||
* This file is part of 0 A.D.
|
||||
*
|
||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||
@ -79,8 +79,6 @@ public:
|
||||
&& (z >= GetMinZ()) && (z < GetMaxZ()));
|
||||
}
|
||||
|
||||
CStr8 GetMovementClass(ssize_t i, ssize_t j) const;
|
||||
|
||||
float GetVertexGroundLevel(ssize_t i, ssize_t j) const;
|
||||
fixed GetVertexGroundLevelFixed(ssize_t i, ssize_t j) const;
|
||||
float GetExactGroundLevel(float x, float z) const;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2021 Wildfire Games.
|
||||
/* Copyright (C) 2022 Wildfire Games.
|
||||
* This file is part of 0 A.D.
|
||||
*
|
||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||
@ -35,8 +35,7 @@ CTerrainProperties::CTerrainProperties(CTerrainPropertiesPtr parent):
|
||||
m_BaseColor(0),
|
||||
m_HasBaseColor(false),
|
||||
m_TextureAngle((float)M_PI / 4.f),
|
||||
m_TextureSize(32.f),
|
||||
m_MovementClass("default")
|
||||
m_TextureSize(32.f)
|
||||
{
|
||||
if (m_pParent)
|
||||
m_Groups = m_pParent->m_Groups;
|
||||
@ -95,7 +94,6 @@ void CTerrainProperties::LoadXml(XMBElement node, CXeromyces *pFile, const VfsPa
|
||||
// Terrain Attribs
|
||||
ATTR(mmap);
|
||||
ATTR(groups);
|
||||
ATTR(movementclass);
|
||||
ATTR(angle);
|
||||
ATTR(size);
|
||||
#undef ELMT
|
||||
@ -136,10 +134,6 @@ void CTerrainProperties::LoadXml(XMBElement node, CXeromyces *pFile, const VfsPa
|
||||
{
|
||||
m_TextureSize = attr.Value.ToFloat();
|
||||
}
|
||||
else if (attr.Name == attr_movementclass)
|
||||
{
|
||||
m_MovementClass = attr.Value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2021 Wildfire Games.
|
||||
/* Copyright (C) 2022 Wildfire Games.
|
||||
* This file is part of 0 A.D.
|
||||
*
|
||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||
@ -55,8 +55,6 @@ private:
|
||||
u32 m_BaseColor;
|
||||
bool m_HasBaseColor;
|
||||
|
||||
CStr m_MovementClass;
|
||||
|
||||
// Orientation of texture (in radians) (default pi/4 = 45 degrees)
|
||||
float m_TextureAngle;
|
||||
|
||||
@ -103,11 +101,6 @@ public:
|
||||
return m_TextureSize;
|
||||
}
|
||||
|
||||
CStr GetMovementClass() const
|
||||
{
|
||||
return m_MovementClass;
|
||||
}
|
||||
|
||||
const GroupVector &GetGroups() const
|
||||
{
|
||||
return m_Groups;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2021 Wildfire Games.
|
||||
/* Copyright (C) 2022 Wildfire Games.
|
||||
* This file is part of 0 A.D.
|
||||
*
|
||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||
@ -44,11 +44,6 @@ public:
|
||||
TS_ASSERT_OK(g_VFS->Mount(L"cache", DataDir() / "_testcache" / "", 0, VFS_MAX_PRIORITY));
|
||||
CXeromyces::Startup();
|
||||
|
||||
// Need some stuff for terrain movement costs:
|
||||
// (TODO: this ought to be independent of any graphics code)
|
||||
new CTerrainTextureManager;
|
||||
g_TexMan.LoadTerrainTextures();
|
||||
|
||||
enet_initialize();
|
||||
}
|
||||
|
||||
@ -56,8 +51,6 @@ public:
|
||||
{
|
||||
enet_deinitialize();
|
||||
|
||||
delete &g_TexMan;
|
||||
|
||||
CXeromyces::Terminate();
|
||||
g_VFS.reset();
|
||||
DeleteDirectory(DataDir()/"_testcache");
|
||||
|
@ -435,10 +435,6 @@ void Shutdown(int flags)
|
||||
|
||||
ShutdownPs();
|
||||
|
||||
TIMER_BEGIN(L"shutdown TexMan");
|
||||
delete &g_TexMan;
|
||||
TIMER_END(L"shutdown TexMan");
|
||||
|
||||
if (hasRenderer)
|
||||
{
|
||||
TIMER_BEGIN(L"shutdown Renderer");
|
||||
@ -826,10 +822,6 @@ void InitGraphics(const CmdLineArgs& args, int flags, const std::vector<CStr>& i
|
||||
|
||||
void InitNonVisual(const CmdLineArgs& args)
|
||||
{
|
||||
// Need some stuff for terrain movement costs:
|
||||
// (TODO: this ought to be independent of any graphics code)
|
||||
new CTerrainTextureManager;
|
||||
g_TexMan.LoadTerrainTextures();
|
||||
Autostart(args);
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2021 Wildfire Games.
|
||||
/* Copyright (C) 2022 Wildfire Games.
|
||||
* This file is part of 0 A.D.
|
||||
*
|
||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||
@ -248,11 +248,6 @@ void CReplayPlayer::Replay(const bool serializationtest, const int rejointesttur
|
||||
if (ooslog)
|
||||
g_Game->GetSimulation2()->EnableOOSLog();
|
||||
|
||||
// Need some stuff for terrain movement costs:
|
||||
// (TODO: this ought to be independent of any graphics code)
|
||||
new CTerrainTextureManager;
|
||||
g_TexMan.LoadTerrainTextures();
|
||||
|
||||
// Initialise h_mgr so it doesn't crash when emitting sounds
|
||||
h_mgr_init();
|
||||
|
||||
@ -329,9 +324,6 @@ void CReplayPlayer::Replay(const bool serializationtest, const int rejointesttur
|
||||
// it's already destructed.
|
||||
g_ScriptContext.reset();
|
||||
|
||||
// Clean up
|
||||
delete &g_TexMan;
|
||||
|
||||
delete &g_Profiler;
|
||||
delete &g_ProfileViewer;
|
||||
SAFE_DELETE(g_ScriptStatsTable);
|
||||
|
@ -316,6 +316,8 @@ CRenderer::CRenderer()
|
||||
|
||||
CRenderer::~CRenderer()
|
||||
{
|
||||
delete &g_TexMan;
|
||||
|
||||
// We no longer UnloadWaterTextures here -
|
||||
// that is the responsibility of the module that asked for
|
||||
// them to be loaded (i.e. CGameView).
|
||||
|
@ -1163,13 +1163,8 @@ bool CCmpUnitMotion::PerformMove(fixed dt, const fixed& turnRate, WaypointPath&
|
||||
basicSpeed = std::max(std::min(m_TemplateWalkSpeed, floorSpeed), basicSpeed);
|
||||
}
|
||||
|
||||
// Find the speed factor of the underlying terrain.
|
||||
// (We only care about the tile we start on - it doesn't matter if we're moving
|
||||
// partially onto a much slower/faster tile).
|
||||
// TODO: Terrain-dependent speeds are not currently supported.
|
||||
fixed terrainSpeed = fixed::FromInt(1);
|
||||
|
||||
fixed maxSpeed = basicSpeed.Multiply(terrainSpeed);
|
||||
// TODO: would be nice to support terrain-dependent speed again.
|
||||
fixed maxSpeed = basicSpeed;
|
||||
|
||||
fixed timeLeft = dt;
|
||||
fixed zero = fixed::Zero();
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2021 Wildfire Games.
|
||||
/* Copyright (C) 2022 Wildfire Games.
|
||||
* This file is part of 0 A.D.
|
||||
*
|
||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||
@ -45,16 +45,10 @@ public:
|
||||
TS_ASSERT_OK(g_VFS->Mount(L"cache", DataDir() / "_testcache" / "", 0, VFS_MAX_PRIORITY));
|
||||
|
||||
CXeromyces::Startup();
|
||||
|
||||
// Need some stuff for terrain movement costs:
|
||||
// (TODO: this ought to be independent of any graphics code)
|
||||
new CTerrainTextureManager;
|
||||
g_TexMan.LoadTerrainTextures();
|
||||
}
|
||||
|
||||
void tearDown()
|
||||
{
|
||||
delete &g_TexMan;
|
||||
CXeromyces::Terminate();
|
||||
g_VFS.reset();
|
||||
DeleteDirectory(DataDir()/"_testcache");
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2021 Wildfire Games.
|
||||
/* Copyright (C) 2022 Wildfire Games.
|
||||
* This file is part of 0 A.D.
|
||||
*
|
||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||
@ -192,8 +192,7 @@ namespace Pathfinding
|
||||
|
||||
/*
|
||||
* For efficient pathfinding we want to try hard to minimise the per-tile search cost,
|
||||
* so we precompute the tile passability flags and movement costs for the various different
|
||||
* types of unit.
|
||||
* so we precompute the tile passability flags for the various different types of unit.
|
||||
* We also want to minimise memory usage (there can easily be 100K tiles so we don't want
|
||||
* to store many bytes for each).
|
||||
*
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2021 Wildfire Games.
|
||||
/* Copyright (C) 2022 Wildfire Games.
|
||||
* This file is part of 0 A.D.
|
||||
*
|
||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||
@ -885,11 +885,6 @@ public:
|
||||
TS_ASSERT_OK(g_VFS->Mount(L"", DataDir() / "mods" / "public" / "", VFS_MOUNT_MUST_EXIST));
|
||||
TS_ASSERT_OK(g_VFS->Mount(L"cache", DataDir() / "_testcache" / "", 0, VFS_MAX_PRIORITY));
|
||||
|
||||
// Need some stuff for terrain movement costs:
|
||||
// (TODO: this ought to be independent of any graphics code)
|
||||
new CTerrainTextureManager;
|
||||
g_TexMan.LoadTerrainTextures();
|
||||
|
||||
CTerrain terrain;
|
||||
|
||||
CSimulation2 sim2(NULL, g_ScriptContext, &terrain);
|
||||
@ -938,7 +933,6 @@ public:
|
||||
debug_printf("# time = %f (%f/%d)\n", t/reps, t, (int)reps);
|
||||
|
||||
// Shut down the world
|
||||
delete &g_TexMan;
|
||||
g_VFS.reset();
|
||||
DeleteDirectory(DataDir()/"_testcache");
|
||||
CXeromyces::Terminate();
|
||||
|
Loading…
Reference in New Issue
Block a user