Fase 1d: rename del codi restant (effects, stage_system, locals)
Sweep final del naming a CamelCase/camelBack/lower_case:
Fitxers renombrats:
- effects/gestor_puntuacio_flotant.{hpp,cpp} -> floating_score_manager.{hpp,cpp}
- effects/puntuacio_flotant.hpp -> floating_score.hpp
Tipus (CamelCase):
- GestorPuntuacioFlotant -> FloatingScoreManager
- PuntuacioFlotant -> FloatingScore
- ConfigStage -> StageConfig
- ConfigSistemaStages -> StageSystemConfig
- NauTitol -> TitleShip
- EstatNau -> ShipState
Metodes publics (camelBack):
- obte_renderer -> getRenderer
- get_num_actius -> getActiveCount
- calcular_direccio_explosio -> computeExplosionDirection
- trobar_slot_lliure -> findFreeSlot
- explotar -> explode
- reiniciar -> reset
- es_valida -> isValid
- parsejar_fitxer -> parseFile
- carregar -> load
- crear_explosio -> createExplosion
- registrar_puntuacio -> registerScore
- construir_marcador -> buildScoreboard
- render_centered -> renderCentered
Camps struct publics (snake_case):
- actiu/actius -> active
- rotacio -> rotation, rotacio_visual -> visual_rotation
- acceleracio -> acceleration
- velocitat -> velocity
- escala/escala_inicial/objectiu/actual -> scale/initial_scale/...
- posicio/posicio_inicial/objectiu/actual -> position/initial_position/...
- fase_oscilacio -> oscillation_phase
- temps_estat -> state_time
- jugador_id -> player_id
- estat -> state
- brillantor -> brightness
- tipus -> type
Camps privats (sufix _):
- naus_ -> ships_, orni_ -> enemies_, bales_ -> bullets_
- gestor_puntuacio_ -> floating_score_manager_
- punt_mort_ -> death_position_, punt_spawn_ -> spawn_position_
- itocado_per_jugador_ -> hit_timer_per_player_
- vides_per_jugador_ -> lives_per_player_
- puntuacio_per_jugador_ -> score_per_player_
- estat_game_over_ -> game_over_state_
- continues_usados_ -> continues_used_
Constants:
- MARGE_ESQ/DRET/DALT/BAIX -> MARGIN_LEFT/RIGHT/TOP/BOTTOM
Variables locals i parametres comuns (snake_case):
- nau -> ship, enemic -> enemy, bala -> bullet
- forma -> shape, punt(s) -> point(s)
- jugador -> player, partida -> match
- temps -> time, missatge -> message
Diff: 59 fitxers, +1000/-1000 (simetric). Compila i enllaça.
Pendents per a futures fases (no bloquejants):
- Comentaris de capçalera en catala -> castella
- Variables locals/parametres minoritaris en catala
- Include guards (queden alguns #ifndef en lloc de #pragma once)
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -13,46 +13,46 @@
|
||||
|
||||
namespace Title {
|
||||
|
||||
// Estats de l'animació de la nau
|
||||
enum class EstatNau {
|
||||
// Estats de l'animació de la ship
|
||||
enum class ShipState {
|
||||
ENTERING, // Entrant des de fora de pantalla
|
||||
FLOATING, // Flotant en posició estàtica
|
||||
EXITING // Volant cap al punt de fuga
|
||||
EXITING // Volant cap al point de fuga
|
||||
};
|
||||
|
||||
// Dades d'una nau individual al títol
|
||||
struct NauTitol {
|
||||
// Dades d'una ship individual al títol
|
||||
struct TitleShip {
|
||||
// Identificació
|
||||
int jugador_id; // 1 o 2
|
||||
int player_id; // 1 o 2
|
||||
|
||||
// Estat
|
||||
EstatNau estat;
|
||||
float temps_estat; // Temps acumulat en l'estat actual
|
||||
ShipState state;
|
||||
float state_time; // Temps acumulat en l'state actual
|
||||
|
||||
// Posicions
|
||||
Vec2 posicio_inicial; // Posició d'inici (fora de pantalla per ENTERING)
|
||||
Vec2 posicio_objectiu; // Posició objectiu (rellotge 8 o 4)
|
||||
Vec2 posicio_actual; // Posició interpolada actual
|
||||
Vec2 initial_position; // Posició d'inici (fora de pantalla per ENTERING)
|
||||
Vec2 target_position; // Posició objectiu (rellotge 8 o 4)
|
||||
Vec2 current_position; // Posició interpolada actual
|
||||
|
||||
// Escales (simulació eix Z)
|
||||
float escala_inicial; // Escala d'inici (més gran = més a prop)
|
||||
float escala_objectiu; // Escala objectiu (mida flotació)
|
||||
float escala_actual; // Escala interpolada actual
|
||||
float initial_scale; // Escala d'inici (més gran = més a prop)
|
||||
float target_scale; // Escala objectiu (mida flotació)
|
||||
float current_scale; // Escala interpolada actual
|
||||
|
||||
// Flotació
|
||||
float fase_oscilacio; // Acumulador de fase per moviment sinusoïdal
|
||||
float oscillation_phase; // Acumulador de fase per moviment sinusoïdal
|
||||
|
||||
// Paràmetres d'entrada
|
||||
float entry_delay; // Delay abans d'entrar (0.0 per P1, 0.5 per P2)
|
||||
|
||||
// Paràmetres d'oscil·lació per nau
|
||||
// Paràmetres d'oscil·lació per ship
|
||||
float amplitude_x;
|
||||
float amplitude_y;
|
||||
float frequency_x;
|
||||
float frequency_y;
|
||||
|
||||
// Forma
|
||||
std::shared_ptr<Graphics::Shape> forma;
|
||||
std::shared_ptr<Graphics::Shape> shape;
|
||||
|
||||
// Visibilitat
|
||||
bool visible;
|
||||
@@ -68,29 +68,29 @@ class ShipAnimator {
|
||||
void update(float delta_time);
|
||||
void draw() const;
|
||||
|
||||
// Control d'estat (cridat per TitleScene)
|
||||
// Control d'state (cridat per TitleScene)
|
||||
void start_entry_animation();
|
||||
void trigger_exit_animation(); // Anima totes les naus
|
||||
void trigger_exit_animation_for_player(int jugador_id); // Anima només una nau (P1=1, P2=2)
|
||||
void trigger_exit_animation_for_player(int player_id); // Anima només una ship (P1=1, P2=2)
|
||||
void skip_to_floating_state(); // Salta directament a FLOATING sense animació
|
||||
|
||||
// Control de visibilitat
|
||||
void set_visible(bool visible);
|
||||
[[nodiscard]] bool is_animation_complete() const;
|
||||
[[nodiscard]] bool is_visible() const; // Comprova si alguna nau és visible
|
||||
[[nodiscard]] bool is_visible() const; // Comprova si alguna ship és visible
|
||||
|
||||
private:
|
||||
SDL_Renderer* renderer_;
|
||||
std::array<NauTitol, 2> naus_; // Naus P1 i P2
|
||||
std::array<TitleShip, 2> ships_; // Naus P1 i P2
|
||||
|
||||
// Mètodes d'animació
|
||||
void actualitzar_entering(NauTitol& nau, float delta_time);
|
||||
void actualitzar_floating(NauTitol& nau, float delta_time);
|
||||
void actualitzar_exiting(NauTitol& nau, float delta_time);
|
||||
void actualitzar_entering(TitleShip& ship, float delta_time);
|
||||
void actualitzar_floating(TitleShip& ship, float delta_time);
|
||||
void actualitzar_exiting(TitleShip& ship, float delta_time);
|
||||
|
||||
// Configuració
|
||||
void configurar_nau_p1(NauTitol& nau);
|
||||
void configurar_nau_p2(NauTitol& nau);
|
||||
void configurar_nau_p1(TitleShip& ship);
|
||||
void configurar_nau_p2(TitleShip& ship);
|
||||
[[nodiscard]] Vec2 calcular_posicio_fora_pantalla(float angle_rellotge) const;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user