예제 #1
0
        public override Sprite GetDebugOverlay(ObjectEntry obj)
        {
            var up = (obj.SubType & 0x30) == 0;
            var height = (obj.SubType & 0x0F) * 96 + 32;
            int xoffset, width; bool left;

            if (obj.SubType >= 0x80)
            {
                left = up && obj.XFlip;
                var distance = up ? obj.XFlip ? obj.X - 0x2AE0 : 0x16C0 - obj.X : 0x2B20 - obj.X;
                xoffset = left ? distance + 32 : distance > 32 ? 0 : 32 - distance;
                width   = distance > 32 ? distance + (left ? 33 : 32) : 64;
            }
            else
            {
                left    = ((obj.SubType & 1) == 0) ^ obj.XFlip;
                xoffset = left ? 96 : 0;
                width   = left ? 97 : 96;
            }

            var overlay = new BitmapBits(width, height);

            overlay.DrawLine(LevelData.ColorWhite, xoffset, 0, xoffset, height);

            var x = left ? 0 : width - 64;

            if (up)
            {
                overlay.DrawRectangle(LevelData.ColorWhite, x, 0, 63, 31);
            }
            else
            {
                overlay.DrawRectangle(LevelData.ColorWhite, x, height - 32, 63, 31);
            }

            if (width > 64)
            {
                var y = up ? 16 : height - 16;
                if (left)
                {
                    overlay.DrawLine(LevelData.ColorWhite, 64, y, width, y);
                }
                else
                {
                    overlay.DrawLine(LevelData.ColorWhite, 0, y, width - 64, y);
                }
            }

            return(new Sprite(overlay, -xoffset, up ? 16 - height : -16));
        }
예제 #2
0
        public override Sprite GetDebugOverlay(ObjectEntry obj)
        {
            var bitmap = new BitmapBits(IsVertical ? 1 : 64, IsVertical ? 64 : 1);

            bitmap.DrawRectangle(LevelData.ColorWhite, 0, 0, bitmap.Width - 1, bitmap.Height - 1);
            return(new Sprite(bitmap, -bitmap.Width / 2, -bitmap.Height / 2));
        }
예제 #3
0
        public override Sprite GetDebugOverlay(ObjectEntry obj)
        {
            var routine = obj.SubType & 0x0F;

            if (routine == 0 || routine > numRoutines)
            {
                return(null);
            }

            if (routine == 3)
            {
                var bitmap = new BitmapBits(33, 1);
                bitmap.DrawRectangle(LevelData.ColorWhite, 0, 0, 32, 0);
                return(new Sprite(bitmap));
            }
            else
            {
                var bounds = GetBounds(obj);
                var bitmap = new BitmapBits(bounds.Width, bounds.Height);
                bitmap.DrawRectangle(LevelData.ColorWhite, 0, 0, bounds.Width - 1, bounds.Height - 1);

                var xoffset = routine == 2 && !obj.XFlip ? blockSize : 0;
                var yoffset = routine == 1 && !obj.YFlip ? blockSize : 0;
                return(new Sprite(bitmap, xoffset - (bounds.Width / 2), yoffset - (bounds.Height / 2)));
            }
        }
예제 #4
0
        public override Sprite GetDebugOverlay(ObjectEntry obj)
        {
            var routine = obj.SubType & 0x0F;
            var frame   = obj.SubType >> 4;

            if (routine == 0 || routine > 6 || frame >= sprites.Length)
            {
                return(null);
            }
            var length = 64 << ((routine - 1) % 3);
            var adjust = frame == 0 ? 0 : frame == 1 ^ obj.YFlip ? 16 : -16;

            if (routine > 3)
            {
                var offset = (obj.XFlip ? length : -length) / 2;

                var bitmap = new BitmapBits(64, 128);
                bitmap.DrawRectangle(LevelData.ColorWhite, 0, 0, 63, 127);
                return(new Sprite(bitmap, -32, offset + adjust - 64));
            }
            else
            {
                var bitmap = new BitmapBits(length, 1);
                bitmap.DrawLine(LevelData.ColorWhite, 0, 0, length, 0);
                return(new Sprite(bitmap, -length / 2, adjust));
            }
        }
