Commit Graph
133 Commits
Author SHA1 Message Date
Eugene Sandulenko 1e4d4fd42e DIRECTOR: Fix compilation with ImGui disabled 2025-04-19 18:46:57 +02:00
unknown b4370eac34 DIRECTOR: Make rows selectable in Channels display
You can now select a channel in the Dear ImGui channels display. Additionally,
the selected channel is stored in ImGuiState in order to refer to it for debug
drawing.
2025-04-19 12:41:53 +02:00
Misty De Meo 32b0541931 DIRECTOR: fix invalid cropping in virtual desktop
The mismatch between rect locations meant that, if the virtual
desktop was on, windows would have a bit of their content to the
top and bottom clipped out.
2025-03-26 19:52:41 -07:00
Scott Percival fdfdd3ae41 DIRECTOR: Force clip dirty rectangles against screen area
Fixes crash in Microphone Fiend.
2025-03-25 12:17:34 +08:00
Scott Percival 7ac5047bc7 DIRECTOR: Move _mainArchive handle to DirectorEngine
_mainHandle is a pointer to the projector archive, and is set once at
the start of execution. DirectorEngine is a better place for it rather
than the first Window, as other Windows might try and access it.

Fixes crash when changing the cursor in Microphone Fiend.
2025-03-25 12:17:34 +08:00
Scott Percival 29e2397bf8 DIRECTOR: LINGO: Improve accuracy of "play done"
After a script reaches "play done", that script gets aborted.
The Lingo frozen play script (aka the script that initially invoked
play) will be thawed before stopMovie.

Fixes director-tests/D4-unit/T_PLAY01.DIR.
Fixes movie switching in Cyber Grannies.
2025-02-27 21:01:03 +01:00
Scott Percival 151d52f938 DIRECTOR: Move Lingo stack into LingoState, fix c_tell infinite loops
Fixes crashes when starting a new game in Zeddas: Servant of Sheol.
2025-02-04 15:24:17 +01:00
Scott Percival 47fdf67b74 DIRECTOR: Add debugger command for listing windows 2025-02-04 15:24:17 +01:00
Scott Percival feffecff0c DIRECTOR: Improve support for rendering trails 2025-02-04 15:24:17 +01:00
antoniou79 83aeb75d5a DIRECTOR: Fix argument order for setting debug channels
In a few occasions the debug channel and debug level arguments were swapped
2024-07-08 12:44:40 +02:00
Scott Percival 3cef329523 DIRECTOR: Fix film loop playback
Previously, film loops were incremented from Score::updateSprites() by
Channel::setClean(), however this wasn't guaranteed to be run only once
per frame and lead to animation frames being skipped.
This has now been moved into Score::renderFrame.
2024-06-24 22:33:25 +08:00
Scott Percival eb86d2794c DIRECTOR: Check output of thawLingoPlayState 2024-06-18 18:24:08 +08:00
Scott Percival 83e1d42ffa DIRECTOR: Fix Window::invertChannel in 32-bit mode 2024-06-15 02:04:30 +02:00
Scott Percival 86c5098169 DIRECTOR: Add separate execution freeze for "play" calls
According to the Director documentation, "play" acts in a very different
way to "go". Instead of freezing execution of the handler as part of the
stack, it will freeze the handler and defer it until "play done" is
called by something else. This adds a method for doing this, plus
workarounds to not impact the event processing pipeline.

Fixes picking up most of the time trumpets in Virtual Nightclub
(1580:winASWarp in shared.dxr).
2024-06-15 02:04:30 +02:00
Scott Percival cb0aeaed94 DIRECTOR: Only check stepMovie/enterFrame for freeze recursion
Fixes director-tests/D4-unit/T_EVNT18.DIR
2024-06-15 02:04:30 +02:00
Eugene Sandulenko d1e7cfb0fc DIRECTOR: Switch Window before loading new shared cast
The findPath() utility function is requesting g_director->getCurrentPath(),
and that one is calling _currentWindow->getCurrentPath(). With side-loading
of movies in different path, it was still trying loading shared cast
from the current movie directory.
2024-06-07 19:33:49 +02:00
Eugene Sandulenko f3a6e5f24f DIRECTOR: Truly load movie in Window::ensureMovieIsLoaded()
Before that, we were only _scheduling_ the movie to load, which
was leading to movie actually getting loaded only after the
current script is over.

This affects jewels1 boot process, where the following Lingo is used:

  set myWindow to window "puzzle"
  set the fileName of myWindow to "NAVLOAD"
  open(window "puzzle")

  tell window "puzzle"
    waitSignal()
  end tell

As a result, tell() was complaining about unknown waitSignal handler
because it has not yet been loaded.

Now, after splitting loading and Lingo execution into separate phases,
we can truly only load a movie without messing with scripts (yet).
2024-06-05 01:14:25 +02:00
Eugene Sandulenko 5d9d36f4f2 DIRECTOR: Implemented paused start and introduce loaded state
- Split out "Loaded" state for score
- Added two debugflags: paused, to start in paused mode and
  paudeonload, to pause every movie when it is loaded
- Use OSD for reflecting paused state
2024-06-04 22:29:38 +02:00
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