示例#1
0
        public void ShowLocation(int region, int location)
        {
            // Get location
            dfLocation = mapsFile.GetLocation(region, location);
            if (string.IsNullOrEmpty(dfLocation.Name))
            {
                return;
            }

            // Create exterior map
            CreateExteriorMap();

            // Conditionally create dungeon map
            if (dfLocation.HasDungeon)
            {
                CreateDungeonMap();
            }
            else
            {
                dungeonLayoutBitmap = null;
            }

            // Configure modes for new location
            ConfigureModes();

            // Clear block mouse over and selection
            selectedExteriorBlock = -1;
            selectedDungeonBlock  = -1;
            mouseOverBlock        = -1;
            RaiseMouseOverBlockChangedEvent();

            // Redraw
            this.Invalidate();
        }
示例#2
0
        /// <summary>
        /// Attempts to get a Daggerfall location from MAPS.BSA.
        /// </summary>
        /// <param name="regionIndex">Index of region.</param>
        /// <param name="locationIndex">Index of location.</param>
        /// <param name="locationOut">DFLocation data out.</param>
        /// <returns>True if successful.</returns>
        public bool GetLocation(int regionIndex, int locationIndex, out DFLocation locationOut)
        {
            locationOut = new DFLocation();

            if (!isReady)
            {
                return(false);
            }

            // Get location data
            locationOut = mapFileReader.GetLocation(regionIndex, locationIndex);
            if (!locationOut.Loaded)
            {
                DaggerfallUnity.LogMessage(string.Format("Unknown location RegionIndex='{0}', LocationIndex='{1}'.", regionIndex, locationIndex), true);
                return(false);
            }

            return(true);
        }
示例#3
0
        static void Main(string[] args)
        {
            // Specify Arena2 path of local Daggerfall installation
            string MyArena2Path = "C:\\dosgames\\DAGGER\\ARENA2";

            // Path to BSA file
            string FilePath = Path.Combine(MyArena2Path, "MAPS.BSA");

            // Open file
            MapsFile mapsFile = new MapsFile(
                FilePath,
                FileUsage.UseDisk,
                true);

            // Loop through regions
            for (int r = 0; r < mapsFile.RegionCount; r++)
            {
                // Get the region object
                DFRegion region = mapsFile.GetRegion(r);

                // Loop through locations to look for largest dungeon
                int        maxDungeonBlocks   = -1;
                DFLocation maxDungeonLocation = new DFLocation();
                for (int l = 0; l < region.LocationCount; l++)
                {
                    // Get the location object
                    DFLocation location = mapsFile.GetLocation(r, l);

                    // Continue if location does not have a dungeon
                    if (!location.HasDungeon)
                    {
                        continue;
                    }

                    // Find dungeon with most number of blocks
                    if (location.Dungeon.Blocks.Length > maxDungeonBlocks)
                    {
                        maxDungeonBlocks   = location.Dungeon.Blocks.Length;
                        maxDungeonLocation = location;
                    }
                }

                // Output information if dungeon found
                if (maxDungeonBlocks != -1)
                {
                    Console.WriteLine("{0}, {1}, {2}",
                                      region.Name,
                                      maxDungeonLocation.Name,
                                      maxDungeonLocation.Dungeon.Blocks.Length);
                }
            }
        }
        /// <summary>
        /// Loads a Daggerfall location.
        /// </summary>
        /// <param name="regionName">Region name.</param>
        /// <param name="locationName">Location name.</param>
        /// <param name="location">DFLocation.</param>
        /// <returns>True if successful.</returns>
        private bool LoadDaggerfallLocation(
            string regionName,
            string locationName,
            out DFLocation location)
        {
            try
            {
                // Get location
                location = mapsFile.GetLocation(regionName, locationName);
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                location = new DFLocation();
                return(false);
            }

            return(true);
        }