From bf7be3a7f139d1d7aa8d7e9787f4cdfb26b17720 Mon Sep 17 00:00:00 2001 From: Sergio Valor Date: Sat, 16 May 2026 13:52:31 +0200 Subject: [PATCH] fix: cppcheck (21 troballes) --- source/core/audio/jail_audio.hpp | 55 ++++++++++------------ source/core/jail/jdraw8.cpp | 8 ++-- source/core/jail/jdraw8.hpp | 8 ++-- source/core/jail/jfile.cpp | 28 +++++------ source/core/rendering/menu.cpp | 14 +----- source/core/rendering/overlay.cpp | 4 +- source/core/resources/resource_cache.cpp | 4 +- source/core/resources/resource_pack.cpp | 33 ++++++------- source/game/mapa.cpp | 7 ++- source/game/scenes/intro_scene.cpp | 2 +- source/game/scenes/intro_sprites_scene.cpp | 46 +++++++++--------- source/game/scenes/palette_fade.cpp | 2 +- source/game/scenes/palette_fade.hpp | 2 +- 13 files changed, 96 insertions(+), 117 deletions(-) diff --git a/source/core/audio/jail_audio.hpp b/source/core/audio/jail_audio.hpp index e2e86e8..edb3ee2 100644 --- a/source/core/audio/jail_audio.hpp +++ b/source/core/audio/jail_audio.hpp @@ -3,13 +3,14 @@ // --- Includes --- #include -#include // Para uint32_t, uint8_t -#include // Para NULL, fseek, fclose, fopen, fread, ftell, FILE, SEEK_END, SEEK_SET -#include // Para free, malloc -#include // Para std::cout -#include // Para std::unique_ptr -#include // Para std::string -#include // Para std::vector +#include // Para std::fill +#include // Para uint32_t, uint8_t +#include // Para NULL, fseek, fclose, fopen, fread, ftell, FILE, SEEK_END, SEEK_SET +#include // Para free, malloc +#include // Para std::cout +#include // Para std::unique_ptr +#include // Para std::string +#include // Para std::vector #define STB_VORBIS_HEADER_ONLY #include "external/stb_vorbis.c" // NOLINT(bugprone-suspicious-include): stb header-only library @@ -270,9 +271,7 @@ inline void JA_Init(const int freq, const SDL_AudioFormat format, const int num_ for (auto& channel : channels) { channel.state = JA_CHANNEL_FREE; } - for (float& i : JA_soundVolume) { - i = 0.5F; - } + std::fill(std::begin(JA_soundVolume), std::end(JA_soundVolume), 0.5F); } inline void JA_Quit() { @@ -673,10 +672,10 @@ inline void JA_PauseChannel(const int channel) { } if (channel == -1) { - for (auto& channel : channels) { - if (channel.state == JA_CHANNEL_PLAYING) { - channel.state = JA_CHANNEL_PAUSED; - SDL_UnbindAudioStream(channel.stream); + for (auto& ch : channels) { + if (ch.state == JA_CHANNEL_PLAYING) { + ch.state = JA_CHANNEL_PAUSED; + SDL_UnbindAudioStream(ch.stream); } } } else if (channel >= 0 && channel < JA_MAX_SIMULTANEOUS_CHANNELS) { @@ -693,10 +692,10 @@ inline void JA_ResumeChannel(const int channel) { } if (channel == -1) { - for (auto& channel : channels) { - if (channel.state == JA_CHANNEL_PAUSED) { - channel.state = JA_CHANNEL_PLAYING; - SDL_BindAudioStream(sdlAudioDevice, channel.stream); + for (auto& ch : channels) { + if (ch.state == JA_CHANNEL_PAUSED) { + ch.state = JA_CHANNEL_PLAYING; + SDL_BindAudioStream(sdlAudioDevice, ch.stream); } } } else if (channel >= 0 && channel < JA_MAX_SIMULTANEOUS_CHANNELS) { @@ -709,15 +708,15 @@ inline void JA_ResumeChannel(const int channel) { inline void JA_StopChannel(const int channel) { if (channel == -1) { - for (auto& channel : channels) { - if (channel.state != JA_CHANNEL_FREE) { - if (channel.stream != nullptr) { - SDL_DestroyAudioStream(channel.stream); + for (auto& ch : channels) { + if (ch.state != JA_CHANNEL_FREE) { + if (ch.stream != nullptr) { + SDL_DestroyAudioStream(ch.stream); } - channel.stream = nullptr; - channel.state = JA_CHANNEL_FREE; - channel.pos = 0; - channel.sound = nullptr; + ch.stream = nullptr; + ch.state = JA_CHANNEL_FREE; + ch.pos = 0; + ch.sound = nullptr; } } } else if (channel >= 0 && channel < JA_MAX_SIMULTANEOUS_CHANNELS) { @@ -748,9 +747,7 @@ inline auto JA_SetSoundVolume(float volume, const int group = -1) -> float { const float v = SDL_clamp(volume, 0.0F, 1.0F); if (group == -1) { - for (float& i : JA_soundVolume) { - i = v; - } + std::fill(std::begin(JA_soundVolume), std::end(JA_soundVolume), v); } else if (group >= 0 && group < JA_MAX_GROUPS) { JA_soundVolume[group] = v; } else { diff --git a/source/core/jail/jdraw8.cpp b/source/core/jail/jdraw8.cpp index 7316e9a..33ad8e9 100644 --- a/source/core/jail/jdraw8.cpp +++ b/source/core/jail/jdraw8.cpp @@ -145,11 +145,11 @@ void JD8_FillRect(int x, int y, int w, int h, Uint8 color) { } } -void JD8_Blit(JD8_Surface surface) { +void JD8_Blit(const Uint8* surface) { memcpy(screen, surface, 64000); } -void JD8_Blit(int x, int y, JD8_Surface surface, int sx, int sy, int sw, int sh) { +void JD8_Blit(int x, int y, const Uint8* surface, int sx, int sy, int sw, int sh) { int src_pointer = sx + (sy * 320); int dst_pointer = x + (y * 320); for (int i = 0; i < sh; i++) { @@ -159,7 +159,7 @@ void JD8_Blit(int x, int y, JD8_Surface surface, int sx, int sy, int sw, int sh) } } -void JD8_BlitToSurface(int x, int y, JD8_Surface surface, int sx, int sy, int sw, int sh, JD8_Surface dest) { +void JD8_BlitToSurface(int x, int y, const Uint8* surface, int sx, int sy, int sw, int sh, JD8_Surface dest) { int src_pointer = sx + (sy * 320); int dst_pointer = x + (y * 320); for (int i = 0; i < sh; i++) { @@ -305,7 +305,7 @@ void JD8_FadeStartOut() { fade_step = 0; } -void JD8_FadeStartToPal(JD8_Palette pal) { +void JD8_FadeStartToPal(const Color* pal) { fade_type = FadeType::ToPal; memcpy(fade_target, pal, sizeof(Color) * 256); fade_step = 0; diff --git a/source/core/jail/jdraw8.hpp b/source/core/jail/jdraw8.hpp index ccfe647..554654d 100644 --- a/source/core/jail/jdraw8.hpp +++ b/source/core/jail/jdraw8.hpp @@ -30,11 +30,11 @@ void JD8_FillSquare(int ini, int height, Uint8 color); // Pensat per a UI senzilla (barra de progrés del BootLoader, etc.). void JD8_FillRect(int x, int y, int w, int h, Uint8 color); -void JD8_Blit(JD8_Surface surface); +void JD8_Blit(const Uint8* surface); -void JD8_Blit(int x, int y, JD8_Surface surface, int sx, int sy, int sw, int sh); +void JD8_Blit(int x, int y, const Uint8* surface, int sx, int sy, int sw, int sh); -void JD8_BlitToSurface(int x, int y, JD8_Surface surface, int sx, int sy, int sw, int sh, JD8_Surface dest); +void JD8_BlitToSurface(int x, int y, const Uint8* surface, int sx, int sy, int sw, int sh, JD8_Surface dest); void JD8_BlitCK(int x, int y, const Uint8* surface, int sx, int sy, int sw, int sh, Uint8 colorkey); @@ -69,7 +69,7 @@ void JD8_SetPaletteColor(Uint8 index, Uint8 r, Uint8 g, Uint8 b); // un fade en curs per a enllaçar-lo amb un altre subsistema. // L'embolcall `scenes::PaletteFade` ho fa més idiomàtic per a escenes. void JD8_FadeStartOut(); -void JD8_FadeStartToPal(JD8_Palette pal); +void JD8_FadeStartToPal(const Color* pal); auto JD8_FadeTickStep() -> bool; auto JD8_FadeIsActive() -> bool; diff --git a/source/core/jail/jfile.cpp b/source/core/jail/jfile.cpp index 5f1dc15..e52d51f 100644 --- a/source/core/jail/jfile.cpp +++ b/source/core/jail/jfile.cpp @@ -3,6 +3,7 @@ #include #include +#include #include #include #include @@ -90,11 +91,10 @@ void file_setconfigfolder(const char* foldername) { homedir = "/tmp"; } config_folder = std::string(homedir) + "/.config/" + foldername; +#else + config_folder = std::string("/tmp/jailgames_config/") + foldername; #endif - if (config_folder.empty()) { - config_folder = "/tmp/jailgames_config"; - } std::error_code ec; std::filesystem::create_directories(config_folder, ec); // A emscripten/MEMFS create_directories pot fallar (p.ex. parent @@ -112,12 +112,11 @@ auto file_getconfigvalue(const char* key) -> const char* { if (config.empty()) { load_config_values(); } - for (const auto& pair : config) { - if (pair.key == key) { - thread_local std::string value_cache; - value_cache = pair.value; - return value_cache.c_str(); - } + const auto it = std::find_if(config.begin(), config.end(), [key](const keyvalue& pair) { return pair.key == key; }); + if (it != config.end()) { + thread_local std::string value_cache; + value_cache = it->value; + return value_cache.c_str(); } return nullptr; } @@ -126,12 +125,11 @@ void file_setconfigvalue(const char* key, const char* value) { if (config.empty()) { load_config_values(); } - for (auto& pair : config) { - if (pair.key == key) { - pair.value = value; - save_config_values(); - return; - } + const auto it = std::find_if(config.begin(), config.end(), [key](const keyvalue& pair) { return pair.key == key; }); + if (it != config.end()) { + it->value = value; + save_config_values(); + return; } config.push_back({std::string(key), std::string(value)}); save_config_values(); diff --git a/source/core/rendering/menu.cpp b/source/core/rendering/menu.cpp index 66f3122..c302423 100644 --- a/source/core/rendering/menu.cpp +++ b/source/core/rendering/menu.cpp @@ -365,12 +365,7 @@ namespace Menu { // body = (N-1) * ITEM_SPACING + charH — així BOTTOM_PAD és el buit real // sota el text del darrer ítem, no un buit extra per sobre d'un "slot" buit. static auto boxHeight(const Page& page) -> int { - int n = 0; - for (const auto& it : page.items) { - if (isVisible(it)) { - ++n; - } - } + const int n = static_cast(std::count_if(page.items.begin(), page.items.end(), [](const auto& it) { return isVisible(it); })); int body = (n == 0) ? 8 : ((n - 1) * ITEM_SPACING) + 8; int header = HEADER_H + (page.subtitle.empty() ? 0 : SUBTITLE_H); return header + body + BOTTOM_PAD; @@ -557,12 +552,7 @@ namespace Menu { items_y += SUBTITLE_H; } // Compta visibles — si cap, dibuixa placeholder (caixa totalment col·lapsada però oberta) - int visible_count = 0; - for (const auto& it : page.items) { - if (isVisible(it)) { - ++visible_count; - } - } + const int visible_count = static_cast(std::count_if(page.items.begin(), page.items.end(), [](const auto& it) { return isVisible(it); })); if (visible_count == 0) { const char* empty_text = Locale::get("menu.values.empty"); int ew = font_->width(empty_text); diff --git a/source/core/rendering/overlay.cpp b/source/core/rendering/overlay.cpp index 73a255e..ffbc285 100644 --- a/source/core/rendering/overlay.cpp +++ b/source/core/rendering/overlay.cpp @@ -246,7 +246,7 @@ namespace Overlay { // Calcula amplada total interpolant cada segment per la seva anim float total_w = 0.0F; - for (auto& seg : info_segments_) { + for (const auto& seg : info_segments_) { if (seg.anim > 0.0F && !seg.text.empty()) { int w = seg.mono_digits ? font_->widthMonoDigits(seg.text.c_str(), DIGIT_CELL) @@ -270,7 +270,7 @@ namespace Overlay { // Dibuixa cada segment en la seva posició x acumulada float cur_x = (SCREEN_W - total_w) / 2.0F; - for (auto& seg : info_segments_) { + for (const auto& seg : info_segments_) { if (seg.anim > 0.01F && !seg.text.empty()) { int xi = static_cast(cur_x); int seg_w = seg.mono_digits diff --git a/source/core/resources/resource_cache.cpp b/source/core/resources/resource_cache.cpp index 1bc123f..681c813 100644 --- a/source/core/resources/resource_cache.cpp +++ b/source/core/resources/resource_cache.cpp @@ -79,7 +79,7 @@ namespace Resource { } void Cache::calculateTotal() { - auto* list = List::get(); + const auto* list = List::get(); total_count_ = static_cast( list->getListByType(List::Type::MUSIC).size() + list->getListByType(List::Type::SOUND).size() + @@ -110,7 +110,7 @@ namespace Resource { const Uint64 start_ns = SDL_GetTicksNS(); const Uint64 budget_ns = static_cast(budget_ms) * 1'000'000ULL; - auto* list = List::get(); + const auto* list = List::get(); while (stage_ != LoadStage::DONE) { switch (stage_) { diff --git a/source/core/resources/resource_pack.cpp b/source/core/resources/resource_pack.cpp index 9136552..cbdea2e 100644 --- a/source/core/resources/resource_pack.cpp +++ b/source/core/resources/resource_pack.cpp @@ -5,6 +5,7 @@ #include #include #include +#include const std::string ResourcePack::DEFAULT_ENCRYPT_KEY = "AEE_RESOURCES__2026"; @@ -21,11 +22,7 @@ ResourcePack::~ResourcePack() { auto ResourcePack::calculateChecksum(const std::vector& data) -> uint32_t { // djb2-like hash, seed 0x12345678 (idèntic a CCAE). - uint32_t checksum = 0x12345678; - for (unsigned char b : data) { - checksum = ((checksum << 5) + checksum) + b; - } - return checksum; + return std::accumulate(data.begin(), data.end(), uint32_t{0x12345678}, [](uint32_t acc, unsigned char b) { return ((acc << 5) + acc) + b; }); } void ResourcePack::encryptData(std::vector& data, const std::string& key) { @@ -163,20 +160,18 @@ auto ResourcePack::addDirectory(const std::string& directory) -> bool { return false; } - for (const auto& entry : std::filesystem::recursive_directory_iterator(directory)) { - if (!entry.is_regular_file()) { - continue; - } - - std::string filepath = entry.path().string(); - std::string filename = std::filesystem::relative(entry.path(), directory).string(); - std::ranges::replace(filename, '\\', '/'); - - if (!addFile(filename, filepath)) { - return false; - } - } - return true; + namespace fs = std::filesystem; + return std::all_of(fs::recursive_directory_iterator(directory), + fs::recursive_directory_iterator{}, + [&](const fs::directory_entry& entry) { + if (!entry.is_regular_file()) { + return true; + } + std::string filepath = entry.path().string(); + std::string filename = fs::relative(entry.path(), directory).string(); + std::ranges::replace(filename, '\\', '/'); + return addFile(filename, filepath); + }); } auto ResourcePack::getResource(const std::string& filename) -> std::vector { diff --git a/source/game/mapa.cpp b/source/game/mapa.cpp index 0c8a73b..1a0e47c 100644 --- a/source/game/mapa.cpp +++ b/source/game/mapa.cpp @@ -1,5 +1,6 @@ #include "game/mapa.hpp" +#include #include #include "core/jail/jgame.hpp" @@ -246,10 +247,8 @@ void Mapa::comprovaCaixa(Uint8 num) { } // Si algun costat encara no està passat, no hi ha res que fer - for (bool i : this->tombes[num].costat) { - if (!i) { - return; - } + if (std::any_of(std::begin(this->tombes[num].costat), std::end(this->tombes[num].costat), [](bool c) { return !c; })) { + return; } // Sinó, pos la acabem d'obrir diff --git a/source/game/scenes/intro_scene.cpp b/source/game/scenes/intro_scene.cpp index 425c467..66122ef 100644 --- a/source/game/scenes/intro_scene.cpp +++ b/source/game/scenes/intro_scene.cpp @@ -49,7 +49,7 @@ namespace { // blit únic del wordmark "JAILGAMES" complet (231×45 al destí 43,78). // IntroScene només s'activa quan use_new_logo == false, així que la // branca use_new_logo d'aquell helper aquí no es necessita. - void drawWordmark(JD8_Surface gfx) { + void drawWordmark(const Uint8* gfx) { JD8_Blit(43, 78, gfx, 43, 155, 231, 45); } diff --git a/source/game/scenes/intro_sprites_scene.cpp b/source/game/scenes/intro_sprites_scene.cpp index 682e474..2fc0df9 100644 --- a/source/game/scenes/intro_sprites_scene.cpp +++ b/source/game/scenes/intro_sprites_scene.cpp @@ -52,7 +52,7 @@ namespace { // Branqueja segons use_new_logo perquè la mateixa sub-escena es // reutilitza des de IntroScene (logo vell) i IntroNewLogoScene (logo // nou) amb arxius diferents però mateix layout de sprites. - void drawWordmark(JD8_Surface gfx) { + void drawWordmark(const Uint8* gfx) { if (Options::game.use_new_logo) { // Centrat: (320 − 188) / 2 = 66 (IntroNewLogoScene usa la mateixa x). JD8_Blit(66, 78, gfx, 60, 158, 188, 28); @@ -61,7 +61,7 @@ namespace { } } - using RenderFn = void (*)(JD8_Surface, int); + using RenderFn = void (*)(const Uint8*, int); // Una fase — rang [start_i..end_i] inclusive (direcció implícita per // signe), funció de render, i flag d'skippable. Totes les fases actuals @@ -78,38 +78,38 @@ namespace { // Variant 0 — Interrogant / Momia // ========================================================================= - void v0_walk_right(JD8_Surface gfx, int i) { + void v0_walk_right(const Uint8* gfx, int i) { JD8_ClearScreen(0); drawWordmark(gfx); JD8_BlitCK(i, 150, gfx, fr1[(i / 5) % 13], 0, 15, 15, 0); } - void v0_pull_map_right(JD8_Surface gfx, int i) { + void v0_pull_map_right(const Uint8* gfx, int i) { JD8_ClearScreen(0); drawWordmark(gfx); JD8_BlitCK(200, 150, gfx, fr3[std::min(i / 5, 10)], 30, 15, 15, 0); } - void v0_walk_left_to_80(JD8_Surface gfx, int i) { + void v0_walk_left_to_80(const Uint8* gfx, int i) { JD8_ClearScreen(0); drawWordmark(gfx); JD8_BlitCK(i, 150, gfx, fr2[(i / 5) % 13], 15, 15, 15, 0); } - void v0_pull_map_left(JD8_Surface gfx, int i) { + void v0_pull_map_left(const Uint8* gfx, int i) { JD8_ClearScreen(0); drawWordmark(gfx); JD8_BlitCK(80, 150, gfx, fr4[std::min(i / 5, 10)], 45, 15, 15, 0); } - void v0_momia_left(JD8_Surface gfx, int i) { + void v0_momia_left(const Uint8* gfx, int i) { JD8_ClearScreen(0); drawWordmark(gfx); JD8_BlitCK(i, 150, gfx, fr6[(i / 5) % 8], 60, 15, 15, 0); JD8_BlitCK(80, 150, gfx, fr4[10], 45, 15, 15, 0); } - void v0_turn(JD8_Surface gfx, int /*i*/) { + void v0_turn(const Uint8* gfx, int /*i*/) { JD8_ClearScreen(0); drawWordmark(gfx); JD8_BlitCK(80, 150, gfx, fr1[1], 0, 15, 15, 0); @@ -117,28 +117,28 @@ namespace { JD8_BlitCK(80, 133, gfx, 0, INTERROGANT, 15, 15, 0); } - void v0_jump1(JD8_Surface gfx, int i) { + void v0_jump1(const Uint8* gfx, int i) { JD8_ClearScreen(0); drawWordmark(gfx); JD8_BlitCK(80, 150 - ((i % 50) / 5), gfx, fr5[std::min(i / 5, 19)], 45, 15, 15, 0); JD8_BlitCK(95, 150, gfx, fr6[4], 60, 15, 15, 0); } - void v0_jump2(JD8_Surface gfx, int i) { + void v0_jump2(const Uint8* gfx, int i) { JD8_ClearScreen(0); drawWordmark(gfx); JD8_BlitCK(80, 140 + ((i % 50) / 5), gfx, fr5[std::min(i / 5, 19)], 45, 15, 15, 0); JD8_BlitCK(95, 150, gfx, fr6[4], 60, 15, 15, 0); } - void v0_walk_final(JD8_Surface gfx, int i) { + void v0_walk_final(const Uint8* gfx, int i) { JD8_ClearScreen(0); drawWordmark(gfx); JD8_BlitCK(i, 150, gfx, fr2[(i / 5) % 13], 15, 15, 15, 0); JD8_BlitCK(95, 150, gfx, fr6[4], 60, 15, 15, 0); } - void v0_final(JD8_Surface gfx, int /*i*/) { + void v0_final(const Uint8* gfx, int /*i*/) { JD8_ClearScreen(0); drawWordmark(gfx); JD8_BlitCK(95, 150, gfx, fr6[4], 60, 15, 15, 0); @@ -163,21 +163,21 @@ namespace { // Variant 1 — Creu / Pedra // ========================================================================= - void v1_walk_right(JD8_Surface gfx, int i) { + void v1_walk_right(const Uint8* gfx, int i) { JD8_ClearScreen(0); drawWordmark(gfx); JD8_BlitCK(200, 155, gfx, 0, CREU, 15, 15, 255); JD8_BlitCK(i, 150, gfx, fr1[(i / 5) % 13], 0, 15, 15, 255); } - void v1_pull_map(JD8_Surface gfx, int i) { + void v1_pull_map(const Uint8* gfx, int i) { JD8_ClearScreen(0); drawWordmark(gfx); JD8_BlitCK(200, 155, gfx, 0, CREU, 15, 15, 255); JD8_BlitCK(200, 150, gfx, fr3[std::min(i / 5, 10)], 30, 15, 15, 255); } - void v1_interrogant(JD8_Surface gfx, int /*i*/) { + void v1_interrogant(const Uint8* gfx, int /*i*/) { JD8_ClearScreen(0); drawWordmark(gfx); JD8_BlitCK(200, 155, gfx, 0, CREU, 15, 15, 255); @@ -185,7 +185,7 @@ namespace { JD8_BlitCK(200, 150, gfx, fr3[10], 30, 15, 15, 255); } - void v1_drop_map(JD8_Surface gfx, int i) { + void v1_drop_map(const Uint8* gfx, int i) { JD8_ClearScreen(0); drawWordmark(gfx); JD8_BlitCK(200, 155, gfx, 0, CREU, 15, 15, 255); @@ -199,7 +199,7 @@ namespace { } } - void v1_stone_fall(JD8_Surface gfx, int i) { + void v1_stone_fall(const Uint8* gfx, int i) { JD8_ClearScreen(0); drawWordmark(gfx); JD8_BlitCK(200, 155, gfx, 0, CREU, 15, 15, 255); @@ -207,14 +207,14 @@ namespace { JD8_BlitCK(200, i * 2, gfx, fr8[0], 75, 15, 15, 255); } - void v1_stone_break(JD8_Surface gfx, int i) { + void v1_stone_break(const Uint8* gfx, int i) { JD8_ClearScreen(0); drawWordmark(gfx); JD8_BlitCK(200, 155, gfx, 0, CREU, 15, 15, 255); JD8_BlitCK(200, 150, gfx, fr8[i / 10], 75, 15, 15, 255); } - void v1_final(JD8_Surface gfx, int /*i*/) { + void v1_final(const Uint8* gfx, int /*i*/) { JD8_ClearScreen(0); drawWordmark(gfx); JD8_BlitCK(200, 155, gfx, 0, CREU, 15, 15, 255); @@ -237,21 +237,21 @@ namespace { // Variant 2 — Ball de carnaval // ========================================================================= - void v2_approach(JD8_Surface gfx, int i) { + void v2_approach(const Uint8* gfx, int i) { JD8_ClearScreen(0); drawWordmark(gfx); JD8_BlitCK(i, 150, gfx, fr1[(i / 5) % 13], 0, 15, 15, 255); JD8_BlitCK(304 - i, 150, gfx, fr6[(i / 10) % 8], 60, 15, 15, 255); } - void v2_still(JD8_Surface gfx, int /*i*/) { + void v2_still(const Uint8* gfx, int /*i*/) { JD8_ClearScreen(0); drawWordmark(gfx); JD8_BlitCK(145, 150, gfx, fr1[1], 0, 15, 15, 255); JD8_BlitCK(160, 150, gfx, fr6[1], 60, 15, 15, 255); } - void v2_horn(JD8_Surface gfx, int i) { + void v2_horn(const Uint8* gfx, int i) { JD8_ClearScreen(0); drawWordmark(gfx); JD8_BlitCK(125, 150, gfx, fr11[(i / 10) % 2], 90, 15, 15, 255); @@ -259,7 +259,7 @@ namespace { JD8_BlitCK(160, 150, gfx, fr6[1], 60, 15, 15, 255); } - void v2_ball(JD8_Surface gfx, int i) { + void v2_ball(const Uint8* gfx, int i) { JD8_ClearScreen(0); drawWordmark(gfx); JD8_BlitCK(145, 150, gfx, fr9[(i / 10) % 16], 120, 15, 15, 255); diff --git a/source/game/scenes/palette_fade.cpp b/source/game/scenes/palette_fade.cpp index cd7adb2..91a8165 100644 --- a/source/game/scenes/palette_fade.cpp +++ b/source/game/scenes/palette_fade.cpp @@ -7,7 +7,7 @@ namespace scenes { active_ = true; } - void PaletteFade::startFadeTo(JD8_Palette target) { + void PaletteFade::startFadeTo(const Color* target) { JD8_FadeStartToPal(target); active_ = true; } diff --git a/source/game/scenes/palette_fade.hpp b/source/game/scenes/palette_fade.hpp index 6feeb71..721d90c 100644 --- a/source/game/scenes/palette_fade.hpp +++ b/source/game/scenes/palette_fade.hpp @@ -16,7 +16,7 @@ namespace scenes { PaletteFade() = default; void startFadeOut(); - void startFadeTo(JD8_Palette target); + void startFadeTo(const Color* target); void tick(int delta_ms);