Skip to content

Handle impacts for obscure code paths#6848

Merged
BMagnu merged 4 commits into
scp-fs2open:masterfrom
Kestrellius:healing-impacts
Jul 30, 2025
Merged

Handle impacts for obscure code paths#6848
BMagnu merged 4 commits into
scp-fs2open:masterfrom
Kestrellius:healing-impacts

Conversation

@Kestrellius

Copy link
Copy Markdown
Contributor

More #6785 followup. I realized that impacts wouldn't be played in the case of healing weapons (and a couple other edge cases), where they would have been before, so I fixed that.

@wookieejedi wookieejedi added the fix A fix for bugs, not-a-bugs, and/or regressions. label Jul 20, 2025
Comment thread code/ship/shiphit.cpp Outdated
Comment thread code/ship/shiphit.cpp Outdated
wookieejedi added a commit to wookieejedi/fs2open.github.com that referenced this pull request Jul 20, 2025
Overall cleanup that does a few things:

1) Changes `ship_is_shield_up` from integer to bool.

2) `ship_is_shield_up` was only ever called to look at one quadrant, never for all quadrants, so took the opportunity to update the 'all-quadrant' block to account for ships with a non-standard number of shield quadrants.

3) ` MAX(2.0f, Shield_percent_skips_damage * shield_get_max_quad(ship_objp)` was used many times throughout the code (and will be used at least 2 more times with scp-fs2open#6848), so simply consolidated all of those uses into a new function called `ship_shield_hitpoint_threshold`. Happy to edit the name however.

4) Removed un-needed redundant comments from `ship_is_shield_up` definition in `ship.h` since those comments were already present in the actual function within `shield.cpp`, and all the other functions used comments in that file instead.

Again happy to tune or edit with any other choices.
@wookieejedi

Copy link
Copy Markdown
Member

Thanks!

@wookieejedi wookieejedi added this to the Release 25.0 milestone Jul 22, 2025
wookieejedi added a commit that referenced this pull request Jul 24, 2025
* Cleanup of Shield Hitpoint Threshold

Overall cleanup that does a few things:

1) Changes `ship_is_shield_up` from integer to bool.

2) `ship_is_shield_up` was only ever called to look at one quadrant, never for all quadrants, so took the opportunity to update the 'all-quadrant' block to account for ships with a non-standard number of shield quadrants.

3) ` MAX(2.0f, Shield_percent_skips_damage * shield_get_max_quad(ship_objp)` was used many times throughout the code (and will be used at least 2 more times with #6848), so simply consolidated all of those uses into a new function called `ship_shield_hitpoint_threshold`. Happy to edit the name however.

4) Removed un-needed redundant comments from `ship_is_shield_up` definition in `ship.h` since those comments were already present in the actual function within `shield.cpp`, and all the other functions used comments in that file instead.

Again happy to tune or edit with any other choices.

* use proper default arg style

* actually commit the updated files

* appease modern clang

* clang round 2
Comment thread code/ship/shiphit.cpp Outdated
Comment thread code/ship/shiphit.cpp Outdated
Kestrellius pushed a commit to Kestrellius/fs2open.github.com that referenced this pull request Jul 26, 2025
* Cleanup of Shield Hitpoint Threshold

Overall cleanup that does a few things:

1) Changes `ship_is_shield_up` from integer to bool.

2) `ship_is_shield_up` was only ever called to look at one quadrant, never for all quadrants, so took the opportunity to update the 'all-quadrant' block to account for ships with a non-standard number of shield quadrants.

3) ` MAX(2.0f, Shield_percent_skips_damage * shield_get_max_quad(ship_objp)` was used many times throughout the code (and will be used at least 2 more times with scp-fs2open#6848), so simply consolidated all of those uses into a new function called `ship_shield_hitpoint_threshold`. Happy to edit the name however.

4) Removed un-needed redundant comments from `ship_is_shield_up` definition in `ship.h` since those comments were already present in the actual function within `shield.cpp`, and all the other functions used comments in that file instead.

Again happy to tune or edit with any other choices.

* use proper default arg style

* actually commit the updated files

* appease modern clang

* clang round 2

@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.

Thanks, looks good to me now!

@BMagnu BMagnu merged commit abc82bd into scp-fs2open:master Jul 30, 2025
20 checks passed
@Kestrellius Kestrellius deleted the healing-impacts branch August 3, 2025 02:19
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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants