diff --git a/CHANGELOG.md b/CHANGELOG.md index 424f7e259..65130486e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ - added weapons to Lara's empty holsters on pickup (#1291) - added options to quiet or mute music while underwater (#528) - changed the turbo cheat to no longer affect the gameplay time (#1420) +- changed weapon pickup behavior when unarmed to set any weapon as the default weapon, not just pistols (#1443) - 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) - fixed the ingame timer being skewed upon inventory open (#1420, regression from 4.1) diff --git a/README.md b/README.md index dfb43fc29..0f0a7c1ee 100644 --- a/README.md +++ b/README.md @@ -461,6 +461,7 @@ Not all options are turned on by default. Refer to `TR1X_ConfigTool.exe` for det - 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 - added options to quiet or mute music while underwater +- changed weapon pickup behavior when unarmed to set any weapon as the default weapon, not just pistols - 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 diff --git a/src/game/gun.h b/src/game/gun.h index 996f1de4f..5ad9ae364 100644 --- a/src/game/gun.h +++ b/src/game/gun.h @@ -15,6 +15,7 @@ void Gun_HitTarget(ITEM_INFO *item, GAME_VECTOR *hitpos, int16_t damage); void Gun_DrawFlash(LARA_GUN_TYPE weapon_type, int32_t clip); GAME_OBJECT_ID Gun_GetLaraAnim(LARA_GUN_TYPE gun_type); GAME_OBJECT_ID Gun_GetWeaponAnim(LARA_GUN_TYPE gun_type); +LARA_GUN_TYPE Gun_GetType(GAME_OBJECT_ID object_id); void Gun_UpdateLaraMeshes(GAME_OBJECT_ID object_id); void Gun_SetLaraBackMesh(LARA_GUN_TYPE weapon_type); void Gun_SetLaraHandLMesh(LARA_GUN_TYPE weapon_type); diff --git a/src/game/gun/gun.c b/src/game/gun/gun.c index 9a0979510..7a2055e1c 100644 --- a/src/game/gun/gun.c +++ b/src/game/gun/gun.c @@ -234,6 +234,22 @@ GAME_OBJECT_ID Gun_GetWeaponAnim(const LARA_GUN_TYPE gun_type) } } +LARA_GUN_TYPE Gun_GetType(const GAME_OBJECT_ID object_id) +{ + switch (object_id) { + case O_PISTOL_ITEM: + return LGT_PISTOLS; + case O_MAGNUM_ITEM: + return LGT_MAGNUMS; + case O_UZI_ITEM: + return LGT_UZIS; + case O_SHOTGUN_ITEM: + return LGT_SHOTGUN; + default: + return LGT_UNARMED; + } +} + void Gun_DrawFlash(LARA_GUN_TYPE weapon_type, int32_t clip) { int32_t light; diff --git a/src/game/inventory/inventory_func.c b/src/game/inventory/inventory_func.c index 14927807e..f268b8bc2 100644 --- a/src/game/inventory/inventory_func.c +++ b/src/game/inventory/inventory_func.c @@ -14,6 +14,11 @@ bool Inv_AddItem(const GAME_OBJECT_ID object_id) { if (Object_IsObjectType(object_id, g_GunObjects)) { Gun_UpdateLaraMeshes(object_id); + if (g_Lara.gun_type == LGT_UNARMED) { + g_Lara.gun_type = Gun_GetType(object_id); + g_Lara.gun_status = LGS_ARMLESS; + Gun_InitialiseNewWeapon(); + } } const GAME_OBJECT_ID inv_object_id = Inv_GetItemOption(object_id);