|
|
@@ -49,11 +49,11 @@ void FF7DataInstaller::Convert(std::string inputDir, std::string outputDir, cons
|
|
|
{
|
|
|
if (file == "field/char.lgp")
|
|
|
{
|
|
|
- /*
|
|
|
+
|
|
|
auto fullPath = inputDir + file;
|
|
|
mApp.getRoot()->addResourceLocation(fullPath, "LGP", "FFVII");
|
|
|
ConvertFieldModels(fullPath, outputDir);
|
|
|
- mApp.getRoot()->removeResourceLocation(fullPath, "FFVII");*/
|
|
|
+ mApp.getRoot()->removeResourceLocation(fullPath, "FFVII");
|
|
|
}
|
|
|
else if (file == "field/flevel.lgp")
|
|
|
{
|
|
|
@@ -131,6 +131,42 @@ void FF7DataInstaller::ConvertFieldModels(std::string archive, std::string outDi
|
|
|
*/
|
|
|
}
|
|
|
|
|
|
+static void FF7PcFieldToQGearsField(QGears::FLevelFilePtr& field, const std::string& outDir)
|
|
|
+{
|
|
|
+ // Save out the tiles as a PNG image
|
|
|
+
|
|
|
+ const QGears::BackgroundFilePtr& bg = field->getBackground();
|
|
|
+ /*
|
|
|
+ const QGears::PaletteFilePtr& pal = field->getPalette();
|
|
|
+ std::unique_ptr<Ogre::Image> bgImage(bg->createImage(pal));
|
|
|
+ bgImage->save(outDir + "/" + field->getName() + ".png");
|
|
|
+ */
|
|
|
+ QGears::BackgroundFile::Layer& layer = bg->getLayers().at(0);
|
|
|
+ const QGears::CameraMatrixFilePtr& camMatrix = field->getCameraMatrix();
|
|
|
+
|
|
|
+ // TODO: Write out the *_BG.XML data
|
|
|
+
|
|
|
+
|
|
|
+ // Save out the walk mesh as XML
|
|
|
+ const QGears::WalkmeshFilePtr& walkmesh = field->getWalkmesh();
|
|
|
+
|
|
|
+ TiXmlDocument doc;
|
|
|
+ std::unique_ptr<TiXmlElement> element(new TiXmlElement("walkmesh"));
|
|
|
+ for (QGears::WalkmeshFile::Triangle& tri : walkmesh->getTriangles())
|
|
|
+ {
|
|
|
+ std::unique_ptr<TiXmlElement> xmlElement(new TiXmlElement("triangle"));
|
|
|
+ xmlElement->SetAttribute("a", Ogre::StringConverter::toString(tri.a));
|
|
|
+ xmlElement->SetAttribute("b", Ogre::StringConverter::toString(tri.b));
|
|
|
+ xmlElement->SetAttribute("c", Ogre::StringConverter::toString(tri.c));
|
|
|
+ xmlElement->SetAttribute("a_b", std::to_string(tri.access_side[0]));
|
|
|
+ xmlElement->SetAttribute("b_c", std::to_string(tri.access_side[1]));
|
|
|
+ xmlElement->SetAttribute("c_a", std::to_string(tri.access_side[2]));
|
|
|
+ element->LinkEndChild(xmlElement.release());
|
|
|
+ }
|
|
|
+ doc.LinkEndChild(element.release());
|
|
|
+ doc.SaveFile(outDir + "/" + field->getName() + "_wm.xml");
|
|
|
+}
|
|
|
+
|
|
|
void FF7DataInstaller::ConvertFields(std::string archive, std::string outDir)
|
|
|
{
|
|
|
// Everything in here is a field
|
|
|
@@ -145,12 +181,7 @@ void FF7DataInstaller::ConvertFields(std::string archive, std::string outDir)
|
|
|
//try
|
|
|
{
|
|
|
QGears::FLevelFilePtr field = QGears::LZSFLevelFileManager::getSingleton().load(resourceName, "FFVIIFields").staticCast<QGears::FLevelFile>();
|
|
|
-
|
|
|
- const QGears::BackgroundFilePtr& bg = field->getBackground();
|
|
|
- const QGears::PaletteFilePtr& pal = field->getPalette();
|
|
|
- Ogre::Image* bgImage = bg->createImage(pal);
|
|
|
- bgImage->save(outDir + "/" + field->getName() + ".png");
|
|
|
- delete bgImage;
|
|
|
+ FF7PcFieldToQGearsField(field, outDir);
|
|
|
}
|
|
|
/*
|
|
|
catch (const Ogre::Exception& ex)
|