IIRC, it's done with ReleaseSubBitmap(). I'd need to look at that again though, as I paid more attention to how script drawing objects are rendered, than to how the screen itself is rendered normally. I sort of wanted to add negative layers to ZScript drawing, to allow people to draw layered background effects, which would be extreme;y useful. Think of SCHMUP style moving star backdrops, or (fake) parallax scrolling effects. I believe that if a screen has a background layer flag, script drawing to it works that way, but I am not certain of that.
Can anyone confirm without me needing to make something to test it?
Also, the passive subscreen drawing is handled with that wacky quest rule for Z1 compatibility, and the active subscreen is 'effectively' layer 7, as it's rendered over all the layers on the screen. IDR what 'draw over' ffcs do. Do they have their own lovely little layer, or are they just rendered last on 6?
I think we could probably cram a few more layers into 2.6, but not 2.55, as that has (sadly) been requested before. More important than adding layers though, is adding a light table. Allegro supports it, and Moosh, and a few others have asked for more levels of transparency, sop I may as well work on it; if Gleeok didn't already include that in his own new drawing modes. The ability to create, and define bitmaps is going to rock, and the new bitmap drawing modes are going to make people want to do even more with layers.
What I had in mind for 2.6, or 2.65--I know, that's far ahead, but 2.65 is on the roadmap--is layers -9, to 0, to +9. That would give people plenty of freedom, without needing to sacrifice layers to make backgrounds; and they would no longer need to tick that flag box.
On another note, we need to address 'Do not draw subscreen', as when this mode is on, the row 0 screens of a DMap--so, screens 0x00 to 0x0F--are offset, but no other rows are. If you want a sample quest to illustrate this, let me know. That's technically a bug of its own, and I should file it, which I'll try to do tomorrow. Still much work to finish tonight-ish.