示例#1
0
        public override void Draw(Structures.EntityRenderProp Properties)
        {
            DevicePanel d = Properties.Graphics;

            Classes.Scene.EditorEntity e = Properties.EditorObject;
            int  x            = Properties.DrawX;
            int  y            = Properties.DrawY;
            int  Transparency = Properties.Transparency;
            int  animID       = (int)e.attributesMap["type"].ValueEnum;
            var  flipFlag     = e.attributesMap["flipFlag"].ValueEnum;
            bool fliph        = false;
            bool flipv        = false;

            // Handle springs being flipped in both planes
            // Down
            if ((flipFlag & 0x02) == 0x02)
            {
                flipv = true;
            }
            // Left
            if ((flipFlag & 0x01) == 0x01)
            {
                fliph = true;
            }

            var Animation = Methods.Drawing.ObjectDrawing.LoadAnimation(d, "Global/Springs.bin");

            if (EntityRenderer.IsValidated(Animation, new System.Tuple <int, int>(animID, 0)))
            {
                var frame = Animation.Animation.Animations[animID].Frames[0];
                d.DrawBitmap(Animation.Spritesheets.ElementAt(frame.SpriteSheet).Value, x + frame.PivotX, y + frame.PivotY, frame.X, frame.Y, frame.Width, frame.Height, false, Transparency, fliph, flipv);
            }
        }
示例#2
0
 public void DrawTexturePivotNormalCustom(DevicePanel Graphics, Methods.Drawing.ObjectDrawing.EditorAnimation Animation, int AnimID, int FrameID, int x, int y, int Transparency, int height, bool FlipH = false, bool FlipV = false, int rotation = 0, System.Drawing.Color?color = null)
 {
     if (EntityRenderer.IsValidated(Animation, new System.Tuple <int, int>(AnimID, FrameID)))
     {
         var Frame = Animation.Animation.Animations[AnimID].Frames[FrameID];
         Graphics.DrawBitmap(Animation.Spritesheets.ElementAt(Frame.SpriteSheet).Value, x + Frame.PivotX, y + Frame.PivotY, Frame.X, Frame.Y, Frame.Width, height, false, Transparency, FlipH, FlipV, rotation, color);
     }
 }
示例#3
0
 public static void DrawTexturePivotLengthLimit(DevicePanel Graphics, Methods.Drawing.ObjectDrawing.EditorAnimation Animation, int AnimID, int FrameID, int x, int y, int Transparency, int Height)
 {
     if (EntityRenderer.IsValidated(Animation, new System.Tuple <int, int>(AnimID, FrameID)))
     {
         var Frame = Animation.Animation.Animations[AnimID].Frames[FrameID];
         Graphics.DrawBitmap(Animation.Spritesheets.ElementAt(Frame.SpriteSheet).Value, x + Frame.PivotX, y, Frame.X, Frame.Y, Frame.Width, Height, false, Transparency);
     }
 }
        public override void Draw(Structures.EntityRenderProp Properties)
        {
            DevicePanel d = Properties.Graphics;

            Classes.Scene.EditorEntity e = Properties.EditorObject;

            int x            = Properties.DrawX;
            int y            = Properties.DrawY;
            int Transparency = Properties.Transparency;

            var type   = e.attributesMap["type"].ValueUInt8;
            var width  = (int)(e.attributesMap["size"].ValueVector2.X.High) - 1;
            var height = (int)(e.attributesMap["size"].ValueVector2.Y.High) - 1;


            var Animation = Methods.Drawing.ObjectDrawing.LoadAnimation(d, "EditorAssets");

            if (width != -1 && height != -1)
            {
                bool wEven = width % 2 == 0;
                bool hEven = height % 2 == 0;

                int x1 = (x + (wEven ? -8 : -16) + (-width / 2 + width) * 16) + 15;
                int x2 = (x + (wEven ? -8 : -16) + (-width / 2) * 16);
                int y1 = (y + (hEven ? -8 : -16) + (-height / 2 + height) * 16) + 15;
                int y2 = (y + (hEven ? -8 : -16) + (-height / 2) * 16);


                DrawBounds2(d, x1, y1, x2, y2, Transparency, SystemColors.White, SystemColors.Transparent);
            }

            bool knux   = e.attributesMap["onlyKnux"].ValueBool;
            bool mighty = e.attributesMap.ContainsKey("onlyMighty") && e.attributesMap["onlyMighty"].ValueBool;

            // draw Knuckles icon
            if (knux)
            {
                Animation = Methods.Drawing.ObjectDrawing.LoadAnimation(d, "Global/HUD.bin");
                if (EntityRenderer.IsValidated(Animation, new System.Tuple <int, int>(2, 2)))
                {
                    var frame = Animation.Animation.Animations[2].Frames[2];
                    d.DrawBitmap(Animation.Spritesheets.ElementAt(frame.SpriteSheet).Value, x - frame.Width / (mighty ? 1 : 2), y - frame.Height / 2, frame.X, frame.Y, frame.Width, frame.Height, false, Transparency);
                }
            }

            // draw Mighty icon
            if (mighty)
            {
                Animation = Methods.Drawing.ObjectDrawing.LoadAnimation(d, "Global/HUD.bin");
                if (EntityRenderer.IsValidated(Animation, new System.Tuple <int, int>(2, 3)))
                {
                    var frame = Animation.Animation.Animations[2].Frames[3];
                    d.DrawBitmap(Animation.Spritesheets.ElementAt(frame.SpriteSheet).Value, x - (knux ? 0 : frame.Width / 2), y - frame.Height / 2, frame.X, frame.Y, frame.Width, frame.Height, false, Transparency);
                }
            }
        }
