Ejemplo n.º 1
0
 public MotionInterp(PhysicsObj obj, WeenieObject wobj)
 {
     RawState         = new RawMotionState();
     InterpretedState = new InterpretedMotionState();
     SetPhysicsObject(obj);
     SetWeenieObject(wobj);
     PendingMotions = new List <MotionNode>();
 }
Ejemplo n.º 2
0
 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;
 }
Ejemplo n.º 3
0
 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);
 }
Ejemplo n.º 4
0
        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();
        }
Ejemplo n.º 5
0
        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();
        }
Ejemplo n.º 6
0
        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);
        }