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

gun: fix Lara holster and back states #1442

Closed
wants to merge 5 commits into from
Closed

Conversation

rr-
Copy link
Collaborator

@rr- rr- commented Aug 13, 2024

Checklist

  • I have read the coding conventions
  • I have added a changelog entry about what my pull request accomplishes, or it is an internal change

Description

Resolves #1437.

It's impossible to determine which guns should go in Lara's holsters and on her back without saving this information in the save files. To address this, I've added this data to RESUME_INFO, which should work well with the Select Level and Restart Level features. For smoother state management, the current holsters and back gun types are now also included in LARA_INFO (although, in theory, this could be inferred from mesh comparisons). This addition requires extra record-keeping. Additionally, to accommodate saves lacking the new holsters and back gun types information (such as TombATI and anything pre-4.3), I've introduced a special LARA_GUN_TYPE member: LGT_UNKNOWN. Although not ideal, it's the only method I could devise to support these configurations. When this information is missing, Savegame_ApplyLogicToCurrentInfo makes educated guesses to fill in the gaps.

Because I hated seeing mesh_ptrs so often during this endeavor I've introduced Lara_SwapSingleMesh which compels Lara_SwapMeshExtra.

Important testing scenarios to consider that ideally should be combined with each other:

  • Loading the game from a legacy save
  • Loading the game from a 4.2 save
  • Starting a new game
  • Advancing to Natla's Mines (and losing guns)
  • Using the Select Level feature
  • Using the Restart Level feature
  • Enabling and disabling revert_to_pistols config option
  • Going from Natla's Mines to Atlantis with various configurations (this is extra difficult scenario, as it carries over the gun information across a cutscene, and in the middle of it, Lara is given guns)
    • This is handled differently if you start from a TombATI save
    • This is handled yet differently if you start from a TR1X save

Reference mesh matrix for gun combinations that make sense:

Hands object Back object Holsters object
Empty Empty Empty
Empty Empty Magnums
Empty Empty Pistols
Empty Empty Uzis
Empty Shotgun Empty
Empty Shotgun Magnums
Empty Shotgun Pistols
Empty Shotgun Uzis
Magnums Empty Empty
Magnums Empty Pistols
Magnums Empty Uzis
Magnums Shotgun Empty
Magnums Shotgun Pistols
Magnums Shotgun Uzis
Pistols Empty Empty
Pistols Empty Magnums
Pistols Empty Uzis
Pistols Shotgun Empty
Pistols Shotgun Magnums
Pistols Shotgun Uzis
Shotgun Empty Empty
Shotgun Empty Magnums
Shotgun Empty Pistols
Shotgun Empty Uzis
Uzis Empty Empty
Uzis Empty Magnums
Uzis Empty Pistols
Uzis Shotgun Empty
Uzis Shotgun Magnums
Uzis Shotgun Pistols

@rr- rr- added TRX bug A bug with TRX OG bug A bug in original game labels Aug 13, 2024
@rr- rr- added this to the 4.3 milestone Aug 13, 2024
@rr- rr- requested review from lahm86, walkawayy and aredfan August 13, 2024 20:24
@rr-
Copy link
Collaborator Author

rr- commented Aug 13, 2024

Test build: https://home.wind.garden/serve/pub/TR1X-4.2-47-g264ba2c-Windows.zip

Copy link
Collaborator

@walkawayy walkawayy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am 99% likely to have missed some fringe test cases, but everything LGTM... I tried restarting, level selecting, picking up different combinations of guns, checking the guns on save / load between entire game shutdowns, and more. aredfan will probably serve as the ultimate raid boss on this test though.

Copy link
Collaborator

@lahm86 lahm86 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great.

There is one slight anomaly, but I can't decide if it's an actual issue or not.

  • Load Natla's Mines
  • give uzis
  • The uzi holster meshes are drawn
  • Level skip
  • In Atlantis, the uzi holster meshes are drawn
  • Equip guns, and Lara draws her pistols

But this sort of makes sense I think, because even if you try to draw guns in Mines with only the uzis, she doesn't because those aren't the actual selected guns. But on the other hand, you see her holstered uzis and so can be forgiven for expecting those to be drawn.

It raises the question of when you pick up another weapon and you don't have pistols, should that become the current selected weapon?

@rr-
Copy link
Collaborator Author

rr- commented Aug 14, 2024

Thank you for testing!

It raises the question of when you pick up another weapon and you don't have pistols, should that become the current selected weapon?

IMO yes, but I believe it's a different issue since it involves equipping the guns rather than the meshes covered in this PR. Let's open a new ticket for that.

@aredfan
Copy link
Collaborator

aredfan commented Aug 14, 2024

I think I've fully tested the Natla Mines => Atlantis scenarios.

If pistols as primary weapon is enabled, there's an issue with this scenario:

Hands object Back object Holsters object
Shotgun Empty Pistols

Proceed to the next level (Atlantis) and Lara is holding pistols in her hands instead of a shotgun. Also there is no shotgun on her back.

I'll test all the remaining stuff on the list this afternoon.

@aredfan
Copy link
Collaborator

