diff --git a/data/console/commands.yaml b/data/console/commands.yaml index 1d313a5..7233319 100644 --- a/data/console/commands.yaml +++ b/data/console/commands.yaml @@ -244,9 +244,16 @@ categories: completions: ITEM: [ADD, DELETE, DUPLICATE] + - keyword: PLATFORM + handler: cmd_platform + description: "Add, delete or duplicate platform" + usage: "PLATFORM " + completions: + PLATFORM: [ADD, DELETE, DUPLICATE] + - keyword: SET handler: cmd_set - description: "Set property (enemy, item or room)" + description: "Set property (enemy, item, platform or room)" usage: "SET " dynamic_completions: true completions: diff --git a/data/room/02.yaml b/data/room/02.yaml index e3d5685..f249e04 100644 --- a/data/room/02.yaml +++ b/data/room/02.yaml @@ -72,7 +72,6 @@ enemies: boundaries: position1: {x: 4, y: 7} position2: {x: 25, y: 7} - color: 8 - animation: upv_student.yaml position: {x: 9, y: 18} @@ -80,19 +79,8 @@ enemies: boundaries: position1: {x: 3, y: 18} position2: {x: 23, y: 18} - color: 10 flip: true -# Plataformas móviles en esta habitación -platforms: - - animation: bin.yaml - position: {x: 5, y: 17} - velocity: {x: 25, y: 0} - boundaries: - position1: {x: 3, y: 17} - position2: {x: 20, y: 17} - frame: 0 - # Objetos en esta habitación items: - tileSetFile: items.gif @@ -100,3 +88,13 @@ items: position: {x: 4, y: 6} counter: 1 +# Plataformas móviles en esta habitación +platforms: + - animation: bin.yaml + position: {x: 2, y: 16} + velocity: {x: 25, y: 0} + boundaries: + position1: {x: 2, y: 16} + position2: {x: 20, y: 15} + frame: 0 + diff --git a/source/game/editor/map_editor.cpp b/source/game/editor/map_editor.cpp index 1ad3a09..e16702a 100644 --- a/source/game/editor/map_editor.cpp +++ b/source/game/editor/map_editor.cpp @@ -989,9 +989,15 @@ void MapEditor::renderEntityBoundaries() { auto game_surface = Screen::get()->getRendererSurface(); if (!game_surface) { return; } - const Uint8 COLOR_BOUND1 = 11; - const Uint8 COLOR_BOUND2 = 13; - const Uint8 COLOR_ROUTE = 15; + // Colores para la entidad seleccionada (brillantes) + constexpr Uint8 SEL_BOUND1 = 21; // BRIGHT_CYAN + constexpr Uint8 SEL_BOUND2 = 25; // BRIGHT_YELLOW + constexpr Uint8 SEL_ROUTE = 26; // BRIGHT_WHITE + + // Colores para entidades no seleccionadas (apagados) + constexpr Uint8 DIM_BOUND1 = 11; // CYAN + constexpr Uint8 DIM_BOUND2 = 13; // YELLOW + constexpr Uint8 DIM_ROUTE = 14; // WHITE (gris medio) for (auto type : {EntityType::ENEMY, EntityType::PLATFORM}) { for (int i = 0; i < entityDataCount(type); ++i) { @@ -999,6 +1005,8 @@ void MapEditor::renderEntityBoundaries() { auto bd = entityBoundaries(type, i); constexpr float HALF = Tile::SIZE / 2.0F; + bool is_selected = selection_.is(type) && selection_.index == i; + // Posiciones base (pueden estar siendo arrastradas) float init_x = pos_x; float init_y = pos_y; @@ -1019,15 +1027,20 @@ void MapEditor::renderEntityBoundaries() { init_x = drag_.snap_x; init_y = drag_.snap_y; } + is_selected = true; // Arrastrando = siempre iluminado } + Uint8 color_b1 = is_selected ? SEL_BOUND1 : DIM_BOUND1; + Uint8 color_b2 = is_selected ? SEL_BOUND2 : DIM_BOUND2; + Uint8 color_route = is_selected ? SEL_ROUTE : DIM_ROUTE; + // Dibujar líneas de ruta - game_surface->drawLine(b1_x + HALF, b1_y + HALF, init_x + HALF, init_y + HALF, COLOR_ROUTE); - game_surface->drawLine(init_x + HALF, init_y + HALF, b2_x + HALF, b2_y + HALF, COLOR_ROUTE); + game_surface->drawLine(b1_x + HALF, b1_y + HALF, init_x + HALF, init_y + HALF, color_route); + game_surface->drawLine(init_x + HALF, init_y + HALF, b2_x + HALF, b2_y + HALF, color_route); // Marcadores en las boundaries - renderBoundaryMarker(b1_x, b1_y, COLOR_BOUND1); - renderBoundaryMarker(b2_x, b2_y, COLOR_BOUND2); + renderBoundaryMarker(b1_x, b1_y, color_b1); + renderBoundaryMarker(b2_x, b2_y, color_b2); } } }