Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DIRECTOR: Transition fixes, palette cycling effects, and debugger #4261

Merged
merged 28 commits into from Sep 12, 2022

Conversation

moralrecordings
Copy link
Contributor

@moralrecordings moralrecordings commented Sep 11, 2022

No description provided.

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.
Fixes transitions in Lost Mind of Dr. Brain demo.
- Transitions now appear in the debug log, including parameters and
  timing.
- Most transitions would calculate a fixed number of steps, then work
  backwards to figure out the framerate required to fit the duration.
  This approach didn't work for shorter durations, as the delay required
  for the number of steps would drag out the duration. This has been
  fixed by introducing a floor to the number of steps, so that the
  framerate is no higher than 60fps.
- Multi-pass transitions were previously calling stepTransition() on
  every blit; this would effectively redraw the entire screen ~96 times
  a step and blow out the draw time to ~44 seconds. stepTransition() is
  now called once per step.
- Blind transitions now cover the full range.
- kTransDissolveBoxySquares and kTransDissolveBoxyRects were swapped.
- kTransDissolveBoxyRects now adjusts for the viewport aspect ratio.
This is going to be the basis for the palette-cycling effects.
Fixes parts not hiding after being selected on the face
selection screen in Eastern Mind.
Fixes various blue rectangles in Eastern Mind and Total Distortion.
Blit operations in Director expect that the "white" and "black" color
indexes are at 255 and 0, respectively. Fetching these values from
the window manager is not reliable when the palette has multiple
indexes sharing a color (e.g. blackPalette and whitePalette), which will
mean the applyColor flag is incorrectly set to true when foreColor and
backColor are the correct values.

Fixes fade from white when entering the door to the Land of Desire in
Eastern Mind.
Switching to a new movie should force a switch to the default palette if
required, and not assume the palette in use is correct.

Fixes the palette tinting after being reincarnated in Eastern Mind.
Fixes the scene transitions in the Spaceship Warlock trailer.
Fixes regression introduced in 0c09bba

Fixes resource detection in Total Distortion.
Fixes Invictus logo animation in Alice: An Interactive Museum.
Copy link
Member

@sev- sev- left a comment

So, this PR contains the palette changes too... That is fine, but perhaps we need to close #4241 ?

I put some notes for the patch, needs changes.

@@ -107,8 +107,8 @@ Channel::~Channel() {

DirectorPlotData Channel::getPlotData() {
DirectorPlotData pd(g_director, _sprite->_spriteType, _sprite->_ink, _sprite->_blend, _sprite->getBackColor(), _sprite->getForeColor());
pd.colorWhite = pd.d->_wm->_colorWhite;
pd.colorBlack = pd.d->_wm->_colorBlack;
pd.colorWhite = 255;
Copy link
Member

@sev- sev- Sep 11, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this change? 255 is not guaranteed to be white.

Copy link
Contributor Author

@moralrecordings moralrecordings Sep 12, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ink operations use colorWhite and colorBlack to establish whether or not certain color operations should be performed if the foreColor and backColor are different. These operations don't care whether the color is actually white or black; all of the Macromedia palettes have it that way, and the docs reflect that, but they need to be the extrema. Asking the wm for the white or black color doesn't work when you're doing e.g. a fade to white, as it'll see that color index 1 is white and give you that back as the "white" color and wreck all of the ink operations.

engines/director/debugger.cpp Outdated Show resolved Hide resolved
engines/director/debugger.cpp Show resolved Hide resolved
engines/director/debugger.cpp Outdated Show resolved Hide resolved
engines/director/debugger.cpp Outdated Show resolved Hide resolved
@@ -244,13 +244,6 @@ MacShape *Sprite::getShape() {
default:
break;
}

if (g_director->getVersion() >= 400) {
Copy link
Member

@sev- sev- Sep 11, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this removed?

Copy link
Contributor Author

@moralrecordings moralrecordings Sep 12, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added this behaviour back in 2020 to "fix" something, unfortunately before I got into the habit of keeping notes. It was originally for all Director versions, then someone filtered it to v4 and above because it didn't work. Unless there's a regression case that I'm not aware of, we definitely don't need the colour portions and I'm doubtful the line and ink portions would work.

@@ -265,8 +258,7 @@ uint32 Sprite::getBackColor() {

switch (_cast->_type) {
case kCastText:
case kCastButton:
case kCastShape: {
Copy link
Member

@sev- sev- Sep 11, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this removed?

Copy link
Contributor Author

@moralrecordings moralrecordings Sep 12, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shapes in Director use the foreColor and backColor specified in the sprite channel. The cast member has a foreColor and backColor, but my understanding is that it gets overridden.

@@ -280,8 +272,7 @@ uint32 Sprite::getForeColor() {

switch (_cast->_type) {
case kCastText:
case kCastButton:
case kCastShape: {
Copy link
Member

@sev- sev- Sep 11, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same question, why is this removed?

Copy link
Contributor Author

@moralrecordings moralrecordings Sep 12, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See above.

engines/director/util.h Show resolved Hide resolved
@@ -203,7 +203,6 @@ Datum Window::getStageRect() {

void Window::reset() {
resize(_composeSurface->w, _composeSurface->h, true);
_composeSurface->clear(_stageColor);
Copy link
Member

@sev- sev- Sep 11, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this removed? Are we keeping Stage color?

Copy link
Contributor Author

@moralrecordings moralrecordings Sep 12, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are; we're just not filling the stage with the clear color when the color itself changes. Before, we'd transition between two movie files and there'd be a cut to a white screen just before the animation.

@moralrecordings moralrecordings changed the title WIP: DIRECTOR: Add debugger DIRECTOR: Transition fixes, palette cycling effects, and debugger Sep 11, 2022
@moralrecordings moralrecordings force-pushed the debugger branch 2 times, most recently from db7e917 to a2a51e2 Compare Sep 11, 2022
engines/director/debugger.cpp Outdated Show resolved Hide resolved
@@ -107,8 +107,8 @@ Channel::~Channel() {

DirectorPlotData Channel::getPlotData() {
DirectorPlotData pd(g_director, _sprite->_spriteType, _sprite->_ink, _sprite->_blend, _sprite->getBackColor(), _sprite->getForeColor());
pd.colorWhite = pd.d->_wm->_colorWhite;
pd.colorBlack = pd.d->_wm->_colorBlack;
pd.colorWhite = 255;
Copy link
Member

@sev- sev- Sep 12, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this change? 255 is not guaranteed to be white.

@sev-
Copy link
Member

sev- commented Sep 12, 2022

Thank you!

@sev- sev- merged commit d3a2931 into scummvm:master Sep 12, 2022
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants