From 0e6b99fa178d72b30aa23ce4eb300827ec50b64a Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Thu, 21 Mar 2024 00:59:55 +0100 Subject: [PATCH] added support for replicator settings in BD engine to level editor --- src/editor.c | 19 +++++++++++++++++++ src/files.c | 17 +++++++++++++++++ src/main.h | 2 ++ 3 files changed, 38 insertions(+) diff --git a/src/editor.c b/src/editor.c index 391aae98..a3fc486f 100644 --- a/src/editor.c +++ b/src/editor.c @@ -730,6 +730,7 @@ enum GADGET_ID_BD_VOODOO_VANISH_BY_EXPLOSION, GADGET_ID_BD_SLIME_IS_PREDICTABLE, GADGET_ID_BD_CHANGE_EXPANDING_WALL, + GADGET_ID_BD_REPLICATORS_ACTIVE, GADGET_ID_ENVELOPE_AUTOWRAP, GADGET_ID_ENVELOPE_CENTERED, GADGET_ID_MM_LASER_RED, @@ -1076,6 +1077,7 @@ enum ED_CHECKBUTTON_ID_BD_VOODOO_VANISH_BY_EXPLOSION, ED_CHECKBUTTON_ID_BD_SLIME_IS_PREDICTABLE, ED_CHECKBUTTON_ID_BD_CHANGE_EXPANDING_WALL, + ED_CHECKBUTTON_ID_BD_REPLICATORS_ACTIVE, ED_CHECKBUTTON_ID_ENVELOPE_AUTOWRAP, ED_CHECKBUTTON_ID_ENVELOPE_CENTERED, ED_CHECKBUTTON_ID_MM_LASER_RED, @@ -3820,6 +3822,14 @@ static struct NULL, NULL, "Change direction", "Switch horizontal/vertical direction" }, + { + ED_CHECKBUTTON_ID_BD_REPLICATORS_ACTIVE, + ED_ELEMENT_SETTINGS_XPOS(0), ED_ELEMENT_SETTINGS_YPOS(0), + GADGET_ID_BD_REPLICATORS_ACTIVE, GADGET_ID_NONE, + &level.bd_replicators_active, + NULL, NULL, + "Active at start", "Replicators start in active state" + }, { ED_CHECKBUTTON_ID_ENVELOPE_AUTOWRAP, ED_ELEMENT_SETTINGS_XPOS(0), ED_ELEMENT_SETTINGS_YPOS(1), @@ -10907,6 +10917,7 @@ static void DrawPropertiesInfo(void) #define TEXT_RANDOM_SEED "slime random number seed" #define TEXT_ACID_SPREAD_RATE "Spread rate (percent)" #define TEXT_BITER_MOVE_DELAY "Move delay (BD frames)" +#define TEXT_REPLICATION_DELAY "Create delay (BD frames)" static struct { @@ -11041,6 +11052,8 @@ static struct 0, 3 }, { EL_BD_BITER_DOWN, &level.bd_biter_move_delay, TEXT_BITER_MOVE_DELAY, 0, 3 }, + { EL_BD_REPLICATOR, &level.bd_replicator_create_delay, TEXT_REPLICATION_DELAY, + 0, 100 }, { EL_EXTRA_TIME, &level.extra_time, TEXT_TIME_BONUS }, { EL_TIME_ORB_FULL, &level.time_orb_time, TEXT_TIME_BONUS }, { EL_GAME_OF_LIFE, &level.game_of_life[0], TEXT_GAME_OF_LIFE_1,0,8 }, @@ -11225,6 +11238,7 @@ static void DrawPropertiesConfig(void) (properties_element == EL_BD_VOODOO_DOLL ? 4 : 0) + (properties_element == EL_BD_SLIME ? 1 : 0) + (properties_element == EL_BD_ACID ? 1 : 0) + + (properties_element == EL_BD_REPLICATOR ? 1 : 0) + (properties_element == EL_EMC_MAGIC_BALL ? 2 : 0) + num_element_counters); @@ -11456,6 +11470,11 @@ static void DrawPropertiesConfig(void) MapCheckbuttonGadget(ED_CHECKBUTTON_ID_BD_CHANGE_EXPANDING_WALL); } + if (properties_element == EL_BD_REPLICATOR) + { + MapCheckbuttonGadget(ED_CHECKBUTTON_ID_BD_REPLICATORS_ACTIVE); + } + // 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 489565f9..12608703 100644 --- a/src/files.c +++ b/src/files.c @@ -748,6 +748,17 @@ static struct LevelFileConfigInfo chunk_config_ELEM[] = &li.bd_change_expanding_wall, FALSE }, + { + EL_BD_REPLICATOR, -1, + TYPE_BOOLEAN, CONF_VALUE_8_BIT(1), + &li.bd_replicators_active, TRUE + }, + { + EL_BD_REPLICATOR, -1, + TYPE_INTEGER, CONF_VALUE_8_BIT(2), + &li.bd_replicator_create_delay, 4 + }, + // (the following values are related to various game elements) { @@ -4045,6 +4056,9 @@ static void CopyNativeLevel_RND_to_BD(struct LevelInfo *level) cave->expanding_wall_changed = level->bd_change_expanding_wall; + cave->replicators_active = level->bd_replicators_active; + cave->replicator_delay_frame = level->bd_replicator_create_delay; + // level name strncpy(cave->name, level->name, sizeof(GdString)); cave->name[sizeof(GdString) - 1] = '\0'; @@ -4146,6 +4160,9 @@ static void CopyNativeLevel_BD_to_RND(struct LevelInfo *level) level->bd_change_expanding_wall = cave->expanding_wall_changed; + level->bd_replicators_active = cave->replicators_active; + level->bd_replicator_create_delay = cave->replicator_delay_frame; + // 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 13217f50..7d9bc3f1 100644 --- a/src/main.h +++ b/src/main.h @@ -3548,6 +3548,8 @@ struct LevelInfo int bd_biter_eats_element; // BD biter eats this game element when moving int bd_bladder_converts_by_element; // BD bladder converts to clock by touching this element 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 em_slippery_gems; // EM style "gems slip from wall" behaviour boolean em_explodes_by_fire; // EM style chain explosion behaviour -- 2.34.1