Example #1
0
 private void textBoxSpellName_TextChanged(object sender, EventArgs e)
 {
     char[] raw = new char[15];
     char[] temp;
     if (spellNum.Value < 64)
     {
         temp = Do.ASCIIToRaw(this.textBoxSpellName.Text, Lists.KeystrokesMenu, 14);
     }
     else
     {
         temp = Do.ASCIIToRaw(this.textBoxSpellName.Text, Lists.Keystrokes, 14);
     }
     for (int i = 0; i < 14; i++)
     {
         raw[i + 1] = temp[i];
     }
     raw[0] = (char)(spellNameIcon.SelectedIndex + 32);
     if (Model.SpellNames.GetUnsortedName(index).CompareTo(this.textBoxSpellName.Text) != 0)
     {
         spell.Name = raw;
         Model.SpellNames.SetName(
             index, new string(spell.Name));
         Model.SpellNames.SortAlphabetically();
         this.spellName.Items.Clear();
         this.spellName.Items.AddRange(Model.SpellNames.Names);
         this.spellName.SelectedIndex = Model.SpellNames.GetSortedIndex(index);
     }
 }
Example #2
0
 // Name
 private void nameText_TextChanged(object sender, EventArgs e)
 {
     if (this.Updating)
     {
         return;
     }
     char[] raw  = new char[15];
     char[] temp = Do.ASCIIToRaw(this.nameText.Text, Lists.KeystrokesMenu, 14);
     for (int i = 0; i < 14; i++)
     {
         raw[i + 1] = temp[i];
     }
     raw[0] = (char)(nameIcon.SelectedIndex + 32);
     if (Item.Name != raw)
     {
         Item.Name = raw;
         Model.Names.SetName(
             Item.Index,
             new string(Item.Name));
         Model.Names.SortAlphabetically();
         this.name.Items.Clear();
         this.name.Items.AddRange(Model.Names.Names);
         this.name.SelectedIndex = Model.Names.GetSortedIndex(Item.Index);
     }
 }
Example #3
0
 private void nameText_TextChanged(object sender, EventArgs e)
 {
     if (Model.Names.GetUnsortedName(Monster.Index).CompareTo(this.nameText.Text) != 0)
     {
         Monster.Name = Do.ASCIIToRaw(this.nameText.Text, Lists.KeystrokesMenu, 13);
         Model.Names.SetName(
             Monster.Index,
             new string(Monster.Name));
         Model.Names.SortAlphabetically();
         this.name.Items.Clear();
         this.name.Items.AddRange(Model.Names.Names);
         this.name.SelectedIndex = Model.Names.GetSortedIndex(Monster.Index);
     }
 }
Example #4
0
 private void textBoxCharacterName_TextChanged(object sender, EventArgs e)
 {
     if (this.Updating)
     {
         return;
     }
     character.Name = Do.ASCIIToRaw(textBoxCharacterName.Text, Lists.KeystrokesMenu, 10);
     this.Updating  = true;
     this.characterName.Items.Clear();
     for (int i = 0; i < characters.Length; i++)
     {
         this.characterName.Items.Add(new string(characters[i].Name));
     }
     this.characterName.SelectedIndex = index;
     this.Updating = false;
 }
Example #5
0
 // Name
 private void allyNameText_TextChanged(object sender, EventArgs e)
 {
     if (this.Updating)
     {
         return;
     }
     ally.Name     = Do.ASCIIToRaw(allyNameText.Text, Lists.KeystrokesMenu, 10);
     this.Updating = true;
     this.allyName.Items.Clear();
     for (int i = 0; i < allies.Length; i++)
     {
         this.allyName.Items.Add(new string(allies[i].Name));
     }
     this.allyName.SelectedIndex = Index;
     this.Updating = false;
 }
