Commit Graph
115 Commits
Author SHA1 Message Date
Scott Percival bde3fe3f77 DIRECTOR: Reset palette in use on movie switch
Previously if there was a movie switch, and the two movies used
different custom palettes with the same cast ID, there was no
mechanism to force a swap to the new palette.

Fixes palette glitches in Die Hexenakademie.
2024-05-28 16:43:43 +08:00
Eugene Sandulenko 6fff4bee6b DIRECTOR: Added debug traces on movie unloading 2024-05-13 12:39:20 +02:00
Scott Percival 45c9abff93 DIRECTOR: Refactor Channel::getMask()
The Mask ink type allows Director to combine a sprite with a 1bpp
mask bitmap to stencil an image. Previously we were using the widget
drawing code to generate this image, which caused issues with scaling
and depth (as the surface was formatted to match the screen). The new
code checks for a 1bpp image specifically and sends it through, removing
the workarounds for screen depth.

Fixes the drawing of the welcome cube at the start of Virtual Nightclub.
2024-05-12 22:00:19 +02:00
Eugene Sandulenko 76a59aa1cf DIRECTOR: Do not load movie when set rect is called
Clarified with jewels1 on startup
2024-05-12 13:52:58 +02:00
Eugene Sandulenko 9fef247242 DIRECTOR: DEBUGGER: Implement Start/Stop 2024-05-03 20:03:13 +02:00
Scott Percival fa2e5ac9de DIRECTOR: Fix FilmLoopCastMember::getSubChannels
The new bounding box calculation requires the transformed position/size
to be in Sprite, not Channel.

Fixes the visibility of the boar hunt in Wrath of the Gods.
2024-04-25 00:54:17 +02:00
s-m33r c2bee8fc1d DIRECTOR: set _draggable to false if window is Stage 2024-03-25 21:22:56 +01:00
Scott Percival b163dba86d DIRECTOR: Add CD loading delay quirk
Spaceship Warlock is optimised for very slow disk reads; quite a lot of
movie changes will be preceded by a music cue and a still image, knowing
that the system will take a couple of seconds to read the next file.

As a compromise, add a fake delay of [file size]*1000/150000 ms to movie
switches. This can be short-circuited by clicking the mouse, so it is
still possible to navigate around quickly.
2024-02-09 21:17:57 +08:00
Scott Percival 75dd224cf0 DIRECTOR: Clean up event debug messages 2024-01-20 23:14:52 +01:00
Le Philousophe cf3eac29c3 DIRECTOR: Migrate engine to Path 2023-12-24 13:19:25 +01:00
Eugene Sandulenko e28fae39a0 DIRECTOR: Do not complain in Window::ensureMovieIsLoaded() when it is loaded 2023-12-24 03:14:25 +01:00
Eugene Sandulenko 1f9e8a8a34 DIRECTOR: Made certain window operations load the movie immediately 2023-12-24 02:56:30 +01:00
Eugene Sandulenko 70de3d384e DIRECTOR: Make Window filename as a separate variable
It was incorrectly implemented as matching the Window name, because
of short-sighted implementation.

This fixes startup in jewels1, where it creates a separate window
named "puzzle", assigns a filename to it but still continues referring
to the window as "puzzle".
2023-12-20 17:57:52 +01:00
Scott Percival 597904524e DIRECTOR: Fix holes in Window ownership
- Add guardrails to m_forget
- Treat g_director->_currentWindow as a reference-counted copy
- Move MacWindowManager cleanup out of ~Datum into Window::decRefCount
2023-12-02 02:47:40 +01:00
Scott Percival 190406c8d1 DIRECTOR: Add debug timing for draw calls 2023-10-25 18:22:15 +02:00
Harishankar Kumar 33d4b35869 DIRECTOR: Fix visibility issue when setting window properties
This patch fixes the behaviour of windows when setting their
properties (e.g. titleVisibility, Modal, etc) from the lingo.

Initially the window was set to be visible when the property was
set, but this is not the expected behaviour. The window should
only be visible when the `open` command is called. Removed `setVisible(true)`
from various window properties assignment functions.

Fixes popupmenu overlay in `meet-mediaband` and white rectangle when
opening `mcluhan-win`.

--start-movie="main\stvimenu.dxr" mediaband-win
2023-08-09 18:49:16 +02:00
Harishankar Kumar 89cd5ff322 DIRECTOR: Improve logic for recursive enterFrame calls
In the original engine, the enterFrame handler can only be called
recursively upto second depth, and the third call will be ignored.
This was formerly implemented by counting number of frozen lingo
states, however there are cases where the lingo state is frozen,
while enterFrame handler not called, so the count is not accurate.

