}
}
+int GetDrawtoField(void)
+{
+ return (drawto_field == fieldbuffer ? DRAW_TO_FIELDBUFFER : DRAW_TO_BACKBUFFER);
+}
+
static void RedrawPlayfield_RND(void)
{
if (game.envelope_active)
BackToFront();
}
+static void PrepareEnvelopeRequestToScreen(Bitmap *bitmap, int sx, int sy,
+ int xsize, int ysize)
+{
+ if (!global.use_envelope_request ||
+ request.sort_priority <= 0)
+ return;
+
+ if (request.bitmap == NULL ||
+ xsize > request.xsize ||
+ ysize > request.ysize)
+ {
+ if (request.bitmap != NULL)
+ FreeBitmap(request.bitmap);
+
+ request.bitmap = CreateBitmap(xsize, ysize, DEFAULT_DEPTH);
+
+ SDL_Surface *surface = request.bitmap->surface;
+
+ if ((request.bitmap->surface_masked = SDLGetNativeSurface(surface)) == NULL)
+ Fail("SDLGetNativeSurface() failed");
+ }
+
+ BlitBitmap(bitmap, request.bitmap, sx, sy, xsize, ysize, 0, 0);
+
+ SDLFreeBitmapTextures(request.bitmap);
+ SDLCreateBitmapTextures(request.bitmap);
+
+ // set envelope request run-time values
+ request.sx = sx;
+ request.sy = sy;
+ request.xsize = xsize;
+ request.ysize = ysize;
+}
+
+void DrawEnvelopeRequestToScreen(int drawing_target, int drawing_stage)
+{
+ if (global.use_envelope_request &&
+ game.request_active_or_moving &&
+ request.sort_priority > 0 &&
+ drawing_target == DRAW_TO_SCREEN &&
+ drawing_stage == DRAW_GLOBAL_ANIM_STAGE_2)
+ {
+ BlitToScreen(request.bitmap, 0, 0, request.xsize, request.ysize,
+ request.sx, request.sy);
+ }
+}
+
static void setRequestBasePosition(int *x, int *y)
{
int sx_base, sy_base;
// store readily prepared envelope request for later use when animating
BlitBitmap(backbuffer, bitmap_db_store_2, 0, 0, WIN_XSIZE, WIN_YSIZE, 0, 0);
+ PrepareEnvelopeRequestToScreen(bitmap_db_store_2, sx, sy, width, height);
+
if (text_door_style)
free(text_door_style);
}
}
}
+ PrepareEnvelopeRequestToScreen(backbuffer, dst_x, dst_y, width, height);
+
redraw_mask |= REDRAW_FIELD;
BackToFront();
{
boolean game_just_ended = (game_status == GAME_MODE_PLAYING &&
checkGameEnded());
+ int draw_buffer_last = GetDrawtoField();
int width = request.width;
int height = request.height;
int sx, sy;
while (result < 0)
{
+ boolean event_handled = FALSE;
+
if (game_just_ended)
{
- // the MM game engine does not use a special (scrollable) field buffer
- if (level.game_engine_type != GAME_ENGINE_TYPE_MM)
- SetDrawtoField(DRAW_TO_FIELDBUFFER);
+ SetDrawtoField(draw_buffer_last);
HandleGameActions();
while (NextValidEvent(&event))
{
+ event_handled = TRUE;
+
switch (event.type)
{
case EVENT_BUTTONPRESS:
}
}
- if (game_just_ended)
+ if (event_handled)
{
- if (global.use_envelope_request)
+ if (game_just_ended)
{
- // copy back current state of pressed buttons inside request area
- BlitBitmap(drawto, bitmap_db_store_2, sx, sy, width, height, sx, sy);
+ if (global.use_envelope_request)
+ {
+ // copy back current state of pressed buttons inside request area
+ BlitBitmap(drawto, bitmap_db_store_2, sx, sy, width, height, sx, sy);
+ }
}
+
+ PrepareEnvelopeRequestToScreen(drawto, sx, sy, width, height);
}
BackToFront();
}
+ SetDrawtoField(draw_buffer_last);
+
game.request_active = FALSE;
return result;
boolean overlay_enabled = GetOverlayEnabled();
boolean result;
+ game.request_active_or_moving = TRUE;
+
SetOverlayEnabled(FALSE);
if (global.use_envelope_request)
SetOverlayEnabled(overlay_enabled);
+ game.request_active_or_moving = FALSE;
+
return result;
}
boolean any_player_dropping)
{
if (tape.single_step && tape.recording && !tape.pausing)
- if (frame == 7 && !any_player_dropping)
+ if (frame == 7 && !any_player_dropping && FrameCounter > 6)
TapeTogglePause(TAPE_TOGGLE_AUTOMATIC);
CheckSaveEngineSnapshot_EM(action, frame, any_player_moving,