Ejemplo n.º 1
0
        private static void ParseUpdateTile(InputMessage input)
        {
            Location location = input.getLocation();
            var      thingId  = input.PeekU16();

            if (thingId == 0xFF01)
            {
                input.getU16();
            }
            else
            {
                parseTileDescription(input, location);
                input.getU16();
            }
        }
Ejemplo n.º 2
0
        private static Tile parseTileDescription(InputMessage message, Location location)
        {
            Tile tile = new Tile(location);

            while (message.PeekU16() < 0xFF00)
            {
                tile.AddThing(GetThing(message));
            }

            //Console.WriteLine("Tile added: things count = " + tile.things.Count);
            if (Instance.Map.GetTile(location) == null)
            {
                Instance.Map.SetTile(tile);
            }

            return(tile);
        }
Ejemplo n.º 3
0
        private static void parseFloorDescription(InputMessage message, List <Tile> tiles, int x, int y, int z, int width, int height, int offset, ref int skipTiles)
        {
            for (int nx = 0; nx < width; nx++)
            {
                for (int ny = 0; ny < height; ny++)
                {
                    if (skipTiles == 0)
                    {
                        var tileOpt = message.PeekU16();
                        // Decide if we have to skip tiles
                        // or if it is a real tile
                        if (tileOpt == 0xFF11)
                        {
                            message.getU16(); // skip 0xFF11
                            return;
                        }

                        //Console.WriteLine(tileOpt.ToString("X"));
                        if (tileOpt >= 0xFF00)
                        {
                            skipTiles = (short)(message.getU16() & 0xFF);
                        }
                        else
                        {
                            //real tile so read tile
                            tiles.Add(parseTileDescription(message, new Location(x + nx + offset, y + ny + offset, z)));
                            //tiles.Add();
                            skipTiles = (short)(message.getU16() & 0xFF);
                        }
                    }
                    else
                    {
                        skipTiles--;
                    }
                }
            }
        }