2
0
mirror of https://github.com/FWGS/hlsdk-xash3d synced 2024-11-22 09:57:21 +01:00

Merge branch 'master' of https://github.com/FWGS/hlsdk-xash3d into sdk-update

This commit is contained in:
Night Owl 2017-07-11 02:14:45 +05:00
commit 7bba3a124a
3 changed files with 37 additions and 10 deletions

View File

@ -1584,6 +1584,33 @@ void UTIL_StripToken( const char *pKey, char *pDest )
//
// --------------------------------------------------------------
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(int), // FIELD_STRING
@ -1594,12 +1621,12 @@ static int gSizes[FIELD_TYPECOUNT] =
sizeof(int), // FIELD_EDICT
sizeof(float) * 3, // FIELD_VECTOR
sizeof(float) * 3, // FIELD_POSITION_VECTOR
sizeof(int *), // FIELD_POINTER
sizeof(void *), // FIELD_POINTER
sizeof(int), // FIELD_INTEGER
#ifdef GNUC
sizeof(int *) * 2, // FIELD_FUNCTION
sizeof(void *) * 2, // FIELD_FUNCTION
#else
sizeof(int *), // FIELD_FUNCTION
sizeof(void *), // FIELD_FUNCTION
#endif
sizeof(int), // FIELD_BOOLEAN
sizeof(short), // FIELD_SHORT
@ -1890,11 +1917,11 @@ void CSave::WriteFunction( const char *pname, void **data, int count )
{
const char *functionName;
functionName = NAME_FOR_FUNCTION( (size_t)*data );
functionName = NAME_FOR_FUNCTION( *data );
if( functionName )
BufferField( pname, strlen( functionName ) + 1, functionName );
else
ALERT( at_error, "Invalid function pointer in entity!" );
ALERT( at_error, "Invalid function pointer in entity!\n" );
}
void EntvarsKeyvalue( entvars_t *pev, KeyValueData *pkvd )
@ -2137,7 +2164,7 @@ int CRestore::ReadField( void *pBaseData, TYPEDESCRIPTION *pFields, int fieldCou
for( j = 0; j < pTest->fieldSize; j++ )
{
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 )
{
@ -2267,7 +2294,7 @@ int CRestore::ReadField( void *pBaseData, TYPEDESCRIPTION *pFields, int fieldCou
if( strlen( (char *)pInputData ) == 0 )
*( (void**)pOutputData ) = 0;
else
*( (void**)pOutputData ) = (void**)FUNCTION_FROM_NAME( (char *)pInputData );
*( (void**)pOutputData ) = (void*)FUNCTION_FROM_NAME( (char *)pInputData );
break;
default:
ALERT( at_error, "Bad field type\n" );

View File

@ -36,7 +36,7 @@ extern globalvars_t *gpGlobals;
// Use this instead of ALLOC_STRING on constant strings
#define STRING(offset) (const char *)(gpGlobals->pStringBase + (int)offset)
#if !defined __amd64__ || defined(CLIENT_DLL)
#if !defined(__amd64__) && !defined(__aarch64__) || defined(CLIENT_DLL)
#define MAKE_STRING(str) ((size_t)str - (size_t)STRING(0))
#else
#define MAKE_STRING ALLOC_STRING

View File

@ -172,8 +172,8 @@ typedef struct enginefuncs_s
int (*pfnRegUserMsg)( const char *pszName, int iSize );
void (*pfnAnimationAutomove)( const edict_t* pEdict, float flTime );
void (*pfnGetBonePosition)( const edict_t* pEdict, int iBone, float *rgflOrigin, float *rgflAngles );
size_t (*pfnFunctionFromName)( const char *pName );
const char *(*pfnNameForFunction)( size_t function );
void* (*pfnFunctionFromName)( const char *pName );
const char *(*pfnNameForFunction)( void *function );
void (*pfnClientPrintf)( edict_t* pEdict, PRINT_TYPE ptype, const char *szMsg ); // JOHN: engine callbacks so game DLL can print messages to individual clients
void (*pfnServerPrint)( const char *szMsg );
const char *(*pfnCmd_Args)( void ); // these 3 added