示例#5
0
        public override void Draw(Structures.EntityRenderProp Properties)
        {
            DevicePanel d = Properties.Graphics;

            Classes.Scene.EditorEntity e = Properties.EditorObject;
            int x            = Properties.DrawX;
            int y            = Properties.DrawY;
            int Transparency = Properties.Transparency;

            bool fliph = false;
            bool flipv = false;

            int type = (int)e.attributesMap["type"].ValueUInt8;

            if (type > 1)
            {
                type = 1;
            }

            var Animation = Methods.Drawing.ObjectDrawing.LoadAnimation(d, GetSetupAnimation(), type, 0);

            if (EntityRenderer.IsValidated(Animation, new System.Tuple <int, int>(type, 0)))
            {
                var Frame = Animation.Animation.Animations[type].Frames[0];
                d.DrawBitmap(Animation.Spritesheets.ElementAt(Frame.SpriteSheet).Value, x + Frame.PivotX, y + Frame.PivotY, Frame.X, Frame.Y, Frame.Width, Frame.Height, false, Transparency);
            }

            bool knux   = e.attributesMap["onlyKnux"].ValueBool;
            bool mighty = e.attributesMap.ContainsKey("onlyMighty") && e.attributesMap["onlyMighty"].ValueBool;

            // draw Knuckles icon
            if (knux)
            {
                Animation = Methods.Drawing.ObjectDrawing.LoadAnimation(d, "Global/HUD.bin");
                if (EntityRenderer.IsValidated(Animation, new System.Tuple <int, int>(2, 2)))
                {
                    var frame = Animation.Animation.Animations[2].Frames[2];
                    d.DrawBitmap(Animation.Spritesheets.ElementAt(frame.SpriteSheet).Value, x - frame.Width / (mighty ? 1 : 2), y - frame.Height / 2, frame.X, frame.Y, frame.Width, frame.Height, false, Transparency);
                }
            }

            // draw Mighty icon
            if (mighty)
            {
                Animation = Methods.Drawing.ObjectDrawing.LoadAnimation(d, "Global/HUD.bin");
                if (EntityRenderer.IsValidated(Animation, new System.Tuple <int, int>(2, 3)))
                {
                    var frame = Animation.Animation.Animations[2].Frames[3];
                    d.DrawBitmap(Animation.Spritesheets.ElementAt(frame.SpriteSheet).Value, x - (knux ? 0 : frame.Width / 2), y - frame.Height / 2, frame.X, frame.Y, frame.Width, frame.Height, false, Transparency);
                }
            }
        }
