Exemplo n.º 1
0
        internal void ReadObjectData(Reader reader)
        {
            byte objects_count = reader.ReadByte();

            for (int i = 0; i < objects_count; ++i)
            {
                ObjectsNames.Add(reader.ReadRSDKString());
            }
            for (int i = 0; i < objects_count; ++i)
            {
                ScriptPaths.Add(reader.ReadRSDKString()); Console.WriteLine(ScriptPaths[i]);
            }
        }
Exemplo n.º 2
0
        internal void ReadObjectsNames(Reader reader)
        {
            byte objects_count = reader.ReadByte();

            for (int i = 0; i < objects_count; ++i)
            {
                ObjectsNames.Add(reader.ReadRSDKString());
            }
            for (int i = 0; i < objects_count; ++i)
            {
                ScriptPaths.Add(reader.ReadRSDKString());
            }
        }
Exemplo n.º 3
0
        internal void ReadObjectsNames(Reader reader)
        {
            byte srctxt_count = reader.ReadByte();

            for (int i = 0; i < srctxt_count; ++i)
            {
                SourceTxtLocations.Add(reader.ReadRSDKString()); Console.WriteLine(SourceTxtLocations[i]);
            }
        }
Exemplo n.º 4
0
        public Scene(Reader reader)
        {
            Title = reader.ReadRSDKString();
            //Console.WriteLine(Title);
            byte[] buffer = new byte[5];

            ActiveLayer0 = reader.ReadByte();
            ActiveLayer1 = reader.ReadByte();
            ActiveLayer2 = reader.ReadByte();
            ActiveLayer3 = reader.ReadByte();
            Midpoint     = reader.ReadByte();

            reader.Read(buffer, 0, 2); //Read size

            width = 0; height = 0;


            // Map width in 128 pixel units
            // In RSDKv2, it's one byte long
            width  = buffer[0];
            height = buffer[1];

            MapLayout = new ushort[height][];
            for (int i = 0; i < height; i++)
            {
                MapLayout[i] = new ushort[width];
            }

            for (int y = 0; y < height; y++)
            {
                for (int x = 0; x < width; x++)
                {
                    // 128x128 Block number is 16-bit
                    // Big-Endian in RSDKv2 and RSDKv3
                    reader.Read(buffer, 0, 2); //Read size
                    MapLayout[y][x] = (ushort)(buffer[1] + (buffer[0] << 8));
                }
            }


            // Read number of object types, Only RSDKv1 and RSDKv2 support this feature
            int ObjTypeCount = reader.ReadByte();

            for (int n = 0; n < ObjTypeCount; n++)
            {
                string name = reader.ReadRSDKString();

                objectTypeNames.Add(name);
            }
            // Read object data

            int ObjCount = 0;

            // 2 bytes, big-endian, unsigned
            ObjCount  = reader.ReadByte() << 8;
            ObjCount |= reader.ReadByte();

            Object.cur_id = 0;

            for (int n = 0; n < ObjCount; n++)
            {
                // Add object
                objects.Add(new Object(reader));
            }
            reader.Close();
        }
Exemplo n.º 5
0
 public PlayerData(Reader reader)
 {
     PlayerAnimLocation   = reader.ReadRSDKString();
     PlayerScriptLocation = reader.ReadRSDKString();
     PlayerName           = reader.ReadRSDKString();
 }
Exemplo n.º 6
0
 internal WAVConfiguration(Reader reader)
 {
     Name = reader.ReadRSDKString();
 }
Exemplo n.º 7
0
        public Level(Reader reader)
        {
            Title = reader.ReadRSDKString();
            Console.WriteLine(Title);
            byte[] buffer = new byte[5];
            reader.Read(displayBytes, 0, 5); //Waste 5 bytes, I don't care about them right now.
            //The first 4 bytes are loaded into StageSystem.ActiveTileLayers. 5th byte is tLayerMidPoint.
            //If you want to know the values then look at the values for "DisplayBytes"
            reader.Read(buffer, 0, 2); //Read size

            width = 0; height = 0;


            // Map width in 128 pixel units
            // In RSDKv2, it's one byte long
            width  = buffer[0];
            height = buffer[1];

            MapLayout = new ushort[height][];
            for (int i = 0; i < height; i++)
            {
                MapLayout[i] = new ushort[width];
            }

            for (int y = 0; y < height; y++)
            {
                for (int x = 0; x < width; x++)
                {
                    // 128x128 Block number is 16-bit
                    // Big-Endian in RSDKv2 and RSDKv3
                    reader.Read(buffer, 0, 2); //Read size
                    MapLayout[y][x] = (ushort)(buffer[1] + (buffer[0] << 8));
                }
            }


            // Read number of object types, Only RSDKv2 and RSDKv3 support this feature
            int ObjTypeCount = reader.ReadByte();

            for (int n = 0; n < ObjTypeCount; n++)
            {
                string name = reader.ReadRSDKString();

                objectTypeNames.Add(name);
                Console.WriteLine(name);
            }
            // Read object data

            int ObjCount = 0;

            // 2 bytes, big-endian, unsigned
            ObjCount  = reader.ReadByte() << 8;
            ObjCount |= reader.ReadByte();

            int obj_type    = 0;
            int obj_subtype = 0;
            int obj_xPos    = 0;
            int obj_yPos    = 0;

            for (int n = 0; n < ObjCount; n++)
            {
                // Object type, 1 byte, unsigned
                obj_type = reader.ReadByte();
                // Object subtype, 1 byte, unsigned
                obj_subtype = reader.ReadByte();

                // X Position, 2 bytes, big-endian, signed
                obj_xPos  = reader.ReadSByte() << 8;
                obj_xPos |= reader.ReadByte();

                // Y Position, 2 bytes, big-endian, signed
                obj_yPos  = reader.ReadSByte() << 8;
                obj_yPos |= reader.ReadByte();

                // Add object
                objects.Add(new Object(obj_type, obj_subtype, obj_xPos, obj_yPos));
            }
            reader.Close();
        }