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

Using Reload hotkey with weapons that don't have mags causes some memory corruption #384

Open
bangstk opened this issue Jul 10, 2021 · 1 comment

Comments

@bangstk
Copy link

bangstk commented Jul 10, 2021

If a weapon doesn't use ammo (such as melee weapons or beam weapons like the Sparq) it seems that random things will happen if the player uses the reload hotkey with it selected.

The reload sound plays, and then for example, with the Sparq Beam selected, STAMUP patches start disappearing from your inventory every time the reload hotkey is pressed. Other weapons have different effects. Maybe it's writing out of bounds on other memory areas due to undefined ammo.

@icosahedral-dragon
Copy link
Contributor

The reload weapon hotkey function does not check if the current weapon uses ammo before attempting to reload it.

The number of clips the player has for each ammo type is stored in an array. The code looks up the clip count by taking the base ammo type (which will be zero for an ammoless weapon) and adding the current ammo type. But the current ammo type field is shared with the intensity setting for beam weapons. The default intensity for the sparq is 30, causing the code to look past the ammo count array and end up in the drugs/patches list. Hence using the STAMUP patch as "clips" for the sparq. If you change the intensity setting it will have different effects.

This bug doesn't show up in the enhanced edition on Steam, but it may be something that Night Dive have already patched. It looks like we inherited it from the Mac code, anyway.

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

No branches or pull requests

2 participants