fix: const a punters i refs (13 troballes)
This commit is contained in:
@@ -415,7 +415,7 @@ static auto computeFadeDensity(int screen_y, int fade_h, int canvas_height) -> f
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Render amb dissolució als cantons superior/inferior (hash 2D, sense parpelleig)
|
// Render amb dissolució als cantons superior/inferior (hash 2D, sense parpelleig)
|
||||||
void Surface::renderWithVerticalFade(int x, int y, int fade_h, int canvas_height, SDL_FRect* src_rect) const {
|
void Surface::renderWithVerticalFade(int x, int y, int fade_h, int canvas_height, const SDL_FRect* src_rect) const {
|
||||||
const int SX = (src_rect != nullptr) ? static_cast<int>(src_rect->x) : 0;
|
const int SX = (src_rect != nullptr) ? static_cast<int>(src_rect->x) : 0;
|
||||||
const int SY = (src_rect != nullptr) ? static_cast<int>(src_rect->y) : 0;
|
const int SY = (src_rect != nullptr) ? static_cast<int>(src_rect->y) : 0;
|
||||||
const int SW = (src_rect != nullptr) ? static_cast<int>(src_rect->w) : surface_data_->width;
|
const int SW = (src_rect != nullptr) ? static_cast<int>(src_rect->w) : surface_data_->width;
|
||||||
@@ -452,7 +452,7 @@ void Surface::renderWithVerticalFade(int x, int y, int fade_h, int canvas_height
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Idem però reemplaçant un color índex
|
// Idem però reemplaçant un color índex
|
||||||
void Surface::renderWithVerticalFade(int x, int y, int fade_h, int canvas_height, Uint8 source_color, Uint8 target_color, SDL_FRect* src_rect) const {
|
void Surface::renderWithVerticalFade(int x, int y, int fade_h, int canvas_height, Uint8 source_color, Uint8 target_color, const SDL_FRect* src_rect) const {
|
||||||
const int SX = (src_rect != nullptr) ? static_cast<int>(src_rect->x) : 0;
|
const int SX = (src_rect != nullptr) ? static_cast<int>(src_rect->x) : 0;
|
||||||
const int SY = (src_rect != nullptr) ? static_cast<int>(src_rect->y) : 0;
|
const int SY = (src_rect != nullptr) ? static_cast<int>(src_rect->y) : 0;
|
||||||
const int SW = (src_rect != nullptr) ? static_cast<int>(src_rect->w) : surface_data_->width;
|
const int SW = (src_rect != nullptr) ? static_cast<int>(src_rect->w) : surface_data_->width;
|
||||||
|
|||||||
@@ -87,10 +87,10 @@ class Surface {
|
|||||||
void renderWithColorReplace(int x, int y, Uint8 source_color = 0, Uint8 target_color = 0, SDL_FRect* src_rect = nullptr, SDL_FlipMode flip = SDL_FLIP_NONE) const;
|
void renderWithColorReplace(int x, int y, Uint8 source_color = 0, Uint8 target_color = 0, SDL_FRect* src_rect = nullptr, SDL_FlipMode flip = SDL_FLIP_NONE) const;
|
||||||
|
|
||||||
// Render amb dissolució als cantons superior/inferior (hash 2D, sense parpelleig)
|
// Render amb dissolució als cantons superior/inferior (hash 2D, sense parpelleig)
|
||||||
void renderWithVerticalFade(int x, int y, int fade_h, int canvas_height, SDL_FRect* src_rect = nullptr) const;
|
void renderWithVerticalFade(int x, int y, int fade_h, int canvas_height, const SDL_FRect* src_rect = nullptr) const;
|
||||||
|
|
||||||
// Idem però reemplaçant un color índex (per a sprites sobre fons del mateix color)
|
// Idem però reemplaçant un color índex (per a sprites sobre fons del mateix color)
|
||||||
void renderWithVerticalFade(int x, int y, int fade_h, int canvas_height, Uint8 source_color, Uint8 target_color, SDL_FRect* src_rect = nullptr) const;
|
void renderWithVerticalFade(int x, int y, int fade_h, int canvas_height, Uint8 source_color, Uint8 target_color, const SDL_FRect* src_rect = nullptr) const;
|
||||||
|
|
||||||
// Establece un color en la paleta
|
// Establece un color en la paleta
|
||||||
void setColor(int index, Uint32 color);
|
void setColor(int index, Uint32 color);
|
||||||
|
|||||||
@@ -1278,7 +1278,7 @@ auto MapEditor::createNewRoom(const std::string& direction) -> std::string { //
|
|||||||
|
|
||||||
// Comprobar que no hay ya una room en esa dirección
|
// Comprobar que no hay ya una room en esa dirección
|
||||||
if (!direction.empty()) {
|
if (!direction.empty()) {
|
||||||
std::string* existing = nullptr;
|
const std::string* existing = nullptr;
|
||||||
if (direction == "UP") {
|
if (direction == "UP") {
|
||||||
existing = &room_data_.upper_room;
|
existing = &room_data_.upper_room;
|
||||||
} else if (direction == "DOWN") {
|
} else if (direction == "DOWN") {
|
||||||
@@ -1294,7 +1294,7 @@ auto MapEditor::createNewRoom(const std::string& direction) -> std::string { //
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Encontrar el primer número libre (reutiliza huecos)
|
// Encontrar el primer número libre (reutiliza huecos)
|
||||||
auto& rooms = Resource::Cache::get()->getRooms();
|
const auto& rooms = Resource::Cache::get()->getRooms();
|
||||||
std::set<int> used;
|
std::set<int> used;
|
||||||
for (const auto& r : rooms) {
|
for (const auto& r : rooms) {
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ void MiniMap::buildTileColorTable(const std::string& tileset_name) {
|
|||||||
|
|
||||||
// Posiciona las rooms en un grid usando BFS desde las conexiones
|
// Posiciona las rooms en un grid usando BFS desde las conexiones
|
||||||
void MiniMap::layoutRooms() {
|
void MiniMap::layoutRooms() {
|
||||||
auto& rooms = Resource::Cache::get()->getRooms();
|
const auto& rooms = Resource::Cache::get()->getRooms();
|
||||||
if (rooms.empty()) { return; }
|
if (rooms.empty()) { return; }
|
||||||
|
|
||||||
// Mapa de nombre → Room::Data
|
// Mapa de nombre → Room::Data
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ Cheevos::~Cheevos() {
|
|||||||
// Inicializa los logros
|
// Inicializa los logros
|
||||||
void Cheevos::init() { // NOLINT(readability-convert-member-functions-to-static)
|
void Cheevos::init() { // NOLINT(readability-convert-member-functions-to-static)
|
||||||
cheevos_list_.clear();
|
cheevos_list_.clear();
|
||||||
auto* loc = Locale::get();
|
const auto* loc = Locale::get();
|
||||||
cheevos_list_.emplace_back(Achievement{.id = 1, .caption = loc->get("achievements.c1"), .description = loc->get("achievements.d1"), .icon = 2});
|
cheevos_list_.emplace_back(Achievement{.id = 1, .caption = loc->get("achievements.c1"), .description = loc->get("achievements.d1"), .icon = 2});
|
||||||
cheevos_list_.emplace_back(Achievement{.id = 2, .caption = loc->get("achievements.c2"), .description = loc->get("achievements.d2"), .icon = 2});
|
cheevos_list_.emplace_back(Achievement{.id = 2, .caption = loc->get("achievements.c2"), .description = loc->get("achievements.d2"), .icon = 2});
|
||||||
cheevos_list_.emplace_back(Achievement{.id = 3, .caption = loc->get("achievements.c3"), .description = loc->get("achievements.d3"), .icon = 2});
|
cheevos_list_.emplace_back(Achievement{.id = 3, .caption = loc->get("achievements.c3"), .description = loc->get("achievements.d3"), .icon = 2});
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ void Credits::handleInput() {
|
|||||||
|
|
||||||
// Inicializa los textos
|
// Inicializa los textos
|
||||||
void Credits::iniTexts() { // NOLINT(readability-convert-member-functions-to-static)
|
void Credits::iniTexts() { // NOLINT(readability-convert-member-functions-to-static)
|
||||||
auto* loc = Locale::get();
|
const auto* loc = Locale::get();
|
||||||
|
|
||||||
texts_.clear();
|
texts_.clear();
|
||||||
texts_.push_back({.label = "", .color = static_cast<Uint8>(PaletteColor::WHITE)});
|
texts_.push_back({.label = "", .color = static_cast<Uint8>(PaletteColor::WHITE)});
|
||||||
|
|||||||
@@ -172,7 +172,7 @@ void Ending::updateState(float delta_time) {
|
|||||||
void Ending::iniTexts() { // NOLINT(readability-convert-member-functions-to-static)
|
void Ending::iniTexts() { // NOLINT(readability-convert-member-functions-to-static)
|
||||||
// Vector con los textos (traducidos según el idioma activo)
|
// Vector con los textos (traducidos según el idioma activo)
|
||||||
std::vector<TextAndPosition> texts;
|
std::vector<TextAndPosition> texts;
|
||||||
auto* loc = Locale::get();
|
const auto* loc = Locale::get();
|
||||||
|
|
||||||
// Escena #0
|
// Escena #0
|
||||||
texts.push_back({.caption = loc->get("ending.t0"), .pos = 32});
|
texts.push_back({.caption = loc->get("ending.t0"), .pos = 32});
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ void GameOver::render() {
|
|||||||
auto text = Resource::Cache::get()->getText("smb2");
|
auto text = Resource::Cache::get()->getText("smb2");
|
||||||
|
|
||||||
// Escribe el texto de GAME OVER
|
// Escribe el texto de GAME OVER
|
||||||
auto* loc = Locale::get();
|
const auto* loc = Locale::get();
|
||||||
text->writeDX(Text::CENTER_FLAG | Text::COLOR_FLAG, GameCanvas::CENTER_X, TEXT_Y, loc->get("game_over.title"), 1, color_); // NOLINT(readability-static-accessed-through-instance)
|
text->writeDX(Text::CENTER_FLAG | Text::COLOR_FLAG, GameCanvas::CENTER_X, TEXT_Y, loc->get("game_over.title"), 1, color_); // NOLINT(readability-static-accessed-through-instance)
|
||||||
|
|
||||||
// Dibuja los sprites (ya posicionados en el constructor, solo ajustamos Y)
|
// Dibuja los sprites (ya posicionados en el constructor, solo ajustamos Y)
|
||||||
|
|||||||
@@ -544,7 +544,7 @@ void Title::renderMainMenu() {
|
|||||||
const int TOTAL_HEIGHT = 3 * SPACING; // 3 espacios entre 4 items
|
const int TOTAL_HEIGHT = 3 * SPACING; // 3 espacios entre 4 items
|
||||||
const int START_Y = MENU_CENTER_Y - (TOTAL_HEIGHT / 2);
|
const int START_Y = MENU_CENTER_Y - (TOTAL_HEIGHT / 2);
|
||||||
|
|
||||||
auto* loc = Locale::get();
|
const auto* loc = Locale::get();
|
||||||
menu_text_->writeDX(Text::CENTER_FLAG | Text::COLOR_FLAG, PlayArea::CENTER_X, START_Y, loc->get("title.menu.play"), 1, COLOR);
|
menu_text_->writeDX(Text::CENTER_FLAG | Text::COLOR_FLAG, PlayArea::CENTER_X, START_Y, loc->get("title.menu.play"), 1, COLOR);
|
||||||
menu_text_->writeDX(Text::CENTER_FLAG | Text::COLOR_FLAG, PlayArea::CENTER_X, START_Y + SPACING, loc->get("title.menu.keyboard"), 1, COLOR);
|
menu_text_->writeDX(Text::CENTER_FLAG | Text::COLOR_FLAG, PlayArea::CENTER_X, START_Y + SPACING, loc->get("title.menu.keyboard"), 1, COLOR);
|
||||||
menu_text_->writeDX(Text::CENTER_FLAG | Text::COLOR_FLAG, PlayArea::CENTER_X, START_Y + (2 * SPACING), loc->get("title.menu.joystick"), 1, COLOR);
|
menu_text_->writeDX(Text::CENTER_FLAG | Text::COLOR_FLAG, PlayArea::CENTER_X, START_Y + (2 * SPACING), loc->get("title.menu.joystick"), 1, COLOR);
|
||||||
@@ -683,7 +683,7 @@ void Title::renderKeyboardRemap() const {
|
|||||||
const int START_Y = MENU_CENTER_Y - (2 * TEXT_SIZE); // Centrado aproximado
|
const int START_Y = MENU_CENTER_Y - (2 * TEXT_SIZE); // Centrado aproximado
|
||||||
|
|
||||||
// Mensaje principal: "PRESS KEY FOR [ACTION]" o "KEYS DEFINED" si completado
|
// Mensaje principal: "PRESS KEY FOR [ACTION]" o "KEYS DEFINED" si completado
|
||||||
auto* loc = Locale::get();
|
const auto* loc = Locale::get();
|
||||||
if (remap_step_ >= 3) {
|
if (remap_step_ >= 3) {
|
||||||
menu_text_->writeDX(Text::CENTER_FLAG | Text::COLOR_FLAG, PlayArea::CENTER_X, START_Y, loc->get("title.keys.defined"), 1, COLOR);
|
menu_text_->writeDX(Text::CENTER_FLAG | Text::COLOR_FLAG, PlayArea::CENTER_X, START_Y, loc->get("title.keys.defined"), 1, COLOR);
|
||||||
} else {
|
} else {
|
||||||
@@ -731,7 +731,7 @@ void Title::renderJoystickRemap() const {
|
|||||||
const int START_Y = MENU_CENTER_Y - (2 * TEXT_SIZE); // Centrado aproximado
|
const int START_Y = MENU_CENTER_Y - (2 * TEXT_SIZE); // Centrado aproximado
|
||||||
|
|
||||||
// Mensaje principal: "PRESS BUTTON FOR [ACTION]" o "BUTTONS DEFINED" si completado
|
// Mensaje principal: "PRESS BUTTON FOR [ACTION]" o "BUTTONS DEFINED" si completado
|
||||||
auto* loc = Locale::get();
|
const auto* loc = Locale::get();
|
||||||
if (remap_step_ >= 3) {
|
if (remap_step_ >= 3) {
|
||||||
menu_text_->writeDX(Text::CENTER_FLAG | Text::COLOR_FLAG, PlayArea::CENTER_X, START_Y, loc->get("title.buttons.defined"), 1, COLOR);
|
menu_text_->writeDX(Text::CENTER_FLAG | Text::COLOR_FLAG, PlayArea::CENTER_X, START_Y, loc->get("title.buttons.defined"), 1, COLOR);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -32,7 +32,7 @@
|
|||||||
// Toggle genérico para comandos booleanos ON/OFF (reemplaza macro BOOL_TOGGLE_CMD)
|
// Toggle genérico para comandos booleanos ON/OFF (reemplaza macro BOOL_TOGGLE_CMD)
|
||||||
static auto boolToggle(
|
static auto boolToggle(
|
||||||
const std::string& label,
|
const std::string& label,
|
||||||
bool& option,
|
const bool& option,
|
||||||
const std::function<void()>& toggle_fn,
|
const std::function<void()>& toggle_fn,
|
||||||
const std::vector<std::string>& args) -> std::string {
|
const std::vector<std::string>& args) -> std::string {
|
||||||
if (args.empty()) {
|
if (args.empty()) {
|
||||||
|
|||||||
Reference in New Issue
Block a user