refactor: renombra jugador*/zona/radi/MARGE/origen/letra residuals a anglès
This commit is contained in:
1 parent
d36ad7d1c5
commit
252e881e93
22 files changed
+265
-265
No files matched your search
@@ -9,8 +9,8 @@ namespace Defaults::FX::Glow {
|
||||
|
||||
// Neon glow per outline gruixut, aplicat automàticament per renderShape.
|
||||
// Els gruixos d'halo són RÀTIOS del bounding_radius de la shape (escalat
|
||||
// per scale), de manera que un pentàgon (radi 20) té halo gros i una bala
|
||||
// (radi 3) té halo subtil. El core (últim pass) usa el gruix de línia
|
||||
// per scale), de manera que un pentàgon (radius 20) té halo gros i una bala
|
||||
// (radius 3) té halo subtil. El core (últim pass) usa el gruix de línia
|
||||
// global (1.5px) — no escala amb la shape.
|
||||
//
|
||||
// Cap superior: si la shape és molt gran (logos del títol, intro), el
|
||||
|
||||
@@ -59,7 +59,7 @@ namespace Defaults::Game {
|
||||
constexpr float INIT_HUD_SHIP2_RATIO_INIT = 0.20F;
|
||||
constexpr float INIT_HUD_SHIP2_RATIO_END = 1.0F;
|
||||
|
||||
// Posición inicial de la nave en INIT_HUD (75% de altura de zona de juego)
|
||||
// Posición inicial de la nave en INIT_HUD (75% de altura de zone de juego)
|
||||
constexpr float INIT_HUD_SHIP_START_Y_RATIO = 0.75F; // 75% desde el top de PLAYAREA
|
||||
|
||||
// Spawn positions (distribución horizontal para 2 jugadores)
|
||||
|
||||
@@ -68,7 +68,7 @@ namespace Defaults::Title {
|
||||
constexpr float FLOATING_SCALE = 1.0F * SHIP_BASE_SCALE; // Flotante: scale base
|
||||
|
||||
// Offset de entrada (ajustat automáticoament a l'scale)
|
||||
// Fórmula: (radi màxim de la ship * scale de entrada) + margen
|
||||
// Fórmula: (radius màxim de la ship * scale de entrada) + margen
|
||||
constexpr float ENTRY_OFFSET = (SHIP_MAX_RADIUS * ENTRY_SCALE_START) + ENTRY_OFFSET_MARGIN;
|
||||
|
||||
// Vec2 de fuga (centro para l'animación de salida)
|
||||
|
||||
@@ -23,12 +23,12 @@ namespace Graphics {
|
||||
}
|
||||
|
||||
void Border::bumpAt(Vec2 contact_point, float strength) {
|
||||
const SDL_FRect& zona = Defaults::Zones::PLAYAREA;
|
||||
const SDL_FRect& zone = Defaults::Zones::PLAYAREA;
|
||||
const std::array<float, SIDE_COUNT> DISTANCES = {
|
||||
/* TOP */ std::abs(contact_point.y - zona.y),
|
||||
/* RIGHT */ std::abs((zona.x + zona.w) - contact_point.x),
|
||||
/* BOTTOM */ std::abs((zona.y + zona.h) - contact_point.y),
|
||||
/* LEFT */ std::abs(contact_point.x - zona.x)};
|
||||
/* TOP */ std::abs(contact_point.y - zone.y),
|
||||
/* RIGHT */ std::abs((zone.x + zone.w) - contact_point.x),
|
||||
/* BOTTOM */ std::abs((zone.y + zone.h) - contact_point.y),
|
||||
/* LEFT */ std::abs(contact_point.x - zone.x)};
|
||||
|
||||
int closest_idx = 0;
|
||||
float closest_dist = DISTANCES[0];
|
||||
@@ -71,11 +71,11 @@ namespace Graphics {
|
||||
} // namespace
|
||||
|
||||
void Border::draw() const {
|
||||
const SDL_FRect& zona = Defaults::Zones::PLAYAREA;
|
||||
const int X1 = static_cast<int>(zona.x);
|
||||
const int Y1 = static_cast<int>(zona.y);
|
||||
const int X2 = static_cast<int>(zona.x + zona.w);
|
||||
const int Y2 = static_cast<int>(zona.y + zona.h);
|
||||
const SDL_FRect& zone = Defaults::Zones::PLAYAREA;
|
||||
const int X1 = static_cast<int>(zone.x);
|
||||
const int Y1 = static_cast<int>(zone.y);
|
||||
const int X2 = static_cast<int>(zone.x + zone.w);
|
||||
const int Y2 = static_cast<int>(zone.y + zone.h);
|
||||
|
||||
const int OFF_TOP = static_cast<int>(sides_[SIDE_TOP].displacement_px);
|
||||
const int OFF_RIGHT = static_cast<int>(sides_[SIDE_RIGHT].displacement_px);
|
||||
|
||||
@@ -141,9 +141,9 @@ namespace Graphics {
|
||||
}
|
||||
|
||||
void Playfield::buildLines() {
|
||||
const SDL_FRect& zona = Defaults::Zones::PLAYAREA;
|
||||
const float CELL_W = zona.w / static_cast<float>(Defaults::Playfield::COLUMNS);
|
||||
const float CELL_H = zona.h / static_cast<float>(Defaults::Playfield::ROWS);
|
||||
const SDL_FRect& zone = Defaults::Zones::PLAYAREA;
|
||||
const float CELL_W = zone.w / static_cast<float>(Defaults::Playfield::COLUMNS);
|
||||
const float CELL_H = zone.h / static_cast<float>(Defaults::Playfield::ROWS);
|
||||
const float SUB_W = CELL_W / static_cast<float>(Defaults::Playfield::SUBDIVISIONS);
|
||||
const float SUB_H = CELL_H / static_cast<float>(Defaults::Playfield::SUBDIVISIONS);
|
||||
const int SUB_VERTS = Defaults::Playfield::COLUMNS * Defaults::Playfield::SUBDIVISIONS;
|
||||
@@ -154,14 +154,14 @@ namespace Graphics {
|
||||
|
||||
// Verticals: posicions i ∈ [1, SUB_VERTS-1].
|
||||
for (int i = 1; i < SUB_VERTS; i++) {
|
||||
const float X = zona.x + (static_cast<float>(i) * SUB_W);
|
||||
const float X = zone.x + (static_cast<float>(i) * SUB_W);
|
||||
const bool IS_MAIN = (i % Defaults::Playfield::SUBDIVISIONS) == 0;
|
||||
const float BRIGHTNESS = IS_MAIN
|
||||
? Defaults::Playfield::GRID_BRIGHTNESS
|
||||
: Defaults::Playfield::SUBGRID_BRIGHTNESS;
|
||||
verticals.push_back(Line{
|
||||
.start = {.x = X, .y = zona.y},
|
||||
.end = {.x = X, .y = zona.y + zona.h},
|
||||
.start = {.x = X, .y = zone.y},
|
||||
.end = {.x = X, .y = zone.y + zone.h},
|
||||
.brightness = BRIGHTNESS,
|
||||
.spawn_time_s = 0.0F,
|
||||
.is_vertical = true});
|
||||
@@ -169,14 +169,14 @@ namespace Graphics {
|
||||
|
||||
// Horitzontals: posicions j ∈ [1, SUB_HORIZ-1].
|
||||
for (int j = 1; j < SUB_HORIZ; j++) {
|
||||
const float Y = zona.y + (static_cast<float>(j) * SUB_H);
|
||||
const float Y = zone.y + (static_cast<float>(j) * SUB_H);
|
||||
const bool IS_MAIN = (j % Defaults::Playfield::SUBDIVISIONS) == 0;
|
||||
const float BRIGHTNESS = IS_MAIN
|
||||
? Defaults::Playfield::GRID_BRIGHTNESS
|
||||
: Defaults::Playfield::SUBGRID_BRIGHTNESS;
|
||||
horizontals.push_back(Line{
|
||||
.start = {.x = zona.x, .y = Y},
|
||||
.end = {.x = zona.x + zona.w, .y = Y},
|
||||
.start = {.x = zone.x, .y = Y},
|
||||
.end = {.x = zone.x + zone.w, .y = Y},
|
||||
.brightness = BRIGHTNESS,
|
||||
.spawn_time_s = 0.0F,
|
||||
.is_vertical = false});
|
||||
|
||||
@@ -25,11 +25,11 @@ namespace Graphics {
|
||||
}
|
||||
|
||||
void StarfieldParallax::buildStars() {
|
||||
const SDL_FRect& zona = Defaults::Zones::PLAYAREA;
|
||||
const float MIN_X = zona.x;
|
||||
const float MAX_X = zona.x + zona.w;
|
||||
const float MIN_Y = zona.y;
|
||||
const float MAX_Y = zona.y + zona.h;
|
||||
const SDL_FRect& zone = Defaults::Zones::PLAYAREA;
|
||||
const float MIN_X = zone.x;
|
||||
const float MAX_X = zone.x + zone.w;
|
||||
const float MIN_Y = zone.y;
|
||||
const float MAX_Y = zone.y + zone.h;
|
||||
|
||||
// Color únic per a totes les estrelles: el mateix blanc-blau gel
|
||||
// del starfield del títol (Defaults::Title::Colors::STARFIELD).
|
||||
@@ -89,13 +89,13 @@ namespace Graphics {
|
||||
}
|
||||
|
||||
void StarfieldParallax::update(float delta_time, Vec2 world_velocity) {
|
||||
const SDL_FRect& zona = Defaults::Zones::PLAYAREA;
|
||||
const float MIN_X = zona.x;
|
||||
const float MAX_X = zona.x + zona.w;
|
||||
const float MIN_Y = zona.y;
|
||||
const float MAX_Y = zona.y + zona.h;
|
||||
const float W = zona.w;
|
||||
const float H = zona.h;
|
||||
const SDL_FRect& zone = Defaults::Zones::PLAYAREA;
|
||||
const float MIN_X = zone.x;
|
||||
const float MAX_X = zone.x + zone.w;
|
||||
const float MIN_Y = zone.y;
|
||||
const float MAX_Y = zone.y + zone.h;
|
||||
const float W = zone.w;
|
||||
const float H = zone.h;
|
||||
|
||||
for (auto& star : stars_) {
|
||||
const float FACTOR = layerParallax(star.layer);
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace Physics {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Calcular radi combinat (con amplificador per hitbox generós)
|
||||
// Calcular radius combinat (con amplificador per hitbox generós)
|
||||
float suma_radis = (a.getCollisionRadius() + b.getCollisionRadius()) * amplifier;
|
||||
float suma_radis_sq = suma_radis * suma_radis;
|
||||
|
||||
@@ -31,8 +31,8 @@ namespace Physics {
|
||||
return dist_sq <= suma_radis_sq;
|
||||
}
|
||||
|
||||
// Swept collision: una entitat mòbil (radi r_a) s'ha desplaçat de p0 a p1 aquest
|
||||
// frame. Comprova si el segment expandit pel radi conjunt (r_a + radi de b, amb
|
||||
// Swept collision: una entitat mòbil (radius r_a) s'ha desplaçat de p0 a p1 aquest
|
||||
// frame. Comprova si el segment expandit pel radius conjunt (r_a + radius de b, amb
|
||||
// amplificador) toca el cercle de l'entity b. Equival al check discrete quan
|
||||
// p0 == p1 (sense moviment). Evita tunneling a velocitats altes.
|
||||
inline auto checkCollisionSwept(const Vec2& p0, const Vec2& p1, float r_a, const Entities::Entity& b, float amplifier = 1.0F) -> bool {
|
||||
|
||||
@@ -4,52 +4,52 @@
|
||||
|
||||
namespace GameConfig {
|
||||
|
||||
// Mode de juego
|
||||
enum class Mode : std::uint8_t {
|
||||
NORMAL, // Partida normal
|
||||
DEMO // Mode demostració (futur)
|
||||
};
|
||||
// Mode de juego
|
||||
enum class Mode : std::uint8_t {
|
||||
NORMAL, // Partida normal
|
||||
DEMO // Mode demostració (futur)
|
||||
};
|
||||
|
||||
// Configuración de una match
|
||||
struct MatchConfig {
|
||||
bool jugador1_actiu{false}; // Es active el player 1?
|
||||
bool jugador2_actiu{false}; // Es active el player 2?
|
||||
// Configuración de una match
|
||||
struct MatchConfig {
|
||||
bool player1_active{false}; // Es active el player 1?
|
||||
bool player2_active{false}; // Es active el player 2?
|
||||
Mode mode{Mode::NORMAL}; // Mode de juego
|
||||
|
||||
// Métodos auxiliars
|
||||
|
||||
// Retorna true si solo hay un player active
|
||||
[[nodiscard]] auto isSinglePlayer() const -> bool {
|
||||
return (jugador1_actiu && !jugador2_actiu) ||
|
||||
(!jugador1_actiu && jugador2_actiu);
|
||||
return (player1_active && !player2_active) ||
|
||||
(!player1_active && player2_active);
|
||||
}
|
||||
|
||||
// Retorna true si hay dos jugadors active
|
||||
[[nodiscard]] auto isCoop() const -> bool {
|
||||
return jugador1_actiu && jugador2_actiu;
|
||||
return player1_active && player2_active;
|
||||
}
|
||||
|
||||
// Retorna true si no hay sin player active
|
||||
[[nodiscard]] auto hasNoPlayers() const -> bool {
|
||||
return !jugador1_actiu && !jugador2_actiu;
|
||||
return !player1_active && !player2_active;
|
||||
}
|
||||
|
||||
// Compte de jugadors active (0, 1 o 2)
|
||||
[[nodiscard]] auto getPlayerCount() const -> uint8_t {
|
||||
return (jugador1_actiu ? 1 : 0) + (jugador2_actiu ? 1 : 0);
|
||||
return (player1_active ? 1 : 0) + (player2_active ? 1 : 0);
|
||||
}
|
||||
|
||||
// Retorna l'ID de l'únic player active (0 o 1)
|
||||
// Solo vàlid si es_un_jugador() retorna true
|
||||
[[nodiscard]] auto getSinglePlayerId() const -> uint8_t {
|
||||
if (jugador1_actiu && !jugador2_actiu) {
|
||||
if (player1_active && !player2_active) {
|
||||
return 0;
|
||||
}
|
||||
if (!jugador1_actiu && jugador2_actiu) {
|
||||
if (!player1_active && player2_active) {
|
||||
return 1;
|
||||
}
|
||||
return 0; // Fallback (necesario comprovar es_un_jugador() primer)
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
} // namespace GameConfig
|
||||
Reference in new issue
Block a user