From: Holger Schemel Date: Wed, 28 Feb 2024 21:59:36 +0000 (+0100) Subject: added support for diagonal player movement in BD engine to level editor X-Git-Tag: 4.4.0.0-test-1~260 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=f187fddd964c6da2ab42b3da9f43961842f62572;p=rocksndiamonds.git added support for diagonal player movement in BD engine to level editor --- diff --git a/src/editor.c b/src/editor.c index ac2bb220..5a5dc93d 100644 --- a/src/editor.c +++ b/src/editor.c @@ -679,6 +679,7 @@ enum GADGET_ID_CAN_FALL_INTO_ACID, GADGET_ID_CAN_MOVE_INTO_ACID, GADGET_ID_DONT_COLLIDE_WITH, + GADGET_ID_BD_DIAGONAL_MOVEMENTS, GADGET_ID_ENVELOPE_AUTOWRAP, GADGET_ID_ENVELOPE_CENTERED, GADGET_ID_MM_LASER_RED, @@ -994,6 +995,7 @@ enum ED_CHECKBUTTON_ID_CAN_FALL_INTO_ACID, ED_CHECKBUTTON_ID_CAN_MOVE_INTO_ACID, ED_CHECKBUTTON_ID_DONT_COLLIDE_WITH, + ED_CHECKBUTTON_ID_BD_DIAGONAL_MOVEMENTS, ED_CHECKBUTTON_ID_ENVELOPE_AUTOWRAP, ED_CHECKBUTTON_ID_ENVELOPE_CENTERED, ED_CHECKBUTTON_ID_MM_LASER_RED, @@ -3328,6 +3330,13 @@ static struct NULL, NULL, "deadly when colliding with", "element is deadly when hitting player" }, + { + ED_ELEMENT_SETTINGS_XPOS(0), ED_ELEMENT_SETTINGS_YPOS(0), + GADGET_ID_BD_DIAGONAL_MOVEMENTS, GADGET_ID_NONE, + &level.bd_diagonal_movements, + NULL, NULL, + "can move diagonally", "player can move diagonally" + }, { ED_ELEMENT_SETTINGS_XPOS(0), ED_ELEMENT_SETTINGS_YPOS(1), GADGET_ID_ENVELOPE_AUTOWRAP, GADGET_ID_NONE, @@ -10331,6 +10340,7 @@ static boolean checkPropertiesConfig(int element) CAN_GROW(element) || COULD_MOVE_INTO_ACID(element) || MAYBE_DONT_COLLIDE_WITH(element) || + element == EL_BD_PLAYER || element == EL_SOKOBAN_OBJECT || element == EL_SOKOBAN_FIELD_EMPTY || element == EL_SOKOBAN_FIELD_FULL) @@ -10565,6 +10575,9 @@ static void DrawPropertiesConfig(void) } } + if (properties_element == EL_BD_PLAYER) + MapCheckbuttonGadget(ED_CHECKBUTTON_ID_BD_DIAGONAL_MOVEMENTS); + if (IS_GEM(properties_element)) MapCheckbuttonGadget(ED_CHECKBUTTON_ID_EM_SLIPPERY_GEMS); diff --git a/src/files.c b/src/files.c index 433f6813..b48fcf4a 100644 --- a/src/files.c +++ b/src/files.c @@ -563,6 +563,15 @@ static struct LevelFileConfigInfo chunk_config_ELEM[] = &li.initial_inventory_size[3], 1, MAX_INITIAL_INVENTORY_SIZE }, + // (these values are only valid for BD style levels) + { + EL_BD_PLAYER, -1, + TYPE_BOOLEAN, CONF_VALUE_8_BIT(1), + &li.bd_diagonal_movements, FALSE + }, + + // (the following values are related to various game elements) + { EL_EMERALD, -1, TYPE_INTEGER, CONF_VALUE_16_BIT(1), @@ -3710,6 +3719,8 @@ static void CopyNativeLevel_RND_to_BD(struct LevelInfo *level) cave->level_speed[0] = 160; // set cave speed + cave->diagonal_movements = level->bd_diagonal_movements; + strncpy(cave->name, level->name, sizeof(GdString)); cave->name[sizeof(GdString) - 1] = '\0'; @@ -3735,6 +3746,8 @@ static void CopyNativeLevel_BD_to_RND(struct LevelInfo *level) level->score[SC_TIME_BONUS] = cave->level_timevalue[bd_level_nr]; level->score[SC_DIAMOND] = cave->diamond_value; + level->bd_diagonal_movements = cave->diagonal_movements; + strncpy(level->name, cave->name, MAX_LEVEL_NAME_LEN); level->name[MAX_LEVEL_NAME_LEN] = '\0'; diff --git a/src/main.h b/src/main.h index 1ed645e2..68b2cd69 100644 --- a/src/main.h +++ b/src/main.h @@ -3466,6 +3466,7 @@ struct LevelInfo int initial_inventory_size[MAX_PLAYERS]; int initial_inventory_content[MAX_PLAYERS][MAX_INITIAL_INVENTORY_SIZE]; + boolean bd_diagonal_movements; // BD style diagonal movements boolean em_slippery_gems; // EM style "gems slip from wall" behaviour boolean em_explodes_by_fire; // EM style chain explosion behaviour boolean use_spring_bug; // for compatibility with old levels