Norbert wrote: ↑October 17th, 2019, 6:49 pm
3. What exactly are the 'stuff' values?
Each level contains 25 words with 'stuff'.
[...]
The stuff is stored after the elements.
You're looking at it the wrong way: This "stuff" is stored
before the room links, and your editor is reading the "stuff" of the next level.
Basically, there is a level table starting at 0x6A7C, with 20 bytes per level.
You're already using the part of it which tells where the prince starts the level (arOffsetKid[] in your code).
However, it also contains (among others) the addresses of the level data (room links + elements), at the end of each table entry.
For example, for level 1, at offset 0x6A8E (= 0x6A7C + 0x12) is the address 0xAD8E.
At offset 0xAD8E the first thing is the length of the data in the following chunk of data. This is the first word of the "stuff".
Within this chunk, the first 24 words are offsets to the elements of each room. This is the rest of the "stuff".
After this, the chunk contains the room links and the elements, which the editor can already handle.
Norbert wrote: ↑October 17th, 2019, 6:49 pm
1. How exactly do buttons work?
[...]
will show you I do understand that the last two bytes of button elements contain a word that I should use.
However, if you look at the (left side of the) attached screenshot of a portion of level 7, you can see the buttons do not directly point to locations (because gate location 321 precedes gate location 313), so there must be a table somewhere that converts button numbers to room/tile locations. But where...
These two bytes are simply an offset into the chunk of level data I mentioned above.
They always point at the first byte of the triggered object.
If you look at the numbers of the gates in room 16 on the picture, they are 297, 305, 313, 321.
Each is 8 more than the last one, and 8 is the number of bytes in a gate definition.
Norbert wrote: ↑October 17th, 2019, 6:49 pm
Any information that allows me to improve this editor is welcome.
I'm writing a wiki article which will explain these in more detail.