Ejemplo n.º 1
0
        /////// <summary>
        /////// Saves the current uw2 save file.
        /////// </summary>
        /////// <param name="sender"></param>
        /////// <param name="e"></param>
        ////private void writePlayerDatToolStripMenuItem1_Click(object sender, EventArgs e)
        ////{
        ////    char[] buffer = PlayerDatUI.GetValuesFromPDatGrid(this);
        ////    buffer = playerdat.EncryptDecryptUW2(buffer, (byte)buffer[0]);
        ////    Util.WriteStreamFile(main.basepath + "\\save" + curslot + "\\PLAYER.DAT", buffer);
        ////}

        /// <summary>
        /// Loads a lev.ark file from the game data or a save file
        /// </summary>
        /// <param name="option"></param>
        private void LoadUWLevArk(int option)
        {
            main.PopulateItemIDList(CmbWorldItem_ID);
            string filename = "\\save" + option + "\\lev.ark";

            switch (option)
            {
            case 0:
                filename = "\\data\\lev.ark";
                break;
            }

            if (UWGameStrings == null)
            {
                UWGameStrings = new UWStrings();
                UWGameStrings.LoadStringsPak(main.basepath + "\\data\\strings.pak", 1, GrdStrings);
            }
            if (Util.ReadStreamFile(main.basepath + filename, out levarkbuffer))
            {
                curlevarkfile = main.basepath + filename;
                int NoOfBlocks = (int)Util.getValAtAddress(levarkbuffer, 0, 16);
                uwblocks = new Util.UWBlock[NoOfBlocks];
                TreeUWBlocks.Nodes.Clear();
                TreeNode TileMapNodes      = TreeUWBlocks.Nodes.Add("Tilemaps");
                TreeNode OverlayMapNodes   = TreeUWBlocks.Nodes.Add("Overlays");
                TreeNode TextureMapNodes   = TreeUWBlocks.Nodes.Add("TextureMaps");
                TreeNode AutoMapNodes      = TreeUWBlocks.Nodes.Add("AutoMaps");
                TreeNode AutoMapNotesNodes = TreeUWBlocks.Nodes.Add("AutoMapNotes");//These are variable sizes
                for (int i = 0; i <= uwblocks.GetUpperBound(0); i++)
                {
                    if (Util.LoadUWBlock(levarkbuffer, i, Util.UWBlockSizes(i), out uwblocks[i]))
                    {
                        uwblocks[i].ContentType = Util.GetUWLevArkContentType(i);
                        TreeNode node;
                        switch (uwblocks[i].ContentType)
                        {
                        case Util.ContentTypes.AnimationOverlay:
                            node = OverlayMapNodes.Nodes.Add("Block #" + i); break;

                        case Util.ContentTypes.AutoMap:
                            node = AutoMapNodes.Nodes.Add("Block #" + i); break;

                        case Util.ContentTypes.AutoMapNotes:
                            node = AutoMapNotesNodes.Nodes.Add("Block #" + i); break;

                        case Util.ContentTypes.TextureMap:
                            node = TextureMapNodes.Nodes.Add("Block #" + i); break;

                        case Util.ContentTypes.TileMap:
                        default:
                            node = TileMapNodes.Nodes.Add("Block #" + i); break;
                        }
                        node.Tag = i;
                    }
                }
            }//end readstreamfile
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Loads the current games strings file.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void stringsToolStripMenuItem_Click(object sender, EventArgs e)
 {
     UWGameStrings = new UWStrings();
     UWGameStrings.LoadStringsPak(main.basepath + "\\data\\strings.pak", curgame, GrdStrings);
 }