This patch improves the logic by counting the number of enterFrame
in frozen lingo states as well, so it can be identified that these
previous frames are indeed of `enterFrame` handler.

Fixes bug where the elevator when jumping to next floor (yellow one)
broke dimensional movement in `totaldistortion-win`.
2023-08-05 21:51:58 +02:00
Eugene Sandulenko 8bccc12786 DIRECTOR: Reduce header dependency 2023-08-02 21:05:06 +02:00
Harishankar Kumar 46ce5bd51f DIRECTOR: Fix memory leaks when changing sharedCast
When changing from shared casts in `Window::loadNewSharedCast`, and in
instance where previousCast need to be deleted, we just deleted the cast
itself but not the underlying `Archive`, this resulted in memory leaks.
`~Director()` was not deleting this archive because it was being removed
from `_allSeenResFiles` in favour of loading new archive.

Fixed by deleting `Archive *_castArchive` of previousCast after erasing
its entry from `_allSeenResFiles`.
2023-07-25 06:59:54 +02:00
Misty De Meo 26e203856f DIRECTOR: fully remove old shared cast
When reloading the shared cast, erase the references from both
_allSeenResFiles and _allOpenResFiles. In the case that the shared
cast is reloaded from a different path, this would leave a dangling
reference in _allOpenResFiles. This would then lead to a crash later
when enumerating _allOpenResFiles and trying to access the found
path in _allSeenResFiles.

Fixes a crash in the D4 version of Alice which would occur when loading
the cursor. This occurs since Alice ends up loading first Shared.dir and
then DATA:Shared.dir, leaving a dangling reference to Shared.dir in
_allSeenResFiles.

Issue was introduced in 9aa0958736.
2023-07-18 15:45:10 -07:00
Harishankar Kumar fdd8c34691 DIRECTOR: Rename _frame, getCurrentFrame(), getTotalFrames() to improve readability 2023-07-10 16:03:11 +02:00
Harishankar Kumar 0bde66b864 DIRECTOR: Implement fileName of window property
Normally Director will look for a movie of the same name as the window,
however with `the fileName` property, it can assign name of movie to be
played in the window.
2023-07-08 22:15:42 +03:00
Scott Percival 8a6d7d6c95 DIRECTOR: Move file extension checks to innermost loop
Fixes shared cast detection in Meet Mediaband.
2023-07-08 22:01:00 +03:00
Scott Percival 17e1853347 DIRECTOR: Refactor path detection
Previously, paths were verified by pathMakeRelative().
This method had several drawbacks; the code was increasingly ad-hoc
and recursive, and the function would return a Common::String that
was not guaranteed to be distinct. 90% of the time the path would need
to be converted to Common::Path so that file streams could use it.

This code has been replaced with findPath(), a function which takes a
path string as recieved from Director (e.g. a Lingo script, a filename
stored in a CastInfo record) and returns a Common::Path object for the
file on the local system. The inner workings have been split into subfunctions,
which should make it easier to add workarounds and fuzz at the correct
layer.
2023-07-08 22:01:00 +03:00
Eugene Sandulenko 1d0e7993f5 DIRECTOR: Force drawing of frame counter even when there are no other changes 2023-07-01 17:01:40 +02:00
Eugene Sandulenko 95dfac0794 DIRECTOR: Remove code duplication in debug draw 2023-07-01 17:01:40 +02:00
Eugene Sandulenko 95d8cf840c DIRECTOR: _allOpenResFiles -> _allSeenResFiles 2023-06-29 23:22:54 +02:00
Eugene Sandulenko 7baba61852 DIRECTOR: Modernized rest of the loops 2023-06-29 23:22:38 +02:00
Eugene Sandulenko a62b7985b5 DIRECTOR: Modernized some loops 2023-06-29 17:35:06 +02:00
Eugene Sandulenko 29309a4078 DIRECTOR: Draw shadow for debug sprite/frame information 2023-06-17 11:01:54 +02:00
Scott Percival 458e97933d DIRECTOR: Refactor archive loading code
Make DirectorEngine::_allOpenResFiles the de-facto owner of Archive *
objects, move all of the various loadEXE/loadMac methods off Window and
onto DirectorEngine, and replace inline Archive loading with
openArchive().
2023-06-08 09:16:30 +02:00
Harishankar KumarandPragyansh Chaturvedi 829c3e32f4 DIRECTOR: Implement modal property of window
Implements modal property using the locking widgets of macwindowmanager.

`modal of window` in 'workshop' uses this.

