[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???
--------------------------------------------------------------------------------
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
----------
* [OptionRowHandler] Add a new metric to ScreenOptionsMaster:
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
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
----------
File diff suppressed because it is too large Load Diff
+20 -35
View File
@@ -67,49 +67,34 @@ RString GetCustomDifficulty( StepsType st, Difficulty dc, CourseType ct )
return DifficultyToString( dc );
}
const StepsTypeInfo &sti = GAMEMAN->GetStepsTypeInfo( st );
switch( sti.m_StepsTypeCategory )
if( dc == Difficulty_Edit )
{
DEFAULT_FAIL(sti.m_StepsTypeCategory);
case StepsTypeCategory_Single:
case StepsTypeCategory_Double:
if( dc == Difficulty_Edit )
return "Edit";
}
// OPTIMIZATION OPPORTUNITY: cache these metrics and cache the splitting
vector<RString> vsNames;
split( NAMES, ",", vsNames );
FOREACH( RString, vsNames, sName )
{
ThemeMetric<StepsType> STEPS_TYPE("CustomDifficulty",(*sName)+"StepsType");
if( STEPS_TYPE == StepsType_Invalid || st == STEPS_TYPE ) // match
{
return "Edit";
}
else
{
// OPTIMIZATION OPPORTUNITY: cache these metrics and cache the splitting
vector<RString> vsNames;
split( NAMES, ",", vsNames );
FOREACH( RString, vsNames, sName )
ThemeMetric<Difficulty> DIFFICULTY("CustomDifficulty",(*sName)+"Difficulty");
if( DIFFICULTY == Difficulty_Invalid || dc == DIFFICULTY ) // match
{
ThemeMetric<StepsType> STEPS_TYPE("CustomDifficulty",(*sName)+"StepsType");
if( STEPS_TYPE == StepsType_Invalid || st == STEPS_TYPE ) // match
ThemeMetric<CourseType> COURSE_TYPE("CustomDifficulty",(*sName)+"CourseType");
if( COURSE_TYPE == CourseType_Invalid || ct == COURSE_TYPE ) // match
{
ThemeMetric<Difficulty> DIFFICULTY("CustomDifficulty",(*sName)+"Difficulty");
if( DIFFICULTY == Difficulty_Invalid || dc == DIFFICULTY ) // match
{
ThemeMetric<CourseType> COURSE_TYPE("CustomDifficulty",(*sName)+"CourseType");
if( COURSE_TYPE == CourseType_Invalid || ct == COURSE_TYPE ) // match
{
ThemeMetric<RString> STRING("CustomDifficulty",(*sName)+"String");
return STRING.GetValue();
}
}
ThemeMetric<RString> STRING("CustomDifficulty",(*sName)+"String");
return STRING.GetValue();
}
}
// no matching CustomDifficulty, so use a regular difficulty name
if( dc == Difficulty_Invalid )
return RString();
return DifficultyToString( dc );
}
case StepsTypeCategory_Couple:
return "Couple";
case StepsTypeCategory_Routine:
return "Routine";
}
// no matching CustomDifficulty, so use a regular difficulty name
if( dc == Difficulty_Invalid )
return RString();
return DifficultyToString( dc );
}
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
int iTickCount = -1;
// used to adapt weird tickcounts
float fScrollRatio = 1.0f;
//float fScrollRatio = 1.0f; -- uncomment when ready to use.
vector<RString> vNoteRows;
// 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" )
);
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(
"ScreenMiniMenuCourseDisplay",
MenuRowDef( -1, "Play mods from course", true, EditMode_Practice, true, false, 0, NULL )
@@ -879,6 +884,8 @@ void ScreenEdit::Init()
PO_GROUP_ASSIGN( m_PlayerStateEdit.m_PlayerOptions, ModsLevel_Stage, m_sNoteSkin, GAMESTATE->m_pPlayerState[PLAYER_1]->m_PlayerOptions.GetStage().m_sNoteSkin );
}
m_PlayerStateEdit.m_PlayerOptions.FromString( ModsLevel_Stage, EDIT_MODIFIERS );
this->originalPlayerOptions.FromString(ModsLevel_Stage, EDIT_MODIFIERS);
m_pSteps->GetNoteData( m_NoteDataEdit );
m_NoteFieldEdit.SetXY( EDIT_X, EDIT_Y );
@@ -1973,6 +1980,7 @@ void ScreenEdit::InputEdit( const InputEventPlus &input, EditButton EditB )
else
{
GAMESTATE->m_pCurSong->m_Attacks.UpdateStartTimes(fDelta);
GAMESTATE->m_pCurSong->m_fMusicSampleStartSeconds += fDelta;
}
SetDirty( true );
}
@@ -2168,20 +2176,20 @@ void ScreenEdit::InputEdit( const InputEventPlus &input, EditButton EditB )
{
const RString sDuration = ssprintf( "%.6f", attacks[index].fSecsRemaining );
g_InsertCourseAttack.rows[remove].bEnabled = true;
if( g_InsertCourseAttack.rows[duration].choices.size() == 9 )
g_InsertCourseAttack.rows[duration].choices.push_back( sDuration );
g_InsertStepAttack.rows[sa_remove].bEnabled = true;
if( g_InsertStepAttack.rows[sa_duration].choices.size() == 9 )
g_InsertStepAttack.rows[sa_duration].choices.push_back( sDuration );
else
g_InsertCourseAttack.rows[duration].choices.back() = sDuration;
g_InsertCourseAttack.rows[duration].iDefaultChoice = 9;
g_InsertStepAttack.rows[sa_duration].choices.back() = sDuration;
g_InsertStepAttack.rows[sa_duration].iDefaultChoice = 9;
}
else
{
if( g_InsertCourseAttack.rows[duration].choices.size() == 10 )
g_InsertCourseAttack.rows[duration].choices.pop_back();
g_InsertCourseAttack.rows[duration].iDefaultChoice = 3;
if( g_InsertStepAttack.rows[sa_duration].choices.size() == 10 )
g_InsertStepAttack.rows[sa_duration].choices.pop_back();
g_InsertStepAttack.rows[sa_duration].iDefaultChoice = 3;
}
EditMiniMenu( &g_InsertCourseAttack, SM_BackFromInsertStepAttack );
EditMiniMenu( &g_InsertStepAttack, SM_BackFromInsertStepAttack );
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_fLastInsertAttackDurationSeconds = end - start;
GAMESTATE->m_pPlayerState[PLAYER_1]->m_PlayerOptions.Assign( ModsLevel_Stage, po );
toEdit.Assign( ModsLevel_Stage, po );
SCREENMAN->AddNewScreenToTop( "ScreenPlayerOptions", SM_BackFromInsertStepAttackPlayerOptions );
break;
}
@@ -2603,6 +2613,10 @@ void ScreenEdit::InputPlay( const InputEventPlus &input, EditButton EditB )
}
GetAppropriateTiming().m_fBeat0OffsetInSeconds += fOffsetDelta;
if (!GAMESTATE->m_bIsUsingStepTiming)
{
GAMESTATE->m_pCurSong->m_fMusicSampleStartSeconds += fOffsetDelta;
}
}
break;
}
@@ -3156,7 +3170,7 @@ void ScreenEdit::HandleScreenMessage( const ScreenMessage SM )
int iDurationChoice = ScreenMiniMenu::s_viLastAnswers[0];
TimingData &timing = GetAppropriateTiming();
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;
int iAttack = FindAttackAtTime(attacks, g_fLastInsertAttackPositionSeconds);
@@ -3167,11 +3181,13 @@ void ScreenEdit::HandleScreenMessage( const ScreenMessage SM )
}
else
{
ModsGroup<PlayerOptions> &toEdit = GAMESTATE->m_pPlayerState[PLAYER_1]->m_PlayerOptions;
this->originalPlayerOptions.Assign(ModsLevel_Preferred, toEdit.GetPreferred());
PlayerOptions po;
if (iAttack >= 0)
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 );
}
}
@@ -3206,7 +3222,8 @@ void ScreenEdit::HandleScreenMessage( const ScreenMessage SM )
}
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();
if (g_fLastInsertAttackPositionSeconds >= 0)
@@ -3224,6 +3241,7 @@ void ScreenEdit::HandleScreenMessage( const ScreenMessage SM )
else
attacks.push_back(a);
}
toRestore.Assign(ModsLevel_Preferred, this->originalPlayerOptions.GetPreferred());
}
else if( SM == SM_BackFromInsertCourseAttackPlayerOptions )
{
@@ -3490,6 +3508,7 @@ static void ChangeBeat0Offset( const RString &sNew )
else
{
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;
int iAttack = FindAttackAtTime(attacks, start);
ModsGroup<PlayerOptions> &toEdit = GAMESTATE->m_pPlayerState[PLAYER_1]->m_PlayerOptions;
this->originalPlayerOptions.Assign(ModsLevel_Preferred, toEdit.GetPreferred());
PlayerOptions po;
if (iAttack >= 0)
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 );
SetDirty(true);
break;
+12 -1
View File
@@ -266,6 +266,9 @@ protected:
BitmapText m_textInputTips;
/** @brief The player options before messing with attacks. */
ModsGroup<PlayerOptions> originalPlayerOptions;
/**
* @brief Keep a backup of the present Step TimingData when
* entering a playing or recording state.
@@ -507,11 +510,11 @@ public:
{
difficulty, /**< What is the difficulty 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? */
description, /**< What is the description of this chart? */
chartstyle, /**< How is this chart meant to be played? */
step_credit, /**< Who wrote this individual chart? */
predict_meter, /**< What does the game think this chart's rating should be? */
step_display_bpm,
step_min_bpm,
step_max_bpm,
@@ -634,6 +637,14 @@ public:
remove,
NUM_CourseAttackChoice
};
enum StepAttackChoice
{
sa_duration,
sa_set_mods,
sa_remove,
NUM_StepAttackChoice
};
void InitEditMappings();
EditButton DeviceToEdit( const DeviceInput &DeviceI ) const;
+1 -1
View File
@@ -41,7 +41,7 @@
* @brief The internal version of the cache for StepMania.
*
* 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? */
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 )
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
{
NoteDataUtil::CalculateRadarValues( tempNoteData, fMusicLengthSeconds, m_CachedRadarValues[0] );