Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 2 commits into from
Aug 15, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
- fixed carrying over unexpected guns in holsters to the next level under rare scenarios (#1437, regression from 2.4)
- fixed item cheats not updating Lara holster and backpack meshes (#1437)
- improved initial level load time by lazy-loading audio samples (LostArtefacts/TR2X#114)
- set Lara's default weapon to any weapon she picks up when unarmed, not just pistols (#1443)
walkawayy marked this conversation as resolved.
Show resolved Hide resolved

## [4.2](https://github.com/LostArtefacts/TR1X/compare/4.1.2...4.2) - 2024-07-14
- added creating minidump files on crashes
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -515,6 +515,7 @@ Not all options are turned on by default. Refer to `TR1X_ConfigTool.exe` for det
- fixed looking forward too far causing an upside down camera frame
- fixed the Scion being extremely difficult to shoot with the shotgun
- fixed collision issues with drawbridges, trapdoors, and bridges when stacked over each other, over slopes, and near the ground
- set Lara's default weapon to any weapon she picks up when unarmed, not just pistols

#### Cheats
- added a fly cheat
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();
rr- marked this conversation as resolved.
Show resolved Hide resolved
}
}

const GAME_OBJECT_ID inv_object_id = Inv_GetItemOption(object_id);
Expand Down