X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;ds=inline;f=src%2Feditor.c;h=eaf1aa29c1102780beb2acd3cfcab5e75b5a3dfc;hb=28f0f8708f4b4f8c4f39f1b23bc5fc7e0fed7579;hp=388083eeaa3ba06accf70853e39221c724c83963;hpb=bf7f1c667ad861d6cadacd0b9d6fe517be977a6e;p=rocksndiamonds.git diff --git a/src/editor.c b/src/editor.c index 388083ee..eaf1aa29 100644 --- a/src/editor.c +++ b/src/editor.c @@ -1,7 +1,7 @@ /*********************************************************** * Rocks'n'Diamonds -- McDuffin Strikes Back! * *----------------------------------------------------------* -* (c) 1995-2001 Artsoft Entertainment * +* (c) 1995-2002 Artsoft Entertainment * * Holger Schemel * * Detmolder Strasse 189 * * 33604 Bielefeld * @@ -1273,8 +1273,8 @@ static char *getElementInfoText(int element) { char *info_text = "unknown"; - if (element < num_element_info) - info_text = element_info[element]; + if (element < NUM_LEVEL_ELEMENTS) + info_text = element_info[element].editor_description; else Error(ERR_WARN, "no element description for element %d", element); @@ -3641,6 +3641,7 @@ static void HandleCounterButtons(struct GadgetInfo *gi) case ED_COUNTER_ID_SELECT_LEVEL: LoadLevel(level_nr); + TapeErase(); ResetUndoBuffer(); DrawEditModeWindow(); break; @@ -3920,6 +3921,9 @@ static void HandleControlButtons(struct GadgetInfo *gi) Request("No Level without Gregor Mc Duffin please !", REQ_CONFIRM); else { + if (LevelChanged()) + level.game_version = GAME_VERSION_ACTUAL; + for(x=0; xevent.type == GD_EVENT_INFO_LEAVING) + return; + /* misuse this function to delete brush cursor, if needed */ if (edit_mode == ED_MODE_DRAWING && draw_with_brush) DeleteBrushFromCursor(); @@ -4130,6 +4130,9 @@ static void HandleDrawingAreaInfo(struct GadgetInfo *gi) ClearEditorGadgetInfoText(); + if (gi->event.type == GD_EVENT_INFO_LEAVING) + return; + /* make sure to stay inside drawing area boundaries */ sx = (sx < min_sx ? min_sx : sx > max_sx ? max_sx : sx); sy = (sy < min_sy ? min_sy : sy > max_sy ? max_sy : sy); @@ -4238,3 +4241,27 @@ static void HandleDrawingAreaInfo(struct GadgetInfo *gi) "Content area %d position: %d, %d", id - GADGET_ID_ELEM_CONTENT_0 + 1, sx, sy); } + +void RequestExitLevelEditor(boolean ask_if_level_has_changed) +{ + if (!ask_if_level_has_changed || + !LevelChanged() || + Request("Level has changed! Exit without saving ?", + REQ_ASK | REQ_STAY_OPEN)) + { + CloseDoor(DOOR_CLOSE_1); + /* + CloseDoor(DOOR_CLOSE_ALL); + */ + game_status = MAINMENU; + DrawMainMenu(); + } + else + { + CloseDoor(DOOR_CLOSE_1); + BlitBitmap(pix[PIX_DB_DOOR], pix[PIX_DB_DOOR], + DOOR_GFX_PAGEX2, DOOR_GFX_PAGEY1, DXSIZE,DYSIZE, + DOOR_GFX_PAGEX1, DOOR_GFX_PAGEY1); + OpenDoor(DOOR_OPEN_1); + } +}