Remove unneeded paramter in CS_DropWeapon (#988)

Updated in 4/30/2019 csgo update
This commit is contained in:
PerfectLaugh 2019-05-02 00:38:02 +09:00 committed by Michael Flaherty
parent 328fbf3f19
commit c2d4643204
2 changed files with 12 additions and 18 deletions

View File

@ -216,12 +216,12 @@ DETOUR_DECL_MEMBER3(DetourTerminateRound, void, int, reason, int, unknown, int,
#endif #endif
} }
DETOUR_DECL_MEMBER3(DetourCSWeaponDrop, void, CBaseEntity *, weapon, bool, bDropShield, bool, bThrowForward) DETOUR_DECL_MEMBER2(DetourCSWeaponDrop, void, CBaseEntity *, weapon, bool, bThrowForward)
{ {
if (g_pIgnoreCSWeaponDropDetour) if (g_pIgnoreCSWeaponDropDetour)
{ {
g_pIgnoreCSWeaponDropDetour = false; g_pIgnoreCSWeaponDropDetour = false;
DETOUR_MEMBER_CALL(DetourCSWeaponDrop)(weapon, bDropShield, bThrowForward); DETOUR_MEMBER_CALL(DetourCSWeaponDrop)(weapon, bThrowForward);
return; return;
} }
@ -236,7 +236,7 @@ DETOUR_DECL_MEMBER3(DetourCSWeaponDrop, void, CBaseEntity *, weapon, bool, bDrop
if (result == Pl_Continue) if (result == Pl_Continue)
{ {
DETOUR_MEMBER_CALL(DetourCSWeaponDrop)(weapon, bDropShield, bThrowForward); DETOUR_MEMBER_CALL(DetourCSWeaponDrop)(weapon, bThrowForward);
} }
return; return;

View File

@ -230,17 +230,14 @@ 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[3]; \ PassInfo pass[2]; \
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); \
pass[2].flags = PASSFLAG_BYVAL; \ pWrapper = g_pBinTools->CreateCall(addr, CallConv_ThisCall, NULL, pass, 2))
pass[2].type = PassType_Basic; \
pass[2].size = sizeof(bool); \
pWrapper = g_pBinTools->CreateCall(addr, CallConv_ThisCall, NULL, pass, 3))
} }
CBaseEntity *pEntity; CBaseEntity *pEntity;
@ -273,16 +270,13 @@ 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;
unsigned char vstk[sizeof(CBaseEntity *) * 2 + sizeof(bool) * 2]; unsigned char vstk[sizeof(CBaseEntity *) * 2 + sizeof(bool)];
unsigned char *vptr = vstk; unsigned char *vptr = vstk;
// <psychonic> first one is always false. second is true to toss, false to just drop
*(CBaseEntity **)vptr = pEntity; *(CBaseEntity **)vptr = pEntity;
vptr += sizeof(CBaseEntity *); vptr += sizeof(CBaseEntity *);
*(CBaseEntity **)vptr = pWeapon; *(CBaseEntity **)vptr = pWeapon;
vptr += sizeof(CBaseEntity *); vptr += sizeof(CBaseEntity *);
*(bool *)vptr = false;
vptr += sizeof(bool);
*(bool *)vptr = (params[3]) ? true : false; *(bool *)vptr = (params[3]) ? true : false;
pWrapper->Execute(vstk, NULL); pWrapper->Execute(vstk, NULL);
@ -907,9 +901,9 @@ static cell_t CS_UpdateClientModel(IPluginContext *pContext, const cell_t *param
static cell_t CS_ItemDefIndexToID(IPluginContext *pContext, const cell_t *params) static cell_t CS_ItemDefIndexToID(IPluginContext *pContext, const cell_t *params)
{ {
#if SOURCE_ENGINE == SE_CSGO #if SOURCE_ENGINE == SE_CSGO
ItemIndexMap::Result res = g_mapDefIdxToClass.find((uint16_t)params[1]); ItemIndexMap::Result res = g_mapDefIdxToClass.find((uint16_t)params[1]);
if (!res.found()) if (!res.found())
return pContext->ThrowNativeError("Invalid item definition passed."); return pContext->ThrowNativeError("Invalid item definition passed.");
return res->value.m_iWeaponID; return res->value.m_iWeaponID;
@ -921,9 +915,9 @@ static cell_t CS_ItemDefIndexToID(IPluginContext *pContext, const cell_t *params
static cell_t CS_WeaponIDToItemDefIndex(IPluginContext *pContext, const cell_t *params) static cell_t CS_WeaponIDToItemDefIndex(IPluginContext *pContext, const cell_t *params)
{ {
#if SOURCE_ENGINE == SE_CSGO #if SOURCE_ENGINE == SE_CSGO
WeaponIDMap::Result res = g_mapWeaponIDToDefIdx.find((SMCSWeapon)params[1]); WeaponIDMap::Result res = g_mapWeaponIDToDefIdx.find((SMCSWeapon)params[1]);
if (!res.found()) if (!res.found())
return pContext->ThrowNativeError("Invalid weapon id passed."); return pContext->ThrowNativeError("Invalid weapon id passed.");
return res->value.m_iDefIdx; return res->value.m_iDefIdx;