comment/whitespace editing

This commit is contained in:
AJ Kelly
2011-02-09 17:42:16 -06:00
parent d27ac32bb1
commit 0755d0f3b9
10 changed files with 66 additions and 71 deletions
+4 -6
View File
@@ -9,8 +9,7 @@ public:
void Load( const RString &sCommand );
RString GetOriginalCommandString() const; // used when reporting an error in number of args
RString GetName() const; // the command name is the first argument in all-lowercase
RString GetName() const; // the command name is the first argument in all-lowercase
void Clear() { m_vsArgs.clear(); }
@@ -32,10 +31,9 @@ public:
};
// Take a command list string and return pointers to each of the tokens in the
// string. sCommand list is a list of commands separated by ';'.
// TODO: This is expensive to do during the game. Eventually,
// move all calls to ParseCommands to happen during load, then execute
// from the parsed Command structures.
// string. sCommand list is a list of commands separated by ';'.
// TODO: This is expensive to do during the game. Eventually, move all calls to
// ParseCommands to happen during load, then execute from the parsed Command structures.
void ParseCommands( const RString &sCmds, Commands &vCmdsOut );
Commands ParseCommands( const RString &sCmds );
+1 -1
View File
@@ -99,7 +99,7 @@ bool CourseLoaderCRS::LoadFromMsd( const RString &sPath, const MsdFile &msd, Cou
out.m_iCustomMeter[cd] = max( atoi(sParams[2]), 0 );
}
}
// todo: add COMBO and COMBOMODE? -aj
// todo: add COMBO and COMBOMODE from DWI CRS files? -aj
else if( 0 == stricmp(sValueName, "MODS") )
{
+19 -21
View File
@@ -21,37 +21,35 @@ 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. */
/* 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;
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 == "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 == "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 == "expert" ) return Difficulty_Challenge;
else if( s2 == "oni" ) return Difficulty_Challenge;
else if( s2 == "edit" ) return Difficulty_Edit;
else return Difficulty_Invalid;
else return Difficulty_Invalid;
}
const RString &CourseDifficultyToLocalizedString( CourseDifficulty x )
{
static auto_ptr<LocalizedString> g_CourseDifficultyName[NUM_Difficulty];
@@ -86,6 +84,8 @@ RString GetCustomDifficulty( StepsType st, Difficulty dc, CourseType ct )
* sure what the correct behavior in this case should be. Should we still
* allow custom difficulties? Why do we not allow custom difficulties for
* Couple, Routine, or Edit? - Steve */
// CustomDifficulty for Edit defeats the purpose of the edit's name.
// I don't know the other two. -aj
if( st == StepsType_Invalid )
{
/* This is not totally necessary since DifficultyToString() will
@@ -161,13 +161,11 @@ RString TrailToCustomDifficulty( const Trail *pTrail )
return GetCustomDifficulty( pTrail->m_StepsType, pTrail->m_CourseDifficulty, pTrail->m_CourseType );
}
#include "LuaBinding.h"
LuaFunction( StepsToCustomDifficulty, StepsToCustomDifficulty(Luna<Steps>::check(L, 1)) );
LuaFunction( TrailToCustomDifficulty, TrailToCustomDifficulty(Luna<Trail>::check(L, 1)) );
/*
* (c) 2001-2004 Chris Danford
* All rights reserved.
+1 -1
View File
@@ -78,7 +78,7 @@ void StepsDisplayList::LoadFromNode( const XNode* pNode )
for( unsigned m = 0; m < m_Lines.size(); ++m )
{
// todo: Row1, Row2? also m_sName+"Row" -aj
// todo: Use Row1, Row2 for names? also m_sName+"Row" -aj
m_Lines[m].m_Meter.SetName( "Row" );
m_Lines[m].m_Meter.Load( "StepsDisplayListRow", NULL );
this->AddChild( &m_Lines[m].m_Meter );
+2 -2
View File
@@ -2606,7 +2606,7 @@ static const Game g_Game_Popn =
/** Guitar5 ******************************************************************/
//ThemeMetric<int> GUITAR5_COL_SPACING ("ColumnSpacing","Guitar5");
static const int GUITAR5_COL_SPACING = 48; // todo: get a proper value? -aj
static const int GUITAR5_COL_SPACING = 48;
static const Style g_Style_Guitar_Five =
{ // STYLE_GUITAR_FIVE
@@ -3051,7 +3051,7 @@ StepsType GameManager::StringToStepsType( RString sStepsType )
sStepsType.MakeLower();
// TODO: Format specific hacks should be moved into the file loader for that format.
// If i'm assuming this correctly, these only apply to .sm files: -aj
// If i'm assuming this correctly, these two only apply to .sm files: -aj
// HACK: We eliminated "ez2-single-hard", but we should still handle it.
if( sStepsType == "ez2-single-hard" )
+1 -1
View File
@@ -69,7 +69,7 @@ void ModIcon::Set( const RString &_sText )
m_sprEmpty->SetVisible( bVacant );
m_text.SetText( sText );
// This line makes Lua option rows crash: -aj
// This line makes Lua option rows crash: -aj
m_text.CropToWidth( CROP_TEXT_TO_WIDTH );
}
+8 -8
View File
@@ -77,7 +77,7 @@ static const OptionColumnEntry g_OptionColumnEntries[] =
{"Brake", 0},
{"Wave", 0},
{"Expand", 0},
{"Boomerang", 0},
{"Boomerang", 0},
//--------------------//
{"Drunk", 1},
{"Dizzy", 1},
@@ -89,13 +89,13 @@ static const OptionColumnEntry g_OptionColumnEntries[] =
{"Sudden", 2},
{"Stealth", 2},
{"Blink", 2},
{"RandomVanish", 2},
{"RandomVanish",2},
//--------------------//
{"Mirror", 3},
{"Left", 3},
{"Right", 3},
{"Shuffle", 3},
{"SuperShuffle", 3},
{"SuperShuffle",3},
//--------------------//
{"Little", 4},
{"NoHolds", 4},
@@ -104,11 +104,11 @@ static const OptionColumnEntry g_OptionColumnEntries[] =
//--------------------//
{"Reverse", 5},
{"Split", 5},
{"Alternate", 5},
{"Alternate", 5},
{"Cross", 5},
{"Centered", 5},
{"Centered", 5},
//--------------------//
{"Incoming", 6},
{"Incoming", 6},
{"Space", 6},
{"Hallway", 6},
{"Distant", 6},
@@ -116,7 +116,7 @@ static const OptionColumnEntry g_OptionColumnEntries[] =
int OptionToPreferredColumn( RString sOptionText )
{
/* Speedups always go in column 0. digit ... x */
// Speedups always go in column 0. digit ... x
if( sOptionText.size() > 1 &&
isdigit(sOptionText[0]) &&
tolower(sOptionText[sOptionText.size()-1]) == 'x' )
@@ -128,7 +128,7 @@ int OptionToPreferredColumn( RString sOptionText )
if( g_OptionColumnEntries[i].szString == sOptionText )
return g_OptionColumnEntries[i].iSlotIndex;
/* This warns about C1234 and noteskins. */
// This warns about C1234 and noteskins.
// LOG->Warn("Unknown option: '%s'", sOptionText.c_str() );
return 0;
}
+2 -2
View File
@@ -18,8 +18,8 @@
static RString BackgroundChangeToString( const BackgroundChange &bgc )
{
// TODO: Technically we need to double-escape the filename (because it might contain '=') and then
// unescape the value returned by the MsdFile.
// TODO: Technically we need to double-escape the filename (because it might
// contain '=') and then unescape the value returned by the MsdFile.
RString s = ssprintf(
"%.3f=%s=%.3f=%d=%d=%d=%s=%s=%s=%s=%s",
bgc.m_fStartBeat,
+26 -28
View File
@@ -661,7 +661,7 @@ const BitmapText &OptionRow::GetTextItemForRow( PlayerNumber pn, int iChoiceOnRo
{
case LAYOUT_SHOW_ONE_IN_ROW:
index = bOneChoice ? 0 : pn;
/* If only P2 is enabled, his selections will be in index 0. */
// If only P2 is enabled, his selections will be in index 0.
if( m_textItems.size() == 1 )
index = 0;
break;
@@ -685,14 +685,13 @@ void OptionRow::GetWidthXY( PlayerNumber pn, int iChoiceOnRow, int &iWidthOut, i
iYOut = lrintf( m_Frame.GetDestY() );
}
int OptionRow::GetOneSelection( PlayerNumber pn, bool bAllowFail ) const
{
for( unsigned i=0; i<m_vbSelected[pn].size(); i++ )
if( m_vbSelected[pn][i] )
return i;
ASSERT( bAllowFail ); // shouldn't call this if not expecting one to be selected
ASSERT( bAllowFail ); // shouldn't call this if not expecting one to be selected
return -1;
}
@@ -761,14 +760,12 @@ void OptionRow::ResetFocusFromSelection( PlayerNumber pn )
switch( m_pHand->m_Def.m_selectType )
{
case SELECT_ONE:
/* Import the focus from the selected option. */
// Import the focus from the selected option.
iSelection = GetOneSelection( pn, true );
break;
}
//
// HACK: Set focus to one item in the row, which is "go down"
//
if( m_bFirstItemGoesDown )
iSelection = 0;
@@ -809,12 +806,14 @@ void OptionRow::SetExitText( RString sExitText )
void OptionRow::Reload()
{
// TODO: Nothing uses this yet and it causes skips when changing options.
//if( m_pHand->m_Def.m_bExportOnChange )
//{
// bool bRowHasFocus[NUM_PLAYERS];
// ZERO( bRowHasFocus );
// ExportOptions( vpns, bRowHasFocus );
//}
/*
if( m_pHand->m_Def.m_bExportOnChange )
{
bool bRowHasFocus[NUM_PLAYERS];
ZERO( bRowHasFocus );
ExportOptions( vpns, bRowHasFocus );
}
*/
switch( m_pHand->Reload() )
{
@@ -841,14 +840,15 @@ void OptionRow::Reload()
break;
}
// TODO: Nothing uses this yet and it causes skips when changing options.
//if( m_pHand->m_Def.m_bExportOnChange )
//{
// bool bRowHasFocus[NUM_PLAYERS];
// ZERO( bRowHasFocus );
// ExportOptions( vpns, bRowHasFocus );
//}
/*
if( m_pHand->m_Def.m_bExportOnChange )
{
bool bRowHasFocus[NUM_PLAYERS];
ZERO( bRowHasFocus );
ExportOptions( vpns, bRowHasFocus );
}
*/
}
void OptionRow::HandleMessage( const Message &msg )
@@ -866,8 +866,8 @@ void OptionRow::HandleMessage( const Message &msg )
}
/* Hack: the NextRow entry is never set, and should be transparent. Remove
* it, and readd it below. */
/* Hack: the NextRow entry is never set, and should be transparent.
* Remove it, and readd it below. */
#define ERASE_ONE_BOOL_AT_FRONT_IF_NEEDED( vbSelected ) \
if( GetFirstItemGoesDown() ) \
vbSelected.erase( vbSelected.begin() );
@@ -889,7 +889,7 @@ void OptionRow::ImportOptions( const vector<PlayerNumber> &vpns )
ASSERT( m_vbSelected[p].size() == m_pHand->m_Def.m_vsChoices.size() );
ERASE_ONE_BOOL_AT_FRONT_IF_NEEDED( m_vbSelected[p] );
}
m_pHand->ImportOption( this, vpns, m_vbSelected );
FOREACH_CONST( PlayerNumber, vpns, iter )
@@ -906,7 +906,7 @@ int OptionRow::ExportOptions( const vector<PlayerNumber> &vpns, bool bRowHasFocu
ASSERT( m_pHand->m_Def.m_vsChoices.size() > 0 );
int iChangeMask = 0;
FOREACH_CONST( PlayerNumber, vpns, iter )
{
PlayerNumber p = *iter;
@@ -916,15 +916,14 @@ int OptionRow::ExportOptions( const vector<PlayerNumber> &vpns, bool bRowHasFocu
ASSERT( m_vbSelected[p].size() == m_pHand->m_Def.m_vsChoices.size() );
ERASE_ONE_BOOL_AT_FRONT_IF_NEEDED( m_vbSelected[p] );
// SELECT_NONE rows get exported if they have focus when the user presses
// Start.
// SELECT_NONE rows get exported if they have focus when the user presses Start.
int iChoice = GetChoiceInRowWithFocus( p );
if( m_pHand->m_Def.m_selectType == SELECT_NONE && bFocus )
m_vbSelected[p][iChoice] = true;
}
iChangeMask |= m_pHand->ExportOption( vpns, m_vbSelected );
FOREACH_CONST( PlayerNumber, vpns, iter )
{
PlayerNumber p = *iter;
@@ -933,14 +932,13 @@ int OptionRow::ExportOptions( const vector<PlayerNumber> &vpns, bool bRowHasFocu
int iChoice = GetChoiceInRowWithFocus( p );
if( m_pHand->m_Def.m_selectType == SELECT_NONE && bFocus )
m_vbSelected[p][iChoice] = false;
INSERT_ONE_BOOL_AT_FRONT_IF_NEEDED( m_vbSelected[p] );
}
return iChangeMask;
}
/*
* (c) 2001-2004 Chris Danford
* All rights reserved.
+2 -1
View File
@@ -745,7 +745,8 @@ class OptionRowHandlerListDifficulties: public OptionRowHandlerList
FOREACH_CONST( Difficulty, CommonMetrics::DIFFICULTIES_TO_SHOW.GetValue(), d )
{
StepsType st = GAMEMAN->GetHowToPlayStyleForGame( GAMESTATE->m_pCurGame )->m_StepsType; // TODO: Is this the best thing we can do here?
// TODO: Is this the best thing we can do here?
StepsType st = GAMEMAN->GetHowToPlayStyleForGame( GAMESTATE->m_pCurGame )->m_StepsType;
RString s = CustomDifficultyToLocalizedString( GetCustomDifficulty(st, *d, CourseType_Invalid) );
m_Def.m_vsChoices.push_back( s );