예제 #5
0
        public override Sprite GetDebugOverlay(ObjectEntry obj)
        {
            var direction = obj.SubType & 0x70;

            if (direction > 0x40)
            {
                return(null);
            }

            if (direction == 0x10)
            {
                var horz = new BitmapBits(8, 32);
                horz.DrawRectangle(LevelData.ColorWhite, 0, 0, 7, 31);
                return(new Sprite(horz, obj.XFlip ? 24 : 32, -16));
            }
            if (direction < 0x30)
            {
                var vert = new BitmapBits(32, 8);
                vert.DrawRectangle(LevelData.ColorWhite, 0, 0, 31, 7);
                return(new Sprite(vert, -16, obj.YFlip ? 32 : 24));
            }

            var diag = new BitmapBits(28, 28);

            diag.DrawLine(LevelData.ColorWhite, 0, 4, 4, 0);
            diag.DrawLine(LevelData.ColorWhite, 5, 0, 27, 22);
            diag.DrawLine(LevelData.ColorWhite, 0, 5, 22, 27);
            diag.DrawLine(LevelData.ColorWhite, 23, 27, 27, 23);
            var overlay = new Sprite(diag, -16, -16);

            overlay.Flip(obj.XFlip, obj.YFlip ^ direction == 0x40);
            overlay.Offset(obj.XFlip ^ direction == 0x40 ? 32 : -32, 32);
            return(overlay);
        }
예제 #6
0
        public override Sprite GetDebugOverlay(ObjectEntry obj)
        {
            var bitmap = new BitmapBits(192, 192);

            bitmap.DrawRectangle(LevelData.ColorWhite, 0, 0, 191, 191);
            return(new Sprite(bitmap, -96, -96));
        }
예제 #7
0
        public override void Init(ObjectData data)
        {
            properties    = new PropertySpec[1];
            subtypes      = new ReadOnlyCollection <byte>(new byte[0]);
            unknownSprite = BuildFlippedSprites(ObjectHelper.UnknownObject);

            properties[0] = new PropertySpec("Path ID", typeof(int), "Extended",
                                             "The path information associated with this object.", null,
                                             (obj) => obj.SubType >> 1,
                                             (obj, value) => obj.SubType = (byte)((int)value << 1));

            startCoords = new Point[4];
            paths       = new Sprite[4];
            BuildPathsCoords(0, 0x1390, 0x2D0, 0x1230, 0x2D0, 0x1230, 0x300);
            BuildPathsCoords(1, 0x13F0, 0x2D0, 0x1560, 0x2D0, 0x1560, 0x280);
            BuildPathsCoords(2, 0x2090, 0x650, 0x2030, 0x650, 0x2030, 0x680);
            BuildPathsCoords(3, 0x20F0, 0x650, 0x21E0, 0x650, 0x21E0, 0x600);

            var bitmap = new BitmapBits(129, 401);

            bitmap.DrawRectangle(LevelData.ColorWhite, 0, 0, 128, 32);
            bitmap.DrawLine(LevelData.ColorWhite, 64, 32, 64, 400);
            bitmap.DrawLine(LevelData.ColorBlack, 65, 32, 65, 400);
            overlay = new Sprite(bitmap, -64, -16);
        }
예제 #8
0
        public override Sprite GetDebugOverlay(ObjectEntry obj)
        {
            var bitmap = new BitmapBits(64, 288);

            bitmap.DrawRectangle(LevelData.ColorWhite, 0, 0, 63, 287);
            return(new Sprite(bitmap, -32, -32));
        }
예제 #9
0
        public override Sprite GetDebugOverlay(ObjectEntry obj)
        {
            var bitmap = new BitmapBits(32, 256);

            bitmap.DrawRectangle(LevelData.ColorWhite, 0, 0, 31, 255);
            return(new Sprite(bitmap, -16, -128));
        }
예제 #10
0
        public override Sprite GetDebugOverlay(ObjectEntry obj)
        {
            var bitmap = new BitmapBits(obj.SubType * 2, 16);

            bitmap.DrawRectangle(LevelData.ColorWhite, 0, 0, bitmap.Width - 1, 15);
            return(new Sprite(bitmap, -obj.SubType, -8));
        }
예제 #11
0
        public override Sprite GetDebugOverlay(ObjectEntry obj)
        {
            var bitmap = new BitmapBits(32, sprite[0].Height);

            bitmap.DrawRectangle(LevelData.ColorWhite, 0, 0, 31, sprite[0].Height - 1);
            return(new Sprite(bitmap, -16, sprite[0].Y - 64));
        }
예제 #12
0
        public override void Init(ObjectData data)
        {
            properties = new PropertySpec[2];
            subtypes   = new ReadOnlyCollection <byte>(new byte[0]);
            sprite     = BuildFlippedSprites(ObjectHelper.UnknownObject);

            var bitmap = new BitmapBits(64, 32);

            bitmap.DrawRectangle(LevelData.ColorWhite, 0, 0, 63, 31);
            overlay = new Sprite(bitmap, -32, -16);

            properties[0] = new PropertySpec("Delayed", typeof(bool), "Extended",
                                             "If set, the Flybot will appear 40 frames after the alarm.", null,
                                             (obj) => (obj.SubType & 1) != 0,
                                             (obj, value) => obj.SubType = (byte)((obj.SubType & 0xFE) | ((bool)value ? 1 : 0)));

            properties[1] = new PropertySpec("Direction", typeof(int), "Extended",
                                             "The side of the screen from which the Flybot will appear.", null, new Dictionary <string, int>
            {
                { "Right", 0 },
                { "Left", 2 }
            },
                                             (obj) => obj.SubType & 0xFE,
                                             (obj, value) => obj.SubType = (byte)((obj.SubType & 1) | ((int)value & 2)));
        }
