pickup: add guns to emtpy holsters on pickup

Resolves #1291.
This commit is contained in:
walkawayy 2024-08-10 12:48:56 -04:00
parent 61a159f558
commit 871259d620
5 changed files with 36 additions and 4 deletions

View file

@ -2,6 +2,7 @@
- added deadly water feature from TR2+ for custom levels (#1404)
- added skybox support, with a default option provided for Lost Valley, Colosseum and Obelisk of Khamoon (#94)
- added an option for Lara to use her underwater swimming physics from TR2+ (#1003)
- added weapons to Lara's empty holsters on pickup (#1291)
- changed the turbo cheat to no longer affect the gameplay time (#1420)
- fixed adjacent Midas Touch objects potentially allowing gold bar duplication in custom levels (#1415)
- fixed the excessive pitch and playback speed correction for music files with sampling rate other than 44100 Hz (#1417, regression from 2.0)

View file

@ -459,6 +459,7 @@ Not all options are turned on by default. Refer to `TR1X_ConfigTool.exe` for det
- added graphics effects, lava emitters, flame emitters, and waterfalls to the savegame so they now persist on load
- added an option to restore the mummy in City of Khamoon room 25, similar to the PS version
- added a flag indicating if new game plus is unlocked to the player config which allows the player to select new game plus or not when making a new game
- added weapons to Lara's empty holsters on pickup
- fixed keys and items not working when drawing guns immediately after using them
- fixed counting the secret in The Great Pyramid
- fixed running out of ammo forcing Lara to equip pistols even if she doesn't carry them

View file

@ -167,7 +167,7 @@ void Carrier_TestItemDrops(int16_t item_num)
GAME_OBJECT_ID object_id = item->object_id;
if (g_GameFlow.convert_dropped_guns
&& Object_IsObjectType(object_id, g_GunObjects)
&& Inv_RequestItem(object_id)) {
&& Inv_RequestItem(object_id) && object_id != O_PISTOL_ITEM) {
object_id = Object_GetCognate(object_id, g_GunAmmoObjectMap);
}

View file

@ -101,6 +101,7 @@ const GAME_OBJECT_ID g_PickupObjects[] = {
const GAME_OBJECT_ID g_GunObjects[] = {
// clang-format off
O_PISTOL_ITEM,
O_SHOTGUN_ITEM,
O_MAGNUM_ITEM,
O_UZI_ITEM,
@ -168,6 +169,7 @@ const GAME_OBJECT_ID g_InvObjects[] = {
const GAME_OBJECT_PAIR g_GunAmmoObjectMap[] = {
// clang-format off
{ O_PISTOL_ITEM, O_PISTOL_AMMO_ITEM },
{ O_SHOTGUN_ITEM, O_SG_AMMO_ITEM },
{ O_MAGNUM_ITEM, O_MAG_AMMO_ITEM },
{ O_UZI_ITEM, O_UZI_AMMO_ITEM },

View file

@ -49,16 +49,44 @@ static const OBJECT_BOUNDS m_PickUpBoundsUW = {
},
};
static void PickUp_AddGunToMesh(
const GAME_OBJECT_ID obj_num, const ITEM_INFO *lara_item);
static void PickUp_GetItem(
int16_t item_num, ITEM_INFO *item, ITEM_INFO *lara_item);
static void PickUp_GetAllAtLaraPos(ITEM_INFO *item, ITEM_INFO *lara_item);
static void PickUp_AddGunToMesh(
const GAME_OBJECT_ID obj_num, const ITEM_INFO *const lara_item)
{
const bool lara_has_pistols = Inv_RequestItem(O_PISTOL_ITEM)
|| Inv_RequestItem(O_MAGNUM_ITEM) || Inv_RequestItem(O_UZI_ITEM);
if (!Inv_RequestItem(O_SHOTGUN_ITEM) && obj_num == O_SHOTGUN_ITEM) {
g_Lara.mesh_ptrs[LM_TORSO] =
g_Meshes[g_Objects[O_SHOTGUN_ANIM].mesh_index + LM_TORSO];
} else if (!lara_has_pistols && obj_num == O_PISTOL_ITEM) {
g_Lara.mesh_ptrs[LM_THIGH_L] =
g_Meshes[g_Objects[O_PISTOL_ANIM].mesh_index + LM_THIGH_L];
g_Lara.mesh_ptrs[LM_THIGH_R] =
g_Meshes[g_Objects[O_PISTOL_ANIM].mesh_index + LM_THIGH_R];
} else if (!lara_has_pistols && obj_num == O_MAGNUM_ITEM) {
g_Lara.mesh_ptrs[LM_THIGH_L] =
g_Meshes[g_Objects[O_MAGNUM_ANIM].mesh_index + LM_THIGH_L];
g_Lara.mesh_ptrs[LM_THIGH_R] =
g_Meshes[g_Objects[O_MAGNUM_ANIM].mesh_index + LM_THIGH_R];
} else if (!lara_has_pistols && obj_num == O_UZI_ITEM) {
g_Lara.mesh_ptrs[LM_THIGH_L] =
g_Meshes[g_Objects[O_UZI_ANIM].mesh_index + LM_THIGH_L];
g_Lara.mesh_ptrs[LM_THIGH_R] =
g_Meshes[g_Objects[O_UZI_ANIM].mesh_index + LM_THIGH_R];
}
}
static void PickUp_GetItem(
int16_t item_num, ITEM_INFO *item, ITEM_INFO *lara_item)
{
if (item->object_number == O_SHOTGUN_ITEM) {
g_Lara.mesh_ptrs[LM_TORSO] =
g_Meshes[g_Objects[O_SHOTGUN_ANIM].mesh_index + LM_TORSO];
if (Object_IsObjectType(item->object_number, g_GunObjects)) {
PickUp_AddGunToMesh(item->object_number, lara_item);
}
Overlay_AddPickup(item->object_number);
Inv_AddItem(item->object_number);