From 536750b428ebf0ae82fb2b274765b990d0f9c742 Mon Sep 17 00:00:00 2001 From: Nick Hastings Date: Fri, 22 Oct 2021 23:42:45 -0400 Subject: [PATCH] Add missing parameters for CSWeaponDrop. --- extensions/cstrike/forwards.cpp | 6 +++--- extensions/cstrike/natives.cpp | 13 ++++++++++--- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/extensions/cstrike/forwards.cpp b/extensions/cstrike/forwards.cpp index ef1d4f6c..505d67f5 100644 --- a/extensions/cstrike/forwards.cpp +++ b/extensions/cstrike/forwards.cpp @@ -219,7 +219,7 @@ DETOUR_DECL_MEMBER3(DetourTerminateRound, void, int, reason, int, unknown, int, #if SOURCE_ENGINE == SE_CSGO DETOUR_DECL_MEMBER3(DetourCSWeaponDrop, void, CBaseEntity *, weapon, bool, bThrowForward, bool, bDonated) #else -DETOUR_DECL_MEMBER2(DetourCSWeaponDrop, void, CBaseEntity *, weapon, bool, bThrowForward) +DETOUR_DECL_MEMBER3(DetourCSWeaponDrop, void, CBaseEntity *, weapon, bool, bDropShield, bool, bThrowForward) #endif { if (g_pIgnoreCSWeaponDropDetour) @@ -228,7 +228,7 @@ DETOUR_DECL_MEMBER2(DetourCSWeaponDrop, void, CBaseEntity *, weapon, bool, bThro #if SOURCE_ENGINE == SE_CSGO DETOUR_MEMBER_CALL(DetourCSWeaponDrop)(weapon, bThrowForward, bDonated); #else - DETOUR_MEMBER_CALL(DetourCSWeaponDrop)(weapon, bThrowForward); + DETOUR_MEMBER_CALL(DetourCSWeaponDrop)(weapon, bDropShield, bThrowForward); #endif return; } @@ -252,7 +252,7 @@ DETOUR_DECL_MEMBER2(DetourCSWeaponDrop, void, CBaseEntity *, weapon, bool, bThro #if SOURCE_ENGINE == SE_CSGO DETOUR_MEMBER_CALL(DetourCSWeaponDrop)(weapon, bThrowForward, bDonated); #else - DETOUR_MEMBER_CALL(DetourCSWeaponDrop)(weapon, bThrowForward); + DETOUR_MEMBER_CALL(DetourCSWeaponDrop)(weapon, bDropShield, bThrowForward); #endif } diff --git a/extensions/cstrike/natives.cpp b/extensions/cstrike/natives.cpp index 1e6159fe..c4c578ef 100644 --- a/extensions/cstrike/natives.cpp +++ b/extensions/cstrike/natives.cpp @@ -227,14 +227,17 @@ static cell_t CS_DropWeapon(IPluginContext *pContext, const cell_t *params) if (!pWrapper) { REGISTER_NATIVE_ADDR(WEAPONDROP_GAMEDATA_NAME, - PassInfo pass[2]; \ + PassInfo pass[3]; \ pass[0].flags = PASSFLAG_BYVAL; \ pass[0].type = PassType_Basic; \ pass[0].size = sizeof(CBaseEntity *); \ pass[1].flags = PASSFLAG_BYVAL; \ pass[1].type = PassType_Basic; \ 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; @@ -267,7 +270,11 @@ static cell_t CS_DropWeapon(IPluginContext *pContext, const cell_t *params) if (params[4] == 1 && g_pCSWeaponDropDetoured) g_pIgnoreCSWeaponDropDetour = true; - ArgBuffer vstk(pEntity, pWeapon, (params[3]) ? true : false); +#if SOURCE_ENGINE == SE_CSGO + ArgBuffer vstk(pEntity, pWeapon, !!params[3], false); +#else + ArgBuffer vstk(pEntity, pWeapon, false, !!params[3]); +#endif pWrapper->Execute(vstk, NULL); return 1;