source-engine/utils/xbox/makephx/util.cpp
FluorescentCIAAfricanAmerican 3bf9df6b27 1
2020-04-22 12:56:21 -04:00

42 lines
842 B
C++

//========= Copyright Valve Corporation, All rights reserved. ============//
#include "mathlib/mathlib.h"
#include "util.h"
#include "tier1/strtools.h"
void UTIL_StringToFloatArray( float *pVector, int count, const char *pString )
{
char *pstr, *pfront, tempString[128];
int j;
Q_strncpy( tempString, pString, sizeof(tempString) );
pstr = pfront = tempString;
for ( j = 0; j < count; j++ ) // lifted from pr_edict.c
{
pVector[j] = atof( pfront );
// skip any leading whitespace
while ( *pstr && *pstr <= ' ' )
pstr++;
// skip to next whitespace
while ( *pstr && *pstr > ' ' )
pstr++;
if (!*pstr)
break;
pstr++;
pfront = pstr;
}
for ( j++; j < count; j++ )
{
pVector[j] = 0;
}
}
void UTIL_StringToVector( float *pVector, const char *pString )
{
UTIL_StringToFloatArray( pVector, 3, pString );
}