Commit Graph
69 Commits
Author SHA1 Message Date
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
Vladimir Serbinenko 0670d1a16a DIRECTOR: Switch to openFileOrDataFork 2022-12-04 20:16:21 +01:00
Roland van Laar 891fa08f15 DIRECTOR: Refactor loading next Movie
The loading of the next movie and corresponding shared cast
is now handled in seperate functions.
There checks when to load a new shared cast and when to delete
the previous one could be simplified by returning early when the
previous and new shared casts are the same.

At the same time it fixes a Dereference after null check from Coverity.
sharedCast->getArchive() could return a null pointer and wasn't checked
in all places.

Fixes COVERITY: 1498090
2022-10-07 17:00:31 +02:00
Scott Percival 2874f05eb3 DIRECTOR: Implement movie and nextmovie debugger commands 2022-09-28 17:07:07 +02:00
Roland van Laar 6c4e6321f3 DIRECTOR: LINGO: Improve frozen context handling
When an error happens during go, for example with a nonexisting movie
the lingo callstack isn't cleaned up properly.

Now the callstack is cleaned up via `popContext(aborting=true)`.

This improves on commit:
DIRECTOR: fix memleak when lingo context is frozen
27b314cb25
2022-09-24 23:49:10 +02:00
Roland van Laar 15ee7ba98a DIRECTOR: LINGO: fix memory leaks for lingo tests
The Lingo tests were failing because of memory leaks.
- `move` overwrote an existing cast without deleting it
- `puppetTransition` was set but not removed on class destruction
- the *.lingo test files were opened but never removed
2022-09-24 23:21:38 +02:00
Roland van Laar 27b314cb25 DIRECTOR: fix memleak when lingo context is frozen
Cleanup the lingo callstack when closing.

When a movie calls `go frameId` a big pause button is hit
and everything is put into order to not go to the frame +1
but to the requested frameId. That big pause button is called
`_freezeContext`.

However when quitting in the middle of a frozen context
there are lingo frames left on the callstack.

This can be reliably reproduced with a plethora of D2 and D3 movies
with the debugflags fewframesonly,fast.
2022-09-24 21:28:22 +02: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 f440529512 DIRECTOR: only cleanup sharedcast when it exists
Fixes segfault when the sharedcast was a nullptr.
2022-09-17 23:51:57 +02:00
Roland van Laar a105a0c121 DIRECTOR: unregister shared cast before deleting
A pointer to sharedCast was stored in the HashMap_openResFiles.
sharedCasts were deleted when a switch to a new movie was made
while _openResFiles is cleared when quitting Director.

