metamod/dllapi.cpp
branchB-work
changeset 170 7fee65f95eab
parent 158 02716ab98019
child 171 b29e03d3061b
     1.1 --- a/metamod/dllapi.cpp	Tue Aug 23 20:06:18 2005 +0000
     1.2 +++ b/metamod/dllapi.cpp	Thu Nov 24 00:27:02 2005 +0000
     1.3 @@ -331,6 +331,12 @@
     1.4  	RETURN_API_void();
     1.5  }
     1.6  
     1.7 +//Added 2005/11/22 (no SDK update)
     1.8 +void mm_CvarValue2(const edict_t *pEdict, int requestID, const char *cvarName, const char *value) {
     1.9 +	META_NEWAPI_HANDLE_void(FN_CVARVALUE2, pfnCvarValue2, (pEdict, requestID, cvarName, value));
    1.10 +	RETURN_API_void();
    1.11 +}
    1.12 +
    1.13  // From SDK dlls/cbase.cpp:
    1.14  // "(wd)" indicates my comments on the functions
    1.15  static DLL_FUNCTIONS gFunctionTable = 
    1.16 @@ -469,11 +475,6 @@
    1.17  C_DLLEXPORT int GetNewDLLFunctions(NEW_DLL_FUNCTIONS *pNewFunctionTable, int *interfaceVersion) 
    1.18  {
    1.19  	META_DEBUG(6, ("called: GetNewDLLFunctions; version=%d", *interfaceVersion));
    1.20 -	// Don't provide these functions to engine if gamedll doesn't provide
    1.21 -	// them.  Otherwise, we're in the position of having to provide answers
    1.22 -	// we can't necessarily provide (for instance, ShouldCollide())...
    1.23 -	if(!GameDLL.funcs.newapi_table)
    1.24 -		return(FALSE);
    1.25  
    1.26  	if(!pNewFunctionTable) {
    1.27  		META_ERROR("GetNewDLLFunctions called with null pNewFunctionTable");
    1.28 @@ -486,10 +487,16 @@
    1.29  		return(FALSE);
    1.30  	}
    1.31  	
    1.32 -	// Detect old engine
    1.33 -	if (!IS_VALID_PTR((void *)g_engfuncs.pfnQueryClientCvarValue))
    1.34 -		memcpy(pNewFunctionTable, &gNewFunctionTable, sizeof(NEW_DLL_FUNCTIONS) - sizeof(FN_CVARVALUE));
    1.35 -	else
    1.36 +	// Detect old engines
    1.37 +	if (!IS_VALID_PTR((void *)g_engfuncs.pfnQueryClientCvarValue2))
    1.38 +	{
    1.39 +		if (!IS_VALID_PTR((void *)g_engfuncs.pfnQueryClientCvarValue))
    1.40 +			memcpy(pNewFunctionTable, &gNewFunctionTable, sizeof(NEW_DLL_FUNCTIONS) - sizeof(FN_CVARVALUE) - sizeof(FN_CVARVALUE2));
    1.41 +		else
    1.42 +			memcpy(pNewFunctionTable, &gNewFunctionTable, sizeof(NEW_DLL_FUNCTIONS) - sizeof(FN_CVARVALUE2));
    1.43 +	} else {
    1.44          memcpy(pNewFunctionTable, &gNewFunctionTable, sizeof(NEW_DLL_FUNCTIONS));
    1.45 +	}
    1.46 +
    1.47  	return(TRUE);
    1.48  }