added tiers, vstdlib

This commit is contained in:
Fisual
2022-06-15 19:04:06 +07:00
parent ee744a24c4
commit f248151331
104 changed files with 38642 additions and 36 deletions

View File

@@ -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