Commit Graph
709 Commits
Author SHA1 Message Date
Scott Percival 190406c8d1 DIRECTOR: Add debug timing for draw calls 2023-10-25 18:22:15 +02:00
Harishankar Kumar c963b2c3b4 DIRECTOR: Fix chan <frameNum> debugger command
This patch fixes chan command, previously when called with frameNum it
was mutating the state of frame and thus crashing.
2023-08-13 10:57:23 +02:00
Harishankar Kumar ffd515fe6a DIRECTOR: Refactor score loading and remove framesOffset
This patch completely removes framesOffset and rebuildChannelData()
The framesOffset was used to store the number of frames and their
starting position in frame stream, however this information is not
needed as when in frames jumping, all the channels needed to be built
from frame 1, thus only position of first frame is needed.
2023-08-13 10:57:23 +02:00
Harishankar Kumar 4e1cdb73b4 DIRECTOR: Refactor loading cast when building framesOffset
This patch refactors the code that builds the framesOffsets table,
initially each frame of movie was being parsed and sprite casts loaded
then was being discarded, this was not very efficient.  Refactored code
to load cast only when they are required, thus reducing the time to load
a movie.

Fixed slow loading of large movies in `totaldistortion-win`

--start-movie="ATD/HD/ADTDVSVF/TDVIDDB1.DIR" totaldistortion-win
2023-08-13 10:57:23 +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 a7a41273cf DIRECTOR: Improve screenshot comparison of previous builds
This patch adds simple pixel by pixel comparison of screenshots
between builds. It is useful to detect regressions in graphics
rendering.
2023-07-26 23:37:37 +02:00
Scott Percival 8a55400789 DIRECTOR: Inject empty score if VWSC block is missing
Games can load movies without a score; e.g. with a MovieScript
which performs a check then bounces to a different movie.
In these cases, we can reuse the frame loader code and inject
a Score with one empty frame.

Fixes the EXE movie in Maniac Sports.
2023-07-23 14:07:20 +02:00
Harishankar Kumar 70bbe562c3 DIRECTOR: Rebuild frames when there is jump to current frame
Initially, the frames data were only being reset and rebuild when
jumps were made to frame that is different than current one, ie
this in case when `_nextFrame != _curFrameNumber`, this however
had problems with `majestic-mac` not opening and stuck on loading
screen.

Fixed problem where `majestic-mac` would constantly jump to main-menu
screen (ie same frame) and would not load the game.
2023-07-22 01:06:45 +02:00
Harishankar Kumar b1da9423b9 DIRECTOR: Refactor scoreCachedPaletteId to frames loading
Move caching logic of scoreCachedPaletteId from Score to Frame.
2023-07-19 14:57:59 +02:00
Harishankar Kumar e13eba2162 DIRECTOR: Refactor tempo, remove scoreCachedTempo
This removes the scoreCachedTempo from main channel struct, it was
observed that with advent of on demand frame loading, the tempo is
automatically being overwritten when found in score, this renders
previous logic to cache tempo and carry to forward useless.

`More Puppets` of 'theapartment-4` is now working.
2023-07-19 14:57:59 +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 543db81f30 DIRECTOR: Copy back sprites from channel to frame
Without this the lingo modified non puppet sprites properties were not
being reflected in the frame. Now what happens is if you modify a non
puppet property then lingo will temporarily override the score (ie that
property is remain the same until an update from score is encountered)

This closely resembles the behaviour of the original engine.
2023-07-19 14:57:59 +02:00
Scott Percival 889130a3fa DIRECTOR: Share Sprite parsing code between Frame and FilmLoopCastMember 2023-07-16 14:01:48 +02:00
Scott Percival eb39be60c2 DIRECTOR: Fix regression where previous frame's tempo is used
Fixes the 0% warning message in The Cute Machine.
2023-07-14 13:26:12 +02:00
Harishankar Kumar 492791cf74 DIRECTOR: Fix lingo execution after go to frame
When frame jumping instructions like `go to frame` is used, it should pause
lingo execution before changing frames and then executing remaining lingo code,
This fixes the problem where lingo was executed before the frame was updated.

`ATD\HD\bdDREAMA.DXR` of 'totaldistortion' uses this to set puppetSprite after
calling go to frame.
2023-07-12 22:49:16 +02:00
Harishankar Kumar cf6655db16 DIRECTOR: Remove bad warning message from test code 2023-07-12 22:49:16 +02:00
Eugene Sandulenko 4c27273b60 DIRECTOR: Disable frame copying code and added puppet check to it 2023-07-10 16:03:11 +02:00
Eugene Sandulenko 4a535f6b52 DIRECTOR: Copy sprites from the channel to the current frame
This allows Lingo-modified properties to be modified further by Score
2023-07-10 16:03:11 +02:00
Eugene Sandulenko 582c673193 DIRECTOR: Optimize frameOffsets calculation 2023-07-10 16:03:11 +02:00
Eugene Sandulenko 5d13fc92d2 DIRECTOR: Improve debug output 2023-07-10 16:03:11 +02:00
Eugene Sandulenko cd3be9ac18 DIRECTOR: Remove Score::_channelData. We now read frames dynamically 2023-07-10 16:03:11 +02:00
Eugene Sandulenko 4eadd3b7bf DIRECTOR: Reset frame fully on rewind. This fixes D2-D3 2023-07-10 16:03:11 +02:00
Eugene Sandulenko 30fdc2a9e2 DIRECTOR: Do not process frame actions multiple times
Also drop now impossible check for unreferenced actions
2023-07-10 16:03:11 +02:00
Eugene Sandulenko aa44019679 DIRECTOR: Copy channels to _currentFrame before frame data loading 2023-07-10 16:03:11 +02:00
Eugene Sandulenko 4245cc2607 DIRECTOR: Initial frame loading refactoring
D4 is working, rhe rest is broken
2023-07-10 16:03:11 +02:00
Harishankar Kumar 5c3f4b837b DIRECTOR: Refactored score class, changed comments 2023-07-10 16:03:11 +02:00
Harishankar Kumar 8b259c8627 DIRECTOR: Minor changes, comments and some more corrections 2023-07-10 16:03:11 +02:00
Harishankar Kumar af82ea2769 DIRECTOR: Fix frame number mismatch with total frames in score
Total number of frames were being read from VWSC resource
(version > kFileVer400), however it has been found that for some movies
there is mismatch between version and total frames. Therefore now changed
the code to load all frames initially to read total number of frames.

