In companion the prioriy bands work right. Brandon your problem probably appear off because of the ego's foot print. it's based off the ystep so could look slightly off in actual play hence the necesary adjustments
SCI Companion doesn't appear to match the priority band formula that scummvm uses. The differences are very minor though. I'm talking about a single line out every 3rd or so priority band. As an example, line 169 should be priority band 13 according to scummvm (regardless of whether each step is performed solely as an integer calculation or with retaining the fractional parts, it still produces the same result of 13):
1 + ((169 - 42) * 2000) / (((190 - 42) * 2000)/14) = 13
Now if you open up SCI Companion, create a new picture and then take the mouse down to the 169th line, you'll notice that the priority band is still 12. It doesn't change to 13 until line 170. In total I think there are 5 that are misplaced, i.e. bands 1, 6, 8, 11 and 13.
I think I've just spotted another issue with SCI Companion. When I turn on the grid lines, not only does priority band 13 get drawn on line 170 but the short line drawn upwards from the right hand end of the priority band line implies that everything before and including line 170 is priority band 13 (since 13 is light magenta). That short line on the right hand end should be drawn downwards shouldn't it? As its currently drawn, it is implying a white priority band, which doesn't exist in SCI0 as far as I know. A priority value of 15 exists for VIEWs but a priority band on the screen of value 15 doesn't exist. I am assuming here that SCI Companion is a SCI0 picture editor.
I just found this comment in the ScummVM source code:
* Applies to all versions before 0.000.502
* Old SCI versions used to interpret the third DrawPic() parameter inversely,
* with the opposite default value (obviously).
* Also, they used 15 priority zones from 42 to 200 instead of 14 priority
* zones from 42 to 190.
Seems like I'll never get this sorted then! Even different versions of SCI0 have different rules on something quite fundamental!! - It appears, though, that SCI Companion is assuming versions newer than 0.000.502 since the lines only go up to 190, and the Priority value on the status line at the bottom only goes up to 14.
The reason I'm bringing all these things up for discussion is because I want to get things as accurate as possible with PICEDIT's SCI0 support.