Update linux dep script (no bug, r=NPOTB).
2 * vim: set ts=4 sw=4 tw=99 noet :
3 * =============================================================================
5 * Copyright (C) 2004-2008 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_CHALFLIFE2_H_
33 #define _INCLUDE_SOURCEMOD_CHALFLIFE2_H_
36 #include <sh_string.h>
37 #include <sh_tinyhash.h>
38 #include <am-utility.h>
39 #include <am-hashmap.h>
40 #include <sm_stringhashmap.h>
41 #include <sm_namehashset.h>
42 #include "sm_globals.h"
44 #include <IGameHelpers.h>
45 #include <KeyValues.h>
46 #include <server_class.h>
48 #include <ihandleentity.h>
49 #include <tier0/icommandline.h>
50 #if SOURCE_ENGINE >= SE_PORTAL2
56 using namespace SourceHook;
57 using namespace SourceMod;
59 #define HUD_PRINTTALK 3
60 #define HUD_PRINTCENTER 4
66 static inline bool matches(const char *name, const sm_sendprop_info_t &info)
68 return strcmp(name, info.prop->GetName()) == 0;
72 static inline bool matches(const char *name, const DataTableInfo *info)
74 return strcmp(name, info->sc->GetName()) == 0;
77 DataTableInfo(ServerClass *sc)
83 NameHashSet<sm_sendprop_info_t, SendPropPolicy> lookup;
86 struct DataMapCachePolicy
88 static inline bool matches(const char *name, const sm_datatable_info_t &info)
90 return strcmp(name, info.prop->fieldName) == 0;
94 typedef NameHashSet<sm_datatable_info_t, DataMapCachePolicy> DataMapCache;
96 struct DelayedFakeCliCmd
103 struct CachedCommandInfo
105 const CCommand *args;
106 #if SOURCE_ENGINE <= SE_DARKMESSIAH
111 struct DelayedKickInfo
118 // copy from game/shared/entitylist_base.h
122 IHandleEntity *m_pEntity;
126 #if (SOURCE_ENGINE >= SE_PORTAL2) && (SOURCE_ENGINE != SE_DOTA)
128 string_t m_iClassName;
133 public SMGlobalClass,
140 void OnSourceModStartup(bool late);
141 void OnSourceModAllInitialized();
142 void OnSourceModAllInitialized_Post();
143 /*void OnSourceModAllShutdown();*/
144 public: //IGameHelpers
145 SendProp *FindInSendTable(const char *classname, const char *offset);
146 bool FindSendPropInfo(const char *classname, const char *offset, sm_sendprop_info_t *info);
147 datamap_t *GetDataMap(CBaseEntity *pEntity);
148 ServerClass *FindServerClass(const char *classname);
149 typedescription_t *FindInDataMap(datamap_t *pMap, const char *offset);
150 bool FindDataMapInfo(datamap_t *pMap, const char *offset, sm_datatable_info_t *pDataTable);
151 void SetEdictStateChanged(edict_t *pEdict, unsigned short offset);
152 bool TextMsg(int client, int dest, const char *msg);
153 bool HintTextMsg(int client, const char *msg);
154 bool HintTextMsg(cell_t *players, int count, const char *msg);
155 bool ShowVGUIMenu(int client, const char *name, KeyValues *data, bool show);
157 bool KVLoadFromFile(KeyValues *kv, IBaseFileSystem *filesystem, const char *resourceName, const char *pathID = NULL);
158 edict_t *EdictOfIndex(int index);
159 int IndexOfEdict(edict_t *pEnt);
160 edict_t *GetHandleEntity(CBaseHandle &hndl);
161 void SetHandleEntity(CBaseHandle &hndl, edict_t *pEnt);
162 const char *GetCurrentMap();
163 void ServerCommand(const char *buffer);
164 CBaseEntity *ReferenceToEntity(cell_t entRef);
165 cell_t EntityToReference(CBaseEntity *pEntity);
166 cell_t IndexToReference(int entIndex);
167 int ReferenceToIndex(cell_t entRef);
168 cell_t ReferenceToBCompatRef(cell_t entRef);
169 CEntInfo *LookupEntity(int entIndex);
170 cell_t EntityToBCompatRef(CBaseEntity *pEntity);
171 void *GetGlobalEntityList();
172 int GetSendPropOffset(SendProp *prop);
173 ICommandLine *GetValveCommandLine();
174 const char *GetEntityClassname(edict_t *pEdict);
175 const char *GetEntityClassname(CBaseEntity *pEntity);
176 bool IsMapValid(const char *map);
178 void AddToFakeCliCmdQueue(int client, int userid, const char *cmd);
179 void ProcessFakeCliCmdQueue();
181 void PushCommandStack(const CCommand *cmd);
182 void PopCommandStack();
183 const CCommand *PeekCommandStack();
184 const char *CurrentCommandName();
185 void AddDelayedKick(int client, int userid, const char *msg);
186 void ProcessDelayedKicks();
187 #if !defined METAMOD_PLAPI_VERSION || PLAPI_VERSION < 11
188 bool IsOriginalEngine();
191 DataTableInfo *_FindServerClass(const char *classname);
193 void InitLogicalEntData();
194 void InitCommandLine();
196 typedef ke::HashMap<datamap_t *, DataMapCache *, ke::PointerPolicy<datamap_t> > DataTableMap;
198 NameHashSet<DataTableInfo *> m_Classes;
204 Queue<DelayedFakeCliCmd *> m_CmdQueue;
205 CStack<DelayedFakeCliCmd *> m_FreeCmds;
206 CStack<CachedCommandInfo> m_CommandStack;
207 Queue<DelayedKickInfo> m_DelayedKicks;
208 void *m_pGetCommandLine;
211 extern CHalfLife2 g_HL2;
213 bool IndexToAThings(cell_t, CBaseEntity **pEntData, edict_t **pEdictData);
215 #endif //_INCLUDE_SOURCEMOD_CHALFLIFE2_H_