Răsfoiți Sursa

Improvements in main, item and equip menu. Name menu partially implemented. MENU opcode implemented in installer, partially in game scripts.

Iñigo Valentin 3 ani în urmă
părinte
comite
3c2b5db640

+ 48 - 0
V-Gears-Installer/include/decompiler/field/instruction/FieldWindowInstruction.h

@@ -45,6 +45,54 @@ class FieldWindowInstruction : public KernelCallInstruction{
 
         void ProcessMPNAM(CodeGenerator* code_gen);
 
+
+        /**
+         * Processes a MENU opcode.
+         *
+         * Opcode: 0x49
+         * Short name: MENU
+         * Long name: Menu
+         *
+         * Memory layout (4 bytes)
+         * |0x49|B|T|E|
+         *
+         * Arguments
+         * - const UByte B: Bank for parameter, or zero if P is specified as a literal value.
+         * - const UByte T: Type of menu, or special event.
+         * - const UByte P: Parameter to the menu, or address of parameter value, if B is non-zero.
+         *
+         * MENU has two uses. Its primary function is to display a menu or other special screen.
+         * These menus range from the character name entry screen, to a shop, and even the staff
+         * credit display. The other function is to provide a set of special events that would
+         * normally be accomplished through a set of opcodes, but are instead coded directly into a
+         * MENU call. Some types of menu are erroneous or produce erratic behaviour, and were most
+         * likely used for testing. As such, they are not listed here.
+         *
+         * Standard Menu Types
+         *
+         * ID  Menu Type
+         *  5  FF7 Credits
+         *  6  Character Name Entry
+         *  7  Party Select
+         *  8  Shop
+         *  9  Main Menu
+         *  E  Save Screen
+         *
+         * Special Event Types
+         * ID  Event Type
+         *  F  Yuffie's Materia Steal (Remove All Materia)
+         * 12  Remove Cloud's Materia
+         * 13  Restore Cloud's Materia
+         *
+         * Parameters
+         *
+         * Character Name Entry: Parameter indicates the name of the character to edit, and follows
+         * the standard Character IDs, as well as 0x64 to indicate the Chocobo naming screen.
+         *
+         * @param[in,out] code_gen Code generator to append lines.
+         */
+        void ProcessMENU(CodeGenerator* code_gen);
+
         void ProcessMENU2(CodeGenerator* code_gen);
 
         void ProcessWINDOW(CodeGenerator* code_gen);

+ 62 - 1
V-Gears-Installer/src/decompiler/field/instruction/FieldWindowInstruction.cpp

@@ -41,7 +41,7 @@ void FieldWindowInstruction::ProcessInst(
         case OPCODES::MPRA2: code_gen->WriteTodo(md.GetEntityName(), "MPRA2"); break;
         case OPCODES::MPNAM: ProcessMPNAM(code_gen); break;
         case OPCODES::ASK: code_gen->WriteTodo(md.GetEntityName(), "ASK"); break;
-        case OPCODES::MENU: code_gen->WriteTodo(md.GetEntityName(), "MENU"); break;
+        case OPCODES::MENU: ProcessMENU(code_gen); break;
         case OPCODES::MENU2: ProcessMENU2(code_gen); break;
         case OPCODES::WINDOW: ProcessWINDOW(code_gen); break;
         case OPCODES::WMOVE: code_gen->WriteTodo(md.GetEntityName(), "WMOVE"); break;
@@ -71,6 +71,67 @@ void FieldWindowInstruction::ProcessWINDOW(CodeGenerator* code_gen){
     ).str());
 }
 
