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

Inconsistent port behaviour when plasma gun is out of ammo

Recommended Posts

When the plasma gun is out of ammo in vanilla and ZDoom, it gets lowered quickly. In other ports, like prboom+, Eternity and 3DGE, it first goes through the frames (the ones where Doomguy is holding it upright) then it gets lowered.

Any insight on this?

EDIT: OK, complevel 2 changes this behaviour for prboom+, although I can't find the toggle in the options, are there hidden options that are changeable only with complevel?

Share this post

Link to post

A_ReFire() is called after each shot of plasma, this then calls P_FireWeapon() which then calls P_CheckAmmo() (which returns zero). P_CheckAmmo() when you are out of ammo basically just goes through all other guns to see if you have ammo in them (falling back to the first in the worst/best case). Then that specified weapon is set as the next weapon to use (weaponchange) and then the current weapon is placed in the lower state, skipping any frames after. With some DeHackEd magic you can have some fun with this.

The source ports that do it differently might have it where there is a plasma type of lower or plasma check, but you would need to look at the sources for that.

Other than that, it is possible the Doom guy likes some roasty plasma rifle in his pockets.

Share this post

Link to post

Interesting find.

It doesn't affect demo playback in Eternity (in that vanilla behaviour still functions with vanilla demos), but I can't find any compat/gameplay options to make vanilla's method the default behaviour during regular play in Eternity either (not that I really looked for longer than 10 seconds, so I probably missed it).

Share this post

Link to post

My first guess would be that Boom is the source of that change.

// P_CheckAmmo
// Returns true if there is enough ammo to shoot.
// If not, selects the next weapon to use.
// (only in demo_compatibility mode -- killough 3/22/98)

boolean P_CheckAmmo(player_t *player)
  ammotype_t ammo = weaponinfo[player->readyweapon].ammo;
  int count = 1;  // Regular

  if (player->readyweapon == wp_bfg)  // Minimal amount for one shot varies.
    count = BFGCELLS;
    if (player->readyweapon == wp_supershotgun)        // Double barrel.
      count = 2;

  // Some do not need ammunition anyway.
  // Return if current ammunition sufficient.

  if (ammo == am_noammo || player->ammo[ammo] >= count)
    return true;

  // Out of ammo, pick a weapon to change to.
  // killough 3/22/98: for old demos we do the switch here and now;
  // for Boom games we cannot do this, and have different player
  // preferences across demos or networks, so we have to use the
  // G_BuildTiccmd() interface instead of making the switch here.

  if (demo_compatibility)
      player->pendingweapon = P_SwitchWeapon(player);      // phares
      // Now set appropriate weapon overlay.

  return false;

Share this post

Link to post

This is similar to the fuck-up that makes weapon changing on ammo collection behave differently.

BOOM team never should have added weapon priority as a user preference. It is part of the game logic and is one reason Eternity has had so much difficulty getting to a sane place where it can support other games' weapons.

Share this post

Link to post
Quasar said:

BOOM team never should have added weapon priority as a user preference.

I'll give you that it uglies up the code and introduces a number of unfortunate bugs, and I understand it gave you trouble when extending the system to non-vanilla weapons. But otherwise, I must disagree. From my point of view as a player, weapon preferences are something which I really do not wish to live without. When playing in pre-Boom complevels I curse loudly every time the game autoswitches to the plasma gun and I accidentally waste a few precious cells, often robbing me of an entire BFG shot in the process. Autoswitching to shotgun or chaingun is far more desirable.

Also I note the Boom weapon switch bugs can, at least in my experience, be fixed without breaking sync. The patches have been working for me for years, but IIRC there was some doubt about their correctness or elegance from #doom-tech, so I never committed them (IIRC, adding a new global, for P_CheckAmmo to signal G_BuildTiccmd to switch weapons on the next tic, was suboptimal, but I've never come up with a better solution).

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