MoveStep() public static method

SV_movestep Called by monster program code. The move will be adjusted for slopes and stairs, but if the move isn't possible, no move is done, false is returned, and pr_global_struct.trace_normal is set to the normal of the blocking wall
public static MoveStep ( edict_t ent, v3f &move, bool relink ) : bool
ent edict_t
move v3f
relink bool
return bool
Example #1
0
        /// <summary>
        /// PF_walkmove
        /// float(float yaw, float dist) walkmove
        /// </summary>
        static void PF_walkmove()
        {
            edict_t ent  = Server.ProgToEdict(Progs.GlobalStruct.self);
            float   yaw  = GetFloat(OFS.OFS_PARM0);
            float   dist = GetFloat(OFS.OFS_PARM1);

            if (((int)ent.v.flags & (EdictFlags.FL_ONGROUND | EdictFlags.FL_FLY | EdictFlags.FL_SWIM)) == 0)
            {
                ReturnFloat(0);
                return;
            }

            yaw = (float)(yaw * Math.PI * 2.0 / 360.0);

            v3f move;

            move.x = (float)Math.Cos(yaw) * dist;
            move.y = (float)Math.Sin(yaw) * dist;
            move.z = 0;

            // save program state, because SV_movestep may call other progs
            dfunction_t oldf    = Progs.xFunction;
            int         oldself = Progs.GlobalStruct.self;

            ReturnFloat(Server.MoveStep(ent, ref move, true) ? 1 : 0);

            // restore program state
            Progs.xFunction         = oldf;
            Progs.GlobalStruct.self = oldself;
        }