Commit Graph
36 Commits
Author SHA1 Message Date
Scott Percival bb9789daeb DIRECTOR: Fix cursors with hotspots outside of crop area
Fixes the cursor position in Blinky Bill's Ghost Cave.
2024-07-14 18:12:28 +08:00
Scott Percival 337f214ff4 DIRECTOR: Move equality warnings behind debug gate 2024-05-22 17:24:31 +02:00
Scott Percival 428ad1ac18 DIRECTOR: Fix Cursor::readFromCast for D5 2024-05-12 22:00:19 +02:00
Scott Percival ec56a7c2fe DIRECTOR: Fix kTheCursor output after Cursor::readFromCast 2024-05-12 22:00:19 +02:00
Misty De Meo 2c05c5bdfa DIRECTOR: fix loading cursor from main archive
Fixes a bug introduced in 9aa0958736.
That commit limited reading cursors to open res files, not all
*seen* res files. However, that broke the custom cursor in Small
Stories for Sleepless Nights for Mac (nemurenu-mac-ja), which stores
its cursor in the game's main archive which is already closed at the
time the cursor gets loaded.
2023-09-10 09:20:37 +02:00
Eugene Sandulenko 9aa0958736 DIRECTOR: Properly keep track of open resource files and their precedence
We used to close resources when we were closing movies, but with making
Archives owned by Director class, we now have list of all _seen_ resources.

This change implements a proper, ordered list of resources which are
overriding the ones loaded earlier.

Fixes cursors in the7colors which were read from previously loaded Shared Casts.
--start-movie=04CLUB:FloorColidor:IntoFloo
2023-06-30 00:32:57 +02:00
Eugene Sandulenko 95d8cf840c DIRECTOR: _allOpenResFiles -> _allSeenResFiles 2023-06-29 23:22:54 +02:00
Eugene Sandulenko a62b7985b5 DIRECTOR: Modernized some loops 2023-06-29 17:35:06 +02:00
Scott Percival f703ee6ecf DIRECTOR: Split CastMember classes into files 2023-04-29 14:20:05 +02:00
Einar Johan Trøan Sømåen c3b1baf906 DIRECTOR: Refactor BitmapCastMember to store a Picture instead of decoder
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.
2023-03-26 19:11:46 +02:00
Scott Percival ce78554746 DIRECTOR: Check current cast archive for CURS resources 2023-01-26 23:36:17 +08:00
Scott Percival 48740a2ad1 DIRECTOR: Remove all palette reversing workarounds
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.
2023-01-10 13:41:53 +01:00
Roland van Laar 0091a20fe9 DIRECTOR: limit files closed by closeResFile
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`.
2022-09-23 22:55:50 +02:00
Roland van Laar c6c56efc4a DIRECTOR: Fix mac memory leaks
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.
2022-09-22 23:36:39 +02:00
Misty De MeoandEugene Sandulenko 3e9e39a8fa DIRECTOR: resource might be missing cursor
Co-authored-by: Eugene Sandulenko <sev@scummvm.org>
2022-07-13 18:12:22 +02:00
Eugene Sandulenko abea37c9bb ALL: Update ScummVM project license to GPLv3+ 2021-12-26 18:48:43 +01:00
Filippos Karapetis d260b1e9e6 DIRECTOR: LINGO: Add overloaded operators for Datum structs 2021-08-30 19:08:15 -04:00
Roland van Laar 6ca9c1f8bf DIRECTOR: fix check on array size
Setting a cursor to a cast needs an array of 2 not 1.
2021-08-26 12:58:06 +02:00
Roland van Laar 5d45afb18b DIRECTOR: Convert cursor setting into Datum
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.
2021-08-26 12:23:07 +02:00
ysj1173886760 98b5adc4cc DIRECTOR: fix memory leak when using win cursor. 2021-08-17 08:56:13 +08:00
ysj1173886760 5f93dd7cd9 DIRECTOR: set arrow cursor for default custom cursor in windows platform. 2021-08-16 08:41:36 +08:00
ysj1173886760 2472c763be DIRECTOR: try to load custom cursor from exe file in win platform. 2021-08-16 08:41:36 +08:00
ysj1173886760 4766fd025b DIRECTOR: set fallback cursor when custom cursor is not read correctly. 2021-08-14 21:42:53 +08:00
djsrv 19dab8f130 DIRECTOR: Set cursors per-movie, not globally 2021-08-06 01:11:49 -04:00
djsrv 615995fdc1 DIRECTOR: Change member refs to use CastMemberID 2021-06-30 22:32:19 -04:00
Eugene Sandulenko e27d5ac7fc DIRECTOR: JANITORIAL: Code formatting and unified the namespace end comments 2020-08-21 00:36:19 +02:00
Nathanael Gentry 5583009442 DIRECTOR: Add default cursor arrow case 2020-08-19 10:41:55 -04:00
djsrv baacf3c1ab DIRECTOR: Replace SeekableSubReadStreamEndian
Use the superclass SeekableReadStreamEndian.
2020-08-12 17:26:55 -04:00
Scott Percival 4bfffc43a7 DIRECTOR: Move widgets from cast members to channels (#2372)
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
2020-07-26 04:32:29 +00:00
Nathanael Gentry 61f533e3e9 DIRECTOR: Fix cursor hotspot registration 2020-07-22 10:32:39 -04:00
Nathanael Gentry 343046bd5e DIRECTOR: Properly set cursor keyColor 2020-07-22 10:20:56 -04:00
Nathanael Gentry 87b8ff5825 DIRECTOR: Condition cursor palette check 2020-07-22 10:20:56 -04:00
Nathanael Gentry f3b18aba52 DIRECTOR: Add missing flag
Otherwise, the mask is never applied.
2020-07-22 10:20:56 -04:00
Nathanael Gentry 2622a4628f DIRECTOR: Reset cursors properly
This also handles cases when there is an error loading.
2020-07-20 14:18:15 -04:00
Nathanael Gentry f903822f8d DIRECTOR: Read cursors from external resources 2020-07-20 14:17:24 -04:00
Nathanael Gentry 4f15cb4af4 DIRECTOR: Introduce Cursor class 2020-07-18 00:37:57 -04:00