Skip to content

Commit

Permalink
Engine: fixed Dissolve transition
Browse files Browse the repository at this point in the history
Was broken by 33a7a29, because I did not correctly understood uses of this DDB.
  • Loading branch information
ivan-mogilko committed Jan 6, 2024
1 parent a37d8cc commit 55f1d03
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
7 changes: 5 additions & 2 deletions Engine/ac/event.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,10 @@ void process_event(const EventHappened *evp) {
if (game.color_depth == 1)
quit("!Cannot use crossfade screen transition in 256-colour games");

IDriverDependantBitmap *ddb = prepare_screen_for_transition_in();
// TODO: crossfade does not need a screen with transparency, it should be opaque;
// but Software renderer cannot alpha-blend non-masked sprite at the moment,
// see comment to drawing opaque sprite in SDLRendererGraphicsDriver!
IDriverDependantBitmap *ddb = prepare_screen_for_transition_in(false /* transparent */);
for (int alpha = 254; alpha > 0; alpha -= 16)
{
// do the crossfade
Expand Down Expand Up @@ -321,7 +324,7 @@ void process_event(const EventHappened *evp) {
int aa,bb,cc;
RGB interpal[256];

IDriverDependantBitmap *ddb = prepare_screen_for_transition_in();
IDriverDependantBitmap *ddb = prepare_screen_for_transition_in(false /* transparent */);
for (aa=0;aa<16;aa++) {
// merge the palette while dithering
if (game.color_depth == 1)
Expand Down
4 changes: 2 additions & 2 deletions Engine/ac/screen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ void current_fade_out_effect () {
}
}

IDriverDependantBitmap* prepare_screen_for_transition_in()
IDriverDependantBitmap* prepare_screen_for_transition_in(bool opaque)
{
if (saved_viewport_bitmap == nullptr)
quit("Crossfade: buffer is null attempting transition");
Expand All @@ -107,7 +107,7 @@ IDriverDependantBitmap* prepare_screen_for_transition_in()
delete saved_viewport_bitmap;
saved_viewport_bitmap = clippedBuffer;
}
return gfxDriver->CreateDDBFromBitmap(saved_viewport_bitmap, false, true);
return gfxDriver->CreateDDBFromBitmap(saved_viewport_bitmap, false, opaque);
}

//=============================================================================
Expand Down
2 changes: 1 addition & 1 deletion Engine/ac/screen.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ namespace AGS { namespace Engine { class IDriverDependantBitmap; } }
void fadein_impl(PALETTE p, int speed);
void fadeout_impl(int spdd);
void current_fade_out_effect ();
AGS::Engine::IDriverDependantBitmap* prepare_screen_for_transition_in();
AGS::Engine::IDriverDependantBitmap* prepare_screen_for_transition_in(bool opaque);

// Screenshot made in the last room, used during some of the transition effects
extern AGS::Common::Bitmap *saved_viewport_bitmap;
Expand Down

0 comments on commit 55f1d03

Please sign in to comment.