Co-authored-by: Pragyansh Chaturvedi <pragyanshchaturvedi18@gmail.com>
2023-06-01 20:17:23 +02:00
Harishankar KumarandPragyansh Chaturvedi dd72dd09ca DIRECTOR: Implement the titleVisible property of window
Modifies border of window by first changing title to "", then updating
window border to borderType 2 `ThinNoTitle`.

`titleVisible of window` to verify this behavior.

Co-authored-by: Pragyansh Chaturvedi <pragyanshchaturvedi18@gmail.com>
2023-06-01 20:17:23 +02:00
Harishankar Kumar 6700c810fa DIRECTOR: Get/Set rect property of window, allow dynamic resize/move.
Adds the support to get/set field 'rect' of window object, interally it modifies the inner dimension of window object.

'mcluhan' used this to set window dimensions of background windows (through tell), Additionally `rect of window` in `workshop` also uses this patch for setting/getting field `rect` of window.
2023-05-31 13:29:33 +02:00
Harishankar Kumar 23f1229e67 GRAPHICS: MACGUI: Refactor resize() to extract inner window resizing
resize function is extracted to new function resize and resizeInner,
also a new private function rebuildSurface is created to handle common
code of refreshing/rebuilding surface after modifying inner or outer
window dimensions.
2023-05-31 13:29:33 +02:00
Scott Percival 9ec6722b6a DIRECTOR: Remove inkBlitStretchSurface()
No longer needed, the scaling should happen when updating the widget.

Fixes adjusting sprites with Lingo, such as in DEVO Presents:
Adventures of the Smart Patrol.
2023-05-28 14:44:09 +02:00
Scott Percival 9188159114 DIRECTOR: Move draw debugger to Window::render() 2023-05-28 14:44:09 +02:00
Scott Percival f703ee6ecf DIRECTOR: Split CastMember classes into files 2023-04-29 14:20:05 +02:00
Scott Percival 82e891d1d3 DIRECTOR: Move palette/transition debugging to images flag 2023-03-06 21:26:28 +01:00
Eugene Sandulenko 31c22852fd DIRECTOR: Added more debug output 2023-02-23 13:26:49 +01:00
Eugene Sandulenko 871b39c347 DIRECTOR: Do not enforce current path when loading next movie. Bug #13204
These days we are checking path validity in Window::setNextMovie(),
thus, forcing _currentPath leaded to inability to load movies from
root when called from within a subdirectory.

Fixes alice-win
2023-02-23 01:03:56 +01:00
Eugene Sandulenko 7d6018e663 DIRECTOR: Implement and use spriteType2str() 2023-02-13 16:24:46 +01:00
Eugene Sandulenko be62305248 DIRECTOR: Implemented debugger commands for drawing bitmapcast outlines and frame number 2023-02-04 15:48:41 +01:00
Eugene Sandulenko 5ce90b0bc7 DIRECTOR: Increased number of fewframesonly to 19 2023-01-27 22:29:21 +01:00
Eugene Sandulenko 63a57c1ba3 DIRECTOR: Made fewframesonly count global frames.
If the movie is switching during the first few frames, we were
resetting the counter which led to buildbot hanging.
2023-01-27 22:25:19 +01:00
Scott Percival d76b359ac2 DIRECTOR: Refactor movie loaders to allow loading from executables 2023-01-19 12:12:21 +01:00
Scott Percival 2674b628c4 DIRECTOR: Free frozen lingo states in window destructor 2022-12-09 01:10:57 +01:00
Scott Percival 7c975eff43 DIRECTOR: LINGO: Adjust freezing/thawing behaviour 2022-12-09 01:10:57 +01:00
Scott Percival 3ea7f10467 DIRECTOR: Freeze LingoState instead of using callstack
Previously, the Lingo state would be frozen by persisting the frames on
the bottom of the callstack with a special flag. This required extra
logic to determine whether or not the callstack was intended to be empty
after execution finished, with some complex edge cases.

The new approach is to swap out the LingoState object on the window,
meaning that an empty callstack always signifies execution has completed.
It remains to be seen if we'll need to track more than one frozen
context; for now it seems to be okay.

Fixes driving to locations in DEVO Presents: Adventures of the Smart Patrol.
2022-12-09 01:10:57 +01:00
Scott Percival 873095c87e DIRECTOR: Move current Lingo state into Window-owned struct
The previous arrangement was to copy the bits of Lingo state back and forth from
the Window object to the Lingo instance, and query the window for the
callstack. This refactor consolidates the current Lingo state into a single
struct, owned by the Window object and accessible via a pointer on the
Lingo object.
2022-12-09 01:10:57 +01:00