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

Fix gear rendering for Suppressor #257

Merged
merged 1 commit into from
Dec 3, 2022

Conversation

zear
Copy link
Collaborator

@zear zear commented Dec 2, 2022

Fix misaligned gear mask and a buffer overflow for cars which use more than 8 gears, and thus pixelmaps other than HGEARS.PIX.

This issue exists because the gear rendering code assumes that the pixelmap with gear images contains 8 individual gear images. However, this is only true for HGEARS.PIX. In case of the Suppressor, which uses HGEARS4.PIX, there are 11 gears and so the mask is applied at the wrong offset.
Since both of the pixelmaps in question have gears that should clip at the height of 28, hardcode this number instead of trying to calculate it.

Another solution would be to simply force HGEARS4.PIX for all the cars, as those graphics are identical for both files (just with more gears in the latter one). I guess they really wanted to save every byte of memory in the OG, huh?

This fixes #256:
gear2

Copy link
Owner

@dethrace-labs dethrace-labs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice find and fix! I’d never noticed this!

@dethrace-labs
Copy link
Owner

Maybe you could change the “>> 3” to a “/ 8” since you are touching those lines? It’s more likely that was what the original code looked like

Fix misaligned gear mask and a buffer overflow for cars which use more
than 8 gears, and thus pixelmaps other than HGEARS.PIX.

Signed-off-by: Artur Rojek <contact@artur-rojek.eu>
@zear
Copy link
Collaborator Author

zear commented Dec 3, 2022

Done.

@dethrace-labs dethrace-labs merged commit 49d8e96 into dethrace-labs:main Dec 3, 2022
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.

Gear images misaligned for cars with more than 8 gears
2 participants