Exemplo n.º 1
0
        public Sequence DoMotion(uint motion, MovementParameters movementParams)
        {
            if (PhysicsObj == null)
            {
                return(new Sequence(8));
            }

            if (movementParams.CancelMoveTo)
            {
                PhysicsObj.cancel_moveto();
            }

            if (movementParams.SetHoldKey)
            {
                SetHoldKey(movementParams.HoldKeyToApply, movementParams.CancelMoveTo);
            }

            var sequence = new Sequence();

            if (InterpretedState.CurrentStyle != 0x8000003D)
            {
                switch (motion)
                {
                case 0x41000012:
                    sequence.ID = 0x3F;
                    return(sequence);

                case 0x41000013:
                    sequence.ID = 0x40;
                    return(sequence);

                case 0x41000014:
                    sequence.ID = 0x41;
                    return(sequence);
                }

                if ((motion & 0x2000000) != 0)
                {
                    sequence.ID = 0x42;
                    return(sequence);
                }
            }

            if ((motion & 0x10000000) != 0)
            {
                if (InterpretedState.GetNumActions() >= 6)
                {
                    sequence.ID = 0x45;
                    return(sequence);
                }
            }
            var newMotion = DoInterpretedMotion(motion, movementParams);

            if (newMotion == null && movementParams.ModifyRawState)
            {
                RawState.ApplyMotion(motion, movementParams);
            }

            return(newMotion);
        }
Exemplo n.º 2
0
        public WeenieError DoMotion(uint motion, MovementParameters movementParams)
        {
            if (PhysicsObj == null)
            {
                return(WeenieError.NoPhysicsObject);
            }

            // movementparams ref?
            var currentParams = new MovementParameters(movementParams);
            var currentMotion = motion;

            if (movementParams.CancelMoveTo)
            {
                PhysicsObj.cancel_moveto();
            }

            if (movementParams.SetHoldKey)
            {
                SetHoldKey(movementParams.HoldKeyToApply, movementParams.CancelMoveTo);
            }

            adjust_motion(ref currentMotion, ref currentParams.Speed, movementParams.HoldKeyToApply);

            if (InterpretedState.CurrentStyle != (uint)MotionCommand.NonCombat)
            {
                switch (motion)
                {
                case (uint)MotionCommand.Crouch:
                    return(WeenieError.CantCrouchInCombat);

                case (uint)MotionCommand.Sitting:
                    return(WeenieError.CantSitInCombat);

                case (uint)MotionCommand.Sleeping:
                    return(WeenieError.CantLieDownInCombat);
                }

                if ((motion & (uint)CommandMask.ChatEmote) != 0)
                {
                    return(WeenieError.CantChatEmoteInCombat);
                }
            }

            if ((motion & (uint)CommandMask.Action) != 0)
            {
                if (InterpretedState.GetNumActions() >= 6)
                {
                    return(WeenieError.TooManyActions);
                }
            }
            var result = DoInterpretedMotion(currentMotion, currentParams);

            if (result == WeenieError.None && movementParams.ModifyRawState)
            {
                RawState.ApplyMotion(motion, movementParams);
            }

            return(result);
        }