diff --git a/CLAUDE.md b/CLAUDE.md index b18bb25..39a8922 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -12,7 +12,7 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co 1. **Habitaciones más grandes** — aprovechar el espacio del marcador (scoreboard) para ampliar el área jugable. Esto implica revisar la resolución de canvas, el layout de la HUD y el tamaño de los tilemaps. 2. ~~**Nueva física del jugador**~~ ✅ **HECHO** — Player reescrito con pipeline de 6 fases, colisiones tile-based, ~20 métodos eliminados. -3. ~~**Motor de colisiones por tiles**~~ ✅ **HECHO** — `TileCollider` con queries directas al grid. Collision tilemap editado desde el editor (tecla 7). Sistema antiguo de superficies preservado pero no usado. Pendiente: tiles kill (5) y conveyor (6). +3. ~~**Motor de colisiones por tiles**~~ ✅ **HECHO** — `TileCollider` con queries directas al grid. Collision tilemap editado desde el editor (tecla 8). Sistema antiguo de superficies preservado pero no usado. Pendiente: tiles kill (5) y conveyor (6). 4. ~~**Transición de pantalla animada**~~ ✅ **HECHO** — Scroll con easing `cubicInOut` (0.5s), ambas rooms visibles, enemigos activos, jugador puede moverse durante la transición. 5. **Paleta Amstrad CPC** — subir de la paleta actual (8-bit indexada limitada) a la paleta del Amstrad CPC (27 colores / más colores que la actual). Afecta a `PaletteManager` y a todos los assets de color. diff --git a/source/game/defaults.hpp b/source/game/defaults.hpp index b206cba..7428f0f 100644 --- a/source/game/defaults.hpp +++ b/source/game/defaults.hpp @@ -107,11 +107,11 @@ namespace Defaults::Notification { } // namespace Defaults::Notification namespace Defaults::Console { - constexpr bool TRANSPARENT = false; // Por defecto sólida - constexpr Uint8 BG_COLOR = 0; // Color de fondo (índice de paleta) - constexpr Uint8 MSG_COLOR = 8; // Color de los mensajes - constexpr Uint8 PROMPT_COLOR = 9; // Color del prompt y del borde - constexpr Uint8 COMMAND_COLOR = 9; // Color del texto que escribe el usuario + constexpr bool TRANSPARENT = false; // Por defecto sólida + constexpr Uint8 BG_COLOR = 0; // Color de fondo (índice de paleta) + constexpr Uint8 MSG_COLOR = 8; // Color de los mensajes + constexpr Uint8 PROMPT_COLOR = 9; // Color del prompt y del borde + constexpr Uint8 COMMAND_COLOR = 9; // Color del texto que escribe el usuario } // namespace Defaults::Console namespace Defaults::Localization { diff --git a/source/game/editor/map_editor.cpp b/source/game/editor/map_editor.cpp index c5a8c19..ef1d30c 100644 --- a/source/game/editor/map_editor.cpp +++ b/source/game/editor/map_editor.cpp @@ -5,12 +5,12 @@ #include #include -#include // Para std::round -#include // Para std::remove (borrar fichero) -#include // Para directory_iterator (getAnimationCompletions) -#include // Para ifstream, ofstream -#include // Para cout -#include // Para set +#include // Para std::round +#include // Para std::remove (borrar fichero) +#include // Para directory_iterator (getAnimationCompletions) +#include // Para ifstream, ofstream +#include // Para cout +#include // Para set #include // Para std::error_code #include "core/input/mouse.hpp" // Para Mouse @@ -489,8 +489,8 @@ void MapEditor::handleEvent(const SDL_Event& event) { // NOLINT(readability-fun return; } - // 7: alternar entre draw y collision - if (event.type == SDL_EVENT_KEY_DOWN && event.key.key == SDLK_7 && static_cast(event.key.repeat) == 0) { + // 8: alternar entre draw y collision + if (event.type == SDL_EVENT_KEY_DOWN && event.key.key == SDLK_8 && static_cast(event.key.repeat) == 0) { setEditingCollision(!editing_collision_); return; } @@ -1520,11 +1520,20 @@ auto MapEditor::getSetCompletions() const -> std::vector { auto MapEditor::getAnimationCompletions() const -> std::vector { const char* folder = nullptr; switch (selection_.type) { - case EntityType::ENEMY: folder = "data/enemies"; break; - case EntityType::PLATFORM: folder = "data/platforms"; break; - case EntityType::KEY: folder = "data/keys"; break; - case EntityType::DOOR: folder = "data/doors"; break; - default: return {}; + case EntityType::ENEMY: + folder = "data/enemies"; + break; + case EntityType::PLATFORM: + folder = "data/platforms"; + break; + case EntityType::KEY: + folder = "data/keys"; + break; + case EntityType::DOOR: + folder = "data/doors"; + break; + default: + return {}; } std::vector result; std::error_code ec; diff --git a/source/game/editor/map_editor.hpp b/source/game/editor/map_editor.hpp index 525d05b..649e2ca 100644 --- a/source/game/editor/map_editor.hpp +++ b/source/game/editor/map_editor.hpp @@ -226,10 +226,10 @@ class MapEditor { bool active_{false}; DragState drag_; Selection selection_; // Entidad seleccionada (unificada: enemy, item o platform) - BrushPattern brush_; // Brush activo (vacío = sin brush) + BrushPattern brush_; // Brush activo (vacío = sin brush) EyedropperState eyedropper_; // Estado del eyedropper (clic derecho) - bool painting_{false}; // true mientras se está pintando con click izquierdo mantenido - bool editing_collision_{false}; // true = editando collision tilemap, false = editando draw tilemap + bool painting_{false}; // true mientras se está pintando con click izquierdo mantenido + bool editing_collision_{false}; // true = editando collision tilemap, false = editando draw tilemap // Datos de la habitación Room::Data room_data_; diff --git a/source/game/editor/mini_map.hpp b/source/game/editor/mini_map.hpp index 021b758..cda2b6c 100644 --- a/source/game/editor/mini_map.hpp +++ b/source/game/editor/mini_map.hpp @@ -51,9 +51,9 @@ class MiniMap { // Tabla de color predominante para un tileset concreto struct TileColorTable { - std::vector colors; // tile_index → palette color - int tileset_width{0}; // Ancho del tileset en tiles - Uint8 transparent{16}; // Color transparente del tileset + std::vector colors; // tile_index → palette color + int tileset_width{0}; // Ancho del tileset en tiles + Uint8 transparent{16}; // Color transparente del tileset }; auto getOrBuildTileColorTable(const std::string& tileset_name) -> const TileColorTable&; diff --git a/source/game/options.cpp b/source/game/options.cpp index 5bc4a57..f8c0573 100644 --- a/source/game/options.cpp +++ b/source/game/options.cpp @@ -592,19 +592,29 @@ namespace Options { const auto& c = yaml["console"]; if (c.contains("transparent")) { - try { console.transparent = c["transparent"].get_value(); } catch (...) {} + try { + console.transparent = c["transparent"].get_value(); + } catch (...) {} } if (c.contains("bg_color")) { - try { console.bg_color = std::clamp(c["bg_color"].get_value(), 0, 255); } catch (...) {} + try { + console.bg_color = std::clamp(c["bg_color"].get_value(), 0, 255); + } catch (...) {} } if (c.contains("msg_color")) { - try { console.msg_color = std::clamp(c["msg_color"].get_value(), 0, 255); } catch (...) {} + try { + console.msg_color = std::clamp(c["msg_color"].get_value(), 0, 255); + } catch (...) {} } if (c.contains("prompt_color")) { - try { console.prompt_color = std::clamp(c["prompt_color"].get_value(), 0, 255); } catch (...) {} + try { + console.prompt_color = std::clamp(c["prompt_color"].get_value(), 0, 255); + } catch (...) {} } if (c.contains("command_color")) { - try { console.command_color = std::clamp(c["command_color"].get_value(), 0, 255); } catch (...) {} + try { + console.command_color = std::clamp(c["command_color"].get_value(), 0, 255); + } catch (...) {} } } @@ -750,10 +760,10 @@ namespace Options { // CONSOLE file << "# CONSOLE\n"; file << "console:\n"; - file << " transparent: " << (console.transparent ? "true" : "false") << " # true = sin fondo, false = solida\n"; - file << " bg_color: " << console.bg_color << " # indice de paleta del fondo (solo si transparent: false)\n"; - file << " msg_color: " << console.msg_color << " # indice de paleta de los mensajes\n"; - file << " prompt_color: " << console.prompt_color << " # indice de paleta del prompt y del borde\n"; + file << " transparent: " << (console.transparent ? "true" : "false") << " # true = sin fondo, false = solida\n"; + file << " bg_color: " << console.bg_color << " # indice de paleta del fondo (solo si transparent: false)\n"; + file << " msg_color: " << console.msg_color << " # indice de paleta de los mensajes\n"; + file << " prompt_color: " << console.prompt_color << " # indice de paleta del prompt y del borde\n"; file << " command_color: " << console.command_color << " # indice de paleta del texto escrito por el usuario\n"; file << "\n"; diff --git a/source/game/options.hpp b/source/game/options.hpp index 4e6dff1..0956389 100644 --- a/source/game/options.hpp +++ b/source/game/options.hpp @@ -140,11 +140,11 @@ namespace Options { // Estructura para las opciones visuales de la consola en pantalla struct Console { - bool transparent{Defaults::Console::TRANSPARENT}; // true = sin fondo, false = sólida - int bg_color{Defaults::Console::BG_COLOR}; // Índice de paleta del fondo (sólo si !transparent) - int msg_color{Defaults::Console::MSG_COLOR}; // Índice de paleta de las líneas de mensaje - int prompt_color{Defaults::Console::PROMPT_COLOR}; // Índice de paleta del prompt y del borde - int command_color{Defaults::Console::COMMAND_COLOR};// Índice de paleta del texto escrito por el usuario + bool transparent{Defaults::Console::TRANSPARENT}; // true = sin fondo, false = sólida + int bg_color{Defaults::Console::BG_COLOR}; // Índice de paleta del fondo (sólo si !transparent) + int msg_color{Defaults::Console::MSG_COLOR}; // Índice de paleta de las líneas de mensaje + int prompt_color{Defaults::Console::PROMPT_COLOR}; // Índice de paleta del prompt y del borde + int command_color{Defaults::Console::COMMAND_COLOR}; // Índice de paleta del texto escrito por el usuario }; // Estructura para un preset de PostFX diff --git a/source/game/scenes/game.cpp b/source/game/scenes/game.cpp index 0b43029..f7691fe 100644 --- a/source/game/scenes/game.cpp +++ b/source/game/scenes/game.cpp @@ -215,7 +215,7 @@ void Game::handleEvents() { GameControl::enter_editor(); Notifier::get()->show({Locale::get()->get("game.editor_enabled")}); // NOLINT(readability-static-accessed-through-instance) } - } else if (event.type == SDL_EVENT_KEY_DOWN && event.key.key == SDLK_8 && static_cast(event.key.repeat) == 0 && MapEditor::get()->isActive()) { + } else if (event.type == SDL_EVENT_KEY_DOWN && event.key.key == SDLK_G && static_cast(event.key.repeat) == 0 && MapEditor::get()->isActive()) { MapEditor::get()->showGrid(!MapEditor::get()->isGridEnabled()); } else if (MapEditor::get()->isActive()) { MapEditor::get()->handleEvent(event); diff --git a/source/game/ui/console.hpp b/source/game/ui/console.hpp index 7f8c298..7a24471 100644 --- a/source/game/ui/console.hpp +++ b/source/game/ui/console.hpp @@ -58,7 +58,7 @@ class Console { // Constantes de consola static constexpr std::string_view CONSOLE_NAME = "Projecte 2026 Console"; - static constexpr std::string_view CONSOLE_VERSION = "v2.2"; + static constexpr std::string_view CONSOLE_VERSION = "v2.3"; static constexpr int MAX_LINE_CHARS = 32; static constexpr int MAX_HISTORY_SIZE = 20; static constexpr float CURSOR_ON_TIME = 0.5F; diff --git a/source/game/ui/console_commands.cpp b/source/game/ui/console_commands.cpp index 2823ea2..81bd10b 100644 --- a/source/game/ui/console_commands.cpp +++ b/source/game/ui/console_commands.cpp @@ -954,11 +954,7 @@ static auto cmdSize(const std::vector& /*unused*/) -> std::string { // CONSOLE [TRANSPARENT [ON|OFF]|BG|MSG|PROMPT|COMMAND <0-255>] static auto cmdConsole(const std::vector& args) -> std::string { // NOLINT(readability-function-cognitive-complexity) if (args.empty()) { - return std::string("Console ") + (Options::console.transparent ? "transparent" : "solid") - + " bg:" + std::to_string(Options::console.bg_color) - + " msg:" + std::to_string(Options::console.msg_color) - + " prompt:" + std::to_string(Options::console.prompt_color) - + " cmd:" + std::to_string(Options::console.command_color); + return std::string("Console ") + (Options::console.transparent ? "transparent" : "solid") + " bg:" + std::to_string(Options::console.bg_color) + " msg:" + std::to_string(Options::console.msg_color) + " prompt:" + std::to_string(Options::console.prompt_color) + " cmd:" + std::to_string(Options::console.command_color); } if (args[0] == "TRANSPARENT") { @@ -1340,7 +1336,7 @@ auto CommandRegistry::generateConsoleHelp() const -> std::string { // NOLINT(re if (active_scope_ == "editor" && !editor_cmds.empty()) { result += "Editor:\n" + editor_cmds + "\n"; - result += "keys: 9=editor 8=grid e=eraser m=map\n"; + result += "keys: 9=editor g=grid 8=collision e=eraser m=map\n"; } if (!debug_cmds.empty()) {