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
+2 -4
View File
@@ -9,7 +9,6 @@ public:
void Load( const RString &sCommand ); void Load( const RString &sCommand );
RString GetOriginalCommandString() const; // used when reporting an error in number of args 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(); } void Clear() { m_vsArgs.clear(); }
@@ -33,9 +32,8 @@ public:
// Take a command list string and return pointers to each of the tokens in the // 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 ';'. // string. sCommand list is a list of commands separated by ';'.
// TODO: This is expensive to do during the game. Eventually, // TODO: This is expensive to do during the game. Eventually, move all calls to
// move all calls to ParseCommands to happen during load, then execute // ParseCommands to happen during load, then execute from the parsed Command structures.
// from the parsed Command structures.
void ParseCommands( const RString &sCmds, Commands &vCmdsOut ); void ParseCommands( const RString &sCmds, Commands &vCmdsOut );
Commands ParseCommands( const RString &sCmds ); 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 ); 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") ) else if( 0 == stricmp(sValueName, "MODS") )
{ {
+6 -8
View File
@@ -21,11 +21,10 @@ XToString( Difficulty );
StringToX( Difficulty ); StringToX( Difficulty );
LuaXType( Difficulty ); LuaXType( Difficulty );
/* We prefer the above names; recognize a number of others, too. (They'll /* We prefer the above names; recognize a number of others, too. (They'll get
* get normalized when written to SMs, etc.) */ * normalized when written to SMs, etc.) TODO: Format specific hacks should be
/* TODO: Format specific hacks should be moved into the file loader for * moved into the file loader for that format. We don't want to carry these
* that format. We don't want to carry these hacks forward to file * hacks forward to file formats that don't need them. */
* formats that don't need them. */
Difficulty DwiCompatibleStringToDifficulty( const RString& sDC ) Difficulty DwiCompatibleStringToDifficulty( const RString& sDC )
{ {
RString s2 = sDC; RString s2 = sDC;
@@ -51,7 +50,6 @@ Difficulty DwiCompatibleStringToDifficulty( const RString& sDC )
else return Difficulty_Invalid; else return Difficulty_Invalid;
} }
const RString &CourseDifficultyToLocalizedString( CourseDifficulty x ) const RString &CourseDifficultyToLocalizedString( CourseDifficulty x )
{ {
static auto_ptr<LocalizedString> g_CourseDifficultyName[NUM_Difficulty]; 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 * sure what the correct behavior in this case should be. Should we still
* allow custom difficulties? Why do we not allow custom difficulties for * allow custom difficulties? Why do we not allow custom difficulties for
* Couple, Routine, or Edit? - Steve */ * 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 ) if( st == StepsType_Invalid )
{ {
/* This is not totally necessary since DifficultyToString() will /* 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 ); return GetCustomDifficulty( pTrail->m_StepsType, pTrail->m_CourseDifficulty, pTrail->m_CourseType );
} }
#include "LuaBinding.h" #include "LuaBinding.h"
LuaFunction( StepsToCustomDifficulty, StepsToCustomDifficulty(Luna<Steps>::check(L, 1)) ); LuaFunction( StepsToCustomDifficulty, StepsToCustomDifficulty(Luna<Steps>::check(L, 1)) );
LuaFunction( TrailToCustomDifficulty, TrailToCustomDifficulty(Luna<Trail>::check(L, 1)) ); LuaFunction( TrailToCustomDifficulty, TrailToCustomDifficulty(Luna<Trail>::check(L, 1)) );
/* /*
* (c) 2001-2004 Chris Danford * (c) 2001-2004 Chris Danford
* All rights reserved. * 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 ) 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.SetName( "Row" );
m_Lines[m].m_Meter.Load( "StepsDisplayListRow", NULL ); m_Lines[m].m_Meter.Load( "StepsDisplayListRow", NULL );
this->AddChild( &m_Lines[m].m_Meter ); this->AddChild( &m_Lines[m].m_Meter );
+2 -2
View File
@@ -2606,7 +2606,7 @@ static const Game g_Game_Popn =
/** Guitar5 ******************************************************************/ /** Guitar5 ******************************************************************/
//ThemeMetric<int> GUITAR5_COL_SPACING ("ColumnSpacing","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 = static const Style g_Style_Guitar_Five =
{ // STYLE_GUITAR_FIVE { // STYLE_GUITAR_FIVE
@@ -3051,7 +3051,7 @@ StepsType GameManager::StringToStepsType( RString sStepsType )
sStepsType.MakeLower(); sStepsType.MakeLower();
// TODO: Format specific hacks should be moved into the file loader for that format. // 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. // HACK: We eliminated "ez2-single-hard", but we should still handle it.
if( sStepsType == "ez2-single-hard" ) if( sStepsType == "ez2-single-hard" )
+4 -4
View File
@@ -89,13 +89,13 @@ static const OptionColumnEntry g_OptionColumnEntries[] =
{"Sudden", 2}, {"Sudden", 2},
{"Stealth", 2}, {"Stealth", 2},
{"Blink", 2}, {"Blink", 2},
{"RandomVanish", 2}, {"RandomVanish",2},
//--------------------// //--------------------//
{"Mirror", 3}, {"Mirror", 3},
{"Left", 3}, {"Left", 3},
{"Right", 3}, {"Right", 3},
{"Shuffle", 3}, {"Shuffle", 3},
{"SuperShuffle", 3}, {"SuperShuffle",3},
//--------------------// //--------------------//
{"Little", 4}, {"Little", 4},
{"NoHolds", 4}, {"NoHolds", 4},
@@ -116,7 +116,7 @@ static const OptionColumnEntry g_OptionColumnEntries[] =
int OptionToPreferredColumn( RString sOptionText ) int OptionToPreferredColumn( RString sOptionText )
{ {
/* Speedups always go in column 0. digit ... x */ // Speedups always go in column 0. digit ... x
if( sOptionText.size() > 1 && if( sOptionText.size() > 1 &&
isdigit(sOptionText[0]) && isdigit(sOptionText[0]) &&
tolower(sOptionText[sOptionText.size()-1]) == 'x' ) tolower(sOptionText[sOptionText.size()-1]) == 'x' )
@@ -128,7 +128,7 @@ int OptionToPreferredColumn( RString sOptionText )
if( g_OptionColumnEntries[i].szString == sOptionText ) if( g_OptionColumnEntries[i].szString == sOptionText )
return g_OptionColumnEntries[i].iSlotIndex; 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() ); // LOG->Warn("Unknown option: '%s'", sOptionText.c_str() );
return 0; return 0;
} }
+2 -2
View File
@@ -18,8 +18,8 @@
static RString BackgroundChangeToString( const BackgroundChange &bgc ) static RString BackgroundChangeToString( const BackgroundChange &bgc )
{ {
// TODO: Technically we need to double-escape the filename (because it might contain '=') and then // TODO: Technically we need to double-escape the filename (because it might
// unescape the value returned by the MsdFile. // contain '=') and then unescape the value returned by the MsdFile.
RString s = ssprintf( RString s = ssprintf(
"%.3f=%s=%.3f=%d=%d=%d=%s=%s=%s=%s=%s", "%.3f=%s=%.3f=%d=%d=%d=%s=%s=%s=%s=%s",
bgc.m_fStartBeat, bgc.m_fStartBeat,
+21 -23
View File
@@ -661,7 +661,7 @@ const BitmapText &OptionRow::GetTextItemForRow( PlayerNumber pn, int iChoiceOnRo
{ {
case LAYOUT_SHOW_ONE_IN_ROW: case LAYOUT_SHOW_ONE_IN_ROW:
index = bOneChoice ? 0 : pn; 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 ) if( m_textItems.size() == 1 )
index = 0; index = 0;
break; break;
@@ -685,7 +685,6 @@ void OptionRow::GetWidthXY( PlayerNumber pn, int iChoiceOnRow, int &iWidthOut, i
iYOut = lrintf( m_Frame.GetDestY() ); iYOut = lrintf( m_Frame.GetDestY() );
} }
int OptionRow::GetOneSelection( PlayerNumber pn, bool bAllowFail ) const int OptionRow::GetOneSelection( PlayerNumber pn, bool bAllowFail ) const
{ {
for( unsigned i=0; i<m_vbSelected[pn].size(); i++ ) for( unsigned i=0; i<m_vbSelected[pn].size(); i++ )
@@ -761,14 +760,12 @@ void OptionRow::ResetFocusFromSelection( PlayerNumber pn )
switch( m_pHand->m_Def.m_selectType ) switch( m_pHand->m_Def.m_selectType )
{ {
case SELECT_ONE: case SELECT_ONE:
/* Import the focus from the selected option. */ // Import the focus from the selected option.
iSelection = GetOneSelection( pn, true ); iSelection = GetOneSelection( pn, true );
break; break;
} }
//
// HACK: Set focus to one item in the row, which is "go down" // HACK: Set focus to one item in the row, which is "go down"
//
if( m_bFirstItemGoesDown ) if( m_bFirstItemGoesDown )
iSelection = 0; iSelection = 0;
@@ -809,12 +806,14 @@ void OptionRow::SetExitText( RString sExitText )
void OptionRow::Reload() void OptionRow::Reload()
{ {
// TODO: Nothing uses this yet and it causes skips when changing options. // TODO: Nothing uses this yet and it causes skips when changing options.
//if( m_pHand->m_Def.m_bExportOnChange ) /*
//{ if( m_pHand->m_Def.m_bExportOnChange )
// bool bRowHasFocus[NUM_PLAYERS]; {
// ZERO( bRowHasFocus ); bool bRowHasFocus[NUM_PLAYERS];
// ExportOptions( vpns, bRowHasFocus ); ZERO( bRowHasFocus );
//} ExportOptions( vpns, bRowHasFocus );
}
*/
switch( m_pHand->Reload() ) switch( m_pHand->Reload() )
{ {
@@ -841,14 +840,15 @@ void OptionRow::Reload()
break; break;
} }
// TODO: Nothing uses this yet and it causes skips when changing options. // TODO: Nothing uses this yet and it causes skips when changing options.
//if( m_pHand->m_Def.m_bExportOnChange ) /*
//{ if( m_pHand->m_Def.m_bExportOnChange )
// bool bRowHasFocus[NUM_PLAYERS]; {
// ZERO( bRowHasFocus ); bool bRowHasFocus[NUM_PLAYERS];
// ExportOptions( vpns, bRowHasFocus ); ZERO( bRowHasFocus );
//} ExportOptions( vpns, bRowHasFocus );
}
*/
} }
void OptionRow::HandleMessage( const Message &msg ) 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 /* Hack: the NextRow entry is never set, and should be transparent.
* it, and readd it below. */ * Remove it, and readd it below. */
#define ERASE_ONE_BOOL_AT_FRONT_IF_NEEDED( vbSelected ) \ #define ERASE_ONE_BOOL_AT_FRONT_IF_NEEDED( vbSelected ) \
if( GetFirstItemGoesDown() ) \ if( GetFirstItemGoesDown() ) \
vbSelected.erase( vbSelected.begin() ); vbSelected.erase( vbSelected.begin() );
@@ -916,8 +916,7 @@ int OptionRow::ExportOptions( const vector<PlayerNumber> &vpns, bool bRowHasFocu
ASSERT( m_vbSelected[p].size() == m_pHand->m_Def.m_vsChoices.size() ); ASSERT( m_vbSelected[p].size() == m_pHand->m_Def.m_vsChoices.size() );
ERASE_ONE_BOOL_AT_FRONT_IF_NEEDED( m_vbSelected[p] ); ERASE_ONE_BOOL_AT_FRONT_IF_NEEDED( m_vbSelected[p] );
// SELECT_NONE rows get exported if they have focus when the user presses // SELECT_NONE rows get exported if they have focus when the user presses Start.
// Start.
int iChoice = GetChoiceInRowWithFocus( p ); int iChoice = GetChoiceInRowWithFocus( p );
if( m_pHand->m_Def.m_selectType == SELECT_NONE && bFocus ) if( m_pHand->m_Def.m_selectType == SELECT_NONE && bFocus )
m_vbSelected[p][iChoice] = true; m_vbSelected[p][iChoice] = true;
@@ -940,7 +939,6 @@ int OptionRow::ExportOptions( const vector<PlayerNumber> &vpns, bool bRowHasFocu
return iChangeMask; return iChangeMask;
} }
/* /*
* (c) 2001-2004 Chris Danford * (c) 2001-2004 Chris Danford
* All rights reserved. * All rights reserved.
+2 -1
View File
@@ -745,7 +745,8 @@ class OptionRowHandlerListDifficulties: public OptionRowHandlerList
FOREACH_CONST( Difficulty, CommonMetrics::DIFFICULTIES_TO_SHOW.GetValue(), d ) 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) ); RString s = CustomDifficultyToLocalizedString( GetCustomDifficulty(st, *d, CourseType_Invalid) );
m_Def.m_vsChoices.push_back( s ); m_Def.m_vsChoices.push_back( s );