Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- PF_walkmove
- float(float yaw, float dist) walkmove
- */
- void
- PF_walkmove(void)
- {
- edict_t *ent;
- float yaw, dist;
- vec3_t move;
- dfunction_t *oldf;
- int oldself;
- ent = PROG_TO_EDICT(pr_global_struct->self);
- yaw = G_FLOAT(OFS_PARM0);
- dist = G_FLOAT(OFS_PARM1);
- if(!((int)ent->v.flags & (FL_ONGROUND | FL_FLY | FL_SWIM))) {
- G_FLOAT(OFS_RETURN) = 0;
- return;
- }
- yaw = yaw * M_PI * 2 / 360;
- move[0] = cos(yaw) * dist;
- move[1] = sin(yaw) * dist;
- move[2] = 0;
- // save program state, because SV_movestep may call other progs
- oldf = pr_xfunction;
- oldself = pr_global_struct->self;
- G_FLOAT(OFS_RETURN) = SV_movestep(ent, move, true);
- // restore program state
- pr_xfunction = oldf;
- pr_global_struct->self = oldself;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement