mirror of
https://github.com/celisej567/cool-source-archive.git
synced 2026-09-21 20:10:15 +03:00
added tiers, vstdlib
This commit is contained in:
@@ -1957,6 +1957,44 @@ const char * V_UnqualifiedFileName( const char * in )
|
||||
return out;
|
||||
}
|
||||
|
||||
int V_StringToIntArray(int* pVector, int count, const char* pString)
|
||||
{
|
||||
char* pstr, * pfront, tempString[128];
|
||||
int j;
|
||||
|
||||
V_strncpy(tempString, pString, sizeof(tempString));
|
||||
pstr = pfront = tempString;
|
||||
|
||||
for (j = 0; j < count; j++) // lifted from pr_edict.c
|
||||
{
|
||||
pVector[j] = atoi(pfront);
|
||||
|
||||
while (*pstr && *pstr != ' ')
|
||||
pstr++;
|
||||
if (!*pstr)
|
||||
break;
|
||||
pstr++;
|
||||
pfront = pstr;
|
||||
}
|
||||
|
||||
int nFound = j + 1;
|
||||
|
||||
for (j++; j < count; j++)
|
||||
{
|
||||
pVector[j] = 0;
|
||||
}
|
||||
|
||||
return nFound;
|
||||
}
|
||||
void V_StringToColor32(color32* color, const char* pString)
|
||||
{
|
||||
int tmp[4];
|
||||
int nCount = V_StringToIntArray(tmp, 4, pString);
|
||||
color->r = tmp[0];
|
||||
color->g = tmp[1];
|
||||
color->b = tmp[2];
|
||||
color->a = (nCount == 4) ? tmp[3] : 255;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Composes a path and filename together, inserting a path separator
|
||||
|
||||
Reference in New Issue
Block a user