tune(bullets): puja MAX_BALES a 50 i deshardcoded el slot per jugador
This commit is contained in:
@@ -6,7 +6,7 @@
|
|||||||
namespace Defaults::Entities {
|
namespace Defaults::Entities {
|
||||||
|
|
||||||
constexpr int MAX_ORNIS = 15;
|
constexpr int MAX_ORNIS = 15;
|
||||||
constexpr int MAX_BALES = 3;
|
constexpr int MAX_BALES = 50;
|
||||||
|
|
||||||
constexpr float SHIP_RADIUS = 12.0F;
|
constexpr float SHIP_RADIUS = 12.0F;
|
||||||
constexpr float ENEMY_RADIUS = 20.0F;
|
constexpr float ENEMY_RADIUS = 20.0F;
|
||||||
|
|||||||
@@ -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;
|
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};
|
Vec2 posicio_dispar = {.x = tip_x, .y = tip_y};
|
||||||
|
|
||||||
// Buscar primera bullet inactiva en el pool del player
|
// Buscar primera bullet inactiva en el pool del player.
|
||||||
int start_idx = player_id * 3; // P1=[0,1,2], P2=[3,4,5]
|
// El pool global té MAX_BALES slots per jugador (P1=[0..MAX-1], P2=[MAX..2*MAX-1]).
|
||||||
for (int i = start_idx; i < start_idx + 3; i++) {
|
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()) {
|
if (!bullets_[i].isActive()) {
|
||||||
bullets_[i].disparar(posicio_dispar, ship_angle, player_id);
|
bullets_[i].disparar(posicio_dispar, ship_angle, player_id);
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in New Issue
Block a user