Bring light into the shadow...variables.

Yeah, yeah, can't make a good joke at 2:30 AM.
This commit is contained in:
Jason Felds
2011-03-14 02:36:48 -04:00
parent 650653b4d2
commit d855d8c7e8
18 changed files with 81 additions and 80 deletions
+2 -2
View File
@@ -519,8 +519,8 @@ bool Course::GetTrailUnsorted( StepsType st, CourseDifficulty cd, Trail &trail )
if( e->iChooseIndex < int(vSongAndSteps.size()) )
{
resolved.pSong = vpSongs[e->iChooseIndex];
const vector<Steps*> &vpSongs = mapSongToSteps[resolved.pSong];
resolved.pSteps = vpSongs[ RandomInt(vpSongs.size()) ];
const vector<Steps*> &mappedSongs = mapSongToSteps[resolved.pSong];
resolved.pSteps = mappedSongs[ RandomInt(mappedSongs.size()) ];
}
else
{
+3 -3
View File
@@ -155,15 +155,15 @@ void ModIconRow::SetFromGameState()
continue; // skip
// search for a vacant spot
for( int i=iPerferredCol; i<NUM_OPTION_ICONS; i++ )
for( int j=iPerferredCol; j<NUM_OPTION_ICONS; j++ )
{
if( vsText[i] != "" )
if( vsText[j] != "" )
{
continue;
}
else
{
vsText[i] = sOption;
vsText[j] = sOption;
break;
}
}
+2 -2
View File
@@ -847,9 +847,9 @@ void NoteData::GetTapNoteRangeExclusive( int iTrack, int iStartRow, int iEndRow,
--prev;
if( prev->second.type == TapNote::hold_head )
{
int iStartRow = prev->first;
int localStartRow = prev->first;
const TapNote &tn = prev->second;
if( iStartRow + tn.iDuration >= iEndRow )
if( localStartRow + tn.iDuration >= iEndRow )
end = prev;
}
}
+12 -12
View File
@@ -476,9 +476,9 @@ static bool LoadFromBMSFile( const RString &sPath, const NameToData_t &mapNameTo
if( sNoteId != "00" )
{
vTapNotes.push_back( TAP_ORIGINAL_TAP );
map<RString,int>::const_iterator it = idToKeySoundIndex.find( sNoteId );
if( it != idToKeySoundIndex.end() )
vTapNotes.back().iKeysoundIndex = it->second;
map<RString,int>::const_iterator rInt = idToKeySoundIndex.find( sNoteId );
if( rInt != idToKeySoundIndex.end() )
vTapNotes.back().iKeysoundIndex = rInt->second;
}
else
{
@@ -762,28 +762,28 @@ static void ReadGlobalTags( const NameToData_t &mapNameToData, Song &out, Measur
continue;
// this is keysound file name. Looks like "#WAV1A"
RString sData = it->second;
RString nData = it->second;
RString sWavID = sName.Right(2);
/* Due to bugs in some programs, many BMS files have a "WAV" extension
* on files in the BMS for files that actually have some other extension.
* Do a search. Don't do a wildcard search; if sData is "song.wav",
* we might also have "song.png", which we shouldn't match. */
if( !IsAFile(out.GetSongDir()+sData) )
if( !IsAFile(out.GetSongDir()+nData) )
{
const char *exts[] = { "oga", "ogg", "wav", "mp3", NULL }; // XXX: stop duplicating these everywhere
for( unsigned i = 0; exts[i] != NULL; ++i )
{
RString fn = SetExtension( sData, exts[i] );
RString fn = SetExtension( nData, exts[i] );
if( IsAFile(out.GetSongDir()+fn) )
{
sData = fn;
nData = fn;
break;
}
}
}
if( !IsAFile(out.GetSongDir()+sData) )
LOG->UserLog( "Song file", out.GetSongDir(), "references key \"%s\" that can't be found", sData.c_str() );
if( !IsAFile(out.GetSongDir()+nData) )
LOG->UserLog( "Song file", out.GetSongDir(), "references key \"%s\" that can't be found", nData.c_str() );
sWavID.MakeUpper(); // HACK: undo the MakeLower()
out.m_vsKeysoundFile.push_back( sData );
@@ -807,11 +807,11 @@ static void ReadGlobalTags( const NameToData_t &mapNameToData, Song &out, Measur
float fBeatsPerMeasure = GetBeatsPerMeasure( mapMeasureToTimeSig, iMeasureNo, sigAdjustmentsOut );
int iRowsPerMeasure = BeatToNoteRow( fBeatsPerMeasure );
RString sData = it->second;
int totalPairs = sData.size() / 2;
RString nData = it->second;
int totalPairs = nData.size() / 2;
for( int i = 0; i < totalPairs; ++i )
{
RString sPair = sData.substr( i*2, 2 );
RString sPair = nData.substr( i*2, 2 );
int iVal = 0;
if( sscanf( sPair, "%x", &iVal ) == 0 || iVal == 0 )
+5 -5
View File
@@ -750,9 +750,9 @@ static bool LoadFromMidi( const RString &sPath, Song &songOut )
if( uVelocity == 0 )
midiEventType = note_off;
MidiEvent event = { count, midiEventType };
MidiEvent mEvent = { count, midiEventType };
//float fBeat = NoteRowToBeat( MidiCountToNoteRow(count) );
vMidiEvent[uNoteNumber].push_back( event );
vMidiEvent[uNoteNumber].push_back( mEvent );
}
break;
default:
@@ -850,13 +850,13 @@ skip_track:
// hold note ending on the same row as a tap note.
NoteData::TrackMap::iterator begin, end;
noteData.GetTapNoteRangeInclusive( nnt, MidiCountToNoteRow(count), MidiCountToNoteRow(count), begin, end, true );
for( NoteData::TrackMap::iterator iter = begin; iter != end; iter++ )
for( NoteData::TrackMap::iterator lIter = begin; lIter != end; lIter++ )
{
// if( gd == expert && fBeat >= 27*4-2 && nnt == green )
// LOG->Trace( "shortening hold at %f, length %d", fBeat, length );
ASSERT( iter->second.type == TapNote::hold_head );
iter->second.iDuration = MidiCountToNoteRow(count) - iter->first - 2;
ASSERT( lIter->second.type == TapNote::hold_head );
lIter->second.iDuration = MidiCountToNoteRow(count) - lIter->first - 2;
}
noteData.SetTapNote( nnt, MidiCountToNoteRow(count), tn );
+14 -14
View File
@@ -408,9 +408,9 @@ static bool LoadFromPMSFile( const RString &sPath, const NameToData_t &mapNameTo
if( sNoteId != "00" )
{
vTapNotes.push_back( TAP_ORIGINAL_TAP );
map<RString,int>::const_iterator it = idToKeySoundIndex.find( sNoteId );
if( it != idToKeySoundIndex.end() )
vTapNotes.back().iKeysoundIndex = it->second;
map<RString,int>::const_iterator rInt = idToKeySoundIndex.find( sNoteId );
if( rInt != idToKeySoundIndex.end() )
vTapNotes.back().iKeysoundIndex = rInt->second;
}
else
{
@@ -609,31 +609,31 @@ static void ReadGlobalTags( const NameToData_t &mapNameToData, Song &out, Measur
continue;
// this is keysound file name. Looks like "#WAV1A"
RString sData = it->second;
RString nData = it->second;
RString sWavID = sName.Right(2);
/* Due to bugs in some programs, many PMS files have a "WAV" extension
* on files in the PMS for files that actually have some other extension.
* Do a search. Don't do a wildcard search; if sData is "song.wav",
* we might also have "song.png", which we shouldn't match. */
if( !IsAFile(out.GetSongDir()+sData) )
if( !IsAFile(out.GetSongDir()+nData) )
{
const char *exts[] = { "oga", "ogg", "wav", "mp3", NULL }; // XXX: stop duplicating these everywhere
for( unsigned i = 0; exts[i] != NULL; ++i )
{
RString fn = SetExtension( sData, exts[i] );
RString fn = SetExtension( nData, exts[i] );
if( IsAFile(out.GetSongDir()+fn) )
{
sData = fn;
nData = fn;
break;
}
}
}
if( !IsAFile(out.GetSongDir()+sData) )
LOG->UserLog( "Song file", out.GetSongDir(), "references key \"%s\" that can't be found", sData.c_str() );
if( !IsAFile(out.GetSongDir()+nData) )
LOG->UserLog( "Song file", out.GetSongDir(), "references key \"%s\" that can't be found", nData.c_str() );
sWavID.MakeUpper(); // HACK: undo the MakeLower()
out.m_vsKeysoundFile.push_back( sData );
out.m_vsKeysoundFile.push_back( nData );
idToKeySoundIndexOut[ sWavID ] = out.m_vsKeysoundFile.size()-1;
LOG->Trace( "Inserting keysound index %u '%s'", unsigned(out.m_vsKeysoundFile.size()-1), sWavID.c_str() );
}
@@ -654,11 +654,11 @@ static void ReadGlobalTags( const NameToData_t &mapNameToData, Song &out, Measur
float fBeatsPerMeasure = GetBeatsPerMeasure( mapMeasureToTimeSig, iMeasureNo, sigAdjustmentsOut );
int iRowsPerMeasure = BeatToNoteRow( fBeatsPerMeasure );
RString sData = it->second;
int totalPairs = sData.size() / 2;
RString nData = it->second;
int totalPairs = nData.size() / 2;
for( int i = 0; i < totalPairs; ++i )
{
RString sPair = sData.substr( i*2, 2 );
RString sPair = nData.substr( i*2, 2 );
int iVal = 0;
if( sscanf( sPair, "%x", &iVal ) == 0 || iVal == 0 )
@@ -738,7 +738,7 @@ static void ReadGlobalTags( const NameToData_t &mapNameToData, Song &out, Measur
{
// XXX: offset
int iBPMNo;
sscanf( sData, "%x", &iBPMNo ); // data is in hexadecimal
sscanf( nData, "%x", &iBPMNo ); // data is in hexadecimal
RString sBPM;
RString sTagToLookFor = ssprintf( "#bpm%02x", iBPMNo );
+2 -2
View File
@@ -413,9 +413,9 @@ void SMLoader::LoadTimingFromSMFile( const MsdFile &msd, TimingData &out )
if(arrayWarpsFromNegativeBPMs.size() > 0)
{
// zomg we already have some warps...
for( unsigned i=0; i<arrayWarpsFromNegativeBPMs.size(); i++ )
for( unsigned j=0; j<arrayWarpsFromNegativeBPMs.size(); j++ )
{
out.AddWarpSegment( arrayWarpsFromNegativeBPMs[i] );
out.AddWarpSegment( arrayWarpsFromNegativeBPMs[j] );
}
}
// warp sorting will need to take place.
+1 -1
View File
@@ -603,7 +603,7 @@ void OptionRow::UpdateEnabledDisabled()
case LAYOUT_SHOW_ONE_IN_ROW:
FOREACH_HumanPlayer( pn )
{
bool bRowEnabled = m_pHand->m_Def.m_vEnabledForPlayers.find(pn) != m_pHand->m_Def.m_vEnabledForPlayers.end();
bRowEnabled = m_pHand->m_Def.m_vEnabledForPlayers.find(pn) != m_pHand->m_Def.m_vEnabledForPlayers.end();
if( !m_pHand->m_Def.m_bOneChoiceForAllPlayers )
{
+12 -12
View File
@@ -146,9 +146,9 @@ void OptionListRow::SetUnderlines( const vector<bool> &aSelections, const Option
else if( pTarget->m_Def.m_selectType == SELECT_MULTIPLE )
{
const vector<bool> &bTargetSelections = m_pOptions->m_bSelections.find(sDest)->second;
for( unsigned i=0; i<bTargetSelections.size(); i++ )
for( unsigned j=0; j<bTargetSelections.size(); j++ )
{
if( bTargetSelections[i] )
if( bTargetSelections[j] )
bSelected = true;
}
}
@@ -400,10 +400,10 @@ void OptionsList::Input( const InputEventPlus &input )
wrap( iSelection, bTargetSelections.size() );
SelectItem( sDest, iSelection );
Message msg("OptionsListQuickChange");
msg.SetParam( "Player", pn );
msg.SetParam( "Direction", iDir );
MESSAGEMAN->Broadcast( msg );
Message lMsg("OptionsListQuickChange");
lMsg.SetParam( "Player", pn );
lMsg.SetParam( "Direction", iDir );
MESSAGEMAN->Broadcast( lMsg );
}
}
return;
@@ -426,9 +426,9 @@ void OptionsList::Input( const InputEventPlus &input )
wrap( m_iMenuStackSelection, pHandler->m_Def.m_vsChoices.size()+1 ); // +1 for exit row
PositionCursor();
Message msg("OptionsListLeft");
msg.SetParam( "Player", input.pn );
MESSAGEMAN->Broadcast( msg );
Message lMsg("OptionsListLeft");
lMsg.SetParam( "Player", input.pn );
MESSAGEMAN->Broadcast( lMsg );
return;
}
else if( input.MenuI == GAME_BUTTON_RIGHT )
@@ -447,9 +447,9 @@ void OptionsList::Input( const InputEventPlus &input )
wrap( m_iMenuStackSelection, pHandler->m_Def.m_vsChoices.size()+1 ); // +1 for exit row
PositionCursor();
Message msg("OptionsListRight");
msg.SetParam( "Player", input.pn );
MESSAGEMAN->Broadcast( msg );
Message lMsg("OptionsListRight");
lMsg.SetParam( "Player", input.pn );
MESSAGEMAN->Broadcast( lMsg );
return;
}
else if( input.MenuI == GAME_BUTTON_START )
+5 -5
View File
@@ -2810,16 +2810,16 @@ void Player::CrossedRows( int iLastRowCrossed, const RageTimer &now )
int iNumHoldsMissedThisRow = 0;
// start at r-1 so that we consider holds whose end rows are equal to the checkpoint row
NoteData::all_tracks_iterator iter = m_NoteData.GetTapNoteRangeAllTracks( r-1, r, true );
for( ; !iter.IsAtEnd(); ++iter )
NoteData::all_tracks_iterator nIter = m_NoteData.GetTapNoteRangeAllTracks( r-1, r, true );
for( ; !nIter.IsAtEnd(); ++nIter )
{
TapNote &tn = *iter;
TapNote &tn = *nIter;
if( tn.type != TapNote::hold_head )
continue;
int iStartRow = iter.Row();
int iStartRow = nIter.Row();
int iEndRow = iStartRow + tn.iDuration;
int iTrack = iter.Track();
int iTrack = nIter.Track();
// "the first row after the hold head that lands on a beat"
int iFirstCheckpointOfHold = ((iStartRow+iCheckpointFrequencyRows)/iCheckpointFrequencyRows) * iCheckpointFrequencyRows;
+2 -2
View File
@@ -575,8 +575,8 @@ float RageFastSin( float x )
bInited = true;
for( unsigned i=0; i<ARRAYLEN(table); i++ )
{
float x = SCALE(i,0,ARRAYLEN(table),0.0f,PI);
table[i] = sinf(x);
float z = SCALE(i,0,ARRAYLEN(table),0.0f,PI);
table[i] = sinf(z);
}
}
+3 -3
View File
@@ -383,14 +383,14 @@ void ScreenOptionsEditCourse::SetCurrentSong()
}
else
{
int iRow = m_iCurrentRow[PLAYER_1];
iRow = m_iCurrentRow[PLAYER_1];
int iEntryIndex = RowToEntryIndex( iRow );
Song *pSong = NULL;
if( iEntryIndex != -1 )
{
int iCurrentSongRow = EntryIndexAndRowTypeToRow(iEntryIndex,RowType_Song);
OptionRow &row = *m_pRows[ iCurrentSongRow ];
int index = row.GetOneSelection(PLAYER_1);
OptionRow &oRow = *m_pRows[ iCurrentSongRow ];
int index = oRow.GetOneSelection(PLAYER_1);
if( index != 0 )
pSong = m_vpSongs[ index - 1 ];
}
+1 -1
View File
@@ -142,7 +142,7 @@ void ScreenOptionsManageCourses::BeginScreen()
vector<Course*>::const_iterator iter = find( m_vpCourses.begin(), m_vpCourses.end(), GAMESTATE->m_pCurCourse );
if( iter != m_vpCourses.end() )
{
int iIndex = iter - m_vpCourses.begin();
iIndex = iter - m_vpCourses.begin();
this->MoveRowAbsolute( GAMESTATE->m_MasterPlayerNumber, 1 + iIndex );
}
}
+1 -1
View File
@@ -110,7 +110,7 @@ void ScreenOptionsManageEditSteps::BeginScreen()
vector<Steps*>::const_iterator iter = find( m_vpSteps.begin(), m_vpSteps.end(), GAMESTATE->m_pCurSteps[PLAYER_1] );
if( iter != m_vpSteps.end() )
{
int iIndex = iter - m_vpSteps.begin();
iIndex = iter - m_vpSteps.begin();
this->MoveRowAbsolute( PLAYER_1, 1 + iIndex );
}
}
+3 -2
View File
@@ -197,8 +197,9 @@ void ScreenOptionsMemoryCard::ProcessMenuStart( const InputEventPlus &input )
const vector<UsbStorageDevice> &v = m_CurrentUsbStorageDevices;
if( iCurRow < int(v.size()) ) // a card
{
const vector<UsbStorageDevice> &v = m_CurrentUsbStorageDevices;
const UsbStorageDevice &dev = v[iCurRow];
// Why is this statement in twice? Doubt it would change right after the if. -Wolfman2000
const vector<UsbStorageDevice> &vUSB = m_CurrentUsbStorageDevices;
const UsbStorageDevice &dev = vUSB[iCurRow];
MEMCARDMAN->m_sEditorMemoryCardOsMountPoint.Set( dev.sOsMountDir );
/* The destination screen must UnmountCard. XXX: brittle */
+6 -6
View File
@@ -669,21 +669,21 @@ namespace
continue;
}
RString sName;
LuaHelpers::Pop( L, sName );
NodeNamesToAdd.push_back( sName );
RString nName;
LuaHelpers::Pop( L, nName );
NodeNamesToAdd.push_back( nName );
NodesToAdd.push_back( LuaReference() );
NodesToAdd.back().SetFromStack( L );
continue;
}
RString sName;
LuaHelpers::Pop( L, sName );
RString nName;
LuaHelpers::Pop( L, nName );
// Otherwise, add an attribute.
XNodeLuaValue *pValue = new XNodeLuaValue;
pValue->SetValueFromStack( L );
pNode->AppendAttrFrom( sName, pValue );
pNode->AppendAttrFrom( nName, pValue );
}
lua_pop( L, 1 );
@@ -425,10 +425,10 @@ wchar_t InputHandler_MacOSX_HID::DeviceButtonToChar( DeviceButton button, bool b
if( KeyLayout )
{
UInt32 keyboardType = LMGetKbdType();
UInt32 modifiers = bUseCurrentKeyModifiers ? GetCurrentKeyModifiers() : 0;
UInt32 nModifiers = bUseCurrentKeyModifiers ? GetCurrentKeyModifiers() : 0;
UniChar unicodeInputString[4];
UniCharCount length;
OSStatus status = UCKeyTranslate( *KeyLayout, iMacVirtualKey, kUCKeyActionDown, modifiers,
OSStatus status = UCKeyTranslate( *KeyLayout, iMacVirtualKey, kUCKeyActionDown, nModifiers,
keyboardType, 0, &iDeadKeyState, ARRAYLEN(unicodeInputString),
&length, unicodeInputString );
@@ -193,10 +193,10 @@ RString MovieDecoder_Theora::ProcessHeaders()
while(1)
{
ogg_packet op;
int ret = ogg_stream_packetpeek( &m_OggStream, &op );
if( ret == 0 )
int ret2 = ogg_stream_packetpeek( &m_OggStream, &op );
if( ret2 == 0 )
break;
if( ret < 0 )
if( ret2 < 0 )
return ssprintf( "error opening %s: error parsing Theora stream headers", m_File.GetPath().c_str() );
if( !theora_packet_isheader(&op) )
@@ -208,8 +208,8 @@ RString MovieDecoder_Theora::ProcessHeaders()
return RString();
}
ret = theora_decode_header( &m_TheoraInfo, &m_TheoraComment, &op);
if( ret < 0 && ret != OC_NEWPACKET )
ret2 = theora_decode_header( &m_TheoraInfo, &m_TheoraComment, &op);
if( ret2 < 0 && ret2 != OC_NEWPACKET )
return ssprintf( "error opening %s: error parsing Theora stream headers", m_File.GetPath().c_str() );
ogg_stream_packetout( &m_OggStream, NULL );