public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
		{
			if (value == null) {
				ILevelChild lc = context.Instance as ILevelChild;
				if (lc == null)
					return null;

				Movement movement = new Movement(lc.Level);

				ILocation location = context.Instance as ILocation;
				if (location != null) {
					movement.Location = location.Location;
				}

				return movement;
			} else {
				DialogResult result = MessageBox.Show("Do you want to delete this movement information?", "Delete Movement", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
				if (result == DialogResult.OK)
					return null;
				else
					return value;
			}
		}
示例#2
0
		public object Clone()
		{
			Movement cpyMovement = new Movement(mLevel);

			if (mBaseMovement != null)
				cpyMovement.mBaseMovement = (Movement)mBaseMovement.Clone();

			cpyMovement.mType = mType;
			cpyMovement.mReverse = mReverse;
			cpyMovement.mTimePeriod = mTimePeriod;
			cpyMovement.mRadius1 = mRadius1;
			cpyMovement.mRadius2 = mRadius2;
			cpyMovement.mStartPhase = mStartPhase;
			cpyMovement.mMoveRotation = mMoveRotation;
			cpyMovement.mAnchorPoint = mAnchorPoint;

			cpyMovement.mOffset = mOffset;
			cpyMovement.mPause1 = mPause1;
			cpyMovement.mPause2 = mPause2;
			cpyMovement.mPhase1 = mPhase1;
			cpyMovement.mPhase2 = mPhase2;
			cpyMovement.mPostDelayPhase = mPostDelayPhase;
			cpyMovement.mMaxAngle = mMaxAngle;
			cpyMovement.mUnknown8 = mUnknown8;
			cpyMovement.mRotation = mRotation;
			cpyMovement.mUnknown10 = mUnknown10;
			cpyMovement.mUnknown11 = mUnknown11;
			cpyMovement.mObjectX = mObjectX;
			cpyMovement.mObjectY = mObjectY;

			return cpyMovement;
		}
示例#3
0
		public void ReadData(BinaryReader br, int version)
		{
			int mlink = br.ReadInt32();
			if (mlink == 0)
				return;
			if (mlink != 1) {
				if (mLevel == null)
					mMovementLinkREQUIRED = mlink;
				else
					mMovementLink = GetMovementLink(mlink);
				return;
			}

			sbyte movementShape = br.ReadSByte();
			mType = (MovementType)Math.Abs(movementShape);
			if (movementShape < 0) {
				mReverse = true;
			}

			int type = (int)mType;
			if (mReverse)
				type = (256 - type);

			mAnchorPoint.X = br.ReadSingle();
			mAnchorPoint.Y = br.ReadSingle();

			mTimePeriod = br.ReadInt16();

			FlagGroup fA = new FlagGroup(br.ReadInt16());

			if (fA[0])
				mOffset = br.ReadInt16();
			if (fA[1])
				mRadius1 = br.ReadInt16();
			if (fA[2])
				mStartPhase = br.ReadSingle();
			if (fA[3])
				mMoveRotation = MathExt.ToDegrees(br.ReadSingle());
			if (fA[4])
				mRadius2 = br.ReadInt16();
			if (fA[5])
				mPause1 = br.ReadInt16();
			if (fA[6])
				mPause2 = br.ReadInt16();
			if (fA[7])
				mPhase1 = br.ReadByte();
			if (fA[8])
				mPhase2 = br.ReadByte();
			if (fA[9])
				mPostDelayPhase = br.ReadSingle();
			if (fA[10])
				mMaxAngle = br.ReadSingle();
			if (fA[11])
				mUnknown8 = br.ReadSingle();
			if (fA[14])
				mRotation = MathExt.ToDegrees(br.ReadSingle());
			if (fA[12]) {
				mUnknown10 = br.ReadSingle();
				mUnknown11 = br.ReadSingle();
				//Another movement
				mBaseMovement = new Movement(mLevel);
				mBaseMovement.ReadData(br, version);
				//mBaseMovement = null;
			}
			if (fA[13]) {
				mObjectX = br.ReadSingle();
				mObjectY = br.ReadSingle();
			}
		}
示例#4
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];
		}