Fixed build.
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 <sm_trie_tpl.h>
40 #include "sm_globals.h"
42 #include <IGameHelpers.h>
43 #include <KeyValues.h>
44 #include <server_class.h>
46 #include <ihandleentity.h>
47 #include <tier0/icommandline.h>
48 #if SOURCE_ENGINE >= SE_PORTAL2
54 using namespace SourceHook;
55 using namespace SourceMod;
57 #define HUD_PRINTTALK 3
58 #define HUD_PRINTCENTER 4
63 KTrie<sm_sendprop_info_t> lookup;
68 DataMapTrie() : trie(NULL) {}
69 KTrie<sm_datatable_info_t> *trie;
72 struct DelayedFakeCliCmd
79 struct CachedCommandInfo
82 #if SOURCE_ENGINE <= SE_DARKMESSIAH
87 struct DelayedKickInfo
94 // copy from game/shared/entitylist_base.h
98 IHandleEntity *m_pEntity;
102 #if (SOURCE_ENGINE >= SE_PORTAL2) && (SOURCE_ENGINE != SE_DOTA)
104 string_t m_iClassName;
109 public SMGlobalClass,
116 void OnSourceModStartup(bool late);
117 void OnSourceModAllInitialized();
118 void OnSourceModAllInitialized_Post();
119 /*void OnSourceModAllShutdown();*/
120 public: //IGameHelpers
121 SendProp *FindInSendTable(const char *classname, const char *offset);
122 bool FindSendPropInfo(const char *classname, const char *offset, sm_sendprop_info_t *info);
123 datamap_t *GetDataMap(CBaseEntity *pEntity);
124 ServerClass *FindServerClass(const char *classname);
125 typedescription_t *FindInDataMap(datamap_t *pMap, const char *offset);
126 bool FindDataMapInfo(datamap_t *pMap, const char *offset, sm_datatable_info_t *pDataTable);
127 void SetEdictStateChanged(edict_t *pEdict, unsigned short offset);
128 bool TextMsg(int client, int dest, const char *msg);
129 bool HintTextMsg(int client, const char *msg);
130 bool HintTextMsg(cell_t *players, int count, const char *msg);
131 bool ShowVGUIMenu(int client, const char *name, KeyValues *data, bool show);
133 bool KVLoadFromFile(KeyValues *kv, IBaseFileSystem *filesystem, const char *resourceName, const char *pathID = NULL);
134 edict_t *EdictOfIndex(int index);
135 int IndexOfEdict(edict_t *pEnt);
136 edict_t *GetHandleEntity(CBaseHandle &hndl);
137 void SetHandleEntity(CBaseHandle &hndl, edict_t *pEnt);
138 const char *GetCurrentMap();
139 void ServerCommand(const char *buffer);
140 CBaseEntity *ReferenceToEntity(cell_t entRef);
141 cell_t EntityToReference(CBaseEntity *pEntity);
142 cell_t IndexToReference(int entIndex);
143 int ReferenceToIndex(cell_t entRef);
144 cell_t ReferenceToBCompatRef(cell_t entRef);
145 CEntInfo *LookupEntity(int entIndex);
146 cell_t EntityToBCompatRef(CBaseEntity *pEntity);
147 void *GetGlobalEntityList();
148 int GetSendPropOffset(SendProp *prop);
149 ICommandLine *GetValveCommandLine();
150 const char *GetEntityClassname(edict_t *pEdict);
151 const char *GetEntityClassname(CBaseEntity *pEntity);
152 bool IsMapValid(const char *map);
154 void AddToFakeCliCmdQueue(int client, int userid, const char *cmd);
155 void ProcessFakeCliCmdQueue();
157 void PushCommandStack(const CCommand *cmd);
158 void PopCommandStack();
159 const CCommand *PeekCommandStack();
160 const char *CurrentCommandName();
161 void AddDelayedKick(int client, int userid, const char *msg);
162 void ProcessDelayedKicks();
163 #if !defined METAMOD_PLAPI_VERSION || PLAPI_VERSION < 11
164 bool IsOriginalEngine();
167 DataTableInfo *_FindServerClass(const char *classname);
169 void InitLogicalEntData();
170 void InitCommandLine();
173 List<DataTableInfo *> m_Tables;
174 THash<datamap_t *, DataMapTrie> m_Maps;
179 Queue<DelayedFakeCliCmd *> m_CmdQueue;
180 CStack<DelayedFakeCliCmd *> m_FreeCmds;
181 CStack<CachedCommandInfo> m_CommandStack;
182 Queue<DelayedKickInfo> m_DelayedKicks;
183 void *m_pGetCommandLine;
186 extern CHalfLife2 g_HL2;
188 bool IndexToAThings(cell_t, CBaseEntity **pEntData, edict_t **pEdictData);
190 #endif //_INCLUDE_SOURCEMOD_CHALFLIFE2_H_