Skip to content

fix dual fire handling for banks that cannot use it - #7635

Draft
Goober5000 wants to merge 1 commit into
scp-fs2open:masterfrom
Goober5000:fix/firingpoints
Draft

fix dual fire handling for banks that cannot use it#7635
Goober5000 wants to merge 1 commit into
scp-fs2open:masterfrom
Goober5000:fix/firingpoints

Conversation

@Goober5000

Copy link
Copy Markdown
Contributor

The Secondary_dual_fire flag is per-ship, but not every secondary bank can dual fire. Previously the HUD drew the dual fire link icon even when the armed bank had only one firepoint, and firing such a bank cleared the flag entirely, silently discarding the player's dual fire preference for the other banks.

Extend the ignored-rather-than-cleared approach already established for no-doublefire weapons to the single-firepoint case:

  • add ship_secondary_bank_can_dual_fire() as the single source of truth for bank validity, No_doublefire, ai_profiles restrictions, and firepoint count
  • ship_fire_secondary() now fires single and leaves the flag alone when the bank cannot dual fire, instead of removing the flag
  • the weapons gauges and the hardpoints gauge consult the helper, so the link icon and second-firepoint highlight are no longer drawn for incapable banks
  • the dual fire toggle on a single-firepoint bank now explains why it cannot dual fire and leaves the preference untouched
  • restoring the saved dual fire preference no longer depends on bank 0's firepoint count, since incapable banks now simply ignore the flag
  • weapon_create()'s substitution pattern logic also consults the helper so the pattern index no longer advances as if a pair were fired

The Secondary_dual_fire flag is per-ship, but not every secondary bank
can dual fire.  Previously the HUD drew the dual fire link icon even
when the armed bank had only one firepoint, and firing such a bank
cleared the flag entirely, silently discarding the player's dual fire
preference for the other banks.

Extend the ignored-rather-than-cleared approach already established
for no-doublefire weapons to the single-firepoint case:

- add ship_secondary_bank_can_dual_fire() as the single source of truth
  for bank validity, No_doublefire, ai_profiles restrictions, and
  firepoint count
- ship_fire_secondary() now fires single and leaves the flag alone when
  the bank cannot dual fire, instead of removing the flag
- the weapons gauges and the hardpoints gauge consult the helper, so the
  link icon and second-firepoint highlight are no longer drawn for
  incapable banks
- the dual fire toggle on a single-firepoint bank now explains why it
  cannot dual fire and leaves the preference untouched
- restoring the saved dual fire preference no longer depends on bank 0's
  firepoint count, since incapable banks now simply ignore the flag
- weapon_create()'s substitution pattern logic also consults the helper
  so the pattern index no longer advances as if a pair were fired

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@Goober5000 Goober5000 added fix A fix for bugs, not-a-bugs, and/or regressions. HUD A feature or issue related to the HUD Requested by Active Mod A feature request that has been requested by a mod that is actively in development. labels Jul 21, 2026

@wookieejedi wookieejedi left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix works as expected and did not hit any other issues, thanks! Code also looks good.

@Goober5000
Goober5000 marked this pull request as ready for review July 28, 2026 02:34
@Goober5000
Goober5000 marked this pull request as draft July 28, 2026 03:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fix A fix for bugs, not-a-bugs, and/or regressions. HUD A feature or issue related to the HUD Requested by Active Mod A feature request that has been requested by a mod that is actively in development.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants