Esempio n. 1
0
qboolean SV_StepDirection (edict_t *ent, float yaw, float dist)
{
	vec3_t		move, oldorigin;
	float		delta;
	
	ent->v.ideal_yaw = yaw;
	PF_changeyaw();
	
	yaw = yaw*Q_PI*2 / 360;
	move[0] = cosf(yaw)*dist;
	move[1] = sinf(yaw)*dist;
	move[2] = 0;

	VectorCopy (ent->v.origin, oldorigin);
	if (SV_movestep (ent, move, FALSE))
	{
		delta = ent->v.angles[YAW] - ent->v.ideal_yaw;
		if (delta > 45 && delta < 315)
		{		// not turned far enough, so don't take the step
			VectorCopy (oldorigin, ent->v.origin);
		}
		SV_LinkEdict (ent, TRUE);
		return TRUE;
	}
	SV_LinkEdict (ent, TRUE);
		
	return FALSE;
}
Esempio n. 2
0
qboolean SV_StepDirection (edict_t *ent, float yaw, float dist)
{
	vec3_t		move, oldorigin;
	float		delta;
	qboolean    set_trace_plane;
	
	ent->v.ideal_yaw = yaw;
	PF_changeyaw();
	
	yaw = yaw*M_PI*2 / 360;
	move[0] = cos(yaw)*dist;
	move[1] = sin(yaw)*dist;
	move[2] = 0;//FIXME: Make wallcrawlers and flying monsters use this!

	VectorCopy (ent->v.origin, oldorigin);
	if((int)ent->v.flags & FL_SET_TRACE)
		set_trace_plane = true;
	else
		set_trace_plane = false;

	if (SV_movestep (ent, move, false, false, set_trace_plane))
	{
		delta = ent->v.angles[YAW] - ent->v.ideal_yaw;
		if (delta > 45 && delta < 315)
		{		// not turned far enough, so don't take the step
			VectorCopy (oldorigin, ent->v.origin);
		}
		SV_LinkEdict (ent, true);
		return true;
	}
	SV_LinkEdict (ent, true);
		
	return false;
}