refactor(log): migra game/scenes i game/ui a Log::
- logo_scene, title_scene, intro_scene, room_fsm: missatges de cicle d'escena com a Log::info amb tag "scene" o "RoomFsm". Eliminats els TODO obsolets sobre el logger pendent. - game_scene (16 logs): events del bus (LEVEL COMPLETE, PLAYER HIT, PLAYER KILLED) com a info; transicions de ROOM com a info; warns als casos d'àudio absent o música no arrencada. - hud (3 logs): init i events com a info. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
0b708f1515
commit
5fce52e0ad
6 files changed
+34
-46
No files matched your search
@@ -7,7 +7,6 @@
|
|||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <filesystem>
|
#include <filesystem>
|
||||||
#include <iostream>
|
|
||||||
#include <iterator>
|
#include <iterator>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
#include <variant>
|
#include <variant>
|
||||||
@@ -41,6 +40,7 @@
|
|||||||
#include "utils/defaults.hpp"
|
#include "utils/defaults.hpp"
|
||||||
#include "utils/defines.hpp"
|
#include "utils/defines.hpp"
|
||||||
#include "utils/easing.hpp"
|
#include "utils/easing.hpp"
|
||||||
|
#include "utils/log.hpp"
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
@@ -290,13 +290,12 @@ GameScene::GameScene(Config config)
|
|||||||
// re-emissions es filtren per estat per no re-entrar mai des d'una
|
// re-emissions es filtren per estat per no re-entrar mai des d'una
|
||||||
// transició ja en marxa.
|
// transició ja en marxa.
|
||||||
entity_manager_.getBus().subscribe("level_complete", [this](const Event& ev) {
|
entity_manager_.getBus().subscribe("level_complete", [this](const Event& ev) {
|
||||||
std::cout << "[LEVEL COMPLETE] player_id=" << ev.player_id << '\n';
|
Log::info("LEVEL COMPLETE", "player_id={}", ev.player_id);
|
||||||
if (state_ == RoomFsm::State::PLAYING) { setState(RoomFsm::State::ROOM_OUTRO); }
|
if (state_ == RoomFsm::State::PLAYING) { setState(RoomFsm::State::ROOM_OUTRO); }
|
||||||
});
|
});
|
||||||
entity_manager_.getBus().subscribe("player_hit", [](const Event& ev) {
|
entity_manager_.getBus().subscribe("player_hit", [](const Event& ev) {
|
||||||
const auto* dmg = std::get_if<int>(&ev.payload);
|
const auto* dmg = std::get_if<int>(&ev.payload);
|
||||||
std::cout << "[PLAYER HIT] player_id=" << ev.player_id
|
Log::info("PLAYER HIT", "player_id={} dmg={}", ev.player_id, dmg != nullptr ? *dmg : 0);
|
||||||
<< " dmg=" << (dmg != nullptr ? *dmg : 0) << '\n';
|
|
||||||
});
|
});
|
||||||
// `player_killed` el publica un hazard letal (mòmia amb
|
// `player_killed` el publica un hazard letal (mòmia amb
|
||||||
// `kills_outright`) després del `player_hit`. Aquí resolem el
|
// `kills_outright`) després del `player_hit`. Aquí resolem el
|
||||||
@@ -556,8 +555,7 @@ void GameScene::loadRoom(const std::string& yaml_path) {
|
|||||||
hud_->setPyramidRoom(mgr.currentPyramid(), mgr.currentRoom());
|
hud_->setPyramidRoom(mgr.currentPyramid(), mgr.currentRoom());
|
||||||
}
|
}
|
||||||
|
|
||||||
std::cout << "[ROOM] load " << yaml_path << ": entities reloaded, paint cleared, "
|
Log::info("ROOM", "load {}: entities reloaded, paint cleared, {} active player(s) disabled (awaiting spawn cinematic)", yaml_path, ACTIVE_COUNT);
|
||||||
<< ACTIVE_COUNT << " active player(s) disabled (awaiting spawn cinematic)\n";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GameScene::advanceToNextRoom() {
|
void GameScene::advanceToNextRoom() {
|
||||||
@@ -565,7 +563,7 @@ void GameScene::advanceToNextRoom() {
|
|||||||
if (!mgr.advance()) {
|
if (!mgr.advance()) {
|
||||||
// Política temporal mentre no hi haja pantalla de "Fi de joc":
|
// Política temporal mentre no hi haja pantalla de "Fi de joc":
|
||||||
// arribar al final del levels.yaml fa loop a la primera sala.
|
// arribar al final del levels.yaml fa loop a la primera sala.
|
||||||
std::cout << "[ROOM] final del levels.yaml — bucle a la primera sala\n";
|
Log::info("ROOM", "final del levels.yaml — bucle a la primera sala");
|
||||||
mgr.restart();
|
mgr.restart();
|
||||||
}
|
}
|
||||||
loadRoom(mgr.currentPath());
|
loadRoom(mgr.currentPath());
|
||||||
@@ -576,9 +574,9 @@ void GameScene::enterRoomIntro() {
|
|||||||
// Anotem la transició al log si veníem d'un altre estat; si ja
|
// Anotem la transició al log si veníem d'un altre estat; si ja
|
||||||
// estàvem a INTRO (cas típic d'un salt debug) també queda ben clar.
|
// estàvem a INTRO (cas típic d'un salt debug) també queda ben clar.
|
||||||
if (state_ != RoomFsm::State::ROOM_INTRO) {
|
if (state_ != RoomFsm::State::ROOM_INTRO) {
|
||||||
std::cout << "[ROOM] " << RoomFsm::stateName(state_) << " -> ROOM_INTRO\n";
|
Log::info("ROOM", "{} -> ROOM_INTRO", RoomFsm::stateName(state_));
|
||||||
} else {
|
} else {
|
||||||
std::cout << "[ROOM] ROOM_INTRO restart (cinemàtica reiniciada)\n";
|
Log::info("ROOM", "ROOM_INTRO restart (cinemàtica reiniciada)");
|
||||||
}
|
}
|
||||||
state_ = RoomFsm::State::ROOM_INTRO;
|
state_ = RoomFsm::State::ROOM_INTRO;
|
||||||
transition_ = {};
|
transition_ = {};
|
||||||
@@ -602,7 +600,7 @@ void GameScene::enterRoomIntro() {
|
|||||||
|
|
||||||
auto* audio = Audio::get();
|
auto* audio = Audio::get();
|
||||||
if (audio == nullptr) {
|
if (audio == nullptr) {
|
||||||
std::cout << "[ROOM] INTRO: Audio absent — sense música, timeline només contra text\n";
|
Log::warn("ROOM", "INTRO: Audio absent — sense música, timeline només contra text");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
audio->stopMusic();
|
audio->stopMusic();
|
||||||
@@ -611,10 +609,9 @@ void GameScene::enterRoomIntro() {
|
|||||||
if (Audio::getMusicState() == Audio::MusicState::PLAYING) {
|
if (Audio::getMusicState() == Audio::MusicState::PLAYING) {
|
||||||
const int DUR_MS = Audio::getMusicDurationMs("room_intro.ogg");
|
const int DUR_MS = Audio::getMusicDurationMs("room_intro.ogg");
|
||||||
transition_config_.intro_music_tail_ms = std::max(0, DUR_MS - TEXT_TOTAL_MS);
|
transition_config_.intro_music_tail_ms = std::max(0, DUR_MS - TEXT_TOTAL_MS);
|
||||||
std::cout << "[ROOM] INTRO: música " << DUR_MS << " ms, music_tail "
|
Log::info("ROOM", "INTRO: música {} ms, music_tail {} ms", DUR_MS, transition_config_.intro_music_tail_ms);
|
||||||
<< transition_config_.intro_music_tail_ms << " ms\n";
|
|
||||||
} else {
|
} else {
|
||||||
std::cout << "[ROOM] INTRO: música no arrencada — timeline només contra text\n";
|
Log::warn("ROOM", "INTRO: música no arrencada — timeline només contra text");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -638,7 +635,7 @@ void GameScene::respawnPlayersInstant() {
|
|||||||
state_ = RoomFsm::State::PLAYING;
|
state_ = RoomFsm::State::PLAYING;
|
||||||
intro_completed_ = true;
|
intro_completed_ = true;
|
||||||
transition_ = {};
|
transition_ = {};
|
||||||
std::cout << "[ROOM] post-editor: spawn instantani, estat -> PLAYING\n";
|
Log::info("ROOM", "post-editor: spawn instantani, estat -> PLAYING");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -671,11 +668,11 @@ void GameScene::triggerPlayerSpawn(std::size_t slot_index) {
|
|||||||
// al YAML, l'arma queda buida i el LAND és sec igualment.
|
// al YAML, l'arma queda buida i el LAND és sec igualment.
|
||||||
players_[slot_index]->armNextLandReverb(transition_config_.intro_land_reverb_preset);
|
players_[slot_index]->armNextLandReverb(transition_config_.intro_land_reverb_preset);
|
||||||
|
|
||||||
std::cout << "[ROOM] spawn cinematic P" << (slot_index + 1) << ": airborne entry\n";
|
Log::info("ROOM", "spawn cinematic P{}: airborne entry", slot_index + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GameScene::dispatchPlayerKilled(int player_id) {
|
void GameScene::dispatchPlayerKilled(int player_id) {
|
||||||
std::cout << "[PLAYER KILLED] player_id=" << player_id << '\n';
|
Log::info("PLAYER KILLED", "player_id={}", player_id);
|
||||||
const auto IT = std::ranges::find_if(players_, [player_id](const auto& p) {
|
const auto IT = std::ranges::find_if(players_, [player_id](const auto& p) {
|
||||||
return p && p->getId() == player_id;
|
return p && p->getId() == player_id;
|
||||||
});
|
});
|
||||||
@@ -713,7 +710,7 @@ void GameScene::spawnDuePlayers() {
|
|||||||
|
|
||||||
void GameScene::setState(RoomFsm::State new_state) {
|
void GameScene::setState(RoomFsm::State new_state) {
|
||||||
if (new_state == state_) { return; }
|
if (new_state == state_) { return; }
|
||||||
std::cout << "[ROOM] " << RoomFsm::stateName(state_) << " -> " << RoomFsm::stateName(new_state) << '\n';
|
Log::info("ROOM", "{} -> {}", RoomFsm::stateName(state_), RoomFsm::stateName(new_state));
|
||||||
state_ = new_state;
|
state_ = new_state;
|
||||||
transition_ = {};
|
transition_ = {};
|
||||||
// Reset defensiu dels flags de cicle quan tornem a INTRO via aquest
|
// Reset defensiu dels flags de cicle quan tornem a INTRO via aquest
|
||||||
@@ -742,7 +739,7 @@ void GameScene::setState(RoomFsm::State new_state) {
|
|||||||
const int TEXT_TOTAL_MS = transition_config_.outro_text_enter_ms + transition_config_.outro_text_hold_ms + transition_config_.outro_text_exit_ms;
|
const int TEXT_TOTAL_MS = transition_config_.outro_text_enter_ms + transition_config_.outro_text_hold_ms + transition_config_.outro_text_exit_ms;
|
||||||
transition_config_.outro_music_tail_ms = 0;
|
transition_config_.outro_music_tail_ms = 0;
|
||||||
if (audio == nullptr) {
|
if (audio == nullptr) {
|
||||||
std::cout << "[ROOM] OUTRO: Audio absent — sense música, timeline només contra text\n";
|
Log::warn("ROOM", "OUTRO: Audio absent — sense música, timeline només contra text");
|
||||||
} else {
|
} else {
|
||||||
audio->stopMusic();
|
audio->stopMusic();
|
||||||
audio->setOnMusicEnded({});
|
audio->setOnMusicEnded({});
|
||||||
@@ -750,10 +747,9 @@ void GameScene::setState(RoomFsm::State new_state) {
|
|||||||
if (Audio::getMusicState() == Audio::MusicState::PLAYING) {
|
if (Audio::getMusicState() == Audio::MusicState::PLAYING) {
|
||||||
const int DUR_MS = Audio::getMusicDurationMs("room_outro.ogg");
|
const int DUR_MS = Audio::getMusicDurationMs("room_outro.ogg");
|
||||||
transition_config_.outro_music_tail_ms = std::max(0, DUR_MS - TEXT_TOTAL_MS);
|
transition_config_.outro_music_tail_ms = std::max(0, DUR_MS - TEXT_TOTAL_MS);
|
||||||
std::cout << "[ROOM] OUTRO: música " << DUR_MS << " ms, music_tail "
|
Log::info("ROOM", "OUTRO: música {} ms, music_tail {} ms", DUR_MS, transition_config_.outro_music_tail_ms);
|
||||||
<< transition_config_.outro_music_tail_ms << " ms\n";
|
|
||||||
} else {
|
} else {
|
||||||
std::cout << "[ROOM] OUTRO: música no arrencada — timeline només contra text\n";
|
Log::warn("ROOM", "OUTRO: música no arrencada — timeline només contra text");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1075,7 +1071,7 @@ void GameScene::handlePauseInput() {
|
|||||||
pause_.curve = GOING_TO_PAUSE ? UiConfig::get().pauseEnterCurve() : UiConfig::get().pauseExitCurve();
|
pause_.curve = GOING_TO_PAUSE ? UiConfig::get().pauseEnterCurve() : UiConfig::get().pauseExitCurve();
|
||||||
pause_.state = GOING_TO_PAUSE ? PauseState::ENTERING : PauseState::EXITING;
|
pause_.state = GOING_TO_PAUSE ? PauseState::ENTERING : PauseState::EXITING;
|
||||||
|
|
||||||
std::cout << "[PAUSE] " << (GOING_TO_PAUSE ? "entering" : "exiting") << " from_scale=" << pause_.from_scale << " duration_ms=" << pause_.duration_ms << '\n';
|
Log::info("PAUSE", "{} from_scale={} duration_ms={}", GOING_TO_PAUSE ? "entering" : "exiting", pause_.from_scale, pause_.duration_ms);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1212,7 +1208,7 @@ void GameScene::update(int delta_ms) {
|
|||||||
// (creuar → player_exited → level_complete → OUTRO) es manté.
|
// (creuar → player_exited → level_complete → OUTRO) es manté.
|
||||||
// Mateixos gates que el salt entre sales.
|
// Mateixos gates que el salt entre sales.
|
||||||
if (pause_.state == PauseState::IDLE && !editor_.active() && detectOpenDoor()) {
|
if (pause_.state == PauseState::IDLE && !editor_.active() && detectOpenDoor()) {
|
||||||
std::cout << "[DEBUG] força obertura de la porta\n";
|
Log::info("DEBUG", "força obertura de la porta");
|
||||||
entity_manager_.forceOpenDoor();
|
entity_manager_.forceOpenDoor();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -4,7 +4,6 @@
|
|||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <iostream>
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
@@ -20,13 +19,12 @@
|
|||||||
#include "game/scenes/scene_flow.hpp"
|
#include "game/scenes/scene_flow.hpp"
|
||||||
#include "utils/defaults.hpp"
|
#include "utils/defaults.hpp"
|
||||||
#include "utils/defines.hpp"
|
#include "utils/defines.hpp"
|
||||||
|
#include "utils/log.hpp"
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
constexpr int NAME_Y_OFFSET = -8;
|
constexpr int NAME_Y_OFFSET = -8;
|
||||||
constexpr int TIMER_Y_OFFSET = 8;
|
constexpr int TIMER_Y_OFFSET = 8;
|
||||||
// TODO: migrar a un logger unificat quan es decideixi (veure INC-03 a
|
|
||||||
// docs/audit-core-rendering.md).
|
|
||||||
const char* const SCENE_NAME = "INTRO";
|
const char* const SCENE_NAME = "INTRO";
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
@@ -34,7 +32,7 @@ namespace {
|
|||||||
IntroScene::IntroScene(std::shared_ptr<Text> font, DebugConfig::StartingPlayers starting_players)
|
IntroScene::IntroScene(std::shared_ptr<Text> font, DebugConfig::StartingPlayers starting_players)
|
||||||
: font_(std::move(font)),
|
: font_(std::move(font)),
|
||||||
starting_players_(starting_players) {
|
starting_players_(starting_players) {
|
||||||
std::cout << "[scene] " << SCENE_NAME << " start (players=" << DebugConfig::toString(starting_players_) << ")\n";
|
Log::info("scene", "{} start (players={})", SCENE_NAME, DebugConfig::toString(starting_players_));
|
||||||
}
|
}
|
||||||
|
|
||||||
IntroScene::~IntroScene() = default;
|
IntroScene::~IntroScene() = default;
|
||||||
|
|||||||
@@ -4,7 +4,6 @@
|
|||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <iostream>
|
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
#include "core/audio/audio.hpp"
|
#include "core/audio/audio.hpp"
|
||||||
@@ -19,19 +18,17 @@
|
|||||||
#include "game/scenes/placeholder_input.hpp"
|
#include "game/scenes/placeholder_input.hpp"
|
||||||
#include "game/scenes/scene_flow.hpp"
|
#include "game/scenes/scene_flow.hpp"
|
||||||
#include "utils/defines.hpp"
|
#include "utils/defines.hpp"
|
||||||
|
#include "utils/log.hpp"
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
// TODO: migrar a un logger unificat quan es decideixi (veure INC-03 a
|
|
||||||
// docs/audit-core-rendering.md). De moment std::cout per rastrejar el
|
|
||||||
// flux d'escenes als smoke runs.
|
|
||||||
const char* const SCENE_NAME = "LOGO";
|
const char* const SCENE_NAME = "LOGO";
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
LogoScene::LogoScene(std::shared_ptr<Surface> logo, bool reset)
|
LogoScene::LogoScene(std::shared_ptr<Surface> logo, bool reset)
|
||||||
: logo_(std::move(logo)) {
|
: logo_(std::move(logo)) {
|
||||||
std::cout << "[scene] " << SCENE_NAME << (reset ? " start (reset)\n" : " start\n");
|
Log::info("scene", "{} start{}", SCENE_NAME, reset ? " (reset)" : "");
|
||||||
if (reset) {
|
if (reset) {
|
||||||
if (auto* audio = Audio::get(); audio != nullptr) {
|
if (auto* audio = Audio::get(); audio != nullptr) {
|
||||||
audio->stopMusic();
|
audio->stopMusic();
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
#include "game/scenes/room_fsm.hpp"
|
#include "game/scenes/room_fsm.hpp"
|
||||||
|
|
||||||
#include <array>
|
#include <array>
|
||||||
#include <iostream>
|
|
||||||
#include <string_view>
|
#include <string_view>
|
||||||
|
|
||||||
#include "core/locale/locale.hpp"
|
#include "core/locale/locale.hpp"
|
||||||
#include "core/resources/resource_helper.hpp"
|
#include "core/resources/resource_helper.hpp"
|
||||||
#include "external/fkyaml_node.hpp"
|
#include "external/fkyaml_node.hpp"
|
||||||
|
#include "utils/log.hpp"
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
@@ -28,7 +28,7 @@ namespace RoomFsm {
|
|||||||
|
|
||||||
auto bytes = Resource::Helper::loadFile(yaml_path);
|
auto bytes = Resource::Helper::loadFile(yaml_path);
|
||||||
if (bytes.empty()) {
|
if (bytes.empty()) {
|
||||||
std::cout << "RoomFsm: " << yaml_path << " absent — uso fallbacks compilats\n";
|
Log::warn("RoomFsm", "{} absent — uso fallbacks compilats", yaml_path);
|
||||||
return cfg;
|
return cfg;
|
||||||
}
|
}
|
||||||
const auto* begin = reinterpret_cast<const char*>(bytes.data());
|
const auto* begin = reinterpret_cast<const char*>(bytes.data());
|
||||||
@@ -83,9 +83,7 @@ namespace RoomFsm {
|
|||||||
cfg.text_panel_height_px = readChildInt(n, "height_px", cfg.text_panel_height_px);
|
cfg.text_panel_height_px = readChildInt(n, "height_px", cfg.text_panel_height_px);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::cout << "RoomFsm: timings carregats des de " << yaml_path
|
Log::info("RoomFsm", "timings carregats des de {} (intro fade {}ms, outro fade {}ms)", yaml_path, cfg.intro_fade_in_ms, cfg.outro_fade_out_ms);
|
||||||
<< " (intro fade " << cfg.intro_fade_in_ms
|
|
||||||
<< "ms, outro fade " << cfg.outro_fade_out_ms << "ms)\n";
|
|
||||||
return cfg;
|
return cfg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,6 @@
|
|||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <iostream>
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
@@ -26,6 +25,7 @@
|
|||||||
#include "utils/defaults.hpp"
|
#include "utils/defaults.hpp"
|
||||||
#include "utils/defines.hpp"
|
#include "utils/defines.hpp"
|
||||||
#include "utils/easing.hpp"
|
#include "utils/easing.hpp"
|
||||||
|
#include "utils/log.hpp"
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
@@ -72,7 +72,7 @@ TitleScene::TitleScene(std::shared_ptr<Text> condensed_font, std::shared_ptr<Tex
|
|||||||
game_logo_(std::move(game_logo)),
|
game_logo_(std::move(game_logo)),
|
||||||
mini_logo_(std::move(mini_logo)),
|
mini_logo_(std::move(mini_logo)),
|
||||||
timer_ms_(UiConfig::get().titleDurationMs()) {
|
timer_ms_(UiConfig::get().titleDurationMs()) {
|
||||||
std::cout << "[scene] " << SCENE_NAME << " start\n";
|
Log::info("scene", "{} start", SCENE_NAME);
|
||||||
const auto& hh = UiConfig::get().titleHeatHaze();
|
const auto& hh = UiConfig::get().titleHeatHaze();
|
||||||
if (hh.enabled) {
|
if (hh.enabled) {
|
||||||
heat_haze_.emplace(Effects::HeatHaze::Params{
|
heat_haze_.emplace(Effects::HeatHaze::Params{
|
||||||
@@ -190,7 +190,7 @@ void TitleScene::enterStarting(DebugConfig::StartingPlayers players) {
|
|||||||
if (auto* audio = Audio::get(); audio != nullptr) {
|
if (auto* audio = Audio::get(); audio != nullptr) {
|
||||||
audio->fadeOutMusic(UiConfig::get().titleMusicFadeOutMs());
|
audio->fadeOutMusic(UiConfig::get().titleMusicFadeOutMs());
|
||||||
}
|
}
|
||||||
std::cout << "[scene] " << SCENE_NAME << " STARTING (players=" << DebugConfig::toString(players) << ")\n";
|
Log::info("scene", "{} STARTING (players={})", SCENE_NAME, DebugConfig::toString(players));
|
||||||
}
|
}
|
||||||
|
|
||||||
void TitleScene::tickIdle(int delta_ms, bool p1_start, bool p2_start) {
|
void TitleScene::tickIdle(int delta_ms, bool p1_start, bool p2_start) {
|
||||||
@@ -255,7 +255,7 @@ void TitleScene::enterAttract() {
|
|||||||
if (attract_fade_) {
|
if (attract_fade_) {
|
||||||
attract_fade_->begin(UiConfig::get().titleAttractFadeToBlackMs());
|
attract_fade_->begin(UiConfig::get().titleAttractFadeToBlackMs());
|
||||||
}
|
}
|
||||||
std::cout << "[scene] " << SCENE_NAME << " ATTRACT_OUT\n";
|
Log::info("scene", "{} ATTRACT_OUT", SCENE_NAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TitleScene::advanceToIntro(DebugConfig::StartingPlayers players) {
|
void TitleScene::advanceToIntro(DebugConfig::StartingPlayers players) {
|
||||||
|
|||||||
@@ -6,7 +6,6 @@
|
|||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <iostream>
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
#include <variant>
|
#include <variant>
|
||||||
@@ -19,6 +18,7 @@
|
|||||||
#include "utils/defaults.hpp"
|
#include "utils/defaults.hpp"
|
||||||
#include "utils/defines.hpp"
|
#include "utils/defines.hpp"
|
||||||
#include "utils/easing.hpp"
|
#include "utils/easing.hpp"
|
||||||
|
#include "utils/log.hpp"
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
@@ -127,17 +127,16 @@ Hud::Hud(EventBus& bus, std::shared_ptr<Text> font)
|
|||||||
blk.flash_ms_left = UiConfig::get().hudFlashMs();
|
blk.flash_ms_left = UiConfig::get().hudFlashMs();
|
||||||
blk.shake_ms_left = UiConfig::get().hudShakeMs();
|
blk.shake_ms_left = UiConfig::get().hudShakeMs();
|
||||||
blk.shake_intensity = 1.5F;
|
blk.shake_intensity = 1.5F;
|
||||||
std::cout << "[HUD] player_hit p" << (IDX + 1) << " dmg=" << (dmg != nullptr ? *dmg : 0)
|
Log::info("HUD", "player_hit p{} dmg={} lives={}", IDX + 1, dmg != nullptr ? *dmg : 0, players_[IDX].lives);
|
||||||
<< " lives=" << players_[IDX].lives << '\n';
|
|
||||||
}));
|
}));
|
||||||
|
|
||||||
subs_.push_back(bus_.subscribe("level_complete", [](const Event& /*ev*/) {
|
subs_.push_back(bus_.subscribe("level_complete", [](const Event& /*ev*/) {
|
||||||
// TODO: capturar `this` i cridar setMode(*, Mode::Win) per als
|
// TODO: capturar `this` i cridar setMode(*, Mode::Win) per als
|
||||||
// tres blocs quan el mode Win estiga implementat.
|
// tres blocs quan el mode Win estiga implementat.
|
||||||
std::cout << "[HUD] level_complete (mode Win pendent)\n";
|
Log::info("HUD", "level_complete (mode Win pendent)");
|
||||||
}));
|
}));
|
||||||
|
|
||||||
std::cout << "[HUD] init: 3 blocks ready (entry " << ENTRY_MS << " ms)\n";
|
Log::info("HUD", "init: 3 blocks ready (entry {} ms)", ENTRY_MS);
|
||||||
}
|
}
|
||||||
|
|
||||||
Hud::~Hud() {
|
Hud::~Hud() {
|
||||||
|
|||||||
Reference in new issue
Block a user