2014-11-02
* fixed bug with not updating default bitmap pointer for scaled images
+ * fixed redraw/fade bugs when redefining the playfield size or position
2014-10-27
* fixed some smaller issues with loading custom artwork
-#define COMPILE_DATE_STRING "2014-10-27 21:31"
+#define COMPILE_DATE_STRING "2014-11-02 01:32"
void DrawLevelEd()
{
- int old_sx = SX;
- int old_sy = SY;
- int old_sxsize = SXSIZE;
- int old_sysize = SYSIZE;
-
StopAnimation();
CloseDoor(DOOR_CLOSE_ALL);
/* needed if different viewport properties defined for editor */
ChangeViewportPropertiesIfNeeded();
- if (old_sx != SX ||
- old_sy != SY ||
- old_sxsize != SXSIZE ||
- old_sysize != SYSIZE)
- playfield_area_changed = TRUE;
- else
- playfield_area_changed = FALSE;
+ playfield_area_changed = DrawingAreaChanged();
OpenDoor(DOOR_OPEN_1 | DOOR_OPEN_2 | DOOR_NO_DELAY);
BlitBitmap(graphic_info[IMG_GLOBAL_DOOR].bitmap, drawto,
DOOR_GFX_PAGEX8, 236, EXSIZE, EYSIZE, EX, EY);
- redraw_mask |= REDRAW_ALL;
+ // redraw_mask |= REDRAW_ALL;
FreeLevelEditorGadgets();
CreateLevelEditorGadgets();
/* needed before playing if editor playfield area has different size */
ClearRectangle(drawto, REAL_SX, REAL_SY, FULL_SXSIZE, FULL_SYSIZE);
- redraw_mask = REDRAW_ALL;
+ // redraw_mask = REDRAW_ALL;
level_editor_test_game = TRUE;
FadeIn(REDRAW_FIELD);
+#if 1
+ // full screen redraw is required at this point in the following cases:
+ // - special editor door undrawn when game was started from level editor
+ // - drawing area (playfield) was changed and has to be removed completely
+ redraw_mask = REDRAW_ALL;
+ BackToFront();
+#endif
+
if (!game.restart_level)
{
/* copy default game door content to main double buffer */
gfx.field_save_buffer = field_save_buffer;
+ gfx.drawing_area_changed = FALSE;
+
SetDrawDeactivationMask(REDRAW_NONE); /* do not deactivate drawing */
SetDrawBackgroundMask(REDRAW_NONE); /* deactivate masked drawing */
}
CheckDrawingArea(x, y, 1, 1, gfx.draw_background_mask));
}
+boolean DrawingAreaChanged()
+{
+ int drawing_area_changed = gfx.drawing_area_changed;
+
+ // reset flag for change of drawing area after querying it
+ gfx.drawing_area_changed = FALSE;
+
+ return drawing_area_changed;
+}
+
static boolean InClippedRectangle(Bitmap *bitmap, int *x, int *y,
int *width, int *height, boolean is_dest)
{
int draw_deactivation_mask;
int draw_background_mask;
+ boolean drawing_area_changed;
+
Bitmap *field_save_buffer;
Bitmap *background_bitmap;
void ClearRectangleOnBackground(Bitmap *, int, int, int, int);
void BlitBitmapMasked(Bitmap *, Bitmap *, int, int, int, int, int, int);
boolean DrawingOnBackground(int, int);
+boolean DrawingAreaChanged();
void BlitBitmapOnBackground(Bitmap *, Bitmap *, int, int, int, int, int, int);
void DrawSimpleBlackLine(Bitmap *, int, int, int, int);
void DrawSimpleWhiteLine(Bitmap *, int, int, int, int);
KeyboardAutoRepeatOn();
ActivateJoystick();
- SetDrawDeactivationMask(REDRAW_NONE);
- SetDrawBackgroundMask(REDRAW_FIELD);
-
audio.sound_deactivated = FALSE;
GetPlayerConfig();
LoadLevel(level_nr);
LoadScore(level_nr);
+ // set this after "ChangeViewportPropertiesIfNeeded()" (which may reset it)
+ SetDrawDeactivationMask(REDRAW_NONE);
+ SetDrawBackgroundMask(REDRAW_FIELD);
+
SetMainBackgroundImage(IMG_BACKGROUND_MAIN);
if (fade_mask == REDRAW_ALL)
static void DrawChooseTree(TreeInfo **ti_ptr)
{
+ int fade_mask = (DrawingAreaChanged() ? REDRAW_ALL : REDRAW_FIELD);
+
UnmapAllGadgets();
FreeScreenGadgets();
CloseDoor(DOOR_CLOSE_2);
- FadeOut(REDRAW_FIELD);
+ FadeOut(fade_mask);
ClearField();
HandleChooseTree(0, 0, 0, 0, MB_MENU_INITIALIZE, ti_ptr);
MapScreenTreeGadgets(*ti_ptr);
- FadeIn(REDRAW_FIELD);
+ FadeIn(fade_mask);
InitAnimation();
}
void DrawHallOfFame(int highlight_position)
{
+ int fade_mask = (DrawingAreaChanged() ? REDRAW_ALL : REDRAW_FIELD);
+
UnmapAllGadgets();
FadeSoundsAndMusic();
FadeSetEnterScreen();
- FadeOut(REDRAW_FIELD);
+ FadeOut(fade_mask);
InitAnimation();
HandleHallOfFame(highlight_position, 0, 0, 0, MB_MENU_INITIALIZE);
- FadeIn(REDRAW_FIELD);
+ FadeIn(fade_mask);
}
static void drawHallOfFameList(int first_entry, int highlight_position)
static void DrawSetupScreen_Generic()
{
+ int fade_mask = (DrawingAreaChanged() ? REDRAW_ALL : REDRAW_FIELD);
boolean redraw_all = FALSE;
char *title_string = NULL;
int i;
if (redraw_mask & REDRAW_ALL)
redraw_all = TRUE;
- FadeOut(REDRAW_FIELD);
+ FadeOut(fade_mask);
ClearField();
MapScreenGadgets(max_setup_info);
if (redraw_all)
- redraw_mask = REDRAW_ALL;
+ redraw_mask = fade_mask = REDRAW_ALL;
- FadeIn(redraw_mask);
+ FadeIn(fade_mask);
InitAnimation();
}
int vy = VY - outer_border;
int exsize = EXSIZE + 2 * outer_border;
- CloseDoor(DOOR_CLOSE_2);
-
/* draw bigger level editor toolbox window */
BlitBitmap(gfx1->bitmap, drawto, gfx1->src_x, gfx1->src_y,
top_border_width, top_border_height, ex, ey - top_border_height);
boolean init_video_buffer = FALSE;
boolean init_gadgets_and_toons = FALSE;
boolean init_em_graphics = FALSE;
+ boolean drawing_area_changed = FALSE;
if (viewport.window.width != WIN_XSIZE ||
viewport.window.height != WIN_YSIZE)
init_em_graphics = TRUE;
}
+ if (new_sx != SX ||
+ new_sy != SY ||
+ new_sxsize != SXSIZE ||
+ new_sysize != SYSIZE ||
+ new_real_sx != REAL_SX ||
+ new_real_sy != REAL_SY ||
+ new_full_sxsize != FULL_SXSIZE ||
+ new_full_sysize != FULL_SYSIZE)
+ {
+ if (!init_video_buffer)
+ drawing_area_changed = TRUE;
+ }
+
SX = new_sx;
SY = new_sy;
DX = new_dx;
SCR_FIELDX = new_scr_fieldx;
SCR_FIELDY = new_scr_fieldy;
+
+ gfx.drawing_area_changed = drawing_area_changed;
+
+ SetDrawDeactivationMask(REDRAW_NONE);
+ SetDrawBackgroundMask(REDRAW_FIELD);
}
if (init_video_buffer)
// printf("::: init_video_buffer\n");
InitVideoBuffer(WIN_XSIZE, WIN_YSIZE, DEFAULT_DEPTH, setup.fullscreen);
-
- SetDrawDeactivationMask(REDRAW_NONE);
- SetDrawBackgroundMask(REDRAW_FIELD);
}
if (init_gadgets_and_toons)