Add missing parameters for CSWeaponDrop.

This commit is contained in:
Nick Hastings 2021-10-22 23:42:45 -04:00
parent 11e7bb10f1
commit 536750b428
2 changed files with 13 additions and 6 deletions

View File

@ -219,7 +219,7 @@ DETOUR_DECL_MEMBER3(DetourTerminateRound, void, int, reason, int, unknown, int,
#if SOURCE_ENGINE == SE_CSGO #if SOURCE_ENGINE == SE_CSGO
DETOUR_DECL_MEMBER3(DetourCSWeaponDrop, void, CBaseEntity *, weapon, bool, bThrowForward, bool, bDonated) DETOUR_DECL_MEMBER3(DetourCSWeaponDrop, void, CBaseEntity *, weapon, bool, bThrowForward, bool, bDonated)
#else #else
DETOUR_DECL_MEMBER2(DetourCSWeaponDrop, void, CBaseEntity *, weapon, bool, bThrowForward) DETOUR_DECL_MEMBER3(DetourCSWeaponDrop, void, CBaseEntity *, weapon, bool, bDropShield, bool, bThrowForward)
#endif #endif
{ {
if (g_pIgnoreCSWeaponDropDetour) if (g_pIgnoreCSWeaponDropDetour)
@ -228,7 +228,7 @@ DETOUR_DECL_MEMBER2(DetourCSWeaponDrop, void, CBaseEntity *, weapon, bool, bThro
#if SOURCE_ENGINE == SE_CSGO #if SOURCE_ENGINE == SE_CSGO
DETOUR_MEMBER_CALL(DetourCSWeaponDrop)(weapon, bThrowForward, bDonated); DETOUR_MEMBER_CALL(DetourCSWeaponDrop)(weapon, bThrowForward, bDonated);
#else #else
DETOUR_MEMBER_CALL(DetourCSWeaponDrop)(weapon, bThrowForward); DETOUR_MEMBER_CALL(DetourCSWeaponDrop)(weapon, bDropShield, bThrowForward);
#endif #endif
return; return;
} }
@ -252,7 +252,7 @@ DETOUR_DECL_MEMBER2(DetourCSWeaponDrop, void, CBaseEntity *, weapon, bool, bThro
#if SOURCE_ENGINE == SE_CSGO #if SOURCE_ENGINE == SE_CSGO
DETOUR_MEMBER_CALL(DetourCSWeaponDrop)(weapon, bThrowForward, bDonated); DETOUR_MEMBER_CALL(DetourCSWeaponDrop)(weapon, bThrowForward, bDonated);
#else #else
DETOUR_MEMBER_CALL(DetourCSWeaponDrop)(weapon, bThrowForward); DETOUR_MEMBER_CALL(DetourCSWeaponDrop)(weapon, bDropShield, bThrowForward);
#endif #endif
} }

View File

@ -227,14 +227,17 @@ static cell_t CS_DropWeapon(IPluginContext *pContext, const cell_t *params)
if (!pWrapper) if (!pWrapper)
{ {
REGISTER_NATIVE_ADDR(WEAPONDROP_GAMEDATA_NAME, REGISTER_NATIVE_ADDR(WEAPONDROP_GAMEDATA_NAME,
PassInfo pass[2]; \ PassInfo pass[3]; \
pass[0].flags = PASSFLAG_BYVAL; \ pass[0].flags = PASSFLAG_BYVAL; \
pass[0].type = PassType_Basic; \ pass[0].type = PassType_Basic; \
pass[0].size = sizeof(CBaseEntity *); \ pass[0].size = sizeof(CBaseEntity *); \
pass[1].flags = PASSFLAG_BYVAL; \ pass[1].flags = PASSFLAG_BYVAL; \
pass[1].type = PassType_Basic; \ pass[1].type = PassType_Basic; \
pass[1].size = sizeof(bool); \ pass[1].size = sizeof(bool); \
pWrapper = g_pBinTools->CreateCall(addr, CallConv_ThisCall, NULL, pass, 2)) pass[2].flags = PASSFLAG_BYVAL; \
pass[2].type = PassType_Basic; \
pass[2].size = sizeof(bool); \
pWrapper = g_pBinTools->CreateCall(addr, CallConv_ThisCall, NULL, pass, 3))
} }
CBaseEntity *pEntity; CBaseEntity *pEntity;
@ -267,7 +270,11 @@ static cell_t CS_DropWeapon(IPluginContext *pContext, const cell_t *params)
if (params[4] == 1 && g_pCSWeaponDropDetoured) if (params[4] == 1 && g_pCSWeaponDropDetoured)
g_pIgnoreCSWeaponDropDetour = true; g_pIgnoreCSWeaponDropDetour = true;
ArgBuffer<CBaseEntity*, CBaseEntity*, bool> vstk(pEntity, pWeapon, (params[3]) ? true : false); #if SOURCE_ENGINE == SE_CSGO
ArgBuffer<CBaseEntity*, CBaseEntity*, bool, bool> vstk(pEntity, pWeapon, !!params[3], false);
#else
ArgBuffer<CBaseEntity*, CBaseEntity*, bool, bool> vstk(pEntity, pWeapon, false, !!params[3]);
#endif
pWrapper->Execute(vstk, NULL); pWrapper->Execute(vstk, NULL);
return 1; return 1;