From 562da2b37600717b27f574b5f52d4be9eb6527e5 Mon Sep 17 00:00:00 2001 From: AJ Martinez Date: Tue, 12 Sep 2023 16:26:40 -0700 Subject: [PATCH] Anti item farming: item box clarity --- src/objects/random-item.c | 5 +++++ src/p_local.h | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/objects/random-item.c b/src/objects/random-item.c index a5db705f6..b2dcdc6b9 100644 --- a/src/objects/random-item.c +++ b/src/objects/random-item.c @@ -47,6 +47,11 @@ static player_t *GetItemBoxPlayer(mobj_t *mobj) // Always use normal item box rules -- could pass in "2" for fakes but they blend in better like this if (P_CanPickupItem(&players[i], 1)) { + // Check for players who can take this pickup, but won't be allowed to (antifarming) + UINT8 mytype = (mobj->flags2 & MF2_AMBUSH) ? 2 : 1; + if (P_IsPickupCheesy(&players[i], mytype)) + continue; + fixed_t dist = P_AproxDistance(P_AproxDistance( players[i].mo->x - mobj->x, players[i].mo->y - mobj->y), diff --git a/src/p_local.h b/src/p_local.h index e4ce266f8..5241bc3db 100644 --- a/src/p_local.h +++ b/src/p_local.h @@ -543,8 +543,8 @@ void P_CheckPointLimit(void); boolean P_CheckRacers(void); boolean P_CanPickupItem(player_t *player, UINT8 weapon); -boolean P_IsPickupCheesy(player_t *player, UINT8 weapon); -void P_UpdateLastPickup(player_t *player, UINT8 weapon); +boolean P_IsPickupCheesy(player_t *player, UINT8 type); +void P_UpdateLastPickup(player_t *player, UINT8 type); boolean P_CanPickupEmblem(player_t *player, INT32 emblemID); boolean P_EmblemWasCollected(INT32 emblemID);