Added TF2_MakeBleed native to TF2 ext (bug 4542, r=fyren,psychonic).
This commit is contained in:
parent
9c2e0ebd4c
commit
488de0014e
@ -34,6 +34,57 @@
|
||||
#include "time.h"
|
||||
#include "RegNatives.h"
|
||||
|
||||
// native TF2_MakeBleed(client, victim, Float:duration)
|
||||
cell_t TF2_MakeBleed(IPluginContext *pContext, const cell_t *params)
|
||||
{
|
||||
static ICallWrapper *pWrapper = NULL;
|
||||
|
||||
// CTFPlayerShared::MakeBleed(CTFPlayer*, CTFWeaponBase*, float)
|
||||
if(!pWrapper)
|
||||
{
|
||||
REGISTER_NATIVE_ADDR("MakeBleed",
|
||||
PassInfo pass[3]; \
|
||||
pass[0].flags = PASSFLAG_BYVAL; \
|
||||
pass[0].size = sizeof(CBaseEntity *); \
|
||||
pass[0].type = PassType_Basic; \
|
||||
pass[1].flags = PASSFLAG_BYVAL; \
|
||||
pass[1].size = sizeof(CBaseEntity *); \
|
||||
pass[1].type = PassType_Basic; \
|
||||
pass[2].flags = PASSFLAG_BYVAL; \
|
||||
pass[2].size = sizeof(float); \
|
||||
pass[2].type = PassType_Basic; \
|
||||
pWrapper = g_pBinTools->CreateCall(addr, CallConv_ThisCall, NULL, pass, 3))
|
||||
}
|
||||
|
||||
CBaseEntity *pEntity;
|
||||
if (!(pEntity = UTIL_GetCBaseEntity(params[1], true)))
|
||||
{
|
||||
return pContext->ThrowNativeError("Client index %d is not valid", params[1]);
|
||||
}
|
||||
|
||||
CBaseEntity *pTarget;
|
||||
if (!(pTarget = UTIL_GetCBaseEntity(params[2], true)))
|
||||
{
|
||||
return pContext->ThrowNativeError("Client index %d is not valid", params[2]);
|
||||
}
|
||||
|
||||
void *obj = (void *)((uint8_t *)pEntity + playerSharedOffset->actual_offset);
|
||||
|
||||
unsigned char vstk[sizeof(void *) + 2*sizeof(CBaseEntity *) + sizeof(float)];
|
||||
unsigned char *vptr = vstk;
|
||||
|
||||
*(void **)vptr = obj;
|
||||
vptr += sizeof(void *);
|
||||
*(CBaseEntity **)vptr = pTarget;
|
||||
vptr += sizeof(CBaseEntity *);
|
||||
*(CBaseEntity **)vptr = NULL;
|
||||
vptr += sizeof(CBaseEntity *);
|
||||
*(float *)vptr = sp_ctof(params[3]);
|
||||
|
||||
pWrapper->Execute(vstk, NULL);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
// native TF2_Burn(client, target)
|
||||
cell_t TF2_Burn(IPluginContext *pContext, const cell_t *params)
|
||||
@ -421,5 +472,6 @@ sp_nativeinfo_t g_TFNatives[] =
|
||||
{"TF2_RemoveCondition", TF2_RemoveCondition},
|
||||
{"TF2_SetPlayerPowerPlay", TF2_SetPowerplayEnabled},
|
||||
{"TF2_StunPlayer", TF2_StunPlayer},
|
||||
{"TF2_MakeBleed", TF2_MakeBleed},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
@ -99,6 +99,13 @@
|
||||
"linux" "@_ZN12CTFGameRules10GetHolidayEv"
|
||||
"mac" "@_ZN12CTFGameRules10GetHolidayEv"
|
||||
}
|
||||
"MakeBleed"
|
||||
{
|
||||
"library" "server"
|
||||
"windows" "\x56\x8B\xF1\x8B\x8E\x2A\x2A\x2A\x2A\x8B\x2A\x8B\x90\x2A\x2A\x2A\x2A\xFF\xD2\x84\xC0\x0F\x2A\x2A\x2A\x2A\x2A\x8B\x86\x2A\x2A\x2A\x2A\xC1"
|
||||
"linux" "@_ZN15CTFPlayerShared9MakeBleedEP9CTFPlayerP13CTFWeaponBasef"
|
||||
"mac" "@_ZN15CTFPlayerShared9MakeBleedEP9CTFPlayerP13CTFWeaponBasef"
|
||||
}
|
||||
}
|
||||
"Offsets"
|
||||
{
|
||||
|
@ -217,6 +217,16 @@ native TF2_RemovePlayerDisguise(client);
|
||||
*/
|
||||
native TF2_StunPlayer(client, Float:duration, Float:slowdown=0.0, stunflags, attacker=0);
|
||||
|
||||
/**
|
||||
* Induces the bleed effect on a client
|
||||
*
|
||||
* @param client Player's index.
|
||||
* @param victim Victim's index.
|
||||
* @param float Duration of bleeding (in seconds).
|
||||
* @noreturn
|
||||
*/
|
||||
native TF2_MakeBleed(client, victim, Float:duration);
|
||||
|
||||
/**
|
||||
* Retrieves the entity index of the CPlayerResource entity
|
||||
*
|
||||
@ -286,6 +296,7 @@ public __ext_tf2_SetNTVOptional()
|
||||
MarkNativeAsOptional("TF2_DisguisePlayer");
|
||||
MarkNativeAsOptional("TF2_RemovePlayerDisguise");
|
||||
MarkNativeAsOptional("TF2_StunPlayer");
|
||||
MakeNativeAsOptional("TF2_MakeBleed");
|
||||
MarkNativeAsOptional("TF2_GetResourceEntity");
|
||||
MarkNativeAsOptional("TF2_GetClass");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user