mirror of
https://github.com/rehlds/metamod-r.git
synced 2024-12-28 15:45:37 +03:00
201 lines
5.8 KiB
C++
201 lines
5.8 KiB
C++
#include <extdll.h>
|
|
#include <meta_api.h>
|
|
|
|
DLL_FUNCTIONS g_DllFunctionTable =
|
|
{
|
|
NULL, // pfnGameInit
|
|
NULL, // pfnSpawn
|
|
NULL, // pfnThink
|
|
NULL, // pfnUse
|
|
NULL, // pfnTouch
|
|
NULL, // pfnBlocked
|
|
NULL, // pfnKeyValue
|
|
NULL, // pfnSave
|
|
NULL, // pfnRestore
|
|
NULL, // pfnSetAbsBox
|
|
NULL, // pfnSaveWriteFields
|
|
NULL, // pfnSaveReadFields
|
|
NULL, // pfnSaveGlobalState
|
|
NULL, // pfnRestoreGlobalState
|
|
NULL, // pfnResetGlobalState
|
|
NULL, // pfnClientConnect
|
|
NULL, // pfnClientDisconnect
|
|
NULL, // pfnClientKill
|
|
NULL, // pfnClientPutInServer
|
|
NULL, // pfnClientCommand
|
|
NULL, // pfnClientUserInfoChanged
|
|
NULL, // pfnServerActivate
|
|
NULL, // pfnServerDeactivate
|
|
NULL, // pfnPlayerPreThink
|
|
NULL, // pfnPlayerPostThink
|
|
NULL, // pfnStartFrame
|
|
NULL, // pfnParmsNewLevel
|
|
NULL, // pfnParmsChangeLevel
|
|
NULL, // pfnGetGameDescription
|
|
NULL, // pfnPlayerCustomization
|
|
NULL, // pfnSpectatorConnect
|
|
NULL, // pfnSpectatorDisconnect
|
|
NULL, // pfnSpectatorThink
|
|
NULL, // pfnSys_Error
|
|
NULL, // pfnPM_Move
|
|
NULL, // pfnPM_Init
|
|
NULL, // pfnPM_FindTextureType
|
|
NULL, // pfnSetupVisibility
|
|
NULL, // pfnUpdateClientData
|
|
NULL, // pfnAddToFullPack
|
|
NULL, // pfnCreateBaseline
|
|
NULL, // pfnRegisterEncoders
|
|
NULL, // pfnGetWeaponData
|
|
NULL, // pfnCmdStart
|
|
NULL, // pfnCmdEnd
|
|
NULL, // pfnConnectionlessPacket
|
|
NULL, // pfnGetHullBounds
|
|
NULL, // pfnCreateInstancedBaselines
|
|
NULL, // pfnInconsistentFile
|
|
NULL, // pfnAllowLagCompensation
|
|
};
|
|
|
|
DLL_FUNCTIONS g_DllFunctionTable_Post =
|
|
{
|
|
NULL, // pfnGameInit
|
|
NULL, // pfnSpawn
|
|
NULL, // pfnThink
|
|
NULL, // pfnUse
|
|
NULL, // pfnTouch
|
|
NULL, // pfnBlocked
|
|
NULL, // pfnKeyValue
|
|
NULL, // pfnSave
|
|
NULL, // pfnRestore
|
|
NULL, // pfnSetAbsBox
|
|
NULL, // pfnSaveWriteFields
|
|
NULL, // pfnSaveReadFields
|
|
NULL, // pfnSaveGlobalState
|
|
NULL, // pfnRestoreGlobalState
|
|
NULL, // pfnResetGlobalState
|
|
NULL, // pfnClientConnect
|
|
NULL, // pfnClientDisconnect
|
|
NULL, // pfnClientKill
|
|
NULL, // pfnClientPutInServer
|
|
NULL, // pfnClientCommand
|
|
NULL, // pfnClientUserInfoChanged
|
|
NULL, // pfnServerActivate
|
|
NULL, // pfnServerDeactivate
|
|
NULL, // pfnPlayerPreThink
|
|
NULL, // pfnPlayerPostThink
|
|
NULL, // pfnStartFrame
|
|
NULL, // pfnParmsNewLevel
|
|
NULL, // pfnParmsChangeLevel
|
|
NULL, // pfnGetGameDescription
|
|
NULL, // pfnPlayerCustomization
|
|
NULL, // pfnSpectatorConnect
|
|
NULL, // pfnSpectatorDisconnect
|
|
NULL, // pfnSpectatorThink
|
|
NULL, // pfnSys_Error
|
|
NULL, // pfnPM_Move
|
|
NULL, // pfnPM_Init
|
|
NULL, // pfnPM_FindTextureType
|
|
NULL, // pfnSetupVisibility
|
|
NULL, // pfnUpdateClientData
|
|
NULL, // pfnAddToFullPack
|
|
NULL, // pfnCreateBaseline
|
|
NULL, // pfnRegisterEncoders
|
|
NULL, // pfnGetWeaponData
|
|
NULL, // pfnCmdStart
|
|
NULL, // pfnCmdEnd
|
|
NULL, // pfnConnectionlessPacket
|
|
NULL, // pfnGetHullBounds
|
|
NULL, // pfnCreateInstancedBaselines
|
|
NULL, // pfnInconsistentFile
|
|
NULL, // pfnAllowLagCompensation
|
|
};
|
|
|
|
NEW_DLL_FUNCTIONS g_NewDllFunctionTable =
|
|
{
|
|
NULL, //! pfnOnFreeEntPrivateData() Called right before the object's memory is freed. Calls its destructor.
|
|
NULL, //! pfnGameShutdown()
|
|
NULL, //! pfnShouldCollide()
|
|
NULL, //! pfnCvarValue()
|
|
NULL, //! pfnCvarValue2()
|
|
};
|
|
|
|
NEW_DLL_FUNCTIONS g_NewDllFunctionTable_Post =
|
|
{
|
|
NULL, //! pfnOnFreeEntPrivateData() Called right before the object's memory is freed. Calls its destructor.
|
|
NULL, //! pfnGameShutdown()
|
|
NULL, //! pfnShouldCollide()
|
|
NULL, //! pfnCvarValue()
|
|
NULL, //! pfnCvarValue2()
|
|
};
|
|
|
|
C_DLLEXPORT int GetEntityAPI2(DLL_FUNCTIONS *pFunctionTable, int *interfaceVersion)
|
|
{
|
|
if (!pFunctionTable)
|
|
{
|
|
ALERT(at_logged, __FUNCTION__ " called with null pFunctionTable");
|
|
return FALSE;
|
|
}
|
|
if (*interfaceVersion != INTERFACE_VERSION)
|
|
{
|
|
ALERT(at_logged, __FUNCTION__ " version mismatch; requested=%d ours=%d", *interfaceVersion, INTERFACE_VERSION);
|
|
*interfaceVersion = INTERFACE_VERSION;
|
|
return FALSE;
|
|
}
|
|
|
|
memcpy(pFunctionTable, &g_DllFunctionTable, sizeof(DLL_FUNCTIONS));
|
|
return TRUE;
|
|
}
|
|
|
|
C_DLLEXPORT int GetEntityAPI2_Post(DLL_FUNCTIONS *pFunctionTable, int *interfaceVersion)
|
|
{
|
|
if (!pFunctionTable)
|
|
{
|
|
ALERT(at_logged, __FUNCTION__ " called with null pFunctionTable");
|
|
return FALSE;
|
|
}
|
|
if (*interfaceVersion != INTERFACE_VERSION)
|
|
{
|
|
ALERT(at_logged, __FUNCTION__ " version mismatch; requested=%d ours=%d", *interfaceVersion, INTERFACE_VERSION);
|
|
*interfaceVersion = INTERFACE_VERSION;
|
|
return FALSE;
|
|
}
|
|
|
|
memcpy(pFunctionTable, &g_DllFunctionTable_Post, sizeof(DLL_FUNCTIONS));
|
|
return TRUE;
|
|
}
|
|
|
|
C_DLLEXPORT int GetNewDLLFunctions(NEW_DLL_FUNCTIONS *pNewFunctionTable, int *interfaceVersion)
|
|
{
|
|
if (!pNewFunctionTable)
|
|
{
|
|
ALERT(at_logged, __FUNCTION__ " called with null pNewFunctionTable");
|
|
return FALSE;
|
|
}
|
|
if (*interfaceVersion != NEW_DLL_FUNCTIONS_VERSION)
|
|
{
|
|
ALERT(at_logged, __FUNCTION__ " version mismatch; requested=%d ours=%d", *interfaceVersion, NEW_DLL_FUNCTIONS_VERSION);
|
|
*interfaceVersion = NEW_DLL_FUNCTIONS_VERSION;
|
|
return FALSE;
|
|
}
|
|
|
|
memcpy(pNewFunctionTable, &g_NewDllFunctionTable, sizeof(NEW_DLL_FUNCTIONS));
|
|
return TRUE;
|
|
}
|
|
|
|
C_DLLEXPORT int GetNewDLLFunctions_Post(NEW_DLL_FUNCTIONS *pNewFunctionTable, int *interfaceVersion)
|
|
{
|
|
if (!pNewFunctionTable)
|
|
{
|
|
ALERT(at_logged, __FUNCTION__ " called with null pNewFunctionTable");
|
|
return FALSE;
|
|
}
|
|
if (*interfaceVersion != NEW_DLL_FUNCTIONS_VERSION)
|
|
{
|
|
ALERT(at_logged, __FUNCTION__ " version mismatch; requested=%d ours=%d", *interfaceVersion, NEW_DLL_FUNCTIONS_VERSION);
|
|
*interfaceVersion = NEW_DLL_FUNCTIONS_VERSION;
|
|
return FALSE;
|
|
}
|
|
|
|
memcpy(pNewFunctionTable, &g_NewDllFunctionTable_Post, sizeof(NEW_DLL_FUNCTIONS));
|
|
return TRUE;
|
|
}
|