Page 1 of 1
Weapon pickups don't autoswitch
Posted: Fri Dec 26, 2008 2:04 am
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.
Re: Weapon pickups don't autoswitch
Posted: Sat Dec 27, 2008 10:21 am
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...
Re: Weapon pickups don't autoswitch
Posted: Mon Dec 29, 2008 6:22 am
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.).
Re: Weapon pickups don't autoswitch
Posted: Mon Dec 29, 2008 6:35 am
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.
Re: Weapon pickups don't autoswitch
Posted: Mon Dec 29, 2008 8:10 am
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?
Re: Weapon pickups don't autoswitch
Posted: Mon Dec 29, 2008 8:17 am
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.
Re: Weapon pickups don't autoswitch
Posted: Mon Dec 29, 2008 8:32 am
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?
Re: Weapon pickups don't autoswitch
Posted: Mon Dec 29, 2008 11:22 am
by Ryan Cordell
Last weapon which had no ammo?

Re: Weapon pickups don't autoswitch
Posted: Mon Dec 29, 2008 11:32 am
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.
Re: Weapon pickups don't autoswitch
Posted: Tue Jan 06, 2009 12:17 am
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.

Re: Weapon pickups don't autoswitch
Posted: Tue Jan 06, 2009 2:23 am
by Graf Zahl
Sure this can be done - but it will never be the same as Doom.exe which always selected the shotgun.
Re: Weapon pickups don't autoswitch
Posted: Tue Jan 06, 2009 3:58 am
by Kilkakon
We could consider a "BackupWeapon" property on the PlayerPawn, which took a classname. That sounds like an adventure in itself though. :S