From 164f58c883fc22e62942caef075006c050dd6191 Mon Sep 17 00:00:00 2001 From: Sergio Valor Date: Tue, 26 May 2026 18:09:29 +0200 Subject: [PATCH 1/2] refactor(enemies): renombrar big_pentagon a orb i enemy_big_orb a enemy_orb --- .../big_pentagon.yaml => orb/orb.yaml} | 8 +++---- .../{enemy_big_orb.shp => enemy_orb.shp} | 4 ++-- data/stages/stages.yaml | 24 +++++++++---------- source/game/entities/enemy.hpp | 10 ++++---- source/game/entities/enemy_config.cpp | 6 ++--- source/game/entities/enemy_registry.cpp | 8 +++---- source/game/entities/enemy_registry.hpp | 2 +- source/game/stage_system/stage_loader.cpp | 4 ++-- source/game/systems/collision_system.cpp | 2 +- 9 files changed, 34 insertions(+), 34 deletions(-) rename data/entities/{big_pentagon/big_pentagon.yaml => orb/orb.yaml} (94%) rename data/shapes/{enemy_big_orb.shp => enemy_orb.shp} (92%) diff --git a/data/entities/big_pentagon/big_pentagon.yaml b/data/entities/orb/orb.yaml similarity index 94% rename from data/entities/big_pentagon/big_pentagon.yaml rename to data/entities/orb/orb.yaml index 5314dec..0a840bd 100644 --- a/data/entities/big_pentagon/big_pentagon.yaml +++ b/data/entities/orb/orb.yaml @@ -1,12 +1,12 @@ -name: big_pentagon -ai_type: big_pentagon # Validat contra el directori; mapeja a EnemyType::BIG_PENTAGON. +name: orb +ai_type: orb # Validat contra el directori; mapeja a EnemyType::ORB. # Shape circular pròpia (anell exterior + anell interior + 6 radis + nucli), # pensada per llegir-se com a "reactor / orb" amb més detall que els enemics # petits. shape: - path: enemy_big_orb.shp - scale: 1.5 + path: enemy_orb.shp + scale: 1.0 collision_factor: 1.0 physics: diff --git a/data/shapes/enemy_big_orb.shp b/data/shapes/enemy_orb.shp similarity index 92% rename from data/shapes/enemy_big_orb.shp rename to data/shapes/enemy_orb.shp index 39c3c87..95be4bc 100644 --- a/data/shapes/enemy_big_orb.shp +++ b/data/shapes/enemy_orb.shp @@ -1,4 +1,4 @@ -# enemy_big_orb.shp - ORNI enemic gegant (orb circular, doble anell amb radis) +# enemy_orb.shp - ORNI enemic gegant (orb circular, doble anell amb radis) # © 2026 JailDesigner # # Forma "reactor / boss circular" — més detall que els enemics petits perquè @@ -9,7 +9,7 @@ # - Petit "+" central com a nucli. # Bounding radius natiu = 20 (alineat amb la resta d'enemics). -name: enemy_big_orb +name: enemy_orb scale: 1.0 center: 0, 0 diff --git a/data/stages/stages.yaml b/data/stages/stages.yaml index e6ebcfd..ccd9562 100644 --- a/data/stages/stages.yaml +++ b/data/stages/stages.yaml @@ -9,7 +9,7 @@ # - { timeout: T } → quan han passat T segons des de l'inici de la wave. # - { all_dead: true, timeout: T } → el que arribe abans (amuntegament si vas lent). # -# Tipus d'enemic: pentagon, square (alias: cuadrado), pinwheel (alias: molinillo), star, big_pentagon. +# Tipus d'enemic: pentagon, square (alias: cuadrado), pinwheel (alias: molinillo), star, orb. metadata: version: "2.0" @@ -47,14 +47,14 @@ stages: spawn_interval: 0.5 next: end - # STAGE 3 — Primer big_pentagon (HP=10). + # STAGE 3 — Primer orb (HP=10). - stage_id: 3 multipliers: { velocity: 1.0, rotation: 1.0, tracking: 0.5 } waves: - spawn: [pentagon, pentagon, square] spawn_interval: 0.4 next: all_dead - - spawn: [big_pentagon] + - spawn: [orb] next: { all_dead: true, timeout: 12.0 } - spawn: [pinwheel, pinwheel] spawn_interval: 0.5 @@ -76,7 +76,7 @@ stages: - spawn: [pinwheel, pinwheel, pinwheel] spawn_interval: 0.4 next: all_dead - - spawn: [big_pentagon, pentagon, pentagon] + - spawn: [orb, pentagon, pentagon] spawn_interval: 0.5 next: end @@ -93,7 +93,7 @@ stages: - spawn: [pinwheel, pinwheel, star, star] spawn_interval: 0.4 next: all_dead - - spawn: [big_pentagon, square, square] + - spawn: [orb, square, square] spawn_interval: 0.5 next: end @@ -110,7 +110,7 @@ stages: - spawn: [pinwheel, pinwheel, pinwheel] spawn_interval: 0.3 next: all_dead - - spawn: [big_pentagon, pinwheel, pinwheel] + - spawn: [orb, pinwheel, pinwheel] spawn_interval: 0.4 next: end @@ -127,7 +127,7 @@ stages: - spawn: [star, star, star] spawn_interval: 0.4 next: all_dead - - spawn: [big_pentagon, pinwheel, pinwheel, square] + - spawn: [orb, pinwheel, pinwheel, square] spawn_interval: 0.5 next: end @@ -141,7 +141,7 @@ stages: - spawn: [square, square, star, star] spawn_interval: 0.3 next: { all_dead: true, timeout: 5.0 } - - spawn: [big_pentagon] + - spawn: [orb] next: { all_dead: true, timeout: 8.0 } - spawn: [pinwheel, pinwheel, square, star, pentagon] spawn_interval: 0.3 @@ -154,13 +154,13 @@ stages: - spawn: [pinwheel, pinwheel, star, star] spawn_interval: 0.3 next: { all_dead: true, timeout: 4.0 } - - spawn: [big_pentagon, square, square] + - spawn: [orb, square, square] spawn_interval: 0.4 next: { all_dead: true, timeout: 8.0 } - spawn: [pinwheel, pinwheel, pinwheel, pinwheel] spawn_interval: 0.3 next: { all_dead: true, timeout: 5.0 } - - spawn: [big_pentagon, pinwheel, pinwheel, square, star] + - spawn: [orb, pinwheel, pinwheel, square, star] spawn_interval: 0.4 next: end @@ -171,12 +171,12 @@ stages: - spawn: [pinwheel, pinwheel, pinwheel, pinwheel] spawn_interval: 0.25 next: { all_dead: true, timeout: 4.0 } - - spawn: [big_pentagon, square, star] + - spawn: [orb, square, star] spawn_interval: 0.4 next: { all_dead: true, timeout: 6.0 } - spawn: [pinwheel, pinwheel, star, star, square] spawn_interval: 0.3 next: { all_dead: true, timeout: 5.0 } - - spawn: [big_pentagon, big_pentagon, pinwheel, pinwheel, star] + - spawn: [orb, orb, pinwheel, pinwheel, star] spawn_interval: 0.4 next: end diff --git a/source/game/entities/enemy.hpp b/source/game/entities/enemy.hpp index aab39fe..f5e9508 100644 --- a/source/game/entities/enemy.hpp +++ b/source/game/entities/enemy.hpp @@ -17,11 +17,11 @@ class Ship; // Tipo de enemy enum class EnemyType : uint8_t { - PENTAGON = 0, // Pentágono esquivador (zigzag) - SQUARE = 1, // Square perseguidor (tracks ship) - PINWHEEL = 2, // Molinillo agresivo (rápido, girando) - STAR = 3, // Estrella de 5 puntes (clone visual de Pentagon, comportament zigzag) - BIG_PENTAGON = 4, // Pentàgon gegant tough (HP=10, chase lent — primer enemic HP>1) + PENTAGON = 0, // Pentágono esquivador (zigzag) + SQUARE = 1, // Square perseguidor (tracks ship) + PINWHEEL = 2, // Molinillo agresivo (rápido, girando) + STAR = 3, // Estrella de 5 puntes (clone visual de Pentagon, comportament zigzag) + ORB = 4, // Orb gegant tough (HP=10, chase lent — primer enemic HP>1) }; // Forward declaration — EnemyConfig viu a enemy_config.hpp i s'inclou només a enemy.cpp. diff --git a/source/game/entities/enemy_config.cpp b/source/game/entities/enemy_config.cpp index 19af094..afb5654 100644 --- a/source/game/entities/enemy_config.cpp +++ b/source/game/entities/enemy_config.cpp @@ -30,7 +30,7 @@ namespace { if (s == "square") { return EnemyType::SQUARE; } if (s == "pinwheel") { return EnemyType::PINWHEEL; } if (s == "star") { return EnemyType::STAR; } - if (s == "big_pentagon") { return EnemyType::BIG_PENTAGON; } + if (s == "orb") { return EnemyType::ORB; } return std::nullopt; } @@ -353,8 +353,8 @@ namespace { out.movement.rotation_proximity_multiplier = legacy.rotation_proximity_multiplier; out.movement.proximity_distance = legacy.proximity_distance; break; - case EnemyType::BIG_PENTAGON: - // Sense legacy fallback: el YAML del big_pentagon ha de definir + case EnemyType::ORB: + // Sense legacy fallback: el YAML de l'orb ha de definir // ai.movement explícitament. Default chase lent perquè el switch // siga exhaustiu i no falli si algú omet el bloc ai. out.movement.type = MovementType::CHASE; diff --git a/source/game/entities/enemy_registry.cpp b/source/game/entities/enemy_registry.cpp index 79e1de3..fdeb8ee 100644 --- a/source/game/entities/enemy_registry.cpp +++ b/source/game/entities/enemy_registry.cpp @@ -13,7 +13,7 @@ EnemyConfig EnemyRegistry::pentagon_config; EnemyConfig EnemyRegistry::square_config; EnemyConfig EnemyRegistry::pinwheel_config; EnemyConfig EnemyRegistry::star_config; -EnemyConfig EnemyRegistry::big_pentagon_config; +EnemyConfig EnemyRegistry::orb_config; bool EnemyRegistry::loaded = false; namespace { @@ -40,7 +40,7 @@ auto EnemyRegistry::loadAll() -> bool { loadOne("square", EnemyType::SQUARE, square_config) && loadOne("pinwheel", EnemyType::PINWHEEL, pinwheel_config) && loadOne("star", EnemyType::STAR, star_config) && - loadOne("big_pentagon", EnemyType::BIG_PENTAGON, big_pentagon_config); + loadOne("orb", EnemyType::ORB, orb_config); loaded = OK; if (OK) { std::cout << "[EnemyRegistry] 5 configuracions d'enemic carregades.\n"; @@ -62,8 +62,8 @@ auto EnemyRegistry::get(EnemyType type) -> const EnemyConfig& { return pinwheel_config; case EnemyType::STAR: return star_config; - case EnemyType::BIG_PENTAGON: - return big_pentagon_config; + case EnemyType::ORB: + return orb_config; } std::cerr << "[EnemyRegistry] FATAL: tipus desconegut\n"; std::exit(EXIT_FAILURE); diff --git a/source/game/entities/enemy_registry.hpp b/source/game/entities/enemy_registry.hpp index 466bcea..ac8ee59 100644 --- a/source/game/entities/enemy_registry.hpp +++ b/source/game/entities/enemy_registry.hpp @@ -27,6 +27,6 @@ class EnemyRegistry { static EnemyConfig square_config; static EnemyConfig pinwheel_config; static EnemyConfig star_config; - static EnemyConfig big_pentagon_config; + static EnemyConfig orb_config; static bool loaded; }; diff --git a/source/game/stage_system/stage_loader.cpp b/source/game/stage_system/stage_loader.cpp index 896e567..71f0e33 100644 --- a/source/game/stage_system/stage_loader.cpp +++ b/source/game/stage_system/stage_loader.cpp @@ -219,8 +219,8 @@ namespace StageSystem { out = EnemyType::PINWHEEL; } else if (type_str == "star") { out = EnemyType::STAR; - } else if (type_str == "big_pentagon") { - out = EnemyType::BIG_PENTAGON; + } else if (type_str == "orb") { + out = EnemyType::ORB; } else { return false; } diff --git a/source/game/systems/collision_system.cpp b/source/game/systems/collision_system.cpp index fa67f14..487c4ba 100644 --- a/source/game/systems/collision_system.cpp +++ b/source/game/systems/collision_system.cpp @@ -234,7 +234,7 @@ namespace Systems::Collision { processWoundedDeaths(ctx); // expiran ANTES de ser tocadas por bala este frame detectBulletEnemy(ctx); // Wounded chain desactivat: era massa fàcil que un enemic ferit topés - // amb el big_pentagon (10 HP) i el matés instantàniament. La regla + // amb l'orb (10 HP) i el matés instantàniament. La regla // "ferit-toca-sa → ferit" queda permanentment fora. detectShipEnemy(ctx); detectBulletPlayer(ctx); From 61a4886e628682f108ca0886697fd0bfde6a410e Mon Sep 17 00:00:00 2001 From: Sergio Valor Date: Tue, 26 May 2026 18:25:15 +0200 Subject: [PATCH 2/2] refactor(shapes): reorganitzar data/shapes en subcarpetes per categoria (enemy/bullet/ship/effect) --- data/entities/bullet/bullet.yaml | 2 +- data/entities/bullet_long/bullet_long.yaml | 2 +- data/entities/orb/orb.yaml | 2 +- data/entities/pentagon/pentagon.yaml | 2 +- data/entities/pinwheel/pinwheel.yaml | 2 +- data/entities/player/player.yaml | 4 ++-- data/entities/square/square.yaml | 2 +- data/entities/star/star.yaml | 2 +- data/shapes/{bullet.shp => bullet/basic.shp} | 4 ++-- data/shapes/{bullet_double.shp => bullet/double.shp} | 4 ++-- data/shapes/{bullet_long.shp => bullet/long.shp} | 4 ++-- data/shapes/{star.shp => effect/starfield.shp} | 4 ++-- data/shapes/{ => effect}/title_flash.shp | 2 +- data/shapes/{enemy_orb.shp => enemy/orb.shp} | 4 ++-- data/shapes/{enemy_pentagon.shp => enemy/pentagon.shp} | 4 ++-- data/shapes/{enemy_pinwheel.shp => enemy/pinwheel.shp} | 4 ++-- data/shapes/{enemy_square.shp => enemy/square.shp} | 4 ++-- data/shapes/{star_5.shp => enemy/star.shp} | 4 ++-- data/shapes/ship.shp | 8 -------- data/shapes/ship/arrow.shp | 7 +++++++ data/shapes/{ship3.shp => ship/interceptor.shp} | 4 ++-- data/shapes/{ship2.shp => ship/wedge.shp} | 5 ++--- source/core/graphics/shape_loader.cpp | 2 +- source/core/graphics/shape_loader.hpp | 2 +- source/game/effects/trail_manager.cpp | 4 ++-- source/game/entities/ship.cpp | 2 +- source/game/scenes/game_scene.cpp | 4 ++-- source/game/scenes/title_scene.cpp | 2 +- source/game/title/ship_animator.cpp | 4 ++-- source/game/title/ship_animator.hpp | 4 ++-- 30 files changed, 51 insertions(+), 53 deletions(-) rename data/shapes/{bullet.shp => bullet/basic.shp} (64%) rename data/shapes/{bullet_double.shp => bullet/double.shp} (87%) rename data/shapes/{bullet_long.shp => bullet/long.shp} (93%) rename data/shapes/{star.shp => effect/starfield.shp} (84%) rename data/shapes/{ => effect}/title_flash.shp (84%) rename data/shapes/{enemy_orb.shp => enemy/orb.shp} (93%) rename data/shapes/{enemy_pentagon.shp => enemy/pentagon.shp} (80%) rename data/shapes/{enemy_pinwheel.shp => enemy/pinwheel.shp} (91%) rename data/shapes/{enemy_square.shp => enemy/square.shp} (81%) rename data/shapes/{star_5.shp => enemy/star.shp} (86%) delete mode 100644 data/shapes/ship.shp create mode 100644 data/shapes/ship/arrow.shp rename data/shapes/{ship3.shp => ship/interceptor.shp} (89%) rename data/shapes/{ship2.shp => ship/wedge.shp} (68%) diff --git a/data/entities/bullet/bullet.yaml b/data/entities/bullet/bullet.yaml index d90fb19..a4e2298 100644 --- a/data/entities/bullet/bullet.yaml +++ b/data/entities/bullet/bullet.yaml @@ -3,7 +3,7 @@ name: bullet # Shape de la bala. El bounding_radius del .shp dóna el hitbox base (~3 px); # scale el modula visualment i pel hitbox. shape: - path: bullet.shp + path: bullet/basic.shp scale: 1.0 collision_factor: 1.0 diff --git a/data/entities/bullet_long/bullet_long.yaml b/data/entities/bullet_long/bullet_long.yaml index 7950779..25e6ff9 100644 --- a/data/entities/bullet_long/bullet_long.yaml +++ b/data/entities/bullet_long/bullet_long.yaml @@ -4,7 +4,7 @@ name: bullet_long # jugador i amb prou marge per reaccionar. La velocitat NO viu aquí: es passa # a Bullet::fire() i la decideix qui dispara (l'AiTickAction). shape: - path: bullet_long.shp + path: bullet/long.shp scale: 1.0 collision_factor: 0.5 diff --git a/data/entities/orb/orb.yaml b/data/entities/orb/orb.yaml index 0a840bd..a06673f 100644 --- a/data/entities/orb/orb.yaml +++ b/data/entities/orb/orb.yaml @@ -5,7 +5,7 @@ ai_type: orb # Validat contra el directori; mapeja a EnemyType::O # pensada per llegir-se com a "reactor / orb" amb més detall que els enemics # petits. shape: - path: enemy_orb.shp + path: enemy/orb.shp scale: 1.0 collision_factor: 1.0 diff --git a/data/entities/pentagon/pentagon.yaml b/data/entities/pentagon/pentagon.yaml index baf4096..3e58721 100644 --- a/data/entities/pentagon/pentagon.yaml +++ b/data/entities/pentagon/pentagon.yaml @@ -2,7 +2,7 @@ name: pentagon ai_type: pentagon # Validat contra el directori; mapeja a EnemyType::PENTAGON. shape: - path: enemy_pentagon.shp + path: enemy/pentagon.shp scale: 1.0 # multiplicador visual + hitbox sobre la mida nativa del .shp collision_factor: 1.0 # ajust opcional del hitbox (default 1.0) diff --git a/data/entities/pinwheel/pinwheel.yaml b/data/entities/pinwheel/pinwheel.yaml index bf782bd..2ee336e 100644 --- a/data/entities/pinwheel/pinwheel.yaml +++ b/data/entities/pinwheel/pinwheel.yaml @@ -2,7 +2,7 @@ name: pinwheel ai_type: pinwheel # Validat contra el directori; mapeja a EnemyType::PINWHEEL. shape: - path: enemy_pinwheel.shp + path: enemy/pinwheel.shp scale: 1.0 # multiplicador visual + hitbox sobre la mida nativa del .shp collision_factor: 1.0 # ajust opcional del hitbox (default 1.0) diff --git a/data/entities/player/player.yaml b/data/entities/player/player.yaml index e318b37..27503e6 100644 --- a/data/entities/player/player.yaml +++ b/data/entities/player/player.yaml @@ -1,7 +1,7 @@ name: player_ship # Shape de la nau. Resolt per ShapeLoader (busca a "shapes/"). -# Nota: el segon jugador rep un override del shape ("ship2.shp") al ctor. +# Nota: el segon jugador rep un override del shape ("ship/wedge.shp") al ctor. # Quan s'introdueixin variants reals de nau, es crearà un YAML separat # per cada model. # @@ -10,7 +10,7 @@ name: player_ship # automàtic de la shape; tocar només si el feel del hitbox # no quadra amb la silueta visual (default 1.0). shape: - path: ship.shp + path: ship/arrow.shp scale: 1.0 collision_factor: 1.0 diff --git a/data/entities/square/square.yaml b/data/entities/square/square.yaml index 8de6d1c..60b2d7f 100644 --- a/data/entities/square/square.yaml +++ b/data/entities/square/square.yaml @@ -2,7 +2,7 @@ name: square ai_type: square # Validat contra el directori; mapeja a EnemyType::SQUARE. shape: - path: enemy_square.shp + path: enemy/square.shp scale: 1.0 # multiplicador visual + hitbox sobre la mida nativa del .shp collision_factor: 1.0 # ajust opcional del hitbox (default 1.0) diff --git a/data/entities/star/star.yaml b/data/entities/star/star.yaml index 8ba95f8..311e42d 100644 --- a/data/entities/star/star.yaml +++ b/data/entities/star/star.yaml @@ -2,7 +2,7 @@ name: star ai_type: star # Validat contra el directori; mapeja a EnemyType::STAR. shape: - path: star_5.shp + path: enemy/star.shp scale: 0.7 # Lleugerament més petit que els altres enemics per diferenciar visualment. collision_factor: 1.0 diff --git a/data/shapes/bullet.shp b/data/shapes/bullet/basic.shp similarity index 64% rename from data/shapes/bullet.shp rename to data/shapes/bullet/basic.shp index ad9d4e2..cd4cf2b 100644 --- a/data/shapes/bullet.shp +++ b/data/shapes/bullet/basic.shp @@ -1,6 +1,6 @@ -# bullet.shp - Projectil (octàgon, radi=3) +# bullet/basic.shp - Projectil (octàgon, radi=3) -name: bullet +name: basic scale: 1.0 center: 0, 0 diff --git a/data/shapes/bullet_double.shp b/data/shapes/bullet/double.shp similarity index 87% rename from data/shapes/bullet_double.shp rename to data/shapes/bullet/double.shp index eeaa14e..2f931d2 100644 --- a/data/shapes/bullet_double.shp +++ b/data/shapes/bullet/double.shp @@ -1,4 +1,4 @@ -# bullet_double.shp - Bala anular (dos cercles concèntrics) +# bullet/double.shp - Bala anular (dos cercles concèntrics) # © 2026 JailDesigner # # Dos octàgons concèntrics al centre (0,0): @@ -6,7 +6,7 @@ # - Interior: radi 2 (lleugerament més petit que la bala estàndard) # Aspecte d'anell / aura de plasma. Bounding radius natiu = 4. -name: bullet_double +name: double scale: 1.0 center: 0, 0 diff --git a/data/shapes/bullet_long.shp b/data/shapes/bullet/long.shp similarity index 93% rename from data/shapes/bullet_long.shp rename to data/shapes/bullet/long.shp index f377e94..d8ae078 100644 --- a/data/shapes/bullet_long.shp +++ b/data/shapes/bullet/long.shp @@ -1,4 +1,4 @@ -# bullet_long.shp - Bala allargada vertical (dos mig-octàgons + dos costats) +# bullet/long.shp - Bala allargada vertical (dos mig-octàgons + dos costats) # © 2026 JailDesigner # # Càpsula orientada al llarg de l'eix Y: la bala viatja segons el seu angle @@ -15,7 +15,7 @@ # Bounding radius natiu = 6 (extrem vertical a y=±6). # collision_factor al YAML compensa el bounding doble (0.5 → hitbox ≈ 3). -name: bullet_long +name: long scale: 1.0 center: 0, 0 diff --git a/data/shapes/star.shp b/data/shapes/effect/starfield.shp similarity index 84% rename from data/shapes/star.shp rename to data/shapes/effect/starfield.shp index cc04a19..c7c9850 100644 --- a/data/shapes/star.shp +++ b/data/shapes/effect/starfield.shp @@ -1,7 +1,7 @@ -# star.shp - Estrella per a starfield +# effect/starfield.shp - Estrella per a starfield # © 2026 JailDesigner -name: star +name: starfield scale: 1.0 center: 0, 0 diff --git a/data/shapes/title_flash.shp b/data/shapes/effect/title_flash.shp similarity index 84% rename from data/shapes/title_flash.shp rename to data/shapes/effect/title_flash.shp index cdcce3e..3b84a2e 100644 --- a/data/shapes/title_flash.shp +++ b/data/shapes/effect/title_flash.shp @@ -1,4 +1,4 @@ -# title_flash.shp - Sparkle 4-puntes amb costats còncaus (Atari-style) +# effect/title_flash.shp - Sparkle 4-puntes amb costats còncaus (Atari-style) # 4 puntes als cardinals (radi 30) i valls còncaus als 45° (corba Bezier # quadràtica amb control point ±8). 5 punts per arc subdividint la corba. diff --git a/data/shapes/enemy_orb.shp b/data/shapes/enemy/orb.shp similarity index 93% rename from data/shapes/enemy_orb.shp rename to data/shapes/enemy/orb.shp index 95be4bc..cfeff3c 100644 --- a/data/shapes/enemy_orb.shp +++ b/data/shapes/enemy/orb.shp @@ -1,4 +1,4 @@ -# enemy_orb.shp - ORNI enemic gegant (orb circular, doble anell amb radis) +# enemy/orb.shp - ORNI enemic gegant (orb circular, doble anell amb radis) # © 2026 JailDesigner # # Forma "reactor / boss circular" — més detall que els enemics petits perquè @@ -9,7 +9,7 @@ # - Petit "+" central com a nucli. # Bounding radius natiu = 20 (alineat amb la resta d'enemics). -name: enemy_orb +name: orb scale: 1.0 center: 0, 0 diff --git a/data/shapes/enemy_pentagon.shp b/data/shapes/enemy/pentagon.shp similarity index 80% rename from data/shapes/enemy_pentagon.shp rename to data/shapes/enemy/pentagon.shp index 8a8106a..c0be334 100644 --- a/data/shapes/enemy_pentagon.shp +++ b/data/shapes/enemy/pentagon.shp @@ -1,6 +1,6 @@ -# enemy_pentagon.shp - ORNI enemic (pentàgon doble concentric, radi exterior=20) +# enemy/pentagon.shp - ORNI enemic (pentàgon doble concentric, radi exterior=20) -name: enemy_pentagon +name: pentagon scale: 1.0 center: 0, 0 diff --git a/data/shapes/enemy_pinwheel.shp b/data/shapes/enemy/pinwheel.shp similarity index 91% rename from data/shapes/enemy_pinwheel.shp rename to data/shapes/enemy/pinwheel.shp index 9747af1..97aa7ec 100644 --- a/data/shapes/enemy_pinwheel.shp +++ b/data/shapes/enemy/pinwheel.shp @@ -1,7 +1,7 @@ -# enemy_pinwheel.shp - ORNI enemic (molinillo de 4 triangles) +# enemy/pinwheel.shp - ORNI enemic (molinillo de 4 triangles) # © 2026 JailDesigner -name: enemy_pinwheel +name: pinwheel scale: 1.0 center: 0, 0 diff --git a/data/shapes/enemy_square.shp b/data/shapes/enemy/square.shp similarity index 81% rename from data/shapes/enemy_square.shp rename to data/shapes/enemy/square.shp index 36d48f1..b1bb581 100644 --- a/data/shapes/enemy_square.shp +++ b/data/shapes/enemy/square.shp @@ -1,6 +1,6 @@ -# enemy_square.shp - ORNI enemic (rombe, radi=20) + ull amb pupil·la al centre +# enemy/square.shp - ORNI enemic (rombe, radi=20) + ull amb pupil·la al centre -name: enemy_square +name: square scale: 1.0 center: 0, 0 diff --git a/data/shapes/star_5.shp b/data/shapes/enemy/star.shp similarity index 86% rename from data/shapes/star_5.shp rename to data/shapes/enemy/star.shp index 62b5a57..6d0f3ab 100644 --- a/data/shapes/star_5.shp +++ b/data/shapes/enemy/star.shp @@ -1,4 +1,4 @@ -# star_5.shp - ORNI enemic (estrella de 5 puntes, només perímetre) +# enemy/star.shp - ORNI enemic (estrella de 5 puntes, només perímetre) # © 2026 JailDesigner # # Pentagrama clàssic: 5 vèrtexs exteriors (radi 20) alternant amb 5 vèrtexs @@ -8,7 +8,7 @@ # Sense línies interiors: una única polyline que recorre el perímetre. # Bounding radius natiu ≈ 20 (alineat amb pentagon/square/pinwheel). -name: star_5 +name: star scale: 1.0 center: 0, 0 diff --git a/data/shapes/ship.shp b/data/shapes/ship.shp deleted file mode 100644 index aebcbe7..0000000 --- a/data/shapes/ship.shp +++ /dev/null @@ -1,8 +0,0 @@ -# ship.shp - Nau del jugador 1 -# Triangle amb base còncava (punta de fletxa) - -name: ship -scale: 1.0 -center: 0, 0 - -polyline: 0,-12 8.49,8.49 0,4 -8.49,8.49 0,-12 diff --git a/data/shapes/ship/arrow.shp b/data/shapes/ship/arrow.shp new file mode 100644 index 0000000..bd9362d --- /dev/null +++ b/data/shapes/ship/arrow.shp @@ -0,0 +1,7 @@ +# ship/arrow.shp - Nau del jugador 1 (triangle amb base còncava, punta de fletxa) + +name: arrow +scale: 1.0 +center: 0, 0 + +polyline: 0,-12 8.49,8.49 0,4 -8.49,8.49 0,-12 diff --git a/data/shapes/ship3.shp b/data/shapes/ship/interceptor.shp similarity index 89% rename from data/shapes/ship3.shp rename to data/shapes/ship/interceptor.shp index 998a4a6..0bf49d1 100644 --- a/data/shapes/ship3.shp +++ b/data/shapes/ship/interceptor.shp @@ -1,7 +1,7 @@ -# ship2.shp - Nau del jugador 2 (interceptor amb ales) +# ship/interceptor.shp - Interceptor amb ales laterals pronunciades # © 2026 JailDesigner -name: ship2 +name: interceptor scale: 1.0 center: 0, 0 diff --git a/data/shapes/ship2.shp b/data/shapes/ship/wedge.shp similarity index 68% rename from data/shapes/ship2.shp rename to data/shapes/ship/wedge.shp index 4bf35d3..54737ed 100644 --- a/data/shapes/ship2.shp +++ b/data/shapes/ship/wedge.shp @@ -1,7 +1,6 @@ -# ship2.shp - Nau del jugador 2 -# Triangle amb cercle central (distintiu visual) +# ship/wedge.shp - Nau del jugador 2 (triangle amb cercle central) -name: ship2 +name: wedge scale: 1.0 center: 0, 0 diff --git a/source/core/graphics/shape_loader.cpp b/source/core/graphics/shape_loader.cpp index 15d6159..f5e27f8 100644 --- a/source/core/graphics/shape_loader.cpp +++ b/source/core/graphics/shape_loader.cpp @@ -20,7 +20,7 @@ namespace Graphics { return it->second; // Cache hit } - // Normalize path: "ship.shp" → "shapes/ship.shp" + // Normalize path: "ship/arrow.shp" → "shapes/ship/arrow.shp" // "logo/letra_j.shp" → "shapes/logo/letra_j.shp" std::string normalized = filename; if (!normalized.starts_with("shapes/")) { diff --git a/source/core/graphics/shape_loader.hpp b/source/core/graphics/shape_loader.hpp index a8a228b..7118416 100644 --- a/source/core/graphics/shape_loader.hpp +++ b/source/core/graphics/shape_loader.hpp @@ -19,7 +19,7 @@ namespace Graphics { // Carregar shape desde file (con caché) // Retorna punter compartit (nullptr si error) - // Exemple: load("ship.shp") → busca a "data/shapes/ship.shp" + // Exemple: load("ship/arrow.shp") → busca a "data/shapes/ship/arrow.shp" static auto load(const std::string& filename) -> std::shared_ptr; // Netejar caché (útil per debug/recàrrega) diff --git a/source/game/effects/trail_manager.cpp b/source/game/effects/trail_manager.cpp index 3ca245d..604d6ef 100644 --- a/source/game/effects/trail_manager.cpp +++ b/source/game/effects/trail_manager.cpp @@ -33,9 +33,9 @@ namespace Effects { TrailManager::TrailManager(Rendering::Renderer* renderer) : renderer_(renderer), - star_shape_(Graphics::ShapeLoader::load("star.shp")) { + star_shape_(Graphics::ShapeLoader::load("effect/starfield.shp")) { if (!star_shape_ || !star_shape_->isValid()) { - std::cerr << "[TrailManager] Warning: no s'ha pogut load star.shp\n"; + std::cerr << "[TrailManager] Warning: no s'ha pogut load effect/starfield.shp\n"; } for (auto& particle : pool_) { particle.active = false; diff --git a/source/game/entities/ship.cpp b/source/game/entities/ship.cpp index 1c92b01..3292238 100644 --- a/source/game/entities/ship.cpp +++ b/source/game/entities/ship.cpp @@ -26,7 +26,7 @@ Ship::Ship(Rendering::Renderer* renderer, PlayerConfig config, const char* shape config_(std::move(config)) { brightness_ = Defaults::Brightness::NAU; - // El shape pot venir del YAML o ser overridden (ex: P2 amb "ship2.shp"). + // El shape pot venir del YAML o ser overridden (ex: P2 amb "ship/wedge.shp"). const std::string SHAPE_PATH = (shape_override != nullptr) ? shape_override : config_.shape.path; shape_ = Graphics::ShapeLoader::load(SHAPE_PATH); if (!shape_ || !shape_->isValid()) { diff --git a/source/game/scenes/game_scene.cpp b/source/game/scenes/game_scene.cpp index 208bdc4..dc1dbc2 100644 --- a/source/game/scenes/game_scene.cpp +++ b/source/game/scenes/game_scene.cpp @@ -82,8 +82,8 @@ GameScene::GameScene(SDLManager& sdl, SceneContext& context) } // Inicialitzar naves: P1 amb el shape del YAML, P2 amb override visual. - ships_[0] = Ship(sdl.getRenderer(), *player_config); // Jugador 1: nau estàndard - ships_[1] = Ship(sdl.getRenderer(), *player_config, "ship2.shp"); // Jugador 2: interceptor amb ales + ships_[0] = Ship(sdl.getRenderer(), *player_config); // Jugador 1: nau estàndard + ships_[1] = Ship(sdl.getRenderer(), *player_config, "ship/wedge.shp"); // Jugador 2: triangle amb cercle central // Inicialitzar balas con renderer std::ranges::fill(bullets_, Bullet(sdl.getRenderer())); diff --git a/source/game/scenes/title_scene.cpp b/source/game/scenes/title_scene.cpp index 520bfb0..e064d2f 100644 --- a/source/game/scenes/title_scene.cpp +++ b/source/game/scenes/title_scene.cpp @@ -78,7 +78,7 @@ TitleScene::TitleScene(SDLManager& sdl, SceneContext& context) // Flash que tapa el "pop" final de la nau al VP. Es spawneja al centre // de pantalla (= projecció del VP) quan ship_animator avisa. - flash_shape_ = Graphics::ShapeLoader::load("title_flash.shp"); + flash_shape_ = Graphics::ShapeLoader::load("effect/title_flash.shp"); ship_animator_->setOnShipDisappear([this](int /*player_id*/) { triggerFlash(Vec2{ .x = static_cast(Defaults::Window::WIDTH) / 2.0F, diff --git a/source/game/title/ship_animator.cpp b/source/game/title/ship_animator.cpp index 1f4db36..36a912c 100644 --- a/source/game/title/ship_animator.cpp +++ b/source/game/title/ship_animator.cpp @@ -114,8 +114,8 @@ namespace Title { } void ShipAnimator::init() { - auto shape_p1 = Graphics::ShapeLoader::load("ship.shp"); - auto shape_p2 = Graphics::ShapeLoader::load("ship2.shp"); + auto shape_p1 = Graphics::ShapeLoader::load("ship/arrow.shp"); + auto shape_p2 = Graphics::ShapeLoader::load("ship/wedge.shp"); ships_[0].player_id = 1; if (shape_p1 && shape_p1->isValid()) { diff --git a/source/game/title/ship_animator.hpp b/source/game/title/ship_animator.hpp index 904e6f3..0a43a00 100644 --- a/source/game/title/ship_animator.hpp +++ b/source/game/title/ship_animator.hpp @@ -3,8 +3,8 @@ // // Manté la mateixa màquina d'estats // (ENTERING → FLOATING → EXITING) però treballa amb posicions Vec3 i emet -// wireframes a través d'una `Camera3D`. La geometria s'extrau de `ship.shp` -// (P1) i `ship2.shp` (P2) per extrusió en Z. +// wireframes a través d'una `Camera3D`. La geometria s'extrau de +// `ship/arrow.shp` (P1) i `ship/wedge.shp` (P2) per extrusió en Z. #pragma once