Пример #1
0
        public GMSound(BinaryReader binaryReader)
        {
            Name          = new GMString(binaryReader);
            Kind          = binaryReader.ReadInt32();
            FileExtension = new GMString(binaryReader);
            OrigName      = new GMString(binaryReader);
            Effects       = binaryReader.ReadUInt32();

            // Parse "Effects" flag.
            int len = (int)EffectEnum.__LENGTH;

            EffectArr = new bool[len];
            uint bk_e = Effects;

            for (int i = 0; i < len; i++)
            {
                EffectArr[i] = (bk_e & 1U) != 0U;
                bk_e       >>= 1;
            }

            Volume  = binaryReader.ReadSingle();
            Pan     = binaryReader.ReadSingle();
            Preload = ReadBool(binaryReader);
            SoundID = binaryReader.ReadInt32();
        }
Пример #2
0
        public GMGeneral(BinaryReader binaryReader) : base(binaryReader)
        {
            CheckHeader("GEN8");
            Debug         = binaryReader.ReadInt32();
            Name          = new GMString(binaryReader);
            RoomMaxID     = binaryReader.ReadInt32();
            RoomMaxTileID = binaryReader.ReadInt32();
            ID            = binaryReader.ReadInt32();

            guid1 = binaryReader.ReadInt32();
            guid2 = binaryReader.ReadInt32();
            guid3 = binaryReader.ReadInt32();
            guid4 = binaryReader.ReadInt32();

            RoomOrderCount = binaryReader.ReadInt32();

            RoomOrderInt = new List <int>(RoomOrderCount);
            for (int i = 0; i < RoomOrderCount; i++)
            {
                RoomOrderInt.Add(binaryReader.ReadInt32());
            }
            RoomOrder = new List <GMRoom>(RoomOrderCount);
            // filled later in GMWAD...

            FixChunkAddr(binaryReader);
        }
Пример #3
0
        public List <GMString> Arguments;    // actual arguments I guess. there was no bytecode so they're compiled @ runtime.

        public GMGMLAction(BinaryReader binaryReader)
        {
            LibID         = binaryReader.ReadInt32();
            ID            = binaryReader.ReadInt32();
            Kind          = (ActionType)binaryReader.ReadInt32();
            UseRelative   = ReadBool(binaryReader);
            IsQuestion    = ReadBool(binaryReader);
            UseApplyTo    = ReadBool(binaryReader);
            ExeType       = (EventExecuteType)binaryReader.ReadInt32();
            Name          = new GMString(binaryReader);
            Code          = new GMString(binaryReader);
            ArgumentCount = binaryReader.ReadInt32();
            Who           = binaryReader.ReadInt32();
            Relative      = ReadBool(binaryReader);
            IsNot         = ReadBool(binaryReader);
            ArgTypeCount  = binaryReader.ReadInt32();
            ArgTypesList  = new List <ArgTypes>(ArgTypeCount);
            Arguments     = new List <GMString>(ArgTypeCount);
            //Debug.Assert(ArgumentCount == ArgTypeCount);
            for (int a = 0; a < ArgTypeCount; a++)
            {
                ArgTypesList.Add((ArgTypes)binaryReader.ReadInt32());
                Arguments.Add(new GMString(binaryReader));
            }
        }
Пример #4
0
        public GMString Text;         // it's basically an RTF document.


        public GMHelp(BinaryReader binaryReader) : base(binaryReader)
        {
            CheckHeader("HELP");

            BackgroundColor = new GMColor(binaryReader.ReadUInt32());
            Mimic           = ReadBool(binaryReader);
            Caption         = new GMString(binaryReader);
            Left            = binaryReader.ReadInt32();
            Top             = binaryReader.ReadInt32();
            Width           = binaryReader.ReadInt32();
            Height          = binaryReader.ReadInt32();

            Border  = ReadBool(binaryReader);
            Sizable = ReadBool(binaryReader);
            OnTop   = ReadBool(binaryReader);
            Modal   = ReadBool(binaryReader);

            Text = new GMString(binaryReader);

            FixChunkAddr(binaryReader);
        }
Пример #5
0
        public GMSprite(BinaryReader binaryReader, GMWAD w)
        {
            Name        = new GMString(binaryReader);
            Width       = binaryReader.ReadInt32();
            Height      = binaryReader.ReadInt32();
            BBoxLeft    = binaryReader.ReadInt32();
            BBoxRight   = binaryReader.ReadInt32();
            BBoxBottom  = binaryReader.ReadInt32();
            BBoxTop     = binaryReader.ReadInt32();
            Transparent = ReadBool(binaryReader);
            Smooth      = ReadBool(binaryReader);
            Preload     = ReadBool(binaryReader);
            int mode = binaryReader.ReadInt32();

            BBoxMode   = (MaskShape)mode;
            ColCheck   = ReadBool(binaryReader);
            XOrigin    = binaryReader.ReadInt32();
            YOrigin    = binaryReader.ReadInt32();
            ImageCount = binaryReader.ReadInt32();
            if (ImageCount != 0)
            {
                ImageTextures = new List <GMTPAGEntry>(ImageCount);
                for (int img = 0; img < ImageCount; img++)
                {
                    uint addr = binaryReader.ReadUInt32();
                    if (addr != 0)
                    {
                        long prev_addr = binaryReader.BaseStream.Position;
                        binaryReader.BaseStream.Position = addr;
                        var item = new GMTPAGEntry(binaryReader, w);
                        binaryReader.BaseStream.Position = prev_addr;
                        ImageTextures.Add(item);
                    }
                    else
                    {
                        ImageTextures.Add(null);
                    }
                }
            }
            else
            {
                ImageTextures = null;
            }
            MasksCount = binaryReader.ReadInt32();
            if (MasksCount != 0)
            {
                MaskData = new List <byte[]>(MasksCount);
                for (int msk = 0; msk < MasksCount; msk++)
                {
                    int    size = CalculateMaskSize(Width, Height);
                    byte[] data = binaryReader.ReadBytes(size);
                    MaskData.Add(data);
                }
            }
            else
            {
                MaskData = null;
            }

            // this is happening in Karoshi...
            if (ImageCount != MasksCount)
            {
                Output.Print($"Sprite {Name}'s ImageCount and MaskCount do not match. {ImageCount} | {MasksCount}");
            }
        }
Пример #6
0
 public GMGMLConstant(string name, string value)
 {
     Name  = new GMString(name);
     Value = new GMString(value);
 }
Пример #7
0
 public GMGMLConstant(BinaryReader binaryReader)
 {
     Name  = new GMString(binaryReader);
     Value = new GMString(binaryReader);
 }