diff --git a/source/core/audio/jail_audio.hpp b/source/core/audio/jail_audio.hpp index 57858b4..cb46012 100644 --- a/source/core/audio/jail_audio.hpp +++ b/source/core/audio/jail_audio.hpp @@ -26,14 +26,14 @@ struct SDLFreeDeleter { }; // --- Public Enums --- -enum JA_Channel_state { +enum JA_Channel_state : std::uint8_t { JA_CHANNEL_INVALID, JA_CHANNEL_FREE, JA_CHANNEL_PLAYING, JA_CHANNEL_PAUSED, JA_SOUND_DISABLED, }; -enum JA_Music_state { +enum JA_Music_state : std::uint8_t { JA_MUSIC_INVALID, JA_MUSIC_PLAYING, JA_MUSIC_PAUSED, @@ -42,7 +42,7 @@ enum JA_Music_state { }; // --- Struct Definitions --- -enum { +enum : std::uint8_t { JA_MAX_SIMULTANEOUS_CHANNELS = 20, JA_MAX_GROUPS = 2 }; diff --git a/source/core/jail/jdraw8.cpp b/source/core/jail/jdraw8.cpp index cd7d70f..45805ae 100644 --- a/source/core/jail/jdraw8.cpp +++ b/source/core/jail/jdraw8.cpp @@ -65,7 +65,7 @@ auto JD8_LoadSurface(const char* file) -> JD8_Surface { memcpy(image, cached.data(), 64000); return image; } catch (const std::exception&) { - // No està al cache (asset no llistat al manifest). Fallback. + // @INTENTIONAL: no està al cache (asset no llistat al manifest), fallback al loader. } } @@ -95,7 +95,7 @@ auto JD8_LoadPalette(const char* file) -> JD8_Palette { memcpy(palette, cached.data(), 768); return palette; } catch (const std::exception&) { - // No està al cache — fallback a lectura + LoadPalette. + // @INTENTIONAL: no està al cache, fallback a lectura + LoadPalette. } } @@ -262,7 +262,7 @@ void JD8_SetPaletteColor(Uint8 index, Uint8 r, Uint8 g, Uint8 b) { // el caller decideix quan fer Flip. namespace { - enum class FadeType { + enum class FadeType : std::uint8_t { None = 0, Out, ToPal, diff --git a/source/core/jail/jinput.hpp b/source/core/jail/jinput.hpp index b5536c4..d6072ce 100644 --- a/source/core/jail/jinput.hpp +++ b/source/core/jail/jinput.hpp @@ -1,6 +1,8 @@ #pragma once #include +#include + void JI_DisableKeyboard(Uint32 time); // Bloqueja tot l'input cap al joc (JI_KeyPressed retorna false per a tot) @@ -9,7 +11,7 @@ void JI_SetInputBlocked(bool blocked); // Estableix l'estat d'una tecla virtual. Múltiples fonts (gamepad, remap) // s'agrupen per OR. JI_KeyPressed retorna true si el teclat real O qualsevol // font virtual està premuda. -enum JI_VirtualSource { +enum JI_VirtualSource : std::uint8_t { JI_VSRC_GAMEPAD = 0, JI_VSRC_REMAP = 1, JI_VSRC_COUNT = 2 diff --git a/source/core/locale/locale.cpp b/source/core/locale/locale.cpp index bd4161d..80a6bea 100644 --- a/source/core/locale/locale.cpp +++ b/source/core/locale/locale.cpp @@ -22,7 +22,9 @@ namespace Locale { } else if (node.is_scalar()) { try { strings_[prefix] = node.get_value(); - } catch (...) {} + } catch (...) { + // @INTENTIONAL: si el valor no és string vàlid, l'ignorem i continuem. + } } } diff --git a/source/core/rendering/menu.cpp b/source/core/rendering/menu.cpp index 0da7b74..a54fbf0 100644 --- a/source/core/rendering/menu.cpp +++ b/source/core/rendering/menu.cpp @@ -49,7 +49,7 @@ namespace Menu { static constexpr float HEIGHT_RATE = 12.0F; // smoothing exponencial de l'alçada (~150 ms al 90%) // --- Items --- - enum class ItemKind { Toggle, + enum class ItemKind : std::uint8_t { Toggle, Cycle, IntRange, Submenu, diff --git a/source/core/rendering/overlay.cpp b/source/core/rendering/overlay.cpp index a884042..73a255e 100644 --- a/source/core/rendering/overlay.cpp +++ b/source/core/rendering/overlay.cpp @@ -33,7 +33,7 @@ namespace Overlay { // --- Estat de les notificacions --- - enum class Status { RISING, + enum class Status : std::uint8_t { RISING, STAY, VANISHING, FINISHED }; @@ -73,7 +73,7 @@ namespace Overlay { // --- Crèdits cinematogràfics --- // Usen el sistema de notificacions en posició TOP_CENTER_DROP. - enum class CreditsPhase { IDLE, + enum class CreditsPhase : std::uint8_t { IDLE, DELAY, PLAYING_1, GAP, diff --git a/source/core/rendering/overlay.hpp b/source/core/rendering/overlay.hpp index 12f8383..9ec3cbb 100644 --- a/source/core/rendering/overlay.hpp +++ b/source/core/rendering/overlay.hpp @@ -2,6 +2,7 @@ #include +#include #include #include diff --git a/source/core/rendering/shader_backend.hpp b/source/core/rendering/shader_backend.hpp index 657cbae..aa5acfc 100644 --- a/source/core/rendering/shader_backend.hpp +++ b/source/core/rendering/shader_backend.hpp @@ -2,6 +2,7 @@ #include +#include #include #include @@ -10,7 +11,7 @@ namespace Rendering { /** @brief Identificador del shader de post-procesado activo */ - enum class ShaderType { POSTFX, + enum class ShaderType : std::uint8_t { POSTFX, CRTPI }; /** diff --git a/source/core/resources/resource_cache.hpp b/source/core/resources/resource_cache.hpp index fd8fd86..8f26959 100644 --- a/source/core/resources/resource_cache.hpp +++ b/source/core/resources/resource_cache.hpp @@ -3,6 +3,7 @@ #include #include +#include #include #include #include @@ -42,7 +43,7 @@ namespace Resource { private: Cache() = default; - enum class LoadStage { + enum class LoadStage : std::uint8_t { MUSICS, SOUNDS, BITMAPS, diff --git a/source/core/resources/resource_list.hpp b/source/core/resources/resource_list.hpp index 66dc80e..dbc3e25 100644 --- a/source/core/resources/resource_list.hpp +++ b/source/core/resources/resource_list.hpp @@ -1,5 +1,6 @@ #pragma once +#include #include #include #include @@ -13,7 +14,7 @@ namespace Resource { // iterar per categoria a l'hora de carregar. class List { public: - enum class Type : int { + enum class Type : std::uint8_t { DATA, BITMAP, MUSIC, diff --git a/source/game/mapa.hpp b/source/game/mapa.hpp index 1f4dbf4..cfd1954 100644 --- a/source/game/mapa.hpp +++ b/source/game/mapa.hpp @@ -1,10 +1,12 @@ #pragma once +#include + #include "core/jail/jdraw8.hpp" #include "game/info.hpp" #include "game/prota.hpp" -enum { +enum : std::uint8_t { CONTE_RES = 0, CONTE_TRESOR = 1, CONTE_FARAO = 2, diff --git a/source/game/marcador.cpp b/source/game/marcador.cpp index 8b7936c..9192480 100644 --- a/source/game/marcador.cpp +++ b/source/game/marcador.cpp @@ -5,8 +5,6 @@ Marcador::Marcador(JD8_Surface gfx, Prota* sam) { this->sam = sam; } -Marcador::~Marcador() = default; - void Marcador::draw() { if (info::ctx.num_piramide < 6) { this->pintaNumero(55, 2, info::ctx.num_piramide); diff --git a/source/game/marcador.hpp b/source/game/marcador.hpp index 5f684db..af3ebd1 100644 --- a/source/game/marcador.hpp +++ b/source/game/marcador.hpp @@ -7,7 +7,7 @@ class Marcador { public: explicit Marcador(JD8_Surface gfx, Prota* sam); - ~Marcador(); + ~Marcador() = default; void draw(); diff --git a/source/game/modulegame.hpp b/source/game/modulegame.hpp index 6497782..6decefd 100644 --- a/source/game/modulegame.hpp +++ b/source/game/modulegame.hpp @@ -1,5 +1,6 @@ #pragma once +#include #include #include @@ -42,7 +43,7 @@ class ModuleGame : public scenes::Scene { [[nodiscard]] auto nextState() const -> int override; private: - enum class Phase { + enum class Phase : std::uint8_t { FadingIn, Playing, FadingOut, diff --git a/source/game/options.cpp b/source/game/options.cpp index 6c74b3c..30cb82b 100644 --- a/source/game/options.cpp +++ b/source/game/options.cpp @@ -441,7 +441,9 @@ namespace Options { if (node.contains(key)) { try { target = node[key].get_value(); - } catch (...) {} + } catch (...) { + // @INTENTIONAL: si el camp YAML no és float vàlid, mantenim el valor per defecte. + } } } @@ -561,32 +563,38 @@ namespace Options { if (p.contains("mask_type")) { try { preset.mask_type = p["mask_type"].get_value(); - } catch (...) {} + } catch (...) { /* @INTENTIONAL: camp YAML invàlid, mantenim el valor per defecte. */ + } } if (p.contains("enable_scanlines")) { try { preset.enable_scanlines = p["enable_scanlines"].get_value(); - } catch (...) {} + } catch (...) { /* @INTENTIONAL: camp YAML invàlid, mantenim el valor per defecte. */ + } } if (p.contains("enable_multisample")) { try { preset.enable_multisample = p["enable_multisample"].get_value(); - } catch (...) {} + } catch (...) { /* @INTENTIONAL: camp YAML invàlid, mantenim el valor per defecte. */ + } } if (p.contains("enable_gamma")) { try { preset.enable_gamma = p["enable_gamma"].get_value(); - } catch (...) {} + } catch (...) { /* @INTENTIONAL: camp YAML invàlid, mantenim el valor per defecte. */ + } } if (p.contains("enable_curvature")) { try { preset.enable_curvature = p["enable_curvature"].get_value(); - } catch (...) {} + } catch (...) { /* @INTENTIONAL: camp YAML invàlid, mantenim el valor per defecte. */ + } } if (p.contains("enable_sharper")) { try { preset.enable_sharper = p["enable_sharper"].get_value(); - } catch (...) {} + } catch (...) { /* @INTENTIONAL: camp YAML invàlid, mantenim el valor per defecte. */ + } } crtpi_presets.push_back(preset); } diff --git a/source/game/options.hpp b/source/game/options.hpp index efa541a..e5116e4 100644 --- a/source/game/options.hpp +++ b/source/game/options.hpp @@ -1,5 +1,6 @@ #pragma once +#include #include #include @@ -19,17 +20,17 @@ namespace Options { }; // Posició del render info - enum class RenderInfoPosition { OFF = 0, + enum class RenderInfoPosition : std::uint8_t { OFF = 0, TOP = 1, BOTTOM = 2 }; // Filtre de textura per a l'upscale final (sempre, no només en 4:3) - enum class TextureFilter { NEAREST = 0, + enum class TextureFilter : std::uint8_t { NEAREST = 0, LINEAR = 1 }; // Mode de presentació lògica (escala finestra): mapeja directament // als valors de SDL_RendererLogicalPresentation. - enum class ScalingMode { DISABLED = 0, + enum class ScalingMode : std::uint8_t { DISABLED = 0, STRETCH = 1, LETTERBOX = 2, OVERSCAN = 3, diff --git a/source/game/scenes/banner_scene.hpp b/source/game/scenes/banner_scene.hpp index 34d05e1..a56d272 100644 --- a/source/game/scenes/banner_scene.hpp +++ b/source/game/scenes/banner_scene.hpp @@ -1,5 +1,7 @@ #pragma once +#include + #include "game/scenes/palette_fade.hpp" #include "game/scenes/scene.hpp" #include "game/scenes/surface_handle.hpp" @@ -26,7 +28,7 @@ namespace scenes { [[nodiscard]] auto nextState() const -> int override { return 0; } private: - enum class Phase { FadingIn, + enum class Phase : std::uint8_t { FadingIn, Showing, FadingOut, Done }; diff --git a/source/game/scenes/credits_scene.hpp b/source/game/scenes/credits_scene.hpp index 5632fca..2d4ef82 100644 --- a/source/game/scenes/credits_scene.hpp +++ b/source/game/scenes/credits_scene.hpp @@ -1,5 +1,7 @@ #pragma once +#include + #include "core/jail/jdraw8.hpp" #include "game/scenes/frame_animator.hpp" #include "game/scenes/palette_fade.hpp" @@ -31,7 +33,7 @@ namespace scenes { [[nodiscard]] auto done() const -> bool override { return phase_ == Phase::Done; } private: - enum class Phase { Rolling, + enum class Phase : std::uint8_t { Rolling, FadingOut, Done }; diff --git a/source/game/scenes/intro_new_logo_scene.hpp b/source/game/scenes/intro_new_logo_scene.hpp index 4e11d51..4eb7441 100644 --- a/source/game/scenes/intro_new_logo_scene.hpp +++ b/source/game/scenes/intro_new_logo_scene.hpp @@ -1,5 +1,6 @@ #pragma once +#include #include #include "core/jail/jdraw8.hpp" @@ -39,7 +40,7 @@ namespace scenes { [[nodiscard]] auto done() const -> bool override { return phase_ == Phase::Done; } private: - enum class Phase { + enum class Phase : std::uint8_t { Initial, // pantalla negra 1000 ms Revealing, // 9 × 2 frames × 150 ms cada un FullLogoFlash, // logo complet + cursor, 200 ms diff --git a/source/game/scenes/intro_scene.hpp b/source/game/scenes/intro_scene.hpp index 50dd087..c78ef9b 100644 --- a/source/game/scenes/intro_scene.hpp +++ b/source/game/scenes/intro_scene.hpp @@ -1,5 +1,6 @@ #pragma once +#include #include #include "core/jail/jdraw8.hpp" @@ -40,7 +41,7 @@ namespace scenes { [[nodiscard]] auto done() const -> bool override { return phase_ == Phase::Done; } private: - enum class Phase { + enum class Phase : std::uint8_t { InitialWait, // 1000 ms pantalla negra Reveal, // 15 passos del wordmark PaletteCycle, // 256 × 20 ms mutant pal[16..31] diff --git a/source/game/scenes/menu_scene.hpp b/source/game/scenes/menu_scene.hpp index 67e1949..b3699da 100644 --- a/source/game/scenes/menu_scene.hpp +++ b/source/game/scenes/menu_scene.hpp @@ -1,5 +1,7 @@ #pragma once +#include + #include "game/scenes/frame_animator.hpp" #include "game/scenes/palette_fade.hpp" #include "game/scenes/scene.hpp" @@ -29,7 +31,7 @@ namespace scenes { [[nodiscard]] auto done() const -> bool override { return phase_ == Phase::Done; } private: - enum class Phase { FadingIn, + enum class Phase : std::uint8_t { FadingIn, Showing, FadingOut, Done }; diff --git a/source/game/scenes/mort_scene.hpp b/source/game/scenes/mort_scene.hpp index 212c74e..b8bdfc4 100644 --- a/source/game/scenes/mort_scene.hpp +++ b/source/game/scenes/mort_scene.hpp @@ -1,5 +1,7 @@ #pragma once +#include + #include "game/scenes/palette_fade.hpp" #include "game/scenes/scene.hpp" #include "game/scenes/surface_handle.hpp" @@ -21,7 +23,7 @@ namespace scenes { [[nodiscard]] auto done() const -> bool override { return phase_ == Phase::Done; } private: - enum class Phase { FadingIn, + enum class Phase : std::uint8_t { FadingIn, Showing, FadingOut, Done }; diff --git a/source/game/scenes/secreta_scene.hpp b/source/game/scenes/secreta_scene.hpp index 96baaa2..ed976b1 100644 --- a/source/game/scenes/secreta_scene.hpp +++ b/source/game/scenes/secreta_scene.hpp @@ -1,5 +1,7 @@ #pragma once +#include + #include "core/jail/jdraw8.hpp" #include "game/scenes/palette_fade.hpp" #include "game/scenes/scene.hpp" @@ -35,7 +37,7 @@ namespace scenes { [[nodiscard]] auto nextState() const -> int override { return 0; } private: - enum class Phase { + enum class Phase : std::uint8_t { InitialFadeOut, Tomba1ScrollIn, Tomba1Hold, diff --git a/source/game/scenes/slides_scene.hpp b/source/game/scenes/slides_scene.hpp index afa31f9..58b04f9 100644 --- a/source/game/scenes/slides_scene.hpp +++ b/source/game/scenes/slides_scene.hpp @@ -1,5 +1,7 @@ #pragma once +#include + #include "core/jail/jdraw8.hpp" #include "game/scenes/palette_fade.hpp" #include "game/scenes/scene.hpp" @@ -44,7 +46,7 @@ namespace scenes { [[nodiscard]] auto nextState() const -> int override { return next_state_; } private: - enum class Phase { + enum class Phase : std::uint8_t { Slide1Enter, Slide1Hold, FadeOut1,