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

Add "Ammo per shot" DEHACKED field #24

Merged
merged 11 commits into from
Apr 16, 2021

Conversation

XaserAcheron
Copy link
Contributor

Adds a new Ammo per shot field to DEHACKED. Implementation mirrors Eternity's, for forward-compat n' whatnot.

A summary of sorts:

  • Weapons now use this field to determine if the player has enough ammo to fire, instead of hardcoding the value for each weapon.
  • Weapon autoswitch has been fixed in general to check the correct ammotype & ammo use for each weapon, rather than assume the vanilla ammotypes (this is an ooooold bug from ever since DEHACKED was introduced).
  • The new A_ConsumeAmmo and A_CheckAmmo MBF21 DEHACKED codepointers will use the ready weapon's Ammo per shot field if the amount arg is set to zero.
  • Vanilla doom weapon fire codepointer behavior varies on whether or not the Ammo per shot field is explicitly set on a weapon.
    • If set, the ready weapon's Ammo per shot field is subtracted from the weapon's ammo type.
    • If not set, the amount of ammo subtracted depends on the weapon codepointer being used (e.g. A_FireShotgun2 will subtract 2, A_FireBFG will subtract BFGCELLS -- this mirrors vanilla Doom behavior)
  • For general sanity, the "BFG Cells/Shot" field will also set the BFG weapon's Ammo per shot field.

There's a little bit of refactoring of things that touches a bit of Heretic (namely, all the various ammo-per-shot arrays for the doom/heretic weapons were replaced with the new weaponinfo_t ammopershot field ), though this feature is not yet fully implemented for Heretic 'cause it doesn't do DEH. ;) -- I tested Heretic to make sure it all works as intended still (and the spec passes), so all should be well there.

[Will update mbf21.md here in a bit; need to make the PR first. ;]

@XaserAcheron
Copy link
Contributor Author

Quick-ish update: needed to add a check for wp_noammo in P_SubtractAmmo, and while I was in the neighborhood, I went ahead and made it so in mbf21 ammo cannot go into the negatives, 'cause nobody wants that. :P

@XaserAcheron
Copy link
Contributor Author

Just updated mbf21.md with some info on the new stuffs.

prboom2/src/p_pspr.c Outdated Show resolved Hide resolved
prboom2/src/p_pspr.c Outdated Show resolved Hide resolved
prboom2/src/p_pspr.c Outdated Show resolved Hide resolved
prboom2/src/p_pspr.c Outdated Show resolved Hide resolved
prboom2/src/p_pspr.c Outdated Show resolved Hide resolved
prboom2/src/p_pspr.c Show resolved Hide resolved
prboom2/src/d_deh.c Show resolved Hide resolved
prboom2/src/d_items.h Outdated Show resolved Hide resolved
prboom2/src/p_pspr.c Outdated Show resolved Hide resolved
@kraflab
Copy link
Owner

kraflab commented Apr 15, 2021

I'll resolve the conflicts, sec

@kraflab kraflab merged commit 5223d6f into kraflab:master Apr 16, 2021
@XaserAcheron XaserAcheron deleted the mbf21-ammopershot branch May 1, 2021 22:42
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