public static TmosWorldScreen RandomizerWorldScreenToTmosWorldScreen(RandomizerModWorldScreen randomizerWorldScreen) { byte[] wsData = new byte[] { randomizerWorldScreen.ParentWorld, randomizerWorldScreen.AmbientSound, RandomizerModWorldScreen.GetContentValue(randomizerWorldScreen.WSContent), randomizerWorldScreen.ObjectSet, randomizerWorldScreen.ScreenIndexRight, randomizerWorldScreen.ScreenIndexLeft, randomizerWorldScreen.ScreenIndexDown, randomizerWorldScreen.ScreenIndexUp, randomizerWorldScreen.DataPointer, randomizerWorldScreen.ExitPosition, randomizerWorldScreen.TopTiles, randomizerWorldScreen.BottomTiles, randomizerWorldScreen.WorldScreenColor, randomizerWorldScreen.SpritesColor, randomizerWorldScreen.Unknown, randomizerWorldScreen.Event }; TmosWorldScreen ws = new TmosWorldScreen(wsData); return(ws); }
public void UpdateWorldScreenBottomTileSection(int worldScreenIndex, int tileSectionIndex) { RandomizerModWorldScreen ws = WorldScreens[worldScreenIndex]; ws.BottomTiles = (byte)tileSectionIndex; ws.TileSectionBottom = _romData.LoadTileSection(ws.BottomTiles, GetBottomTileDataOffset(ws.DataPointer)); }
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 UpdateWorldScreenTopTileSection(int worldScreenIndex, int tileSectionIndex) { // RandomizerModWorldScreen ws = WorldScreens[worldScreenIndex]; //Get Tile Data Offset ws.TopTiles = (byte)tileSectionIndex; ws.TileSectionTop = _romData.LoadTileSection(ws.TopTiles, GetTopTileDataOffset(ws.DataPointer)); }
public bool CollisionTest_Right_IsCompatable(RandomizerModWorldScreen destinationWS) { if (ScreenIndexRight == 0xFF) { return(true); } //take the edge of this screen's grid, and compare it to the opposite edge of the destinationWS Tile[,] tileGrid = GetTileGrid(); Tile[,] destinationTileGrid = destinationWS.GetTileGrid(); Tile[] tileGrid_RightEdge = new Tile[6]; for (int y = 0; y < tileGrid.GetLength(1); y++) { tileGrid_RightEdge[y] = tileGrid[7, y]; } Tile[] destinationTileGrid_LeftEdge = new Tile[6]; for (int y = 0; y < tileGrid.GetLength(1); y++) { destinationTileGrid_LeftEdge[y] = destinationTileGrid[0, y]; } bool[] compatableCollisionTiles = new bool[6]; for (int y = 0; y < tileGrid.GetLength(1); y++) { if (TileIsWalkable(tileGrid_RightEdge[y]) == TileIsWalkable(destinationTileGrid_LeftEdge[y])) { compatableCollisionTiles[y] = true; } } //Now we have a bool array indicating which squares are compatable with the other screen. Use this to decide if the screens are compatable return(AllBoolsAreTrue(compatableCollisionTiles)); }
public bool CollisionTest_Down_IsCompatable(RandomizerModWorldScreen destinationWS) { if (ScreenIndexDown == 0xFF) { return(true); } //take the edge of this screen's grid, and compare it to the opposite edge of the destinationWS Tile[,] tileGrid = GetTileGrid(); Tile[,] destinationTileGrid = destinationWS.GetTileGrid(); Tile[] tileGrid_BottomEdge = new Tile[8]; for (int x = 0; x < tileGrid.GetLength(0); x++) { tileGrid_BottomEdge[x] = tileGrid[x, 5]; } Tile[] destinationTileGrid_TopEdge = new Tile[8]; for (int x = 0; x < tileGrid.GetLength(0); x++) { destinationTileGrid_TopEdge[x] = destinationTileGrid[x, 0]; } bool[] compatableCollisionTiles = new bool[8]; for (int x = 0; x < tileGrid.GetLength(0); x++) { if (TileIsWalkable(tileGrid_BottomEdge[x]) == TileIsWalkable(destinationTileGrid_TopEdge[x])) { compatableCollisionTiles[x] = true; } } //Now we have a bool array indicating which squares are compatable with the other screen. Use this to decide if the screens are compatable return(AllBoolsAreTrue(compatableCollisionTiles)); }
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; } }