Add K_DropPaperItem, split from K_DropItems but with custom item type and amount

This commit is contained in:
James R 2023-06-27 00:08:47 -07:00
parent 58cccedd64
commit a0b0891009
2 changed files with 19 additions and 8 deletions

View file

@ -6599,20 +6599,30 @@ mobj_t *K_CreatePaperItem(fixed_t x, fixed_t y, fixed_t z, angle_t angle, SINT8
return drop;
}
void K_DropPaperItem(player_t *player, UINT8 itemtype, UINT16 itemamount)
{
if (!player->mo || P_MobjWasRemoved(player->mo))
{
return;
}
mobj_t *drop = K_CreatePaperItem(
player->mo->x, player->mo->y, player->mo->z + player->mo->height/2,
player->mo->angle + ANGLE_90, P_MobjFlip(player->mo),
itemtype, itemamount
);
K_FlipFromObject(drop, player->mo);
}
// For getting EXTRA hit!
void K_DropItems(player_t *player)
{
K_DropHnextList(player);
if (player->mo && !P_MobjWasRemoved(player->mo) && player->itemamount > 0)
if (player->itemamount > 0)
{
mobj_t *drop = K_CreatePaperItem(
player->mo->x, player->mo->y, player->mo->z + player->mo->height/2,
player->mo->angle + ANGLE_90, P_MobjFlip(player->mo),
player->itemtype, player->itemamount
);
K_FlipFromObject(drop, player->mo);
K_DropPaperItem(player, player->itemtype, player->itemamount);
}
K_StripItems(player);

View file

@ -151,6 +151,7 @@ void K_KartUpdatePosition(player_t *player);
void K_UpdateAllPlayerPositions(void);
SINT8 K_GetTotallyRandomResult(UINT8 useodds);
mobj_t *K_CreatePaperItem(fixed_t x, fixed_t y, fixed_t z, angle_t angle, SINT8 flip, UINT8 type, UINT8 amount);
void K_DropPaperItem(player_t *player, UINT8 itemtype, UINT16 itemamount);
void K_PopPlayerShield(player_t *player);
void K_DropItems(player_t *player);
void K_DropRocketSneaker(player_t *player);