Replace further P_CanPickupItem constants and allow them to be parsed in Lua

This commit is contained in:
Lach 2025-05-14 02:04:40 +10:00
parent 22817ac60b
commit ca06b2a334
6 changed files with 13 additions and 8 deletions

View file

@ -5251,6 +5251,11 @@ struct int_const_s const INT_CONST[] = {
{"TN_CHANGEPITCH",TN_CHANGEPITCH}, {"TN_CHANGEPITCH",TN_CHANGEPITCH},
{"TN_LOOPING",TN_LOOPING}, {"TN_LOOPING",TN_LOOPING},
{"PICKUP_RINGORSPHERE", PICKUP_RINGORSPHERE},
{"PICKUP_ITEMBOX", PICKUP_ITEMBOX},
{"PICKUP_EGGBOX", PICKUP_EGGBOX},
{"PICKUP_PAPERITEM", PICKUP_PAPERITEM},
{NULL,0} {NULL,0}
}; };

View file

@ -497,7 +497,7 @@ static BlockItReturn_t K_FindObjectsForNudging(mobj_t *thing)
break; break;
} }
if (P_CanPickupItem(g_nudgeSearch.botmo->player, 1)) if (P_CanPickupItem(g_nudgeSearch.botmo->player, PICKUP_ITEMBOX))
{ {
K_AddAttackObject(thing, side, ((thing->extravalue1 < RINGBOX_TIME) ? 10 : 20)); K_AddAttackObject(thing, side, ((thing->extravalue1 < RINGBOX_TIME) ? 10 : 20));
} }
@ -508,7 +508,7 @@ static BlockItReturn_t K_FindObjectsForNudging(mobj_t *thing)
break; break;
} }
if (P_CanPickupItem(g_nudgeSearch.botmo->player, 1)) // Can pick up an actual item if (P_CanPickupItem(g_nudgeSearch.botmo->player, PICKUP_ITEMBOX)) // Can pick up an actual item
{ {
const UINT8 stealth = K_EggboxStealth(thing->x, thing->y); const UINT8 stealth = K_EggboxStealth(thing->x, thing->y);
const UINT8 requiredstealth = (g_nudgeSearch.botmo->player->botvars.difficulty * g_nudgeSearch.botmo->player->botvars.difficulty); const UINT8 requiredstealth = (g_nudgeSearch.botmo->player->botvars.difficulty * g_nudgeSearch.botmo->player->botvars.difficulty);
@ -529,7 +529,7 @@ static BlockItReturn_t K_FindObjectsForNudging(mobj_t *thing)
break; break;
} }
if (P_CanPickupItem(g_nudgeSearch.botmo->player, 3)) if (P_CanPickupItem(g_nudgeSearch.botmo->player, PICKUP_PAPERITEM))
{ {
K_AddAttackObject(thing, side, 20); K_AddAttackObject(thing, side, 20);
} }
@ -542,7 +542,7 @@ static BlockItReturn_t K_FindObjectsForNudging(mobj_t *thing)
} }
if ((RINGTOTAL(g_nudgeSearch.botmo->player) < 20 && !(g_nudgeSearch.botmo->player->pflags & PF_RINGLOCK) if ((RINGTOTAL(g_nudgeSearch.botmo->player) < 20 && !(g_nudgeSearch.botmo->player->pflags & PF_RINGLOCK)
&& P_CanPickupItem(g_nudgeSearch.botmo->player, 0)) && P_CanPickupItem(g_nudgeSearch.botmo->player, PICKUP_RINGORSPHERE))
&& !thing->extravalue1 && !thing->extravalue1
&& (g_nudgeSearch.botmo->player->itemtype != KITEM_LIGHTNINGSHIELD)) && (g_nudgeSearch.botmo->player->itemtype != KITEM_LIGHTNINGSHIELD))
{ {

View file

@ -172,7 +172,7 @@ boolean K_EggItemCollide(mobj_t *t1, mobj_t *t2)
if (t1->health <= 0 || t2->health <= 0) if (t1->health <= 0 || t2->health <= 0)
return true; return true;
if (!P_CanPickupItem(t2->player, 2)) if (!P_CanPickupItem(t2->player, PICKUP_EGGBOX))
return true; return true;
K_DropItems(t2->player); K_DropItems(t2->player);

View file

@ -10066,7 +10066,7 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd)
} }
extern consvar_t cv_fuzz; extern consvar_t cv_fuzz;
if (cv_fuzz.value && P_CanPickupItem(player, 1)) if (cv_fuzz.value && P_CanPickupItem(player, PICKUP_ITEMBOX))
{ {
K_StartItemRoulette(player, P_RandomRange(PR_FUZZ, 0, 1)); K_StartItemRoulette(player, P_RandomRange(PR_FUZZ, 0, 1));
} }

View file

@ -629,7 +629,7 @@ award_immediately (mobj_t *hyu)
return false; return false;
} }
if (!P_CanPickupItem(player, 1)) if (!P_CanPickupItem(player, PICKUP_ITEMBOX))
return false; return false;
// Prevent receiving any more items or even stacked // Prevent receiving any more items or even stacked

View file

@ -48,7 +48,7 @@ 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 // 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)) if (P_CanPickupItem(&players[i], PICKUP_ITEMBOX))
{ {
// Check for players who can take this pickup, but won't be allowed to (antifarming) // Check for players who can take this pickup, but won't be allowed to (antifarming)
UINT8 mytype = (mobj->flags2 & MF2_BOSSDEAD) ? 2 : 1; UINT8 mytype = (mobj->flags2 & MF2_BOSSDEAD) ? 2 : 1;