[default -> splittiming] That's a lot.

This commit is contained in:
Jason Felds
2011-05-15 06:09:33 -04:00
9 changed files with 100 additions and 59 deletions
-29
View File
@@ -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<LocalizedString> g_CourseDifficultyName[NUM_Difficulty];
-2
View File
@@ -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. */
+26 -1
View File
@@ -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<char *>(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<OptionColumnEntry> g_OptionColumnEntries;
*/
// todo: metric these? -aj
static const OptionColumnEntry g_OptionColumnEntries[] =
{
+28
View File
@@ -10,6 +10,7 @@
#include "GameInput.h"
#include "NotesLoader.h"
#include "PrefsManager.h"
#include "Difficulty.h"
#include <map>
@@ -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.
+1 -1
View File
@@ -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...)
+1 -1
View File
@@ -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();
+2 -2
View File
@@ -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;
}
+5 -4
View File
@@ -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]);
@@ -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
ButtonPressed( DeviceInput(dev, pos, 1, tm) );
ButtonPressed( DeviceInput(dev, neg, 0, tm) );
}
else if( int(val) < 0 )
{
// 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, 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 );
}
}