Lint: rename de métodos privados (camelBack + traducción al inglés)
Tanda grande de identifier-naming: 47 métodos privados pasan de snake_case (en su mayoría catalán/spanish) a camelBack inglés. Solo afecta a sus archivos hpp+cpp; ningún símbolo cruza fichero (los públicos quedan para una pasada manual con VS Code). Renames por clase: - ShapeLoader: resolve_path → resolvePath. - VectorText: load_charset → loadCharset, get_shape_filename → getShapeFilename. - Shape: starts_with → startsWith (cuidado de no tocar std::string::starts_with que también usaba), extract_value → extractValue, parse_center → parseCenter, parse_points → parsePoints. - Starfield: inicialitzar_estrella → initStar, fora_area → isOutsideArea, calcular_escala → computeScale, calcular_brightness → computeBrightness. - TitleScene: actualitzar_animacio_logo → updateLogoAnimation, inicialitzar_titol → initTitle. - LogoScene: inicialitzar_lletres → initLetters, actualitzar_explosions → updateExplosions, canviar_estat → changeState, totes_lletres_completes → allLettersComplete. - SpawnController: generar_spawn_events → generateSpawnEvents, seleccionar_tipus_aleatori → selectRandomType, spawn_enemic → spawnEnemy, aplicar_multiplicadors → applyMultipliers. - ShipAnimator: actualitzar_entering/floating/exiting → updateEntering/Floating/Exiting, configurar_nau_p1/p2 → configureShipP1/P2, calcular_posicio_fora_pantalla → computeOffscreenPosition. - GameScene: dibuixar_marges → drawMargins, dibuixar_marcador → drawScoreboard, disparar_bala → fireBullet, obtenir_punt_spawn → getSpawnPoint, unir_jugador → joinPlayer, dibuixar_continue → drawContinue, dibuixar_missatge_stage → drawStageMessage. - StageLoader: parse_metadata/stage/spawn_config/distribution/multipliers/ spawn_mode → parseMetadata/Stage/SpawnConfig/Distribution/Multipliers/ SpawnMode, validar_config → validateConfig. - StageManager: canviar_estat → changeState, processar_init_hud/level_start/playing/level_completed → processInitHud/LevelStart/Playing/LevelCompleted, carregar_stage → loadStage. Métodos públicos y funciones libres (cross-file) quedan a propósito sin tocar — los renombrará el usuario con la herramienta de rename de VS Code. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
c80212adb9
commit
6d0df85e5e
23 files changed
+181
-181
No files matched your search
@@ -122,7 +122,7 @@ void GameScene::init() {
|
||||
score_per_player_[1] = 0;
|
||||
floating_score_manager_.reset();
|
||||
|
||||
// DEPRECATED: spawn_position_ ya no s'usa, es calcula dinàmicament con obtenir_punt_spawn(player_id)
|
||||
// DEPRECATED: spawn_position_ ya no s'usa, es calcula dinàmicament con getSpawnPoint(player_id)
|
||||
// const SDL_FRect& zona = Defaults::Zones::PLAYAREA;
|
||||
// spawn_position_.x = zona.x + zona.w * 0.5f;
|
||||
// spawn_position_.y = zona.y + zona.h * Defaults::Game::INIT_HUD_SHIP_START_Y_RATIO;
|
||||
@@ -133,7 +133,7 @@ void GameScene::init() {
|
||||
|
||||
if (jugador_actiu) {
|
||||
// Jugador active: init normalment
|
||||
Vec2 spawn_pos = obtenir_punt_spawn(i);
|
||||
Vec2 spawn_pos = getSpawnPoint(i);
|
||||
ships_[i].init(&spawn_pos, false); // No invulnerability at start
|
||||
// Registrar el cuerpo físico de la nave en el mundo (Fase 6c)
|
||||
physics_world_.addBody(&ships_[i].getBody());
|
||||
@@ -213,11 +213,11 @@ void GameScene::stepShootingInput() {
|
||||
auto* input = Input::get();
|
||||
if (match_config_.jugador1_actiu &&
|
||||
input->checkActionPlayer1(InputAction::SHOOT, Input::DO_NOT_ALLOW_REPEAT)) {
|
||||
disparar_bala(0);
|
||||
fireBullet(0);
|
||||
}
|
||||
if (match_config_.jugador2_actiu &&
|
||||
input->checkActionPlayer2(InputAction::SHOOT, Input::DO_NOT_ALLOW_REPEAT)) {
|
||||
disparar_bala(1);
|
||||
fireBullet(1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -248,7 +248,7 @@ void GameScene::stepMidGameJoin() {
|
||||
? input->checkActionPlayer1(InputAction::START, Input::DO_NOT_ALLOW_REPEAT)
|
||||
: input->checkActionPlayer2(InputAction::START, Input::DO_NOT_ALLOW_REPEAT);
|
||||
if (START_PRESSED) {
|
||||
unir_jugador(pid);
|
||||
joinPlayer(pid);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -269,7 +269,7 @@ auto GameScene::stepContinueScreen(float delta_time) -> bool {
|
||||
.hit_timer_per_player = hit_timer_per_player_,
|
||||
.ships = ships_,
|
||||
.match_config = match_config_,
|
||||
.get_spawn_point = [this](uint8_t pid) { return obtenir_punt_spawn(pid); },
|
||||
.get_spawn_point = [this](uint8_t pid) { return getSpawnPoint(pid); },
|
||||
};
|
||||
Systems::ContinueScreen::update(cont_ctx, delta_time);
|
||||
Systems::ContinueScreen::processInput(cont_ctx);
|
||||
@@ -326,7 +326,7 @@ void GameScene::stepDeathSequence(float delta_time) {
|
||||
// *** PHASE 3: RESPAWN OR GAME OVER ***
|
||||
lives_per_player_[i]--;
|
||||
if (lives_per_player_[i] > 0) {
|
||||
Vec2 spawn_pos = obtenir_punt_spawn(i);
|
||||
Vec2 spawn_pos = getSpawnPoint(i);
|
||||
ships_[i].init(&spawn_pos, /*activar_invulnerabilitat=*/true);
|
||||
hit_timer_per_player_[i] = 0.0F;
|
||||
continue;
|
||||
@@ -399,10 +399,10 @@ void GameScene::runStageInitHud(float delta_time) {
|
||||
Defaults::Game::INIT_HUD_SHIP2_RATIO_END);
|
||||
|
||||
if (match_config_.jugador1_actiu && SHIP1_P < 1.0F) {
|
||||
ships_[0].setCenter(Systems::InitHud::computeShipPosition(SHIP1_P, obtenir_punt_spawn(0)));
|
||||
ships_[0].setCenter(Systems::InitHud::computeShipPosition(SHIP1_P, getSpawnPoint(0)));
|
||||
}
|
||||
if (match_config_.jugador2_actiu && SHIP2_P < 1.0F) {
|
||||
ships_[1].setCenter(Systems::InitHud::computeShipPosition(SHIP2_P, obtenir_punt_spawn(1)));
|
||||
ships_[1].setCenter(Systems::InitHud::computeShipPosition(SHIP2_P, getSpawnPoint(1)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -491,7 +491,7 @@ void GameScene::draw() {
|
||||
// Handle CONTINUE screen
|
||||
if (game_over_state_ == GameOverState::CONTINUE) {
|
||||
// Draw game background elements first
|
||||
dibuixar_marges();
|
||||
drawMargins();
|
||||
|
||||
for (const auto& enemy : enemies_) {
|
||||
enemy.draw();
|
||||
@@ -503,17 +503,17 @@ void GameScene::draw() {
|
||||
|
||||
debris_manager_.draw();
|
||||
floating_score_manager_.draw();
|
||||
dibuixar_marcador();
|
||||
drawScoreboard();
|
||||
|
||||
// Draw CONTINUE screen overlay
|
||||
dibuixar_continue();
|
||||
drawContinue();
|
||||
return;
|
||||
}
|
||||
|
||||
// Handle final GAME OVER state
|
||||
if (game_over_state_ == GameOverState::GAME_OVER) {
|
||||
// Game over: draw enemies, bullets, debris, and "GAME OVER" text
|
||||
dibuixar_marges();
|
||||
drawMargins();
|
||||
|
||||
for (const auto& enemy : enemies_) {
|
||||
enemy.draw();
|
||||
@@ -538,7 +538,7 @@ void GameScene::draw() {
|
||||
|
||||
text_.renderCentered(GAME_OVER_TEXT, {.x = centre_x, .y = centre_y}, SCALE, SPACING);
|
||||
|
||||
dibuixar_marcador();
|
||||
drawScoreboard();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -601,7 +601,7 @@ void GameScene::draw() {
|
||||
}
|
||||
|
||||
case StageSystem::EstatStage::LEVEL_START:
|
||||
dibuixar_marges();
|
||||
drawMargins();
|
||||
// [NEW] Draw both ships if active and alive
|
||||
for (uint8_t i = 0; i < 2; i++) {
|
||||
bool jugador_actiu = (i == 0) ? match_config_.jugador1_actiu : match_config_.jugador2_actiu;
|
||||
@@ -620,12 +620,12 @@ void GameScene::draw() {
|
||||
floating_score_manager_.draw();
|
||||
|
||||
// [EXISTING] Draw intro message and score
|
||||
dibuixar_missatge_stage(stage_manager_->get_missatge_level_start());
|
||||
dibuixar_marcador();
|
||||
drawStageMessage(stage_manager_->get_missatge_level_start());
|
||||
drawScoreboard();
|
||||
break;
|
||||
|
||||
case StageSystem::EstatStage::PLAYING:
|
||||
dibuixar_marges();
|
||||
drawMargins();
|
||||
|
||||
// [EXISTING] Normal rendering - active ships
|
||||
for (uint8_t i = 0; i < 2; i++) {
|
||||
@@ -645,11 +645,11 @@ void GameScene::draw() {
|
||||
|
||||
debris_manager_.draw();
|
||||
floating_score_manager_.draw();
|
||||
dibuixar_marcador();
|
||||
drawScoreboard();
|
||||
break;
|
||||
|
||||
case StageSystem::EstatStage::LEVEL_COMPLETED:
|
||||
dibuixar_marges();
|
||||
drawMargins();
|
||||
// [NEW] Draw both ships if active and alive
|
||||
for (uint8_t i = 0; i < 2; i++) {
|
||||
bool jugador_actiu = (i == 0) ? match_config_.jugador1_actiu : match_config_.jugador2_actiu;
|
||||
@@ -668,8 +668,8 @@ void GameScene::draw() {
|
||||
floating_score_manager_.draw();
|
||||
|
||||
// [EXISTING] Draw completion message and score
|
||||
dibuixar_missatge_stage(StageSystem::Constants::MISSATGE_LEVEL_COMPLETED);
|
||||
dibuixar_marcador();
|
||||
drawStageMessage(StageSystem::Constants::MISSATGE_LEVEL_COMPLETED);
|
||||
drawScoreboard();
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -714,7 +714,7 @@ void GameScene::tocado(uint8_t player_id) {
|
||||
// Phase 3 is handled in update() when hit_timer_per_player_ >= DEATH_DURATION
|
||||
}
|
||||
|
||||
void GameScene::dibuixar_marges() const {
|
||||
void GameScene::drawMargins() const {
|
||||
// Dibuixar rectangle de la zona de juego
|
||||
const SDL_FRect& zona = Defaults::Zones::PLAYAREA;
|
||||
|
||||
@@ -731,7 +731,7 @@ void GameScene::dibuixar_marges() const {
|
||||
Rendering::linea(sdl_.getRenderer(), x2, y1, x2, y2); // Right
|
||||
}
|
||||
|
||||
void GameScene::dibuixar_marcador() {
|
||||
void GameScene::drawScoreboard() {
|
||||
// Construir text del marcador
|
||||
std::string text = buildScoreboard();
|
||||
|
||||
@@ -789,7 +789,7 @@ auto GameScene::buildScoreboard() const -> std::string {
|
||||
|
||||
// [NEW] Stage system helper methods
|
||||
|
||||
void GameScene::dibuixar_missatge_stage(const std::string& message) {
|
||||
void GameScene::drawStageMessage(const std::string& message) {
|
||||
constexpr float BASE_SCALE = 1.0F;
|
||||
constexpr float SPACING = 2.0F;
|
||||
|
||||
@@ -858,7 +858,7 @@ void GameScene::dibuixar_missatge_stage(const std::string& message) {
|
||||
// Helper methods for 2-player support
|
||||
// ========================================
|
||||
|
||||
auto GameScene::obtenir_punt_spawn(uint8_t player_id) const -> Vec2 {
|
||||
auto GameScene::getSpawnPoint(uint8_t player_id) const -> Vec2 {
|
||||
const SDL_FRect& zona = Defaults::Zones::PLAYAREA;
|
||||
|
||||
float x_ratio;
|
||||
@@ -877,7 +877,7 @@ auto GameScene::obtenir_punt_spawn(uint8_t player_id) const -> Vec2 {
|
||||
.y = zona.y + (zona.h * Defaults::Game::SPAWN_Y_RATIO)};
|
||||
}
|
||||
|
||||
void GameScene::disparar_bala(uint8_t player_id) {
|
||||
void GameScene::fireBullet(uint8_t player_id) {
|
||||
// Verificar que el player está vivo
|
||||
if (hit_timer_per_player_[player_id] > 0.0F) {
|
||||
return;
|
||||
@@ -908,7 +908,7 @@ void GameScene::disparar_bala(uint8_t player_id) {
|
||||
}
|
||||
}
|
||||
|
||||
void GameScene::dibuixar_continue() {
|
||||
void GameScene::drawContinue() {
|
||||
const SDL_FRect& play_area = Defaults::Zones::PLAYAREA;
|
||||
constexpr float SPACING = 4.0F;
|
||||
|
||||
@@ -943,7 +943,7 @@ void GameScene::dibuixar_continue() {
|
||||
}
|
||||
}
|
||||
|
||||
void GameScene::unir_jugador(uint8_t player_id) {
|
||||
void GameScene::joinPlayer(uint8_t player_id) {
|
||||
// Activate player
|
||||
if (player_id == 0) {
|
||||
match_config_.jugador1_actiu = true;
|
||||
@@ -957,7 +957,7 @@ void GameScene::unir_jugador(uint8_t player_id) {
|
||||
hit_timer_per_player_[player_id] = 0.0F;
|
||||
|
||||
// Spawn with invulnerability
|
||||
Vec2 spawn_pos = obtenir_punt_spawn(player_id);
|
||||
Vec2 spawn_pos = getSpawnPoint(player_id);
|
||||
ships_[player_id].init(&spawn_pos, true);
|
||||
|
||||
// No visual message, just spawn (per user requirement)
|
||||
|
||||
@@ -88,17 +88,17 @@ class GameScene final : public Scene {
|
||||
|
||||
// Funciones privades
|
||||
void tocado(uint8_t player_id);
|
||||
void dibuixar_marges() const; // Dibuixar vores de la zona de juego
|
||||
void dibuixar_marcador(); // Dibuixar marcador de puntuación
|
||||
void disparar_bala(uint8_t player_id); // Shoot bullet from player
|
||||
[[nodiscard]] auto obtenir_punt_spawn(uint8_t player_id) const -> Vec2; // Get spawn position for player
|
||||
void drawMargins() const; // Dibuixar vores de la zona de juego
|
||||
void drawScoreboard(); // Dibuixar marcador de puntuación
|
||||
void fireBullet(uint8_t player_id); // Shoot bullet from player
|
||||
[[nodiscard]] auto getSpawnPoint(uint8_t player_id) const -> Vec2; // Get spawn position for player
|
||||
|
||||
// [NEW] Continue & Join system
|
||||
void unir_jugador(uint8_t player_id); // Join inactive player mid-game
|
||||
void dibuixar_continue(); // Draw continue screen
|
||||
void joinPlayer(uint8_t player_id); // Join inactive player mid-game
|
||||
void drawContinue(); // Draw continue screen
|
||||
|
||||
// [NEW] Stage system helpers
|
||||
void dibuixar_missatge_stage(const std::string& message);
|
||||
void drawStageMessage(const std::string& message);
|
||||
|
||||
// [NEW] Función helper del marcador
|
||||
[[nodiscard]] auto buildScoreboard() const -> std::string;
|
||||
|
||||
@@ -56,7 +56,7 @@ LogoScene::LogoScene(SDLManager& sdl, SceneContext& context)
|
||||
(void)option; // Suprimir warning
|
||||
|
||||
so_reproduit_.fill(false); // Inicialitzar seguiment de sons
|
||||
inicialitzar_lletres();
|
||||
initLetters();
|
||||
}
|
||||
|
||||
LogoScene::~LogoScene() {
|
||||
@@ -75,7 +75,7 @@ void LogoScene::handleEvent(const SDL_Event& event) {
|
||||
(void)event;
|
||||
}
|
||||
|
||||
void LogoScene::inicialitzar_lletres() {
|
||||
void LogoScene::initLetters() {
|
||||
using namespace Graphics;
|
||||
|
||||
// Llista de archivos .shp (A repetida para las dues A's)
|
||||
@@ -154,7 +154,7 @@ void LogoScene::inicialitzar_lletres() {
|
||||
<< " lletres carregades, ancho total: " << ancho_total << " px\n";
|
||||
}
|
||||
|
||||
void LogoScene::canviar_estat(AnimationState nou_estat) {
|
||||
void LogoScene::changeState(AnimationState nou_estat) {
|
||||
estat_actual_ = nou_estat;
|
||||
temps_estat_actual_ = 0.0F; // Reset time
|
||||
|
||||
@@ -179,12 +179,12 @@ void LogoScene::canviar_estat(AnimationState nou_estat) {
|
||||
<< "\n";
|
||||
}
|
||||
|
||||
auto LogoScene::totes_lletres_completes() const -> bool {
|
||||
auto LogoScene::allLettersComplete() const -> bool {
|
||||
// Cuando global_progress = 1.0, todas las lletres tenen letra_progress = 1.0
|
||||
return temps_estat_actual_ >= DURACIO_ZOOM;
|
||||
}
|
||||
|
||||
void LogoScene::actualitzar_explosions(float delta_time) {
|
||||
void LogoScene::updateExplosions(float delta_time) {
|
||||
temps_des_ultima_explosio_ += delta_time;
|
||||
|
||||
// Comprovar si es el moment de explode la següent lletra
|
||||
@@ -211,7 +211,7 @@ void LogoScene::actualitzar_explosions(float delta_time) {
|
||||
temps_des_ultima_explosio_ = 0.0F;
|
||||
} else {
|
||||
// Todas las lletres han explotat, transición a POST_EXPLOSION
|
||||
canviar_estat(AnimationState::POST_EXPLOSION);
|
||||
changeState(AnimationState::POST_EXPLOSION);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -222,7 +222,7 @@ void LogoScene::update(float delta_time) {
|
||||
switch (estat_actual_) {
|
||||
case AnimationState::PRE_ANIMATION:
|
||||
if (temps_estat_actual_ >= DURACIO_PRE) {
|
||||
canviar_estat(AnimationState::ANIMATION);
|
||||
changeState(AnimationState::ANIMATION);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -246,20 +246,20 @@ void LogoScene::update(float delta_time) {
|
||||
}
|
||||
}
|
||||
|
||||
if (totes_lletres_completes()) {
|
||||
canviar_estat(AnimationState::POST_ANIMATION);
|
||||
if (allLettersComplete()) {
|
||||
changeState(AnimationState::POST_ANIMATION);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case AnimationState::POST_ANIMATION:
|
||||
if (temps_estat_actual_ >= DURACIO_POST_ANIMATION) {
|
||||
canviar_estat(AnimationState::EXPLOSION);
|
||||
changeState(AnimationState::EXPLOSION);
|
||||
}
|
||||
break;
|
||||
|
||||
case AnimationState::EXPLOSION:
|
||||
actualitzar_explosions(delta_time);
|
||||
updateExplosions(delta_time);
|
||||
break;
|
||||
|
||||
case AnimationState::POST_EXPLOSION:
|
||||
|
||||
@@ -85,11 +85,11 @@ class LogoScene final : public Scene {
|
||||
static constexpr float ORIGEN_ZOOM_Y = Defaults::Game::HEIGHT * 0.4F; // Vec2 inicial Y del zoom
|
||||
|
||||
// Métodos privats
|
||||
void inicialitzar_lletres();
|
||||
void actualitzar_explosions(float delta_time);
|
||||
void initLetters();
|
||||
void updateExplosions(float delta_time);
|
||||
auto checkSkipButtonPressed() -> bool;
|
||||
|
||||
// Métodos de gestió de estats
|
||||
void canviar_estat(AnimationState nou_estat);
|
||||
[[nodiscard]] auto totes_lletres_completes() const -> bool;
|
||||
void changeState(AnimationState nou_estat);
|
||||
[[nodiscard]] auto allLettersComplete() const -> bool;
|
||||
};
|
||||
@@ -84,7 +84,7 @@ TitleScene::TitleScene(SDLManager& sdl, SceneContext& context)
|
||||
}
|
||||
|
||||
// Inicialitzar lletres del título "ORNI ATTACK!"
|
||||
inicialitzar_titol();
|
||||
initTitle();
|
||||
|
||||
// Logo JAILGAMES pequeño sobre el copyright inferior.
|
||||
inicialitzarJailgames();
|
||||
@@ -100,7 +100,7 @@ TitleScene::~TitleScene() {
|
||||
Audio::get()->stopMusic();
|
||||
}
|
||||
|
||||
void TitleScene::inicialitzar_titol() {
|
||||
void TitleScene::initTitle() {
|
||||
using namespace Graphics;
|
||||
|
||||
// === LÍNIA 1: "ORNI" ===
|
||||
@@ -425,7 +425,7 @@ void TitleScene::update(float delta_time) {
|
||||
}
|
||||
|
||||
// Actualitzar animación del logo
|
||||
actualitzar_animacio_logo(delta_time);
|
||||
updateLogoAnimation(delta_time);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -433,7 +433,7 @@ void TitleScene::update(float delta_time) {
|
||||
temps_acumulat_ += delta_time;
|
||||
|
||||
// Continuar animación orbital durante la transición
|
||||
actualitzar_animacio_logo(delta_time);
|
||||
updateLogoAnimation(delta_time);
|
||||
|
||||
// [NOU] Continuar comprovant si l'altre player quiere unir-se durante la transición ("late join")
|
||||
{
|
||||
@@ -542,7 +542,7 @@ void TitleScene::update(float delta_time) {
|
||||
}
|
||||
}
|
||||
|
||||
void TitleScene::actualitzar_animacio_logo(float delta_time) {
|
||||
void TitleScene::updateLogoAnimation(float delta_time) {
|
||||
// Solo calcular i aplicar offsets si l'animación está activa
|
||||
if (animacio_activa_) {
|
||||
// Acumular time escalat
|
||||
|
||||
@@ -112,10 +112,10 @@ class TitleScene final : public Scene {
|
||||
static constexpr float DURACIO_LERP = 2.0F; // 2s per arribar a amplitud completa
|
||||
|
||||
// Métodos privats
|
||||
void actualitzar_animacio_logo(float delta_time); // Actualitza l'animación orbital del logo
|
||||
void updateLogoAnimation(float delta_time); // Actualitza l'animación orbital del logo
|
||||
auto checkSkipButtonPressed() -> bool;
|
||||
auto checkStartGameButtonPressed() -> bool;
|
||||
void inicialitzar_titol(); // Carrega i posiciona las lletres del título
|
||||
void initTitle(); // Carrega i posiciona las lletres del título
|
||||
void inicialitzarJailgames(); // Carrega i posiciona el logo JAILGAMES pequeño
|
||||
void dibuixarPeuTitol(float spacing) const; // Logo JAILGAMES + línia de copyright
|
||||
};
|
||||
Reference in new issue
Block a user