1.1 --- a/extensions/tf2/natives.cpp Mon Jul 26 08:23:49 2010 -0400
1.2 +++ b/extensions/tf2/natives.cpp Mon Jul 26 11:06:08 2010 -0400
1.3 @@ -34,6 +34,57 @@
1.4 #include "time.h"
1.5 #include "RegNatives.h"
1.6
1.7 +// native TF2_MakeBleed(client, victim, Float:duration)
1.8 +cell_t TF2_MakeBleed(IPluginContext *pContext, const cell_t *params)
1.9 +{
1.10 + static ICallWrapper *pWrapper = NULL;
1.11 +
1.12 + // CTFPlayerShared::MakeBleed(CTFPlayer*, CTFWeaponBase*, float)
1.13 + if(!pWrapper)
1.14 + {
1.15 + REGISTER_NATIVE_ADDR("MakeBleed",
1.16 + PassInfo pass[3]; \
1.17 + pass[0].flags = PASSFLAG_BYVAL; \
1.18 + pass[0].size = sizeof(CBaseEntity *); \
1.19 + pass[0].type = PassType_Basic; \
1.20 + pass[1].flags = PASSFLAG_BYVAL; \
1.21 + pass[1].size = sizeof(CBaseEntity *); \
1.22 + pass[1].type = PassType_Basic; \
1.23 + pass[2].flags = PASSFLAG_BYVAL; \
1.24 + pass[2].size = sizeof(float); \
1.25 + pass[2].type = PassType_Basic; \
1.26 + pWrapper = g_pBinTools->CreateCall(addr, CallConv_ThisCall, NULL, pass, 3))
1.27 + }
1.28 +
1.29 + CBaseEntity *pEntity;
1.30 + if (!(pEntity = UTIL_GetCBaseEntity(params[1], true)))
1.31 + {
1.32 + return pContext->ThrowNativeError("Client index %d is not valid", params[1]);
1.33 + }
1.34 +
1.35 + CBaseEntity *pTarget;
1.36 + if (!(pTarget = UTIL_GetCBaseEntity(params[2], true)))
1.37 + {
1.38 + return pContext->ThrowNativeError("Client index %d is not valid", params[2]);
1.39 + }
1.40 +
1.41 + void *obj = (void *)((uint8_t *)pEntity + playerSharedOffset->actual_offset);
1.42 +
1.43 + unsigned char vstk[sizeof(void *) + 2*sizeof(CBaseEntity *) + sizeof(float)];
1.44 + unsigned char *vptr = vstk;
1.45 +
1.46 + *(void **)vptr = obj;
1.47 + vptr += sizeof(void *);
1.48 + *(CBaseEntity **)vptr = pTarget;
1.49 + vptr += sizeof(CBaseEntity *);
1.50 + *(CBaseEntity **)vptr = NULL;
1.51 + vptr += sizeof(CBaseEntity *);
1.52 + *(float *)vptr = sp_ctof(params[3]);
1.53 +
1.54 + pWrapper->Execute(vstk, NULL);
1.55 +
1.56 + return 1;
1.57 +}
1.58
1.59 // native TF2_Burn(client, target)
1.60 cell_t TF2_Burn(IPluginContext *pContext, const cell_t *params)
1.61 @@ -421,5 +472,6 @@
1.62 {"TF2_RemoveCondition", TF2_RemoveCondition},
1.63 {"TF2_SetPlayerPowerPlay", TF2_SetPowerplayEnabled},
1.64 {"TF2_StunPlayer", TF2_StunPlayer},
1.65 + {"TF2_MakeBleed", TF2_MakeBleed},
1.66 {NULL, NULL}
1.67 };