From 7e2021da70fa693e19cd4d6b6bdc7b432b5b0301 Mon Sep 17 00:00:00 2001 From: Sergio Valor Date: Wed, 5 Feb 2025 10:17:49 +0100 Subject: [PATCH] canvi de pc --- source/manage_hiscore_table.h | 11 ++++++----- source/player.cpp | 1 + source/player.h | 3 +++ 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/source/manage_hiscore_table.h b/source/manage_hiscore_table.h index f351a82..e839b1b 100644 --- a/source/manage_hiscore_table.h +++ b/source/manage_hiscore_table.h @@ -14,12 +14,13 @@ // Estructura para las entradas de la tabla de recirds struct HiScoreEntry { - std::string name; // Nombre - int score; // Puntuación + std::string name; // Nombre + int score = 0; // Puntuación + bool one_credit_complete = false; // Indica si se ha conseguido 1CC - // Constructor - explicit HiScoreEntry(const std::string &n = "", int s = 0) - : name(n), score(s) {} + // Constructor + explicit HiScoreEntry(const std::string &n = "", int s = 0) + : name(n), score(s) {} }; // Clase ManageHiScoreTable diff --git a/source/player.cpp b/source/player.cpp index f13e52c..7f8e7ac 100644 --- a/source/player.cpp +++ b/source/player.cpp @@ -546,6 +546,7 @@ void Player::setPlayingState(PlayerState state) } case PlayerState::CELEBRATING: { + game_completed_ = true; setScoreboardMode(ScoreboardMode::SCORE); break; } diff --git a/source/player.h b/source/player.h index 2669de1..3da1179 100644 --- a/source/player.h +++ b/source/player.h @@ -93,6 +93,8 @@ private: int enter_name_counter_; // Contador para poner nombre Uint32 enter_name_ticks_ = 0; // Variable para poder cambiar el contador de poner nombre en función del tiempo int step_counter_ = 0; // Cuenta los pasos para los estados en los que camina automáticamente + bool game_completed_ = false; // Indica si ha completado el juego + int credits_used_ = 0; // Indica el numero de veces que ha continuado // Actualiza el circulo de colisión a la posición del jugador void shiftColliders(); @@ -230,6 +232,7 @@ public: int getWidth() const { return WIDTH_; } PlayerState getPlayingState() const { return playing_state_; } std::string getName() const { return name_; } + bool get1CC() const { return game_completed_ && credits_used_ == 0; } // Setters void setController(int index) { controller_index_ = index; }