core/sourcemm_api.h
author David Anderson <dvander@alliedmods.net>
Sun Aug 26 18:41:57 2007 +0000 (2007-08-26)
changeset 1371 d207f0e17532
parent 1330 ab94316bb52b
child 1541 e46ad208b9b4
permissions -rw-r--r--
added amb727 (sm_time_adjustment)
dvander@370
     1
/**
ds@653
     2
 * vim: set ts=4 :
ds@1330
     3
 * =============================================================================
dvander@1231
     4
 * SourceMod
dvander@1231
     5
 * Copyright (C) 2004-2007 AlliedModders LLC.  All rights reserved.
ds@1330
     6
 * =============================================================================
dvander@370
     7
 *
ds@1330
     8
 * This program is free software; you can redistribute it and/or modify it under
ds@1330
     9
 * the terms of the GNU General Public License, version 3.0, as published by the
ds@1330
    10
 * Free Software Foundation.
dvander@1231
    11
 * 
ds@1330
    12
 * This program is distributed in the hope that it will be useful, but WITHOUT
ds@1330
    13
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
ds@1330
    14
 * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
ds@1330
    15
 * details.
dvander@1231
    16
 *
ds@1330
    17
 * You should have received a copy of the GNU General Public License along with
ds@1330
    18
 * this program.  If not, see <http://www.gnu.org/licenses/>.
dvander@1231
    19
 *
ds@1330
    20
 * As a special exception, AlliedModders LLC gives you permission to link the
ds@1330
    21
 * code of this program (as well as its derivative works) to "Half-Life 2," the
ds@1330
    22
 * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
ds@1330
    23
 * by the Valve Corporation.  You must obey the GNU General Public License in
ds@1330
    24
 * all respects for all other code used.  Additionally, AlliedModders LLC grants
ds@1330
    25
 * this exception to all derivative works.  AlliedModders LLC defines further
ds@1330
    26
 * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
ds@1330
    27
 * or <http://www.sourcemod.net/license.php>.
dvander@370
    28
 *
dvander@370
    29
 * Version: $Id$
dvander@370
    30
 */
dvander@370
    31
dvander@145
    32
#ifndef _INCLUDE_SOURCEMOD_MM_API_H_
dvander@145
    33
#define _INCLUDE_SOURCEMOD_MM_API_H_
dvander@145
    34
ds@457
    35
#include "convar_sm.h"
dvander@145
    36
#include <ISmmPlugin.h>
dvander@209
    37
#include <eiface.h>
dvander@453
    38
#include <igameevents.h>
dvander@644
    39
#include <iplayerinfo.h>
dvander@530
    40
#include <random.h>
faluco@654
    41
#include <filesystem.h>
faluco@656
    42
#include <IEngineSound.h>
dvander@145
    43
dvander@162
    44
/**
dvander@162
    45
 * @file Contains wrappers around required Metamod:Source API exports
dvander@162
    46
 */
dvander@162
    47
ds@675
    48
class SourceMod_Core : 
ds@675
    49
	public ISmmPlugin,
ds@675
    50
	public IMetamodListener
dvander@145
    51
{
dvander@145
    52
public:
dvander@145
    53
	bool Load(PluginId id, ISmmAPI *ismm, char *error, size_t maxlen, bool late);
dvander@145
    54
	bool Unload(char *error, size_t maxlen);
dvander@145
    55
	bool Pause(char *error, size_t maxlen);
dvander@145
    56
	bool Unpause(char *error, size_t maxlen);
dvander@145
    57
	void AllPluginsLoaded();
dvander@145
    58
public:
dvander@145
    59
	const char *GetAuthor();
dvander@145
    60
	const char *GetName();
dvander@145
    61
	const char *GetDescription();
dvander@145
    62
	const char *GetURL();
dvander@145
    63
	const char *GetLicense();
dvander@145
    64
	const char *GetVersion();
dvander@145
    65
	const char *GetDate();
dvander@145
    66
	const char *GetLogTag();
ds@675
    67
public:
ds@675
    68
	void OnVSPListening(IServerPluginCallbacks *iface);
ds@1145
    69
#if PLAPI_VERSION >= 12
ds@1145
    70
	void OnUnlinkConCommandBase(PluginId id, ConCommandBase *pCommand);
ds@1145
    71
#else
ds@1145
    72
	void OnPluginUnload(PluginId id);
ds@1145
    73
#endif
dvander@145
    74
};
dvander@145
    75
dvander@160
    76
extern SourceMod_Core g_SourceMod_Core;
dvander@209
    77
extern IVEngineServer *engine;
dvander@209
    78
extern IServerGameDLL *gamedll;
faluco@226
    79
extern IServerGameClients *serverClients;
ds@457
    80
extern ICvar *icvar;
dvander@304
    81
extern ISmmPluginManager *g_pMMPlugins;
dvander@448
    82
extern CGlobalVars *gpGlobals;
dvander@453
    83
extern IGameEventManager2 *gameevents;
dvander@496
    84
extern SourceHook::CallClass<IVEngineServer> *enginePatch;
dvander@532
    85
extern SourceHook::CallClass<IServerGameDLL> *gamedllPatch;
dvander@530
    86
extern IUniformRandomStream *engrandom;
dvander@644
    87
extern IPlayerInfoManager *playerinfo;
faluco@654
    88
extern IBaseFileSystem *basefilesystem;
faluco@656
    89
extern IEngineSound *enginesound;
faluco@659
    90
extern IServerPluginHelpers *serverpluginhelpers;
dvander@496
    91
dvander@496
    92
#define ENGINE_CALL(func)		SH_CALL(enginePatch, &IVEngineServer::func)
dvander@532
    93
#define SERVER_CALL(func)		SH_CALL(gamedllPatch, &IServerGameDLL::func)
dvander@145
    94
dvander@145
    95
PLUGIN_GLOBALVARS();
dvander@145
    96
dvander@145
    97
#endif //_INCLUDE_SOURCEMOD_MM_API_H_