public void LoadDataFromRom(TmosRom rom) { _romData = rom; LoadWorldScreensFromRom(_romData); LoadTileDataFromRom(_romData); LoadTileSectionsFromRom(_romData); }
public void LoadTileSectionsFromRom(TmosRom tmosRom) { // TileSections = new TmosTileSection[TmosData.DataStructureCounts.TileSection_Count]; TileSections = new TmosTileSection[255]; for (int i = 0; i < TileSections.Length; i++) { TmosTileSection tmosTileSection = tmosRom.LoadTileSection(i, 0); TileSections[i] = tmosTileSection; } }
private void btn_load_rom_Click(object sender, EventArgs e) { DialogResult result = openFileDialog1.ShowDialog(); if (result == System.Windows.Forms.DialogResult.OK) { string filePath = openFileDialog1.FileName; _currentRom = new TmosRom(); _currentRom.LoadRom(filePath); _randomizerMod = new RandomizerMod(); _randomizerMod.LoadDataFromRom(_currentRom); _randomizerMod.Randomize(); //Init display stuff Init(); } //update initial settings display }
public void LoadTileDataFromRom(TmosRom tmosRom) { TileData = tmosRom.LoadTileData(); }
public void LoadWorldScreensFromRom(TmosRom tmosRom) { WorldScreens = new RandomizerModWorldScreen[TmosData.DataStructureCounts.WorldScreen_Count]; //Now we have data from the rom //Convert the TmosWorldScreens into RandomizerModWorldScreens (which will hopefully be less tied to the lower level details) for (int i = 0; i < WorldScreens.Length; i++) { TmosWorldScreen tmosWorldScreen = tmosRom.LoadWorldScreen(i); RandomizerModWorldScreen ws = new RandomizerModWorldScreen() { WSContent = RandomizerModWorldScreen.GetContentFromValue(tmosWorldScreen.Content), //Loading the original byte values into RandomizeModWorldScreen just for now, even though eventually it should have interactive types like the above values rather than byte values. ParentWorld = tmosWorldScreen.ParentWorld, //music and some other things AmbientSound = tmosWorldScreen.AmbientSound, // Content = tmosWorldScreen.Content, //Just used this value to create the WSContent object, so kind of reduntant putting it in the RandomizerModWorldScreenObject ObjectSet = tmosWorldScreen.ObjectSet, ScreenIndexRight = tmosWorldScreen.ScreenIndexRight, ScreenIndexLeft = tmosWorldScreen.ScreenIndexLeft, ScreenIndexDown = tmosWorldScreen.ScreenIndexDown, ScreenIndexUp = tmosWorldScreen.ScreenIndexUp, DataPointer = tmosWorldScreen.DataPointer, ExitPosition = tmosWorldScreen.ExitPosition, TopTiles = tmosWorldScreen.TopTiles, //Just used this value to create the TileSectionTop object, so kind of reduntant putting it in BottomTiles = tmosWorldScreen.BottomTiles, //Just used this value to create the TileSectionBottom object, so kind of reduntant putting it in WorldScreenColor = tmosWorldScreen.WorldScreenColor, SpritesColor = tmosWorldScreen.SpritesColor, Unknown = tmosWorldScreen.Unknown, Event = tmosWorldScreen.Event, }; int bottomTileDataOffset = 0; int topTileDataOffset = 0; if (ws.DataPointer >= 0x40 && ws.DataPointer < 0x8f) { bottomTileDataOffset = 0x2000; topTileDataOffset = 0x0000; } else if (ws.DataPointer >= 0x8f && ws.DataPointer < 0xA0) { bottomTileDataOffset = 0x0000; topTileDataOffset = 0x2000; } else if (ws.DataPointer >= 0xC0) { topTileDataOffset = 0x2000; bottomTileDataOffset = 0x2000; } ws.TileSectionTop = _romData.LoadTileSection(ws.TopTiles, topTileDataOffset); ws.TileSectionBottom = _romData.LoadTileSection(ws.BottomTiles, bottomTileDataOffset); WorldScreens[i] = ws; } }