2005-04-17 01:35:37 +02:00
|
|
|
/* ======== SourceMM ========
|
2006-01-07 15:38:18 +01:00
|
|
|
* Copyright (C) 2004-2006 Metamod:Source Development Team
|
2005-04-17 01:35:37 +02: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"
|
|
|
|
|
2005-06-25 00:26:19 +02:00
|
|
|
typedef void (*CONPRINTF_FUNC)(const char *, ...);
|
|
|
|
|
2005-04-19 07:36:59 +02:00
|
|
|
namespace SourceMM
|
2005-04-17 01:35:37 +02:00
|
|
|
{
|
2005-04-19 07:36:59 +02:00
|
|
|
class CSmmAPI : public ISmmAPI
|
|
|
|
{
|
2005-06-25 00:26:19 +02:00
|
|
|
public:
|
2006-08-09 03:52:49 +02:00
|
|
|
CSmmAPI();
|
2005-04-19 07:36:59 +02:00
|
|
|
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();
|
2005-05-16 22:15:57 +02:00
|
|
|
IConCommandBaseAccessor *GetCvarBaseAccessor();
|
2005-05-26 10:06:23 +02:00
|
|
|
bool RegisterConCmdBase(ISmmPlugin *plugin, ConCommandBase *pCommand);
|
|
|
|
void UnregisterConCmdBase(ISmmPlugin *plugin, ConCommandBase *pCommand);
|
2005-06-25 00:26:19 +02:00
|
|
|
void ConPrint(const char *fmt);
|
|
|
|
void ConPrintf(const char *fmt, ...);
|
|
|
|
bool CacheSuccessful();
|
2005-10-06 23:59:10 +02:00
|
|
|
bool RemotePrintingAvailable()
|
|
|
|
{
|
|
|
|
return CacheSuccessful();
|
|
|
|
}
|
|
|
|
virtual void GetApiVersions(int &major, int &minor, int &plvers, int &plmin);
|
|
|
|
virtual void GetShVersions(int &shvers, int &shimpl);
|
2005-10-20 16:37:47 +02:00
|
|
|
virtual void AddListener(ISmmPlugin *plugin, IMetamodListener *pListener);
|
2005-10-20 16:52:49 +02:00
|
|
|
virtual void *MetaFactory(const char *iface, int *ret, PluginId *id);
|
2005-12-06 08:59:18 +01:00
|
|
|
virtual int FormatIface(char buffer[], unsigned int maxlength);
|
2005-12-24 00:38:38 +01:00
|
|
|
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, ...);
|
2006-04-21 08:35:47 +02:00
|
|
|
void ClientConPrintf(edict_t *client, const char *fmt, ...);
|
2006-08-15 22:10:12 +02:00
|
|
|
void *VInterfaceMatch(CreateInterfaceFn fn, const char *iface, int min=-1);
|
2005-06-25 00:26:19 +02:00
|
|
|
public:
|
|
|
|
bool CacheCmds();
|
2005-04-19 07:36:59 +02:00
|
|
|
private:
|
|
|
|
META_RES m_Res;
|
2005-06-25 00:26:19 +02:00
|
|
|
CONPRINTF_FUNC m_ConPrintf;
|
|
|
|
bool m_Cache;
|
2005-04-19 07:36:59 +02:00
|
|
|
};
|
2005-04-17 01:35:37 +02:00
|
|
|
};
|
|
|
|
|
2005-04-19 07:36:59 +02:00
|
|
|
extern SourceMM::CSmmAPI g_SmmAPI;
|
2005-04-17 01:35:37 +02:00
|
|
|
|
2006-04-21 08:35:47 +02:00
|
|
|
#define CONMSG g_SmmAPI.ConPrintf
|
|
|
|
#define CLIENT_CONMSG g_SmmAPI.ClientConPrintf
|
2005-06-25 00:26:19 +02:00
|
|
|
|
2005-04-17 01:35:37 +02:00
|
|
|
#endif //_INCLUDE_CSMM_API_H
|