1
0
mirror of https://github.com/alliedmodders/metamod-source.git synced 2025-01-30 19:52:17 +01:00

broke api! refactored a bunch of very, very old things

--HG--
extra : convert_revision : svn%3Ac2935e3e-5518-0410-8daf-afa5dab7d4e3/trunk%40460
This commit is contained in:
David Anderson 2007-10-06 15:47:59 +00:00
parent 7281835f13
commit 7af5ce0e00
5 changed files with 36 additions and 73 deletions

View File

@ -68,7 +68,7 @@ public:
* @param msg Formatted string.
*/
virtual void LogMsg(ISmmPlugin *pl, const char *msg, ...) =0;
public:
/**
* @brief Returns an interface factory for the HL2 engine.
*
@ -76,7 +76,7 @@ public:
* If syn is false, the true function is returned.
* @return CreateInterfaceFn function pointer.
*/
virtual CreateInterfaceFn engineFactory(bool syn=true) =0;
virtual CreateInterfaceFn GetEngineFactory(bool syn=true) =0;
/**
* @brief Returns an interface factory for the HL2 physics engine.
@ -85,7 +85,7 @@ public:
* If syn is false, the true function is returned.
* @return CreateInterfaceFn function pointer.
*/
virtual CreateInterfaceFn physicsFactory(bool syn=true) =0;
virtual CreateInterfaceFn GetPhysicsFactory(bool syn=true) =0;
/**
* @brief Returns an interface factory for the HL2 file system.
@ -94,7 +94,7 @@ public:
* If syn is false, the true function is returned.
* @return CreateInterfaceFn function pointer.
*/
virtual CreateInterfaceFn fileSystemFactory(bool syn=true) =0;
virtual CreateInterfaceFn GetFileSystemFactory(bool syn=true) =0;
/**
* @brief Returns an interface factory for the GameDLL.
@ -103,38 +103,14 @@ public:
* If syn is false, the true function is returned.
* @return CreateInterfaceFn function pointer.
*/
virtual CreateInterfaceFn serverFactory(bool syn=true) =0;
virtual CreateInterfaceFn GetServerFactory(bool syn=true) =0;
/**
* @brief Returns a CGlobalVars pointer from the HL2 Engine.
*
* @return CGlobalVars pointer.
*/
virtual CGlobalVars *pGlobals() =0;
/**
* @brief Used with SourceHook, sets teh last meta return value.
* Note: Do not call this directly, use the Metamod macros.
*
* @param res META_RETURN value to set.
*/
virtual void SetLastMetaReturn(META_RES res) =0;
/**
* @brief Used with SourceHook, returns the last meta return value.
* Note: This is only valid inside a hook function.
*
* @return Last META_RETURN value set by a plugin.
*/
virtual META_RES GetLastMetaReturn() =0;
public: // Added in 1.00-RC2 (0:0)
/**
* @brief Allows access to Metamod's ConCommandBaseAccessor.
*
* @return Returns IConCommandBaseAccessor pointer.
*/
virtual IConCommandBaseAccessor *GetCvarBaseAccessor() =0;
virtual CGlobalVars *GetCGlobals() =0;
/**
* @brief Registers a ConCommandBase.
@ -143,7 +119,7 @@ public: // Added in 1.00-RC2 (0:0)
* @param pCommand ConCommandBase to register.
* @return True if successful, false otherwise.
*/
virtual bool RegisterConCmdBase(ISmmPlugin *plugin, ConCommandBase *pCommand) =0;
virtual bool RegisterConCommandBase(ISmmPlugin *plugin, ConCommandBase *pCommand) =0;
/**
* @brief Unregisters a ConCommandBase.
@ -151,7 +127,7 @@ public: // Added in 1.00-RC2 (0:0)
* @param plugin Parent plugin API pointer.
* @param pCommand ConCommandBase to unlink.
*/
virtual void UnregisterConCmdBase(ISmmPlugin *plugin, ConCommandBase *pCommand) =0;
virtual void UnregisterConCommandBase(ISmmPlugin *plugin, ConCommandBase *pCommand) =0;
/**
* @brief Prints an unformatted string to the remote server console.
@ -171,14 +147,6 @@ public: // Added in 1.00-RC2 (0:0)
*/
virtual void ConPrintf(const char *fmt, ...) =0;
public: // Added in 1.1.0 (1:0)
/**
* @brief Checks if ConPrint/ConPrintf will mirror to rcon.
*
* @return True if remote printing available, false otherwise.
*/
virtual bool RemotePrintingAvailable() =0;
/**
* @brief Returns the Metamod Version numbers as major version and minor (API) version.
* Changes to minor version are guaranteed to be backwards compatible.
@ -217,7 +185,6 @@ public: // Added in 1.1.0 (1:0)
*/
virtual void *MetaFactory(const char *iface, int *ret, PluginId *id) =0;
public: // Added in 1.1.2 (1:1)
/**
* @brief Given a base interface name, such as ServerGameDLL or ServerGameDLL003,
* reformats the string to increase the number, then returns the new number.
@ -229,7 +196,6 @@ public: // Added in 1.1.2 (1:1)
*/
virtual int FormatIface(char iface[], unsigned int maxlength) =0;
public: // Added in 1.2 (1:2)
/**
* @brief Searches for an interface, eliminating the need to loop through FormatIface().
*
@ -261,7 +227,6 @@ public: // Added in 1.2 (1:2)
*/
virtual void PathFormat(char *buffer, size_t len, const char *fmt, ...) =0;
public: // Added in 1.2.2 (1:3)
/**
* @brief Prints text in the specified client's console. Same as
* IVEngineServer::ClientPrintf except that it allows for string formatting.
@ -271,7 +236,6 @@ public: // Added in 1.2.2 (1:3)
*/
virtual void ClientConPrintf(edict_t *client, const char *fmt, ...) =0;
public: // Added in 1.3 (1:4)
/**
* @brief Wrapper around InterfaceSearch(). Assumes no maximum.
* This is designed to replace the fact that searches only went upwards.
@ -290,7 +254,6 @@ public: // Added in 1.3 (1:4)
*/
virtual void *VInterfaceMatch(CreateInterfaceFn fn, const char *iface, int min=-1) =0;
public: // Added in 1.4 (1:5)
/**
* @brief Tells SourceMM to add VSP hooking capability to plugins.
*
@ -338,7 +301,6 @@ public: // Added in 1.4 (1:5)
*/
virtual const char *GetUserMessage(int index, int *size=NULL) =0;
public: // Added in 1.5.0 (1:6)
/**
* @brief Returns the highest interface version of IServerPluginCallbacks
* that the engine supports. This is useful for games that run on older
@ -350,7 +312,6 @@ public: // Added in 1.5.0 (1:6)
*/
virtual int GetVSPVersion() =0;
public: // Added in 1.6.0 (1:7)
/**
* @brief Returns the engine interface that MM:S is using as a backend.
*
@ -386,7 +347,7 @@ public: // Added in 1.6.0 (1:7)
* 1.3 Added new interface search API.
* 1.4 Added VSP listener and user message API.
* 1.5.0 Added API for getting highest supported version of IServerPluginCallbacks.
* 1.6.0 Added API for Orange Box.
* 1.6.0 Added API for Orange Box. Broke backwards compatibility.
*/
#endif //_INCLUDE_ISMM_API_H