`ATD\HD\ABPOPUP1.DXR` of `totaldistortion` is one such example.
2023-07-10 16:03:11 +02:00
Harishankar Kumar f3928ec4cf DIRECTOR: Rebuild channel data when frame jumping, fix screen freeze bugs. 2023-07-10 16:03:11 +02:00
Harishankar Kumar 64a214fa86 DIRECTOR: Fix framesSize exceeded for demand loaded frames 2023-07-10 16:03:11 +02:00
Harishankar Kumar 6cdd4a92db DIRECTOR: Load all of VWSC resource in framesStream 2023-07-10 16:03:11 +02:00
Harishankar Kumar b29f01dc20 DIRECTOR: Added corner condition while on demand reading of frames. 2023-07-10 16:03:11 +02:00
Harishankar Kumar 5ec6a62fe8 DIRECTOR: Change _frameStream to read and wrap stream data 2023-07-10 16:03:11 +02:00
Harishankar Kumar fdd8c34691 DIRECTOR: Rename _frame, getCurrentFrame(), getTotalFrames() to improve readability 2023-07-10 16:03:11 +02:00
Harishankar Kumar bcc3ad7f66 DIRECTOR: Refactored quickSelect to getFrameData
Earlier quickSelect was modifying and contaminating current state
of the score. This was causing problems with the frame demand.
Now quickSelect is only used for previewing one frame and it
doesn't modify the score.
2023-07-10 16:03:11 +02:00
Harishankar Kumar 81a0a5b7e0 DIRECTOR: Fix indirect memory leakage, added in-memory data store. 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
Scott Percival 63c791aeda DIRECTOR: Don't skip frame delay when switching frames
Fixes animation playback speed in The Seven Colors.
2023-07-08 22:01:00 +03:00
Eugene Sandulenko 7baba61852 DIRECTOR: Modernized rest of the loops 2023-06-29 23:22:38 +02:00
Scott Percival 4bf4e4a4a0 DIRECTOR: Fixes based on feedback 2023-05-28 14:44:09 +02:00
Scott Percival bcb502d634 DIRECTOR: Move getRegistrationOffset and getBbox to CastMember 2023-05-28 14:44:09 +02:00
Scott Percival 4a85392dd9 DIRECTOR: Skip palette fades when the source and destination match
Fixes menu interactions in The Cute machine.
2023-05-28 14:44:09 +02:00
Scott Percival da06ecad9b DIRECTOR: Move _lastPalette to DirectorEngine
If the destination movie uses a palette cast member in the same location
as the source, but with different data; Director will assume that the old
palette is correct right up until it has to switch to something else via
the score.

Additionally, ensure that all palettes are loaded into the index when
the Cast is loaded, not just single ones that haven't been loaded before.

Fixes movie transitions and palette rendering in Phibos: Following the Comet.
2023-05-14 14:10:22 +02:00
Scott Percival 3b5500227a DIRECTOR: Update the current sound fade during a palette transition
Fixes the intro music fading in The Cute machine.
2023-05-10 22:32:21 +02:00
Scott Percival 343a177016 DIRECTOR: Add new lookup table for D5 palette fade times
When fading a palette, Director lets you pick a "frame rate" between 1
and 30. These each correspond to a fixed transition time, with the
higher framerates converging to zero.

In D4 and under the slowest of these frame rates is half a second.
After some user feedback they changed this in D5 to be a range
of times, ranging from a leisurely 16.5 seconds all the way to
instantaneous.

Fixes the intro fade in The Cute machine.
2023-05-10 22:32:21 +02:00
Scott Percival 5426729bf4 DIRECTOR: Fix zoom transitions 2023-05-10 09:48:50 +02:00
Scott Percival ec76e5dfc6 DIRECTOR: Refactor palette loading for D5
Previously, the palette ID namespace was shared between cast ID, builtin
ID and resource fork ID. This was quite messy.

The new approach is to use CastMemberID; builtin palettes are libId -1,
cast palettes use their respective libId, and a null CastMemberID
indicates a blank entry.
2023-05-10 09:48:50 +02:00
Scott Percival 8a990d556c DIRECTOR: Add Transition cast member type 2023-05-10 09:48:50 +02:00
Scott Percival 2009f27712 DIRECTOR: Add D5 support for _defaultPalette 2023-05-10 09:48:50 +02:00