This commit is contained in:
2025-10-27 18:35:53 +01:00
parent b1dca32a5b
commit 3179a08dac
63 changed files with 686 additions and 693 deletions

View File

@@ -2,6 +2,7 @@
#include <SDL3/SDL.h>
#include <utility>
#include <vector> // Para vector
#include "core/input/global_inputs.hpp" // Para check
@@ -263,7 +264,7 @@ void Game::renderRoomName() {
}
// Cambia de habitación
bool Game::changeRoom(const std::string& room_path) {
auto Game::changeRoom(const std::string& room_path) -> bool {
// En las habitaciones los limites tienen la cadena del fichero o un 0 en caso de no limitar con nada
if (room_path == "0") {
return false;
@@ -313,7 +314,7 @@ void Game::checkPlayerIsOnBorder() {
}
// Comprueba las colisiones del jugador con los enemigos
bool Game::checkPlayerAndEnemies() {
auto Game::checkPlayerAndEnemies() -> bool {
const bool DEATH = room_->enemyCollision(player_->getCollider());
if (DEATH) {
killPlayer();
@@ -415,7 +416,7 @@ void Game::setScoreBoardColor() {
}
// Comprueba si ha finalizado el juego
bool Game::checkEndGame() {
auto Game::checkEndGame() -> bool {
const bool IS_ON_THE_ROOM = room_->getName() == "THE JAIL"; // Estar en la habitación que toca
const bool HAVE_THE_ITEMS = board_->items >= int(total_items_ * 0.9F) || Options::cheats.jail_is_open == Options::Cheat::State::ENABLED; // Con mas del 90% de los items recogidos
const bool IS_ON_THE_DOOR = player_->getRect().x <= 128; // Y en la ubicación que toca (En la puerta)
@@ -436,7 +437,7 @@ bool Game::checkEndGame() {
}
// Obtiene la cantidad total de items que hay en el mapeado del juego
int Game::getTotalItems() {
auto Game::getTotalItems() -> int {
int items = 0;
auto rooms = Resource::get()->getRooms();
@@ -572,7 +573,7 @@ void Game::checkEndGameCheevos() {
void Game::initPlayer(const PlayerSpawn& spawn_point, std::shared_ptr<Room> room) {
std::string player_texture = Options::cheats.alternate_skin == Options::Cheat::State::ENABLED ? "player2.gif" : "player.gif";
std::string player_animations = Options::cheats.alternate_skin == Options::Cheat::State::ENABLED ? "player2.ani" : "player.ani";
const PlayerData PLAYER(spawn_point, player_texture, player_animations, room);
const PlayerData PLAYER(spawn_point, player_texture, player_animations, std::move(room));
player_ = std::make_shared<Player>(PLAYER);
}
@@ -582,7 +583,7 @@ void Game::createRoomNameTexture() {
room_name_surface_ = std::make_shared<Surface>(Options::game.width, text->getCharacterSize() * 2);
// Establece el destino de la textura
room_name_rect_ = {0.0F, PLAY_AREA_HEIGHT, Options::game.width, text->getCharacterSize() * 2.0F};
room_name_rect_ = {.x = 0.0F, .y = PLAY_AREA_HEIGHT, .w = Options::game.width, .h = text->getCharacterSize() * 2.0F};
}
// Hace sonar la música