View File

@ -37,7 +37,7 @@
#include <sourcehook.h>
#include "ISmmAPI.h"
#define PLAPI_VERSION 12
#define PLAPI_VERSION 13
#define PLAPI_NAME "ISmmPlugin"
class ISmmAPI;
@ -389,10 +389,10 @@ public:
g_PLID = id;
#define META_LOG g_SMAPI->LogMsg
#define META_REGCMD(name) g_SMAPI->RegisterConCmdBase(g_PLAPI, name##_command)
#define META_REGCVAR(var) g_SMAPI->RegisterConCmdBase(g_PLAPI, var)
#define META_UNREGCMD(name) g_SMAPI->UnregisterConCmdBase(g_PLAPI, name##_command)
#define META_UNREGCVAR(var) g_SMAPI->UnregisterConCmdBase(g_PLAPI, var)
#define META_REGCMD(name) g_SMAPI->RegisterConCommandBase(g_PLAPI, name##_command)
#define META_REGCVAR(var) g_SMAPI->RegisterConCommandBase(g_PLAPI, var)
#define META_UNREGCMD(name) g_SMAPI->UnregisterConCommandBase(g_PLAPI, name##_command)
#define META_UNREGCVAR(var) g_SMAPI->UnregisterConCommandBase(g_PLAPI, var)
#define META_CONPRINT g_SMAPI->ConPrint
#define META_CONPRINTF g_SMAPI->ConPrintf

View File

