Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enforce stricter checks on sequence Facings. #21135

Merged
merged 1 commit into from Oct 21, 2023

Conversation

pchote
Copy link
Member

@pchote pchote commented Oct 19, 2023

This prevents modders from setting Facings values that can cause the game to crash with an unhelpful IndexOutOfRangeException.

Consider Facings: 5. 1024 / 5 = 204.8 WAngle units for each sprite. The frame selection code rounds this down to 204 per frame, which then leaves angles 204 * 5 = 1020 through 1023 without associated artwork, causing a crash when something asks for that.

An alternative solution would be to non-uniformly map the facings to the angle range (4 of the 5 frames have 205 units, 1 with 204, or 5 with 204 and 1 with 208), but this would add a lot of complexity and probably a measurable performance hit. The responsibility is on modders to not pick silly frame values, but this does rely on the game telling them when they do it wrong.

@pchote
Copy link
Member Author

pchote commented Oct 19, 2023

Testcase: https://resource.openra.net/maps/54794

@PunkPun PunkPun merged commit 20c683f into OpenRA:bleed Oct 21, 2023
3 checks passed
@PunkPun
Copy link
Member

PunkPun commented Oct 21, 2023

changelog

@pchote pchote deleted the facings-check branch October 29, 2023 10:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants