X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Feditor.c;h=1b8f0c4bedaaeb42744e70ac82f311e5b189d3fb;hb=14b5ed161164a42c7513700fe101c4bd2e3b63e3;hp=9d5c42d2b9dd19ed3084ab734c5fa3e690158246;hpb=d442dd6ca65b694c37fbd3c93505644fe8478263;p=rocksndiamonds.git diff --git a/src/editor.c b/src/editor.c index 9d5c42d2..1b8f0c4b 100644 --- a/src/editor.c +++ b/src/editor.c @@ -34,12 +34,21 @@ */ /* positions in the level editor */ +#if 1 +#define ED_WIN_MB_LEFT_XPOS (editor.element_left.x) +#define ED_WIN_MB_LEFT_YPOS (editor.element_left.y) +#define ED_WIN_MB_MIDDLE_XPOS (editor.element_middle.x) +#define ED_WIN_MB_MIDDLE_YPOS (editor.element_middle.y) +#define ED_WIN_MB_RIGHT_XPOS (editor.element_right.x) +#define ED_WIN_MB_RIGHT_YPOS (editor.element_right.y) +#else #define ED_WIN_MB_LEFT_XPOS 6 #define ED_WIN_MB_LEFT_YPOS 258 #define ED_WIN_MB_MIDDLE_XPOS 42 #define ED_WIN_MB_MIDDLE_YPOS ED_WIN_MB_LEFT_YPOS #define ED_WIN_MB_RIGHT_XPOS 78 #define ED_WIN_MB_RIGHT_YPOS ED_WIN_MB_LEFT_YPOS +#endif /* values for the control window */ #define ED_CTRL_NO_BUTTONS_GFX_XPOS 6 @@ -90,12 +99,21 @@ ED_NUM_CTRL4_BUTTONS) /* values for the element list */ +#if 1 +#define ED_ELEMENTLIST_XPOS (editor.palette.x) +#define ED_ELEMENTLIST_YPOS (editor.palette.y) +#else #define ED_ELEMENTLIST_XPOS 5 #define ED_ELEMENTLIST_YPOS 30 +#endif #define ED_ELEMENTLIST_XSIZE 20 #define ED_ELEMENTLIST_YSIZE 20 #define ED_ELEMENTLIST_BUTTONS_HORIZ 4 +#if 1 +#define ED_ELEMENTLIST_BUTTONS_VERT 9 +#else #define ED_ELEMENTLIST_BUTTONS_VERT 11 +#endif #define ED_NUM_ELEMENTLIST_BUTTONS (ED_ELEMENTLIST_BUTTONS_HORIZ * \ ED_ELEMENTLIST_BUTTONS_VERT) @@ -971,8 +989,13 @@ #define RANDOM_USE_QUANTITY 1 /* maximal size of level editor drawing area */ +#if NEW_TILESIZE +#define MAX_ED_FIELDX (SCR_FIELDX) +#define MAX_ED_FIELDY (SCR_FIELDY - 1) +#else #define MAX_ED_FIELDX (2 * SCR_FIELDX) #define MAX_ED_FIELDY (2 * SCR_FIELDY - 1) +#endif /* @@ -1047,7 +1070,11 @@ static struct /* ---------- current level number --------------------------------------- */ { +#if 1 + -1, -1, /* these values are not constant, but can change at runtime */ +#else DX + 5 - SX, DY + 3 - SY, +#endif 1, 100, GADGET_ID_SELECT_LEVEL_DOWN, GADGET_ID_SELECT_LEVEL_UP, GADGET_ID_SELECT_LEVEL_TEXT, GADGET_ID_NONE, @@ -2474,25 +2501,41 @@ static struct { { ED_SCROLLBUTTON_XPOS, ED_SCROLLBUTTON_YPOS + 0 * ED_SCROLLBUTTON_YSIZE, +#if 1 + -1, -1, /* these values are not constant, but can change at runtime */ +#else ED_SCROLL_UP_XPOS, ED_SCROLL_UP_YPOS, +#endif GADGET_ID_SCROLL_UP, "scroll level editing area up" }, { ED_SCROLLBUTTON_XPOS, ED_SCROLLBUTTON_YPOS + 1 * ED_SCROLLBUTTON_YSIZE, +#if 1 + -1, -1, /* these values are not constant, but can change at runtime */ +#else ED_SCROLL_DOWN_XPOS, ED_SCROLL_DOWN_YPOS, +#endif GADGET_ID_SCROLL_DOWN, "scroll level editing area down" }, { ED_SCROLLBUTTON_XPOS, ED_SCROLLBUTTON_YPOS + 2 * ED_SCROLLBUTTON_YSIZE, +#if 1 + -1, -1, /* these values are not constant, but can change at runtime */ +#else ED_SCROLL_LEFT_XPOS, ED_SCROLL_LEFT_YPOS, +#endif GADGET_ID_SCROLL_LEFT, "scroll level editing area left" }, { ED_SCROLLBUTTON_XPOS, ED_SCROLLBUTTON_YPOS + 3 * ED_SCROLLBUTTON_YSIZE, +#if 1 + -1, -1, /* these values are not constant, but can change at runtime */ +#else ED_SCROLL_RIGHT_XPOS, ED_SCROLL_RIGHT_YPOS, +#endif GADGET_ID_SCROLL_RIGHT, "scroll level editing area right" }, @@ -2524,14 +2567,16 @@ static struct { { ED_SCROLLBAR_XPOS, ED_SCROLLBAR_YPOS, +#if 1 + -1, -1, /* these values are not constant, but can change at runtime */ + -1, -1, /* these values are not constant, but can change at runtime */ + -1, -1, /* these values are not constant, but can change at runtime */ + -1, -1, /* these values are not constant, but can change at runtime */ +#else SX + ED_SCROLL_HORIZONTAL_XPOS, SY + ED_SCROLL_HORIZONTAL_YPOS, ED_SCROLL_HORIZONTAL_XSIZE, ED_SCROLL_HORIZONTAL_YSIZE, -#if 1 SX, SY, SXSIZE, SYSIZE, -#else - 0, 0, - SX + SXSIZE + SX, WIN_YSIZE, #endif GD_TYPE_SCROLLBAR_HORIZONTAL, GADGET_ID_SCROLL_HORIZONTAL, @@ -2539,14 +2584,16 @@ static struct }, { ED_SCROLLBAR_XPOS, ED_SCROLLBAR_YPOS, +#if 1 + -1, -1, /* these values are not constant, but can change at runtime */ + -1, -1, /* these values are not constant, but can change at runtime */ + -1, -1, /* these values are not constant, but can change at runtime */ + -1, -1, /* these values are not constant, but can change at runtime */ +#else SX + ED_SCROLL_VERTICAL_XPOS, SY + ED_SCROLL_VERTICAL_YPOS, ED_SCROLL_VERTICAL_XSIZE, ED_SCROLL_VERTICAL_YSIZE, -#if 1 SX, SY, SXSIZE, SYSIZE, -#else - 0, 0, - SX + SXSIZE + SX, WIN_YSIZE, #endif GD_TYPE_SCROLLBAR_VERTICAL, GADGET_ID_SCROLL_VERTICAL, @@ -2554,14 +2601,16 @@ static struct }, { ED_SCROLLBAR2_XPOS, ED_SCROLLBAR2_YPOS, +#if 1 + -1, -1, /* these values are not constant, but can change at runtime */ + ED_SCROLL2_VERTICAL_XSIZE, ED_SCROLL2_VERTICAL_YSIZE, + -1, -1, /* these values are not constant, but can change at runtime */ + -1, -1, /* these values are not constant, but can change at runtime */ +#else DX + ED_SCROLL2_VERTICAL_XPOS, DY + ED_SCROLL2_VERTICAL_YPOS, ED_SCROLL2_VERTICAL_XSIZE, ED_SCROLL2_VERTICAL_YSIZE, -#if 1 DX, DY, DXSIZE, DYSIZE, -#else - SX + SXSIZE + SX, 0, - WIN_XSIZE - (SX + SXSIZE + SX), WIN_YSIZE, #endif GD_TYPE_SCROLLBAR_VERTICAL, GADGET_ID_SCROLL_LIST_VERTICAL, @@ -2685,7 +2734,7 @@ static struct GADGET_ID_CONTINUOUS_SNAPPING, GADGET_ID_NONE, &level.continuous_snapping, NULL, - "continuos snapping", "use snapping without releasing key" + "continuous snapping", "use snapping without releasing key" }, { ED_ELEMENT_SETTINGS_XPOS(0), ED_ELEMENT_SETTINGS_YPOS(7), @@ -3007,7 +3056,12 @@ static struct { 0, 0, GADGET_ID_DRAWING_LEVEL, GADGET_ID_NONE, - NULL, MAX_ED_FIELDX, MAX_ED_FIELDY, + NULL, +#if 1 + -1, -1, /* these values are not constant, but can change at runtime */ +#else + MAX_ED_FIELDX, MAX_ED_FIELDY, +#endif NULL, NULL, NULL, NULL }, @@ -3269,7 +3323,11 @@ static struct */ /* actual size of level editor drawing area */ +#if 1 +static int ed_fieldx, ed_fieldy; +#else static int ed_fieldx = MAX_ED_FIELDX - 1, ed_fieldy = MAX_ED_FIELDY - 1; +#endif /* actual position of level editor drawing area in level playfield */ static int level_xpos = -1, level_ypos = -1; @@ -5109,7 +5167,7 @@ static void DrawElementBorder(int dest_x, int dest_y, int width, int height, int by2 = TILEY - by; int i; - getGraphicSource(border_graphic, 0, &src_bitmap, &src_x, &src_y); + getFixedGraphicSource(border_graphic, 0, &src_bitmap, &src_x, &src_y); BlitBitmap(src_bitmap, drawto, src_x, src_y, bx, by, dest_x - bx, dest_y - by); @@ -5158,38 +5216,10 @@ static void DrawDrawingArea(int id) static void ScrollMiniLevel(int from_x, int from_y, int scroll) { -#if 0 - /* (directly solved in BlitBitmap() now) */ - static Bitmap *tmp_backbuffer = NULL; -#endif int x, y; int dx = (scroll == ED_SCROLL_LEFT ? -1 : scroll == ED_SCROLL_RIGHT ? 1 : 0); int dy = (scroll == ED_SCROLL_UP ? -1 : scroll == ED_SCROLL_DOWN ? 1 : 0); -#if 0 - /* (directly solved in BlitBitmap() now) */ - if (tmp_backbuffer == NULL) - tmp_backbuffer = CreateBitmap(WIN_XSIZE, WIN_YSIZE, DEFAULT_DEPTH); - - /* needed when blitting directly to same bitmap -- should not be needed with - recent SDL libraries, but apparently does not work in 1.2.11 directly */ - BlitBitmap(drawto, tmp_backbuffer, - SX + (dx == -1 ? MINI_TILEX : 0), - SY + (dy == -1 ? MINI_TILEY : 0), - (ed_fieldx * MINI_TILEX) - (dx != 0 ? MINI_TILEX : 0), - (ed_fieldy * MINI_TILEY) - (dy != 0 ? MINI_TILEY : 0), - SX + (dx == +1 ? MINI_TILEX : 0), - SY + (dy == +1 ? MINI_TILEY : 0)); - BlitBitmap(tmp_backbuffer, drawto, - SX + (dx == +1 ? MINI_TILEX : 0), - SY + (dy == +1 ? MINI_TILEY : 0), - (ed_fieldx * MINI_TILEX) - (dx != 0 ? MINI_TILEX : 0), - (ed_fieldy * MINI_TILEY) - (dy != 0 ? MINI_TILEY : 0), - SX + (dx == +1 ? MINI_TILEX : 0), - SY + (dy == +1 ? MINI_TILEY : 0)); - -#else - BlitBitmap(drawto, drawto, SX + (dx == -1 ? MINI_TILEX : 0), SY + (dy == -1 ? MINI_TILEY : 0), @@ -5197,7 +5227,6 @@ static void ScrollMiniLevel(int from_x, int from_y, int scroll) (ed_fieldy * MINI_TILEY) - (dy != 0 ? MINI_TILEY : 0), SX + (dx == +1 ? MINI_TILEX : 0), SY + (dy == +1 ? MINI_TILEY : 0)); -#endif if (dx) { @@ -5220,7 +5249,7 @@ static void CreateControlButtons() { Bitmap *gd_bitmap = graphic_info[IMG_GLOBAL_DOOR].bitmap; struct GadgetInfo *gi; - unsigned long event_mask; + unsigned int event_mask; int i; /* create toolbox buttons */ @@ -5355,6 +5384,16 @@ static void CreateControlButtons() level_editor_gadget[id] = gi; } + /* these values are not constant, but can change at runtime */ + scrollbutton_info[ED_SCROLLBUTTON_ID_AREA_UP].x = ED_SCROLL_UP_XPOS; + scrollbutton_info[ED_SCROLLBUTTON_ID_AREA_UP].y = ED_SCROLL_UP_YPOS; + scrollbutton_info[ED_SCROLLBUTTON_ID_AREA_DOWN].x = ED_SCROLL_DOWN_XPOS; + scrollbutton_info[ED_SCROLLBUTTON_ID_AREA_DOWN].y = ED_SCROLL_DOWN_YPOS; + scrollbutton_info[ED_SCROLLBUTTON_ID_AREA_LEFT].x = ED_SCROLL_LEFT_XPOS; + scrollbutton_info[ED_SCROLLBUTTON_ID_AREA_LEFT].y = ED_SCROLL_LEFT_YPOS; + scrollbutton_info[ED_SCROLLBUTTON_ID_AREA_RIGHT].x = ED_SCROLL_RIGHT_XPOS; + scrollbutton_info[ED_SCROLLBUTTON_ID_AREA_RIGHT].y = ED_SCROLL_RIGHT_YPOS; + /* create buttons for scrolling of drawing area and element list */ for (i = 0; i < ED_NUM_SCROLLBUTTONS; i++) { @@ -5416,6 +5455,7 @@ static void CreateControlButtons() /* create buttons for element list */ for (i = 0; i < ED_NUM_ELEMENTLIST_BUTTONS; i++) { + struct GraphicInfo *gd = &graphic_info[IMG_EDITOR_PALETTE_BUTTON]; Bitmap *deco_bitmap; int deco_x, deco_y, deco_xpos, deco_ypos; int gd_xoffset, gd_yoffset; @@ -5430,9 +5470,15 @@ static void CreateControlButtons() gd_xoffset = ED_ELEMENTLIST_XPOS + x * ED_ELEMENTLIST_XSIZE; gd_yoffset = ED_ELEMENTLIST_YPOS + y * ED_ELEMENTLIST_YSIZE; +#if 1 + gd_x1 = gd->src_x; + gd_x2 = gd->src_x + gd->pressed_xoffset; + gd_y = gd->src_y; +#else gd_x1 = DOOR_GFX_PAGEX6 + ED_ELEMENTLIST_XPOS + ED_ELEMENTLIST_XSIZE; gd_x2 = DOOR_GFX_PAGEX6 + ED_ELEMENTLIST_XPOS; gd_y = DOOR_GFX_PAGEY1 + ED_ELEMENTLIST_YPOS; +#endif getMiniGraphicSource(el2edimg(element), &deco_bitmap, &deco_x, &deco_y); deco_xpos = (ED_ELEMENTLIST_XSIZE - MINI_TILEX) / 2; @@ -5447,8 +5493,8 @@ static void CreateControlButtons() GDI_HEIGHT, ED_ELEMENTLIST_YSIZE, GDI_TYPE, GD_TYPE_NORMAL_BUTTON, GDI_STATE, GD_BUTTON_UNPRESSED, - GDI_DESIGN_UNPRESSED, gd_bitmap, gd_x1, gd_y, - GDI_DESIGN_PRESSED, gd_bitmap, gd_x2, gd_y, + GDI_DESIGN_UNPRESSED, gd->bitmap, gd_x1, gd_y, + GDI_DESIGN_PRESSED, gd->bitmap, gd_x2, gd_y, GDI_DECORATION_DESIGN, deco_bitmap, deco_x, deco_y, GDI_DECORATION_POSITION, deco_xpos, deco_ypos, GDI_DECORATION_SIZE, MINI_TILEX, MINI_TILEY, @@ -5470,6 +5516,10 @@ static void CreateCounterButtons() int max_infotext_len = getMaxInfoTextLength(); int i; + /* these values are not constant, but can change at runtime */ + counterbutton_info[ED_COUNTER_ID_SELECT_LEVEL].x = DX + 5 - SX; + counterbutton_info[ED_COUNTER_ID_SELECT_LEVEL].y = DY + 3 - SY; + for (i = 0; i < ED_NUM_COUNTERBUTTONS; i++) { int j; @@ -5495,7 +5545,7 @@ static void CreateCounterButtons() int gd_xoffset; int gd_x, gd_x1, gd_x2, gd_y; int x_size, y_size; - unsigned long event_mask; + unsigned int event_mask; char infotext[max_infotext_len + 1]; event_mask = GD_EVENT_PRESSED | GD_EVENT_REPEATED; @@ -5624,10 +5674,14 @@ static void CreateDrawingAreas() { int i; + /* these values are not constant, but can change at runtime */ + drawingarea_info[ED_DRAWING_ID_DRAWING_LEVEL].area_xsize = MAX_ED_FIELDX; + drawingarea_info[ED_DRAWING_ID_DRAWING_LEVEL].area_ysize = MAX_ED_FIELDY; + for (i = 0; i < ED_NUM_DRAWING_AREAS; i++) { struct GadgetInfo *gi; - unsigned long event_mask; + unsigned int event_mask; int id = drawingarea_info[i].gadget_id; int x = SX + drawingarea_info[i].x; int y = SY + drawingarea_info[i].y; @@ -5678,7 +5732,7 @@ static void CreateTextInputGadgets() Bitmap *gd_bitmap = graphic_info[IMG_GLOBAL_DOOR].bitmap; int gd_x, gd_y; struct GadgetInfo *gi; - unsigned long event_mask; + unsigned int event_mask; char infotext[MAX_OUTPUT_LINESIZE + 1]; int id = textinput_info[i].gadget_id; @@ -5726,7 +5780,7 @@ static void CreateTextAreaGadgets() Bitmap *gd_bitmap = graphic_info[IMG_GLOBAL_DOOR].bitmap; int gd_x, gd_y; struct GadgetInfo *gi; - unsigned long event_mask; + unsigned int event_mask; char infotext[MAX_OUTPUT_LINESIZE + 1]; int id = textarea_info[i].gadget_id; int area_xsize = textarea_info[i].xsize; @@ -5775,7 +5829,7 @@ static void CreateSelectboxGadgets() Bitmap *gd_bitmap = graphic_info[IMG_GLOBAL_DOOR].bitmap; int gd_x, gd_y; struct GadgetInfo *gi; - unsigned long event_mask; + unsigned int event_mask; char infotext[MAX_OUTPUT_LINESIZE + 1]; int id = selectbox_info[i].gadget_id; int x = SX + selectbox_info[i].x; @@ -5852,7 +5906,7 @@ static void CreateTextbuttonGadgets() Bitmap *gd_bitmap = graphic_info[IMG_GLOBAL_DOOR].bitmap; int gd_x1, gd_x2, gd_y1, gd_y2; struct GadgetInfo *gi; - unsigned long event_mask; + unsigned int event_mask; char infotext[MAX_OUTPUT_LINESIZE + 1]; int id = textbutton_info[i].gadget_id; int x = SX + textbutton_info[i].x; @@ -5925,7 +5979,7 @@ static void CreateGraphicbuttonGadgets() { Bitmap *gd_bitmap = graphic_info[IMG_GLOBAL_DOOR].bitmap; struct GadgetInfo *gi; - unsigned long event_mask; + unsigned int event_mask; int i; /* create buttons for scrolling of drawing area and element list */ @@ -5991,6 +6045,42 @@ static void CreateScrollbarGadgets() { int i; + /* these values are not constant, but can change at runtime */ + scrollbar_info[ED_SCROLLBAR_ID_AREA_HORIZONTAL].x = + SX + ED_SCROLL_HORIZONTAL_XPOS; + scrollbar_info[ED_SCROLLBAR_ID_AREA_HORIZONTAL].y = + SY + ED_SCROLL_HORIZONTAL_YPOS; + scrollbar_info[ED_SCROLLBAR_ID_AREA_HORIZONTAL].width = + ED_SCROLL_HORIZONTAL_XSIZE; + scrollbar_info[ED_SCROLLBAR_ID_AREA_HORIZONTAL].height = + ED_SCROLL_HORIZONTAL_YSIZE; + scrollbar_info[ED_SCROLLBAR_ID_AREA_HORIZONTAL].wheel_x = SX; + scrollbar_info[ED_SCROLLBAR_ID_AREA_HORIZONTAL].wheel_y = SY; + scrollbar_info[ED_SCROLLBAR_ID_AREA_HORIZONTAL].wheel_width = SXSIZE; + scrollbar_info[ED_SCROLLBAR_ID_AREA_HORIZONTAL].wheel_height = SYSIZE; + + scrollbar_info[ED_SCROLLBAR_ID_AREA_VERTICAL].x = + SX + ED_SCROLL_VERTICAL_XPOS; + scrollbar_info[ED_SCROLLBAR_ID_AREA_VERTICAL].y = + SY + ED_SCROLL_VERTICAL_YPOS; + scrollbar_info[ED_SCROLLBAR_ID_AREA_VERTICAL].width = + ED_SCROLL_VERTICAL_XSIZE; + scrollbar_info[ED_SCROLLBAR_ID_AREA_VERTICAL].height = + ED_SCROLL_VERTICAL_YSIZE; + scrollbar_info[ED_SCROLLBAR_ID_AREA_VERTICAL].wheel_x = SX; + scrollbar_info[ED_SCROLLBAR_ID_AREA_VERTICAL].wheel_y = SY; + scrollbar_info[ED_SCROLLBAR_ID_AREA_VERTICAL].wheel_width = SXSIZE; + scrollbar_info[ED_SCROLLBAR_ID_AREA_VERTICAL].wheel_height = SYSIZE; + + scrollbar_info[ED_SCROLLBAR_ID_LIST_VERTICAL].x = + DX + ED_SCROLL2_VERTICAL_XPOS; + scrollbar_info[ED_SCROLLBAR_ID_LIST_VERTICAL].y = + DY + ED_SCROLL2_VERTICAL_YPOS; + scrollbar_info[ED_SCROLLBAR_ID_LIST_VERTICAL].wheel_x = DX; + scrollbar_info[ED_SCROLLBAR_ID_LIST_VERTICAL].wheel_y = DY; + scrollbar_info[ED_SCROLLBAR_ID_LIST_VERTICAL].wheel_width = DXSIZE; + scrollbar_info[ED_SCROLLBAR_ID_LIST_VERTICAL].wheel_height = DYSIZE; + for (i = 0; i < ED_NUM_SCROLLBARS; i++) { int id = scrollbar_info[i].gadget_id; @@ -5998,7 +6088,7 @@ static void CreateScrollbarGadgets() int gd_x1, gd_x2, gd_y1, gd_y2; struct GadgetInfo *gi; int items_max, items_visible, item_position; - unsigned long event_mask; + unsigned int event_mask; if (i == ED_SCROLLBAR_ID_LIST_VERTICAL) { @@ -6065,7 +6155,7 @@ static void CreateCheckbuttonGadgets() { Bitmap *gd_bitmap = graphic_info[IMG_GLOBAL_DOOR].bitmap; struct GadgetInfo *gi; - unsigned long event_mask; + unsigned int event_mask; int gd_x1, gd_x2, gd_x3, gd_x4, gd_y; int i; @@ -6128,7 +6218,7 @@ static void CreateRadiobuttonGadgets() { Bitmap *gd_bitmap = graphic_info[IMG_GLOBAL_DOOR].bitmap; struct GadgetInfo *gi; - unsigned long event_mask; + unsigned int event_mask; int gd_x1, gd_x2, gd_x3, gd_x4, gd_y; int i; @@ -6193,6 +6283,10 @@ void CreateLevelEditorGadgets() /* setting 'game_status' is needed to get the right fonts for the editor */ game_status = GAME_MODE_EDITOR; + /* these values are not constant, but can change at runtime */ + ed_fieldx = MAX_ED_FIELDX - 1; + ed_fieldy = MAX_ED_FIELDY - 1; + ReinitializeElementList(); CreateControlButtons(); @@ -6586,13 +6680,20 @@ static void UnmapDrawingArea(int id) UnmapGadget(level_editor_gadget[drawingarea_info[id].gadget_id]); } -static void UnmapLevelEditorWindowGadgets() +static void UnmapLevelEditorFieldGadgets() { int i; +#if 1 + for (i = 0; i < NUM_EDITOR_GADGETS; i++) + if (IN_GFX_FIELD_FULL(level_editor_gadget[i]->x, + level_editor_gadget[i]->y)) + UnmapGadget(level_editor_gadget[i]); +#else for (i = 0; i < NUM_EDITOR_GADGETS; i++) if (level_editor_gadget[i]->x < SX + SXSIZE) UnmapGadget(level_editor_gadget[i]); +#endif } void UnmapLevelEditorGadgets() @@ -6667,8 +6768,8 @@ static boolean PrepareSavingIntoPersonalLevelSet() return TRUE; } - if (!Request("This level is read only ! " - "Save into personal level set ?", REQ_ASK)) + if (!Request("This level is read only! " + "Save into personal level set?", REQ_ASK)) return FALSE; // "cd" to personal level set dir (for writing copy the first time) @@ -6946,13 +7047,13 @@ static boolean CopyCustomElement(int element_old, int element_new, } else if (IS_CUSTOM_ELEMENT(element_old) && !IS_CUSTOM_ELEMENT(element_new)) { - Request("Please choose custom element !", REQ_CONFIRM); + Request("Please choose custom element!", REQ_CONFIRM); return FALSE; } else if (IS_GROUP_ELEMENT(element_old) && !IS_GROUP_ELEMENT(element_new)) { - Request("Please choose group element !", REQ_CONFIRM); + Request("Please choose group element!", REQ_CONFIRM); return FALSE; } @@ -7177,7 +7278,7 @@ static void CopyCustomElementPropertiesToGame(int element) if (level.use_custom_template) { - if (Request("Copy and modify level template ?", REQ_ASK)) + if (Request("Copy and modify level template?", REQ_ASK)) { level.use_custom_template = FALSE; ModifyGadget(level_editor_gadget[GADGET_ID_CUSTOM_USE_TEMPLATE], @@ -7348,6 +7449,11 @@ void DrawLevelEd() FadeOut(REDRAW_FIELD); #endif +#if 1 + /* needed if different viewport properties defined for editor */ + ChangeViewportPropertiesIfNeeded(); +#endif + OpenDoor(DOOR_OPEN_2 | DOOR_NO_DELAY); #if DEBUG @@ -7374,8 +7480,19 @@ void DrawLevelEd() } /* copy default editor door content to main double buffer */ +#if 1 + BlitBitmap(graphic_info[IMG_BACKGROUND_PALETTE].bitmap, drawto, + graphic_info[IMG_BACKGROUND_PALETTE].src_x, + graphic_info[IMG_BACKGROUND_PALETTE].src_y, + DXSIZE, DYSIZE, DX, DY); +#else BlitBitmap(graphic_info[IMG_GLOBAL_DOOR].bitmap, drawto, DOOR_GFX_PAGEX6, DOOR_GFX_PAGEY1, DXSIZE, DYSIZE, DX, DY); +#endif + +#if 0 + printf("::: %d, %d / %d, %d\n", VX, VY, EX, EY); +#endif /* draw bigger door */ DrawSpecialEditorDoor(); @@ -7386,6 +7503,11 @@ void DrawLevelEd() redraw_mask |= REDRAW_ALL; +#if 1 + FreeLevelEditorGadgets(); + CreateLevelEditorGadgets(); +#endif + ReinitializeElementList(); /* update dynamic level element list */ ReinitializeElementListButtons(); /* custom element may look different */ @@ -7672,7 +7794,7 @@ static void DrawDrawingWindow() SetMainBackgroundImage(IMG_UNDEFINED); ClearField(); - UnmapLevelEditorWindowGadgets(); + UnmapLevelEditorFieldGadgets(); UnmapLevelEditorToolboxCustomGadgets(); AdjustDrawingAreaGadgets(); @@ -7843,7 +7965,7 @@ static void DrawLevelInfoWindow() { stick_element_properties_window = FALSE; - UnmapLevelEditorWindowGadgets(); + UnmapLevelEditorFieldGadgets(); SetMainBackgroundImage(IMG_BACKGROUND_EDITOR); ClearField(); @@ -8098,7 +8220,7 @@ static int PrintElementDescriptionFromFile(char *filename, int start_line) int max_lines_per_screen = (SYSIZE - pad_y) / font_height - 1; return DrawTextFile(sx, sy, filename, font_nr, max_chars_per_line, -1, - max_lines_per_screen, -1, TRUE, FALSE, FALSE); + max_lines_per_screen, 0, -1, TRUE, FALSE, FALSE); } static void DrawPropertiesInfo() @@ -8737,7 +8859,7 @@ static void DrawEditorElementAnimation(int x, int y) ANIM_MODE(graphic) == ANIM_CE_SCORE ? custom_element.collect_score_initial : FrameCounter); - DrawGraphicAnimationExt(drawto, x, y, graphic, frame, NO_MASKING); + DrawFixedGraphicAnimationExt(drawto, x, y, graphic, frame, NO_MASKING); } static void DrawEditorElementName(int x, int y, int element) @@ -8809,7 +8931,7 @@ static void DrawPropertiesWindow() CopyElementPropertiesToEditor(properties_element); - UnmapLevelEditorWindowGadgets(); + UnmapLevelEditorFieldGadgets(); UnmapLevelEditorToolboxDrawingGadgets(); UnmapLevelEditorToolboxCustomGadgets(); @@ -10049,7 +10171,11 @@ static void SelectArea(int from_x, int from_y, int to_x, int to_y, static void CopyBrushExt(int from_x, int from_y, int to_x, int to_y, int button, int mode) { +#if 1 + static short brush_buffer[MAX_LEV_FIELDX][MAX_LEV_FIELDY]; +#else static short brush_buffer[MAX_ED_FIELDX][MAX_ED_FIELDY]; +#endif static int brush_width, brush_height; static int last_cursor_x = -1, last_cursor_y = -1; static boolean delete_old_brush; @@ -10230,7 +10356,10 @@ static void FloodFill(int from_x, int from_y, int fill_element) static int DrawLevelText(int sx, int sy, char letter, int mode) { static short delete_buffer[MAX_LEV_FIELDX]; - static int start_sx, start_sy; + static int start_sx; +#if 0 + static int start_sy; +#endif static int last_sx, last_sy; static boolean typing = FALSE; int letter_element = EL_CHAR_ASCII0 + letter; @@ -10272,8 +10401,12 @@ static int DrawLevelText(int sx, int sy, char letter, int mode) DrawLevelText(0, 0, 0, TEXT_END); typing = TRUE; - start_sx = last_sx = sx; - start_sy = last_sy = sy; + start_sx = sx; +#if 0 + start_sy = sy; +#endif + last_sx = sx; + last_sy = sy; DrawLevelText(sx, sy, 0, TEXT_SETCURSOR); break; @@ -10638,10 +10771,10 @@ static void HandleDrawingAreas(struct GadgetInfo *gi) gi->y + sy * MINI_TILEY, el2edimg(new_element)); else - DrawGraphicExt(drawto, - gi->x + sx * TILEX, - gi->y + sy * TILEY, - el2img(new_element), 0); + DrawFixedGraphicExt(drawto, + gi->x + sx * TILEX, + gi->y + sy * TILEY, + el2img(new_element), 0); if (id == GADGET_ID_CUSTOM_GRAPHIC) new_element = GFX_ELEMENT(new_element); @@ -10787,7 +10920,7 @@ static void HandleCounterButtons(struct GadgetInfo *gi) if ((level_changed && pressed) || (!level_changed && released)) return; - if (level_changed && !Request("Level has changed ! Discard changes ?", + if (level_changed && !Request("Level has changed! Discard changes?", REQ_ASK)) { if (gadget_id == counterbutton_info[counter_id].gadget_id_text) @@ -10960,11 +11093,11 @@ static void HandleTextbuttonGadgets(struct GadgetInfo *gi) CopyPlayfield(Feld, level.field); if (new_template || - Request("Save this template and kill the old ?", REQ_ASK)) + Request("Save this template and kill the old?", REQ_ASK)) SaveLevelTemplate(); if (new_template) - Request("Template saved !", REQ_CONFIRM); + Request("Template saved!", REQ_CONFIRM); /* restore original "level.field" (needed to track playfield changes) */ CopyPlayfield(FieldBackup, level.field); @@ -11080,7 +11213,7 @@ static void HandleCheckbuttons(struct GadgetInfo *gi) if (level.use_custom_template && !fileExists(template_filename)) { - Request("No level template found !", REQ_CONFIRM); + Request("No level template found!", REQ_CONFIRM); level.use_custom_template = FALSE; ModifyGadget(gi, GDI_CHECKED, FALSE, GDI_END); @@ -11313,7 +11446,7 @@ static void HandleControlButtons(struct GadgetInfo *gi) case GADGET_ID_UNDO: if (undo_buffer_steps == 0) { - Request("Undo buffer empty !", REQ_CONFIRM); + Request("Undo buffer empty!", REQ_CONFIRM); break; } @@ -11387,7 +11520,7 @@ static void HandleControlButtons(struct GadgetInfo *gi) new_level = !fileExists(level_filename); if (new_level || - Request("Save this level and kill the old ?", REQ_ASK)) + Request("Save this level and kill the old?", REQ_ASK)) { if (leveldir_former->readonly) ModifyLevelInfoForSavingIntoPersonalLevelSet(leveldir_former->name); @@ -11403,10 +11536,10 @@ static void HandleControlButtons(struct GadgetInfo *gi) if (leveldir_former->readonly) sprintf(level_saved_msg, - "Level saved as level %d into personal level set !", + "Level saved as level %d into personal level set!", level_nr); else - strcpy(level_saved_msg, "Level saved !"); + strcpy(level_saved_msg, "Level saved!"); Request(level_saved_msg, REQ_CONFIRM); } @@ -11435,7 +11568,9 @@ static void HandleControlButtons(struct GadgetInfo *gi) BackToFront(); /* force redraw of undrawn special door */ +#if 0 DrawCompleteVideoDisplay(); +#endif level_editor_test_game = TRUE; @@ -11663,8 +11798,8 @@ void HandleLevelEditorKeyInput(Key key) void HandleLevelEditorIdle() { - static unsigned long action_delay = 0; - unsigned long action_delay_value = GameFrameDelay; + static unsigned int action_delay = 0; + unsigned int action_delay_value = GameFrameDelay; int xpos = 1, ypos = 2; int i; @@ -11910,7 +12045,7 @@ void RequestExitLevelEditor(boolean ask_if_level_has_changed, { if (!ask_if_level_has_changed || !LevelChanged() || - Request("Level has changed ! Exit without saving ?", + Request("Level has changed! Exit without saving?", REQ_ASK | REQ_STAY_OPEN)) { CloseDoor(DOOR_CLOSE_1);