Exemplo n.º 1
0
 public void AddMap(int number, Map map)
 {
     Bank.Add(number, map);
 }
 private void WriteMapData(Map map)
 {
     PGMEBackend.Program.isEdited = true;
     map.WriteMapHeaderToRaw();
     hexViewerRawMapHeader.ByteProvider = new DynamicByteProvider(map.rawHeader, true, false, false);
 }
 public void LoadNPCView(Map map, int npcNum)
 {
     if (map != null && map.NPCs != null && map.NPCs.Count > npcNum)
         LoadNPCView(map.NPCs[npcNum]);
     else
         NoEntitiesOfType();
 }
        private void LoadHeaderTabMapHeader(Map map)
        {
            hexViewerRawMapHeader.ByteProvider = new DynamicByteProvider(map.rawHeader, true, false, false);
            hexNumberBoxHeaderTabLayoutHeaderPointer.Text = (map.mapDataPointer + 0x8000000).ToString("X8");
            hexNumberBoxHeaderTabEventDataPointer.Text = (map.eventDataPointer + 0x8000000).ToString("X8");
            hexNumberBoxHeaderTabLevelScriptPointer.Text = (map.mapScriptDataPointer + 0x8000000).ToString("X8");
            hexNumberBoxHeaderTabConnectionDataPointer.Text = (map.connectionsDataPointer + 0x8000000).ToString("X8");

            hexNumberBoxHeaderTabMapNames.Text = ((byte)map.mapNameIndex).ToString("X2");
            cbHeaderTabShowsName.Checked = map.showsName;
            cbHeaderTabCanRun.Checked = map.canRun;
            cbHeaderTabCanRideBike.Checked = map.canRideBike;
            cbHeaderTabCanEscape.Checked = map.canEscape;

            hexNumberBoxHeaderTabLayoutIndex.Text = ((short)map.mapLayoutIndex).ToString("X4");

            hexNumberBoxHeaderTabMusic.Text = ((short)map.musicNumber).ToString("X4");

            cbHeaderTabVisibility.SelectedIndex = ((cbHeaderTabVisibility.Items.Count > map.visibility) ? map.visibility : 0);
            hexNumberBoxHeaderTabVisibility.Text = map.visibility.ToString("X2");
            cbHeaderTabWeather.SelectedIndex = ((cbHeaderTabWeather.Items.Count > map.weather) ? map.weather : 0);
            hexNumberBoxHeaderTabWeather.Text = map.weather.ToString("X2");
            cbHeaderTabMapType.SelectedIndex = ((cbHeaderTabMapType.Items.Count > map.mapType) ? map.mapType : 0);
            hexNumberBoxHeaderTabMapType.Text = map.mapType.ToString("X2");
            cbHeaderTabBattleBackground.SelectedIndex = ((cbHeaderTabBattleBackground.Items.Count > map.battleBackground) ? map.battleBackground : 0);
            hexNumberBoxHeaderTabBattleBackground.Text = map.battleBackground.ToString("X2");
        }
 public void LoadTriggerView(Map map, int triggerNum)
 {
     if (map != null && map.Triggers != null && map.Triggers.Count > triggerNum)
         LoadTriggerView(map.Triggers[triggerNum]);
     else
         NoEntitiesOfType();
 }
 public void LoadSignView(Map map, int signNum)
 {
     if (map != null && map.Signs != null && map.Signs.Count > signNum)
         LoadSignView(map.Signs[signNum]);
     else
         NoEntitiesOfType();
 }
 public void LoadWarpView(Map map, int warpNum)
 {
     if (map != null && map.Warps != null && map.Warps.Count > warpNum)
         LoadWarpView(map.Warps[warpNum]);
     else
         NoEntitiesOfType();
 }
        public static int LoadMap(object map)
        {
            if (isEdited)
            {
                string result = UnsavedChangesDialog();
                if (result == "Yes")
                    SaveMap();
                else if (result == "No")
                {
                    if(currentMap != null)
                        currentMap.Revert();
                    currentLayout.Revert();
                }
                else if (result == "Cancel")
                    return 1;
                isEdited = false;
            }

            Stopwatch loadTime = new Stopwatch();
            UndoManager.Clear();
            loadTime.Start();

            mainGUI.EnableControlsOnMapLoad();
            if (currentLayout != null)
            {
                currentLayout.Unload();
            }

            if (map is Map)
            {
                currentMap = (Map)map;
                currentLayout = ((Map)map).layout;
            }
            else if (map is MapLayout)
            {
                currentMap = null;
                currentLayout = (MapLayout)map;
            }

            mainGUI.LoadMap(map);

            //Stop timer
            loadTime.Stop();

            TimeSpan ts = loadTime.Elapsed;
            string elapsedTime = ts.Seconds + "." + (ts.Milliseconds / 10);

            mainGUI.SetTitleText(programTitle + " | " + currentFileName + " | " + ((currentMap != null) ? currentMap.name : currentLayout.name));
            mainGUI.SetLoadingStatus(string.Format(rmInternalStrings.GetString("MapLoadedStatus"), (currentMap != null) ? currentMap.name : currentLayout.name, elapsedTime));
            return 0;
        }