Просмотр исходного кода

Merge pull request #77 from myst6re/master

PC Background Export fixes
paulsapps 11 лет назад
Родитель
Сommit
da85d9b298

+ 5 - 0
QGearsMain/src/data/QGearsBackgroundFile.cpp

@@ -191,6 +191,11 @@ namespace QGears
             }
             else if (data_page.value_size == 1)
             {
+                if (it->palette_page >= palette->getPages().size())
+                {
+                    Ogre::LogManager::getSingleton().stream()
+                        << "Error: palette page Index out of Bounds " << it->palette_page;
+                }
                 const PaletteFile::Page& palette_page(palette->getPage(it->palette_page));
                 for (uint16 y(SPRITE_HEIGHT); y--;)
                 {

+ 7 - 2
QGearsMain/src/data/QGearsBackgroundFileSerializer.cpp

@@ -174,6 +174,11 @@ namespace QGears
         readShort( stream, pDest.unknown_1C );
         readShort( stream, pDest.data_page );
         readShort( stream, pDest.data_page2 );
+        // when data_page2 != 0, it must be used instead of data_page
+        if ( pDest.data_page2 )
+        {
+            pDest.data_page = pDest.data_page2;
+        }
         readShort( stream, pDest.colourDepth );
         readObject( stream, pDest.unknown_24 );
         pDest.unknown_24 /= unknown_24_SCALE;
@@ -204,10 +209,10 @@ namespace QGears
         pDest.g = static_cast<float>(( colour & BIT_MASK_GREEN ) >>  6);
         pDest.b = static_cast<float>(colour & BIT_MASK_BLUE);
         pDest /= BIT_SIZE;
-        pDest.a = 0.0f;
+        pDest.a = 1.0f;
         if ( colour == 0 )
         {
-            pDest.a = 1.0f;
+            pDest.a = 0.0f;
         }
     }
 

+ 6 - 4
utilities/q-gears-launcher/src/ff7DataInstaller.cpp

@@ -47,8 +47,7 @@ void FF7DataInstaller::Convert(std::string inputDir, std::string outputDir, cons
 {
     for (const auto& file : files)
     {
-        // TODO: Comparison will be incorrect on some platforms
-        if (file == "field\\char.lgp")
+        if (file == "field/char.lgp")
         {
             /*
             auto fullPath = inputDir + file;
@@ -56,7 +55,7 @@ void FF7DataInstaller::Convert(std::string inputDir, std::string outputDir, cons
             ConvertFieldModels(fullPath, outputDir);
             mApp.getRoot()->removeResourceLocation(fullPath, "FFVII");*/
         }
-        else if (file == "field\\flevel.lgp")
+        else if (file == "field/flevel.lgp")
         {
             auto fullPath = inputDir + file;
             mApp.getRoot()->addResourceLocation(fullPath, "LGP", "FFVIIFields");
@@ -138,7 +137,10 @@ void FF7DataInstaller::ConvertFields(std::string archive, std::string outDir)
     Ogre::StringVectorPtr resources = mApp.ResMgr()->listResourceNames("FFVIIFields", "*");
     for (auto& resourceName : *resources)
     {
-        if (!QGears::StringUtil::endsWith(resourceName, ".tex") /*&& resourceName == "blin67_4"*/)
+        if (!QGears::StringUtil::endsWith(resourceName, ".tex")
+         && !QGears::StringUtil::endsWith(resourceName, ".tut")
+         && !QGears::StringUtil::endsWith(resourceName, ".siz")
+         && resourceName != "maplist" /*&& resourceName == "blin67_4"*/)
         {
             //try
             {

+ 2 - 2
utilities/q-gears-launcher/src/mainwindow.cpp

@@ -143,8 +143,8 @@ void MainWindow::on_btnGO_clicked()
 
 		// TODO: Enumerate files or find some better way to do this :)
 		std::vector<std::string> vec;
-		vec.push_back(QDir::toNativeSeparators("field/char.lgp").toStdString());
-		vec.push_back(QDir::toNativeSeparators("field/flevel.lgp").toStdString());
+		vec.push_back(QString("field/char.lgp").toStdString());
+		vec.push_back(QString("field/flevel.lgp").toStdString());
 
 		FF7DataInstaller conversion;
 		conversion.Convert(QDir::toNativeSeparators(input).toStdString(), QDir::toNativeSeparators(output).toStdString(), vec);