Exemple #1
0
        public WeenieError DoInterpretedMotion(uint motion, MovementParameters movementParams)
        {
            if (PhysicsObj == null)
            {
                return(WeenieError.NoPhysicsObject);
            }

            var result = WeenieError.None;

            if (contact_allows_move(motion))
            {
                if (StandingLongJump && (motion == (uint)MotionCommand.WalkForward || motion == (uint)MotionCommand.RunForward || motion == (uint)MotionCommand.SideStepRight))
                {
                    if (movementParams.ModifyInterpretedState)
                    {
                        InterpretedState.ApplyMotion(motion, movementParams);
                    }
                }
                else
                {
                    if (motion == (uint)MotionCommand.Dead)
                    {
                        PhysicsObj.RemoveLinkAnimations();
                    }

                    result = PhysicsObj.DoInterpretedMotion(motion, movementParams);

                    if (result == WeenieError.None)
                    {
                        var jump_error_code = WeenieError.None;

                        if (movementParams.DisableJumpDuringLink)
                        {
                            jump_error_code = WeenieError.YouCantJumpFromThisPosition;
                        }
                        else
                        {
                            jump_error_code = motion_allows_jump(motion);

                            if (jump_error_code == WeenieError.None && (motion & (uint)CommandMask.Action) == 0)
                            {
                                jump_error_code = motion_allows_jump(InterpretedState.ForwardCommand);
                            }
                        }

                        add_to_queue(movementParams.ContextID, motion, jump_error_code);

                        if (movementParams.ModifyInterpretedState)
                        {
                            InterpretedState.ApplyMotion(motion, movementParams);
                        }
                    }
                }
            }
            else
            {
                if ((motion & (uint)CommandMask.Action) != 0)
                {
                    result = WeenieError.YouCantJumpWhileInTheAir;
                }

                else
                {
                    if (movementParams.ModifyInterpretedState)
                    {
                        InterpretedState.ApplyMotion(motion, movementParams);
                    }

                    result = WeenieError.None;
                }
            }

            if (PhysicsObj.CurCell == null)
            {
                PhysicsObj.RemoveLinkAnimations();
            }

            return(result);
        }
Exemple #2
0
        public Sequence DoInterpretedMotion(uint motion, MovementParameters movementParams)
        {
            if (PhysicsObj == null)
            {
                return(new Sequence(8));
            }

            var sequence = new Sequence();

            if (contact_allows_move(motion))
            {
                if (StandingLongJump && (motion == 0x45000005 || motion == 0x44000007 || motion == 0x6500000F))
                {
                    if (movementParams.ModifyInterpretedState)
                    {
                        InterpretedState.ApplyMotion(motion, movementParams);
                    }
                }
                else
                {
                    if (motion == 0x40000011)
                    {
                        PhysicsObj.RemoveLinkAnimations();
                    }

                    sequence = PhysicsObj.DoInterpretedMotion(motion, movementParams);

                    if (sequence == null)
                    {
                        var jump_error_code = 0;

                        if (movementParams.DisableJumpDuringLink)
                        {
                            jump_error_code = 0x48;
                        }
                        else
                        {
                            jump_error_code = motion_allows_jump(motion);

                            if (jump_error_code == 0 && (motion & 0x10000000) != 0)
                            {
                                jump_error_code = motion_allows_jump(InterpretedState.ForwardCommand);
                            }
                        }

                        add_to_queue(movementParams.ContextID, motion, jump_error_code);

                        if (movementParams.ModifyInterpretedState)
                        {
                            InterpretedState.ApplyMotion(motion, movementParams);
                        }
                    }
                }
            }
            else
            {
                if ((motion & 0x10000000) != 0)
                {
                    sequence.ID = 0x24;
                }

                else if (movementParams.ModifyInterpretedState)
                {
                    InterpretedState.ApplyMotion(motion, movementParams);
                }
            }

            if (PhysicsObj != null && PhysicsObj.CurCell == null)
            {
                PhysicsObj.RemoveLinkAnimations();
            }

            return(sequence);
        }