afegida logica de continues

fix: el text no centrava correctament en horitzontal
This commit is contained in:
2025-12-17 13:31:32 +01:00
parent 3b432e6580
commit ec333efe66
4 changed files with 291 additions and 23 deletions

View File

@@ -24,6 +24,13 @@
#include "core/system/game_config.hpp"
#include "core/types.hpp"
// Game over state machine
enum class EstatGameOver {
NONE, // Normal gameplay
CONTINUE, // Continue countdown screen (9→0)
GAME_OVER // Final game over (returning to title)
};
// Classe principal del joc (escena)
class EscenaJoc {
public:
@@ -53,8 +60,11 @@ class EscenaJoc {
// Lives and game over system
std::array<int, 2> vides_per_jugador_; // [0]=P1, [1]=P2
bool game_over_; // Game over state flag
float game_over_timer_; // Countdown timer for auto-return (seconds)
EstatGameOver estat_game_over_; // Game over state machine (NONE, CONTINUE, GAME_OVER)
int continue_counter_; // Continue countdown (9→0)
float continue_tick_timer_; // Timer for countdown tick (1.0s)
int continues_usados_; // Continues used this game (0-3 max)
float game_over_timer_; // Final GAME OVER timer before title screen
// Punt punt_spawn_; // DEPRECATED: usar obtenir_punt_spawn(player_id)
Punt punt_mort_; // Death position (for respawn, legacy)
std::array<int, 2> puntuacio_per_jugador_; // [0]=P1, [1]=P2
@@ -78,6 +88,12 @@ class EscenaJoc {
void disparar_bala(uint8_t player_id); // Shoot bullet from player
Punt obtenir_punt_spawn(uint8_t player_id) const; // Get spawn position for player
// [NEW] Continue & Join system
void unir_jugador(uint8_t player_id); // Join inactive player mid-game
void processar_input_continue(); // Handle input during continue screen
void actualitzar_continue(float delta_time); // Update continue countdown
void dibuixar_continue(); // Draw continue screen
// [NEW] Stage system helpers
void dibuixar_missatge_stage(const std::string& missatge);