예제 #1
0
 public virtual void Pmove(pmove_t pmove)
 {
     PMove.Pmove(pmove);
 }
예제 #2
0
 public void Pmove(pmove_t pmove)
 {
     PMove.Pmove(pmove);
 }
예제 #3
0
        public static void PredictMovement()
        {
            if (Globals.cls.state != Defines.ca_active)
            {
                return;
            }
            if (Globals.cl_paused.value != 0F)
            {
                return;
            }
            if (Globals.cl_predict.value == 0F || (Globals.cl.frame.playerstate.pmove.pm_flags & pmove_t.PMF_NO_PREDICTION) != 0)
            {
                for (int i = 0; i < 3; i++)
                {
                    Globals.cl.predicted_angles[i] = Globals.cl.viewangles[i] + Math3D.SHORT2ANGLE(Globals.cl.frame.playerstate.pmove.delta_angles[i]);
                }

                return;
            }

            int ack     = Globals.cls.netchan.incoming_acknowledged;
            int current = Globals.cls.netchan.outgoing_sequence;

            if (current - ack >= Defines.CMD_BACKUP)
            {
                if (Globals.cl_showmiss.value != 0F)
                {
                    Com.Printf("exceeded CMD_BACKUP\\n");
                }
                return;
            }

            pmove_t pm = new pmove_t();

            pm.trace               = new AnonymousTraceAdapter();
            pm.pointcontents       = new AnonymousPointContentsAdapter();
            PMove.pm_airaccelerate = Lib.Atof(Globals.cl.configstrings[Defines.CS_AIRACCEL]);
            pm.s.Set(Globals.cl.frame.playerstate.pmove);
            int       frame = 0;
            usercmd_t cmd;

            while (++ack < current)
            {
                frame = ack & (Defines.CMD_BACKUP - 1);
                cmd   = Globals.cl.cmds[frame];
                pm.cmd.Set(cmd);
                PMove.Pmove(pm);
                Math3D.VectorCopy(pm.s.origin, Globals.cl.predicted_origins[frame]);
            }

            int oldframe = (ack - 2) & (Defines.CMD_BACKUP - 1);
            int oldz     = Globals.cl.predicted_origins[oldframe][2];
            int step     = pm.s.origin[2] - oldz;

            if (step > 63 && step < 160 && (pm.s.pm_flags & pmove_t.PMF_ON_GROUND) != 0)
            {
                Globals.cl.predicted_step      = step * 0.125F;
                Globals.cl.predicted_step_time = (int)(Globals.cls.realtime - Globals.cls.frametime * 500);
            }

            Globals.cl.predicted_origin[0] = pm.s.origin[0] * 0.125F;
            Globals.cl.predicted_origin[1] = pm.s.origin[1] * 0.125F;
            Globals.cl.predicted_origin[2] = pm.s.origin[2] * 0.125F;
            Math3D.VectorCopy(pm.viewangles, Globals.cl.predicted_angles);
        }