Fix freezard graphics crash with enemy health scaling#5232
Merged
aMannus merged 1 commit intoHarbourMasters:developfrom Mar 28, 2025
Merged
Fix freezard graphics crash with enemy health scaling#5232aMannus merged 1 commit intoHarbourMasters:developfrom
aMannus merged 1 commit intoHarbourMasters:developfrom
Conversation
Malkierian
approved these changes
Mar 27, 2025
Contributor
|
I don't want to block this as it fixes a crash but would be nice to have this inside a hook or VB should somehow (not sure which makes more sense here thb) |
Contributor
|
I don't know if it's possible to do from within a hook. We don't have one for ActorDraw, and it looks like this is mid draw anyway, but I don't really know much about VB principles. |
Contributor
|
The only thing I'm not sure of is if it's possible to change something you pass into a VB should by reference, but I think you can. It should probably be around where the index is set in vanilla though. |
aMannus
approved these changes
Mar 28, 2025
Contributor
aMannus
left a comment
There was a problem hiding this comment.
Let's get this in now then and consider to move this when we move everything enemy rando related to hooks/shipinit
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.
Freezards use a calculation of their health as an index for which display list to use for their body. If the health value is too large, then the index would go out of bounds and place garbage into the graphics instructions.
To fix this, a check for enemy health scaling is used and the index recalculated by scaling the health from a ratio of the "new" maximum health, back down to the original max of 6, and then a final safety clamp to get the index into range.
This should make it so that Freezards broken state will linearly match the scaled health.
Fixes #5225
Build Artifacts