Skip to content

Commit

Permalink
tr1/carrier: test for Qualopec mummy on item drop
Browse files Browse the repository at this point in the history
This moves the enemy status check when testing item drops into a
separate function for clarity, and checks additionally for the
Qualopec mummy, whose hitpoints will still be greater than 0 when Lara
touches it, and this still qualifies as a kill.
  • Loading branch information
lahm86 committed Oct 16, 2024
1 parent 3846e03 commit cce7068
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions src/tr1/game/carrier.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
static int16_t m_AnimatingCount = 0;

static ITEM *M_GetCarrier(int16_t item_num);
static CARRIED_ITEM *M_GetFirstDropItem(const ITEM *carrier);
static void M_AnimateDrop(CARRIED_ITEM *item);
static void M_InitialiseDataDrops(void);
static void M_InitialiseGameflowDrops(int32_t level_num);
Expand Down Expand Up @@ -57,6 +58,19 @@ static ITEM *M_GetCarrier(const int16_t item_num)
return item;
}

static CARRIED_ITEM *M_GetFirstDropItem(const ITEM *const carrier)
{
if (carrier->hit_points > 0 && carrier->object_id != O_MUMMY) {
return NULL;
}

if (carrier->object_id == O_PIERRE && !(carrier->flags & IF_ONE_SHOT)) {
return NULL;
}

return carrier->carried_item;
}

static void M_AnimateDrop(CARRIED_ITEM *const item)
{
if (item->status != DS_FALLING) {
Expand Down Expand Up @@ -265,10 +279,8 @@ DROP_STATUS Carrier_GetSaveStatus(const CARRIED_ITEM *item)
void Carrier_TestItemDrops(const int16_t item_num)
{
const ITEM *const carrier = Item_Get(item_num);
CARRIED_ITEM *item = carrier->carried_item;
if (carrier->hit_points > 0 || item == NULL
|| (carrier->object_id == O_PIERRE
&& !(carrier->flags & IF_ONE_SHOT))) {
CARRIED_ITEM *item = M_GetFirstDropItem(carrier);
if (item == NULL) {
return;
}

Expand Down

0 comments on commit cce7068

Please sign in to comment.