Pretty much the subj. I'm curious if there's a some documented way in OpenTTD engine to determine if the given sprite is one that's supposed to be used as a "tile basement" (i.e. something like green grass sprite or flat water sprite)? I'm looking for some function which would return "true" for sprite ids like 3981, 4259 or 4061, and return "false" for ids like 2115 or 1553. Hope OpenTTD dev gurus would give me some advice on it. Thanks in advance.
P.S. And yet another question: am I right that it is impossible for NewGRFs to introduce new "basement" sprites, so the only thing they could do with "basement" sprites is to replace base set sprites with a new ones using 0x0A action?
Is there a way to distinguish basement sprites from other?
Moderator: OpenTTD Developers
- planetmaker
- OpenTTD Developer
- Posts: 9432
- Joined: 07 Nov 2007 22:44
- Location: Sol d
Re: Is there a way to distinguish basement sprites from othe
ground sprites are not special in itself. They're special by how they're used and by what it implies for their shape: they must be flat and have no height, thus be identical in shape to the default ground sprites. There's also no general overview of which sprites are ground sprites.
But if you explain your intentions or share your thoughts we might be able to help you far better.
But if you explain your intentions or share your thoughts we might be able to help you far better.
Generally the answer is 'no' as you can well define your own ground sprites for houses, stations, airports, industries and objects. With respect to landscape tiles (grass, fields, water,...), your only option is to replace the existing landscape sprites like you said.LeXa2 wrote:am I right that it is impossible for NewGRFs to introduce new "basement" sprites, so the only thing they could do with "basement" sprites is to replace base set sprites with a new ones using 0x0A action?
OpenTTD: manual | online content | translations | Wanted contributions and patches
#openttdcoop: blog | wiki | public server | DevZone | NewGRF web translator
DevZone - home of the free NewGRFs: OpenSFX | OpenMSX | OpenGFX | Swedish Rails | OpenGFX+ Trains|RV|Industries|Airports|Landscape | NML
Re: Is there a way to distinguish basement sprites from othe
That's what I've been afraid of after several days of reading the source code .planetmaker wrote:...There's also no general overview of which sprites are ground sprites. ...
I need it to get some benefits in a small blitter-related project I'm working on last two weeks. I don't want to dive into details of this project yet but fact is that it'd be easier to do some things in blitter in case I would be able to tell if the given sprite is a basement sprite (i.e. it is supposed to be used as "downmost" layer of the sprite overlay chain). It's no problem to patch the engine a bit so sprite_id would be passed into blitter (at least into Encode which would be enough for my needs) but as there's "no general overview" it looks like I'd either would have to implement function of "basement detection" myself that'd work for baseset sprite ids or assume in blitter that each and every sprite is "basement" (which I'm doing currently).planetmaker wrote:But if you explain your intentions or share your thoughts we might be able to help you far better.
So it is possible for NewGRF not only to replace existing sprites for houses, stations, e.t.c but also to patch them so they would use completely new ones (with differing sprite_id) instead? No luck for me then, seems that I would have to spend some time reading newgrf-related code.planetmaker wrote:Generally the answer is 'no' as you can well define your own ground sprites for houses, stations, airports, industries and objects. With respect to landscape tiles (grass, fields, water,...), your only option is to replace the existing landscape sprites like you said.LeXa2 wrote:am I right that it is impossible for NewGRFs to introduce new "basement" sprites, so the only thing they could do with "basement" sprites is to replace base set sprites with a new ones using 0x0A action?
Thanks for your answers.
Re: Is there a way to distinguish basement sprites from othe
It's even possible for NewGRFs to use one and the same sprite as a ground sprite in one place and as a non-ground sprite in a different place. And with a foundation sprite underneath, a ground sprite will suddenly become a child sprite of the foundation instead.LeXa2 wrote:So it is possible for NewGRF not only to replace existing sprites for houses, stations, e.t.c but also to patch them so they would use completely new ones (with differing sprite_id) instead?
The only place I could image you'd have any chance at detecting ground sprites is somewhere inside the sprite sorter.
-- Michael Lutz
Re: Is there a way to distinguish basement sprites from othe
That's expected and understood and I have no problem with it . Actually I've been a bit relaxed in my requirements to the "detection routine": what is important for me is if the given sprite could ever be used as "basement" sprite. If it could - in blitter modification I'm implementing it would be necessary to use some safeguarding quirks for sprite to be displayed properly. If it's not - quirks could be bypassed resulting in more speed (and more "mathematically correct" rendering).Michi_cc wrote:It's even possible for NewGRFs to use one and the same sprite as a ground sprite in one place and as a non-ground sprite in a different place. And with a foundation sprite underneath, a ground sprite will suddenly become a child sprite of the foundation instead.
The only place I could image you'd have any chance at detecting ground sprites is somewhere inside the sprite sorter.
For now chances look grim that I'd find any heuristic that would allow me to detect what I want for a general case without hacking into sprite sorter, as you advised. That's not what I want really (don't like invasive patches leading to a "spaghetti code") but I could resort to it in case there won't be any other way to solve my problem. Or would simply get by with quirks always enabled if changes required to implement detection I need would be too invasive for my taste .
Who is online
Users browsing this forum: Google [Bot] and 15 guests