int anim_delay_counter;
int post_delay_counter;
+ int fade_delay_counter;
+ int fade_alpha;
+
boolean init_event_state;
boolean anim_event_state;
Bitmap *fade_bitmap =
(drawing_target == DRAW_TO_FADE_SOURCE ? gfx.fade_bitmap_source :
drawing_target == DRAW_TO_FADE_TARGET ? gfx.fade_bitmap_target : NULL);
+ int alpha = (c->fade_mode & FADE_MODE_FADE ? part->fade_alpha : g->alpha);
int x, y;
for (y = 0; y < c->stacked_yfactor; y++)
dst_x += part->viewport_x;
dst_y += part->viewport_y;
- SetBitmapAlphaNextBlit(src_bitmap, g->alpha);
+ SetBitmapAlphaNextBlit(src_bitmap, alpha);
if (drawing_target == DRAW_TO_SCREEN)
blit_screen(src_bitmap, src_x, src_y, width, height,
struct GraphicInfo *g = &part->graphic_info;
struct GraphicInfo *c = &part->control_info;
boolean viewport_changed = SetGlobalAnimPart_Viewport(part);
+ int alpha = (g->alpha != -1 ? g->alpha : SDL_ALPHA_OPAQUE);
// if game is paused, also pause playfield and door animations
if (isPausedOnPlayfieldOrDoor(part))
if (part->anim_random_frame == -1)
part->anim_random_frame = GetSimpleRandom(g->anim_frames);
+ if (c->fade_mode & FADE_MODE_FADE)
+ {
+ // when fading in screen, first frame is 100 % transparent or opaque
+ part->fade_delay_counter = c->fade_delay + 1;
+ part->fade_alpha = (c->fade_mode == FADE_MODE_FADE_IN ? 0 : alpha);
+ }
+ else
+ {
+ part->fade_delay_counter = 0;
+ part->fade_alpha = -1;
+ }
+
if (c->direction & MV_HORIZONTAL)
{
int pos_bottom = part->viewport_height - g->height;
return ANIM_STATE_WAITING;
}
+ if (part->fade_delay_counter > 0)
+ {
+ part->fade_delay_counter--;
+ part->fade_alpha = alpha * (c->fade_mode == FADE_MODE_FADE_IN ?
+ c->fade_delay - part->fade_delay_counter :
+ part->fade_delay_counter) / c->fade_delay;
+ }
+
// special case to prevent expiring loop sounds when playing
PlayGlobalAnimSoundIfLoop(part);
{
result = (string_has_parameter(value, "none") ? FADE_MODE_NONE :
string_has_parameter(value, "fade") ? FADE_MODE_FADE :
+ string_has_parameter(value, "fade_in") ? FADE_MODE_FADE_IN :
+ string_has_parameter(value, "fade_out") ? FADE_MODE_FADE_OUT :
string_has_parameter(value, "crossfade") ? FADE_MODE_CROSSFADE :
string_has_parameter(value, "melt") ? FADE_MODE_MELT :
string_has_parameter(value, "curtain") ? FADE_MODE_CURTAIN :