diff --git a/CMakeLists.txt b/CMakeLists.txt index 426c480..69ced58 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -61,10 +61,12 @@ set(APP_SOURCES source/game/entities/item.cpp source/game/entities/player.cpp + # Game - Configuration + source/game/options.cpp + # Game - Gameplay source/game/gameplay/cheevos.cpp source/game/gameplay/item_tracker.cpp - source/game/gameplay/options.cpp source/game/gameplay/room.cpp source/game/gameplay/room_tracker.cpp source/game/gameplay/scoreboard.cpp diff --git a/source/core/input/global_inputs.cpp b/source/core/input/global_inputs.cpp index f4b098e..cbc1c0b 100644 --- a/source/core/input/global_inputs.cpp +++ b/source/core/input/global_inputs.cpp @@ -9,7 +9,7 @@ #include "core/input/input.hpp" // Para Input, InputAction, INPUT_DO_NOT_ALLOW_REPEAT #include "core/rendering/screen.hpp" // Para Screen -#include "game/gameplay/options.hpp" // Para Options, options, OptionsVideo, Section +#include "game/options.hpp" // Para Options, options, OptionsVideo, Section #include "game/ui/notifier.hpp" // Para Notifier, NotificationText #include "utils/utils.hpp" // Para stringInVector diff --git a/source/core/rendering/screen.cpp b/source/core/rendering/screen.cpp index 6bc8249..359b0ab 100644 --- a/source/core/rendering/screen.cpp +++ b/source/core/rendering/screen.cpp @@ -15,7 +15,7 @@ #include "core/rendering/text.hpp" // Para Text #include "core/resources/asset.hpp" // Para Asset, AssetType #include "core/resources/resource.hpp" // Para Resource -#include "game/gameplay/options.hpp" // Para Options, options, OptionsVideo, Border +#include "game/options.hpp" // Para Options, options, OptionsVideo, Border #include "game/ui/notifier.hpp" // Para Notifier // [SINGLETON] diff --git a/source/core/resources/resource.cpp b/source/core/resources/resource.cpp index 8f7e8a7..2be853b 100644 --- a/source/core/resources/resource.cpp +++ b/source/core/resources/resource.cpp @@ -11,7 +11,7 @@ #include "core/rendering/text.hpp" // Para Text, loadTextFile #include "core/resources/asset.hpp" // Para AssetType, Asset #include "external/jail_audio.h" // Para JA_DeleteMusic, JA_DeleteSound, JA_Loa... -#include "game/gameplay/options.hpp" // Para Options, OptionsGame, options +#include "game/options.hpp" // Para Options, OptionsGame, options #include "game/gameplay/room.hpp" // Para RoomData, loadRoomFile, loadRoomTileFile #include "utils/utils.hpp" // Para getFileName, printWithDots, PaletteColor struct JA_Music_t; // lines 17-17 diff --git a/source/core/system/director.cpp b/source/core/system/director.cpp index d84e3f2..1dc39e1 100644 --- a/source/core/system/director.cpp +++ b/source/core/system/director.cpp @@ -20,7 +20,7 @@ #include "core/system/debug.hpp" // Para Debug #include "external/jail_audio.h" // Para JA_SetMusicVolume, JA_SetSoundV... #include "game/gameplay/cheevos.hpp" // Para Cheevos -#include "game/gameplay/options.hpp" // Para Options, options, OptionsVideo +#include "game/options.hpp" // Para Options, options, OptionsVideo #include "game/scenes/credits.hpp" // Para Credits #include "game/scenes/ending.hpp" // Para Ending #include "game/scenes/ending2.hpp" // Para Ending2 diff --git a/source/game/gameplay/defaults.hpp b/source/game/defaults.hpp similarity index 100% rename from source/game/gameplay/defaults.hpp rename to source/game/defaults.hpp diff --git a/source/game/entities/player.cpp b/source/game/entities/player.cpp index 2f00fbd..ed45046 100644 --- a/source/game/entities/player.cpp +++ b/source/game/entities/player.cpp @@ -9,7 +9,7 @@ #include "core/resources/resource.hpp" // Para Resource #include "core/system/debug.hpp" // Para Debug #include "external/jail_audio.h" // Para JA_PlaySound -#include "game/gameplay/options.hpp" // Para Cheat, Options, options +#include "game/options.hpp" // Para Cheat, Options, options #include "game/gameplay/room.hpp" // Para Room, TileType #include "utils/defines.hpp" // Para RoomBorder::BOTTOM, RoomBorder::LEFT, RoomBorder::RIGHT diff --git a/source/game/gameplay/cheevos.cpp b/source/game/gameplay/cheevos.cpp index 28e7d5d..feac8b6 100644 --- a/source/game/gameplay/cheevos.cpp +++ b/source/game/gameplay/cheevos.cpp @@ -6,7 +6,7 @@ #include // Para basic_ostream, operator<<, basic_ofstream #include // Para cout, cerr -#include "game/gameplay/options.hpp" // Para Options, options +#include "game/options.hpp" // Para Options, options #include "game/ui/notifier.hpp" // Para Notifier // [SINGLETON] diff --git a/source/game/gameplay/room.cpp b/source/game/gameplay/room.cpp index 7443949..1273921 100644 --- a/source/game/gameplay/room.cpp +++ b/source/game/gameplay/room.cpp @@ -12,7 +12,7 @@ #include "core/system/debug.hpp" // Para Debug #include "external/jail_audio.h" // Para JA_PlaySound #include "game/gameplay/item_tracker.hpp" // Para ItemTracker -#include "game/gameplay/options.hpp" // Para Options, OptionsStats, options +#include "game/options.hpp" // Para Options, OptionsStats, options #include "game/gameplay/scoreboard.hpp" // Para ScoreboardData #include "utils/defines.hpp" // Para BLOCK, PLAY_AREA_HEIGHT, PLAY_AREA_WIDTH #include "utils/utils.hpp" // Para LineHorizontal, LineDiagonal, LineVertical diff --git a/source/game/gameplay/scoreboard.cpp b/source/game/gameplay/scoreboard.cpp index 0f153d1..c752670 100644 --- a/source/game/gameplay/scoreboard.cpp +++ b/source/game/gameplay/scoreboard.cpp @@ -7,7 +7,7 @@ #include "core/rendering/surface_animated_sprite.hpp" // Para SAnimatedSprite #include "core/rendering/text.hpp" // Para Text #include "core/resources/resource.hpp" // Para Resource -#include "game/gameplay/options.hpp" // Para Options, options, Cheat, OptionsGame +#include "game/options.hpp" // Para Options, options, Cheat, OptionsGame #include "utils/defines.hpp" // Para BLOCK #include "utils/utils.hpp" // Para stringToColor diff --git a/source/game/gameplay/stats.cpp b/source/game/gameplay/stats.cpp index 0bfd319..9e5e91a 100644 --- a/source/game/gameplay/stats.cpp +++ b/source/game/gameplay/stats.cpp @@ -3,7 +3,7 @@ #include // Para basic_ostream, basic_ifstream, basic_istream #include // Para basic_stringstream -#include "game/gameplay/options.hpp" // Para Options, OptionsStats, options +#include "game/options.hpp" // Para Options, OptionsStats, options // Constructor Stats::Stats(const std::string& file, const std::string& buffer) diff --git a/source/game/gameplay/options.cpp b/source/game/options.cpp similarity index 99% rename from source/game/gameplay/options.cpp rename to source/game/options.cpp index c02991e..702f253 100644 --- a/source/game/gameplay/options.cpp +++ b/source/game/options.cpp @@ -1,4 +1,4 @@ -#include "game/gameplay/options.hpp" +#include "game/options.hpp" #include diff --git a/source/game/gameplay/options.hpp b/source/game/options.hpp similarity index 99% rename from source/game/gameplay/options.hpp rename to source/game/options.hpp index 3078ee7..56d06c0 100644 --- a/source/game/gameplay/options.hpp +++ b/source/game/options.hpp @@ -46,7 +46,7 @@ enum class ControlScheme { } // namespace Options // Incluir constantes por defecto después de declarar los enums -#include "game/gameplay/defaults.hpp" +#include "game/defaults.hpp" namespace Options { diff --git a/source/game/scene_manager.hpp b/source/game/scene_manager.hpp index a06b654..72f5b8b 100644 --- a/source/game/scene_manager.hpp +++ b/source/game/scene_manager.hpp @@ -25,15 +25,15 @@ enum class Scene { // --- Opciones para transiciones entre escenas --- enum class Options { - NONE, // Sin opciones especiales - LOGO_TO_INTRO, // Del logo a la intro - LOGO_TO_TITLE, // Del logo al título - TITLE_WITH_LOADING_SCREEN, // Al título mostrando pantalla de carga - TITLE_WITHOUT_LOADING_SCREEN // Al título sin pantalla de carga + NONE, // Sin opciones especiales + LOGO_TO_LOADING_SCREEN, // Del logo a la intro + LOGO_TO_TITLE, // Del logo al título + TITLE_WITH_LOADING_SCREEN, // Al título mostrando pantalla de carga + TITLE_WITHOUT_LOADING_SCREEN // Al título sin pantalla de carga }; // --- Variables de estado globales (inline C++17) --- -inline Scene current = Scene::LOGO; // Escena actual -inline Options options = Options::NONE; // Opciones de la escena actual +inline Scene current = Scene::LOGO; // Escena actual +inline Options options = Options::LOGO_TO_LOADING_SCREEN; // Opciones de la escena actual } // namespace SceneManager diff --git a/source/game/scenes/credits.cpp b/source/game/scenes/credits.cpp index 6ffd756..a8048f6 100644 --- a/source/game/scenes/credits.cpp +++ b/source/game/scenes/credits.cpp @@ -12,7 +12,7 @@ #include "core/rendering/surface_animated_sprite.hpp" // Para SAnimatedSprite #include "core/rendering/text.hpp" // Para Text, TEXT_CENTER, TEXT_COLOR #include "core/resources/resource.hpp" // Para Resource -#include "game/gameplay/options.hpp" // Para Options, options, OptionsGame, Sectio... +#include "game/options.hpp" // Para Options, options, OptionsGame, Sectio... #include "utils/defines.hpp" // Para GAME_SPEED, PLAY_AREA_CENTER_X, PLAY_... #include "utils/global_events.hpp" // Para check #include "utils/utils.hpp" // Para PaletteColor diff --git a/source/game/scenes/ending.cpp b/source/game/scenes/ending.cpp index b9555bd..67fcf0a 100644 --- a/source/game/scenes/ending.cpp +++ b/source/game/scenes/ending.cpp @@ -13,7 +13,7 @@ #include "core/rendering/text.hpp" // Para Text, TEXT_STROKE #include "core/resources/resource.hpp" // Para Resource #include "external/jail_audio.h" // Para JA_SetVolume, JA_PlayMusic, JA_StopMusic -#include "game/gameplay/options.hpp" // Para Options, options, OptionsGame, SectionS... +#include "game/options.hpp" // Para Options, options, OptionsGame, SectionS... #include "utils/defines.hpp" // Para GAME_SPEED #include "utils/global_events.hpp" // Para check #include "utils/utils.hpp" // Para PaletteColor diff --git a/source/game/scenes/ending2.cpp b/source/game/scenes/ending2.cpp index 71e35ee..c589663 100644 --- a/source/game/scenes/ending2.cpp +++ b/source/game/scenes/ending2.cpp @@ -1,5 +1,3 @@ -#include "game/scene_manager.hpp" // Para SceneManager - #include "game/scenes/ending2.hpp" #include @@ -14,7 +12,8 @@ #include "core/rendering/text.hpp" // Para Text #include "core/resources/resource.hpp" // Para Resource #include "external/jail_audio.h" // Para JA_SetVolume, JA_PlayMusic, JA_StopMusic -#include "game/gameplay/options.hpp" // Para Options, options, OptionsGame, Sectio... +#include "game/options.hpp" // Para Options, options, OptionsGame, Sectio... +#include "game/scene_manager.hpp" // Para SceneManager #include "utils/defines.hpp" // Para GAMECANVAS_CENTER_X, GAMECANVAS_CENTER_Y #include "utils/global_events.hpp" // Para check #include "utils/utils.hpp" // Para PaletteColor, stringToColor @@ -182,7 +181,7 @@ void Ending2::updateState() { case EndingState::FADING: if (state_.hasEnded(EndingState::FADING)) { SceneManager::current = SceneManager::Scene::LOGO; - SceneManager::options = SceneManager::Options::LOGO_TO_INTRO; + SceneManager::options = SceneManager::Options::LOGO_TO_LOADING_SCREEN; } break; diff --git a/source/game/scenes/game.cpp b/source/game/scenes/game.cpp index cc2ab6f..8a62560 100644 --- a/source/game/scenes/game.cpp +++ b/source/game/scenes/game.cpp @@ -17,7 +17,7 @@ #include "external/jail_audio.h" // Para JA_PauseMusic, JA_GetMusicState, JA_P... #include "game/gameplay/cheevos.hpp" // Para Cheevos #include "game/gameplay/item_tracker.hpp" // Para ItemTracker -#include "game/gameplay/options.hpp" // Para Options, options, Cheat, SectionState +#include "game/options.hpp" // Para Options, options, Cheat, SectionState #include "game/gameplay/room.hpp" // Para Room, RoomData #include "game/gameplay/room_tracker.hpp" // Para RoomTracker #include "game/gameplay/scoreboard.hpp" // Para ScoreboardData, Scoreboard diff --git a/source/game/scenes/game_over.cpp b/source/game/scenes/game_over.cpp index 2dca4f6..e624310 100644 --- a/source/game/scenes/game_over.cpp +++ b/source/game/scenes/game_over.cpp @@ -13,7 +13,7 @@ #include "core/rendering/text.hpp" // Para TEXT_CENTER, TEXT_COLOR, Text #include "core/resources/resource.hpp" // Para Resource #include "external/jail_audio.h" // Para JA_PlayMusic -#include "game/gameplay/options.hpp" // Para Options, options, OptionsStats, Secti... +#include "game/options.hpp" // Para Options, options, OptionsStats, Secti... #include "utils/defines.hpp" // Para GAMECANVAS_CENTER_X, GAME_SPEED #include "utils/global_events.hpp" // Para check #include "utils/utils.hpp" // Para PaletteColor, stringToColor diff --git a/source/game/scenes/loading_screen.cpp b/source/game/scenes/loading_screen.cpp index b42ea5d..686a8b2 100644 --- a/source/game/scenes/loading_screen.cpp +++ b/source/game/scenes/loading_screen.cpp @@ -11,7 +11,7 @@ #include "core/rendering/surface_sprite.hpp" // Para SSprite #include "core/resources/resource.hpp" // Para Resource #include "external/jail_audio.h" // Para JA_PlayMusic, JA_SetVolume, JA_StopMusic -#include "game/gameplay/options.hpp" // Para Options, options, SectionState, Options... +#include "game/options.hpp" // Para Options, options, SectionState, Options... #include "utils/defines.hpp" // Para GAME_SPEED #include "utils/global_events.hpp" // Para check #include "utils/utils.hpp" // Para stringToColor, PaletteColor diff --git a/source/game/scenes/logo.cpp b/source/game/scenes/logo.cpp index 3b1c3ac..3e98060 100644 --- a/source/game/scenes/logo.cpp +++ b/source/game/scenes/logo.cpp @@ -1,5 +1,3 @@ -#include "game/scene_manager.hpp" // Para SceneManager - #include "game/scenes/logo.hpp" #include @@ -9,7 +7,8 @@ #include "core/rendering/surface.hpp" // Para Surface #include "core/rendering/surface_sprite.hpp" // Para SSprite #include "core/resources/resource.hpp" // Para Resource -#include "game/gameplay/options.hpp" // Para Options, SectionState, options, Section +#include "game/options.hpp" // Para Options, SectionState, options, Section +#include "game/scene_manager.hpp" // Para SceneManager #include "utils/defines.hpp" // Para GAME_SPEED #include "utils/global_events.hpp" // Para check #include "utils/utils.hpp" // Para PaletteColor @@ -165,23 +164,13 @@ void Logo::updateTextureColors() { void Logo::update() { // Comprueba que la diferencia de ticks sea mayor a la velocidad del juego if (SDL_GetTicks() - ticks_ > GAME_SPEED) { - // Actualiza el contador de ticks - ticks_ = SDL_GetTicks(); + ticks_ = SDL_GetTicks(); // Actualiza el contador de ticks - // Comprueba las entradas - checkInput(); - - // Incrementa el contador - counter_++; - - // Gestiona el logo de JAILGAME - updateJAILGAMES(); - - // Gestiona el color de las texturas - updateTextureColors(); - - // Actualiza el objeto Screen - Screen::get()->update(); + checkInput(); // Comprueba las entradas + counter_++; // Incrementa el contador + updateJAILGAMES(); // Gestiona el logo de JAILGAME + updateTextureColors(); // Gestiona el color de las texturas + Screen::get()->update(); // Actualiza el objeto Screen // Comprueba si ha terminado el logo if (counter_ == END_LOGO_ + POST_LOGO_) { @@ -217,11 +206,17 @@ void Logo::run() { // Termina la sección void Logo::endSection() { - if (SceneManager::options == SceneManager::Options::LOGO_TO_TITLE) { - SceneManager::current = SceneManager::Scene::TITLE; - } + switch (SceneManager::options) { + case SceneManager::Options::LOGO_TO_TITLE: + SceneManager::current = SceneManager::Scene::TITLE; + break; - else if (SceneManager::options == SceneManager::Options::LOGO_TO_INTRO) { - SceneManager::current = SceneManager::Scene::LOADING_SCREEN; + case SceneManager::Options::LOGO_TO_LOADING_SCREEN: + SceneManager::current = SceneManager::Scene::LOADING_SCREEN; + break; + + default: + // Ninguna acción por defecto + break; } -} \ No newline at end of file +} diff --git a/source/game/scenes/title.cpp b/source/game/scenes/title.cpp index 7e67350..af209a5 100644 --- a/source/game/scenes/title.cpp +++ b/source/game/scenes/title.cpp @@ -14,7 +14,7 @@ #include "core/rendering/text.hpp" // Para Text, TEXT_CENTER, TEXT_COLOR #include "core/resources/resource.hpp" // Para Resource #include "game/gameplay/cheevos.hpp" // Para Cheevos, Achievement -#include "game/gameplay/options.hpp" // Para Options, options, SectionState, Section +#include "game/options.hpp" // Para Options, options, SectionState, Section #include "utils/defines.hpp" // Para PLAY_AREA_CENTER_X, GAMECANVAS_WIDTH #include "utils/global_events.hpp" // Para check #include "utils/utils.hpp" // Para stringToColor, PaletteColor, playMusic diff --git a/source/game/ui/notifier.cpp b/source/game/ui/notifier.cpp index f2c6aab..be26a5d 100644 --- a/source/game/ui/notifier.cpp +++ b/source/game/ui/notifier.cpp @@ -13,7 +13,7 @@ #include "core/rendering/text.hpp" // Para Text, TEXT_CENTER, TEXT_COLOR #include "core/resources/resource.hpp" // Para Resource #include "external/jail_audio.h" // Para JA_PlaySound -#include "game/gameplay/options.hpp" // Para Options, options, NotificationPosition +#include "game/options.hpp" // Para Options, options, NotificationPosition #include "utils/utils.hpp" // Para PaletteColor // [SINGLETON] diff --git a/source/utils/global_events.cpp b/source/utils/global_events.cpp index 80a6c66..49e3984 100644 --- a/source/utils/global_events.cpp +++ b/source/utils/global_events.cpp @@ -3,7 +3,7 @@ #include "utils/global_events.hpp" #include "core/input/mouse.hpp" -#include "game/gameplay/options.hpp" // Para Options, options, OptionsGame, OptionsAudio +#include "game/options.hpp" // Para Options, options, OptionsGame, OptionsAudio namespace globalEvents { // Comprueba los eventos que se pueden producir en cualquier sección del juego