mirror of
https://github.com/YGGverse/hlsdk-portable.git
synced 2025-01-23 21:24:27 +00:00
Fix field sizes
This commit is contained in:
parent
3bce17e3a0
commit
9ebfc98177
@ -1584,6 +1584,33 @@ void UTIL_StripToken( const char *pKey, char *pDest )
|
|||||||
//
|
//
|
||||||
// --------------------------------------------------------------
|
// --------------------------------------------------------------
|
||||||
static int gSizes[FIELD_TYPECOUNT] =
|
static int gSizes[FIELD_TYPECOUNT] =
|
||||||
|
{
|
||||||
|
sizeof(float), // FIELD_FLOAT
|
||||||
|
sizeof(int), // FIELD_STRING
|
||||||
|
sizeof(void*), // FIELD_ENTITY
|
||||||
|
sizeof(void*), // FIELD_CLASSPTR
|
||||||
|
sizeof(void*), // FIELD_EHANDLE
|
||||||
|
sizeof(void*), // FIELD_entvars_t
|
||||||
|
sizeof(void*), // FIELD_EDICT
|
||||||
|
sizeof(float) * 3, // FIELD_VECTOR
|
||||||
|
sizeof(float) * 3, // FIELD_POSITION_VECTOR
|
||||||
|
sizeof(void *), // FIELD_POINTER
|
||||||
|
sizeof(int), // FIELD_INTEGER
|
||||||
|
#ifdef GNUC
|
||||||
|
sizeof(void *) * 2, // FIELD_FUNCTION
|
||||||
|
#else
|
||||||
|
sizeof(void *), // FIELD_FUNCTION
|
||||||
|
#endif
|
||||||
|
sizeof(int), // FIELD_BOOLEAN
|
||||||
|
sizeof(short), // FIELD_SHORT
|
||||||
|
sizeof(char), // FIELD_CHARACTER
|
||||||
|
sizeof(float), // FIELD_TIME
|
||||||
|
sizeof(int), // FIELD_MODELNAME
|
||||||
|
sizeof(int), // FIELD_SOUNDNAME
|
||||||
|
};
|
||||||
|
|
||||||
|
// entities has different store size
|
||||||
|
static int gInputSizes[FIELD_TYPECOUNT] =
|
||||||
{
|
{
|
||||||
sizeof(float), // FIELD_FLOAT
|
sizeof(float), // FIELD_FLOAT
|
||||||
sizeof(int), // FIELD_STRING
|
sizeof(int), // FIELD_STRING
|
||||||
@ -1594,12 +1621,12 @@ static int gSizes[FIELD_TYPECOUNT] =
|
|||||||
sizeof(int), // FIELD_EDICT
|
sizeof(int), // FIELD_EDICT
|
||||||
sizeof(float) * 3, // FIELD_VECTOR
|
sizeof(float) * 3, // FIELD_VECTOR
|
||||||
sizeof(float) * 3, // FIELD_POSITION_VECTOR
|
sizeof(float) * 3, // FIELD_POSITION_VECTOR
|
||||||
sizeof(int *), // FIELD_POINTER
|
sizeof(void *), // FIELD_POINTER
|
||||||
sizeof(int), // FIELD_INTEGER
|
sizeof(int), // FIELD_INTEGER
|
||||||
#ifdef GNUC
|
#ifdef GNUC
|
||||||
sizeof(int *) * 2, // FIELD_FUNCTION
|
sizeof(void *) * 2, // FIELD_FUNCTION
|
||||||
#else
|
#else
|
||||||
sizeof(int *), // FIELD_FUNCTION
|
sizeof(void *), // FIELD_FUNCTION
|
||||||
#endif
|
#endif
|
||||||
sizeof(int), // FIELD_BOOLEAN
|
sizeof(int), // FIELD_BOOLEAN
|
||||||
sizeof(short), // FIELD_SHORT
|
sizeof(short), // FIELD_SHORT
|
||||||
@ -2137,7 +2164,7 @@ int CRestore::ReadField( void *pBaseData, TYPEDESCRIPTION *pFields, int fieldCou
|
|||||||
for( j = 0; j < pTest->fieldSize; j++ )
|
for( j = 0; j < pTest->fieldSize; j++ )
|
||||||
{
|
{
|
||||||
void *pOutputData = ( (char *)pBaseData + pTest->fieldOffset + ( j * gSizes[pTest->fieldType] ) );
|
void *pOutputData = ( (char *)pBaseData + pTest->fieldOffset + ( j * gSizes[pTest->fieldType] ) );
|
||||||
void *pInputData = (char *)pData + j * gSizes[pTest->fieldType];
|
void *pInputData = (char *)pData + j * gInputSizes[pTest->fieldType];
|
||||||
|
|
||||||
switch( pTest->fieldType )
|
switch( pTest->fieldType )
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user