Updated some CS:GO gamedata.
3 * =============================================================================
5 * Copyright (C) 2004-2010 AlliedModders LLC. All rights reserved.
6 * =============================================================================
8 * This program is free software; you can redistribute it and/or modify it under
9 * the terms of the GNU General Public License, version 3.0, as published by the
10 * Free Software Foundation.
12 * This program is distributed in the hope that it will be useful, but WITHOUT
13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
14 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
17 * You should have received a copy of the GNU General Public License along with
18 * this program. If not, see <http://www.gnu.org/licenses/>.
20 * As a special exception, AlliedModders LLC gives you permission to link the
21 * code of this program (as well as its derivative works) to "Half-Life 2," the
22 * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
23 * by the Valve Corporation. You must obey the GNU General Public License in
24 * all respects for all other code used. Additionally, AlliedModders LLC grants
25 * this exception to all derivative works. AlliedModders LLC defines further
26 * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
27 * or <http://www.sourcemod.net/license.php>.
32 #ifndef _INCLUDE_SOURCEMOD_COMPAT_WRAPPERS_H_
33 #define _INCLUDE_SOURCEMOD_COMPAT_WRAPPERS_H_
37 #if SOURCE_ENGINE >= SE_ORANGEBOX
38 #define CONVAR_REGISTER(object) ConVar_Register(0, object)
40 inline bool IsFlagSet(ConCommandBase *cmd, int flag)
42 return cmd->IsFlagSet(flag);
44 inline void InsertServerCommand(const char *buf)
46 engine->InsertServerCommand(buf);
48 inline ConCommandBase *FindCommandBase(const char *name)
50 return icvar->FindCommandBase(name);
52 inline ConCommand *FindCommand(const char *name)
54 return icvar->FindCommand(name);
60 inline const char *ArgS() const
62 return engine->Cmd_Args();
64 inline int ArgC() const
66 return engine->Cmd_Argc();
68 inline const char *Arg(int index) const
70 return engine->Cmd_Argv(index);
74 inline bool IsFlagSet(ConCommandBase *cmd, int flag)
76 return cmd->IsBitSet(flag);
78 inline void InsertServerCommand(const char *buf)
80 engine->InsertServerCommand(buf);
82 inline ConCommandBase *FindCommandBase(const char *name)
84 ConCommandBase *pBase = icvar->GetCommands();
87 if (strcmp(pBase->GetName(), name) == 0)
89 if (!pBase->IsCommand())
96 pBase = const_cast<ConCommandBase *>(pBase->GetNext());
100 inline ConCommand *FindCommand(const char *name)
102 ConCommandBase *pBase = icvar->GetCommands();
105 if (strcmp(pBase->GetName(), name) == 0)
107 if (!pBase->IsCommand())
112 return static_cast<ConCommand *>(pBase);
114 pBase = const_cast<ConCommandBase *>(pBase->GetNext());
119 #define CVAR_INTERFACE_VERSION VENGINE_CVAR_INTERFACE_VERSION
121 #define CONVAR_REGISTER(object) ConCommandBaseMgr::OneTimeInit(object)
122 typedef FnChangeCallback FnChangeCallback_t;
123 #endif //SOURCE_ENGINE >= SE_ORANGEBOX
125 #if SOURCE_ENGINE >= SE_LEFT4DEAD
126 inline int IndexOfEdict(const edict_t *pEdict)
128 return (int)(pEdict - gpGlobals->pEdicts);
130 inline edict_t *PEntityOfEntIndex(int iEntIndex)
132 if (iEntIndex >= 0 && iEntIndex < gpGlobals->maxEntities)
134 return (edict_t *)(gpGlobals->pEdicts + iEntIndex);
138 inline int GetTypeDescOffs(typedescription_t *td)
140 return td->fieldOffset;
143 inline int IndexOfEdict(const edict_t *pEdict)
145 return engine->IndexOfEdict(pEdict);
147 inline edict_t *PEntityOfEntIndex(int iEntIndex)
149 return engine->PEntityOfEntIndex(iEntIndex);
151 inline int GetTypeDescOffs(typedescription_t *td)
153 return td->fieldOffset[TD_OFFSET_NORMAL];
155 #endif //SOURCE_ENGINE >= SE_LEFT4DEAD
157 #if SOURCE_ENGINE == SE_DOTA
158 inline int GetPlayerUserId(edict_t *pEdict)
160 return engine->GetPlayerUserId(IndexOfEdict(pEdict) - 1);
163 inline int GetPlayerUserId(int client)
165 engine->GetPlayerUserId(client - 1);
168 inline int GetPlayerUserId(edict_t *pEdict)
170 return engine->GetPlayerUserId(pEdict);
173 inline int GetPlayerUserId(int client)
175 return engine->GetPlayerUserId(PEntityOfEntIndex(client));
177 #endif //SOURCE_ENGINE >= SE_DOTA
179 #endif //_INCLUDE_SOURCEMOD_COMPAT_WRAPPERS_H_