예제 #13
0
        public override Sprite GetDebugOverlay(ObjectEntry obj)
        {
            var routine = obj.SubType & 0x0F;

            if (routine >= overlays.Length)
            {
                return(null);
            }
            if (routine != 7)
            {
                return(overlays[routine]);
            }

            var ceiling = FindCeiling(obj);

            if (ceiling == 0)
            {
                return(null);
            }

            var overlay = new BitmapBits(sprite.Width, sprite.Bottom * 2);

            overlay.DrawRectangle(LevelData.ColorWhite, 0, 0, overlay.Width - 1, overlay.Height - 1);
            return(new Sprite(overlay, sprite.X, ceiling - obj.Y));
        }
예제 #14
0
        public override Sprite GetDebugOverlay(ObjectEntry obj)
        {
            var movement = obj.SubType >> 4;

            if (movement > 2)
            {
                return(null);
            }

            int xoffset = 0, yoffset = 0;

            if (movement == 0)
            {
                xoffset = obj.XFlip ? -128 : 128;
            }
            else
            {
                yoffset  = movement * (obj.XFlip ? -64 : 64);
                movement = 1;
            }

            var sprite = GetFlippedSprite(obj, movement);
            var bitmap = new BitmapBits(sprite.Width, sprite.Height);

            bitmap.DrawRectangle(LevelData.ColorWhite, 0, 0, sprite.Width - 1, sprite.Height - 1);

            return(new Sprite(bitmap, sprite.X + xoffset, sprite.Y + yoffset));
        }
예제 #15
0
        public override Sprite GetDebugOverlay(ObjectEntry obj)
        {
            var bitmap = new BitmapBits(96, 128);

            bitmap.DrawRectangle(LevelData.ColorWhite, 0, 0, 95, 127);
            return(new Sprite(bitmap, -48, -64));
        }
예제 #16
0
        private Sprite Square(int radius)
        {
            var length  = radius * 2;
            var overlay = new BitmapBits(length + 1, length + 1);

            overlay.DrawRectangle(LevelData.ColorWhite, 0, 0, length, length);
            return(new Sprite(overlay, -radius, -radius));
        }
예제 #17
0
        public override Sprite GetDebugOverlay(ObjectEntry obj)
        {
            var height  = (obj.SubType & 0x70) == 0 ? 0x80 : 0x100;
            var overlay = new BitmapBits(16, height);

            overlay.DrawRectangle(LevelData.ColorWhite, 0, 0, 15, height - 1);
            return(new Sprite(overlay, -8, -height / 2));
        }
예제 #18
0
        public override Sprite GetDebugOverlay(ObjectEntry obj)
        {
            var width   = obj.SubType << 4;
            var overlay = new BitmapBits(width, height);

            overlay.DrawRectangle(LevelData.ColorWhite, 0, 0, width - 1, height - 1);
            return(new Sprite(overlay, -width / 2, -height / 2));
        }
예제 #19
0
        public override Sprite GetDebugOverlay(ObjectEntry obj)
        {
            var length = (obj.SubType << 3) + 16;
            var bitmap = new BitmapBits(16, length);

            bitmap.DrawRectangle(LevelData.ColorWhite, 0, 0, 15, length - 1);
            return(new Sprite(bitmap, -8, 8 - length));
        }
예제 #20
0
        public override Sprite GetDebugOverlay(ObjectEntry obj)
        {
            var height = obj.SubType << 4;
            var bitmap = new BitmapBits(128, height);

            bitmap.DrawRectangle(LevelData.ColorWhite, 0, 0, 127, height - 1);
            return(new Sprite(bitmap, -64, -height / 2));
        }
예제 #21
0
        public override Sprite GetDebugOverlay(ObjectEntry obj)
        {
            var bounds = GetBounds(obj);
            var bitmap = new BitmapBits(bounds.Width, bounds.Height);

            bitmap.DrawRectangle(LevelData.ColorWhite, 0, 0, bounds.Width - 1, bounds.Height - 1);
            return(new Sprite(bitmap, -bounds.Width / 2, -bounds.Height / 2));
        }
