public WeenieError StopMotion(uint motion, MovementParameters movementParams) { if (PhysicsObj == null) { return(WeenieError.NoPhysicsObject); } if (movementParams.CancelMoveTo) { PhysicsObj.cancel_moveto(); } var currentMotion = motion; var currentParams = new MovementParameters(); currentParams.CopySome(movementParams); adjust_motion(ref currentMotion, ref currentParams.Speed, movementParams.HoldKeyToApply); var result = StopInterpretedMotion(currentMotion, currentParams); if (result == WeenieError.None && movementParams.ModifyRawState) { RawState.RemoveMotion(motion); } return(result); }
public WeenieError DoMotion(uint motion, MovementParameters movementParams) { if (PhysicsObj == null) { return(WeenieError.NoPhysicsObject); } // movementparams ref? var currentParams = new MovementParameters(); currentParams.CopySome(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); }