aredfan commented Aug 14, 2024

There's just 1 issue regarding legacy saves with pistols as primary weapon enabled. This save is from TombATI where Lara is holding her shotgun.

20240814_120002_Sanctuary_of_the_Scion

Save:
saveati.zip


Edit: Actually this is a TR1X bug and not an issue with legacy saves. I was able to reproduce it in 4.2.

@aredfan
Copy link
Collaborator

aredfan commented Aug 14, 2024

Testing done! LGTM and thank you for taking the time to work on this issue.

To summarise:
-The issues I mentioned previously are already present in 4.2 so not new regressions introduced under this PR.
-With pistols as primary weapon disabled. When starting NG+, there are pistol meshes in Lara's holsters, but when drawn, turns into uzis. This might already be covered under #1443.

@rr-
Copy link
Collaborator Author

rr- commented Aug 14, 2024

https://home.wind.garden/serve/pub/TR1X-4.2-48-g65bed6e-Windows.zip
@aredfan can you verify if the mentioned issues have been fixed by this proposed patch?

I'll now look into the NG+ issue which I missed before.

@rr-
Copy link
Collaborator Author

rr- commented Aug 14, 2024

https://home.wind.garden/serve/pub/TR1X-4.2-49-gc3740a4-Windows.zip
this should fix the NG+ issue.

@aredfan
Copy link
Collaborator

aredfan commented Aug 14, 2024

@rr- For the first 2 issues:

  • Lara still holds pistols in Atlantis but this time there's a shotgun on her back. 👍
  • The save issue is still present.

For NG(+)

If pistols as primary weapon is disabled. LGTM.

If pistols as primary weapon is enabled:

  • NG: Empty holsters, draws pistols.
  • NG+: Uzis in holsters, draw pistols.
  • JNG: Empty holsters, draws pistols.
  • JNG+: Uzis in holsters, draw pistols.

@rr- rr- force-pushed the b1437-holsters-woes branch from c3740a4 to 78bbd8e Compare August 14, 2024 13:25
@rr-
Copy link
Collaborator Author

rr- commented Aug 14, 2024

Lara still holds pistols in Atlantis but this time there's a shotgun on her back. 👍

That's good as Lara forcefully gets her pistols back, and the revert to pistols option correctly switches her equipped gun to pistols.

@aredfan can you plesae give this one more round of tests? It should fix the savegame issue and the meshes in NG/NG+. The fix was had a significant change, but it affected only when the revert to pistols option is enabled.

https://home.wind.garden/serve/pub/TR1X-4.2-49-g78bbd8e-Windows.zip

@aredfan
Copy link
Collaborator

aredfan commented Aug 14, 2024

@rr- No problem, I'm happy to keep testing if needs be. The shotgun save issue is now fixed. 👍

These 2 remaining issues still persist when pistols as primary weapon is enabled:

  • NG+: Uzis in holsters, draw pistols.
  • JNG+: Uzis in holsters, draw pistols.

@rr-
Copy link
Collaborator Author

rr- commented Aug 14, 2024

@rr- No problem, I'm happy to keep testing if needs be. The shotgun save issue is now fixed. 👍

These 2 remaining issues still persist when pistols as primary weapon is enabled:

  • NG+: Uzis in holsters, draw pistols.
  • JNG+: Uzis in holsters, draw pistols.

I would say this is the intended behavior, since she does revert to pistols, but at the same time it's shown that she has the uzis.

Or maybe I should make this setting not apply to the first level?

@walkawayy
Copy link
Collaborator

@rr- No problem, I'm happy to keep testing if needs be. The shotgun save issue is now fixed. 👍
These 2 remaining issues still persist when pistols as primary weapon is enabled:

  • NG+: Uzis in holsters, draw pistols.
  • JNG+: Uzis in holsters, draw pistols.

I would say this is the intended behavior, since she does revert to pistols, but at the same time it's shown that she has the uzis.

Or maybe I should make this setting not apply to the first level?

I would say if pistols as primary weapon is enabled, she should have pistols in holsters + draw pistols. If you want to have Uzis in the holsters to highlight all weapons in NG+, I would say she should equip them too. It's weird IMO to draw pistols if Uzis are in her holsters.

@aredfan
Copy link
Collaborator

aredfan commented Aug 14, 2024

I would say this is the intended behavior, since she does revert to pistols, but at the same time it's shown that she has the uzis.

Or maybe I should make this setting not apply to the first level?

That does make sense actually since the setting says revert to pistols. In that case, everything LGTM. 💯

@rr-
Copy link
Collaborator Author

rr- commented Aug 14, 2024

I've set it to keep the UZIs regardless of the revert_to_pistols setting.

@rr-
Copy link
Collaborator Author

rr- commented Aug 14, 2024

Merged in a1e72ac

@rr- rr- closed this Aug 14, 2024
@rr- rr- deleted the b1437-holsters-woes branch August 14, 2024 15:06
@rr- rr- added the TR1 label Oct 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
OG bug A bug in original game TR1 TRX bug A bug with TRX
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TR1X bug: Possible for Lara to start Atlantis level with empty holsters
4 participants