#define ED_ELEMENTLIST_YPOS (editor.palette.y)
#define ED_ELEMENTLIST_XSIZE (graphic_info[IMG_EDITOR_PALETTE_BUTTON].width)
#define ED_ELEMENTLIST_YSIZE (graphic_info[IMG_EDITOR_PALETTE_BUTTON].height)
-#define ED_ELEMENTLIST_BUTTONS_HORIZ (editor.palette.cols)
-#define ED_ELEMENTLIST_BUTTONS_VERT (editor.palette.rows)
+#define ED_ELEMENTLIST_COLS MAX(1, editor.palette.cols)
+#define ED_ELEMENTLIST_ROWS MAX(1, editor.palette.rows)
+#define ED_ELEMENTLIST_BUTTONS_HORIZ (ED_ELEMENTLIST_COLS)
+#define ED_ELEMENTLIST_BUTTONS_VERT (ED_ELEMENTLIST_ROWS)
#define ED_NUM_ELEMENTLIST_BUTTONS (ED_ELEMENTLIST_BUTTONS_HORIZ * \
ED_ELEMENTLIST_BUTTONS_VERT)
{
// required for correct padding of palette headline buttons
if (*editor_elements_info[i].headline_list_size > 0)
- num_editor_elements += editor.palette.cols;
+ num_editor_elements += ED_ELEMENTLIST_COLS;
for (j = 0; j < *editor_elements_info[i].headline_list_size; j++)
{
// required for correct padding of palette element buttons
int element_list_size = *editor_elements_info[i].element_list_size;
int element_rows =
- (element_list_size + editor.palette.cols - 1) / editor.palette.cols;
- int element_buttons = editor.palette.cols * element_rows;
+ (element_list_size + ED_ELEMENTLIST_COLS - 1) / ED_ELEMENTLIST_COLS;
+ int element_buttons = ED_ELEMENTLIST_COLS * element_rows;
num_editor_elements += element_buttons;
}
{
// required for correct padding of palette headline buttons
int headline_size = (*editor_elements_info[i].headline_list_size > 0 ?
- editor.palette.cols : 0);
+ ED_ELEMENTLIST_COLS : 0);
for (j = 0; j < headline_size; j++)
{
// required for correct padding of palette element buttons
int element_list_size = *editor_elements_info[i].element_list_size;
int element_rows =
- (element_list_size + editor.palette.cols - 1) / editor.palette.cols;
- int element_buttons = editor.palette.cols * element_rows;
+ (element_list_size + ED_ELEMENTLIST_COLS - 1) / ED_ELEMENTLIST_COLS;
+ int element_buttons = ED_ELEMENTLIST_COLS * element_rows;
// copy all elements from element list
for (j = 0; j < element_list_size; j++)
return (door_1_viewport_unchanged && door_1_contains_toolbox);
}
+static void DrawEditorDoorBackground(int graphic, int x, int y,
+ int width, int height)
+{
+ struct GraphicInfo *g = &graphic_info[graphic];
+
+ if (g->bitmap != NULL)
+ BlitBitmap(g->bitmap, drawto, g->src_x, g->src_y,
+ MIN(width, g->width), MIN(height, g->height), x, y);
+ else
+ ClearRectangle(drawto, x, y, width, height);
+}
+
static void DrawEditorDoorContent(void)
{
// needed for gadgets drawn on background (like palette scrollbar)
SetDoorBackgroundImage(IMG_UNDEFINED);
// copy default editor door content to main double buffer
- BlitBitmap(graphic_info[IMG_BACKGROUND_PALETTE].bitmap, drawto,
- graphic_info[IMG_BACKGROUND_PALETTE].src_x,
- graphic_info[IMG_BACKGROUND_PALETTE].src_y,
- MIN(DXSIZE, graphic_info[IMG_BACKGROUND_PALETTE].width),
- MIN(DYSIZE, graphic_info[IMG_BACKGROUND_PALETTE].height),
- DX, DY);
+ DrawEditorDoorBackground(IMG_BACKGROUND_PALETTE, DX, DY, DXSIZE, DYSIZE);
// draw bigger door
DrawSpecialEditorDoor();
// draw new control window
- BlitBitmap(graphic_info[IMG_BACKGROUND_TOOLBOX].bitmap, drawto,
- graphic_info[IMG_BACKGROUND_TOOLBOX].src_x,
- graphic_info[IMG_BACKGROUND_TOOLBOX].src_y,
- MIN(EXSIZE, graphic_info[IMG_BACKGROUND_TOOLBOX].width),
- MIN(EYSIZE, graphic_info[IMG_BACKGROUND_TOOLBOX].height),
- EX, EY);
+ DrawEditorDoorBackground(IMG_BACKGROUND_TOOLBOX, EX, EY, EXSIZE, EYSIZE);
// draw all toolbox gadgets to editor doors
MapControlButtons();
FadeSoundsAndMusic();
- if (CheckIfGlobalBorderOrPlayfieldViewportHasChanged())
+ if (CheckFadeAll())
fade_mask = REDRAW_ALL;
FadeOut(fade_mask);