X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Feditor.c;h=f21d086ea693aa6a9225d11f7c9eb4c787d2a0ae;hb=dc51f089096a0c775d2a03d0b862a14d6ce88d51;hp=cea409513013fdb6a051fa5ec5e87389ba160637;hpb=e23b36169cfbf393cfecc7d19257e338a915a232;p=rocksndiamonds.git diff --git a/src/editor.c b/src/editor.c index cea40951..f21d086e 100644 --- a/src/editor.c +++ b/src/editor.c @@ -10602,30 +10602,10 @@ static void InitDrawingElements(void) if (level.game_engine_type == game_engine_type_last) return; - if (level.game_engine_type == GAME_ENGINE_TYPE_BD) - { - new_element1 = EL_BD_WALL; - new_element2 = EL_EMPTY; - new_element3 = EL_BD_SAND; - } - else if (level.game_engine_type == GAME_ENGINE_TYPE_SP) - { - new_element1 = EL_SP_CHIP_SINGLE; - new_element2 = EL_EMPTY; - new_element3 = EL_SP_BASE; - } - else if (level.game_engine_type == GAME_ENGINE_TYPE_MM) - { - new_element1 = EL_MM_MIRROR_START; - new_element2 = EL_EMPTY; - new_element3 = EL_MM_WOODEN_WALL; - } - else - { - new_element1 = EL_WALL; - new_element2 = EL_EMPTY; - new_element3 = EL_SAND; - } + // select drawing elements according to game engine type + new_element1 = getDrawingElement(EL_WALL); + new_element2 = getDrawingElement(EL_EMPTY); + new_element3 = getDrawingElement(EL_SAND); game_engine_type_last = level.game_engine_type; } @@ -11452,13 +11432,13 @@ void SetDefaultLevelColors_BD(void) bd_color_default[i] = *bd_color[i]; } -static void SetRandomLevelColors_BD(void) +void SetRandomLevelColors_BD(int bd_color_type) { struct LevelInfo_BD *level_bd = level.native_bd_level; GdCave *cave = level_bd->cave; // create random cave colors - gd_cave_set_random_colors(cave, level.bd_color_type); + gd_cave_set_random_colors(cave, bd_color_type); // copy colors to level editor level.bd_color_b = cave->colorb; @@ -11514,7 +11494,7 @@ static void DrawEngineConfigColors(void) else { // color type switched to different color type as default colors => use random colors - SetRandomLevelColors_BD(); + SetRandomLevelColors_BD(level.bd_color_type); } } @@ -11573,6 +11553,11 @@ static void DrawLevelConfigWindow(void) stick_element_properties_window = FALSE; + // make sure that previous level config edit mode exists for this level + if (edit_mode_levelconfig == ED_MODE_LEVELCONFIG_ENGINE && + level.game_engine_type != GAME_ENGINE_TYPE_BD) + edit_mode_levelconfig = ED_MODE_LEVELCONFIG_LEVEL; + SetAutomaticNumberOfGemsNeeded(); UnmapLevelEditorFieldGadgets(); @@ -11998,33 +11983,38 @@ static void DrawPropertiesInfo(void) ypos += 2 * MAX(font1_height, font2_height); - // ----- print standard properties of this element + // ----- print standard properties of this element (only for certain game engines) - DrawTextS(xpos, ypos, font1_nr, properties_text); + if (level.game_engine_type == GAME_ENGINE_TYPE_RND || + level.game_engine_type == GAME_ENGINE_TYPE_EM || + level.game_engine_type == GAME_ENGINE_TYPE_SP) + { + DrawTextS(xpos, ypos, font1_nr, properties_text); - ypos += line1_height; + ypos += line1_height; - for (i = 0; properties[i].value != -1; i++) - { - if (!HAS_PROPERTY(properties_element, properties[i].value)) - continue; + for (i = 0; properties[i].value != -1; i++) + { + if (!HAS_PROPERTY(properties_element, properties[i].value)) + continue; - DrawTextS(xpos, ypos, font2_nr, properties[i].text); + DrawTextS(xpos, ypos, font2_nr, properties[i].text); - ypos += font2_height; + ypos += font2_height; - num_standard_properties++; - } + num_standard_properties++; + } - if (num_standard_properties == 0) - { - DrawTextS(xpos + properties_text_len, ypos - line1_height + font2_yoffset, - font2_nr, none_text); + if (num_standard_properties == 0) + { + DrawTextS(xpos + properties_text_len, ypos - line1_height + font2_yoffset, + font2_nr, none_text); - ypos -= (line1_height - font1_height); - } + ypos -= (line1_height - font1_height); + } - ypos += MAX(font1_height, font2_height); + ypos += MAX(font1_height, font2_height); + } // ----- print special description of this element @@ -16636,7 +16626,7 @@ static void HandleTextbuttonGadgets(struct GadgetInfo *gi) } else if (type_id == ED_TEXTBUTTON_ID_BD_SET_RANDOM_COLORS) { - SetRandomLevelColors_BD(); + SetRandomLevelColors_BD(level.bd_color_type); // update BD color palette gadgets after setting random colors DrawLevelConfigWindow();