inventory: set any weapon to default on pickup if unarmed (#1445)

Resolves #1443.
This commit is contained in:
walkawayy 2024-08-15 11:24:34 -04:00 committed by GitHub
parent a1e72ac8ba
commit c61471f275
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 24 additions and 0 deletions

View file

@ -5,6 +5,7 @@
- added weapons to Lara's empty holsters on pickup (#1291) - added weapons to Lara's empty holsters on pickup (#1291)
- added options to quiet or mute music while underwater (#528) - added options to quiet or mute music while underwater (#528)
- changed the turbo cheat to no longer affect the gameplay time (#1420) - 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 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 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) - fixed the ingame timer being skewed upon inventory open (#1420, regression from 4.1)

View file

@ -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 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 weapons to Lara's empty holsters on pickup
- added options to quiet or mute music while underwater - 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 keys and items not working when drawing guns immediately after using them
- fixed counting the secret in The Great Pyramid - 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 - fixed running out of ammo forcing Lara to equip pistols even if she doesn't carry them

View file

@ -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); 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_GetLaraAnim(LARA_GUN_TYPE gun_type);
GAME_OBJECT_ID Gun_GetWeaponAnim(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_UpdateLaraMeshes(GAME_OBJECT_ID object_id);
void Gun_SetLaraBackMesh(LARA_GUN_TYPE weapon_type); void Gun_SetLaraBackMesh(LARA_GUN_TYPE weapon_type);
void Gun_SetLaraHandLMesh(LARA_GUN_TYPE weapon_type); void Gun_SetLaraHandLMesh(LARA_GUN_TYPE weapon_type);

View file

@ -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) void Gun_DrawFlash(LARA_GUN_TYPE weapon_type, int32_t clip)
{ {
int32_t light; int32_t light;

View file

@ -14,6 +14,11 @@ bool Inv_AddItem(const GAME_OBJECT_ID object_id)
{ {
if (Object_IsObjectType(object_id, g_GunObjects)) { if (Object_IsObjectType(object_id, g_GunObjects)) {
Gun_UpdateLaraMeshes(object_id); 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); const GAME_OBJECT_ID inv_object_id = Inv_GetItemOption(object_id);