Handle impacts for obscure code paths#6848
Merged
Merged
Conversation
wookieejedi
reviewed
Jul 20, 2025
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.
Member
|
Thanks! |
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
wookieejedi
reviewed
Jul 24, 2025
wookieejedi
reviewed
Jul 24, 2025
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
ad8b3cb to
28a730f
Compare
wookieejedi
approved these changes
Jul 28, 2025
wookieejedi
left a comment
Member
There was a problem hiding this comment.
Thanks, looks good to me now!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.