예제 #1
0
        public void read(Reader reader)
        {
            // Palettes
            stagePalette.read(reader, 2);

            // SpriteSheets
            byte sheetCount = reader.ReadByte();

            spriteSheets.Clear();
            for (int i = 0; i < sheetCount; ++i)
            {
                spriteSheets.Add(reader.readRSDKString());
            }

            // Objects
            byte objectCount = reader.ReadByte();

            objects.Clear();
            for (int i = 0; i < objectCount; ++i)
            {
                ObjectInfo info = new ObjectInfo();
                info.script = reader.readRSDKString();
                objects.Add(info);
            }

            foreach (ObjectInfo info in objects)
            {
                info.sheetID = (GfxSlotIDs)reader.ReadByte();
            }

            // SoundFX
            byte sfxCount = reader.ReadByte();

            soundFX.Clear();
            for (int i = 0; i < sfxCount; ++i)
            {
                soundFX.Add(reader.readRSDKString());
            }

            // Music
            byte trackCount = reader.ReadByte();

            musicTracks.Clear();
            for (int i = 0; i < trackCount; ++i)
            {
                musicTracks.Add(reader.readRSDKString());
            }

            reader.Close();
        }
예제 #2
0
        public void read(Reader reader)
        {
            var    fileStream = reader.BaseStream as FileStream;
            string filename   = fileStream.Name;

            Reader ITMreader = new Reader(Path.GetDirectoryName(filename) + "\\" + Path.GetFileNameWithoutExtension(filename) + ".itm");

            // Tile Layout Loading
            width  = reader.ReadByte();
            height = reader.ReadByte();
            layout = new byte[height][];
            for (int i = 0; i < height; i++)
            {
                layout[i] = new byte[width];
            }

            // Read map data from the map file
            for (int y = 0; y < height; y++)
            {
                for (int x = 0; x < width; x++)
                {
                    layout[y][x] = reader.ReadByte();
                }
            }
            reader.Close();

            // Object Layout Loading
            title = ITMreader.readRSDKString();

            initialMusicID      = (TrackIDs)ITMreader.ReadByte();
            initialBackgroundID = (BackgroundIDs)ITMreader.ReadByte();
            playerSpawnX        = (short)(ITMreader.ReadByte() << 8);
            playerSpawnX       |= ITMreader.ReadByte();
            playerSpawnY        = (short)(ITMreader.ReadByte() << 8);
            playerSpawnY       |= ITMreader.ReadByte();

            // Read entities from the item file
            int entityCount = ITMreader.ReadByte() << 8;

            entityCount |= ITMreader.ReadByte();

            entities.Clear();
            for (int i = 0; i < entityCount; i++)
            {
                entities.Add(new Entity(ITMreader));
            }

            ITMreader.Close();
        }
예제 #3
0
        public void read(Reader reader, bool dcVer = false)
        {
            unknown    = reader.ReadByte();
            playerType = (PlayerIDs)reader.ReadByte();
            byte animationCount = reader.ReadByte();

            // SpriteSheets
            for (int s = 0; s < (dcVer ? 2 : 3); ++s)
            {
                spriteSheets[s] = reader.readRSDKString();
            }

            // Animations
            animations.Clear();
            for (int a = 0; a < animationCount; ++a)
            {
                animations.Add(new AnimationEntry(reader, a < animationNames.Length ? animationNames[a] : $"Retro Sonic Animation #{a + 1}"));
            }

            reader.Close();
        }
예제 #4
0
 public void read(Reader reader)
 {
     directory   = reader.readRSDKString();
     startOffset = reader.ReadInt32();
 }