Weapon pickups don't autoswitch

Bugs that have been investigated and resolved somehow.

Moderator: GZDoom Developers

Forum rules
Please don't bump threads here if you have a problem - it will often be forgotten about if you do. Instead, make a new thread here.
Post Reply
User avatar
Chris
Posts: 2971
Joined: Thu Jul 17, 2003 12:07 am
Graphics Processor: ATI/AMD with Vulkan/Metal Support

Weapon pickups don't autoswitch

Post by Chris »

I've been noticing this ever since I came back to playing ZDoom. I don't know if it's intended behavior, but it strikes me as at least inconsitent behavior.

If you have a weapon, say a shutgun, and run out of ammo, it'll autoswitch to something else; like the pistol. If you then pickup some shotgun shells, it'll autoswitch back to the shotgun. But if you picked up another shotgun instead, it won't switch back to it, even though you get ammo for it all the same.

It seems if it'll switch back once you reacquire ammo for it, IMO, it should do so regardless of where that ammo came from.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49230
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Weapon pickups don't autoswitch

Post by Graf Zahl »

You know what? This has been bugging me forever since 2.0.90 but I never made the connection between the differences of weapon/ammo pickups...
Gez
 
 
Posts: 17945
Joined: Fri Jul 06, 2007 3:22 pm

Re: Weapon pickups don't autoswitch

Post by Gez »

Behavior is still inconsistent with when you pick up a backpack, or get ammo through another mean (cheat, custominventory item giving ammo through DECORATE code, etc.).
User avatar
Enjay
 
 
Posts: 27042
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland
Contact:

Re: Weapon pickups don't autoswitch

Post by Enjay »

Funnily enough, this bug has been annoying me for some time too, but I couldn't quite figure out what it was that wasn't happening correctly. I just knew that *something* wasn't right.

Anyway, I just checked doom2.exe. If you have switched to the pistol from the shotgun due to lack of shotgun ammo, then pick up a backpack, you switch back to the shotgun. In Zdoom (r1333) you do not.
dennisj1
Posts: 399
Joined: Sun Jan 11, 2004 1:46 pm
Location: Superior, WI

Re: Weapon pickups don't autoswitch

Post by dennisj1 »

Enjay wrote: If you have switched to the pistol from the shotgun due to lack of shotgun ammo,
Did you mean that? Or, is it supposed to be reversed?
Gez
 
 
Posts: 17945
Joined: Fri Jul 06, 2007 3:22 pm

Re: Weapon pickups don't autoswitch

Post by Gez »

dennisj1 wrote:
Enjay wrote: If you have switched to the pistol from the shotgun due to lack of shotgun ammo,
Did you mean that? Or, is it supposed to be reversed?
"switched to the pistol from the shotgun" and "switched from the shotgun to the pistol" have exactly the same meaning. What he said is what he meant, and is absolutely correct.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49230
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Weapon pickups don't autoswitch

Post by Graf Zahl »

Enjay wrote: Anyway, I just checked doom2.exe. If you have switched to the pistol from the shotgun due to lack of shotgun ammo, then pick up a backpack, you switch back to the shotgun. In Zdoom (r1333) you do not.

ZDoom's weapon switching works differently than vanilla's and I'm afraid that the backpack is a victim of that which is not that easily restored. What decides which weapon is supposed to be activated when a backpack is being picked up?
User avatar
Ryan Cordell
Posts: 4349
Joined: Sun Feb 06, 2005 6:39 am
Preferred Pronouns: No Preference
Operating System Version (Optional): Windows 10
Graphics Processor: nVidia (Modern GZDoom)
Location: Capital of Explodistan

Re: Weapon pickups don't autoswitch

Post by Ryan Cordell »

Last weapon which had no ammo? :?
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49230
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Weapon pickups don't autoswitch

Post by Graf Zahl »

No matter what can be done - it would be different than always switching to the shotgun unless such weapons get specially flagged.
User avatar
Kilkakon
Posts: 314
Joined: Fri Jul 09, 2004 11:53 pm
Location: Western Australia
Contact:

Re: Weapon pickups don't autoswitch

Post by Kilkakon »

Blade Nightflame wrote:Last weapon which had no ammo? :?
How about this? (please forgive the Javasque code)

Code: Select all

int mostValuedWeaponIndex = currentlyUsedWeapon;
for ( int i = 0; i < weaponsInInventory.length; i++ )
{
	if ( weaponsInInventory[ i ].SelectionOrder < currentlyUsedWeapon.SelectionOrder )
	{
		mostValuedWeaponIndex = currentlyUsedWeapon;
	}
}
SelectWeapon( weaponsInInventory[ mostValuedWeaponIndex ] );
Maybe something like that could be acceptable? I admit that I have complete ignorance of Zdoom's code (or C++ for that matter) so take from that what you will. ():)
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49230
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Weapon pickups don't autoswitch

Post by Graf Zahl »

Sure this can be done - but it will never be the same as Doom.exe which always selected the shotgun.
User avatar
Kilkakon
Posts: 314
Joined: Fri Jul 09, 2004 11:53 pm
Location: Western Australia
Contact:

Re: Weapon pickups don't autoswitch

Post by Kilkakon »

We could consider a "BackupWeapon" property on the PlayerPawn, which took a classname. That sounds like an adventure in itself though. :S
Post Reply

Return to “Closed Bugs [GZDoom]”