1.1 --- a/sourcemm/CSmmAPI.h Fri Sep 21 16:54:52 2007 +0000
1.2 +++ b/sourcemm/CSmmAPI.h Fri Sep 21 18:03:57 2007 +0000
1.3 @@ -29,69 +29,67 @@
1.4
1.5 typedef void (*CONPRINTF_FUNC)(const char *, ...);
1.6
1.7 -namespace SourceMM
1.8 +class CSmmAPI : public ISmmAPI
1.9 {
1.10 - class CSmmAPI : public ISmmAPI
1.11 +public:
1.12 + CSmmAPI();
1.13 + ~CSmmAPI();
1.14 +public:
1.15 + void LogMsg(ISmmPlugin *pl, const char *msg, ...);
1.16 +public:
1.17 + CreateInterfaceFn engineFactory(bool syn=true);
1.18 + CreateInterfaceFn physicsFactory(bool syn=true);
1.19 + CreateInterfaceFn fileSystemFactory(bool syn=true);
1.20 + CreateInterfaceFn serverFactory(bool syn=true);
1.21 + CGlobalVars *pGlobals();
1.22 + void SetLastMetaReturn(META_RES res);
1.23 + META_RES GetLastMetaReturn();
1.24 + IConCommandBaseAccessor *GetCvarBaseAccessor();
1.25 + bool RegisterConCmdBase(ISmmPlugin *plugin, ConCommandBase *pCommand);
1.26 + void UnregisterConCmdBase(ISmmPlugin *plugin, ConCommandBase *pCommand);
1.27 + void ConPrint(const char *fmt);
1.28 + void ConPrintf(const char *fmt, ...);
1.29 + bool RemotePrintingAvailable()
1.30 {
1.31 - public:
1.32 - CSmmAPI();
1.33 - ~CSmmAPI();
1.34 - public:
1.35 - void LogMsg(ISmmPlugin *pl, const char *msg, ...);
1.36 - public:
1.37 - CreateInterfaceFn engineFactory(bool syn=true);
1.38 - CreateInterfaceFn physicsFactory(bool syn=true);
1.39 - CreateInterfaceFn fileSystemFactory(bool syn=true);
1.40 - CreateInterfaceFn serverFactory(bool syn=true);
1.41 - CGlobalVars *pGlobals();
1.42 - void SetLastMetaReturn(META_RES res);
1.43 - META_RES GetLastMetaReturn();
1.44 - IConCommandBaseAccessor *GetCvarBaseAccessor();
1.45 - bool RegisterConCmdBase(ISmmPlugin *plugin, ConCommandBase *pCommand);
1.46 - void UnregisterConCmdBase(ISmmPlugin *plugin, ConCommandBase *pCommand);
1.47 - void ConPrint(const char *fmt);
1.48 - void ConPrintf(const char *fmt, ...);
1.49 - bool RemotePrintingAvailable()
1.50 - {
1.51 - return CmdCacheSuccessful();
1.52 - }
1.53 - virtual void GetApiVersions(int &major, int &minor, int &plvers, int &plmin);
1.54 - virtual void GetShVersions(int &shvers, int &shimpl);
1.55 - virtual void AddListener(ISmmPlugin *plugin, IMetamodListener *pListener);
1.56 - virtual void *MetaFactory(const char *iface, int *ret, PluginId *id);
1.57 - virtual int FormatIface(char buffer[], unsigned int maxlength);
1.58 - virtual void *InterfaceSearch(CreateInterfaceFn fn, const char *iface, int max, int *ret);
1.59 - virtual const char *GetBaseDir();
1.60 - virtual void PathFormat(char *buffer, size_t len, const char *fmt, ...);
1.61 - void ClientConPrintf(edict_t *client, const char *fmt, ...);
1.62 - void *VInterfaceMatch(CreateInterfaceFn fn, const char *iface, int min=-1);
1.63 - void EnableVSPListener();
1.64 - int GetGameDLLVersion();
1.65 - int GetUserMessageCount();
1.66 - int FindUserMessage(const char *name, int *size=NULL);
1.67 - const char *GetUserMessage(int index, int *size=NULL);
1.68 - int GetVSPVersion();
1.69 - public:
1.70 - bool CacheCmds();
1.71 - bool CmdCacheSuccessful();
1.72 - void LoadAsVSP();
1.73 - bool VSPEnabled()
1.74 - {
1.75 - return m_VSP;
1.76 - }
1.77 - bool CacheUserMessages();
1.78 - bool MsgCacheSuccessful();
1.79 - private:
1.80 - META_RES m_Res;
1.81 - CONPRINTF_FUNC m_ConPrintf;
1.82 - bool m_CmdCache;
1.83 - bool m_VSP;
1.84 - int m_MsgCount;
1.85 - UserMsgDict m_UserMessages;
1.86 - };
1.87 + return CmdCacheSuccessful();
1.88 + }
1.89 + virtual void GetApiVersions(int &major, int &minor, int &plvers, int &plmin);
1.90 + virtual void GetShVersions(int &shvers, int &shimpl);
1.91 + virtual void AddListener(ISmmPlugin *plugin, IMetamodListener *pListener);
1.92 + virtual void *MetaFactory(const char *iface, int *ret, PluginId *id);
1.93 + virtual int FormatIface(char buffer[], unsigned int maxlength);
1.94 + virtual void *InterfaceSearch(CreateInterfaceFn fn, const char *iface, int max, int *ret);
1.95 + virtual const char *GetBaseDir();
1.96 + virtual void PathFormat(char *buffer, size_t len, const char *fmt, ...);
1.97 + void ClientConPrintf(edict_t *client, const char *fmt, ...);
1.98 + void *VInterfaceMatch(CreateInterfaceFn fn, const char *iface, int min=-1);
1.99 + void EnableVSPListener();
1.100 + int GetGameDLLVersion();
1.101 + int GetUserMessageCount();
1.102 + int FindUserMessage(const char *name, int *size=NULL);
1.103 + const char *GetUserMessage(int index, int *size=NULL);
1.104 + int GetVSPVersion();
1.105 + int GetSourceEngineBuild();
1.106 +public:
1.107 + bool CacheCmds();
1.108 + bool CmdCacheSuccessful();
1.109 + void LoadAsVSP();
1.110 + bool VSPEnabled()
1.111 + {
1.112 + return m_VSP;
1.113 + }
1.114 + bool CacheUserMessages();
1.115 + bool MsgCacheSuccessful();
1.116 +private:
1.117 + META_RES m_Res;
1.118 + CONPRINTF_FUNC m_ConPrintf;
1.119 + bool m_CmdCache;
1.120 + bool m_VSP;
1.121 + int m_MsgCount;
1.122 + UserMsgDict m_UserMessages;
1.123 };
1.124
1.125 -extern SourceMM::CSmmAPI g_SmmAPI;
1.126 +extern CSmmAPI g_SmmAPI;
1.127
1.128 #define CONMSG g_SmmAPI.ConPrintf
1.129 #define CLIENT_CONMSG g_SmmAPI.ClientConPrintf