Latest guess is:
if (4) is less than 128, the square concerned has an "outdoor" background type, as seen in Caergoth, Hizden, Kristophan, New Aurim, Hawkbluff, Blackwater Glade and Bai'or. Exact background type is determined by bitwise manipulation of the relevant number in (5), the 2 and 8 bits are the ones associated with backdrops. It may be zones not just backdrops.
It is possible for a town to have four background types, Kristophan for one has that. It has both DQK outdoor background types, mud and grass. Then it has two indoor ones, stone and wood. Now the header for any DQK town only has room for three background types. Kristophan has a header that lists: Wood, Bricks, Outdoor Grass. Thus the outdoor mud must be a default background type that does not need to be listed in the header.
I still don't know how the game files record locked doors. It may happen by placing of events, this would require a locked door event. I think I have figured out the walls, backdrops and blockages, that leaves everything else.
In summary, the backdrops are functions of both (4) and (5). Now I am working on an FRUA translation which will require breaking most of the towns up into bits. I will match the events in the squares of Caergoth with what I am reading in the decryption of the ECL file.