Commit graph

116 commits

Author SHA1 Message Date
Scott Percival
0005d43144 DIRECTOR: LINGO: Mark new event types 2025-02-04 15:24:17 +01:00
Scott Percival
c6d6785447 DIRECTOR: Fix loading Lingo scripts from different internal casts
Fixes the block minigame in Fisher Price Learning in Toyland.
2024-11-11 20:40:06 +01:00
Scott Percival
215e5ed29a DIRECTOR: Fix crash when suspending on a "play" call
Fixes interacting with Neow-Neow in the cave in Nikolai's Trains.
2024-06-15 02:04:30 +02:00
Scott Percival
2ff3357dac DIRECTOR: Refactor Channel to remove overlay position/dimensions
The original logic doesn't hold up to testing. The position/width/height
of a sprite can be changed at any time without any extra flags; although
the screen needs to be redrawn before you can see any change.

The main thing that the sprite puppet flag does is determine if sprites
are updated from the score data when the frame changes.

Fixes the broken mouse cursor tracking sprite in Chop Suey.

Fixes the sprite scaling in the Doc Martens minigame in Virtual
Nightclub.

Fixes director-tests/D4-unit/T_SPRT01.DIR
2024-05-18 13:56:01 +02:00
Scott Percival
aa15020b8d DIRECTOR: Refactor mouse event handling
After creating a bunch of tests, it is clear that the choice of what
mouseDown/mouseUp handler in the hierarchy to use is determined just
before running it. This was a problem, as we were caching that
information up-front when processing the input events, and it is
entirely possible for e.g. a mouseDown handler to jump to another frame,
which would affect which subsequent mouseDown/mouseUp handlers to call.

Fixes director-tests/D4-unit/T_EVNT01 to T_EVNT11.
2024-05-12 22:00:19 +02:00
Scott Percival
6a0fb37616 DIRECTOR: Allow only one input event to execute at a time
If you trigger e.g. a mouseDown and a mouseUp event, the mouseUp event
should not be run until the mouseDown event has returned.

Fixes director-tests/D4-unit/T_EVNT03.DIR
2024-05-12 22:00:19 +02:00
Scott Percival
565be3d3c9 DIRECTOR: Cache cast member when processing mouseDown/mouseUp
Fixes clicking the movement buttons in P.A.W.S.
2024-04-25 00:54:17 +02:00
Scott Percival
27f0e8f8bb DIRECTOR: Rework event ordering to be closer to original
Confirmed to work with:
- darkeye (race condition when viewing cutscenes or switching scenes in
  the menu)
- gadget (race condition after climbing the stairs in GA28)
- the7colors (intro cutscene timed with b_delay)
- wallobee (hotspot select gated with b_delay)
2024-01-30 23:30:11 +01:00
Scott Percival
94bd08a4dd DIRECTOR: Change assert to no-op when queueing events
Apparently it is possible to send events if there are no frames (e.g. a
movie with no Score data and a script which redirects to another movie).

Fixes occasional crashes when starting Team Xtreme: Operation Weather
Disaster.
2024-01-11 20:41:43 +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
Eugene Sandulenko
8bccc12786
DIRECTOR: Reduce header dependency 2023-08-02 21:05:06 +02:00
Harishankar Kumar
e2c0847720 DIRECTOR: LINGO: Scoped and scopeless lingo score
This patch fixes the behaviour of having both scoped and scopeless lingo
in the same score script. It has been observed that movies created with
D3.1 that uses scopeless lingo can be ported to D4, in which case the
scopeless lingo is executed first, before the scoped lingo. (for example
in `put "abc" enterFrame put "enter" end`, abc will be printed first,
then enter)

Fix the problem where frames in certain `totaldistortion-win` movies are
played spontaneously because enterFrame handlers are not called due to
scopeless statements contained in the movie.

--start-movie="ATD/HD/FISMH2H6.DXR"@50 totaldistortion-win
2023-08-01 00:23:27 +02:00
Harishankar Kumar
329e63b662 DIRECTOR: Refactor main channels into struct
Main channels of frame is now refactored into struct, this is
to make it easier to copy/add more flags and integrate it with
frames loading.
2023-07-19 14:57:59 +02:00
Harishankar Kumar
fdd8c34691 DIRECTOR: Rename _frame, getCurrentFrame(), getTotalFrames() to improve readability 2023-07-10 16:03:11 +02:00
Harishankar Kumar
2b331582aa DIRECTOR: Change preloading of frames to demand loading
Frames are now loaded on demand, when they are first accessed. Also
the starting offsets of each frames are stored in a special array, so
any previously visited frame might have quick access time. Much of the
work is done in Score class itself.

Warning: This commit is not yet complete. There are various issues
and crashes on the way.

Demand loading of frames is implemented to replicate the behavior of
the original engine. The original engine does not load frames until
it is accessed, this property when used with lingo is exploited to
allow changes in sprite properties when there is no next frame changes
of that property. In essential what happened was that for a non puppet
sprites, the game can have its property changed and rendered until there
was full refresh (in form of jumps, etc) of screen. This was not possible
with precached frames.

The first example use was seen in movie `ATD\HD\bdDREAMA.DXR` of game
'totaldistortion-win'.
2023-07-10 16:03:11 +02:00
Eugene Sandulenko
7baba61852
DIRECTOR: Modernized rest of the loops 2023-06-29 23:22:38 +02:00
Scott Percival
3b13e8ff43 DIRECTOR: Support D5 loading multiple casts
In D5 and up, you can have multiple casts in the same movie, along with
external casts. Unlike shared casts these are different namespaces;
each movie maps the casts to a libId, which is then used by
CastMemberID.castLib.

