tune(bullets): puja MAX_BALES a 50 i deshardcoded el slot per jugador

This commit is contained in:
2026-05-21 18:51:55 +02:00
parent 23eff1585c
commit e6eaf870c6
2 changed files with 6 additions and 4 deletions
+1 -1
View File
@@ -6,7 +6,7 @@
namespace Defaults::Entities {
constexpr int MAX_ORNIS = 15;
constexpr int MAX_BALES = 3;
constexpr int MAX_BALES = 50;
constexpr float SHIP_RADIUS = 12.0F;
constexpr float ENEMY_RADIUS = 20.0F;
+5 -3
View File
@@ -850,9 +850,11 @@ void GameScene::fireBullet(uint8_t player_id) {
float tip_y = (LOCAL_TIP_X * sin_a) + (LOCAL_TIP_Y * cos_a) + ship_centre.y;
Vec2 posicio_dispar = {.x = tip_x, .y = tip_y};
// Buscar primera bullet inactiva en el pool del player
int start_idx = player_id * 3; // P1=[0,1,2], P2=[3,4,5]
for (int i = start_idx; i < start_idx + 3; i++) {
// Buscar primera bullet inactiva en el pool del player.
// El pool global té MAX_BALES slots per jugador (P1=[0..MAX-1], P2=[MAX..2*MAX-1]).
constexpr int SLOTS_PER_PLAYER = Defaults::Entities::MAX_BALES;
const int START_IDX = player_id * SLOTS_PER_PLAYER;
for (int i = START_IDX; i < START_IDX + SLOTS_PER_PLAYER; i++) {
if (!bullets_[i].isActive()) {
bullets_[i].disparar(posicio_dispar, ship_angle, player_id);
break;