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 ConCommandBase *FindCommandBase(
const char *name)
46 return icvar->FindCommandBase(name);
48 inline ConCommand *FindCommand(
const char *name)
50 return icvar->FindCommand(name);
56 inline const char *ArgS()
const
60 inline int ArgC()
const
64 inline const char *Arg(
int index)
const
66 return engine->Cmd_Argv(index);
69 static int MaxCommandLength() {
return 512; }
72 inline bool IsFlagSet(ConCommandBase *cmd,
int flag)
74 return cmd->IsBitSet(flag);
76 inline ConCommandBase *FindCommandBase(
const char *name)
78 ConCommandBase *pBase = icvar->GetCommands();
81 if (strcmp(pBase->GetName(), name) == 0)
83 if (!pBase->IsCommand())
90 pBase =
const_cast<ConCommandBase *
>(pBase->GetNext());
94 inline ConCommand *FindCommand(
const char *name)
96 ConCommandBase *pBase = icvar->GetCommands();
99 if (strcmp(pBase->GetName(), name) == 0)
101 if (!pBase->IsCommand())
106 return static_cast<ConCommand *
>(pBase);
108 pBase =
const_cast<ConCommandBase *
>(pBase->GetNext());
113 #define CVAR_INTERFACE_VERSION VENGINE_CVAR_INTERFACE_VERSION
115 #define CONVAR_REGISTER(object) ConCommandBaseMgr::OneTimeInit(object)
116 typedef FnChangeCallback FnChangeCallback_t;
117 #endif //SOURCE_ENGINE >= SE_ORANGEBOX
119 #if SOURCE_ENGINE >= SE_LEFT4DEAD
120 inline int IndexOfEdict(
const edict_t *pEdict)
122 return (
int)(pEdict - gpGlobals->pEdicts);
124 inline edict_t *PEntityOfEntIndex(
int iEntIndex)
126 if (iEntIndex >= 0 && iEntIndex < gpGlobals->maxEntities)
128 return (edict_t *)(gpGlobals->pEdicts + iEntIndex);
132 inline int GetTypeDescOffs(typedescription_t *td)
134 return td->fieldOffset;
137 inline int IndexOfEdict(
const edict_t *pEdict)
139 return engine->IndexOfEdict(pEdict);
141 inline edict_t *PEntityOfEntIndex(
int iEntIndex)
143 return engine->PEntityOfEntIndex(iEntIndex);
145 inline int GetTypeDescOffs(typedescription_t *td)
147 return td->fieldOffset[TD_OFFSET_NORMAL];
149 #endif //SOURCE_ENGINE >= SE_LEFT4DEAD
151 #if SOURCE_ENGINE == SE_DOTA
152 inline int GetPlayerUserId(edict_t *pEdict)
154 return engine->GetPlayerUserId(IndexOfEdict(pEdict) - 1);
157 inline int GetPlayerUserId(
int client)
159 return engine->GetPlayerUserId(client - 1);
162 inline int GetPlayerUserId(edict_t *pEdict)
164 return engine->GetPlayerUserId(pEdict);
167 inline int GetPlayerUserId(
int client)
169 return engine->GetPlayerUserId(PEntityOfEntIndex(client));
171 #endif //SOURCE_ENGINE >= SE_DOTA
173 #endif //_INCLUDE_SOURCEMOD_COMPAT_WRAPPERS_H_
IVEngineServer * engine
Definition: smsdk_ext.cpp:310