diff --git a/dlls/csstats2/csstats/amxxmodule.cpp b/dlls/csstats2/csstats/amxxmodule.cpp index 4b4d9ae3..88a48c5a 100755 --- a/dlls/csstats2/csstats/amxxmodule.cpp +++ b/dlls/csstats2/csstats/amxxmodule.cpp @@ -2479,7 +2479,9 @@ PFN_REGISTER_SPFORWARD_BYNAME g_fn_RegisterSPForwardByName; PFN_UNREGISTER_SPFORWARD g_fn_UnregisterSPForward; PFN_MERGEDEFINITION_FILE g_fn_MergeDefinition_File; PFN_AMX_FINDNATIVE g_fn_AmxFindNative; -PFN_GETPLAYERFLAGS g_fn_GetPlayerFlags; +PFN_GETPLAYERFLAGS g_fn_GetPlayerFlags; +PFN_GET_PLAYER_EDICT g_fn_GetPlayerEdict; +PFN_FORMAT g_fn_Format; // *** Exports *** C_DLLEXPORT int AMXX_Query(int *interfaceVersion, amxx_module_info_s *moduleInfo) @@ -2524,6 +2526,7 @@ C_DLLEXPORT int AMXX_Attach(PFN_REQ_FNPTR reqFnptrFunc) REQFUNC("GetModname", g_fn_GetModname, PFN_GET_MODNAME); REQFUNC("Log", g_fn_Log, PFN_LOG); REQFUNC("MergeDefinitionFile", g_fn_MergeDefinition_File, PFN_MERGEDEFINITION_FILE); + REQFUNC("Format", g_fn_Format, PFN_FORMAT); // Amx scripts REQFUNC("GetAmxScript", g_fn_GetAmxScript, PFN_GET_AMXSCRIPT); @@ -2579,6 +2582,7 @@ C_DLLEXPORT int AMXX_Attach(PFN_REQ_FNPTR reqFnptrFunc) REQFUNC("GetPlayerArmor", g_fn_GetPlayerArmor, PFN_GET_PLAYER_ARMOR); REQFUNC("GetPlayerHealth", g_fn_GetPlayerHealth, PFN_GET_PLAYER_HEALTH); REQFUNC("GetPlayerFlags", g_fn_GetPlayerFlags, PFN_GETPLAYERFLAGS); + REQFUNC("GetPlayerEdict", g_fn_GetPlayerEdict, PFN_GET_PLAYER_EDICT); // Memory REQFUNC_OPT("Allocator", g_fn_Allocator, PFN_ALLOCATOR); @@ -2673,16 +2677,17 @@ void ValidateMacros_DontCallThis_Smiley() MF_AmxExecv(0, 0, 0, 0, 0); MF_AmxFindPublic(0, 0, 0); MF_AmxAllot(0, 0, 0, 0); - MF_LoadAmxScript(0, 0, 0, 0); + MF_LoadAmxScript(0, 0, 0, 0, 0); MF_UnloadAmxScript(0, 0); MF_RegisterSPForward(0, 0, 0, 0, 0, 0); MF_RegisterSPForwardByName(0, 0, 0, 0, 0, 0); MF_UnregisterSPForward(0); + MF_GetPlayerFrags(0); + MF_GetPlayerEdict(0); + MF_Format("", 4, "str"); } #endif -#ifdef MEMORY_TEST - /************* MEMORY *************/ // undef all defined macros #undef new @@ -2796,7 +2801,7 @@ void *operator new(size_t reportedSize) return ptr; // allocation failed - throw std::bad_alloc(); + return NULL; } void *operator new[](size_t reportedSize) @@ -2809,7 +2814,7 @@ void *operator new[](size_t reportedSize) return ptr; // allocation failed - throw std::bad_alloc(); + return NULL; } // Microsoft memory tracking operators @@ -2823,7 +2828,7 @@ void *operator new(size_t reportedSize, const char *sourceFile, int sourceLine) return ptr; // allocation failed - throw std::bad_alloc(); + return NULL; } void *operator new[](size_t reportedSize, const char *sourceFile, int sourceLine) { @@ -2835,7 +2840,7 @@ void *operator new[](size_t reportedSize, const char *sourceFile, int sourceLine return ptr; // allocation failed - throw std::bad_alloc(); + return NULL; } void operator delete(void *reportedAddress) @@ -2854,8 +2859,6 @@ void operator delete[](void *reportedAddress) Mem_Deallocator(g_Mem_CurrentFilename, g_Mem_CurrentLine, g_Mem_CurrentFunc, m_alloc_delete_array, reportedAddress); } -#endif //MEMORY_TEST - /************* stuff from dlls/util.cpp *************/ // must come here because cbase.h declares it's own operator new diff --git a/dlls/csstats2/csstats/amxxmodule.h b/dlls/csstats2/csstats/amxxmodule.h index c3d0eb42..0d44ad13 100755 --- a/dlls/csstats2/csstats/amxxmodule.h +++ b/dlls/csstats2/csstats/amxxmodule.h @@ -1944,6 +1944,12 @@ typedef int (*PFN_IS_PLAYER_CONNECTING) (int /*id*/); typedef int (*PFN_IS_PLAYER_HLTV) (int /*id*/); typedef int (*PFN_GET_PLAYER_ARMOR) (int /*id*/); typedef int (*PFN_GET_PLAYER_HEALTH) (int /*id*/); +#ifdef USE_METAMOD +typedef edict_t * (*PFN_GET_PLAYER_EDICT) (int /*id*/); +#else +typedef void * (*PFN_GET_PLAYER_EDICT) (int /*id*/); +#endif + typedef void * (*PFN_ALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/, const unsigned int /*type*/, const size_t /*size*/); typedef void * (*PFN_REALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/, @@ -1963,6 +1969,7 @@ typedef int (*PFN_REGISTER_SPFORWARD) (AMX * /*amx*/, int /*func*/, ... /*pa typedef int (*PFN_REGISTER_SPFORWARD_BYNAME) (AMX * /*amx*/, const char * /*funcName*/, ... /*params*/); typedef void (*PFN_UNREGISTER_SPFORWARD) (int /*id*/); typedef void (*PFN_MERGEDEFINITION_FILE) (const char * /*filename*/); +typedef const char * (*PFN_FORMAT) (const char * /*fmt*/, ... /*params*/); extern PFN_ADD_NATIVES g_fn_AddNatives; extern PFN_BUILD_PATHNAME g_fn_BuildPathname; @@ -2017,6 +2024,8 @@ extern PFN_UNREGISTER_SPFORWARD g_fn_UnregisterSPForward; extern PFN_MERGEDEFINITION_FILE g_fn_MergeDefinition_File; extern PFN_AMX_FINDNATIVE g_fn_AmxFindNative; extern PFN_GETPLAYERFLAGS g_fn_GetPlayerFlags; +extern PFN_GET_PLAYER_EDICT g_fn_GetPlayerEdict; +extern PFN_FORMAT g_fn_Format; #ifdef MAY_NEVER_BE_DEFINED // Function prototypes for intellisense and similar systems @@ -2066,6 +2075,8 @@ int MF_RegisterSPForwardByName (AMX * amx, const char *str, ...) { } int MF_RegisterSPForward (AMX * amx, int func, ...) { } void MF_UnregisterSPForward (int id) { } int MF_GetPlayerFlags (int id) { } +edict_t* MF_GetPlayerEdict (int id) { } +const char * MF_Format (const char *fmt, ...) { } #endif // MAY_NEVER_BE_DEFINED #define MF_AddNatives g_fn_AddNatives @@ -2121,8 +2132,8 @@ void MF_Log(const char *fmt, ...); #define MF_RegisterSPForward g_fn_RegisterSPForward #define MF_UnregisterSPForward g_fn_UnregisterSPForward #define MF_GetPlayerFlags g_fn_GetPlayerFlags - -#ifdef MEMORY_TEST +#define MF_GetPlayerEdict g_fn_GetPlayerEdict +#define MF_Format g_fn_Format; /*** Memory ***/ void *operator new(size_t reportedSize); @@ -2167,6 +2178,4 @@ void Mem_Deallocator(const char *sourceFile, const unsigned int sourceLine, cons #define realloc(ptr,sz) Mem_Reallocator(__FILE__,__LINE__,__FUNCTION__,m_alloc_realloc,sz,ptr) #define free(ptr) Mem_Deallocator(__FILE__,__LINE__,__FUNCTION__,m_alloc_free,ptr) -#endif //MEMORY_TEST - #endif // #ifndef __AMXXMODULE_H__ diff --git a/dlls/cstrike/amxxmodule.cpp b/dlls/cstrike/amxxmodule.cpp index 4b4d9ae3..88a48c5a 100755 --- a/dlls/cstrike/amxxmodule.cpp +++ b/dlls/cstrike/amxxmodule.cpp @@ -2479,7 +2479,9 @@ PFN_REGISTER_SPFORWARD_BYNAME g_fn_RegisterSPForwardByName; PFN_UNREGISTER_SPFORWARD g_fn_UnregisterSPForward; PFN_MERGEDEFINITION_FILE g_fn_MergeDefinition_File; PFN_AMX_FINDNATIVE g_fn_AmxFindNative; -PFN_GETPLAYERFLAGS g_fn_GetPlayerFlags; +PFN_GETPLAYERFLAGS g_fn_GetPlayerFlags; +PFN_GET_PLAYER_EDICT g_fn_GetPlayerEdict; +PFN_FORMAT g_fn_Format; // *** Exports *** C_DLLEXPORT int AMXX_Query(int *interfaceVersion, amxx_module_info_s *moduleInfo) @@ -2524,6 +2526,7 @@ C_DLLEXPORT int AMXX_Attach(PFN_REQ_FNPTR reqFnptrFunc) REQFUNC("GetModname", g_fn_GetModname, PFN_GET_MODNAME); REQFUNC("Log", g_fn_Log, PFN_LOG); REQFUNC("MergeDefinitionFile", g_fn_MergeDefinition_File, PFN_MERGEDEFINITION_FILE); + REQFUNC("Format", g_fn_Format, PFN_FORMAT); // Amx scripts REQFUNC("GetAmxScript", g_fn_GetAmxScript, PFN_GET_AMXSCRIPT); @@ -2579,6 +2582,7 @@ C_DLLEXPORT int AMXX_Attach(PFN_REQ_FNPTR reqFnptrFunc) REQFUNC("GetPlayerArmor", g_fn_GetPlayerArmor, PFN_GET_PLAYER_ARMOR); REQFUNC("GetPlayerHealth", g_fn_GetPlayerHealth, PFN_GET_PLAYER_HEALTH); REQFUNC("GetPlayerFlags", g_fn_GetPlayerFlags, PFN_GETPLAYERFLAGS); + REQFUNC("GetPlayerEdict", g_fn_GetPlayerEdict, PFN_GET_PLAYER_EDICT); // Memory REQFUNC_OPT("Allocator", g_fn_Allocator, PFN_ALLOCATOR); @@ -2673,16 +2677,17 @@ void ValidateMacros_DontCallThis_Smiley() MF_AmxExecv(0, 0, 0, 0, 0); MF_AmxFindPublic(0, 0, 0); MF_AmxAllot(0, 0, 0, 0); - MF_LoadAmxScript(0, 0, 0, 0); + MF_LoadAmxScript(0, 0, 0, 0, 0); MF_UnloadAmxScript(0, 0); MF_RegisterSPForward(0, 0, 0, 0, 0, 0); MF_RegisterSPForwardByName(0, 0, 0, 0, 0, 0); MF_UnregisterSPForward(0); + MF_GetPlayerFrags(0); + MF_GetPlayerEdict(0); + MF_Format("", 4, "str"); } #endif -#ifdef MEMORY_TEST - /************* MEMORY *************/ // undef all defined macros #undef new @@ -2796,7 +2801,7 @@ void *operator new(size_t reportedSize) return ptr; // allocation failed - throw std::bad_alloc(); + return NULL; } void *operator new[](size_t reportedSize) @@ -2809,7 +2814,7 @@ void *operator new[](size_t reportedSize) return ptr; // allocation failed - throw std::bad_alloc(); + return NULL; } // Microsoft memory tracking operators @@ -2823,7 +2828,7 @@ void *operator new(size_t reportedSize, const char *sourceFile, int sourceLine) return ptr; // allocation failed - throw std::bad_alloc(); + return NULL; } void *operator new[](size_t reportedSize, const char *sourceFile, int sourceLine) { @@ -2835,7 +2840,7 @@ void *operator new[](size_t reportedSize, const char *sourceFile, int sourceLine return ptr; // allocation failed - throw std::bad_alloc(); + return NULL; } void operator delete(void *reportedAddress) @@ -2854,8 +2859,6 @@ void operator delete[](void *reportedAddress) Mem_Deallocator(g_Mem_CurrentFilename, g_Mem_CurrentLine, g_Mem_CurrentFunc, m_alloc_delete_array, reportedAddress); } -#endif //MEMORY_TEST - /************* stuff from dlls/util.cpp *************/ // must come here because cbase.h declares it's own operator new diff --git a/dlls/cstrike/amxxmodule.h b/dlls/cstrike/amxxmodule.h index c6e95585..0d44ad13 100755 --- a/dlls/cstrike/amxxmodule.h +++ b/dlls/cstrike/amxxmodule.h @@ -1944,6 +1944,12 @@ typedef int (*PFN_IS_PLAYER_CONNECTING) (int /*id*/); typedef int (*PFN_IS_PLAYER_HLTV) (int /*id*/); typedef int (*PFN_GET_PLAYER_ARMOR) (int /*id*/); typedef int (*PFN_GET_PLAYER_HEALTH) (int /*id*/); +#ifdef USE_METAMOD +typedef edict_t * (*PFN_GET_PLAYER_EDICT) (int /*id*/); +#else +typedef void * (*PFN_GET_PLAYER_EDICT) (int /*id*/); +#endif + typedef void * (*PFN_ALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/, const unsigned int /*type*/, const size_t /*size*/); typedef void * (*PFN_REALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/, @@ -1955,7 +1961,7 @@ typedef int (*PFN_AMX_EXECV) (AMX* /*amx*/, cell* /*return val*/, int /*in typedef int (*PFN_AMX_ALLOT) (AMX* /*amx*/, int /*length*/, cell* /*amx_addr*/, cell** /*phys_addr*/); typedef int (*PFN_AMX_FINDPUBLIC) (AMX* /*amx*/, char* /*func name*/, int* /*index*/); typedef int (*PFN_AMX_FINDNATIVE) (AMX* /*amx*/, char* /*func name*/, int* /*index*/); -typedef int (*PFN_LOAD_AMXSCRIPT) (AMX* /*amx*/, void** /*code*/, const char* /*path*/, char[64] /*error info*/); +typedef int (*PFN_LOAD_AMXSCRIPT) (AMX* /*amx*/, void** /*code*/, const char* /*path*/, char[64] /*error info*/, int /* debug */); typedef int (*PFN_UNLOAD_AMXSCRIPT) (AMX* /*amx*/,void** /*code*/); typedef cell (*PFN_REAL_TO_CELL) (REAL /*x*/); typedef REAL (*PFN_CELL_TO_REAL) (cell /*x*/); @@ -1963,6 +1969,7 @@ typedef int (*PFN_REGISTER_SPFORWARD) (AMX * /*amx*/, int /*func*/, ... /*pa typedef int (*PFN_REGISTER_SPFORWARD_BYNAME) (AMX * /*amx*/, const char * /*funcName*/, ... /*params*/); typedef void (*PFN_UNREGISTER_SPFORWARD) (int /*id*/); typedef void (*PFN_MERGEDEFINITION_FILE) (const char * /*filename*/); +typedef const char * (*PFN_FORMAT) (const char * /*fmt*/, ... /*params*/); extern PFN_ADD_NATIVES g_fn_AddNatives; extern PFN_BUILD_PATHNAME g_fn_BuildPathname; @@ -2017,6 +2024,8 @@ extern PFN_UNREGISTER_SPFORWARD g_fn_UnregisterSPForward; extern PFN_MERGEDEFINITION_FILE g_fn_MergeDefinition_File; extern PFN_AMX_FINDNATIVE g_fn_AmxFindNative; extern PFN_GETPLAYERFLAGS g_fn_GetPlayerFlags; +extern PFN_GET_PLAYER_EDICT g_fn_GetPlayerEdict; +extern PFN_FORMAT g_fn_Format; #ifdef MAY_NEVER_BE_DEFINED // Function prototypes for intellisense and similar systems @@ -2066,6 +2075,8 @@ int MF_RegisterSPForwardByName (AMX * amx, const char *str, ...) { } int MF_RegisterSPForward (AMX * amx, int func, ...) { } void MF_UnregisterSPForward (int id) { } int MF_GetPlayerFlags (int id) { } +edict_t* MF_GetPlayerEdict (int id) { } +const char * MF_Format (const char *fmt, ...) { } #endif // MAY_NEVER_BE_DEFINED #define MF_AddNatives g_fn_AddNatives @@ -2121,8 +2132,8 @@ void MF_Log(const char *fmt, ...); #define MF_RegisterSPForward g_fn_RegisterSPForward #define MF_UnregisterSPForward g_fn_UnregisterSPForward #define MF_GetPlayerFlags g_fn_GetPlayerFlags - -#ifdef MEMORY_TEST +#define MF_GetPlayerEdict g_fn_GetPlayerEdict +#define MF_Format g_fn_Format; /*** Memory ***/ void *operator new(size_t reportedSize); @@ -2167,6 +2178,4 @@ void Mem_Deallocator(const char *sourceFile, const unsigned int sourceLine, cons #define realloc(ptr,sz) Mem_Reallocator(__FILE__,__LINE__,__FUNCTION__,m_alloc_realloc,sz,ptr) #define free(ptr) Mem_Deallocator(__FILE__,__LINE__,__FUNCTION__,m_alloc_free,ptr) -#endif //MEMORY_TEST - #endif // #ifndef __AMXXMODULE_H__ diff --git a/dlls/dod2/dodfun/amxxmodule.cpp b/dlls/dod2/dodfun/amxxmodule.cpp index 4b4d9ae3..88a48c5a 100755 --- a/dlls/dod2/dodfun/amxxmodule.cpp +++ b/dlls/dod2/dodfun/amxxmodule.cpp @@ -2479,7 +2479,9 @@ PFN_REGISTER_SPFORWARD_BYNAME g_fn_RegisterSPForwardByName; PFN_UNREGISTER_SPFORWARD g_fn_UnregisterSPForward; PFN_MERGEDEFINITION_FILE g_fn_MergeDefinition_File; PFN_AMX_FINDNATIVE g_fn_AmxFindNative; -PFN_GETPLAYERFLAGS g_fn_GetPlayerFlags; +PFN_GETPLAYERFLAGS g_fn_GetPlayerFlags; +PFN_GET_PLAYER_EDICT g_fn_GetPlayerEdict; +PFN_FORMAT g_fn_Format; // *** Exports *** C_DLLEXPORT int AMXX_Query(int *interfaceVersion, amxx_module_info_s *moduleInfo) @@ -2524,6 +2526,7 @@ C_DLLEXPORT int AMXX_Attach(PFN_REQ_FNPTR reqFnptrFunc) REQFUNC("GetModname", g_fn_GetModname, PFN_GET_MODNAME); REQFUNC("Log", g_fn_Log, PFN_LOG); REQFUNC("MergeDefinitionFile", g_fn_MergeDefinition_File, PFN_MERGEDEFINITION_FILE); + REQFUNC("Format", g_fn_Format, PFN_FORMAT); // Amx scripts REQFUNC("GetAmxScript", g_fn_GetAmxScript, PFN_GET_AMXSCRIPT); @@ -2579,6 +2582,7 @@ C_DLLEXPORT int AMXX_Attach(PFN_REQ_FNPTR reqFnptrFunc) REQFUNC("GetPlayerArmor", g_fn_GetPlayerArmor, PFN_GET_PLAYER_ARMOR); REQFUNC("GetPlayerHealth", g_fn_GetPlayerHealth, PFN_GET_PLAYER_HEALTH); REQFUNC("GetPlayerFlags", g_fn_GetPlayerFlags, PFN_GETPLAYERFLAGS); + REQFUNC("GetPlayerEdict", g_fn_GetPlayerEdict, PFN_GET_PLAYER_EDICT); // Memory REQFUNC_OPT("Allocator", g_fn_Allocator, PFN_ALLOCATOR); @@ -2673,16 +2677,17 @@ void ValidateMacros_DontCallThis_Smiley() MF_AmxExecv(0, 0, 0, 0, 0); MF_AmxFindPublic(0, 0, 0); MF_AmxAllot(0, 0, 0, 0); - MF_LoadAmxScript(0, 0, 0, 0); + MF_LoadAmxScript(0, 0, 0, 0, 0); MF_UnloadAmxScript(0, 0); MF_RegisterSPForward(0, 0, 0, 0, 0, 0); MF_RegisterSPForwardByName(0, 0, 0, 0, 0, 0); MF_UnregisterSPForward(0); + MF_GetPlayerFrags(0); + MF_GetPlayerEdict(0); + MF_Format("", 4, "str"); } #endif -#ifdef MEMORY_TEST - /************* MEMORY *************/ // undef all defined macros #undef new @@ -2796,7 +2801,7 @@ void *operator new(size_t reportedSize) return ptr; // allocation failed - throw std::bad_alloc(); + return NULL; } void *operator new[](size_t reportedSize) @@ -2809,7 +2814,7 @@ void *operator new[](size_t reportedSize) return ptr; // allocation failed - throw std::bad_alloc(); + return NULL; } // Microsoft memory tracking operators @@ -2823,7 +2828,7 @@ void *operator new(size_t reportedSize, const char *sourceFile, int sourceLine) return ptr; // allocation failed - throw std::bad_alloc(); + return NULL; } void *operator new[](size_t reportedSize, const char *sourceFile, int sourceLine) { @@ -2835,7 +2840,7 @@ void *operator new[](size_t reportedSize, const char *sourceFile, int sourceLine return ptr; // allocation failed - throw std::bad_alloc(); + return NULL; } void operator delete(void *reportedAddress) @@ -2854,8 +2859,6 @@ void operator delete[](void *reportedAddress) Mem_Deallocator(g_Mem_CurrentFilename, g_Mem_CurrentLine, g_Mem_CurrentFunc, m_alloc_delete_array, reportedAddress); } -#endif //MEMORY_TEST - /************* stuff from dlls/util.cpp *************/ // must come here because cbase.h declares it's own operator new diff --git a/dlls/dod2/dodfun/amxxmodule.h b/dlls/dod2/dodfun/amxxmodule.h index c3d0eb42..0d44ad13 100755 --- a/dlls/dod2/dodfun/amxxmodule.h +++ b/dlls/dod2/dodfun/amxxmodule.h @@ -1944,6 +1944,12 @@ typedef int (*PFN_IS_PLAYER_CONNECTING) (int /*id*/); typedef int (*PFN_IS_PLAYER_HLTV) (int /*id*/); typedef int (*PFN_GET_PLAYER_ARMOR) (int /*id*/); typedef int (*PFN_GET_PLAYER_HEALTH) (int /*id*/); +#ifdef USE_METAMOD +typedef edict_t * (*PFN_GET_PLAYER_EDICT) (int /*id*/); +#else +typedef void * (*PFN_GET_PLAYER_EDICT) (int /*id*/); +#endif + typedef void * (*PFN_ALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/, const unsigned int /*type*/, const size_t /*size*/); typedef void * (*PFN_REALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/, @@ -1963,6 +1969,7 @@ typedef int (*PFN_REGISTER_SPFORWARD) (AMX * /*amx*/, int /*func*/, ... /*pa typedef int (*PFN_REGISTER_SPFORWARD_BYNAME) (AMX * /*amx*/, const char * /*funcName*/, ... /*params*/); typedef void (*PFN_UNREGISTER_SPFORWARD) (int /*id*/); typedef void (*PFN_MERGEDEFINITION_FILE) (const char * /*filename*/); +typedef const char * (*PFN_FORMAT) (const char * /*fmt*/, ... /*params*/); extern PFN_ADD_NATIVES g_fn_AddNatives; extern PFN_BUILD_PATHNAME g_fn_BuildPathname; @@ -2017,6 +2024,8 @@ extern PFN_UNREGISTER_SPFORWARD g_fn_UnregisterSPForward; extern PFN_MERGEDEFINITION_FILE g_fn_MergeDefinition_File; extern PFN_AMX_FINDNATIVE g_fn_AmxFindNative; extern PFN_GETPLAYERFLAGS g_fn_GetPlayerFlags; +extern PFN_GET_PLAYER_EDICT g_fn_GetPlayerEdict; +extern PFN_FORMAT g_fn_Format; #ifdef MAY_NEVER_BE_DEFINED // Function prototypes for intellisense and similar systems @@ -2066,6 +2075,8 @@ int MF_RegisterSPForwardByName (AMX * amx, const char *str, ...) { } int MF_RegisterSPForward (AMX * amx, int func, ...) { } void MF_UnregisterSPForward (int id) { } int MF_GetPlayerFlags (int id) { } +edict_t* MF_GetPlayerEdict (int id) { } +const char * MF_Format (const char *fmt, ...) { } #endif // MAY_NEVER_BE_DEFINED #define MF_AddNatives g_fn_AddNatives @@ -2121,8 +2132,8 @@ void MF_Log(const char *fmt, ...); #define MF_RegisterSPForward g_fn_RegisterSPForward #define MF_UnregisterSPForward g_fn_UnregisterSPForward #define MF_GetPlayerFlags g_fn_GetPlayerFlags - -#ifdef MEMORY_TEST +#define MF_GetPlayerEdict g_fn_GetPlayerEdict +#define MF_Format g_fn_Format; /*** Memory ***/ void *operator new(size_t reportedSize); @@ -2167,6 +2178,4 @@ void Mem_Deallocator(const char *sourceFile, const unsigned int sourceLine, cons #define realloc(ptr,sz) Mem_Reallocator(__FILE__,__LINE__,__FUNCTION__,m_alloc_realloc,sz,ptr) #define free(ptr) Mem_Deallocator(__FILE__,__LINE__,__FUNCTION__,m_alloc_free,ptr) -#endif //MEMORY_TEST - #endif // #ifndef __AMXXMODULE_H__ diff --git a/dlls/dod2/dodx/amxxmodule.cpp b/dlls/dod2/dodx/amxxmodule.cpp index 4b4d9ae3..88a48c5a 100755 --- a/dlls/dod2/dodx/amxxmodule.cpp +++ b/dlls/dod2/dodx/amxxmodule.cpp @@ -2479,7 +2479,9 @@ PFN_REGISTER_SPFORWARD_BYNAME g_fn_RegisterSPForwardByName; PFN_UNREGISTER_SPFORWARD g_fn_UnregisterSPForward; PFN_MERGEDEFINITION_FILE g_fn_MergeDefinition_File; PFN_AMX_FINDNATIVE g_fn_AmxFindNative; -PFN_GETPLAYERFLAGS g_fn_GetPlayerFlags; +PFN_GETPLAYERFLAGS g_fn_GetPlayerFlags; +PFN_GET_PLAYER_EDICT g_fn_GetPlayerEdict; +PFN_FORMAT g_fn_Format; // *** Exports *** C_DLLEXPORT int AMXX_Query(int *interfaceVersion, amxx_module_info_s *moduleInfo) @@ -2524,6 +2526,7 @@ C_DLLEXPORT int AMXX_Attach(PFN_REQ_FNPTR reqFnptrFunc) REQFUNC("GetModname", g_fn_GetModname, PFN_GET_MODNAME); REQFUNC("Log", g_fn_Log, PFN_LOG); REQFUNC("MergeDefinitionFile", g_fn_MergeDefinition_File, PFN_MERGEDEFINITION_FILE); + REQFUNC("Format", g_fn_Format, PFN_FORMAT); // Amx scripts REQFUNC("GetAmxScript", g_fn_GetAmxScript, PFN_GET_AMXSCRIPT); @@ -2579,6 +2582,7 @@ C_DLLEXPORT int AMXX_Attach(PFN_REQ_FNPTR reqFnptrFunc) REQFUNC("GetPlayerArmor", g_fn_GetPlayerArmor, PFN_GET_PLAYER_ARMOR); REQFUNC("GetPlayerHealth", g_fn_GetPlayerHealth, PFN_GET_PLAYER_HEALTH); REQFUNC("GetPlayerFlags", g_fn_GetPlayerFlags, PFN_GETPLAYERFLAGS); + REQFUNC("GetPlayerEdict", g_fn_GetPlayerEdict, PFN_GET_PLAYER_EDICT); // Memory REQFUNC_OPT("Allocator", g_fn_Allocator, PFN_ALLOCATOR); @@ -2673,16 +2677,17 @@ void ValidateMacros_DontCallThis_Smiley() MF_AmxExecv(0, 0, 0, 0, 0); MF_AmxFindPublic(0, 0, 0); MF_AmxAllot(0, 0, 0, 0); - MF_LoadAmxScript(0, 0, 0, 0); + MF_LoadAmxScript(0, 0, 0, 0, 0); MF_UnloadAmxScript(0, 0); MF_RegisterSPForward(0, 0, 0, 0, 0, 0); MF_RegisterSPForwardByName(0, 0, 0, 0, 0, 0); MF_UnregisterSPForward(0); + MF_GetPlayerFrags(0); + MF_GetPlayerEdict(0); + MF_Format("", 4, "str"); } #endif -#ifdef MEMORY_TEST - /************* MEMORY *************/ // undef all defined macros #undef new @@ -2796,7 +2801,7 @@ void *operator new(size_t reportedSize) return ptr; // allocation failed - throw std::bad_alloc(); + return NULL; } void *operator new[](size_t reportedSize) @@ -2809,7 +2814,7 @@ void *operator new[](size_t reportedSize) return ptr; // allocation failed - throw std::bad_alloc(); + return NULL; } // Microsoft memory tracking operators @@ -2823,7 +2828,7 @@ void *operator new(size_t reportedSize, const char *sourceFile, int sourceLine) return ptr; // allocation failed - throw std::bad_alloc(); + return NULL; } void *operator new[](size_t reportedSize, const char *sourceFile, int sourceLine) { @@ -2835,7 +2840,7 @@ void *operator new[](size_t reportedSize, const char *sourceFile, int sourceLine return ptr; // allocation failed - throw std::bad_alloc(); + return NULL; } void operator delete(void *reportedAddress) @@ -2854,8 +2859,6 @@ void operator delete[](void *reportedAddress) Mem_Deallocator(g_Mem_CurrentFilename, g_Mem_CurrentLine, g_Mem_CurrentFunc, m_alloc_delete_array, reportedAddress); } -#endif //MEMORY_TEST - /************* stuff from dlls/util.cpp *************/ // must come here because cbase.h declares it's own operator new diff --git a/dlls/dod2/dodx/amxxmodule.h b/dlls/dod2/dodx/amxxmodule.h index c3d0eb42..0d44ad13 100755 --- a/dlls/dod2/dodx/amxxmodule.h +++ b/dlls/dod2/dodx/amxxmodule.h @@ -1944,6 +1944,12 @@ typedef int (*PFN_IS_PLAYER_CONNECTING) (int /*id*/); typedef int (*PFN_IS_PLAYER_HLTV) (int /*id*/); typedef int (*PFN_GET_PLAYER_ARMOR) (int /*id*/); typedef int (*PFN_GET_PLAYER_HEALTH) (int /*id*/); +#ifdef USE_METAMOD +typedef edict_t * (*PFN_GET_PLAYER_EDICT) (int /*id*/); +#else +typedef void * (*PFN_GET_PLAYER_EDICT) (int /*id*/); +#endif + typedef void * (*PFN_ALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/, const unsigned int /*type*/, const size_t /*size*/); typedef void * (*PFN_REALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/, @@ -1963,6 +1969,7 @@ typedef int (*PFN_REGISTER_SPFORWARD) (AMX * /*amx*/, int /*func*/, ... /*pa typedef int (*PFN_REGISTER_SPFORWARD_BYNAME) (AMX * /*amx*/, const char * /*funcName*/, ... /*params*/); typedef void (*PFN_UNREGISTER_SPFORWARD) (int /*id*/); typedef void (*PFN_MERGEDEFINITION_FILE) (const char * /*filename*/); +typedef const char * (*PFN_FORMAT) (const char * /*fmt*/, ... /*params*/); extern PFN_ADD_NATIVES g_fn_AddNatives; extern PFN_BUILD_PATHNAME g_fn_BuildPathname; @@ -2017,6 +2024,8 @@ extern PFN_UNREGISTER_SPFORWARD g_fn_UnregisterSPForward; extern PFN_MERGEDEFINITION_FILE g_fn_MergeDefinition_File; extern PFN_AMX_FINDNATIVE g_fn_AmxFindNative; extern PFN_GETPLAYERFLAGS g_fn_GetPlayerFlags; +extern PFN_GET_PLAYER_EDICT g_fn_GetPlayerEdict; +extern PFN_FORMAT g_fn_Format; #ifdef MAY_NEVER_BE_DEFINED // Function prototypes for intellisense and similar systems @@ -2066,6 +2075,8 @@ int MF_RegisterSPForwardByName (AMX * amx, const char *str, ...) { } int MF_RegisterSPForward (AMX * amx, int func, ...) { } void MF_UnregisterSPForward (int id) { } int MF_GetPlayerFlags (int id) { } +edict_t* MF_GetPlayerEdict (int id) { } +const char * MF_Format (const char *fmt, ...) { } #endif // MAY_NEVER_BE_DEFINED #define MF_AddNatives g_fn_AddNatives @@ -2121,8 +2132,8 @@ void MF_Log(const char *fmt, ...); #define MF_RegisterSPForward g_fn_RegisterSPForward #define MF_UnregisterSPForward g_fn_UnregisterSPForward #define MF_GetPlayerFlags g_fn_GetPlayerFlags - -#ifdef MEMORY_TEST +#define MF_GetPlayerEdict g_fn_GetPlayerEdict +#define MF_Format g_fn_Format; /*** Memory ***/ void *operator new(size_t reportedSize); @@ -2167,6 +2178,4 @@ void Mem_Deallocator(const char *sourceFile, const unsigned int sourceLine, cons #define realloc(ptr,sz) Mem_Reallocator(__FILE__,__LINE__,__FUNCTION__,m_alloc_realloc,sz,ptr) #define free(ptr) Mem_Deallocator(__FILE__,__LINE__,__FUNCTION__,m_alloc_free,ptr) -#endif //MEMORY_TEST - #endif // #ifndef __AMXXMODULE_H__ diff --git a/dlls/engine/amxxmodule.cpp b/dlls/engine/amxxmodule.cpp index 1a01d5cd..860b82af 100755 --- a/dlls/engine/amxxmodule.cpp +++ b/dlls/engine/amxxmodule.cpp @@ -2687,8 +2687,6 @@ void ValidateMacros_DontCallThis_Smiley() } #endif -#ifdef MEMORY_TEST - /************* MEMORY *************/ // undef all defined macros #undef new @@ -2802,7 +2800,7 @@ void *operator new(size_t reportedSize) return ptr; // allocation failed - throw std::bad_alloc(); + return NULL; } void *operator new[](size_t reportedSize) @@ -2815,7 +2813,7 @@ void *operator new[](size_t reportedSize) return ptr; // allocation failed - throw std::bad_alloc(); + return NULL; } // Microsoft memory tracking operators @@ -2829,7 +2827,7 @@ void *operator new(size_t reportedSize, const char *sourceFile, int sourceLine) return ptr; // allocation failed - throw std::bad_alloc(); + return NULL; } void *operator new[](size_t reportedSize, const char *sourceFile, int sourceLine) { @@ -2841,7 +2839,7 @@ void *operator new[](size_t reportedSize, const char *sourceFile, int sourceLine return ptr; // allocation failed - throw std::bad_alloc(); + return NULL; } void operator delete(void *reportedAddress) @@ -2860,8 +2858,6 @@ void operator delete[](void *reportedAddress) Mem_Deallocator(g_Mem_CurrentFilename, g_Mem_CurrentLine, g_Mem_CurrentFunc, m_alloc_delete_array, reportedAddress); } -#endif //MEMORY_TEST - /************* stuff from dlls/util.cpp *************/ // must come here because cbase.h declares it's own operator new diff --git a/dlls/engine/amxxmodule.h b/dlls/engine/amxxmodule.h index c6e95585..d91f7695 100755 --- a/dlls/engine/amxxmodule.h +++ b/dlls/engine/amxxmodule.h @@ -2122,8 +2122,6 @@ void MF_Log(const char *fmt, ...); #define MF_UnregisterSPForward g_fn_UnregisterSPForward #define MF_GetPlayerFlags g_fn_GetPlayerFlags -#ifdef MEMORY_TEST - /*** Memory ***/ void *operator new(size_t reportedSize); void *operator new[](size_t reportedSize); @@ -2167,6 +2165,4 @@ void Mem_Deallocator(const char *sourceFile, const unsigned int sourceLine, cons #define realloc(ptr,sz) Mem_Reallocator(__FILE__,__LINE__,__FUNCTION__,m_alloc_realloc,sz,ptr) #define free(ptr) Mem_Deallocator(__FILE__,__LINE__,__FUNCTION__,m_alloc_free,ptr) -#endif //MEMORY_TEST - #endif // #ifndef __AMXXMODULE_H__ diff --git a/dlls/fun/amxxmodule.cpp b/dlls/fun/amxxmodule.cpp index 4b4d9ae3..88a48c5a 100755 --- a/dlls/fun/amxxmodule.cpp +++ b/dlls/fun/amxxmodule.cpp @@ -2479,7 +2479,9 @@ PFN_REGISTER_SPFORWARD_BYNAME g_fn_RegisterSPForwardByName; PFN_UNREGISTER_SPFORWARD g_fn_UnregisterSPForward; PFN_MERGEDEFINITION_FILE g_fn_MergeDefinition_File; PFN_AMX_FINDNATIVE g_fn_AmxFindNative; -PFN_GETPLAYERFLAGS g_fn_GetPlayerFlags; +PFN_GETPLAYERFLAGS g_fn_GetPlayerFlags; +PFN_GET_PLAYER_EDICT g_fn_GetPlayerEdict; +PFN_FORMAT g_fn_Format; // *** Exports *** C_DLLEXPORT int AMXX_Query(int *interfaceVersion, amxx_module_info_s *moduleInfo) @@ -2524,6 +2526,7 @@ C_DLLEXPORT int AMXX_Attach(PFN_REQ_FNPTR reqFnptrFunc) REQFUNC("GetModname", g_fn_GetModname, PFN_GET_MODNAME); REQFUNC("Log", g_fn_Log, PFN_LOG); REQFUNC("MergeDefinitionFile", g_fn_MergeDefinition_File, PFN_MERGEDEFINITION_FILE); + REQFUNC("Format", g_fn_Format, PFN_FORMAT); // Amx scripts REQFUNC("GetAmxScript", g_fn_GetAmxScript, PFN_GET_AMXSCRIPT); @@ -2579,6 +2582,7 @@ C_DLLEXPORT int AMXX_Attach(PFN_REQ_FNPTR reqFnptrFunc) REQFUNC("GetPlayerArmor", g_fn_GetPlayerArmor, PFN_GET_PLAYER_ARMOR); REQFUNC("GetPlayerHealth", g_fn_GetPlayerHealth, PFN_GET_PLAYER_HEALTH); REQFUNC("GetPlayerFlags", g_fn_GetPlayerFlags, PFN_GETPLAYERFLAGS); + REQFUNC("GetPlayerEdict", g_fn_GetPlayerEdict, PFN_GET_PLAYER_EDICT); // Memory REQFUNC_OPT("Allocator", g_fn_Allocator, PFN_ALLOCATOR); @@ -2673,16 +2677,17 @@ void ValidateMacros_DontCallThis_Smiley() MF_AmxExecv(0, 0, 0, 0, 0); MF_AmxFindPublic(0, 0, 0); MF_AmxAllot(0, 0, 0, 0); - MF_LoadAmxScript(0, 0, 0, 0); + MF_LoadAmxScript(0, 0, 0, 0, 0); MF_UnloadAmxScript(0, 0); MF_RegisterSPForward(0, 0, 0, 0, 0, 0); MF_RegisterSPForwardByName(0, 0, 0, 0, 0, 0); MF_UnregisterSPForward(0); + MF_GetPlayerFrags(0); + MF_GetPlayerEdict(0); + MF_Format("", 4, "str"); } #endif -#ifdef MEMORY_TEST - /************* MEMORY *************/ // undef all defined macros #undef new @@ -2796,7 +2801,7 @@ void *operator new(size_t reportedSize) return ptr; // allocation failed - throw std::bad_alloc(); + return NULL; } void *operator new[](size_t reportedSize) @@ -2809,7 +2814,7 @@ void *operator new[](size_t reportedSize) return ptr; // allocation failed - throw std::bad_alloc(); + return NULL; } // Microsoft memory tracking operators @@ -2823,7 +2828,7 @@ void *operator new(size_t reportedSize, const char *sourceFile, int sourceLine) return ptr; // allocation failed - throw std::bad_alloc(); + return NULL; } void *operator new[](size_t reportedSize, const char *sourceFile, int sourceLine) { @@ -2835,7 +2840,7 @@ void *operator new[](size_t reportedSize, const char *sourceFile, int sourceLine return ptr; // allocation failed - throw std::bad_alloc(); + return NULL; } void operator delete(void *reportedAddress) @@ -2854,8 +2859,6 @@ void operator delete[](void *reportedAddress) Mem_Deallocator(g_Mem_CurrentFilename, g_Mem_CurrentLine, g_Mem_CurrentFunc, m_alloc_delete_array, reportedAddress); } -#endif //MEMORY_TEST - /************* stuff from dlls/util.cpp *************/ // must come here because cbase.h declares it's own operator new diff --git a/dlls/fun/amxxmodule.h b/dlls/fun/amxxmodule.h index c6e95585..0d44ad13 100755 --- a/dlls/fun/amxxmodule.h +++ b/dlls/fun/amxxmodule.h @@ -1944,6 +1944,12 @@ typedef int (*PFN_IS_PLAYER_CONNECTING) (int /*id*/); typedef int (*PFN_IS_PLAYER_HLTV) (int /*id*/); typedef int (*PFN_GET_PLAYER_ARMOR) (int /*id*/); typedef int (*PFN_GET_PLAYER_HEALTH) (int /*id*/); +#ifdef USE_METAMOD +typedef edict_t * (*PFN_GET_PLAYER_EDICT) (int /*id*/); +#else +typedef void * (*PFN_GET_PLAYER_EDICT) (int /*id*/); +#endif + typedef void * (*PFN_ALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/, const unsigned int /*type*/, const size_t /*size*/); typedef void * (*PFN_REALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/, @@ -1955,7 +1961,7 @@ typedef int (*PFN_AMX_EXECV) (AMX* /*amx*/, cell* /*return val*/, int /*in typedef int (*PFN_AMX_ALLOT) (AMX* /*amx*/, int /*length*/, cell* /*amx_addr*/, cell** /*phys_addr*/); typedef int (*PFN_AMX_FINDPUBLIC) (AMX* /*amx*/, char* /*func name*/, int* /*index*/); typedef int (*PFN_AMX_FINDNATIVE) (AMX* /*amx*/, char* /*func name*/, int* /*index*/); -typedef int (*PFN_LOAD_AMXSCRIPT) (AMX* /*amx*/, void** /*code*/, const char* /*path*/, char[64] /*error info*/); +typedef int (*PFN_LOAD_AMXSCRIPT) (AMX* /*amx*/, void** /*code*/, const char* /*path*/, char[64] /*error info*/, int /* debug */); typedef int (*PFN_UNLOAD_AMXSCRIPT) (AMX* /*amx*/,void** /*code*/); typedef cell (*PFN_REAL_TO_CELL) (REAL /*x*/); typedef REAL (*PFN_CELL_TO_REAL) (cell /*x*/); @@ -1963,6 +1969,7 @@ typedef int (*PFN_REGISTER_SPFORWARD) (AMX * /*amx*/, int /*func*/, ... /*pa typedef int (*PFN_REGISTER_SPFORWARD_BYNAME) (AMX * /*amx*/, const char * /*funcName*/, ... /*params*/); typedef void (*PFN_UNREGISTER_SPFORWARD) (int /*id*/); typedef void (*PFN_MERGEDEFINITION_FILE) (const char * /*filename*/); +typedef const char * (*PFN_FORMAT) (const char * /*fmt*/, ... /*params*/); extern PFN_ADD_NATIVES g_fn_AddNatives; extern PFN_BUILD_PATHNAME g_fn_BuildPathname; @@ -2017,6 +2024,8 @@ extern PFN_UNREGISTER_SPFORWARD g_fn_UnregisterSPForward; extern PFN_MERGEDEFINITION_FILE g_fn_MergeDefinition_File; extern PFN_AMX_FINDNATIVE g_fn_AmxFindNative; extern PFN_GETPLAYERFLAGS g_fn_GetPlayerFlags; +extern PFN_GET_PLAYER_EDICT g_fn_GetPlayerEdict; +extern PFN_FORMAT g_fn_Format; #ifdef MAY_NEVER_BE_DEFINED // Function prototypes for intellisense and similar systems @@ -2066,6 +2075,8 @@ int MF_RegisterSPForwardByName (AMX * amx, const char *str, ...) { } int MF_RegisterSPForward (AMX * amx, int func, ...) { } void MF_UnregisterSPForward (int id) { } int MF_GetPlayerFlags (int id) { } +edict_t* MF_GetPlayerEdict (int id) { } +const char * MF_Format (const char *fmt, ...) { } #endif // MAY_NEVER_BE_DEFINED #define MF_AddNatives g_fn_AddNatives @@ -2121,8 +2132,8 @@ void MF_Log(const char *fmt, ...); #define MF_RegisterSPForward g_fn_RegisterSPForward #define MF_UnregisterSPForward g_fn_UnregisterSPForward #define MF_GetPlayerFlags g_fn_GetPlayerFlags - -#ifdef MEMORY_TEST +#define MF_GetPlayerEdict g_fn_GetPlayerEdict +#define MF_Format g_fn_Format; /*** Memory ***/ void *operator new(size_t reportedSize); @@ -2167,6 +2178,4 @@ void Mem_Deallocator(const char *sourceFile, const unsigned int sourceLine, cons #define realloc(ptr,sz) Mem_Reallocator(__FILE__,__LINE__,__FUNCTION__,m_alloc_realloc,sz,ptr) #define free(ptr) Mem_Deallocator(__FILE__,__LINE__,__FUNCTION__,m_alloc_free,ptr) -#endif //MEMORY_TEST - #endif // #ifndef __AMXXMODULE_H__ diff --git a/dlls/geoip/amxxmodule.cpp b/dlls/geoip/amxxmodule.cpp index 4b4d9ae3..88a48c5a 100755 --- a/dlls/geoip/amxxmodule.cpp +++ b/dlls/geoip/amxxmodule.cpp @@ -2479,7 +2479,9 @@ PFN_REGISTER_SPFORWARD_BYNAME g_fn_RegisterSPForwardByName; PFN_UNREGISTER_SPFORWARD g_fn_UnregisterSPForward; PFN_MERGEDEFINITION_FILE g_fn_MergeDefinition_File; PFN_AMX_FINDNATIVE g_fn_AmxFindNative; -PFN_GETPLAYERFLAGS g_fn_GetPlayerFlags; +PFN_GETPLAYERFLAGS g_fn_GetPlayerFlags; +PFN_GET_PLAYER_EDICT g_fn_GetPlayerEdict; +PFN_FORMAT g_fn_Format; // *** Exports *** C_DLLEXPORT int AMXX_Query(int *interfaceVersion, amxx_module_info_s *moduleInfo) @@ -2524,6 +2526,7 @@ C_DLLEXPORT int AMXX_Attach(PFN_REQ_FNPTR reqFnptrFunc) REQFUNC("GetModname", g_fn_GetModname, PFN_GET_MODNAME); REQFUNC("Log", g_fn_Log, PFN_LOG); REQFUNC("MergeDefinitionFile", g_fn_MergeDefinition_File, PFN_MERGEDEFINITION_FILE); + REQFUNC("Format", g_fn_Format, PFN_FORMAT); // Amx scripts REQFUNC("GetAmxScript", g_fn_GetAmxScript, PFN_GET_AMXSCRIPT); @@ -2579,6 +2582,7 @@ C_DLLEXPORT int AMXX_Attach(PFN_REQ_FNPTR reqFnptrFunc) REQFUNC("GetPlayerArmor", g_fn_GetPlayerArmor, PFN_GET_PLAYER_ARMOR); REQFUNC("GetPlayerHealth", g_fn_GetPlayerHealth, PFN_GET_PLAYER_HEALTH); REQFUNC("GetPlayerFlags", g_fn_GetPlayerFlags, PFN_GETPLAYERFLAGS); + REQFUNC("GetPlayerEdict", g_fn_GetPlayerEdict, PFN_GET_PLAYER_EDICT); // Memory REQFUNC_OPT("Allocator", g_fn_Allocator, PFN_ALLOCATOR); @@ -2673,16 +2677,17 @@ void ValidateMacros_DontCallThis_Smiley() MF_AmxExecv(0, 0, 0, 0, 0); MF_AmxFindPublic(0, 0, 0); MF_AmxAllot(0, 0, 0, 0); - MF_LoadAmxScript(0, 0, 0, 0); + MF_LoadAmxScript(0, 0, 0, 0, 0); MF_UnloadAmxScript(0, 0); MF_RegisterSPForward(0, 0, 0, 0, 0, 0); MF_RegisterSPForwardByName(0, 0, 0, 0, 0, 0); MF_UnregisterSPForward(0); + MF_GetPlayerFrags(0); + MF_GetPlayerEdict(0); + MF_Format("", 4, "str"); } #endif -#ifdef MEMORY_TEST - /************* MEMORY *************/ // undef all defined macros #undef new @@ -2796,7 +2801,7 @@ void *operator new(size_t reportedSize) return ptr; // allocation failed - throw std::bad_alloc(); + return NULL; } void *operator new[](size_t reportedSize) @@ -2809,7 +2814,7 @@ void *operator new[](size_t reportedSize) return ptr; // allocation failed - throw std::bad_alloc(); + return NULL; } // Microsoft memory tracking operators @@ -2823,7 +2828,7 @@ void *operator new(size_t reportedSize, const char *sourceFile, int sourceLine) return ptr; // allocation failed - throw std::bad_alloc(); + return NULL; } void *operator new[](size_t reportedSize, const char *sourceFile, int sourceLine) { @@ -2835,7 +2840,7 @@ void *operator new[](size_t reportedSize, const char *sourceFile, int sourceLine return ptr; // allocation failed - throw std::bad_alloc(); + return NULL; } void operator delete(void *reportedAddress) @@ -2854,8 +2859,6 @@ void operator delete[](void *reportedAddress) Mem_Deallocator(g_Mem_CurrentFilename, g_Mem_CurrentLine, g_Mem_CurrentFunc, m_alloc_delete_array, reportedAddress); } -#endif //MEMORY_TEST - /************* stuff from dlls/util.cpp *************/ // must come here because cbase.h declares it's own operator new diff --git a/dlls/geoip/amxxmodule.h b/dlls/geoip/amxxmodule.h index c3d0eb42..0d44ad13 100755 --- a/dlls/geoip/amxxmodule.h +++ b/dlls/geoip/amxxmodule.h @@ -1944,6 +1944,12 @@ typedef int (*PFN_IS_PLAYER_CONNECTING) (int /*id*/); typedef int (*PFN_IS_PLAYER_HLTV) (int /*id*/); typedef int (*PFN_GET_PLAYER_ARMOR) (int /*id*/); typedef int (*PFN_GET_PLAYER_HEALTH) (int /*id*/); +#ifdef USE_METAMOD +typedef edict_t * (*PFN_GET_PLAYER_EDICT) (int /*id*/); +#else +typedef void * (*PFN_GET_PLAYER_EDICT) (int /*id*/); +#endif + typedef void * (*PFN_ALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/, const unsigned int /*type*/, const size_t /*size*/); typedef void * (*PFN_REALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/, @@ -1963,6 +1969,7 @@ typedef int (*PFN_REGISTER_SPFORWARD) (AMX * /*amx*/, int /*func*/, ... /*pa typedef int (*PFN_REGISTER_SPFORWARD_BYNAME) (AMX * /*amx*/, const char * /*funcName*/, ... /*params*/); typedef void (*PFN_UNREGISTER_SPFORWARD) (int /*id*/); typedef void (*PFN_MERGEDEFINITION_FILE) (const char * /*filename*/); +typedef const char * (*PFN_FORMAT) (const char * /*fmt*/, ... /*params*/); extern PFN_ADD_NATIVES g_fn_AddNatives; extern PFN_BUILD_PATHNAME g_fn_BuildPathname; @@ -2017,6 +2024,8 @@ extern PFN_UNREGISTER_SPFORWARD g_fn_UnregisterSPForward; extern PFN_MERGEDEFINITION_FILE g_fn_MergeDefinition_File; extern PFN_AMX_FINDNATIVE g_fn_AmxFindNative; extern PFN_GETPLAYERFLAGS g_fn_GetPlayerFlags; +extern PFN_GET_PLAYER_EDICT g_fn_GetPlayerEdict; +extern PFN_FORMAT g_fn_Format; #ifdef MAY_NEVER_BE_DEFINED // Function prototypes for intellisense and similar systems @@ -2066,6 +2075,8 @@ int MF_RegisterSPForwardByName (AMX * amx, const char *str, ...) { } int MF_RegisterSPForward (AMX * amx, int func, ...) { } void MF_UnregisterSPForward (int id) { } int MF_GetPlayerFlags (int id) { } +edict_t* MF_GetPlayerEdict (int id) { } +const char * MF_Format (const char *fmt, ...) { } #endif // MAY_NEVER_BE_DEFINED #define MF_AddNatives g_fn_AddNatives @@ -2121,8 +2132,8 @@ void MF_Log(const char *fmt, ...); #define MF_RegisterSPForward g_fn_RegisterSPForward #define MF_UnregisterSPForward g_fn_UnregisterSPForward #define MF_GetPlayerFlags g_fn_GetPlayerFlags - -#ifdef MEMORY_TEST +#define MF_GetPlayerEdict g_fn_GetPlayerEdict +#define MF_Format g_fn_Format; /*** Memory ***/ void *operator new(size_t reportedSize); @@ -2167,6 +2178,4 @@ void Mem_Deallocator(const char *sourceFile, const unsigned int sourceLine, cons #define realloc(ptr,sz) Mem_Reallocator(__FILE__,__LINE__,__FUNCTION__,m_alloc_realloc,sz,ptr) #define free(ptr) Mem_Deallocator(__FILE__,__LINE__,__FUNCTION__,m_alloc_free,ptr) -#endif //MEMORY_TEST - #endif // #ifndef __AMXXMODULE_H__ diff --git a/dlls/ns/ns/amxxmodule.cpp b/dlls/ns/ns/amxxmodule.cpp index 4b4d9ae3..88a48c5a 100755 --- a/dlls/ns/ns/amxxmodule.cpp +++ b/dlls/ns/ns/amxxmodule.cpp @@ -2479,7 +2479,9 @@ PFN_REGISTER_SPFORWARD_BYNAME g_fn_RegisterSPForwardByName; PFN_UNREGISTER_SPFORWARD g_fn_UnregisterSPForward; PFN_MERGEDEFINITION_FILE g_fn_MergeDefinition_File; PFN_AMX_FINDNATIVE g_fn_AmxFindNative; -PFN_GETPLAYERFLAGS g_fn_GetPlayerFlags; +PFN_GETPLAYERFLAGS g_fn_GetPlayerFlags; +PFN_GET_PLAYER_EDICT g_fn_GetPlayerEdict; +PFN_FORMAT g_fn_Format; // *** Exports *** C_DLLEXPORT int AMXX_Query(int *interfaceVersion, amxx_module_info_s *moduleInfo) @@ -2524,6 +2526,7 @@ C_DLLEXPORT int AMXX_Attach(PFN_REQ_FNPTR reqFnptrFunc) REQFUNC("GetModname", g_fn_GetModname, PFN_GET_MODNAME); REQFUNC("Log", g_fn_Log, PFN_LOG); REQFUNC("MergeDefinitionFile", g_fn_MergeDefinition_File, PFN_MERGEDEFINITION_FILE); + REQFUNC("Format", g_fn_Format, PFN_FORMAT); // Amx scripts REQFUNC("GetAmxScript", g_fn_GetAmxScript, PFN_GET_AMXSCRIPT); @@ -2579,6 +2582,7 @@ C_DLLEXPORT int AMXX_Attach(PFN_REQ_FNPTR reqFnptrFunc) REQFUNC("GetPlayerArmor", g_fn_GetPlayerArmor, PFN_GET_PLAYER_ARMOR); REQFUNC("GetPlayerHealth", g_fn_GetPlayerHealth, PFN_GET_PLAYER_HEALTH); REQFUNC("GetPlayerFlags", g_fn_GetPlayerFlags, PFN_GETPLAYERFLAGS); + REQFUNC("GetPlayerEdict", g_fn_GetPlayerEdict, PFN_GET_PLAYER_EDICT); // Memory REQFUNC_OPT("Allocator", g_fn_Allocator, PFN_ALLOCATOR); @@ -2673,16 +2677,17 @@ void ValidateMacros_DontCallThis_Smiley() MF_AmxExecv(0, 0, 0, 0, 0); MF_AmxFindPublic(0, 0, 0); MF_AmxAllot(0, 0, 0, 0); - MF_LoadAmxScript(0, 0, 0, 0); + MF_LoadAmxScript(0, 0, 0, 0, 0); MF_UnloadAmxScript(0, 0); MF_RegisterSPForward(0, 0, 0, 0, 0, 0); MF_RegisterSPForwardByName(0, 0, 0, 0, 0, 0); MF_UnregisterSPForward(0); + MF_GetPlayerFrags(0); + MF_GetPlayerEdict(0); + MF_Format("", 4, "str"); } #endif -#ifdef MEMORY_TEST - /************* MEMORY *************/ // undef all defined macros #undef new @@ -2796,7 +2801,7 @@ void *operator new(size_t reportedSize) return ptr; // allocation failed - throw std::bad_alloc(); + return NULL; } void *operator new[](size_t reportedSize) @@ -2809,7 +2814,7 @@ void *operator new[](size_t reportedSize) return ptr; // allocation failed - throw std::bad_alloc(); + return NULL; } // Microsoft memory tracking operators @@ -2823,7 +2828,7 @@ void *operator new(size_t reportedSize, const char *sourceFile, int sourceLine) return ptr; // allocation failed - throw std::bad_alloc(); + return NULL; } void *operator new[](size_t reportedSize, const char *sourceFile, int sourceLine) { @@ -2835,7 +2840,7 @@ void *operator new[](size_t reportedSize, const char *sourceFile, int sourceLine return ptr; // allocation failed - throw std::bad_alloc(); + return NULL; } void operator delete(void *reportedAddress) @@ -2854,8 +2859,6 @@ void operator delete[](void *reportedAddress) Mem_Deallocator(g_Mem_CurrentFilename, g_Mem_CurrentLine, g_Mem_CurrentFunc, m_alloc_delete_array, reportedAddress); } -#endif //MEMORY_TEST - /************* stuff from dlls/util.cpp *************/ // must come here because cbase.h declares it's own operator new diff --git a/dlls/ns/ns/amxxmodule.h b/dlls/ns/ns/amxxmodule.h index c3d0eb42..0d44ad13 100755 --- a/dlls/ns/ns/amxxmodule.h +++ b/dlls/ns/ns/amxxmodule.h @@ -1944,6 +1944,12 @@ typedef int (*PFN_IS_PLAYER_CONNECTING) (int /*id*/); typedef int (*PFN_IS_PLAYER_HLTV) (int /*id*/); typedef int (*PFN_GET_PLAYER_ARMOR) (int /*id*/); typedef int (*PFN_GET_PLAYER_HEALTH) (int /*id*/); +#ifdef USE_METAMOD +typedef edict_t * (*PFN_GET_PLAYER_EDICT) (int /*id*/); +#else +typedef void * (*PFN_GET_PLAYER_EDICT) (int /*id*/); +#endif + typedef void * (*PFN_ALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/, const unsigned int /*type*/, const size_t /*size*/); typedef void * (*PFN_REALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/, @@ -1963,6 +1969,7 @@ typedef int (*PFN_REGISTER_SPFORWARD) (AMX * /*amx*/, int /*func*/, ... /*pa typedef int (*PFN_REGISTER_SPFORWARD_BYNAME) (AMX * /*amx*/, const char * /*funcName*/, ... /*params*/); typedef void (*PFN_UNREGISTER_SPFORWARD) (int /*id*/); typedef void (*PFN_MERGEDEFINITION_FILE) (const char * /*filename*/); +typedef const char * (*PFN_FORMAT) (const char * /*fmt*/, ... /*params*/); extern PFN_ADD_NATIVES g_fn_AddNatives; extern PFN_BUILD_PATHNAME g_fn_BuildPathname; @@ -2017,6 +2024,8 @@ extern PFN_UNREGISTER_SPFORWARD g_fn_UnregisterSPForward; extern PFN_MERGEDEFINITION_FILE g_fn_MergeDefinition_File; extern PFN_AMX_FINDNATIVE g_fn_AmxFindNative; extern PFN_GETPLAYERFLAGS g_fn_GetPlayerFlags; +extern PFN_GET_PLAYER_EDICT g_fn_GetPlayerEdict; +extern PFN_FORMAT g_fn_Format; #ifdef MAY_NEVER_BE_DEFINED // Function prototypes for intellisense and similar systems @@ -2066,6 +2075,8 @@ int MF_RegisterSPForwardByName (AMX * amx, const char *str, ...) { } int MF_RegisterSPForward (AMX * amx, int func, ...) { } void MF_UnregisterSPForward (int id) { } int MF_GetPlayerFlags (int id) { } +edict_t* MF_GetPlayerEdict (int id) { } +const char * MF_Format (const char *fmt, ...) { } #endif // MAY_NEVER_BE_DEFINED #define MF_AddNatives g_fn_AddNatives @@ -2121,8 +2132,8 @@ void MF_Log(const char *fmt, ...); #define MF_RegisterSPForward g_fn_RegisterSPForward #define MF_UnregisterSPForward g_fn_UnregisterSPForward #define MF_GetPlayerFlags g_fn_GetPlayerFlags - -#ifdef MEMORY_TEST +#define MF_GetPlayerEdict g_fn_GetPlayerEdict +#define MF_Format g_fn_Format; /*** Memory ***/ void *operator new(size_t reportedSize); @@ -2167,6 +2178,4 @@ void Mem_Deallocator(const char *sourceFile, const unsigned int sourceLine, cons #define realloc(ptr,sz) Mem_Reallocator(__FILE__,__LINE__,__FUNCTION__,m_alloc_realloc,sz,ptr) #define free(ptr) Mem_Deallocator(__FILE__,__LINE__,__FUNCTION__,m_alloc_free,ptr) -#endif //MEMORY_TEST - #endif // #ifndef __AMXXMODULE_H__ diff --git a/dlls/pgsql/amxxmodule.cpp b/dlls/pgsql/amxxmodule.cpp index 4b4d9ae3..88a48c5a 100755 --- a/dlls/pgsql/amxxmodule.cpp +++ b/dlls/pgsql/amxxmodule.cpp @@ -2479,7 +2479,9 @@ PFN_REGISTER_SPFORWARD_BYNAME g_fn_RegisterSPForwardByName; PFN_UNREGISTER_SPFORWARD g_fn_UnregisterSPForward; PFN_MERGEDEFINITION_FILE g_fn_MergeDefinition_File; PFN_AMX_FINDNATIVE g_fn_AmxFindNative; -PFN_GETPLAYERFLAGS g_fn_GetPlayerFlags; +PFN_GETPLAYERFLAGS g_fn_GetPlayerFlags; +PFN_GET_PLAYER_EDICT g_fn_GetPlayerEdict; +PFN_FORMAT g_fn_Format; // *** Exports *** C_DLLEXPORT int AMXX_Query(int *interfaceVersion, amxx_module_info_s *moduleInfo) @@ -2524,6 +2526,7 @@ C_DLLEXPORT int AMXX_Attach(PFN_REQ_FNPTR reqFnptrFunc) REQFUNC("GetModname", g_fn_GetModname, PFN_GET_MODNAME); REQFUNC("Log", g_fn_Log, PFN_LOG); REQFUNC("MergeDefinitionFile", g_fn_MergeDefinition_File, PFN_MERGEDEFINITION_FILE); + REQFUNC("Format", g_fn_Format, PFN_FORMAT); // Amx scripts REQFUNC("GetAmxScript", g_fn_GetAmxScript, PFN_GET_AMXSCRIPT); @@ -2579,6 +2582,7 @@ C_DLLEXPORT int AMXX_Attach(PFN_REQ_FNPTR reqFnptrFunc) REQFUNC("GetPlayerArmor", g_fn_GetPlayerArmor, PFN_GET_PLAYER_ARMOR); REQFUNC("GetPlayerHealth", g_fn_GetPlayerHealth, PFN_GET_PLAYER_HEALTH); REQFUNC("GetPlayerFlags", g_fn_GetPlayerFlags, PFN_GETPLAYERFLAGS); + REQFUNC("GetPlayerEdict", g_fn_GetPlayerEdict, PFN_GET_PLAYER_EDICT); // Memory REQFUNC_OPT("Allocator", g_fn_Allocator, PFN_ALLOCATOR); @@ -2673,16 +2677,17 @@ void ValidateMacros_DontCallThis_Smiley() MF_AmxExecv(0, 0, 0, 0, 0); MF_AmxFindPublic(0, 0, 0); MF_AmxAllot(0, 0, 0, 0); - MF_LoadAmxScript(0, 0, 0, 0); + MF_LoadAmxScript(0, 0, 0, 0, 0); MF_UnloadAmxScript(0, 0); MF_RegisterSPForward(0, 0, 0, 0, 0, 0); MF_RegisterSPForwardByName(0, 0, 0, 0, 0, 0); MF_UnregisterSPForward(0); + MF_GetPlayerFrags(0); + MF_GetPlayerEdict(0); + MF_Format("", 4, "str"); } #endif -#ifdef MEMORY_TEST - /************* MEMORY *************/ // undef all defined macros #undef new @@ -2796,7 +2801,7 @@ void *operator new(size_t reportedSize) return ptr; // allocation failed - throw std::bad_alloc(); + return NULL; } void *operator new[](size_t reportedSize) @@ -2809,7 +2814,7 @@ void *operator new[](size_t reportedSize) return ptr; // allocation failed - throw std::bad_alloc(); + return NULL; } // Microsoft memory tracking operators @@ -2823,7 +2828,7 @@ void *operator new(size_t reportedSize, const char *sourceFile, int sourceLine) return ptr; // allocation failed - throw std::bad_alloc(); + return NULL; } void *operator new[](size_t reportedSize, const char *sourceFile, int sourceLine) { @@ -2835,7 +2840,7 @@ void *operator new[](size_t reportedSize, const char *sourceFile, int sourceLine return ptr; // allocation failed - throw std::bad_alloc(); + return NULL; } void operator delete(void *reportedAddress) @@ -2854,8 +2859,6 @@ void operator delete[](void *reportedAddress) Mem_Deallocator(g_Mem_CurrentFilename, g_Mem_CurrentLine, g_Mem_CurrentFunc, m_alloc_delete_array, reportedAddress); } -#endif //MEMORY_TEST - /************* stuff from dlls/util.cpp *************/ // must come here because cbase.h declares it's own operator new diff --git a/dlls/pgsql/amxxmodule.h b/dlls/pgsql/amxxmodule.h index c3d0eb42..0d44ad13 100755 --- a/dlls/pgsql/amxxmodule.h +++ b/dlls/pgsql/amxxmodule.h @@ -1944,6 +1944,12 @@ typedef int (*PFN_IS_PLAYER_CONNECTING) (int /*id*/); typedef int (*PFN_IS_PLAYER_HLTV) (int /*id*/); typedef int (*PFN_GET_PLAYER_ARMOR) (int /*id*/); typedef int (*PFN_GET_PLAYER_HEALTH) (int /*id*/); +#ifdef USE_METAMOD +typedef edict_t * (*PFN_GET_PLAYER_EDICT) (int /*id*/); +#else +typedef void * (*PFN_GET_PLAYER_EDICT) (int /*id*/); +#endif + typedef void * (*PFN_ALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/, const unsigned int /*type*/, const size_t /*size*/); typedef void * (*PFN_REALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/, @@ -1963,6 +1969,7 @@ typedef int (*PFN_REGISTER_SPFORWARD) (AMX * /*amx*/, int /*func*/, ... /*pa typedef int (*PFN_REGISTER_SPFORWARD_BYNAME) (AMX * /*amx*/, const char * /*funcName*/, ... /*params*/); typedef void (*PFN_UNREGISTER_SPFORWARD) (int /*id*/); typedef void (*PFN_MERGEDEFINITION_FILE) (const char * /*filename*/); +typedef const char * (*PFN_FORMAT) (const char * /*fmt*/, ... /*params*/); extern PFN_ADD_NATIVES g_fn_AddNatives; extern PFN_BUILD_PATHNAME g_fn_BuildPathname; @@ -2017,6 +2024,8 @@ extern PFN_UNREGISTER_SPFORWARD g_fn_UnregisterSPForward; extern PFN_MERGEDEFINITION_FILE g_fn_MergeDefinition_File; extern PFN_AMX_FINDNATIVE g_fn_AmxFindNative; extern PFN_GETPLAYERFLAGS g_fn_GetPlayerFlags; +extern PFN_GET_PLAYER_EDICT g_fn_GetPlayerEdict; +extern PFN_FORMAT g_fn_Format; #ifdef MAY_NEVER_BE_DEFINED // Function prototypes for intellisense and similar systems @@ -2066,6 +2075,8 @@ int MF_RegisterSPForwardByName (AMX * amx, const char *str, ...) { } int MF_RegisterSPForward (AMX * amx, int func, ...) { } void MF_UnregisterSPForward (int id) { } int MF_GetPlayerFlags (int id) { } +edict_t* MF_GetPlayerEdict (int id) { } +const char * MF_Format (const char *fmt, ...) { } #endif // MAY_NEVER_BE_DEFINED #define MF_AddNatives g_fn_AddNatives @@ -2121,8 +2132,8 @@ void MF_Log(const char *fmt, ...); #define MF_RegisterSPForward g_fn_RegisterSPForward #define MF_UnregisterSPForward g_fn_UnregisterSPForward #define MF_GetPlayerFlags g_fn_GetPlayerFlags - -#ifdef MEMORY_TEST +#define MF_GetPlayerEdict g_fn_GetPlayerEdict +#define MF_Format g_fn_Format; /*** Memory ***/ void *operator new(size_t reportedSize); @@ -2167,6 +2178,4 @@ void Mem_Deallocator(const char *sourceFile, const unsigned int sourceLine, cons #define realloc(ptr,sz) Mem_Reallocator(__FILE__,__LINE__,__FUNCTION__,m_alloc_realloc,sz,ptr) #define free(ptr) Mem_Deallocator(__FILE__,__LINE__,__FUNCTION__,m_alloc_free,ptr) -#endif //MEMORY_TEST - #endif // #ifndef __AMXXMODULE_H__ diff --git a/dlls/sockets/amxxmodule.cpp b/dlls/sockets/amxxmodule.cpp index 4b4d9ae3..88a48c5a 100755 --- a/dlls/sockets/amxxmodule.cpp +++ b/dlls/sockets/amxxmodule.cpp @@ -2479,7 +2479,9 @@ PFN_REGISTER_SPFORWARD_BYNAME g_fn_RegisterSPForwardByName; PFN_UNREGISTER_SPFORWARD g_fn_UnregisterSPForward; PFN_MERGEDEFINITION_FILE g_fn_MergeDefinition_File; PFN_AMX_FINDNATIVE g_fn_AmxFindNative; -PFN_GETPLAYERFLAGS g_fn_GetPlayerFlags; +PFN_GETPLAYERFLAGS g_fn_GetPlayerFlags; +PFN_GET_PLAYER_EDICT g_fn_GetPlayerEdict; +PFN_FORMAT g_fn_Format; // *** Exports *** C_DLLEXPORT int AMXX_Query(int *interfaceVersion, amxx_module_info_s *moduleInfo) @@ -2524,6 +2526,7 @@ C_DLLEXPORT int AMXX_Attach(PFN_REQ_FNPTR reqFnptrFunc) REQFUNC("GetModname", g_fn_GetModname, PFN_GET_MODNAME); REQFUNC("Log", g_fn_Log, PFN_LOG); REQFUNC("MergeDefinitionFile", g_fn_MergeDefinition_File, PFN_MERGEDEFINITION_FILE); + REQFUNC("Format", g_fn_Format, PFN_FORMAT); // Amx scripts REQFUNC("GetAmxScript", g_fn_GetAmxScript, PFN_GET_AMXSCRIPT); @@ -2579,6 +2582,7 @@ C_DLLEXPORT int AMXX_Attach(PFN_REQ_FNPTR reqFnptrFunc) REQFUNC("GetPlayerArmor", g_fn_GetPlayerArmor, PFN_GET_PLAYER_ARMOR); REQFUNC("GetPlayerHealth", g_fn_GetPlayerHealth, PFN_GET_PLAYER_HEALTH); REQFUNC("GetPlayerFlags", g_fn_GetPlayerFlags, PFN_GETPLAYERFLAGS); + REQFUNC("GetPlayerEdict", g_fn_GetPlayerEdict, PFN_GET_PLAYER_EDICT); // Memory REQFUNC_OPT("Allocator", g_fn_Allocator, PFN_ALLOCATOR); @@ -2673,16 +2677,17 @@ void ValidateMacros_DontCallThis_Smiley() MF_AmxExecv(0, 0, 0, 0, 0); MF_AmxFindPublic(0, 0, 0); MF_AmxAllot(0, 0, 0, 0); - MF_LoadAmxScript(0, 0, 0, 0); + MF_LoadAmxScript(0, 0, 0, 0, 0); MF_UnloadAmxScript(0, 0); MF_RegisterSPForward(0, 0, 0, 0, 0, 0); MF_RegisterSPForwardByName(0, 0, 0, 0, 0, 0); MF_UnregisterSPForward(0); + MF_GetPlayerFrags(0); + MF_GetPlayerEdict(0); + MF_Format("", 4, "str"); } #endif -#ifdef MEMORY_TEST - /************* MEMORY *************/ // undef all defined macros #undef new @@ -2796,7 +2801,7 @@ void *operator new(size_t reportedSize) return ptr; // allocation failed - throw std::bad_alloc(); + return NULL; } void *operator new[](size_t reportedSize) @@ -2809,7 +2814,7 @@ void *operator new[](size_t reportedSize) return ptr; // allocation failed - throw std::bad_alloc(); + return NULL; } // Microsoft memory tracking operators @@ -2823,7 +2828,7 @@ void *operator new(size_t reportedSize, const char *sourceFile, int sourceLine) return ptr; // allocation failed - throw std::bad_alloc(); + return NULL; } void *operator new[](size_t reportedSize, const char *sourceFile, int sourceLine) { @@ -2835,7 +2840,7 @@ void *operator new[](size_t reportedSize, const char *sourceFile, int sourceLine return ptr; // allocation failed - throw std::bad_alloc(); + return NULL; } void operator delete(void *reportedAddress) @@ -2854,8 +2859,6 @@ void operator delete[](void *reportedAddress) Mem_Deallocator(g_Mem_CurrentFilename, g_Mem_CurrentLine, g_Mem_CurrentFunc, m_alloc_delete_array, reportedAddress); } -#endif //MEMORY_TEST - /************* stuff from dlls/util.cpp *************/ // must come here because cbase.h declares it's own operator new diff --git a/dlls/sockets/amxxmodule.h b/dlls/sockets/amxxmodule.h index c3d0eb42..0d44ad13 100755 --- a/dlls/sockets/amxxmodule.h +++ b/dlls/sockets/amxxmodule.h @@ -1944,6 +1944,12 @@ typedef int (*PFN_IS_PLAYER_CONNECTING) (int /*id*/); typedef int (*PFN_IS_PLAYER_HLTV) (int /*id*/); typedef int (*PFN_GET_PLAYER_ARMOR) (int /*id*/); typedef int (*PFN_GET_PLAYER_HEALTH) (int /*id*/); +#ifdef USE_METAMOD +typedef edict_t * (*PFN_GET_PLAYER_EDICT) (int /*id*/); +#else +typedef void * (*PFN_GET_PLAYER_EDICT) (int /*id*/); +#endif + typedef void * (*PFN_ALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/, const unsigned int /*type*/, const size_t /*size*/); typedef void * (*PFN_REALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/, @@ -1963,6 +1969,7 @@ typedef int (*PFN_REGISTER_SPFORWARD) (AMX * /*amx*/, int /*func*/, ... /*pa typedef int (*PFN_REGISTER_SPFORWARD_BYNAME) (AMX * /*amx*/, const char * /*funcName*/, ... /*params*/); typedef void (*PFN_UNREGISTER_SPFORWARD) (int /*id*/); typedef void (*PFN_MERGEDEFINITION_FILE) (const char * /*filename*/); +typedef const char * (*PFN_FORMAT) (const char * /*fmt*/, ... /*params*/); extern PFN_ADD_NATIVES g_fn_AddNatives; extern PFN_BUILD_PATHNAME g_fn_BuildPathname; @@ -2017,6 +2024,8 @@ extern PFN_UNREGISTER_SPFORWARD g_fn_UnregisterSPForward; extern PFN_MERGEDEFINITION_FILE g_fn_MergeDefinition_File; extern PFN_AMX_FINDNATIVE g_fn_AmxFindNative; extern PFN_GETPLAYERFLAGS g_fn_GetPlayerFlags; +extern PFN_GET_PLAYER_EDICT g_fn_GetPlayerEdict; +extern PFN_FORMAT g_fn_Format; #ifdef MAY_NEVER_BE_DEFINED // Function prototypes for intellisense and similar systems @@ -2066,6 +2075,8 @@ int MF_RegisterSPForwardByName (AMX * amx, const char *str, ...) { } int MF_RegisterSPForward (AMX * amx, int func, ...) { } void MF_UnregisterSPForward (int id) { } int MF_GetPlayerFlags (int id) { } +edict_t* MF_GetPlayerEdict (int id) { } +const char * MF_Format (const char *fmt, ...) { } #endif // MAY_NEVER_BE_DEFINED #define MF_AddNatives g_fn_AddNatives @@ -2121,8 +2132,8 @@ void MF_Log(const char *fmt, ...); #define MF_RegisterSPForward g_fn_RegisterSPForward #define MF_UnregisterSPForward g_fn_UnregisterSPForward #define MF_GetPlayerFlags g_fn_GetPlayerFlags - -#ifdef MEMORY_TEST +#define MF_GetPlayerEdict g_fn_GetPlayerEdict +#define MF_Format g_fn_Format; /*** Memory ***/ void *operator new(size_t reportedSize); @@ -2167,6 +2178,4 @@ void Mem_Deallocator(const char *sourceFile, const unsigned int sourceLine, cons #define realloc(ptr,sz) Mem_Reallocator(__FILE__,__LINE__,__FUNCTION__,m_alloc_realloc,sz,ptr) #define free(ptr) Mem_Deallocator(__FILE__,__LINE__,__FUNCTION__,m_alloc_free,ptr) -#endif //MEMORY_TEST - #endif // #ifndef __AMXXMODULE_H__ diff --git a/dlls/tfc/tfcx/amxxmodule.cpp b/dlls/tfc/tfcx/amxxmodule.cpp index 4b4d9ae3..88a48c5a 100755 --- a/dlls/tfc/tfcx/amxxmodule.cpp +++ b/dlls/tfc/tfcx/amxxmodule.cpp @@ -2479,7 +2479,9 @@ PFN_REGISTER_SPFORWARD_BYNAME g_fn_RegisterSPForwardByName; PFN_UNREGISTER_SPFORWARD g_fn_UnregisterSPForward; PFN_MERGEDEFINITION_FILE g_fn_MergeDefinition_File; PFN_AMX_FINDNATIVE g_fn_AmxFindNative; -PFN_GETPLAYERFLAGS g_fn_GetPlayerFlags; +PFN_GETPLAYERFLAGS g_fn_GetPlayerFlags; +PFN_GET_PLAYER_EDICT g_fn_GetPlayerEdict; +PFN_FORMAT g_fn_Format; // *** Exports *** C_DLLEXPORT int AMXX_Query(int *interfaceVersion, amxx_module_info_s *moduleInfo) @@ -2524,6 +2526,7 @@ C_DLLEXPORT int AMXX_Attach(PFN_REQ_FNPTR reqFnptrFunc) REQFUNC("GetModname", g_fn_GetModname, PFN_GET_MODNAME); REQFUNC("Log", g_fn_Log, PFN_LOG); REQFUNC("MergeDefinitionFile", g_fn_MergeDefinition_File, PFN_MERGEDEFINITION_FILE); + REQFUNC("Format", g_fn_Format, PFN_FORMAT); // Amx scripts REQFUNC("GetAmxScript", g_fn_GetAmxScript, PFN_GET_AMXSCRIPT); @@ -2579,6 +2582,7 @@ C_DLLEXPORT int AMXX_Attach(PFN_REQ_FNPTR reqFnptrFunc) REQFUNC("GetPlayerArmor", g_fn_GetPlayerArmor, PFN_GET_PLAYER_ARMOR); REQFUNC("GetPlayerHealth", g_fn_GetPlayerHealth, PFN_GET_PLAYER_HEALTH); REQFUNC("GetPlayerFlags", g_fn_GetPlayerFlags, PFN_GETPLAYERFLAGS); + REQFUNC("GetPlayerEdict", g_fn_GetPlayerEdict, PFN_GET_PLAYER_EDICT); // Memory REQFUNC_OPT("Allocator", g_fn_Allocator, PFN_ALLOCATOR); @@ -2673,16 +2677,17 @@ void ValidateMacros_DontCallThis_Smiley() MF_AmxExecv(0, 0, 0, 0, 0); MF_AmxFindPublic(0, 0, 0); MF_AmxAllot(0, 0, 0, 0); - MF_LoadAmxScript(0, 0, 0, 0); + MF_LoadAmxScript(0, 0, 0, 0, 0); MF_UnloadAmxScript(0, 0); MF_RegisterSPForward(0, 0, 0, 0, 0, 0); MF_RegisterSPForwardByName(0, 0, 0, 0, 0, 0); MF_UnregisterSPForward(0); + MF_GetPlayerFrags(0); + MF_GetPlayerEdict(0); + MF_Format("", 4, "str"); } #endif -#ifdef MEMORY_TEST - /************* MEMORY *************/ // undef all defined macros #undef new @@ -2796,7 +2801,7 @@ void *operator new(size_t reportedSize) return ptr; // allocation failed - throw std::bad_alloc(); + return NULL; } void *operator new[](size_t reportedSize) @@ -2809,7 +2814,7 @@ void *operator new[](size_t reportedSize) return ptr; // allocation failed - throw std::bad_alloc(); + return NULL; } // Microsoft memory tracking operators @@ -2823,7 +2828,7 @@ void *operator new(size_t reportedSize, const char *sourceFile, int sourceLine) return ptr; // allocation failed - throw std::bad_alloc(); + return NULL; } void *operator new[](size_t reportedSize, const char *sourceFile, int sourceLine) { @@ -2835,7 +2840,7 @@ void *operator new[](size_t reportedSize, const char *sourceFile, int sourceLine return ptr; // allocation failed - throw std::bad_alloc(); + return NULL; } void operator delete(void *reportedAddress) @@ -2854,8 +2859,6 @@ void operator delete[](void *reportedAddress) Mem_Deallocator(g_Mem_CurrentFilename, g_Mem_CurrentLine, g_Mem_CurrentFunc, m_alloc_delete_array, reportedAddress); } -#endif //MEMORY_TEST - /************* stuff from dlls/util.cpp *************/ // must come here because cbase.h declares it's own operator new diff --git a/dlls/tfc/tfcx/amxxmodule.h b/dlls/tfc/tfcx/amxxmodule.h index c3d0eb42..0d44ad13 100755 --- a/dlls/tfc/tfcx/amxxmodule.h +++ b/dlls/tfc/tfcx/amxxmodule.h @@ -1944,6 +1944,12 @@ typedef int (*PFN_IS_PLAYER_CONNECTING) (int /*id*/); typedef int (*PFN_IS_PLAYER_HLTV) (int /*id*/); typedef int (*PFN_GET_PLAYER_ARMOR) (int /*id*/); typedef int (*PFN_GET_PLAYER_HEALTH) (int /*id*/); +#ifdef USE_METAMOD +typedef edict_t * (*PFN_GET_PLAYER_EDICT) (int /*id*/); +#else +typedef void * (*PFN_GET_PLAYER_EDICT) (int /*id*/); +#endif + typedef void * (*PFN_ALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/, const unsigned int /*type*/, const size_t /*size*/); typedef void * (*PFN_REALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/, @@ -1963,6 +1969,7 @@ typedef int (*PFN_REGISTER_SPFORWARD) (AMX * /*amx*/, int /*func*/, ... /*pa typedef int (*PFN_REGISTER_SPFORWARD_BYNAME) (AMX * /*amx*/, const char * /*funcName*/, ... /*params*/); typedef void (*PFN_UNREGISTER_SPFORWARD) (int /*id*/); typedef void (*PFN_MERGEDEFINITION_FILE) (const char * /*filename*/); +typedef const char * (*PFN_FORMAT) (const char * /*fmt*/, ... /*params*/); extern PFN_ADD_NATIVES g_fn_AddNatives; extern PFN_BUILD_PATHNAME g_fn_BuildPathname; @@ -2017,6 +2024,8 @@ extern PFN_UNREGISTER_SPFORWARD g_fn_UnregisterSPForward; extern PFN_MERGEDEFINITION_FILE g_fn_MergeDefinition_File; extern PFN_AMX_FINDNATIVE g_fn_AmxFindNative; extern PFN_GETPLAYERFLAGS g_fn_GetPlayerFlags; +extern PFN_GET_PLAYER_EDICT g_fn_GetPlayerEdict; +extern PFN_FORMAT g_fn_Format; #ifdef MAY_NEVER_BE_DEFINED // Function prototypes for intellisense and similar systems @@ -2066,6 +2075,8 @@ int MF_RegisterSPForwardByName (AMX * amx, const char *str, ...) { } int MF_RegisterSPForward (AMX * amx, int func, ...) { } void MF_UnregisterSPForward (int id) { } int MF_GetPlayerFlags (int id) { } +edict_t* MF_GetPlayerEdict (int id) { } +const char * MF_Format (const char *fmt, ...) { } #endif // MAY_NEVER_BE_DEFINED #define MF_AddNatives g_fn_AddNatives @@ -2121,8 +2132,8 @@ void MF_Log(const char *fmt, ...); #define MF_RegisterSPForward g_fn_RegisterSPForward #define MF_UnregisterSPForward g_fn_UnregisterSPForward #define MF_GetPlayerFlags g_fn_GetPlayerFlags - -#ifdef MEMORY_TEST +#define MF_GetPlayerEdict g_fn_GetPlayerEdict +#define MF_Format g_fn_Format; /*** Memory ***/ void *operator new(size_t reportedSize); @@ -2167,6 +2178,4 @@ void Mem_Deallocator(const char *sourceFile, const unsigned int sourceLine, cons #define realloc(ptr,sz) Mem_Reallocator(__FILE__,__LINE__,__FUNCTION__,m_alloc_realloc,sz,ptr) #define free(ptr) Mem_Deallocator(__FILE__,__LINE__,__FUNCTION__,m_alloc_free,ptr) -#endif //MEMORY_TEST - #endif // #ifndef __AMXXMODULE_H__ diff --git a/dlls/ts/tsx/amxxmodule.cpp b/dlls/ts/tsx/amxxmodule.cpp index 4b4d9ae3..88a48c5a 100755 --- a/dlls/ts/tsx/amxxmodule.cpp +++ b/dlls/ts/tsx/amxxmodule.cpp @@ -2479,7 +2479,9 @@ PFN_REGISTER_SPFORWARD_BYNAME g_fn_RegisterSPForwardByName; PFN_UNREGISTER_SPFORWARD g_fn_UnregisterSPForward; PFN_MERGEDEFINITION_FILE g_fn_MergeDefinition_File; PFN_AMX_FINDNATIVE g_fn_AmxFindNative; -PFN_GETPLAYERFLAGS g_fn_GetPlayerFlags; +PFN_GETPLAYERFLAGS g_fn_GetPlayerFlags; +PFN_GET_PLAYER_EDICT g_fn_GetPlayerEdict; +PFN_FORMAT g_fn_Format; // *** Exports *** C_DLLEXPORT int AMXX_Query(int *interfaceVersion, amxx_module_info_s *moduleInfo) @@ -2524,6 +2526,7 @@ C_DLLEXPORT int AMXX_Attach(PFN_REQ_FNPTR reqFnptrFunc) REQFUNC("GetModname", g_fn_GetModname, PFN_GET_MODNAME); REQFUNC("Log", g_fn_Log, PFN_LOG); REQFUNC("MergeDefinitionFile", g_fn_MergeDefinition_File, PFN_MERGEDEFINITION_FILE); + REQFUNC("Format", g_fn_Format, PFN_FORMAT); // Amx scripts REQFUNC("GetAmxScript", g_fn_GetAmxScript, PFN_GET_AMXSCRIPT); @@ -2579,6 +2582,7 @@ C_DLLEXPORT int AMXX_Attach(PFN_REQ_FNPTR reqFnptrFunc) REQFUNC("GetPlayerArmor", g_fn_GetPlayerArmor, PFN_GET_PLAYER_ARMOR); REQFUNC("GetPlayerHealth", g_fn_GetPlayerHealth, PFN_GET_PLAYER_HEALTH); REQFUNC("GetPlayerFlags", g_fn_GetPlayerFlags, PFN_GETPLAYERFLAGS); + REQFUNC("GetPlayerEdict", g_fn_GetPlayerEdict, PFN_GET_PLAYER_EDICT); // Memory REQFUNC_OPT("Allocator", g_fn_Allocator, PFN_ALLOCATOR); @@ -2673,16 +2677,17 @@ void ValidateMacros_DontCallThis_Smiley() MF_AmxExecv(0, 0, 0, 0, 0); MF_AmxFindPublic(0, 0, 0); MF_AmxAllot(0, 0, 0, 0); - MF_LoadAmxScript(0, 0, 0, 0); + MF_LoadAmxScript(0, 0, 0, 0, 0); MF_UnloadAmxScript(0, 0); MF_RegisterSPForward(0, 0, 0, 0, 0, 0); MF_RegisterSPForwardByName(0, 0, 0, 0, 0, 0); MF_UnregisterSPForward(0); + MF_GetPlayerFrags(0); + MF_GetPlayerEdict(0); + MF_Format("", 4, "str"); } #endif -#ifdef MEMORY_TEST - /************* MEMORY *************/ // undef all defined macros #undef new @@ -2796,7 +2801,7 @@ void *operator new(size_t reportedSize) return ptr; // allocation failed - throw std::bad_alloc(); + return NULL; } void *operator new[](size_t reportedSize) @@ -2809,7 +2814,7 @@ void *operator new[](size_t reportedSize) return ptr; // allocation failed - throw std::bad_alloc(); + return NULL; } // Microsoft memory tracking operators @@ -2823,7 +2828,7 @@ void *operator new(size_t reportedSize, const char *sourceFile, int sourceLine) return ptr; // allocation failed - throw std::bad_alloc(); + return NULL; } void *operator new[](size_t reportedSize, const char *sourceFile, int sourceLine) { @@ -2835,7 +2840,7 @@ void *operator new[](size_t reportedSize, const char *sourceFile, int sourceLine return ptr; // allocation failed - throw std::bad_alloc(); + return NULL; } void operator delete(void *reportedAddress) @@ -2854,8 +2859,6 @@ void operator delete[](void *reportedAddress) Mem_Deallocator(g_Mem_CurrentFilename, g_Mem_CurrentLine, g_Mem_CurrentFunc, m_alloc_delete_array, reportedAddress); } -#endif //MEMORY_TEST - /************* stuff from dlls/util.cpp *************/ // must come here because cbase.h declares it's own operator new diff --git a/dlls/ts/tsx/amxxmodule.h b/dlls/ts/tsx/amxxmodule.h index c3d0eb42..0d44ad13 100755 --- a/dlls/ts/tsx/amxxmodule.h +++ b/dlls/ts/tsx/amxxmodule.h @@ -1944,6 +1944,12 @@ typedef int (*PFN_IS_PLAYER_CONNECTING) (int /*id*/); typedef int (*PFN_IS_PLAYER_HLTV) (int /*id*/); typedef int (*PFN_GET_PLAYER_ARMOR) (int /*id*/); typedef int (*PFN_GET_PLAYER_HEALTH) (int /*id*/); +#ifdef USE_METAMOD +typedef edict_t * (*PFN_GET_PLAYER_EDICT) (int /*id*/); +#else +typedef void * (*PFN_GET_PLAYER_EDICT) (int /*id*/); +#endif + typedef void * (*PFN_ALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/, const unsigned int /*type*/, const size_t /*size*/); typedef void * (*PFN_REALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/, @@ -1963,6 +1969,7 @@ typedef int (*PFN_REGISTER_SPFORWARD) (AMX * /*amx*/, int /*func*/, ... /*pa typedef int (*PFN_REGISTER_SPFORWARD_BYNAME) (AMX * /*amx*/, const char * /*funcName*/, ... /*params*/); typedef void (*PFN_UNREGISTER_SPFORWARD) (int /*id*/); typedef void (*PFN_MERGEDEFINITION_FILE) (const char * /*filename*/); +typedef const char * (*PFN_FORMAT) (const char * /*fmt*/, ... /*params*/); extern PFN_ADD_NATIVES g_fn_AddNatives; extern PFN_BUILD_PATHNAME g_fn_BuildPathname; @@ -2017,6 +2024,8 @@ extern PFN_UNREGISTER_SPFORWARD g_fn_UnregisterSPForward; extern PFN_MERGEDEFINITION_FILE g_fn_MergeDefinition_File; extern PFN_AMX_FINDNATIVE g_fn_AmxFindNative; extern PFN_GETPLAYERFLAGS g_fn_GetPlayerFlags; +extern PFN_GET_PLAYER_EDICT g_fn_GetPlayerEdict; +extern PFN_FORMAT g_fn_Format; #ifdef MAY_NEVER_BE_DEFINED // Function prototypes for intellisense and similar systems @@ -2066,6 +2075,8 @@ int MF_RegisterSPForwardByName (AMX * amx, const char *str, ...) { } int MF_RegisterSPForward (AMX * amx, int func, ...) { } void MF_UnregisterSPForward (int id) { } int MF_GetPlayerFlags (int id) { } +edict_t* MF_GetPlayerEdict (int id) { } +const char * MF_Format (const char *fmt, ...) { } #endif // MAY_NEVER_BE_DEFINED #define MF_AddNatives g_fn_AddNatives @@ -2121,8 +2132,8 @@ void MF_Log(const char *fmt, ...); #define MF_RegisterSPForward g_fn_RegisterSPForward #define MF_UnregisterSPForward g_fn_UnregisterSPForward #define MF_GetPlayerFlags g_fn_GetPlayerFlags - -#ifdef MEMORY_TEST +#define MF_GetPlayerEdict g_fn_GetPlayerEdict +#define MF_Format g_fn_Format; /*** Memory ***/ void *operator new(size_t reportedSize); @@ -2167,6 +2178,4 @@ void Mem_Deallocator(const char *sourceFile, const unsigned int sourceLine, cons #define realloc(ptr,sz) Mem_Reallocator(__FILE__,__LINE__,__FUNCTION__,m_alloc_realloc,sz,ptr) #define free(ptr) Mem_Deallocator(__FILE__,__LINE__,__FUNCTION__,m_alloc_free,ptr) -#endif //MEMORY_TEST - #endif // #ifndef __AMXXMODULE_H__