[default -> loading window] All these merges could be avoided if someone could say that this code works fine.

This commit is contained in:
Henrik Andersson
2011-07-13 16:13:04 +02:00
8 changed files with 618 additions and 133 deletions
+9
View File
@@ -8,12 +8,21 @@ ________________________________________________________________________________
StepMania 5.0 ????????? | 20110??? StepMania 5.0 ????????? | 20110???
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
2011/07/13
----------
* [Difficulty] Allow ALL StepsTypes to use CustomDifficulty properly.
There was some unfair targeting of Couple and Routine. [Wolfman2000]
* [Steps] Calculate accurate radar values for Couple charts. [Wolfman2000]
2011/07/12 2011/07/12
---------- ----------
* [OptionRowHandler] Add a new metric to ScreenOptionsMaster: * [OptionRowHandler] Add a new metric to ScreenOptionsMaster:
StepsUseChartName. Use this if you want your charts to have a unique name StepsUseChartName. Use this if you want your charts to have a unique name
in the options menu. If there is no #CHARTNAME or it is "Blank", it reverts in the options menu. If there is no #CHARTNAME or it is "Blank", it reverts
to the original behavior. This metric is false by default. [Wolfman2000] to the original behavior. This metric is false by default. [Wolfman2000]
* [ScreenEdit] Fixed a bug involving #ATTACKS. Now when you set an attack,
the mods are reverted back to how they were prior to the attack being set.
[Wolfman2000]
2011/07/09 2011/07/09
---------- ----------
File diff suppressed because it is too large Load Diff
-15
View File
@@ -67,19 +67,10 @@ RString GetCustomDifficulty( StepsType st, Difficulty dc, CourseType ct )
return DifficultyToString( dc ); return DifficultyToString( dc );
} }
const StepsTypeInfo &sti = GAMEMAN->GetStepsTypeInfo( st );
switch( sti.m_StepsTypeCategory )
{
DEFAULT_FAIL(sti.m_StepsTypeCategory);
case StepsTypeCategory_Single:
case StepsTypeCategory_Double:
if( dc == Difficulty_Edit ) if( dc == Difficulty_Edit )
{ {
return "Edit"; return "Edit";
} }
else
{
// OPTIMIZATION OPPORTUNITY: cache these metrics and cache the splitting // OPTIMIZATION OPPORTUNITY: cache these metrics and cache the splitting
vector<RString> vsNames; vector<RString> vsNames;
split( NAMES, ",", vsNames ); split( NAMES, ",", vsNames );
@@ -104,12 +95,6 @@ RString GetCustomDifficulty( StepsType st, Difficulty dc, CourseType ct )
if( dc == Difficulty_Invalid ) if( dc == Difficulty_Invalid )
return RString(); return RString();
return DifficultyToString( dc ); return DifficultyToString( dc );
}
case StepsTypeCategory_Couple:
return "Couple";
case StepsTypeCategory_Routine:
return "Routine";
}
} }
LuaFunction( GetCustomDifficulty, GetCustomDifficulty(Enum::Check<StepsType>(L,1), Enum::Check<Difficulty>(L, 2), Enum::Check<CourseType>(L, 3, true)) ); LuaFunction( GetCustomDifficulty, GetCustomDifficulty(Enum::Check<StepsType>(L,1), Enum::Check<Difficulty>(L, 2), Enum::Check<CourseType>(L, 3, true)) );
+1 -1
View File
@@ -34,7 +34,7 @@ static bool LoadFromKSFFile( const RString &sPath, Steps &out, const Song &song,
// this is the value we read for TICKCOUNT // this is the value we read for TICKCOUNT
int iTickCount = -1; int iTickCount = -1;
// used to adapt weird tickcounts // used to adapt weird tickcounts
float fScrollRatio = 1.0f; //float fScrollRatio = 1.0f; -- uncomment when ready to use.
vector<RString> vNoteRows; vector<RString> vNoteRows;
// According to Aldo_MX, there is a default BPM and it's 60. -aj // According to Aldo_MX, there is a default BPM and it's 60. -aj
+35 -14
View File
@@ -757,6 +757,11 @@ static MenuDef g_InsertCourseAttack(
MenuRowDef( ScreenEdit::remove, "Remove", true, EditMode_Practice, true, true, 0, "Press Start" ) MenuRowDef( ScreenEdit::remove, "Remove", true, EditMode_Practice, true, true, 0, "Press Start" )
); );
static MenuDef g_InsertStepAttack("ScreenMiniMenuInsertCourseAttack",
MenuRowDef( ScreenEdit::sa_duration, "Duration seconds", true, EditMode_Practice, true, false, 3, "5","10","15","20","25","30","35","40","45" ),
MenuRowDef( ScreenEdit::sa_set_mods, "Set modifiers", true, EditMode_Practice, true, true, 0, "Press Start" ),
MenuRowDef( ScreenEdit::sa_remove, "Remove", true, EditMode_Practice, true, true, 0, "Press Start" ));
static MenuDef g_CourseMode( static MenuDef g_CourseMode(
"ScreenMiniMenuCourseDisplay", "ScreenMiniMenuCourseDisplay",
MenuRowDef( -1, "Play mods from course", true, EditMode_Practice, true, false, 0, NULL ) MenuRowDef( -1, "Play mods from course", true, EditMode_Practice, true, false, 0, NULL )
@@ -880,6 +885,8 @@ void ScreenEdit::Init()
} }
m_PlayerStateEdit.m_PlayerOptions.FromString( ModsLevel_Stage, EDIT_MODIFIERS ); m_PlayerStateEdit.m_PlayerOptions.FromString( ModsLevel_Stage, EDIT_MODIFIERS );
this->originalPlayerOptions.FromString(ModsLevel_Stage, EDIT_MODIFIERS);
m_pSteps->GetNoteData( m_NoteDataEdit ); m_pSteps->GetNoteData( m_NoteDataEdit );
m_NoteFieldEdit.SetXY( EDIT_X, EDIT_Y ); m_NoteFieldEdit.SetXY( EDIT_X, EDIT_Y );
m_NoteFieldEdit.SetZoom( 0.5f ); m_NoteFieldEdit.SetZoom( 0.5f );
@@ -1973,6 +1980,7 @@ void ScreenEdit::InputEdit( const InputEventPlus &input, EditButton EditB )
else else
{ {
GAMESTATE->m_pCurSong->m_Attacks.UpdateStartTimes(fDelta); GAMESTATE->m_pCurSong->m_Attacks.UpdateStartTimes(fDelta);
GAMESTATE->m_pCurSong->m_fMusicSampleStartSeconds += fDelta;
} }
SetDirty( true ); SetDirty( true );
} }
@@ -2168,20 +2176,20 @@ void ScreenEdit::InputEdit( const InputEventPlus &input, EditButton EditB )
{ {
const RString sDuration = ssprintf( "%.6f", attacks[index].fSecsRemaining ); const RString sDuration = ssprintf( "%.6f", attacks[index].fSecsRemaining );
g_InsertCourseAttack.rows[remove].bEnabled = true; g_InsertStepAttack.rows[sa_remove].bEnabled = true;
if( g_InsertCourseAttack.rows[duration].choices.size() == 9 ) if( g_InsertStepAttack.rows[sa_duration].choices.size() == 9 )
g_InsertCourseAttack.rows[duration].choices.push_back( sDuration ); g_InsertStepAttack.rows[sa_duration].choices.push_back( sDuration );
else else
g_InsertCourseAttack.rows[duration].choices.back() = sDuration; g_InsertStepAttack.rows[sa_duration].choices.back() = sDuration;
g_InsertCourseAttack.rows[duration].iDefaultChoice = 9; g_InsertStepAttack.rows[sa_duration].iDefaultChoice = 9;
} }
else else
{ {
if( g_InsertCourseAttack.rows[duration].choices.size() == 10 ) if( g_InsertStepAttack.rows[sa_duration].choices.size() == 10 )
g_InsertCourseAttack.rows[duration].choices.pop_back(); g_InsertStepAttack.rows[sa_duration].choices.pop_back();
g_InsertCourseAttack.rows[duration].iDefaultChoice = 3; g_InsertStepAttack.rows[sa_duration].iDefaultChoice = 3;
} }
EditMiniMenu( &g_InsertCourseAttack, SM_BackFromInsertStepAttack ); EditMiniMenu( &g_InsertStepAttack, SM_BackFromInsertStepAttack );
break; break;
} }
@@ -2248,9 +2256,11 @@ void ScreenEdit::InputEdit( const InputEventPlus &input, EditButton EditB )
} }
} }
ModsGroup<PlayerOptions> &toEdit = GAMESTATE->m_pPlayerState[PLAYER_1]->m_PlayerOptions;
this->originalPlayerOptions.Assign(ModsLevel_Preferred, toEdit.GetPreferred());
g_fLastInsertAttackPositionSeconds = start; g_fLastInsertAttackPositionSeconds = start;
g_fLastInsertAttackDurationSeconds = end - start; g_fLastInsertAttackDurationSeconds = end - start;
GAMESTATE->m_pPlayerState[PLAYER_1]->m_PlayerOptions.Assign( ModsLevel_Stage, po ); toEdit.Assign( ModsLevel_Stage, po );
SCREENMAN->AddNewScreenToTop( "ScreenPlayerOptions", SM_BackFromInsertStepAttackPlayerOptions ); SCREENMAN->AddNewScreenToTop( "ScreenPlayerOptions", SM_BackFromInsertStepAttackPlayerOptions );
break; break;
} }
@@ -2603,6 +2613,10 @@ void ScreenEdit::InputPlay( const InputEventPlus &input, EditButton EditB )
} }
GetAppropriateTiming().m_fBeat0OffsetInSeconds += fOffsetDelta; GetAppropriateTiming().m_fBeat0OffsetInSeconds += fOffsetDelta;
if (!GAMESTATE->m_bIsUsingStepTiming)
{
GAMESTATE->m_pCurSong->m_fMusicSampleStartSeconds += fOffsetDelta;
}
} }
break; break;
} }
@@ -3156,7 +3170,7 @@ void ScreenEdit::HandleScreenMessage( const ScreenMessage SM )
int iDurationChoice = ScreenMiniMenu::s_viLastAnswers[0]; int iDurationChoice = ScreenMiniMenu::s_viLastAnswers[0];
TimingData &timing = GetAppropriateTiming(); TimingData &timing = GetAppropriateTiming();
g_fLastInsertAttackPositionSeconds = timing.GetElapsedTimeFromBeat( GetBeat() ); g_fLastInsertAttackPositionSeconds = timing.GetElapsedTimeFromBeat( GetBeat() );
g_fLastInsertAttackDurationSeconds = StringToFloat( g_InsertCourseAttack.rows[0].choices[iDurationChoice] ); g_fLastInsertAttackDurationSeconds = StringToFloat( g_InsertStepAttack.rows[0].choices[iDurationChoice] );
AttackArray &attacks = GAMESTATE->m_bIsUsingStepTiming ? m_pSteps->m_Attacks : m_pSong->m_Attacks; AttackArray &attacks = GAMESTATE->m_bIsUsingStepTiming ? m_pSteps->m_Attacks : m_pSong->m_Attacks;
int iAttack = FindAttackAtTime(attacks, g_fLastInsertAttackPositionSeconds); int iAttack = FindAttackAtTime(attacks, g_fLastInsertAttackPositionSeconds);
@@ -3167,11 +3181,13 @@ void ScreenEdit::HandleScreenMessage( const ScreenMessage SM )
} }
else else
{ {
ModsGroup<PlayerOptions> &toEdit = GAMESTATE->m_pPlayerState[PLAYER_1]->m_PlayerOptions;
this->originalPlayerOptions.Assign(ModsLevel_Preferred, toEdit.GetPreferred());
PlayerOptions po; PlayerOptions po;
if (iAttack >= 0) if (iAttack >= 0)
po.FromString(attacks[iAttack].sModifiers); po.FromString(attacks[iAttack].sModifiers);
GAMESTATE->m_pPlayerState[PLAYER_1]->m_PlayerOptions.Assign( ModsLevel_Preferred, po ); toEdit.Assign( ModsLevel_Preferred, po );
SCREENMAN->AddNewScreenToTop( "ScreenPlayerOptions", SM_BackFromInsertStepAttackPlayerOptions ); SCREENMAN->AddNewScreenToTop( "ScreenPlayerOptions", SM_BackFromInsertStepAttackPlayerOptions );
} }
} }
@@ -3206,7 +3222,8 @@ void ScreenEdit::HandleScreenMessage( const ScreenMessage SM )
} }
else if (SM == SM_BackFromInsertStepAttackPlayerOptions) else if (SM == SM_BackFromInsertStepAttackPlayerOptions)
{ {
PlayerOptions poChosen = GAMESTATE->m_pPlayerState[PLAYER_1]->m_PlayerOptions.GetPreferred(); ModsGroup<PlayerOptions> &toRestore = GAMESTATE->m_pPlayerState[PLAYER_1]->m_PlayerOptions;
PlayerOptions poChosen = toRestore.GetPreferred();
RString mods = poChosen.GetString(); RString mods = poChosen.GetString();
if (g_fLastInsertAttackPositionSeconds >= 0) if (g_fLastInsertAttackPositionSeconds >= 0)
@@ -3224,6 +3241,7 @@ void ScreenEdit::HandleScreenMessage( const ScreenMessage SM )
else else
attacks.push_back(a); attacks.push_back(a);
} }
toRestore.Assign(ModsLevel_Preferred, this->originalPlayerOptions.GetPreferred());
} }
else if( SM == SM_BackFromInsertCourseAttackPlayerOptions ) else if( SM == SM_BackFromInsertCourseAttackPlayerOptions )
{ {
@@ -3490,6 +3508,7 @@ static void ChangeBeat0Offset( const RString &sNew )
else else
{ {
GAMESTATE->m_pCurSong->m_Attacks.UpdateStartTimes(delta); GAMESTATE->m_pCurSong->m_Attacks.UpdateStartTimes(delta);
GAMESTATE->m_pCurSong->m_fMusicSampleStartSeconds += delta;
} }
} }
@@ -4134,11 +4153,13 @@ void ScreenEdit::HandleAlterMenuChoice(AlterMenuChoice c, const vector<int> &iAn
m_pSteps->m_Attacks : m_pSong->m_Attacks; m_pSteps->m_Attacks : m_pSong->m_Attacks;
int iAttack = FindAttackAtTime(attacks, start); int iAttack = FindAttackAtTime(attacks, start);
ModsGroup<PlayerOptions> &toEdit = GAMESTATE->m_pPlayerState[PLAYER_1]->m_PlayerOptions;
this->originalPlayerOptions.Assign(ModsLevel_Preferred, toEdit.GetPreferred());
PlayerOptions po; PlayerOptions po;
if (iAttack >= 0) if (iAttack >= 0)
po.FromString(attacks[iAttack].sModifiers); po.FromString(attacks[iAttack].sModifiers);
GAMESTATE->m_pPlayerState[PLAYER_1]->m_PlayerOptions.Assign( ModsLevel_Preferred, po ); toEdit.Assign( ModsLevel_Preferred, po );
SCREENMAN->AddNewScreenToTop( "ScreenPlayerOptions", SM_BackFromInsertStepAttackPlayerOptions ); SCREENMAN->AddNewScreenToTop( "ScreenPlayerOptions", SM_BackFromInsertStepAttackPlayerOptions );
SetDirty(true); SetDirty(true);
break; break;
+12 -1
View File
@@ -266,6 +266,9 @@ protected:
BitmapText m_textInputTips; BitmapText m_textInputTips;
/** @brief The player options before messing with attacks. */
ModsGroup<PlayerOptions> originalPlayerOptions;
/** /**
* @brief Keep a backup of the present Step TimingData when * @brief Keep a backup of the present Step TimingData when
* entering a playing or recording state. * entering a playing or recording state.
@@ -507,11 +510,11 @@ public:
{ {
difficulty, /**< What is the difficulty of this chart? */ difficulty, /**< What is the difficulty of this chart? */
meter, /**< What is the numerical rating of this chart? */ meter, /**< What is the numerical rating of this chart? */
predict_meter, /**< What does the game think this chart's rating should be? */
chartname, /**< What is the name of this chart? */ chartname, /**< What is the name of this chart? */
description, /**< What is the description of this chart? */ description, /**< What is the description of this chart? */
chartstyle, /**< How is this chart meant to be played? */ chartstyle, /**< How is this chart meant to be played? */
step_credit, /**< Who wrote this individual chart? */ step_credit, /**< Who wrote this individual chart? */
predict_meter, /**< What does the game think this chart's rating should be? */
step_display_bpm, step_display_bpm,
step_min_bpm, step_min_bpm,
step_max_bpm, step_max_bpm,
@@ -635,6 +638,14 @@ public:
NUM_CourseAttackChoice NUM_CourseAttackChoice
}; };
enum StepAttackChoice
{
sa_duration,
sa_set_mods,
sa_remove,
NUM_StepAttackChoice
};
void InitEditMappings(); void InitEditMappings();
EditButton DeviceToEdit( const DeviceInput &DeviceI ) const; EditButton DeviceToEdit( const DeviceInput &DeviceI ) const;
EditButton MenuButtonToEditButton( GameButton MenuI ) const; EditButton MenuButtonToEditButton( GameButton MenuI ) const;
+1 -1
View File
@@ -41,7 +41,7 @@
* @brief The internal version of the cache for StepMania. * @brief The internal version of the cache for StepMania.
* *
* Increment this value to invalidate the current cache. */ * Increment this value to invalidate the current cache. */
const int FILE_CACHE_VERSION = 190; const int FILE_CACHE_VERSION = 191;
/** @brief How long does a song sample last by default? */ /** @brief How long does a song sample last by default? */
const float DEFAULT_MUSIC_SAMPLE_LENGTH = 12.f; const float DEFAULT_MUSIC_SAMPLE_LENGTH = 12.f;
+16
View File
@@ -225,6 +225,22 @@ void Steps::CalculateRadarValues( float fMusicLengthSeconds )
for( size_t pn = 0; pn < min(vParts.size(), size_t(NUM_PLAYERS)); ++pn ) for( size_t pn = 0; pn < min(vParts.size(), size_t(NUM_PLAYERS)); ++pn )
NoteDataUtil::CalculateRadarValues( vParts[pn], fMusicLengthSeconds, m_CachedRadarValues[pn] ); NoteDataUtil::CalculateRadarValues( vParts[pn], fMusicLengthSeconds, m_CachedRadarValues[pn] );
} }
else if (GAMEMAN->GetStepsTypeInfo(this->m_StepsType).m_StepsTypeCategory == StepsTypeCategory_Couple)
{
NoteData p1 = tempNoteData;
// XXX: Assumption that couple will always have an even number of notes.
const int tracks = tempNoteData.GetNumTracks() / 2;
p1.SetNumTracks(tracks);
NoteDataUtil::CalculateRadarValues(p1,
fMusicLengthSeconds,
m_CachedRadarValues[PLAYER_1]);
// at this point, p2 is tempNoteData.
NoteDataUtil::ShiftTracks(tempNoteData, tracks);
tempNoteData.SetNumTracks(tracks);
NoteDataUtil::CalculateRadarValues(tempNoteData,
fMusicLengthSeconds,
m_CachedRadarValues[PLAYER_2]);
}
else else
{ {
NoteDataUtil::CalculateRadarValues( tempNoteData, fMusicLengthSeconds, m_CachedRadarValues[0] ); NoteDataUtil::CalculateRadarValues( tempNoteData, fMusicLengthSeconds, m_CachedRadarValues[0] );