This is in preparation for allowing for Lingo to get/set the picture
of BitmapCastMember.
In particular, storing a Picture lets us easily replace the existing
image (instead of having to rely on ImageDecoder as source).
Also, having Picture instances that are easy to copy will make lifetime
management easier if pictures are copied into longer-living things such
as globals.
All of the builtin palette lookup tables have been reversed, to match
the original layout of the tables in the Director 4 projector executable.
This corresponds with the colour indexing used in Lingo.
Likewise, the code to load palettes from the cast no longer reads the
colours in reverse order, and shiftPalette no longer expects
the start index to be after the end index.
DirectorEngine::transformColor still exists to upgrade to 32-bit colour,
but no longer reverses the palette index.
The missing builtin 16-color palettes from Director 4 have been added.
Lingo function `closeResFile` is only responsible for closing resource
file opened by `openResFile`. Register in `openResFile` which files
where opened and close only those files in `closeResFile`.
- Rename `_openResFiles` to `_allOpenResFiles` and
- Add new `_openResFiles` hashmap to track which files were opened in
`openResFile`.
There are two types of memory types of leaks fixed that both deal with
mac resource files.
First one, opened resource files weren't always deleted when cleaning up
or on failure of opening.
Second one, the cursors are read from streams of resource files.
Those streams are marked as disposable. They are only disposed of when
delete is called on them.
This fixes two bugs in one go:
- setting a cursor to 0 wasn't possible when a cast+mask cursor was used
- querying a sprite for cast+mask cursor returned 0 instead of the cast
ids.
Cursors can be set in two ways:
1) set cursor of sprite X to INT
2) set cursor of sprite X to [INT, INT]
A `cursor of sprite X` should return the same values that as were used
when setting the cursor.
This change is required to support copies of the same cast member running in different channels.
* DIRECTOR: Move widget ownership from cast member to channel
* DIRECTOR: Cache cast dimensions from createWidget
* DIRECTOR: Add null checks for createWidget
* GRAPHICS: MACGUI: Clear active/hover WM references if the widget is destroyed
* DIRECTOR: LINGO: Re-add null check for kTheEditableText
* DIRECTOR: Avoid destroying widgets if the channel isn't dirty
* DIRECTOR: Fix dirty test
* DIRECTOR: Fix text field writeback
* DIRECTOR: Fix null cast check
* DIRECTOR: Add bbox as argument to createWidget
* DIRECTOR: Add setCast method to Channel
* DIRECTOR: Fix use-after-free in Channel::getMask
* DIRECTOR: Fix bounding box for Button sprites
* DIRECTOR: Cache widget dimensions in cast member
* DIRECTOR: Remove widget from channel if nextSprite is empty
* GRAPHICS: MACGUI: Fix MacText::splitString for empty string case
* DIRECTOR: Add null checks for movie and score in processEvents