|
From: Tapio V. <aa...@us...> - 2010-01-07 16:33:42
|
Module: performous
Branch: master
Commit: 023d80772898f6dc0857756cc3bf8b8f6d329934
Author: Tapio Vierros <tap...@gm...>
Date: Thu Jan 7 18:31:53 2010 +0200
Allow instrumental break skipping and early score dialog in FoF songs.
(Only when instruments are dead.)
---
game/guitargraph.cc | 5 ++++-
game/joystick.hh | 1 +
game/screen_sing.cc | 12 +++++++-----
game/screen_sing.hh | 3 ++-
4 files changed, 14 insertions(+), 7 deletions(-)
diff --git a/game/guitargraph.cc b/game/guitargraph.cc
index 52e196c..a13681d 100644
--- a/game/guitargraph.cc
+++ b/game/guitargraph.cc
@@ -17,7 +17,7 @@ namespace {
{ "Expert", 0x60 }
};
const size_t diffsz = sizeof(diffv) / sizeof(*diffv);
- const int death_delay = 25; // Delay in notes after which the player is hidden
+ const int death_delay = 20; // Delay in notes after which the player is hidden
const float not_joined = -100; // A value that indicates player hasn't joined
const float join_delay = 6.0f; // Time to select track/difficulty when joining mid-game
const float g_angle = 80.0f;
@@ -154,6 +154,9 @@ void GuitarGraph::engine() {
double whammy = 0;
// Handle all events
for (input::Event ev; m_input.tryPoll(ev);) {
+ // This hack disallows joining with Enter-key for skipping instrumental
+ // breaks to be usable with FoF songs.
+ if (dead() && m_input.isKeyboard() && ev.type == input::Event::PICK) continue;
m_dead = 0; // Keep alive
if (m_jointime == not_joined) m_jointime = (time < 0.0 ? -join_delay : time); // Handle joining
// Handle Start/Select keypresses
diff --git a/game/joystick.hh b/game/joystick.hh
index 5b8aa43..e178a74 100644
--- a/game/joystick.hh
+++ b/game/joystick.hh
@@ -147,6 +147,7 @@ namespace input {
bool tryPoll(Event& _e) {return input::Private::devices.find(m_device_id)->second.tryPoll(_e);};
void addEvent(Event _e) {input::Private::devices.find(m_device_id)->second.addEvent(_e);};
bool pressed(int _button) {return input::Private::devices.find(m_device_id)->second.pressed(_button);}; // Current state
+ bool isKeyboard() {return (m_device_id == input::Private::KEYBOARD_ID || m_device_id == input::Private::KEYBOARD_ID2 || m_device_id == input::Private::KEYBOARD_ID3);};
private:
unsigned int m_device_id; // should be some kind of reference
};
diff --git a/game/screen_sing.cc b/game/screen_sing.cc
index dbc5519..606658d 100644
--- a/game/screen_sing.cc
+++ b/game/screen_sing.cc
@@ -227,13 +227,13 @@ void ScreenSing::manageEvent(SDL_Event event) {
return; // The rest are only available when score window is not displayed
}
// Start button has special functions for skipping things (only in singing for now)
- if (nav == input::START && m_song->track_map.empty() && !m_audio.isPaused()) {
+ if (nav == input::START && m_only_singers_alive && !m_song->notes.empty() && !m_audio.isPaused()) {
// Open score dialog early
if (status == Song::FINISHED) {
m_engine->kill(); // kill the engine thread
m_score_window.reset(new ScoreWindow(m_instruments, m_database, m_dancers)); // Song finished, but no score window -> show it
}
- // Skip instrumental breaks (not supported with instruments yet)
+ // Skip instrumental breaks
else if (status == Song::INSTRUMENTAL_BREAK) {
double diff = m_layout_singer->lyrics_begin() - 3.0 - time;
if (diff > 0.0) m_audio.seek(diff);
@@ -315,11 +315,13 @@ void ScreenSing::draw() {
if( !m_dancers.empty() ) {
danceLayout(time);
//m_layout_singer->draw(time, LayoutSinger::LEFT);
+ m_only_singers_alive = false;
} else if( m_instruments.empty() ) {
m_layout_singer->draw(time, LayoutSinger::BOTTOM);
+ m_only_singers_alive = true;
} else {
- bool some_alive = instrumentLayout(time);;
- m_layout_singer->draw(time, some_alive ? LayoutSinger::MIDDLE : LayoutSinger::BOTTOM);
+ m_only_singers_alive = !instrumentLayout(time);;
+ m_layout_singer->draw(time, m_only_singers_alive ? LayoutSinger::BOTTOM : LayoutSinger::MIDDLE);
}
Song::Status status = m_song->status(time);
@@ -329,7 +331,7 @@ void ScreenSing::draw() {
unsigned t = clamp(time, 0.0, length);
m_progress->draw(songPercent);
std::string statustxt = (boost::format("%02u:%02u") % (t / 60) % (t % 60)).str();
- if (!m_score_window.get() && m_song->track_map.empty() && m_song->danceTracks.empty()) {
+ if (!m_score_window.get() && m_only_singers_alive && !m_song->notes.empty()) {
if (status == Song::INSTRUMENTAL_BREAK) statustxt += " ENTER to skip instrumental break";
if (status == Song::FINISHED && !config["game/karaoke_mode"].b()) statustxt += " Remember to wait for grading!";
}
diff --git a/game/screen_sing.hh b/game/screen_sing.hh
index de37b5c..c8518d2 100644
--- a/game/screen_sing.hh
+++ b/game/screen_sing.hh
@@ -50,7 +50,7 @@ class ScreenSing: public Screen {
public:
/// constructor
ScreenSing(std::string const& name, Audio& audio, Capture& capture, Database& database, Backgrounds& bgs):
- Screen(name), m_audio(audio), m_capture(capture), m_database(database), m_backgrounds(bgs), m_latencyAV()
+ Screen(name), m_audio(audio), m_capture(capture), m_database(database), m_backgrounds(bgs), m_latencyAV(), m_only_singers_alive(true)
{}
void enter();
void exit();
@@ -92,5 +92,6 @@ class ScreenSing: public Screen {
double m_latencyAV; // Latency between audio and video output (do not confuse with latencyAR)
boost::shared_ptr<ThemeSing> theme;
AnimValue m_quitTimer;
+ bool m_only_singers_alive;
};
|