From: Holger Schemel Date: Sun, 24 Mar 2024 13:50:13 +0000 (+0100) Subject: added support for nut settings in BD engine to level editor X-Git-Tag: 4.4.0.0-test-1~150 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=7682b4160c39233d30c765171ceaea0af561b45c;p=rocksndiamonds.git added support for nut settings in BD engine to level editor --- diff --git a/src/editor.c b/src/editor.c index 54b5373b..5420a477 100644 --- a/src/editor.c +++ b/src/editor.c @@ -574,6 +574,7 @@ enum GADGET_ID_BD_ACID_TURNS_TO_ELEMENT, GADGET_ID_BD_BITER_EATS_ELEMENT, GADGET_ID_BD_BLADDER_CONVERTS_BY_ELEMENT, + GADGET_ID_BD_NUT_CONTENT, GADGET_ID_START_ELEMENT, GADGET_ID_ARTWORK_ELEMENT, GADGET_ID_EXPLOSION_ELEMENT, @@ -1204,6 +1205,7 @@ enum ED_DRAWING_ID_BD_ACID_TURNS_TO_ELEMENT, ED_DRAWING_ID_BD_BITER_EATS_ELEMENT, ED_DRAWING_ID_BD_BLADDER_CONVERTS_BY_ELEMENT, + ED_DRAWING_ID_BD_NUT_CONTENT, ED_DRAWING_ID_START_ELEMENT, ED_DRAWING_ID_ARTWORK_ELEMENT, ED_DRAWING_ID_EXPLOSION_ELEMENT, @@ -4500,6 +4502,14 @@ static struct &level.bd_bladder_converts_by_element, 1, 1, "Turns to clock by touching:", NULL, NULL, NULL, "Turns to clock by touching element" }, + { + ED_DRAWING_ID_BD_NUT_CONTENT, + ED_AREA_1X1_SETTINGS_XPOS(0), ED_AREA_1X1_SETTINGS_YPOS(1), + ED_AREA_1X1_SETTINGS_XOFF, ED_AREA_1X1_SETTINGS_YOFF, + GADGET_ID_BD_NUT_CONTENT, GADGET_ID_NONE, + &level.bd_nut_content, 1, 1, + "When breaking, changes to:", NULL, NULL, NULL, "Element created when breaking nut" + }, // ---------- level start element ------------------------------------------- @@ -4747,6 +4757,7 @@ static boolean getDrawModeHiRes(void); static int getTabulatorBarWidth(void); static int getTabulatorBarHeight(void); static Pixel getTabulatorBarColor(void); +static void getEditorGraphicAndFrame(int, int *, int *, boolean); static int numHiresTiles(int); static int num_editor_gadgets = 0; // dynamically determined @@ -7391,11 +7402,21 @@ static void DrawDrawingArea(int id) int tilesize = ED_DRAWINGAREA_TILE_SIZE; for (x = 0; x < area_xsize; x++) + { for (y = 0; y < area_ysize; y++) + { + int element = value[x * area_ysize + y]; + int graphic; + int frame; + + getEditorGraphicAndFrame(element, &graphic, &frame, TRUE); + DrawSizedGraphicExt(drawto, gi->x + x * tilesize, gi->y + y * tilesize, - el2edimg(value[x * area_ysize + y]), 0, tilesize); + graphic, frame, tilesize); + } + } } static void ScrollEditorLevel(int from_x, int from_y, int scroll) @@ -11793,6 +11814,11 @@ static void DrawPropertiesConfig(void) MapCheckbuttonGadget(ED_CHECKBUTTON_ID_BD_WATER_CANNOT_FLOW_DOWN); } + if (properties_element == EL_BD_NUT) + { + MapDrawingArea(ED_DRAWING_ID_BD_NUT_CONTENT); + } + // special case: slippery walls option for gems only available in R'n'D game engine if (IS_GEM(properties_element) && level.game_engine_type == GAME_ENGINE_TYPE_RND) MapCheckbuttonGadget(ED_CHECKBUTTON_ID_EM_SLIPPERY_GEMS); diff --git a/src/files.c b/src/files.c index c7a523f6..1b634690 100644 --- a/src/files.c +++ b/src/files.c @@ -811,6 +811,12 @@ static struct LevelFileConfigInfo chunk_config_ELEM[] = &li.bd_water_cannot_flow_down, FALSE }, + { + EL_BD_NUT, -1, + TYPE_ELEMENT, CONF_VALUE_16_BIT(1), + &li.bd_nut_content, EL_BD_NUT_BREAKING_1 + }, + // (the following values are related to various game elements) { @@ -4125,6 +4131,8 @@ static void CopyNativeLevel_RND_to_BD(struct LevelInfo *level) cave->water_does_not_flow_down = level->bd_water_cannot_flow_down; + cave->nut_turns_to_when_crushed = map_element_RND_to_BD_cave(level->bd_nut_content); + // level name strncpy(cave->name, level->name, sizeof(GdString)); cave->name[sizeof(GdString) - 1] = '\0'; @@ -4243,6 +4251,8 @@ static void CopyNativeLevel_BD_to_RND(struct LevelInfo *level) level->bd_water_cannot_flow_down = cave->water_does_not_flow_down; + level->bd_nut_content = map_element_BD_to_RND_cave(cave->nut_turns_to_when_crushed); + // level name char *cave_name = getStringPrint("%s / %d", cave->name, bd_level_nr + 1); diff --git a/src/init.c b/src/init.c index 7c19e260..f7f7d383 100644 --- a/src/init.c +++ b/src/init.c @@ -4299,6 +4299,7 @@ void InitElementPropertiesStatic(void) EL_BD_BITER_LEFT, EL_BD_BITER_DOWN, EL_BD_BLADDER, + EL_BD_NUT, EL_EMC_MAGIC_BALL, EL_EMC_ANDROID, EL_MM_GRAY_BALL, diff --git a/src/main.h b/src/main.h index 71915919..c6b9ab99 100644 --- a/src/main.h +++ b/src/main.h @@ -3669,6 +3669,7 @@ struct LevelInfo boolean bd_conveyor_belts_active; // BD conveyor belts start in active state if enabled boolean bd_conveyor_belts_changed; // BD conveyor belts direction is changed if enabled boolean bd_water_cannot_flow_down; // BD water does not flow downwards if enabled + boolean bd_nut_content; // BD nut contains the specified game element boolean em_slippery_gems; // EM style "gems slip from wall" behaviour boolean em_explodes_by_fire; // EM style chain explosion behaviour