mirror of
https://github.com/scp-fs2open/fs2open.github.com.git
synced 2026-11-13 06:21:29 -10:00
The logic for offsetting a shot by the external weapon model's firing points was duplicated in ship_fire_primary(), ship_fire_secondary(), and the AI's line-of-sight check. Extract it into ship_get_external_model_fp_offset(). This fixes two bugs that were present in all three copies: 1. The chain counter for "chain external model fps" weapons was reset when it reached weapon_model->n_guns (the number of gun banks) rather than the number of firing points in the bank being indexed. For the typical model with one gun bank the counter reset after every shot, so chaining never advanced past the first firing point; for a model with several gun banks the counter could index past the end of the first bank's point array. 2. The AI line-of-sight check advanced the chain counter even though it is only a query, desyncing the counter from the shots actually fired. It now reads the current firing point without advancing. Co-Authored-By: Claude Fable 5 <[email protected]>