This fix removes the reference to the shared cast when the shared cast
is deleted.
2022-09-17 23:15:50 +02:00
Scott Percival e750f05fe4 DIRECTOR: Don't erase _composeSurface after movie change
Fixes the scene transitions in the Spaceship Warlock trailer.
2022-09-12 15:52:18 +02:00
Roland van Laar c342819a60 DIRECTOR: LINGO: Implement the rect of the stage
The rect of stage returns the values of the stage rect.
2022-04-03 12:05:30 +02:00
Eugene Sandulenko abea37c9bb ALL: Update ScummVM project license to GPLv3+ 2021-12-26 18:48:43 +01:00
Scott Percival 6d32f570f5 DIRECTOR: Rework film loops to render as channels
The engine treats film loops as N full channels getting rendered to the
screen in the space of one. As such, it's impossible to pre-blit together
the content, as any blitter mode can be used for each of the items.
2021-11-07 12:05:29 +08:00
Scott Percival 29973e8627 DIRECTOR: Revert change to inkBlitShape
Using the dest. rect for everything leaves snail trails
in most of Spaceship Warlock.
2021-10-12 08:19:29 +08:00
Scott Percival 8b240f69b8 DIRECTOR: Fix inkBlitShape to use destRect for drawing 2021-10-12 01:08:34 +08:00
Scott Percival 8963cf211a DIRECTOR: Move methods from Window to DirectorPlotData 2021-10-12 01:08:34 +08:00
ysj1173886760 c4fac4e2b7 DIRECTOR: move warnings to deeper debug levels. 2021-08-20 19:21:28 +08:00
ysj1173886760 4133592992 GRAPHICS: MACGUI: add cache for inverted color. 2021-08-16 16:58:48 +08:00
ysj1173886760 50bfc4e521 GRAPHICS: MACGUI: implement global color inverter. 2021-08-16 16:54:00 +08:00
ysj1173886760 e9399b6121 DIRECTOR: add comment on invertChannel. 2021-08-16 16:34:31 +08:00
ysj1173886760 fb80649d69 DIRECTOR: fix inverting 8bpp images. 2021-08-16 16:32:33 +08:00
djsrv 50c7cefc2c DIRECTOR: Keep playing sounds when movie switches 2021-08-12 13:18:27 -04:00
ysj1173886760 15c0c68b1c DIRECTOR: don't clear bbox when render trailed channel. 2021-08-12 17:03:09 +08:00
djsrv 1c594b903b DIRECTOR: Use Unicode version of toPrintable 2021-08-07 14:54:36 -04:00
djsrv de0e03fa3d DIRECTOR: Remove filename cleaning in setNextMovie
This is redundant.
2021-08-07 14:54:36 -04:00
djsrv 02aace0598 DIRECTOR: Use ':' as directory separator 2021-08-07 10:44:37 +02:00
ysj1173886760 1dfd722735 DIRECTOR: supporting inverting QDShape 2021-08-03 16:14:50 +08:00
djsrv 7e13add452 DIRECTOR: Fix memory leaks 2021-07-27 23:50:44 -04:00
djsrv 8a9b1cd09c DIRECTOR: Give each window its own sound manager
This Should prevent conflicts between the sound channels of movies
running in parallel.
2021-07-27 22:42:09 -04:00
Eugene Sandulenko 2da3d76c02 DIRECTOR: Put more debug output to printable state 2021-07-27 19:10:11 +02:00
Eugene Sandulenko e6c582fe0f DIRECTOR: Make movie file names printable 2021-07-27 18:14:50 +02:00
djsrv fc1831a462 DIRECTOR: LINGO: Replace _hasFrozenContext
This fixes https://trello.com/c/bucHPI2F/429-majestic-regression
hasFrozenContext is now a function which checks the call stack for
frozen contexts. Not updating this variable manually leaves less room
for error.
2021-07-26 12:59:06 -04:00
djsrv 7f0ae2b827 DIRECTOR: LINGO: Improve switching between windows
This saves/loads more Lingo state to the window so that running Lingo in
multiple windows is safer.
2021-07-26 12:59:06 -04:00
ysj1173886760 31cbd8f55e DIRECTOR: amend the implementation of invertChannel 2021-07-25 16:43:40 +08:00
ysj1173886760 2901700b5a DIRECTOR: comment out the procedure of applying ghost ink effect to text sprite.
it's wrong now.
2021-07-23 19:04:11 +08:00
djsrv 44ad31a043 DIRECTOR: LINGO: Only freeze one context at a time 2021-07-21 20:41:36 -04:00
ysj1173886760 b31bd5f231 DIRECTOR: add movingChanging flag to deal with the sound which will playing across the movie. 2021-07-20 19:34:07 +08:00
djsrv 0592520ddf DIRECTOR: Test multiple possible paths for shared cast 2021-07-16 16:22:06 -04:00
ysj1173886760 e4105dc091 DIRECTOR: clear the widget pointers in castmember when we are switching the movie. 2021-07-12 14:15:24 +08:00
ysj1173886760 8d270071cf DIRECTOR: don't draw outline shape when we get linesize < 0 2021-07-08 02:25:11 +02:00
ysj1173886760 5d4b11c198 DIRECTOR: introduce partial invertion to resolve render invert channel problem 2021-07-08 02:25:11 +02:00
ysj1173886760 010c724971 DIRECTOR: modify the way we are inverting the channel 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
ysj1173886760 d437f7a7e1 DIRECTOR: fix drawing the LineBottomTopSprite 2021-06-26 16:08:20 +02:00
ysj1173886760 b3ef5de251 DIRECTOR: use 0 for not-skip drawing when dealing with mask sprites. 2021-06-20 14:33:53 +02:00
Roland van Laar a7f16ffbe1 DIRECTOR: allow setting of video casts to castNum
The game Majestic dynamically sets the castNum to video casts and expects them to play directly.
Videos were also stopped erroneously. Video stoppage is assumed when
movieRate is 0. The comment als indicated that it was probably broken
for D4.

The corresponding lingo code is, where anim is a cast label.
  set the castNum of sprite 48 to cast(anim)
  updateStage()
  set the movieRate of sprite 48 to 1
  repeat while the movieRate of sprite 48
    updateStage()
  end repeat
2021-06-06 18:15:18 +02:00