For D4 and below, the default cast libId is now represented by
DEFAULT_CAST_LIB. This should make refactoring easier in future.
2023-05-10 09:48:50 +02:00
Scott Percival
e2053c51ab DIRECTOR: Add event breakpoints to debugger 2023-02-08 13:30:58 +01:00
Scott Percival
09cf6d5ada DIRECTOR: LINGO: Prioritise named sprite event handlers
In Director 4, with score scripts it is possible for the compiler
to produce a generic handler which is empty, in addition to named
handlers (e.g. mouseUp). The original behaviour for sprite scripts
was to default to the generic handler if it exists, even if there
is a named handler that matches the event. This change makes the
generic handler the fallback choice.

Fixes opening the inventory in Eastern Mind.
2022-08-28 10:31:00 +00:00
Pragyansh Chaturvedi (r41k0u)
055d0c095e DIRECTOR: LINGO: Prevent execution of cast script in presence of D3-sprite script 2022-07-07 17:57:39 +02:00
Eugene Sandulenko
abea37c9bb
ALL: Update ScummVM project license to GPLv3+ 2021-12-26 18:48:43 +01:00
Misty De Meo
e967c16350 DIRECTOR: add stub handler for some events 2021-11-20 11:21:06 +01:00
Orgad Shaneh
02cfffcb67 DIRECTOR: Use nullptr
Using clang-tidy modernize-use-nullptr
2021-11-14 15:51:59 +02:00
djsrv
fa01b6d434 DIRECTOR: LINGO: Don't warn when replacing script is expected 2021-09-05 20:38:59 -04:00
djsrv
690562b1b1 DIRECTOR: Use separate queues for user and non-user events
We don't want to immediately process user events when processing another
non-user event.
Fixes https://trello.com/c/wtRV31SE/451-journeyman-execution-order
2021-08-17 21:16:52 -04:00
djsrv
ebbb82c683 DIRECTOR: Remove getEventCount() 2021-08-17 20:40:18 -04:00
djsrv
c66e415408 DIRECTOR: LINGO: Process timeout events in score scripts 2021-08-06 11:09:53 -04:00
djsrv
4406d6c598 DIRECTOR: Don't register idle event when new movie started 2021-08-02 10:12:15 -04:00
djsrv
ab0fc404c1 DIRECTOR: Process stepMovie events if outdated Lingo is allowed
Used in Meet MediaBand.
2021-07-23 18:08:53 -04:00
djsrv
fb1e63fc94 DIRECTOR: LINGO: Remove pc arg from Lingo::execute
This arg should always just be the same as _pc.
2021-07-21 18:27:05 -04:00
djsrv
88ea6e1645 DIRECTOR: Re-encode loaded text to UTF-8 2021-07-15 16:31:47 -04:00
ysj1173886760
111726031d DIRECTOR: set currentChannelId to 0 for script channel scripts. 2021-07-08 02:25:11 +02:00
djsrv
615995fdc1 DIRECTOR: Change member refs to use CastMemberID 2021-06-30 22:32:19 -04:00
Orgad Shaneh
a05e54f00c JANITORIAL: Remove trailing whitespaces 2021-05-04 11:46:30 +03:00
djsrv
0ff7274993 DIRECTOR: Multiply version numbers by 100
To accomodate minor version.
2020-08-10 15:00:55 -04:00
djsrv
a7e9ad9de5 DIRECTOR: LINGO: Use events for menu callbacks 2020-07-24 17:12:43 -04:00
djsrv
14892f7f02 DIRECTOR: LINGO: GlobalScript -> EventScript 2020-07-24 17:12:39 -04:00
djsrv
177283249e DIRECTOR: Fix event segfaults 2020-07-24 14:10:13 -04:00
djsrv
f23ef93766 DIRECTOR: Move event handling to movie 2020-07-23 20:05:49 -04:00
djsrv
336576c538 DIRECTOR: LINGO: Enforce return values 2020-07-22 12:38:01 -04:00
djsrv
91a7cc7676 DIRECTOR: LINGO: Fix D4 nobytecode event scripts 2020-07-10 14:02:16 -04:00
djsrv
37938f433c DIRECTOR: LINGO: Add kEventScript
For generic handler-less event scripts
2020-07-10 14:01:14 -04:00
djsrv
04f457c46b DIRECTOR: Add _playState to Score 2020-07-09 12:20:39 -04:00
djsrv
b2c20a07f7 DIRECTOR: LINGO: Refactor Object
This turns Object into a template so any type can easily act as a Lingo
object. For example, script objects no longer own a script context.
They *are* script contexts, and there are custom getters/setters for
methods and properties.
2020-07-07 16:59:55 -04:00
djsrv
38d17341e2 DIRECTOR: LINGO: Move lingo archive to Cast 2020-07-01 22:07:13 -04:00
djsrv
5ae6c34074 DIRECTOR: Separate Movie and Cast from Score 2020-07-01 10:50:31 -04:00
djsrv
75058809aa DIRECTOR: LINGO: Remove kEventStart 2020-06-29 12:50:46 -04:00
djsrv
b43e1fdb13 DIRECTOR: LINGO: Add 2-3 event delegation 2020-06-29 12:48:40 -04:00
djsrv
678e6df29f DIRECTOR: LINGO: Handle stepMovie event 2020-06-29 11:43:10 -04:00
djsrv
b728485736 DIRECTOR: LINGO: Fix frame event queueing 2020-06-26 16:54:56 -04:00