Most of the time we'll be looping to the same frame, where we want
to update the sprites, but not clobber them with the contents of the
current frame.
Fixes the paint splodges on the easel in the A room of Cyber Grannies.
Fixes the menu system in Cosmology of Kyoto.
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.
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.
Previously there was a gap between loading a new frame, and copying the
sprite information from that new frame back to the channels (if
required). Scripts could run in this gap, and in this case they would
be operating on the old sprite information instead of the new.
Score::renderFrame has been renamed to Score::updateFrame; the method
doesn't actually render anything, it reconciles the difference
between the frame data and the channel data, updates the channel data,
and produces a list of dirty rects.
Fixes the menu screen of Majestic: Alien Encounter.
Fixes director-tests/D4-unit/T_SPRT02 and T_SPRT03
It is possible to call "pause" in the exitFrame handler, then rely on
another handler (e.g. mouseDown) to call "continue" to start the movie
playback. exitFrame should not be called again once playback is resumed.
Fixes entering the first hatch in L-Zone.
Fixes D4-unit/T_EVNT12.DIR in director-tests.
The startMovie handler needs "the frame" to return the starting frame,
which isn't necessarily 1. Easiest way to fix this is to set up the
frame data in the Score::startPlay() handler.
Fixes the broken navigation in the Empire State Building in Hell Cab.
Several Director titles make use of the "trails" sprite feature to
draw graphics to the framebuffer, strobing multiple sprites with a
single channel. In order for this to work, we need to be careful that
the dirty rectangles list is only updating the bare minimum area.
Extra rectangles were being added by Score::renderSprites; an invalid
cast reference would still add the channel's bbox to the list. This has
been fixed.
Previously, the end of a transition would force a full screen refresh,
even if the update was partial. This should be unneccesary; transitions
shouldn't leave artifacts on the screen.
Fixes many instances of inventory items disappearing in Team Xtreme:
Operation Weather disaster (e.g. clicking the compass in Stonehenge,
clicking an item on the memory game in Stonehenge).
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)
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.
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
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.
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.
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'.
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.
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.
Score::update() has several branches that quit early, e.g. if the frame
is waiting for a click or a sound. All of these should try to unfreeze
any contexts that are waiting.
Fixes opening the inventory screen in Hell Cab.
Previously, this would return the palette for the current frame (if it
was specified). Real Director behaviour is to return the current
palette in use, i.e. taking into account changes made in previous
frames.
In Director, FPS entries in the tempo channel apply to all subsequent
frames. If we seek to an arbitrary frame, the correct tempo settings
should be applied.
Fixes the animation speeds of the cauldron and the walking teapot in
Chop Suey.
Previously it was possible for a Lingo script to stop a score sound channel,
then call updateStage, which would immediately start it again. To fix
this, updateStage() will now only update puppet sounds.
Fixes the sound playback when going from the map to the exit screen in
Chop Suey.
Most variants of puppetSounds don't actually start the sound immediately
but wait until the frame is updated. So I've created a SoundID struct
which stores a reference to a cast member or externals sound, and that
is used to store the puppetSound until it's actually supposed to start.
In addition, puppet status is now per-channel instead of a universal
flag.