Explorar o código

Adds movement_rotation to installed PC data

Paul %!s(int64=11) %!d(string=hai) anos
pai
achega
e2b0563b7a

+ 6 - 0
QGearsMain/include/data/QGearsTriggersFile.h

@@ -53,6 +53,12 @@ namespace QGears
             return mData->camera_range;
         }
 
+        float MovementRotation() const
+        {
+            // This is the angle in which the player moves when "up" is pressed
+            return 180.0f * (static_cast<float>(mData->control) - 128.0f) / 128.0f;
+        }
+
     protected:
         virtual void loadImpl(void) override;
         virtual void unloadImpl(void) override;

+ 8 - 2
utilities/q-gears-launcher/src/ff7DataInstaller.cpp

@@ -181,6 +181,8 @@ static void FF7PcFieldToQGearsField(QGears::FLevelFilePtr& field, const std::str
     // TODO: Insert triggers into LUA script
     //const QGears::ModelListFilePtr& models = field->getModelList();
     //const QGears::ModelListFile::ModelDescription& desc = models->getModels().at(0);
+    
+    const QGears::TriggersFilePtr& triggers = field->getTriggers();
 
     // Write out the map file which links all the other files together for a given field
     {
@@ -202,7 +204,11 @@ static void FF7PcFieldToQGearsField(QGears::FLevelFilePtr& field, const std::str
         xmlWalkmesh->SetAttribute("file_name", field->getName() + "_wm.xml");
         element->LinkEndChild(xmlWalkmesh.release());
 
-        // TODO: movement_rotation - degree
+
+        std::unique_ptr<TiXmlElement> xmlMovementRotation(new TiXmlElement("movement_rotation"));
+        xmlMovementRotation->SetAttribute("degree", std::to_string(triggers->MovementRotation()));
+        element->LinkEndChild(xmlMovementRotation.release());
+
         // TODO: entity_script - name
         // TODO: entity_model - name, file_name,  position, direction
         // TODO: entity_trigger - name, point1, point2, enabled
@@ -236,7 +242,7 @@ static void FF7PcFieldToQGearsField(QGears::FLevelFilePtr& field, const std::str
         const Ogre::Quaternion orientation = camMatrix->getOrientation();
         const Ogre::Degree fov = camMatrix->getFov(static_cast<float>(kPsxScreenHeight));
 
-        const QGears::TriggersFilePtr& triggers = field->getTriggers();
+     
         const int min_x = triggers->getCameraRange().left * kScaleUpFactor;
         const int min_y = triggers->getCameraRange().top * kScaleUpFactor;
         const int max_x = triggers->getCameraRange().right * kScaleUpFactor;