extensions/sdkhooks/macros.h
author David Anderson <dvander@alliedmods.net>
Thu Aug 08 22:02:42 2013 -0700 (2013-08-08)
changeset 3980 dc7dfcd855dc
parent 3767 7223d0a452a8
child 4035 24784617e0dd
permissions -rw-r--r--
More Windows build fix.
skamonkey@3767
     1
/**
skamonkey@3767
     2
 * vim: set ts=4 :
skamonkey@3767
     3
 * =============================================================================
skamonkey@3767
     4
 * Source SDK Hooks Extension
skamonkey@3767
     5
 * Copyright (C) 2010-2012 Nicholas Hastings
skamonkey@3767
     6
 * Copyright (C) 2009-2010 Erik Minekus
skamonkey@3767
     7
 * =============================================================================
skamonkey@3767
     8
 *
skamonkey@3767
     9
 * This program is free software; you can redistribute it and/or modify it under
skamonkey@3767
    10
 * the terms of the GNU General Public License, version 3.0, as published by the
skamonkey@3767
    11
 * Free Software Foundation.
skamonkey@3767
    12
 * 
skamonkey@3767
    13
 * This program is distributed in the hope that it will be useful, but WITHOUT
skamonkey@3767
    14
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
skamonkey@3767
    15
 * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
skamonkey@3767
    16
 * details.
skamonkey@3767
    17
 *
skamonkey@3767
    18
 * You should have received a copy of the GNU General Public License along with
skamonkey@3767
    19
 * this program.  If not, see <http://www.gnu.org/licenses/>.
skamonkey@3767
    20
 *
skamonkey@3767
    21
 * As a special exception, AlliedModders LLC gives you permission to link the
skamonkey@3767
    22
 * code of this program (as well as its derivative works) to "Half-Life 2," the
skamonkey@3767
    23
 * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
skamonkey@3767
    24
 * by the Valve Corporation.  You must obey the GNU General Public License in
skamonkey@3767
    25
 * all respects for all other code used.  Additionally, AlliedModders LLC grants
skamonkey@3767
    26
 * this exception to all derivative works.  AlliedModders LLC defines further
skamonkey@3767
    27
 * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
skamonkey@3767
    28
 * or <http://www.sourcemod.net/license.php>.
skamonkey@3767
    29
 *
skamonkey@3767
    30
 * Version: $Id$
skamonkey@3767
    31
 */
skamonkey@3767
    32
skamonkey@3767
    33
#define SET_PRE_true(gamedataname) g_HookTypes[SDKHook_##gamedataname].supported = true;
skamonkey@3767
    34
#define SET_PRE_false(gamedataname)
skamonkey@3767
    35
#define SET_POST_true(gamedataname) g_HookTypes[SDKHook_##gamedataname##Post].supported = true;
skamonkey@3767
    36
#define SET_POST_false(gamedataname)
skamonkey@3767
    37
skamonkey@3767
    38
#define CHECKOFFSET(gamedataname, supportsPre, supportsPost) \
skamonkey@3767
    39
	offset = 0; \
skamonkey@3767
    40
	g_pGameConf->GetOffset(#gamedataname, &offset); \
skamonkey@3767
    41
	if (offset > 0) \
skamonkey@3767
    42
		SH_MANUALHOOK_RECONFIGURE(gamedataname, offset, 0, 0); \
skamonkey@3767
    43
		SET_PRE_##supportsPre(gamedataname) \
skamonkey@3767
    44
		SET_POST_##supportsPost(gamedataname)
skamonkey@3767
    45
skamonkey@3767
    46
#define CHECKOFFSET_W(gamedataname, supportsPre, supportsPost) \
skamonkey@3767
    47
	offset = 0; \
skamonkey@3767
    48
	g_pGameConf->GetOffset("Weapon_"#gamedataname, &offset); \
skamonkey@3767
    49
	if (offset > 0) \
skamonkey@3767
    50
		SH_MANUALHOOK_RECONFIGURE(Weapon_##gamedataname, offset, 0, 0); \
skamonkey@3767
    51
		SET_PRE_##supportsPre(Weapon##gamedataname) \
skamonkey@3767
    52
		SET_POST_##supportsPost(Weapon##gamedataname)
skamonkey@3767
    53
skamonkey@3767
    54
#define HOOKLOOP \
skamonkey@3767
    55
	for(int i = g_HookList.Count() - 1; i >= 0; i--)