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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user