|
From: Felix B. <fbe...@us...> - 2010-05-25 04:29:38
|
Module: performous
Branch: master
Commit: 35bbdc9316808aa84750f007b0f4fbcaafaea342
Author: Felix Bertram <fl...@be...>
Date: Mon May 24 21:28:06 2010 -0700
Added kids mode
In this mode the Easy difficulty uses kids rules.
Feature enabled by setting game/kids_mode in config file.
---
data/schema.xml | 6 ++++++
game/guitargraph.cc | 16 ++++++++++++++--
game/guitargraph.hh | 2 ++
3 files changed, 22 insertions(+), 2 deletions(-)
diff --git a/data/schema.xml b/data/schema.xml
index 1eea68e..ca2e8ce 100644
--- a/data/schema.xml
+++ b/data/schema.xml
@@ -88,6 +88,12 @@ to save the current settings to XML.
<long>Force joystick to some kind of instrument.</long>
</locale>
</entry>
+ <entry name="game/kids_mode" type="bool" value="false">
+ <locale name="C">
+ <short>Use Kids rules for Easy dificulty</short>
+ <long>Use Kids rules for Easy difficuty.</long>
+ </locale>
+ </entry>
<!-- Graphic preferences -->
<entry name="graphic/window_width" type="int" value="800" hidden="true">
diff --git a/game/guitargraph.cc b/game/guitargraph.cc
index 54f9418..7cdef5d 100644
--- a/game/guitargraph.cc
+++ b/game/guitargraph.cc
@@ -12,6 +12,7 @@
namespace {
struct Diff { std::string name; int basepitch; } diffv[] = {
+ { "Kids", 0x3C },
{ "Easy", 0x3C },
{ "Medium", 0x48 },
{ "Hard", 0x54 },
@@ -65,6 +66,7 @@ GuitarGraph::GuitarGraph(Audio& audio, Song const& song, bool drums, int number)
m_drums(drums),
m_use3d(config["graphic/3d_notes"].b()),
m_leftymode(false),
+ m_kiddymode(config["game/kids_mode"].b()),
m_level(),
m_track_index(m_instrumentTracks.end()),
m_dfIt(m_drumfills.end()),
@@ -220,7 +222,9 @@ void GuitarGraph::engine() {
if (time < m_jointime) {
if (ev.type == input::Event::PICK || ev.type == input::Event::PRESS) {
if (!m_drums && ev.pressed[4]) nextTrack();
- if (ev.pressed[0 + m_drums]) difficulty(DIFFICULTY_SUPAEASY);
+ if (ev.pressed[0 + m_drums]) {
+ if (m_kiddymode) difficulty(DIFFICULTY_KIDS);
+ else difficulty(DIFFICULTY_SUPAEASY); }
else if (ev.pressed[1 + m_drums]) difficulty(DIFFICULTY_EASY);
else if (ev.pressed[2 + m_drums]) difficulty(DIFFICULTY_MEDIUM);
else if (ev.pressed[3 + m_drums]) difficulty(DIFFICULTY_AMAZING);
@@ -431,8 +435,16 @@ void GuitarGraph::drumHit(double time, int fret) {
double tolerance = maxTolerance;
double signed_error = maxTolerance;
Chords::iterator best = m_chords.end();
+ // when we get here m_chordIt points to the last best fit chord
for (Chords::iterator it = m_chordIt; it != m_chords.end() && it->begin <= time + tolerance; ++it) {
- if (m_notes[it->dur[fret]]) continue; // Already played
+ // it->dur[fret] == NULL for a chord that doesn't include the fret played (pad hit)
+ // m_notes[it->dur[fret]] != 0 when the fret played (pad hit) was already played
+ if (m_level == DIFFICULTY_KIDS) {
+ // in kiddy mode we don't care about the correct pad
+ // all that matters is that there is still a missing note in that chord
+ if (m_chordIt->status == m_chordIt->polyphony) continue;
+ } else if (m_notes[it->dur[fret]]) continue; // invalid fret/hit or already played
+
double error = std::abs(it->begin - time);
if (error < tolerance) {
best = it;
diff --git a/game/guitargraph.hh b/game/guitargraph.hh
index 9a534c5..ccf9e9c 100644
--- a/game/guitargraph.hh
+++ b/game/guitargraph.hh
@@ -97,9 +97,11 @@ class GuitarGraph: public InstrumentGraph {
bool m_drums; /// are we using drums?
bool m_use3d; /// are we using 3d?
bool m_leftymode; /// switch guitar notes to right-to-left direction
+ bool m_kiddymode; /// super-easy mode for kids
// Track stuff
enum Difficulty {
+ DIFFICULTY_KIDS, // Kids
DIFFICULTY_SUPAEASY, // Easy
DIFFICULTY_EASY, // Medium
DIFFICULTY_MEDIUM, // Hard
|