115 lines
5.7 KiB
C++
115 lines
5.7 KiB
C++
// game.hpp - Dimensions del joc i regles de partida (vides, durades, colisions)
|
|
// © 2026 JailDesigner
|
|
|
|
#pragma once
|
|
|
|
namespace Defaults::Game {
|
|
|
|
// Dimensiones base del juego (coordenadas lógicas, 16:9)
|
|
constexpr int WIDTH = 1280;
|
|
constexpr int HEIGHT = 720;
|
|
|
|
// Regles de partida
|
|
constexpr int STARTING_LIVES = 3; // Initial lives
|
|
constexpr float DEATH_DURATION = 3.0F; // Seconds of death animation
|
|
constexpr float GAME_OVER_DURATION = 5.0F; // Seconds to display game over
|
|
|
|
// Valores centinela del temporitzador de mort per-jugador.
|
|
constexpr float HIT_TIMER_INACTIVE_PLAYER = 999.0F; // Jugador permanentment inactiu
|
|
constexpr float HIT_TIMER_TRIGGER_DEATH = 0.001F; // Trigger inicial post-impacte (>0 sense disparar regla)
|
|
// Ha de ser ≥ 1.0F: PhysicsWorld separa els cossos al contacte exacte (dist == suma de radis),
|
|
// així que un amplificador < 1 fa que el check de gameplay no es dispari mai. Marge petit
|
|
// (1.05F) per tolerar floating-point i petites separacions post-impuls.
|
|
constexpr float COLLISION_SHIP_ENEMY_AMPLIFIER = 1.05F;
|
|
constexpr float COLLISION_BULLET_ENEMY_AMPLIFIER = 1.15F; // 115% hitbox (generous)
|
|
// Wounded chain: el rebot físic separa els cossos abans que arribi
|
|
// la detecció gameplay; amplier generós perquè el toc compti.
|
|
constexpr float COLLISION_WOUNDED_CHAIN_AMPLIFIER = 1.25F;
|
|
|
|
// Friendly fire system
|
|
constexpr bool FRIENDLY_FIRE_ENABLED = true; // Activar friendly fire
|
|
constexpr float COLLISION_BULLET_PLAYER_AMPLIFIER = 1.0F; // Hitbox exacto (100%)
|
|
// BULLET_SPEED migrat a data/entities/player/player.yaml (weapon.bullet_speed).
|
|
|
|
// Transición LEVEL_START (mensajes aleatorios PRE-level)
|
|
constexpr float LEVEL_START_DURATION = 3.0F; // Duración total
|
|
constexpr float LEVEL_START_TYPING_RATIO = 0.3F; // 30% escribiendo, 70% mostrando
|
|
|
|
// Transición LEVEL_COMPLETED (mensaje "GOOD JOB COMMANDER!")
|
|
constexpr float LEVEL_COMPLETED_DURATION = 3.0F; // Duración total
|
|
constexpr float LEVEL_COMPLETED_TYPING_RATIO = 0.05F; // ~150ms de typewriter (escan ràpid però visible)
|
|
|
|
// Attract mode: transició TÍTOL → DEMO. Primer un "dive" de càmera cap al
|
|
// punt de fuga (deixa enrere títol/naus/logo) i després una cortinilla negra
|
|
// que cau per tapar; a la demo, la cortinilla segueix caient i destapa.
|
|
namespace Dive {
|
|
constexpr float DURATION = 0.55F; // Durada del dive (s), amb acceleració (ease-in)
|
|
constexpr float CAMERA_DISTANCE = 450.0F; // Avanç de la càmera en +Z (passa les naus, a Z≈323)
|
|
constexpr float ZOOM_MAX = 7.0F; // Zoom final dels elements 2D (logo + peu) en travessar-los
|
|
} // namespace Dive
|
|
namespace Curtain {
|
|
constexpr float COVER_DURATION = 0.35F; // TÍTOL: la tela cau i tapa
|
|
constexpr float REVEAL_DURATION = 0.45F; // DEMO: la tela segueix caient i destapa
|
|
} // namespace Curtain
|
|
|
|
// Transición INIT_HUD (animación inicial del HUD)
|
|
constexpr float INIT_HUD_DURATION = 3.0F; // Duración total del estado
|
|
|
|
// Ratios de animación (inicio y fin como porcentajes del tiempo total)
|
|
// RECT (rectángulo de márgenes)
|
|
constexpr float INIT_HUD_RECT_RATIO_INIT = 0.30F;
|
|
constexpr float INIT_HUD_RECT_RATIO_END = 0.85F;
|
|
|
|
// SCORE (marcador de puntuación)
|
|
constexpr float INIT_HUD_SCORE_RATIO_INIT = 0.60F;
|
|
constexpr float INIT_HUD_SCORE_RATIO_END = 0.90F;
|
|
|
|
// SHIP1 (nave player 1)
|
|
constexpr float INIT_HUD_SHIP1_RATIO_INIT = 0.0F;
|
|
constexpr float INIT_HUD_SHIP1_RATIO_END = 1.0F;
|
|
|
|
// SHIP2 (nave player 2)
|
|
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 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)
|
|
constexpr float P1_SPAWN_X_RATIO = 0.33F; // 33% desde izquierda
|
|
constexpr float P2_SPAWN_X_RATIO = 0.67F; // 67% desde izquierda
|
|
constexpr float SPAWN_Y_RATIO = 0.75F; // 75% desde arriba
|
|
|
|
// Continue system behavior
|
|
constexpr int CONTINUE_COUNT_START = 9; // Countdown starts at 9
|
|
constexpr float CONTINUE_TICK_DURATION = 1.0F; // Seconds per countdown tick
|
|
constexpr int MAX_CONTINUES = 3; // Maximum continues per game
|
|
constexpr bool INFINITE_CONTINUES = false; // If true, unlimited continues
|
|
|
|
// Continue screen visual configuration
|
|
namespace ContinueScreen {
|
|
// "CONTINUE" text
|
|
constexpr float CONTINUE_TEXT_SCALE = 2.0F; // Text size
|
|
constexpr float CONTINUE_TEXT_Y_RATIO = 0.30F; // 35% from top of PLAYAREA
|
|
|
|
// Countdown number (9, 8, 7...)
|
|
constexpr float COUNTER_TEXT_SCALE = 4.0F; // Text size (large)
|
|
constexpr float COUNTER_TEXT_Y_RATIO = 0.50F; // 50% from top of PLAYAREA
|
|
|
|
// "CONTINUES LEFT: X" text
|
|
constexpr float INFO_TEXT_SCALE = 0.7F; // Text size (small)
|
|
constexpr float INFO_TEXT_Y_RATIO = 0.75F; // 65% from top of PLAYAREA
|
|
} // namespace ContinueScreen
|
|
|
|
// Game Over screen visual configuration
|
|
namespace GameOverScreen {
|
|
constexpr float TEXT_SCALE = 2.0F; // "GAME OVER" text size
|
|
constexpr float TEXT_SPACING = 4.0F; // Character spacing
|
|
} // namespace GameOverScreen
|
|
|
|
// Stage message configuration (LEVEL_START, LEVEL_COMPLETED)
|
|
constexpr float STAGE_MESSAGE_Y_RATIO = 0.25F; // 25% from top of PLAYAREA
|
|
constexpr float STAGE_MESSAGE_MAX_WIDTH_RATIO = 0.9F; // 90% of PLAYAREA width
|
|
|
|
} // namespace Defaults::Game
|