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

Change: Allow creating 32bpp-only NewGRFs #314

Merged
merged 3 commits into from
Dec 18, 2023

Conversation

PeterN
Copy link
Member

@PeterN PeterN commented Dec 12, 2023

The NFO requirement that the first sprite is 8bpp and 'normal zoom', was never actually enforced by OpenTTD itself which has no problem loading 32bpp-only NewGRFs.

NML allows 32bpp and zoom levels but only on alternative_sprites.

This change supports the use of zoom level and bit depth parameters on the spriteset() instruction. The format is similar to alternative_sprites();

spriteset(name[, image_file])
spriteset(name, zoom_level, bit_depth[, image_file[, mask_file]])

A short regression test is included.

Rationale: some NewGRF authors are already creating 32bpp-only sets with other tools that already allow it, whilst authors using NML are creating 32bpp-only with fake transparent 8bpp sprites. Given that we can't (and shouldn't) force authors to create content they don't want to, it is better to just remove the requirement for 8bpp sprites. This is beneficial as it means that OpenTTD may be able to detect when 8bpp sprites are missing which it cannot do if dummy 8bpp sprites are present.

Copy link
Contributor

@glx22 glx22 left a comment

Choose a reason for hiding this comment

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

And some flake8/black problems

nml/ast/spriteblock.py Outdated Show resolved Hide resolved
nml/ast/spriteblock.py Outdated Show resolved Hide resolved
nml/ast/spriteblock.py Outdated Show resolved Hide resolved
The format is similar to alternative_sprites().

spriteset(name[, image_file])
spriteset(name, zoom_level, bit_depth[, image_file[, mask_file]])
@andythenorth
Copy link
Contributor

andythenorth commented Dec 13, 2023

FIRS and Iron Horse appear to build fine with this PR (both 8bpp DOS-palette, 1x zoom, no 32bpp support)

@PeterN PeterN merged commit a35551c into OpenTTD:master Dec 18, 2023
21 checks passed
@PeterN PeterN deleted the allow-32bpp-only branch December 18, 2023 09:38
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.

3 participants