public ObjectLayout(Reader reader) { Title = reader.ReadRSDKString(); Music = reader.ReadByte(); Background = reader.ReadByte(); PlayerXpos = (ushort)(reader.ReadByte() << 8); PlayerXpos |= reader.ReadByte(); PlayerYPos = (ushort)(reader.ReadByte() << 8); PlayerYPos |= reader.ReadByte(); // Read objects from the item file int ObjCount = reader.ReadByte() << 8; ObjCount |= reader.ReadByte(); Object.cur_id = 0; for (int i = 0; i < ObjCount; i++) { // Add object objects.Add(new Object(reader)); } reader.Close(); }
internal void ReadObjectsSpriteSheets(Reader reader) { byte objectSheets_count = reader.ReadByte(); for (int i = 0; i < objectSheets_count; ++i) { ObjectSpritesheets.Add(reader.ReadRSDKString()); } }
public Scene(Reader reader) { // Separate path components String dirname = Path.GetDirectoryName(reader.GetFilename()); String basename = "\\" + Path.GetFileNameWithoutExtension(reader.GetFilename()); String itmPath = dirname + basename + ".itm"; Reader ITMreader = new Reader(itmPath); Title = ITMreader.ReadRSDKString(); width = reader.ReadByte(); height = reader.ReadByte(); MapLayout = new ushort[height][]; for (int i = 0; i < height; i++) { MapLayout[i] = new ushort[width]; } // Read map data from the map file for (int y = 0; y < height; y++) { for (int x = 0; x < width; x++) { MapLayout[y][x] = reader.ReadByte(); } } Music = ITMreader.ReadByte(); Background = ITMreader.ReadByte(); PlayerXpos = (short)(ITMreader.ReadByte() << 8); PlayerXpos |= ITMreader.ReadByte(); PlayerYPos = (short)(ITMreader.ReadByte() << 8); PlayerYPos |= ITMreader.ReadByte(); // Read objects from the item file int ObjCount = ITMreader.ReadByte() << 8; ObjCount |= ITMreader.ReadByte(); Object.cur_id = 0; for (int i = 0; i < ObjCount; i++) { // Add object objects.Add(new Object(ITMreader)); } reader.Close(); }
internal void ReadObjectsNames(Reader reader) { byte objects_count = reader.ReadByte(); for (int i = 0; i < objects_count; ++i) { ObjectData OD = new ObjectData(); OD.FilePath = reader.ReadRSDKString(); Objects.Add(OD); } for (int i = 0; i < objects_count; i++) { Objects[i].SpriteSheetID = reader.ReadByte(); } }
public Animation(Reader reader, bool DreamcastVer = false) { Unknown = reader.ReadByte(); PlayerType = reader.ReadByte(); this.DreamcastVer = DreamcastVer; int spriteSheetCount = 3; if (DreamcastVer) //The Dreamcast Demo of retro-sonic only had 2 spritesheets per animation... { spriteSheetCount = 2; } else //But the PC demo has 3 spritesheets per animation! so we set that here! { spriteSheetCount = 3; } var animationCount = reader.ReadByte(); for (int i = 0; i < 3; ++i) { if (i == 2 && DreamcastVer) { SpriteSheets[i] = "<NULL>"; } else { SpriteSheets[i] = reader.ReadRSDKString(); string tmp = ""; for (int ii = 0; ii < SpriteSheets[i].Length - 1; ii++) //Fixes a crash when using the string to load (by trimming the null char off) { tmp += SpriteSheets[i][ii]; } SpriteSheets[i] = tmp; } } for (int i = 0; i < animationCount; ++i) { Animations.Add(new AnimationEntry(reader)); } reader.Close(); }
public Animation(Reader reader, bool DreamcastVer = false) { Unknown = reader.ReadByte(); PlayerType = reader.ReadByte(); this.DreamcastVer = DreamcastVer; int spriteSheetCount = 3; if (DreamcastVer) //The Dreamcast Demo of retro-sonic only had 2 spritesheets per animation... { spriteSheetCount = 2; } else //But the PC demo has 3 spritesheets per animation! so we set that here! { spriteSheetCount = 3; } var animationCount = reader.ReadByte(); for (int i = 0; i < 3; ++i) { if (i == 2 && DreamcastVer) { SpriteSheets[i] = "<NULL>"; } else { SpriteSheets[i] = reader.ReadRSDKString(); } } for (int i = 0; i < animationCount; ++i) { Animations.Add(new AnimationEntry(reader)); } reader.Close(); }