Fase 0: eliminar tot el codi llegacy (polars + primitives + bool dibuixar)

Aplicada la directiva "res llegacy" abans d'arrencar la migracio a fisica
vectorial + SDL3 GPU. Cada bossa de cruft que arrossegava el port de Pascal
queda eliminada.

Borrats (huerfanos):
- source/core/rendering/primitives.hpp/.cpp (modul/diferencia/angle_punt/
  crear_poligon_regular)
- source/core/rendering/polygon_renderer.hpp/.cpp (rota_tri/rota_pol)
- core::types::Triangle, Poligon, IPunt
- Defaults::Entities::MAX_IPUNTS i alias a constants.hpp
- EscenaJoc::chatarra_cosmica_ (mai usat)
- Bresenham comentat dins de Rendering::linea()

Simplificat (parametre 'dibuixar' llegacy que sempre era true):
- Rendering::linea(...): treta la signatura bool dibuixar, retorn void
- Rendering::render_shape(...): treta la signatura bool dibuixar
- 11 callsites de linea() actualitzats (escena_joc, debris_manager)
- 12 callsites de render_shape() actualitzats

Modernitzats:
- 5 fitxers .shp netejats de comentaris polar->cartesia historics
- types.hpp queda nomes amb Punt (l'unica coordenada del joc)
- debris_manager.hpp afegit include explicit de defaults.hpp

Net: 452 linies eliminades, 56 afegides. Compila i enllaca correctament.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-19 11:10:42 +02:00
parent cb7b99cab3
commit 6cf990bc1d
28 changed files with 55 additions and 451 deletions
+1 -2
View File
@@ -14,8 +14,7 @@ constexpr int MARGE_DALT = static_cast<int>(Defaults::Zones::PLAYAREA.y);
constexpr int MARGE_BAIX =
static_cast<int>(Defaults::Zones::PLAYAREA.y + Defaults::Zones::PLAYAREA.h);
// Límits de polígons i objectes
constexpr int MAX_IPUNTS = Defaults::Entities::MAX_IPUNTS;
// Límits d'objectes
constexpr int MAX_ORNIS = Defaults::Entities::MAX_ORNIS;
constexpr int MAX_BALES = Defaults::Entities::MAX_BALES;
-1
View File
@@ -314,7 +314,6 @@ void DebrisManager::dibuixar() const {
static_cast<int>(debris.p1.y),
static_cast<int>(debris.p2.x),
static_cast<int>(debris.p2.y),
true,
debris.brightness);
}
}
+1
View File
@@ -7,6 +7,7 @@
#include <array>
#include <memory>
#include "core/defaults.hpp"
#include "core/graphics/shape.hpp"
#include "core/types.hpp"
#include "debris.hpp"
+1 -1
View File
@@ -87,7 +87,7 @@ void Bala::dibuixar() const {
if (esta_ && forma_) {
// [NUEVO] Usar render_shape en lloc de rota_pol
// Les bales roten segons l'angle de trajectòria
Rendering::render_shape(renderer_, forma_, centre_, angle_, 1.0F, true, 1.0F, brightness_);
Rendering::render_shape(renderer_, forma_, centre_, angle_, 1.0F, 1.0F, brightness_);
}
}
+1 -1
View File
@@ -185,7 +185,7 @@ void Enemic::dibuixar() const {
float escala = calcular_escala_actual();
// brightness_ is already updated in actualitzar()
Rendering::render_shape(renderer_, forma_, centre_, rotacio_, escala, true, 1.0F, brightness_);
Rendering::render_shape(renderer_, forma_, centre_, rotacio_, escala, 1.0F, brightness_);
}
}
+1 -1
View File
@@ -167,7 +167,7 @@ void Nau::dibuixar() const {
float velocitat_visual = velocitat_ / 33.33F;
float escala = 1.0F + (velocitat_visual / 12.0F);
Rendering::render_shape(renderer_, forma_, centre_, angle_, escala, true, 1.0F, brightness_);
Rendering::render_shape(renderer_, forma_, centre_, angle_, escala, 1.0F, brightness_);
}
void Nau::aplicar_fisica(float delta_time) {
+10 -10
View File
@@ -745,10 +745,10 @@ void EscenaJoc::dibuixar_marges() const {
int y2 = static_cast<int>(zona.y + zona.h);
// 4 línies per formar el rectangle
Rendering::linea(sdl_.obte_renderer(), x1, y1, x2, y1, true); // Top
Rendering::linea(sdl_.obte_renderer(), x1, y2, x2, y2, true); // Bottom
Rendering::linea(sdl_.obte_renderer(), x1, y1, x1, y2, true); // Left
Rendering::linea(sdl_.obte_renderer(), x2, y1, x2, y2, true); // Right
Rendering::linea(sdl_.obte_renderer(), x1, y1, x2, y1); // Top
Rendering::linea(sdl_.obte_renderer(), x1, y2, x2, y2); // Bottom
Rendering::linea(sdl_.obte_renderer(), x1, y1, x1, y2); // Left
Rendering::linea(sdl_.obte_renderer(), x2, y1, x2, y2); // Right
}
void EscenaJoc::dibuixar_marcador() {
@@ -794,11 +794,11 @@ void EscenaJoc::dibuixar_marges_animat(float progress) const {
// Línia esquerra: creix des del centre cap a l'esquerra
int x1_phase1 = static_cast<int>(cx - ((cx - x1) * phase1_progress));
Rendering::linea(sdl_.obte_renderer(), cx, y1, x1_phase1, y1, true);
Rendering::linea(sdl_.obte_renderer(), cx, y1, x1_phase1, y1);
// Línia dreta: creix des del centre cap a la dreta
int x2_phase1 = static_cast<int>(cx + ((x2 - cx) * phase1_progress));
Rendering::linea(sdl_.obte_renderer(), cx, y1, x2_phase1, y1, true);
Rendering::linea(sdl_.obte_renderer(), cx, y1, x2_phase1, y1);
}
// --- FASE 2: Línies verticals laterals (33-66%) ---
@@ -807,10 +807,10 @@ void EscenaJoc::dibuixar_marges_animat(float progress) const {
// Línia esquerra: creix des de dalt cap a baix
int y2_phase2 = static_cast<int>(y1 + ((y2 - y1) * phase2_progress));
Rendering::linea(sdl_.obte_renderer(), x1, y1, x1, y2_phase2, true);
Rendering::linea(sdl_.obte_renderer(), x1, y1, x1, y2_phase2);
// Línia dreta: creix des de dalt cap a baix
Rendering::linea(sdl_.obte_renderer(), x2, y1, x2, y2_phase2, true);
Rendering::linea(sdl_.obte_renderer(), x2, y1, x2, y2_phase2);
}
// --- FASE 3: Línies horitzontals inferiors (66-100%) ---
@@ -819,11 +819,11 @@ void EscenaJoc::dibuixar_marges_animat(float progress) const {
// Línia esquerra: creix des de l'esquerra cap al centre
int x_left_phase3 = static_cast<int>(x1 + ((cx - x1) * phase3_progress));
Rendering::linea(sdl_.obte_renderer(), x1, y2, x_left_phase3, y2, true);
Rendering::linea(sdl_.obte_renderer(), x1, y2, x_left_phase3, y2);
// Línia dreta: creix des de la dreta cap al centre
int x_right_phase3 = static_cast<int>(x2 - ((x2 - cx) * phase3_progress));
Rendering::linea(sdl_.obte_renderer(), x2, y2, x_right_phase3, y2, true);
Rendering::linea(sdl_.obte_renderer(), x2, y2, x_right_phase3, y2);
}
}
+1 -3
View File
@@ -55,7 +55,6 @@ class EscenaJoc {
std::array<Nau, 2> naus_; // [0]=P1, [1]=P2
std::array<Enemic, Constants::MAX_ORNIS> orni_;
std::array<Bala, Constants::MAX_BALES * 2> bales_; // 6 balas: P1=[0,1,2], P2=[3,4,5]
Poligon chatarra_cosmica_;
std::array<float, 2> itocado_per_jugador_; // Death timers per player (seconds)
// Lives and game over system
@@ -65,8 +64,7 @@ class EscenaJoc {
float continue_tick_timer_; // Timer for countdown tick (1.0s)
int continues_usados_; // Continues used this game (0-3 max)
float game_over_timer_; // Final GAME OVER timer before title screen
// Punt punt_spawn_; // DEPRECATED: usar obtenir_punt_spawn(player_id)
Punt punt_mort_; // Death position (for respawn, legacy)
Punt punt_mort_; // Death position (for respawn)
std::array<int, 2> puntuacio_per_jugador_; // [0]=P1, [1]=P2
// Text vectorial
-2
View File
@@ -379,7 +379,6 @@ void EscenaLogo::dibuixar() {
pos_actual,
0.0F,
escala_actual,
true,
1.0F);
}
}
@@ -403,7 +402,6 @@ void EscenaLogo::dibuixar() {
lletra.posicio,
0.0F,
ESCALA_FINAL,
true,
1.0F);
}
}
-4
View File
@@ -593,7 +593,6 @@ void EscenaTitol::dibuixar() {
pos_shadow,
0.0F,
Defaults::Title::Layout::LOGO_SCALE,
true,
1.0F, // progress = 1.0 (totalment visible)
SHADOW_BRIGHTNESS // brightness = 0.4 (brillantor reduïda)
);
@@ -611,7 +610,6 @@ void EscenaTitol::dibuixar() {
pos_shadow,
0.0F,
Defaults::Title::Layout::LOGO_SCALE,
true,
1.0F, // progress = 1.0 (totalment visible)
SHADOW_BRIGHTNESS);
}
@@ -627,7 +625,6 @@ void EscenaTitol::dibuixar() {
lletra.posicio,
0.0F,
Defaults::Title::Layout::LOGO_SCALE,
true,
1.0F // Brillantor completa
);
}
@@ -640,7 +637,6 @@ void EscenaTitol::dibuixar() {
lletra.posicio,
0.0F,
Defaults::Title::Layout::LOGO_SCALE,
true,
1.0F // Brillantor completa
);
}
-1
View File
@@ -67,7 +67,6 @@ void ShipAnimator::dibuixar() const {
nau.posicio_actual,
0.0F, // angle (rotació 2D no utilitzada)
nau.escala_actual,
true, // dibuixar
1.0F, // progress (sempre visible)
1.0F // brightness (brillantor màxima)
);