core/sourcemm_api.h
author Peace-Maker <januk@freenet.de>
Wed Apr 23 08:55:09 2014 -0400 (2014-04-23)
changeset 4330 98726cea1607
parent 3929 0bc0ffdb2eba
permissions -rw-r--r--
Mark CS:S as supporting HudMsg (bug 6108, r=psychonic).
dvander@370
     1
/**
ds@653
     2
 * vim: set ts=4 :
ds@1330
     3
 * =============================================================================
dvander@1231
     4
 * SourceMod
ds@3099
     5
 * Copyright (C) 2004-2010 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
skamonkey@3899
    35
#if SOURCE_ENGINE == SE_DOTA
skamonkey@3899
    36
#include "convar_sm_dota.h"
skamonkey@3899
    37
#elif SOURCE_ENGINE >= SE_ALIENSWARM
ds@3099
    38
#include "convar_sm_swarm.h"
skamonkey@3613
    39
#elif SOURCE_ENGINE >= SE_LEFT4DEAD
ds@2400
    40
#include "convar_sm_l4d.h"
skamonkey@3613
    41
#elif SOURCE_ENGINE >= SE_ORANGEBOX
ds@2400
    42
#include "convar_sm_ob.h"
faluco@1541
    43
#else
ds@2400
    44
#include "convar_sm.h"
faluco@1541
    45
#endif
dvander@145
    46
#include <ISmmPlugin.h>
dvander@209
    47
#include <eiface.h>
dvander@453
    48
#include <igameevents.h>
dvander@644
    49
#include <iplayerinfo.h>
dvander@530
    50
#include <random.h>
faluco@654
    51
#include <filesystem.h>
faluco@656
    52
#include <IEngineSound.h>
dvander@145
    53
faluco@1541
    54
#ifndef METAMOD_PLAPI_VERSION
faluco@1541
    55
	#include <metamod_wrappers.h>
faluco@1541
    56
#endif
faluco@1541
    57
dvander@162
    58
/**
dvander@162
    59
 * @file Contains wrappers around required Metamod:Source API exports
dvander@162
    60
 */
dvander@162
    61
ds@675
    62
class SourceMod_Core : 
ds@675
    63
	public ISmmPlugin,
ds@675
    64
	public IMetamodListener
dvander@145
    65
{
dvander@145
    66
public:
dvander@145
    67
	bool Load(PluginId id, ISmmAPI *ismm, char *error, size_t maxlen, bool late);
dvander@145
    68
	bool Unload(char *error, size_t maxlen);
dvander@145
    69
	bool Pause(char *error, size_t maxlen);
dvander@145
    70
	bool Unpause(char *error, size_t maxlen);
dvander@145
    71
	void AllPluginsLoaded();
dvander@145
    72
public:
dvander@145
    73
	const char *GetAuthor();
dvander@145
    74
	const char *GetName();
dvander@145
    75
	const char *GetDescription();
dvander@145
    76
	const char *GetURL();
dvander@145
    77
	const char *GetLicense();
dvander@145
    78
	const char *GetVersion();
dvander@145
    79
	const char *GetDate();
dvander@145
    80
	const char *GetLogTag();
ds@675
    81
public:
ds@675
    82
	void OnVSPListening(IServerPluginCallbacks *iface);
dvander@2845
    83
#if defined METAMOD_PLAPI_VERSION || PLAPI_VERSION >= 11
ds@1145
    84
	void OnUnlinkConCommandBase(PluginId id, ConCommandBase *pCommand);
ds@1145
    85
#else
ds@1145
    86
	void OnPluginUnload(PluginId id);
ds@1145
    87
#endif
dvander@1655
    88
	void *OnMetamodQuery(const char *iface, int *ret);
dvander@145
    89
};
dvander@145
    90
dvander@160
    91
extern SourceMod_Core g_SourceMod_Core;
dvander@209
    92
extern IVEngineServer *engine;
dvander@209
    93
extern IServerGameDLL *gamedll;
faluco@226
    94
extern IServerGameClients *serverClients;
ds@457
    95
extern ICvar *icvar;
dvander@304
    96
extern ISmmPluginManager *g_pMMPlugins;
dvander@448
    97
extern CGlobalVars *gpGlobals;
dvander@453
    98
extern IGameEventManager2 *gameevents;
dvander@496
    99
extern SourceHook::CallClass<IVEngineServer> *enginePatch;
dvander@532
   100
extern SourceHook::CallClass<IServerGameDLL> *gamedllPatch;
dvander@530
   101
extern IUniformRandomStream *engrandom;
dvander@644
   102
extern IPlayerInfoManager *playerinfo;
faluco@654
   103
extern IBaseFileSystem *basefilesystem;
voidedweasel@3929
   104
extern IFileSystem *filesystem;
faluco@656
   105
extern IEngineSound *enginesound;
faluco@659
   106
extern IServerPluginHelpers *serverpluginhelpers;
dvander@1581
   107
extern IServerPluginCallbacks *vsp_interface;
dvander@1581
   108
extern int vsp_version;
dvander@496
   109
dvander@496
   110
#define ENGINE_CALL(func)		SH_CALL(enginePatch, &IVEngineServer::func)
dvander@532
   111
#define SERVER_CALL(func)		SH_CALL(gamedllPatch, &IServerGameDLL::func)
dvander@145
   112
dvander@145
   113
PLUGIN_GLOBALVARS();
dvander@145
   114
dvander@145
   115
#endif //_INCLUDE_SOURCEMOD_MM_API_H_
dvander@1655
   116