clang-tidy
clang-format
This commit is contained in:
2025-08-10 22:01:18 +02:00
parent 659a4ced44
commit 41e3fd1d8d
29 changed files with 235 additions and 302 deletions

View File

@@ -397,56 +397,56 @@ void Player::render() {
// Calcula la animacion de moverse y disparar del jugador
auto Player::computeAnimation() const -> std::pair<std::string, SDL_FlipMode> {
const std::string baseAnim = (walking_state_ == State::WALKING_STOP) ? "stand" : "walk";
std::string animName;
SDL_FlipMode flipMode = SDL_FLIP_NONE;
const std::string BASE_ANIM = (walking_state_ == State::WALKING_STOP) ? "stand" : "walk";
std::string anim_name;
SDL_FlipMode flip_mode = SDL_FLIP_NONE;
switch (firing_state_) {
case State::FIRING_NONE:
animName = baseAnim;
flipMode = (walking_state_ == State::WALKING_RIGHT) ? SDL_FLIP_HORIZONTAL : SDL_FLIP_NONE;
anim_name = BASE_ANIM;
flip_mode = (walking_state_ == State::WALKING_RIGHT) ? SDL_FLIP_HORIZONTAL : SDL_FLIP_NONE;
break;
case State::FIRING_UP:
animName = baseAnim + "-fire-center";
flipMode = (walking_state_ == State::WALKING_RIGHT) ? SDL_FLIP_HORIZONTAL : SDL_FLIP_NONE;
anim_name = BASE_ANIM + "-fire-center";
flip_mode = (walking_state_ == State::WALKING_RIGHT) ? SDL_FLIP_HORIZONTAL : SDL_FLIP_NONE;
break;
case State::FIRING_LEFT:
case State::FIRING_RIGHT:
animName = baseAnim + "-fire-side";
flipMode = (firing_state_ == State::FIRING_RIGHT) ? SDL_FLIP_HORIZONTAL : SDL_FLIP_NONE;
anim_name = BASE_ANIM + "-fire-side";
flip_mode = (firing_state_ == State::FIRING_RIGHT) ? SDL_FLIP_HORIZONTAL : SDL_FLIP_NONE;
break;
case State::RECOILING_UP:
animName = baseAnim + "-recoil-center";
flipMode = (walking_state_ == State::WALKING_RIGHT) ? SDL_FLIP_HORIZONTAL : SDL_FLIP_NONE;
anim_name = BASE_ANIM + "-recoil-center";
flip_mode = (walking_state_ == State::WALKING_RIGHT) ? SDL_FLIP_HORIZONTAL : SDL_FLIP_NONE;
break;
case State::RECOILING_LEFT:
case State::RECOILING_RIGHT:
animName = baseAnim + "-recoil-side";
flipMode = (firing_state_ == State::RECOILING_RIGHT) ? SDL_FLIP_HORIZONTAL : SDL_FLIP_NONE;
anim_name = BASE_ANIM + "-recoil-side";
flip_mode = (firing_state_ == State::RECOILING_RIGHT) ? SDL_FLIP_HORIZONTAL : SDL_FLIP_NONE;
break;
case State::COOLING_UP:
animName = baseAnim + "-cool-center";
flipMode = (walking_state_ == State::WALKING_RIGHT) ? SDL_FLIP_HORIZONTAL : SDL_FLIP_NONE;
anim_name = BASE_ANIM + "-cool-center";
flip_mode = (walking_state_ == State::WALKING_RIGHT) ? SDL_FLIP_HORIZONTAL : SDL_FLIP_NONE;
break;
case State::COOLING_LEFT:
case State::COOLING_RIGHT:
animName = baseAnim + "-cool-side";
flipMode = (firing_state_ == State::COOLING_RIGHT) ? SDL_FLIP_HORIZONTAL : SDL_FLIP_NONE;
anim_name = BASE_ANIM + "-cool-side";
flip_mode = (firing_state_ == State::COOLING_RIGHT) ? SDL_FLIP_HORIZONTAL : SDL_FLIP_NONE;
break;
default:
animName = baseAnim;
flipMode = (walking_state_ == State::WALKING_RIGHT) ? SDL_FLIP_HORIZONTAL : SDL_FLIP_NONE;
anim_name = BASE_ANIM;
flip_mode = (walking_state_ == State::WALKING_RIGHT) ? SDL_FLIP_HORIZONTAL : SDL_FLIP_NONE;
break;
}
return {animName, flipMode};
return {anim_name, flip_mode};
}
// Establece la animación correspondiente al estado
@@ -936,15 +936,15 @@ auto Player::isRenderable() const -> bool {
// Añade una puntuación a la tabla de records
void Player::addScoreToScoreBoard() const {
if (hi_score_table_ == nullptr) {
return; // Verificar esto antes de crear el manager
return; // Verificar esto antes de crear el manager
}
const auto ENTRY = HiScoreEntry(trim(getLastEnterName()), getScore(), get1CC());
auto manager = std::make_unique<ManageHiScoreTable>(*hi_score_table_);
if (glowing_entry_ != nullptr) {
*glowing_entry_ = manager->add(ENTRY);
}
manager->saveToFile(Asset::get()->get("score.bin"));
}