+void FieldWindowInstruction::ProcessMENU(CodeGenerator* code_gen){
+    FieldCodeGenerator* cg = static_cast<FieldCodeGenerator*>(code_gen);
+    int menu_id = std::stoi(FieldCodeGenerator::FormatValueOrVariable(
+        cg->GetFormatter(), params_[1]->GetUnsigned(), params_[2]->GetSigned(),
+        FieldCodeGenerator::ValueType::Integer
+      ));
+    int param = std::stoi(FieldCodeGenerator::FormatValueOrVariable(
+      cg->GetFormatter(), params_[1]->GetUnsigned(), params_[3]->GetSigned(),
+      FieldCodeGenerator::ValueType::Integer
+    ));
+    switch(menu_id){
+        case 0x05: // Ending credits.
+            code_gen->AddOutputLine("ending_credits()");
+            break;
+        case 0x06: // Name menu
+            if (param == 64) // ID 64 is for chocobos.
+                code_gen->AddOutputLine("name_chocobo()");
+            else
+                code_gen->AddOutputLine((boost::format("name_character(%1%)") % param).str());
+            break;
+        case 0x07: // Form party.
+            switch (param){
+                case 0x01: // Split in 3 teams (last battle).
+                    code_gen->AddOutputLine("Party.split_teams(3)");
+                    break;
+                case 0x02: // Split in 2 teams (last battle).
+                    code_gen->AddOutputLine("Party.split_teams(2)");
+                    break;
+                default: // 0x00: Normal, form party of three.
+                    code_gen->AddOutputLine("Party.choose_party()");
+            }
+            break;
+        case 0x08: //Shop
+            code_gen->AddOutputLine((boost::format("open_shop(%1%)") % param).str());
+            break;
+        case 0x09: // Party menu
+            code_gen->AddOutputLine("open_menu(\"party\")");
+            break;
+        case 0x0E: // Party menu
+            code_gen->AddOutputLine("open_menu(\"save\")");
+            break;
+        case 0x0F: // Steal materia event.
+            code_gen->AddOutputLine("Party.steal_materia()");
+            break;
+        case 0x12: // Remove materia from character.
+            code_gen->AddOutputLine(
+              (boost::format("Characters.remove_materia(%1%)") % param).str()
+            );
+            break;
+        case 0x13: // Restore character materia.
+            code_gen->AddOutputLine(
+              (boost::format("Characters.restore_materia(%1%)") % param).str()
+            );
+            break;
+        default:
+            code_gen->AddOutputLine(
+              (boost::format("-- Unknown menu %1% (%2%)") % menu_id % param).str()
+            );
+    }
+}
+
 void FieldWindowInstruction::ProcessMESSAGE(
   CodeGenerator* code_gen, const std::string& script_name
 ){

+ 12 - 0
V-Gears/src/core/ScriptManager.cpp

@@ -65,6 +65,7 @@ void ScriptManager::Input(const VGears::Event& event){
     if (
       (event.type == VGears::ET_KEY_PRESS || event.type == VGears::ET_KEY_REPEAT_WAIT)
       && (
+        // TODO: Do this the other way: block keys NOT TO pass to scripts.
         event.param1 == OIS::KC_RETURN
         || event.param1 == OIS::KC_ESCAPE
         || event.param1 == OIS::KC_SPACE
@@ -73,6 +74,17 @@ void ScriptManager::Input(const VGears::Event& event){
         || event.param1 == OIS::KC_RIGHT
         || event.param1 == OIS::KC_DOWN
         || event.param1 == OIS::KC_UP
+        || event.param1 == OIS::KC_PGUP
+        || event.param1 == OIS::KC_PGDOWN
+        || event.param1 == OIS::KC_A || event.param1 == OIS::KC_B || event.param1 == OIS::KC_C
+        || event.param1 == OIS::KC_D || event.param1 == OIS::KC_E || event.param1 == OIS::KC_F
+        || event.param1 == OIS::KC_G || event.param1 == OIS::KC_H || event.param1 == OIS::KC_I
+        || event.param1 == OIS::KC_J || event.param1 == OIS::KC_K || event.param1 == OIS::KC_L
+        || event.param1 == OIS::KC_M || event.param1 == OIS::KC_N || event.param1 == OIS::KC_O
+        || event.param1 == OIS::KC_P || event.param1 == OIS::KC_Q || event.param1 == OIS::KC_R
+        || event.param1 == OIS::KC_S || event.param1 == OIS::KC_T || event.param1 == OIS::KC_U
+        || event.param1 == OIS::KC_V || event.param1 == OIS::KC_W || event.param1 == OIS::KC_X
+        || event.param1 == OIS::KC_Y || event.param1 == OIS::KC_Z || event.param1 == OIS::KC_X
       )
     ){
         for (unsigned int i = 0; i < script_entity_.size(); ++ i){

+ 2 - 0
V-Gears/src/core/Utilites.cpp

@@ -253,6 +253,8 @@ KeyName key_names[] = {
     {"F10", OIS::KC_F10},
     {"F11", OIS::KC_F11},
     {"F12", OIS::KC_F12},
+    {"PGUP", OIS::KC_PGUP},
+    {"PGDN", OIS::KC_PGDOWN},
     {"UNASSIGNED", OIS::KC_UNASSIGNED},
 };
 

+ 1 - 0
data/data/screens.xml

@@ -10,6 +10,7 @@
     <prototype file_name="screens/item_menu/prototypes.xml" />
     <screen file_name="screens/item_menu/item_menu.xml" />
     <screen file_name="screens/equip_menu/equip_menu.xml" />
+    <screen file_name="screens/name_menu/name_menu.xml" />
 
     <!-- Dialogs -->
     <prototype file_name="screens/dialog/prototypes.xml" />

+ 69 - 65
data/data/screens/equip_menu/equip_menu.xml

@@ -1,5 +1,5 @@
 <screen name="EquipMenu" script="scripts/menu/equip_menu.lua" visible="false">
-    <widget name="Container" width="425" height="240" origin_x="50%" origin_y="49%" align="center" valign="middle" scale="3 3" visible="true">
+    <widget name="Container" width="40%" height="40%" x="0" y="0" align="left" valign="top" scale="2.5 2.5" visible="true">
         <widget name="Character" width="100%" height="70" visible="true">
             <prototype name="Window"/>
             <sprite name="Portrait" image="images/other/choco.png" x="10" y="12" width="48" height="48" visible="true" />
@@ -26,80 +26,84 @@
             <prototype name="Window" />
             <text_area name="Help" x="16" y="6" font="FFVIIFont" visible="true" />
         </widget>
-        <widget name="Slots" x="0" y="94" width="260" height="50" visible="true">
+        <widget name="Slots" x="0" y="94" width="230" height="50" visible="true">
             <prototype name="Window" />
             <text_area name="SlotsLbl" text_name="EquipMenuSlots" x="16" y="10" font="FFVIIFont" visible="true" />
             <text_area name="GrowthLbl" text_name="EquipMenuGrowth" x="16" y="28" font="FFVIIFont" visible="true" />
-            <text_area name="Growth0" text_name="EquipMenuGrowth1" x="80" y="28" font="FFVIIFont" visible="true" />
-            <text_area name="Growth1" text_name="EquipMenuGrowth1" x="80" y="28" font="FFVIIFont" visible="true" />
-            <text_area name="Growth2" text_name="EquipMenuGrowth2" x="80" y="28" font="FFVIIFont" visible="false" />
-            <text_area name="Growth3" text_name="EquipMenuGrowth3" x="80" y="28" font="FFVIIFont" visible="false" />
-            <sprite name="Slot1" image="images/icons/materia_slot.png" x="80" y="8" width="18" height="18" visible="true"/>
-            <sprite name="Slot2" image="images/icons/materia_slot.png" x="100" y="8" width="18" height="18" visible="true"/>
-            <sprite name="Link1" image="images/icons/materia_slot_link.png" x="94" y="8" width="10" height="18" visible="true"/>
-            <sprite name="Slot3" image="images/icons/materia_slot.png" x="120" y="8" width="18" height="18" visible="true"/>
-            <sprite name="Slot4" image="images/icons/materia_slot.png" x="140" y="8" width="18" height="18" visible="true"/>
-            <sprite name="Link2" image="images/icons/materia_slot_link.png" x="134" y="8" width="10" height="18" visible="true"/>
-            <sprite name="Slot5" image="images/icons/materia_slot.png" x="160" y="8" width="18" height="18" visible="true"/>
-            <sprite name="Slot6" image="images/icons/materia_slot.png" x="180" y="8" width="18" height="18" visible="true"/>
-            <sprite name="Link3" image="images/icons/materia_slot_link.png" x="174" y="8" width="10" height="18" visible="true"/>
-            <sprite name="Slot7" image="images/icons/materia_slot.png" x="200" y="8" width="18" height="18" visible="true"/>
-            <sprite name="Slot8" image="images/icons/materia_slot.png" x="220" y="8" width="18" height="18" visible="true"/>
-            <sprite name="Link4" image="images/icons/materia_slot_link.png" x="214" y="8" width="10" height="18" visible="true"/>
+            <text_area name="Growth0" text_name="EquipMenuGrowth1" x="75" y="28" font="FFVIIFont" visible="true" />
+            <text_area name="Growth1" text_name="EquipMenuGrowth1" x="75" y="28" font="FFVIIFont" visible="true" />
+            <text_area name="Growth2" text_name="EquipMenuGrowth2" x="75" y="28" font="FFVIIFont" visible="false" />
+            <text_area name="Growth3" text_name="EquipMenuGrowth3" x="75" y="28" font="FFVIIFont" visible="false" />
+            <sprite name="Slot1" image="images/icons/materia_slot.png" x="75" y="8" width="16" height="16" visible="true"/>
+            <sprite name="Slot2" image="images/icons/materia_slot.png" x="92" y="8" width="16" height="16" visible="true"/>
+            <sprite name="Link1" image="images/icons/materia_slot_link.png" x="87" y="8" width="9" height="16" visible="true"/>
+            <sprite name="Slot3" image="images/icons/materia_slot.png" x="109" y="8" width="16" height="16" visible="true"/>
+            <sprite name="Slot4" image="images/icons/materia_slot.png" x="126" y="8" width="16" height="16" visible="true"/>
+            <sprite name="Link2" image="images/icons/materia_slot_link.png" x="121" y="8" width="9" height="16" visible="true"/>
+            <sprite name="Slot5" image="images/icons/materia_slot.png" x="143" y="8" width="16" height="16" visible="true"/>
+            <sprite name="Slot6" image="images/icons/materia_slot.png" x="160" y="8" width="16" height="16" visible="true"/>
+            <sprite name="Link3" image="images/icons/materia_slot_link.png" x="155" y="8" width="9" height="16" visible="true"/>
+            <sprite name="Slot7" image="images/icons/materia_slot.png" x="177" y="8" width="16" height="16" visible="true"/>
+            <sprite name="Slot8" image="images/icons/materia_slot.png" x="194" y="8" width="16" height="16" visible="true"/>
+            <sprite name="Link4" image="images/icons/materia_slot_link.png" x="189" y="8" width="9" height="16" visible="true"/>
         </widget>
-        <widget name="SlotsEmpty" x="0" y="94" width="260" height="50" visible="false">
+        <widget name="SlotsEmpty" x="0" y="94" width="230" height="50" visible="false">
             <prototype name="Window" />
         </widget>
-        <widget name="Stats" x="0" y="144" width="260" height="100%-145" visible="true">
+        <widget name="Stats" x="0" y="144" width="230" height="100%-145" visible="true">
             <prototype name="Window" />
-            <text_area name="AtkLbl" text_name="EquipMenuAtk" x="20" y="4" font="FFVIIFont" visible="true" />
-            <text_area name="AccLbl" text_name="EquipMenuAcc" x="20" y="16" font="FFVIIFont" visible="true" />
-            <text_area name="DefLbl" text_name="EquipMenuDef" x="20" y="28" font="FFVIIFont" visible="true" />
-            <text_area name="EvaLbl" text_name="EquipMenuEva" x="20" y="40" font="FFVIIFont" visible="true" />
-            <text_area name="MAtkLbl" text_name="EquipMenuMAtk" x="20" y="52" font="FFVIIFont" visible="true" />
-            <text_area name="MDefLbl" text_name="EquipMenuMDef" x="20" y="64" font="FFVIIFont" visible="true" />
-            <text_area name="MEvaLbl" text_name="EquipMenuMEva" x="20" y="76" font="FFVIIFont" visible="true" />
-            <text_area name="Atk" x="120" y="5" font="FFVIIMenuDigits" visible="true" />
-            <text_area name="Acc" x="120" y="17" font="FFVIIMenuDigits" visible="true" />
-            <text_area name="Def" x="120" y="29" font="FFVIIMenuDigits" visible="true" />
-            <text_area name="Eva" x="120" y="41" font="FFVIIMenuDigits" visible="true" />
-            <text_area name="MAtk" x="120" y="53" font="FFVIIMenuDigits" visible="true" />
-            <text_area name="MDef" x="120" y="65" font="FFVIIMenuDigits" visible="true" />
-            <text_area name="MEva" x="120" y="77" font="FFVIIMenuDigits" visible="true" />
-            <text_area name="AtkArw" text_name="EquipMenuArrow" x="155" y="4" font="FFVIIFont" visible="true" />
-            <text_area name="AccArw" text_name="EquipMenuArrow" x="155" y="16" font="FFVIIFont" visible="true" />
-            <text_area name="DefArw" text_name="EquipMenuArrow" x="155" y="28" font="FFVIIFont" visible="true" />
-            <text_area name="EvaArw" text_name="EquipMenuArrow" x="155" y="40" font="FFVIIFont" visible="true" />
-            <text_area name="MAtkArw" text_name="EquipMenuArrow" x="155" y="52" font="FFVIIFont" visible="true" />
-            <text_area name="MDefArw" text_name="EquipMenuArrow" x="155" y="64" font="FFVIIFont" visible="true" />
-            <text_area name="MEvaArw" text_name="EquipMenuArrow" x="155" y="76" font="FFVIIFont" visible="true" />
-            <text_area name="AtkDif" x="170" y="5" font="FFVIIMenuDigits" visible="true" />
-            <text_area name="AccDif" x="170" y="17" font="FFVIIMenuDigits" visible="true" />
-            <text_area name="DefDif" x="170" y="29" font="FFVIIMenuDigits" visible="true" />
-            <text_area name="EvaDif" x="170" y="41" font="FFVIIMenuDigits" visible="true" />
-            <text_area name="MAtkDif" x="170" y="53" font="FFVIIMenuDigits" visible="true" />
-            <text_area name="MDefDif" x="170" y="65" font="FFVIIMenuDigits" visible="true" />
-            <text_area name="MEvaDif" x="170" y="77" font="FFVIIMenuDigits" visible="true" />
+            <text_area name="AtkLbl" text_name="EquipMenuAtk" x="20" y="6%" font="FFVIIFont" visible="true" />
+            <text_area name="AccLbl" text_name="EquipMenuAcc" x="20" y="19%" font="FFVIIFont" visible="true" />
+            <text_area name="DefLbl" text_name="EquipMenuDef" x="20" y="32%" font="FFVIIFont" visible="true" />
+            <text_area name="EvaLbl" text_name="EquipMenuEva" x="20" y="45%" font="FFVIIFont" visible="true" />
+            <text_area name="MAtkLbl" text_name="EquipMenuMAtk" x="20" y="58%" font="FFVIIFont" visible="true" />
+            <text_area name="MDefLbl" text_name="EquipMenuMDef" x="20" y="71%" font="FFVIIFont" visible="true" />
+            <text_area name="MEvaLbl" text_name="EquipMenuMEva" x="20" y="84%" font="FFVIIFont" visible="true" />
+            <text_area name="Atk" x="120" y="6%+1" font="FFVIIMenuDigits" visible="true" />
+            <text_area name="Acc" x="120" y="19%+1" font="FFVIIMenuDigits" visible="true" />
+            <text_area name="Def" x="120" y="32%+1" font="FFVIIMenuDigits" visible="true" />
+            <text_area name="Eva" x="120" y="45%+1" font="FFVIIMenuDigits" visible="true" />
+            <text_area name="MAtk" x="120" y="58%+1" font="FFVIIMenuDigits" visible="true" />
+            <text_area name="MDef" x="120" y="71%+1" font="FFVIIMenuDigits" visible="true" />
+            <text_area name="MEva" x="120" y="84%+1" font="FFVIIMenuDigits" visible="true" />
+            <text_area name="AtkArw" text_name="EquipMenuArrow" x="155" y="6%" font="FFVIIFont" visible="true" />
+            <text_area name="AccArw" text_name="EquipMenuArrow" x="155" y="19%" font="FFVIIFont" visible="true" />
+            <text_area name="DefArw" text_name="EquipMenuArrow" x="155" y="32%" font="FFVIIFont" visible="true" />
+            <text_area name="EvaArw" text_name="EquipMenuArrow" x="155" y="45%" font="FFVIIFont" visible="true" />
+            <text_area name="MAtkArw" text_name="EquipMenuArrow" x="155" y="58%" font="FFVIIFont" visible="true" />
+            <text_area name="MDefArw" text_name="EquipMenuArrow" x="155" y="71%" font="FFVIIFont" visible="true" />
+            <text_area name="MEvaArw" text_name="EquipMenuArrow" x="155" y="84%" font="FFVIIFont" visible="true" />
+            <text_area name="AtkDif" x="170" y="6%+1" font="FFVIIMenuDigits" visible="true" />
+            <text_area name="AccDif" x="170" y="19%+1" font="FFVIIMenuDigits" visible="true" />
+            <text_area name="DefDif" x="170" y="32%+1" font="FFVIIMenuDigits" visible="true" />
+            <text_area name="EvaDif" x="170" y="45%+1" font="FFVIIMenuDigits" visible="true" />
+            <text_area name="MAtkDif" x="170" y="58%+1" font="FFVIIMenuDigits" visible="true" />
+            <text_area name="MDefDif" x="170" y="71%+1" font="FFVIIMenuDigits" visible="true" />
+            <text_area name="MEvaDif" x="170" y="84%+1" font="FFVIIMenuDigits" visible="true" />
         </widget>
-        <widget name="List" x="260" y="94" width="100%-260" height="100%-95" visible="true">
+        <widget name="List" x="230" y="94" width="100%-230" height="100%-95" visible="true">
             <prototype name="Window" />
-            <text_area name="Item1" x="15" y="5" font="FFVIIFont" visible="true" />
-            <text_area name="Item2" x="15" y="22" font="FFVIIFont" visible="true" />
-            <text_area name="Item3" x="15" y="39" font="FFVIIFont" visible="true" />
-            <text_area name="Item4" x="15" y="56" font="FFVIIFont" visible="true" />
-            <text_area name="Item5" x="15" y="73" font="FFVIIFont" visible="true" />
-            <text_area name="Item6" x="15" y="90" font="FFVIIFont" visible="true" />
-            <text_area name="Item7" x="15" y="107" font="FFVIIFont" visible="true" />
-            <text_area name="Item8" x="15" y="124" font="FFVIIFont" visible="true" />
+            <text_area name="Item1" x="15" y="4%" font="FFVIIFont" visible="true" />
+            <text_area name="Item2" x="15" y="13%" font="FFVIIFont" visible="true" />
+            <text_area name="Item3" x="15" y="22%" font="FFVIIFont" visible="true" />
+            <text_area name="Item4" x="15" y="31%" font="FFVIIFont" visible="true" />
+            <text_area name="Item5" x="15" y="40%" font="FFVIIFont" visible="true" />
+            <text_area name="Item6" x="15" y="49%" font="FFVIIFont" visible="true" />
+            <text_area name="Item7" x="15" y="58%" font="FFVIIFont" visible="true" />
+            <text_area name="Item8" x="15" y="67%" font="FFVIIFont" visible="true" />
+            <text_area name="Item9" x="15" y="76%" font="FFVIIFont" visible="true" />
+            <text_area name="Item10" x="15" y="85%" font="FFVIIFont" visible="true" />
             <sprite name="Cursor" image="images/icons/cursor.png" x="-10" y="8" width="24" height="17" visible="true">
-                <animation name="Position1" length="0" y="0:8" />
-                <animation name="Position2" length="0" y="0:25" />
-                <animation name="Position3" length="0" y="0:42" />
-                <animation name="Position4" length="0" y="0:59" />
-                <animation name="Position5" length="0" y="0:76" />
-                <animation name="Position6" length="0" y="0:93" />
-                <animation name="Position7" length="0" y="0:110" />
-                <animation name="Position8" length="0" y="0:127" />
+                <animation name="Position1" length="0" y="0:4%+3" />
+                <animation name="Position2" length="0" y="0:13%+3" />
+                <animation name="Position3" length="0" y="0:22%+3" />
+                <animation name="Position4" length="0" y="0:31%+3" />
+                <animation name="Position5" length="0" y="0:40%+3" />
+                <animation name="Position6" length="0" y="0:49%+3" />
+                <animation name="Position7" length="0" y="0:58%+3" />
+                <animation name="Position8" length="0" y="0:67%+3" />
+                <animation name="Position9" length="0" y="0:76%+3" />
+                <animation name="Position10" length="0" y="0:85%+3" />
             </sprite>
         </widget>
     </widget>

+ 143 - 108
data/data/screens/item_menu/item_menu.xml

@@ -1,6 +1,6 @@
 <screen name="ItemMenu" script="scripts/menu/item_menu.lua" visible="false">
-    <widget name="Container" width="368" height="240" origin_x="50%" origin_y="50%" align="center" valign="middle" scale="3 3" visible="true">
-        <widget name="ItemMenuTopBar" x="30" y="5" width="310" height="24" visible="true">
+    <widget name="Container" width="40%" height="40%" x="0" y="0" align="left" valign="top" scale="2.5 2.5" visible="true">
+        <widget name="ItemMenuTopBar" x="0" y="0" width="100%" height="24" visible="true">
             <prototype name="Window" />
             <text_area name="ItemText" x="36" y="6" text_name="ItemMenuUse" font="FFVIIFont" visible="true" />
             <text_area name="ItemText" x="96" y="6" text_name="ItemMenuOrder" font="FFVIIFont" visible="true" />
@@ -11,15 +11,15 @@
                 <animation name="Position3" length="0" x="0:126" />
             </sprite>
         </widget>
-        <widget name="ItemMenuTitle" x="254" y="5" width="86" height="24" visible="true">
+        <widget name="ItemMenuTitle" x="100%-86" y="" width="86" height="24" visible="true">
             <prototype name="Window" />
             <text_area name="ItemText" x="16" y="6" text_name="ItemMenuItem" font="FFVIIFont" visible="true" />
         </widget>
-        <widget name="ItemMenuSecondBar" x="30" y="29" width="310" height="24" visible="true">
+        <widget name="ItemMenuSecondBar" x="0" y="24" width="100%" height="24" visible="true">
             <prototype name="Window" />
-            <text_area name="ItemText" x="16" y="6" text_name="Placeholder" font="FFVIIFont" visible="true" />
+            <text_area name="ItemText" x="16" y="6" font="FFVIIFont" visible="true" />
         </widget>
-        <widget name="ItemMenuCharacters" x="30" y="53" width="155" height="182" visible="true">
+        <widget name="ItemMenuCharacters" x="0" y="48" width="50%" height="100%-48" visible="true">
             <prototype name="Window" />
             <widget name="Character1" x="0" y="0" width="100%" height="55" visible="true">
                 <sprite name="Portrait" image="images/other/choco.png" x="10" y="12" width="48" height="48" visible="true" />
@@ -50,70 +50,91 @@
                 <sprite name="Cursor3" image="images/icons/cursor.png" x="0" y="135" width="24" height="17" visible="true"/>
             </widget>
         </widget>
-        <widget name="ItemList" x="185" y="53" width="155" height="182" visible="true">
+        <widget name="ItemList" x="50%" y="48" width="50%" height="100%-48" visible="true">
             <prototype name="Window" />
 
-            <sprite name="Icon0" image="images/icons/item_item.png" x="8" y="5" width="13" height="15" visible="true" />
-            <text_area name="Name0" x="30" y="6" text_name="Placeholder" font="FFVIIFont" visible="true" />
-            <text_area name="Colon0" x="130" y="6" text_name="Colon" font="FFVIIFont" visible="true" />
-            <text_area name="Qty0" x="135" y="6" text_name="Placeholder" font="FFVIIFont" visible="true" />
-
-            <sprite name="Icon1" image="images/icons/item_item.png" x="8" y="22" width="13" height="15" visible="true" />
-            <text_area name="Name1" x="30" y="23" text_name="Placeholder" font="FFVIIFont" visible="true" />
-            <text_area name="Colon1" x="130" y="23" text_name="Colon" font="FFVIIFont" visible="true" />
-            <text_area name="Qty1" x="135" y="23" text_name="Placeholder" font="FFVIIFont" visible="true" />
-
-            <sprite name="Icon2" image="images/icons/item_item.png" x="8" y="39" width="13" height="15" visible="true" />
-            <text_area name="Name2" x="30" y="40" text_name="Placeholder" font="FFVIIFont" visible="true" />
-            <text_area name="Colon2" x="130" y="40" text_name="Colon" font="FFVIIFont" visible="true" />
-            <text_area name="Qty2" x="135" y="40" text_name="Placeholder" font="FFVIIFont" visible="true" />
-
-            <sprite name="Icon3" image="images/icons/item_item.png" x="8" y="56" width="13" height="15" visible="true" />
-            <text_area name="Name3" x="30" y="57" text_name="Placeholder" font="FFVIIFont" visible="true" />
-            <text_area name="Colon3" x="130" y="57" text_name="Colon" font="FFVIIFont" visible="true" />
-            <text_area name="Qty3" x="135" y="57" text_name="Placeholder" font="FFVIIFont" visible="true" />
-
-            <sprite name="Icon4" image="images/icons/item_item.png" x="8" y="73" width="13" height="15" visible="true" />
-            <text_area name="Name4" x="30" y="74" text_name="Placeholder" font="FFVIIFont" visible="true" />
-            <text_area name="Colon4" x="130" y="74" text_name="Colon" font="FFVIIFont" visible="true" />
-            <text_area name="Qty4" x="135" y="74" text_name="Placeholder" font="FFVIIFont" visible="true" />
-
-            <sprite name="Icon5" image="images/icons/item_item.png" x="8" y="90" width="13" height="15" visible="true" />
-            <text_area name="Name5" x="30" y="91" text_name="Placeholder" font="FFVIIFont" visible="true" />
-            <text_area name="Colon5" x="130" y="91" text_name="Colon" font="FFVIIFont" visible="true" />
-            <text_area name="Qty5" x="135" y="91" text_name="Placeholder" font="FFVIIFont" visible="true" />
-
-            <sprite name="Icon6" image="images/icons/item_item.png" x="8" y="107" width="13" height="15" visible="true" />
-            <text_area name="Name6" x="30" y="108" text_name="Placeholder" font="FFVIIFont" visible="true" />
-            <text_area name="Colon6" x="130" y="108" text_name="Colon" font="FFVIIFont" visible="true" />
-            <text_area name="Qty6" x="135" y="108" text_name="Placeholder" font="FFVIIFont" visible="true" />
-
-            <sprite name="Icon7" image="images/icons/item_item.png" x="8" y="124" width="13" height="15" visible="true" />
-            <text_area name="Name7" x="30" y="125" text_name="Placeholder" font="FFVIIFont" visible="true" />
-            <text_area name="Colon7" x="130" y="125" text_name="Colon" font="FFVIIFont" visible="true" />
-            <text_area name="Qty7" x="135" y="125" text_name="Placeholder" font="FFVIIFont" visible="true" />
-
-            <sprite name="Icon8" image="images/icons/item_item.png" x="8" y="141" width="13" height="15" visible="true" />
-            <text_area name="Name8" x="30" y="142" text_name="Placeholder" font="FFVIIFont" visible="true" />
-            <text_area name="Colon8" x="130" y="142" text_name="Colon" font="FFVIIFont" visible="true" />
-            <text_area name="Qty8" x="135" y="142" text_name="Placeholder" font="FFVIIFont" visible="true" />
-
-            <sprite name="Icon9" image="images/icons/item_item.png" x="8" y="158" width="13" height="15" visible="true" />
-            <text_area name="Name9" x="30" y="159" text_name="Placeholder" font="FFVIIFont" visible="true" />
-            <text_area name="Colon9" x="130" y="159" text_name="Colon" font="FFVIIFont" visible="true" />
-            <text_area name="Qty9" x="135" y="159" text_name="Placeholder" font="FFVIIFont" visible="true" />
+            <sprite name="ScrollBg" x="100%-12" y="2" width="10" height="100%-6" colour="0.2 0.2 0.2" alpha="0.8" visible="true"/>
+            <sprite name="Scroll" x="100%-11" y="3" width="8" height="18" colour="0.7 0.7 0.7" visible="true"/>
 
-            <sprite name="Cursor" image="images/icons/cursor.png" x="-11" y="6" width="24" height="17" visible="true">
-                <animation name="Position1" length="0" y="0:6" />
-                <animation name="Position2" length="0" y="0:23" />
-                <animation name="Position3" length="0" y="0:40" />
-                <animation name="Position4" length="0" y="0:57" />
-                <animation name="Position5" length="0" y="0:78" />
-                <animation name="Position6" length="0" y="0:91" />
-                <animation name="Position7" length="0" y="0:108" />
-                <animation name="Position8" length="0" y="0:125" />
-                <animation name="Position9" length="0" y="0:142" />
-                <animation name="Position10" length="0" y="0:159" />
+            <sprite name="Icon1" image="images/icons/item_item.png" x="8" y="5%-2" width="13" height="15" visible="true" />
+            <text_area name="Name1" x="30" y="5%" font="FFVIIFont" visible="true" />
+            <text_area name="Colon1" x="130" y="5%" font="FFVIIFont" visible="true" />
+            <text_area name="Qty1" x="135" y="5%" font="FFVIIFont" visible="true" />
+
+            <sprite name="Icon2" image="images/icons/item_item.png" x="8" y="12%-2" width="13" height="15" visible="true" />
+            <text_area name="Name2" x="30" y="12%" font="FFVIIFont" visible="true" />
+            <text_area name="Colon2" x="130" y="12%" font="FFVIIFont" visible="true" />
+            <text_area name="Qty2" x="135" y="12%" font="FFVIIFont" visible="true" />
+
+            <sprite name="Icon3" image="images/icons/item_item.png" x="8" y="19%-2" width="13" height="15" visible="true" />
+            <text_area name="Name3" x="30" y="19%" font="FFVIIFont" visible="true" />
+            <text_area name="Colon3" x="130" y="19%" font="FFVIIFont" visible="true" />
+            <text_area name="Qty3" x="135" y="19%" font="FFVIIFont" visible="true" />
+
+            <sprite name="Icon4" image="images/icons/item_item.png" x="8" y="26%-2" width="13" height="15" visible="true" />
+            <text_area name="Name4" x="30" y="26%" font="FFVIIFont" visible="true" />
+            <text_area name="Colon4" x="130" y="26%" font="FFVIIFont" visible="true" />
+            <text_area name="Qty4" x="135" y="26%" font="FFVIIFont" visible="true" />
+
+            <sprite name="Icon5" image="images/icons/item_item.png" x="8" y="33%-2" width="13" height="15" visible="true" />
+            <text_area name="Name5" x="30" y="33%" font="FFVIIFont" visible="true" />
+            <text_area name="Colon5" x="130" y="33%" font="FFVIIFont" visible="true" />
+            <text_area name="Qty5" x="135" y="33%" font="FFVIIFont" visible="true" />
+
+            <sprite name="Icon6" image="images/icons/item_item.png" x="8" y="40%-2" width="13" height="15" visible="true" />
+            <text_area name="Name6" x="30" y="40%" font="FFVIIFont" visible="true" />
+            <text_area name="Colon6" x="130" y="40%" font="FFVIIFont" visible="true" />
+            <text_area name="Qty6" x="135" y="40%" font="FFVIIFont" visible="true" />
+
+            <sprite name="Icon7" image="images/icons/item_item.png" x="8" y="47%-2" width="13" height="15" visible="true" />
+            <text_area name="Name7" x="30" y="47%" font="FFVIIFont" visible="true" />
+            <text_area name="Colon7" x="130" y="47%" font="FFVIIFont" visible="true" />
+            <text_area name="Qty7" x="135" y="47%" font="FFVIIFont" visible="true" />
+
+            <sprite name="Icon8" image="images/icons/item_item.png" x="8" y="54%-2" width="13" height="15" visible="true" />
+            <text_area name="Name8" x="30" y="54%" font="FFVIIFont" visible="true" />
+            <text_area name="Colon8" x="130" y="54%" font="FFVIIFont" visible="true" />
+            <text_area name="Qty8" x="135" y="54%" font="FFVIIFont" visible="true" />
+
+            <sprite name="Icon9" image="images/icons/item_item.png" x="8" y="61%-2" width="13" height="15" visible="true" />
+            <text_area name="Name9" x="30" y="61%" font="FFVIIFont" visible="true" />
+            <text_area name="Colon9" x="130" y="61%" font="FFVIIFont" visible="true" />
+            <text_area name="Qty9" x="135" y="61%" font="FFVIIFont" visible="true" />
+
+            <sprite name="Icon10" image="images/icons/item_item.png" x="8" y="68%-2" width="13" height="15" visible="true" />
+            <text_area name="Name10" x="30" y="68%" font="FFVIIFont" visible="true" />
+            <text_area name="Colon10" x="130" y="68%" font="FFVIIFont" visible="true" />
+            <text_area name="Qty10" x="135" y="68%" font="FFVIIFont" visible="true" />
+
+            <sprite name="Icon11" image="images/icons/item_item.png" x="8" y="75%-2" width="13" height="15" visible="true" />
+            <text_area name="Name11" x="30" y="75%" font="FFVIIFont" visible="true" />
+            <text_area name="Colon11" x="130" y="75%" font="FFVIIFont" visible="true" />
+            <text_area name="Qty11" x="135" y="75%" font="FFVIIFont" visible="true" />
+
+            <sprite name="Icon12" image="images/icons/item_item.png" x="8" y="82%-2" width="13" height="15" visible="true" />
+            <text_area name="Name12" x="30" y="82%" font="FFVIIFont" visible="true" />
+            <text_area name="Colon12" x="130" y="82%" font="FFVIIFont" visible="true" />
+            <text_area name="Qty12" x="135" y="82%" font="FFVIIFont" visible="true" />
+
+            <sprite name="Icon13" image="images/icons/item_item.png" x="8" y="89%-2" width="13" height="15" visible="true" />
+            <text_area name="Name13" x="30" y="89%" font="FFVIIFont" visible="true" />
+            <text_area name="Colon13" x="130" y="89%" font="FFVIIFont" visible="true" />
+            <text_area name="Qty13" x="135" y="89%" font="FFVIIFont" visible="true" />
+
+            <sprite name="Cursor" image="images/icons/cursor.png" x="-11" y="5%+2" width="24" height="17" visible="true">
+                <animation name="Position1" length="0" y="0:5%+2" />
+                <animation name="Position2" length="0" y="0:12%+2" />
+                <animation name="Position3" length="0" y="0:19%+2" />
+                <animation name="Position4" length="0" y="0:26%+2" />
+                <animation name="Position5" length="0" y="0:33%+2" />
+                <animation name="Position6" length="0" y="0:40%+2" />
+                <animation name="Position7" length="0" y="0:47%+2" />
+                <animation name="Position8" length="0" y="0:54%+2" />
+                <animation name="Position9" length="0" y="0:61%+2" />
+                <animation name="Position10" length="0" y="0:68%+2" />
+                <animation name="Position11" length="0" y="0:75%+2" />
+                <animation name="Position12" length="0" y="0:82%+2" />
+                <animation name="Position13" length="0" y="0:89%+2" />
             </sprite>
 
 
@@ -140,49 +161,63 @@
             </sprite>
 
         </widget>
-        <widget name="KeyItems" x="30" y="53" width="310" height="182" visible="false">
+        <widget name="KeyItems" x="0" y="48" width="100%" height="100%-48" visible="false">
             <prototype name="Window" />
-            <text_area name="KeyItem0-0" x="30" y="6" text_name="Placeholder" font="FFVIIFont" visible="true" />
-            <text_area name="KeyItem0-1" x="185" y="6" text_name="Placeholder" font="FFVIIFont" visible="true" />
-            <text_area name="KeyItem1-0" x="30" y="6" text_name="Placeholder" font="FFVIIFont" visible="true" />
-            <text_area name="KeyItem1-1" x="185" y="6" text_name="Placeholder" font="FFVIIFont" visible="true" />
-            <text_area name="KeyItem2-0" x="30" y="40" text_name="Placeholder" font="FFVIIFont" visible="true" />
-            <text_area name="KeyItem2-1" x="185" y="40" text_name="Placeholder" font="FFVIIFont" visible="true" />
-            <text_area name="KeyItem3-0" x="30" y="57" text_name="Placeholder" font="FFVIIFont" visible="true" />
-            <text_area name="KeyItem3-1" x="185" y="57" text_name="Placeholder" font="FFVIIFont" visible="true" />
-            <text_area name="KeyItem4-0" x="30" y="74" text_name="Placeholder" font="FFVIIFont" visible="true" />
-            <text_area name="KeyItem4-1" x="185" y="74" text_name="Placeholder" font="FFVIIFont" visible="true" />
-            <text_area name="KeyItem5-0" x="30" y="91" text_name="Placeholder" font="FFVIIFont" visible="true" />
-            <text_area name="KeyItem5-1" x="185" y="91" text_name="Placeholder" font="FFVIIFont" visible="true" />
-            <text_area name="KeyItem6-0" x="30" y="108" text_name="Placeholder" font="FFVIIFont" visible="true" />
-            <text_area name="KeyItem6-1" x="185" y="108" text_name="Placeholder" font="FFVIIFont" visible="true" />
-            <text_area name="KeyItem7-0" x="30" y="125" text_name="Placeholder" font="FFVIIFont" visible="true" />
-            <text_area name="KeyItem7-1" x="185" y="125" text_name="Placeholder" font="FFVIIFont" visible="true" />
-            <text_area name="KeyItem8-0" x="30" y="142" text_name="Placeholder" font="FFVIIFont" visible="true" />
-            <text_area name="KeyItem8-1" x="185" y="142" text_name="Placeholder" font="FFVIIFont" visible="true" />
-            <text_area name="KeyItem9-0" x="30" y="159" text_name="Placeholder" font="FFVIIFont" visible="true" />
-            <text_area name="KeyItem9-1" x="185" y="159" text_name="Placeholder" font="FFVIIFont" visible="true" />
+            <sprite name="ScrollBg" x="100%-12" y="2" width="10" height="100%-6" colour="0.2 0.2 0.2" alpha="0.8" visible="true"/>
+            <sprite name="Scroll" x="100%-11" y="3" width="8" height="18" colour="0.7 0.7 0.7" visible="true"/>
+            <text_area name="KeyItem1-1" x="10%" y="5%" font="FFVIIFont" visible="true" />
+            <text_area name="KeyItem1-2" x="60%" y="5%" font="FFVIIFont" visible="true" />
+            <text_area name="KeyItem2-1" x="10%" y="12%" font="FFVIIFont" visible="true" />
+            <text_area name="KeyItem2-2" x="60%" y="12%" font="FFVIIFont" visible="true" />
+            <text_area name="KeyItem3-1" x="10%" y="19%" font="FFVIIFont" visible="true" />
+            <text_area name="KeyItem3-2" x="60%" y="19%" font="FFVIIFont" visible="true" />
+            <text_area name="KeyItem4-1" x="10%" y="26%" font="FFVIIFont" visible="true" />
+            <text_area name="KeyItem4-2" x="60%" y="26%" font="FFVIIFont" visible="true" />
+            <text_area name="KeyItem5-1" x="10%" y="33%" font="FFVIIFont" visible="true" />
+            <text_area name="KeyItem5-2" x="60%" y="33%" font="FFVIIFont" visible="true" />
+            <text_area name="KeyItem6-1" x="10%" y="40%" font="FFVIIFont" visible="true" />
+            <text_area name="KeyItem6-2" x="60%" y="40%" font="FFVIIFont" visible="true" />
+            <text_area name="KeyItem7-1" x="10%" y="47%" font="FFVIIFont" visible="true" />
+            <text_area name="KeyItem7-2" x="60%" y="47%" font="FFVIIFont" visible="true" />
+            <text_area name="KeyItem8-1" x="10%" y="54%" font="FFVIIFont" visible="true" />
+            <text_area name="KeyItem8-2" x="60%" y="54%" font="FFVIIFont" visible="true" />
+            <text_area name="KeyItem9-1" x="10%" y="61%" font="FFVIIFont" visible="true" />
+            <text_area name="KeyItem9-2" x="60%" y="61%" font="FFVIIFont" visible="true" />
+            <text_area name="KeyItem10-1" x="10%" y="68%" font="FFVIIFont" visible="true" />
+            <text_area name="KeyItem10-2" x="60%" y="68%" font="FFVIIFont" visible="true" />
+            <text_area name="KeyItem11-1" x="10%" y="75%" font="FFVIIFont" visible="true" />
+            <text_area name="KeyItem11-2" x="60%" y="75%" font="FFVIIFont" visible="true" />
+            <text_area name="KeyItem12-1" x="10%" y="82%" font="FFVIIFont" visible="true" />
+            <text_area name="KeyItem12-2" x="60%" y="82%" font="FFVIIFont" visible="true" />
+            <text_area name="KeyItem13-1" x="10%" y="89%" font="FFVIIFont" visible="true" />
+            <text_area name="KeyItem13-2" x="60%" y="89%" font="FFVIIFont" visible="true" />
             <sprite name="Cursor" image="images/icons/cursor.png" x="-11" y="6" width="24" height="17" visible="true">
-                <animation name="Position0-0" length="0" x="0:0" y="0:6" />
-                <animation name="Position0-1" length="0" x="0:150" y="0:6" />
-                <animation name="Position1-0" length="0" x="0:0" y="0:23" />
-                <animation name="Position1-1" length="0" x="0:150" y="0:23" />
-                <animation name="Position2-0" length="0" x="0:0" y="0:40" />
-                <animation name="Position2-1" length="0" x="0:150" y="0:40" />
-                <animation name="Position3-0" length="0" x="0:0" y="0:57" />
-                <animation name="Position3-1" length="0" x="0:150" y="0:57" />
-                <animation name="Position4-0" length="0" x="0:0" y="0:78" />
-                <animation name="Position4-1" length="0" x="0:150" y="0:78" />
-                <animation name="Position5-0" length="0" x="0:0" y="0:91" />
-                <animation name="Position5-1" length="0" x="0:150" y="0:91" />
-                <animation name="Position6-0" length="0" x="0:0" y="0:108" />
-                <animation name="Position6-1" length="0" x="0:150" y="0:108" />
-                <animation name="Position7-0" length="0" x="0:0" y="0:125" />
-                <animation name="Position7-1" length="0" x="0:150" y="0:125" />
-                <animation name="Position8-0" length="0" x="0:0" y="0:142" />
-                <animation name="Position8-1" length="0" x="0:150" y="0:142" />
-                <animation name="Position9-0" length="0" x="0:0" y="0:159" />
-                <animation name="Position9-1" length="0" x="0:150" y="0:159" />
+                <animation name="Position1-1" length="0" x="0:10%-24" y="0:5%+1" />
+                <animation name="Position1-2" length="0" x="0:60%-24" y="0:5%+1" />
+                <animation name="Position2-1" length="0" x="0:10%-24" y="0:12%+1" />
+                <animation name="Position2-2" length="0" x="0:60%-24" y="0:12%+1" />
+                <animation name="Position3-1" length="0" x="0:10%-24" y="0:19%+1" />
+                <animation name="Position3-2" length="0" x="0:60%-24" y="0:19%+1" />
+                <animation name="Position4-1" length="0" x="0:10%-24" y="0:26%+1" />
+                <animation name="Position4-2" length="0" x="0:60%-24" y="0:26%+1" />
+                <animation name="Position5-1" length="0" x="0:10%-24" y="0:33%+1" />
+                <animation name="Position5-2" length="0" x="0:60%-24" y="0:33%+1" />
+                <animation name="Position6-1" length="0" x="0:10%-24" y="0:40%+1" />
+                <animation name="Position6-2" length="0" x="0:60%-24" y="0:40%+1" />
+                <animation name="Position7-1" length="0" x="0:10%-24" y="0:47%+1" />
+                <animation name="Position7-2" length="0" x="0:60%-24" y="0:47%+1" />
+                <animation name="Position8-1" length="0" x="0:10%-24" y="0:54%+1" />
+                <animation name="Position8-2" length="0" x="0:60%-24" y="0:54%+1" />
+                <animation name="Position9-1" length="0" x="0:10%-24" y="0:61%+1" />
+                <animation name="Position9-2" length="0" x="0:60%-24" y="0:61%+1" />
+                <animation name="Position10-1" length="0" x="0:10%-24" y="0:68%+1" />
+                <animation name="Position10-2" length="0" x="0:60%-24" y="0:68%+1" />
+                <animation name="Position11-1" length="0" x="0:10%-24" y="0:75%+1" />
+                <animation name="Position11-2" length="0" x="0:60%-24" y="0:75%+1" />
+                <animation name="Position12-1" length="0" x="0:10%-24" y="0:82%+1" />
+                <animation name="Position12-2" length="0" x="0:60%-24" y="0:82%+1" />
+                <animation name="Position13-1" length="0" x="0:10%-24" y="0:89%+1" />
+                <animation name="Position13-2" length="0" x="0:60%-24" y="0:89%+1" />
             </sprite>
         </widget>
     </widget>

+ 65 - 59
data/data/screens/main_menu/main_menu.xml

@@ -1,66 +1,70 @@
 <screen name="MainMenu" script="scripts/menu/main_menu.lua" visible="false">
-    <widget name="Container" width="100%" height="100%" x="0%"  y="0%" align="left" valign="top" scale="3 3" visible="true">
-        <widget name="Characters" x="1%" y="1%" width="32%" height="30%" visible="true">
+    <widget name="Container" width="40%" height="40%" x="0" y="0" align="left" valign="top" scale="2.5 2.5" visible="true">
+        <widget name="Characters" x="5%" y="5%" width="85%" height="80%" visible="true">
             <prototype name="Window" />
-            <animation name="Appear" length="0.3" x="0:110%,0.3:1%" />
-            <animation name="Disappear" length="0.3" x="0:1%,0.3:110%" />
-
-            <widget name="Character1" x="0" y="0" width="100%" height="60" visible="true">
-                <sprite name="Portrait" image="images/other/choco.png" x="22" y="12" width="48" height="48" visible="true">
-                    <animation name="RowFront" length="0" x="0:10" />
-                    <animation name="RowBack" length="0" x="0:22" />
+            <animation name="Appear" length="0.3" x="0:105%,0.3:5%" />
+            <animation name="Disappear" length="0.3" x="0:5%,0.3:105%" />
+            <widget name="Character1" x="2%" y="2%" width="100%" height="30%" visible="true">
+                <sprite name="Portrait" image="images/other/choco.png" x="5" y="12" width="56" height="56" visible="true">
+                    <animation name="RowFront" length="0" x="0:5" />
+                    <animation name="RowBack" length="0" x="0:25" />
                 </sprite>
-                <widget name="Data" x="80" y="14" width="100%" height="100%" visible="true">
+                <widget name="Data" x="80" y="18" width="100%" height="100%" visible="true">
                     <prototype name="MenuCharacterData" />
                 </widget>
-                <text_area name="NextLevelText" x="172" y="17" text_name="CharacterDataNextLevel" font="FFVIIFont" visible="true" />
-                <sprite name="NextLevelBar" image="images/icons/menu_bar.png" x="172" y="28" width="64" height="8" visible="true" />
-                <sprite name="NextLevelLinePart1" x="173" y="29" width="20" height="3" colours="0.5 0.5 0.5, 0.5 0.5 0.5, 0.5 0.125 0.125, 0.5 0.125 0.125" alpha="0.8" visible="false" />
-                <sprite name="NextLevelLinePart2" x="173" y="32" width="20" height="3" colours="0.5 0.125 0.125, 0.5 0.125 0.125, 0 0 0, 0 0 0" alpha="0.8" visible="false" />
-                <text_area name="LimitLevelText" x="172" y="38" text_name="CharacterDataLimitLevel" font="FFVIIFont" visible="true" />
-                <sprite name="LimitLevelBar" image="images/icons/menu_bar.png" x="172" y="49" width="64" height="8" visible="true" />
-                <text_area name="LimitLevel" x="225" y="40" text_name="CharacterDataLimitLevelNumber" font="FFVIIMenuDigits" visible="true" />
-                <sprite name="LimitLinePart1" x="173" y="50" width="25" height="3" colours="0.5 0.5 0.5, 0.5 0.5 0.5, 0.5 0.125 0.31, 0.5 0.125 0.31" alpha="0.8" visible="false" />
-                <sprite name="LimitLinePart2" x="173" y="53" width="25" height="3" colours="0.5 0.125 0.31, 0.5 0.125 0.31, 0 0 0, 0 0 0" alpha="0.8" visible="false" />
+                <text_area name="NextLevelText" x="177" y="17" text_name="CharacterDataNextLevel" font="FFVIIFont" visible="true" />
+                <sprite name="NextLevelBar" image="images/icons/menu_bar.png" x="182" y="28" width="64" height="8" visible="true" />
+                <sprite name="NextLevelLinePart1" x="183" y="29" width="20" height="3" colours="0.5 0.5 0.5, 0.5 0.5 0.5, 0.5 0.125 0.125, 0.5 0.125 0.125" alpha="0.8" visible="false" />
+                <sprite name="NextLevelLinePart2" x="183" y="32" width="20" height="3" colours="0.5 0.125 0.125, 0.5 0.125 0.125, 0 0 0, 0 0 0" alpha="0.8" visible="false" />
+                <text_area name="LimitLevelText" x="177" y="38" text_name="CharacterDataLimitLevel" font="FFVIIFont" visible="true" />
+                <sprite name="LimitLevelBar" image="images/icons/menu_bar.png" x="183" y="49" width="64" height="8" visible="true" />
+                <text_area name="LimitLevel" x="230" y="40" text_name="CharacterDataLimitLevelNumber" font="FFVIIMenuDigits" visible="true" />
+                <sprite name="LimitLinePart1" x="183" y="50" width="25" height="3" colours="0.5 0.5 0.5, 0.5 0.5 0.5, 0.5 0.125 0.31, 0.5 0.125 0.31" alpha="0.8" visible="false" />
+                <sprite name="LimitLinePart2" x="183" y="53" width="25" height="3" colours="0.5 0.125 0.31, 0.5 0.125 0.31, 0 0 0, 0 0 0" alpha="0.8" visible="false" />
             </widget>
-            <widget name="Character2" x="0" y="65" width="100%" height="60" visible="true">
-                <sprite name="Portrait" image="images/other/choco.png" x="22" y="12" width="48" height="48" visible="true" />
-                <widget name="Data" x="80" y="14" width="100%" height="100%" visible="true">
+            <widget name="Character2" x="2%" y="32%" width="100%" height="32%" visible="true">
+                <sprite name="Portrait" image="images/other/choco.png" x="5" y="12" width="56" height="56" visible="true">
+                    <animation name="RowFront" length="0" x="0:5" />
+                    <animation name="RowBack" length="0" x="0:25" />
+                </sprite>
+                <widget name="Data" x="80" y="18" width="100%" height="100%" visible="true">
                     <prototype name="MenuCharacterData" />
                 </widget>
-                <text_area name="NextLevelText" x="172" y="17" text_name="CharacterDataNextLevel" font="FFVIIFont" visible="true" />
-                <sprite name="NextLevelBar" image="images/icons/menu_bar.png" x="172" y="28" width="64" height="8" visible="true" />
-                <sprite name="NextLevelLinePart1" x="173" y="29" width="20" height="3" colours="0.5 0.5 0.5, 0.5 0.5 0.5, 0.5 0.125 0.125, 0.5 0.125 0.125" alpha="0.8" visible="false" />
-                <sprite name="NextLevelLinePart2" x="173" y="32" width="20" height="3" colours="0.5 0.125 0.125, 0.5 0.125 0.125, 0 0 0, 0 0 0" alpha="0.8" visible="false" />
-                <text_area name="LimitLevelText" x="172" y="38" text_name="CharacterDataLimitLevel" font="FFVIIFont" visible="true" />
-                <sprite name="LimitLevelBar" image="images/icons/menu_bar.png" x="172" y="49" width="64" height="8" visible="true" />
-                <text_area name="LimitLevel" x="225" y="40" text_name="CharacterDataLimitLevelNumber" font="FFVIIMenuDigits" visible="true" />
-                <sprite name="LimitLinePart1" x="173" y="50" width="25" height="3" colours="0.5 0.5 0.5, 0.5 0.5 0.5, 0.5 0.125 0.31, 0.5 0.125 0.31" alpha="0.8" visible="false" />
-                <sprite name="LimitLinePart2" x="173" y="53" width="25" height="3" colours="0.5 0.125 0.31, 0.5 0.125 0.31, 0 0 0, 0 0 0" alpha="0.8" visible="false" />
+                <text_area name="NextLevelText" x="177" y="17" text_name="CharacterDataNextLevel" font="FFVIIFont" visible="true" />
+                <sprite name="NextLevelBar" image="images/icons/menu_bar.png" x="182" y="28" width="64" height="8" visible="true" />
+                <sprite name="NextLevelLinePart1" x="183" y="29" width="20" height="3" colours="0.5 0.5 0.5, 0.5 0.5 0.5, 0.5 0.125 0.125, 0.5 0.125 0.125" alpha="0.8" visible="false" />
+                <sprite name="NextLevelLinePart2" x="183" y="32" width="20" height="3" colours="0.5 0.125 0.125, 0.5 0.125 0.125, 0 0 0, 0 0 0" alpha="0.8" visible="false" />
+                <text_area name="LimitLevelText" x="177" y="38" text_name="CharacterDataLimitLevel" font="FFVIIFont" visible="true" />
+                <sprite name="LimitLevelBar" image="images/icons/menu_bar.png" x="183" y="49" width="64" height="8" visible="true" />
+                <text_area name="LimitLevel" x="230" y="40" text_name="CharacterDataLimitLevelNumber" font="FFVIIMenuDigits" visible="true" />
+                <sprite name="LimitLinePart1" x="183" y="50" width="25" height="3" colours="0.5 0.5 0.5, 0.5 0.5 0.5, 0.5 0.125 0.31, 0.5 0.125 0.31" alpha="0.8" visible="false" />
+                <sprite name="LimitLinePart2" x="183" y="53" width="25" height="3" colours="0.5 0.125 0.31, 0.5 0.125 0.31, 0 0 0, 0 0 0" alpha="0.8" visible="false" />
             </widget>
-            <widget name="Character3" x="0" y="130" width="100%" height="60" visible="true">
-                <sprite name="Portrait" image="images/other/choco.png" x="22" y="12" width="48" height="48" visible="true" />
-                <widget name="Data" x="80" y="14" width="100%" height="100%" visible="true">
+            <widget name="Character3" x="2%" y="62%" width="100%" height="32%" visible="true">
+               <sprite name="Portrait" image="images/other/choco.png" x="5" y="12" width="56" height="56" visible="true">
+                    <animation name="RowFront" length="0" x="0:5" />
+                    <animation name="RowBack" length="0" x="0:25" />
+                </sprite>
+                <widget name="Data" x="80" y="18" width="100%" height="100%" visible="true">
                     <prototype name="MenuCharacterData" />
                 </widget>
-                <text_area name="NextLevelText" x="172" y="17" text_name="CharacterDataNextLevel" font="FFVIIFont" visible="true" />
-                <sprite name="NextLevelBar" image="images/icons/menu_bar.png" x="172" y="28" width="64" height="8" visible="true" />
-                <sprite name="NextLevelLinePart1" x="173" y="29" width="20" height="3" colours="0.5 0.5 0.5, 0.5 0.5 0.5, 0.5 0.125 0.125, 0.5 0.125 0.125" alpha="0.8" visible="false" />
-                <sprite name="NextLevelLinePart2" x="173" y="32" width="20" height="3" colours="0.5 0.125 0.125, 0.5 0.125 0.125, 0 0 0, 0 0 0" alpha="0.8" visible="false" />
-                <text_area name="LimitLevelText" x="172" y="38" text_name="CharacterDataLimitLevel" font="FFVIIFont" visible="true" />
-                <sprite name="LimitLevelBar" image="images/icons/menu_bar.png" x="172" y="49" width="64" height="8" visible="true" />
-                <text_area name="LimitLevel" x="225" y="40" text_name="CharacterDataLimitLevelNumber" font="FFVIIMenuDigits" visible="true" />
-                <sprite name="LimitLinePart1" x="173" y="50" width="25" height="3" colours="0.5 0.5 0.5, 0.5 0.5 0.5, 0.5 0.125 0.31, 0.5 0.125 0.31" alpha="0.8" visible="false" />
-                <sprite name="LimitLinePart2" x="173" y="53" width="25" height="3" colours="0.5 0.125 0.31, 0.5 0.125 0.31, 0 0 0, 0 0 0" alpha="0.8" visible="false" />
+                <text_area name="NextLevelText" x="177" y="17" text_name="CharacterDataNextLevel" font="FFVIIFont" visible="true" />
+                <sprite name="NextLevelBar" image="images/icons/menu_bar.png" x="182" y="28" width="64" height="8" visible="true" />
+                <sprite name="NextLevelLinePart1" x="183" y="29" width="20" height="3" colours="0.5 0.5 0.5, 0.5 0.5 0.5, 0.5 0.125 0.125, 0.5 0.125 0.125" alpha="0.8" visible="false" />
+                <sprite name="NextLevelLinePart2" x="183" y="32" width="20" height="3" colours="0.5 0.125 0.125, 0.5 0.125 0.125, 0 0 0, 0 0 0" alpha="0.8" visible="false" />
+                <text_area name="LimitLevelText" x="177" y="38" text_name="CharacterDataLimitLevel" font="FFVIIFont" visible="true" />
+                <sprite name="LimitLevelBar" image="images/icons/menu_bar.png" x="183" y="49" width="64" height="8" visible="true" />
+                <text_area name="LimitLevel" x="230" y="40" text_name="CharacterDataLimitLevelNumber" font="FFVIIMenuDigits" visible="true" />
+                <sprite name="LimitLinePart1" x="183" y="50" width="25" height="3" colours="0.5 0.5 0.5, 0.5 0.5 0.5, 0.5 0.125 0.31, 0.5 0.125 0.31" alpha="0.8" visible="false" />
+                <sprite name="LimitLinePart2" x="183" y="53" width="25" height="3" colours="0.5 0.125 0.31, 0.5 0.125 0.31, 0 0 0, 0 0 0" alpha="0.8" visible="false" />
             </widget>
-            <sprite name="Cursor" image="images/icons/cursor.png" x="0" y="35" width="24" height="16" visible="false">
-                <animation name="Position1" length="0" y="0:35" />
-                <animation name="Position2" length="0" y="0:95" />
-                <animation name="Position3" length="0" y="0:155" />
+            <sprite name="Cursor" image="images/icons/cursor.png" x="0" y="2%+40" width="24" height="16" visible="false">
+                <animation name="Position1" length="0" y="0:2%+40" />
+                <animation name="Position2" length="0" y="0:32%+40" />
+                <animation name="Position3" length="0" y="0:62%+40" />
             </sprite>
         </widget>
-
-        <widget name="Menu" x="270" y="5" width="75" height="132" visible="true">
+        <widget name="Menu" x="100%-105" y="2%" width="90" height="144" visible="true">
             <prototype name="Window" />
             <text_area name="ItemText" x="16" y="6" text_name="MainMenuItem" font="FFVIIFont" visible="true" />
             <text_area name="MagicText" x="16" y="18" text_name="MainMenuMagic" font="FFVIIFont" visible="true" />
@@ -72,6 +76,7 @@
             <text_area name="ConfigText" x="16" y="90" text_name="MainMenuConfig" font="FFVIIFont" visible="true" />
             <text_area name="PHSText" x="16" y="102" text_name="MainMenuPHS" font="FFVIIFont" visible="true" />
             <text_area name="SaveText" x="16" y="114" text_name="MainMenuSave" font="FFVIIFont" visible="true" />
+            <text_area name="Quit" x="16" y="126" text_name="MainMenuQuit" font="FFVIIFont" visible="true" />
             <sprite name="Cursor" image="images/icons/cursor.png" x="-11" y="6" width="24" height="16" visible="true">
                 <animation name="Position1" length="0" y="0:6" />
                 <animation name="Position2" length="0" y="0:18" />
@@ -83,14 +88,15 @@
                 <animation name="Position8" length="0" y="0:90" />
                 <animation name="Position9" length="0" y="0:102" />
                 <animation name="Position10" length="0" y="0:114" />
+                <animation name="Position11" length="0" y="0:126" />
             </sprite>
-            <animation name="Appear" length="0.3" y="0:405,0.3:5" />
-            <animation name="Disappear" length="0.3" y="0:5,0.3:405" />
+            <animation name="Appear" length="0.3" y="0:105%,0.3:2%" />
+            <animation name="Disappear" length="0.3" y="0:2%,0.3:105%" />
         </widget>
 
-        <widget name="TimeGil" x="270" y="164" width="75" height="36" visible="true">
+        <widget name="TimeGil" x="100%-105" y="100%-90" width="85" height="36" visible="true">
             <prototype name="Window" />
-            <text_area name="TimeText" x="4" y="6" text_name="MainMenuTime" font="FFVIIFont" visible="true" />
+            <text_area name="TimeText" x="3" y="6" text_name="MainMenuTime" font="FFVIIFont" visible="true" />
             <text_area name="TimeHours" x="31" y="8" text_name="MainMenuHours" font="FFVIIMenuDigits" visible="true" />
             <text_area name="TimeSemicolon1" x="44" y="1" text_name="MainMenuSemicolon" font="FFVIIMenuFont" visible="true" />
             <text_area name="TimeMinutes" x="50" y="8" text_name="MainMenuMinutes" font="FFVIIMenuDigits" visible="true" />
@@ -98,17 +104,17 @@
             <text_area name="TimeSemicolon2" x="62" y="1" text_name="MainMenuSemicolon" font="FFVIIMenuFont" visible="true" />
             <text_area name="TimeSeconds" x="67" y="8" text_name="MainMenuSeconds" font="FFVIIMenuDigits" visible="true" />
             -->
-            <text_area name="GilText" x="5" y="20" text_name="MainMenuGil" font="FFVIIFont" visible="true" />
+            <text_area name="GilText" x="3" y="20" text_name="MainMenuGil" font="FFVIIFont" visible="true" />
             <text_area name="Gil" x="14" y="22" text_name="MainMenuGilAmount" font="FFVIIMenuDigits" visible="true" />
-            <animation name="Appear" length="0.3" x="0:-458,0.3:270" />
-            <animation name="Disappear" length="0.3" x="0:270,0.3:-458" />
+            <animation name="Appear" length="0.3" x="0:-200%,0.3:100%-105" />
+            <animation name="Disappear" length="0.3" x="0:100%-105,0.3:-200%" />
         </widget>
 
-        <widget name="Location" x="165" y="200" width="180" height="24" visible="true">
+        <widget name="Location" x="100%-200" y="100%-54" width="180" height="24" visible="true">
             <prototype name="Window" />
             <text_area name="Text" x="8" y="6" text_name="MainMenuLocation" font="FFVIIFont" visible="true" />
-            <animation name="Appear" length="0.3" y="0:-136,0.3:200" />
-            <animation name="Disappear" length="0.3" y="0:200,0.3:-136" />
+            <animation name="Appear" length="0.3" y="0:-200%,0.3:100%-54" />
+            <animation name="Disappear" length="0.3" y="0:100%-54,0.3:-200%" />
         </widget>
     </widget>
 </screen>

+ 50 - 0
data/data/screens/name_menu/name_menu.xml

@@ -0,0 +1,50 @@
+<screen name="NameMenu" script="scripts/menu/name_menu.lua" visible="false">
+    <sprite name="Background" x="0" y="0" width="100%" height="100%" colour="0 0 0" visible="true"/>
+    <widget name="Container" width="40%" height="40%" x="0" y="0" align="left" valign="top" scale="2.5 2.5" visible="true">
+        <widget name="Help" x="0" y="0" width="100%" height="24" visible="true">
+            <prototype name="Window" />
+            <text_area name="Help" text_name="NameMenuHelp" x="16" y="6" font="FFVIIFont" visible="true" />
+        </widget>
+        <widget name="Character" width="100%" x="0" y="24" height="70" visible="true">
+            <prototype name="Window"/>
+            <sprite name="Portrait" image="images/other/choco.png" x="10" y="12" width="48" height="48" visible="true" />
+            <widget name="Name" width="72" height="16" x="80" y="50%-8" visible="true">
+                <text_area name="Char1" x="1" y="0" width="8" height="16" visible="true" font="FFVIIFont" />
+                <text_area name="Char2" x="11" y="0" width="8" height="16" visible="true" font="FFVIIFont" />
+                <text_area name="Char3" x="21" y="0" width="8" height="16" visible="true" font="FFVIIFont" />
+                <text_area name="Char4" x="31" y="0" width="8" height="16" visible="true" font="FFVIIFont" />
+                <text_area name="Char5" x="41" y="0" width="8" height="16" visible="true" font="FFVIIFont" />
+                <text_area name="Char6" x="51" y="0" width="8" height="16" visible="true" font="FFVIIFont" />
+                <text_area name="Char7" x="61" y="0" width="8" height="16" visible="true" font="FFVIIFont" />
+                <text_area name="Char8" x="71" y="0" width="8" height="16" visible="true" font="FFVIIFont" />
+                <text_area name="Char9" x="81" y="0" width="8" height="16" visible="true" font="FFVIIFont" />
+                <text_area name="Char10" x="91" y="0" width="8" height="16" visible="true" font="FFVIIFont" />
+                <text_area name="Char11" x="101" y="0" width="8" height="16" visible="true" font="FFVIIFont" />
+                <text_area name="Char12" x="111" y="0" width="8" height="16" visible="true" font="FFVIIFont" />
+                <sprite name="Score1" x="0" y="11" width="8" height="0.3" colour="0.6 0.6 0.6" visible="true"/>
+                <sprite name="Score2" x="10" y="11" width="8" height="0.3" colour="0.6 0.6 0.6" visible="true"/>
+                <sprite name="Score3" x="20" y="11" width="8" height="0.3" colour="0.6 0.6 0.6" visible="true"/>
+                <sprite name="Score4" x="30" y="11" width="8" height="0.3" colour="0.6 0.6 0.6" visible="true"/>
+                <sprite name="Score5" x="40" y="11" width="8" height="0.3" colour="0.6 0.6 0.6" visible="true"/>
+                <sprite name="Score6" x="50" y="11" width="8" height="0.3" colour="0.6 0.6 0.6" visible="true"/>
+                <sprite name="Score7" x="60" y="11" width="8" height="0.3" colour="0.6 0.6 0.6" visible="true"/>
+                <sprite name="Score8" x="70" y="11" width="8" height="0.3" colour="0.6 0.6 0.6" visible="true"/>
+                <sprite name="Score9" x="80" y="11" width="8" height="0.3" colour="0.6 0.6 0.6" visible="true"/>
+                <sprite name="Score10" x="90" y="11" width="8" height="0.3" colour="0.6 0.6 0.6" visible="true"/>
+                <sprite name="Score11" x="100" y="11" width="8" height="0.3" colour="0.6 0.6 0.6" visible="true"/>
+                <sprite name="Score12" x="110" y="11" width="8" height="0.3" colour="0.6 0.6 0.6" visible="true"/>
+            </widget>
+        </widget>
+        <widget name="Options" x="100%-80" y="94" width="80" height="100%-94" visible="true">
+            <prototype name="Window" />
+            <text_area name="Clear" x="15" y="10" font="FFVIIFont" visible="true" />
+            <text_area name="Default" x="15" y="20" font="FFVIIFont" visible="true" />
+            <text_area name="Confirm" x="15" y="30" font="FFVIIFont" visible="true" />
+            <sprite name="Cursor" image="images/icons/cursor.png" x="-5" y="10" width="24" height="17" visible="true">
+                <animation name="Position1" length="0" y="0:10" />
+                <animation name="Position2" length="0" y="0:20" />
+                <animation name="Position3" length="0" y="0:30" />
+            </sprite>
+        </widget>
+    </widget>
+</screen>

+ 9 - 0
data/data/scripts/data.lua

@@ -191,6 +191,15 @@ FFVII.Party = {
     [3] = nil
 }
 
+--- Current party.
+--
+-- @todo: Change from FFVII.Party, which is to be deleted.
+Party = {
+    [1] = nil,
+    [2] = nil,
+    [3] = nil
+}
+
 --- Memory banks.
 --
 -- Used to store gama data.

+ 5 - 2
data/data/scripts/debug_data.lua

@@ -29,7 +29,7 @@ Inventory.add_item(240, 4)
 Inventory.add_item(289, 4)
 Inventory.add_item(290, 1)
 Inventory.add_item(294, 2)
-Inventory.add_key_item(0)
+--[[Inventory.add_key_item(0)
 Inventory.add_key_item(1)
 Inventory.add_key_item(5)
 Inventory.add_key_item(18)
@@ -38,7 +38,10 @@ Inventory.add_key_item(20)
 Inventory.add_key_item(21)
 Inventory.add_key_item(22)
 Inventory.add_key_item(33)
-Inventory.add_key_item(38)
+Inventory.add_key_item(38)]]
+for i = 0, 50 do
+    Inventory.add_key_item(i)
+end
 Inventory.money = 1234567
 Inventory.sort(Inventory.ORDER.NAME)
 Characters[0].stats.hp.current = 12345

+ 42 - 0
data/data/scripts/field.lua

@@ -181,6 +181,48 @@ axyzi = function(bx, by, bz, bt, id, ax, ay, az, at, scale)
     return 0
 end
 
+--- Shows the ending credits.
+ending_credits = function()
+    -- TODO: Implement. Probably in a looooong loooong time.
+end
+
+--- Displays a window where a name can be assigned to a character.
+--
+-- @param id ID of the character to name.
+name_character = function(id)
+    -- TODO: Implement.
+    if Characters[id] == nil then
+        print("Tried to rename invalid character with ID " .. tostring(id))
+        return 0
+    end
+    UiContainer.NameMenu.id = id
+    UiContainer.NameMenu.chocobo = false
+    script:request(Script.UI, "NameMenu", "show", 0)
+end
+
+--- Displays a window where a name can be assigned to a chocobo.
+name_chocobo = function()
+    -- TODO: Implement.
+end
+
+--- Automatically opens a menu.
+--
+-- @param menu The name of the menu.
+open_menu = function(menu)
+    if menu == "party" then
+        -- TODO
+    elseif menu == "save" then
+        -- TODO
+    end
+end
+
+--- Opens a shop.
+--
+-- @param id Shop ID.
+open_shop = function(id)
+    -- TODO: Implement
+end
+
 --- Utility to change fields and enter battles.
 System["MapChanger"] = {
     map_name = "",

+ 1 - 1
data/data/scripts/menu/begin_menu.lua

@@ -60,7 +60,7 @@ UiContainer.BeginMenu = {
                     script:request_end_sync( Script.UI, "BeginMenu", "hide", 0 )
                     entity_manager:get_entity("Cloud"):set_position(-0.820312, 0.500000, 17.281244)
                     entity_manager:set_player_entity("Cloud")
-                    FFVII.set_party(0, 1, nil)
+                    FFVII.set_party(0, 1, 4)
                     script:wait(0.5)
                     entity_manager:get_player_entity():set_position(-0.820312, 0.500000, 17.281244)
                     entity_manager:get_entity("Cloud"):jump_to_position(-0.800312, 0.500000, -1, 1) -- Triangle 42, 2 steps.

+ 4 - 4
data/data/scripts/menu/equip_menu.lua

@@ -41,7 +41,7 @@ UiContainer.EquipMenu = {
     list_position = 1,
 
     --- Maximum slots in the item list.
-    list_position_total = 8,
+    list_position_total = 10,
 
     --- highlighted position in the current item list.
     list_item_selected = 1,
@@ -206,7 +206,7 @@ UiContainer.EquipMenu = {
         ui_manager:get_widget("EquipMenu.Container.Stats.MDefArw"):set_visible(false)
         ui_manager:get_widget("EquipMenu.Container.Stats.MEvaArw"):set_visible(false)
         ui_manager:get_widget("EquipMenu.Container.List.Cursor"):set_visible(false)
-        for i = 1, 8 do
+        for i = 1, self.list_position_total do
             ui_manager:get_widget("EquipMenu.Container.List.Item" .. tostring(i)):set_text("")
         end
     end,
@@ -238,7 +238,7 @@ UiContainer.EquipMenu = {
         elseif self.selecting_slot == Inventory.ITEM_TYPE.ACCESSORY then
             list = self.avail_accessories
         else
-            for i = 1, 8 do
+            for i = 1, self.list_position_total do
                 ui_manager:get_widget("EquipMenu.Container.List.Item" .. tostring(i)):set_text("")
             end
             return false
@@ -247,7 +247,7 @@ UiContainer.EquipMenu = {
             -- No items for the list
             return false
         end
-        for i = 1, 8 do
+        for i = 1, self.list_position_total do
             if #(list) >= i + self.list_first_visible then
                 local name = Game.Items[list[i + self.list_first_visible]].name
                 ui_manager:get_widget("EquipMenu.Container.List.Item" .. tostring(i)):set_text(name)

+ 113 - 39
data/data/scripts/menu/item_menu.lua

@@ -9,14 +9,14 @@ UiContainer.ItemMenu = {
     --- Max cursor position in the top bar.
     bar_position_total = 3,
 
-    --- Current cursor position in the item list (1-10).
+    --- Current cursor position in the item list (1-13).
     --
     -- It doesn't represent the item id or the inventory position, but the highlighted row among
     -- the ten displayed.
     item_cursor_position = 1,
 
-    --- Max cursor position in the item list (1-10).
-    item_cursor_position_total = 10,
+    --- Max cursor position in the item list.
+    item_cursor_position_total = 13,
 
     --- Highlighted inventory position (1-320).
     item_cursor_item_selected = 1,
@@ -34,18 +34,27 @@ UiContainer.ItemMenu = {
     --
     -- It doesn't represent the item id or the inventory position, but the highlighted row among
     -- the ten displayed.
-    key_items_cursor_x_position = 0,
+    key_items_cursor_y_position = 1,
 
     --- Key items cursor horizontal position (0-1)
     --
     -- It doesn't represent the item id or the inventory position, but the highlighted row among
-    -- the ten displayed. 0 if the cursor is in the left column, 1 if it's on the right.
-    key_items_cursor_y_position = 0,
+    -- the ten displayed. 1 if the cursor is in the left column, 2 if it's on the right.
+    key_items_cursor_x_position = 1,
+
+    --- Max vertical cursor position in the key item list.
+    key_items_cursor_y_position_total = 13,
+
+    --- Total number of rows in the key items window.
+    --
+    -- Includes visible and scrolled/scrollable rows. Since there are 51 key items, there are
+    -- 26 rows.
+    key_items_total_rows = 26,
 
     --- First visible row of key items (0-16)
     --
     -- Changes as the key item list scrols vertically.
-    first_key_item_row_in_window = 0,
+    first_key_item_row_in_window = 1,
 
     --- Current cursor position in the order section (1-8).
     order_cursor_position = 1,
@@ -59,6 +68,9 @@ UiContainer.ItemMenu = {
     --- Indicates it the selected item affect the entire party.
     item_in_use_party = false,
 
+    -- Slots in the party inventory
+    inventory_size = 320,
+
     --- Run when the menu is creaded.
     --
     -- It does nothing.
@@ -154,7 +166,7 @@ UiContainer.ItemMenu = {
                 local cursor = ui_manager:get_widget("ItemMenu.Container.ItemList.Cursor")
                 local desc_label = ui_manager:get_widget("ItemMenu.Container.ItemMenuSecondBar.ItemText")
                 if button == "Down" then
-                    if self.item_cursor_item_selected >= 320 then
+                    if self.item_cursor_item_selected >= self.inventory_size then
                         -- At the very end, do nothing
                         return 0
                     end
@@ -170,7 +182,7 @@ UiContainer.ItemMenu = {
                     cursor:set_default_animation("Position" .. self.item_cursor_position)
                     -- If an item is selected, show description
                     if (Inventory[self.item_cursor_item_selected] ~= nil) then
-                        desc_label:set_text(Game.Items[Inventory[self.item_cursor_item_selected].item].description)
+                        desc_label:set_text(Game.Items[Inventory[self.item_cursor_item_selected + 1].item].description)
                     else
                         desc_label:set_text("")
                     end
@@ -191,10 +203,32 @@ UiContainer.ItemMenu = {
                     cursor:set_default_animation("Position" .. self.item_cursor_position)
                     -- If an item is selected, show description
                     if (Inventory[self.item_cursor_item_selected] ~= nil) then
-                        desc_label:set_text(Game.Items[Inventory[self.item_cursor_item_selected].item].description)
+                        desc_label:set_text(Game.Items[Inventory[self.item_cursor_item_selected + 1].item].description)
                     else
                         desc_label:set_text("")
                     end
+                elseif button == "PGDN" then -- TODO: Also, the bind to R1
+                    if self.first_item_in_window + self.item_cursor_position_total < self.inventory_size - self.item_cursor_position_total then
+                        self.item_cursor_item_selected = self.item_cursor_item_selected + self.item_cursor_position_total
+                        self.first_item_in_window = self.first_item_in_window + self.item_cursor_position_total
+                        self.populate_items(self)
+                        if (Inventory[self.item_cursor_item_selected] ~= nil) then
+                            desc_label:set_text(Game.Items[Inventory[self.item_cursor_item_selected + 1].item].description)
+                        else
+                            desc_label:set_text("")
+                        end
+                    end
+                elseif button == "PGUP" then -- TODO: Also, the bind to L1
+                    if self.first_item_in_window - self.item_cursor_position_total > 1 then
+                        self.item_cursor_item_selected = self.item_cursor_item_selected - self.item_cursor_position_total
+                        self.first_item_in_window = self.first_item_in_window - self.item_cursor_position_total
+                        self.populate_items(self)
+                        if (Inventory[self.item_cursor_item_selected] ~= nil) then
+                            desc_label:set_text(Game.Items[Inventory[self.item_cursor_item_selected + 1].item].description)
+                        else
+                            desc_label:set_text("")
+                        end
+                    end
                 elseif button == "Escape" and event == "Press" then
                     self.submenu_bar(self)
                     UiContainer.current_submenu = "bar_selection"
@@ -202,7 +236,7 @@ UiContainer.ItemMenu = {
                 elseif button == "Enter" then
                     if Game.Items[Inventory[self.item_cursor_item_selected].item].menu == 1 then
                         self.item_in_use = Inventory[self.item_cursor_item_selected].item
-                        if (Game.Items[Inventory[self.item_cursor_item_selected].item].target.default_multiple) == 1 then
+                        if (Game.Items[Inventory[self.item_cursor_item_selected - 1].item].target.default_multiple) == 1 then
                             self.item_in_use_party = true
                             self.submenu_chars(self, true)
                         else
@@ -249,11 +283,11 @@ UiContainer.ItemMenu = {
                 end
             elseif UiContainer.current_submenu == "key_item_selection" then
                 if button == "Down" then
-                    if self.key_items_cursor_y_position == 9 and self.first_key_item_row_in_window == 16 then
+                    if self.key_items_cursor_y_position == self.key_items_cursor_y_position_total and self.first_key_item_row_in_window == self.key_items_total_rows - self.key_items_cursor_y_position then
                         -- Last key item selected, do nothing
                         return 0
                     end
-                    if self.key_items_cursor_y_position == 9 then
+                    if self.key_items_cursor_y_position == self.key_items_cursor_y_position_total then
                         -- Scroll down by 1, don't move cursor
                         self.first_key_item_row_in_window = self.first_key_item_row_in_window + 1
                         self.populate_key_items(self)
@@ -263,18 +297,18 @@ UiContainer.ItemMenu = {
                     end
                     ui_manager:get_widget("ItemMenu.Container.KeyItems.Cursor"):set_default_animation("Position" .. self.key_items_cursor_y_position .. "-" .. self.key_items_cursor_x_position)
                     -- Show description of the selected item, if any.
-                    local k_selected_id = (self.first_key_item_row_in_window + self.key_items_cursor_y_position) * 2 + self.key_items_cursor_x_position
+                    local k_selected_id = 2 * (self.first_key_item_row_in_window + self.key_items_cursor_y_position - 2) + self.key_items_cursor_x_position - 1
                     if (Inventory.key[k_selected_id] == true) then
                         ui_manager:get_widget("ItemMenu.Container.ItemMenuSecondBar.ItemText"):set_text(Game.Key_Items[k_selected_id].description)
                     else
                         ui_manager:get_widget("ItemMenu.Container.ItemMenuSecondBar.ItemText"):set_text("")
                     end
                 elseif button == "Up" then
-                    if self.key_items_cursor_y_position == 0 and self.first_key_item_row_in_window == 0 then -- TODO: Don't hardcode.
+                    if self.key_items_cursor_y_position == 1 and self.first_key_item_row_in_window == 1 then
                         -- First item, do nothing.
                         return 0
                     end
-                    if self.key_items_cursor_y_position == 0 then
+                    if self.key_items_cursor_y_position == 1 then
                         -- Scroll down by 1, don't move cursor
                         self.first_key_item_row_in_window = self.first_key_item_row_in_window - 1
                         self.populate_key_items(self)
@@ -284,25 +318,26 @@ UiContainer.ItemMenu = {
                     end
                     ui_manager:get_widget("ItemMenu.Container.KeyItems.Cursor"):set_default_animation("Position" .. self.key_items_cursor_y_position .. "-" .. self.key_items_cursor_x_position)
                     -- Show description of the selected item, if any.
-                    local k_selected_id = (self.first_key_item_row_in_window + self.key_items_cursor_y_position) * 2 + self.key_items_cursor_x_position
+                    local k_selected_id = 2 * (self.first_key_item_row_in_window + self.key_items_cursor_y_position - 2) + self.key_items_cursor_x_position - 1
                     if (Inventory.key[k_selected_id] == true) then
                         ui_manager:get_widget("ItemMenu.Container.ItemMenuSecondBar.ItemText"):set_text(Game.Key_Items[k_selected_id].description)
                     else
                         ui_manager:get_widget("ItemMenu.Container.ItemMenuSecondBar.ItemText"):set_text("")
                     end
                 elseif button == "Right" then
-                    local next_selected_index = (self.first_key_item_row_in_window + self.key_items_cursor_y_position) * 2 + self.key_items_cursor_x_position + 1
-                    if next_selected_index >= 50 then
+                    local k_selected_id = 2 * (self.first_key_item_row_in_window + self.key_items_cursor_y_position - 2) + self.key_items_cursor_x_position - 1
+                    if k_selected_id >= 50 then
                         -- Already in last item, do nothing
                         return 0
                     end
-                    if self.key_items_cursor_x_position == 0 then
+                    k_selected_id = k_selected_id + 1
+                    if self.key_items_cursor_x_position == 1 then
                         -- If on the left, move to the right. No scrolling.
-                        self.key_items_cursor_x_position = 1
+                        self.key_items_cursor_x_position = 2
                     else
                         -- If on the right, move to left and one row down...
-                        self.key_items_cursor_x_position = 0
-                        if self.key_items_cursor_y_position == 9 then
+                        self.key_items_cursor_x_position = 1
+                        if self.key_items_cursor_y_position == self.key_items_cursor_y_position_total then
                             -- ... by scrolling down by 1, not moving cursor.
                             self.first_key_item_row_in_window = self.first_key_item_row_in_window + 1
                             self.populate_key_items(self)
@@ -313,25 +348,25 @@ UiContainer.ItemMenu = {
                     end
                     ui_manager:get_widget("ItemMenu.Container.KeyItems.Cursor"):set_default_animation("Position" .. self.key_items_cursor_y_position .. "-" .. self.key_items_cursor_x_position)
                     -- Show description of the selected item, if any.
-                    local k_selected_id = (self.first_key_item_row_in_window + self.key_items_cursor_y_position) * 2 + self.key_items_cursor_x_position
                     if (Inventory.key[k_selected_id] == true) then
                         ui_manager:get_widget("ItemMenu.Container.ItemMenuSecondBar.ItemText"):set_text(Game.Key_Items[k_selected_id].description)
                     else
                         ui_manager:get_widget("ItemMenu.Container.ItemMenuSecondBar.ItemText"):set_text("")
                     end
                 elseif button == "Left" then
-                    local next_selected_index = (self.first_key_item_row_in_window + self.key_items_cursor_y_position) * 2 + self.key_items_cursor_x_position - 1
-                    if next_selected_index < 0 then
+                    local k_selected_id = 2 * (self.first_key_item_row_in_window + self.key_items_cursor_y_position - 2) + self.key_items_cursor_x_position - 1
+                    if k_selected_id <= 0 then
                         -- Already in first item, do nothing
                         return 0
                     end
-                    if self.key_items_cursor_x_position == 1 then
+                    k_selected_id = k_selected_id - 1
+                    if self.key_items_cursor_x_position == 2 then
                         -- If on the right, move to the left. No scrolling.
-                        self.key_items_cursor_x_position = 0
+                        self.key_items_cursor_x_position = 1
                     else
                         -- If on the left, move to right and one row up...
-                        self.key_items_cursor_x_position = 1
-                        if self.key_items_cursor_y_position == 0 then
+                        self.key_items_cursor_x_position = 2
+                        if self.key_items_cursor_y_position == 1 then
                             -- ... by scrolling up by 1, not moving cursor.
                             self.first_key_item_row_in_window = self.first_key_item_row_in_window - 1
                             self.populate_key_items(self)
@@ -342,12 +377,37 @@ UiContainer.ItemMenu = {
                     end
                     ui_manager:get_widget("ItemMenu.Container.KeyItems.Cursor"):set_default_animation("Position" .. self.key_items_cursor_y_position .. "-" .. self.key_items_cursor_x_position)
                     -- Show description of the selected item, if any.
-                    local k_selected_id = (self.first_key_item_row_in_window + self.key_items_cursor_y_position) * 2 + self.key_items_cursor_x_position
                     if (Inventory.key[k_selected_id] == true) then
                         ui_manager:get_widget("ItemMenu.Container.ItemMenuSecondBar.ItemText"):set_text(Game.Key_Items[k_selected_id].description)
                     else
                         ui_manager:get_widget("ItemMenu.Container.ItemMenuSecondBar.ItemText"):set_text("")
                     end
+                elseif button == "PGDN" then -- TODO: Also, the bind to R1
+                    if self.first_key_item_row_in_window + self.key_items_cursor_y_position_total < self.key_items_total_rows - self.key_items_cursor_y_position_total then
+                        self.first_key_item_row_in_window = self.first_key_item_row_in_window + self.key_items_cursor_y_position_total
+                        self.populate_items(self)
+                        -- Show description of the selected item, if any.
+                        local k_selected_id = 2 * (self.first_key_item_row_in_window + self.key_items_cursor_y_position - 2) + self.key_items_cursor_x_position - 1
+                        if (Inventory.key[k_selected_id] == true) then
+                            ui_manager:get_widget("ItemMenu.Container.ItemMenuSecondBar.ItemText"):set_text(Game.Key_Items[k_selected_id].description)
+                        else
+                            ui_manager:get_widget("ItemMenu.Container.ItemMenuSecondBar.ItemText"):set_text("")
+                        end
+                    end
+                elseif button == "PGUP" then -- TODO: Also, the bind to L1
+                    if self.first_key_item_row_in_window + self.key_items_cursor_y_position_total > 1 then
+                        self.first_key_item_row_in_window = self.first_key_item_row_in_window - self.key_items_cursor_y_position_total
+                        self.populate_items(self)
+                        -- Show description of the selected item, if any.
+                        local k_selected_id = 2 * (self.first_key_item_row_in_window + self.key_items_cursor_y_position - 2) + self.key_items_cursor_x_position - 1
+                        if (Inventory.key[k_selected_id] == true) then
+                            ui_manager:get_widget("ItemMenu.Container.ItemMenuSecondBar.ItemText"):set_text(Game.Key_Items[k_selected_id].description)
+                        else
+                            ui_manager:get_widget("ItemMenu.Container.ItemMenuSecondBar.ItemText"):set_text("")
+                        end
+                    end
+                elseif button == "Escape" then
+                    self.submenu_bar(self)
                 end
 
             end
@@ -461,7 +521,7 @@ UiContainer.ItemMenu = {
         ui_manager:get_widget("ItemMenu.Container.KeyItems.Cursor"):set_visible(true)
         ui_manager:get_widget("ItemMenu.Container.KeyItems.Cursor"):set_default_animation("Position" .. self.key_items_cursor_y_position .. "-" .. self.key_items_cursor_x_position)
         -- Show description of the selected item, if any.
-        local k_selected_id = (self.first_key_item_row_in_window + self.key_items_cursor_y_position) * 2 + self.key_items_cursor_x_position
+        local k_selected_id = 2 * (self.first_key_item_row_in_window + self.key_items_cursor_y_position - 2) + self.key_items_cursor_x_position - 1
         if (Inventory.key[k_selected_id] == true) then
             ui_manager:get_widget("ItemMenu.Container.ItemMenuSecondBar.ItemText"):set_text(Game.Key_Items[k_selected_id].description)
         else
@@ -858,10 +918,10 @@ UiContainer.ItemMenu = {
 
     --- Populates the visible inventory entries.
     --
-    -- 10 entries visible at a time.
+    -- 13 entries visible at a time.
     populate_items = function(self)
         local first_item_in_window = self.first_item_in_window
-        for i = 0, 9 do
+        for i = 1, self.item_cursor_position_total do
             local w_icon = ui_manager:get_widget("ItemMenu.Container.ItemList.Icon" .. tostring(i))
             local w_name = ui_manager:get_widget("ItemMenu.Container.ItemList.Name" .. tostring(i))
             local w_colon = ui_manager:get_widget("ItemMenu.Container.ItemList.Colon" .. tostring(i))
@@ -913,18 +973,25 @@ UiContainer.ItemMenu = {
                 w_colon:set_text(":") -- Refresh text to apply colour.
             end
         end
+        -- Set scroll bar position
+        local scroll = ui_manager:get_widget("ItemMenu.Container.ItemList.Scroll")
+        -- first_item_in_window == 1 then Top -> 0%3
+        -- first_item_in_window == inventory_size - first_item_in_window then top = 100%-21
+        local percent = math.floor(self.first_item_in_window * 100 / (self.inventory_size - self.item_cursor_position_total))
+        local fixed = -1 * math.floor(self.first_item_in_window * 17 / (self.inventory_size - self.item_cursor_position_total)) + 3
+        scroll:set_y(percent, fixed)
         return
     end,
 
     --- Populates the visible key items entries.
     --
-    -- 20 entries visible at a time (10 rows).
+    -- 26 entries visible at a time (13 rows).
     populate_key_items = function(self)
         local first_key_item_row_in_window = self.first_key_item_row_in_window
-        for i = 0, 9 do
-            local label_left = ui_manager:get_widget("ItemMenu.Container.KeyItems.KeyItem" .. tostring(i) .. "-0")
-            local label_right = ui_manager:get_widget("ItemMenu.Container.KeyItems.KeyItem" .. tostring(i) .. "-1")
-            local left_item_index = (first_key_item_row_in_window + i) * 2
+        for i = 1, self.key_items_cursor_y_position_total do
+            local label_left = ui_manager:get_widget("ItemMenu.Container.KeyItems.KeyItem" .. tostring(i) .. "-1")
+            local label_right = ui_manager:get_widget("ItemMenu.Container.KeyItems.KeyItem" .. tostring(i) .. "-2")
+            local left_item_index = (first_key_item_row_in_window + i - 2) * 2
             local right_item_index = left_item_index + 1
             if Inventory.has_key_item(left_item_index) == true then -- Left column
                 label_left:set_text(Game.Key_Items[left_item_index].name)
@@ -937,6 +1004,13 @@ UiContainer.ItemMenu = {
                 label_right:set_text("")
             end
         end
+        -- Set scroll bar position
+        local scroll = ui_manager:get_widget("ItemMenu.Container.KeyItems.Scroll")
+        -- first_key_item_row_in_window == 1 then Top -> 0%3
+        -- first_key_item_row_in_window == key_items_total_rows - first_key_item_row_in_window = 100%-21
+        local percent = math.ceil((self.first_key_item_row_in_window - 1) * 100 / (self.key_items_total_rows - self.key_items_cursor_y_position_total))
+        local fixed = -1 * math.floor((self.first_key_item_row_in_window - 1) * 13 / (self.key_items_total_rows - self.key_items_cursor_y_position_total)) + 3
+        scroll:set_y(percent, fixed)
         return
     end,
 

+ 2 - 1
data/data/scripts/menu/main_menu.lua

@@ -7,7 +7,7 @@ UiContainer.MainMenu = {
     position = 1,
 
     -- Max cursor position in the main menu.
-    position_total = 10,
+    position_total = 11,
 
     --- When selecting a character, the menu in this position will be opened.
     --
@@ -134,6 +134,7 @@ UiContainer.MainMenu = {
         for c = 1, 3 do
             if FFVII.Party[c] ~= nil then
                 UiContainer.populate_character_data("MainMenu.Container.Characters.Character" .. tostring(c), Characters[FFVII.Party[c]])
+                ui_manager:get_widget("MainMenu.Container.Characters.Character" .. tostring(c) .. ".Portrait"):set_image("images/characters/" .. tostring(FFVII.Party[c]) .. ".png")
                 if Characters[FFVII.Party[c]].back_row == 1 then
                     ui_manager:get_widget("MainMenu.Container.Characters.Character" .. tostring(c) .. ".Portrait"):set_default_animation("RowBack")
                 else

+ 144 - 0
data/data/scripts/menu/name_menu.lua

@@ -0,0 +1,144 @@
+if UiContainer == nil then UiContainer = {} end
+
+--- The name menu.
+UiContainer.NameMenu = {
+
+    --- Indicates if a chocobo is being renamed instead of a character.
+    chocobo = false,
+
+    --- ID of the character or chocobo being renamed.
+    id = -1,
+
+    --- Default name.
+    default_name = "",
+
+    --- Currently input-ed name
+    name = "",
+
+    --- Max number of characters allowed in a name.
+    max_characters = 12,
+
+    --- Current text cursor
+    text_cursor = 1,
+
+    letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ",
+
+    --- Run when the menu is creaded.
+    --
+    -- It does nothing.
+    on_start = function(self)
+        return 0
+    end,
+
+    --- Handles button events.
+    --
+    -- For the current submenu, handles directional keys, enter and escape events.
+    -- @param button Pressed button string key. "Up", "Left", "Enter" and "Escape" are handled.
+    -- @param event Trigger event. Normally, "Press".
+    on_button = function(self, button, event)
+        if UiContainer.current_menu == "name" then
+            print("BUTTON " .. button .. " on " .. UiContainer.current_menu .. "." .. UiContainer.current_submenu)
+
+            if UiContainer.current_submenu == "confirm" then
+            elseif UiContainer.current_submenu == "" then
+                local character_index = string.find(self.letters, button)
+                if button == "Up" and event == "Press" then
+                elseif button == "Down" then
+                elseif button == "Left" then
+                    if self.text_cursor > 1 then
+                        self.text_cursor = self.text_cursor - 1
+                        self.draw_cursor(self)
+                    end
+                elseif button == "Right" then
+                    if self.text_cursor < self.max_characters then
+                        self.text_cursor = self.text_cursor + 1
+                        self.draw_cursor(self)
+                    end
+                elseif button == "Enter" then
+                -- TODO: Else Letters
+                elseif character_index ~= nil then
+                    print(" LETTER " .. character_index)
+                    self.set_char(self, character_index)
+                    self.text_cursor = math.min(self.text_cursor + 1, self.max_characters)
+                    self.populate_name(self)
+                    self.draw_cursor(self)
+                end
+            end
+        end
+        return 0
+    end,
+
+    --- Opens the main menu.
+    --
+    -- Populates and updates displayed data before opening.
+    show = function(self)
+        entity_manager:set_paused(true)
+        FFVII.MenuSettings.pause_available = false
+        ui_manager:get_widget("NameMenu"):set_visible(true)
+        UiContainer.current_menu = "name"
+        UiContainer.current_submenu = ""
+        ui_manager:get_widget("NameMenu.Container.Character.Portrait"):set_image("images/characters/" .. tostring(self.id) .. ".png")
+        self.default_name = Characters[self.id].name
+        self.name = Characters[self.id].name
+        self.text_cursor = math.min(#(self.name) + 1, self.max_characters)
+        self.populate_name(self)
+        self.draw_cursor(self)
+        return 0;
+    end,
+
+    draw_cursor = function(self)
+        -- TODO: Do this with animations.
+        for i = 1, self.max_characters do
+            if self.text_cursor == i then
+                print("")
+                ui_manager:get_widget("NameMenu.Container.Character.Name.Score" .. tostring(i)):set_height(1.8)
+                --ui_manager:get_widget("NameMenu.Container.Character.Name.Score" .. tostring(i)):set_default_animation("Active")
+            else
+                ui_manager:get_widget("NameMenu.Container.Character.Name.Score" .. tostring(i)):set_height(0.3)
+                --ui_manager:get_widget("NameMenu.Container.Character.Name.Score" .. tostring(i)):set_default_animation("Inactive")
+            end
+        end
+    end,
+
+    populate_name = function(self)
+        for i = 1, self.max_characters do
+            if #(self.name) < i then
+                ui_manager:get_widget("NameMenu.Container.Character.Name.Char" .. tostring(i)):set_text("")
+            else
+                ui_manager:get_widget("NameMenu.Container.Character.Name.Char" .. tostring(i)):set_text(self.name:sub(i, i))
+
+            end
+        end
+    end,
+
+    --- Sets a character in the current cursor position
+    set_char = function(self, character_index)
+        local temp_name = ""
+        for i = 1, self.max_characters do
+            if i == self.text_cursor then
+                -- TODO: First position or after space: Use upper case table
+                if self.text_cursor == 1 or self.name:sub(i - 1, i - 1) == " " then
+                    temp_name = temp_name .. self.letters:sub(character_index, character_index)
+                else
+                    temp_name = temp_name .. string.lower(self.letters:sub(character_index, character_index))
+                end
+                print("NEW: " .. self.letters:sub(character_index, character_index))
+            elseif #(self.name) >= i then
+                -- TODO: First position or after space: to upper, else to lower
+                temp_name = temp_name .. self.name:sub(i, i)
+                print("OLD: " .. self.name:sub(i, i))
+            end
+        end
+        self.name = temp_name
+    end,
+
+    --- Hides the item menu and goes back to the main menu.
+    hide = function(self)
+        ui_manager:get_widget("NameMenu"):set_visible(false)
+        UiContainer.current_menu = ""
+        UiContainer.current_submenu = ""
+        FFVII.MenuSettings.pause_available = true
+        entity_manager:set_paused(false)
+        return 0;
+    end,
+}

+ 39 - 1
data/data/scripts/system.lua

@@ -626,7 +626,45 @@ Characters.equip = function(char_id, item_id)
     return true
 end
 
+--- Removes all materia from a character.
+--
+-- @param id ID of the character to remove materia from.
+Characters.remove_materia = function(id)
+    -- TODO: Implement
+end
+
+--- Restores all materia to a character.
+--
+-- @param id ID of the character to restore materia to.
+Characters.restore_materia = function(id)
+    -- TODO: Implement
+end
+
+
 Materia.add = function(id, ap)
     ap = ap or 0
-    -- TODO
+    -- TODO Implement.
+end
+
+--- Splits the party in teams.
+--
+-- @param number Number of teams (only 2 or 3).
+Party.split_teams = function(number)
+    if number < 2 then
+        number = 2
+    elseif number > 3 then
+        number = 3
+    end
+    -- TODO: Implement.
+end
+
+--- Displays a menu to choose a party of three.
+Party.choose_party = function()
+    -- TODO: Implement
+end
+
+--- Special event. Removes all materia from the party, equipped and unequipped.
+Party.steal_materia = function()
+    -- TODO: Implement.
+    -- TODO: How is this reversed?
 end