예제 #22
0
        public override Sprite GetDebugOverlay(ObjectEntry obj)
        {
            var width  = obj.SubType << 1;
            var bitmap = new BitmapBits(width, 128);

            bitmap.DrawRectangle(LevelData.ColorWhite, 0, 0, width - 1, 127);
            return(new Sprite(bitmap, -width / 2, -64));
        }
예제 #23
0
        public override Sprite GetDebugOverlay(ObjectEntry obj)
        {
            var bounds  = GetSprite(obj).Bounds;
            var overlay = new BitmapBits(bounds.Size);

            overlay.DrawRectangle(LevelData.ColorWhite, 0, 0, bounds.Width - 1, bounds.Height - 1);

            return(new Sprite(overlay, bounds.X, bounds.Y));
        }
예제 #24
0
        public override Sprite GetDebugOverlay(ObjectEntry obj)
        {
            var width = 192 + ((obj.SubType & 1) << 7);

            var bitmap = new BitmapBits(width, 40);

            bitmap.DrawRectangle(LevelData.ColorWhite, 0, 0, width - 1, 39);
            return(new Sprite(bitmap, -width / 2, 32));
        }
예제 #25
0
        public override Sprite GetDebugOverlay(ObjectEntry obj)
        {
            int        w   = ((obj.SubType >> 4) + 1) * 16;
            int        h   = ((obj.SubType & 0xF) + 1) * 16;
            BitmapBits bmp = new BitmapBits(w, h);

            bmp.DrawRectangle(LevelData.ColorWhite, 0, 0, w - 1, h - 1);
            return(new Sprite(bmp, -(w / 2), -(h / 2)));
        }
        public override Sprite GetSprite(ObjectEntry obj)
        {
            int        w   = ((obj.SubType >> 4) + 1) * 16;
            int        h   = ((obj.SubType & 0xF) + 1) * 16;
            BitmapBits bmp = new BitmapBits(w, h);

            bmp.DrawRectangle(0x1C, 0, 0, w - 1, h - 1);
            return(new Sprite(new Sprite(bmp, new Point(-(w / 2), -(h / 2))), img));
        }
예제 #27
0
 public override Sprite GetSprite(ObjectEntry obj)
 {
     int w = ((obj.SubType >> 4) + 1) * 16;
     int h = ((obj.SubType & 0xF) + 1) * 16;
     BitmapBits bmp = new BitmapBits(w, h);
     bmp.DrawRectangle(0x1C, 0, 0, w - 1, h - 1);
     Sprite spr = new Sprite(new Sprite(bmp, new Point(-(w / 2), -(h / 2))), img);
     spr.Offset = new Point(spr.X + obj.X, spr.Y + obj.Y);
     return spr;
 }
예제 #28
0
        public override Sprite GetDebugOverlay(ObjectEntry obj)
        {
            if ((obj.SubType & 1) != 0)
            {
                return(null);
            }

            var bitmap = new BitmapBits(128, 128);

            bitmap.DrawRectangle(LevelData.ColorWhite, 0, 0, 31, 31);
            bitmap.DrawRectangle(LevelData.ColorWhite, 32, 32, 31, 31);
            bitmap.DrawRectangle(LevelData.ColorWhite, 64, 64, 31, 31);
            bitmap.DrawRectangle(LevelData.ColorWhite, 96, 96, 31, 31);

            var overlay = new Sprite(bitmap, obj.XFlip ? -16 : -112, 16);

            overlay.Flip(!obj.XFlip, (obj.SubType & 4) != 0);
            return(overlay);
        }
예제 #29
0
        public override Sprite GetDebugOverlay(ObjectEntry obj)
        {
            var bitmap = new BitmapBits(48, 32);

            bitmap.DrawRectangle(LevelData.ColorWhite, 0, 0, 47, 31);

            var pattern  = GetMovementPattern(obj);
            var distance = 96 * ((pattern & 2) - 1) * ((pattern & 1) + 1);

            return(new Sprite(bitmap, -24, distance - 16));
        }
예제 #30
0
        public override Sprite GetDebugOverlay(ObjectEntry obj)
        {
            if ((obj.SubType & 1) != 0)
            {
                return(null);
            }

            var bitmap = new BitmapBits(32, 32);

            bitmap.DrawRectangle(LevelData.ColorWhite, 0, 0, 31, 31);
            return(new Sprite(bitmap, obj.YFlip ? -16 : obj.XFlip ? 16 : -48, -16));
        }
예제 #31
0
        public override Sprite GetDebugOverlay(ObjectEntry obj)
        {
            if (obj.SubType >= 0x80)
            {
                return(null);
            }

            var overlay = new BitmapBits(128, 64);

            overlay.DrawRectangle(LevelData.ColorWhite, 0, 0, 127, 63);
            return(new Sprite(overlay, -64, -32));
        }