@ -801,7 +801,7 @@ void MetamodSource::LogMsg(ISmmPlugin *pl, const char *msg, ...)
LogMessage("[%s] %s", pl->GetLogTag(), buffer);
}
CreateInterfaceFn MetamodSource::engineFactory(bool syn/* =true */)
CreateInterfaceFn MetamodSource::GetEngineFactory(bool syn/* =true */)
{
if (syn)
{
@ -811,7 +811,7 @@ CreateInterfaceFn MetamodSource::engineFactory(bool syn/* =true */)
return engine_factory;
}
CreateInterfaceFn MetamodSource::physicsFactory(bool syn/* =true */)
CreateInterfaceFn MetamodSource::GetPhysicsFactory(bool syn/* =true */)
{
if (syn)
{
@ -821,7 +821,7 @@ CreateInterfaceFn MetamodSource::physicsFactory(bool syn/* =true */)
return physics_factory;
}
CreateInterfaceFn MetamodSource::fileSystemFactory(bool syn/* =true */)
CreateInterfaceFn MetamodSource::GetFileSystemFactory(bool syn/* =true */)
{
if (syn)
{
@ -831,7 +831,7 @@ CreateInterfaceFn MetamodSource::fileSystemFactory(bool syn/* =true */)
return filesystem_factory;
}
CreateInterfaceFn MetamodSource::serverFactory(bool syn/* =true */)
CreateInterfaceFn MetamodSource::GetServerFactory(bool syn/* =true */)
{
if (syn)
{
@ -841,7 +841,7 @@ CreateInterfaceFn MetamodSource::serverFactory(bool syn/* =true */)
return gamedll_info.factory;
}
CGlobalVars *MetamodSource::pGlobals()
CGlobalVars *MetamodSource::GetCGlobals()
{
return gpGlobals;
}
@ -1148,7 +1148,7 @@ IConCommandBaseAccessor *MetamodSource::GetCvarBaseAccessor()
return provider->GetConCommandBaseAccessor();
}
bool MetamodSource::RegisterConCmdBase(ISmmPlugin *plugin, ConCommandBase *pCommand)
bool MetamodSource::RegisterConCommandBase(ISmmPlugin *plugin, ConCommandBase *pCommand)
{
if (provider->IsConCommandBaseACommand(pCommand))
{
@ -1162,7 +1162,7 @@ bool MetamodSource::RegisterConCmdBase(ISmmPlugin *plugin, ConCommandBase *pComm
return provider->RegisterConCommandBase(pCommand);
}
void MetamodSource::UnregisterConCmdBase(ISmmPlugin *plugin, ConCommandBase *pCommand)
void MetamodSource::UnregisterConCommandBase(ISmmPlugin *plugin, ConCommandBase *pCommand)
{
if (provider->IsConCommandBaseACommand(pCommand))
{

View File

@ -51,23 +51,23 @@ using namespace SourceMM;
*/
#define SOURCEMM_VERSION SVN_FILE_VERSION_STRING
#define SOURCEMM_DATE __DATE__
#define SM_VERS_API_MAJOR 1 //increase this on a breaking change
#define SM_VERS_API_MINOR 7 //increase this on a non-breaking API change
#define SM_VERS_API_MAJOR 2 //increase this on a breaking change
#define SM_VERS_API_MINOR 0 //increase this on a non-breaking API change
class MetamodSource : public ISmmAPI
{
public:
void LogMsg(ISmmPlugin *pl, const char *msg, ...);
CreateInterfaceFn engineFactory(bool syn=true);
CreateInterfaceFn physicsFactory(bool syn=true);
CreateInterfaceFn fileSystemFactory(bool syn=true);
CreateInterfaceFn serverFactory(bool syn=true);
CGlobalVars *pGlobals();
CreateInterfaceFn GetEngineFactory(bool syn=true);
CreateInterfaceFn GetPhysicsFactory(bool syn=true);
CreateInterfaceFn GetFileSystemFactory(bool syn=true);
CreateInterfaceFn GetServerFactory(bool syn=true);
CGlobalVars *GetCGlobals();
void SetLastMetaReturn(META_RES res);
META_RES GetLastMetaReturn();
IConCommandBaseAccessor *GetCvarBaseAccessor();
bool RegisterConCmdBase(ISmmPlugin *plugin, ConCommandBase *pCommand);
void UnregisterConCmdBase(ISmmPlugin *plugin, ConCommandBase *pCommand);
bool RegisterConCommandBase(ISmmPlugin *plugin, ConCommandBase *pCommand);
void UnregisterConCommandBase(ISmmPlugin *plugin, ConCommandBase *pCommand);
void ConPrint(const char *str);
void ConPrintf(const char *fmt, ...);
bool RemotePrintingAvailable();

View File

@ -48,17 +48,19 @@
* 4: Added AllPluginsLoaded() callback (2005-04-18)
* 5: Bumped version for SourceHook V4 (2005-05-01)
* 6: Added functions for console printing (2005-05-26)
* M 7: Changed template libraries (2005-08-11)
* 7: Changed template libraries (2005-08-11)
* New loading structure mechanism
* New SourceHook version
* 8: New SourceHook version (2005-12-23)
* New ISmmAPI additions
* 9: New ISmmPluginManager additions
* C 10: Added VSP listen functions to ISmmAPI and IMetamodListener (2007-02-09)
* C 11: New SourceHook version V5 (May, 2007)
* 10: Added VSP listen functions to ISmmAPI and IMetamodListener (2007-02-09)
* 11: New SourceHook version v4.5 (May, 2007)
* 12: Orange Box API
* MC 13: Breaking of API for next SH version and other API changes
*/
#define PLAPI_MIN_VERSION 7
#define PLAPI_MIN_VERSION 13
namespace SourceMM
{