From: Holger Schemel Date: Fri, 22 Mar 2024 09:49:09 +0000 (+0100) Subject: added support for conveyor belt settings in BD engine to level editor X-Git-Tag: 4.4.0.0-test-1~167 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=440971997e0b8de3ec7c5ba8d3f577abbdeaa87e;p=rocksndiamonds.git added support for conveyor belt settings in BD engine to level editor --- diff --git a/src/editor.c b/src/editor.c index a3fc486f..ab2350d4 100644 --- a/src/editor.c +++ b/src/editor.c @@ -731,6 +731,8 @@ enum GADGET_ID_BD_SLIME_IS_PREDICTABLE, GADGET_ID_BD_CHANGE_EXPANDING_WALL, GADGET_ID_BD_REPLICATORS_ACTIVE, + GADGET_ID_BD_CONVEYOR_BELTS_ACTIVE, + GADGET_ID_BD_CONVEYOR_BELTS_CHANGED, GADGET_ID_ENVELOPE_AUTOWRAP, GADGET_ID_ENVELOPE_CENTERED, GADGET_ID_MM_LASER_RED, @@ -1078,6 +1080,8 @@ enum ED_CHECKBUTTON_ID_BD_SLIME_IS_PREDICTABLE, ED_CHECKBUTTON_ID_BD_CHANGE_EXPANDING_WALL, ED_CHECKBUTTON_ID_BD_REPLICATORS_ACTIVE, + ED_CHECKBUTTON_ID_BD_CONVEYOR_BELTS_ACTIVE, + ED_CHECKBUTTON_ID_BD_CONVEYOR_BELTS_CHANGED, ED_CHECKBUTTON_ID_ENVELOPE_AUTOWRAP, ED_CHECKBUTTON_ID_ENVELOPE_CENTERED, ED_CHECKBUTTON_ID_MM_LASER_RED, @@ -3830,6 +3834,22 @@ static struct NULL, NULL, "Active at start", "Replicators start in active state" }, + { + ED_CHECKBUTTON_ID_BD_CONVEYOR_BELTS_ACTIVE, + ED_ELEMENT_SETTINGS_XPOS(0), ED_ELEMENT_SETTINGS_YPOS(0), + GADGET_ID_BD_CONVEYOR_BELTS_ACTIVE, GADGET_ID_NONE, + &level.bd_conveyor_belts_active, + NULL, NULL, + "Active at start", "Conveyor belts start in active state" + }, + { + ED_CHECKBUTTON_ID_BD_CONVEYOR_BELTS_CHANGED, + ED_ELEMENT_SETTINGS_XPOS(0), ED_ELEMENT_SETTINGS_YPOS(1), + GADGET_ID_BD_CONVEYOR_BELTS_CHANGED, GADGET_ID_NONE, + &level.bd_conveyor_belts_changed, + NULL, NULL, + "Change direction", "Switch conveyor belt direction" + }, { ED_CHECKBUTTON_ID_ENVELOPE_AUTOWRAP, ED_ELEMENT_SETTINGS_XPOS(0), ED_ELEMENT_SETTINGS_YPOS(1), @@ -11107,6 +11127,8 @@ static boolean checkPropertiesConfig(int element) IS_PLAYER_ELEMENT(element) || IS_BD_PLAYER_ELEMENT(element) || IS_BD_EXPANDABLE_WALL(properties_element) || + IS_BD_CONVEYOR_BELT(properties_element) || + IS_BD_CONVEYOR_BELT_SWITCH(properties_element) || IS_SOKOBAN_OBJECT_OR_FIELD(element) || HAS_EDITOR_CONTENT(element) || CAN_GROW(element) || @@ -11475,6 +11497,13 @@ static void DrawPropertiesConfig(void) MapCheckbuttonGadget(ED_CHECKBUTTON_ID_BD_REPLICATORS_ACTIVE); } + if (IS_BD_CONVEYOR_BELT(properties_element) || + IS_BD_CONVEYOR_BELT_SWITCH(properties_element)) + { + MapCheckbuttonGadget(ED_CHECKBUTTON_ID_BD_CONVEYOR_BELTS_ACTIVE); + MapCheckbuttonGadget(ED_CHECKBUTTON_ID_BD_CONVEYOR_BELTS_CHANGED); + } + // 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 12608703..a164fdfd 100644 --- a/src/files.c +++ b/src/files.c @@ -759,6 +759,17 @@ static struct LevelFileConfigInfo chunk_config_ELEM[] = &li.bd_replicator_create_delay, 4 }, + { + EL_BD_CONVEYOR_LEFT, -1, + TYPE_BOOLEAN, CONF_VALUE_8_BIT(1), + &li.bd_conveyor_belts_active, TRUE + }, + { + EL_BD_CONVEYOR_LEFT, -1, + TYPE_BOOLEAN, CONF_VALUE_8_BIT(2), + &li.bd_conveyor_belts_changed, FALSE + }, + // (the following values are related to various game elements) { @@ -4059,6 +4070,9 @@ static void CopyNativeLevel_RND_to_BD(struct LevelInfo *level) cave->replicators_active = level->bd_replicators_active; cave->replicator_delay_frame = level->bd_replicator_create_delay; + cave->conveyor_belts_active = level->bd_conveyor_belts_active; + cave->conveyor_belts_direction_changed= level->bd_conveyor_belts_changed; + // level name strncpy(cave->name, level->name, sizeof(GdString)); cave->name[sizeof(GdString) - 1] = '\0'; @@ -4163,6 +4177,9 @@ static void CopyNativeLevel_BD_to_RND(struct LevelInfo *level) level->bd_replicators_active = cave->replicators_active; level->bd_replicator_create_delay = cave->replicator_delay_frame; + level->bd_conveyor_belts_active = cave->conveyor_belts_active; + level->bd_conveyor_belts_changed = cave->conveyor_belts_direction_changed; + // level name char *cave_name = getStringPrint("%s / %d", cave->name, bd_level_nr + 1); diff --git a/src/main.h b/src/main.h index 7d9bc3f1..fdda6505 100644 --- a/src/main.h +++ b/src/main.h @@ -918,6 +918,16 @@ (e) == EL_BD_EXPANDABLE_STEELWALL_VERTICAL || \ (e) == EL_BD_EXPANDABLE_STEELWALL_ANY) +#define IS_BD_CONVEYOR_BELT(e) ((e) == EL_BD_CONVEYOR_LEFT || \ + (e) == EL_BD_CONVEYOR_LEFT_ACTIVE || \ + (e) == EL_BD_CONVEYOR_RIGHT || \ + (e) == EL_BD_CONVEYOR_RIGHT_ACTIVE) + +#define IS_BD_CONVEYOR_BELT_SWITCH(e) ((e) == EL_BD_CONVEYOR_SWITCH || \ + (e) == EL_BD_CONVEYOR_SWITCH_ACTIVE || \ + (e) == EL_BD_CONVEYOR_DIR_SWITCH_LEFT || \ + (e) == EL_BD_CONVEYOR_DIR_SWITCH_RIGHT) + #define IS_SOKOBAN_OBJECT_OR_FIELD(e) ((e) == EL_SOKOBAN_OBJECT || \ (e) == EL_SOKOBAN_FIELD_EMPTY || \ (e) == EL_SOKOBAN_FIELD_FULL) @@ -3550,6 +3560,8 @@ struct LevelInfo boolean bd_change_expanding_wall; // BD expanding wall direction is changed if enabled boolean bd_replicators_active; // BD replicators start in active state if enabled int bd_replicator_create_delay; // BD replicator delay between replications (in BD frames) + 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 em_slippery_gems; // EM style "gems slip from wall" behaviour boolean em_explodes_by_fire; // EM style chain explosion behaviour