Skip to content

Commit c2d4643

Browse files
PerfectLaughHeadline
authored andcommitted
Remove unneeded paramter in CS_DropWeapon (#988)
Updated in 4/30/2019 csgo update
1 parent 328fbf3 commit c2d4643

File tree

2 files changed

+12
-18
lines changed

2 files changed

+12
-18
lines changed

extensions/cstrike/forwards.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -216,12 +216,12 @@ DETOUR_DECL_MEMBER3(DetourTerminateRound, void, int, reason, int, unknown, int,
216216
#endif
217217
}
218218

219-
DETOUR_DECL_MEMBER3(DetourCSWeaponDrop, void, CBaseEntity *, weapon, bool, bDropShield, bool, bThrowForward)
219+
DETOUR_DECL_MEMBER2(DetourCSWeaponDrop, void, CBaseEntity *, weapon, bool, bThrowForward)
220220
{
221221
if (g_pIgnoreCSWeaponDropDetour)
222222
{
223223
g_pIgnoreCSWeaponDropDetour = false;
224-
DETOUR_MEMBER_CALL(DetourCSWeaponDrop)(weapon, bDropShield, bThrowForward);
224+
DETOUR_MEMBER_CALL(DetourCSWeaponDrop)(weapon, bThrowForward);
225225
return;
226226
}
227227

@@ -236,7 +236,7 @@ DETOUR_DECL_MEMBER3(DetourCSWeaponDrop, void, CBaseEntity *, weapon, bool, bDrop
236236

237237
if (result == Pl_Continue)
238238
{
239-
DETOUR_MEMBER_CALL(DetourCSWeaponDrop)(weapon, bDropShield, bThrowForward);
239+
DETOUR_MEMBER_CALL(DetourCSWeaponDrop)(weapon, bThrowForward);
240240
}
241241

242242
return;

extensions/cstrike/natives.cpp

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -230,17 +230,14 @@ static cell_t CS_DropWeapon(IPluginContext *pContext, const cell_t *params)
230230
if (!pWrapper)
231231
{
232232
REGISTER_NATIVE_ADDR(WEAPONDROP_GAMEDATA_NAME,
233-
PassInfo pass[3]; \
233+
PassInfo pass[2]; \
234234
pass[0].flags = PASSFLAG_BYVAL; \
235235
pass[0].type = PassType_Basic; \
236236
pass[0].size = sizeof(CBaseEntity *); \
237237
pass[1].flags = PASSFLAG_BYVAL; \
238238
pass[1].type = PassType_Basic; \
239239
pass[1].size = sizeof(bool); \
240-
pass[2].flags = PASSFLAG_BYVAL; \
241-
pass[2].type = PassType_Basic; \
242-
pass[2].size = sizeof(bool); \
243-
pWrapper = g_pBinTools->CreateCall(addr, CallConv_ThisCall, NULL, pass, 3))
240+
pWrapper = g_pBinTools->CreateCall(addr, CallConv_ThisCall, NULL, pass, 2))
244241
}
245242

246243
CBaseEntity *pEntity;
@@ -273,16 +270,13 @@ static cell_t CS_DropWeapon(IPluginContext *pContext, const cell_t *params)
273270
if (params[4] == 1 && g_pCSWeaponDropDetoured)
274271
g_pIgnoreCSWeaponDropDetour = true;
275272

276-
unsigned char vstk[sizeof(CBaseEntity *) * 2 + sizeof(bool) * 2];
273+
unsigned char vstk[sizeof(CBaseEntity *) * 2 + sizeof(bool)];
277274
unsigned char *vptr = vstk;
278275

279-
// <psychonic> first one is always false. second is true to toss, false to just drop
280276
*(CBaseEntity **)vptr = pEntity;
281277
vptr += sizeof(CBaseEntity *);
282278
*(CBaseEntity **)vptr = pWeapon;
283279
vptr += sizeof(CBaseEntity *);
284-
*(bool *)vptr = false;
285-
vptr += sizeof(bool);
286280
*(bool *)vptr = (params[3]) ? true : false;
287281

288282
pWrapper->Execute(vstk, NULL);
@@ -907,9 +901,9 @@ static cell_t CS_UpdateClientModel(IPluginContext *pContext, const cell_t *param
907901
static cell_t CS_ItemDefIndexToID(IPluginContext *pContext, const cell_t *params)
908902
{
909903
#if SOURCE_ENGINE == SE_CSGO
910-
ItemIndexMap::Result res = g_mapDefIdxToClass.find((uint16_t)params[1]);
911-
912-
if (!res.found())
904+
ItemIndexMap::Result res = g_mapDefIdxToClass.find((uint16_t)params[1]);
905+
906+
if (!res.found())
913907
return pContext->ThrowNativeError("Invalid item definition passed.");
914908

915909
return res->value.m_iWeaponID;
@@ -921,9 +915,9 @@ static cell_t CS_ItemDefIndexToID(IPluginContext *pContext, const cell_t *params
921915
static cell_t CS_WeaponIDToItemDefIndex(IPluginContext *pContext, const cell_t *params)
922916
{
923917
#if SOURCE_ENGINE == SE_CSGO
924-
WeaponIDMap::Result res = g_mapWeaponIDToDefIdx.find((SMCSWeapon)params[1]);
925-
926-
if (!res.found())
918+
WeaponIDMap::Result res = g_mapWeaponIDToDefIdx.find((SMCSWeapon)params[1]);
919+
920+
if (!res.found())
927921
return pContext->ThrowNativeError("Invalid weapon id passed.");
928922

929923
return res->value.m_iDefIdx;

0 commit comments

Comments
 (0)