Example #1
0
        public object Clone()
        {
            PegInfo pi = new PegInfo(mParent);

            pi.mVariable = mVariable;
            pi.mCrumble  = mCrumble;
            return(pi);
        }
Example #2
0
		public Brick(Level level)
			: base(level)
		{
			PegInfo = new PegInfo(this, true, false);

			mWidth = 20.0f;
			mLength = 30.0f;
			mCurvePoints = 4;
			mCurved = false;
		}
Example #3
0
        public Brick(Level level)
            : base(level)
        {
            PegInfo = new PegInfo(this, true, false);

            mWidth       = 20.0f;
            mLength      = 30.0f;
            mCurvePoints = 4;
            mCurved      = false;
        }
Example #4
0
        public override void Draw(Graphics g)
        {
            //Show only if its collidable
            if (!HasPegInfo)
            {
                if (Level.ShowCollision && !Collision)
                {
                    return;
                }
            }

            base.Draw(g);

            //Get the circle image
            Image circleImage = GetCircleImage();

            //Set the location
            PointF location = DrawLocation;

            //Set the draw bounds
            RectangleF drawbounds = new RectangleF(location.X - mRadius, location.Y - mRadius, mRadius * 2, mRadius * 2);


            if (Level.ShowCollision || (!HasPegInfo && circleImage == null))
            {
                if (!Level.ShowPreview)
                {
                    //Draw the collision white circle
                    g.FillEllipse(Brushes.White, drawbounds);
                }
            }
            else
            {
                if (HasPegInfo)
                {
                    //Draw the PeggleEdit style peg
                    g.FillEllipse(new SolidBrush(PegInfo.GetOuterColour()), drawbounds);
                    drawbounds.Inflate(-2, -2);
                    g.FillEllipse(new SolidBrush(PegInfo.GetInnerColour()), drawbounds);
                }
                else
                {
                    //Draw the circle image
                    g.DrawImage(circleImage, location.X - (circleImage.Width / 2), location.Y - (circleImage.Height / 2), circleImage.Width, circleImage.Height);
                }
            }
        }
Example #5
0
        private void DrawStrightBrick(Graphics g, PointF location)
        {
            RectangleF dest = new RectangleF(location.X - (Length / 2), location.Y - (Width / 2), Length, Width);

            DrawBrick(g, dest, PegInfo.GetOuterColour());

            dest.Inflate(-2, -5);

            if (mTextureFlip)
            {
                dest.Y += 3.0f;
            }
            else
            {
                dest.Y -= 3.0f;
            }

            DrawBrick(g, dest, PegInfo.GetInnerColour());
        }
Example #6
0
        private void DrawCurvedBrick(Graphics g, PointF location)
        {
            if (Level.ShowCollision)
            {
                DrawCurvedBrick(g, Color.White, location, false);
                return;
            }

            float shadingOffset = 8.0f;

            if (mTextureFlip)
            {
                shadingOffset = 2.0f;
            }

            DrawCurvedBrick(g, PegInfo.GetOuterColour(), location, false);
            mWidth     /= 2.0f;
            location.X += shadingOffset;
            DrawCurvedBrick(g, PegInfo.GetInnerColour(), location, true);
            location.X -= shadingOffset;
            mWidth     *= 2.0f;
        }
Example #7
0
		public object Clone()
		{
			PegInfo pi = new PegInfo(mParent);
			pi.mVariable = mVariable;
			pi.mCrumble = mCrumble;
			return pi;
		}
Example #8
0
		public void ReadGenericData(BinaryReader br, int version)
		{
			FlagGroup f = new FlagGroup(br.ReadInt32());

			mCollision = f[5];
			mVisible = f[6];
			mCanMove = f[7];
			mBackground = f[14];
			mBaseObject = f[15];
			mBallStopReset = f[20];
			mForeground = f[22];
			mDrawSort = f[24];
			mForeground2 = f[25];
			mDrawFloat = f[28];

			if (f[0])
				mRolly = br.ReadSingle();
			if (f[1])
				mBouncy = br.ReadSingle();
			if (f[4])
				br.ReadInt32();
			if (f[8])
				mSolidColour = Color.FromArgb(br.ReadInt32());
			if (f[9])
				mOutlineColour = Color.FromArgb(br.ReadInt32());
			if (f[10]) {
				mImageFilename = LevelReader.ReadPopcapString(br);
			}
			if (f[11])
				mImageDX = br.ReadSingle();
			if (f[12])
				mImageDY = br.ReadSingle();
			if (f[13])
				mImageRotation = MathExt.ToDegrees(br.ReadSingle());
			if (f[16])
				br.ReadInt32();
			if (f[17])
				mID = LevelReader.ReadPopcapString(br);
			if (f[18])
				br.ReadInt32();
			if (f[19])
				mSound = br.ReadByte();
			if (f[21])
				mLogic = LevelReader.ReadPopcapString(br);
			if (f[23])
				mMaxBounceVelocity = br.ReadSingle();
			if (f[26])
				mSubID = br.ReadInt32();
			if (f[27])
				mFlipperFlags = br.ReadByte();
			if (f[2]) {
				mPegInfo = new PegInfo(this);
				mPegInfo.ReadData(br, version);				
			}
			if (f[3]) {
				mMovement = new Movement(mLevel);
				mMovement.ReadData(br, version);
			}

			if (f[30] && version >= 0x50)
				mShadow = f[30];
		}
Example #9
0
        public void ReadGenericData(BinaryReader br, int version)
        {
            FlagGroup f = new FlagGroup(br.ReadInt32());

            mCollision     = f[5];
            mVisible       = f[6];
            mCanMove       = f[7];
            mBackground    = f[14];
            mBaseObject    = f[15];
            mBallStopReset = f[20];
            mForeground    = f[22];
            mDrawSort      = f[24];
            mForeground2   = f[25];
            mDrawFloat     = f[28];

            if (f[0])
            {
                mRolly = br.ReadSingle();
            }
            if (f[1])
            {
                mBouncy = br.ReadSingle();
            }
            if (f[4])
            {
                br.ReadInt32();
            }
            if (f[8])
            {
                mSolidColour = Color.FromArgb(br.ReadInt32());
            }
            if (f[9])
            {
                mOutlineColour = Color.FromArgb(br.ReadInt32());
            }
            if (f[10])
            {
                mImageFilename = LevelReader.ReadPopcapString(br);
            }
            if (f[11])
            {
                mImageDX = br.ReadSingle();
            }
            if (f[12])
            {
                mImageDY = br.ReadSingle();
            }
            if (f[13])
            {
                mImageRotation = MathExt.ToDegrees(br.ReadSingle());
            }
            if (f[16])
            {
                br.ReadInt32();
            }
            if (f[17])
            {
                mID = LevelReader.ReadPopcapString(br);
            }
            if (f[18])
            {
                br.ReadInt32();
            }
            if (f[19])
            {
                mSound = br.ReadByte();
            }
            if (f[21])
            {
                mLogic = LevelReader.ReadPopcapString(br);
            }
            if (f[23])
            {
                mMaxBounceVelocity = br.ReadSingle();
            }
            if (f[26])
            {
                mSubID = br.ReadInt32();
            }
            if (f[27])
            {
                mFlipperFlags = br.ReadByte();
            }
            if (f[2])
            {
                mPegInfo = new PegInfo(this);
                mPegInfo.ReadData(br, version);
            }
            if (f[3])
            {
                mMovement = new Movement(mLevel);
                mMovement.ReadData(br, version);
            }

            if (f[30] && version >= 0x50)
            {
                mShadow = f[30];
            }
        }