示例#6
0
        public static void DrawHitbox(DevicePanel Graphics, Methods.Drawing.ObjectDrawing.EditorAnimation Animation, string HitboxName, System.Drawing.Color color, int AnimID, int FrameID, int x, int y, int Transparency, bool FlipH = false, bool FlipV = false, int rotation = 0)
        {
            if (EntityRenderer.IsValidated(Animation, new System.Tuple <int, int>(AnimID, FrameID)))
            {
                var Frame = Animation.Animation.Animations[AnimID].Frames[FrameID];

                if (Animation.Animation.CollisionBoxes.Contains(HitboxName))
                {
                    int hitboxIndex = Animation.Animation.CollisionBoxes.IndexOf(HitboxName);
                    int x1          = x + (int)Frame.HitBoxes[hitboxIndex].Left;
                    int y1          = y + (int)Frame.HitBoxes[hitboxIndex].Bottom;
                    int x2          = x + (int)Frame.HitBoxes[hitboxIndex].Right;
                    int y2          = y + (int)Frame.HitBoxes[hitboxIndex].Top;

                    Graphics.DrawRectangle(x1, y1, x2, y2, color);
                }
            }
        }
        public override void Draw(Structures.EntityRenderProp Properties)
        {
            Classes.Scene.EditorEntity e = Properties.EditorObject;
            DevicePanel d            = Properties.Graphics;
            int         x            = Properties.DrawX;
            int         y            = Properties.DrawY;
            int         Transparency = Properties.Transparency;

            bool fliph = false;
            bool flipv = false;

            int size      = (int)e.attributesMap["size"].ValueEnum;
            var Animation = Methods.Drawing.ObjectDrawing.LoadAnimation(Properties.Graphics, "AIZ/Platform.bin", 0, size + 3);

            DrawTexturePivotNormal(d, Animation, Animation.RequestedAnimID, Animation.RequestedFrameID, x, y, Transparency, fliph, flipv);

            bool knux   = e.attributesMap["onlyKnux"].ValueBool;
            bool mighty = e.attributesMap.ContainsKey("onlyMighty") && e.attributesMap["onlyMighty"].ValueBool;

            // draw Knuckles icon
            if (knux)
            {
                Animation = Methods.Drawing.ObjectDrawing.LoadAnimation(d, "Global/HUD.bin");
                if (EntityRenderer.IsValidated(Animation, new System.Tuple <int, int>(2, 2)))
                {
                    var frame = Animation.Animation.Animations[2].Frames[2];
                    d.DrawBitmap(Animation.Spritesheets.ElementAt(frame.SpriteSheet).Value, x - frame.Width / (mighty ? 1 : 2), y - frame.Height / 2, frame.X, frame.Y, frame.Width, frame.Height, false, Transparency);
                }
            }

            // draw Mighty icon
            if (mighty)
            {
                Animation = Methods.Drawing.ObjectDrawing.LoadAnimation(d, "Global/HUD.bin");
                if (EntityRenderer.IsValidated(Animation, new System.Tuple <int, int>(2, 3)))
                {
                    var frame = Animation.Animation.Animations[2].Frames[3];
                    d.DrawBitmap(Animation.Spritesheets.ElementAt(frame.SpriteSheet).Value, x - (knux ? 0 : frame.Width / 2), y - frame.Height / 2, frame.X, frame.Y, frame.Width, frame.Height, false, Transparency);
                }
            }
        }
示例#8
0
        public override void Draw(Structures.EntityRenderProp Properties)
        {
            DevicePanel d = Properties.Graphics;

            Classes.Scene.EditorEntity e = Properties.EditorObject;

            int x            = Properties.DrawX;
            int y            = Properties.DrawY;
            int Transparency = Properties.Transparency;


            const int LeftDist   = 1,
                      LeftPlane  = 2,
                      RightDist  = 4,
                      RightPlane = 8;

            var flags = (int)e.attributesMap["flags"].ValueEnum;
            var size  = (int)(e.attributesMap["size"].ValueEnum) - 1;
            var angle = e.attributesMap["angle"].ValueInt32;

            int frameDist  = (flags & LeftDist) > 0 ? 1 : 0;
            int framePlane = (flags & LeftPlane) > 0 ? 2 : 0;
            var Animation  = Methods.Drawing.ObjectDrawing.LoadAnimation(Properties.Graphics, "Global/PlaneSwitch.bin");

            const int pivotOffsetX = -8, pivotOffsetY = 0;
            const int drawOffsetX = 0, drawOffsetY = -8;


            if (EntityRenderer.IsValidated(Animation, new System.Tuple <int, int>(0, frameDist + framePlane)))
            {
                var  frame = Animation.Animation.Animations[0].Frames[frameDist + framePlane];
                bool hEven = size % 2 == 0;
                for (int yy = 0; yy <= size; ++yy)
                {
                    int[] drawCoords = RotatePoints(
                        x - frame.Width,
                        (y + (hEven ? frame.PivotY : -frame.Height) + (-size / 2 + yy) * frame.Height),
                        x + pivotOffsetX, y + pivotOffsetY, angle);

                    d.DrawBitmap(Animation.Spritesheets.ElementAt(frame.SpriteSheet).Value, drawCoords[0] + drawOffsetX, drawCoords[1] + drawOffsetY, frame.X, frame.Y, frame.Width, frame.Height, false, Transparency);
                }
            }

            frameDist  = (flags & RightDist) > 0 ? 1 : 0;
            framePlane = (flags & RightPlane) > 0 ? 2 : 0;
            Animation  = Methods.Drawing.ObjectDrawing.LoadAnimation(d, "Global/PlaneSwitch.bin");

            if (EntityRenderer.IsValidated(Animation, new System.Tuple <int, int>(0, frameDist + framePlane)))
            {
                var  frame = Animation.Animation.Animations[0].Frames[frameDist + framePlane];
                bool hEven = size % 2 == 0;
                for (int yy = 0; yy <= size; ++yy)
                {
                    int[] drawCoords = RotatePoints(
                        x,
                        (y + (hEven ? frame.PivotY : -frame.Height) + (-size / 2 + yy) * frame.Height),
                        x + pivotOffsetX, y + pivotOffsetY, angle);

                    d.DrawBitmap(Animation.Spritesheets.ElementAt(frame.SpriteSheet).Value, drawCoords[0] + drawOffsetX, drawCoords[1] + drawOffsetY, frame.X, frame.Y, frame.Width, frame.Height, false, Transparency);
                }
            }
        }