Example #6
0
 private void nameText_TextChanged(object sender, EventArgs e)
 {
     if (Model.Names.GetUnsortedName(index).CompareTo(this.nameText.Text) != 0)
     {
         attacks[index].Name = Do.ASCIIToRaw(this.nameText.Text, Lists.Keystrokes, 13);
         Model.Names.SetName(
             index, new string(attacks[index].Name));
         Model.Names.SortAlphabetically();
         //
         this.Updating = true;
         //
         this.name.Items.Clear();
         this.name.Items.AddRange(Model.Names.Names);
         this.name.SelectedIndex = Model.Names.GetSortedIndex(index);
         //
         this.Updating = false;
     }
 }
Example #7
0
 private void textBoxItemName_TextChanged(object sender, EventArgs e)
 {
     char[] raw  = new char[15];
     char[] temp = Do.ASCIIToRaw(this.textBoxItemName.Text, Lists.KeystrokesMenu, 14);
     for (int i = 0; i < 14; i++)
     {
         raw[i + 1] = temp[i];
     }
     raw[0] = (char)(itemNameIcon.SelectedIndex + 32);
     if (item.Name != raw)
     {
         item.Name = raw;
         Model.ItemNames.SetName(
             item.Index,
             new string(item.Name));
         Model.ItemNames.SortAlphabetically();
         this.itemName.Items.Clear();
         this.itemName.Items.AddRange(Model.ItemNames.Names);
         this.itemName.SelectedIndex = Model.ItemNames.GetSortedIndex(item.Index);
         shopsEditor.ResortStrings();
     }
 }
Example #8
0
        private void textBoxLocation_TextChanged(object sender, EventArgs e)
        {
            if (this.Updating)
            {
                return;
            }
            location.Name     = Do.ASCIIToRaw(textBoxLocation.Text, Lists.Keystrokes, textBoxLocation.Text.Length);
            this.Updating     = true;
            locationName.Text = textBoxLocation.Text;
            locationName.Invalidate();
            this.Updating = false;
            // check total length
            char[][] pointNames = new char[56][];
            char[]   tempB;
            int[]    duplicates = new int[56];  // the point it is a duplicate of
            int[]    levels     = new int[56];  // the location within the point it is a duplicate of
            bool[]   isdup      = new bool[56]; // if is a duplicate of something
            // set duplicates
            for (int i = 0; i < locations.Length; i++)
            {
                pointNames[i] = locations[i].Name;   // the name we'll be comparing everything to
                if (!isdup[i])
                {
                    for (int a = 0; a < locations.Length; a++)
                    {
                        if (a != i && !isdup[a])       // last condition checks if it already has duplicate
                        {
                            tempB = locations[a].Name; // the name that might be a duplicate of tempA
                            for (int b = 0; b < pointNames[i].Length; b++)
                            {
                                if (tempB.Length == pointNames[i].Length - b)
                                {
                                    if (Bits.Compare(pointNames[i], tempB, b, 0)) // if tempB is a duplicate of tempA at location b of tempA
                                    {
                                        levels[a]     = b;
                                        duplicates[a] = i;
                                        isdup[a]      = true;
                                        break;
                                    }
                                }
                                else if (tempB.Length > pointNames[i].Length - b)
                                {
                                    break;
                                }
                            }
                        }
                    }
                }
            }
            // assemble
            ushort[] pointers = new ushort[56];
            int      dOffset  = 0x3EFD80;
            ushort   pointer  = 0;

            // set all of the ones that aren't duplicates first (so we'll have pointers to use)
            for (int i = 0; i < locations.Length; i++)
            {
                if (!isdup[i])
                {
                    pointers[i] = pointer;
                    dOffset    += pointNames[i].Length;
                    pointer    += (ushort)pointNames[i].Length;
                    dOffset++; pointer++;
                    if (i != locations.Length - 1 && !isdup[i + 1] && dOffset > 0x3EFF1F)
                    {
                        break;
                    }
                }
            }
            dOffset--;
            nameFreeSpace.Text      = (0x3EFF1F - dOffset).ToString() + " characters left";
            nameFreeSpace.BackColor = dOffset > 0x3EFF1F ? Color.Red : SystemColors.Control;
            //
            SetWorldMapTextImage();
        }