Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
E.J.

Infinite ammo with dehacked?

Recommended Posts

Hi all again.

Could someone point me in the right direction here?

I would like to either create a dehacked file that gives a weapon infinite ammo, or that increases the limit while starting the player with their ammo full.

Edit;

NM. I had no idea it'd be so simple.
I finally bit the bullet, and installed Whacked 3.
It was something along adding a single line entry for the ammo 'type'.

Share this post


Link to post

Also make sure you make the max ammo and pickup ammo 0 for whatever ammo types you're giving infinite ammo to.

Share this post


Link to post

Or with eternity extensions for BEX, you can add ammo per shot = 0 but making ammo = 5 works for Boom and DEH!

Share this post


Link to post
neubejiita said:

Just set the weapons ammo type to 5, that is the fist and chainsaw ammo type, then there will be no ammo problems.

http://pastebay.com/122619

Here is my super.deh for reference. Have fun.


Thanks.

BTW - Has anyone here ever gotten WhackEd3 to run successfully under Linux Wine? Is there any reason I shouldn\\\'t just use WhackEd2, which runs fine under it?

Share this post


Link to post

Actually using the "no ammo" ammo type with any weapon pointer except the chainsaw or fist will corrupt the player's max shotgun ammo, at least in vanilla DOOM. This is because of the value of am_noammo and the layout of the player_t structure in memory:

ammo[0]    // am_clip    == 0
ammo[1]    // am_shell   == 1
ammo[2]    // am_cell    == 2
ammo[3]    // am_misl    == 3
maxammo[0] // am_numammo == 4 (maxammo for bullets)
maxammo[1] // am_noammo  == 5 (maxammo for shotgun !!!)
None of the weapon pointers except A_Punch and A_Saw bother to check that the weapon's ammo type is in range, so when they go to do this:
player->ammo[weaponinfo[player->readyweapon].ammo] -= <amt>;
they are committing an undefined access past the boundaries of the ammo[] array.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×