You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
41 lines
842 B
41 lines
842 B
//========= 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 ); |
|
}
|
|
|