public static RandomizerModWorldScreen TmosWorldScreenToRandomizerWorldScreen(TmosWorldScreen tmosWorldScreen) { 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, }; return(ws); }
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; } }