Exemple #1
0
void SV_MoveToOrigin( edict_t *ent, const vec3_t pflGoal, float dist, int iMoveType )
{
	vec3_t	vecDist;

	VectorCopy( pflGoal, vecDist );

	if( ent->v.flags & ( FL_FLY|FL_SWIM|FL_ONGROUND ))
	{
		if( iMoveType == MOVE_NORMAL )
		{
			if( SV_StepDirection( ent, ent->v.ideal_yaw, dist ) == 0 )
			{
				SV_NewChaseDir( ent, vecDist, dist );
			}
		}
		else
		{
			vecDist[0] -= ent->v.origin[0];
			vecDist[1] -= ent->v.origin[1];

			if( ent->v.flags & ( FL_FLY|FL_SWIM ))
				vecDist[2] -= ent->v.origin[2];
			else vecDist[2] = 0.0f;

			VectorNormalize( vecDist );
			VectorScale( vecDist, dist, vecDist );
			SV_FlyDirection( ent, vecDist );
		}
	}
}
HLDS_DLLEXPORT void SV_MoveToOrigin_I(edict_t *ent, const vec3_t pflGoal, float dist, int iMoveType) {

   vec3_t var_c_temp;


   var_c_temp[0] = pflGoal[0];
   var_c_temp[1] = pflGoal[1];
   var_c_temp[2] = pflGoal[2];

   if(ent->v.flags & (FL_FLY | FL_SWIM | FL_ONGROUND)) {
      if(iMoveType == MOVE_NORMAL) {

         if(SV_StepDirection(ent, ent->v.ideal_yaw, dist) == 0) {
            SV_NewChaseDir2(ent, var_c_temp, dist);
         }
      }
      else {

         var_c_temp[0] -= ent->v.origin[0];
         var_c_temp[1] -= ent->v.origin[1];

         if(ent->v.flags & (FL_FLY | FL_SWIM)) {
            var_c_temp[2] -= ent->v.origin[2];
         }
         else { //If on ground, I guess we just don't worry about the third axis.  Sorta makes sense.
            var_c_temp[2] = 0;
         }

         VectorNormalize(var_c_temp);
         VectorScale(var_c_temp, dist, var_c_temp);
         SV_FlyDirection(ent, var_c_temp);
      }
   }
}