diff --git a/src/Difficulty.cpp b/src/Difficulty.cpp index 9e64fe665b..e37c5a4745 100644 --- a/src/Difficulty.cpp +++ b/src/Difficulty.cpp @@ -21,35 +21,6 @@ XToString( Difficulty ); StringToX( Difficulty ); LuaXType( Difficulty ); -/* We prefer the above names; recognize a number of others, too. (They'll get - * normalized when written to SMs, etc.) TODO: Format specific hacks should be - * moved into the file loader for that format. We don't want to carry these - * hacks forward to file formats that don't need them. */ -Difficulty DwiCompatibleStringToDifficulty( const RString& sDC ) -{ - RString s2 = sDC; - s2.MakeLower(); - if( s2 == "beginner" ) return Difficulty_Beginner; - else if( s2 == "easy" ) return Difficulty_Easy; - else if( s2 == "basic" ) return Difficulty_Easy; - else if( s2 == "light" ) return Difficulty_Easy; - else if( s2 == "medium" ) return Difficulty_Medium; - else if( s2 == "another" ) return Difficulty_Medium; - else if( s2 == "trick" ) return Difficulty_Medium; - else if( s2 == "standard" ) return Difficulty_Medium; - else if( s2 == "difficult") return Difficulty_Medium; - else if( s2 == "hard" ) return Difficulty_Hard; - else if( s2 == "ssr" ) return Difficulty_Hard; - else if( s2 == "maniac" ) return Difficulty_Hard; - else if( s2 == "heavy" ) return Difficulty_Hard; - else if( s2 == "smaniac" ) return Difficulty_Challenge; - else if( s2 == "challenge" ) return Difficulty_Challenge; - else if( s2 == "expert" ) return Difficulty_Challenge; - else if( s2 == "oni" ) return Difficulty_Challenge; - else if( s2 == "edit" ) return Difficulty_Edit; - else return Difficulty_Invalid; -} - const RString &CourseDifficultyToLocalizedString( CourseDifficulty x ) { static auto_ptr g_CourseDifficultyName[NUM_Difficulty]; diff --git a/src/Difficulty.h b/src/Difficulty.h index 48b97a6006..3c7896efd3 100644 --- a/src/Difficulty.h +++ b/src/Difficulty.h @@ -22,8 +22,6 @@ const RString& DifficultyToString( Difficulty dc ); Difficulty StringToDifficulty( const RString& sDC ); LuaDeclareType( Difficulty ); -Difficulty DwiCompatibleStringToDifficulty( const RString& sDC ); - typedef Difficulty CourseDifficulty; const int NUM_CourseDifficulty = NUM_Difficulty; /** @brief Loop through the shown course difficulties. */ diff --git a/src/ModIconRow.cpp b/src/ModIconRow.cpp index aae4517466..362c5a8e4d 100644 --- a/src/ModIconRow.cpp +++ b/src/ModIconRow.cpp @@ -66,10 +66,35 @@ void ModIconRow::HandleMessage( const Message &msg ) struct OptionColumnEntry { - char szString[30]; + char *szString; int iSlotIndex; + + //void FromStack( lua_State *L, int iPos ); }; +/* +void OptionColumnEntry::FromStack( lua_State *L, int iPos ) +{ + if( lua_type(L, iPos) != LUA_TTABLE ) + return; + + lua_pushvalue( L, iPos ); + const int iTab = lua_gettop( L ); + + // option name + lua_getfield( L, iTab, "Name" ); + RString sName = lua_tostring( L, -1 ); + szString = const_cast(sName.c_str()); + lua_settop( L, iTab ); + + // option icon index + lua_getfield( L, iTab, "IconIndex" ); + iSlotIndex = lua_tointeger( L, -1 ); + lua_settop( L, iTab ); +} +static vector g_OptionColumnEntries; +*/ + // todo: metric these? -aj static const OptionColumnEntry g_OptionColumnEntries[] = { diff --git a/src/NotesLoaderDWI.cpp b/src/NotesLoaderDWI.cpp index 10f9c69f55..bd4e2314fe 100644 --- a/src/NotesLoaderDWI.cpp +++ b/src/NotesLoaderDWI.cpp @@ -10,6 +10,7 @@ #include "GameInput.h" #include "NotesLoader.h" #include "PrefsManager.h" +#include "Difficulty.h" #include @@ -140,6 +141,33 @@ static bool Is192( const RString &sStepData, size_t pos ) /** @brief All DWI files use 4 beats per measure. */ const int BEATS_PER_MEASURE = 4; +/* We prefer the normal names; recognize a number of others, too. (They'll get + * normalized when written to SMs, etc.) */ +Difficulty DwiCompatibleStringToDifficulty( const RString& sDC ) +{ + RString s2 = sDC; + s2.MakeLower(); + if( s2 == "beginner" ) return Difficulty_Beginner; + else if( s2 == "easy" ) return Difficulty_Easy; + else if( s2 == "basic" ) return Difficulty_Easy; + else if( s2 == "light" ) return Difficulty_Easy; + else if( s2 == "medium" ) return Difficulty_Medium; + else if( s2 == "another" ) return Difficulty_Medium; + else if( s2 == "trick" ) return Difficulty_Medium; + else if( s2 == "standard" ) return Difficulty_Medium; + else if( s2 == "difficult") return Difficulty_Medium; + else if( s2 == "hard" ) return Difficulty_Hard; + else if( s2 == "ssr" ) return Difficulty_Hard; + else if( s2 == "maniac" ) return Difficulty_Hard; + else if( s2 == "heavy" ) return Difficulty_Hard; + else if( s2 == "smaniac" ) return Difficulty_Challenge; + else if( s2 == "challenge" ) return Difficulty_Challenge; + else if( s2 == "expert" ) return Difficulty_Challenge; + else if( s2 == "oni" ) return Difficulty_Challenge; + else if( s2 == "edit" ) return Difficulty_Edit; + else return Difficulty_Invalid; +} + /** * @brief Look through the notes tag to extract the data. * @param sMode the steps type. diff --git a/src/NotesLoaderSM.cpp b/src/NotesLoaderSM.cpp index 360ceaf111..cd1fc8d52e 100644 --- a/src/NotesLoaderSM.cpp +++ b/src/NotesLoaderSM.cpp @@ -40,7 +40,7 @@ void SMLoader::LoadFromSMTokens( out.m_StepsType = GAMEMAN->StringToStepsType( sStepsType ); out.SetDescription( sDescription ); out.SetCredit( sDescription ); // this is often used for both. - out.SetDifficulty( DwiCompatibleStringToDifficulty(sDifficulty) ); + out.SetDifficulty( StringToDifficulty(sDifficulty) ); // Handle hacks that originated back when StepMania didn't have // Difficulty_Challenge. (At least v1.64, possibly v3.0 final...) diff --git a/src/NotesLoaderSMA.cpp b/src/NotesLoaderSMA.cpp index 5f4d2faea4..16cbeaa1fe 100644 --- a/src/NotesLoaderSMA.cpp +++ b/src/NotesLoaderSMA.cpp @@ -330,7 +330,7 @@ void SMALoader::LoadFromSMATokens( out.m_StepsType = GAMEMAN->StringToStepsType( sStepsType ); out.SetDescription( sDescription ); out.SetCredit( sDescription ); // this is often used for both. - out.SetDifficulty( DwiCompatibleStringToDifficulty(sDifficulty) ); + out.SetDifficulty( StringToDifficulty(sDifficulty) ); sDescription.MakeLower(); diff --git a/src/NotesLoaderSSC.cpp b/src/NotesLoaderSSC.cpp index 74015106f5..b576d26ca0 100644 --- a/src/NotesLoaderSSC.cpp +++ b/src/NotesLoaderSSC.cpp @@ -432,7 +432,7 @@ bool SSCLoader::LoadFromSSCFile( const RString &sPath, Song &out, bool bFromCach else if( sValueName=="DIFFICULTY" ) { - pNewNotes->SetDifficulty( DwiCompatibleStringToDifficulty( sParams[1] ) ); + pNewNotes->SetDifficulty( StringToDifficulty( sParams[1] ) ); } else if( sValueName=="METER" ) @@ -673,7 +673,7 @@ bool SSCLoader::LoadEditFromMsd( const MsdFile &msd, const RString &sEditFilePat else if( sValueName=="DIFFICULTY" ) { - pNewNotes->SetDifficulty( DwiCompatibleStringToDifficulty( sParams[1] ) ); + pNewNotes->SetDifficulty( StringToDifficulty( sParams[1] ) ); bSSCFormat = true; } diff --git a/src/ScreenEvaluation.cpp b/src/ScreenEvaluation.cpp index de756c34fc..1f87fe4b97 100644 --- a/src/ScreenEvaluation.cpp +++ b/src/ScreenEvaluation.cpp @@ -357,7 +357,7 @@ void ScreenEvaluation::Init() SET_XY( m_sprPercentFrame[p] ); this->AddChild( m_sprPercentFrame[p] ); - /* Use "ScreenEvaluation Percent" for the [metric set], but position and + /* Use "ScreenEvaluation Percent" in the [metrics], but position and * tween it with "PercentP1X", etc. */ m_Percent[p].SetName( ssprintf("PercentP%d",p+1) ); m_Percent[p].Load( GAMESTATE->m_pPlayerState[p], &m_pStageStats->m_player[p], "ScreenEvaluation Percent", true ); @@ -404,7 +404,8 @@ void ScreenEvaluation::Init() ActorUtil::LoadAllCommands( m_sprActualBar[p][r], m_sName ); SET_XY( m_sprActualBar[p][r] ); - // .99999 is fairly close to 1.00, so we use that + // .99999 is fairly close to 1.00, so we use that. + // todo: allow extra commands for AAA/AAAA? -aj if( m_pStageStats->m_player[p].m_radarActual[r] > 0.99999f ) m_sprActualBar[p][r].RunCommands( BAR_ACTUAL_MAX_COMMAND ); this->AddChild( &m_sprActualBar[p][r] ); @@ -546,12 +547,12 @@ void ScreenEvaluation::Init() SET_XY( m_textDetailText[l][p] ); this->AddChild( &m_textDetailText[l][p] ); - static const int indeces[NUM_DetailLine] = + static const int indices[NUM_DetailLine] = { RadarCategory_TapsAndHolds, RadarCategory_Jumps, RadarCategory_Holds, RadarCategory_Mines, RadarCategory_Hands, RadarCategory_Rolls, RadarCategory_Lifts, RadarCategory_Fakes }; - const int ind = indeces[l]; + const int ind = indices[l]; const int iActual = lrintf(m_pStageStats->m_player[p].m_radarActual[ind]); const int iPossible = lrintf(m_pStageStats->m_player[p].m_radarPossible[ind]); diff --git a/src/arch/InputHandler/InputHandler_DirectInput.cpp b/src/arch/InputHandler/InputHandler_DirectInput.cpp index 4fb78dee35..9817a88d0d 100644 --- a/src/arch/InputHandler/InputHandler_DirectInput.cpp +++ b/src/arch/InputHandler/InputHandler_DirectInput.cpp @@ -417,17 +417,24 @@ void InputHandler_DInput::UpdatePolled( DIDevice &device, const RageTimer &tm ) val = state.lZ; //LOG->Trace("MouseWheel polled: %i",val); INPUTFILTER->UpdateMouseWheel(val); - - /* - if( (int)val != 0 ) + if( val == 0 ) + { + // release all + ButtonPressed( DeviceInput(dev, pos, 0, tm) ); + ButtonPressed( DeviceInput(dev, neg, 0, tm) ); + } + else if( int(val) > 0 ) { // positive values: WheelUp - // negative values: WheelDown - float l = SCALE( int(val), -120.0f, 120.0f, -1.0f, 1.0f ); - ButtonPressed( DeviceInput(dev, neg, max(-l,0), tm) ); - ButtonPressed( DeviceInput(dev, pos, max(+l,0), tm) ); + ButtonPressed( DeviceInput(dev, pos, 1, tm) ); + ButtonPressed( DeviceInput(dev, neg, 0, tm) ); + } + else if( int(val) < 0 ) + { + // negative values: WheelDown + ButtonPressed( DeviceInput(dev, neg, 1, tm) ); + ButtonPressed( DeviceInput(dev, pos, 0, tm) ); } - */ } break; default: LOG->MapLog( "unknown input", @@ -529,26 +536,37 @@ void InputHandler_DInput::UpdateBuffered( DIDevice &device, const RageTimer &tm INPUTFILTER->UpdateMouseWheel(l); { up = MOUSE_WHEELUP; down = MOUSE_WHEELDOWN; + float fWheelDelta = l; //l = SCALE( int(evtbuf[i].dwData), -WHEEL_DELTA, WHEEL_DELTA, 1.0f, -1.0f ); - if( int(evtbuf[i].dwData) > 0 ) + if( l > 0 ) { - DeviceInput diUp = DeviceInput(dev, up, 1, tm); - ButtonPressed( diUp ); - DeviceInput diDown = DeviceInput(dev, down, 0, tm); - ButtonPressed( diDown ); + DeviceInput diUp = DeviceInput(dev, up, 1.0f, tm); + DeviceInput diDown = DeviceInput(dev, down, 0.0f, tm); + while( fWheelDelta >= WHEEL_DELTA ) + { + ButtonPressed( diUp ); + ButtonPressed( diDown ); + INPUTFILTER->UpdateMouseWheel(fWheelDelta); + fWheelDelta -= WHEEL_DELTA; + } } - else if( int(evtbuf[i].dwData) < 0 ) + else if( l < 0 ) { - DeviceInput diDown = DeviceInput(dev, down, 1, tm); - ButtonPressed( diDown ); - DeviceInput diUp = DeviceInput(dev, up, 0, tm); - ButtonPressed( diUp ); + DeviceInput diDown = DeviceInput(dev, down, 1.0f, tm); + DeviceInput diUp = DeviceInput(dev, up, 0.0f, tm); + while( fWheelDelta <= -WHEEL_DELTA ) + { + ButtonPressed( diDown ); + ButtonPressed( diUp ); + INPUTFILTER->UpdateMouseWheel(fWheelDelta); + fWheelDelta += WHEEL_DELTA; + } } else { - DeviceInput diUp = DeviceInput(dev, up, 0, tm); + DeviceInput diUp = DeviceInput(dev, up, 0.0f, tm); ButtonPressed( diUp ); - DeviceInput diDown = DeviceInput(dev, down, 0, tm); + DeviceInput diDown = DeviceInput(dev, down, 0.0f, tm); ButtonPressed( diDown ); } }