core/HalfLife2.h
author Phong Dang <teame06@gmail.com>
Wed Aug 01 07:29:40 2007 +0000 (2007-08-01)
changeset 1241 2e8046793bc9
parent 1231 17badaf66ce4
child 1264 3685e0f4f6f9
permissions -rw-r--r--
Added check to make sure player are alive to perform sm_slap, sm_burn, sm_slay.
dvander@592
     1
/**
dvander@592
     2
 * vim: set ts=4 :
dvander@1231
     3
 * ================================================================
dvander@1231
     4
 * SourceMod
dvander@1231
     5
 * Copyright (C) 2004-2007 AlliedModders LLC.  All rights reserved.
dvander@1231
     6
 * ================================================================
dvander@592
     7
 *
dvander@1231
     8
 * This program is free software; you can redistribute it and/or 
dvander@1231
     9
 * modify it under the terms of the GNU General Public License, 
dvander@1231
    10
 * version 3.0, as published by the Free Software Foundation.
dvander@1231
    11
 * 
dvander@1231
    12
 * This program is distributed in the hope that it will be useful,
dvander@1231
    13
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
dvander@1231
    14
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
dvander@1231
    15
 * GNU General Public License for more details.
dvander@1231
    16
 *
dvander@1231
    17
 * You should have received a copy of the GNU General Public License
dvander@1231
    18
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
dvander@1231
    19
 *
dvander@1231
    20
 * As a special exception, AlliedModders LLC gives you permission to 
dvander@1231
    21
 * link the code of this program (as well as its derivative works) to 
dvander@1231
    22
 * "Half-Life 2," the "Source Engine," the "SourcePawn JIT," and any 
dvander@1231
    23
 * Game MODs that run on software by the Valve Corporation.  You must 
dvander@1231
    24
 * obey the GNU General Public License in all respects for all other 
dvander@1231
    25
 * code used. Additionally, AlliedModders LLC grants this exception 
dvander@1231
    26
 * to all derivative works. AlliedModders LLC defines further 
dvander@1231
    27
 * exceptions, found in LICENSE.txt (as of this writing, version 
dvander@1231
    28
 * JULY-31-2007), or <http://www.sourcemod.net/license.php>.
dvander@592
    29
 *
dvander@592
    30
 * Version: $Id$
dvander@592
    31
 */
dvander@592
    32
dvander@592
    33
#ifndef _INCLUDE_SOURCEMOD_CHALFLIFE2_H_
dvander@592
    34
#define _INCLUDE_SOURCEMOD_CHALFLIFE2_H_
dvander@592
    35
dvander@592
    36
#include <sh_list.h>
faluco@682
    37
#include <sh_tinyhash.h>
dvander@592
    38
#include "sm_trie.h"
dvander@592
    39
#include "sm_globals.h"
dvander@965
    40
#include <IGameHelpers.h>
faluco@1218
    41
#include <KeyValues.h>
dvander@592
    42
dvander@592
    43
using namespace SourceHook;
dvander@965
    44
using namespace SourceMod;
dvander@592
    45
dvander@895
    46
#define HUD_PRINTTALK		3
dvander@895
    47
#define HUD_PRINTCENTER		4
dvander@895
    48
dvander@592
    49
struct DataTableInfo
dvander@592
    50
{
dvander@592
    51
	ServerClass *sc;
dvander@592
    52
	Trie *lookup;
dvander@592
    53
};
dvander@592
    54
faluco@682
    55
struct DataMapTrie
faluco@682
    56
{
faluco@682
    57
	DataMapTrie() : trie(NULL) {}
faluco@682
    58
	Trie *trie;
faluco@682
    59
};
faluco@682
    60
dvander@965
    61
class CHalfLife2 : 
dvander@965
    62
	public SMGlobalClass,
dvander@965
    63
	public IGameHelpers
dvander@592
    64
{
dvander@592
    65
public:
dvander@592
    66
	CHalfLife2();
dvander@592
    67
	~CHalfLife2();
dvander@592
    68
public:
dvander@677
    69
	void OnSourceModStartup(bool late);
ds@873
    70
	void OnSourceModAllInitialized();
dvander@677
    71
	/*void OnSourceModAllShutdown();*/
dvander@965
    72
public: //IGameHelpers
dvander@592
    73
	SendProp *FindInSendTable(const char *classname, const char *offset);
dvander@965
    74
	datamap_t *GetDataMap(CBaseEntity *pEntity);
dvander@592
    75
	ServerClass *FindServerClass(const char *classname);
faluco@682
    76
	typedescription_t *FindInDataMap(datamap_t *pMap, const char *offset);
dvander@685
    77
	void SetEdictStateChanged(edict_t *pEdict, unsigned short offset);
dvander@1132
    78
	bool TextMsg(int client, int dest, const char *msg);
faluco@1218
    79
	bool HinTextMsg(int client, const char *msg);
faluco@1218
    80
	bool ShowVGUIMenu(int client, const char *name, KeyValues *data, bool show);
dvander@592
    81
private:
dvander@592
    82
	DataTableInfo *_FindServerClass(const char *classname);
dvander@592
    83
private:
dvander@592
    84
	Trie *m_pClasses;
dvander@592
    85
	List<DataTableInfo *> m_Tables;
faluco@682
    86
	THash<datamap_t *, DataMapTrie> m_Maps;
ds@873
    87
	int m_MsgTextMsg;
faluco@1218
    88
	int m_HinTextMsg;
faluco@1218
    89
	int m_VGUIMenu;
dvander@592
    90
};
dvander@592
    91
dvander@592
    92
extern CHalfLife2 g_HL2;
dvander@685
    93
extern bool g_IsOriginalEngine;
dvander@592
    94
dvander@592
    95
#endif //_INCLUDE_SOURCEMOD_CHALFLIFE2_H_