Skip to content

Commit

Permalink
inventory: set any weapon to default on pickup if unarmed (LostArtefa…
Browse files Browse the repository at this point in the history
  • Loading branch information
walkawayy authored Aug 15, 2024
1 parent a1e72ac commit c61471f
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions src/game/gun.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
16 changes: 16 additions & 0 deletions src/game/gun/gun.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
5 changes: 5 additions & 0 deletions src/game/inventory/inventory_func.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit c61471f

Please sign in to comment.