Load map descriptions from their XML file.

Add basic hold-fire stance, and use it for some test maps.
Add JSON data container to map XML files, to simplify the interaction
between scripts and maps.
Fix fixed-point printing so it roundtrips safely through map files.
Fix camera startup positions in old-format maps.

This was SVN commit r7844.
This commit is contained in:
Ykkrosh
2010-08-04 21:15:41 +00:00
parent a5171d9145
commit 65bcedb9fc
21 changed files with 415 additions and 28 deletions
+14 -3
View File
@@ -167,6 +167,7 @@ void CMapWriter::PackTerrain(CFilePacker& packer, CTerrain* pTerrain)
// pack tile data
packer.PackRaw(&tiles[0],sizeof(STileDesc)*tiles.size());
}
void CMapWriter::WriteXML(const VfsPath& filename,
WaterManager* pWaterMan, SkyManager* pSkyMan,
CLightEnv* pLightEnv, CCamera* pCamera, CCinemaManager* pCinema,
@@ -275,6 +276,16 @@ void CMapWriter::WriteXML(const VfsPath& filename,
}
}
if (pSimulation2)
{
std::string settings = pSimulation2->GetMapSettings();
if (!settings.empty())
{
XML_Element("ScriptSettings");
XML_CDATA(("\n" + settings + "\n").c_str());
}
}
{
XML_Element("Entities");
@@ -310,13 +321,13 @@ void CMapWriter::WriteXML(const VfsPath& filename,
CFixedVector3D rot = cmpPosition->GetRotation();
{
XML_Element("Position");
XML_Attribute("x", pos.X.ToDouble());
XML_Attribute("z", pos.Z.ToDouble());
XML_Attribute("x", pos.X);
XML_Attribute("z", pos.Z);
// TODO: height offset etc
}
{
XML_Element("Orientation");
XML_Attribute("y", rot.Y.ToDouble());
XML_Attribute("y", rot.Y);
// TODO: X, Z maybe
}
}