public MotionInterp(PhysicsObj obj, WeenieObject wobj) { RawState = new RawMotionState(); InterpretedState = new InterpretedMotionState(); SetPhysicsObject(obj); SetWeenieObject(wobj); PendingMotions = new List <MotionNode>(); }
public void copy_movement_from(InterpretedMotionState state) { CurrentStyle = state.CurrentStyle; ForwardCommand = state.ForwardCommand; ForwardSpeed = state.ForwardSpeed; SideStepCommand = state.SideStepCommand; SideStepSpeed = state.SideStepSpeed; TurnCommand = state.TurnCommand; TurnSpeed = state.TurnSpeed; }
public void move_to_interpreted_state(InterpretedMotionState state) { if (MotionInterpreter == null) { MotionInterpreter = MotionInterp.Create(PhysicsObj, WeenieObj); if (PhysicsObj != null) { MotionInterpreter.enter_default_state(); } } MotionInterpreter.move_to_interpreted_state(state); }
public void enter_default_state() { RawState = new RawMotionState(); InterpretedState = new InterpretedMotionState(); PhysicsObj.InitializeMotionTables(); add_to_queue(0, 0x41000003, 0); // hardcoded default state? Initted = true; LeaveGround(); }
public void enter_default_state() { RawState = new RawMotionState(); InterpretedState = new InterpretedMotionState(); PhysicsObj.InitializeMotionTables(); PendingMotions = new LinkedList <MotionNode>(); // ?? add_to_queue(0, (uint)MotionCommand.Ready, 0); Initted = true; LeaveGround(); }
public bool move_to_interpreted_state(InterpretedMotionState state) { if (PhysicsObj == null) { return(false); } RawState.CurrentStyle = state.CurrentStyle; PhysicsObj.cancel_moveto(); var allowJump = motion_allows_jump(InterpretedState.ForwardCommand) == WeenieError.None ? true : false; InterpretedState.copy_movement_from(state); apply_current_movement(true, allowJump); var movementParams = new MovementParameters(); foreach (var action in state.Actions) { var currentStamp = action.Stamp & 0x7FFF; var serverStamp = ServerActionStamp & 0x7FFFF; var deltaStamp = Math.Abs(currentStamp - serverStamp); var diff = deltaStamp <= 0x3FFF ? serverStamp < currentStamp : currentStamp < serverStamp; if (diff) { if (WeenieObj != null && WeenieObj.IsCreature() || action.Autonomous) { ServerActionStamp = action.Stamp; movementParams.Speed = action.Speed; movementParams.Autonomous = action.Autonomous; DoInterpretedMotion(action.Action, movementParams); } } } return(true); }