granera con sarna no pica
This commit is contained in:
@@ -80,15 +80,6 @@ Game::Game(Mode mode)
|
||||
Console::get()->on_toggle = [this](bool open) { player_->setIgnoreInput(open); };
|
||||
if (Console::get()->isActive()) { player_->setIgnoreInput(true); }
|
||||
}
|
||||
GameControl::change_player_skin = [this](const std::string& skin_name) -> void {
|
||||
Options::game.player_skin = skin_name;
|
||||
player_->setSkin(skin_name);
|
||||
};
|
||||
GameControl::change_player_color = [this](int color) -> void {
|
||||
Options::game.player_color = color;
|
||||
player_->setColor();
|
||||
};
|
||||
|
||||
#ifdef _DEBUG
|
||||
GameControl::change_room = [this](const std::string& r) -> bool { return this->changeRoom(r); };
|
||||
GameControl::get_current_room = [this]() -> std::string { return current_room_; };
|
||||
@@ -108,7 +99,6 @@ Game::Game(Mode mode)
|
||||
} else {
|
||||
Options::cheats.invincible = invincible_before_debug_ ? Options::Cheat::State::ENABLED : Options::Cheat::State::DISABLED;
|
||||
}
|
||||
player_->setColor();
|
||||
scoreboard_data_->music = !Debug::get()->isEnabled();
|
||||
scoreboard_data_->music ? Audio::get()->resumeMusic() : Audio::get()->pauseMusic();
|
||||
};
|
||||
@@ -172,8 +162,6 @@ Game::~Game() {
|
||||
|
||||
ItemTracker::destroy();
|
||||
|
||||
GameControl::change_player_skin = nullptr;
|
||||
GameControl::change_player_color = nullptr;
|
||||
if (Console::get() != nullptr) { Console::get()->on_toggle = nullptr; }
|
||||
|
||||
#ifdef _DEBUG
|
||||
@@ -646,12 +634,10 @@ void Game::handleDebugEvents(const SDL_Event& event) { // NOLINT(readability-co
|
||||
|
||||
case SDLK_1:
|
||||
toggleCheat(Options::cheats.infinite_lives, Locale::get()->get("game.cheat_infinite_lives")); // NOLINT(readability-static-accessed-through-instance)
|
||||
player_->setColor();
|
||||
break;
|
||||
|
||||
case SDLK_2:
|
||||
toggleCheat(Options::cheats.invincible, Locale::get()->get("game.cheat_invincible")); // NOLINT(readability-static-accessed-through-instance)
|
||||
player_->setColor();
|
||||
break;
|
||||
|
||||
case SDLK_7:
|
||||
@@ -671,7 +657,6 @@ void Game::handleDebugEvents(const SDL_Event& event) { // NOLINT(readability-co
|
||||
} else {
|
||||
Options::cheats.invincible = invincible_before_debug_ ? Options::Cheat::State::ENABLED : Options::Cheat::State::DISABLED;
|
||||
}
|
||||
player_->setColor();
|
||||
scoreboard_data_->music = !Debug::get()->isEnabled();
|
||||
scoreboard_data_->music ? Audio::get()->resumeMusic() : Audio::get()->pauseMusic();
|
||||
break;
|
||||
@@ -779,9 +764,6 @@ auto Game::changeRoom(const std::string& room_path) -> bool {
|
||||
// Pasa la nueva habitación al jugador
|
||||
player_->setRoom(room_);
|
||||
|
||||
// Recalcula el color del jugador (evita coincidir con el fondo)
|
||||
player_->setColor();
|
||||
|
||||
// Cambia la habitación actual
|
||||
current_room_ = room_path;
|
||||
|
||||
@@ -938,7 +920,7 @@ void Game::killPlayer() {
|
||||
}
|
||||
|
||||
// Sonido
|
||||
Audio::get()->playSound("death.wav", Audio::Group::GAME);
|
||||
Audio::get()->playSound(Defaults::Sound::Files::DEATH, Audio::Group::GAME);
|
||||
|
||||
// Transicionar al estado BLACK_SCREEN (el respawn ocurre en transitionToState)
|
||||
transitionToState(State::BLACK_SCREEN);
|
||||
@@ -956,7 +938,7 @@ void Game::togglePause() {
|
||||
// Inicializa al jugador
|
||||
void Game::initPlayer(const Player::SpawnData& spawn_point, std::shared_ptr<Room> room) { // NOLINT(readability-convert-member-functions-to-static)
|
||||
const bool IGNORE_INPUT = player_ != nullptr && player_->getIgnoreInput();
|
||||
std::string player_animations = Player::skinToAnimationPath(Options::game.player_skin);
|
||||
std::string player_animations = Player::skinToAnimationPath(Defaults::Game::Player::SKIN);
|
||||
const Player::Data PLAYER{.spawn_data = spawn_point, .animations_path = player_animations, .room = std::move(room)};
|
||||
player_ = std::make_shared<Player>(PLAYER);
|
||||
if (IGNORE_INPUT) { player_->setIgnoreInput(true); }
|
||||
@@ -964,7 +946,7 @@ void Game::initPlayer(const Player::SpawnData& spawn_point, std::shared_ptr<Room
|
||||
|
||||
// Hace sonar la música
|
||||
void Game::keepMusicPlaying() {
|
||||
const std::string MUSIC_PATH = mode_ == Mode::GAME ? "574070_KUVO_Farewell_to_school.ogg" : "574071_EA_DTV.ogg";
|
||||
const std::string MUSIC_PATH = mode_ == Mode::GAME ? Defaults::Music::Files::GAME_TRACK : Defaults::Music::Files::TITLE_TRACK;
|
||||
|
||||
// Si la música no está sonando
|
||||
if (Audio::get()->getMusicState() == Audio::MusicState::STOPPED) {
|
||||
|
||||
Reference in New Issue
Block a user