소스 검색

Merge pull request #101 from paulsapps/installer

fix FF7 dat dumper movement rotation reading bug and add to PC data installer
paulsapps 11 년 전
부모
커밋
520ca74000

+ 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;

+ 6 - 5
utilities/ffvii_field_dat_dumper/src/DatFile.cpp

@@ -2766,9 +2766,9 @@ DatFile::GetCamera( Ogre::Vector3& position, Ogre::Quaternion& orientation, Ogre
     matrix[ 1 ][ 2 ] = ( s16 )GetU16LE( offset_to_camera + 0x0e ) / 4096.0f;
     matrix[ 2 ][ 2 ] = ( s16 )GetU16LE( offset_to_camera + 0x12 ) / 4096.0f;
     // get camera position in camera space
-    position.x  = -( s32 )GetU32LE( offset_to_camera + 0x14 ) / downscaler;
-    position.y  = -( s32 )GetU32LE( offset_to_camera + 0x18 ) / downscaler;
-    position.z  = -( s32 )GetU32LE( offset_to_camera + 0x1c ) / downscaler;
+    position.x = -(s32)GetU32LE(offset_to_camera + 0x14);// / downscaler;
+    position.y = -(s32)GetU32LE(offset_to_camera + 0x18);// / downscaler;
+    position.z = -(s32)GetU32LE(offset_to_camera + 0x1c);// / downscaler;
 
     orientation.FromRotationMatrix( matrix );
     position = orientation * position;
@@ -3634,8 +3634,9 @@ DatFile::DumpTriggersMovements( const Ogre::String& export_path, const Field& fi
 
 
     // movement rotation
-    u32 movement = GetU32LE( offset_to_triggers + 0x08 );
-    export_script->Log( "<movement_rotation degree=\"" + Ogre::StringConverter::toString( 180.0f * ( ( float )movement - 32768.0f ) / 32768.0f ) + "\" />\n" );
+    const u8 movement = GetU8(offset_to_triggers + 0x09);
+    const float movementDegree = 180.0f * (static_cast<float>(movement) - 128.0f) / 128.0f;
+    export_script->Log( "<movement_rotation degree=\"" + Ogre::StringConverter::toString( movementDegree ) + "\" />\n" );
 
 
 

+ 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;