예제 #1
0
파일: Level.cs 프로젝트: snarfblam/editroid
        /// <summary>
        /// Loads all currentLevelIndex-specific data for a specific currentLevelIndex in a given ROM image
        /// </summary>
        /// <param name="rom">The Rom object to load data from</param>
        /// <param name="currentLevelIndex">The currentLevelIndex to load</param>
        public Level(MetroidRom rom, LevelIndex level)
        {
            this.rom   = rom;
            data       = rom.data;
            this.index = level;

            Format    = rom.Format.CreateLevelFormat(this);
            this.Bank = rom.Format.Banks[Format.LevelBankIndex];

            Bytes = new ByteIndexer(this);
            PCpu  = new PointerIndexer(this);
            PRom  = new PRomIndexer(this);

            pointers_deprecated = new LevelPointers(rom, this);

            structures = new StructureCollection(this);
            screens    = new ScreenCollection(this);

            patternGroups = new PatternGroupIndexTable(this);
            LoadPatterns();
            LoadPalette();

            combos  = new ComboTable(rom, Format.ComboDataOffset);
            sprites = Graphic.LevelSprites.GetSprites(level);
            itemTable_DEPRECATED = new ItemLoader(this, rom);
            //structures = new StructureCollection(this);
            altMusic = new AlternateMusicRooms(rom, this);

            this.Items = new ItemCollection(this);
            Items.LoadItems();

            TilePhysicsTableLocation = Format.GetTilePhysicsTableLocation();
        }
예제 #2
0
        public LevelPointers(MetroidRom rom, Level level)
        {
            this.Rom   = rom;
            this.Level = level;

            structs = new PointerTable(rom, (pRom)StructTableOffset, CalculateStructCount());
        }
예제 #3
0
파일: Level.cs 프로젝트: snarfblam/editroid
 public PointerTableData(int offset, int pointerCount, string text, MetroidRom Rom)
 {
     this.offset       = offset;
     this.pointerCount = pointerCount;
     this.displayName  = text;
     this.romData      = Rom.data;
 }
예제 #4
0
        internal void LoadRom(MetroidRom gameRom, MapControl map)
        {
            this.rom = gameRom;
            this.map = map;

            FindDoors();
            FindItems();

            UpdateItemCount();
        }
예제 #5
0
        public void LoadRomData(Level lvl)
        {
            this.rom  = lvl.Rom;
            levelData = lvl;

            tdArrangement.LoadLevel(lvl);
            tdUnplaced.LoadLevel(lvl);

            tdArrangement.Redraw();
            tdUnplaced.Redraw();
        }
예제 #6
0
 public static DialogResult ShowChrDialog(MetroidRom rom, Form owner)
 {
     using (frmChrTable frm = new frmChrTable()) {
         try {
             frm.Rom = rom;
         } catch (ArgumentOutOfRangeException ex) { // Thrown when initializing numericupdown controls with invalid values
             MessageBox.Show("This ROM does not appear to have a valid CHR usage table.");
             return(DialogResult.Cancel);
         }
         return(Program.Dialogs.ShowDialog(frm, owner));
     }
 }
예제 #7
0
 public PointerTable(MetroidRom rom, pRom tableLocation, int tableSize, bool use24BitPointers)
 {
     this.Offset             = tableLocation;
     this.Rom                = rom;
     this.Count              = tableSize;
     this.using24BitPointers = use24BitPointers;
     if (use24BitPointers)
     {
         EntrySize     = 3;
         pointerOffset = 1;
     }
 }
예제 #8
0
        /// <summary>
        /// Creates a Screen object.
        /// </summary>
        /// <param name="rom">ROM data</param>
        /// <param name="loadFromRom">If true, this screen will be initialized with the
        /// data referenced by the screen pointer (based on the value of the 'index' parameter)</param>
        public Screen(MetroidRom rom, ScreenCollection owner)
        {
            data = rom.data;
            ////this.Index = index;
            this.rom   = rom;
            this.Owner = owner;


            this.Structs = _structs.AsReadOnly();
            this.Enemies = _enemies.AsReadOnly();
            this.Doors   = _doors.AsReadOnly();
        }
예제 #9
0
        public ChrUsageEntryEditor(MetroidRom rom, int index, NumericUpDown spr, NumericUpDown bg1, NumericUpDown bg2, NumericUpDown rate)
        {
            this.rom   = rom;
            this.index = index;
            if (!rom.Format.HasChrUsageTable)
            {
                throw new ArgumentException("Specified ROM does not have a CHR usage table.");
            }

            this.spr  = spr;
            this.bg1  = bg1;
            this.bg2  = bg2;
            this.rate = rate;
        }
예제 #10
0
        /// <summary>
        /// Prompts the user to apply a patch and returns true if the patch is applied.
        /// </summary>
        /// <param name="patch"></param>
        /// <param name="rom"></param>
        /// <returns>True if the patch is applied.</returns>
        public static bool TryApplyPatch(RomPatch patch, MetroidRom rom, Form owner)
        {
            PatchForm form = new PatchForm();

            form.Patch = patch;
            Program.Dialogs.ShowDialog(form, owner);

            if (form.DialogResult == DialogResult.OK)
            {
                using (Stream s = new MemoryStream(rom.data)) {
                    patch.Apply(s);
                    return(true);
                }
            }

            return(false);
        }
예제 #11
0
        public PatternTable(bool linear, PatternTableType type, PatternGroupIndexTable globalTiles, PatternGroupIndexTable levelTiles, MetroidRom rom)
        {
            this.type    = type;
            this._Linear = linear;
            if (linear)
            {
                patterns = new Bitmap(2048, 8, PixelFormat.Format8bppIndexed);
            }
            else
            {
                patterns = new Bitmap(128, 128, PixelFormat.Format8bppIndexed);
            }

            this.rom    = rom;
            this.groups = levelTiles;

            this.BeginWrite();
            LoadPatternGroups(globalTiles);
            LoadPatternGroups(levelTiles);
            this.EndWrite();
        }
예제 #12
0
 internal void SetRom(MetroidRom rom, Project p)
 {
     this.rom     = rom;
     this.project = p;
     UpdateUI(updateMode.Level);
 }
예제 #13
0
파일: Level.cs 프로젝트: snarfblam/editroid
 public PaletteTable(MetroidRom rom, LevelIndex level)
 {
     this.rom   = rom;
     this.level = level;
 }
예제 #14
0
 /// <summary>
 /// Creates a ComboTable based on the specified ROM data
 /// </summary>
 /// <param name="data">ROM image</param>
 /// <param name="offset">location of data</param>
 public ComboTable(MetroidRom rom, int offset)
 {
     this.rom = rom;
     _Data    = rom.data;
     _Offset  = offset;
 }
예제 #15
0
 public void SetRom(MetroidRom rom)
 {
     this.rom = rom;
     LoadTree();
 }
예제 #16
0
 public PointerTable(MetroidRom rom, pRom tableLocation, int tableSize)
 {
     this.Offset = tableLocation;
     this.Rom    = rom;
     this.Count  = tableSize;
 }