Merge pull request #119 from VoiDeD/sdkhooks-blocked
Implement SDKHook_Blocked and SDKHook_BlockedPost (r=psychonic).
This commit is contained in:
commit
e6ff9c36ed
@ -88,6 +88,8 @@ HookTypeData g_HookTypes[SDKHook_MAXHOOKS] =
|
|||||||
{"Reload", "DT_BaseCombatWeapon", false},
|
{"Reload", "DT_BaseCombatWeapon", false},
|
||||||
{"ReloadPost", "DT_BaseCombatWeapon", false},
|
{"ReloadPost", "DT_BaseCombatWeapon", false},
|
||||||
{"GetMaxHealth", "", false},
|
{"GetMaxHealth", "", false},
|
||||||
|
{"Blocked", "", false},
|
||||||
|
{"BlockedPost", "", false},
|
||||||
};
|
};
|
||||||
|
|
||||||
SDKHooks g_Interface;
|
SDKHooks g_Interface;
|
||||||
@ -191,6 +193,7 @@ SH_DECL_MANUALHOOK1(Weapon_CanUse, 0, 0, 0, bool, CBaseCombatWeapon *);
|
|||||||
SH_DECL_MANUALHOOK3_void(Weapon_Drop, 0, 0, 0, CBaseCombatWeapon *, const Vector *, const Vector *);
|
SH_DECL_MANUALHOOK3_void(Weapon_Drop, 0, 0, 0, CBaseCombatWeapon *, const Vector *, const Vector *);
|
||||||
SH_DECL_MANUALHOOK1_void(Weapon_Equip, 0, 0, 0, CBaseCombatWeapon *);
|
SH_DECL_MANUALHOOK1_void(Weapon_Equip, 0, 0, 0, CBaseCombatWeapon *);
|
||||||
SH_DECL_MANUALHOOK2(Weapon_Switch, 0, 0, 0, bool, CBaseCombatWeapon *, int);
|
SH_DECL_MANUALHOOK2(Weapon_Switch, 0, 0, 0, bool, CBaseCombatWeapon *, int);
|
||||||
|
SH_DECL_MANUALHOOK1_void(Blocked, 0, 0, 0, CBaseEntity *);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -529,6 +532,7 @@ void SDKHooks::SetupHooks()
|
|||||||
CHECKOFFSET_W(Equip, true, true);
|
CHECKOFFSET_W(Equip, true, true);
|
||||||
CHECKOFFSET_W(Switch, true, true);
|
CHECKOFFSET_W(Switch, true, true);
|
||||||
CHECKOFFSET(VPhysicsUpdate, true, true);
|
CHECKOFFSET(VPhysicsUpdate, true, true);
|
||||||
|
CHECKOFFSET(Blocked, true, true);
|
||||||
|
|
||||||
// this one is in a class all its own -_-
|
// this one is in a class all its own -_-
|
||||||
offset = 0;
|
offset = 0;
|
||||||
@ -699,6 +703,12 @@ HookReturn SDKHooks::Hook(int entity, SDKHookType type, IPluginFunction *callbac
|
|||||||
case SDKHook_ShouldCollide:
|
case SDKHook_ShouldCollide:
|
||||||
hookid = SH_ADD_MANUALVPHOOK(ShouldCollide, pEnt, SH_MEMBER(&g_Interface, &SDKHooks::Hook_ShouldCollide), false);
|
hookid = SH_ADD_MANUALVPHOOK(ShouldCollide, pEnt, SH_MEMBER(&g_Interface, &SDKHooks::Hook_ShouldCollide), false);
|
||||||
break;
|
break;
|
||||||
|
case SDKHook_Blocked:
|
||||||
|
hookid = SH_ADD_MANUALVPHOOK(Blocked, pEnt, SH_MEMBER(&g_Interface, &SDKHooks::Hook_Blocked), false);
|
||||||
|
break;
|
||||||
|
case SDKHook_BlockedPost:
|
||||||
|
hookid = SH_ADD_MANUALVPHOOK(Blocked, pEnt, SH_MEMBER(&g_Interface, &SDKHooks::Hook_BlockedPost), true);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
vhook.SetHookID(hookid);
|
vhook.SetHookID(hookid);
|
||||||
@ -1576,6 +1586,22 @@ void SDKHooks::Hook_VPhysicsUpdatePost(IPhysicsObject *pPhysics)
|
|||||||
Call(META_IFACEPTR(CBaseEntity), SDKHook_VPhysicsUpdatePost);
|
Call(META_IFACEPTR(CBaseEntity), SDKHook_VPhysicsUpdatePost);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SDKHooks::Hook_Blocked(CBaseEntity *pOther)
|
||||||
|
{
|
||||||
|
cell_t result = Call(META_IFACEPTR(CBaseEntity), SDKHook_Blocked, pOther);
|
||||||
|
|
||||||
|
if(result >= Pl_Handled)
|
||||||
|
RETURN_META(MRES_SUPERCEDE);
|
||||||
|
|
||||||
|
RETURN_META(MRES_IGNORED);
|
||||||
|
}
|
||||||
|
|
||||||
|
void SDKHooks::Hook_BlockedPost(CBaseEntity *pOther)
|
||||||
|
{
|
||||||
|
Call(META_IFACEPTR(CBaseEntity), SDKHook_BlockedPost, pOther);
|
||||||
|
RETURN_META(MRES_IGNORED);
|
||||||
|
}
|
||||||
|
|
||||||
bool SDKHooks::Hook_WeaponCanSwitchTo(CBaseCombatWeapon *pWeapon)
|
bool SDKHooks::Hook_WeaponCanSwitchTo(CBaseCombatWeapon *pWeapon)
|
||||||
{
|
{
|
||||||
cell_t result = Call(META_IFACEPTR(CBaseEntity), SDKHook_WeaponCanSwitchTo, pWeapon);
|
cell_t result = Call(META_IFACEPTR(CBaseEntity), SDKHook_WeaponCanSwitchTo, pWeapon);
|
||||||
|
@ -88,6 +88,8 @@ enum SDKHookType
|
|||||||
SDKHook_Reload,
|
SDKHook_Reload,
|
||||||
SDKHook_ReloadPost,
|
SDKHook_ReloadPost,
|
||||||
SDKHook_GetMaxHealth,
|
SDKHook_GetMaxHealth,
|
||||||
|
SDKHook_Blocked,
|
||||||
|
SDKHook_BlockedPost,
|
||||||
SDKHook_MAXHOOKS
|
SDKHook_MAXHOOKS
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -319,6 +321,8 @@ public:
|
|||||||
void Hook_UsePost(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value);
|
void Hook_UsePost(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value);
|
||||||
void Hook_VPhysicsUpdate(IPhysicsObject *pPhysics);
|
void Hook_VPhysicsUpdate(IPhysicsObject *pPhysics);
|
||||||
void Hook_VPhysicsUpdatePost(IPhysicsObject *pPhysics);
|
void Hook_VPhysicsUpdatePost(IPhysicsObject *pPhysics);
|
||||||
|
void Hook_Blocked(CBaseEntity *pOther);
|
||||||
|
void Hook_BlockedPost(CBaseEntity *pOther);
|
||||||
bool Hook_WeaponCanSwitchTo(CBaseCombatWeapon *pWeapon);
|
bool Hook_WeaponCanSwitchTo(CBaseCombatWeapon *pWeapon);
|
||||||
bool Hook_WeaponCanSwitchToPost(CBaseCombatWeapon *pWeapon);
|
bool Hook_WeaponCanSwitchToPost(CBaseCombatWeapon *pWeapon);
|
||||||
bool Hook_WeaponCanUse(CBaseCombatWeapon *pWeapon);
|
bool Hook_WeaponCanUse(CBaseCombatWeapon *pWeapon);
|
||||||
|
@ -107,6 +107,12 @@
|
|||||||
"linux" "158"
|
"linux" "158"
|
||||||
"mac" "158"
|
"mac" "158"
|
||||||
}
|
}
|
||||||
|
"Blocked"
|
||||||
|
{
|
||||||
|
"windows" "102"
|
||||||
|
"linux" "103"
|
||||||
|
"mac" "103"
|
||||||
|
}
|
||||||
"Weapon_CanSwitchTo"
|
"Weapon_CanSwitchTo"
|
||||||
{
|
{
|
||||||
"windows" "265"
|
"windows" "265"
|
||||||
@ -246,6 +252,12 @@
|
|||||||
"linux" "158"
|
"linux" "158"
|
||||||
"mac" "158"
|
"mac" "158"
|
||||||
}
|
}
|
||||||
|
"Blocked"
|
||||||
|
{
|
||||||
|
"windows" "102"
|
||||||
|
"linux" "103"
|
||||||
|
"mac" "103"
|
||||||
|
}
|
||||||
"Weapon_CanSwitchTo"
|
"Weapon_CanSwitchTo"
|
||||||
{
|
{
|
||||||
"windows" "265"
|
"windows" "265"
|
||||||
@ -385,6 +397,12 @@
|
|||||||
"linux" "158"
|
"linux" "158"
|
||||||
"mac" "158"
|
"mac" "158"
|
||||||
}
|
}
|
||||||
|
"Blocked"
|
||||||
|
{
|
||||||
|
"windows" "102"
|
||||||
|
"linux" "103"
|
||||||
|
"mac" "103"
|
||||||
|
}
|
||||||
"Weapon_CanSwitchTo"
|
"Weapon_CanSwitchTo"
|
||||||
{
|
{
|
||||||
"windows" "265"
|
"windows" "265"
|
||||||
|
@ -117,10 +117,15 @@ enum SDKHookType
|
|||||||
SDKHook_Reload,
|
SDKHook_Reload,
|
||||||
SDKHook_ReloadPost,
|
SDKHook_ReloadPost,
|
||||||
SDKHook_GetMaxHealth, /**< ep2v and later */
|
SDKHook_GetMaxHealth, /**< ep2v and later */
|
||||||
|
SDKHook_Blocked,
|
||||||
|
SDKHook_BlockedPost,
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Alphabetized for easy readability
|
Alphabetized for easy readability
|
||||||
|
|
||||||
|
SDKHook_Blocked,
|
||||||
|
SDKHook_BlockedPost,
|
||||||
|
|
||||||
SDKHook_EndTouch,
|
SDKHook_EndTouch,
|
||||||
SDKHook_EndTouchPost,
|
SDKHook_EndTouchPost,
|
||||||
@ -210,6 +215,7 @@ union SDKHookCB
|
|||||||
// EndTouch
|
// EndTouch
|
||||||
// StartTouch
|
// StartTouch
|
||||||
// Touch
|
// Touch
|
||||||
|
// Blocked
|
||||||
function Action (int entity, int other);
|
function Action (int entity, int other);
|
||||||
|
|
||||||
// EndTouchPost
|
// EndTouchPost
|
||||||
|
Loading…
Reference in New Issue
Block a user