dxx-rebirth/similar
Kp 2e682e140d Prevent sound stacking when all primary weapons are exhausted
ziplantil reported that in Descent 1, if a player has an empty Vulcan
cannon, and no energy, then attempting to fire a weapon would play the
SOUND_ALREADY_SELECTED clip every frame until the player ceased trying
to fire.  The problem does not impact Descent 2 since Descent 2 does not
play this sound sample when trying to activate a weapon that is already
active.

If the current weapon is already LASER_INDEX, then
select_primary_weapon(LASER_INDEX) simplifies to:

```

	// Pointless, player already using this weapon
	newdemo_record_player_weapon(LASER_INDEX)
	if (Primary_weapon != LASER_INDEX) {
		// skipped, path is false
	}
	else
	{
		if (wait_for_rearm)	// true for this path
			// Bad, plays every frame
			digi_play_sample(SOUND_ALREADY_SELECTED);
	}
	// Pointless, Primary_weapon already is LASER_INDEX
	Primary_weapon = LASER_INDEX;
	if (weapon_name)
	{
		// skipped, path is false
	}

```

Skipping the call avoids two pointless statements, one bad statement,
and nothing useful.  Therefore, the simplest fix for the problem is to
call select_primary_weapon(LASER_INDEX) only if the primary weapon is
not currently LASER_INDEX.

Reported-by: ziplantil <https://github.com/dxx-rebirth/dxx-rebirth/issues/499>
2020-03-28 17:09:28 +00:00
..
2d Downgrade PCX failures from Error to CON_URGENT 2019-07-07 22:00:02 +00:00
3d Zip ranges passed to rotate_point_list 2020-02-01 22:33:31 +00:00
arch Defer digi_mixer_start_sound work until it is needed 2020-03-28 16:55:43 +00:00
editor Use susegment for WALL_IS_DOORWAY 2019-12-27 02:02:23 +00:00
main Prevent sound stacking when all primary weapons are exhausted 2020-03-28 17:09:28 +00:00
misc Fix externally reported Mac OS X build break 2019-10-23 03:02:16 +00:00