2
0
mirror of https://github.com/rehlds/metamod-r.git synced 2025-01-16 08:38:00 +03:00

111 lines
5.2 KiB
C
Raw Normal View History

2016-07-26 23:31:47 +07:00
#pragma once
2016-07-26 23:31:47 +07:00
#include "plinfo.h" // plugin_info_t, etc
2016-07-04 12:07:29 +06:00
#include "sdk_util.h" // hudtextparms_t, etc
// max buffer size for printed messages
2016-07-26 23:31:47 +07:00
#define MAX_LOGMSG_LEN 1024
2016-07-04 12:07:29 +06:00
// For GetGameInfo:
2016-07-26 23:31:47 +07:00
enum ginfo_t
{
2016-07-04 12:07:29 +06:00
GINFO_NAME = 0,
GINFO_DESC,
GINFO_GAMEDIR,
GINFO_DLL_FULLPATH,
GINFO_DLL_FILENAME,
GINFO_REALDLL_FULLPATH,
2016-07-26 23:31:47 +07:00
};
2016-07-04 12:07:29 +06:00
// Meta Utility Function table type.
2016-07-26 23:31:47 +07:00
struct mutil_funcs_t
{
2016-07-04 12:07:29 +06:00
void (*pfnLogConsole) (plid_t plid, const char *fmt, ...);
void (*pfnLogMessage) (plid_t plid, const char *fmt, ...);
void (*pfnLogError) (plid_t plid, const char *fmt, ...);
void (*pfnLogDeveloper) (plid_t plid, const char *fmt, ...);
void (*pfnCenterSay) (plid_t plid, const char *fmt, ...);
2016-07-26 23:31:47 +07:00
void (*pfnCenterSayParms) (plid_t plid, hudtextparms_t tparms, const char *fmt, ...);
void (*pfnCenterSayVarargs) (plid_t plid, hudtextparms_t tparms, const char *fmt, va_list ap);
qboolean (*pfnCallGameEntity) (plid_t plid, const char *entStr, entvars_t *pev);
int (*pfnGetUserMsgID) (plid_t plid, const char *msgname, int *size);
const char * (*pfnGetUserMsgName) (plid_t plid, int msgid, int *size);
const char * (*pfnGetPluginPath) (plid_t plid);
const char * (*pfnGetGameInfo) (plid_t plid, ginfo_t tag);
int (*pfnLoadPlugin) (plid_t plid, const char *cmdline, PLUG_LOADTIME now, void **plugin_handle);
int (*pfnUnloadPlugin) (plid_t plid, const char *cmdline, PLUG_LOADTIME now, PL_UNLOAD_REASON reason);
int (*pfnUnloadPluginByHandle) (plid_t plid, void *plugin_handle, PLUG_LOADTIME now, PL_UNLOAD_REASON reason);
const char * (*pfnIsQueryingClientCvar) (plid_t plid, const edict_t *pEdict);
int (*pfnMakeRequestId) (plid_t plid);
2016-07-26 09:08:43 +07:00
void (*pfnGetHookTables) (plid_t plid, enginefuncs_t **peng, DLL_FUNCTIONS **pdll, NEW_DLL_FUNCTIONS **pnewdll);
#ifdef UNFINISHED
2016-07-26 23:31:47 +07:00
int (*pfnHookGameEvent) (plid_t plid, game_event_t event, event_func_t pfnHandle);
int (*pfnHookLogTrigger) (plid_t plid, const char *trigger, logmatch_func_t pfnHandle);
int (*pfnHookLogString) (plid_t plid, const char *string, logmatch_func_t pfnHandle);
int (*pfnHookLogRegex) (plid_t plid, const char *pattern, logmatch_func_t pfnHandle);
qboolean (*pfnRemoveHookID) (plid_t plid, int hookid);
2016-07-26 23:31:47 +07:00
int (*pfnRemoveHookAll) (plid_t plid);
#endif
};
2016-07-26 07:22:47 +07:00
extern mutil_funcs_t MetaUtilFunctions;
2016-07-04 12:07:29 +06:00
// Meta Utility Functions
void mutil_LogConsole(plid_t plid, const char *fmt, ...);
void mutil_LogMessage(plid_t plid, const char *fmt, ...);
void mutil_LogError(plid_t plid, const char *fmt, ...);
void mutil_LogDeveloper(plid_t plid, const char *fmt, ...);
void mutil_CenterSay(plid_t plid, const char *fmt, ...);
2016-07-26 23:31:47 +07:00
void mutil_CenterSayParms(plid_t plid, hudtextparms_t tparms, const char *fmt, ...);
void mutil_CenterSayVarargs(plid_t plid, hudtextparms_t tparms, const char *fmt, va_list ap);
qboolean mutil_CallGameEntity(plid_t plid, const char *entStr, entvars_t *pev);
int mutil_GetUserMsgID(plid_t plid, const char *name, int *size);
const char *mutil_GetUserMsgName(plid_t plid, int msgid, int *size);
const char *mutil_GetPluginPath(plid_t plid);
const char *mutil_GetGameInfo(plid_t plid, ginfo_t tag);
const char *mutil_IsQueryingClientCvar(plid_t plid, const edict_t *pEdict);
int mutil_MakeRequestId(plid_t plid);
void mutil_GetHookTables(plid_t plid, enginefuncs_t **peng, DLL_FUNCTIONS **pdll, NEW_DLL_FUNCTIONS **pnewdll);
#ifdef UNFINISHED
2016-07-26 23:31:47 +07:00
int mutil_HookGameEvent(plid_t plid, game_event_t event, event_func_t pfnHandle);
int mutil_HookLogTrigger(plid_t plid, const char *trigger, logmatch_func_t pfnHandle);
int mutil_HookLogString(plid_t plid, const char *string, logmatch_func_t pfnHandle);
int mutil_HookLogRegex(plid_t plid, const char *pattern, logmatch_func_t pfnHandle);
qboolean mutil_RemoveHookID(plid_t plid, int hookid);
int mutil_RemoveHookAll(plid_t plid);
2016-07-26 23:31:47 +07:00
#endif
2016-07-04 12:07:29 +06:00
// Convenience macros for MetaUtil functions
#define LOG_CONSOLE (*gpMetaUtilFuncs->pfnLogConsole)
#define LOG_MESSAGE (*gpMetaUtilFuncs->pfnLogMessage)
#define LOG_ERROR (*gpMetaUtilFuncs->pfnLogError)
2016-07-04 12:07:29 +06:00
#define LOG_DEVELOPER (*gpMetaUtilFuncs->pfnLogDeveloper)
#define CENTER_SAY (*gpMetaUtilFuncs->pfnCenterSay)
2016-07-04 12:07:29 +06:00
#define CENTER_SAY_PARMS (*gpMetaUtilFuncs->pfnCenterSayParms)
#define CENTER_SAY_VARARGS (*gpMetaUtilFuncs->pfnCenterSayVarargs)
#define CALL_GAME_ENTITY (*gpMetaUtilFuncs->pfnCallGameEntity)
#define GET_USER_MSG_ID (*gpMetaUtilFuncs->pfnGetUserMsgID)
#define GET_USER_MSG_NAME (*gpMetaUtilFuncs->pfnGetUserMsgName)
#define GET_PLUGIN_PATH (*gpMetaUtilFuncs->pfnGetPluginPath)
#define GET_GAME_INFO (*gpMetaUtilFuncs->pfnGetGameInfo)
#define LOAD_PLUGIN (*gpMetaUtilFuncs->pfnLoadPlugin)
2016-07-04 12:07:29 +06:00
#define UNLOAD_PLUGIN (*gpMetaUtilFuncs->pfnUnloadPlugin)
#define UNLOAD_PLUGIN_BY_HANDLE (*gpMetaUtilFuncs->pfnUnloadPluginByHandle)
2016-07-04 12:07:29 +06:00
#define IS_QUERYING_CLIENT_CVAR (*gpMetaUtilFuncs->pfnIsQueryingClientCvar)
#define MAKE_REQUESTID (*gpMetaUtilFuncs->pfnMakeRequestId)
#define GET_HOOK_TABLES (*gpMetaUtilFuncs->pfnGetHookTables)
#ifdef UNFINISHED
#define HOOK_GAME_EVENT (*gpMetaUtilFuncs->pfnHookGameEvent)
#define HOOK_LOG_TRIGGER (*gpMetaUtilFuncs->pfnHookLogTrigger)
#define HOOK_LOG_STRING (*gpMetaUtilFuncs->pfnHookLogString)
#define HOOK_LOG_REGEX (*gpMetaUtilFuncs->pfnHookLogRegex)
#define REMOVE_HOOK_ID (*gpMetaUtilFuncs->pfnRemoveHookID)
#define REMOVE_HOOK_ALL (*gpMetaUtilFuncs->pfnRemoveHookAll)
2016-07-26 23:31:47 +07:00
#endif