In PQ4CD, when leaving the shooting range through the front door,
some transition screen items will be generated that have invalid
dimensions. SSCI simply clips these rectangles to zero.
SSCI's last resort comparison here was to compare the object IDs
of planes & screen items, but this randomly breaks (at least) the
"you have died" dialog at the end of Phant1, and text & buttons
in Hoyle5, even in SSCI itself.
This commit changes last resort comparison to use a monotonically
increasing ID instead, which keeps objects with identical priority
& z-index in creation order when compared.
Fixes Trac#9585.
loopNo/celNo are set to unsigned integers in ScreenItem::setFromObject
in SSCI, thus their value will be adjusted when it's negative, like in
this case
The way dimensions of scaled screen items are calculated changed
over the lifetime of SSCI. In early low-resolution and
mixed-resolution games, scaled drawing needed to use at a global
cadence across the entire screen to ensure proper alignment, but
in later games (like Torin), local scaling of individual screen
items seems to be the way scaling is performed.
It seems highly probable that there are later SCI games that use
the "hi res" rendering path, so sorting and unsorting of
ScreenItemLists needs to be accurate.
The implementation was not correctly rounding the scaled position
with mulru, leading to occasionally incorrect hit detection at
the boundaries of boxes.
1. Reorder member initialisations to match class member order
2. Use #pragma mark instead of comments for annotating sections
3. Remove useless >=0 checks on unsigned types