From 1e7b6eb2aa8ee9f348a444900cfb614d6adaad76 Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Mon, 11 Mar 2024 19:40:10 +0100 Subject: [PATCH] added support for active player in BD engine to level editor --- src/editor.c | 13 +++++++++++++ src/files.c | 7 +++++++ src/main.h | 1 + 3 files changed, 21 insertions(+) diff --git a/src/editor.c b/src/editor.c index 0db1f716..a9ef7e5e 100644 --- a/src/editor.c +++ b/src/editor.c @@ -700,6 +700,7 @@ enum GADGET_ID_CAN_MOVE_INTO_ACID, GADGET_ID_DONT_COLLIDE_WITH, GADGET_ID_BD_DIAGONAL_MOVEMENTS, + GADGET_ID_BD_TOPMOST_PLAYER_ACTIVE, GADGET_ID_ENVELOPE_AUTOWRAP, GADGET_ID_ENVELOPE_CENTERED, GADGET_ID_MM_LASER_RED, @@ -1031,6 +1032,7 @@ enum ED_CHECKBUTTON_ID_CAN_MOVE_INTO_ACID, ED_CHECKBUTTON_ID_DONT_COLLIDE_WITH, ED_CHECKBUTTON_ID_BD_DIAGONAL_MOVEMENTS, + ED_CHECKBUTTON_ID_BD_TOPMOST_PLAYER_ACTIVE, ED_CHECKBUTTON_ID_ENVELOPE_AUTOWRAP, ED_CHECKBUTTON_ID_ENVELOPE_CENTERED, ED_CHECKBUTTON_ID_MM_LASER_RED, @@ -3642,6 +3644,14 @@ static struct NULL, NULL, "can move diagonally", "player can move diagonally" }, + { + ED_CHECKBUTTON_ID_BD_TOPMOST_PLAYER_ACTIVE, + ED_ELEMENT_SETTINGS_XPOS(0), ED_ELEMENT_SETTINGS_YPOS(1), + GADGET_ID_BD_TOPMOST_PLAYER_ACTIVE, GADGET_ID_NONE, + &level.bd_topmost_player_active, + NULL, NULL, + "topmost player is active", "use first player found on playfield" + }, { ED_CHECKBUTTON_ID_ENVELOPE_AUTOWRAP, ED_ELEMENT_SETTINGS_XPOS(0), ED_ELEMENT_SETTINGS_YPOS(1), @@ -11033,7 +11043,10 @@ static void DrawPropertiesConfig(void) } if (IS_BD_PLAYER_ELEMENT(properties_element)) + { MapCheckbuttonGadget(ED_CHECKBUTTON_ID_BD_DIAGONAL_MOVEMENTS); + MapCheckbuttonGadget(ED_CHECKBUTTON_ID_BD_TOPMOST_PLAYER_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) diff --git a/src/files.c b/src/files.c index 0c75667c..0a9f3a5c 100644 --- a/src/files.c +++ b/src/files.c @@ -641,6 +641,11 @@ static struct LevelFileConfigInfo chunk_config_ELEM[] = TYPE_BOOLEAN, CONF_VALUE_8_BIT(1), &li.bd_diagonal_movements, FALSE }, + { + EL_BD_PLAYER, -1, + TYPE_BOOLEAN, CONF_VALUE_8_BIT(2), + &li.bd_topmost_player_active, TRUE + }, { EL_BD_DIAMOND, -1, @@ -3797,6 +3802,7 @@ static void CopyNativeLevel_RND_to_BD(struct LevelInfo *level) cave->pal_timing = level->bd_pal_timing; cave->intermission = level->bd_intermission; cave->diagonal_movements = level->bd_diagonal_movements; + cave->active_is_first_found = level->bd_topmost_player_active; cave->lineshift = level->bd_line_shifting_borders; cave->wraparound_objects = level->bd_wraparound_objects; @@ -3839,6 +3845,7 @@ static void CopyNativeLevel_BD_to_RND(struct LevelInfo *level) level->bd_pal_timing = cave->pal_timing; level->bd_intermission = cave->intermission; level->bd_diagonal_movements = cave->diagonal_movements; + level->bd_topmost_player_active = cave->active_is_first_found; level->bd_line_shifting_borders = cave->lineshift; level->bd_wraparound_objects = cave->wraparound_objects; diff --git a/src/main.h b/src/main.h index 85b69174..77f15e42 100644 --- a/src/main.h +++ b/src/main.h @@ -3493,6 +3493,7 @@ struct LevelInfo boolean bd_gravity_affects_all; // BD engine gravity affects all falling objects boolean bd_intermission; // BD level is intermission boolean bd_diagonal_movements; // BD style diagonal movements + boolean bd_topmost_player_active; // BD engine uses first player found on playfield 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 -- 2.34.1