#include "cartoons.h"
#include "network.h"
#include "tape.h"
+#include "screens.h"
/* select level set with EMC X11 graphics before activating EM GFX debugging */
void DrawMaskedBorder(int redraw_mask)
{
+ /* do not draw masked screen borders when displaying title screens */
+ if (effectiveGameStatus() == GAME_MODE_TITLE ||
+ effectiveGameStatus() == GAME_MODE_MESSAGE)
+ return;
+
if (redraw_mask & REDRAW_ALL)
DrawMaskedBorder_ALL();
else
if (redraw_mask & REDRAW_TILES &&
game_status == GAME_MODE_PLAYING &&
- border.draw_masked[game_status])
+ border.draw_masked[GAME_MODE_PLAYING])
redraw_mask |= REDRAW_FIELD;
if (global.fps_slowdown && game_status == GAME_MODE_PLAYING)
SyncDisplay();
-#if 1
- DrawMaskedBorder(redraw_mask);
-#endif
+ /* prevent drawing masked border to backbuffer when using playfield buffer */
+ if (game_status != GAME_MODE_PLAYING ||
+ redraw_mask & REDRAW_FROM_BACKBUFFER ||
+ buffer == backbuffer)
+ DrawMaskedBorder(redraw_mask);
+ else
+ DrawMaskedBorder(redraw_mask & REDRAW_DOORS);
if (redraw_mask & REDRAW_ALL)
{
-#if 0
- DrawMaskedBorder(REDRAW_ALL);
-#endif
BlitBitmap(backbuffer, window, 0, 0, WIN_XSIZE, WIN_YSIZE, 0, 0);
redraw_mask = REDRAW_NONE;
if (game_status != GAME_MODE_PLAYING ||
redraw_mask & REDRAW_FROM_BACKBUFFER)
{
-#if 0
- DrawMaskedBorder(REDRAW_FIELD);
-#endif
BlitBitmap(backbuffer, window,
REAL_SX, REAL_SY, FULL_SXSIZE, FULL_SYSIZE, REAL_SX, REAL_SY);
}
ABS(ScreenMovPos) == ScrollStepSize ||
redraw_tiles > REDRAWTILES_THRESHOLD)
{
-#if 1
- if (border.draw_masked[GFX_SPECIAL_ARG_MAIN])
+ if (border.draw_masked[GAME_MODE_PLAYING])
{
- BlitBitmap(buffer, backbuffer, fx, fy, SXSIZE, SYSIZE, SX, SY);
+ if (buffer != backbuffer)
+ {
+ /* copy playfield buffer to backbuffer to add masked border */
+ BlitBitmap(buffer, backbuffer, fx, fy, SXSIZE, SYSIZE, SX, SY);
+ DrawMaskedBorder(REDRAW_FIELD);
+ }
- DrawMaskedBorder(REDRAW_FIELD);
BlitBitmap(backbuffer, window,
REAL_SX, REAL_SY, FULL_SXSIZE, FULL_SYSIZE,
REAL_SX, REAL_SY);
}
else
+ {
BlitBitmap(buffer, window, fx, fy, SXSIZE, SYSIZE, SX, SY);
-#else
- BlitBitmap(buffer, window, fx, fy, SXSIZE, SYSIZE, SX, SY);
-#endif
+ }
#if 0
#ifdef DEBUG
if (redraw_mask & REDRAW_DOORS)
{
if (redraw_mask & REDRAW_DOOR_1)
- {
-#if 0
- DrawMaskedBorder(REDRAW_DOOR_1);
-#endif
BlitBitmap(backbuffer, window, DX, DY, DXSIZE, DYSIZE, DX, DY);
- }
if (redraw_mask & REDRAW_DOOR_2)
- {
-#if 0
- DrawMaskedBorder(REDRAW_DOOR_2);
-#endif
BlitBitmap(backbuffer, window, VX, VY, VXSIZE, VYSIZE, VX, VY);
- }
if (redraw_mask & REDRAW_DOOR_3)
- {
-#if 0
- DrawMaskedBorder(REDRAW_DOOR_3);
-#endif
BlitBitmap(backbuffer, window, EX, EY, EXSIZE, EYSIZE, EX, EY);
- }
redraw_mask &= ~REDRAW_DOORS;
}
{
void (*draw_border_function)(void) = NULL;
Bitmap *bitmap = (fade_mode == FADE_MODE_CROSSFADE ? bitmap_db_cross : NULL);
- int fade_delay = menu.fade_delay;
- int post_delay = (fade_mode == FADE_MODE_FADE_OUT ? menu.post_delay : 0);
int x, y, width, height;
+ int fade_delay, post_delay;
if (fade_mask & REDRAW_FIELD)
{
width = FULL_SXSIZE;
height = FULL_SYSIZE;
+ fade_delay = menu.fade_delay;
+ post_delay = (fade_mode == FADE_MODE_FADE_OUT ? menu.post_delay : 0);
+
draw_border_function = DrawMaskedBorder_FIELD;
}
else /* REDRAW_ALL */
y = 0;
width = WIN_XSIZE;
height = WIN_YSIZE;
+
+ fade_delay = title.fade_delay_final;
+ post_delay = (fade_mode == FADE_MODE_FADE_OUT ? title.post_delay_final : 0);
}
redraw_mask |= fade_mask;
BlitBitmap(backbuffer, bitmap_db_cross, 0, 0, WIN_XSIZE, WIN_YSIZE, 0, 0);
}
+void SetWindowBackgroundImageIfDefined(int graphic)
+{
+ if (graphic_info[graphic].bitmap)
+ SetWindowBackgroundBitmap(graphic_info[graphic].bitmap);
+}
+
void SetMainBackgroundImageIfDefined(int graphic)
{
if (graphic_info[graphic].bitmap)
- SetMainBackgroundImage(graphic);
+ SetMainBackgroundBitmap(graphic_info[graphic].bitmap);
}
void SetMainBackgroundImage(int graphic)
SetDoorBackgroundBitmap(bitmap_db_panel);
}
-void DrawBackground(int dst_x, int dst_y, int width, int height)
+void DrawBackground(int x, int y, int width, int height)
{
-#if 1
- ClearRectangleOnBackground(drawto, dst_x, dst_y, width, height);
+ /* !!! "drawto" might still point to playfield buffer here (see below) !!! */
+ /* (when entering hall of fame after playing) */
+#if 0
+ ClearRectangleOnBackground(drawto, x, y, width, height);
#else
- ClearRectangleOnBackground(backbuffer, dst_x, dst_y, width, height);
+ ClearRectangleOnBackground(backbuffer, x, y, width, height);
#endif
redraw_mask |= REDRAW_FIELD;
}
+void DrawBackgroundForFont(int x, int y, int width, int height, int font_nr)
+{
+ struct FontBitmapInfo *font = getFontBitmapInfo(font_nr);
+
+ if (font->bitmap == NULL)
+ return;
+
+ DrawBackground(x, y, width, height);
+}
+
+void DrawBackgroundForGraphic(int x, int y, int width, int height, int graphic)
+{
+ struct GraphicInfo *g = &graphic_info[graphic];
+
+ if (g->bitmap == NULL)
+ return;
+
+ DrawBackground(x, y, width, height);
+}
+
void ClearWindow()
{
+ /* !!! "drawto" might still point to playfield buffer here (see above) !!! */
+ /* (when entering hall of fame after playing) */
DrawBackground(REAL_SX, REAL_SY, FULL_SXSIZE, FULL_SYSIZE);
+ /* !!! maybe this should be done before clearing the background !!! */
if (setup.soft_scrolling && game_status == GAME_MODE_PLAYING)
{
ClearRectangle(fieldbuffer, 0, 0, FXSIZE, FYSIZE);
if (music == MUS_UNDEFINED)
return;
+ if (!setup.sound_music)
+ return;
+
PlayMusic(music);
}
+void PlaySoundActivating()
+{
+#if 0
+ PlaySound(SND_MENU_ITEM_ACTIVATING);
+#endif
+}
+
+void PlaySoundSelecting()
+{
+#if 0
+ PlaySound(SND_MENU_ITEM_SELECTING);
+#endif
+}
+
void ToggleFullscreenIfNeeded()
{
boolean change_fullscreen = (setup.fullscreen !=