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

Set hitLocation when return status is not -1 #429

Merged

Conversation

roginvs
Copy link
Contributor

@roginvs roginvs commented Dec 25, 2024

Original PR is here fallout2-ce#9

In some cases function calledShotSelectHitLocation can return not a -1 value but not to set hitLocation. This causes undefined behavior when hitLocation is used later, and it can cause the game to crash with segfault because hitLocation is used as array index later.

This PR ensures that if calledShotSelectHitLocation function reports a success then hitLocation value will always be set

Originally reported in https://www.nma-fallout.com/threads/fallout-nevada-and-sonora-in-the-browser.222617/#post-4529005

@alexbatalov
Copy link
Owner

I've double checked the original binary, there is indeed a bug, the default hit location is torso.

@alexbatalov alexbatalov merged commit ad7b0e5 into alexbatalov:main Jan 13, 2025
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants