2008-11-14 11:25:40 +01:00
|
|
|
/* ======== SourceMM ========
|
2010-05-19 08:28:55 +02:00
|
|
|
* Copyright (C) 2004-2010 Metamod:Source Development Team
|
2008-11-14 11:25:40 +01:00
|
|
|
* No warranties of any kind
|
|
|
|
*
|
|
|
|
* License: zlib/libpng
|
|
|
|
*
|
|
|
|
* Author(s): David "BAILOPAN" Anderson
|
|
|
|
* ============================
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _INCLUDE_CSMM_API_H
|
|
|
|
#define _INCLUDE_CSMM_API_H
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Header for CSmmAPI implementation
|
|
|
|
* @file CSmmAPI.h
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "ISmmAPI.h"
|
|
|
|
|
|
|
|
typedef void (*CONPRINTF_FUNC)(const char *, ...);
|
|
|
|
|
|
|
|
namespace SourceMM
|
|
|
|
{
|
|
|
|
class CSmmAPI : public ISmmAPI
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
CSmmAPI();
|
|
|
|
public:
|
|
|
|
void LogMsg(ISmmPlugin *pl, const char *msg, ...);
|
|
|
|
public:
|
|
|
|
CreateInterfaceFn engineFactory(bool syn=true);
|
|
|
|
CreateInterfaceFn physicsFactory(bool syn=true);
|
|
|
|
CreateInterfaceFn fileSystemFactory(bool syn=true);
|
|
|
|
CreateInterfaceFn serverFactory(bool syn=true);
|
|
|
|
CGlobalVars *pGlobals();
|
|
|
|
void SetLastMetaReturn(META_RES res);
|
|
|
|
META_RES GetLastMetaReturn();
|
|
|
|
IConCommandBaseAccessor *GetCvarBaseAccessor();
|
|
|
|
bool RegisterConCmdBase(ISmmPlugin *plugin, ConCommandBase *pCommand);
|
|
|
|
void UnregisterConCmdBase(ISmmPlugin *plugin, ConCommandBase *pCommand);
|
|
|
|
void ConPrint(const char *fmt);
|
|
|
|
void ConPrintf(const char *fmt, ...);
|
|
|
|
bool RemotePrintingAvailable()
|
|
|
|
{
|
|
|
|
return CmdCacheSuccessful();
|
|
|
|
}
|
|
|
|
virtual void GetApiVersions(int &major, int &minor, int &plvers, int &plmin);
|
|
|
|
virtual void GetShVersions(int &shvers, int &shimpl);
|
|
|
|
virtual void AddListener(ISmmPlugin *plugin, IMetamodListener *pListener);
|
|
|
|
virtual void *MetaFactory(const char *iface, int *ret, PluginId *id);
|
|
|
|
virtual int FormatIface(char buffer[], unsigned int maxlength);
|
|
|
|
virtual void *InterfaceSearch(CreateInterfaceFn fn, const char *iface, int max, int *ret);
|
|
|
|
virtual const char *GetBaseDir();
|
|
|
|
virtual void PathFormat(char *buffer, size_t len, const char *fmt, ...);
|
2009-10-29 08:52:39 +01:00
|
|
|
virtual IServerPluginCallbacks *GetVSPInfo(int *pVersion);
|
2008-11-14 11:25:40 +01:00
|
|
|
void ClientConPrintf(edict_t *client, const char *fmt, ...);
|
|
|
|
void *VInterfaceMatch(CreateInterfaceFn fn, const char *iface, int min=-1);
|
|
|
|
void EnableVSPListener();
|
|
|
|
int GetGameDLLVersion();
|
|
|
|
int GetUserMessageCount();
|
|
|
|
int FindUserMessage(const char *name, int *size=NULL);
|
|
|
|
const char *GetUserMessage(int index, int *size=NULL);
|
2009-10-29 09:12:10 +01:00
|
|
|
int GetSourceEngineBuild();
|
2008-11-14 11:25:40 +01:00
|
|
|
public:
|
|
|
|
bool CacheCmds();
|
|
|
|
bool CmdCacheSuccessful();
|
|
|
|
void LoadAsVSP();
|
|
|
|
bool VSPEnabled()
|
|
|
|
{
|
|
|
|
return m_VSP;
|
|
|
|
}
|
2009-12-10 07:59:50 +01:00
|
|
|
void CacheUserMessages();
|
2010-05-19 08:28:55 +02:00
|
|
|
void GetFullPluginPath(const char *plugin, char *buffer, size_t len);
|
2008-11-14 11:25:40 +01:00
|
|
|
private:
|
|
|
|
META_RES m_Res;
|
|
|
|
CONPRINTF_FUNC m_ConPrintf;
|
|
|
|
bool m_CmdCache;
|
|
|
|
bool m_VSP;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
extern SourceMM::CSmmAPI g_SmmAPI;
|
|
|
|
|
|
|
|
#define CONMSG g_SmmAPI.ConPrintf
|
|
|
|
#define CLIENT_CONMSG g_SmmAPI.ClientConPrintf
|
|
|
|
|
|
|
|
#endif //_INCLUDE_CSMM_API_H
|