Fase 1a: Punt -> Vec2 amb operadors moderns

Primera sub-fase del naming sweep. Punt era un struct sense
operacions, conservat per compatibilitat amb el Pascal original.
Substituit per Vec2, un aggregate amb operadors aritmetics, dot,
length, normalized i length_squared (camelBack: lengthSquared)
seguint les regles del .clang-tidy del projecte.

Canvis:
- core/types.hpp reescrit: nou struct Vec2 amb +=,-=,*=,/=,
  unary -, ==, dot, length, lengthSquared, normalized
- Operadors fora de la classe: +, -, *, / (amb float per ambdues
  bandes), - unari, ==
- Vec2 segueix sent aggregate (sense constructors definits):
  els 'designated initializers' del codi existent funcionen igual:
  Vec2{.x = ..., .y = ...}
- Sed global sobre 35 fitxers: tots els 'Punt' -> 'Vec2'

Net: 35 fitxers tocats, +180 / -114. Compila i enllaça.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
JailDesignerandClaude Opus 4.7 committed 2026-05-19 11:33:27 +02:00
1 parent 6cf990bc1d
commit cd38101f99
35 files changed
+180 -114

No files matched your search

+3 -3
View File
@@ -232,8 +232,8 @@ void ShipAnimator::actualitzar_exiting(NauTitol& nau, float delta_time) {
// Aplicar easing (ease_in_quad per acceleració cap al punt de fuga)
float eased_progress = Easing::ease_in_quad(progress);
// Punt de fuga (centre del starfield)
constexpr Punt punt_fuga{.x = VANISHING_POINT_X, .y = VANISHING_POINT_Y};
// Vec2 de fuga (centre del starfield)
constexpr Vec2 punt_fuga{.x = VANISHING_POINT_X, .y = VANISHING_POINT_Y};
// Lerp posició cap al punt de fuga (preservar posició inicial actual)
// Nota: posicio_inicial conté la posició on estava quan es va activar EXITING
@@ -320,7 +320,7 @@ void ShipAnimator::configurar_nau_p2(NauTitol& nau) {
nau.visible = true;
}
Punt ShipAnimator::calcular_posicio_fora_pantalla(float angle_rellotge) const {
Vec2 ShipAnimator::calcular_posicio_fora_pantalla(float angle_rellotge) const {
using namespace Defaults::Title::Ships;
// Convertir angle del rellotge a radians (per exemple: 240° per clock 8)
+4 -4
View File
@@ -30,9 +30,9 @@ struct NauTitol {
float temps_estat; // Temps acumulat en l'estat actual
// Posicions
Punt posicio_inicial; // Posició d'inici (fora de pantalla per ENTERING)
Punt posicio_objectiu; // Posició objectiu (rellotge 8 o 4)
Punt posicio_actual; // Posició interpolada actual
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
// Escales (simulació eix Z)
float escala_inicial; // Escala d'inici (més gran = més a prop)
@@ -91,7 +91,7 @@ class ShipAnimator {
// Configuració
void configurar_nau_p1(NauTitol& nau);
void configurar_nau_p2(NauTitol& nau);
[[nodiscard]] Punt calcular_posicio_fora_pantalla(float angle_rellotge) const;
[[nodiscard]] Vec2 calcular_posicio_fora_pantalla(float angle_rellotge) const;
};
} // namespace Title