Browse Source

Several game and installer improvements:
- The playable entity turns solid when manually moved. This makes it able to interact with lines in bugged fields.
- Line script indexes properly set.
- Improved the way line entity data is passed around between classes and functions.
- Entities can be assigned to characters, and retrieved by character ID.
- Field script output messages are now printed to console too.
- Expanded character name lookup table.
- Implemented opcodes: BITOFF, IFKEYON, IFKEYOFF, JOIN and SPLIT.
- Code formatting.
- Code documentation.
- Updated configuration and resource files.

Iñigo Valentin 3 years ago
parent
commit
0a55786ba6

+ 7 - 6
V-Gears-Installer/src/ff7DataInstaller.cpp

@@ -770,20 +770,21 @@ static void FF7PcFieldToQGearsField(
         // Get lines. Add them to a list, so they aren't processed later as regular entities.
         std::vector<std::string> line_entities;
         for (SUDM::FF7::Field::Line line : decompiled.lines){
+
             std::unique_ptr<TiXmlElement> xml_entity_trigger(new TiXmlElement("entity_trigger"));
             line_entities.push_back(line.name);
             xml_entity_trigger->SetAttribute("name", line.name);
             xml_entity_trigger->SetAttribute(
               "point1",
-              std::to_string(line.ax * FF7DataInstaller::LINE_SCALE_FACTOR)
-                + " " + std::to_string(line.ay * FF7DataInstaller::LINE_SCALE_FACTOR)
-                + " " + std::to_string(line.az * FF7DataInstaller::LINE_SCALE_FACTOR)
+              std::to_string(line.point_a[0] * FF7DataInstaller::LINE_SCALE_FACTOR)
+                + " " + std::to_string(line.point_a[1] * FF7DataInstaller::LINE_SCALE_FACTOR)
+                + " " + std::to_string(line.point_a[2] * FF7DataInstaller::LINE_SCALE_FACTOR)
             );
             xml_entity_trigger->SetAttribute(
               "point2",
-              std::to_string(line.bx * FF7DataInstaller::LINE_SCALE_FACTOR)
-                + " " + std::to_string(line.by * FF7DataInstaller::LINE_SCALE_FACTOR)
-                + " " + std::to_string(line.bz * FF7DataInstaller::LINE_SCALE_FACTOR)
+              std::to_string(line.point_b[0] * FF7DataInstaller::LINE_SCALE_FACTOR)
+                + " " + std::to_string(line.point_b[1] * FF7DataInstaller::LINE_SCALE_FACTOR)
+                + " " + std::to_string(line.point_b[2] * FF7DataInstaller::LINE_SCALE_FACTOR)
             );
             xml_entity_trigger->SetAttribute("enabled", "true");
             element->LinkEndChild(xml_entity_trigger.release());

+ 41 - 0
V-Gears/include/core/Entity.h

@@ -1002,6 +1002,41 @@ class Entity{
          */
         int ScriptAnimationSync();
 
+        /**
+         * Assigns the entity as a character.
+         *
+         * Marks the entity as a character, and assigns a character name and
+         * ID.
+         *
+         * @param character_name[in] The character name.
+         */
+        void SetCharacter(const char* character_name);
+
+        /**
+         * Checks if the entity is a character.
+         *
+         * An entity is not a character until {@see SetCharacter} has been
+         * called.
+         *
+         * @return True if the entity is a character, false otherwise.
+         */
+        bool IsCharacter();
+
+        /**
+         * Retrieves the entity's character ID.
+         *
+         * @return The character ID, or 0 if the entity is not a character.
+         */
+        uint GetCharacterId();
+
+        /**
+         * Retrieves the entity's character name.
+         *
+         * @return The character name, or an empty string if the entity is not
+         * a character.
+         */
+        std::string GetCharacterName();
+
     protected:
 
         /**
@@ -1303,5 +1338,11 @@ class Entity{
          * @return Angular distance to the specified entity.
          */
         Ogre::Degree GetDirectionToEntity(Entity* entity) const;
+
+        bool is_character_;
+
+        uint character_id_;
+
+        std::string character_name_;
 };
 

+ 50 - 3
V-Gears/include/core/EntityManager.h

@@ -185,6 +185,15 @@ class EntityManager : public Ogre::Singleton<EntityManager>{
          */
         Entity* GetEntity(const Ogre::String& name) const;
 
+        /**
+         * Retrieves an entity by it's assigned character ID.
+         *
+         * @param id[in] Character ID of the entity to retrieve.
+         * @return The entity assigned to the character, or nullptr if there
+         * is no one.
+         */
+        Entity* GetEntityFromCharacterId(const char* id) const;
+
         /**
          * Retrieves an entity by name.
          *
@@ -214,6 +223,13 @@ class EntityManager : public Ogre::Singleton<EntityManager>{
          */
         void ScriptSetPlayerEntity(const char* name);
 
+        /**
+         * Retrieves the playable entity.
+         *
+         * @return The playable entity.
+         */
+        Entity* ScriptGetPlayerEntity() const;
+
         /**
          * Unsets any playable entities.
          */
@@ -281,6 +297,31 @@ class EntityManager : public Ogre::Singleton<EntityManager>{
          */
         void StartBattle(unsigned int formation);
 
+        /**
+         * Checks if a key is being pressed.
+         *
+         * @param key_code[in] The code of the key to test.
+         * @return True if the key is being pressed, false otherwise.
+         */
+        bool IsKeyOn(unsigned int key_code);
+
+        /**
+         * Checks if a key is not being pressed.
+         *
+         * @param key_code[in] The code of the key to test.
+         * @return False if the key is being pressed, true otherwise.
+         */
+        bool IsKeyOn(unsigned int key_code);
+
+        /**
+         * Assigns a character to an entity.
+         *
+         * @param entity_name[in] The entity name.
+         * @param character name[in] The character name. Usually the same as
+         * the entity.
+         */
+        void SetEntityToCharacter(const char* entity_name, const char* character_name);
+
     private:
 
         /**
@@ -421,12 +462,16 @@ class EntityManager : public Ogre::Singleton<EntityManager>{
         Entity* player_entity_;
 
         /**
-         * @todo Understand and document.
+         * The playable entity current movement indicator.
+         *
+         * Applies only for manual movement.
          */
         Ogre::Vector3 player_move_;
 
         /**
-         * @todo Understand and document.
+         * The playable entity current movement turn indicator.
+         *
+         * Applies only for manual movement.
          */
         Ogre::Radian player_move_rotation_;
 
@@ -436,7 +481,9 @@ class EntityManager : public Ogre::Singleton<EntityManager>{
         bool player_lock_;
 
         /**
-         * @todo Understand and document.
+         * Indicates if the playable is being moved by running.
+         *
+         * Applies only for manual movement.
          */
         bool player_run_;
 

+ 101 - 251
V-Gears/include/core/ScriptManagerBinds.h

@@ -32,6 +32,7 @@
  * @param text[in] The text to be printed.
  */
 void ScriptPrint(const char* text){
+    std::cout << "[SCRIPT] " << text << std::endl;
     Console::getSingleton().AddTextToOutput(text);
 }
 
@@ -65,8 +66,6 @@ void ScriptConsole(const char* text){
 
 void ScriptManager::InitBinds(){
 
-    std::cout << "[INIT BINDS] Begin " << std::endl;
-
     // Global functions.
     luabind::module(lua_state_)[
         luabind::def("print", (void(*)(const char*)) &ScriptPrint),
@@ -79,134 +78,75 @@ void ScriptManager::InitBinds(){
         luabind::class_<Entity>("Entity")
           .def(
             "set_position",
-            (void(Entity::*)(const float, const float, const float))
-              &Entity::ScriptSetPosition
+            (void(Entity::*)(const float, const float, const float)) &Entity::ScriptSetPosition
           )
           // Internally returns 3 values:
           .def("get_position", (void(Entity::*)()) &Entity::ScriptGetPosition)
-          .def(
-            "set_rotation",
-            (void(Entity::*)(const float)) &Entity::ScriptSetRotation
-          )
+          .def("set_rotation", (void(Entity::*)(const float)) &Entity::ScriptSetRotation)
           .def("get_rotation", (float(Entity::*)()) &Entity::ScriptGetRotation)
-          .def(
-            "set_solid_radius",
-            (void(Entity::*)(const float)) &Entity::SetSolidRadius
-          )
+          .def("set_solid_radius", (void(Entity::*)(const float)) &Entity::SetSolidRadius)
           .def("get_solid_radius", (float(Entity::*)()) &Entity::GetSolidRadius)
           .def("set_solid", (void(Entity::*)(const bool)) &Entity::SetSolid)
           .def("is_solid", (bool(Entity::*)()) &Entity::IsSolid)
-          .def(
-            "set_talk_radius",
-            (void(Entity::*)(const float)) &Entity::SetTalkRadius
-          )
+          .def("set_talk_radius", (void(Entity::*)(const float)) &Entity::SetTalkRadius)
           .def("get_talk_radius", (float(Entity::*)()) &Entity::GetTalkRadius)
           // Some old test script use this, its just an alias for SetTalkable:
-          .def(
-            "set_interactable",
-            (void(Entity::*)(const bool)) &Entity::SetTalkable
-          )
-          .def(
-            "set_talkable",
-            (void(Entity::*)(const bool)) &Entity::SetTalkable
-          )
+          .def("set_interactable", (void(Entity::*)(const bool)) &Entity::SetTalkable)
+          .def("set_talkable", (void(Entity::*)(const bool)) &Entity::SetTalkable)
           .def("is_talkable", (bool(Entity::*)()) &Entity::IsTalkable)
           .def("set_visible", (void(Entity::*)(const bool)) &Entity::SetVisible)
           .def("is_visible", (bool(Entity::*)()) &Entity::IsVisible)
-          .def(
-            "set_move_auto_speed",
-            (void(Entity::*)(const float)) &Entity::SetMoveAutoSpeed
-          )
-          .def(
-            "get_move_auto_speed",
-            (float(Entity::*)()) &Entity::GetMoveAutoSpeed
-          )
-          .def(
-            "get_move_triangle_id",
-            (int(Entity::*)()) &Entity::GetMoveTriangleId
-          )
-          .def(
-            "move_auto_rotation",
-            (void(Entity::*)(const bool)) &Entity::SetMoveAutoRotation
-          )
-          .def(
-            "move_auto_animation",
-            (void(Entity::*)(const bool)) &Entity::SetMoveAutoAnimation
-          )
+          .def("set_move_auto_speed", (void(Entity::*)(const float)) &Entity::SetMoveAutoSpeed)
+          .def("get_move_auto_speed", (float(Entity::*)()) &Entity::GetMoveAutoSpeed)
+          .def("get_move_triangle_id", (int(Entity::*)()) &Entity::GetMoveTriangleId)
+          .def("move_auto_rotation", (void(Entity::*)(const bool)) &Entity::SetMoveAutoRotation)
+          .def("move_auto_animation", (void(Entity::*)(const bool)) &Entity::SetMoveAutoAnimation)
           .def(
             "move_to_position",
-            (void(Entity::*)(const float, const float))
-              &Entity::ScriptMoveToPosition
-            )
-          .def(
-            "move_to_entity",
-            (void(Entity::*)(Entity*)) &Entity::ScriptMoveToEntity
-          )
-          .def(
-            "move_sync",
-            (int(Entity::*)()) &Entity::ScriptMoveSync, luabind::yield
+            (void(Entity::*)(const float, const float)) &Entity::ScriptMoveToPosition
           )
+          .def("move_to_entity", (void(Entity::*)(Entity*)) &Entity::ScriptMoveToEntity)
+          .def("move_sync", (int(Entity::*)()) &Entity::ScriptMoveSync, luabind::yield)
           .def(
             "linear_to_position",
             (void(Entity::*)(
-              const float, const float, const float,
-              const LinearMovement, const char*
-            )) &Entity::ScriptLinearToPosition)
+              const float, const float, const float, const LinearMovement, const char*
+            )) &Entity::ScriptLinearToPosition
+          )
           .def(
-            "linear_sync",
-            (int(Entity::*)()) &Entity::ScriptLinearSync, luabind::yield
+            "linear_sync", (int(Entity::*)()) &Entity::ScriptLinearSync, luabind::yield
           )
           .def(
             "jump_to_position",
-            (void(Entity::*)(
-               const float, const float, const float, const float
-             ))&Entity::ScriptJumpToPosition
-           )
-          .def(
-            "jump_sync",
-            (int(Entity::*)()) &Entity::ScriptJumpSync, luabind::yield
+            (void(Entity::*)(const float, const float, const float, const float))
+              &Entity::ScriptJumpToPosition
           )
+          .def("jump_sync", (int(Entity::*)()) &Entity::ScriptJumpSync, luabind::yield)
           .def(
             "offset_to_position",
-            (void(Entity::*)(
-              const float, const float, const float,
-              const ActionType, const float
-            )) &Entity::ScriptOffsetToPosition
-          )
-          .def(
-            "offset_sync",
-            (int(Entity::*)()) &Entity::ScriptOffsetSync, luabind::yield
+            (void(Entity::*)(const float, const float, const float, const ActionType, const float))
+              &Entity::ScriptOffsetToPosition
           )
+          .def("offset_sync", (int(Entity::*)()) &Entity::ScriptOffsetSync, luabind::yield)
           .def(
             "turn_to_entity",
-            (void(Entity::*)(Entity*, const TurnDirection, const float))
-              &Entity::ScriptTurnToEntity
+            (void(Entity::*)(Entity*, const TurnDirection, const float)) &Entity::ScriptTurnToEntity
           )
           .def(
-            "turn_to_direction",
-            (void(Entity::*)(
-               const float, const TurnDirection, const ActionType, const float
-            )) &Entity::ScriptTurnToDirection)
-          .def(
-            "turn_sync",
-            (int(Entity::*)()) &Entity::ScriptTurnSync, luabind::yield
-          )
+            "turn_to_direction", (
+              void(Entity::*)(const float, const TurnDirection, const ActionType, const float)
+            ) &Entity::ScriptTurnToDirection)
+          .def("turn_sync", (int(Entity::*)()) &Entity::ScriptTurnSync, luabind::yield)
           .def(
-            "set_animation_speed",
-            (void(Entity::*)(const float)) &Entity::ScriptSetAnimationSpeed
-          )
-          .def(
-            "play_animation",
-            (void(Entity::*)(const char*)) &Entity::ScriptPlayAnimation
+            "set_animation_speed", (void(Entity::*)(const float)) &Entity::ScriptSetAnimationSpeed
           )
+          .def("play_animation", (void(Entity::*)(const char*)) &Entity::ScriptPlayAnimation)
           .def(
-            "play_animation_stop",
-            (void(Entity::*)(const char*)) &Entity::ScriptPlayAnimationStop
+            "play_animation_stop", (void(Entity::*)(const char*)) &Entity::ScriptPlayAnimationStop
           )
           .def(
             "play_animation",
-            (void(Entity::*)(const char*, const float, const float))
-              &Entity::ScriptPlayAnimation
+            (void(Entity::*)(const char*, const float, const float)) &Entity::ScriptPlayAnimation
           )
           .def(
             "play_animation_stop",
@@ -217,10 +157,7 @@ void ScriptManager::InitBinds(){
             "set_default_animation",
             (void(Entity::*)(const char*)) &Entity::ScriptSetDefaultAnimation
           )
-          .def(
-            "animation_sync",
-            (int(Entity::*)()) &Entity::ScriptAnimationSync, luabind::yield
-          )
+          .def("animation_sync", (int(Entity::*)()) &Entity::ScriptAnimationSync, luabind::yield)
           .enum_("constants")[
              luabind::value("NONE", AT_NONE),
              luabind::value("LINEAR", AT_LINEAR),
@@ -243,86 +180,71 @@ void ScriptManager::InitBinds(){
             "random_encounters_on",
             (float(EntityManager::*)(bool)) &EntityManager::SetRandomEncounters
           )
-          .def(
-            "start_battle",
-            (void(EntityManager::*)(unsigned int)) &EntityManager::StartBattle
-          )
+          .def("start_battle", (void(EntityManager::*)(unsigned int)) &EntityManager::StartBattle)
           // TODO: Run? Set battle flags
-          .def(
-            "battle_run",
-            (void(EntityManager::*)(unsigned int)) &EntityManager::StartBattle
-          )
+          .def("battle_run", (void(EntityManager::*)(unsigned int)) &EntityManager::StartBattle)
     ];
 
     // Entity individual point commands
     luabind::module(lua_state_)[
         luabind::class_< EntityPoint >("EntityPoint")
-          .def( // Internally returns 3 values:
-            "get_position",
-            (void(EntityPoint::*)()) &EntityPoint::ScriptGetPosition
-          )
-          .def(
-            "get_rotation",
-            (float(EntityPoint::*)()) &EntityPoint::ScriptGetRotation
-          )
+          // Internally returns 3 values:
+          .def("get_position", (void(EntityPoint::*)()) &EntityPoint::ScriptGetPosition)
+          .def("get_rotation", (float(EntityPoint::*)()) &EntityPoint::ScriptGetRotation)
     ];
 
     // Commands for the entity manager, not related to any particular entity.
     luabind::module(lua_state_)[
         luabind::class_<EntityManager>("EntityManager")
-          .def(
-             "set_paused",
-             (void(EntityManager::*)(const bool))
-               &EntityManager::ScriptSetPaused
-          )
+          .def("set_paused", (void(EntityManager::*)(const bool)) &EntityManager::ScriptSetPaused)
           .def(
              "add_entity",
              (void(EntityManager::*)(
-               const char*, const char*, const float,
-               const float, const float, const float
+               const char*, const char*, const float, const float, const float, const float
              )) &EntityManager::ScriptAddEntity
           )
           .def(
              "add_entity_script",
-             (void(EntityManager::*)(const char*))
-               &EntityManager::ScriptAddEntityScript
+             (void(EntityManager::*)(const char*)) &EntityManager::ScriptAddEntityScript
           )
           .def(
-             "get_entity",
-             (Entity*(EntityManager::*)(const char*))
-             &EntityManager::ScriptGetEntity
+             "get_entity", (Entity*(EntityManager::*)(const char*)) &EntityManager::ScriptGetEntity
+          )
+          .def(
+             "get_entity_from_character_id",
+             (Entity*(EntityManager::*)(const char*)) &EntityManager::GetEntityFromCharacterId
           )
           .def(
              "get_entity_point",
-             (EntityPoint*(EntityManager::*)(const char*))
-             &EntityManager::ScriptGetEntityPoint
+             (EntityPoint*(EntityManager::*)(const char*)) &EntityManager::ScriptGetEntityPoint
           )
           .def(
              "set_player_entity",
-             (void(EntityManager::*)(const char*))
-               &EntityManager::ScriptSetPlayerEntity
+             (void(EntityManager::*)(const char*)) &EntityManager::ScriptSetPlayerEntity
           )
+          .def(
+               "get_player_entity",
+               (Entity*(EntityManager::*)()) &EntityManager::ScriptGetPlayerEntity
+            )
           .def(
             "unset_player_entity",
             (void(EntityManager::*)()) &EntityManager::ScriptUnsetPlayerEntity
           )
           .def(
-            "player_lock",
-            (void(EntityManager::*)(const bool))
-              &EntityManager::ScriptPlayerLock
+            "player_lock", (void(EntityManager::*)(const bool)) &EntityManager::ScriptPlayerLock
           )
           .def(
             "random_encounters_on",
             (float(EntityManager::*)(bool)) &EntityManager::SetRandomEncounters
           )
-          .def(
-            "start_battle",
-            (void(EntityManager::*)(unsigned int)) &EntityManager::StartBattle
-          )
+          .def("start_battle", (void(EntityManager::*)(unsigned int)) &EntityManager::StartBattle)
           // TODO: Run? Set battle flags
+          .def("battle_run", (void(EntityManager::*)(unsigned int)) &EntityManager::StartBattle)
+          .def("is_key_on", (bool(EntityManager::*)(unsigned int)) &EntityManager::IsKeyOn)
+          .def("is_key_off", (bool(EntityManager::*)(unsigned int)) &EntityManager::IsKeyOff)
           .def(
-            "battle_run",
-            (void(EntityManager::*)(unsigned int)) &EntityManager::StartBattle
+            "set_entity_to_character",
+            (void(EntityManager::*)(const char*, const char*)) &EntityManager::SetEntityToCharacter
           )
     ];
 
@@ -331,35 +253,28 @@ void ScriptManager::InitBinds(){
         luabind::class_<Background2D>("Background2D")
           .def(
             "autoscroll_to_entity",
-            (void(Background2D::*)(Entity*))
-              &Background2D::ScriptAutoScrollToEntity
+            (void(Background2D::*)(Entity*)) &Background2D::ScriptAutoScrollToEntity
           )
           .def(
             "scroll_to_position",
             (void(Background2D::*)(
-              const float, const float,
-              const Background2D::ScrollType, const float
+              const float, const float, const Background2D::ScrollType, const float
             )) &Background2D::ScriptScrollToPosition
           )
           .def(
-            "scroll_sync",
-            (int(Background2D::*)()) &Background2D::ScriptScrollSync,
-            luabind::yield
+            "scroll_sync", (int(Background2D::*)()) &Background2D::ScriptScrollSync, luabind::yield
           )
           .def(
             "play_animation_looped",
-            (void(Background2D::*)(const char*))
-              &Background2D::ScriptPlayAnimationLooped
+            (void(Background2D::*)(const char*)) &Background2D::ScriptPlayAnimationLooped
           )
           .def(
             "play_animation_once",
-            (void(Background2D::*)(const char*))
-              &Background2D::ScriptPlayAnimationOnce
+            (void(Background2D::*)(const char*)) &Background2D::ScriptPlayAnimationOnce
           )
           .def(
             "animation_sync",
-            (int(Background2D::*)(const char*))
-              &Background2D::ScriptAnimationSync,
+            (int(Background2D::*)(const char*)) &Background2D::ScriptAnimationSync,
             luabind::yield
           )
           .enum_("constants")[
@@ -372,13 +287,8 @@ void ScriptManager::InitBinds(){
     // Walkmesh commands
     luabind::module(lua_state_)[
         luabind::class_<Walkmesh>("Walkmesh")
-          .def(
-            "lock_walkmesh",
-            (void(Walkmesh ::*)(unsigned int, bool)) &Walkmesh ::LockWalkmesh
-          )
-          .def(
-            "is_locked", (bool(Walkmesh ::*)(unsigned int)) &Walkmesh ::IsLocked
-          )
+          .def("lock_walkmesh", (void(Walkmesh ::*)(unsigned int, bool)) &Walkmesh ::LockWalkmesh)
+          .def("is_locked", (bool(Walkmesh ::*)(unsigned int)) &Walkmesh ::IsLocked)
     ];
 
     // Dialog commands
@@ -386,23 +296,18 @@ void ScriptManager::InitBinds(){
         luabind::class_<DialogsManager>("Dialog")
           .def(
             "dialog_open",
-            (void(DialogsManager::*)(const char*, int, int, int, int))
-              &DialogsManager::OpenDialog
+            (void(DialogsManager::*)(const char*, int, int, int, int)) &DialogsManager::OpenDialog
           )
           .def(
             "dialog_set_text",
-            (void(DialogsManager::*)(const char*, const char*))
-              &DialogsManager::SetText
+            (void(DialogsManager::*)(const char*, const char*)) &DialogsManager::SetText
           )
           .def(
             "dialog_wait_for_close",
             (int(DialogsManager::*)(const char*)) &DialogsManager::Sync,
             luabind::yield
           )
-          .def(
-            "dialog_close",
-            (void(DialogsManager::*)(const char*)) &DialogsManager::Hide
-          )
+          .def("dialog_close", (void(DialogsManager::*)(const char*)) &DialogsManager::Hide)
           .def(
             "set_variable",
             (void(DialogsManager::*)(const char*, const char*, const char*))
@@ -410,19 +315,13 @@ void ScriptManager::InitBinds(){
           )
           .def(
             "set_clickable",
-            (void(DialogsManager::*)(const char*, const bool))
-              &DialogsManager::SetClickable
+            (void(DialogsManager::*)(const char*, const bool)) &DialogsManager::SetClickable
           )
           .def(
             "set_cursor",
-            (void(DialogsManager::*)(const char*, const int, const int))
-              &DialogsManager::SetCursor
-          )
-          .def(
-            "get_cursor",
-            (int(DialogsManager::*)(const char*))
-              &DialogsManager::GetCursor
+            (void(DialogsManager::*)(const char*, const int, const int)) &DialogsManager::SetCursor
           )
+          .def("get_cursor", (int(DialogsManager::*)(const char*)) &DialogsManager::GetCursor)
           .enum_("constants")[
             luabind::value("SOLID", MSL_SOLID),
             luabind::value("TRANSPARENT", MSL_TRANSPARENT),
@@ -433,18 +332,9 @@ void ScriptManager::InitBinds(){
     // UI widget commands
     luabind::module(lua_state_)[
         luabind::class_<UiWidget>("UiWidget")
-          .def(
-            "set_visible",
-            (void(UiWidget::*)(const bool)) &UiWidget::SetVisible
-          )
-          .def(
-            "is_visible",
-            (bool(UiWidget::*)()) &UiWidget::IsVisible
-          )
-          .def(
-            "play_animation",
-            (void(UiWidget::*)(const char*)) &UiWidget::ScriptPlayAnimation
-          )
+          .def("set_visible", (void(UiWidget::*)(const bool)) &UiWidget::SetVisible)
+          .def("is_visible", (bool(UiWidget::*)()) &UiWidget::IsVisible)
+          .def("play_animation", (void(UiWidget::*)(const char*)) &UiWidget::ScriptPlayAnimation)
           .def(
             "play_animation_stop",
             (void(UiWidget::*)(const char*)) &UiWidget::ScriptPlayAnimationStop
@@ -461,59 +351,33 @@ void ScriptManager::InitBinds(){
           )
           .def(
             "set_default_animation",
-            (void(UiWidget::*)(const char*))
-              &UiWidget::ScriptSetDefaultAnimation
+            (void(UiWidget::*)(const char*)) &UiWidget::ScriptSetDefaultAnimation
           )
           .def(
-            "animation_sync",
-            (int(UiWidget::*)()) &UiWidget::ScriptAnimationSync, luabind::yield
+            "animation_sync", (int(UiWidget::*)()) &UiWidget::ScriptAnimationSync, luabind::yield
           )
           .def(
             "set_colour",
-            (void(UiWidget::*)(const float, const float, const float))
-            &UiWidget::SetColour
-          )
-          .def(
-            "set_alpha",
-            (void(UiWidget::*)(const float)) &UiWidget::SetAlpha
-          )
-          .def(
-            "set_x",
-            (void(UiWidget::*)(const float, const float)) &UiWidget::SetX
-          )
-          .def(
-            "set_y", (void(UiWidget::*)(const float, const float))
-            &UiWidget::SetY
-          )
-          .def(
-            "set_z",
-            (void(UiWidget::*)(const float)) &UiWidget::SetZ
-          )
-          .def(
-            "set_width", (void(UiWidget::*)(const float, const float))
-            &UiWidget::SetWidth
-          )
-          .def(
-            "set_height",
-            (void(UiWidget::*)(const float, const float)) &UiWidget::SetHeight
-          )
+            (void(UiWidget::*)(const float, const float, const float)) &UiWidget::SetColour
+          )
+          .def("set_alpha", (void(UiWidget::*)(const float)) &UiWidget::SetAlpha)
+          .def("set_x", (void(UiWidget::*)(const float, const float)) &UiWidget::SetX)
+          .def("set_y", (void(UiWidget::*)(const float, const float)) &UiWidget::SetY)
+          .def("set_z", (void(UiWidget::*)(const float)) &UiWidget::SetZ)
+          .def("set_width", (void(UiWidget::*)(const float, const float)) &UiWidget::SetWidth)
+          .def("set_height", (void(UiWidget::*)(const float, const float)) &UiWidget::SetHeight)
     ];
 
     // UI manager commands. Use to get a specific widget.
     luabind::module(lua_state_)[
         luabind::class_<UiManager>("UiManager")
-          .def(
-            "get_widget",
-            (UiWidget*(UiManager::*)(const char*)) &UiManager::ScriptGetWidget
-          )
+          .def("get_widget", (UiWidget*(UiManager::*)(const char*)) &UiManager::ScriptGetWidget)
     ];
 
     // Timer command. To show a in-game timer.
     luabind::module(lua_state_)[
         luabind::class_<Timer>("Timer")
-          .def(
-            "get_game_time_total", (float(Timer::*)()) &Timer::GetGameTimeTotal
-          )
+          .def("get_game_time_total", (float(Timer::*)()) &Timer::GetGameTimeTotal)
           .def("set_timer", (float(Timer::*)(const float)) &Timer::SetGameTimer)
           .def("get_timer", (int(Timer::*)()) &Timer::GetGameTimer)
     ];
@@ -522,28 +386,23 @@ void ScriptManager::InitBinds(){
     luabind::module(lua_state_)[
         luabind::class_<ScriptManager>("Script")
           .def(
-            "wait",
-            (int(ScriptManager::*)(const float)) &ScriptManager::ScriptWait,
-            luabind::yield
+            "wait", (int(ScriptManager::*)(const float)) &ScriptManager::ScriptWait, luabind::yield
           )
           .def(
             "request",
-            (void(ScriptManager::*)(
-              const ScriptManager::Type, const char*, const char*, const int
-            )) &ScriptManager::ScriptRequest
+            (void(ScriptManager::*)(const ScriptManager::Type, const char*, const char*, const int))
+              &ScriptManager::ScriptRequest
           )
           .def(
             "request_start_sync",
-            (int(ScriptManager::*)(
-              const ScriptManager::Type, const char*, const char*, const int
-            )) &ScriptManager::ScriptRequestStartSync,
+            (int(ScriptManager::*)(const ScriptManager::Type, const char*, const char*, const int))
+              &ScriptManager::ScriptRequestStartSync,
             luabind::yield
           )
           .def(
             "request_end_sync",
-            (int(ScriptManager::*)
-              (const ScriptManager::Type, const char*, const char*, const int))
-                &ScriptManager::ScriptRequestEndSync,
+            (int(ScriptManager::*) (const ScriptManager::Type, const char*, const char*, const int))
+              &ScriptManager::ScriptRequestEndSync,
             luabind::yield
           )
           .enum_("constants")[
@@ -556,10 +415,7 @@ void ScriptManager::InitBinds(){
     // Commnds to initiate modules
     luabind::module(lua_state_)[
         luabind::class_<QGears::WorldMapModule>("world_map_module")
-          .def(
-            "init",
-            (void(QGears::WorldMapModule::*)()) &QGears::WorldMapModule::Init
-          )
+          .def("init", (void(QGears::WorldMapModule::*)()) &QGears::WorldMapModule::Init)
     ];
 
     // Register all command handlers
@@ -572,16 +428,10 @@ void ScriptManager::InitBinds(){
       = boost::ref(*(EntityManager::getSingletonPtr()->GetBackground2D()));
     luabind::globals(lua_state_)["walkmesh"]
       = boost::ref(*(EntityManager::getSingletonPtr()->GetWalkmesh()));
-    luabind::globals(lua_state_)["dialog"]
-      = boost::ref(*(DialogsManager::getSingletonPtr()));
-    luabind::globals(lua_state_)["ui_manager"]
-      = boost::ref(*(UiManager::getSingletonPtr()));
+    luabind::globals(lua_state_)["dialog"] = boost::ref(*(DialogsManager::getSingletonPtr()));
+    luabind::globals(lua_state_)["ui_manager"] = boost::ref(*(UiManager::getSingletonPtr()));
     luabind::globals(lua_state_)["world_map_module"]
       = boost::ref(*(QGears::WorldMapModule::getSingletonPtr()));
-    luabind::globals(lua_state_)["timer"]
-      = boost::ref(*(Timer::getSingletonPtr()));
+    luabind::globals(lua_state_)["timer"] = boost::ref(*(Timer::getSingletonPtr()));
     luabind::globals(lua_state_)["script"] = boost::ref(*this);
-
-    std::cout << "[INIT BINDS] END " << std::endl;
-
 }

+ 1 - 4
V-Gears/include/data/QGearsTriggersFile.h

@@ -402,10 +402,7 @@ namespace QGears{
              * @return The movement rotation.
              */
             float MovementRotation() const{
-                return
-                  180.0f
-                  * (static_cast<float>(trigger_data_->control) - 128.0f)
-                  / 128.0f;
+                return 180.0f * (static_cast<float>(trigger_data_->control) - 128.0f) / 128.0f;
             }
 
             /**

+ 31 - 1
V-Gears/src/FF7Character.cpp

@@ -24,24 +24,54 @@ namespace FFVII{
 
     Character::CharacterIdLookupMap Character::CreateLookupMap(){
         CharacterIdLookupMap lookup;
+        lookup["Cloud"] = CLOUD;
+        lookup["cloud"] = CLOUD;
+        lookup["CLOUD"] = CLOUD;
         lookup["AAAA"] = CLOUD;
         lookup["n_cloud"] = CLOUD;
+        lookup["Tifa"] = TIFA;
+        lookup["tifa"] = TIFA;
+        lookup["TIFA"] = TIFA;
         lookup["AAGB"] = TIFA;
         lookup["n_tifa"] = TIFA;
+        lookup["Aeris"] = AERIS;
+        lookup["AERIS"] = AERIS;
+        lookup["aerit"] = AERIS;
         lookup["AUFF"] = AERIS;
         lookup["CAHC"] = AERIS;
         lookup["n_erith"] = AERIS;
         lookup["earithf"] = AERIS;
+        lookup["Barret"] = BARRET;
+        lookup["barret"] = BARRET;
+        lookup["BARRET"] = BARRET;
         lookup["ACGD"] = BARRET;
         lookup["ballet"] = BARRET;
+        lookup["Red"] = RED;
+        lookup["red"] = RED;
+        lookup["RED"] = RED;
+        lookup["Red XIII"] = RED;
+        lookup["RedXIII"] = RED;
         lookup["ADDA"] = RED;
         lookup["red"] = RED;
-        lookup["ABDA"] = CID;
+        lookup["Cid"] = CID;
+        lookup["CID"] = CID;
         lookup["cid"] = CID;
+        lookup["ABDA"] = CID;
         lookup["AEHD"] = VINCENT;
+        lookup["Vincent"] = VINCENT;
+        lookup["VINCENT"] = VINCENT;
         lookup["vincent"] = VINCENT;
+        lookup["Yuffie"] = YUVI;
+        lookup["yuffie"] = YUVI;
+        lookup["YUFFIE"] = YUVI;
         lookup["ABJB"] = YUVI;
         lookup["yufi"] = YUVI;
+        lookup["Cait Sith"] = KETCY;
+        lookup["Cait sith"] = KETCY;
+        lookup["CAIT SITH"] = KETCY;
+        lookup["CaitSith"] = KETCY;
+        lookup["Caitsith"] = KETCY;
+        lookup["CAITSITH"] = KETCY;
         lookup["AEBC"] = KETCY;
         lookup["ketcy"] = KETCY;
         return lookup;

+ 24 - 3
V-Gears/src/core/Entity.cpp

@@ -27,9 +27,9 @@ Entity::Entity(const Ogre::String& name, Ogre::SceneNode* node):
   scene_node_(node),
   height_(1.0f),
   solid_radius_(0.24f),
-  solid_(false),
+  solid_(true),
   talk_radius_(0.45f),
-  talkable_(false),
+  talkable_(true),
   state_(Entity::NONE),
   move_auto_speed_(0.7f),
   move_walk_speed_(0.7f),
@@ -64,7 +64,10 @@ Entity::Entity(const Ogre::String& name, Ogre::SceneNode* node):
   animation_speed_(1.0f),
   animation_default_("Idle"),
   animation_current_name_(""),
-  animation_auto_play_(true)
+  animation_auto_play_(true),
+  is_character_(false),
+  character_id_(0),
+  character_name_("")
 {
     model_root_node_ = scene_node_->createChildSceneNode();
     model_node_ = model_root_node_->createChildSceneNode();
@@ -731,6 +734,24 @@ int Entity::ScriptAnimationSync(){
     return -1;
 }
 
+void Entity::SetCharacter(const char* character_name){
+    is_character_ = true;
+    character_name_ = character_name;
+    if (character_name_ == "Cloud") character_id_ = 0;
+    else if (character_name_ == "Barret") character_id_ = 1;
+    else if (character_name_ == "Tifa") character_id_ = 2;
+    else if (character_name_ == "Aeris") character_id_ = 3;
+    else if (character_name_ == "Red XIII") character_id_ = 4;
+    // TODO: Continue this list.
+    // TODO: Or better event, look IDs up somewhere.
+}
+
+bool Entity::IsCharacter(){return is_character_;}
+
+uint Entity::GetCharacterId(){return character_id_;}
+
+std::string Entity::GetCharacterName(){return character_name_;}
+
 Ogre::Degree Entity::GetDirectionToEntity(Entity* entity) const{
     Ogre::Vector3 current_point = GetPosition();
     Ogre::Vector3 direction_point = entity->GetPosition();

+ 33 - 1
V-Gears/src/core/EntityManager.cpp

@@ -246,6 +246,12 @@ void EntityManager::Update(){
             );
             player_entity_->SetState(Entity::WALKMESH);
         }
+
+        // HACK: If manually moving, make playable entity solid.
+        // Some scripts 'forget' to make the playable entity solid at the end
+        // of them, and if it remains non-solid, it can't interact with lines
+        // (i.e. it cant' use gateways).
+        player_entity_->SetSolid(true);
     }
 
     for (unsigned int i = 0; i < entity_.size(); ++ i){
@@ -494,6 +500,14 @@ Entity* EntityManager::GetEntity(const Ogre::String& name) const{
     return nullptr;
 }
 
+Entity* EntityManager::GetEntityFromCharacterId(const char* id) const{
+    for (unsigned int i = 0; i < entity_.size(); ++ i){
+        if (entity_[i]->IsCharacter() && entity_[i]->GetCharacterId() == atoi(id))
+            return entity_[i];
+    }
+    return nullptr;
+}
+
 Entity* EntityManager::ScriptGetEntity(const char* name) const{
     return GetEntity(Ogre::String(name));
 }
@@ -512,6 +526,8 @@ void EntityManager::ScriptSetPlayerEntity(const char* name){
     }
 }
 
+Entity* EntityManager::ScriptGetPlayerEntity() const{return player_entity_;}
+
 void EntityManager::ScriptUnsetPlayerEntity(){player_entity_ = nullptr;}
 
 void EntityManager::ScriptPlayerLock(const bool lock){
@@ -544,6 +560,22 @@ void EntityManager::StartBattle(unsigned int formation){
     std::cout << "[BATTLE] Start battle ID " << formation << "\n";
 }
 
+bool EntityManager::IsKeyOn(unsigned int key_code){
+    // TODO: Translate keycodes to game key codes.
+    // For example 32 is standard for "Enter", but in game is "Circle/Action".
+    return InputManager::getSingleton().IsButtonPressed(key_code);
+}
+
+bool EntityManager::IsKeyOff(unsigned int key_code){return !IsKeyOn(key_code);}
+
+void EntityManager::SetEntityToCharacter(const char* entity_name, const char* character_name){
+    for (unsigned int i = 0; i < entity_.size(); ++ i){
+        if (entity_[i]->GetName() == entity_name){
+            entity_[i]->SetCharacter(character_name);
+        }
+    }
+}
+
 bool EntityManager::SetEntityOnWalkmesh(Entity* entity){
     Ogre::Vector3 position3 = entity->GetPosition();
     Ogre::Vector2 position2;
@@ -551,7 +583,7 @@ bool EntityManager::SetEntityOnWalkmesh(Entity* entity){
     position2.y = position3.y;
     std::vector<std::pair<int, float>> triangles;
 
-    // Search for posible triangles
+    // Search for possible triangles.
     for (int i = 0; i < walkmesh_.GetNumberOfTriangles(); ++ i){
         Ogre::Vector3 A3 = walkmesh_.GetA(i);
         Ogre::Vector3 B3 = walkmesh_.GetB(i);

+ 1 - 0
lib/SUDM/decompiler/.gitignore

@@ -0,0 +1 @@
+/doc/

+ 56 - 41
lib/SUDM/decompiler/ff7_field/ff7_field_codegen.h

@@ -181,48 +181,63 @@ namespace FF7
         const std::string FormatInvertedBool(uint32 value);
  
         template<typename TValue>
-        const std::string FormatValueOrVariable(SUDM::IScriptFormatter& formatter, uint32 bank, TValue valueOrAddress, ValueType valueType = ValueType::Integer, float scale = 1.0f)
-        {
-            switch (bank)
-            {
-            case 0:
-                switch (valueType)
-                {
-                case ValueType::Float:
-                    // TODO: check for zero
-                    return std::to_string(valueOrAddress / scale);
-                case ValueType::Integer:
+
+        /**
+         * Formats a data access for a map script.
+         *
+         * If possible, it will look for friendly names for variables.
+         *
+         * @param formatter[in] Formatter to look up variable friendly names.
+         * @param bank[in] The memory bank to use.
+         * @param value_or_address[in] The value or memory address to use.
+         * When bank is 0, it will be considered as a value. When bank is non
+         * 0, it will be considered an address of the bank.
+         * @param value_type[in] Data type to use. Used only when getting
+         * a value, not a bank address.
+         * @param scale[in] Scale to scale values to. Used only when using
+         * float values, unused when type is integer or when using a bank
+         * address.
+         * @return String with the friendly variable name, value, or bank
+         * address.
+         */
+        const std::string FormatValueOrVariable(
+          SUDM::IScriptFormatter& formatter, uint32 bank, TValue valueOrAddress,
+          ValueType valueType = ValueType::Integer, float scale = 1.0f
+        ){
+            switch (bank){
+                case 0:
+                    switch (valueType){
+                        // TODO: check for zero
+                        case ValueType::Float: return std::to_string(valueOrAddress / scale);
+                        case ValueType::Integer: return std::to_string(valueOrAddress);
+                        default: return std::to_string(valueOrAddress);
+                    }
+                case 1:
+                case 2:
+                case 3:
+                case 13:
+                case 15:
+                    {
+                        const auto address = static_cast<uint32>(valueOrAddress) & 0xFF;
+                        const auto friendly_name = formatter.VarName(bank, valueOrAddress);
+                        if (friendly_name.empty())
+                            return (boost::format("FFVII.Banks[%1%][%2%]") % bank % address).str();
+                        return (boost::format("FFVII.Data.%1%") % friendly_name).str();
+                    }
+                case 5:
+                case 6:
+                    {
+                        const auto address = static_cast<uint32>(valueOrAddress)& 0xFF;
+                        const  auto friendly_name = formatter.VarName(bank, address);
+                        if (friendly_name.empty())
+                            return (boost::format("FFVII.Banks[%1%][%2%]") % bank % address).str();
+                        return "FFVII.Data." + friendly_name;
+                    }
                 default:
-                    return std::to_string(valueOrAddress);
-                }
-            case 1:
-            case 2:
-            case 3:
-            case 13:
-            case 15:
-            {
-                const auto address = static_cast<uint32>(valueOrAddress) & 0xFF;
-                const auto friendlyName = formatter.VarName(bank, valueOrAddress);
-                if (friendlyName.empty())
-                {
-                    return (boost::format("FFVII.Data.var_%1%_%2%") % bank % address).str();
-                }
-                return (boost::format("FFVII.Data.%1%") % friendlyName).str();
-            }
-            case 5:
-            case 6:
-            {
-                const auto address = static_cast<uint32>(valueOrAddress)& 0xFF;
-                const  auto friendlyName = formatter.VarName(bank, address);
-                if (friendlyName.empty())
-                {
-                    return (boost::format("FFVII.Data.temp_%1%_%2%") % bank % address).str();
-                }
-                return "FFVII.Data." + friendlyName;
-            }
-            default:
-                //throw UnknownBankException();
-                return (boost::format("FFVII.Data.unknown_%1%_%2%") % bank % (static_cast<uint32>(valueOrAddress) & 0xFF)).str();
+                    //throw UnknownBankException();
+                    return (boost::format(
+                      "FFVII.Banks[%1%][%2%]") % bank % (static_cast<uint32>(valueOrAddress) & 0xFF)
+                    ).str();
             }
         }
     }

+ 11 - 5
lib/SUDM/decompiler/ff7_field/ff7_field_disassembler.cpp

@@ -112,8 +112,8 @@ std::unique_ptr<Function> FF7::FF7Disassembler::StartLineFunction(size_t script_
     func->_retVal = false;
     func->_args = 0;
     switch (script_index){
-        case 2: func->_name = "on_enter_line"; break;
-        case 3: func->_name = "on_move_to_line"; break;
+        case 0: func->_name = "on_enter_line"; break;
+        case 1: func->_name = "on_move_to_line"; break;
         case 4: func->_name = "on_cross_line"; break;
         case 5: func->_name = "on_leave_line"; break;
         default: func->_name = "script_" + std::to_string(script_index);
@@ -204,8 +204,12 @@ void FF7::FF7Disassembler::AddFunc(
     // Read each block of opcodes up to a return.
     const size_t old_num_instructions = _insts.size();
     std::unique_ptr<Function> func;
+
+    // Initialize the function.
     if (mEngine->EntityIsLine(entity_index)) func = StartLineFunction(script_index);
     else func = StartFunction(script_index);
+
+    // Read.
     if (to_return_only){
         // Read opcodes to the end or bail at the first return.
         is_line = ReadOpCodesToPositionOrReturn(
@@ -236,13 +240,15 @@ void FF7::FF7Disassembler::AddFunc(
     func->mNumInstructions = new_num_instructions - old_num_instructions;
     func->mEndAddr = _insts.back()->_address;
 
-
     if (!func_name.empty()) func->_name = func_name;
 
     // TODO: Remove and test. Should be applied in StartLineFunction
-    if (is_line){
+    // TODO: I dont know which one is OK. Check.
+    if (mEngine->EntityIsLine(entity_index)){
         switch (script_index){
-            case 2: func->_name = "on_enter_line"; break;
+            case 1:
+            case 2:
+                func->_name = "on_enter_line"; break;
             case 3: func->_name = "on_move_to_line"; break;
             case 4: func->_name = "on_cross_line"; break;
             case 5: func->_name = "on_leave_line"; break;

File diff suppressed because it is too large
+ 1079 - 1576
lib/SUDM/decompiler/ff7_field/ff7_field_engine.cpp


+ 700 - 338
lib/SUDM/decompiler/ff7_field/ff7_field_engine.h

@@ -40,11 +40,9 @@ namespace FF7{
              * @param formatter[in] The formatter to be used by the engine.
              * @param scriptName The script name.
              */
-            FF7FieldEngine(
-              SUDM::IScriptFormatter& formatter, std::string scriptName
-            ) : mFormatter(formatter), mScriptName(scriptName){
-                setOutputStackEffect(false);
-            }
+            FF7FieldEngine(SUDM::IScriptFormatter& formatter, std::string scriptName) :
+              mFormatter(formatter), mScriptName(scriptName)
+            {setOutputStackEffect(false);}
 
             /**
              * Destructor.
@@ -86,9 +84,7 @@ namespace FF7{
                      *
                      * @return The entity name
                      */
-                    std::string Name() const{
-                        return mName;
-                    }
+                    std::string Name() const{return mName;}
 
                     /**
                      * Retrieves a function.
@@ -103,9 +99,7 @@ namespace FF7{
                      */
                     std::string FunctionByIndex(size_t index) const{
                         auto it = mFunctions.find(index);
-                        if (it == std::end(mFunctions)){
-                            throw InternalDecompilerError();
-                        }
+                        if (it == std::end(mFunctions)) throw InternalDecompilerError();
                         return it->second;
                     }
 
@@ -134,24 +128,70 @@ namespace FF7{
                     }
 
                     /**
-                     * Indicates if the entity is a line.
-                     * @TODO: Make private.
+                     * Marks the entity as a line.
+                     *
+                     * @param line[in] True to mark the entity as a line,
+                     * false to unmark it.
+                     * @param point_a[in] First point of the line. Can be null
+                     * if line is false.
+                     * @param point_b[in] Second point of the line. Can be
+                     * null if line is false.
                      */
-                    bool is_line_;
+                    void MarkAsLine(
+                      bool line, std::vector<float> point_a, std::vector<float> point_b
+                    ){
+                        is_line_ = line;
+                        point_a_.clear();
+                        point_b_.clear();
+                        if (line){
+                            if (point_a.size() >= 3 && point_b.size() >= 3){
+                                point_a_.push_back(point_a[0]);
+                                point_a_.push_back(point_a[1]);
+                                point_a_.push_back(point_a[2]);
+                                point_b_.push_back(point_b[0]);
+                                point_b_.push_back(point_b[1]);
+                                point_b_.push_back(point_b[2]);
+                            }
+                            // TODO: Notify on else.
+                        }
+                        // TODO: These are not getting to the final script.
+                        // Maybe this can be removed?
+                        AddFunction("on_enter_line", 1);
+                        AddFunction("on_move_to_line", 2);
+                        AddFunction("on_cross_line", 3);
+                        AddFunction("on_leave_line", 4);
+                    }
 
                     /**
-                     * The first point of the line.
-                     * @TODO: Make private.
+                     * Checks if the entity is a line.
+                     *
+                     * Note that an entity is not considered to be a line
+                     * until a function has been found containing the opcode
+                     * LINE and {@see MarkAsLine} has been called.
+                     *
+                     * @return true if the entity is a line.
                      */
-                    std::vector<float> point_a_;
+                    bool IsLine(){return is_line_;}
 
                     /**
-                     * The first point of the line.
-                     * @TODO: Make private.
+                     * Retrieves the first point of the line entity.
+                     *
+                     * If the entity is not a line, the behavior is undefined.
+                     *
+                     * @return The first point of the line entity.
                      */
-                    std::vector<float> point_b_;
+                    std::vector<float> GetLinePointA(){return point_a_;}
+
+                    /**
+                     * Retrieves the second point of the line entity.
+                     *
+                     * If the entity is not a line, the behavior is undefined.
+                     *
+                     * @return The second point of the line entity.
+                     */
+                    std::vector<float> GetLinePointB(){return point_b_;}
+
 
-                    float ax, ay, az, bx, by, bz;
 
                 private:
 
@@ -165,18 +205,37 @@ namespace FF7{
                      * @todo What is a function here? An Opcode?
                      */
                     std::map< size_t, std::string > mFunctions;
+
+                    /**
+                     * Indicates if the entity is a line.
+                     */
+                    bool is_line_;
+
+                    /**
+                     * The first point of a line entity.
+                     *
+                     * If the entity is not a line, it may not be initializer.
+                     */
+                    std::vector<float> point_a_;
+
+                    /**
+                     * The second point of a line entity.
+                     *
+                     * If the entity is not a line, it may not be initializer.
+                     */
+                    std::vector<float> point_b_;
             };
 
             /**
              * Retrieves the dissasembler.
              *
              * @param insts[in] List of instructions.
-             * @param rawScriptData[in] Script data, raw format.
+             * @param raw_script_data[in] Script data, raw format.
              * @return Pointer to the dissasembler.
              * @todo Understand and document properly.
              */
             virtual std::unique_ptr<Disassembler> getDisassembler(
-              InstVec &insts, const std::vector<unsigned char>& rawScriptData
+              InstVec &insts, const std::vector<unsigned char>& raw_script_data
             ) override;
 
             /**
@@ -186,9 +245,7 @@ namespace FF7{
              * @return Pointer to the dissasembler.
              * @todo Understand and document properly.
              */
-            virtual std::unique_ptr<Disassembler> getDisassembler(
-              InstVec &insts
-            ) override;
+            virtual std::unique_ptr<Disassembler> getDisassembler(InstVec &insts) override;
 
             /**
              * Retrieves the code generator.
@@ -239,21 +296,19 @@ namespace FF7{
              *
              * @return A map of entities, with the name and index.
              */
-            std::map<size_t, Entity> GetEntityIndexMap() const{
-                return mEntityIndexMap;
-            }
+            std::map<size_t, Entity> GetEntityIndexMap() const{return mEntityIndexMap;}
 
             /**
              * Adds a function to an entity.
              *
-             * @param entityName Name of the entity.
-             * @param entityIndex Index of the entity.
-             * @param functionName Name of the function.
-             * @param functionIndex Index of the function.
+             * @param entity_name Name of the entity.
+             * @param entity_index Index of the entity.
+             * @param func_name Name of the function.
+             * @param func_index Index of the function.
              */
             void AddEntityFunction(
-              const std::string& entityName, size_t entityIndex,
-              const std::string& funcName, size_t funcIndex
+              const std::string& entity_name, size_t entity_index,
+              const std::string& func_name, size_t func_index
             );
 
             /**
@@ -290,9 +345,7 @@ namespace FF7{
              */
             const Entity& EntityByIndex(size_t index) const{
                 auto it = mEntityIndexMap.find(index);
-                if (it == std::end(mEntityIndexMap)){
-                    throw InternalDecompilerError();
-                }
+                if (it == std::end(mEntityIndexMap)) throw InternalDecompilerError();
                 return it->second;
             }
 
@@ -308,7 +361,7 @@ namespace FF7{
              *
              * @return The script name.
              */
-            const std::string& ScriptName() const { return mScriptName; }
+            const std::string& ScriptName() const {return mScriptName;}
 
         private:
 
@@ -318,19 +371,19 @@ namespace FF7{
              * Usefull for scripts that only contain one one return
              * statement.
              *
-             * @param insts[in|out] List of instructions to proccess. Extraneous
-             * return statements will be deleted from the instructions.
-             * @param g[in] Code graph.
-             * @todo What is the graph used to?
+             * @param insts[in|out] List of instructions to proccess.
+             * Extraneous return statements will be deleted from the
+             * instructions.
+             * @param g[in] Code graph. Unused.
              */
             void RemoveExtraneousReturnStatements(InstVec& insts, Graph g);
 
             /**
              * Removes trailing infinite loops.
              *
-             * In FF7 some scripts ends with an infinite loop to keep it alive.
-             * in QGears this isn't required, and can cause infinite loops, so
-             * they can be removed.
+             * In FF7 some scripts ends with an infinite loop to keep it
+             * alive. in QGears this isn't required, and can cause infinite
+             * loops, so they can be removed.
              *
              * @param insts[in|out] List of instructions to proccess. Trailing
              * infinite loops will be deleted from the instructions.
@@ -342,10 +395,11 @@ namespace FF7{
             /**
              * Tries to detect scripts with trailing infinite loops.
              *
-             * In FF7 some scripts ends with an infinite loop to keep it alive.
-             * in QGears this isn't required, and can cause infinite loops, so
-             * they can be removed. This function marks them, so they can be
-             * deleted with @{see FF7FieldEngine::RemoveTrailingInfiniteLoops}
+             * In FF7 some scripts ends with an infinite loop to keep it
+             * alive. in QGears this isn't required, and can cause infinite
+             * loops, so they can be removed. This function marks them, so
+             * they can be deleted with
+             * @{see FF7FieldEngine::RemoveTrailingInfiniteLoops}.
              */
             void MarkInfiniteLoopGroups(InstVec& insts, Graph g);
 
@@ -374,8 +428,10 @@ namespace FF7{
      * An unconditional map jump instruction.
      */
     class FF7UncondJumpInstruction : public UncondJumpInstruction{
+
         public:
 
+            // TODO: Make private and add accessors.
             /**
              * Whether or not this is really a call to a script function.
              */
@@ -415,13 +471,12 @@ namespace FF7{
              * @param func[in] Function to process.
              * @param stack[out] Function stack.
              * @param engine[in] Engine.
-             * @param codeGen[in] Code generator.
+             * @param code_gen[in] Code generator.
              * @todo Func and engine are unused?
              * @todo Understand and document properly.
              */
             virtual void processInst(
-              Function& func, ValueStack &stack,
-              Engine *engine, CodeGenerator *codeGen
+              Function& func, ValueStack &stack, Engine *engine, CodeGenerator *code_gen
             ) override;
 
             /**
@@ -441,18 +496,19 @@ namespace FF7{
         public:
 
             /**
-             * Processes the instruction.
+             * Processes a conditional jump instruction.
              *
-             * @param func[in] Function to process.
-             * @param stack[out] Function stack.
-             * @param engine[in] Engine.
-             * @param codeGen[in] Code generator.
-             * @todo Func and engine are unused?
-             * @todo Understand and document properly.
+             * Checks if the condition is a function or a comparison, and
+             * adds the function to the stack.
+             *
+             * @param function[in] Function to process. Unused.
+             * @param stack[out] Function stack. The Instruction will be added
+             * here.
+             * @param engine[in] Engine. Unused.
+             * @param code_gen[in] Code generator.
              */
             virtual void processInst(
-              Function& func, ValueStack &stack,
-              Engine *engine, CodeGenerator *codeGen
+              Function& function, ValueStack &stack, Engine *engine, CodeGenerator *code_gen
             ) override;
 
             /**
@@ -492,13 +548,10 @@ namespace FF7{
              * @param func[in] Function to process.
              * @param stack[out] Function stack.
              * @param engine[in] Engine.
-             * @param codeGen[in] Code generator.
-             * @todo Func and engine are unused?
-             * @todo Understand and document properly.
+             * @param code_gen[in] Code generator.
              */
             virtual void processInst(
-              Function& func, ValueStack &stack,
-              Engine *engine, CodeGenerator *codeGen
+              Function& func, ValueStack &stack, Engine *engine, CodeGenerator *code_gen
             ) override;
 
         private:
@@ -521,23 +574,20 @@ namespace FF7{
              * const UByte E: The ID of the target entity.
              * const Bit[3] P: The priority at which we want to execute the
              *                 remote script (high 3 bits of byte).
-             * const Bit[5] F: The ID of the specific member function of E to be
-             *                 executed (low 5 bits of byte).
+             * const Bit[5] F: The ID of the specific member function of E to
+             *                 be executed (low 5 bits of byte).
              *
              * Requests that a remote entity executes one of its member
              * functions at a specified priority. The request is asynchronous
-             * and returns immediately without waiting for the remote execution
-             * to start or finish. If the specified priority is already busy
-             * executing, the request will fail silently.
+             * and returns immediately without waiting for the remote
+             * execution to start or finish. If the specified priority is
+             * already busy executing, the request will fail silently.
              *
-             * @param codegen[in|out] Code generator. Output lines are appended
-             * to it.
+             * @param codegen[in|out] Code generator. Output lines are
+             * appended to it.
              * @param engine[in] The engine instance to fetch entities.
              */
-            void processREQ(
-              CodeGenerator* codeGen,
-              const FF7FieldEngine& engine
-            );
+            void processREQ(CodeGenerator* code_gen, const FF7FieldEngine& engine);
 
             /**
              * Processes a REQSW command.
@@ -557,8 +607,8 @@ namespace FF7{
              * const UByte E: The ID of the target entity.
              * const Bit[3] P: The priority at which we want to execute the
              *                 remote script (high 3 bits of byte).
-             * const Bit[5] F: The ID of the specific member function of E to be
-             *                 executed (low 5 bits of byte).
+             * const Bit[5] F: The ID of the specific member function of E to
+             *                 be executed (low 5 bits of byte).
              *
              * Requests that a remote entity executes one of its member
              * functions at a specified priority. If the specified priority is
@@ -566,14 +616,11 @@ namespace FF7{
              * available and only then return. The remote execution is still
              * carried out asynchronously, with no notification of completion.
              *
-             * @param codegen[in|out] Code generator. Output lines are appended
-             * to it.
+             * @param codegen[in|out] Code generator. Output lines are
+             * appended to it.
              * @param engine[in] The engine instance to fetch entities.
              */
-            void processREQSW(
-              CodeGenerator* codeGen,
-              const FF7FieldEngine& engine
-            );
+            void processREQSW(CodeGenerator* code_gen, const FF7FieldEngine& engine);
 
             /**
              * Processes a REQEW command.
@@ -592,21 +639,18 @@ namespace FF7{
              * const UByte E: The ID of the target entity.
              * const Bit[3] P: The priority at which we want to execute the
              *                 remote script (high 3 bits of byte).
-             * const Bit[5] F: The ID of the specific member function of E to be
-             *                 executed (low 5 bits of byte).
+             * const Bit[5] F: The ID of the specific member function of E to
+             *                 be executed (low 5 bits of byte).
              *
              * Requests that a remote entity executes one of its member
              * functions at a specified priority. The request will block until
              * remote execution has finished before returning.
              *
-             * @param codegen[in|out] Code generator. Output lines are appended
-             * to it.
+             * @param codegen[in|out] Code generator. Output lines are
+             * appended to it.
              * @param engine[in] The engine instance to fetch entities.
              */
-            void processREQEW(
-              CodeGenerator* codeGen,
-              const FF7FieldEngine& engine
-            );
+            void processREQEW(CodeGenerator* code_gen, const FF7FieldEngine& engine);
 
             /**
              * Processes a RETTO command.
@@ -626,18 +670,18 @@ namespace FF7{
              *                   current entity to be executed to (low 5 bits
              *                   of byte).
              *
-             * Stops the active script loop for this entity and also any script
-             * loops (except the main) that are queuing to be executed after the
-             * current script. This is essentially the same as adding a RET onto
-             * each of the active / queued scripts next execution position and
-             * returning the current op index to index for each script. Then the
-             * script control is passed to the script F within the current
-             * entity with the priority P.
+             * Stops the active script loop for this entity and also any
+             * script loops (except the main) that are queuing to be executed
+             * after the current script. This is essentially the same as
+             * adding a RET onto each of the active / queued scripts next
+             * execution position and returning the current op index to index
+             * for each script. Then the script control is passed to the
+             * script F within the current entity with the priority P.
              *
-             * @param codegen[in|out] Code generator. Output lines are appended
-             * to it.
+             * @param codegen[in|out] Code generator. Output lines are
+             * appended to it.
              */
-            void processRETTO(CodeGenerator* codeGen);
+            void processRETTO(CodeGenerator* code_gen);
 
             /**
              * Processes a WAIT command.
@@ -660,10 +704,10 @@ namespace FF7{
              * WAIT(0x1E) (or WAIT(30) in decimal) will pause script execution
              * for 1 second, WAIT(0x96) will pause for 5 seconds, and so on.
              *
-             * @param codegen[in|out] Code generator. Output lines are appended
-             * to it.
+             * @param codegen[in|out] Code generator. Output lines are
+             * appended to it.
              */
-            void processWAIT(CodeGenerator* codeGen);
+            void processWAIT(CodeGenerator* code_gen);
     };
 
     /**
@@ -673,25 +717,22 @@ namespace FF7{
 
         public:
 
-        /**
-         * Processes the instruction.
-         *
-         * @param func[in] Function to process.
-         * @param stack[out] Function stack.
-         * @param engine[in] Engine.
-         * @param codeGen[in] Code generator.
-         * @todo Func and engine are unused?
-         * @todo Understand and document properly.
-         */
+            /**
+             * Processes the instruction.
+             *
+             * @param func[in] Function to process.
+             * @param stack[out] Function stack.
+             * @param engine[in] Engine. Unused.
+             * @param code_gen[in] Code generator.
+             */
             virtual void processInst(
-              Function& func, ValueStack &stack,
-              Engine *engine, CodeGenerator *codeGen
+              Function& func, ValueStack &stack, Engine *engine, CodeGenerator *code_gen
             ) override;
 
         private:
 
             /**
-             * Processes a BATTLE command.
+             * Processes a BATTLE opcode.
              *
              * Opcode: 0x70
              * Short name: BATTLE
@@ -718,10 +759,10 @@ namespace FF7{
              * @param codegen[in|out] Code generator. Output lines are appended
              * to it.
              */
-            void processBATTLE(CodeGenerator* codeGen);
+            void processBATTLE(CodeGenerator* code_gen);
 
             /**
-             * Processes a BTLON command.
+             * Processes a BTLON opcode.
              *
              * Opcode: 0x71
              * Short name: BTLON
@@ -734,18 +775,18 @@ namespace FF7{
              * Arguments
              *   const UByte S: Switch battles on/off (0/1, respectively).
              *
-             * Turns random encounters on or off for this field. Note that if a
-             * field does not have any Encounter Data set in its field file,
+             * Turns random encounters on or off for this field. Note that if
+             * a field does not have any Encounter Data set in its field file,
              * battles will not occur regardless of the argument passed with
              * this opcode.
              *
-             * @param codegen[in|out] Code generator. Output lines are appended
-             * to it.
+             * @param codegen[in|out] Code generator. Output lines are
+             * appended to it.
              */
-            void processBTLON(CodeGenerator* codeGen);
+            void processBTLON(CodeGenerator* code_gen);
 
             /**
-             * Processes a MAPJUMP command.
+             * Processes a MAPJUMP opcode.
              *
              * Opcode: 0x60
              * Short name: BTLON
@@ -772,238 +813,559 @@ namespace FF7{
              *                  next field, in the standard game format.
              *
              * Switches fields to the one indicated by I, and places the
-             * character at the coordinates and direction specified. This is an
-             * alternative to using a gateway, and can complement their usage as
-             * it allows for more than 12 gateways by simulating their behaviour
-             * through a LINE which, when crossed, executes a MAPJUMP.
-             *
-             * @param codegen[in|out] Code generator. Output lines are appended
-             * to it.
+             * character at the coordinates and direction specified. This is
+             * an alternative to using a gateway, and can complement their
+             * usage as it allows for more than 12 gateways by simulating
+             * their behavior through a LINE which, when crossed, executes a
+             * MAPJUMP.
+             *
+             * @param codegen[in|out] Code generator. Output lines are
+             * appended to it.
              * @param func[in] Function
              * @todo What is func for?
              */
-            void processMAPJUMP(CodeGenerator* codeGen, Function& func);
+            void processMAPJUMP(CodeGenerator* code_gen, Function& func);
     };
 
-    class FF7MathInstruction : public StoreInstruction
-    {
-    public:
-        virtual void processInst(Function& func, ValueStack &stack, Engine *engine, CodeGenerator *codeGen) override;
-    private:
-        void processSaturatedPLUS(CodeGenerator* codeGen);
-        void processSaturatedPLUS2(CodeGenerator* codeGen);
-        void processSaturatedMINUS(CodeGenerator* codeGen);
-        void processSaturatedMINUS2(CodeGenerator* codeGen);
-        void processSaturatedINC(CodeGenerator* codeGen);
-        void processSaturatedINC2(CodeGenerator* codeGen);
-        void processSaturatedDEC(CodeGenerator* codeGen);
-        void processSaturatedDEC2(CodeGenerator* codeGen);
-        void processRDMSD(CodeGenerator* codeGen);
-        void processSETBYTE_SETWORD(CodeGenerator* codeGen);
-        void processBITON(CodeGenerator* codeGen);
-        void processPLUSx_MINUSx(CodeGenerator* codeGen, const std::string& op);
-        void processINCx_DECx(CodeGenerator* codeGen, const std::string& op);
-        void processRANDOM(CodeGenerator* codeGen);
+    /**
+     * A math instruction.
+     */
+    class FF7MathInstruction : public StoreInstruction{
+
+        public:
+
+            /**
+             * Processes the instruction.
+             *
+             * @param func[in] Function to process.
+             * @param stack[out] Function stack.
+             * @param engine[in] Engine. Unused.
+             * @param code_gen[in] Code generator.
+             */
+            virtual void processInst(
+              Function& func, ValueStack &stack, Engine *engine, CodeGenerator *code_gen
+            ) override;
+
+        private:
+
+            void processSaturatedPLUS(CodeGenerator* code_gen);
+            void processSaturatedPLUS2(CodeGenerator* code_gen);
+            void processSaturatedMINUS(CodeGenerator* code_gen);
+            void processSaturatedMINUS2(CodeGenerator* code_gen);
+            void processSaturatedINC(CodeGenerator* code_gen);
+            void processSaturatedINC2(CodeGenerator* code_gen);
+            void processSaturatedDEC(CodeGenerator* code_gen);
+            void processSaturatedDEC2(CodeGenerator* code_gen);
+            void processRDMSD(CodeGenerator* code_gen);
+            void processSETBYTE_SETWORD(CodeGenerator* code_gen);
+
+            /**
+             * Processes a BITON opcode.
+             *
+             * Opcode: 0x82
+             * Short name: BITON
+             * Long name: Set Bit
+             *
+             * Memory layout (4 bytes)
+             * |0x82|D/S|A|B|
+             *
+             * Arguments
+             * - const Bit[4] D: Destination bank.
+             * - const Bit[4] S: Source bank.
+             * - const UByte A: Destination address.
+             * - const UByte Bit: The number of the bit to turn on.
+             *
+             * Sets the nth bit in the "A" location, where n is a number
+             * between 0-7 supplied in B. A value of zero in B will set the
+             * least significant bit. If the Source Bank is 0 then the bit to
+             * be set is taken from "Bit". If the Source Bank is an 8 bit
+             * bank, then the bit is the address in that bank where the
+             * operand is.
+             *
+             * @param code_gen[in|out] Code generator. Output lines are
+             * appended to it.
+             */
+            void processBITON(CodeGenerator* code_gen);
+
+            /**
+             * Processes a BITON opcode.
+             *
+             * Opcode: 0x83
+             * Short name: BITOFF
+             * Long name: Reset Bit
+             *
+             * Memory layout (4 bytes)
+             * |0x83|D/S|A|B|
+             *
+             * Arguments
+             * - const Bit[4] D: Destination bank.
+             * - const Bit[4] S: Source bank.
+             * - const UByte A: Destination address.
+             * - const UByte Bit: The number of the bit to turn off.
+             *
+             * Sets the nth bit in the "A" location, where n is a number
+             * between 0-7 supplied in B. A value of zero in B will reset the
+             * least significant bit. If the Source Bank is 0 then the bit to
+             * be set is taken from "Bit". If the Source Bank is an 8 bit
+             * bank, then the bit is the address in that bank where the
+             * operand is.
+             *
+             * @param code_gen[in|out] Code generator. Output lines are
+             * appended to it.
+             */
+            void processBITOFF(CodeGenerator* code_gen);
+            void processPLUSx_MINUSx(CodeGenerator* code_gen, const std::string& op);
+            void processINCx_DECx(CodeGenerator* code_gen, const std::string& op);
+            void processRANDOM(CodeGenerator* code_gen);
     };
 
-    class FF7WindowInstruction : public KernelCallInstruction
-    {
-    public:
-        virtual void processInst(Function& func, ValueStack &stack, Engine *engine, CodeGenerator *codeGen) override;
-    private:
-        void processMESSAGE(CodeGenerator* codeGen, const std::string& scriptName);
-        void processMPNAM(CodeGenerator* codeGen);
-        void processMENU2(CodeGenerator* codeGen);
-        void processWINDOW(CodeGenerator* codeGen);
-        void processWCLSE(CodeGenerator* codeGen);
+    /**
+     * A window instruction.
+     */
+    class FF7WindowInstruction : public KernelCallInstruction{
+
+        public:
+
+            /**
+             * Processes the instruction.
+             *
+             * @param func[in] Function to process.
+             * @param stack[out] Function stack.
+             * @param engine[in] Engine.
+             * @param code_gen[in] Code generator.
+             */
+            virtual void processInst(
+              Function& func, ValueStack &stack, Engine *engine, CodeGenerator *code_gen
+            ) override;
+
+        private:
+
+            void processMESSAGE(CodeGenerator* code_gen, const std::string& script_name);
+            void processMPNAM(CodeGenerator* code_gen);
+            void processMENU2(CodeGenerator* code_gen);
+            void processWINDOW(CodeGenerator* code_gen);
+            void processWCLSE(CodeGenerator* code_gen);
     };
 
-    class FF7PartyInstruction : public KernelCallInstruction
-    {
-    public:
-        virtual void processInst(Function& func, ValueStack &stack, Engine *engine, CodeGenerator *codeGen) override;
-    private:
-        void processSTITM(CodeGenerator* codeGen);
-        void processPRTYE(CodeGenerator* codeGen);
+    /**
+     * A party instruction
+     */
+    class FF7PartyInstruction : public KernelCallInstruction{
+
+        public:
+
+            /**
+             * Processes the instruction.
+             *
+             * @param func[in] Function to process.
+             * @param stack[out] Function stack.
+             * @param engine[in] Engine. Unused
+             * @param code_gen[in] Code generator.
+             */
+            virtual void processInst(
+              Function& func, ValueStack &stack, Engine *engine, CodeGenerator *code_gen
+            ) override;
+
+        private:
+
+            void processSTITM(CodeGenerator* code_gen);
+            void processPRTYE(CodeGenerator* code_gen);
     };
 
-    class FF7ModelInstruction : public KernelCallInstruction
-    {
-    public:
-        virtual void processInst(Function& func, ValueStack &stack, Engine *engine, CodeGenerator *codeGen) override;
-    private:
-        void processTLKON(CodeGenerator* codeGen, const std::string& entity);
-        void processPC(CodeGenerator* codeGen, const std::string& entity);
-        void processCHAR(CodeGenerator* codeGen, const std::string& entity);
-        void processDFANM(CodeGenerator* codeGen, const std::string& entity, int charId);
-        void processANIME1(CodeGenerator* codeGen, const std::string& entity, int charId);
-        void processVISI(CodeGenerator* codeGen, const std::string& entity);
-        void processXYZI(CodeGenerator* codeGen, const std::string& entity);
-        void processMOVE(CodeGenerator* codeGen, const std::string& entity);
-        void processMSPED(CodeGenerator* codeGen, const std::string& entity);
-        void processDIR(CodeGenerator* codeGen, const std::string& entity);
-        void processTURNGEN(CodeGenerator* codeGen, const std::string& entity);
-        void processGETAI(CodeGenerator* codeGen, const FF7FieldEngine& engine);
-        void processANIM_2(CodeGenerator* codeGen, const std::string& entity, int charId);
-        void processCANIM2(CodeGenerator* codeGen, const std::string& entity, int charId);
-        void processCANM_2(CodeGenerator* codeGen, const std::string& entity, int charId);
-        void processCC(CodeGenerator* codeGen, const FF7FieldEngine& engine);
-        void processSOLID(CodeGenerator* codeGen, const std::string& entity);
-
-        /**
-         * Processes an OFST opcode.
-         *
-         * Opcode: 0xC3
-         * Short name: OFST
-         * Long name: Offset Object
-         *
-         * Memory layout (8 bytes)
-         * |0xC3|B1/B2|B3/B4|T|X|Y|Z|S|
-         *
-         * Arguments:
-         * - const Bit[4] B1: Bank to retrieve X offset, or zero if X is
-         * specified as a literal.
-         * - const Bit[4] B2: Bank to retrieve Y offset, or zero if Y is
-         * specified as a literal.
-         * - const Bit[4] B3: Bank to retrieve Z offset, or zero if Z is
-         * specified as a literal.
-         * - const Bit[4] B4: Bank to retrieve speed, or zero if S is specified
-         * as a literal.
-         * - const UByte T: Type of movement.
-         * - const Short X: X offset amount, relative to current position, or
-         * address to find X offset, if B1 is non-zero.
-         * - const Short Y: Y offset amount, relative to current position, or
-         * address to find Y offset, if B2 is non-zero.
-         * - const Short Z: Z offset amount, relative to current position, or
-         * address to find Z offset, if B3 is non-zero.
-         * - const UShort S: Speed of the offset movement, if type is non-zero,
-         * or address to find speed, if B4 is non-zero.
-         *
-         * Offsets the field object, belonging to the entity whose script this
-         * opcode resides in, by a certain amount. After being offset, the
-         * character continues to be constrained in movement as defined by the
-         * walkmesh's shape, but at a certain distance away from the normal
-         * walkmesh position. Other field objects are unaffected, and their
-         * position or movements are maintained on the walkmesh's original
-         * position. If B1, B2, B3 or B4 is non-zero, then the value for that
-         * particular component is taken from memory using the corresponding
-         * bank and address specified, rather than as a literal value. Both
-         * retrieved values and literals can be used for different components.
-         * If using T, X, Y or S as addresses, the lower byte should hold the
-         * address whilst the higher byte should be zero. The amount to offset
-         * is specified relative to the current position. If Type is specified,
-         * the object moves gradually from its current point to the offset
-         * position; this can be used to simulate movements such as elevators.
-         * Any type outside the range in the table will cause the offset not to
-         * occur. If the object is set to move gradually, then the speed of
-         * offset can be set; the greater the number, the slower the object
-         * moves to its target offset. Script execution may also be halted
-         * until the gradual offset has been completed. For this, see OFSTW.
-         *
-         * @param codeGen The code generator.
-         * @param entity[in] The entity name.
-         */
-        void processOFST(CodeGenerator* codegen, const std::string& entity);
+    /**
+     * A model instruction.
+     */
+    class FF7ModelInstruction : public KernelCallInstruction{
+
+        public:
+
+            /**
+             * Processes the instruction.
+             *
+             * @param func[in] Function to process.
+             * @param stack[out] Function stack.
+             * @param engine[in] Engine.
+             * @param code_gen[in] Code generator.
+             */
+            virtual void processInst(
+              Function& func, ValueStack &stack, Engine *engine, CodeGenerator *code_gen
+            ) override;
+
+        private:
+
+            /**
+             * Processes a JOIN opcode.
+             *
+             * Opcode: 0x08
+             * Short name: JOIN
+             * Long name: Party Field Join
+             * Memory layout (2 bytes)
+             * |0x08|S|
+             *
+             * Arguments
+             * - const UByte S: Speed that the characters join back together.
+             *
+             * Causes seperated party characters that have previously been
+             * SPLIT onto the field, to be joined back together again; that
+             * is, only the party leader becomes visible on the field. This
+             * should be called if a previous SPLIT has completed (the party
+             * members have finished speaking, or performing their actions,
+             * for example). As with SPLIT, the speed of the join is
+             * specified, from a scale of 1 (almost instant) to FF (very slow
+             * walk), and must be non-zero. In contrast to most MOVE related
+             * op codes, the speed is this setting is actually the total
+             * number of frames required. Depending on the distance from the
+             * player character and the number of frames required, the entity
+             * plays a run or walk animation. Also, all characters take the
+             * same time irrespective of distance. Calling JOIN without having
+             * previously SPLIT the characters will cause the party members to
+             * appear at the walkmesh origin and attempt to JOIN from there.
+             * This is not normally the required behaviour and should be
+             * avoided.
+             *
+             * @param code_gen The code generator.
+             */
+            void processJOIN(CodeGenerator* code_gen);
+
+            /**
+             * Processes a SPLIT opcode.
+             *
+             * Opcode: 0x09
+             * Short name: SPLIT
+             * Long name: Party Field Split
+             *
+             * Memory layout (15 bytes)
+             * |0x20|B1/B2|B3/B4|B5/B6|XA|XA|YA|YA|DA|XB|XB|YB|YB|DB|S|
+             *
+             * Arguments
+             * - const Bit[4] B1: Bank for XA, or zero if XA is specified as a
+             * literal value.
+             * - const Bit[4] B2: Bank for YA, or zero if YA is specified as a
+             * literal value.
+             * - const Bit[4] B3: Bank for DA, or zero if DA is specified as a
+             * literal value.
+             * - const Bit[4] B4: Bank for XB, or zero if XB is specified as a
+             * literal value.
+             * - const Bit[4] B5: Bank for YB, or zero if YB is specified as a
+             * literal value.
+             * - const Bit[4] B6: Bank for DB, or zero if DB is specified as a
+             * literal value.
+             * - const Short XA: X-coordinate of the second character in the
+             * party after the split, or address for the value if B1 is
+             * non-zero.
+             * - const Short YA: Y-coordinate of the second character in the
+             * party after the split, or address for the value if B2 is
+             * non-zero.
+             * - const UByte DA: Direction the second character faces after the
+             * split, or address for the value if B3 is non-zero.
+             * - const Short XB: X-coordinate of the third character in the
+             * party after the split, or address for the value if B4 is
+             * non-zero.
+             * - const Short YB: Y-coordinate of the third character in the
+             * party after the split, or address for the value if B5 is
+             * non-zero.
+             * - const UByte DB: Direction the third character faces after the
+             * split, or address for the value if B6 is non-zero.
+             * - const UByte S: Speed that the characters split.
+             *
+             * Causes the common 'split effect' whereby the second and third
+             * characters in the current party 'come out' from the party
+             * leader. That is, they become visible in the field, starting
+             * from the center of the party leader, and move out to the
+             * coordinates specified in the argument list. This is commonly
+             * used when the other characters in the current party have an
+             * action or dialog to perform and must be individually visible in
+             * the field. As well as specifying final coordinates for the two
+             * other party characters, the directions each character faces
+             * after the split are specified as a byte, using the common
+             * direction values found throughout the game. Speed is also given
+             * and is used to specify the rate at which the characters leave
+             * the party leader, using a scale from 1 (almost instant) to FF
+             * (extremely slow walk); this must be non-zero. In contrast to
+             * most MOVE related op codes, the speed is this setting is
+             * actually the total number of frames required. Depending on the
+             * distance from the player character and the number of frames
+             * required, the entity plays a run or walk animation. Also, all
+             * characters take the same time irrespective of distance.
+             *
+             * @param code_gen The code generator.
+             */
+            void processSPLIT(CodeGenerator* code_gen);
+            void processTLKON(CodeGenerator* code_gen, const std::string& entity);
+            void processPC(CodeGenerator* code_gen, const std::string& entity);
+            void processCHAR(CodeGenerator* code_gen, const std::string& entity);
+            void processDFANM(CodeGenerator* code_gen, const std::string& entity, int char_id);
+            void processANIME1(CodeGenerator* code_gen, const std::string& entity, int char_id);
+            void processVISI(CodeGenerator* code_gen, const std::string& entity);
+            void processXYZI(CodeGenerator* code_gen, const std::string& entity);
+            void processMOVE(CodeGenerator* code_gen, const std::string& entity);
+            void processMSPED(CodeGenerator* code_gen, const std::string& entity);
+            void processDIR(CodeGenerator* code_gen, const std::string& entity);
+            void processTURNGEN(CodeGenerator* code_gen, const std::string& entity);
+            void processGETAI(CodeGenerator* code_gen, const FF7FieldEngine& engine);
+            void processANIM_2(CodeGenerator* code_gen, const std::string& entity, int char_id);
+            void processCANIM2(CodeGenerator* code_gen, const std::string& entity, int char_id);
+            void processCANM_2(CodeGenerator* code_gen, const std::string& entity, int char_id);
+            void processCC(CodeGenerator* code_gen, const FF7FieldEngine& engine);
+            void processSOLID(CodeGenerator* code_gen, const std::string& entity);
+
+            /**
+             * Processes an OFST opcode.
+             *
+             * Opcode: 0xC3
+             * Short name: OFST
+             * Long name: Offset Object
+             *
+             * Memory layout (8 bytes)
+             * |0xC3|B1/B2|B3/B4|T|X|Y|Z|S|
+             *
+             * Arguments:
+             * - const Bit[4] B1: Bank to retrieve X offset, or zero if X is
+             * specified as a literal.
+             * - const Bit[4] B2: Bank to retrieve Y offset, or zero if Y is
+             * specified as a literal.
+             * - const Bit[4] B3: Bank to retrieve Z offset, or zero if Z is
+             * specified as a literal.
+             * - const Bit[4] B4: Bank to retrieve speed, or zero if S is
+             * specified as a literal.
+             * - const UByte T: Type of movement.
+             * - const Short X: X offset amount, relative to current position,
+             * or address to find X offset, if B1 is non-zero.
+             * - const Short Y: Y offset amount, relative to current position,
+             * or address to find Y offset, if B2 is non-zero.
+             * - const Short Z: Z offset amount, relative to current position,
+             * or address to find Z offset, if B3 is non-zero.
+             * - const UShort S: Speed of the offset movement, if type is
+             * non-zero, or address to find speed, if B4 is non-zero.
+             *
+             * Offsets the field object, belonging to the entity whose script
+             * this opcode resides in, by a certain amount. After being
+             * offset, the character continues to be constrained in movement
+             * as defined by the walkmesh's shape, but at a certain distance
+             * away from the normal walkmesh position. Other field objects are
+             * unaffected, and their position or movements are maintained on
+             * the walkmesh's original position. If B1, B2, B3 or B4 is
+             * non-zero, then the value for that particular component is taken
+             * from memory using the corresponding bank and address specified,
+             * rather than as a literal value. Both retrieved values and
+             * literals can be used for different components. If using T, X, Y
+             * or S as addresses, the lower byte should hold the address
+             * whilst the higher byte should be zero. The amount to offset is
+             * specified relative to the current position. If Type is
+             * specified, the object moves gradually from its current point to
+             * the offset position; this can be used to simulate movements
+             * such as elevators. Any type outside the range in the table will
+             * cause the offset not to occur. If the object is set to move
+             * gradually, then the speed of offset can be set; the greater the
+             * number, the slower the object moves to its target offset.
+             * Script execution may also be halted until the gradual offset
+             * has been completed. For this, see OFSTW.
+             *
+             * @param codegen The code generator.
+             * @param entity[in] The entity name.
+             */
+            void processOFST(CodeGenerator* codegen, const std::string& entity);
     };
 
-    class FF7WalkmeshInstruction : public KernelCallInstruction
-    {
-    public:
-        virtual void processInst(Function& func, ValueStack &stack, Engine *engine, CodeGenerator *codeGen) override;
-
-    private:
-        void processUC(CodeGenerator* codeGen);
-
-        /**
-         * Processes a LINE opcode.
-         *
-         * Opcode: 0xD0
-         * Short name: LINE
-         * Long name: Line definition
-         *
-         * Memory layout (7 bytes)
-         * |0xD0|XA|YA|ZA|XB|YB|ZB|
-         *
-         * Arguments:
-         * - const Short XA: X-coordinate of the first point of the line.
-         * - const Short YA: Y-coordinate of the first point of the line.
-         * - const Short ZA: Z-coordinate of the first point of the line.
-         * - const Short XB: X-coordinate of the second point of the line.
-         * - const Short YB: Y-coordinate of the second point of the line.
-         * - const Short ZB: Z-coordinate of the second point of the line.
-         *
-         * Defines a line on the walkmesh that, when crossed by a playable
-         * character, causes one of the entity's scripts to be executed. These
-         * are similar to the triggers in Section 8. All the lines in the
-         * current field can be turned on or off by using the LINON opcode.
-         *
-         * There are generally 6 scripts (other than the init and main) if the entity is a LINE.
-         * - script index 2 -> S1 - [OK].
-         * - script index 3 -> S2 - Move.
-         * - script index 4 -> S3 - Move.
-         * - script index 5 -> S4 - Go.
-         * - script index 6 -> S5 - Go 1x.
-         * - script index 7 -> S6 - Go away.
-         *
-         * @param codeGen The code generator.
-         * @param entity[in] The entity name.
-         */
-        void processLINE(CodeGenerator* codeGen, const std::string& entity);
+    /**
+     * A walkmesh instruction.
+     */
+    class FF7WalkmeshInstruction : public KernelCallInstruction{
+
+        public:
+
+            /**
+             * Processes the instruction.
+             *
+             * @param func[in] Function to process.
+             * @param stack[out] Function stack.
+             * @param engine[in] Engine. Unused.
+             * @param code_gen[in] Code generator.
+             */
+            virtual void processInst(
+              Function& func, ValueStack &stack, Engine *engine, CodeGenerator *code_gen
+            ) override;
+
+        private:
+
+            void processUC(CodeGenerator* code_gen);
+
+            /**
+             * Processes a LINE opcode.
+             *
+             * Opcode: 0xD0
+             * Short name: LINE
+             * Long name: Line definition
+             *
+             * Memory layout (7 bytes)
+             * |0xD0|XA|YA|ZA|XB|YB|ZB|
+             *
+             * Arguments:
+             * - const Short XA: X-coordinate of the first point of the line.
+             * - const Short YA: Y-coordinate of the first point of the line.
+             * - const Short ZA: Z-coordinate of the first point of the line.
+             * - const Short XB: X-coordinate of the second point of the line.
+             * - const Short YB: Y-coordinate of the second point of the line.
+             * - const Short ZB: Z-coordinate of the second point of the line.
+             *
+             * Defines a line on the walkmesh that, when crossed by a playable
+             * character, causes one of the entity's scripts to be executed.
+             * These are similar to the triggers in Section 8. All the lines
+             * in the current field can be turned on or off by using the LINON
+             * opcode.
+             *
+             * There are generally 6 scripts (other than the init and main) if
+             * the entity is a LINE.
+             * - script index 2 -> S1 - [OK].
+             * - script index 3 -> S2 - Move.
+             * - script index 4 -> S3 - Move.
+             * - script index 5 -> S4 - Go.
+             * - script index 6 -> S5 - Go 1x.
+             * - script index 7 -> S6 - Go away.
+             *
+             * @param code_gen The code generator.
+             * @param entity[in] The entity name.
+             */
+            void processLINE(CodeGenerator* code_gen, const std::string& entity);
     };
 
-    class FF7BackgroundInstruction : public KernelCallInstruction
-    {
-    public:
-        virtual void processInst(Function& func, ValueStack &stack, Engine *engine, CodeGenerator *codeGen) override;
-    private:
-        void processBGON(CodeGenerator* codeGen);
-        void processBGOFF(CodeGenerator* codeGen);
-        void processBGCLR(CodeGenerator* codeGen);
-        void processSTPAL(CodeGenerator* codeGen);
-        void processLDPAL(CodeGenerator* codeGen);
-        void processCPPAL(CodeGenerator* codeGen);
-        void processADPAL(CodeGenerator* codeGen);
-        void processMPPAL2(CodeGenerator* codeGen);
-        void processSTPLS(CodeGenerator* codeGen);
-        void processLDPLS(CodeGenerator* codeGen);
+    /**
+     * A background instruction.
+     */
+    class FF7BackgroundInstruction : public KernelCallInstruction{
+
+        public:
+
+            /**
+             * Processes the instruction.
+             *
+             * @param func[in] Function to process.
+             * @param stack[out] Function stack.
+             * @param engine[in] Engine. Unused
+             * @param code_gen[in] Code generator.
+             */
+            virtual void processInst(
+              Function& func, ValueStack &stack, Engine *engine, CodeGenerator *code_gen
+            ) override;
+
+        private:
+
+            void processBGON(CodeGenerator* code_gen);
+            void processBGOFF(CodeGenerator* code_gen);
+            void processBGCLR(CodeGenerator* code_gen);
+            void processSTPAL(CodeGenerator* code_gen);
+            void processLDPAL(CodeGenerator* code_gen);
+            void processCPPAL(CodeGenerator* code_gen);
+            void processADPAL(CodeGenerator* code_gen);
+            void processMPPAL2(CodeGenerator* code_gen);
+            void processSTPLS(CodeGenerator* code_gen);
+            void processLDPLS(CodeGenerator* code_gen);
     };
 
-    class FF7CameraInstruction : public KernelCallInstruction
-    {
-    public:
-        virtual void processInst(Function& func, ValueStack &stack, Engine *engine, CodeGenerator *codeGen) override;
-    private:
-        void processNFADE(CodeGenerator* codeGen);
-        void processSCR2D(CodeGenerator* codeGen);
-        void processSCR2DC(CodeGenerator* codeGen);
-        void processFADE(CodeGenerator* codeGen);
+    /**
+     * A camera instruction.
+     */
+    class FF7CameraInstruction : public KernelCallInstruction{
+
+        public:
+
+            /**
+             * Processes the instruction.
+             *
+             * @param func[in] Function to process.
+             * @param stack[out] Function stack.
+             * @param engine[in] Engine. Unused
+             * @param code_gen[in] Code generator.
+             */
+            virtual void processInst(
+              Function& func, ValueStack &stack, Engine *engine, CodeGenerator *code_gen
+            ) override;
+
+        private:
+
+            void processNFADE(CodeGenerator* code_gen);
+            void processSCR2D(CodeGenerator* code_gen);
+            void processSCR2DC(CodeGenerator* code_gen);
+            void processFADE(CodeGenerator* code_gen);
     };
 
-    class FF7AudioVideoInstruction : public KernelCallInstruction
-    {
-    public:
-        virtual void processInst(Function& func, ValueStack &stack, Engine *engine, CodeGenerator *codeGen) override;
-    private:
-        void processAKAO2(CodeGenerator* codeGen);
-        void processMUSIC(CodeGenerator* codeGen);
-        void processSOUND(CodeGenerator* codeGen);
-        void processAKAO(CodeGenerator* codeGen);
-        void processMULCK(CodeGenerator* codeGen);
-        void processPMVIE(CodeGenerator* codeGen);
-        void processMOVIE(CodeGenerator* codeGen);
-        void processMVIEF(CodeGenerator* codeGen);
+    /**
+     * An audio or video (or both) instruction.
+     */
+    class FF7AudioVideoInstruction : public KernelCallInstruction{
+
+        public:
+
+            /**
+             * Processes the instruction.
+             *
+             * @param func[in] Function to process.
+             * @param stack[out] Function stack.
+             * @param engine[in] Engine. Unused
+             * @param code_gen[in] Code generator.
+             */
+            virtual void processInst(
+              Function& func, ValueStack &stack, Engine *engine, CodeGenerator *code_gen
+            ) override;
+
+        private:
+
+            void processAKAO2(CodeGenerator* code_gen);
+            void processMUSIC(CodeGenerator* code_gen);
+            void processSOUND(CodeGenerator* code_gen);
+            void processAKAO(CodeGenerator* code_gen);
+            void processMULCK(CodeGenerator* code_gen);
+            void processPMVIE(CodeGenerator* code_gen);
+            void processMOVIE(CodeGenerator* code_gen);
+            void processMVIEF(CodeGenerator* code_gen);
     };
 
-    class FF7UncategorizedInstruction : public KernelCallInstruction
-    {
-    public:
-        virtual void processInst(Function& func, ValueStack &stack, Engine *engine, CodeGenerator *codeGen) override;
+    /**
+     * An instructions that doesn't fall in any other category.
+     */
+    class FF7UncategorizedInstruction : public KernelCallInstruction{
+
+        public:
+
+            /**
+             * Processes the instruction.
+             *
+             * @param func[in] Function to process.
+             * @param stack[out] Function stack.
+             * @param engine[in] Engine. Unused.
+             * @param code_gen[in] Code generator.
+             */
+            virtual void processInst(
+              Function& func, ValueStack &stack, Engine *engine, CodeGenerator *code_gen
+            ) override;
     };
 
-    class FF7NoOperationInstruction : public Instruction
-    {
-    public:
-        static InstPtr Create() { return new FF7NoOperationInstruction(); }
-        virtual void processInst(Function& func, ValueStack &stack, Engine *engine, CodeGenerator *codeGen) override;
+    /**
+     * An instruction that does nothing.
+     */
+    class FF7NoOperationInstruction : public Instruction{
+
+        public:
+
+            /**
+             * Generates a instruction that does nothing.
+             *
+             * @return The generated instruction.
+             */
+            static InstPtr Create(){return new FF7NoOperationInstruction();}
+
+            /**
+             * Processes the instruction.
+             *
+             * It doesn't do anything.
+             *
+             * @param func[in] Function to process. Unused.
+             * @param stack[out] Function stack. Unused.
+             * @param engine[in] Engine. Unused.
+             * @param code_gen[in] Code generator. Unused.
+             */
+            virtual void processInst(
+              Function& func, ValueStack &stack, Engine *engine, CodeGenerator *code_gen
+            ) override;
     };
 }

+ 1 - 0
lib/SUDM/decompiler/sudm.h

@@ -54,6 +54,7 @@ namespace SUDM
             struct Line{
                 std::string name;
                 std::vector<float> point_a;
+                std::vector<float> point_b;
                 float ax, ay, az;
                 float bx, by, bz;
             };

+ 2 - 2
output/data/config.cfg

@@ -31,7 +31,7 @@ bind F9 "script_run_string \"script:request( Script.UI, \\\"BeginMenu\\\", \\\"h
 bind F12 "screenshot"
 
 
-set_language English
+set_language english
 
 bind_game_event Space "message_ok"
 bind_game_event Up "message_up"
@@ -42,4 +42,4 @@ bind_game_event LCtrl "run"
 bind_game_event Up "walk_up"
 bind_game_event Right "walk_right"
 bind_game_event Down "walk_down"
-bind_game_event Left "walk_left"
+bind_game_event Left "walk_left"

+ 2 - 0
output/data/fonts.xml

@@ -5,4 +5,6 @@
     <font file_name="fonts/ffvii_menu.xml" />
     <font file_name="fonts/ffvii_digits.xml" />
     <font file_name="fonts/ffvii_timer.xml" />
+    <font file_name="fonts/ffvii.xml" />
+    <font file_name="fonts/ffvii.xml" />
 </fonts>

+ 96 - 0
output/data/fonts/ffvii.xml

@@ -0,0 +1,96 @@
+<font name="FFVIIFont" language="English" image="fonts/ffvii_en.png" image_size="256 256" height="16">
+    <char name=" " x="0" y="0" width="12" height="12" pre="0" post="-9" />
+    <char name="!" x="12" y="0" width="12" height="12" pre="2" post="-7" />
+    <char name="&quot;" x="24" y="0" width="12" height="12" pre="2" post="-4" />
+    <char name="#" x="36" y="0" width="12" height="12" pre="0" post="-2" />
+    <char name="$" x="48" y="0" width="12" height="12" pre="0" post="-5" />
+    <char name="%" x="60" y="0" width="12" height="12" pre="0" post="-2" />
+    <char name="&" x="72" y="0" width="12" height="12" pre="0" post="-3" />
+    <char name="'" x="84" y="0" width="12" height="12" pre="0" post="-9" />
+    <char name="(" x="96" y="0" width="12" height="12" pre="2" post="-4" />
+    <char name=")" x="108" y="0" width="12" height="12" pre="2" post="-4" />
+    <char name="*" x="120" y="0" width="12" height="12" pre="0" post="-5" />
+    <char name="+" x="132" y="0" width="12" height="12" pre="0" post="-5" />
+    <char name="," x="144" y="0" width="12" height="12" pre="1" post="-5" />
+    <char name="-" x="156" y="0" width="12" height="12" pre="0" post="-7" />
+    <char name="." x="168" y="0" width="12" height="12" pre="1" post="-6" />
+    <char name="/" x="180" y="0" width="12" height="12" pre="0" post="-6" />
+    <char name="0" x="192" y="0" width="12" height="12" pre="0" post="-4" />
+    <char name="1" x="204" y="0" width="12" height="12" pre="2" post="-5" />
+    <char name="2" x="216" y="0" width="12" height="12" pre="0" post="-4" />
+    <char name="3" x="228" y="0" width="12" height="12" pre="0" post="-4" />
+    <char name="4" x="240" y="0" width="12" height="12" pre="0" post="-4" />
+    <char name="5" x="0" y="12" width="12" height="12" pre="0" post="-4" />
+    <char name="6" x="12" y="12" width="12" height="12" pre="0" post="-4" />
+    <char name="7" x="24" y="12" width="12" height="12" pre="0" post="-4" />
+    <char name="8" x="36" y="12" width="12" height="12" pre="0" post="-4" />
+    <char name="9" x="48" y="12" width="12" height="12" pre="0" post="-4" />
+    <char name=":" x="60" y="12" width="12" height="12" pre="2" post="-7" />
+    <char name=";" x="72" y="12" width="12" height="12" pre="0" post="-8" />
+    <char name="<" x="84" y="12" width="12" height="12" pre="0" post="-5" />
+    <char name="=" x="96" y="12" width="12" height="12" pre="0" post="-4" />
+    <char name=">" x="108" y="12" width="12" height="12" pre="0" post="-5" />
+    <char name="?" x="120" y="12" width="12" height="12" pre="1" post="-5" />
+    <char name="@" x="132" y="12" width="12" height="12" pre="0" post="-2" />
+    <char name="A" x="144" y="12" width="12" height="12" pre="0" post="-3" />
+    <char name="B" x="156" y="12" width="12" height="12" pre="0" post="-5" />
+    <char name="C" x="168" y="12" width="12" height="12" pre="0" post="-4" />
+    <char name="D" x="180" y="12" width="12" height="12" pre="0" post="-4" />
+    <char name="E" x="192" y="12" width="12" height="12" pre="0" post="-5" />
+    <char name="F" x="204" y="12" width="12" height="12" pre="0" post="-5" />
+    <char name="G" x="216" y="12" width="12" height="12" pre="0" post="-4" />
+    <char name="H" x="228" y="12" width="12" height="12" pre="0" post="-4" />
+    <char name="I" x="240" y="12" width="12" height="12" pre="0" post="-9" />
+    <char name="J" x="0" y="24" width="12" height="12" pre="0" post="-6" />
+    <char name="K" x="12" y="24" width="12" height="12" pre="0" post="-5" />
+    <char name="L" x="24" y="24" width="12" height="12" pre="0" post="-5" />
+    <char name="M" x="36" y="24" width="12" height="12" pre="0" post="-1" />
+    <char name="N" x="48" y="24" width="12" height="12" pre="0" post="-4" />
+    <char name="O" x="60" y="24" width="12" height="12" pre="0" post="-3" />
+    <char name="P" x="72" y="24" width="12" height="12" pre="0" post="-5" />
+    <char name="Q" x="84" y="24" width="12" height="12" pre="0" post="-3" />
+    <char name="R" x="96" y="24" width="12" height="12" pre="0" post="-5" />
+    <char name="S" x="108" y="24" width="12" height="12" pre="0" post="-5" />
+    <char name="T" x="120" y="24" width="12" height="12" pre="0" post="-5" />
+    <char name="U" x="132" y="24" width="12" height="12" pre="0" post="-4" />
+    <char name="V" x="144" y="24" width="12" height="12" pre="0" post="-3" />
+    <char name="W" x="156" y="24" width="12" height="12" pre="0" post="-1" />
+    <char name="X" x="168" y="24" width="12" height="12" pre="0" post="-4" />
+    <char name="Y" x="180" y="24" width="12" height="12" pre="0" post="-3" />
+    <char name="Z" x="192" y="24" width="12" height="12" pre="0" post="-5" />
+    <char name="[" x="204" y="24" width="12" height="12" pre="0" post="-8" />
+    <char name="\" x="216" y="24" width="12" height="12" pre="0" post="-6" />
+    <char name="]" x="228" y="24" width="12" height="12" pre="0" post="-8" />
+    <char name="^" x="240" y="24" width="12" height="12" pre="0" post="-5" />
+    <char name="_" x="0" y="36" width="12" height="12" pre="0" post="-4" />
+    <char name="`" x="12" y="36" width="12" height="12" pre="0" post="-8" />
+    <char name="a" x="24" y="36" width="12" height="12" pre="0" post="-5" />
+    <char name="b" x="36" y="36" width="12" height="12" pre="0" post="-5" />
+    <char name="c" x="48" y="36" width="12" height="12" pre="0" post="-6" />
+    <char name="d" x="60" y="36" width="12" height="12" pre="0" post="-5" />
+    <char name="e" x="72" y="36" width="12" height="12" pre="0" post="-5" />
+    <char name="f" x="84" y="36" width="12" height="12" pre="0" post="-6" />
+    <char name="g" x="96" y="36" width="12" height="12" pre="0" post="-5" />
+    <char name="h" x="108" y="36" width="12" height="12" pre="0" post="-5" />
+    <char name="i" x="120" y="36" width="12" height="12" pre="0" post="-9" />
+    <char name="j" x="132" y="36" width="12" height="12" pre="0" post="-8" />
+    <char name="k" x="144" y="36" width="12" height="12" pre="0" post="-6" />
+    <char name="l" x="156" y="36" width="12" height="12" pre="0" post="-9" />
+    <char name="m" x="168" y="36" width="12" height="12" pre="0" post="-1" />
+    <char name="n" x="180" y="36" width="12" height="12" pre="0" post="-5" />
+    <char name="o" x="192" y="36" width="12" height="12" pre="0" post="-5" />
+    <char name="p" x="204" y="36" width="12" height="12" pre="0" post="-5" />
+    <char name="q" x="216" y="36" width="12" height="12" pre="0" post="-5" />
+    <char name="r" x="228" y="36" width="12" height="12" pre="0" post="-7" />
+    <char name="s" x="240" y="36" width="12" height="12" pre="0" post="-6" />
+    <char name="t" x="0" y="48" width="12" height="12" pre="0" post="-6" />
+    <char name="u" x="12" y="48" width="12" height="12" pre="0" post="-5" />
+    <char name="v" x="24" y="48" width="12" height="12" pre="0" post="-5" />
+    <char name="w" x="36" y="48" width="12" height="12" pre="0" post="-1" />
+    <char name="x" x="48" y="48" width="12" height="12" pre="0" post="-5" />
+    <char name="y" x="60" y="48" width="12" height="12" pre="0" post="-5" />
+    <char name="z" x="72" y="48" width="12" height="12" pre="0" post="-6" />
+    <char name="…" x="12" y="96" width="12" height="12" pre="0" post="-3" />
+    <char name="“" x="120" y="96" width="12" height="12" pre="0" post="-6" />
+    <char name="”" x="132" y="96" width="12" height="12" pre="0" post="-6" />
+</font>

+ 14 - 20
output/data/maps.xml

@@ -1,22 +1,16 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
 <maps>
-  
-    <map name="ffvii_startmap" file_name="maps/ffvii/field/startmap.xml" />
-    <map name="ffvii_md1stin" file_name="maps/ffvii/field/md1stin.xml" />
-    <map name="ffvii_md1_1" file_name="maps/ffvii/field/md1_1.xml" />
-    <map name="ffvii_md1_2" file_name="maps/ffvii/field/md1_2.xml" />
-    <map name="ffvii_nrthmk" file_name="maps/ffvii/field/nrthmk.xml" />
-    <map name="ffvii_nmkin_1" file_name="maps/ffvii/field/nmkin_1.xml" />
-    <map name="ffvii_elevtr1" file_name="maps/ffvii/field/elevtr1.xml" />
-    <map name="ffvii_nmkin_2" file_name="maps/ffvii/field/nmkin_2.xml" />
-    <map name="ffvii_nmkin_3" file_name="maps/ffvii/field/nmkin_3.xml" />
-    <map name="ffvii_tin_2" file_name="maps/ffvii/field/tin_2.xml" />
-
-    <map name="ffvii_battle_300" file_name="maps/ffvii/battle/300.xml" />
-    <map name="ffvii_battle_bridge_scene" file_name="maps/ffvii/battle/bridge.xml" />
-
-    <map name="debug" file_name="maps/test/debug.xml" />
-    <map name="test_1" file_name="maps/test/test_1.xml" />
-    <map name="test_2" file_name="maps/test/test_2.xml" />
-    <map name="test_3" file_name="maps/test/test_3.xml" />
+    <map name="ffvii_elevtr1" file_name="maps/ffvii/field/elevtr1/map.xml" />
+    <map name="ffvii_md1_1" file_name="maps/ffvii/field/md1_1/map.xml" />
+    <map name="ffvii_md1_2" file_name="maps/ffvii/field/md1_2/map.xml" />
+    <map name="ffvii_md1stin" file_name="maps/ffvii/field/md1stin/map.xml" />
+    <map name="ffvii_md8_1" file_name="maps/ffvii/field/md8_1/map.xml" />
+    <map name="ffvii_md8_4" file_name="maps/ffvii/field/md8_4/map.xml" />
+    <map name="ffvii_nmkin_1" file_name="maps/ffvii/field/nmkin_1/map.xml" />
+    <map name="ffvii_nmkin_2" file_name="maps/ffvii/field/nmkin_2/map.xml" />
+    <map name="ffvii_nmkin_3" file_name="maps/ffvii/field/nmkin_3/map.xml" />
+    <map name="ffvii_nrthmk" file_name="maps/ffvii/field/nrthmk/map.xml" />
+    <map name="ffvii_rootmap" file_name="maps/ffvii/field/rootmap/map.xml" />
+    <map name="ffvii_startmap" file_name="maps/ffvii/field/startmap/map.xml" />
+    <map name="ffvii_tin_1" file_name="maps/ffvii/field/tin_1/map.xml" />
+    <map name="ffvii_tin_2" file_name="maps/ffvii/field/tin_2/map.xml" />
 </maps>

+ 3 - 1
output/data/screens/begin_menu/begin_menu.lua

@@ -37,7 +37,9 @@ UiContainer.BeginMenu = {
                     script:request_end_sync( Script.UI, "BeginMenu", "hide", 0 )
                     console( "camera_free true" )
                     console( "debug_walkmesh true" )
-                    map( "test_1" )
+                    load_field_map_request("ffvii_nmkin_1", "Spawn_nrthmk")
+                    --map("ffvii_md1_2")
+                    --map( "test_1" )
                     FFVII.MenuSettings.pause_available = true
                 elseif self.position == 4 then
                     script:request_end_sync( Script.UI, "BeginMenu", "hide", 0 )

+ 4 - 4
output/data/screens/idol/idol.lua

@@ -48,10 +48,10 @@ UiContainer.Idol = {
                     ui_manager:get_widget( "Idol.ArrowLeft" ):play_animation( "Press" )
                     self.picture_current = self.picture_current + 1
                     if self.picture_current == self.picture_number then
-                        ui_manager:get_widget( "Idol.ArrowLeft" ):setcolour_( 0.5, 0.5, 0.5 )
+                        ui_manager:get_widget( "Idol.ArrowLeft" ):set_colour( 0.5, 0.5, 0.5 )
                         ui_manager:get_widget( "Idol.ArrowLeft" ):set_alpha( 0.5 )
                     end
-                    ui_manager:get_widget( "Idol.ArrowRight" ):setcolour_( 1, 1, 1 )
+                    ui_manager:get_widget( "Idol.ArrowRight" ):set_colour( 1, 1, 1 )
                     ui_manager:get_widget( "Idol.ArrowRight" ):set_alpha( 1 )
 
                     for i = 1, self.picture_number, 1 do
@@ -81,10 +81,10 @@ UiContainer.Idol = {
                     ui_manager:get_widget( "Idol.ArrowRight" ):play_animation( "Press" )
                     self.picture_current = self.picture_current - 1
                     if self.picture_current == 1 then
-                        ui_manager:get_widget( "Idol.ArrowRight" ):setcolour_( 0.5, 0.5, 0.5 )
+                        ui_manager:get_widget( "Idol.ArrowRight" ):set_colour( 0.5, 0.5, 0.5 )
                         ui_manager:get_widget( "Idol.ArrowRight" ):set_alpha( 0.5 )
                     end
-                    ui_manager:get_widget( "Idol.ArrowLeft" ):setcolour_( 1, 1, 1 )
+                    ui_manager:get_widget( "Idol.ArrowLeft" ):set_colour( 1, 1, 1 )
                     ui_manager:get_widget( "Idol.ArrowLeft" ):set_alpha( 1 )
 
                     for i = 1, self.picture_number, 1 do

+ 1 - 1
output/data/screens/main_menu/main_menu.lua

@@ -61,7 +61,7 @@ UiContainer.MainMenu = {
         local location    = ui_manager:get_widget( "MainMenu.Container.Location" )
 
         ui_manager:get_widget( "MainMenu.Container.Menu.PHSText" ):set_visible( false )
-        ui_manager:get_widget( "MainMenu.Container.Menu.SaveText" ):setcolour_( 0.4, 0.4, 0.4 )
+        ui_manager:get_widget( "MainMenu.Container.Menu.SaveText" ):set_colour( 0.4, 0.4, 0.4 )
 
         characters:play_animation_stop( "Appear" )
         menu:play_animation_stop( "Appear" )

+ 26 - 0
output/data/scripts/ffvii/data.lua

@@ -32,6 +32,11 @@ FFVII.Data = {
     m1_226 = false,
     m1_times_up = false,
     item_sector1_chest1 = false,
+
+    -- TODO: From here on, what are these for?
+    movieFrameNumber = 0,
+    temp_6_4 = 0,
+    expectedTriangleId = 0,
 }
 
 
@@ -59,3 +64,24 @@ FFVII.ItemStorage = {
 
 FFVII.Party = {
 }
+
+FFVII.Banks = {}
+for i = 1, 15 do
+    FFVII.Banks[i] = {}
+    for j = 1, 256 do
+        FFVII.Banks[i][j] = 0
+    end
+end
+
+FFVII.BitBanks = {}
+for i = 1, 16 do
+    FFVII.BitBanks[i] = {}
+    for j = 1, 256 do
+        FFVII.BitBanks[i][j] = {}
+        for k = 1, 8 do
+            FFVII.BitBanks[i][j][k] = 0
+        end
+    end
+end
+
+

+ 120 - 2
output/data/scripts/ffvii/field.lua

@@ -7,8 +7,6 @@ load_field_map_request = function( map_name, point_name )
     end
 end
 
-
-
 set_entity_to_character = function( entity_name, character_name )
     if character_name == FFVII.Party[ 1 ] and entity_name ~= "" then
         if System.MapChanger.point_name ~= "" then
@@ -26,16 +24,136 @@ set_entity_to_character = function( entity_name, character_name )
 
         entity_manager:set_player_entity( entity_name )
     end
+    entity_manager:set_entity_to_character(entity_name, character_name)
 end
 
+--[[
+ Joins the party members in the field.
+ @param speed Speed at which the characters join
+]]
+join_party = function(speed)
+    local player = entity_manager:get_player_entity()
+    if (player  == nil) then
+        do return end
+    end
+    local x, y, z = player:get_position()
+    for c = 2, 3 do
+        if FFVII.Party[c] ~= nil then
+            local character = entity_manager:get_entity_from_character_id(FFVII.Party[c])
+            if character ~= nil then
+                local cur_speed = character:get_move_auto_speed()
+                character:set_solid(false)
+                -- Approximated speed, good enough for now.
+                -- TODO: Calculate speed based on time, as the orignal opcode.
+                character:set_move_auto_speed(speed / 16)
+                character:move_to_position(x, y)
+                character:move_sync()
+                character:set_move_auto_speed(cur_speed)
+                character:set_visible(false)
+                character:set_talkable(false)
+            end
+        end
+    end
+end
 
+--[[
+ Splits the party members in the field.
+ @param ax_addr Bank for ax, or zero if ax is specified as a literal value.
+ @param ay_addr Bank for ay, or zero if ay is specified as a literal value.
+ @param ar_addr Bank for ar, or zero if ar is specified as a literal value.
+ @param bx_addr Bank for bx, or zero if bx is specified as a literal value.
+ @param by_addr Bank for by, or zero if by is specified as a literal value.
+ @param br_addr Bank for br, or zero if by is specified as a literal value.
+ @param ax X-coordinate of the second character in the party after the split, or address for the value if ax_addr is non-zero.
+ @param ay Y-coordinate of the second character in the party after the split, or address for the value if ax_addr is non-zero.
+ @param ar Direction the second character faces after the split, or address for the value if ar_addr is non-zero.
+ @param bx X-coordinate of the third character in the party after the split, or address for the value if bx_addr is non-zero.
+ @param by Y-coordinate of the third character in the party after the split, or address for the value if bx_addr is non-zero.
+ @param br Direction the third character faces after the split, or address for the value if br_addr is non-zero.
+ @param speed Speed at which the characters split.
+]]
+split_party = function(ax_addr, ay_addr, ar_addr, bx_addr, by_addr, br_addr, ax, ay, ar, bx, by, br, speed)
+    local player = entity_manager:get_player_entity()
+    local x, y, z = player:get_position()
+    for c = 2, 3 do
+        if FFVII.Party[c] ~= nil then
+            local character = entity_manager:get_entity_from_character_id(FFVII.Party[c])
+            if character ~= nil then
+                local cur_speed = character:get_move_auto_speed()
+                -- Approximated speed, good enough for now.
+                -- TODO: Calculate speed based on time, as the orignal opcode.
+                character:set_move_auto_speed(speed / 16)
+                character:set_position(x, y, z)
+                character:set_visible(true)
+                character:set_solid(false)
+                if c == 2 then
+                    character:move_to_position(ax, ay)
+                elseif c == 3 then
+                    character:move_to_position(bx, by)
+                end
+                character:move_sync()
+                if c == 2 then
+                    character:set_rotation(ar)
+                elseif c == 3 then
+                    character:set_rotation(br)
+                end
+                character:set_move_auto_speed(cur_speed)
+                character:set_solid(true)
+                character:set_talkable(true)
+            end
+        end
+    end
+end
 
+--[[
+ Locks or unlocks player movement and menu access.
+ @param lock True to lock, false to unlock.
+]]
 player_lock = function( lock )
     entity_manager:player_lock( lock )
     FFVII.MenuSettings.available = ( lock == false )
 end
 
+--[[
+ Sets a bit variable on (1).
+ @param bank Memory bank (0-index, as in game).
+ @param variable Bank address (0-index, as in game).
+ @param bit Address bit (0-index, as in game).
+]]
+bit_on = function(bank, variable, bit)
+    FFVII.BitBanks[bank + 1][variable + 1][bit + 1] = 1
+end
+
+--[[
+ Sets a bit variable off (0).
+ @param bank Memory bank (0-index, as in game).
+ @param variable Bank address (0-index, as in game).
+ @param bit Address bit (0-index, as in game).
+]]
+bit_off = function(bank, variable, bit)
+    FFVII.BitBanks[bank + 1][variable + 1][bit + 1] = 0
+end
+
+--[[
+ Retrieves a bit variable.
+ @param bank Memory bank (0-index, as in game).
+ @param variable Bank address (0-index, as in game).
+ @param bit Address bit (0-index, as in game).
+ @return 1 or 0
+]]
+bit = function(bank, variable, bit)
+    return FFVII.BitBanks[bank + 1][variable + 1][bit + 1]
+end
 
+--[[
+ Checks if a key is being pressed.
+ @param key_code The code of the key to check.
+ @return True if the key is being pressed, false otherwise.
+ @todo Implement.
+]]
+KeyOn = function(key_code)
+    return true;
+end
 
 System[ "MapChanger" ] = {
     map_name = "",

+ 1 - 1
output/data/scripts/ffvii/system.lua

@@ -124,7 +124,7 @@ FFVII.add_item = function( item, quantity )
 
     FFVII.ItemStorage[ item ] = old_quantity + quantity
 
-    if FFVII.ItemStorage[ item ] < 99 then
+    if FFVII.ItemStorage[ item ] > 99 then
         FFVII.ItemStorage[ item ] = 99
     end
 end

+ 233 - 1
output/data/system/system.fontdef

@@ -1,4 +1,236 @@
-CourierNew
+font FFVIIFont
+{
+    type image
+    source system/courier_new_9_75.png
+
+    glyph u32 0.015625 0.125 0.046875 0.1875
+    glyph u33 0.078125 0.125 0.109375 0.1875
+    glyph u34 0.140625 0.125 0.171875 0.1875
+    glyph u35 0.203125 0.125 0.234375 0.1875
+    glyph u36 0.265625 0.125 0.296875 0.1875
+    glyph u37 0.328125 0.125 0.359375 0.1875
+    glyph u38 0.390625 0.125 0.421875 0.1875
+    glyph u39 0.453125 0.125 0.484375 0.1875
+    glyph u40 0.515625 0.125 0.546875 0.1875
+    glyph u41 0.578125 0.125 0.609375 0.1875
+    glyph u42 0.640625 0.125 0.671875 0.1875
+    glyph u43 0.703125 0.125 0.734375 0.1875
+    glyph u44 0.765625 0.125 0.796875 0.1875
+    glyph u45 0.828125 0.125 0.859375 0.1875
+    glyph u46 0.890625 0.125 0.921875 0.1875
+    glyph u47 0.953125 0.125 0.984375 0.1875
+    glyph u48 0.015625 0.1875 0.046875 0.25
+    glyph u49 0.078125 0.1875 0.109375 0.25
+    glyph u50 0.140625 0.1875 0.171875 0.25
+    glyph u51 0.203125 0.1875 0.234375 0.25
+    glyph u52 0.265625 0.1875 0.296875 0.25
+    glyph u53 0.328125 0.1875 0.359375 0.25
+    glyph u54 0.390625 0.1875 0.421875 0.25
+    glyph u55 0.453125 0.1875 0.484375 0.25
+    glyph u56 0.515625 0.1875 0.546875 0.25
+    glyph u57 0.578125 0.1875 0.609375 0.25
+    glyph u58 0.640625 0.1875 0.671875 0.25
+    glyph u59 0.703125 0.1875 0.734375 0.25
+    glyph u60 0.765625 0.1875 0.796875 0.25
+    glyph u61 0.828125 0.1875 0.859375 0.25
+    glyph u62 0.890625 0.1875 0.921875 0.25
+    glyph u63 0.953125 0.1875 0.984375 0.25
+    glyph u64 0.015625 0.25 0.046875 0.3125
+    glyph u65 0.078125 0.25 0.109375 0.3125
+    glyph u66 0.140625 0.25 0.171875 0.3125
+    glyph u67 0.203125 0.25 0.234375 0.3125
+    glyph u68 0.265625 0.25 0.296875 0.3125
+    glyph u69 0.328125 0.25 0.359375 0.3125
+    glyph u70 0.390625 0.25 0.421875 0.3125
+    glyph u71 0.453125 0.25 0.484375 0.3125
+    glyph u72 0.515625 0.25 0.546875 0.3125
+    glyph u73 0.578125 0.25 0.609375 0.3125
+    glyph u74 0.640625 0.25 0.671875 0.3125
+    glyph u75 0.703125 0.25 0.734375 0.3125
+    glyph u76 0.765625 0.25 0.796875 0.3125
+    glyph u77 0.828125 0.25 0.859375 0.3125
+    glyph u78 0.890625 0.25 0.921875 0.3125
+    glyph u79 0.953125 0.25 0.984375 0.3125
+    glyph u80 0.015625 0.3125 0.046875 0.375
+    glyph u81 0.078125 0.3125 0.109375 0.375
+    glyph u82 0.140625 0.3125 0.171875 0.375
+    glyph u83 0.203125 0.3125 0.234375 0.375
+    glyph u84 0.265625 0.3125 0.296875 0.375
+    glyph u85 0.328125 0.3125 0.359375 0.375
+    glyph u86 0.390625 0.3125 0.421875 0.375
+    glyph u87 0.453125 0.3125 0.484375 0.375
+    glyph u88 0.515625 0.3125 0.546875 0.375
+    glyph u89 0.578125 0.3125 0.609375 0.375
+    glyph u90 0.640625 0.3125 0.671875 0.375
+    glyph u91 0.703125 0.3125 0.734375 0.375
+    glyph u92 0.765625 0.3125 0.796875 0.375
+    glyph u93 0.828125 0.3125 0.859375 0.375
+    glyph u94 0.890625 0.3125 0.921875 0.375
+    glyph u95 0.953125 0.3125 0.984375 0.375
+    glyph u96 0.015625 0.375 0.046875 0.4375
+    glyph u97 0.078125 0.375 0.109375 0.4375
+    glyph u98 0.140625 0.375 0.171875 0.4375
+    glyph u99 0.203125 0.375 0.234375 0.4375
+    glyph u100 0.265625 0.375 0.296875 0.4375
+    glyph u101 0.328125 0.375 0.359375 0.4375
+    glyph u102 0.390625 0.375 0.421875 0.4375
+    glyph u103 0.453125 0.375 0.484375 0.4375
+    glyph u104 0.515625 0.375 0.546875 0.4375
+    glyph u105 0.578125 0.375 0.609375 0.4375
+    glyph u106 0.640625 0.375 0.671875 0.4375
+    glyph u107 0.703125 0.375 0.734375 0.4375
+    glyph u108 0.765625 0.375 0.796875 0.4375
+    glyph u109 0.828125 0.375 0.859375 0.4375
+    glyph u110 0.890625 0.375 0.921875 0.4375
+    glyph u111 0.953125 0.375 0.984375 0.4375
+    glyph u112 0.015625 0.4375 0.046875 0.5
+    glyph u113 0.078125 0.4375 0.109375 0.5
+    glyph u114 0.140625 0.4375 0.171875 0.5
+    glyph u115 0.203125 0.4375 0.234375 0.5
+    glyph u116 0.265625 0.4375 0.296875 0.5
+    glyph u117 0.328125 0.4375 0.359375 0.5
+    glyph u118 0.390625 0.4375 0.421875 0.5
+    glyph u119 0.453125 0.4375 0.484375 0.5
+    glyph u120 0.515625 0.4375 0.546875 0.5
+    glyph u121 0.578125 0.4375 0.609375 0.5
+    glyph u122 0.640625 0.4375 0.671875 0.5
+    glyph u123 0.703125 0.4375 0.734375 0.5
+    glyph u124 0.765625 0.4375 0.796875 0.5
+    glyph u125 0.828125 0.4375 0.859375 0.5
+    glyph u126 0.890625 0.4375 0.921875 0.5
+    glyph u127 0.953125 0.4375 0.984375 0.5
+    glyph u128 0.015625 0.5 0.046875 0.5625
+    glyph u129 0.078125 0.5 0.109375 0.5625
+    glyph u130 0.140625 0.5 0.171875 0.5625
+    glyph u131 0.203125 0.5 0.234375 0.5625
+    glyph u132 0.265625 0.5 0.296875 0.5625
+    glyph u133 0.328125 0.5 0.359375 0.5625
+    glyph u134 0.390625 0.5 0.421875 0.5625
+    glyph u135 0.453125 0.5 0.484375 0.5625
+    glyph u136 0.515625 0.5 0.546875 0.5625
+    glyph u137 0.578125 0.5 0.609375 0.5625
+    glyph u138 0.640625 0.5 0.671875 0.5625
+    glyph u139 0.703125 0.5 0.734375 0.5625
+    glyph u140 0.765625 0.5 0.796875 0.5625
+    glyph u141 0.828125 0.5 0.859375 0.5625
+    glyph u142 0.890625 0.5 0.921875 0.5625
+    glyph u143 0.953125 0.5 0.984375 0.5625
+    glyph u144 0.015625 0.5625 0.046875 0.625
+    glyph u145 0.078125 0.5625 0.109375 0.625
+    glyph u146 0.140625 0.5625 0.171875 0.625
+    glyph u147 0.203125 0.5625 0.234375 0.625
+    glyph u148 0.265625 0.5625 0.296875 0.625
+    glyph u149 0.328125 0.5625 0.359375 0.625
+    glyph u150 0.390625 0.5625 0.421875 0.625
+    glyph u151 0.453125 0.5625 0.484375 0.625
+    glyph u152 0.515625 0.5625 0.546875 0.625
+    glyph u153 0.578125 0.5625 0.609375 0.625
+    glyph u154 0.640625 0.5625 0.671875 0.625
+    glyph u155 0.703125 0.5625 0.734375 0.625
+    glyph u156 0.765625 0.5625 0.796875 0.625
+    glyph u157 0.828125 0.5625 0.859375 0.625
+    glyph u158 0.890625 0.5625 0.921875 0.625
+    glyph u159 0.953125 0.5625 0.984375 0.625
+    glyph u160 0.015625 0.625 0.046875 0.6875
+    glyph u161 0.078125 0.625 0.109375 0.6875
+    glyph u162 0.140625 0.625 0.171875 0.6875
+    glyph u163 0.203125 0.625 0.234375 0.6875
+    glyph u164 0.265625 0.625 0.296875 0.6875
+    glyph u165 0.328125 0.625 0.359375 0.6875
+    glyph u166 0.390625 0.625 0.421875 0.6875
+    glyph u167 0.453125 0.625 0.484375 0.6875
+    glyph u168 0.515625 0.625 0.546875 0.6875
+    glyph u169 0.578125 0.625 0.609375 0.6875
+    glyph u170 0.640625 0.625 0.671875 0.6875
+    glyph u171 0.703125 0.625 0.734375 0.6875
+    glyph u172 0.765625 0.625 0.796875 0.6875
+    glyph u173 0.828125 0.625 0.859375 0.6875
+    glyph u174 0.890625 0.625 0.921875 0.6875
+    glyph u175 0.953125 0.625 0.984375 0.6875
+    glyph u176 0.015625 0.6875 0.046875 0.75
+    glyph u177 0.078125 0.6875 0.109375 0.75
+    glyph u178 0.140625 0.6875 0.171875 0.75
+    glyph u179 0.203125 0.6875 0.234375 0.75
+    glyph u180 0.265625 0.6875 0.296875 0.75
+    glyph u181 0.328125 0.6875 0.359375 0.75
+    glyph u182 0.390625 0.6875 0.421875 0.75
+    glyph u183 0.453125 0.6875 0.484375 0.75
+    glyph u184 0.515625 0.6875 0.546875 0.75
+    glyph u185 0.578125 0.6875 0.609375 0.75
+    glyph u186 0.640625 0.6875 0.671875 0.75
+    glyph u187 0.703125 0.6875 0.734375 0.75
+    glyph u188 0.765625 0.6875 0.796875 0.75
+    glyph u189 0.828125 0.6875 0.859375 0.75
+    glyph u190 0.890625 0.6875 0.921875 0.75
+    glyph u191 0.953125 0.6875 0.984375 0.75
+    glyph u192 0.015625 0.75 0.046875 0.8125
+    glyph u193 0.078125 0.75 0.109375 0.8125
+    glyph u194 0.140625 0.75 0.171875 0.8125
+    glyph u195 0.203125 0.75 0.234375 0.8125
+    glyph u196 0.265625 0.75 0.296875 0.8125
+    glyph u197 0.328125 0.75 0.359375 0.8125
+    glyph u198 0.390625 0.75 0.421875 0.8125
+    glyph u199 0.453125 0.75 0.484375 0.8125
+    glyph u200 0.515625 0.75 0.546875 0.8125
+    glyph u201 0.578125 0.75 0.609375 0.8125
+    glyph u202 0.640625 0.75 0.671875 0.8125
+    glyph u203 0.703125 0.75 0.734375 0.8125
+    glyph u204 0.765625 0.75 0.796875 0.8125
+    glyph u205 0.828125 0.75 0.859375 0.8125
+    glyph u206 0.890625 0.75 0.921875 0.8125
+    glyph u207 0.953125 0.75 0.984375 0.8125
+    glyph u208 0.015625 0.8125 0.046875 0.875
+    glyph u209 0.078125 0.8125 0.109375 0.875
+    glyph u210 0.140625 0.8125 0.171875 0.875
+    glyph u211 0.203125 0.8125 0.234375 0.875
+    glyph u212 0.265625 0.8125 0.296875 0.875
+    glyph u213 0.328125 0.8125 0.359375 0.875
+    glyph u214 0.390625 0.8125 0.421875 0.875
+    glyph u215 0.453125 0.8125 0.484375 0.875
+    glyph u216 0.515625 0.8125 0.546875 0.875
+    glyph u217 0.578125 0.8125 0.609375 0.875
+    glyph u218 0.640625 0.8125 0.671875 0.875
+    glyph u219 0.703125 0.8125 0.734375 0.875
+    glyph u220 0.765625 0.8125 0.796875 0.875
+    glyph u221 0.828125 0.8125 0.859375 0.875
+    glyph u222 0.890625 0.8125 0.921875 0.875
+    glyph u223 0.953125 0.8125 0.984375 0.875
+    glyph u224 0.015625 0.875 0.046875 0.9375
+    glyph u225 0.078125 0.875 0.109375 0.9375
+    glyph u226 0.140625 0.875 0.171875 0.9375
+    glyph u227 0.203125 0.875 0.234375 0.9375
+    glyph u228 0.265625 0.875 0.296875 0.9375
+    glyph u229 0.328125 0.875 0.359375 0.9375
+    glyph u230 0.390625 0.875 0.421875 0.9375
+    glyph u231 0.453125 0.875 0.484375 0.9375
+    glyph u232 0.515625 0.875 0.546875 0.9375
+    glyph u233 0.578125 0.875 0.609375 0.9375
+    glyph u234 0.640625 0.875 0.671875 0.9375
+    glyph u235 0.703125 0.875 0.734375 0.9375
+    glyph u236 0.765625 0.875 0.796875 0.9375
+    glyph u237 0.828125 0.875 0.859375 0.9375
+    glyph u238 0.890625 0.875 0.921875 0.9375
+    glyph u239 0.953125 0.875 0.984375 0.9375
+    glyph u240 0.015625 0.9375 0.046875 1
+    glyph u241 0.078125 0.9375 0.109375 1
+    glyph u242 0.140625 0.9375 0.171875 1
+    glyph u243 0.203125 0.9375 0.234375 1
+    glyph u244 0.265625 0.9375 0.296875 1
+    glyph u245 0.328125 0.9375 0.359375 1
+    glyph u246 0.390625 0.9375 0.421875 1
+    glyph u247 0.453125 0.9375 0.484375 1
+    glyph u248 0.515625 0.9375 0.546875 1
+    glyph u249 0.578125 0.9375 0.609375 1
+    glyph u250 0.640625 0.9375 0.671875 1
+    glyph u251 0.703125 0.9375 0.734375 1
+    glyph u252 0.765625 0.9375 0.796875 1
+    glyph u253 0.828125 0.9375 0.859375 1
+    glyph u254 0.890625 0.9375 0.921875 1
+    glyph u255 0.953125 0.9375 0.984375 1
+}
+
+
+font CourierNew
 {
     type image
     source system/courier_new_9_75.png

+ 2 - 2
output/data/system/system.lua

@@ -1,4 +1,4 @@
--- create containers for all script entities
+-- create containers for all script entitys
 System = {}
 EntityContainer = {}
 UiContainer = {}
@@ -24,4 +24,4 @@ function table.copy( t )
     setmetatable( res, mt )
 
     return res
-end
+end

+ 1 - 1
output/data/texts.xml

@@ -1,5 +1,5 @@
 <texts>
-    <language name="English">
+    <language name="english">
         <text file="texts/english/names.xml" />
         <text file="texts/english/menu.xml" />
         <text file="texts/english/dialogs_receiving.xml" />

+ 16 - 7
output/plugins.cfg

@@ -1,10 +1,19 @@
+# Defines plugins to load
+
 # Define plugin folder
-PluginFolder=/usr/lib/q-gears/plugins/
-#PluginFolder=/usr/lib/x86_64-linux-gnu/OGRE/
-#PluginFolder=~/.q-gears/plugins
+PluginFolder=.
 
 # Define plugins
-    Plugin=RenderSystem_GL
-#    Plugin=Plugin_Data
- 
-Plugin=Codec_FreeImage
+# Plugin=RenderSystem_Direct3D9
+# Plugin=RenderSystem_Direct3D11
+ Plugin=RenderSystem_GL
+# Plugin=RenderSystem_GLES
+# Plugin=RenderSystem_GLES2
+# Plugin=Plugin_ParticleFX
+# Plugin=Plugin_BSPSceneManager
+# Plugin=Plugin_CgProgramManager
+# Plugin=Plugin_PCZSceneManager
+# Plugin=Plugin_OctreeZone
+# Plugin=Plugin_OctreeSceneManager
+# Plugin=Plugin_Data
+Plugin=Codec_STBI

+ 9 - 3
output/resources.cfg

@@ -3,6 +3,12 @@
 FileSystem=data
 
 [FFVII_World]
-#FileSystem=D:/game/Final Fantasy VII/data_orig
-#LGP=D:/game/Final Fantasy VII/data/field/gflevel.lgp
-LGP=C:\Program Files (x86)\Steam\SteamApps\common\FINAL FANTASY VII\data\wm\world_us.lgp
+#LGP=~/.wine/drive_c/FF7/data/wm/world_us.lgp
+
+[FFVIIFields]
+
+[FFVIITextures]
+FileSystem=data/models/ffvii/field/units/
+
+[General]
+#FileSystem=/home/ivalentin/.q-gears/

+ 461 - 0
output/system.fontdef

@@ -0,0 +1,461 @@
+font FFVIIFont
+{
+    type image
+    source system/courier_new_9_75.png
+
+    glyph u32 0.015625 0.125 0.046875 0.1875
+    glyph u33 0.078125 0.125 0.109375 0.1875
+    glyph u34 0.140625 0.125 0.171875 0.1875
+    glyph u35 0.203125 0.125 0.234375 0.1875
+    glyph u36 0.265625 0.125 0.296875 0.1875
+    glyph u37 0.328125 0.125 0.359375 0.1875
+    glyph u38 0.390625 0.125 0.421875 0.1875
+    glyph u39 0.453125 0.125 0.484375 0.1875
+    glyph u40 0.515625 0.125 0.546875 0.1875
+    glyph u41 0.578125 0.125 0.609375 0.1875
+    glyph u42 0.640625 0.125 0.671875 0.1875
+    glyph u43 0.703125 0.125 0.734375 0.1875
+    glyph u44 0.765625 0.125 0.796875 0.1875
+    glyph u45 0.828125 0.125 0.859375 0.1875
+    glyph u46 0.890625 0.125 0.921875 0.1875
+    glyph u47 0.953125 0.125 0.984375 0.1875
+    glyph u48 0.015625 0.1875 0.046875 0.25
+    glyph u49 0.078125 0.1875 0.109375 0.25
+    glyph u50 0.140625 0.1875 0.171875 0.25
+    glyph u51 0.203125 0.1875 0.234375 0.25
+    glyph u52 0.265625 0.1875 0.296875 0.25
+    glyph u53 0.328125 0.1875 0.359375 0.25
+    glyph u54 0.390625 0.1875 0.421875 0.25
+    glyph u55 0.453125 0.1875 0.484375 0.25
+    glyph u56 0.515625 0.1875 0.546875 0.25
+    glyph u57 0.578125 0.1875 0.609375 0.25
+    glyph u58 0.640625 0.1875 0.671875 0.25
+    glyph u59 0.703125 0.1875 0.734375 0.25
+    glyph u60 0.765625 0.1875 0.796875 0.25
+    glyph u61 0.828125 0.1875 0.859375 0.25
+    glyph u62 0.890625 0.1875 0.921875 0.25
+    glyph u63 0.953125 0.1875 0.984375 0.25
+    glyph u64 0.015625 0.25 0.046875 0.3125
+    glyph u65 0.078125 0.25 0.109375 0.3125
+    glyph u66 0.140625 0.25 0.171875 0.3125
+    glyph u67 0.203125 0.25 0.234375 0.3125
+    glyph u68 0.265625 0.25 0.296875 0.3125
+    glyph u69 0.328125 0.25 0.359375 0.3125
+    glyph u70 0.390625 0.25 0.421875 0.3125
+    glyph u71 0.453125 0.25 0.484375 0.3125
+    glyph u72 0.515625 0.25 0.546875 0.3125
+    glyph u73 0.578125 0.25 0.609375 0.3125
+    glyph u74 0.640625 0.25 0.671875 0.3125
+    glyph u75 0.703125 0.25 0.734375 0.3125
+    glyph u76 0.765625 0.25 0.796875 0.3125
+    glyph u77 0.828125 0.25 0.859375 0.3125
+    glyph u78 0.890625 0.25 0.921875 0.3125
+    glyph u79 0.953125 0.25 0.984375 0.3125
+    glyph u80 0.015625 0.3125 0.046875 0.375
+    glyph u81 0.078125 0.3125 0.109375 0.375
+    glyph u82 0.140625 0.3125 0.171875 0.375
+    glyph u83 0.203125 0.3125 0.234375 0.375
+    glyph u84 0.265625 0.3125 0.296875 0.375
+    glyph u85 0.328125 0.3125 0.359375 0.375
+    glyph u86 0.390625 0.3125 0.421875 0.375
+    glyph u87 0.453125 0.3125 0.484375 0.375
+    glyph u88 0.515625 0.3125 0.546875 0.375
+    glyph u89 0.578125 0.3125 0.609375 0.375
+    glyph u90 0.640625 0.3125 0.671875 0.375
+    glyph u91 0.703125 0.3125 0.734375 0.375
+    glyph u92 0.765625 0.3125 0.796875 0.375
+    glyph u93 0.828125 0.3125 0.859375 0.375
+    glyph u94 0.890625 0.3125 0.921875 0.375
+    glyph u95 0.953125 0.3125 0.984375 0.375
+    glyph u96 0.015625 0.375 0.046875 0.4375
+    glyph u97 0.078125 0.375 0.109375 0.4375
+    glyph u98 0.140625 0.375 0.171875 0.4375
+    glyph u99 0.203125 0.375 0.234375 0.4375
+    glyph u100 0.265625 0.375 0.296875 0.4375
+    glyph u101 0.328125 0.375 0.359375 0.4375
+    glyph u102 0.390625 0.375 0.421875 0.4375
+    glyph u103 0.453125 0.375 0.484375 0.4375
+    glyph u104 0.515625 0.375 0.546875 0.4375
+    glyph u105 0.578125 0.375 0.609375 0.4375
+    glyph u106 0.640625 0.375 0.671875 0.4375
+    glyph u107 0.703125 0.375 0.734375 0.4375
+    glyph u108 0.765625 0.375 0.796875 0.4375
+    glyph u109 0.828125 0.375 0.859375 0.4375
+    glyph u110 0.890625 0.375 0.921875 0.4375
+    glyph u111 0.953125 0.375 0.984375 0.4375
+    glyph u112 0.015625 0.4375 0.046875 0.5
+    glyph u113 0.078125 0.4375 0.109375 0.5
+    glyph u114 0.140625 0.4375 0.171875 0.5
+    glyph u115 0.203125 0.4375 0.234375 0.5
+    glyph u116 0.265625 0.4375 0.296875 0.5
+    glyph u117 0.328125 0.4375 0.359375 0.5
+    glyph u118 0.390625 0.4375 0.421875 0.5
+    glyph u119 0.453125 0.4375 0.484375 0.5
+    glyph u120 0.515625 0.4375 0.546875 0.5
+    glyph u121 0.578125 0.4375 0.609375 0.5
+    glyph u122 0.640625 0.4375 0.671875 0.5
+    glyph u123 0.703125 0.4375 0.734375 0.5
+    glyph u124 0.765625 0.4375 0.796875 0.5
+    glyph u125 0.828125 0.4375 0.859375 0.5
+    glyph u126 0.890625 0.4375 0.921875 0.5
+    glyph u127 0.953125 0.4375 0.984375 0.5
+    glyph u128 0.015625 0.5 0.046875 0.5625
+    glyph u129 0.078125 0.5 0.109375 0.5625
+    glyph u130 0.140625 0.5 0.171875 0.5625
+    glyph u131 0.203125 0.5 0.234375 0.5625
+    glyph u132 0.265625 0.5 0.296875 0.5625
+    glyph u133 0.328125 0.5 0.359375 0.5625
+    glyph u134 0.390625 0.5 0.421875 0.5625
+    glyph u135 0.453125 0.5 0.484375 0.5625
+    glyph u136 0.515625 0.5 0.546875 0.5625
+    glyph u137 0.578125 0.5 0.609375 0.5625
+    glyph u138 0.640625 0.5 0.671875 0.5625
+    glyph u139 0.703125 0.5 0.734375 0.5625
+    glyph u140 0.765625 0.5 0.796875 0.5625
+    glyph u141 0.828125 0.5 0.859375 0.5625
+    glyph u142 0.890625 0.5 0.921875 0.5625
+    glyph u143 0.953125 0.5 0.984375 0.5625
+    glyph u144 0.015625 0.5625 0.046875 0.625
+    glyph u145 0.078125 0.5625 0.109375 0.625
+    glyph u146 0.140625 0.5625 0.171875 0.625
+    glyph u147 0.203125 0.5625 0.234375 0.625
+    glyph u148 0.265625 0.5625 0.296875 0.625
+    glyph u149 0.328125 0.5625 0.359375 0.625
+    glyph u150 0.390625 0.5625 0.421875 0.625
+    glyph u151 0.453125 0.5625 0.484375 0.625
+    glyph u152 0.515625 0.5625 0.546875 0.625
+    glyph u153 0.578125 0.5625 0.609375 0.625
+    glyph u154 0.640625 0.5625 0.671875 0.625
+    glyph u155 0.703125 0.5625 0.734375 0.625
+    glyph u156 0.765625 0.5625 0.796875 0.625
+    glyph u157 0.828125 0.5625 0.859375 0.625
+    glyph u158 0.890625 0.5625 0.921875 0.625
+    glyph u159 0.953125 0.5625 0.984375 0.625
+    glyph u160 0.015625 0.625 0.046875 0.6875
+    glyph u161 0.078125 0.625 0.109375 0.6875
+    glyph u162 0.140625 0.625 0.171875 0.6875
+    glyph u163 0.203125 0.625 0.234375 0.6875
+    glyph u164 0.265625 0.625 0.296875 0.6875
+    glyph u165 0.328125 0.625 0.359375 0.6875
+    glyph u166 0.390625 0.625 0.421875 0.6875
+    glyph u167 0.453125 0.625 0.484375 0.6875
+    glyph u168 0.515625 0.625 0.546875 0.6875
+    glyph u169 0.578125 0.625 0.609375 0.6875
+    glyph u170 0.640625 0.625 0.671875 0.6875
+    glyph u171 0.703125 0.625 0.734375 0.6875
+    glyph u172 0.765625 0.625 0.796875 0.6875
+    glyph u173 0.828125 0.625 0.859375 0.6875
+    glyph u174 0.890625 0.625 0.921875 0.6875
+    glyph u175 0.953125 0.625 0.984375 0.6875
+    glyph u176 0.015625 0.6875 0.046875 0.75
+    glyph u177 0.078125 0.6875 0.109375 0.75
+    glyph u178 0.140625 0.6875 0.171875 0.75
+    glyph u179 0.203125 0.6875 0.234375 0.75
+    glyph u180 0.265625 0.6875 0.296875 0.75
+    glyph u181 0.328125 0.6875 0.359375 0.75
+    glyph u182 0.390625 0.6875 0.421875 0.75
+    glyph u183 0.453125 0.6875 0.484375 0.75
+    glyph u184 0.515625 0.6875 0.546875 0.75
+    glyph u185 0.578125 0.6875 0.609375 0.75
+    glyph u186 0.640625 0.6875 0.671875 0.75
+    glyph u187 0.703125 0.6875 0.734375 0.75
+    glyph u188 0.765625 0.6875 0.796875 0.75
+    glyph u189 0.828125 0.6875 0.859375 0.75
+    glyph u190 0.890625 0.6875 0.921875 0.75
+    glyph u191 0.953125 0.6875 0.984375 0.75
+    glyph u192 0.015625 0.75 0.046875 0.8125
+    glyph u193 0.078125 0.75 0.109375 0.8125
+    glyph u194 0.140625 0.75 0.171875 0.8125
+    glyph u195 0.203125 0.75 0.234375 0.8125
+    glyph u196 0.265625 0.75 0.296875 0.8125
+    glyph u197 0.328125 0.75 0.359375 0.8125
+    glyph u198 0.390625 0.75 0.421875 0.8125
+    glyph u199 0.453125 0.75 0.484375 0.8125
+    glyph u200 0.515625 0.75 0.546875 0.8125
+    glyph u201 0.578125 0.75 0.609375 0.8125
+    glyph u202 0.640625 0.75 0.671875 0.8125
+    glyph u203 0.703125 0.75 0.734375 0.8125
+    glyph u204 0.765625 0.75 0.796875 0.8125
+    glyph u205 0.828125 0.75 0.859375 0.8125
+    glyph u206 0.890625 0.75 0.921875 0.8125
+    glyph u207 0.953125 0.75 0.984375 0.8125
+    glyph u208 0.015625 0.8125 0.046875 0.875
+    glyph u209 0.078125 0.8125 0.109375 0.875
+    glyph u210 0.140625 0.8125 0.171875 0.875
+    glyph u211 0.203125 0.8125 0.234375 0.875
+    glyph u212 0.265625 0.8125 0.296875 0.875
+    glyph u213 0.328125 0.8125 0.359375 0.875
+    glyph u214 0.390625 0.8125 0.421875 0.875
+    glyph u215 0.453125 0.8125 0.484375 0.875
+    glyph u216 0.515625 0.8125 0.546875 0.875
+    glyph u217 0.578125 0.8125 0.609375 0.875
+    glyph u218 0.640625 0.8125 0.671875 0.875
+    glyph u219 0.703125 0.8125 0.734375 0.875
+    glyph u220 0.765625 0.8125 0.796875 0.875
+    glyph u221 0.828125 0.8125 0.859375 0.875
+    glyph u222 0.890625 0.8125 0.921875 0.875
+    glyph u223 0.953125 0.8125 0.984375 0.875
+    glyph u224 0.015625 0.875 0.046875 0.9375
+    glyph u225 0.078125 0.875 0.109375 0.9375
+    glyph u226 0.140625 0.875 0.171875 0.9375
+    glyph u227 0.203125 0.875 0.234375 0.9375
+    glyph u228 0.265625 0.875 0.296875 0.9375
+    glyph u229 0.328125 0.875 0.359375 0.9375
+    glyph u230 0.390625 0.875 0.421875 0.9375
+    glyph u231 0.453125 0.875 0.484375 0.9375
+    glyph u232 0.515625 0.875 0.546875 0.9375
+    glyph u233 0.578125 0.875 0.609375 0.9375
+    glyph u234 0.640625 0.875 0.671875 0.9375
+    glyph u235 0.703125 0.875 0.734375 0.9375
+    glyph u236 0.765625 0.875 0.796875 0.9375
+    glyph u237 0.828125 0.875 0.859375 0.9375
+    glyph u238 0.890625 0.875 0.921875 0.9375
+    glyph u239 0.953125 0.875 0.984375 0.9375
+    glyph u240 0.015625 0.9375 0.046875 1
+    glyph u241 0.078125 0.9375 0.109375 1
+    glyph u242 0.140625 0.9375 0.171875 1
+    glyph u243 0.203125 0.9375 0.234375 1
+    glyph u244 0.265625 0.9375 0.296875 1
+    glyph u245 0.328125 0.9375 0.359375 1
+    glyph u246 0.390625 0.9375 0.421875 1
+    glyph u247 0.453125 0.9375 0.484375 1
+    glyph u248 0.515625 0.9375 0.546875 1
+    glyph u249 0.578125 0.9375 0.609375 1
+    glyph u250 0.640625 0.9375 0.671875 1
+    glyph u251 0.703125 0.9375 0.734375 1
+    glyph u252 0.765625 0.9375 0.796875 1
+    glyph u253 0.828125 0.9375 0.859375 1
+    glyph u254 0.890625 0.9375 0.921875 1
+    glyph u255 0.953125 0.9375 0.984375 1
+}
+
+font CourierNew
+{
+    type image
+    source system/courier_new_9_75.png
+
+    glyph u32 0.015625 0.125 0.046875 0.1875
+    glyph u33 0.078125 0.125 0.109375 0.1875
+    glyph u34 0.140625 0.125 0.171875 0.1875
+    glyph u35 0.203125 0.125 0.234375 0.1875
+    glyph u36 0.265625 0.125 0.296875 0.1875
+    glyph u37 0.328125 0.125 0.359375 0.1875
+    glyph u38 0.390625 0.125 0.421875 0.1875
+    glyph u39 0.453125 0.125 0.484375 0.1875
+    glyph u40 0.515625 0.125 0.546875 0.1875
+    glyph u41 0.578125 0.125 0.609375 0.1875
+    glyph u42 0.640625 0.125 0.671875 0.1875
+    glyph u43 0.703125 0.125 0.734375 0.1875
+    glyph u44 0.765625 0.125 0.796875 0.1875
+    glyph u45 0.828125 0.125 0.859375 0.1875
+    glyph u46 0.890625 0.125 0.921875 0.1875
+    glyph u47 0.953125 0.125 0.984375 0.1875
+    glyph u48 0.015625 0.1875 0.046875 0.25
+    glyph u49 0.078125 0.1875 0.109375 0.25
+    glyph u50 0.140625 0.1875 0.171875 0.25
+    glyph u51 0.203125 0.1875 0.234375 0.25
+    glyph u52 0.265625 0.1875 0.296875 0.25
+    glyph u53 0.328125 0.1875 0.359375 0.25
+    glyph u54 0.390625 0.1875 0.421875 0.25
+    glyph u55 0.453125 0.1875 0.484375 0.25
+    glyph u56 0.515625 0.1875 0.546875 0.25
+    glyph u57 0.578125 0.1875 0.609375 0.25
+    glyph u58 0.640625 0.1875 0.671875 0.25
+    glyph u59 0.703125 0.1875 0.734375 0.25
+    glyph u60 0.765625 0.1875 0.796875 0.25
+    glyph u61 0.828125 0.1875 0.859375 0.25
+    glyph u62 0.890625 0.1875 0.921875 0.25
+    glyph u63 0.953125 0.1875 0.984375 0.25
+    glyph u64 0.015625 0.25 0.046875 0.3125
+    glyph u65 0.078125 0.25 0.109375 0.3125
+    glyph u66 0.140625 0.25 0.171875 0.3125
+    glyph u67 0.203125 0.25 0.234375 0.3125
+    glyph u68 0.265625 0.25 0.296875 0.3125
+    glyph u69 0.328125 0.25 0.359375 0.3125
+    glyph u70 0.390625 0.25 0.421875 0.3125
+    glyph u71 0.453125 0.25 0.484375 0.3125
+    glyph u72 0.515625 0.25 0.546875 0.3125
+    glyph u73 0.578125 0.25 0.609375 0.3125
+    glyph u74 0.640625 0.25 0.671875 0.3125
+    glyph u75 0.703125 0.25 0.734375 0.3125
+    glyph u76 0.765625 0.25 0.796875 0.3125
+    glyph u77 0.828125 0.25 0.859375 0.3125
+    glyph u78 0.890625 0.25 0.921875 0.3125
+    glyph u79 0.953125 0.25 0.984375 0.3125
+    glyph u80 0.015625 0.3125 0.046875 0.375
+    glyph u81 0.078125 0.3125 0.109375 0.375
+    glyph u82 0.140625 0.3125 0.171875 0.375
+    glyph u83 0.203125 0.3125 0.234375 0.375
+    glyph u84 0.265625 0.3125 0.296875 0.375
+    glyph u85 0.328125 0.3125 0.359375 0.375
+    glyph u86 0.390625 0.3125 0.421875 0.375
+    glyph u87 0.453125 0.3125 0.484375 0.375
+    glyph u88 0.515625 0.3125 0.546875 0.375
+    glyph u89 0.578125 0.3125 0.609375 0.375
+    glyph u90 0.640625 0.3125 0.671875 0.375
+    glyph u91 0.703125 0.3125 0.734375 0.375
+    glyph u92 0.765625 0.3125 0.796875 0.375
+    glyph u93 0.828125 0.3125 0.859375 0.375
+    glyph u94 0.890625 0.3125 0.921875 0.375
+    glyph u95 0.953125 0.3125 0.984375 0.375
+    glyph u96 0.015625 0.375 0.046875 0.4375
+    glyph u97 0.078125 0.375 0.109375 0.4375
+    glyph u98 0.140625 0.375 0.171875 0.4375
+    glyph u99 0.203125 0.375 0.234375 0.4375
+    glyph u100 0.265625 0.375 0.296875 0.4375
+    glyph u101 0.328125 0.375 0.359375 0.4375
+    glyph u102 0.390625 0.375 0.421875 0.4375
+    glyph u103 0.453125 0.375 0.484375 0.4375
+    glyph u104 0.515625 0.375 0.546875 0.4375
+    glyph u105 0.578125 0.375 0.609375 0.4375
+    glyph u106 0.640625 0.375 0.671875 0.4375
+    glyph u107 0.703125 0.375 0.734375 0.4375
+    glyph u108 0.765625 0.375 0.796875 0.4375
+    glyph u109 0.828125 0.375 0.859375 0.4375
+    glyph u110 0.890625 0.375 0.921875 0.4375
+    glyph u111 0.953125 0.375 0.984375 0.4375
+    glyph u112 0.015625 0.4375 0.046875 0.5
+    glyph u113 0.078125 0.4375 0.109375 0.5
+    glyph u114 0.140625 0.4375 0.171875 0.5
+    glyph u115 0.203125 0.4375 0.234375 0.5
+    glyph u116 0.265625 0.4375 0.296875 0.5
+    glyph u117 0.328125 0.4375 0.359375 0.5
+    glyph u118 0.390625 0.4375 0.421875 0.5
+    glyph u119 0.453125 0.4375 0.484375 0.5
+    glyph u120 0.515625 0.4375 0.546875 0.5
+    glyph u121 0.578125 0.4375 0.609375 0.5
+    glyph u122 0.640625 0.4375 0.671875 0.5
+    glyph u123 0.703125 0.4375 0.734375 0.5
+    glyph u124 0.765625 0.4375 0.796875 0.5
+    glyph u125 0.828125 0.4375 0.859375 0.5
+    glyph u126 0.890625 0.4375 0.921875 0.5
+    glyph u127 0.953125 0.4375 0.984375 0.5
+    glyph u128 0.015625 0.5 0.046875 0.5625
+    glyph u129 0.078125 0.5 0.109375 0.5625
+    glyph u130 0.140625 0.5 0.171875 0.5625
+    glyph u131 0.203125 0.5 0.234375 0.5625
+    glyph u132 0.265625 0.5 0.296875 0.5625
+    glyph u133 0.328125 0.5 0.359375 0.5625
+    glyph u134 0.390625 0.5 0.421875 0.5625
+    glyph u135 0.453125 0.5 0.484375 0.5625
+    glyph u136 0.515625 0.5 0.546875 0.5625
+    glyph u137 0.578125 0.5 0.609375 0.5625
+    glyph u138 0.640625 0.5 0.671875 0.5625
+    glyph u139 0.703125 0.5 0.734375 0.5625
+    glyph u140 0.765625 0.5 0.796875 0.5625
+    glyph u141 0.828125 0.5 0.859375 0.5625
+    glyph u142 0.890625 0.5 0.921875 0.5625
+    glyph u143 0.953125 0.5 0.984375 0.5625
+    glyph u144 0.015625 0.5625 0.046875 0.625
+    glyph u145 0.078125 0.5625 0.109375 0.625
+    glyph u146 0.140625 0.5625 0.171875 0.625
+    glyph u147 0.203125 0.5625 0.234375 0.625
+    glyph u148 0.265625 0.5625 0.296875 0.625
+    glyph u149 0.328125 0.5625 0.359375 0.625
+    glyph u150 0.390625 0.5625 0.421875 0.625
+    glyph u151 0.453125 0.5625 0.484375 0.625
+    glyph u152 0.515625 0.5625 0.546875 0.625
+    glyph u153 0.578125 0.5625 0.609375 0.625
+    glyph u154 0.640625 0.5625 0.671875 0.625
+    glyph u155 0.703125 0.5625 0.734375 0.625
+    glyph u156 0.765625 0.5625 0.796875 0.625
+    glyph u157 0.828125 0.5625 0.859375 0.625
+    glyph u158 0.890625 0.5625 0.921875 0.625
+    glyph u159 0.953125 0.5625 0.984375 0.625
+    glyph u160 0.015625 0.625 0.046875 0.6875
+    glyph u161 0.078125 0.625 0.109375 0.6875
+    glyph u162 0.140625 0.625 0.171875 0.6875
+    glyph u163 0.203125 0.625 0.234375 0.6875
+    glyph u164 0.265625 0.625 0.296875 0.6875
+    glyph u165 0.328125 0.625 0.359375 0.6875
+    glyph u166 0.390625 0.625 0.421875 0.6875
+    glyph u167 0.453125 0.625 0.484375 0.6875
+    glyph u168 0.515625 0.625 0.546875 0.6875
+    glyph u169 0.578125 0.625 0.609375 0.6875
+    glyph u170 0.640625 0.625 0.671875 0.6875
+    glyph u171 0.703125 0.625 0.734375 0.6875
+    glyph u172 0.765625 0.625 0.796875 0.6875
+    glyph u173 0.828125 0.625 0.859375 0.6875
+    glyph u174 0.890625 0.625 0.921875 0.6875
+    glyph u175 0.953125 0.625 0.984375 0.6875
+    glyph u176 0.015625 0.6875 0.046875 0.75
+    glyph u177 0.078125 0.6875 0.109375 0.75
+    glyph u178 0.140625 0.6875 0.171875 0.75
+    glyph u179 0.203125 0.6875 0.234375 0.75
+    glyph u180 0.265625 0.6875 0.296875 0.75
+    glyph u181 0.328125 0.6875 0.359375 0.75
+    glyph u182 0.390625 0.6875 0.421875 0.75
+    glyph u183 0.453125 0.6875 0.484375 0.75
+    glyph u184 0.515625 0.6875 0.546875 0.75
+    glyph u185 0.578125 0.6875 0.609375 0.75
+    glyph u186 0.640625 0.6875 0.671875 0.75
+    glyph u187 0.703125 0.6875 0.734375 0.75
+    glyph u188 0.765625 0.6875 0.796875 0.75
+    glyph u189 0.828125 0.6875 0.859375 0.75
+    glyph u190 0.890625 0.6875 0.921875 0.75
+    glyph u191 0.953125 0.6875 0.984375 0.75
+    glyph u192 0.015625 0.75 0.046875 0.8125
+    glyph u193 0.078125 0.75 0.109375 0.8125
+    glyph u194 0.140625 0.75 0.171875 0.8125
+    glyph u195 0.203125 0.75 0.234375 0.8125
+    glyph u196 0.265625 0.75 0.296875 0.8125
+    glyph u197 0.328125 0.75 0.359375 0.8125
+    glyph u198 0.390625 0.75 0.421875 0.8125
+    glyph u199 0.453125 0.75 0.484375 0.8125
+    glyph u200 0.515625 0.75 0.546875 0.8125
+    glyph u201 0.578125 0.75 0.609375 0.8125
+    glyph u202 0.640625 0.75 0.671875 0.8125
+    glyph u203 0.703125 0.75 0.734375 0.8125
+    glyph u204 0.765625 0.75 0.796875 0.8125
+    glyph u205 0.828125 0.75 0.859375 0.8125
+    glyph u206 0.890625 0.75 0.921875 0.8125
+    glyph u207 0.953125 0.75 0.984375 0.8125
+    glyph u208 0.015625 0.8125 0.046875 0.875
+    glyph u209 0.078125 0.8125 0.109375 0.875
+    glyph u210 0.140625 0.8125 0.171875 0.875
+    glyph u211 0.203125 0.8125 0.234375 0.875
+    glyph u212 0.265625 0.8125 0.296875 0.875
+    glyph u213 0.328125 0.8125 0.359375 0.875
+    glyph u214 0.390625 0.8125 0.421875 0.875
+    glyph u215 0.453125 0.8125 0.484375 0.875
+    glyph u216 0.515625 0.8125 0.546875 0.875
+    glyph u217 0.578125 0.8125 0.609375 0.875
+    glyph u218 0.640625 0.8125 0.671875 0.875
+    glyph u219 0.703125 0.8125 0.734375 0.875
+    glyph u220 0.765625 0.8125 0.796875 0.875
+    glyph u221 0.828125 0.8125 0.859375 0.875
+    glyph u222 0.890625 0.8125 0.921875 0.875
+    glyph u223 0.953125 0.8125 0.984375 0.875
+    glyph u224 0.015625 0.875 0.046875 0.9375
+    glyph u225 0.078125 0.875 0.109375 0.9375
+    glyph u226 0.140625 0.875 0.171875 0.9375
+    glyph u227 0.203125 0.875 0.234375 0.9375
+    glyph u228 0.265625 0.875 0.296875 0.9375
+    glyph u229 0.328125 0.875 0.359375 0.9375
+    glyph u230 0.390625 0.875 0.421875 0.9375
+    glyph u231 0.453125 0.875 0.484375 0.9375
+    glyph u232 0.515625 0.875 0.546875 0.9375
+    glyph u233 0.578125 0.875 0.609375 0.9375
+    glyph u234 0.640625 0.875 0.671875 0.9375
+    glyph u235 0.703125 0.875 0.734375 0.9375
+    glyph u236 0.765625 0.875 0.796875 0.9375
+    glyph u237 0.828125 0.875 0.859375 0.9375
+    glyph u238 0.890625 0.875 0.921875 0.9375
+    glyph u239 0.953125 0.875 0.984375 0.9375
+    glyph u240 0.015625 0.9375 0.046875 1
+    glyph u241 0.078125 0.9375 0.109375 1
+    glyph u242 0.140625 0.9375 0.171875 1
+    glyph u243 0.203125 0.9375 0.234375 1
+    glyph u244 0.265625 0.9375 0.296875 1
+    glyph u245 0.328125 0.9375 0.359375 1
+    glyph u246 0.390625 0.9375 0.421875 1
+    glyph u247 0.453125 0.9375 0.484375 1
+    glyph u248 0.515625 0.9375 0.546875 1
+    glyph u249 0.578125 0.9375 0.609375 1
+    glyph u250 0.640625 0.9375 0.671875 1
+    glyph u251 0.703125 0.9375 0.734375 1
+    glyph u252 0.765625 0.9375 0.796875 1
+    glyph u253 0.828125 0.9375 0.859375 1
+    glyph u254 0.890625 0.9375 0.921875 1
+    glyph u255 0.953125 0.9375 0.984375 1
+}

Some files were not shown because too many files changed in this diff